[jalview] 01/01: Imported Upstream version 2.9+dfsg
Michael Crusoe
misterc-guest at moszumanska.debian.org
Mon Feb 8 08:36:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
misterc-guest pushed a commit to annotated tag upstream/2.9+dfsg
in repository jalview.
commit 3415f678bf3068c41f3581aea21b41b731f9b044
Author: Michael R. Crusoe <crusoe at ucdavis.edu>
Date: Sun Feb 7 12:25:06 2016 -0800
Imported Upstream version 2.9+dfsg
---
JalviewApplet.jpx | 150 +-
JalviewX.jpx | 94 +-
README | 2 +-
build.xml | 1329 ++--
doc/AddingGroovySupport.html | 7 +-
doc/AnnotationPostAnalysis.txt | 59 +
doc/JalviewRNASupport.html | 84 +
doc/UnitTesting.html | 111 +
doc/biojsmsa-templates.html | 101 +
doc/building.html | 12 +-
doc/developing.html | 83 +-
doc/i18n.html | 96 +
doc/index.html | 307 +-
doc/newdmobj.html | 73 +-
help/help.hs | 104 +-
help/help.jhm | 56 +-
help/helpTOC.html | 45 +-
help/helpTOC.xml | 274 +-
help/html/Jalview_Logo.png | Bin 0 -> 15420 bytes
help/html/calculations/consensus.html | 73 +-
help/html/calculations/conservation.html | 91 +-
help/html/calculations/pairwise.html | 55 +-
help/html/calculations/pca.html | 187 +-
help/html/calculations/pcaviewer.gif | Bin 0 -> 27629 bytes
help/html/calculations/quality.html | 69 +-
help/html/calculations/recoverInputdata.html | 35 +-
help/html/calculations/redundancy.html | 37 +-
help/html/calculations/referenceseq.html | 50 +
help/html/calculations/scorematrices.html | 1662 +++++
help/html/calculations/sorting.html | 131 +-
help/html/calculations/structureconsensus.html | 54 +
help/html/calculations/tree.html | 177 +-
help/html/calculations/treeviewer.html | 210 +-
help/html/colourSchemes/abovePID.html | 33 +-
.../html/colourSchemes/annotationColourSetting.gif | Bin 0 -> 13891 bytes
.../html/colourSchemes/annotationColourSetting.jpg | Bin 43293 -> 0 bytes
help/html/colourSchemes/annotationColouring.html | 124 +-
help/html/colourSchemes/annotationColours.gif | Bin 0 -> 23564 bytes
help/html/colourSchemes/annotationColours.jpg | Bin 107885 -> 0 bytes
help/html/colourSchemes/blosum.html | 30 +-
help/html/colourSchemes/buried.html | 97 +-
help/html/colourSchemes/clustal.html | 139 +-
help/html/colourSchemes/colbytcoffee.png | Bin 0 -> 137157 bytes
help/html/colourSchemes/conservation.html | 70 +-
help/html/colourSchemes/helix.html | 97 +-
help/html/colourSchemes/hydrophobic.html | 104 +-
help/html/colourSchemes/index.html | 647 +-
help/html/colourSchemes/nucleotide.html | 43 +-
help/html/colourSchemes/pid.html | 60 +-
help/html/colourSchemes/purinepyrimidine.html | 48 +
help/html/colourSchemes/rnahelicesColouring.html | 68 +
help/html/colourSchemes/rnahelicescoloring.png | Bin 0 -> 34699 bytes
help/html/colourSchemes/strand.html | 97 +-
help/html/colourSchemes/taylor.html | 95 +-
help/html/colourSchemes/textcolour.html | 47 +-
help/html/colourSchemes/turn.html | 97 +-
help/html/colourSchemes/user.html | 66 +-
help/html/colourSchemes/userDefined_java6.gif | Bin 0 -> 42343 bytes
help/html/colourSchemes/userDefined_java7.gif | Bin 0 -> 38939 bytes
help/html/colourSchemes/zappo.html | 90 +-
help/html/editing/index.html | 152 +-
.../features/AnnotationColumnSelectionWithSM.gif | Bin 0 -> 42694 bytes
.../AnnotationColumnSelectionWithoutSM.gif | Bin 0 -> 37778 bytes
help/html/features/annotation.html | 65 +-
help/html/features/annotationsFormat.html | 559 +-
help/html/features/bioJsonFormat.html | 83 +
help/html/features/biojsmsa.html | 58 +
help/html/features/chimera.html | 254 +
help/html/features/clarguments.html | 404 +-
help/html/features/codingfeatures.html | 72 +-
help/html/features/columnFilterByAnnotation.html | 83 +
help/html/features/commandline.html | 91 +-
help/html/features/creatinFeatures.html | 84 +-
help/html/features/cursorMode.html | 123 +-
help/html/features/dasfeatures.html | 98 +-
help/html/features/dassettings.html | 91 +-
help/html/features/editingFeatures.html | 65 +-
help/html/features/featuresFormat.html | 311 +-
help/html/features/featureschemes.html | 139 +-
help/html/features/featuresettings.html | 168 +-
help/html/features/groovy.html | 193 +-
help/html/features/hiddenRegions.html | 176 +-
help/html/features/jalarchive.html | 43 +-
help/html/features/jmol.html | 494 +-
help/html/features/multipleViews.html | 136 +-
help/html/features/newkeystrokes.html | 76 +-
help/html/features/overview.html | 38 +-
help/html/features/pdbseqfetcher.png | Bin 0 -> 97462 bytes
help/html/features/pdbsequencefetcher.html | 103 +
help/html/features/pdbviewer.html | 296 +-
help/html/features/preferences.html | 468 +-
help/html/features/schooser_enter-id.png | Bin 0 -> 29766 bytes
help/html/features/schooser_main.png | Bin 0 -> 58895 bytes
help/html/features/search.html | 201 +-
help/html/features/selectfetchdb.gif | Bin 0 -> 41486 bytes
help/html/features/seqfeatures.html | 157 +-
help/html/features/seqfetch.html | 135 +-
help/html/features/seqfetcher.gif | Bin 8702 -> 11434 bytes
help/html/features/seqmappings.html | 85 +-
help/html/features/splitView.html | 163 +
help/html/features/structurechooser.html | 127 +
help/html/features/varna.html | 93 +
help/html/features/viewingpdbs.html | 226 +-
help/html/features/wrap.html | 637 +-
help/html/features/xsspannotation.html | 96 +
help/html/index.html | 108 +-
help/html/io/export.html | 112 +-
help/html/io/exportseqreport.html | 59 +
help/html/io/fileformats.html | 130 +-
help/html/io/index.html | 144 +-
help/html/io/modellerpir.html | 76 +-
help/html/io/seqreport.gif | Bin 0 -> 25151 bytes
help/html/io/tcoffeescores.html | 84 +
help/html/jalviewjnlp.html | 78 -
help/html/keys.html | 568 +-
help/html/memory.html | 212 +-
help/html/menus/alignmentMenu.html | 1199 +--
help/html/menus/alwannotation.html | 91 +
help/html/menus/alwannotationpanel.html | 117 +
help/html/menus/alwannotations.html | 87 -
help/html/menus/alwcalculate.html | 184 +-
help/html/menus/alwcolour.html | 89 +-
help/html/menus/alwedit.html | 180 +-
help/html/menus/alwfile.html | 214 +-
help/html/menus/alwformat.html | 116 +-
help/html/menus/alwselect.html | 88 +-
help/html/menus/alwview.html | 129 +-
help/html/menus/desktopMenu.html | 234 +-
help/html/menus/index.html | 52 +-
help/html/menus/popupMenu.html | 320 +-
help/html/menus/wsmenu.html | 163 +-
help/html/misc/aaproperties.html | 54 +-
help/html/misc/aminoAcids.html | 529 +-
help/html/misc/geneticCode.html | 153 +-
help/html/na/index.html | 124 +
help/html/privacy.html | 127 +-
help/html/releases.html | 3120 +++++---
help/html/vamsas/index.html | 256 +-
help/html/webServices/AACon.html | 74 +
help/html/webServices/JABAWS.html | 106 +-
help/html/webServices/RNAalifold.html | 89 +
help/html/webServices/RNAalifoldAnnotationRows.png | Bin 0 -> 31732 bytes
help/html/webServices/dbreffetcher.html | 174 +-
help/html/webServices/index.html | 157 +-
help/html/webServices/jnet.html | 217 +-
help/html/webServices/msaclient.html | 129 +-
help/html/webServices/newsreader.html | 64 +-
help/html/webServices/proteinDisorder.html | 253 +
help/html/webServices/shmr.html | 103 +-
help/html/webServices/urllinks.html | 157 +-
help/html/webServices/webServicesParams.html | 150 +-
help/html/webServices/webServicesPrefs.html | 146 +-
help/html/webServices/wsprefs.gif | Bin 18473 -> 23662 bytes
help/html/whatsNew.html | 152 +-
jalview-jalopy.xml | 7 +-
nbbuild.xml | 38 +-
nbproject/genfiles.properties | 12 +-
nbproject/project.properties | 24 +-
nbproject/project.xml | 37 +-
resources/authors.props | 4 +
resources/embl_mapping.xml | 310 +-
resources/images/JalviewLogo_Huge.png | Bin 0 -> 53903 bytes
resources/images/JalviewLogo_big.png | Bin 0 -> 4539 bytes
resources/images/Jalview_Logo.png | Bin 0 -> 15420 bytes
resources/images/Jalview_Logo_small.png | Bin 0 -> 1687 bytes
resources/images/dna.png | Bin 0 -> 895 bytes
resources/images/error.png | Bin 0 -> 633 bytes
resources/images/good.png | Bin 0 -> 965 bytes
resources/images/loading.gif | Bin 0 -> 1849 bytes
resources/images/logo.gif | Bin 615 -> 14501 bytes
resources/images/logo_big.gif | Bin 6804 -> 16656 bytes
resources/images/{logo_big.gif => logo_big_v2.gif} | Bin
resources/images/{logo.gif => logo_v2.gif} | Bin
resources/images/protein.png | Bin 0 -> 524 bytes
resources/images/sugar.png | Bin 0 -> 542 bytes
resources/images/warning.gif | Bin 0 -> 239 bytes
resources/lang/Messages.properties | 1282 ++++
resources/lang/Messages_es.properties | 1136 +++
resources/uniprot_mapping.xml | 7 +-
schemas/JalviewUserColours.xsd | 30 +-
schemas/JalviewWsParamSet.xsd | 7 +-
schemas/castor-mapping.xsd | 629 +-
schemas/jalview.nodesc.properties | 43 +-
schemas/jalview.properties | 43 +-
schemas/jalview.xsd | 730 +-
schemas/jalviewJvV1.xsd | 325 +-
schemas/vamsas.xsd | 18 +-
schemas/vamsasJvV1.xsd | 183 +-
src/MCview/AppletPDBCanvas.java | 244 +-
src/MCview/AppletPDBViewer.java | 87 +-
src/MCview/Atom.java | 55 +-
src/MCview/Bond.java | 33 +-
src/MCview/MCMatrix.java | 13 +-
src/MCview/PDBCanvas.java | 252 +-
src/MCview/PDBChain.java | 405 +-
src/MCview/PDBViewer.java | 163 +-
src/MCview/PDBfile.java | 423 +-
src/MCview/Residue.java | 29 +-
src/MCview/Zsort.java | 36 +-
src/com/github/reinert/jjschema/Attributes.java | 68 +
src/com/stevesoft/pat/Any.java | 2 +-
src/com/stevesoft/pat/BackG.java | 2 +-
src/com/stevesoft/pat/BackMatch.java | 2 +-
src/com/stevesoft/pat/Backup.java | 2 +-
src/com/stevesoft/pat/Bits.java | 4 +-
src/com/stevesoft/pat/Boundary.java | 2 +-
src/com/stevesoft/pat/Bracket.java | 3 +-
src/com/stevesoft/pat/Ctrl.java | 97 +-
src/com/stevesoft/pat/Custom.java | 6 +-
src/com/stevesoft/pat/CustomEndpoint.java | 2 +-
src/com/stevesoft/pat/DotMulti.java | 2 +-
src/com/stevesoft/pat/End.java | 2 +-
src/com/stevesoft/pat/FastBracket.java | 3 +-
src/com/stevesoft/pat/FastMulti.java | 2 +-
src/com/stevesoft/pat/FileRegex.java | 81 +-
src/com/stevesoft/pat/Group.java | 2 +-
src/com/stevesoft/pat/Multi.java | 8 +-
src/com/stevesoft/pat/Multi_stage2.java | 2 +-
src/com/stevesoft/pat/NoPattern.java | 2 +-
src/com/stevesoft/pat/NullPattern.java | 2 +-
src/com/stevesoft/pat/Or.java | 3 +-
src/com/stevesoft/pat/OrMark.java | 2 +-
src/com/stevesoft/pat/Pattern.java | 10 +-
src/com/stevesoft/pat/Pthings.java | 2 +-
src/com/stevesoft/pat/PushRule.java | 5 +-
src/com/stevesoft/pat/Range.java | 2 +-
src/com/stevesoft/pat/RegOpt.java | 4 +-
src/com/stevesoft/pat/RegRes.java | 4 +-
src/com/stevesoft/pat/Regex.java | 73 +-
src/com/stevesoft/pat/RegexReader.java | 5 +-
src/com/stevesoft/pat/RegexTokenizer.java | 3 +-
src/com/stevesoft/pat/RegexWriter.java | 56 +-
src/com/stevesoft/pat/ReplaceRule.java | 2 +-
src/com/stevesoft/pat/Replacer.java | 8 +-
src/com/stevesoft/pat/Skip.java | 4 +-
src/com/stevesoft/pat/SkipBMH.java | 10 +-
src/com/stevesoft/pat/Skipped.java | 6 +-
src/com/stevesoft/pat/Start.java | 2 +-
src/com/stevesoft/pat/StringLike.java | 8 +-
src/com/stevesoft/pat/Transformer.java | 8 +-
src/com/stevesoft/pat/lookAhead.java | 2 +-
src/com/stevesoft/pat/oneChar.java | 2 +-
.../stevesoft/pat/wrap/CharArrayBufferWrap.java | 3 +-
src/com/stevesoft/pat/wrap/CharArrayWrap.java | 3 +-
.../stevesoft/pat/wrap/RandomAccessFileWrap.java | 18 +-
src/com/stevesoft/pat/wrap/StringBufferWrap.java | 3 +-
src/com/stevesoft/pat/wrap/StringWrap.java | 3 +-
src/com/stevesoft/pat/wrap/WriterWrap.java | 6 +-
src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java | 951 +++
src/ext/edu/ucsf/rbvi/strucviz2/ChimeraChain.java | 372 +
.../edu/ucsf/rbvi/strucviz2/ChimeraManager.java | 899 +++
src/ext/edu/ucsf/rbvi/strucviz2/ChimeraModel.java | 557 ++
.../edu/ucsf/rbvi/strucviz2/ChimeraResidue.java | 456 ++
.../rbvi/strucviz2/ChimeraStructuralObject.java | 112 +
.../edu/ucsf/rbvi/strucviz2/ChimeraTreeModel.java | 216 +
.../edu/ucsf/rbvi/strucviz2/StructureManager.java | 960 +++
.../edu/ucsf/rbvi/strucviz2/StructureSettings.java | 30 +
.../ucsf/rbvi/strucviz2/port/ListenerThreads.java | 302 +
src/ext/vamsas/IRegistry.java | 13 +-
src/ext/vamsas/IRegistryService.java | 13 +-
src/ext/vamsas/IRegistryServiceLocator.java | 27 +-
src/ext/vamsas/Jpred.java | 13 +-
src/ext/vamsas/JpredService.java | 13 +-
src/ext/vamsas/JpredServiceLocator.java | 27 +-
src/ext/vamsas/JpredSoapBindingStub.java | 27 +-
src/ext/vamsas/MuscleWS.java | 13 +-
src/ext/vamsas/MuscleWSService.java | 13 +-
src/ext/vamsas/MuscleWSServiceLocator.java | 27 +-
src/ext/vamsas/MuscleWSSoapBindingStub.java | 28 +-
src/ext/vamsas/RegistryServiceSoapBindingStub.java | 16 +-
src/ext/vamsas/SeqSearchI.java | 77 +-
src/ext/vamsas/SeqSearchServiceLocator.java | 373 +-
src/ext/vamsas/SeqSearchServiceService.java | 61 +-
.../vamsas/SeqSearchServiceSoapBindingStub.java | 977 +--
src/ext/vamsas/ServiceHandle.java | 19 +-
src/ext/vamsas/ServiceHandles.java | 19 +-
src/jalview/analysis/AAFrequency.java | 594 +-
src/jalview/analysis/AlignSeq.java | 445 +-
src/jalview/analysis/AlignmentAnnotationUtils.java | 243 +
src/jalview/analysis/AlignmentSorter.java | 193 +-
src/jalview/analysis/AlignmentUtils.java | 1424 ++++
src/jalview/analysis/AnnotationSorter.java | 416 ++
src/jalview/analysis/CodingUtils.java | 139 +
src/jalview/analysis/CodonComparator.java | 111 +
src/jalview/analysis/Conservation.java | 142 +-
src/jalview/analysis/CrossRef.java | 1188 ++-
src/jalview/analysis/Dna.java | 1525 ++--
src/jalview/analysis/Finder.java | 55 +-
src/jalview/analysis/Grouping.java | 142 +-
src/jalview/analysis/NJTree.java | 191 +-
src/jalview/analysis/PCA.java | 140 +-
src/jalview/analysis/ParseProperties.java | 56 +-
src/jalview/analysis/Rna.java | 284 +
src/jalview/analysis/SecStrConsensus.java | 254 +
src/jalview/analysis/SeqsetUtils.java | 29 +-
src/jalview/analysis/SequenceIdMatcher.java | 144 +-
src/jalview/analysis/StructureFrequency.java | 541 ++
src/jalview/analysis/WUSSParseException.java | 43 +
.../analysis/scoremodels/FeatureScoreModel.java | 158 +
.../analysis/scoremodels/PIDScoreModel.java | 75 +
.../scoremodels/PairwiseSeqScoreModel.java | 80 +
src/jalview/analysis/scoremodels/SWScoreModel.java | 94 +
src/jalview/api/AlignCalcManagerI.java | 161 +
src/jalview/api/AlignCalcWorkerI.java | 33 +
src/jalview/api/AlignExportSettingI.java | 73 +
src/jalview/api/AlignViewControllerGuiI.java | 65 +
src/jalview/api/AlignViewControllerI.java | 98 +
src/jalview/api/AlignViewportI.java | 378 +
src/jalview/api/AlignmentViewPanel.java | 57 +-
src/jalview/api/BuildDetailsI.java | 30 +
src/jalview/api/ComplexAlignFile.java | 69 +
src/jalview/api/FeatureRenderer.java | 153 +-
src/jalview/api/FeatureSettingsControllerI.java | 28 +
src/jalview/api/FeatureSettingsModelI.java | 26 +
src/jalview/api/FeaturesDisplayedI.java | 49 +
src/jalview/api/OOMHandlerI.java | 28 +
src/jalview/api/RotatableCanvasI.java | 39 +
src/jalview/api/SequenceRenderer.java | 15 +-
src/jalview/api/SequenceStructureBinding.java | 34 +-
src/jalview/api/SplitContainerI.java | 58 +
.../api/StructureSelectionManagerProvider.java | 29 +-
src/jalview/api/ViewStyleI.java | 260 +
src/jalview/api/analysis/ScoreModelI.java | 36 +
src/jalview/api/analysis/ViewBasedAnalysisI.java | 37 +
.../api/structures/JalviewStructureDisplayI.java | 65 +
src/jalview/appletgui/APopupMenu.java | 694 +-
src/jalview/appletgui/AlignFrame.java | 7822 +++++++++++---------
src/jalview/appletgui/AlignViewport.java | 1643 +---
src/jalview/appletgui/AlignmentPanel.java | 708 +-
src/jalview/appletgui/AnnotationColourChooser.java | 190 +-
src/jalview/appletgui/AnnotationColumnChooser.java | 945 +++
src/jalview/appletgui/AnnotationLabels.java | 271 +-
src/jalview/appletgui/AnnotationPanel.java | 939 +--
src/jalview/appletgui/AnnotationRowFilter.java | 212 +
src/jalview/appletgui/AppletJmol.java | 238 +-
src/jalview/appletgui/AppletJmolBinding.java | 105 +-
src/jalview/appletgui/CutAndPasteTransfer.java | 362 +-
src/jalview/appletgui/EditNameDialog.java | 20 +-
src/jalview/appletgui/EmbmenuFrame.java | 586 +-
src/jalview/appletgui/ExtJmol.java | 102 +-
src/jalview/appletgui/FeatureColourChooser.java | 94 +-
src/jalview/appletgui/FeatureRenderer.java | 904 +--
src/jalview/appletgui/FeatureSettings.java | 277 +-
src/jalview/appletgui/Finder.java | 98 +-
src/jalview/appletgui/FontChooser.java | 369 +-
src/jalview/appletgui/IdCanvas.java | 123 +-
src/jalview/appletgui/IdPanel.java | 80 +-
src/jalview/appletgui/IdwidthAdjuster.java | 51 +-
src/jalview/appletgui/JVDialog.java | 23 +-
src/jalview/appletgui/OverviewPanel.java | 113 +-
src/jalview/appletgui/PCAPanel.java | 202 +-
src/jalview/appletgui/PaintRefresher.java | 41 +-
src/jalview/appletgui/PairwiseAlignPanel.java | 53 +-
src/jalview/appletgui/RedundancyPanel.java | 139 +-
src/jalview/appletgui/RotatableCanvas.java | 58 +-
src/jalview/appletgui/ScalePanel.java | 116 +-
src/jalview/appletgui/SeqCanvas.java | 291 +-
src/jalview/appletgui/SeqPanel.java | 596 +-
src/jalview/appletgui/SequenceRenderer.java | 127 +-
src/jalview/appletgui/SliderPanel.java | 113 +-
src/jalview/appletgui/SplitFrame.java | 240 +
src/jalview/appletgui/TitledPanel.java | 95 +
src/jalview/appletgui/Tooltip.java | 478 +-
src/jalview/appletgui/TreeCanvas.java | 139 +-
src/jalview/appletgui/TreePanel.java | 113 +-
src/jalview/appletgui/UserDefinedColours.java | 130 +-
src/jalview/bin/BuildDetails.java | 75 +
src/jalview/bin/Cache.java | 342 +-
src/jalview/bin/Jalview.java | 618 +-
src/jalview/bin/JalviewLite.java | 5687 +++++++-------
src/jalview/bin/JalviewLiteURLRetrieve.java | 20 +-
src/jalview/binding/Alignment.java | 322 +-
src/jalview/binding/Annotation.java | 854 +--
src/jalview/binding/AnnotationElement.java | 563 +-
src/jalview/binding/Colour.java | 956 ++-
src/jalview/binding/Feature.java | 561 +-
src/jalview/binding/FeatureSettings.java | 481 +-
src/jalview/binding/Features.java | 195 +-
src/jalview/binding/JGroup.java | 1474 ++--
src/jalview/binding/JSeq.java | 1243 ++--
src/jalview/binding/JalviewModel.java | 426 +-
src/jalview/binding/JalviewModelSequence.java | 1852 ++---
src/jalview/binding/JalviewUserColours.java | 635 +-
src/jalview/binding/Pdbentry.java | 631 +-
src/jalview/binding/PdbentryItem.java | 361 +-
src/jalview/binding/Pdbids.java | 195 +-
src/jalview/binding/Property.java | 322 +-
src/jalview/binding/Sequence.java | 195 +-
src/jalview/binding/SequenceSet.java | 1027 +--
src/jalview/binding/SequenceType.java | 373 +-
src/jalview/binding/Setting.java | 479 +-
src/jalview/binding/Tree.java | 1638 ++--
src/jalview/binding/UserColourScheme.java | 196 +-
src/jalview/binding/UserColours.java | 323 +-
src/jalview/binding/VAMSAS.java | 1158 +--
src/jalview/binding/VamsasModel.java | 194 +-
src/jalview/binding/Viewport.java | 2810 +++----
src/jalview/commands/ChangeCaseCommand.java | 30 +-
src/jalview/commands/CommandI.java | 13 +-
src/jalview/commands/EditCommand.java | 697 +-
src/jalview/commands/OrderCommand.java | 55 +-
src/jalview/commands/RemoveGapColCommand.java | 26 +-
src/jalview/commands/RemoveGapsCommand.java | 28 +-
src/jalview/commands/SlideSequencesCommand.java | 44 +-
src/jalview/commands/TrimRegionCommand.java | 36 +-
src/jalview/controller/AlignViewController.java | 423 ++
.../controller/FeatureSettingsController.java | 35 +
.../controller/FeatureSettingsControllerGuiI.java | 26 +
src/jalview/datamodel/ASequence.java | 33 +
src/jalview/datamodel/ASequenceI.java | 32 +
src/jalview/datamodel/AlignedCodon.java | 108 +
src/jalview/datamodel/AlignedCodonFrame.java | 780 +-
src/jalview/datamodel/Alignment.java | 824 ++-
src/jalview/datamodel/AlignmentAnnotation.java | 682 +-
src/jalview/datamodel/AlignmentExportData.java | 83 +
src/jalview/datamodel/AlignmentI.java | 244 +-
src/jalview/datamodel/AlignmentOrder.java | 56 +-
src/jalview/datamodel/AlignmentView.java | 2389 +++---
src/jalview/datamodel/AnnotatedCollectionI.java | 46 +
src/jalview/datamodel/Annotation.java | 109 +-
src/jalview/datamodel/BinaryNode.java | 13 +-
src/jalview/datamodel/BinarySequence.java | 109 +-
src/jalview/datamodel/CigarArray.java | 780 +-
src/jalview/datamodel/CigarBase.java | 1306 ++--
src/jalview/datamodel/CigarCigar.java | 125 +-
src/jalview/datamodel/CigarSimple.java | 67 +-
src/jalview/datamodel/ColumnSelection.java | 2637 +++----
src/jalview/datamodel/DBRefEntry.java | 34 +-
src/jalview/datamodel/DBRefSource.java | 273 +-
src/jalview/datamodel/FeatureProperties.java | 121 +-
src/jalview/datamodel/GraphLine.java | 29 +-
src/jalview/datamodel/HiddenSequences.java | 89 +-
.../datamodel/IncompleteCodonException.java | 33 +
src/jalview/datamodel/Mapping.java | 329 +-
src/jalview/datamodel/NodeTransformI.java | 13 +-
src/jalview/datamodel/PDBEntry.java | 95 +-
src/jalview/datamodel/Provenance.java | 15 +-
src/jalview/datamodel/ProvenanceEntry.java | 13 +-
src/jalview/datamodel/RnaViewerModel.java | 64 +
src/jalview/datamodel/SearchResults.java | 298 +-
.../datamodel/SecondaryStructureAnnotation.java | 52 +
src/jalview/datamodel/SeqCigar.java | 222 +-
src/jalview/datamodel/Sequence.java | 409 +-
src/jalview/datamodel/SequenceCollectionI.java | 67 +
src/jalview/datamodel/SequenceDummy.java | 53 +
src/jalview/datamodel/SequenceFeature.java | 43 +-
src/jalview/datamodel/SequenceGroup.java | 468 +-
src/jalview/datamodel/SequenceI.java | 150 +-
src/jalview/datamodel/SequenceNode.java | 15 +-
src/jalview/datamodel/SequencePoint.java | 13 +-
src/jalview/datamodel/StructureViewerModel.java | 225 +
src/jalview/datamodel/UniprotEntry.java | 44 +-
src/jalview/datamodel/UniprotFile.java | 25 +-
src/jalview/datamodel/UniprotProteinName.java | 84 +-
src/jalview/datamodel/UniprotSequence.java | 39 +-
src/jalview/datamodel/xdb/embl/BasePosition.java | 19 +-
src/jalview/datamodel/xdb/embl/EmblEntry.java | 216 +-
src/jalview/datamodel/xdb/embl/EmblError.java | 18 +-
src/jalview/datamodel/xdb/embl/EmblFeature.java | 39 +-
.../datamodel/xdb/embl/EmblFeatureLocElement.java | 19 +-
.../datamodel/xdb/embl/EmblFeatureLocations.java | 41 +-
src/jalview/datamodel/xdb/embl/EmblFile.java | 67 +-
src/jalview/datamodel/xdb/embl/EmblSequence.java | 18 +-
src/jalview/datamodel/xdb/embl/Qualifier.java | 21 +-
src/jalview/exceptions/JalviewException.java | 45 +
.../exceptions/NoFileSelectedException.java | 30 +
src/jalview/ext/jmol/JalviewJmolBinding.java | 3001 ++++----
src/jalview/ext/jmol/JmolCommands.java | 332 +-
src/jalview/ext/jmol/PDBFileWithJmol.java | 465 ++
src/jalview/ext/paradise/Annotate3D.java | 248 +
src/jalview/ext/rbvi/chimera/ChimeraCommands.java | 293 +
src/jalview/ext/rbvi/chimera/ChimeraListener.java | 149 +
.../ext/rbvi/chimera/JalviewChimeraBinding.java | 1118 +++
src/jalview/ext/varna/JalviewVarnaBinding.java | 35 +
src/jalview/ext/varna/RnaModel.java | 52 +
src/jalview/ext/varna/VarnaCommands.java | 170 +
src/jalview/gui/AlignExportSettings.java | 118 +
src/jalview/gui/AlignFrame.java | 2999 +++++---
src/jalview/gui/AlignViewport.java | 2457 ++----
src/jalview/gui/AlignmentPanel.java | 1021 ++-
src/jalview/gui/AnnotationChooser.java | 657 ++
src/jalview/gui/AnnotationColourChooser.java | 511 +-
src/jalview/gui/AnnotationColumnChooser.java | 920 +++
src/jalview/gui/AnnotationExporter.java | 611 +-
src/jalview/gui/AnnotationLabels.java | 554 +-
src/jalview/gui/AnnotationPanel.java | 1209 +--
src/jalview/gui/AnnotationRowFilter.java | 401 +
src/jalview/gui/AppJmol.java | 849 +--
src/jalview/gui/AppJmolBinding.java | 142 +-
src/jalview/gui/AppVarna.java | 752 ++
src/jalview/gui/AppVarnaBinding.java | 577 ++
src/jalview/gui/AssociatePdbFileWithSeq.java | 106 +-
src/jalview/gui/BlogReader.java | 87 +-
src/jalview/gui/ChimeraViewFrame.java | 1211 +++
src/jalview/gui/ConservationThread.java | 103 -
src/jalview/gui/Console.java | 42 +-
src/jalview/gui/CutAndPasteHtmlTransfer.java | 244 +
src/jalview/gui/CutAndPasteTransfer.java | 175 +-
src/jalview/gui/DasSourceBrowser.java | 1806 +++--
src/jalview/gui/Desktop.java | 1339 +++-
src/jalview/gui/EPSOptions.java | 47 +-
src/jalview/gui/EditNameDialog.java | 30 +-
src/jalview/gui/FeatureColourChooser.java | 104 +-
src/jalview/gui/FeatureRenderer.java | 1169 +--
src/jalview/gui/FeatureSettings.java | 584 +-
src/jalview/gui/Finder.java | 201 +-
src/jalview/gui/FontChooser.java | 166 +-
src/jalview/gui/HTMLOptions.java | 162 +
src/jalview/gui/Help.java | 110 +
src/jalview/gui/IProgressIndicator.java | 107 +-
src/jalview/gui/IProgressIndicatorHandler.java | 73 +-
src/jalview/gui/IdCanvas.java | 163 +-
src/jalview/gui/IdPanel.java | 251 +-
src/jalview/gui/IdwidthAdjuster.java | 50 +-
src/jalview/gui/JDatabaseTree.java | 573 ++
src/jalview/gui/Jalview2XML.java | 4147 +++++++----
src/jalview/gui/Jalview2XML_V1.java | 980 +--
src/jalview/gui/JalviewAppender.java | 13 +-
src/jalview/gui/JalviewChangeSupport.java | 32 +-
src/jalview/gui/JalviewChimeraBindingModel.java | 138 +
src/jalview/gui/JalviewDialog.java | 99 +-
src/jalview/gui/JvSwingUtils.java | 184 +-
src/jalview/gui/MenuChooser.java | 99 +
src/jalview/gui/OOMWarning.java | 177 +-
src/jalview/gui/OptsAndParamsPage.java | 188 +-
src/jalview/gui/OptsParametersContainerI.java | 26 +-
src/jalview/gui/OverviewPanel.java | 115 +-
src/jalview/gui/PCAPanel.java | 453 +-
src/jalview/gui/PDBSearchPanel.java | 317 +
src/jalview/gui/PaintRefresher.java | 134 +-
src/jalview/gui/PairwiseAlignPanel.java | 50 +-
src/jalview/gui/PopupMenu.java | 1185 ++-
src/jalview/gui/Preferences.java | 583 +-
src/jalview/gui/ProgressBar.java | 255 +
src/jalview/gui/PromptUserConfig.java | 24 +-
src/jalview/gui/RedundancyPanel.java | 157 +-
src/jalview/gui/RestInputParamEditDialog.java | 155 +-
src/jalview/gui/RestServiceEditorPane.java | 318 +-
src/jalview/gui/RotatableCanvas.java | 81 +-
src/jalview/gui/SVGOptions.java | 162 +
src/jalview/gui/ScalePanel.java | 156 +-
src/jalview/gui/ScriptWindow.java | 732 --
src/jalview/gui/SeqCanvas.java | 270 +-
src/jalview/gui/SeqPanel.java | 971 +--
src/jalview/gui/SequenceFetcher.java | 865 ++-
src/jalview/gui/SequenceRenderer.java | 184 +-
src/jalview/gui/SliderPanel.java | 95 +-
src/jalview/gui/SplashScreen.java | 304 +-
src/jalview/gui/SplitFrame.java | 661 ++
src/jalview/gui/StructureChooser.java | 972 +++
src/jalview/gui/StructureViewer.java | 216 +
src/jalview/gui/StructureViewerBase.java | 495 ++
src/jalview/gui/TextColourChooser.java | 100 +-
src/jalview/gui/TreeCanvas.java | 168 +-
src/jalview/gui/TreePanel.java | 190 +-
src/jalview/gui/UserDefinedColours.java | 322 +-
src/jalview/gui/UserQuestionnaireCheck.java | 34 +-
src/jalview/gui/VamsasApplication.java | 63 +-
src/jalview/gui/ViewSelectionMenu.java | 165 +-
src/jalview/gui/WebserviceInfo.java | 170 +-
src/jalview/gui/WsJobParameters.java | 379 +-
src/jalview/gui/WsParamSetManager.java | 43 +-
src/jalview/gui/WsPreferences.java | 303 +-
src/jalview/httpserver/AbstractRequestHandler.java | 205 +
src/jalview/httpserver/HttpServer.java | 300 +
src/jalview/io/AMSAFile.java | 16 +-
src/jalview/io/AlignFile.java | 171 +-
src/jalview/io/AlignmentProperties.java | 35 +-
src/jalview/io/AnnotationFile.java | 3289 ++++----
src/jalview/io/AppletFormatAdapter.java | 420 +-
src/jalview/io/BLCFile.java | 28 +-
src/jalview/io/BioJsHTMLOutput.java | 384 +
src/jalview/io/ClansFile.java | 57 +-
src/jalview/io/ClustalFile.java | 74 +-
src/jalview/io/DBRefFile.java | 91 +-
src/jalview/io/FastaFile.java | 70 +-
src/jalview/io/FeaturesFile.java | 2534 ++++---
src/jalview/io/FileLoader.java | 177 +-
src/jalview/io/FileParse.java | 224 +-
src/jalview/io/FormatAdapter.java | 158 +-
src/jalview/io/Gff3File.java | 174 +
src/jalview/io/HTMLOutput.java | 40 +-
src/jalview/io/HtmlFile.java | 174 +
src/jalview/io/HtmlSvgOutput.java | 682 ++
src/jalview/io/IdentifyFile.java | 192 +-
src/jalview/io/InputStreamParser.java | 57 +
src/jalview/io/JPredFile.java | 39 +-
src/jalview/io/JSONFile.java | 787 ++
src/jalview/io/JalviewFileChooser.java | 119 +-
src/jalview/io/JalviewFileFilter.java | 19 +-
src/jalview/io/JalviewFileView.java | 33 +-
src/jalview/io/JnetAnnotationMaker.java | 210 +-
src/jalview/io/MSFfile.java | 37 +-
src/jalview/io/MatrixFile.java | 69 +-
src/jalview/io/ModellerDescription.java | 94 +-
src/jalview/io/NewickFile.java | 48 +-
src/jalview/io/PIRFile.java | 20 +-
src/jalview/io/PfamFile.java | 28 +-
src/jalview/io/PhylipFile.java | 329 +
src/jalview/io/PileUpfile.java | 31 +-
src/jalview/io/RnamlFile.java | 242 +
src/jalview/io/SequenceAnnotationReport.java | 386 +
src/jalview/io/SimpleBlastFile.java | 28 +-
src/jalview/io/StockholmFile.java | 1780 +++--
src/jalview/io/TCoffeeScoreFile.java | 651 ++
src/jalview/io/VamsasAppDatastore.java | 192 +-
src/jalview/io/WSWUBlastClient.java | 65 +-
src/jalview/io/packed/DataProvider.java | 47 +-
src/jalview/io/packed/JalviewDataset.java | 277 +-
src/jalview/io/packed/ParsePackedSet.java | 63 +-
src/jalview/io/packed/SimpleDataProvider.java | 41 +-
src/jalview/io/vamsas/Datasetsequence.java | 553 +-
src/jalview/io/vamsas/DatastoreItem.java | 68 +-
src/jalview/io/vamsas/DatastoreRegistry.java | 19 +-
src/jalview/io/vamsas/Dbref.java | 17 +-
src/jalview/io/vamsas/LocalDocSyncObject.java | 13 +-
src/jalview/io/vamsas/Rangetype.java | 46 +-
src/jalview/io/vamsas/Sequencefeature.java | 718 +-
src/jalview/io/vamsas/Sequencemapping.java | 50 +-
src/jalview/io/vamsas/Tree.java | 68 +-
src/jalview/javascript/JSFunctionExec.java | 540 +-
src/jalview/javascript/JalviewLiteJsApi.java | 166 +-
src/jalview/javascript/JsCallBack.java | 26 +-
src/jalview/javascript/JsSelectionSender.java | 42 +-
src/jalview/javascript/MouseOverListener.java | 39 +-
.../javascript/MouseOverStructureListener.java | 632 +-
src/jalview/jbgui/GAlignExportSettings.java | 192 +
src/jalview/jbgui/GAlignFrame.java | 2089 ++++--
src/jalview/jbgui/GAlignmentPanel.java | 26 +-
src/jalview/jbgui/GCutAndPasteHtmlTransfer.java | 262 +
src/jalview/jbgui/GCutAndPasteTransfer.java | 50 +-
src/jalview/jbgui/GDasSourceBrowser.java | 472 +-
src/jalview/jbgui/GDesktop.java | 125 +-
src/jalview/jbgui/GFinder.java | 103 +-
src/jalview/jbgui/GFontChooser.java | 202 +-
src/jalview/jbgui/GPCAPanel.java | 185 +-
src/jalview/jbgui/GPDBSearchPanel.java | 396 +
src/jalview/jbgui/GPairwiseAlignPanel.java | 28 +-
src/jalview/jbgui/GPreferences.java | 1567 ++--
src/jalview/jbgui/GRestInputParamEditDialog.java | 118 +-
src/jalview/jbgui/GRestServiceEditorPane.java | 273 +-
src/jalview/jbgui/GRnaStructureViewer.java | 43 +
src/jalview/jbgui/GSequenceLink.java | 49 +-
src/jalview/jbgui/GSliderPanel.java | 43 +-
src/jalview/jbgui/GSplitFrame.java | 163 +
src/jalview/jbgui/GStructureChooser.java | 581 ++
src/jalview/jbgui/GStructureViewer.java | 290 +-
src/jalview/jbgui/GTreePanel.java | 72 +-
src/jalview/jbgui/GUserDefinedColours.java | 72 +-
src/jalview/jbgui/GWebserviceInfo.java | 45 +-
src/jalview/jbgui/GWsPreferences.java | 121 +-
src/jalview/jbgui/PDBDocFieldPreferences.java | 267 +
.../json/binding/biojs/BioJSReleasePojo.java | 66 +
.../json/binding/biojs/BioJSRepositoryPojo.java | 111 +
.../biojson/v1/AlignmentAnnotationPojo.java | 74 +
.../json/binding/biojson/v1/AlignmentPojo.java | 158 +
.../json/binding/biojson/v1/AnnotationPojo.java | 86 +
.../biojson/v1/JalviewBioJsColorSchemeMapper.java | 94 +
.../binding/biojson/v1/SequenceFeaturesPojo.java | 183 +
.../json/binding/biojson/v1/SequenceGrpPojo.java | 181 +
.../json/binding/biojson/v1/SequencePojo.java | 143 +
src/jalview/math/AlignmentDimension.java | 55 +
src/jalview/math/Matrix.java | 44 +-
src/jalview/math/RotatableMatrix.java | 13 +-
src/jalview/renderer/AnnotationRenderer.java | 1608 ++++
src/jalview/renderer/AwtRenderPanelI.java | 62 +
.../renderer/seqfeatures/FeatureRenderer.java | 423 ++
src/jalview/rest/RestHandler.java | 115 +
src/jalview/schemabinding/version2/.castor.cdr | 15 +-
src/jalview/schemabinding/version2/AlcodMap.java | 349 +-
src/jalview/schemabinding/version2/Alcodon.java | 501 +-
.../schemabinding/version2/AlcodonFrame.java | 845 +--
src/jalview/schemabinding/version2/Annotation.java | 2456 +++---
.../version2/AnnotationColourScheme.java | 497 ++
.../schemabinding/version2/AnnotationColours.java | 465 +-
.../schemabinding/version2/AnnotationElement.java | 669 +-
.../schemabinding/version2/CalcIdParam.java | 300 +
src/jalview/schemabinding/version2/Colour.java | 957 ++-
src/jalview/schemabinding/version2/DBRef.java | 425 +-
src/jalview/schemabinding/version2/Feature.java | 1042 +--
.../schemabinding/version2/FeatureSettings.java | 841 +--
src/jalview/schemabinding/version2/Features.java | 195 +-
src/jalview/schemabinding/version2/Group.java | 386 +-
.../schemabinding/version2/HiddenColumns.java | 416 +-
src/jalview/schemabinding/version2/JGroup.java | 2385 +++---
src/jalview/schemabinding/version2/JSeq.java | 1783 +++--
.../schemabinding/version2/JalviewModel.java | 429 +-
.../version2/JalviewModelSequence.java | 1886 ++---
.../schemabinding/version2/JalviewUserColours.java | 638 +-
.../schemabinding/version2/MapListFrom.java | 416 +-
src/jalview/schemabinding/version2/MapListTo.java | 416 +-
.../schemabinding/version2/MapListType.java | 1152 ++-
src/jalview/schemabinding/version2/Mapping.java | 307 +-
.../schemabinding/version2/MappingChoice.java | 325 +-
src/jalview/schemabinding/version2/OtherData.java | 324 +-
src/jalview/schemabinding/version2/Pdbentry.java | 688 +-
.../schemabinding/version2/PdbentryItem.java | 369 +-
src/jalview/schemabinding/version2/Pdbids.java | 498 +-
src/jalview/schemabinding/version2/Property.java | 324 +-
src/jalview/schemabinding/version2/RnaViewer.java | 668 ++
.../schemabinding/version2/SecondaryStructure.java | 290 +
src/jalview/schemabinding/version2/Sequence.java | 596 +-
.../schemabinding/version2/SequenceSet.java | 1654 +++--
.../version2/SequenceSetProperties.java | 326 +-
.../schemabinding/version2/SequenceType.java | 426 +-
src/jalview/schemabinding/version2/Setting.java | 1330 ++--
.../schemabinding/version2/StructureState.java | 1357 ++--
.../schemabinding/version2/ThresholdLine.java | 469 +-
src/jalview/schemabinding/version2/Tree.java | 1705 ++---
.../schemabinding/version2/UserColourScheme.java | 199 +-
.../schemabinding/version2/UserColours.java | 325 +-
src/jalview/schemabinding/version2/VAMSAS.java | 830 ++-
.../schemabinding/version2/VamsasModel.java | 195 +-
src/jalview/schemabinding/version2/Viewport.java | 5128 +++++++------
.../version2/WebServiceParameterSet.java | 836 +--
.../version2/descriptors/AlcodMapDescriptor.java | 448 +-
.../version2/descriptors/AlcodonDescriptor.java | 540 +-
.../descriptors/AlcodonFrameDescriptor.java | 460 +-
.../AnnotationColourSchemeDescriptor.java | 573 ++
.../descriptors/AnnotationColoursDescriptor.java | 530 +-
.../version2/descriptors/AnnotationDescriptor.java | 2161 +++---
.../descriptors/AnnotationElementDescriptor.java | 806 +-
.../descriptors/CalcIdParamDescriptor.java | 313 +
.../version2/descriptors/ColourDescriptor.java | 1059 +--
.../version2/descriptors/DBRefDescriptor.java | 584 +-
.../version2/descriptors/FeatureDescriptor.java | 980 +--
.../descriptors/FeatureSettingsDescriptor.java | 460 +-
.../version2/descriptors/FeaturesDescriptor.java | 277 +-
.../version2/descriptors/GroupDescriptor.java | 443 +-
.../descriptors/HiddenColumnsDescriptor.java | 440 +-
.../version2/descriptors/JGroupDescriptor.java | 2162 +++---
.../version2/descriptors/JSeqDescriptor.java | 1093 +--
.../descriptors/JalviewModelDescriptor.java | 600 +-
.../JalviewModelSequenceDescriptor.java | 815 +-
.../descriptors/JalviewUserColoursDescriptor.java | 523 +-
.../descriptors/MapListFromDescriptor.java | 442 +-
.../version2/descriptors/MapListToDescriptor.java | 442 +-
.../descriptors/MapListTypeDescriptor.java | 652 +-
.../descriptors/MappingChoiceDescriptor.java | 440 +-
.../version2/descriptors/MappingDescriptor.java | 371 +-
.../version2/descriptors/OtherDataDescriptor.java | 448 +-
.../version2/descriptors/PdbentryDescriptor.java | 605 +-
.../descriptors/PdbentryItemDescriptor.java | 387 +-
.../version2/descriptors/PdbidsDescriptor.java | 390 +-
.../version2/descriptors/PropertyDescriptor.java | 448 +-
.../version2/descriptors/RnaViewerDescriptor.java | 634 ++
.../descriptors/SecondaryStructureDescriptor.java | 345 +
.../version2/descriptors/SequenceDescriptor.java | 431 +-
.../descriptors/SequenceSetDescriptor.java | 815 +-
.../SequenceSetPropertiesDescriptor.java | 440 +-
.../descriptors/SequenceTypeDescriptor.java | 594 +-
.../version2/descriptors/SettingDescriptor.java | 1296 ++--
.../descriptors/StructureStateDescriptor.java | 1218 +--
.../descriptors/ThresholdLineDescriptor.java | 536 +-
.../version2/descriptors/TreeDescriptor.java | 1719 +++--
.../descriptors/UserColourSchemeDescriptor.java | 278 +-
.../descriptors/UserColoursDescriptor.java | 445 +-
.../version2/descriptors/VAMSASDescriptor.java | 471 +-
.../descriptors/VamsasModelDescriptor.java | 277 +-
.../version2/descriptors/ViewportDescriptor.java | 4612 +++++++-----
.../WebServiceParameterSetDescriptor.java | 693 +-
src/jalview/schemes/AnnotationColourGradient.java | 318 +-
src/jalview/schemes/Blosum62ColourScheme.java | 34 +-
src/jalview/schemes/BuriedColourScheme.java | 19 +-
src/jalview/schemes/ClustalxColourScheme.java | 227 +-
src/jalview/schemes/ColourSchemeI.java | 100 +-
src/jalview/schemes/ColourSchemeProperty.java | 180 +-
src/jalview/schemes/Consensus.java | 13 +-
src/jalview/schemes/CovariationColourScheme.java | 124 +
src/jalview/schemes/FollowerColourScheme.java | 70 +
src/jalview/schemes/GraduatedColor.java | 19 +-
src/jalview/schemes/HelixColourScheme.java | 19 +-
src/jalview/schemes/HydrophobicColourScheme.java | 19 +-
src/jalview/schemes/NucleotideColourScheme.java | 24 +-
src/jalview/schemes/PIDColourScheme.java | 23 +-
.../schemes/PurinePyrimidineColourScheme.java | 90 +
src/jalview/schemes/RNAHelicesColour.java | 201 +
src/jalview/schemes/RNAHelicesColourChooser.java | 132 +
.../schemes/RNAInteractionColourScheme.java | 85 +
src/jalview/schemes/ResidueColourScheme.java | 87 +-
src/jalview/schemes/ResidueProperties.java | 904 ++-
src/jalview/schemes/ScoreColourScheme.java | 25 +-
src/jalview/schemes/ScoreMatrix.java | 259 +-
src/jalview/schemes/StrandColourScheme.java | 19 +-
src/jalview/schemes/TCoffeeColourScheme.java | 140 +
src/jalview/schemes/TaylorColourScheme.java | 15 +-
src/jalview/schemes/TurnColourScheme.java | 19 +-
src/jalview/schemes/UserColourScheme.java | 44 +-
src/jalview/schemes/ZappoColourScheme.java | 15 +-
.../structure/AlignmentViewPanelListener.java | 26 +-
src/jalview/structure/AtomSpec.java | 85 +
src/jalview/structure/CommandListener.java | 55 +
.../structure/SecondaryStructureListener.java | 39 +
src/jalview/structure/SelectionListener.java | 13 +-
src/jalview/structure/SelectionSource.java | 13 +-
src/jalview/structure/SequenceListener.java | 20 +-
src/jalview/structure/StructureListener.java | 71 +-
src/jalview/structure/StructureMapping.java | 64 +-
.../structure/StructureMappingcommandSet.java | 49 +-
.../structure/StructureSelectionManager.java | 1001 ++-
src/jalview/structure/VamsasListener.java | 75 +-
src/jalview/structure/VamsasSource.java | 30 +-
.../structures/models/AAStructureBindingModel.java | 656 ++
.../models/SequenceStructureBindingModel.java | 72 +
src/jalview/util/AWTConsole.java | 35 +-
src/jalview/util/BrowserLauncher.java | 194 +-
src/jalview/util/ColorUtils.java | 106 +
src/jalview/util/Comparison.java | 179 +-
src/jalview/util/DBRefUtils.java | 192 +-
src/jalview/util/Format.java | 26 +-
src/jalview/util/GroupUrlLink.java | 59 +-
src/jalview/util/ImageMaker.java | 208 +-
src/jalview/util/MapList.java | 694 +-
src/jalview/util/MappingUtils.java | 678 ++
src/jalview/util/MessageManager.java | 127 +
src/jalview/util/ParseHtmlBodyAndLinks.java | 155 +-
src/jalview/util/Platform.java | 131 +-
src/jalview/util/QuickSort.java | 351 +-
src/jalview/util/ReverseListIterator.java | 63 +
src/jalview/util/ShiftList.java | 297 +-
src/jalview/util/StringUtils.java | 251 +
src/jalview/util/TableSorter.java | 1213 +--
src/jalview/util/UrlLink.java | 794 +-
src/jalview/util/jarInputStreamProvider.java | 93 +-
src/jalview/viewmodel/AlignmentViewport.java | 2560 +++++++
src/jalview/viewmodel/PCAModel.java | 246 +
.../AnnotationFilterParameter.java | 122 +
.../seqfeatures/FeatureRendererModel.java | 956 +++
.../seqfeatures/FeatureRendererSettings.java | 97 +
.../seqfeatures/FeatureSettingsModel.java | 28 +
.../viewmodel/seqfeatures/FeaturesDisplayed.java | 114 +
src/jalview/viewmodel/styles/ViewStyle.java | 1097 +++
src/jalview/workers/AlignCalcManager.java | 385 +
src/jalview/workers/AlignCalcWorker.java | 98 +
src/jalview/workers/ComplementConsensusThread.java | 107 +
src/jalview/workers/ConsensusThread.java | 218 +
src/jalview/workers/ConservationThread.java | 143 +
src/jalview/workers/StrucConsensusThread.java | 169 +
src/jalview/ws/AWSThread.java | 110 +-
src/jalview/ws/AWsJob.java | 13 +-
src/jalview/ws/DBRefFetcher.java | 1478 ++--
src/jalview/ws/DasSequenceFeatureFetcher.java | 1824 ++---
src/jalview/ws/EnfinEnvision2OneWay.java | 709 --
src/jalview/ws/HttpClientUtils.java | 169 +
src/jalview/ws/JobStateSummary.java | 36 +-
src/jalview/ws/SequenceFetcher.java | 859 ++-
src/jalview/ws/WSClient.java | 15 +-
src/jalview/ws/WSClientI.java | 13 +-
src/jalview/ws/WSMenuEntryProviderI.java | 17 +-
src/jalview/ws/dbsources/DasSequenceSource.java | 176 -
.../ws/dbsources/EbiFileRetrievedProxy.java | 130 +-
src/jalview/ws/dbsources/EmblCdsSouce.java | 183 +-
src/jalview/ws/dbsources/EmblSource.java | 253 +-
src/jalview/ws/dbsources/EmblXmlSource.java | 320 +-
src/jalview/ws/dbsources/GeneDbSource.java | 259 +-
src/jalview/ws/dbsources/PDBRestClient.java | 422 ++
src/jalview/ws/dbsources/Pdb.java | 464 +-
src/jalview/ws/dbsources/Pfam.java | 313 +-
src/jalview/ws/dbsources/PfamFull.java | 139 +-
src/jalview/ws/dbsources/PfamSeed.java | 138 +-
src/jalview/ws/dbsources/Rfam.java | 118 +
src/jalview/ws/dbsources/RfamFull.java | 81 +
src/jalview/ws/dbsources/RfamSeed.java | 80 +
src/jalview/ws/dbsources/Uniprot.java | 211 +-
src/jalview/ws/dbsources/UnprotName.java | 85 +-
src/jalview/ws/dbsources/Xfam.java | 73 +
.../dbsources/das/DasSequenceSourceListener.java | 165 -
.../ws/dbsources/das/api/DasSourceRegistryI.java | 57 +
.../ws/dbsources/das/api/jalviewSourceI.java | 87 +
.../dbsources/das/datamodel/DasSequenceSource.java | 355 +
.../dbsources/das/datamodel/DasSourceRegistry.java | 486 ++
.../ws/dbsources/das/datamodel/JalviewSource.java | 383 +
src/jalview/ws/ebi/EBIFetchClient.java | 487 +-
src/jalview/ws/io/mime/HttpContentHandler.java | 25 +-
.../ws/io/mime/JalviewMimeContentHandler.java | 77 +-
src/jalview/ws/io/mime/MimeTypes.java | 67 +-
src/jalview/ws/jws1/Annotate3D.java | 282 +
src/jalview/ws/jws1/Discoverer.java | 58 +-
src/jalview/ws/jws1/JPredClient.java | 69 +-
src/jalview/ws/jws1/JPredThread.java | 203 +-
src/jalview/ws/jws1/JWS1Thread.java | 21 +-
src/jalview/ws/jws1/MsaWSClient.java | 53 +-
src/jalview/ws/jws1/MsaWSThread.java | 71 +-
src/jalview/ws/jws1/SeqSearchWSClient.java | 55 +-
src/jalview/ws/jws1/SeqSearchWSThread.java | 72 +-
src/jalview/ws/jws1/WS1Client.java | 20 +-
src/jalview/ws/jws1/WSJob.java | 13 +-
src/jalview/ws/jws2/AAConClient.java | 128 +
src/jalview/ws/jws2/AADisorderClient.java | 379 +
src/jalview/ws/jws2/AWS2Thread.java | 13 +-
src/jalview/ws/jws2/AbstractJabaCalcWorker.java | 621 ++
src/jalview/ws/jws2/JPred301Client.java | 300 +
src/jalview/ws/jws2/JWs2Job.java | 17 +-
src/jalview/ws/jws2/JabaParamStore.java | 121 +-
src/jalview/ws/jws2/JabaPreset.java | 30 +-
src/jalview/ws/jws2/JabaWsServerQuery.java | 236 +-
src/jalview/ws/jws2/JabawsCalcWorker.java | 237 +
.../ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java | 226 +
src/jalview/ws/jws2/Jws2Client.java | 380 +-
src/jalview/ws/jws2/Jws2Discoverer.java | 758 +-
src/jalview/ws/jws2/MsaWSClient.java | 266 +-
src/jalview/ws/jws2/MsaWSThread.java | 383 +-
src/jalview/ws/jws2/ParameterUtils.java | 34 +-
src/jalview/ws/jws2/RNAalifoldClient.java | 405 +
.../ws/jws2/SequenceAnnotationWSClient.java | 258 +
src/jalview/ws/jws2/dm/AAConSettings.java | 153 +
src/jalview/ws/jws2/dm/JabaOption.java | 30 +-
src/jalview/ws/jws2/dm/JabaParameter.java | 15 +-
src/jalview/ws/jws2/dm/JabaValueConstrain.java | 31 +-
src/jalview/ws/jws2/dm/JabaWsParamSet.java | 35 +-
src/jalview/ws/jws2/jabaws2/Jws2Instance.java | 252 +
.../ws/jws2/jabaws2/Jws2InstanceFactory.java | 97 +
src/jalview/ws/params/ArgumentI.java | 14 +-
src/jalview/ws/params/AutoCalcSetting.java | 90 +
.../ws/params/InvalidArgumentException.java | 22 +-
src/jalview/ws/params/OptionI.java | 13 +-
src/jalview/ws/params/ParamDatastoreI.java | 13 +-
src/jalview/ws/params/ParamManager.java | 15 +-
src/jalview/ws/params/ParameterI.java | 17 +-
src/jalview/ws/params/ValueConstrainI.java | 23 +-
src/jalview/ws/params/WsParamSetI.java | 13 +-
src/jalview/ws/params/simple/BooleanOption.java | 38 +-
src/jalview/ws/params/simple/IntegerParameter.java | 75 +-
src/jalview/ws/params/simple/Option.java | 62 +-
src/jalview/ws/params/simple/Parameter.java | 33 +-
.../ws/params/simple/StringChoiceParameter.java | 23 +-
src/jalview/ws/rest/AlignmentProcessor.java | 32 +-
src/jalview/ws/rest/HttpResultSet.java | 36 +-
src/jalview/ws/rest/InputType.java | 312 +-
src/jalview/ws/rest/NoValidInputDataException.java | 31 +-
src/jalview/ws/rest/RestClient.java | 279 +-
src/jalview/ws/rest/RestJob.java | 129 +-
src/jalview/ws/rest/RestJobThread.java | 45 +-
src/jalview/ws/rest/RestServiceDescription.java | 375 +-
src/jalview/ws/rest/params/Alignment.java | 57 +-
src/jalview/ws/rest/params/AnnotationFile.java | 91 +-
src/jalview/ws/rest/params/JobConstant.java | 56 +-
.../ws/rest/params/SeqGroupIndexVector.java | 142 +-
src/jalview/ws/rest/params/SeqIdVector.java | 39 +-
src/jalview/ws/rest/params/SeqVector.java | 74 +-
src/jalview/ws/rest/params/Tree.java | 57 +-
src/jalview/ws/seqfetcher/ASequenceFetcher.java | 784 +-
src/jalview/ws/seqfetcher/DbSourceProxy.java | 278 +-
src/jalview/ws/seqfetcher/DbSourceProxyImpl.java | 279 +-
src/jalview/ws/uimodel/AlignAnalysisUIText.java | 134 +
src/jalview/ws/uimodel/PDBRestRequest.java | 142 +
src/jalview/ws/uimodel/PDBRestResponse.java | 223 +
.../biojava/dasobert/das/DAS_FeatureRetrieve.java | 287 -
.../biojava/dasobert/das/DAS_Feature_Handler.java | 314 -
.../biojava/dasobert/das/DAS_Sequence_Handler.java | 161 -
src/org/biojava/dasobert/das/FeatureThread.java | 198 -
src/org/biojava/dasobert/das/SequenceThread.java | 299 -
src/org/biojava/dasobert/das2/Das2Capability.java | 51 -
.../biojava/dasobert/das2/Das2CapabilityImpl.java | 131 -
src/org/biojava/dasobert/das2/Das2Source.java | 42 -
src/org/biojava/dasobert/das2/Das2SourceImpl.java | 157 -
.../biojava/dasobert/das2/DasSourceConverter.java | 92 -
.../dasobert/das2/io/DAS2SourceHandler.java | 216 -
.../biojava/dasobert/das2/io/DasSourceReader.java | 33 -
.../dasobert/das2/io/DasSourceReaderImpl.java | 183 -
.../biojava/dasobert/dasregistry/Das1Source.java | 305 -
.../dasobert/dasregistry/Das2Validator.java | 44 -
.../dasregistry/DasCoordSysComparator.java | 128 -
.../dasobert/dasregistry/DasCoordinateSystem.java | 233 -
.../biojava/dasobert/dasregistry/DasSource.java | 130 -
.../dasobert/dasregistry/DasSourceComparator.java | 190 -
.../dasobert/eventmodel/AbstractDasEvent.java | 43 -
.../biojava/dasobert/eventmodel/FeatureEvent.java | 96 -
.../dasobert/eventmodel/FeatureListener.java | 48 -
.../dasobert/eventmodel/ObjectListener.java | 51 -
.../biojava/dasobert/eventmodel/SequenceEvent.java | 62 -
.../dasobert/eventmodel/SequenceListener.java | 64 -
.../dasobert/feature/AbstractFeatureTrack.java | 278 -
.../biojava/dasobert/feature/AbstractSegment.java | 256 -
.../dasobert/feature/FeatureComparator.java | 87 -
.../dasobert/feature/FeatureMapComparator.java | 68 -
src/org/biojava/dasobert/feature/FeatureTrack.java | 127 -
.../dasobert/feature/FeatureTrackConverter.java | 526 --
.../biojava/dasobert/feature/FeatureTrackImpl.java | 68 -
.../biojava/dasobert/feature/HistogramFeature.java | 95 -
.../biojava/dasobert/feature/HistogramSegment.java | 67 -
src/org/biojava/dasobert/feature/Segment.java | 84 -
.../dasobert/feature/SegmentComparator.java | 45 -
src/org/biojava/dasobert/feature/SegmentImpl.java | 83 -
src/org/jibble/epsgraphics/EpsDocument.java | 47 +-
src/org/jibble/epsgraphics/EpsException.java | 34 +-
src/org/jibble/epsgraphics/EpsGraphics2D.java | 112 +-
src/uk/ac/ebi/picr/model/CrossReference.java | 675 +-
.../ac/ebi/picr/model/CrossReference_Helper.java | 253 +-
src/uk/ac/ebi/picr/model/UPEntry.java | 591 +-
src/uk/ac/ebi/picr/model/UPEntry_Helper.java | 215 +-
src/uk/ac/ebi/www/Data.java | 21 +-
src/uk/ac/ebi/www/InputParams.java | 21 +-
src/uk/ac/ebi/www/WSFile.java | 21 +-
src/uk/ac/ebi/www/WSWUBlast.java | 13 +-
src/uk/ac/ebi/www/WSWUBlastService.java | 13 +-
src/uk/ac/ebi/www/WSWUBlastServiceLocator.java | 23 +-
src/uk/ac/ebi/www/WSWUBlastSoapBindingStub.java | 39 +-
.../AccessionMapperBindingStub.java | 795 +-
.../AccessionMapperInterface.java | 71 +-
.../AccessionMapperService.java | 61 +-
.../AccessionMapperServiceLocator.java | 385 +-
src/vamsas/IMsaWS.java | 18 +-
src/vamsas/objects/simple/Alignment.java | 25 +-
src/vamsas/objects/simple/Alignment_Helper.java | 13 +-
src/vamsas/objects/simple/JpredResult.java | 21 +-
src/vamsas/objects/simple/JpredResult_Helper.java | 13 +-
src/vamsas/objects/simple/MsaResult.java | 40 +-
src/vamsas/objects/simple/MsaResult_Helper.java | 30 +-
src/vamsas/objects/simple/Msfalignment.java | 21 +-
src/vamsas/objects/simple/Msfalignment_Helper.java | 13 +-
src/vamsas/objects/simple/Object.java | 26 +-
src/vamsas/objects/simple/Object_Helper.java | 13 +-
src/vamsas/objects/simple/Result.java | 25 +-
src/vamsas/objects/simple/Result_Helper.java | 13 +-
src/vamsas/objects/simple/Secstructpred.java | 19 +-
.../objects/simple/Secstructpred_Helper.java | 13 +-
src/vamsas/objects/simple/SeqSearchResult.java | 381 +-
.../objects/simple/SeqSearchResult_Helper.java | 175 +-
src/vamsas/objects/simple/Sequence.java | 25 +-
src/vamsas/objects/simple/SequenceSet.java | 25 +-
src/vamsas/objects/simple/SequenceSet_Helper.java | 13 +-
src/vamsas/objects/simple/Sequence_Helper.java | 13 +-
src/vamsas/objects/simple/WsJobId.java | 25 +-
src/vamsas/objects/simple/WsJobId_Helper.java | 13 +-
1025 files changed, 193388 insertions(+), 116445 deletions(-)
diff --git a/JalviewApplet.jpx b/JalviewApplet.jpx
index 0044ab6..e7186e5 100644
--- a/JalviewApplet.jpx
+++ b/JalviewApplet.jpx
@@ -1,75 +1,75 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--JBuilder XML Project-->
-<project>
- <property category="debug.0" name="SmartStepRedefineClasses" value="0"/>
- <property category="debug.0" name="SmartStepSkipStaticInitializers" value="0"/>
- <property category="debug.0" name="SmartStepSkipSynthetics" value="0"/>
- <property category="editor.general" name="line_ending.style" value="2"/>
- <property category="generalFormatting" name="lineEndingStyle" value="2"/>
- <property category="generalFormatting2" name="lineEndingStyle" value="2"/>
- <property category="generalFormatting2" name="overrideBasicFormatting" value="1"/>
- <property category="javaFormatting" name="classBraceNextLine" value="1"/>
- <property category="javaFormatting" name="methodBraceNextLine" value="1"/>
- <property category="javaFormatting" name="otherBraceNextLine" value="1"/>
- <property category="javaFormatting" name="packagePrefixGroups" value="java;javax;BLANK_LINE;java.awt;javax.swing;BLANK_LINE;org;(*)"/>
- <property category="javaFormatting" name="throwsOnNewLine" value="1"/>
- <property category="javadoc" name="custom.tags.1" value="todo;a;To Do:"/>
- <property category="runtime" name="DefaultConfiguration" value="-1"/>
- <property category="runtime.0" name="BuildTargetOnRun" value="com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make"/>
- <property category="runtime.0" name="ConfigurationName" value="Applet"/>
- <property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.AppletRunner"/>
- <property category="runtime.0" name="applet.appletviewer" value="1"/>
- <property category="runtime.0" name="applet.class" value="jalview.bin.JalviewLite"/>
- <property category="runtime.0" name="applet.html" value="classes/applet.html"/>
- <property category="serverservices" name="single.server.name" value="Tomcat 4.0"/>
- <property category="sys" name="AuthorLabel" value="@author"/>
- <property category="sys" name="BackupPath" value="bak"/>
- <property category="sys" name="CheckStable" value="1"/>
- <property category="sys" name="Company" value=""/>
- <property category="sys" name="CompanyLabel" value="Company:"/>
- <property category="sys" name="Copyright" value="Copyright (c) 2004"/>
- <property category="sys" name="CopyrightLabel" value="Copyright:"/>
- <property category="sys" name="DefaultPath" value="src"/>
- <property category="sys" name="Description" value=""/>
- <property category="sys" name="DescriptionLabel" value="Description:"/>
- <property category="sys" name="DocPath" value="doc"/>
- <property category="sys" name="ExcludeClassEnabled" value="0"/>
- <property category="sys" name="IncludeTestPath" value="1"/>
- <property category="sys" name="InstanceVisibility" value="2"/>
- <property category="sys" name="JDK" value="java version 1.1.8_010"/>
- <property category="sys" name="LastTag" value="0"/>
- <property category="sys" name="Libraries" value=""/>
- <property category="sys" name="MakeStable" value="0"/>
- <property category="sys" name="OutPath" value="classes"/>
- <property category="sys" name="SourcePath" value="src;test"/>
- <property category="sys" name="TestPath" value="src"/>
- <property category="sys" name="Title" value=""/>
- <property category="sys" name="TitleLabel" value="Title:"/>
- <property category="sys" name="Version" value="1.0"/>
- <property category="sys" name="VersionLabel" value="@version"/>
- <property category="sys" name="WorkingDirectory" value="."/>
- <property category="sys" name="enable.auto.packages" value="false"/>
- <node name="jalview.appletgui" type="Package"/>
- <node name="jalview.datamodel" type="Package"/>
- <node name="jalview.jbappletgui" type="Package"/>
- <node name="jalview.math" type="Package"/>
- <node name="jalview.schemes" type="Package"/>
- <file path="src/jalview/analysis/AAFrequency.java"/>
- <file path="src/jalview/io/AlignFile.java"/>
- <file path="src/jalview/analysis/AlignmentSorter.java"/>
- <file path="src/jalview/analysis/AlignSeq.java"/>
- <file path="src/jalview/io/BLCFile.java"/>
- <file path="src/jalview/io/ClustalFile.java"/>
- <file path="src/jalview/analysis/Conservation.java"/>
- <file path="src/jalview/io/FastaFile.java"/>
- <file path="src/jalview/io/FileParse.java"/>
- <file path="src/jalview/io/FormatAdapter.java"/>
- <file path="src/jalview/io/IdentifyFile.java"/>
- <file path="src/jalview/bin/JalviewLite.java"/>
- <file path="src/jalview/io/MSFfile.java"/>
- <file path="src/jalview/io/NewickFile.java"/>
- <file path="src/jalview/analysis/NJTree.java"/>
- <file path="src/jalview/analysis/PCA.java"/>
- <file path="src/jalview/io/PfamFile.java"/>
- <file path="src/jalview/io/PIRFile.java"/>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--JBuilder XML Project-->
+<project>
+ <property category="debug.0" name="SmartStepRedefineClasses" value="0"/>
+ <property category="debug.0" name="SmartStepSkipStaticInitializers" value="0"/>
+ <property category="debug.0" name="SmartStepSkipSynthetics" value="0"/>
+ <property category="editor.general" name="line_ending.style" value="2"/>
+ <property category="generalFormatting" name="lineEndingStyle" value="2"/>
+ <property category="generalFormatting2" name="lineEndingStyle" value="2"/>
+ <property category="generalFormatting2" name="overrideBasicFormatting" value="1"/>
+ <property category="javaFormatting" name="classBraceNextLine" value="1"/>
+ <property category="javaFormatting" name="methodBraceNextLine" value="1"/>
+ <property category="javaFormatting" name="otherBraceNextLine" value="1"/>
+ <property category="javaFormatting" name="packagePrefixGroups" value="java;javax;BLANK_LINE;java.awt;javax.swing;BLANK_LINE;org;(*)"/>
+ <property category="javaFormatting" name="throwsOnNewLine" value="1"/>
+ <property category="javadoc" name="custom.tags.1" value="todo;a;To Do:"/>
+ <property category="runtime" name="DefaultConfiguration" value="-1"/>
+ <property category="runtime.0" name="BuildTargetOnRun" value="com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make"/>
+ <property category="runtime.0" name="ConfigurationName" value="Applet"/>
+ <property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.AppletRunner"/>
+ <property category="runtime.0" name="applet.appletviewer" value="1"/>
+ <property category="runtime.0" name="applet.class" value="jalview.bin.JalviewLite"/>
+ <property category="runtime.0" name="applet.html" value="classes/applet.html"/>
+ <property category="serverservices" name="single.server.name" value="Tomcat 4.0"/>
+ <property category="sys" name="AuthorLabel" value="@author"/>
+ <property category="sys" name="BackupPath" value="bak"/>
+ <property category="sys" name="CheckStable" value="1"/>
+ <property category="sys" name="Company" value=""/>
+ <property category="sys" name="CompanyLabel" value="Company:"/>
+ <property category="sys" name="Copyright" value="Copyright (c) 2004"/>
+ <property category="sys" name="CopyrightLabel" value="Copyright:"/>
+ <property category="sys" name="DefaultPath" value="src"/>
+ <property category="sys" name="Description" value=""/>
+ <property category="sys" name="DescriptionLabel" value="Description:"/>
+ <property category="sys" name="DocPath" value="doc"/>
+ <property category="sys" name="ExcludeClassEnabled" value="0"/>
+ <property category="sys" name="IncludeTestPath" value="1"/>
+ <property category="sys" name="InstanceVisibility" value="2"/>
+ <property category="sys" name="JDK" value="java version 1.1.8_010"/>
+ <property category="sys" name="LastTag" value="0"/>
+ <property category="sys" name="Libraries" value=""/>
+ <property category="sys" name="MakeStable" value="0"/>
+ <property category="sys" name="OutPath" value="classes"/>
+ <property category="sys" name="SourcePath" value="src;test"/>
+ <property category="sys" name="TestPath" value="src"/>
+ <property category="sys" name="Title" value=""/>
+ <property category="sys" name="TitleLabel" value="Title:"/>
+ <property category="sys" name="Version" value="1.0"/>
+ <property category="sys" name="VersionLabel" value="@version"/>
+ <property category="sys" name="WorkingDirectory" value="."/>
+ <property category="sys" name="enable.auto.packages" value="false"/>
+ <node name="jalview.appletgui" type="Package"/>
+ <node name="jalview.datamodel" type="Package"/>
+ <node name="jalview.jbappletgui" type="Package"/>
+ <node name="jalview.math" type="Package"/>
+ <node name="jalview.schemes" type="Package"/>
+ <file path="src/jalview/analysis/AAFrequency.java"/>
+ <file path="src/jalview/io/AlignFile.java"/>
+ <file path="src/jalview/analysis/AlignmentSorter.java"/>
+ <file path="src/jalview/analysis/AlignSeq.java"/>
+ <file path="src/jalview/io/BLCFile.java"/>
+ <file path="src/jalview/io/ClustalFile.java"/>
+ <file path="src/jalview/analysis/Conservation.java"/>
+ <file path="src/jalview/io/FastaFile.java"/>
+ <file path="src/jalview/io/FileParse.java"/>
+ <file path="src/jalview/io/FormatAdapter.java"/>
+ <file path="src/jalview/io/IdentifyFile.java"/>
+ <file path="src/jalview/bin/JalviewLite.java"/>
+ <file path="src/jalview/io/MSFfile.java"/>
+ <file path="src/jalview/io/NewickFile.java"/>
+ <file path="src/jalview/analysis/NJTree.java"/>
+ <file path="src/jalview/analysis/PCA.java"/>
+ <file path="src/jalview/io/PfamFile.java"/>
+ <file path="src/jalview/io/PIRFile.java"/>
+</project>
diff --git a/JalviewX.jpx b/JalviewX.jpx
index 239991a..cb2e19b 100644
--- a/JalviewX.jpx
+++ b/JalviewX.jpx
@@ -1,47 +1,47 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--JBuilder XML Project-->
-<project>
- <property category="debug.0" name="SmartStepRedefineClasses" value="0"/>
- <property category="debug.0" name="SmartStepSkipStaticInitializers" value="0"/>
- <property category="debug.0" name="SmartStepSkipSynthetics" value="0"/>
- <property category="generalFormatting2" name="overrideBasicFormatting" value="1"/>
- <property category="javaFormatting" name="EventStyle" value="0"/>
- <property category="javaFormatting" name="classBraceNextLine" value="1"/>
- <property category="javaFormatting" name="methodBraceNextLine" value="1"/>
- <property category="javaFormatting" name="otherBraceNextLine" value="1"/>
- <property category="javaFormatting" name="packagePrefixGroups" value="java;javax;BLANK_LINE;java.awt;javax.swing;BLANK_LINE;org;(*)"/>
- <property category="javaFormatting" name="throwsOnNewLine" value="1"/>
- <property category="optimize.0" name="OptimizableType" value="com.borland.jbuilder.optimize.IntroOptimizeitProfiler"/>
- <property category="runtime.0" name="BuildTargetOnRun" value="com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make"/>
- <property category="runtime.0" name="ConfigurationName" value="JalviewX"/>
- <property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner"/>
- <property category="runtime.0" name="application.class" value="jalview.bin.Jalview"/>
- <property category="serverservices" name="single.server.name" value="Tomcat 4.0"/>
- <property category="sys" name="AuthorLabel" value="@author"/>
- <property category="sys" name="BackupPath" value="bak"/>
- <property category="sys" name="Company" value="Dundee University"/>
- <property category="sys" name="CompanyLabel" value="Company:"/>
- <property category="sys" name="Copyright" value="Copyright (c) 2004"/>
- <property category="sys" name="CopyrightLabel" value="Copyright:"/>
- <property category="sys" name="DefaultPath" value="src"/>
- <property category="sys" name="Description" value=""/>
- <property category="sys" name="DescriptionLabel" value="Description:"/>
- <property category="sys" name="DocPath" value="doc"/>
- <property category="sys" name="ExcludeClassEnabled" value="0"/>
- <property category="sys" name="IncludeTestPath" value="1"/>
- <property category="sys" name="JDK" value="java version 1.4.2_04-b05"/>
- <property category="sys" name="JvmVersion" value="1.4"/>
- <property category="sys" name="Libraries" value="all"/>
- <property category="sys" name="OutPath" value="classes"/>
- <property category="sys" name="SourcePath" value="src;test"/>
- <property category="sys" name="SourceVersion" value="1.4"/>
- <property category="sys" name="TestPath" value="test"/>
- <property category="sys" name="Title" value=""/>
- <property category="sys" name="TitleLabel" value="Title:"/>
- <property category="sys" name="Version" value="1.0"/>
- <property category="sys" name="VersionLabel" value="@version"/>
- <property category="sys" name="WorkingDirectory" value="."/>
- <property category="sys" name="uidesign.size.jalview.jbgui.GPreferences" value="453,333"/>
- <property category="sys" name="uidesign.size.jalview.jbgui.GSequenceLink" value="400,112"/>
- <file path="build.xml"/>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--JBuilder XML Project-->
+<project>
+ <property category="debug.0" name="SmartStepRedefineClasses" value="0"/>
+ <property category="debug.0" name="SmartStepSkipStaticInitializers" value="0"/>
+ <property category="debug.0" name="SmartStepSkipSynthetics" value="0"/>
+ <property category="generalFormatting2" name="overrideBasicFormatting" value="1"/>
+ <property category="javaFormatting" name="EventStyle" value="0"/>
+ <property category="javaFormatting" name="classBraceNextLine" value="1"/>
+ <property category="javaFormatting" name="methodBraceNextLine" value="1"/>
+ <property category="javaFormatting" name="otherBraceNextLine" value="1"/>
+ <property category="javaFormatting" name="packagePrefixGroups" value="java;javax;BLANK_LINE;java.awt;javax.swing;BLANK_LINE;org;(*)"/>
+ <property category="javaFormatting" name="throwsOnNewLine" value="1"/>
+ <property category="optimize.0" name="OptimizableType" value="com.borland.jbuilder.optimize.IntroOptimizeitProfiler"/>
+ <property category="runtime.0" name="BuildTargetOnRun" value="com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make"/>
+ <property category="runtime.0" name="ConfigurationName" value="JalviewX"/>
+ <property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner"/>
+ <property category="runtime.0" name="application.class" value="jalview.bin.Jalview"/>
+ <property category="serverservices" name="single.server.name" value="Tomcat 4.0"/>
+ <property category="sys" name="AuthorLabel" value="@author"/>
+ <property category="sys" name="BackupPath" value="bak"/>
+ <property category="sys" name="Company" value="Dundee University"/>
+ <property category="sys" name="CompanyLabel" value="Company:"/>
+ <property category="sys" name="Copyright" value="Copyright (c) 2004"/>
+ <property category="sys" name="CopyrightLabel" value="Copyright:"/>
+ <property category="sys" name="DefaultPath" value="src"/>
+ <property category="sys" name="Description" value=""/>
+ <property category="sys" name="DescriptionLabel" value="Description:"/>
+ <property category="sys" name="DocPath" value="doc"/>
+ <property category="sys" name="ExcludeClassEnabled" value="0"/>
+ <property category="sys" name="IncludeTestPath" value="1"/>
+ <property category="sys" name="JDK" value="java version 1.4.2_04-b05"/>
+ <property category="sys" name="JvmVersion" value="1.4"/>
+ <property category="sys" name="Libraries" value="all"/>
+ <property category="sys" name="OutPath" value="classes"/>
+ <property category="sys" name="SourcePath" value="src;test"/>
+ <property category="sys" name="SourceVersion" value="1.4"/>
+ <property category="sys" name="TestPath" value="test"/>
+ <property category="sys" name="Title" value=""/>
+ <property category="sys" name="TitleLabel" value="Title:"/>
+ <property category="sys" name="Version" value="1.0"/>
+ <property category="sys" name="VersionLabel" value="@version"/>
+ <property category="sys" name="WorkingDirectory" value="."/>
+ <property category="sys" name="uidesign.size.jalview.jbgui.GPreferences" value="453,333"/>
+ <property category="sys" name="uidesign.size.jalview.jbgui.GSequenceLink" value="400,112"/>
+ <file path="build.xml"/>
+</project>
diff --git a/README b/README
index 10f032b..cbc93b1 100644
--- a/README
+++ b/README
@@ -4,7 +4,7 @@ Jalview Readme
The source is available as a tar file and comes complete with the GNU General Public License.
-To build the application you will need a J2SDK 1.6+.
+To build the application you will need a J2SDK 1.7+.
An Ant build file (build.xml) is provided, you will need to install Apache Ant first.
Run ant to view usage which will display a list of useful build targets.
diff --git a/build.xml b/build.xml
index e9528fc..de0d7a8 100644
--- a/build.xml
+++ b/build.xml
@@ -1,52 +1,44 @@
<?xml version="1.0"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<project name="jalviewX" default="usage" basedir=".">
- <!-- we use jalopy to format our sources -->
- <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
- <classpath>
- <fileset dir="utils/jalopy/lib">
- <include name="*.jar" />
- </fileset>
- </classpath>
- </taskdef>
-
- <target name="help" depends="usage" />
- <target name="usage">
- <echo message="~~~Jalview Ant build.xml Usage~~~~" />
- <echo message="Targets include:" />
- <echo message="usage - default target, displays this message" />
- <echo message="buildindices - generates JavaHelpSearch from the help files" />
- <echo message="build - compiles all necessary files for Application" />
- <echo message="makedist - compiles and places all necessary jar files into directory dist" />
- <echo message="makefulldist - signs all jar files and builds jnlp file for full distribution" />
- <echo message=" this needs a keystore and key. See docs/building.html for more information." />
- <echo message="compileApplet - compiles all necessary files for Applet" />
- <echo message="makeApplet - compiles, then packages and obfuscates the Applet" />
- <echo message="See docs/building.html and the comments in build file for other targets." />
- <echo message="note: compile and makeApplet require the property java118.home to be set to point to a java 1.1.8 jdk." />
- <echo message="Useful -D flags: -Ddonotobfuscate will prevent applet obfuscation" />
- </target>
-
-
- <!-- utils is a class path to additional utilities needed for
+ <target name="help" depends="usage" />
+ <target name="usage">
+ <echo message="~~~Jalview Ant build.xml Usage~~~~" />
+ <echo message="Targets include:" />
+ <echo message="usage - default target, displays this message" />
+ <echo message="buildindices - generates JavaHelpSearch from the help files" />
+ <echo message="build - compiles all necessary files for Application" />
+ <echo message="makedist - compiles and places all necessary jar files into directory dist" />
+ <echo message="makefulldist - signs all jar files and builds jnlp file for full distribution" />
+ <echo message=" this needs a keystore and key. See docs/building.html for more information." />
+ <echo message="compileApplet - compiles all necessary files for Applet" />
+ <echo message="makeApplet - compiles, then packages and obfuscates the Applet" />
+ <echo message="See docs/building.html and the comments in build file for other targets." />
+ <echo message="note: compile and makeApplet require the property java118.home to be set to point to a java 1.1.8 jdk." />
+ <echo message="Useful -D flags: -Ddonotobfuscate will prevent applet obfuscation" />
+ </target>
+
+
+ <!-- utils is a class path to additional utilities needed for
building docs, jars and webstart stuff -->
- <!--
+ <!--
Userdefined build property defaults
wsdl.server list (plus namespace mapping info ???) - also want
@@ -59,193 +51,316 @@
-->
- <target name="init">
- <path id="axis.classpath">
- <!-->
- <fileset dir="/usr/local/axis/lib">
- <include name="**/*.jar" />
- </fileset>
- <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
- <include name="**/*.jar"/>
- <include name="*.jar"/>
- </fileset> -->
+ <target name="init">
+ <path id="axis.classpath">
+ <!-->
+ <fileset dir="/usr/local/axis/lib">
+ <include name="**/*.jar" />
+ </fileset>
+ <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
+ <include name="**/*.jar"/>
+ <include name="*.jar"/>
+ </fileset> -->
</path>
- <!-- Jalview Version String displayed by application on startup and used to check for updates -->
- <property name="JALVIEW_VERSION" value="DEVELOPMENT" />
- <!-- 2.4 (VAMSAS)" -->
- <!-- Include debugging information in javac true or false -->
- <property name="javac.debug" value="true" />
-
- <!-- JarSigner Key Store for Webstart Distribution -->
- <property name="jalview.keystore" value="./keys/.keystore" />
- <!-- Keystore Password -->
- <property name="jalview.keystore.pass" value="alignmentisfun" />
- <!-- Key Name -->
- <property name="jalview.key" value="jalview" />
- <!-- Key Password -->
- <property name="jalview.key.pass" value="alignmentisfun" />
-
- <!-- Don't change anything below here unless you know what you are doing! -->
- <!-- Url path for WebStart in JNLP file -->
- <property name="WebStartLocation" value="http://www.jalview.org/webstart" />
- <!-- build directory configuration -->
- <property name="libDir" value="lib" />
- <property name="resourceDir" value="resources" />
- <property name="helpDir" value="help" />
- <property name="docDir" value="doc" />
- <property name="sourceDir" value="src" />
- <property name="schemaDir" value="schemas" />
- <property name="outputDir" value="classes" />
- <property name="packageDir" value="dist" />
- <property name="outputJar" value="jalview.jar" />
- <!-- Jalview Applet JMol Jar Dependency -->
- <property name="jmolJar" value="JmolApplet-12.1.13.jar" />
- <property name="jalviewLiteJar" value="jalviewApplet.jar" />
- <!-- switch to indicate if we should obfuscate jalviewLite -->
- <!--<property name="donotobfuscate" value="true"/> -->
-
- <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
- <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
- <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
- <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
- <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
- <property name="WSInterf" value="MsaWS" />
- <property name="wsdl.Namespace" value="vamsas" />
- <property name="wsdl.ClientNS" value="ext.vamsas" />
- <!-- the class path for building the application -->
- <path id="build.classpath">
- <fileset dir="utils">
- <include name="*.jar" />
- <include name="**/*.jar" />
- </fileset>
- <fileset dir="${libDir}">
- <include name="*.jar" />
- <include name="**/*.jar" />
- </fileset>
- <fileset dir="${java.home}/lib">
- <include name="plugin.jar"/>
- </fileset>
- <fileset dir="appletlib">
- <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages
+
+ <!-- Jalview Version String displayed by application on startup and used to check for updates -->
+ <property name="JALVIEW_VERSION" value="DEVELOPMENT" />
+
+ <property name="INSTALLATION" value="Source" />
+
+ <!-- 2.4 (VAMSAS)" -->
+ <!-- Include debugging information in javac true or false -->
+ <property name="javac.debug" value="true" />
+
+ <!-- JarSigner Key Store for Webstart Distribution -->
+ <property name="jalview.keystore" value="./keys/.keystore" />
+ <!-- Keystore Password -->
+ <property name="jalview.keystore.pass" value="alignmentisfun" />
+ <!-- Key Name -->
+ <property name="jalview.key" value="jalview" />
+ <!-- Key Password -->
+ <property name="jalview.key.pass" value="alignmentisfun" />
+
+ <!-- Don't change anything below here unless you know what you are doing! -->
+ <!-- Url path for WebStart in JNLP file -->
+ <property name="WebStartLocation" value="http://www.jalview.org/webstart" />
+ <!-- Webstart Image - looked for in resources/images -->
+ <property name="WebStartImage" value="JalviewLogo_big.png"/>
+ <!-- J2SE version needed for webstart launch -->
+ <!-- Anne's version needs 1.7 - should rebuild VARNA to java 1.6 for release -->
+ <property name="j2sev" value="1.7+"/>
+ <!-- Java Compilation settings - source and target javac version -->
+ <property name="javac.source" value="1.7"/>
+ <property name="javac.target" value="1.7"/>
+
+ <!-- Permissions for running Java applets and applications. -->
+ <!-- Defaults are those suitable for deploying jalview webstart www.jalview.org -->
+ <property name="application.codebase" value="*.jalview.org" />
+ <!-- and allowing the applet to be deployed from any URL -->
+ <!-- note - if you want to make sure LiveConnect works without any warnings, please rebuild and sign your applet jar with your own domain included in the codebase/allowable-codebase properties -->
+ <property name="applet.codebase" value="*.jalview.org *.dundee.ac.uk *" />
+ <property name="applet.caller-codebase" value="${applet.codebase}" />
+
+ <!-- build directory configuration -->
+ <property name="libDir" value="lib" />
+ <property name="resourceDir" value="resources" />
+ <property name="helpDir" value="help" />
+ <property name="docDir" value="doc" />
+ <property name="sourceDir" value="src" />
+ <property name="schemaDir" value="schemas" />
+ <property name="outputDir" value="classes" />
+ <property name="packageDir" value="dist" />
+ <property name="outputJar" value="jalview.jar" />
+ <!-- Jalview Applet JMol Jar Dependency -->
+ <property name="jmolJar" value="JmolApplet-14.2.14_2015.06.11.jar" />
+ <property name="varnaJar" value="VARNAv3-93.jar" />
+ <property name="jsoup" value="jsoup-1.8.1.jar" />
+ <property name="jsonSimple" value="json_simple-1.1.jar" />
+ <property name="javaJson" value="java-json.jar" />
+ <property name="jalviewLiteJar" value="jalviewApplet.jar" />
+ <property name="reportDir" value="test-reports" />
+ <property name="testDir" value="test" />
+ <property name="testOutputDir" value="tests" />
+ <!-- switch to indicate if we should obfuscate jalviewLite -->
+ <!-- <property name="donotobfuscate" value="true"/> -->
+ <!-- switch to exclude associations from generated jnlp files -->
+ <!-- <property name="nojnlpfileassocs" value="true"/> -->
+
+ <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
+ <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
+ <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
+ <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
+ <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
+ <property name="WSInterf" value="MsaWS" />
+ <property name="wsdl.Namespace" value="vamsas" />
+ <property name="wsdl.ClientNS" value="ext.vamsas" />
+ <!-- the class path for building the application -->
+ <path id="build.classpath">
+ <fileset dir="utils">
+ <include name="*.jar" />
+ <include name="**/*.jar" />
+ </fileset>
+ <fileset dir="${libDir}">
+ <include name="*.jar" />
+ <include name="**/*.jar" />
+ </fileset>
+ <fileset dir="${java.home}/lib">
+ <include name="plugin.jar"/>
+ </fileset>
+ <fileset dir="appletlib">
+ <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages
-->
- <include name="${jmolJar}" />
- </fileset>
-
- </path>
- <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
- <!-- The Location of the java 1.1.8 jdk -->
- <!--<property name="java118.home" value="C:\Sun\jdk1.1.8" />
+ <include name="${jmolJar}" />
+ <include name="${varnaJar}" />
+ </fileset>
+
+ </path>
+ <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
+ <!-- The Location of the java 1.1.8 jdk -->
+ <!--<property name="java118.home" value="C:\Sun\jdk1.1.8" /> -->
+ <property name="java118.home" value="${java.home}" />
+ <!-- <property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
-->
- <property name="java118.home" value="${java.home}" />
- <!--<property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
- --><!-- jre for 1.4 version -->
- <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
-
- <!-- the classpath for building the 1.1 applet -->
- <path id="jalviewlite.deps">
- <fileset dir="${java118.home}">
- <include name="lib/classes.zip" />
- </fileset>
- <fileset dir="${java.home}/lib">
- <include name="plugin.jar"/>
- </fileset>
- <pathelement location="appletlib/${jmolJar}" />
- </path>
+ <!-- jre for 1.4 version -->
+ <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
+
+ <!-- the classpath for building the 1.1 applet -->
+ <path id="jalviewlite.deps">
+ <fileset dir="${java118.home}">
+ <include name="lib/classes.zip" />
+ </fileset>
+ <fileset dir="${java.home}/lib">
+ <include name="plugin.jar"/>
+ </fileset>
+ <pathelement location="appletlib/${jmolJar}" />
+ <pathelement location="lib/${varnaJar}" />
+ <pathelement location="lib/${jsoup}" />
+ <pathelement location="lib/${jsonSimple}" />
+ <pathelement location="lib/${javaJson}" />
+
+ </path>
<!-- default location for outputting javadoc -->
<property name="javadocDir" value="${packageDir}/javadoc"/>
- </target>
-
-
- <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
- <target name="buildPropertiesFile" depends="init">
- <tstamp prefix="build">
- <format property="date" pattern="dd MMMM yyyy" />
- </tstamp>
- <properties file="${outputDir}/.build_properties">
- <header>
+ </target>
+
+
+ <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
+ <target name="buildPropertiesFile" depends="init">
+ <tstamp prefix="build">
+ <format property="date" pattern="dd MMMM yyyy" />
+ </tstamp>
+ <exec executable="/usr/bin/git" outputproperty="git.commit" failifexecutionfails="false">
+ <arg value="rev-parse"/>
+ <arg value="--short"/>
+ <arg value="HEAD"/>
+ </exec>
+ <exec executable="/usr/bin/git" outputproperty="git.branch" failifexecutionfails="false">
+ <arg value="rev-parse"/>
+ <arg value="--abbrev-ref"/>
+ <arg value="HEAD"/>
+ </exec>
+ <properties file="${outputDir}/.build_properties">
+ <header>
---Jalview Build Details---
- </header>
- <property name="VERSION" value="${JALVIEW_VERSION}" />
- <property name="BUILD_DATE" value="${build.date}" />
- </properties>
- </target>
-
-
- <target name="clean" depends="init">
- <!-- not efficient yet. -->
- <delete dir="${outputDir}" includes="*,**/*"/>
- </target>
-
- <target name="distclean" depends="init, clean">
-
- <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
- <delete>
- <fileset dir=".">
- <include name="${outputJar}" />
- <include name="#*#" />
- <include name="#*.*#" />
- <include name="**/#*#" />
- <include name="**/#*.*#" />
- <include name="*~" />
- <include name="*.*~" />
- <include name="**/*~" />
- <include name="**/*.*~" />
- </fileset>
- </delete>
- </target>
-
- <target name="prepare" depends="init">
- <mkdir dir="${outputDir}" />
- <copy todir="${outputDir}">
- <fileset dir=".">
- <include name="${docDir}/**/*.*" />
- <include name="${helpDir}/**/*.*" />
- <include name="${libDir}/*.jar" />
- </fileset>
- <fileset dir="${resourceDir}">
- <include name="**/*.*" />
- </fileset>
- </copy>
- </target>
-
- <target name="build" depends="prepare">
- <!-- not efficient yet. -->
- <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
- <exclude name="jalview/*applet*" />
- <exclude name="jalview/appletgui/**" />
- <exclude name="com/stevesoft/**" />
- </javac>
- </target>
- <target name="buildindices" depends="init, prepare" unless="help.uptodate">
- <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
- <arg line="html" />
- </java>
- </target>
-
- <target name="makefulldist" depends="makedist">
- <!-- the default keystore details might need to be edited here -->
- <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
-
- <fileset dir="${packageDir}">
- <include name="*.jar" />
- </fileset>
- </signjar>
- <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
-
- <!-- codebase="http://www.jalview.org/jalview/webstart" -->
- <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
- <jnlp toFile="${packageDir}/jalview.jnlp" codebase="${WebStartLocation}">
- <information>
- <title>Jalview</title>
- <vendor>The Barton Group</vendor>
- <homepage href="http://www.jalview.org" />
- <description>Jalview Multiple Alignment Editor</description>
- <description kind="short">Jalview</description>
- <icon href="logo_big.gif" />
- <offline_allowed />
- <!--
- <association mime-type="application-x/ext-file" extensions="fa"/>
+ </header>
+ <property name="VERSION" value="${JALVIEW_VERSION}" />
+ <property name="INSTALLATION" value="${INSTALLATION} git-commit:${git.commit} [${git.branch}]" />
+ <property name="BUILD_DATE" value="${build.date}" />
+ </properties>
+ </target>
+
+
+ <target name="clean" depends="init">
+ <!-- not efficient yet. -->
+ <delete dir="${outputDir}" includes="*,**/*"/>
+ </target>
+
+ <target name="distclean" depends="init, clean">
+
+ <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
+ <delete>
+ <fileset dir=".">
+ <include name="${outputJar}" />
+ <include name="#*#" />
+ <include name="#*.*#" />
+ <include name="**/#*#" />
+ <include name="**/#*.*#" />
+ <include name="*~" />
+ <include name="*.*~" />
+ <include name="**/*~" />
+ <include name="**/*.*~" />
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="prepare" depends="init">
+ <mkdir dir="${outputDir}" />
+ <copy todir="${outputDir}">
+ <fileset dir=".">
+ <include name="${docDir}/**/*.*" />
+ <include name="${helpDir}/**/*.*" />
+ <include name="${libDir}/*.jar" />
+ </fileset>
+ <fileset dir="${resourceDir}">
+ <include name="**/*.*" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="build" depends="prepare">
+ <!-- not efficient yet. -->
+ <javac source="${javac.source}" target="${javac.target}" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
+ <exclude name="jalview/*applet*" />
+ <exclude name="jalview/appletgui/**" />
+ <exclude name="com/stevesoft/**" />
+ </javac>
+ </target>
+
+
+ <target name="testclean" depends="init">
+ <delete dir="${testOutputDir}" includes="*,**/*"/>
+ </target>
+
+ <target name="prepareTests" depends="init">
+ <mkdir dir="${testOutputDir}" />
+ <copy todir="${testOutputDir}">
+ <fileset dir=".">
+ <include name="${docDir}/**/*.*" />
+ <include name="${helpDir}/**/*.*" />
+ <include name="${libDir}/*.jar" />
+ </fileset>
+ <fileset dir="${resourceDir}">
+ <include name="**/*.*" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="buildTests" depends="prepareTests">
+ <javac source="${javac.source}" target="${javac.target}" srcdir="${sourceDir}" destdir="${testOutputDir}"
+ debug="${javac.debug}" classpathref="build.classpath" includeantruntime="false" >
+ </javac>
+ <javac source="${javac.source}" target="${javac.target}" srcdir="${testDir}" destdir="${testOutputDir}"
+ debug="${javac.debug}" classpathref="build.classpath" includeantruntime="false" >
+ </javac>
+ </target>
+
+ <taskdef name="testng" classname="org.testng.TestNGAntTask" >
+ <classpath location="utils/testnglibs/testng.jar" />
+ </taskdef>
+
+ <target name="testng" depends="buildTests">
+ <testng classpathref="build.classpath" outputDir="${reportDir}"
+ haltOnFailure="false">
+ <classpath location="${testOutputDir}" />
+ <xmlfileset dir="utils" includes="jalview_testng.xml" />
+ </testng>
+ </target>
+
+ <target name="buildindices" depends="init, prepare" unless="help.uptodate">
+ <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
+ <arg line="html" />
+ </java>
+ </target>
+
+ <target name="makefulldist" depends="makedist">
+ <copy todir="${packageDir}">
+ <fileset dir="${resourceDir}/images">
+ <include name="${WebStartImage}"/>
+ </fileset>
+ </copy>
+
+ <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
+
+ <!-- create a dummy jar which will eventually contain the jnlp template -->
+ <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
+ <fileset dir="${packageDir}">
+ <include name="jalview.jar" />
+ </fileset>
+ </jar>
+
+ <mkdir dir="${packageDir}/JNLP-INF"/>
+ <antcall target="writejnlpf">
+ <param name="jnlpFile" value="${packageDir}/JNLP-INF/APPLICATION-TEMPLATE.JNLP"/>
+ <param name="inih" value="*" />
+ <param name="maxh" value="*"/>
+ </antcall>
+
+ <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
+ <fileset dir="${packageDir}">
+ <include name="JNLP-INF"/>
+ </fileset>
+ </jar>
+
+ <antcall target="writejnlpf">
+ <param name="jnlpFile" value="${packageDir}/jalview.jnlp"/>
+ <param name="inih" value="10M" />
+ <param name="maxh" value="256M"/>
+ </antcall>
+
+ <antcall target="writejnlpf">
+ <param name="jnlpFile" value="${packageDir}/jalview_1G.jnlp"/>
+ <param name="inih" value="128M" />
+ <param name="maxh" value="512M"/>
+ </antcall>
+
+ <antcall target="writejnlpf">
+ <param name="jnlpFile" value="${packageDir}/jalview_2G.jnlp"/>
+ <param name="inih" value="256M" />
+ <param name="maxh" value="1024M"/>
+ </antcall>
+
+ <!-- finally, need to postprocess to add in associations at end of 'information' element
+
+ <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
+
+ </xslt>
+
+
+ -->
+ <!--
+ <association mime-type="application-x/ext-file" extensions="fa"/>
<association mime-type="application-x/ext-file" extensions="fasta"/>
+ <association mime-type="application-x/ext-file" extensions="mfa"/>
<association mime-type="application-x/ext-file" extensions="fastq"/>
<association mime-type="application-x/ext-file" extensions="blc"/>
<association mime-type="application-x/ext-file" extensions="msf"/>
@@ -253,133 +368,114 @@
<association mime-type="application-x/ext-file" extensions="aln"/>
<association mime-type="application-x/ext-file" extensions="pir"/>
<association mime-type="application-x/ext-file" extensions="amsa"/>
- -->
- </information>
- <resources>
- <j2se version="1.5+" initial_heap_size="10M" />
- <fileset dir="${packageDir}">
- <include name="jalview.jar" />
- </fileset>
- <fileset dir="${packageDir}">
- <include name="*.jar" />
- <include name="*_*.jar" />
- <exclude name="jalview.jar" />
- </fileset>
- <property name="jalview.version" value="${JALVIEW_VERSION}" />
- </resources>
- <application_desc main_class="jalview.bin.Jalview">
- </application_desc>
- <security>
- <all_permissions />
- </security>
- </jnlp>
- <!-- the rest of these jnlp tasks are copy and pastes of the above but with different Vm args -->
- <jnlp toFile="${packageDir}/jalview_1G.jnlp" codebase="${WebStartLocation}">
- <information>
- <title>Jalview</title>
- <vendor>The Barton Group</vendor>
- <homepage href="http://www.jalview.org" />
- <description>Jalview Multiple Alignment Editor</description>
- <description kind="short">Jalview</description>
- <icon href="logo_big.gif" />
- <offline_allowed />
- <!--
- <association mime-type="application-x/ext-file" extensions="fa"/>
- <association mime-type="application-x/ext-file" extensions="fasta"/>
- <association mime-type="application-x/ext-file" extensions="fastq"/>
- <association mime-type="application-x/ext-file" extensions="blc"/>
- <association mime-type="application-x/ext-file" extensions="msf"/>
- <association mime-type="application-x/ext-file" extensions="pfam"/>
- <association mime-type="application-x/ext-file" extensions="aln"/>
- <association mime-type="application-x/ext-file" extensions="pir"/>
- <association mime-type="application-x/ext-file" extensions="amsa"/>
- -->
- </information>
- <resources>
- <j2se version="1.5+" initial_heap_size="64M" max_heap_size="512M" />
- <fileset dir="${packageDir}">
- <include name="jalview.jar" />
- </fileset>
- <fileset dir="${packageDir}">
- <include name="*.jar" />
- <include name="*_*.jar" />
- <exclude name="jalview.jar" />
- </fileset>
- <property name="jalview.version" value="${JALVIEW_VERSION}" />
- </resources>
- <application_desc main_class="jalview.bin.Jalview">
- </application_desc>
- <security>
- <all_permissions />
- </security>
- </jnlp>
- <jnlp toFile="${packageDir}/jalview_2G.jnlp" codebase="${WebStartLocation}">
- <information>
- <title>Jalview</title>
- <vendor>The Barton Group</vendor>
- <homepage href="http://www.jalview.org" />
- <description>Jalview Multiple Alignment Editor</description>
- <description kind="short">Jalview</description>
- <icon href="logo_big.gif" />
- <offline_allowed />
- <!--
- <association mime-type="application-x/ext-file" extensions="fa"/>
- <association mime-type="application-x/ext-file" extensions="fasta"/>
- <association mime-type="application-x/ext-file" extensions="fastq"/>
- <association mime-type="application-x/ext-file" extensions="blc"/>
- <association mime-type="application-x/ext-file" extensions="msf"/>
- <association mime-type="application-x/ext-file" extensions="pfam"/>
- <association mime-type="application-x/ext-file" extensions="aln"/>
- <association mime-type="application-x/ext-file" extensions="pir"/>
- <association mime-type="application-x/ext-file" extensions="amsa"/>
- -->
- </information>
- <resources>
- <j2se version="1.5+" initial_heap_size="256M" max_heap_size="1024M" />
- <fileset dir="${packageDir}">
- <include name="jalview.jar" />
- </fileset>
- <fileset dir="${packageDir}">
- <include name="*.jar" />
- <include name="*_*.jar" />
- <exclude name="jalview.jar" />
- </fileset>
- <property name="jalview.version" value="${JALVIEW_VERSION}" />
- </resources>
- <application_desc main_class="jalview.bin.Jalview">
- </application_desc>
- <security>
- <all_permissions />
- </security>
- </jnlp>
-
- </target>
-
- <target name="runenv" depends="init">
- <path id="run.classpath">
- <pathelement location="${outputDir}" />
- <fileset dir="${outputDir}">
- <include name="${libDir}/*.jar" />
- </fileset>
- </path>
- <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
-
- <echo>java -classpath ${run.classpath} jalview.bin.Jalview
+ <association mime-type="application-x/ext-file" extensions="stk"/>
+ <association mime-type="application-x/ext-file" extensions="jar"/>-->
+ <!-- and sign the jars -->
+ <!-- the default keystore details might need to be edited here -->
+ <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="SHA1withRSA">
+ <fileset dir="${packageDir}">
+ <include name="*.jar" />
+ </fileset>
+ </signjar>
+ </target>
+
+ <target name="runenv" depends="init">
+ <path id="run.classpath">
+ <pathelement location="${outputDir}" />
+ <fileset dir="${outputDir}">
+ <include name="${libDir}/*.jar" />
+ </fileset>
+ </path>
+ <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
+
+ <echo>java -classpath ${run.classpath} jalview.bin.Jalview
</echo>
- </target>
-
- <target name="buildextclients" depends="init">
- <input message="Building external client source from WSDLs - Do you really want to do this ? (Yy/Nn)" validargs="Y,y,n,N" defaultvalue="N" addproperty="doextbuild.response" />
- <condition property="dontextbuild">
- <equals arg1="n" arg2="${doextbuild.response}" />
- </condition>
- <condition property="dontextbuild">
- <equals arg1="N" arg2="${doextbuild.response}" />
- </condition>
- <fail if="dontextbuild">
+ </target>
+
+ <target name="-generatejnlpf">
+ <presetdef name="jnlpf">
+ <jnlp codebase="${WebStartLocation}">
+ <information>
+ <title>Jalview</title>
+ <vendor>The Barton Group</vendor>
+ <homepage href="http://www.jalview.org" />
+ <description>Jalview Multiple Alignment Editor</description>
+ <description kind="short">Jalview</description>
+ <icon href="${WebStartImage}" />
+ <offline_allowed />
+ </information>
+ <resources>
+ <j2se version="${j2sev}" initial_heap_size="${inih}" max_heap_size="${maxh}" />
+ <fileset dir="${packageDir}">
+ <include name="jalview.jar" />
+ </fileset>
+ <fileset dir="${packageDir}">
+ <include name="*.jar" />
+ <include name="*_*.jar" />
+ <exclude name="jalview.jar" />
+ <exclude name="*jnilib.jar"/>
+ </fileset>
+ </resources>
+ <resources os="Mac OS X">
+ <property name="jalview.version" value="${JALVIEW_VERSION}" />
+ <fileset dir="${packageDir}">
+ <include name="*quaqua*.jnilib.jar"/>
+ </fileset>
+ </resources>
+
+ <application_desc main_class="jalview.bin.Jalview">
+ </application_desc>
+ <security>
+ <all_permissions />
+ </security>
+ </jnlp>
+ </presetdef>
+
+ <jnlpf toFile="${jnlpFile}"/>
+
+ </target>
+
+ <target name="-dofakejnlpfileassoc" depends="-generatejnlpf" if="nojnlpfileassocs">
+ <echo message="Not adding JNLP File Associations"/>
+ </target>
+
+ <target name="-dojnlpfileassoc" depends="-generatejnlpf" unless="nojnlpfileassocs">
+ <replace file="${jnlpFile}">
+ <replacetoken>
+ <![CDATA[</information>]]></replacetoken>
+ <replacevalue>
+ <![CDATA[
+ <association mime-type="application-x/ext-file" extensions="fa" />
+ <association mime-type="application-x/ext-file" extensions="fasta" />
+ <association mime-type="application-x/ext-file" extensions="mfa" />
+ <association mime-type="application-x/ext-file" extensions="fastq" />
+ <association mime-type="application-x/ext-file" extensions="blc" />
+ <association mime-type="application-x/ext-file" extensions="msf" />
+ <association mime-type="application-x/ext-file" extensions="pfam" />
+ <association mime-type="application-x/ext-file" extensions="aln"/>
+ <association mime-type="application-x/ext-file" extensions="pir"/>
+ <association mime-type="application-x/ext-file" extensions="amsa"/>
+ <association mime-type="application-x/ext-file" extensions="stk"/>
+ <association mime-type="application-x/ext-file" extensions="jvp"/>
+ </information>]]></replacevalue>
+ </replace>
+ <echo message="Added file associations to JNLP file"/>
+</target>
+<target name="writejnlpf" depends="-dojnlpfileassoc,-dofakejnlpfileassoc">
+</target>
+
+<target name="buildextclients" depends="init">
+ <input message="Building external client source from WSDLs - Do you really want to do this ? (Yy/Nn)" validargs="Y,y,n,N" defaultvalue="N" addproperty="doextbuild.response" />
+ <condition property="dontextbuild">
+ <equals arg1="n" arg2="${doextbuild.response}" />
+ </condition>
+ <condition property="dontextbuild">
+ <equals arg1="N" arg2="${doextbuild.response}" />
+ </condition>
+ <fail if="dontextbuild">
Build External Client Code process aborted by user. Jalview source is unchanged.
</fail>
- <!-- Currently, this doesn't happen automatically.
+ <!-- Currently, this doesn't happen automatically.
1. Run WSDL2Java as below, which generates an ext.vamsas +
vamsas.<datapackages> fileset.
2. refactor ext.vamsas.SpecificserviceWS* to
@@ -389,207 +485,378 @@
might be using.
-->
- <path id="axisbuild">
- <path refid="build.classpath" />
- </path>
- <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
- <move todir="./bak">
- <fileset dir="${sourceDir}" id="client">
- <include name="${wsdl.ClientNS}/*.*" />
- </fileset>
- </move>
-
- <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
- <mappingSet>
- <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
- <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
- </mappingSet>
- </axis-wsdl2java>
- </target>
-
- <target name="makedist" depends="build, buildPropertiesFile, buildindices">
- <!-- make the package jar if not already existing -->
- <mkdir dir="${packageDir}" />
- <!-- clean dir if it already existed -->
- <delete>
- <fileset dir="${packageDir}">
- <include name="*.jar"/>
- </fileset>
- </delete>
- <jar destfile="${packageDir}/${outputJar}">
- <manifest>
- <attribute name="Main-Class" value="jalview.bin.Jalview" />
- </manifest>
- <fileset dir="${outputDir}/">
- <exclude name="cache*/**" />
- <exclude name="*.jar" />
- <exclude name="*.jar.*" />
- <exclude name="**/*.jar" />
- <exclude name="**/*.jar.*" />
- </fileset>
- </jar>
-
- <copy toDir="${packageDir}" flatten="true">
- <fileset dir="${outputDir}">
- <include name="*.jar" />
- <include name="**/*.jar" />
- </fileset>
- </copy>
- </target>
-
-
- <!-- jalopy code reformatter -->
- <target name="sourcescrub" depends="init,build">
- <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
- <fileset dir="${sourceDir}">
- <include name="*.java" />
- <include name="**/*.java" />
- <include name="**/**/*.java" />
- </fileset>
- </jalopy>
- </target>
-
-
-
- <!-- Compile, package and obfuscate Jalview Applet -->
- <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
-
- <target name="compileApplet" depends="init,clean">
- <mkdir dir="${outputDir}" />
- <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}"
+ <path id="axisbuild">
+ <path refid="build.classpath" />
+ </path>
+ <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
+ <move todir="./bak">
+ <fileset dir="${sourceDir}" id="client">
+ <include name="${wsdl.ClientNS}/*.*" />
+ </fileset>
+ </move>
+
+ <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
+ <mappingSet>
+ <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
+ <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
+ </mappingSet>
+ </axis-wsdl2java>
+</target>
+
+<target name="makedist" depends="build, buildPropertiesFile, buildindices">
+ <!-- make the package jar if not already existing -->
+ <mkdir dir="${packageDir}" />
+ <!-- clean dir if it already existed -->
+ <delete>
+ <fileset dir="${packageDir}">
+ <include name="*.jar"/>
+ </fileset>
+ </delete>
+ <jar destfile="${packageDir}/${outputJar}" index="true">
+ <manifest>
+ <attribute name="Main-Class" value="jalview.bin.Jalview" />
+ <attribute name="Permissions" value="all-permissions" />
+ <attribute name="Application-Name" value="Jalview Desktop" />
+ <attribute name="Codebase" value="${application.codebase}" />
+ </manifest>
+ <fileset dir="${outputDir}/">
+ <exclude name="cache*/**" />
+ <exclude name="*.jar" />
+ <exclude name="*.jar.*" />
+ <exclude name="**/*.jar" />
+ <exclude name="**/*.jar.*" />
+ </fileset>
+ </jar>
+
+ <copy toDir="${packageDir}" flatten="true">
+ <fileset dir="${outputDir}">
+ <include name="*.jar" />
+ <include name="**/*.jar" />
+ </fileset>
+ </copy>
+</target>
+
+
+<!-- jalopy code reformatter -->
+<target name="sourcescrub" depends="init,build">
+ <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
+ <fileset dir="${sourceDir}">
+ <include name="*.java" />
+ <include name="**/*.java" />
+ <include name="**/**/*.java" />
+ </fileset>
+ </jalopy>
+</target>
+
+
+
+<!-- Compile, package and obfuscate Jalview Applet -->
+<target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
+
+<target name="compileApplet" depends="init,clean">
+ <mkdir dir="${outputDir}" />
+ <javac source="${javac.source}" target="${javac.target}" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}"
classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
- excludes="ext/**,MCview/**,org/**,vamsas/**" />
- </target>
-
- <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
- <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
- <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
- <jar destfile="in.jar">
- <manifest>
- <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
- </manifest>
- <fileset dir="${outputDir}">
- <include name="com/**" />
- <include name="MCview/**" />
- <include name="jalview/**" />
- <include name=".build_properties" />
- <include name="images/idwidth.gif" />
- <include name="images/link.gif" />
- </fileset>
- </jar>
- </target>
- <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
- </target>
- <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
- <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
- <delete file="in.jar" />
- </target>
- <target name="-obfuscatereally" unless="donotobfuscate">
-
- <path id="obfuscateDeps.path">
- <pathelement location="${applet.jre.tools}" />
- <pathelement location="appletlib/${jmolJar}" />
- </path>
- <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
-
- <proguard>
- <injar file="in.jar" />
- <outjar file="${jalviewLiteJar}" />
- <libraryjar refid="obfuscateDeps.path" />
- <keep access="public" type="class" name="jalview.bin.JalviewLite">
- <field access="public" />
- <method access="public" />
- <constructor access="public" />
- </keep>
- <!-- -libraryjars "${obfuscateDeps}"
+ excludes="ext/**,gui/**,jbgui/**,MCview/**,org/**,vamsas/**,jalview/ext/rbvi/**,jalview/ext/paradise/**" />
+</target>
+
+<target name="packageApplet" depends="compileApplet, buildPropertiesFile">
+ <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
+ <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
+ <copy todir="${outputDir}/lang">
+ <fileset dir="${resourceDir}/lang">
+ <include name="**.*"/>
+ </fileset>
+ </copy>
+ <jar destfile="in.jar" index="true">
+ <manifest>
+ <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
+ <attribute name="Application-Name" value="JalviewLite" />
+ <attribute name="Codebase" value="${applet.codebase}" />
+ </manifest>
+ <fileset dir="${outputDir}">
+ <include name="com/**" />
+ <include name="MCview/**" />
+ <include name="jalview/**" />
+ <include name=".build_properties" />
+ <include name="images/idwidth.gif" />
+ <include name="images/link.gif" />
+ <include name="lang/**" />
+ </fileset>
+ </jar>
+</target>
+<target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
+</target>
+<target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
+ <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
+ <delete file="in.jar" />
+</target>
+<target name="-obfuscatereally" unless="donotobfuscate">
+
+ <path id="obfuscateDeps.path">
+ <pathelement location="${applet.jre.tools}" />
+ <pathelement location="appletlib/${jmolJar}" />
+ <pathelement location="appletlib/${jsonSimple}" />
+ <pathelement location="appletlib/${javaJson}" />
+ </path>
+ <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
+
+ <proguard>
+ <injar file="in.jar" />
+ <outjar file="${jalviewLiteJar}" />
+ <libraryjar refid="obfuscateDeps.path" />
+ <dontwarn/>
+ <keep access="public" type="class" name="jalview.bin.JalviewLite">
+ <field access="public" />
+ <method access="public" />
+ <constructor access="public" />
+ </keep>
+ <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
+ <field access="public" />
+ <method access="public" />
+ <constructor access="public" />
+ </keep>
+ <!-- -libraryjars "${obfuscateDeps}"
-injars in.jar
-outjars jalviewApplet.jar
-keep public class jalview.bin.JalviewLite
{ public * ; } -->
- </proguard>
- <delete file="in.jar" />
- </target>
-
- <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
- <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
- <delete>
- <fileset dir="${sourceDir}/jalview/schemabinding/version2">
- <include name="*.java" />
- <include name="descriptors/*.java" />
- </fileset>
- </delete>
- <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
- <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
- <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
- <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
- <!--
+ </proguard>
+ <delete file="in.jar" />
+</target>
+
+<target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
+ <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
+ <delete>
+ <fileset dir="${sourceDir}/jalview/schemabinding/version2">
+ <include name="*.java" />
+ <include name="descriptors/*.java" />
+ </fileset>
+ </delete>
+ <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
+ <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
+ <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
+ <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
+ <!--
now build the jalview.binding package with the old schema set
-->
- <delete>
- <fileset dir="${sourceDir}/jalview/binding/">
- <include name="**" />
- </fileset>
- </delete>
- <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
- <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
- <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
- </target>
- <target name="sourcedist" description="create jalview source distribution" depends="init">
- <delete file="${source.dist.name}" />
- <tar destfile="${source.dist.name}" compression="gzip">
- <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
- <include name="LICENSE" />
- <include name="README" />
- <include name="build.xml" />
- <include name="jalview-jalopy.xml" />
- <include name="JalviewApplet.jpx" />
- <include name="JalviewX.jpx" />
- <include name="nbbuild.xml"/>
- <include name="nbproject/genfiles.properties"/>
- <include name="nbproject/project.properties"/>
- <include name="nbproject/project.xml"/>
- <include name="${sourceDir}/*.java" />
- <include name="${sourceDir}/**/*.java" />
- <include name="${sourceDir}/**/*.cdr" />
- <include name="${libDir}/**/*" />
- <include name="${resourceDir}/**/*" />
- <include name="${helpDir}/**/*" />
- <include name="appletlib/${jmolJar}" />
- <exclude name="**/*locales" />
- <exclude name="*locales/**" />
- <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
- <exclude name="utils/InstallAnywhere/**Build*/**" />
- <exclude name="utils/InstallAnywhere/**Build*/**" />
- <exclude name="utils/InstallAnywhere/**locale*" />
- <exclude name="utils/InstallAnywhere/**locale*/**" />
- <include name="${schemaDir}/**/*" />
- <include name="utils/**/*" />
- <include name="${docDir}/**/*" />
- <include name="examples/**/*" />
- </tarfileset>
- </tar>
- </target>
- <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
- <copy todir="${packageDir}/examples">
- <fileset dir="examples">
- <include name="**/*"/>
- <include name="javascript/*"/>
+ <delete>
+ <fileset dir="${sourceDir}/jalview/binding/">
+ <include name="**" />
+ </fileset>
+ </delete>
+ <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
+ <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
+ <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
+</target>
+<target name="sourcedist" description="create jalview source distribution" depends="init">
+ <delete file="${source.dist.name}" />
+ <tar destfile="${source.dist.name}" compression="gzip">
+ <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
+ <include name="LICENSE" />
+ <include name="README" />
+ <include name="build.xml" />
+ <include name="jalview-jalopy.xml" />
+ <include name="JalviewApplet.jpx" />
+ <include name="JalviewX.jpx" />
+ <include name="nbbuild.xml"/>
+ <include name="nbproject/genfiles.properties"/>
+ <include name="nbproject/project.properties"/>
+ <include name="nbproject/project.xml"/>
+ <include name="${sourceDir}/*.java" />
+ <include name="${sourceDir}/**/*.java" />
+ <include name="${sourceDir}/**/*.cdr" />
+ <include name="${libDir}/**/*" />
+ <include name="${resourceDir}/**/*" />
+ <include name="${helpDir}/**/*" />
+ <include name="appletlib/${jmolJar}" />
+ <exclude name="**/*locales" />
+ <exclude name="*locales/**" />
+ <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
+ <exclude name="utils/InstallAnywhere/**Build*/**" />
+ <exclude name="utils/InstallAnywhere/**Build*/**" />
+ <exclude name="utils/InstallAnywhere/**locale*" />
+ <exclude name="utils/InstallAnywhere/**locale*/**" />
+ <include name="${schemaDir}/**/*" />
+ <include name="utils/**/*" />
+ <include name="${docDir}/**/*" />
+ <include name="examples/**/*" />
+ </tarfileset>
+ </tar>
+</target>
+<target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
+ <copy todir="${packageDir}/examples">
+ <fileset dir="examples">
+ <include name="**/*"/>
+ <include name="javascript/*"/>
<include name="jmol/*"/>
- </fileset>
- <fileset dir=".">
- <include name="jalviewApplet.jar"/>
- </fileset>
- <fileset dir="appletlib">
- <include name="**/*"/>
- </fileset>
- </copy>
-
- </target>
- <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
- <javadoc destdir="${javadocDir}">
- <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
- </packageset>
- </javadoc>
- </target>
-
+ </fileset>
+ <fileset dir=".">
+ <include name="${jalviewLiteJar}" />
+ </fileset>
+ <fileset dir="appletlib">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ <jar update="true" index="true" jarfile="${packageDir}/examples/${jalviewLiteJar}"/>
+ <jar update="true" index="true" jarfile="${packageDir}/examples/${javaJson}"/>
+ <jar update="true" index="true" jarfile="${packageDir}/examples/${jsonSimple}"/>
+ <jar update="true" index="true" jarfile="${packageDir}/examples/${jmolJar}">
+ <manifest>
+ <attribute name="Application-Name" value="Jmol (bundled with JalviewLite)"/>
+ <!-- <attribute name="Permissions" value="sandbox" /> -->
+ <!--<attribute name="Trusted-Lib" value="true" /> -->
+ <attribute name="Codebase" value="${applet.codebase}"/>
+ <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}"/>
+ </manifest>
+ </jar>
+ <signjar sigalg="SHA1WithRSA" storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
+ <fileset dir="${packageDir}/examples">
+ <include name="*.jar" />
+ </fileset>
+ </signjar>
+ <presetdef name="ap_applet.jar">
+ <!-- build a signed applet with 'all-permissions' -
+ Needs 'param name="permissions' value="all-permissions"' in applet tag
+ JalviewLite+JmolApplet linked sequence/structure fails
+ Mixed code warnings are raised
+ -->
+ <jar update="true" index="true">
+ <manifest>
+ <attribute name="Application-Name" value="JalviewLite" />
+ <attribute name="Permissions" value="all-permissions" />
+ <attribute name="Codebase" value="${applet.codebase}" />
+ <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
+ <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
+ </manifest>
+ </jar>
+ </presetdef>
+ <presetdef name="applet.jar">
+ <!-- build signed applet with sandbox permissions -
+ Needs 'param name="permissions' value="sandbox"' in applet tag
+ Preserves Pre-Java 1.7_u45 behavior once 'permissions' parameter added to applet tag
+ -->
+
+ <jar update="true" index="true">
+ <manifest>
+ <attribute name="Application-Name" value="JalviewLite" />
+ <attribute name="Permissions" value="sandbox" />
+ <attribute name="Codebase" value="${applet.codebase}" />
+ <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
+ <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
+ </manifest>
+ </jar>
+ </presetdef>
+ <presetdef name="tl_applet.jar">
+ <!-- build signed applet with trusted library/trusted permissions -
+ Needs 'param name="permissions' value="all-permissions"' in applet tag
+ j1.7_45:
+ No mixed code warnings raised
+ Jmol/JalviewLite sequence/structure example doesn't link structures
+ Raises dialog asking user to allow page to control applet via LiveConnect javascript
+
+ -->
+
+ <jar update="true" index="true">
+ <manifest>
+ <attribute name="Application-Name" value="JalviewLite" />
+ <attribute name="Permissions" value="all-permissions" />
+ <attribute name="Codebase" value="${applet.codebase}" />
+ <attribute name="Trusted-Only" value="true" />
+ <attribute name="Trusted-Library" value="true" />
+ </manifest>
+ </jar>
+ </presetdef>
+ <presetdef name="to_applet.jar">
+ <!-- not fully test variant (yet) -->
+ <jar update="true" index="true">
+ <manifest>
+ <attribute name="Application-Name" value="JalviewLite" />
+ <attribute name="Permissions" value="all-permissions" />
+ <attribute name="Codebase" value="${applet.codebase}" />
+ <attribute name="Trusted-Only" value="true" />
+ </manifest>
+ </jar>
+ </presetdef>
+ <!-- create differently privileged artefacts -->
+ <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/u_${jalviewLiteJar}" />
+ <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true"/>
+ <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/u_${javaJson}" overwrite="true"/>
+ <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/u_${jsonSimple}" overwrite="true"/>
+ <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/ap_${jalviewLiteJar}" />
+ <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/ap_${jmolJar}"/>
+ <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/ap_${javaJson}"/>
+ <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/ap_${jsonSimple}"/>
+ <ap_applet.jar jarfile="${packageDir}/examples/ap_${jalviewLiteJar}" />
+ <ap_applet.jar jarfile="${packageDir}/examples/ap_${jmolJar}" />
+ <ap_applet.jar jarfile="${packageDir}/examples/ap_${javaJson}" />
+ <ap_applet.jar jarfile="${packageDir}/examples/ap_${jsonSimple}" />
+ <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}" />
+ <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}" />
+ <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/tl_${javaJson}" />
+ <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/tl_${jsonSimple}" />
+ <tl_applet.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}" />
+ <tl_applet.jar jarfile="${packageDir}/examples/tl_${jmolJar}" />
+ <tl_applet.jar jarfile="${packageDir}/examples/tl_${javaJson}" />
+ <tl_applet.jar jarfile="${packageDir}/examples/tl_${jsonSimple}" />
+ <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/to_${jalviewLiteJar}" />
+ <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/to_${jmolJar}" />
+ <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/to_${javaJson}" />
+ <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/to_${jsonSimple}" />
+ <to_applet.jar jarfile="${packageDir}/examples/to_${jalviewLiteJar}" />
+ <to_applet.jar jarfile="${packageDir}/examples/to_${jmolJar}" />
+ <to_applet.jar jarfile="${packageDir}/examples/to_${javaJson}" />
+ <to_applet.jar jarfile="${packageDir}/examples/to_${jsonSimple}" />
+ <!-- finally, create manifest for original jars -->
+ <applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}" />
+ <applet.jar jarfile="${packageDir}/examples/${jmolJar}" />
+ <applet.jar jarfile="${packageDir}/examples/${javaJson}" />
+ <applet.jar jarfile="${packageDir}/examples/${jsonSimple}" />
+
+ <!-- todo - write examples/downloads for alternate versions of the applet -->
+ <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
+
+ <fileset dir="${packageDir}/examples">
+ <exclude name="u_*.jar"/>
+ <include name="${jalviewLiteJar}" />
+ <include name="${jmolJar}" />
+ <include name="${javaJson}" />
+ <include name="${jsonSimple}" />
+ <include name="to_${jalviewLiteJar}" />
+ <include name="to_${jmolJar}" />
+ <include name="to_${javaJson}" />
+ <include name="to_${jsonSimple}" />
+ <include name="tl_${jalviewLiteJar}" />
+ <include name="tl_${jmolJar}" />
+ <include name="tl_${javaJson}" />
+ <include name="tl_${jsonSimple}" />
+ <include name="ap_${jalviewLiteJar}" />
+ <include name="ap_${jmolJar}" />
+ <include name="ap_${javaJson}" />
+ <include name="ap_${jsonSimple}" />
+ </fileset>
+ </signjar>
+ <!-- bizarre bug causes JmolApplet to always get signed, even if excluded from above. so copy explicitly -->
+ <copy file="appletlib/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
+ <!-- finally, replace any launchApp servlet tags with a version specification -->
+ <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}"">
+ <replacetoken><![CDATA[http://www.jalview.org/services/launchApp"]]></replacetoken>
+ <fileset dir="${packageDir}/examples">
+ <include name="**/*.html"/>
+ </fileset>
+ </replace>
+ <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}'">
+ <replacetoken><![CDATA[http://www.jalview.org/services/launchApp']]></replacetoken>
+ <fileset dir="${packageDir}/examples">
+ <include name="**/*.html"/>
+ </fileset>
+ </replace>
+
+</target>
+<target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
+ <javadoc destdir="${javadocDir}">
+ <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
+ </packageset>
+ </javadoc>
+</target>
</project>
diff --git a/doc/AddingGroovySupport.html b/doc/AddingGroovySupport.html
index 5dfa54f..e71c53b 100644
--- a/doc/AddingGroovySupport.html
+++ b/doc/AddingGroovySupport.html
@@ -1,20 +1,21 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<title>Adding Groovy Support to Jalview
</title>
diff --git a/doc/AnnotationPostAnalysis.txt b/doc/AnnotationPostAnalysis.txt
new file mode 100644
index 0000000..014cb73
--- /dev/null
+++ b/doc/AnnotationPostAnalysis.txt
@@ -0,0 +1,59 @@
+##
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+# Copyright (C) 2015 The Jalview Authors
+#
+# This file is part of Jalview.
+#
+# Jalview is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, either version 3
+# of the License, or (at your option) any later version.
+#
+# Jalview is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+# The Jalview Authors are detailed in the 'AUTHORS' file.
+##
+Init.
+optimise rendering - use same model as alignment but with vertical binary sweep to select range of annotation to render:
+Vertical interval list
+. run length compress the sizes -> n_i * v_height_i -> label each node - total and accumulated total vertical pos (under current visibility settings ?)
+--> ins/delete/hide/show of one or more contiguous individual rows causes local -> global update of position sums.
+--
+.
+indexOf(VPosition in annotation display window),
+VPositionOf(AnnotationI)
+
+0.
+i. Hide/show by whole annotation set id
+ii. move to top/bottom
+iii.
+
+1. Summarising annotation
+{ Annotation Class ID
+|_ { Type string } }
+->
+
+Simple modal :
+- Proportion of sequences with most frequent symbol
+- symbol logo
+[ option to drill down and subselect based on particular symbol or subdivide by all symbols ]
+
+3. Clustering based on annotation
+A few routes:
+use built in PCA calculation to do scalar product based analysis of one or many annotation vectors.
+Sliding window over alignment doing pca at each point. Analyse trajectories through PCA ? (see maximum/minimum and stretches of local similarity)
+
+
+* ''' ACCESS ALL MENUS '''
+-> allow context popup to show all window submenus
+{ local relevant }
+{ Parent window -> file,edit,etc }
+{ Desktop -> File, Tools, ... }
+{ other areas more distant - e.g. sequence/annotation ID popup from middle of alignment/annotation area }
+
+
diff --git a/doc/JalviewRNASupport.html b/doc/JalviewRNASupport.html
new file mode 100644
index 0000000..2e610d9
--- /dev/null
+++ b/doc/JalviewRNASupport.html
@@ -0,0 +1,84 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<title>Jalview RNA Support</title>
+<body>
+<h1>
+Jalview RNA Support
+</h1>
+<p>
+Jalview RNA support was first added during a
+<a href="http://socghop.appspot.com/gsoc/program/home/google/gsoc2010">2010 Google Summer of Code Project</a> by
+Lauren Lui (see her <a href="https://www.nescent.org/wg_phyloinformatics/PhyloSoC:Extending_Jalview_to_Support_RNA_Alignment_Annotation_and_Secondary_Structure_Visualization">
+NESCent wiki page</a> and the project <a href="http://jalview-rnasupport.blogspot.com/">blog</a>).
+</p>
+<h2>What was added</h2>
+<p>
+<ul>
+<li>Recognition of ".stk" and ".sto" extensions for Stockholm file format.</li>
+<li>Purine/Pyrimidine colour scheme.</li>
+<li>Colouring by RNA helices. Helices are determined from the secondary structure line written in WUSS format in Stockholm files.</li>
+<li>Ability to fetch sequences from RFAM.</li>
+<li>Visualization of RNA secondary structure in WUSS format (from input file) and RNA helices in the
+annotation panel.</li>
+</ul>
+</p>
+<p>In 2011, Jan Engelhardt was supported by <a href="http://socghop.appspot.com/gsoc/program/home/google/gsoc2011">GSOC</a> to extend Lauren's work, with <a href="https://www.nescent.org/wg_phyloinformatics/PhyloSoC:_Extending_Jalview_support_for_handling_RNA">support for viewing secondary structure in VARNA and visualizing base pair contact conservation</a>.
+</p>
+<h2>What Jan added</h2>
+<p>
+<ul>
+<li>Enable RNA secondary structure annotation to be imported/exported through Jalview annotation files</li>
+<li>Incorporated <a href="varna.lri.fr">VARNA</a> into the desktop application</li>
+<li>Added a new base pair consensus histogram and sequence logo annotation row</li>
+</ul>
+</p>
+<h2>TODO</h2>
+<h3>Secondary Structure Visualization/Annotation</h3>
+<ul>
+<li>Detection of pseudoknots and tetraloops </li>
+<li>Update colouring of RNA helices in annotation panel when "By RNA helices" colouring is selected</li>
+<li>Editing of secondary structure line</li>
+<li>Update helix colouring when secondary structure changes.</li>
+<li>Support per sequence in RNA secondary structure annotation</li>
+</ul>
+
+<h3>Colour schemes</h3>
+<ul>
+<li>Coloring scheme for pseudoknots</li>
+<li>Covariation colour scheme similar to RFAM's</li>
+<li>Coloring schemes from other MSA viewers, like 4Sale and Assemble</li>
+<li>Highlight positions in alignments that break base pairing specified in the secondary structure line</li>
+</ul>
+<h3>Embed VARNA, An RNA Secondary Structure Viewer</h3>
+<ul>
+<li>The homepage for VARNA can be found <a href="http://varna.lri.fr/">here</a>.</li>
+<li>Hook VARNA into Jalview</li>
+<li>Ability to port RNA secondary structure (e.g. from Stockholm files) into VARNA</li>
+<li>Mouse over and selections get highlighted in the linked views</li>
+</ul>
+<h3>Miscellaneous</h3>
+<ul>
+<li>Add changes done to the main gui to the applet gui</li>
+<li>Add export of Stockholm file format</li>
+</ul>
+</p>
+</body>
+</html>
+
diff --git a/doc/UnitTesting.html b/doc/UnitTesting.html
new file mode 100644
index 0000000..3f1eb5a
--- /dev/null
+++ b/doc/UnitTesting.html
@@ -0,0 +1,111 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<head>
+<title>Unit testing in Jalview</title>
+</head>
+<body>
+<h1> Unit testing in Jalview </h1>
+
+<p>
+In June 2015, the Jalview team adopted <a href=http://testng.org/doc/index.html>TestNG</a> as the favourite unit testing framework. Consequently all existing JUnit tests were ported to TestNG.
+
+
+<h2>Test Groups</h2>
+<a href=http://testng.org/doc/index.html>TestNG</a> provides the ability to perform sophisticated grouping of tests using method annotations. This enables TestNG to be invoked and asked to include a certain set of groups (or regular expression) while excluding another set. This gives maximum flexibility in how tests are partitioned and doesn't require you to recompile anything if you want to run two different sets of tests back to back.
+
+<p>The following test groups are available within the Jalview test environment:
+<ul>
+ <li> Functional - basic unit tests that should always be successfully executed</li>
+ <li> Network - depends on network connection to execute successfully</li>
+ <li> External - depends on external third party resource to execute</li>
+ <li> Interactive - depends on human interaction to execute successfully</li>
+</ul>
+
+<h2>Writing new tests</h2>
+To write a new TestNG tests in Jalview, create a new java class and create test methods which are properly annotated with appropriate <a href=http://testng.org/doc/documentation-main.html#annotations>TestNG annotations</a>. Here is a simple example test:
+
+<pre><code>
+ package jalview.test;
+
+ import org.testng.annotations.*;
+
+ public class SimpleTest {
+
+ @BeforeClass(alwaysRun = true)
+ public void setUp() {
+ // code that will be invoked when this test is instantiated
+ }
+
+ @Test(groups = { "Functional" })
+ public void aFunctionalTest() {
+ System.out.println("Functional test");
+ }
+
+ @Test(groups = { "Network" })
+ public void aNetworkDependentTest() {
+ System.out.println("Network dependent test");
+ }
+
+ @Test(groups = { "External" })
+ public void anExternalDependencyTest() {
+ System.out.println(“Test with external dependence to a third party resource");
+ }
+
+ @Test(groups = { "Interactive" })
+ public void anInteractiveTest() {
+ System.out.println("Human interactive test");
+ }
+ }
+</code></pre>
+
+<h2>Test Execution</h2>
+The TestNG tests for Jalview can be executed in any of the following ways:
+<ul>
+ <li><b>From Eclipse IDE:</b>
+ </br> To execute Jalview unit test in eclipse please take the following steps:
+ <ul>
+ <li>Ensure that you have TestNG plugin correctly install for eclipse</li>
+ <li>Ensure that your test classes are error free and properly annotated</li>
+ <li>Create a lunch configuration "Select the Run / Run... (or Run / Debug...) menu and create a new TestNG configuration"</li>
+ <li>Run the tests by executing the configuration target created above</li>
+ </ul>
+ A more detailed guide for installing and executing TestNG in eclipse is available at <a href=http://testng.org/doc/eclipse.html>testng.org/doc/eclipse.html</a> <br>
+ </li>
+ <li><b>From Ant:</b>
+ </br> To execute Jalview unit test from ant please take the following steps:
+ <ul>
+ <li>Ensure that you have ant installed</li>
+ <li>Ensure that your test classes are error free and properly annotated</li>
+ <li>Ensure that the test class or group is available in the TestNG config file. For Jalview this is located in jalview/utils/jalview_testng.xml</li>
+ <li>Add a TestNG run target to your main ant build file, and execute the target.</li>
+ </ul>
+ A more detailed guide for executing TestNG from ant is available at <a href=http://testng.org/doc/ant.html>http://testng.org/doc/ant.html</a>
+ </li>
+</ul>
+
+<h2>TestNG Tutorial</h2>
+You can find more up-to-date documentations and tutorials on TestNG from the following recommended links:</br>
+<a href=http://http://testng.org/doc/documentation-main.html>http://http://testng.org/doc/documentation-main.html</a></br>
+<a href=http://www.tutorialspoint.com/testng/>http://www.tutorialspoint.com/testng/</a>
+
+
+
+</body>
+</html>
diff --git a/doc/biojsmsa-templates.html b/doc/biojsmsa-templates.html
new file mode 100644
index 0000000..50da663
--- /dev/null
+++ b/doc/biojsmsa-templates.html
@@ -0,0 +1,101 @@
+<html>
+<!--
+ *Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ *Copyright (C) 2015 The Jalview Authors
+ *
+ *This file is part of Jalview.
+ *
+ *Jalview is free software: you can redistribute it and/or
+ *modify it under the terms of the GNU General Public License
+ *as published by the Free Software Foundation, either version 3
+ *of the License, or (at your option) any later version.
+ *
+ *Jalview is distributed in the hope that it will be useful, but
+ *WITHOUT ANY WARRANTY; without even the implied warranty
+ *of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *PURPOSE. See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ *The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<title>The BioJS MSA Templating System</title>
+<body>
+ <h2>BioJS MSA Templates</h2>
+ <p>The Jalview Desktop uses a template file to embed data when
+ exporting an alignment as a BioJS MSA HTML page. This means it is
+ possible to update Jalview's template with different versions of the
+ BioJS MSA viewer, or even customise the page for your own needs.</p>
+ <p>NOTE: This is an experimental feature new in jalview 2.9 -
+ please get in contact with the developers if you're interested in
+ creating your own templates so we can improve this documentation !</p>
+ <h3>The components of a BioJS template file</h3>
+ <ul>
+ <li>All JavaScripts necessary to render and visualise BioJS
+ data</li>
+ <li>JavaScripts to transform BioJSON data to BioJS MSA data</li>
+ <li>Place holder for BioJSON data (this can be a div or input
+ element as show below): <pre>
+ <code><div name="seqData" id="seqData" style="display: none;">#valid BioJSON data#</div> OR
+<input type="hidden" id="seqData" name="seqData" value='#valid BioJSON data#'/>
+</code>
+ </pre>
+ </li>
+ </ul>
+
+ The externalised BioJS MSA templates are available in the Github
+ repository
+ <a
+ href="https://github.com/jalview/exporter-templates/tree/master/biojs">https://github.com/jalview/exporter-templates/tree/master/biojs</a>.
+ <br />Jalview processes the
+ <b>package.json</b> file at
+ <a
+ href="https://github.com/jalview/exporter-templates/blob/master/biojs/package.json">https://github.com/jalview/exporter-templates/blob/master/biojs/package.json</a>
+ to work out the available versions of BioJS MSA Viewer templates and
+ the latest release version to use for its exports.
+
+
+ <h2>Creating/Updating a new BioJS MSA Template</h2>
+ The following steps can be taken to create or update a BioJS MSA
+ template
+ <ol>
+ <li>Add/update all BioJS MSA scripts to the template file</li>
+ <li>Add/update codes for transforming BioJSON data to BioJS MSA
+ data (this requires knowledge of both data models)</li>
+ <li>Ensure that the new template created can be employed by
+ Jalview to generate valid BioJS MSA files. This can be achieved by
+ following the steps below to deploy the new export template to a
+ test repository and subsequently configure Jalview to use the test
+ repository for testing the template:
+ <ol type="i">
+ <li>Publish the template along with a valid package.json
+ file to an online repository</li>
+ <li>Configure Jalview preferences to point to the raw URL
+ of package.json in your test repository. This is done by
+ creating/changing the property <b>'biojs_template_git_repo'</b>
+ in the <b>jalview_properties</b> file <br />e.g. <b>biojs_template_git_repo=https://raw.githubusercontent.com/gituser/biojs-templates/package.json</b>
+ </li>
+ <li>Restart Jalview and ensure that the new templates are
+ downloaded</li>
+ <li>Export an alignment to BioJS MSA</li>
+ <li>Check that the exported file is valid and reflects all
+ the incorporated changes</li>
+ </ol>
+ </li>
+ <li>Commit the new template to the official Jalview-BioJS
+ Github template repository <a
+ href="https://github.com/jalview/exporter-templates/tree/master/biojs">https://github.com/jalview/exporter-templates/tree/master/biojs</a>
+ </li>
+ <li>Update the package.json of the official template repository
+ at <a
+ href="https://github.com/jalview/exporter-templates/blob/master/biojs/package.json">https://github.com/jalview/exporter-templates/blob/master/biojs/package.json</a>
+ accordingly
+ </li>
+ <li>Restore value for <b>'biojs_template_git_repo'</b> in
+ jalview_properties to point to the official template repository
+ </li>
+ <li>Repeat steps 3iii to 3v above</li>
+ </ol>
+
+</body>
+</html>
diff --git a/doc/building.html b/doc/building.html
index dfb21a2..5b9158a 100644
--- a/doc/building.html
+++ b/doc/building.html
@@ -1,20 +1,21 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<head>
<title>Building Jalview from Source</title>
@@ -25,10 +26,9 @@
<p>
You will need the following (hopefully):<br>
<ul>
-<li>Java development kit (we used JDK1.5SE but JDK1.6 will work too,
-and maybe even jikes).</li>
+<li>Java development kit (JDK1.6 is the recommended platform for developing with Jalview, although JDK1.7 seems to work too!).</li>
<li>Ant (we think 1.5.4 is quite sufficient to use the simple build
-file supplied).</li>
+file supplied, and it seems to work with later versions e.g. 1.7).</li>
</ul>
With any luck, after setting your paths and JAVA_HOME correctly, you
just need to change to the Jalview directory and run ant (this works
diff --git a/doc/developing.html b/doc/developing.html
index a5fc4a3..fd6ba1f 100644
--- a/doc/developing.html
+++ b/doc/developing.html
@@ -1,41 +1,42 @@
-<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>Developing Jalview</head>
- <body>
-<p><h1>Developing Jalview</h1>
-</p>
-<ul>
-<li>Basic Source Structure Guidelines</li>
-<li>The Applet and The Application - whats the difference ?</li>
-<li>Package Architecture<br>
-</li>
-<li>Specific Development Guidelines
-<ul>
-<li><a href="newdmobj.html">Adding new datamodel objects to Jalview</a></li>
-<li>Adding new IO capabilities to Jalview</li>
-<li>Adding new database types to Jalview</li>
-<li>Working with the Jalview DAS annotation fetcher</li>
-<li>Adding new analysis methods to jalview</li>
-<li>Adding new web service functionality to jalview</li>
-</ul>
-</li>
-</ul>
-</body>
-</html>
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>Developing Jalview</head>
+ <body>
+<p><h1>Developing Jalview</h1>
+</p>
+<ul>
+<li>Basic Source Structure Guidelines</li>
+<li>The Applet and The Application - whats the difference ?</li>
+<li>Package Architecture<br>
+</li>
+<li>Specific Development Guidelines
+<ul>
+<li><a href="newdmobj.html">Adding new datamodel objects to Jalview</a></li>
+<li>Adding new IO capabilities to Jalview</li>
+<li>Adding new database types to Jalview</li>
+<li>Working with the Jalview DAS annotation fetcher</li>
+<li>Adding new analysis methods to jalview</li>
+<li>Adding new web service functionality to jalview</li>
+</ul>
+</li>
+</ul>
+</body>
+</html>
diff --git a/doc/i18n.html b/doc/i18n.html
new file mode 100644
index 0000000..a985524
--- /dev/null
+++ b/doc/i18n.html
@@ -0,0 +1,96 @@
+<!--
+ *Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ *Copyright (C) 2015 The Jalview Authors
+ *
+ *This file is part of Jalview.
+ *
+ *Jalview is free software: you can redistribute it and/or
+ *modify it under the terms of the GNU General Public License
+ *as published by the Free Software Foundation, either version 3
+ *of the License, or (at your option) any later version.
+ *
+ *Jalview is distributed in the hope that it will be useful, but
+ *WITHOUT ANY WARRANTY; without even the implied warranty
+ *of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *PURPOSE. See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ *The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>Jalview i18n</head>
+ <body>
+<h1>Best practices</h1>
+<ol>
+<li>Follow the standards described in this guide</li>
+<li>Always use properties files for user interface text; never include displayable text in code</li>
+<li>Use properties files only for user interface text (Messages_xx.properties) and config files for configuration settings (jalview.properties).</li>
+<li>Use a proper naming schema for keys in your resource bundles. The name of the keys should provide some information about the context of the displayed text. This helps the translators during the translation process.</li>
+<li>Group keys by view, ie. edit.title, edit.instructions, list.title, list.instructions, create.title, etc</li>
+<li>Never use displayable text when executing comparisons within the logic of the tool (separate codified values from displayable text)</li>
+<li>Always use the MessageManager class for retrieving properties values, and invoke MessageManager methods dynamically, to accommodate dynamic user preferences (see MessageManager below).</li>
+<li>All numbers and dates should be formatted specific to the user's locale (e.g. java.text.NumberFormat and java.text.DateFormat)</li>
+<li>Test code in more than one language</li>
+</ol>
+<h1>MessageManager</h1>
+<p>The jalview.util.MessageManager class is a wrapper class for the ResourceBundle class. It provides dynamic language/locale support for individual users, and is recommended for all Jalview code.</p>
+<p>To use it within your code, you only have to invoke MessageManager with the text key in Messages_xx.properties:</p>
+<p>JButton ok = new JButton(MessageManager.getString("button.ok"));</p>
+<p>This will set JButton text to the one included at button.ok key. In English JButton text will be OK, while in Spanish will be Aceptar. This is the big thing of i18n. :)</p>
+<h1>Don't rely comparisons on labels</h1>
+<p>Don't use this type of coding:
+ threshold.addItem("No Threshold");<br>
+ threshold.addItem("Above Threshold");<br>
+ threshold.addItem("Below Threshold");<br>
+ [...]<br>
+ if (threshold.getSelectedItem().equals("Above Threshold"))<br>
+ {</br>
+ aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD;<br>
+ }<br>
+ else if (threshold.getSelectedItem().equals("Below Threshold"))<br>
+ {<br>
+ aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;<br>
+ }<br>
+</p>
+<p>Once text has been translated, these equals will fail as the label won't be the English ones. It should be used getSelectedIndex() instead of getSelectedItem(). If you do the proper way, the code will look like this:<br>
+ threshold.addItem(MessageManager.getString("label.threshold_feature_no_thereshold"));<br>
+ threshold.addItem(MessageManager.getString("label.threshold_feature_above_thereshold"));<br>
+ threshold.addItem(MessageManager.getString("label.threshold_feature_below_thereshold"));<br>
+ [...]<br>
+ if (threshold.getSelectedIndex()==1)<br>
+ {<br>
+ aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD;<br>
+ }<br>
+ else if (threshold.getSelectedIndex()==2)<br>
+ {<br>
+ aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;<br>
+ }<br>
+</p>
+<h1>How to translate Jalview</h1>
+<p>Anyone interested in localizing/translating Jalview is strongly encouraged to join the <a href="mailto:jalview-dev at jalview.org">Jalview Development List</a> list. We would recommend that you read this entire page before proceeding.</p>
+<p>If you are planning on working on a Jalview translation, please send us an email (<a href="mailto:jalview-dev at jalview.org">Jalview Development List</a>). There may be someone else already working on translating Jalview to your target language.</p>
+<p>Once you have downloaded the source code (available at <a href="http://www.jalview.org/download">http://www.jalview.org/download</a>), you must edit {jalview.home}/resources/lang/Messages_xx.properties, where xx refers to your language country code. If it doesn't exits, rename Messages.properties to Messages_xx.properties.</p>
+<p>Next step...start transtalation!</p>
+<p>Once you have it translated, we would appreciate if you contribute it forwarding the file to <a href="mailto:jalview-dev at jalview.org">Jalview Development List</a>. We will commit it to the code base as soon as possible. Thanks so much for this in advance!</p>
+</body>
+</html>
+
diff --git a/doc/index.html b/doc/index.html
index 4b43977..1f24939 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -1,153 +1,154 @@
-<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-Jalview Source Documentation
-</head>
-<body>
-<h1>Jalview Source Documentation</h1>
-<p>The file structure of the Jalview Source tree is as follows:
-<ul>
- <li>README - basic info for getting started with the source tree.</li>
- <li>LICENCE - the GPL Licence</li>
- <li>RELEASE - contains the name of the tag for the latest
- 'official' Jalview release associated with the source.</li>
- <li>build.xml - ant build for jalview - the 'help' task gives
- information about each task, and there's lots of comments too.</li>
- <li></li>
- <li>src - all jalview source packages, including any specially
- adapted code from other GPL programs. See <a href="developing.html">Jalview
- Development</a> for more info.</li>
- <li>lib - All the libraries that Jalview depends on. Every jar
- file in this directory should be added to the classpath when building
- or running the jalview application.</li>
- <li>appletlib - Any libraries that are specifically required for compiling and/or running the jalviewLite applet (e.g. an applet build of Jmol).
- <li>help - the jalview JavaHelp documents<br>
- <ul>
- <li>help.hs - the main index page. This is generated by the
- jhindexer program run by the 'buildindices' task in build.xml</li>
- <li>help.jhm - helpTOC map - an XML document listing simple names
- for each html page that is linked to in the help contents structure.</li>
- <li>helpTOC.xml - the table of contents presented to the user
- when the help is opened.</li>
- <li>icons - widgets needed for the help system GUI</li>
- <li>html - the help documentation. It loosely follows the
- following structure: <br>
- <ul>
- <li>calculations - pages concerning the calculations menu</li>
- <li>webServices - pages describing web services</li>
- <li>colourSchemes - the ways amino acids can be coloured and the
- user interface for defining them</li>
- <li>editing - mechanisms and interfaces for editing alignments</li>
- <li>features - used to be the sequence features documentation,
- but now contains all sorts of jalview 'features'.</li>
- <li>io - getting data in and out of jalview</li>
- <li>menus - all the menus in Jalview (and the applet)</li>
- <li>misc - useful info</li>
- <li>By convention, we try to maintain the whatsNew.html document
- with each release and complete the releases.html matrix to detail
- what has changed from one version to another.</li>
- <li>keys.html contains all the keystrokes in Jalview - please
- keep this up to date.</li>
- </ul>
- </li>
- </ul>
- </li>
- <li>resources - files needed at run-time for jalview execution.<br>
- <ul>
- <li>images - icons used by jalview</li>
- <li>log4j and commons-logging.properties - configure default
- appenders and logging for Jalview, castor.</li>
- <li>embl_mapping.xml - castor mapping file for the EMBL XML
- Schema.</li>
- .
- <li>uniprot_mapping.xml - castor mapping file for the Uniprot XML
- Schema.</li>
- </ul>
- </li>
- <li>schemas - XML schema definitions used or understood by
- Jalview.<br>
- Jalview uses castor to bind java to XML - either using mapping files
- hand-crafted from a schema in this directory, or from java objects
- generated from the schema and an associated set of properties. <br>
- See the castorbinding task in the ant build.xml file for more info.
- <ul>
- <li>Jalview Project Archive XML Version 1<br>
- vamsasJvV1.xsd<br>
- jalviewJvV1.xsd<br>
- jalview.nodesc.properties - sourcegenerator properties file</li>
- <li>jalview Project Archive XML Version 2<br>
- Jalview works out which version a project is by first trying
- to parse XML with these schema definitions, and then if there are
- problems, falls back to the V1 schema classes.
- <ul>
- <li>vamsas.xsd<br>
- jalview.xsd<br>
- jalview.properties - sourcegenerator properties file</li>
- </ul></li>
- <li>JalviewUserColours.xsd is used by both V1 and V2 project XML
- definitions. This schema is also used to store user colour schemes
- externally from the project file.</li>
- </ul>
- </li>
- <li>utils - various resources needed when building or deploying
- jalview.
- <ul>
- <li>InstallAnywhere
- <ul>
- <li>Jalview.iap_xml is the InstallAnywhere XML project used to
- create the Jalview InstallAnywhere distribution.</li>
- <li>All the other files are bundled into this for installer
- displays. The README_IA appears in the installation directory.</li>
- </ul>
- <li>jalopy<br>
- This is a legacy directory - we intended to use jalopy for
- standardising the jalview source formatting, but found it had a number
- of bugs.</li>
- <li>axis-ant.jar - tasks for constructing client skeletons from
- WSDL documents.</li>
- <li>roxes-ant-tasks-1.2-2004-01-30.jar - conditionals and other
- useful ant tasks.</li>
- <li>castor-*-codegen.jar and castor-*-anttask.jar - codegenerator
- task and library for regenerating the Java classes from schemas. It is
- important to update these and rebuild the source if the version of
- castor that Jalview uses is updated.</li>
- <li>gff2annot.pl - useful script to translate gff to jalview
- features file format - although its not needed since Jalview can parse
- GFF natively (normally at least).</li>
- <li>jhall.jar, jhindexer.jar - the java help system and indexer
- code to build the jalview help in the help directory.</li>
- <li>proguard.jar - obfuscator used when creating
- jalviewApplet.jar. See the build.xml file and the building jalview
- documentation.</li>
- </ul>
- </li>
- <li>installAnywhere - where the installAnywhere build is generated</li>
- <li><em>keys</em> - you might not have this - see <a
- href="building.html">building</a> for info on how to create it.</li>
-<li>dist - where the Jars and JNLP file for the java webstart distribution is generated, and where a copy of the examples directory is created complete with jalviewApplet.jar and the contents of appletlib/*.jar.</li>
-<li>examples - a set of example jalview projects and web pages demonstrating the jalviewLite applet. This is essentially mirrors the <a href="http://www.jalview.org/examples/">www.jalview.org/examples</a> directory on Jalview's website.</li>
-<li>nbbuild.xml - custom config used by the vanilla netbeans project in nbproject</li>
-<li>nbproject - vanilla netbeans project</li>
-<li>JalviewApplet.jpx, JalviewX.jpx - old JBuilder project files</li>
-<li>.project - eclipse .project definition</li>
-</ul>
-
-</body>
-</html>
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+Jalview Source Documentation
+</head>
+<body>
+<h1>Jalview Source Documentation</h1>
+<p>The file structure of the Jalview Source tree is as follows:
+<ul>
+ <li>README - basic info for getting started with the source tree.</li>
+ <li>LICENCE - the GPL Licence</li>
+ <li>RELEASE - contains the name of the tag for the latest
+ 'official' Jalview release associated with the source.</li>
+ <li>build.xml - ant build for jalview - the 'help' task gives
+ information about each task, and there's lots of comments too.</li>
+ <li></li>
+ <li>src - all jalview source packages, including any specially
+ adapted code from other GPL programs. See <a href="developing.html">Jalview
+ Development</a> for more info.</li>
+ <li>lib - All the libraries that Jalview depends on. Every jar
+ file in this directory should be added to the classpath when building
+ or running the jalview application.</li>
+ <li>appletlib - Any libraries that are specifically required for compiling and/or running the jalviewLite applet (e.g. an applet build of Jmol).
+ <li>help - the jalview JavaHelp documents<br>
+ <ul>
+ <li>help.hs - the main index page. This is generated by the
+ jhindexer program run by the 'buildindices' task in build.xml</li>
+ <li>help.jhm - helpTOC map - an XML document listing simple names
+ for each html page that is linked to in the help contents structure.</li>
+ <li>helpTOC.xml - the table of contents presented to the user
+ when the help is opened.</li>
+ <li>icons - widgets needed for the help system GUI</li>
+ <li>html - the help documentation. It loosely follows the
+ following structure: <br>
+ <ul>
+ <li>calculations - pages concerning the calculations menu</li>
+ <li>webServices - pages describing web services</li>
+ <li>colourSchemes - the ways amino acids can be coloured and the
+ user interface for defining them</li>
+ <li>editing - mechanisms and interfaces for editing alignments</li>
+ <li>features - used to be the sequence features documentation,
+ but now contains all sorts of jalview 'features'.</li>
+ <li>io - getting data in and out of jalview</li>
+ <li>menus - all the menus in Jalview (and the applet)</li>
+ <li>misc - useful info</li>
+ <li>By convention, we try to maintain the whatsNew.html document
+ with each release and complete the releases.html matrix to detail
+ what has changed from one version to another.</li>
+ <li>keys.html contains all the keystrokes in Jalview - please
+ keep this up to date.</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li>resources - files needed at run-time for jalview execution.<br>
+ <ul>
+ <li>images - icons used by jalview</li>
+ <li>log4j and commons-logging.properties - configure default
+ appenders and logging for Jalview, castor.</li>
+ <li>embl_mapping.xml - castor mapping file for the EMBL XML
+ Schema.</li>
+ .
+ <li>uniprot_mapping.xml - castor mapping file for the Uniprot XML
+ Schema.</li>
+ </ul>
+ </li>
+ <li>schemas - XML schema definitions used or understood by
+ Jalview.<br>
+ Jalview uses castor to bind java to XML - either using mapping files
+ hand-crafted from a schema in this directory, or from java objects
+ generated from the schema and an associated set of properties. <br>
+ See the castorbinding task in the ant build.xml file for more info.
+ <ul>
+ <li>Jalview Project Archive XML Version 1<br>
+ vamsasJvV1.xsd<br>
+ jalviewJvV1.xsd<br>
+ jalview.nodesc.properties - sourcegenerator properties file</li>
+ <li>jalview Project Archive XML Version 2<br>
+ Jalview works out which version a project is by first trying
+ to parse XML with these schema definitions, and then if there are
+ problems, falls back to the V1 schema classes.
+ <ul>
+ <li>vamsas.xsd<br>
+ jalview.xsd<br>
+ jalview.properties - sourcegenerator properties file</li>
+ </ul></li>
+ <li>JalviewUserColours.xsd is used by both V1 and V2 project XML
+ definitions. This schema is also used to store user colour schemes
+ externally from the project file.</li>
+ </ul>
+ </li>
+ <li>utils - various resources needed when building or deploying
+ jalview.
+ <ul>
+ <li>InstallAnywhere
+ <ul>
+ <li>Jalview.iap_xml is the InstallAnywhere XML project used to
+ create the Jalview InstallAnywhere distribution.</li>
+ <li>All the other files are bundled into this for installer
+ displays. The README_IA appears in the installation directory.</li>
+ </ul>
+ <li>jalopy<br>
+ This is a legacy directory - we intended to use jalopy for
+ standardising the jalview source formatting, but found it had a number
+ of bugs.</li>
+ <li>axis-ant.jar - tasks for constructing client skeletons from
+ WSDL documents.</li>
+ <li>roxes-ant-tasks-1.2-2004-01-30.jar - conditionals and other
+ useful ant tasks.</li>
+ <li>castor-*-codegen.jar and castor-*-anttask.jar - codegenerator
+ task and library for regenerating the Java classes from schemas. It is
+ important to update these and rebuild the source if the version of
+ castor that Jalview uses is updated.</li>
+ <li>gff2annot.pl - useful script to translate gff to jalview
+ features file format - although its not needed since Jalview can parse
+ GFF natively (normally at least).</li>
+ <li>jhall.jar, jhindexer.jar - the java help system and indexer
+ code to build the jalview help in the help directory.</li>
+ <li>proguard.jar - obfuscator used when creating
+ jalviewApplet.jar. See the build.xml file and the building jalview
+ documentation.</li>
+ </ul>
+ </li>
+ <li>installAnywhere - where the installAnywhere build is generated</li>
+ <li><em>keys</em> - you might not have this - see <a
+ href="building.html">building</a> for info on how to create it.</li>
+<li>dist - where the Jars and JNLP file for the java webstart distribution is generated, and where a copy of the examples directory is created complete with jalviewApplet.jar and the contents of appletlib/*.jar.</li>
+<li>examples - a set of example jalview projects and web pages demonstrating the jalviewLite applet. This is essentially mirrors the <a href="http://www.jalview.org/examples/">www.jalview.org/examples</a> directory on Jalview's website.</li>
+<li>nbbuild.xml - custom config used by the vanilla netbeans project in nbproject</li>
+<li>nbproject - vanilla netbeans project</li>
+<li>JalviewApplet.jpx, JalviewX.jpx - old JBuilder project files</li>
+<li>.project - eclipse .project definition</li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/newdmobj.html b/doc/newdmobj.html
index 5521d00..f10c9d3 100644
--- a/doc/newdmobj.html
+++ b/doc/newdmobj.html
@@ -1,36 +1,37 @@
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head>
-<title>Adding New Datamodel Objects To Jalview</title>
-</head>
-<body>
-<h1>Adding New Datamodel Objects To Jalview</h1>
-<p>There are some basic requirements for all Jalview datamodel objects. None of them are mandatory, but each one makes it easier to integrate a new datamodel object into Jalview.</p>
-<p>The primary requirement of classes within jalview.datamodel is that all class implementations must be byte-code compatible with a java 1.1 runtime environment. This is an imposition from the Jalview applet, which is dependent on the core jalview.datamodel package. It is possible to include dependencies to objects which are not available to the JRE1.1 environment, providing you ensure that a test is made at run-time to decide if these dependencies are followed within any particular met [...]
-<p><h3>Steps for integrating a new class into the datamodel</h3>
-<ol><li>Implement in Java 1.1 compatible source.</li>
-<li>Implement copy constructors for the benefit of any datamodel classes that reference it:
-<ul>
-<li>If it is referenced by AlignmentI or SequenceI<br>
-The jalview cut and paste mechanism relies on copy constructors and a 'pseudo-copy constructor' method to make new versions of datamodel objects which correctly inherit references to a subset of attributes referenced by the original objects, and otherwise contain complete duplicates of data (sequence characters, annotation and sequence features) local to that object.
-</li>
-</ul></li>
-<li>
-</body>
-</html>
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<head>
+<title>Adding New Datamodel Objects To Jalview</title>
+</head>
+<body>
+<h1>Adding New Datamodel Objects To Jalview</h1>
+<p>There are some basic requirements for all Jalview datamodel objects. None of them are mandatory, but each one makes it easier to integrate a new datamodel object into Jalview.</p>
+<p>The primary requirement of classes within jalview.datamodel is that all class implementations must be byte-code compatible with a java 1.1 runtime environment. This is an imposition from the Jalview applet, which is dependent on the core jalview.datamodel package. It is possible to include dependencies to objects which are not available to the JRE1.1 environment, providing you ensure that a test is made at run-time to decide if these dependencies are followed within any particular met [...]
+<p><h3>Steps for integrating a new class into the datamodel</h3>
+<ol><li>Implement in Java 1.1 compatible source.</li>
+<li>Implement copy constructors for the benefit of any datamodel classes that reference it:
+<ul>
+<li>If it is referenced by AlignmentI or SequenceI<br>
+The jalview cut and paste mechanism relies on copy constructors and a 'pseudo-copy constructor' method to make new versions of datamodel objects which correctly inherit references to a subset of attributes referenced by the original objects, and otherwise contain complete duplicates of data (sequence characters, annotation and sequence features) local to that object.
+</li>
+</ul></li>
+<li>
+</body>
+</html>
diff --git a/help/help.hs b/help/help.hs
index 8241afe..6115dea 100644
--- a/help/help.hs
+++ b/help/help.hs
@@ -1,43 +1,61 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN" "http://java.sun.com/products/javahelp/helpset_1_0.dtd">
-<helpset version="1.0">
- <!-- title -->
- <title>Jalview Documentation</title>
- <!-- maps -->
- <maps>
- <homeID>home</homeID>
- <mapref location="help.jhm" />
- </maps>
- <!-- views -->
- <view>
- <name>TOC</name>
- <label>Table Of Contents</label>
- <type>javax.help.TOCView</type>
- <data>helpTOC.xml</data>
- </view>
- <view>
- <name>Search</name>
- <label>Search</label>
- <type>javax.help.SearchView</type>
- <data engine="com.sun.java.help.search.DefaultSearchEngine">
- JavaHelpSearch
- </data>
- </view>
-<presentation default="true" displayviews="true" displayviewimages="false">
- <name>TOPALi</name>
- <size width="800" height="700" />
- <location x="200" y="50" />
- <title>Jalview Documentation</title>
- <image>helpIcon</image>
- <toolbar>
- <helpaction image="backIcon">javax.help.BackAction</helpaction>
- <helpaction image="forwardIcon">javax.help.ForwardAction</helpaction>
- <helpaction image="homeIcon">javax.help.HomeAction</helpaction>
- <helpaction>javax.help.SeparatorAction</helpaction>
- <!--<helpaction image="reloadIcon">javax.help.ReloadAction</helpaction>-->
- <!--<helpaction image="addBookmarkIcon">javax.help.FavoritesAction</helpaction>-->
- <helpaction image="printIcon">javax.help.PrintAction</helpaction>
- <helpaction image="printSetupIcon">javax.help.PrintSetupAction</helpaction>
- </toolbar>
- </presentation>
-</helpset>
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN" "http://java.sun.com/products/javahelp/helpset_1_0.dtd">
+<helpset version="1.0">
+ <!-- title -->
+ <title>Jalview Documentation</title>
+ <!-- maps -->
+ <maps>
+ <homeID>home</homeID>
+ <mapref location="help.jhm" />
+ </maps>
+ <!-- views -->
+ <view>
+ <name>TOC</name>
+ <label>Table Of Contents</label>
+ <type>javax.help.TOCView</type>
+ <data>helpTOC.xml</data>
+ </view>
+ <view>
+ <name>Search</name>
+ <label>Search</label>
+ <type>javax.help.SearchView</type>
+ <data engine="com.sun.java.help.search.DefaultSearchEngine">
+ JavaHelpSearch
+ </data>
+ </view>
+<presentation default="true" displayviews="true" displayviewimages="false">
+ <name>TOPALi</name>
+ <size width="800" height="700" />
+ <location x="200" y="50" />
+ <title>Jalview Documentation</title>
+ <image>helpIcon</image>
+ <toolbar>
+ <helpaction image="backIcon">javax.help.BackAction</helpaction>
+ <helpaction image="forwardIcon">javax.help.ForwardAction</helpaction>
+ <helpaction image="homeIcon">javax.help.HomeAction</helpaction>
+ <helpaction>javax.help.SeparatorAction</helpaction>
+ <!--<helpaction image="reloadIcon">javax.help.ReloadAction</helpaction>-->
+ <!--<helpaction image="addBookmarkIcon">javax.help.FavoritesAction</helpaction>-->
+ <helpaction image="printIcon">javax.help.PrintAction</helpaction>
+ <helpaction image="printSetupIcon">javax.help.PrintSetupAction</helpaction>
+ </toolbar>
+ </presentation>
+</helpset>
diff --git a/help/help.jhm b/help/help.jhm
index 261d6d0..357844b 100644
--- a/help/help.jhm
+++ b/help/help.jhm
@@ -1,10 +1,28 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
<!DOCTYPE map PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN" "http://java.sun.com/products/javahelp/map_1_0.dtd">
<map version="1.0">
<mapID target="home" url="html/index.html" />
<mapID target="new" url="html/whatsNew.html"/>
- <mapID target="release" url="html/releases.html"/>
+ <mapID target="release" url="html/releases.html#Jalview.2.9"/>
<mapID target="alannotation" url="html/features/annotation.html"/>
<mapID target="keys" url="html/keys.html"/>
<mapID target="newkeys" url="html/features/newkeystrokes.html"/>
@@ -18,22 +36,34 @@
<mapID target="jnet" url="html/webServices/jnet.html"/>
<mapID target="shmrws" url="html/webServices/shmr.html"/>
<mapID target="newsreader" url="html/webServices/newsreader.html"/>
+ <mapID target="disorder" url="html/webServices/proteinDisorder.html"/>
+ <mapID target="aacon" url="html/webServices/AACon.html"/>
+ <mapID target="rnaalifold" url="html/webServices/RNAalifold.html"/>
+ <mapID target="seqannots" url="html/features/annotation.html#seqannots"/>
<mapID target="seqfetch" url="html/features/seqfetch.html"/>
- <mapID target="dbreffetcher" url="html/webservices/dbreffetcher.html"/>
+ <mapID target="dbreffetcher" url="html/webServices/dbreffetcher.html"/>
<mapID target="seqmappings" url="html/features/seqmappings.html"/>
<mapID target="cdnafeatures" url="html/features/codingfeatures.html"/>
<mapID target="seqfeatures" url="html/features/seqfeatures.html"/>
<mapID target="seqfeatedit" url="html/features/editingFeatures.html"/>
<mapID target="seqfeatcreat" url="html/features/creatinFeatures.html"/>
<mapID target="seqfeatures.settings" url="html/features/featuresettings.html"/>
+ <mapID target="seqfeatures.settings.selcols" url="html/features/featuresettings.html#selectbyfeature"/>
<mapID target="viewingpdbs" url="html/features/viewingpdbs.html"/>
+ <mapID target="viewingpdbs.reps" url="html/features/viewingpdbs.html#viewreps"/>
<mapID target="pdbmcviewer" url="html/features/pdbviewer.html"/>
<mapID target="pdbjmol" url="html/features/jmol.html"/>
+ <mapID target="chimera" url="html/features/chimera.html"/>
+ <mapID target="varna" url="html/features/varna.html"/>
+ <mapID target="xsspannotation" url="html/features/xsspannotation.html"/>
<mapID target="preferences" url="html/features/preferences.html"/>
+ <mapID target="strucprefs" url="html/features/preferences.html#structure"/>
<mapID target="commandline" url="html/features/commandline.html"/>
<mapID target="clarguments" url="html/features/clarguments.html"/>
<mapID target="io" url="html/io/index.html"/>
<mapID target="io.modellerpir" url="html/io/modellerpir.html"/>
+ <mapID target="io.seqreport" url="html/io/exportseqreport.html"/>
+ <mapID target="io.tcoffeescores" url="html/io/tcoffeescores.html"/>
<mapID target="export" url="html/io/export.html"/>
<mapID target="alformats" url="html/io/fileformats.html"/>
<mapID target="annotations.fileformat" url="html/features/annotationsFormat.html"/>
@@ -44,12 +74,14 @@
<mapID target="edit" url="html/editing/index.html"/>
<mapID target="jalarchive" url="html/features/jalarchive.html"/>
<mapID target="multipleviews" url="html/features/multipleViews.html"/>
+ <mapID target="splitframe" url="html/features/splitView.html"/>
<mapID target="trees" url="html/calculations/tree.html"/>
<mapID target="treeviewer" url="html/calculations/treeviewer.html"/>
<mapID target="sorting" url="html/calculations/sorting.html"/>
<mapID target="pca" url="html/calculations/pca.html"/>
<mapID target="pairwise" url="html/calculations/pairwise.html"/>
<mapID target="redundancy" url="html/calculations/redundancy.html"/>
+ <mapID target="referenceseq" url="html/calculations/referenceseq.html"/>
<mapID target="hiddenRegions" url="html/features/hiddenRegions.html"/>
<mapID target="recoverInputdata" url="html/calculations/recoverInputdata.html"/>
<mapID target="colours" url="html/colourSchemes/index.html"/>
@@ -69,10 +101,15 @@
<mapID target="colours.abovepid" url="html/colourSchemes/abovePID.html"/>
<mapID target="colours.conservation" url="html/colourSchemes/conservation.html"/>
<mapID target="colours.annotation" url="html/colourSchemes/annotationColouring.html"/>
+ <mapID target="colours.purinepyrimidine" url="html/colourSchemes/purinepyrimidine.html"/>
+ <mapID target="colours.rnahelices" url="html/colourSchemes/rnahelicesColouring.html"/>
<mapID target="calcs.alquality" url="html/calculations/quality.html"/>
<mapID target="calcs.alconserv" url="html/calculations/conservation.html"/>
- <mapID target="calcs.consensus" url="html/calculations/consensus.html"/>
+ <mapID target="calcs.alstrconsensus" url="html/calculations/structureconsensus.html"/>
+ <mapID target="calcs.consensus" url="html/calculations/consensus.html"/>
+
+ <mapID target="nucleicAcids" url="html/na/index.html"/>
<mapID target="menus" url="html/menus/index.html"/>
<mapID target="desktopMenu" url="html/menus/desktopMenu.html"/>
@@ -81,22 +118,31 @@
<mapID target="alwEdit" url="html/menus/alwedit.html"/>
<mapID target="alwSelect" url="html/menus/alwselect.html"/>
<mapID target="alwView" url="html/menus/alwview.html"/>
+ <mapID target="alwAnnotations" url="html/menus/alwannotation.html"/>
<mapID target="alwFormat" url="html/menus/alwformat.html"/>
<mapID target="alwColour" url="html/menus/alwcolour.html"/>
<mapID target="alwCalc" url="html/menus/alwcalculate.html"/>
<mapID target="wsMenu" url="html/menus/wsmenu.html"/>
<mapID target="popMenu" url="html/menus/popupMenu.html"/>
- <mapID target="annotMenus" url="html/menus/alwannotations.html"/>
+ <mapID target="popMenuAddref" url="html/menus/popupMenu.html#addrefannot"/>
+ <mapID target="annotPanelMenu" url="html/menus/alwannotationpanel.html"/>
<mapID target="memory" url="html/memory.html" />
- <mapID target="jalviewjnlp" url="html/jalviewjnlp.html" />
<mapID target="groovy" url="html/features/groovy.html" />
<mapID target="privacy" url="html/privacy.html" />
<mapID target="vamsas" url="html/vamsas/index.html"/>
<mapID target="aminoAcids" url="html/misc/aminoAcids.html" />
<mapID target="aaProperties" url="html/misc/aaproperties.html" />
<mapID target="geneticCode" url="html/misc/geneticCode.html" />
+ <mapID target="subtMatrices" url="html/calculations/scorematrices.html" />
+ <mapID target="subtMatrices.pam250" url="html/calculations/scorematrices.html#pam250" />
+
+ <mapID target="biojson" url="html/features/bioJsonFormat.html" />
+ <mapID target="pdbfetcher" url="html/features/pdbsequencefetcher.html" />
+ <mapID target="pdbchooser" url="html/features/structurechooser.html" />
+ <mapID target="selectcolbyannot" url="html/features/columnFilterByAnnotation.html" />
+ <mapID target="biojsmsa" url="html/features/biojsmsa.html" />
<mapID target="backIcon" url="icons/back.png" />
<mapID target="forwardIcon" url="icons/forward.png" />
diff --git a/help/helpTOC.html b/help/helpTOC.html
index 4ac5454..ccc4406 100644
--- a/help/helpTOC.html
+++ b/help/helpTOC.html
@@ -4,21 +4,29 @@
<br><a href="html/index.html" target=bodyframe>Jalview Documentation</a>
<br> <a href="html/whatsNew.html" target=bodyframe>What's new</a>
-<br> <a href="html/features/jmol.html" target=bodyframe>Enhanced Jmol/Jalview interaction</a>
-<br> <a href="html/webServices/shmr.html" target=bodyframe>Multi-Harmony Alignment Analysis</a>
-<br> <a href="html/webServices/newsreader.html" target=bodyframe>Jalview News Reader</a>
-<br> <a href="html/calculations/treeviewer.html" target=bodyframe>Sort alignments associated with tree</a>
-<br> <a href="html/colourSchemes/annotationColouring.html" target=bodyframe>Default Annotation preferences</a>
-<br> <a href="html/webServices/JABAWS.html" target=bodyframe>Jaba Web Services</a>
+<br> <a href="html/features/splitView.html" target=bodyframe>Split Frame View</a>
+<br> <a href="html/features/pdbsequencefetcher.html" target=bodyframe>PDB Sequence Fetcher</a>
+<br> <a href="html/features/structurechooser.html" target=bodyframe>PDB Structure Chooser</a>
+<br> <a href="html/features/chimera.html" target=bodyframe>Chimera Viewer</a>
+<br> <a href="html/features/columnFilterByAnnotation.html" target=bodyframe>Select columns by annotation</a>
+<br> <a href="html/releases.html#Jalview.2.9" target=bodyframe>Latest Release Notes</a>
<br> <a href="html/editing/index.html" target=bodyframe>Editing Alignments</a>
<br> <a href="html/features/cursorMode.html" target=bodyframe>Cursor Mode</a>
<br> <a href="html/keys.html" target=bodyframe>Key Strokes</a>
<br> <a href="html/io/index.html" target=bodyframe>Input / Output</a>
+<br> <a href="html/features/bioJsonFormat.html" target=bodyframe>BioJSON v1.0</a>
<br> <a href="html/io/export.html" target=bodyframe>Making Figures</a>
+<br> <a href="html/features/biojsmsa.html" target=bodyframe>BioJS MSA Viewer</a>
<br> <a href="html/features/hiddenRegions.html" target=bodyframe>Hidden Regions</a>
<br> <a href="html/features/multipleViews.html" target=bodyframe>Multiple Views</a>
+<br> <a href="html/features/splitView.html" target=bodyframe>Split Frame View</a>
<br> <a href="html/calculations/treeviewer.html" target=bodyframe>Viewing Trees</a>
<br> <a href="html/features/seqfetch.html" target=bodyframe>Fetching Sequences</a>
+<br> <a href="html/features/columnFilterByAnnotation.html" target=bodyframe>Select columns by annotation</a>
+<br> <a href="html/na/index.html" target=bodyframe>Nucleic Acid Support</a>
+<br> <a href="html/features/varna.html" target=bodyframe>Viewing RNA structure</a>
+<br> <a href="html/calculations/structureconsensus.html" target=bodyframe>RNA Structure Consensus</a>
+<br> <a href="html/colourSchemes/rnahelicesColouring.html" target=bodyframe>RNA Helices coloring</a>
<br> <a href="html/features/seqfeatures.html" target=bodyframe>Sequence Features</a>
<br> <a href="html/features/featuresettings.html" target=bodyframe>Sequence Feature Settings</a>
<br> <a href="html/features/featuresFormat.html" target=bodyframe>Sequence Features File</a>
@@ -27,6 +35,7 @@
<br> <a href="html/features/editingFeatures.html" target=bodyframe>Editing Sequence Features</a>
<br> <a href="html/features/dasfeatures.html" target=bodyframe>DAS Feature Retrieval</a>
<br> <a href="html/features/dassettings.html" target=bodyframe>DAS Feature Settings</a>
+<br> <a href="html/io/exportseqreport.html" target=bodyframe>HTML annotation report</a>
<br> <a href="html/webServices/index.html" target=bodyframe>Web Services</a>
<br> <a href="html/webServices/JABAWS.html" target=bodyframe>JABAWS</a>
<br> <a href="html/webServices/webServicesPrefs.html" target=bodyframe>Web Service Preferences</a>
@@ -34,9 +43,12 @@
<br> <a href="html/webServices/msaclient.html" target=bodyframe>Sequence Alignment</a>
<br> <a href="html/webServices/msaclient.html" target=bodyframe>Multiple Alignment Subjobs</a>
<br> <a href="html/webServices/jnet.html" target=bodyframe>Secondary Structure Prediction</a>
+<br> <a href="html/webServices/RNAalifold.html" target=bodyframe>RNAalifold RNA Secondary Structure Prediction</a>
+<br> <a href="html/webServices/proteinDisorder.html" target=bodyframe>Protein Disorder Prediction</a>
+<br> <a href="html/webServices/AACon.html" target=bodyframe>Alignment Conservation Analysis</a>
<br> <a href="html/webServices/shmr.html" target=bodyframe>Multi-Harmony Alignment Analysis</a>
<br> <a href="html/features/seqfetch.html" target=bodyframe>Sequence Retrieval</a>
-<br> <a href="html/webservices/dbreffetcher.html" target=bodyframe>Database Reference Retrieval</a>
+<br> <a href="html/webServices/dbreffetcher.html" target=bodyframe>Database Reference Retrieval</a>
<br> <a href="html/features/dasfeatures.html" target=bodyframe>DAS Feature Retrieval</a>
<br> <a href="html/colourSchemes/index.html" target=bodyframe>Colour Schemes</a>
<br> <a href="html/colourSchemes/textcolour.html" target=bodyframe>Background Dependent Text Colour</a>
@@ -49,12 +61,15 @@
<br> <a href="html/colourSchemes/turn.html" target=bodyframe>Turn propensity</a>
<br> <a href="html/colourSchemes/buried.html" target=bodyframe>Buried index</a>
<br> <a href="html/colourSchemes/nucleotide.html" target=bodyframe>Nucleotide colours</a>
+<br> <a href="html/colourSchemes/purinepyrimidine.html" target=bodyframe>Purine/Pyrimidine colours</a>
<br> <a href="html/colourSchemes/blosum.html" target=bodyframe>Blosum62</a>
<br> <a href="html/colourSchemes/pid.html" target=bodyframe>by Percentage Identity</a>
<br> <a href="html/colourSchemes/user.html" target=bodyframe>User Defined</a>
<br> <a href="html/colourSchemes/abovePID.html" target=bodyframe>Above Percentage Identity</a>
<br> <a href="html/colourSchemes/conservation.html" target=bodyframe>By conservation</a>
+<br> <a href="html/io/tcoffeescores.html" target=bodyframe>T-COFFEE Scores</a>
<br> <a href="html/colourSchemes/annotationColouring.html" target=bodyframe>By Annotation</a>
+<br> <a href="html/colourSchemes/rnahelicesColouring.html" target=bodyframe>By RNA Helices</a>
<br> Calculations
<br> <a href="html/calculations/sorting.html" target=bodyframe>Sorting alignments</a>
<br> <a href="html/calculations/tree.html" target=bodyframe>Calculating trees</a>
@@ -62,14 +77,23 @@
<br> <a href="html/calculations/recoverInputdata.html" target=bodyframe>Tree/PCA Input Data</a>
<br> <a href="html/calculations/pairwise.html" target=bodyframe>Pairwise Alignments</a>
<br> <a href="html/calculations/redundancy.html" target=bodyframe>Remove Redundancy</a>
+<br> <a href="html/calculations/referenceseq.html" target=bodyframe>Reference Sequences</a>
+<br> <a href="html/features/annotation.html#seqannots" target=bodyframe>Sequence Annotations</a>
+<br> <a href="html/features/xsspannotation.html" target=bodyframe>Annotation from Structure</a>
<br> <a href="html/features/annotation.html" target=bodyframe>Alignment Annotations</a>
<br> <a href="html/calculations/conservation.html" target=bodyframe>Conservation</a>
<br> <a href="html/calculations/quality.html" target=bodyframe>Quality</a>
<br> <a href="html/calculations/consensus.html" target=bodyframe>Consensus</a>
+<br> <a href="html/calculations/structureconsensus.html" target=bodyframe>RNA Structure Consensus</a>
<br> <a href="html/features/annotationsFormat.html" target=bodyframe>Annotations File Format</a>
-<br> <a href="html/features/viewingpdbs.html" target=bodyframe>Viewing PDB Files</a>
+<br> Select Column by Annotation
+<br> <a href="html/features/viewingpdbs.html" target=bodyframe>3D Structure Data</a>
+<br> <a href="html/features/pdbsequencefetcher.html" target=bodyframe>PDB Sequence Fetcher</a>
+<br> <a href="html/features/structurechooser.html" target=bodyframe>PDB Structure Chooser</a>
<br> <a href="html/features/jmol.html" target=bodyframe>Jmol Viewer</a>
+<br> <a href="html/features/chimera.html" target=bodyframe>Chimera Viewer</a>
<br> <a href="html/features/pdbviewer.html" target=bodyframe>Simple PDB Viewer</a>
+<br> <a href="html/features/varna.html" target=bodyframe>Viewing RNA structures</a>
<br> <a href="html/vamsas/index.html" target=bodyframe>VAMSAS Data Exchange</a>
<br> <a href="html/menus/index.html" target=bodyframe>Window Menus</a>
<br> <a href="html/menus/desktopMenu.html" target=bodyframe>Desktop Window</a>
@@ -78,15 +102,15 @@
<br> <a href="html/menus/alwedit.html" target=bodyframe>Edit Menu</a>
<br> <a href="html/menus/alwselect.html" target=bodyframe>Select Menu</a>
<br> <a href="html/menus/alwview.html" target=bodyframe>View Menu</a>
+<br> <a href="html/menus/alwannotation.html" target=bodyframe>Annotations Menu</a>
<br> <a href="html/menus/alwformat.html" target=bodyframe>Format Menu</a>
<br> <a href="html/menus/alwcolour.html" target=bodyframe>Colour Menu</a>
<br> <a href="html/menus/alwcalculate.html" target=bodyframe>Calculation Menu</a>
<br> <a href="html/menus/wsmenu.html" target=bodyframe>Web Service Menu</a>
-<br> <a href="html/menus/alwannotations.html" target=bodyframe>Annotation Menus</a>
+<br> <a href="html/menus/alwannotationpanel.html" target=bodyframe>Annotation Panel Menu</a>
<br> <a href="html/menus/popupMenu.html" target=bodyframe>Popup Menu</a>
<br> <a href="html/features/preferences.html" target=bodyframe>Preferences</a>
<br> <a href="html/memory.html" target=bodyframe>Memory Settings</a>
-<br> <a href="html/jalviewjnlp.html" target=bodyframe>JNLP with extra memory parameters</a>
<br> <a href="html/features/commandline.html" target=bodyframe>Command Line</a>
<br> <a href="html/features/clarguments.html" target=bodyframe>Command Line Arguments</a>
<br> <a href="html/features/groovy.html" target=bodyframe>Groovy Shell</a>
@@ -95,3 +119,4 @@
<br> <a href="html/misc/aminoAcids.html" target=bodyframe>Amino Acid Table</a>
<br> <a href="html/misc/aaproperties.html" target=bodyframe>Amino Acid Properties</a>
<br> <a href="html/misc/geneticCode.html" target=bodyframe>The Genetic Code</a>
+<br> <a href="html/calculations/scorematrices.html" target=bodyframe>Sequence Substitution Matrices</a>
diff --git a/help/helpTOC.xml b/help/helpTOC.xml
index 926a710..73147d2 100644
--- a/help/helpTOC.xml
+++ b/help/helpTOC.xml
@@ -1,131 +1,175 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<!DOCTYPE toc PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN" "http://java.sun.com/products/javahelp/toc_1_0.dtd">
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<toc version="1.0">
-<tocitem text="Jalview Documentation" target="home" expand="true" >
- <tocitem text="What's new" target="new" expand="true">
- <tocitem text="Enhanced Jmol/Jalview interaction" target="pdbjmol"/>
- <tocitem text="Multi-Harmony Alignment Analysis" target="shmrws"/>
- <tocitem text="Jalview News Reader" target="newsreader"/>
- <tocitem text="Sort alignments associated with tree" target="treeviewer"/>
- <tocitem text="Default Annotation preferences" target="colours.annotation"/>
- <tocitem text="Jaba Web Services" target="jabaws"/>
- </tocitem>
- <tocitem text="Editing Alignments" target ="edit"/>
- <tocitem text="Cursor Mode" target="cursor"/>
- <tocitem text="Key Strokes" target="keys"/>
- <tocitem text="Input / Output" target="io"/>
- <tocitem text="Making Figures" target="export"/>
- <tocitem text="Hidden Regions" target="hiddenRegions"/>
- <tocitem text="Multiple Views" target="multipleviews"/>
- <tocitem text="Viewing Trees" target="treeviewer" expand="false"/>
- <tocitem text="Fetching Sequences" target="seqfetch"/>
- <tocitem text="Sequence Features" target="seqfeatures" expand="false">
- <tocitem text="Sequence Feature Settings" target="seqfeatures.settings"/>
- <tocitem text="Sequence Features File" target="features.fileformat"/>
- <tocitem text="Feature Colourschemes" target="features.featureschemes"/>
- <tocitem text="User Defined Sequence Features" target="seqfeatcreat"/>
- <tocitem text="Editing Sequence Features" target="seqfeatedit"/>
- <tocitem text="DAS Feature Retrieval" target="das.viewing"/>
- <tocitem text="DAS Feature Settings" target="das.settings"/>
- </tocitem>
- <tocitem text="Web Services" target="webservice" expand="false">
- <tocitem text="JABAWS" target="jabaws"/>
- <tocitem text="Web Service Preferences" target="wsprefs"/>
- <tocitem text="Web Service Parameters" target="wsparams"/>
- <tocitem text="Sequence Alignment" target="msaservice" expand="false">
- <tocitem text="Multiple Alignment Subjobs" target="msaservice"/>
- </tocitem>
- <tocitem text="Secondary Structure Prediction" target="jnet"/>
- <tocitem text="Multi-Harmony Alignment Analysis" target="shmrws"/>
- <tocitem text="Sequence Retrieval" target="seqfetch"/>
- <tocitem text="Database Reference Retrieval" target="dbreffetcher"/>
- <tocitem text="DAS Feature Retrieval" target="das.viewing"/>
- </tocitem>
- <tocitem text="Colour Schemes" target="colours" expand="false">
- <tocitem text="Background Dependent Text Colour" target="backdeptextcol"/>
- <tocitem text="ClustalX" target="colours.clustal"/>
- <tocitem text="Zappo" target="colours.zappo"/>
- <tocitem text="Taylor" target="colours.taylor"/>
- <tocitem text="Hydrophobicity" target="colours.hydro"/>
- <tocitem text="Helix propensity" target="colours.helix"/>
- <tocitem text="Strand propensity" target="colours.strand"/>
- <tocitem text="Turn propensity" target="colours.turn"/>
- <tocitem text="Buried index" target="colours.buried"/>
- <tocitem text="Nucleotide colours" target="colours.nucleotide"/>
- <tocitem text="Blosum62" target="colours.blosum"/>
- <tocitem text="by Percentage Identity" target="colours.pid"/>
- <tocitem text="User Defined" target="colours.user"/>
- <tocitem text="Above Percentage Identity" target="colours.abovepid"/>
- <tocitem text="By conservation" target="colours.conservation"/>
- <tocitem text="By Annotation" target="colours.annotation"/>
- </tocitem>
- <tocitem text="Calculations" target="calculations" expand="false">
- <tocitem text="Sorting alignments" target="sorting"/>
- <tocitem text="Calculating trees" target="trees"/>
- <tocitem text="Principal Component Analysis" target="pca"/>
- <tocitem text="Tree/PCA Input Data" target="recoverInputdata"/>
- <tocitem text="Pairwise Alignments" target="pairwise"/>
- <tocitem text="Remove Redundancy" target="redundancy"/>
- </tocitem>
- <tocitem text="Alignment Annotations" target ="alannotation" expand="false">
- <tocitem text="Conservation" target="calcs.alconserv"/>
- <tocitem text="Quality" target="calcs.alquality"/>
- <tocitem text="Consensus" target="calcs.consensus"/>
- <tocitem text="Annotations File Format" target="annotations.fileformat"/>
- </tocitem>
- <tocitem text="Viewing PDB Files" target="viewingpdbs" expand="false">
- <tocitem text="Jmol Viewer" target="pdbjmol"/>
- <tocitem text="Simple PDB Viewer" target="pdbmcviewer"/>
- </tocitem>
- <tocitem text="VAMSAS Data Exchange" target="vamsas">
- <!-- what can Jalview share with other apps -->
- <!-- what other apps exist -->
+<!-- DO NOT WRAP THESE LINES - help2Website relies on each item being on one line! -->
+ <tocitem text="Jalview Documentation" target="home" expand="true">
+ <tocitem text="What's new" target="new" expand="true">
+ <tocitem text="Split Frame View" target="splitframe" />
+ <tocitem text="PDB Sequence Fetcher" target="pdbfetcher" />
+ <tocitem text="PDB Structure Chooser" target="pdbchooser" />
+ <tocitem text="Chimera Viewer" target="chimera" />
+ <tocitem text="Select columns by annotation" target="selectcolbyannot" />
+ <tocitem text="Latest Release Notes" target="release"/>
+ </tocitem>
+
+ <tocitem text="Editing Alignments" target="edit" />
+ <tocitem text="Cursor Mode" target="cursor" />
+ <tocitem text="Key Strokes" target="keys" />
+
+ <tocitem text="Input / Output" target="io" expand="false">
+ <tocitem text="BioJSON v1.0" target="biojson" />
+ </tocitem>
+
+ <tocitem text="Making Figures" target="export" expand="false">
+ <tocitem text="BioJS MSA Viewer" target="biojsmsa" />
+ </tocitem>
+
+ <tocitem text="Hidden Regions" target="hiddenRegions" />
+ <tocitem text="Multiple Views" target="multipleviews" />
+ <tocitem text="Split Frame View" target="splitframe" />
+ <tocitem text="Viewing Trees" target="treeviewer" expand="false" />
+ <tocitem text="Fetching Sequences" target="seqfetch" />
+
+ <tocitem text="Select columns by annotation" target="selectcolbyannot" />
+
+ <tocitem text="Nucleic Acid Support" target="nucleicAcids" expand="false">
+ <tocitem text="Viewing RNA structure" target="varna" />
+ <tocitem text="RNA Structure Consensus" target="calcs.alstrconsensus" />
+ <tocitem text="RNA Helices coloring" target="colours.rnahelices" />
+ </tocitem>
+
+ <tocitem text="Sequence Features" target="seqfeatures" expand="false">
+ <tocitem text="Sequence Feature Settings" target="seqfeatures.settings" />
+ <tocitem text="Sequence Features File" target="features.fileformat" />
+ <tocitem text="Feature Colourschemes" target="features.featureschemes" />
+ <tocitem text="User Defined Sequence Features" target="seqfeatcreat" />
+ <tocitem text="Editing Sequence Features" target="seqfeatedit" />
+ <tocitem text="DAS Feature Retrieval" target="das.viewing" />
+ <tocitem text="DAS Feature Settings" target="das.settings" />
+ <tocitem text="HTML annotation report" target="io.seqreport" />
</tocitem>
- <tocitem text="Window Menus" target="menus" expand="false">
- <tocitem text="Desktop Window" target="desktopMenu"/>
- <tocitem text="Alignment Window" target="alMenu">
- <tocitem text="File Menu" target="alwFile"/>
- <tocitem text="Edit Menu" target="alwEdit"/>
- <tocitem text="Select Menu" target="alwSelect"/>
- <tocitem text="View Menu" target="alwView"/>
- <tocitem text="Format Menu" target="alwFormat"/>
- <tocitem text="Colour Menu" target="alwColour"/>
- <tocitem text="Calculation Menu" target="alwCalc"/>
- <tocitem text="Web Service Menu" target="wsMenu"/>
- <tocitem text="Annotation Menus" target="annotMenus"/>
- <tocitem text="Popup Menu" target="popMenu"/>
- </tocitem>
+
+ <tocitem text="Web Services" target="webservice" expand="false">
+ <tocitem text="JABAWS" target="jabaws" />
+ <tocitem text="Web Service Preferences" target="wsprefs" />
+ <tocitem text="Web Service Parameters" target="wsparams" />
+ <tocitem text="Sequence Alignment" target="msaservice" expand="false">
+ <tocitem text="Multiple Alignment Subjobs" target="msaservice" />
+ </tocitem>
+ <tocitem text="Secondary Structure Prediction" target="jnet" />
+ <tocitem text="RNAalifold RNA Secondary Structure Prediction" target="rnaalifold" />
+ <tocitem text="Protein Disorder Prediction" target="disorder" />
+ <tocitem text="Alignment Conservation Analysis" target="aacon" />
+ <tocitem text="Multi-Harmony Alignment Analysis" target="shmrws" />
+ <tocitem text="Sequence Retrieval" target="seqfetch" />
+ <tocitem text="Database Reference Retrieval" target="dbreffetcher" />
+ <tocitem text="DAS Feature Retrieval" target="das.viewing" />
+ </tocitem>
+
+ <tocitem text="Colour Schemes" target="colours" expand="false">
+ <tocitem text="Background Dependent Text Colour" target="backdeptextcol" />
+ <tocitem text="ClustalX" target="colours.clustal" />
+ <tocitem text="Zappo" target="colours.zappo" />
+ <tocitem text="Taylor" target="colours.taylor" />
+ <tocitem text="Hydrophobicity" target="colours.hydro" />
+ <tocitem text="Helix propensity" target="colours.helix" />
+ <tocitem text="Strand propensity" target="colours.strand" />
+ <tocitem text="Turn propensity" target="colours.turn" />
+ <tocitem text="Buried index" target="colours.buried" />
+ <tocitem text="Nucleotide colours" target="colours.nucleotide" />
+ <tocitem text="Purine/Pyrimidine colours" target="colours.purinepyrimidine" />
+ <tocitem text="Blosum62" target="colours.blosum" />
+ <tocitem text="by Percentage Identity" target="colours.pid" />
+ <tocitem text="User Defined" target="colours.user" />
+ <tocitem text="Above Percentage Identity" target="colours.abovepid" />
+ <tocitem text="By conservation" target="colours.conservation" />
+ <tocitem text="T-COFFEE Scores" target="io.tcoffeescores" />
+ <tocitem text="By Annotation" target="colours.annotation" />
+ <tocitem text="By RNA Helices" target="colours.rnahelices" />
+ </tocitem>
+
+ <tocitem text="Calculations" target="calculations" expand="false">
+ <tocitem text="Sorting alignments" target="sorting" />
+ <tocitem text="Calculating trees" target="trees" />
+ <tocitem text="Principal Component Analysis" target="pca" />
+ <tocitem text="Tree/PCA Input Data" target="recoverInputdata" />
+ <tocitem text="Pairwise Alignments" target="pairwise" />
+ <tocitem text="Remove Redundancy" target="redundancy" />
+ <tocitem text="Reference Sequences" target="referenceseq" />
+ </tocitem>
+
+ <tocitem text="Sequence Annotations" target="seqannots" expand="true">
+ <tocitem text="Annotation from Structure" target="xsspannotation" expand="false" />
+ </tocitem>
+
+ <tocitem text="Alignment Annotations" target="alannotation" expand="false">
+ <tocitem text="Conservation" target="calcs.alconserv" />
+ <tocitem text="Quality" target="calcs.alquality" />
+ <tocitem text="Consensus" target="calcs.consensus" />
+ <tocitem text="RNA Structure Consensus" target="calcs.alstrconsensus" />
+ <tocitem text="Annotations File Format" target="annotations.fileformat" />
+ <tocitem text="Select Column by Annotation" target="calcs.annotation" />
+ </tocitem>
+ <tocitem text="3D Structure Data" target="viewingpdbs" expand="false">
+ <tocitem text="PDB Sequence Fetcher" target="pdbfetcher" />
+ <tocitem text="PDB Structure Chooser" target="pdbchooser" />
+ <tocitem text="Jmol Viewer" target="pdbjmol" />
+ <tocitem text="Chimera Viewer" target="chimera" />
+ <tocitem text="Simple PDB Viewer" target="pdbmcviewer" />
+ </tocitem>
+ <tocitem text="Viewing RNA structures" target="varna" expand="false"/>
+ <tocitem text="VAMSAS Data Exchange" target="vamsas">
+ <!-- what can Jalview share with other apps -->
+ <!-- what other apps exist -->
+ </tocitem>
+ <tocitem text="Window Menus" target="menus" expand="false">
+ <tocitem text="Desktop Window" target="desktopMenu" />
+ <tocitem text="Alignment Window" target="alMenu">
+ <tocitem text="File Menu" target="alwFile" />
+ <tocitem text="Edit Menu" target="alwEdit" />
+ <tocitem text="Select Menu" target="alwSelect" />
+ <tocitem text="View Menu" target="alwView" />
+ <tocitem text="Annotations Menu" target="alwAnnotations" />
+ <tocitem text="Format Menu" target="alwFormat" />
+ <tocitem text="Colour Menu" target="alwColour" />
+ <tocitem text="Calculation Menu" target="alwCalc" />
+ <tocitem text="Web Service Menu" target="wsMenu" />
+ <tocitem text="Annotation Panel Menu" target="annotPanelMenu" />
+ <tocitem text="Popup Menu" target="popMenu" />
+ </tocitem>
+ </tocitem>
+ <tocitem text="Preferences" target="preferences" />
+ <tocitem text="Memory Settings" target="memory" expand="false"/>
+ <tocitem text="Command Line" target="commandline" expand="false">
+ <tocitem text="Command Line Arguments" target="clarguments" />
+ <tocitem text="Groovy Shell" target="groovy" />
+ </tocitem>
+ <tocitem text="Privacy" target="privacy" />
+ </tocitem>
+ <tocitem text="Useful information" expand="true">
+ <tocitem text="Amino Acid Table" target="aminoAcids" />
+ <tocitem text="Amino Acid Properties" target="aaProperties" />
+ <tocitem text="The Genetic Code" target="geneticCode" />
+ <tocitem text="Sequence Substitution Matrices" target="subtMatrices" />
+
</tocitem>
- <tocitem text="Preferences" target="preferences"/>
- <tocitem text="Memory Settings" target="memory" expand="false">
- <tocitem text="JNLP with extra memory parameters" target="jalviewjnlp"/>
- </tocitem>
- <tocitem text="Command Line" target="commandline" expand="false">
- <tocitem text="Command Line Arguments" target="clarguments"/>
- <tocitem text="Groovy Shell" target="groovy"/>
- </tocitem>
- <tocitem text="Privacy" target="privacy"/>
-</tocitem>
-<tocitem text="Useful information" expa nd="true">
- <tocitem text="Amino Acid Table" target="aminoAcids"/>
- <tocitem text="Amino Acid Properties" target="aaProperties"/>
- <tocitem text="The Genetic Code" target="geneticCode"/>
-</tocitem>
</toc>
diff --git a/help/html/Jalview_Logo.png b/help/html/Jalview_Logo.png
new file mode 100644
index 0000000..06429d9
Binary files /dev/null and b/help/html/Jalview_Logo.png differ
diff --git a/help/html/calculations/consensus.html b/help/html/calculations/consensus.html
index 5a962a4..0476f05 100644
--- a/help/html/calculations/consensus.html
+++ b/help/html/calculations/consensus.html
@@ -1,35 +1,68 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Alignment Consensus Annotation</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Alignment Consensus Annotation</title>
+</head>
<body>
-<p><strong>Alignment Consensus Annotation</strong></p>
-<p>The consensus displayed below the alignment is the percentage of the modal
- residue per column. By default this calculation takes includes gaps in column.
- You can choose to ignore gaps in the calculation by right clicking on the label
- "Consensus" to the left of the consensus bar chart.
-<p>If the modal value is shared by more than 1 residue, a "+" symbol
- is used in the display for the simple reason that it is not possible to display
- multiple characters in a single character space.
-<p><strong>Copying the consensus sequence</strong></p>
-<p>Select the <strong>"Copy Consensus Sequence"</strong> entry from
-the consensus annotation label to copy the alignment's consensus sequence to the
-clipboard.
-</p>
+ <p>
+ <strong>Alignment Consensus Annotation</strong>
+ </p>
+ <p>The consensus displayed below the alignment is the percentage
+ of the modal residue per column. By default this calculation
+ includes gaps in columns. You can choose to ignore gaps in the
+ calculation by right clicking on the label "Consensus" to
+ the left of the consensus bar chart.
+ <p>If the modal value is shared by more than 1 residue, a
+ "+" symbol is used in the display for the simple reason
+ that it is not possible to display multiple characters in a single
+ character space.
+ <p>
+ <strong>Copying the consensus sequence</strong>
+ </p>
+ <p>
+ Select the <strong>"Copy Consensus Sequence"</strong>
+ entry from the consensus annotation label to copy the alignment's
+ consensus sequence to the clipboard.
+ <p>
+ <strong>Sequence logo</strong>
+ </p>
+ By clicking on the label you can also activate the sequence logo. It
+ indicates the relative amount of residues per column which can be
+ estimated by its size in the logo. The tooltip of a column gives the
+ exact numbers for all occurring residues.
+ <br />If columns of the alignment are very diverse, then it can
+ sometimes be difficult to see the sequence logo - in this case, right
+ click on the annotation row label and select
+ <strong>Normalise Consensus Logo</strong> to scale all columns of the
+ logo to the same height.
+
+ <p>
+ <strong>cDNA Consensus</strong>
+ </p>
+ A
+ <a href="../features/splitView.html">Split Frame View</a> of cDNA and
+ Protein alignments will show the consensus for cDNA below the protein
+ alignment.
+ <br /> This may provide additional information on mutations in DNA
+ that is not visible in the peptide alignment.
</body>
</html>
diff --git a/help/html/calculations/conservation.html b/help/html/calculations/conservation.html
index ebba3ab..da48455 100644
--- a/help/html/calculations/conservation.html
+++ b/help/html/calculations/conservation.html
@@ -1,44 +1,75 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Alignment Conservation Annotation</title></head>
-<body><p><strong>Alignment Conservation Annotation</strong></p>
-<p>This is an automatically calculated quantitative alignment
-annotation which measures the number of conserved physico-chemical
-properties conserved for each column of the alignment. Its calculation
-is based on the one used in
- the AMAS method of multiple sequence alignment analysis :<br>
-<ul>Livingstone
- C.D. and Barton G.J. (1993), Protein Sequence Alignments: A Strategy
- for the Hierarchical Analysis of Residue Conservation.<em>CABIOS</em> Vol. <b>9</b>
- No. 6 (745-756)).
-</ul>
-</p>
-<p>Conservation is measured as a numerical index reflecting the conservation of
- <a href="../misc/aaproperties.html">physico-chemical
- properties</a> in the alignment: Identities score highest, and the next most
- conserved group contain substitutions to amino acids lying in the same physico-chemical
- class.</p>
-
-<p><em>Colouring an alignment by conservation</em><br>
-Conservation scores can be used to colour an alignment. This is
-explained further in the help page for <a
-href="../colourSchemes/conservation.html">conservation colouring</a>.
-</p>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Alignment Conservation Annotation</title>
+</head>
+<body>
+ <p>
+ <strong>Alignment Conservation Annotation</strong>
+ </p>
+ <p>
+ This is an automatically calculated quantitative alignment
+ annotation which measures the number of conserved physico-chemical
+ properties conserved for each column of the alignment. Its
+ calculation is based on the one used in the AMAS method of multiple
+ sequence alignment analysis :<br>
+ <ul>
+ Livingstone C.D. and Barton G.J. (1993), Protein Sequence
+ Alignments: A Strategy for the Hierarchical Analysis of Residue
+ Conservation.
+ <em>CABIOS</em> Vol.
+ <b>9</b> No. 6 (745-756)).
+ </ul>
+ <em><a
+ href="http://www.compbio.dundee.ac.uk/papers/amas/amas3d.html"
+ >View an HTML version of the paper</a></em>
+ </p>
+ <p>
+ Conservation is measured as a numerical index reflecting the
+ conservation of <a href="../misc/aaproperties.html">physico-chemical
+ properties</a> in the alignment: Identities score highest, and the
+ next most conserved group contain substitutions to amino acids lying
+ in the same physico-chemical class.
+ </p>
+ <p>Conservation is visualised on the alignment or a sequence group
+ as a histogram giving the score for each column. Conserved columns
+ are indicated by '*' (score of 11 with default amino acid property
+ grouping), and columns with mutations where all properties are
+ conserved are marked with a '+' (score of 10, indicating all
+ properties are conserved).</p>
+ <p>
+ Mousing over a conservation histogram reveals a tooltip which
+ contains a series of symbols corresponding to the physicochemical
+ properties that are conserved amongst the amino acids observed at
+ each position. In these tooltips, the presence of <em>!</em> implies
+ that the lack of a particular physicochemical property is conserved
+ (e.g. !proline).
+ </p>
+ <p>
+ <em>Colouring an alignment by conservation</em><br>
+ Conservation scores can be used to colour an alignment. This is
+ explained further in the help page for <a
+ href="../colourSchemes/conservation.html"
+ >conservation colouring</a>.
+ </p>
</body>
</html>
diff --git a/help/html/calculations/pairwise.html b/help/html/calculations/pairwise.html
index 795450b..4b9cf68 100644
--- a/help/html/calculations/pairwise.html
+++ b/help/html/calculations/pairwise.html
@@ -1,37 +1,48 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Pairwise Alignment</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Pairwise Alignment</title>
+</head>
<body>
-<p><strong>Pairwise alignment (Proteins only)</strong></p>
-<p>This calculation is performed on the selected sequences only. Java is not the
- fastest language in the world and aligning more than a handful of sequences
- will take a fair amount of time. <br>
- For each pair of sequences the best global alignment is found using BLOSUM62
- as the scoring matrix. The scores reported are the raw scores. The sequences
- are aligned using a dynamic programming technique and using the following gap
- penalties : </p>
-<p>Gap open : 12 <br>
- Gap extend : 2 </p>
-<p>When you select the pairwise alignment option a new window will come up which
- will display the alignments in a text format as they are calculated. Also displayed
- is information about the alignment such as alignment score, length and percentage
- identity between the sequences.</p>
-<p> </p>
+ <p>
+ <strong>Pairwise alignment (Proteins only)</strong>
+ </p>
+ <p>
+ This calculation is performed on the selected sequences only. Java
+ is not the fastest language in the world and aligning more than a
+ handful of sequences will take a fair amount of time. <br> For
+ each pair of sequences the best global alignment is found using
+ BLOSUM62 as the scoring matrix. The scores reported are the raw
+ scores. The sequences are aligned using a dynamic programming
+ technique and using the following gap penalties :
+ </p>
+ <p>
+ Gap open : 12 <br> Gap extend : 2
+ </p>
+ <p>When you select the pairwise alignment option a new window will
+ come up which will display the alignments in a text format as they
+ are calculated. Also displayed is information about the alignment
+ such as alignment score, length and percentage identity between the
+ sequences.</p>
+ <p> </p>
</body>
</html>
diff --git a/help/html/calculations/pca.html b/help/html/calculations/pca.html
index 9ae9e50..d1841a1 100644
--- a/help/html/calculations/pca.html
+++ b/help/html/calculations/pca.html
@@ -1,84 +1,145 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Principal Component Analysis</title>
</head>
<body>
-<p><strong>Principal Component Analysis</strong></p>
-<p>This calculation creates a spatial representation of the
-similarities within a selected group, or all of the sequences in an
-alignment. After the calculation finishes, a 3D viewer displays the set
-of sequences as points in 'similarity space', and similar sequences tend
-to lie near each other in the space.</p>
-<p>Note: The calculation is computationally expensive, and may fail
-for very large sets of sequences - usually because the JVM has run out
-of memory. A future release of Jalview will be able to avoid this by
-executing the calculation via a web service.</p>
-<p>Principal components analysis is a technique for examining the
-structure of complex data sets. The components are a set of dimensions
-formed from the measured values in the data set, and the principle
-component is the one with the greatest magnitude, or length. The sets of
-measurements that differ the most should lie at either end of this
-principle axis, and the other axes correspond to less extreme patterns
-of variation in the data set.</p>
+ <p>
+ <strong>Principal Component Analysis</strong>
+ </p>
+ <p>This calculation creates a spatial representation of the
+ similarities within a selected group, or all of the sequences in an
+ alignment. After the calculation finishes, a 3D viewer displays the
+ set of sequences as points in 'similarity space', and similar
+ sequences tend to lie near each other in the space.</p>
+ <p>
+ <em>Caveats</em><br />The calculation is computationally expensive,
+ and may fail for very large sets of sequences - usually because the
+ JVM has run out of memory. A future release of Jalview will be able
+ to avoid this by executing the calculation via a web service.
+ </p>
+
+ <p>
+ <strong>About PCA</strong>
+ </p>
+ <p>Principal components analysis is a technique for examining the
+ structure of complex data sets. The components are a set of
+ dimensions formed from the measured values in the data set, and the
+ principal component is the one with the greatest magnitude, or
+ length. The sets of measurements that differ the most should lie at
+ either end of this principal axis, and the other axes correspond to
+ less extreme patterns of variation in the data set.</p>
-<p>In this case, the components are generated by an eigenvector
-decomposition of the matrix formed from the sum of BLOSUM scores at each
-aligned position between each pair of sequences. The matrix is not
-symmetric - elements in the upper diagonal give the sum of scores for
-mutating in one direction, and the lower diagonal is the sum of scores
-for mutating in the other. This is a refinement of the method described
-in the paper by G. Casari, C. Sander and A. Valencia. Structural Biology
-volume 2, no. 2, February 1995 (<a
- href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=pubmed&dopt=Abstract&list_uids=7749921">pubmed</a>)
-and implemented at the SeqSpace server at the EBI.</p>
+ <p>
+ <em>Calculating PCAs for aligned sequences</em><br />Jalview can
+ perform PCA analysis on both proteins and nucleotide sequence
+ alignments. In both cases, components are generated by an
+ eigenvector decomposition of the matrix formed from the sum of
+ substitution matrix scores at each aligned position between each
+ pair of sequences - computed with one of the available score
+ matrices, such as <a href="scorematrices.html#blosum62">BLOSUM62</a>,
+ <a href="scorematrices.html#pam250">PAM250</a>, or the <a
+ href="scorematrices.html#simplenucleotide"
+ >simple single nucleotide substitution matrix</a>. The options
+ available for calculation are given in the <strong><em>Change
+ Parameters</em></strong> menu.
+ </p>
+ <p>
+ <em>PCA Calculation modes</em><br /> The default Jalview calculation
+ mode (indicated when <em><strong>Jalview PCA
+ Calculation</strong></em> is ticked in the <strong><em>Change
+ Parameters</em></strong> menu) is to perform a PCA on a matrix where elements
+ in the upper diagonal give the sum of scores for mutating in one
+ direction, and the lower diagonal is the sum of scores for mutating
+ in the other. For protein substitution models like BLOSUM62, this
+ gives an asymmetric matrix, and a different PCA to a matrix produced
+ with the method described in the paper by G. Casari, C. Sander and
+ A. Valencia. Structural Biology volume 2, no. 2, February 1995 (<a
+ href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=pubmed&dopt=Abstract&list_uids=7749921"
+ >pubmed</a>) and implemented at the SeqSpace server at the EBI. This
+ method preconditions the matrix by multiplying it with its
+ transpose, and can be employed in the PCA viewer by unchecking the <strong><em>Jalview
+ PCA Calculation</em></strong> option in the <strong><em>Change
+ Parameters</em></strong> menu.
+ </p>
+ <img src="pcaviewer.gif">
+ <p>
+ <strong>The PCA Viewer</strong>
+ </p>
+ <p>This is an interactive display of the sequences positioned
+ within the similarity space, as points in a rotateable 3D
+ scatterplot. The colour of each sequence point is the same as the
+ sequence group colours, white if no colour has been defined for the
+ sequence, and green if the sequence is part of a the currently
+ selected group.</p>
+ <p>
+ The 3d view can be rotated by dragging the mouse with the <strong>left
+ mouse button</strong> pressed. The view can also be zoomed in and out with
+ the up and down <strong>arrow keys</strong> (and the roll bar of the
+ mouse if present). Labels will be shown for each sequence if the
+ entry in the View menu is checked, and the plot background colour
+ changed from the View→Background Colour.. dialog box. The File
+ menu allows the view to be saved (<strong>File→Save</strong>
+ submenu) as an EPS or PNG image or printed, and the original
+ alignment data and matrix resulting from its PCA analysis to be
+ retrieved. The coordinates for the whole PCA space, or just the
+ current view may also be exported as CSV files for visualization in
+ another program or further analysis.
+ <p>
+ <p>Options for coordinates export are:</p>
+ <ul>
+ <li>Output Values - complete dump of analysis (TxT* matrix
+ computed from sum of scores for all pairs of aligned residues from
+ from i->j and j->i, conditioned matrix to be diagonalised,
+ tridiagonal form, major eigenvalues found)</li>
+ <li>Output Points - The eigenvector matrix - rows correspond to
+ sequences, columns correspond to each dimension in the PCA</li>
+ <li>Transformed Points - The 3D coordinates for each sequence
+ as shown in the PCA plot</li>
+ </ul>
-<p><strong>The PCA Viewer</strong></p>
-<p>This is an interactive display of the sequences positioned within
-the similarity space, as points in a rotateable 3D scatterplot. The
-colour of each sequence point is the same as the sequence group colours,
-white if no colour has been defined for the sequence, and green if the
-sequence is part of a the currently selected group.</p>
-<p>The 3d view can be rotated by dragging the mouse with the <strong>left
-mouse button</strong> pressed. The view can also be zoomed in and out with the up
-and down <strong>arrow keys</strong> (and the roll bar of the mouse if
-present). Labels will be shown for each sequence if the entry in the
-View menu is checked, and the plot background colour changed from the
-View→Background Colour.. dialog box. The File menu allows the view
-to be saved (<strong>File→Save</strong> submenu) as an EPS or PNG
-image or printed, and the original alignment data and matrix resulting
-from its PCA analysis to be retrieved. The coordinates for the whole PCA
-space, or just the current view may also be exported as CSV files for
-visualization in another program or further analysis.</p>
-<p>A tool tip gives the sequence ID corresponding to a point in the
-space, and clicking a point toggles the selection of the corresponding
-sequence in the associated alignment window views. Rectangular region
+ <p>
+ A tool tip gives the sequence ID corresponding to a point in the
+ space, and clicking a point toggles the selection of the
+ corresponding sequence in the associated alignment window views.
+ <!-- Rectangular region
based selection is also possible, by holding the 'S' key whilst
-left-clicking and dragging the mouse over the display. By default,
-points are only associated with the alignment view from which the PCA
-was calculated, but this may be changed via the <strong>View→Associate
-Nodes</strong> sub-menu.</p>
-<p>Initially, the display shows the first three components of the
-similarity space, but any eigenvector can be used by changing the
-selected dimension for the x, y, or z axis through each ones menu
-located below the 3d display.</p>
-<p>
-<p>
+left-clicking and dragging the mouse over the display. -->
+ By default, points are only associated with the alignment view from
+ which the PCA was calculated, but this may be changed via the <strong>View→Associate
+ Nodes</strong> sub-menu.
+ </p>
+ <p>
+ Initially, the display shows the first three components of the
+ similarity space, but any eigenvector can be used by changing the
+ selected dimension for the x, y, or z axis through each ones menu
+ located below the 3d display. The <strong><em>Reset</em></strong>
+ button will reset axis and rotation settings to their defaults.
+ </p>
+ <p>
+ <p>
+ <em>The output of points and transformed point coordinates was
+ added to the Jalview desktop in v2.7.</em> <em>The Reset button
+ and Change Parameters menu were added in Jalview 2.8.</em> <em>Support
+ for PAM250 based PCA was added in Jalview 2.8.1.</em>
</body>
</html>
diff --git a/help/html/calculations/pcaviewer.gif b/help/html/calculations/pcaviewer.gif
new file mode 100644
index 0000000..78c82f2
Binary files /dev/null and b/help/html/calculations/pcaviewer.gif differ
diff --git a/help/html/calculations/quality.html b/help/html/calculations/quality.html
index 4846acc..ff084cf 100644
--- a/help/html/calculations/quality.html
+++ b/help/html/calculations/quality.html
@@ -1,49 +1,52 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Alignment Quality Annotation</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Alignment Quality Annotation</title>
+</head>
<body>
-<p><strong>Alignment Quality Annotation</strong></p>
-<p>Alignment Quality is one of the automatically calculated
-quantitative alignment
-annotations displayed below the columns of a multiple sequence
-alignment (and can be used to shade the alignment). It is an ad-hoc
-measure of the likelihood of observing the mutations (if any) in a
-particular column of the alignment.</p>
-<p>
-More precisely, the quality score is inversely proportional to the
-average cost of all pairs of mutations oberved in a particular column
-of the alignment - a high alignment quality score for a column would
-suggest that there are no mutations, or most mutations observed are
-favourable.
-</p>
+ <p>
+ <strong>Alignment Quality Annotation</strong>
+ </p>
+ <p>Alignment Quality is one of the automatically calculated
+ quantitative alignment annotations displayed below the columns of a
+ multiple sequence alignment (and can be used to shade the
+ alignment). It is an ad-hoc measure of the likelihood of observing
+ the mutations (if any) in a particular column of the alignment.</p>
+ <p>More precisely, the quality score is inversely proportional to
+ the average cost of all pairs of mutations observed in a particular
+ column of the alignment - a high alignment quality score for a
+ column would suggest that there are no mutations, or most mutations
+ observed are favourable.</p>
-<p><em>The Algorithm</em><br>
-The quality score is calculated for each column in an alignment by
-summing, for all mutations, the ratio of the two BLOSUM 62 scores for
-a mutation pair and each residue's conservered BLOSUM62 score (which
-is higher). This valueis normalised for each column, and then plotted
-on a scale from 0 to 1.
-</p>
-<p>
-Multiple alignment algorithms using the BLOSUM 62 substition matrices
-should, in theory, maximise alignment quality for an un-gapped
-alignment, and locally maximise quality for gapped alignments.
-</p>
+ <p>
+ <em>The Algorithm</em><br> The quality score is calculated for
+ each column in an alignment by summing, for all mutations, the ratio
+ of the two BLOSUM 62 scores for a mutation pair and each residue's
+ conserved BLOSUM62 score (which is higher). This value is normalised
+ for each column, and then plotted on a scale from 0 to 1.
+ </p>
+ <p>Multiple alignment algorithms using the BLOSUM 62 substition
+ matrices should, in theory, maximise alignment quality for an
+ un-gapped alignment, and locally maximise quality for gapped
+ alignments.</p>
</body>
</html>
diff --git a/help/html/calculations/recoverInputdata.html b/help/html/calculations/recoverInputdata.html
index c09acbc..cd6a808 100644
--- a/help/html/calculations/recoverInputdata.html
+++ b/help/html/calculations/recoverInputdata.html
@@ -1,30 +1,37 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Viewing Input Data to PCA and Tree calculations</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Viewing Input Data to PCA and Tree calculations</title>
+</head>
<body>
-<p><strong>Viewing Input Data to PCA and Tree calculations</strong></p>
-<p>It is always possible to retrieve the input data used to calculate
- a tree or PCA plot by using the analysis window's
- <strong>"File
- -> Input Data..."</strong> menu item. The Input Data will be
- shown in a new alignment window, with any hidden columns
- preserved.</p>
+ <p>
+ <strong>Viewing Input Data to PCA and Tree calculations</strong>
+ </p>
+ <p>
+ It is always possible to retrieve the input data used to calculate a
+ tree or PCA plot by using the analysis window's <strong>"File
+ -> Input Data..."</strong> menu item. The Input Data will be shown
+ in a new alignment window, with any hidden columns preserved.
+ </p>
</body>
</html>
diff --git a/help/html/calculations/redundancy.html b/help/html/calculations/redundancy.html
index 4ded83c..2946ab7 100644
--- a/help/html/calculations/redundancy.html
+++ b/help/html/calculations/redundancy.html
@@ -1,33 +1,40 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Removing Redundancy</title>
</head>
<body>
-<p><strong>Removing redundancy</strong></p>
-<p>Selecting the option in the Alignment window's <strong>Edit</strong>
-menu or pressing <strong>'CONTROL+D'</strong> brings up a dialog box
-asking you to select a threshold. If the percentage identity between the
-aligned positions of any two sequences in the visible alignment exceeds
-this value, the shorter sequence is discarded.<br><em>Note:</em> The redundancy
-calculation is done when the dialog box is opened. For large numbers
-of sequences this can take a long time as all pairs have to be compared.
-</p>
+ <p>
+ <strong>Removing redundancy</strong>
+ </p>
+ <p>
+ Selecting the option in the Alignment window's <strong>Edit</strong>
+ menu or pressing <strong>'CONTROL+D'</strong> brings up a dialog box
+ asking you to select a threshold. If the percentage identity between
+ the aligned positions of any two sequences in the visible alignment
+ exceeds this value, the shorter sequence is discarded.<br>
+ <em>Note:</em> The redundancy calculation is done when the dialog
+ box is opened. For large numbers of sequences this can take a long
+ time as all pairs have to be compared.
+ </p>
</body>
</html>
diff --git a/help/html/calculations/referenceseq.html b/help/html/calculations/referenceseq.html
new file mode 100644
index 0000000..d0fbb20
--- /dev/null
+++ b/help/html/calculations/referenceseq.html
@@ -0,0 +1,50 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Reference Sequences</title>
+</head>
+<body>
+ <p>
+ <strong>Reference Sequence Alignment Views</strong>
+ </p>
+ <p>
+ The reference sequence for an alignment is indicated by its ID being
+ shown in bold. When a reference sequence has been defined, the <strong>Format→Show
+ unconserved</strong> option highlights mutations with respect to the
+ reference sequence, rather than the alignment's consensus sequence.
+ </p>
+ <p>
+ <ul>
+ <li>Jalview automatically assigns a reference sequence when <a
+ href="../webServices/jnet.html"
+ >JPred4</a> predictions are imported.
+ </li>
+ <li><strong>Assigning a reference sequence</strong><br /> A
+ sequence can be marked as the reference sequence by right-clicking
+ on it's ID to open the popup menu, and selecting the "<strong>(Sequence
+ ID)→Mark as Reference</strong>" entry."</li>
+ </ul>
+ <p>
+ <em>Reference sequence based alignment visualisation was
+ introduced in Jalview 2.9.</em>
+ </p>
+</html>
diff --git a/help/html/calculations/scorematrices.html b/help/html/calculations/scorematrices.html
new file mode 100644
index 0000000..8a1181d
--- /dev/null
+++ b/help/html/calculations/scorematrices.html
@@ -0,0 +1,1662 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Substitution matrices in Jalview</title>
+</head>
+<body>
+ <strong>Substitution Matrices available in Jalview</strong>
+ <p>Jalview includes a small number of built in substitution
+ matrices, used for different types of analysis.</p>
+ <ul>
+ <li><a href="#blosum62">BLOSUM62</a> is the standard protein
+ sequence alignment and analysis matrix.</li>
+ <li><a href="#pam250">PAM250</a> is another standard protein
+ matrix, and (since 2.8.1) is available for Tree and PCA
+ calculations.</li>
+ <li><a href="#simplenucleotide">Simple Nucleotide
+ Substition</a> is a (fairly) arbitrary DNA/RNA substitution matrix.</li>
+ <!-- <li><a href="#conservation">Conservation Matrices</a> A range of matrices for distinguishing amino-acids by physicochemical property conservation.
+</li> -->
+ </ul>
+
+ <p>
+ <strong><a name="blosum62"></a>BLOSUM62</strong><br />
+ <table border="1">
+ <tr>
+ <td></td>
+ <td> A </td>
+ <td> B </td>
+ <td> C </td>
+ <td> D </td>
+ <td> E </td>
+ <td> F </td>
+ <td> G </td>
+ <td> H </td>
+ <td> I </td>
+ <td> K </td>
+ <td> L </td>
+ <td> M </td>
+ <td> N </td>
+ <td> P </td>
+ <td> Q </td>
+ <td> R </td>
+ <td> S </td>
+ <td> T </td>
+ <td> U </td>
+ <td> V </td>
+ <td> W </td>
+ <td> X </td>
+ <td> Y </td>
+ <td> Z </td>
+ </tr>
+ <tr>
+ <td>A</td>
+ <td>4</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>B</td>
+ <td>-2</td>
+ <td>4</td>
+ <td>-3</td>
+ <td>4</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-4</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>C</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>9</td>
+ <td>-3</td>
+ <td>-4</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>3</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-3</td>
+ </tr>
+ <tr>
+ <td>D</td>
+ <td>-2</td>
+ <td>4</td>
+ <td>-3</td>
+ <td>6</td>
+ <td>2</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-4</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>E</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-4</td>
+ <td>2</td>
+ <td>5</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>2</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>4</td>
+ </tr>
+ <tr>
+ <td>F</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>6</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>3</td>
+ <td>-3</td>
+ </tr>
+ <tr>
+ <td>G</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>6</td>
+ <td>-2</td>
+ <td>-4</td>
+ <td>-2</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-2</td>
+ </tr>
+ <tr>
+ <td>H</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>8</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>2</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>I</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>4</td>
+ <td>-3</td>
+ <td>2</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>3</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-3</td>
+ </tr>
+ <tr>
+ <td>K</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>5</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>2</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>L</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>2</td>
+ <td>-2</td>
+ <td>4</td>
+ <td>2</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-3</td>
+ </tr>
+ <tr>
+ <td>M</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>2</td>
+ <td>5</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>N</td>
+ <td>-2</td>
+ <td>3</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>6</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>0</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-4</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>P</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>7</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-4</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>Q</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>2</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>5</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>3</td>
+ </tr>
+ <tr>
+ <td>R</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>5</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>S</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>4</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>T</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>5</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>U</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>V</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>3</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>4</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ </tr>
+ <tr>
+ <td>W</td>
+ <td>-3</td>
+ <td>-4</td>
+ <td>-2</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-4</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>11</td>
+ <td>-2</td>
+ <td>2</td>
+ <td>-3</td>
+ </tr>
+ <tr>
+ <td>X</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>Y</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>3</td>
+ <td>-3</td>
+ <td>2</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>2</td>
+ <td>-1</td>
+ <td>7</td>
+ <td>-2</td>
+ </tr>
+ <tr>
+ <td>Z</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>4</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>3</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>4</td>
+ </tr>
+ </table>
+ <p>
+ <strong><a name="pam250">PAM250</a></strong><br /> <em><strong>P</strong>ercentage
+ <strong>A</strong>ccepted <strong>M</strong>utation matrix. PAM250
+ estimates substitutions after 250% of sites have changed (each
+ site can be mutated multple times).<br /> Jalview 2.8.1 introduced
+ support for PAM250 based <a href="../calculations/pca.html">PCA</a>
+ and <a href="../calculations/tree.html">tree</a> calculations.</em>
+ <table border="1">
+ <tr>
+ <td></td>
+ <td> A </td>
+ <td> B </td>
+ <td> C </td>
+ <td> D </td>
+ <td> E </td>
+ <td> F </td>
+ <td> G </td>
+ <td> H </td>
+ <td> I </td>
+ <td> K </td>
+ <td> L </td>
+ <td> M </td>
+ <td> N </td>
+ <td> P </td>
+ <td> Q </td>
+ <td> R </td>
+ <td> S </td>
+ <td> T </td>
+ <td> U </td>
+ <td> V </td>
+ <td> W </td>
+ <td> X </td>
+ <td> Y </td>
+ <td> Z </td>
+ </tr>
+ <tr>
+ <td>A</td>
+ <td>2</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-6</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>B</td>
+ <td>0</td>
+ <td>3</td>
+ <td>-4</td>
+ <td>3</td>
+ <td>3</td>
+ <td>-4</td>
+ <td>0</td>
+ <td>1</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>2</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-5</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>2</td>
+ </tr>
+ <tr>
+ <td>C</td>
+ <td>-2</td>
+ <td>-4</td>
+ <td>12</td>
+ <td>-5</td>
+ <td>-5</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-5</td>
+ <td>-6</td>
+ <td>-5</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>-5</td>
+ <td>-4</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-8</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-5</td>
+ </tr>
+ <tr>
+ <td>D</td>
+ <td>0</td>
+ <td>3</td>
+ <td>-5</td>
+ <td>4</td>
+ <td>3</td>
+ <td>-6</td>
+ <td>1</td>
+ <td>1</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>2</td>
+ <td>-1</td>
+ <td>2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-7</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>3</td>
+ </tr>
+ <tr>
+ <td>E</td>
+ <td>0</td>
+ <td>3</td>
+ <td>-5</td>
+ <td>3</td>
+ <td>4</td>
+ <td>-5</td>
+ <td>0</td>
+ <td>1</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-7</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>3</td>
+ </tr>
+ <tr>
+ <td>F</td>
+ <td>-3</td>
+ <td>-4</td>
+ <td>-4</td>
+ <td>-6</td>
+ <td>-5</td>
+ <td>9</td>
+ <td>-5</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>-5</td>
+ <td>2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-5</td>
+ <td>-5</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>7</td>
+ <td>-5</td>
+ </tr>
+ <tr>
+ <td>G</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-5</td>
+ <td>5</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-7</td>
+ <td>-1</td>
+ <td>-5</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>H</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>6</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>2</td>
+ <td>0</td>
+ <td>3</td>
+ <td>2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>2</td>
+ </tr>
+ <tr>
+ <td>I</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>5</td>
+ <td>-2</td>
+ <td>2</td>
+ <td>2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>4</td>
+ <td>-5</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ </tr>
+ <tr>
+ <td>K</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>-5</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-5</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>5</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>3</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>L</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-6</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>2</td>
+ <td>-4</td>
+ <td>-2</td>
+ <td>2</td>
+ <td>-3</td>
+ <td>6</td>
+ <td>4</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-3</td>
+ </tr>
+ <tr>
+ <td>M</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-5</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>2</td>
+ <td>0</td>
+ <td>4</td>
+ <td>6</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>2</td>
+ <td>-4</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ </tr>
+ <tr>
+ <td>N</td>
+ <td>0</td>
+ <td>2</td>
+ <td>-4</td>
+ <td>2</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>2</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>2</td>
+ <td>0</td>
+ <td>1</td>
+ <td>0</td>
+ <td>1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-4</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>P</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-5</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>6</td>
+ <td>0</td>
+ <td>0</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-6</td>
+ <td>-1</td>
+ <td>-5</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>Q</td>
+ <td>0</td>
+ <td>1</td>
+ <td>-5</td>
+ <td>2</td>
+ <td>2</td>
+ <td>-5</td>
+ <td>-1</td>
+ <td>3</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>0</td>
+ <td>4</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-5</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>3</td>
+ </tr>
+ <tr>
+ <td>R</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>2</td>
+ <td>-2</td>
+ <td>3</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>0</td>
+ <td>0</td>
+ <td>1</td>
+ <td>6</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>2</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>S</td>
+ <td>1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>2</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>T</td>
+ <td>1</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>1</td>
+ <td>3</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-5</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>U</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>V</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>4</td>
+ <td>-2</td>
+ <td>2</td>
+ <td>2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>4</td>
+ <td>-6</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ </tr>
+ <tr>
+ <td>W</td>
+ <td>-6</td>
+ <td>-5</td>
+ <td>-8</td>
+ <td>-7</td>
+ <td>-7</td>
+ <td>0</td>
+ <td>-7</td>
+ <td>-3</td>
+ <td>-5</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-4</td>
+ <td>-4</td>
+ <td>-6</td>
+ <td>-5</td>
+ <td>2</td>
+ <td>-2</td>
+ <td>-5</td>
+ <td>-4</td>
+ <td>-6</td>
+ <td>17</td>
+ <td>-4</td>
+ <td>0</td>
+ <td>-6</td>
+ </tr>
+ <tr>
+ <td>X</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-3</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-1</td>
+ </tr>
+ <tr>
+ <td>Y</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>0</td>
+ <td>-4</td>
+ <td>-4</td>
+ <td>7</td>
+ <td>-5</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>-5</td>
+ <td>-4</td>
+ <td>-4</td>
+ <td>-3</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-2</td>
+ <td>10</td>
+ <td>-4</td>
+ </tr>
+ <tr>
+ <td>Z</td>
+ <td>0</td>
+ <td>2</td>
+ <td>-5</td>
+ <td>3</td>
+ <td>3</td>
+ <td>-5</td>
+ <td>0</td>
+ <td>2</td>
+ <td>-2</td>
+ <td>0</td>
+ <td>-3</td>
+ <td>-2</td>
+ <td>1</td>
+ <td>0</td>
+ <td>3</td>
+ <td>0</td>
+ <td>0</td>
+ <td>-1</td>
+ <td>-1</td>
+ <td>-2</td>
+ <td>-6</td>
+ <td>-1</td>
+ <td>-4</td>
+ <td>3</td>
+ </tr>
+ </table>
+
+ <p>
+ <strong><a name="simplenucleotide">Simple Nucleotide
+ Substitution</a></strong><br> This is an ad-hoc matrix which, in
+ addition to penalising mutations between the common nucleotides
+ (ACGT), includes T/U equivalence in order to allow both DNA and/or
+ RNA. In addition, it encodes weak equivalence between R and Y with
+ AG and CTU, respectively, and N is allowed to match any other base
+ weakly. This matrix also includes I (Inosine) and X (Xanthine), but
+ encodes them to weakly match any of (ACGTU), and unfavourably match
+ each other.
+ <table border="1">
+ <tr>
+ <td></td>
+ <td> A </td>
+ <td> C </td>
+ <td> G </td>
+ <td> I </td>
+ <td> N </td>
+ <td> R </td>
+ <td> T </td>
+ <td> U </td>
+ <td> X </td>
+ <td> Y </td>
+ </tr>
+ <tr>
+ <td>A</td>
+ <td>10</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>-8</td>
+ </tr>
+ <tr>
+ <td>C</td>
+ <td>-8</td>
+ <td>10</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>1</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>G</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>10</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>-8</td>
+ </tr>
+ <tr>
+ <td>I</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>10</td>
+ <td>1</td>
+ <td>0</td>
+ <td>1</td>
+ <td>1</td>
+ <td>0</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>N</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>10</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>R</td>
+ <td>1</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>0</td>
+ <td>1</td>
+ <td>10</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>0</td>
+ <td>-8</td>
+ </tr>
+ <tr>
+ <td>T</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>1</td>
+ <td>-8</td>
+ <td>10</td>
+ <td>10</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>U</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>1</td>
+ <td>-8</td>
+ <td>10</td>
+ <td>10</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>X</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>0</td>
+ <td>1</td>
+ <td>0</td>
+ <td>1</td>
+ <td>1</td>
+ <td>10</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>Y</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>-8</td>
+ <td>0</td>
+ <td>1</td>
+ <td>-8</td>
+ <td>1</td>
+ <td>1</td>
+ <td>0</td>
+ <td>10</td>
+ </tr>
+ </table>
+ <strong><em>This nucleotide matrix was introduced in
+ Jalview 2.8. If you'd like to improve it - please take a look at <a
+ href="http://issues.jalview.org/browse/JAL-1027"
+ >Issue JAL-1027 - introduce a nucleotide substitution matrix that
+ supports RNA/DNA and ambiguity codes</a>
+ </em></strong>
+ </p>
+ <!-- <p><strong><a name="conservation">Physicochemical property conservation</a></strong><br>
+Three different matrices are provided which reflect differences in physicochemical properties for different amino-acids.
+<ul><li><em>Conservation Both</em><br>Matrix elements count number of properties shared, and number of properties that both amino-acids *do not* have (e.g. hydrophobic and not polar).
+
+<table border="1"><tr><td></td><td> A </td><td> B </td><td> C </td><td> D </td><td> E </td><td> F </td><td> G </td><td> H </td><td> I </td><td> K </td><td> L </td><td> M </td><td> N </td><td> P </td><td> Q </td><td> R </td><td> S </td><td> T </td><td> U </td><td> V </td><td> W </td [...]
+<tr><td>A</td><td>20</td><td>0</td><td>18</td><td>10</td><td>8</td><td>14</td><td>20</td><td>8</td><td>14</td><td>10</td><td>14</td><td>16</td><td>14</td><td>14</td><td>12</td><td>8</td><td>16</td><td>14</td><td>2</td><td>16</td><td>12</td><td>2</td><td>12</td><td>0</td></tr>
+<tr><td>B</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
+<tr><td>C</td><td>18</td><td>0</td><td>18</td><td>12</td><td>10</td><td>16</td><td>18</td><td>10</td><td>16</td><td>12</td><td>16</td><td>18</td><td>16</td><td>16</td><td>14</td><td>10</td><td>14</td><td>16</td><td>2</td><td>18</td><td>14</td><td>2</td><td>14</td><td>0</td></tr>
+<tr><td>D</td><td>10</td><td>0</td><td>12</td><td>18</td><td>18</td><td>8</td><td>10</td><td>10</td><td>8</td><td>12</td><td>8</td><td>10</td><td>16</td><td>12</td><td>14</td><td>14</td><td>14</td><td>16</td><td>2</td><td>10</td><td>10</td><td>2</td><td>10</td><td>0</td></tr>
+<tr><td>E</td><td>8</td><td>0</td><td>10</td><td>18</td><td>14</td><td>10</td><td>8</td><td>12</td><td>10</td><td>14</td><td>10</td><td>12</td><td>14</td><td>10</td><td>16</td><td>16</td><td>12</td><td>14</td><td>2</td><td>8</td><td>12</td><td>2</td><td>12</td><td>0</td></tr>
+<tr><td>F</td><td>14</td><td>0</td><td>16</td><td>8</td><td>10</td><td>18</td><td>14</td><td>14</td><td>16</td><td>12</td><td>16</td><td>18</td><td>12</td><td>12</td><td>14</td><td>10</td><td>10</td><td>12</td><td>2</td><td>14</td><td>18</td><td>2</td><td>18</td><td>0</td></tr>
+<tr><td>G</td><td>20</td><td>0</td><td>18</td><td>10</td><td>8</td><td>14</td><td>16</td><td>8</td><td>14</td><td>10</td><td>14</td><td>16</td><td>14</td><td>14</td><td>12</td><td>8</td><td>16</td><td>14</td><td>2</td><td>16</td><td>12</td><td>2</td><td>12</td><td>0</td></tr>
+<tr><td>H</td><td>8</td><td>0</td><td>10</td><td>10</td><td>12</td><td>14</td><td>8</td><td>18</td><td>10</td><td>18</td><td>10</td><td>12</td><td>10</td><td>6</td><td>12</td><td>16</td><td>8</td><td>10</td><td>4</td><td>8</td><td>16</td><td>4</td><td>16</td><td>0</td></tr>
+<tr><td>I</td><td>14</td><td>0</td><td>16</td><td>8</td><td>10</td><td>16</td><td>14</td><td>10</td><td>20</td><td>12</td><td>20</td><td>18</td><td>12</td><td>12</td><td>14</td><td>10</td><td>10</td><td>12</td><td>2</td><td>18</td><td>14</td><td>2</td><td>14</td><td>0</td></tr>
+<tr><td>K</td><td>10</td><td>0</td><td>12</td><td>12</td><td>14</td><td>12</td><td>10</td><td>18</td><td>12</td><td>14</td><td>12</td><td>14</td><td>12</td><td>8</td><td>14</td><td>18</td><td>10</td><td>12</td><td>4</td><td>10</td><td>14</td><td>4</td><td>14</td><td>0</td></tr>
+<tr><td>L</td><td>14</td><td>0</td><td>16</td><td>8</td><td>10</td><td>16</td><td>14</td><td>10</td><td>20</td><td>12</td><td>18</td><td>18</td><td>12</td><td>12</td><td>14</td><td>10</td><td>10</td><td>12</td><td>2</td><td>18</td><td>14</td><td>2</td><td>14</td><td>0</td></tr>
+<tr><td>M</td><td>16</td><td>0</td><td>18</td><td>10</td><td>12</td><td>18</td><td>16</td><td>12</td><td>18</td><td>14</td><td>18</td><td>18</td><td>14</td><td>14</td><td>16</td><td>12</td><td>12</td><td>14</td><td>2</td><td>16</td><td>16</td><td>2</td><td>16</td><td>0</td></tr>
+<tr><td>N</td><td>14</td><td>0</td><td>16</td><td>16</td><td>14</td><td>12</td><td>14</td><td>10</td><td>12</td><td>12</td><td>12</td><td>14</td><td>20</td><td>16</td><td>18</td><td>14</td><td>18</td><td>20</td><td>2</td><td>14</td><td>14</td><td>2</td><td>14</td><td>0</td></tr>
+<tr><td>P</td><td>14</td><td>0</td><td>16</td><td>12</td><td>10</td><td>12</td><td>14</td><td>6</td><td>12</td><td>8</td><td>12</td><td>14</td><td>16</td><td>16</td><td>14</td><td>10</td><td>14</td><td>16</td><td>0</td><td>14</td><td>10</td><td>0</td><td>10</td><td>0</td></tr>
+<tr><td>Q</td><td>12</td><td>0</td><td>14</td><td>14</td><td>16</td><td>14</td><td>12</td><td>12</td><td>14</td><td>14</td><td>14</td><td>16</td><td>18</td><td>14</td><td>18</td><td>16</td><td>16</td><td>18</td><td>2</td><td>12</td><td>16</td><td>2</td><td>16</td><td>0</td></tr>
+<tr><td>R</td><td>8</td><td>0</td><td>10</td><td>14</td><td>16</td><td>10</td><td>8</td><td>16</td><td>10</td><td>18</td><td>10</td><td>12</td><td>14</td><td>10</td><td>16</td><td>18</td><td>12</td><td>14</td><td>2</td><td>8</td><td>12</td><td>2</td><td>12</td><td>0</td></tr>
+<tr><td>S</td><td>16</td><td>0</td><td>14</td><td>14</td><td>12</td><td>10</td><td>16</td><td>8</td><td>10</td><td>10</td><td>10</td><td>12</td><td>18</td><td>14</td><td>16</td><td>12</td><td>18</td><td>18</td><td>2</td><td>12</td><td>12</td><td>2</td><td>12</td><td>0</td></tr>
+<tr><td>T</td><td>14</td><td>0</td><td>16</td><td>16</td><td>14</td><td>12</td><td>14</td><td>10</td><td>12</td><td>12</td><td>12</td><td>14</td><td>20</td><td>16</td><td>18</td><td>14</td><td>18</td><td>14</td><td>2</td><td>14</td><td>14</td><td>2</td><td>14</td><td>0</td></tr>
+<tr><td>U</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>4</td><td>0</td><td>4</td><td>0</td></tr>
+<tr><td>V</td><td>16</td><td>0</td><td>18</td><td>10</td><td>8</td><td>14</td><td>16</td><td>8</td><td>18</td><td>10</td><td>18</td><td>16</td><td>14</td><td>14</td><td>12</td><td>8</td><td>12</td><td>14</td><td>2</td><td>2</td><td>12</td><td>2</td><td>12</td><td>0</td></tr>
+<tr><td>W</td><td>12</td><td>0</td><td>14</td><td>10</td><td>12</td><td>18</td><td>12</td><td>16</td><td>14</td><td>14</td><td>14</td><td>16</td><td>14</td><td>10</td><td>16</td><td>12</td><td>12</td><td>14</td><td>4</td><td>12</td><td>20</td><td>4</td><td>20</td><td>0</td></tr>
+<tr><td>X</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>4</td><td>0</td><td>4</td><td>0</td></tr>
+<tr><td>Y</td><td>12</td><td>0</td><td>14</td><td>10</td><td>12</td><td>18</td><td>12</td><td>16</td><td>14</td><td>14</td><td>14</td><td>16</td><td>14</td><td>10</td><td>16</td><td>12</td><td>12</td><td>14</td><td>4</td><td>12</td><td>20</td><td>4</td><td>12</td><td>0</td></tr>
+<tr><td>Z</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
+</table>
+
+<li><em>Conservation Pos</em><br>Count number of properties that amino acids both have in common.
+
+<table border="1"><tr><td></td><td> A </td><td> B </td><td> C </td><td> D </td><td> E </td><td> F </td><td> G </td><td> H </td><td> I </td><td> K </td><td> L </td><td> M </td><td> N </td><td> P </td><td> Q </td><td> R </td><td> S </td><td> T </td><td> U </td><td> V </td><td> W </td [...]
+<tr><td>A</td><td>6</td><td>0</td><td>4</td><td>2</td><td>0</td><td>2</td><td>6</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>0</td><td>4</td><td>2</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>B</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
+<tr><td>C</td><td>4</td><td>0</td><td>4</td><td>2</td><td>0</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>0</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>D</td><td>2</td><td>0</td><td>2</td><td>6</td><td>6</td><td>0</td><td>2</td><td>4</td><td>0</td><td>4</td><td>0</td><td>0</td><td>4</td><td>2</td><td>2</td><td>4</td><td>4</td><td>4</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>E</td><td>0</td><td>0</td><td>0</td><td>6</td><td>4</td><td>0</td><td>0</td><td>4</td><td>0</td><td>4</td><td>0</td><td>0</td><td>2</td><td>0</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>F</td><td>2</td><td>0</td><td>2</td><td>0</td><td>0</td><td>4</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>2</td><td>2</td><td>4</td><td>2</td><td>4</td><td>0</td></tr>
+<tr><td>G</td><td>6</td><td>0</td><td>4</td><td>2</td><td>0</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>0</td><td>4</td><td>2</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>H</td><td>2</td><td>0</td><td>2</td><td>4</td><td>4</td><td>4</td><td>2</td><td>8</td><td>2</td><td>8</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>6</td><td>2</td><td>2</td><td>4</td><td>2</td><td>6</td><td>4</td><td>6</td><td>0</td></tr>
+<tr><td>I</td><td>2</td><td>0</td><td>2</td><td>0</td><td>0</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>4</td><td>2</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>K</td><td>2</td><td>0</td><td>2</td><td>4</td><td>4</td><td>2</td><td>2</td><td>8</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>6</td><td>2</td><td>2</td><td>4</td><td>2</td><td>4</td><td>4</td><td>4</td><td>0</td></tr>
+<tr><td>L</td><td>2</td><td>0</td><td>2</td><td>0</td><td>0</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>4</td><td>2</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>M</td><td>2</td><td>0</td><td>2</td><td>0</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>N</td><td>2</td><td>0</td><td>2</td><td>4</td><td>2</td><td>0</td><td>2</td><td>2</td><td>0</td><td>2</td><td>0</td><td>0</td><td>4</td><td>2</td><td>2</td><td>2</td><td>4</td><td>4</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>P</td><td>2</td><td>0</td><td>2</td><td>2</td><td>0</td><td>0</td><td>2</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>2</td><td>2</td><td>0</td><td>0</td><td>2</td><td>2</td><td>0</td><td>2</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
+<tr><td>Q</td><td>0</td><td>0</td><td>0</td><td>2</td><td>2</td><td>0</td><td>0</td><td>2</td><td>0</td><td>2</td><td>0</td><td>0</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>R</td><td>0</td><td>0</td><td>0</td><td>4</td><td>4</td><td>0</td><td>0</td><td>6</td><td>0</td><td>6</td><td>0</td><td>0</td><td>2</td><td>0</td><td>2</td><td>6</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>S</td><td>4</td><td>0</td><td>2</td><td>4</td><td>2</td><td>0</td><td>4</td><td>2</td><td>0</td><td>2</td><td>0</td><td>0</td><td>4</td><td>2</td><td>2</td><td>2</td><td>4</td><td>4</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>T</td><td>2</td><td>0</td><td>2</td><td>4</td><td>2</td><td>0</td><td>2</td><td>2</td><td>0</td><td>2</td><td>0</td><td>0</td><td>4</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>U</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>4</td><td>0</td><td>4</td><td>0</td></tr>
+<tr><td>V</td><td>4</td><td>0</td><td>4</td><td>2</td><td>0</td><td>2</td><td>4</td><td>2</td><td>4</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td></tr>
+<tr><td>W</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>6</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>6</td><td>4</td><td>6</td><td>0</td></tr>
+<tr><td>X</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>4</td><td>0</td><td>4</td><td>0</td></tr>
+<tr><td>Y</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>6</td><td>2</td><td>4</td><td>2</td><td>2</td><td>2</td><td>0</td><td>2</td><td>2</td><td>2</td><td>2</td><td>4</td><td>2</td><td>6</td><td>4</td><td>4</td><td>0</td></tr>
+<tr><td>Z</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
+</table>
+
+</li>
+<li>
+<em>Conservation EnhPos</em><br>Distinguish amino acids based on properties they have in common or lack, emphasising those they have in common.
+
+<table border="1"><tr><td></td><td> A </td><td> B </td><td> C </td><td> D </td><td> E </td><td> F </td><td> G </td><td> H </td><td> I </td><td> K </td><td> L </td><td> M </td><td> N </td><td> P </td><td> Q </td><td> R </td><td> S </td><td> T </td><td> U </td><td> V </td><td> W </td [...]
+<tr><td>A</td><td>16</td><td>0</td><td>13</td><td>7</td><td>4</td><td>9</td><td>16</td><td>6</td><td>9</td><td>7</td><td>9</td><td>10</td><td>9</td><td>9</td><td>6</td><td>4</td><td>12</td><td>9</td><td>3</td><td>12</td><td>8</td><td>3</td><td>8</td><td>0</td></tr>
+<tr><td>B</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
+<tr><td>C</td><td>13</td><td>0</td><td>13</td><td>8</td><td>5</td><td>10</td><td>13</td><td>7</td><td>10</td><td>8</td><td>10</td><td>11</td><td>10</td><td>10</td><td>7</td><td>5</td><td>9</td><td>10</td><td>3</td><td>13</td><td>9</td><td>3</td><td>9</td><td>0</td></tr>
+<tr><td>D</td><td>7</td><td>0</td><td>8</td><td>15</td><td>15</td><td>4</td><td>7</td><td>9</td><td>4</td><td>10</td><td>4</td><td>5</td><td>12</td><td>8</td><td>9</td><td>11</td><td>11</td><td>12</td><td>3</td><td>7</td><td>7</td><td>3</td><td>7</td><td>0</td></tr>
+<tr><td>E</td><td>4</td><td>0</td><td>5</td><td>15</td><td>11</td><td>5</td><td>4</td><td>10</td><td>5</td><td>11</td><td>5</td><td>6</td><td>9</td><td>5</td><td>10</td><td>12</td><td>8</td><td>9</td><td>3</td><td>4</td><td>8</td><td>3</td><td>8</td><td>0</td></tr>
+<tr><td>F</td><td>9</td><td>0</td><td>10</td><td>4</td><td>5</td><td>13</td><td>9</td><td>11</td><td>10</td><td>8</td><td>10</td><td>11</td><td>6</td><td>6</td><td>7</td><td>5</td><td>5</td><td>6</td><td>3</td><td>9</td><td>13</td><td>3</td><td>13</td><td>0</td></tr>
+<tr><td>G</td><td>16</td><td>0</td><td>13</td><td>7</td><td>4</td><td>9</td><td>12</td><td>6</td><td>9</td><td>7</td><td>9</td><td>10</td><td>9</td><td>9</td><td>6</td><td>4</td><td>12</td><td>9</td><td>3</td><td>12</td><td>8</td><td>3</td><td>8</td><td>0</td></tr>
+<tr><td>H</td><td>6</td><td>0</td><td>7</td><td>9</td><td>10</td><td>11</td><td>6</td><td>17</td><td>7</td><td>17</td><td>7</td><td>8</td><td>7</td><td>3</td><td>8</td><td>14</td><td>6</td><td>7</td><td>6</td><td>6</td><td>14</td><td>6</td><td>14</td><td>0</td></tr>
+<tr><td>I</td><td>9</td><td>0</td><td>10</td><td>4</td><td>5</td><td>10</td><td>9</td><td>7</td><td>14</td><td>8</td><td>14</td><td>11</td><td>6</td><td>6</td><td>7</td><td>5</td><td>5</td><td>6</td><td>3</td><td>13</td><td>9</td><td>3</td><td>9</td><td>0</td></tr>
+<tr><td>K</td><td>7</td><td>0</td><td>8</td><td>10</td><td>11</td><td>8</td><td>7</td><td>17</td><td>8</td><td>11</td><td>8</td><td>9</td><td>8</td><td>4</td><td>9</td><td>15</td><td>7</td><td>8</td><td>6</td><td>7</td><td>11</td><td>6</td><td>11</td><td>0</td></tr>
+<tr><td>L</td><td>9</td><td>0</td><td>10</td><td>4</td><td>5</td><td>10</td><td>9</td><td>7</td><td>14</td><td>8</td><td>13</td><td>11</td><td>6</td><td>6</td><td>7</td><td>5</td><td>5</td><td>6</td><td>3</td><td>13</td><td>9</td><td>3</td><td>9</td><td>0</td></tr>
+<tr><td>M</td><td>10</td><td>0</td><td>11</td><td>5</td><td>6</td><td>11</td><td>10</td><td>8</td><td>11</td><td>9</td><td>11</td><td>11</td><td>7</td><td>7</td><td>8</td><td>6</td><td>6</td><td>7</td><td>3</td><td>10</td><td>10</td><td>3</td><td>10</td><td>0</td></tr>
+<tr><td>N</td><td>9</td><td>0</td><td>10</td><td>12</td><td>9</td><td>6</td><td>9</td><td>7</td><td>6</td><td>8</td><td>6</td><td>7</td><td>14</td><td>10</td><td>11</td><td>9</td><td>13</td><td>14</td><td>3</td><td>9</td><td>9</td><td>3</td><td>9</td><td>0</td></tr>
+<tr><td>P</td><td>9</td><td>0</td><td>10</td><td>8</td><td>5</td><td>6</td><td>9</td><td>3</td><td>6</td><td>4</td><td>6</td><td>7</td><td>10</td><td>10</td><td>7</td><td>5</td><td>9</td><td>10</td><td>0</td><td>9</td><td>5</td><td>0</td><td>5</td><td>0</td></tr>
+<tr><td>Q</td><td>6</td><td>0</td><td>7</td><td>9</td><td>10</td><td>7</td><td>6</td><td>8</td><td>7</td><td>9</td><td>7</td><td>8</td><td>11</td><td>7</td><td>11</td><td>10</td><td>10</td><td>11</td><td>3</td><td>6</td><td>10</td><td>3</td><td>10</td><td>0</td></tr>
+<tr><td>R</td><td>4</td><td>0</td><td>5</td><td>11</td><td>12</td><td>5</td><td>4</td><td>14</td><td>5</td><td>15</td><td>5</td><td>6</td><td>9</td><td>5</td><td>10</td><td>15</td><td>8</td><td>9</td><td>3</td><td>4</td><td>8</td><td>3</td><td>8</td><td>0</td></tr>
+<tr><td>S</td><td>12</td><td>0</td><td>9</td><td>11</td><td>8</td><td>5</td><td>12</td><td>6</td><td>5</td><td>7</td><td>5</td><td>6</td><td>13</td><td>9</td><td>10</td><td>8</td><td>13</td><td>13</td><td>3</td><td>8</td><td>8</td><td>3</td><td>8</td><td>0</td></tr>
+<tr><td>T</td><td>9</td><td>0</td><td>10</td><td>12</td><td>9</td><td>6</td><td>9</td><td>7</td><td>6</td><td>8</td><td>6</td><td>7</td><td>14</td><td>10</td><td>11</td><td>9</td><td>13</td><td>9</td><td>3</td><td>9</td><td>9</td><td>3</td><td>9</td><td>0</td></tr>
+<tr><td>U</td><td>3</td><td>0</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>6</td><td>3</td><td>6</td><td>3</td><td>3</td><td>3</td><td>0</td><td>3</td><td>3</td><td>3</td><td>3</td><td>0</td><td>3</td><td>6</td><td>0</td><td>6</td><td>0</td></tr>
+<tr><td>V</td><td>12</td><td>0</td><td>13</td><td>7</td><td>4</td><td>9</td><td>12</td><td>6</td><td>13</td><td>7</td><td>13</td><td>10</td><td>9</td><td>9</td><td>6</td><td>4</td><td>8</td><td>9</td><td>3</td><td>3</td><td>8</td><td>3</td><td>8</td><td>0</td></tr>
+<tr><td>W</td><td>8</td><td>0</td><td>9</td><td>7</td><td>8</td><td>13</td><td>8</td><td>14</td><td>9</td><td>11</td><td>9</td><td>10</td><td>9</td><td>5</td><td>10</td><td>8</td><td>8</td><td>9</td><td>6</td><td>8</td><td>16</td><td>6</td><td>16</td><td>0</td></tr>
+<tr><td>X</td><td>3</td><td>0</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>6</td><td>3</td><td>6</td><td>3</td><td>3</td><td>3</td><td>0</td><td>3</td><td>3</td><td>3</td><td>3</td><td>0</td><td>3</td><td>6</td><td>0</td><td>6</td><td>0</td></tr>
+<tr><td>Y</td><td>8</td><td>0</td><td>9</td><td>7</td><td>8</td><td>13</td><td>8</td><td>14</td><td>9</td><td>11</td><td>9</td><td>10</td><td>9</td><td>5</td><td>10</td><td>8</td><td>8</td><td>9</td><td>6</td><td>8</td><td>16</td><td>6</td><td>8</td><td>0</td></tr>
+<tr><td>Z</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
+</table>
+
+
+</li> -->
+ </ul>
+</body>
+</html>
diff --git a/help/html/calculations/sorting.html b/help/html/calculations/sorting.html
index d7cb9d1..1478d59 100644
--- a/help/html/calculations/sorting.html
+++ b/help/html/calculations/sorting.html
@@ -1,72 +1,97 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Sorting Sequences</title>
</head>
<body>
-<p><strong>Sorting Sequences</strong></p>
-<p>Any group of selected sequences may be reordered by pressing the
-up or down arrow keys. The whole alignment may also be reordered by
-the use of the functions in the Sort menu (<strong>Calculate→Sort</strong>):
-</p>
-<ul>
-<li><p><strong>Sort by ID</strong></p>
-<p>Orders the sequences by the alphanumeric (0-9A-Za-z)
-precedence of their names.</p><p>
-</li>
-<li><p><strong>Sort by Group</strong></p>
-<p>Places sequences in the same group adjacent to each other.</p><p>
-</li>
-<li><p><strong>Sort by Pairwise Identity</strong></p>
-<p>Places pairs of sequences together that align with the greatest
-fraction of conserved residues.
-</p><p>
-</li>
-<li><p><strong>Sort by Tree Order</strong></p>
-<p>The leaf ordering of a particular phylogenetic tree is used to
-order the sequences corresponding to those leaves in the
-alignment.<br>
-If a tree has been calculated from or associated with the current
-alignment, its name will appear in the submenu <strong>Sort→By Tree Order</strong>.</p><p>
-</li>
-<li><p><strong>Sort by alignment ordering</strong></p>
-<p>Multiple alignment methods often order the sequences in their
-alignments by some measure of sequence identity.<br>
-If the current alignment has been generated by one of Jalview's
-alignment web services, the alignment ordering can be recovered by
-its corresponding entry in the Sort menu.
-</p>
-</li>
-<li><p><strong>Sort by Score</strong></p>
-<p>This menu appears if the alignment contains any <a href="../features/annotationsFormat.html">sequence associated
-alignment annotation</a> with associated score values. Each entry is the
-label for a distinct group of sequence associated annotation
-scores which can be used for sorting.</p>
-</ul>
-<p><strong>Reversing the Order</strong></p>
-<p>Selecting any item from the Sort menu will sort sequences in an
-ascending order according to the property defining the sort. If the
-same sort is re-applied, the sequences will be sorted in the inverse
-order. In the case of trees and alignment orderings, Jalview will
-remember your last choice for sorting the alignment and only apply the
-inverse ordering if you select the same tree or alignment ordering
-item again.</p>
+ <p>
+ <strong>Sorting Sequences</strong>
+ </p>
+ <p>
+ Any group of selected sequences may be reordered by pressing the up
+ or down arrow keys. The whole alignment may also be reordered by the
+ use of the functions in the Sort menu (<strong>Calculate→Sort</strong>):
+ </p>
+ <ul>
+ <li><p>
+ <strong>Sort by ID</strong>
+ </p>
+ <p>Orders the sequences by the alphanumeric (0-9A-Za-z)
+ precedence of their names.</p>
+ <p></li>
+ <li><p>
+ <strong>Sort by Group</strong>
+ </p>
+ <p>Places sequences in the same group adjacent to each other.</p>
+ <p></li>
+ <li><p>
+ <strong>Sort by Pairwise Identity</strong>
+ </p>
+ <p>Places pairs of sequences together that align with the
+ greatest fraction of conserved residues.</p>
+ <p></li>
+ <li><p>
+ <strong>Sort by Tree Order</strong>
+ </p>
+ <p>
+ The leaf ordering of a particular phylogenetic tree is used to
+ order the sequences corresponding to those leaves in the
+ alignment.<br> If a tree has been calculated from or
+ associated with the current alignment, its name will appear in
+ the submenu <strong>Sort→By Tree Order</strong>.
+ </p>
+ <p></li>
+ <li><p>
+ <strong>Sort by alignment ordering</strong>
+ </p>
+ <p>
+ Multiple alignment methods often order the sequences in their
+ alignments by some measure of sequence identity.<br> If the
+ current alignment has been generated by one of Jalview's
+ alignment web services, the alignment ordering can be recovered
+ by its corresponding entry in the Sort menu.
+ </p></li>
+ <li><p>
+ <strong>Sort by Score</strong>
+ </p>
+ <p>
+ This menu appears if the alignment contains any <a
+ href="../features/annotationsFormat.html"
+ >sequence associated alignment annotation</a> with associated
+ score values. Each entry is the label for a distinct group of
+ sequence associated annotation scores which can be used for
+ sorting.
+ </p>
+ </ul>
+ <p>
+ <strong>Reversing the Order</strong>
+ </p>
+ <p>Selecting any item from the Sort menu will sort sequences in an
+ ascending order according to the property defining the sort. If the
+ same sort is re-applied, the sequences will be sorted in the inverse
+ order. In the case of trees and alignment orderings, Jalview will
+ remember your last choice for sorting the alignment and only apply
+ the inverse ordering if you select the same tree or alignment
+ ordering item again.</p>
</body>
</html>
diff --git a/help/html/calculations/structureconsensus.html b/help/html/calculations/structureconsensus.html
new file mode 100644
index 0000000..7b0ce98
--- /dev/null
+++ b/help/html/calculations/structureconsensus.html
@@ -0,0 +1,54 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Alignment RNA Structure Consensus Annotation</title>
+</head>
+<body>
+ <p>
+ <strong>Alignment RNA Structure Consensus Annotation</strong>
+ </p>
+
+ <p>
+ The RNA structure consensus displayed below the alignment is the
+ percentage of valid base pairs per column. It is calculated in
+ relation to a secondary structure and just paired columns are
+ calculated. The canonical Watson-Crick base pairings (A-T/U, G-C)
+ and the wobble base pair (G-T/U) are regarded as valid pairings.<br>
+ The amount of valid base pairs is indicated by the profile in the
+ Alignment Annotation row.<br> By default this calculation
+ includes gaps in columns. You can choose to ignore gaps in the
+ calculation by right clicking on the label "StrConsensus"
+ to the left of the structure consensus bar chart.<br>
+ <p>
+ <strong>Structure logo</strong>
+ </p>
+ By clicking on the label you can also activate the structure logo. It
+ is very similar to a sequence logo but counts the numbers of base
+ pairs. There are two residues per column, the actual column and the
+ interacting base. The opening bracket is always the one on the left
+ side.
+ <br> Like sequence logos the relative amount of a specific base
+ pair can be estimated by its size in the logo. The tool tip of a
+ column gives the exact numbers for all occurring valid base pairs.
+ </p>
+</body>
+</html>
diff --git a/help/html/calculations/tree.html b/help/html/calculations/tree.html
index 1579043..f95476f 100644
--- a/help/html/calculations/tree.html
+++ b/help/html/calculations/tree.html
@@ -1,83 +1,128 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Tree Calculation</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Tree Calculation</title>
+</head>
<body>
-<p><strong>Calculation of trees from alignments</strong></p>
-<p>Trees are calculated on either the complete alignment, or just the
-currently selected group of sequences, using the functions in the
-<strong>Calculate→Calculate tree</strong> submenu.
-Once calculated, trees are displayed in a new <a
-href="../calculations/treeviewer.html">tree viewing window</a>. There are
-four different calculations, using one of two distance measures and
-constructing the tree from one of two algorithms :
-</p>
-<p><strong>Distance Measures</strong></p>
-<p>Trees are calculated on the basis of a measure of similarity
-between each pair of sequences in the alignment :
-<ul>
-<li><strong>PID</strong><br>The percentage identity between the two
-sequences at each aligned position.<ul><li>PID = Number of equivalent
-aligned non-gap symbols * 100 / Smallest number of non-gap positions
-in either of both sequences<br><em>This is essentially the 'number of
-identical bases (or residues) per 100 base pairs (or residues)'.</em></li></ul>
-<li><strong>BLOSUM62</strong><br>The sum of BLOSUM62 scores for the
-residue pair at each aligned position.
-</ul>
-</p>
-<p><strong>Tree Construction Methods</strong></p>
-<p>Jalview currently supports two kinds of agglomerative clustering
-methods. These are not intended to substitute for rigorous
-phylogenetic tree construction, and may fail on very large alignments.
-<ul>
-<li><strong>UPGMA tree</strong><br>
- UPGMA stands for Unweighted Pair-Group Method using Arithmetic
- averages. Clusters are iteratively formed and extended by finding a
- non-member sequence with the lowest average dissimilarity over the
- cluster members.
-<p></p>
-</li>
-<li><strong>Neighbour Joining tree</strong><br>
- First described in 1987 by Saitou and Nei, this method applies a
- greedy algorithm to find the tree with the shortest branch
- lengths.<br>
- This method, as implemented in Jalview, is considerably more
- expensive than UPGMA.
-</li>
-</ul>
-</p>
-<p>A newly calculated tree will be displayed in a new <a
-href="../calculations/treeviewer.html">tree viewing window</a>. In
-addition, a new entry with the same tree viewer window name will be added in the Sort
-menu so that the alignment can be reordered to reflect the ordering of
-the leafs of the tree. If the tree was calculated on a selected region
-of the alignment, then the title of the tree view will reflect this.</p>
+ <p>
+ <strong>Calculation of trees from alignments</strong>
+ </p>
+ <p>
+ Trees are calculated on either the complete alignment, or just the
+ currently selected group of sequences, using the functions in the <strong>Calculate→Calculate
+ tree</strong> submenu. Once calculated, trees are displayed in a new <a
+ href="../calculations/treeviewer.html"
+ >tree viewing window</a>. There are four different calculations, using
+ one of two distance measures and constructing the tree from one of
+ two algorithms :
+ </p>
+ <p>
+ <strong>Distance Measures</strong>
+ </p>
+ <p>Trees are calculated on the basis of a measure of similarity
+ between each pair of sequences in the alignment :
+ <ul>
+ <li><strong>PID</strong><br>The percentage identity
+ between the two sequences at each aligned position.
+ <ul>
+ <li>PID = Number of equivalent aligned non-gap symbols *
+ 100 / Smallest number of non-gap positions in either of both
+ sequences<br> <em>This is essentially the 'number of
+ identical bases (or residues) per 100 base pairs (or
+ residues)'.</em>
+ </li>
+ </ul>
+ <li><strong>BLOSUM62, PAM250, DNA</strong><br />These options
+ use one of the available substitution matrices to compute a sum of
+ scores for the residue pairs at each aligned position.
+ <ul>
+ <li>For details about each model, see the <a
+ href="scorematrices.html"
+ >list of built-in score matrices</a>.
+ </li>
+ </ul></li>
+ <li><strong>Sequence Feature Similarity</strong><br>Trees
+ are constructed from a distance matrix formed from Jaccard
+ distances between sequence features observed at each column of the
+ alignment.
+ <ul>
+ <li>Similarity at column <em>i</em> = (Total number of
+ features displayed - Sum of number of features in common at <em>i</em>)
+ <br />Similarities are summed over all columns and divided by
+ the number of columns. <br />Since the total number of
+ feature types is constant over all columns of the alignment,
+ we do not scale the matrix, so tree distances can be
+ interpreted as the average number of features that differ over
+ all sites in the aligned region.
+ </li>
-<p><strong>External Sources for Phylogenetic Trees</strong></p>
- <p>A number of programs exist for the reliable construction of
- phylogenetic trees, which can cope with large numbers of sequences,
- use better distance methods and can perform bootstrapping. Jalview
- can read <a
- href="http://evolution.genetics.washington.edu/phylip/newick_doc.html">Newick</a>
- format tree files using the 'Load Associated Tree' entry of the
- alignment's File menu. Sequences in the alignment will be
- automatically associated to nodes in the tree, by matching Sequence
- IDs to the tree's leaf names.
+ </ul> Distances are computed based on the currently displayed feature
+ types. Sequences with similar distributions of features of the
+ same type will be grouped together in trees computed with this
+ metric. <em>This measure was introduced in Jalview 2.9</em></li>
+ </ul>
+ <p>
+ <strong>Tree Construction Methods</strong>
+ </p>
+ <p>Jalview currently supports two kinds of agglomerative
+ clustering methods. These are not intended to substitute for
+ rigorous phylogenetic tree construction, and may fail on very large
+ alignments.
+ <ul>
+ <li><strong>UPGMA tree</strong><br> UPGMA stands for
+ Unweighted Pair-Group Method using Arithmetic averages. Clusters
+ are iteratively formed and extended by finding a non-member
+ sequence with the lowest average dissimilarity over the cluster
+ members.
+ <p></p></li>
+ <li><strong>Neighbour Joining tree</strong><br> First
+ described in 1987 by Saitou and Nei, this method applies a greedy
+ algorithm to find the tree with the shortest branch lengths.<br>
+ This method, as implemented in Jalview, is considerably more
+ expensive than UPGMA.</li>
+ </ul>
+ <p>
+ A newly calculated tree will be displayed in a new <a
+ href="../calculations/treeviewer.html"
+ >tree viewing window</a>. In addition, a new entry with the same tree
+ viewer window name will be added in the Sort menu so that the
+ alignment can be reordered to reflect the ordering of the leafs of
+ the tree. If the tree was calculated on a selected region of the
+ alignment, then the title of the tree view will reflect this.
+ </p>
+
+ <p>
+ <strong>External Sources for Phylogenetic Trees</strong>
+ </p>
+ <p>
+ A number of programs exist for the reliable construction of
+ phylogenetic trees, which can cope with large numbers of sequences,
+ use better distance methods and can perform bootstrapping. Jalview
+ can read <a
+ href="http://evolution.genetics.washington.edu/phylip/newick_doc.html"
+ >Newick</a> format tree files using the 'Load Associated Tree' entry
+ of the alignment's File menu. Sequences in the alignment will be
+ automatically associated to nodes in the tree, by matching Sequence
+ IDs to the tree's leaf names.
</p>
diff --git a/help/html/calculations/treeviewer.html b/help/html/calculations/treeviewer.html
index fe6dbbc..cbe4f87 100644
--- a/help/html/calculations/treeviewer.html
+++ b/help/html/calculations/treeviewer.html
@@ -1,117 +1,131 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>The Tree Viewing Window</title>
</head>
<body>
-<p><strong>The Tree Viewing Window</strong></p>
-<p>
- The tree viewing window is opened when a tree has been <a href="tree.html">calculated
- from an alignment</a>, or imported via a file or web service. It includes <a href="#menus">menus</a> for
- controlling layout and file and figure creation, and enables
- various selection and colouring operations on the
- associated sequences in the alignment.</p>
-<p>
-<strong><em>Selecting Sequence Leaf Nodes</em></strong><br>
- Selecting sequence ids at the leaves of the tree selects the
- corresponding sequences in the original alignment. These selections
- are also reflected in any other analysis windows associated with the
- alignment, such as another tree viewer.</p>
-<p><strong><em>Grouping sequences by partitioning the tree at a particular distanec</em></strong><br>
- Clicking anywhere along the extent of the tree (but not on a leaf or
- internal node) defines a tree 'partition', by cutting every branch
- of the tree spanning the depth where the mouse-click occurred. Groups
- are created containing sequences at the leaves of each connected
- sub tree. These groups are each given a different colour, which are
- reflected in other windows in the same way as if the sequence ids
- were selected, and can be edited in the same way as user defined
- sequence groups.
-</p>
-<p>Tree partitions are useful for comparing clusters produced by
-different methods and measures. They are also an effective way of
-identifying specific patterns of conservation and mutation
-corresponding to the overall phylogenetic structure, when combined
-with the <a href="../colourSchemes/conservation.html">conservation
-based colour scheme</a>.</p>
-<p>
-<strong><em>Selecting Subtrees and changing the branch order and subtree group colour</em></strong><br>
-Moving the mouse over an internal node of the tree will highlight
- it. You can then : <ul>
- <li>Click the highlighted node to select all the sequences in that branch.
- <li>Double-click the highlighted node to rearrange the tree
- diagram by inverting the branch ordering at that
- node.
- <li>Right-click to open the 'Select Sub-Tree Colour' dialog box, to
- pick a new colour for the sub-tree and associated sequences.
+ <p>
+ <strong>The Tree Viewing Window</strong>
+ </p>
+ <p>
+ The tree viewing window is opened when a tree has been <a
+ href="tree.html"
+ >calculated from an alignment</a>, or imported via a file or web
+ service. It includes <a href="#menus">menus</a> for controlling
+ layout and file and figure creation, and enables various selection
+ and colouring operations on the associated sequences in the
+ alignment.
+ </p>
+ <p>
+ <strong><em>Selecting Sequence Leaf Nodes</em></strong><br>
+ Selecting sequence ids at the leaves of the tree selects the
+ corresponding sequences in the original alignment. These selections
+ are also reflected in any other analysis windows associated with the
+ alignment, such as another tree viewer.
+ </p>
+ <p>
+ <strong><em>Grouping sequences by partitioning the
+ tree at a particular distanec</em></strong><br> Clicking anywhere along
+ the extent of the tree (but not on a leaf or internal node) defines
+ a tree 'partition', by cutting every branch of the tree spanning the
+ depth where the mouse-click occurred. Groups are created containing
+ sequences at the leaves of each connected sub tree. These groups are
+ each given a different colour, which are reflected in other windows
+ in the same way as if the sequence ids were selected, and can be
+ edited in the same way as user defined sequence groups.
+ </p>
+ <p>
+ Tree partitions are useful for comparing clusters produced by
+ different methods and measures. They are also an effective way of
+ identifying specific patterns of conservation and mutation
+ corresponding to the overall phylogenetic structure, when combined
+ with the <a href="../colourSchemes/conservation.html">conservation
+ based colour scheme</a>.
+ </p>
+ <p>
+ <strong><em>Selecting Subtrees and changing the branch
+ order and subtree group colour</em></strong><br> Moving the mouse over an
+ internal node of the tree will highlight it. You can then :
+ <ul>
+ <li>Click the highlighted node to select all the sequences in
+ that branch.
+ <li>Double-click the highlighted node to rearrange the tree
+ diagram by inverting the branch ordering at that node.
+ <li>Right-click to open the 'Select Sub-Tree Colour' dialog
+ box, to pick a new colour for the sub-tree and associated
+ sequences.
+ </ul>
+ </p>
+ <p>
+ <strong><a name="menus"> File Menu</a></strong>
+ </p>
+ <p>This menu allows the displayed tree to be saved as a Newick
+ tree file (Save→Newick File), printed or exported as an image
+ (PNG) or Postscript file. Finally, data used to calculate the tree
+ can be retrieved with the 'Input Data...' entry.</p>
+ <p>
+ <strong>View Menu</strong>
+ </p>
+ <p>When the tree viewer is opened, it displays all the annotation
+ associated with a tree. Trees calculated by Jalview have branch
+ lengths, which correspond to the distance measure used to construct
+ the tree. Tree imported from outside may also contain bootstrap
+ information, and additional leaves from sequences not present in the
+ associated alignment.</p>
+ <p>The view menu mostly contains options controlling the way a
+ tree is rendered and labeled:
+ <ul>
+ <li><strong>Fit to Window</strong>
+ <p>The tree layout will be scaled to fit in the display window.
+ You may need to reduce the font size to minimise the leaf label
+ overlap when this option is selected.</p></li>
+ <li><strong>Font Size ...</strong><em>n</em>
+ <p>
+ Brings up a dialog box to set the font size for the leaf names.
+ <em>n</em> is the current font size.
+ </p></li>
+ <li><strong>Show Distances</strong>
+ <p>Labels each branch or leaf with its associated branch length.</p></li>
+ <li><strong>Show Bootstrap values</strong>
+ <p>Labels each branch or leaf with its associated bootstrap
+ value.</p></li>
+ <li><strong>Mark unlinked leaves</strong>
+ <p>Toggles the display of a '*' at the beginning of a leaf label
+ to indicate that there is no sequence corresponding to that leaf
+ in the associated alignment.</p></li>
+ <li><strong>Sort Alignment By Tree</strong>
+ <p>
+ Sorts any associated alignment views using the current tree. (<em>Only
+ available in the Jalview Desktop</em>)
+ </p></li>
+ <li><strong>Associate Leaves with ...</strong>
+ <p>
+ Only visible when there are <a
+ href="../features/multipleviews.html"
+ >multiple views</a> of the same alignment to show and edit which
+ alignment views are associated with the leaves of the displayed
+ tree.
+ </p>
</ul>
-</p>
-<p><strong><a name="menus">
-File Menu</a></strong></p>
-<p>This menu allows the displayed tree to be saved as a Newick tree
-file (Save→Newick File), printed or exported as an image (PNG) or
-Postscript file. Finally, data used to calculate the tree can be
-retrieved with the 'Input Data...' entry.
-</p>
-<p><strong>View Menu</strong></p>
-<p>When the tree viewer is opened, it displays all the annotation
-associated with a tree. Trees calculated by Jalview have branch
-lengths, which correspond to the distance measure used to construct
-the tree. Tree imported from outside may also contain bootstrap information,
-and additional leaves from sequences not present in the associated
-alignment.
-</p>
-<p>The view menu mostly contains options controlling the way a tree is
-rendered and labeled:
-<ul>
-<li><strong>Fit to Window</strong><p>
-The tree layout will be scaled to fit in the display
-window. You may need to reduce the font size to minimise the leaf
-label overlap when this option is selected.
-</p></li>
-<li><strong>Font Size ...</strong><em>n</em><p>
-Brings up a dialog box to set the font size for the leaf
-names. <em>n</em> is the current font size.
-</p></li>
-<li><strong>Show Distances</strong><p>
-Labels each branch or leaf with its associated branch
-length.</p></li>
-<li><strong>Show Bootstrap values</strong><p>
-Labels each branch or leaf with its associated bootstrap value.
-</p></li>
-<li><strong>Mark unlinked leaves</strong><p>
-Toggles the display of a '*' at the beginning of a leaf label to
-indicate that there is no sequence corresponding to that leaf in the
-associated alignment.
-</p></li>
- <li><strong>Sort Alignment By Tree</strong>
- <p>
- Sorts any associated alignment views using the current tree. (<em>Only
- available in the Jalview Desktop</em>)
- </p>
- </li>
- <li><strong>Associate Leaves with ...</strong>
- <p>
- Only visible when there are <a href="../features/multipleviews.html">multiple
- views</a> of the same alignment to show and edit which alignment views
- are associated with the leaves of the displayed tree.
- </p>
- </ul>
-</p>
+ </p>
</body>
</html>
diff --git a/help/html/colourSchemes/abovePID.html b/help/html/colourSchemes/abovePID.html
index 406fdde..80d45f4 100644
--- a/help/html/colourSchemes/abovePID.html
+++ b/help/html/colourSchemes/abovePID.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Above PID Colours</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Above PID Colours</title>
<style type="text/css">
<!--
td {
@@ -27,11 +31,14 @@ td {
</head>
<body>
-<p> <em>Colouring above a percentage identity threshold</em></p>
-<p> Selecting this option causes the colour scheme to be applied to only those
- residues that occur in that column more than a certain percentage of the time.
- For instance selecting the threshold to be 100 will only colour those columns
- with 100 % identity. This threshold option can be applied to the Zappo, Taylor,
- Hydrophobicity and User colour schemes. </p>
+ <p>
+ <strong>Colouring above a percentage identity threshold</strong>
+ </p>
+ <p>Selecting this option causes the colour scheme to be applied to
+ only those residues that occur in that column more than a certain
+ percentage of the time. For instance selecting the threshold to be
+ 100 will only colour those columns with 100 % identity. This
+ threshold option can be applied to the Zappo, Taylor, Hydrophobicity
+ and User colour schemes.</p>
</body>
</html>
diff --git a/help/html/colourSchemes/annotationColourSetting.gif b/help/html/colourSchemes/annotationColourSetting.gif
new file mode 100644
index 0000000..c4f719f
Binary files /dev/null and b/help/html/colourSchemes/annotationColourSetting.gif differ
diff --git a/help/html/colourSchemes/annotationColourSetting.jpg b/help/html/colourSchemes/annotationColourSetting.jpg
deleted file mode 100644
index f3fbab6..0000000
Binary files a/help/html/colourSchemes/annotationColourSetting.jpg and /dev/null differ
diff --git a/help/html/colourSchemes/annotationColouring.html b/help/html/colourSchemes/annotationColouring.html
index 6f2f59d..55e3a85 100644
--- a/help/html/colourSchemes/annotationColouring.html
+++ b/help/html/colourSchemes/annotationColouring.html
@@ -1,61 +1,97 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Annotation Colouring</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Annotation Colouring</title>
+</head>
<body>
-<p><strong> Annotation Colouring </strong></p>
-<p>Jalview allows the columns of an alignment to be coloured using any
- numerical annotation rows added to that alignment. </p>
-Select "Colour" <strong>→</strong> "..
- by Annotation" to bring up the Colour by Annotation settings window. <br>
- <br><div align="center">
- <img src="annotationColourSetting.jpg" width="507" height="202"> </div>
-<ul>
- <li>Select which annotation to base the colouring scheme on using the top left
- selection box.</li>
- <li> If the "Use Original Colours" box is selected, the colouring
- scheme will use the colouring scheme present on the alignment before the Annotation
- Colour Settings window was displayed. </li>
- <li>The colour scheme can display a colour gradient from a colour
- representing the minimum value in the selected annotation to a colour
- representing the maximum value in the selected annotation. Use the
- "Min Colour" and "Max Colour" to set the colour
- gradient range.
- <ul>
- <li><em>New in Jalview 2.7</em>: Press the "Defaults"
- button to reset the minimum and maximum colours to their default
- settings (these are configured in the applet's parameters or the <a
- href="../features/preferences.html">application's user
- preferences</a>.)
- </ul>
- </li>
+ <p>
+ <strong> Annotation Colouring </strong>
+ </p>
+ <p>Jalview allows the columns of an alignment to be coloured using
+ any numerical annotation rows added to that alignment.</p>
+ Select "Colour"
+ <strong>→</strong> ".. by Annotation" to bring up the
+ Colour by Annotation settings window.
+ <br>
+ <br>
+ <div align="center">
+ <img src="annotationColourSetting.gif" width="471" height="256">
+ </div>
+ <ul>
+ <li>Select which annotation to base the colouring scheme on
+ using the top left selection box.<br />If the <strong>Per-sequence
+ only</strong> tick box is not greyed out, then ticking it will limit the
+ available annotation rows to just those that are sequence
+ associated (e.g. T-COFFEE scores and <a
+ href="../webServices/proteinDisorder.html"
+ >protein disorder predictions</a>), which will colour each sequence
+ according to its own per-residue scores.<br /> <em>Per-sequence
+ associated annotation colouring was introduced in Jalview 2.8</em>
+ </li>
+ <li>If the "Use Original Colours" box is selected,
+ the colouring scheme will use the colouring scheme present on the
+ alignment before the Annotation Colour Settings window was
+ displayed. <br /> <em><strong>Please Note:</strong> If no
+ colour scheme was applied previously, then the colours for lines
+ and labels at each position in the annotation row will be used,
+ for secondary structure symbols and graphs, this may be black by
+ default, so your alignment will be coloured black.</em>
+ </li>
+ <li><em>Secondary structure annotation colouring</em><br />By
+ default, Jalview will employ the helix or sheet colours to shade
+ sequences and columns by available secondary structure annotation
+ tracks. In the case of RNA, each structure is processed to
+ identify distinct RNA helices and rendered in the same way as the
+ <a href="rnahelicesColouring.html">RNA Helices shading scheme</a>.
+ <em>Structure based sequence shading was added in Jalview
+ 2.8.2</em></li>
+ <li>The colour scheme can display a colour gradient from a
+ colour representing the minimum value in the selected annotation
+ to a colour representing the maximum value in the selected
+ annotation. Use the "Min Colour" and "Max
+ Colour" to set the colour gradient range.
+ <ul>
+ <li>Press the "Defaults" button to reset the
+ minimum and maximum colours to their default settings (these
+ are configured in the applet's parameters or the <a
+ href="../features/preferences.html"
+ >application's user preferences</a>.).<br /> <em>Default min
+ and max colours were introduced in Jalview 2.7</em>
+ </ul>
+ </li>
- <li>Select whether to colour the alignment above or below an adjustable threshold
- with the selection box center left of the window. </li>
- <li>Change the threshold value with the slider, or enter the
- exact value in the text box.
- </li>
- <li>Select the "Threshold is Min/Max" checkbox to
- assign colours using the thresholded range's minimum and maximum
- values, otherwise the scale will be defined by the range of values in
- the annotation row.</li>
- </ul>
-<p align="center"><img src="annotationColours.jpg" width="688" height="488"> </p>
+ <li>Select whether to colour the alignment above or below an
+ adjustable threshold with the selection box center left of the
+ window.</li>
+ <li>Change the threshold value with the slider, or enter the
+ exact value in the text box.</li>
+ <li>Select the "Threshold is Min/Max" checkbox to
+ assign colours using the thresholded range's minimum and maximum
+ values, otherwise the scale will be defined by the range of values
+ in the annotation row.</li>
+ </ul>
+ <p align="center">
+ <img src="annotationColours.gif" width="582" height="464">
+ </p>
</body>
</html>
diff --git a/help/html/colourSchemes/annotationColours.gif b/help/html/colourSchemes/annotationColours.gif
new file mode 100644
index 0000000..6d14224
Binary files /dev/null and b/help/html/colourSchemes/annotationColours.gif differ
diff --git a/help/html/colourSchemes/annotationColours.jpg b/help/html/colourSchemes/annotationColours.jpg
deleted file mode 100644
index 5fcfa49..0000000
Binary files a/help/html/colourSchemes/annotationColours.jpg and /dev/null differ
diff --git a/help/html/colourSchemes/blosum.html b/help/html/colourSchemes/blosum.html
index bad9d30..e327d56 100644
--- a/help/html/colourSchemes/blosum.html
+++ b/help/html/colourSchemes/blosum.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Blosum Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Blosum Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -28,10 +32,12 @@ td {
<body>
-<p><em>Blosum62</a></em> </p>
-<p>Gaps are coloured white. If a residue matches the consensus sequence residue
- at that position it is coloured dark blue. If it does not match the consensus
- residue but the 2 residues have a positive Blosum62 score, it is coloured light
- blue.</p>
+ <p>
+ <strong>Blosum62</a></strong>
+ </p>
+ <p>Gaps are coloured white. If a residue matches the consensus
+ sequence residue at that position it is coloured dark blue. If it
+ does not match the consensus residue but the 2 residues have a
+ positive Blosum62 score, it is coloured light blue.</p>
</body>
</html>
diff --git a/help/html/colourSchemes/buried.html b/help/html/colourSchemes/buried.html
index 1367245..d6d0eec 100644
--- a/help/html/colourSchemes/buried.html
+++ b/help/html/colourSchemes/buried.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Buried Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Buried Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,43 +31,46 @@ td {
</head>
<body>
-<p><em>Buried index</em></p>
-<div align="center">
- <table width="400" border="1">
- <tr>
- <td bgcolor="#0000ff">C</td>
- <td bgcolor="#0054ab">I</td>
- <td bgcolor="#005fa0">V</td>
- <td bgcolor="#007b84">L</td>
- <td bgcolor="#008778">F</td>
- </tr>
- <tr>
- <td bgcolor="#009768">M</td>
- <td bgcolor="#009d62">G</td>
- <td bgcolor="#00a35c">A</td>
- <td bgcolor="#00a857">W</td>
- <td bgcolor="#00b649">X</td>
- </tr>
- <tr>
- <td bgcolor="#00d52a">S</td>
- <td bgcolor="#00d52a">H</td>
- <td bgcolor="#00db24">T</td>
- <td bgcolor="#00e01f">P</td>
- <td bgcolor="#00e619">Y</td>
- </tr>
- <tr>
- <td bgcolor="#00eb14">N</td>
- <td bgcolor="#00eb14">B</td>
- <td bgcolor="#00eb14">D</td>
- <td bgcolor="#00f10e">Q</td>
- <td bgcolor="#00f10e">Z</td>
- </tr>
- <tr> </td>
- <td bgcolor="#00f10e">E</td>
- <td bgcolor="#00fc03">R</td>
- <td bgcolor="#00ff00">K</td>
- </tr>
- </table>
-</div>
+ <p>
+ <strong>Buried index</strong>
+ </p>
+ <div align="center">
+ <table width="400" border="1">
+ <tr>
+ <td bgcolor="#0000ff">C</td>
+ <td bgcolor="#0054ab">I</td>
+ <td bgcolor="#005fa0">V</td>
+ <td bgcolor="#007b84">L</td>
+ <td bgcolor="#008778">F</td>
+ </tr>
+ <tr>
+ <td bgcolor="#009768">M</td>
+ <td bgcolor="#009d62">G</td>
+ <td bgcolor="#00a35c">A</td>
+ <td bgcolor="#00a857">W</td>
+ <td bgcolor="#00b649">X</td>
+ </tr>
+ <tr>
+ <td bgcolor="#00d52a">S</td>
+ <td bgcolor="#00d52a">H</td>
+ <td bgcolor="#00db24">T</td>
+ <td bgcolor="#00e01f">P</td>
+ <td bgcolor="#00e619">Y</td>
+ </tr>
+ <tr>
+ <td bgcolor="#00eb14">N</td>
+ <td bgcolor="#00eb14">B</td>
+ <td bgcolor="#00eb14">D</td>
+ <td bgcolor="#00f10e">Q</td>
+ <td bgcolor="#00f10e">Z</td>
+ </tr>
+ <tr>
+ </td>
+ <td bgcolor="#00f10e">E</td>
+ <td bgcolor="#00fc03">R</td>
+ <td bgcolor="#00ff00">K</td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/colourSchemes/clustal.html b/help/html/colourSchemes/clustal.html
index 9f3e04c..0c39a15 100644
--- a/help/html/colourSchemes/clustal.html
+++ b/help/html/colourSchemes/clustal.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Clustal Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Clustal Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,36 +31,95 @@ td {
</head>
<body>
-<p><em>Clustal X Colour Scheme</em></p>
- <p>This is an emulation of the default colourscheme used for alignments in
- Clustal X, a graphical interface for the ClustalW multiple sequence alignment
- program. Each residue in the alignment is assigned a colour if the
- amino acid profile of the alignment at that position
- meets some minimum criteria specific for the residue type.</p>
- <p>The table below gives these criteria as clauses: {+X%,xx,y},
- where X is the minimum percentage presence for any of the xx (or y) residue types.</p>
-<div align="center">
- <p> </p><table border="1">
-<tr><th>Clustal X Default Colouring</th></tr>
- <tr>
- <td><table border="1">
-<tr><th>Residue at position</th><th>Applied Colour</th><th>{ Threshhold, Residue group }</th></tr>
-<tr><td>A,I,L,M,F,W,V</td><td bgcolor="#80a0f0">BLUE</td><td>{+60%, WLVIMAFCHP}</td></tr>
-<tr><td>R,K</td><td bgcolor="#f01505">RED</td><td>{+60%,KR},{+80%, K,R,Q}</td></tr>
-<tr><td>N</td><td bgcolor="#15c015">GREEN</td><td>{+50%, N}, {+85%, N,Y}</td></tr>
-<tr><td>C</td><td bgcolor="#80a0f0">BLUE</td>
-<td>{+60%, WLVIMAFCHP}</td></tr>
-<tr><td>C</td><td bgcolor="#f08080">PINK</td>
-<td>{100%, C}</td></tr>
-<tr><td>Q</td><td bgcolor="#15c015">GREEN</td><td>{+60%,KR},{+50%,QE},{+85%,Q,E,K,R}</td></tr>
-<tr><td>E</td><td bgcolor="#c048c0">MAGENTA</td><td>{+60%,KR},{+50%,QE},{+85%,E,Q,D}</td></tr>
-<tr><td>D</td><td bgcolor="#c048c0">MAGENTA</td><td>{+60%,KR}, {+85%, K,R,Q}, {+50%,ED}</td></tr>
-<tr><td>G</td><td bgcolor="#f09048">ORANGE</td><td>{+0%, G}</td></tr>
-<tr><td>H,Y</td><td bgcolor="#15a4a4">CYAN</td><td>{+60%, WLVIMAFCHP}, {+85%, W,Y,A,C,P,Q,F,H,I,L,M,V}</td></tr>
-<tr><td>P</td><td bgcolor="#c0c000">YELLOW</td><td>{+0%, P}</td></tr>
-<tr><td>S,T</td><td bgcolor="#15c015">GREEN</td><td>{+60%, WLVIMAFCHP}, {+50%, TS}, {+85%,S,T}</td></tr>
-</table>
-</td></tr></table>
-</div>
+ <p>
+ <strong>Clustal X Colour Scheme</strong>
+ </p>
+ <p>This is an emulation of the default colourscheme used for
+ alignments in Clustal X, a graphical interface for the ClustalW
+ multiple sequence alignment program. Each residue in the alignment
+ is assigned a colour if the amino acid profile of the alignment at
+ that position meets some minimum criteria specific for the residue
+ type.</p>
+ <p>The table below gives these criteria as clauses: {+X%,xx,y},
+ where X is the minimum percentage presence for any of the xx (or y)
+ residue types.</p>
+ <div align="center">
+ <p> </p>
+ <table border="1">
+ <tr>
+ <th>Clustal X Default Colouring</th>
+ </tr>
+ <tr>
+ <td><table border="1">
+ <tr>
+ <th>Residue at position</th>
+ <th>Applied Colour</th>
+ <th>{ Threshhold, Residue group }</th>
+ </tr>
+ <tr>
+ <td>A,I,L,M,F,W,V</td>
+ <td bgcolor="#80a0f0">BLUE</td>
+ <td>{+60%, WLVIMAFCHP}</td>
+ </tr>
+ <tr>
+ <td>R,K</td>
+ <td bgcolor="#f01505">RED</td>
+ <td>{+60%,KR},{+80%, K,R,Q}</td>
+ </tr>
+ <tr>
+ <td>N</td>
+ <td bgcolor="#15c015">GREEN</td>
+ <td>{+50%, N}, {+85%, N,Y}</td>
+ </tr>
+ <tr>
+ <td>C</td>
+ <td bgcolor="#80a0f0">BLUE</td>
+ <td>{+60%, WLVIMAFCHP}</td>
+ </tr>
+ <tr>
+ <td>C</td>
+ <td bgcolor="#f08080">PINK</td>
+ <td>{100%, C}</td>
+ </tr>
+ <tr>
+ <td>Q</td>
+ <td bgcolor="#15c015">GREEN</td>
+ <td>{+60%,KR},{+50%,QE},{+85%,Q,E,K,R}</td>
+ </tr>
+ <tr>
+ <td>E</td>
+ <td bgcolor="#c048c0">MAGENTA</td>
+ <td>{+60%,KR},{+50%,QE},{+85%,E,Q,D}</td>
+ </tr>
+ <tr>
+ <td>D</td>
+ <td bgcolor="#c048c0">MAGENTA</td>
+ <td>{+60%,KR}, {+85%, K,R,Q}, {+50%,ED}</td>
+ </tr>
+ <tr>
+ <td>G</td>
+ <td bgcolor="#f09048">ORANGE</td>
+ <td>{+0%, G}</td>
+ </tr>
+ <tr>
+ <td>H,Y</td>
+ <td bgcolor="#15a4a4">CYAN</td>
+ <td>{+60%, WLVIMAFCHP}, {+85%,
+ W,Y,A,C,P,Q,F,H,I,L,M,V}</td>
+ </tr>
+ <tr>
+ <td>P</td>
+ <td bgcolor="#c0c000">YELLOW</td>
+ <td>{+0%, P}</td>
+ </tr>
+ <tr>
+ <td>S,T</td>
+ <td bgcolor="#15c015">GREEN</td>
+ <td>{+60%, WLVIMAFCHP}, {+50%, TS}, {+85%,S,T}</td>
+ </tr>
+ </table></td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/colourSchemes/colbytcoffee.png b/help/html/colourSchemes/colbytcoffee.png
new file mode 100644
index 0000000..7e84e33
Binary files /dev/null and b/help/html/colourSchemes/colbytcoffee.png differ
diff --git a/help/html/colourSchemes/conservation.html b/help/html/colourSchemes/conservation.html
index 4d53a57..ccd3615 100644
--- a/help/html/colourSchemes/conservation.html
+++ b/help/html/colourSchemes/conservation.html
@@ -1,44 +1,56 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Colouring by Conservation</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Colouring by Conservation</title>
+</head>
<body>
-<p><em>Colouring by Conservation</em></p>
-<p>This is an approach to alignment colouring which highlights
- regions of an alignment where physicochemical properties are
- conserved. It is based on the one used in
- the AMAS method of multiple sequence alignment analysis (Livingstone
- C.D. and Barton G.J. (1993), Protein Sequence Alignments: A Strategy
- for the Hierarchical Analysis of Residue Conservation.CABIOS Vol. 9
- No. 6 (745-756)). See the <a href="../calculations/conservation.html">conservation calculation</a> help page for
- a more thorough explanation of the calculation.
-</p>
-<p>For an already coloured alignment, the conservation index at each
- alignment position is used to modify the shading intensity of the
- colour at that position. This means that the most conserved columns
- in each group have the most intense colours, and the least conserved
- are the palest. The slider controls the contrast between these
- extremes.</p>
-<p>Conservation can be calculated over all sequences in an alignment, or just
- within specific groups (such as those defined by
- <a href="../calculations/tree.html">phylogenetic tree partitioning</a>).
- The option 'apply to all groups' controls whether the contrast
- slider value will be applied to the indices for the currently
- selected group, or all groups defined over the alignment.</p>
+ <p>
+ <strong>Colouring by Conservation</strong>
+ </p>
+ <p>
+ This is an approach to alignment colouring which highlights regions
+ of an alignment where physicochemical properties are conserved. It
+ is based on the one used in the AMAS method of multiple sequence
+ alignment analysis (Livingstone C.D. and Barton G.J. (1993), Protein
+ Sequence Alignments: A Strategy for the Hierarchical Analysis of
+ Residue Conservation.CABIOS Vol. 9 No. 6 (745-756)). See the <a
+ href="../calculations/conservation.html"
+ >conservation calculation</a> help page for a more thorough
+ explanation of the calculation.
+ </p>
+ <p>For an already coloured alignment, the conservation index at
+ each alignment position is used to modify the shading intensity of
+ the colour at that position. This means that the most conserved
+ columns in each group have the most intense colours, and the least
+ conserved are the palest. The slider controls the contrast between
+ these extremes.</p>
+ <p>
+ Conservation can be calculated over all sequences in an alignment,
+ or just within specific groups (such as those defined by <a
+ href="../calculations/tree.html"
+ >phylogenetic tree partitioning</a>). The option 'apply to all groups'
+ controls whether the contrast slider value will be applied to the
+ indices for the currently selected group, or all groups defined over
+ the alignment.
+ </p>
</body>
</html>
diff --git a/help/html/colourSchemes/helix.html b/help/html/colourSchemes/helix.html
index 2d2804a..f570ce2 100644
--- a/help/html/colourSchemes/helix.html
+++ b/help/html/colourSchemes/helix.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Helix Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Helix Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,43 +31,46 @@ td {
</head>
<body>
-<p><em>Helix Propensity</em> </p>
-<div align="center">
- <table width="400" border="1">
- <tr>
- <td bgcolor="#ff00ff">E</td>
- <td bgcolor="#ef10ef">M</td>
- <td bgcolor="#e718e7">A</td>
- <td bgcolor="#c936c9">Z</td>
- <td bgcolor="#ae51ae">L</td>
- </tr>
- <tr>
- <td bgcolor="#a05fa0">K</td>
- <td bgcolor="#986798">F</td>
- <td bgcolor="#926d92">Q</td>
- <td bgcolor="#8a758a">I</td>
- <td bgcolor="#8a758a">W</td>
- </tr>
- <tr>
- <td bgcolor="#857a85">V</td>
- <td bgcolor="#778877">D</td>
- <td bgcolor="#758a75">X</td>
- <td bgcolor="#758a75">H</td>
- <td bgcolor="#6f906f">R</td>
- </tr>
- <tr>
- <td bgcolor="#49b649">B</td>
- <td bgcolor="#47b847">T</td>
- <td bgcolor="#36c936">S</td>
- <td bgcolor="#23dc23">C</td>
- <td bgcolor="#21de21">Y</td>
- </tr>
- <tr> </td>
- <td bgcolor="#1be41b">N</td>
- <td bgcolor="#00ff00">G</td>
- <td bgcolor="#00ff00">P</td>
- </tr>
- </table>
-</div>
+ <p>
+ <strong>Helix Propensity</strong>
+ </p>
+ <div align="center">
+ <table width="400" border="1">
+ <tr>
+ <td bgcolor="#ff00ff">E</td>
+ <td bgcolor="#ef10ef">M</td>
+ <td bgcolor="#e718e7">A</td>
+ <td bgcolor="#c936c9">Z</td>
+ <td bgcolor="#ae51ae">L</td>
+ </tr>
+ <tr>
+ <td bgcolor="#a05fa0">K</td>
+ <td bgcolor="#986798">F</td>
+ <td bgcolor="#926d92">Q</td>
+ <td bgcolor="#8a758a">I</td>
+ <td bgcolor="#8a758a">W</td>
+ </tr>
+ <tr>
+ <td bgcolor="#857a85">V</td>
+ <td bgcolor="#778877">D</td>
+ <td bgcolor="#758a75">X</td>
+ <td bgcolor="#758a75">H</td>
+ <td bgcolor="#6f906f">R</td>
+ </tr>
+ <tr>
+ <td bgcolor="#49b649">B</td>
+ <td bgcolor="#47b847">T</td>
+ <td bgcolor="#36c936">S</td>
+ <td bgcolor="#23dc23">C</td>
+ <td bgcolor="#21de21">Y</td>
+ </tr>
+ <tr>
+ </td>
+ <td bgcolor="#1be41b">N</td>
+ <td bgcolor="#00ff00">G</td>
+ <td bgcolor="#00ff00">P</td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/colourSchemes/hydrophobic.html b/help/html/colourSchemes/hydrophobic.html
index 09cf5d3..dda803d 100644
--- a/help/html/colourSchemes/hydrophobic.html
+++ b/help/html/colourSchemes/hydrophobic.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Hydrophobic Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Hydrophobic Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,46 +31,50 @@ td {
</head>
<body>
-<p><em>Hydrophobicity</em></p>
-<p>According to the hydrophobicity table of Kyte, J., and Doolittle, R.F., J.
- Mol. Biol. 1157, 105-132, 1982. The most hydrophobic residues according to this
- table are coloured red and the most hydrophilic ones are coloured blue.</p>
-<div align="center">
- <table width="400" border="1">
- <tr>
- <td bgcolor="#ff0000">I</td>
- <td bgcolor="#f60009">V</td>
- <td bgcolor="#ea0015">L</td>
- <td bgcolor="#cb0034">F</td>
- <td bgcolor="#c2003d">C</td>
- </tr>
- <tr>
- <td bgcolor="#b0004f">M</td>
- <td bgcolor="#ad0052">A</td>
- <td bgcolor="#6a0095">G</td>
- <td bgcolor="#680097">X</td>
- <td bgcolor="#61009e">T</td>
- </tr>
- <tr>
- <td bgcolor="#5e00a1">S</td>
- <td bgcolor="#5b00a4">W</td>
- <td bgcolor="#4f00b0">Y</td>
- <td bgcolor="#4600b9">P</td>
- <td bgcolor="#1500ea">H</td>
- </tr>
- <tr>
- <td bgcolor="#0c00f3">E</td>
- <td bgcolor="#0c00f3">Z</td>
- <td bgcolor="#0c00f3">Q</td>
- <td bgcolor="#0c00f3">D</td>
- <td bgcolor="#0c00f3">B</td>
- </tr>
- <tr> </td>
- <td bgcolor="#0c00f3">N</td>
- <td bgcolor="#0000ff">K</td>
- <td bgcolor="#0000ff">R</td>
- </tr>
- </table>
-</div>
+ <p>
+ <strong>Hydrophobicity</strong>
+ </p>
+ <p>According to the hydrophobicity table of Kyte, J., and
+ Doolittle, R.F., J. Mol. Biol. 1157, 105-132, 1982. The most
+ hydrophobic residues according to this table are coloured red and
+ the most hydrophilic ones are coloured blue.</p>
+ <div align="center">
+ <table width="400" border="1">
+ <tr>
+ <td bgcolor="#ff0000">I</td>
+ <td bgcolor="#f60009">V</td>
+ <td bgcolor="#ea0015">L</td>
+ <td bgcolor="#cb0034">F</td>
+ <td bgcolor="#c2003d">C</td>
+ </tr>
+ <tr>
+ <td bgcolor="#b0004f">M</td>
+ <td bgcolor="#ad0052">A</td>
+ <td bgcolor="#6a0095">G</td>
+ <td bgcolor="#680097">X</td>
+ <td bgcolor="#61009e">T</td>
+ </tr>
+ <tr>
+ <td bgcolor="#5e00a1">S</td>
+ <td bgcolor="#5b00a4">W</td>
+ <td bgcolor="#4f00b0">Y</td>
+ <td bgcolor="#4600b9">P</td>
+ <td bgcolor="#1500ea">H</td>
+ </tr>
+ <tr>
+ <td bgcolor="#0c00f3">E</td>
+ <td bgcolor="#0c00f3">Z</td>
+ <td bgcolor="#0c00f3">Q</td>
+ <td bgcolor="#0c00f3">D</td>
+ <td bgcolor="#0c00f3">B</td>
+ </tr>
+ <tr>
+ </td>
+ <td bgcolor="#0c00f3">N</td>
+ <td bgcolor="#0000ff">K</td>
+ <td bgcolor="#0000ff">R</td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/colourSchemes/index.html b/help/html/colourSchemes/index.html
index 70d74ee..01319b7 100644
--- a/help/html/colourSchemes/index.html
+++ b/help/html/colourSchemes/index.html
@@ -1,21 +1,24 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Colour Schemes</title>
<style type="text/css">
@@ -29,269 +32,373 @@ td {
</style>
</head>
<body>
-<p><strong>Colour schemes</strong></p>
-<p>Jalview allows the user to set a background colour for the whole
-alignment view or for each group defined on regions within it.</p>
-<p>To change the background colour, simply select the colour from
-the "Colour" menu.</p>
-<p>To change the colour of a group, right click on any residue
-within a group and use the popup menu to define the group colour.</p>
-<p>At the top of the "Colour" menu the tick box
-"Apply Background Colour to all groups". This is ticked by
-default so that a chosen colour scheme will be applied to all existing
-groups. If you wish to maintain the colour scheme for defined groups,
-make sure you deselect this option before changing the background
-colour.</p>
-<p>The <strong>"Colour→<a
- href="../colourSchemes/textcolour.html">Colour Text...</a>"</strong> entry
-opens a dialog box to set a different text colour for light and dark
-background, and the intensity threshold for transition between them.</p>
-<p>The default colour schemes are summarised in the table below:
-<div align="center">
-<p> </p>
-<table border="1">
- <tr>
- <td>
- <table border="1">
- <tr>
- <td nowrap></td>
- <td>A</td>
- <td>R</td>
- <td>N</td>
- <td>D</td>
- <td>C</td>
- <td>Q</td>
- <td>E</td>
- <td>G</td>
- <td>H</td>
- <td>I</td>
- <td>L</td>
- <td>K</td>
- <td>M</td>
- <td>F</td>
- <td>P</td>
- <td>S</td>
- <td>T</td>
- <td>W</td>
- <td>Y</td>
- <td>V</td>
- <td>B</td>
- <td>X</td>
- <td>Z</td>
- </tr>
- <tr>
- <td height="24">Clustal</td>
- <td bgcolor="#80a0f0"></td>
- <td bgcolor="#f01505"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#c048c0"></td>
- <td bgcolor="#f08080"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#c048c0"></td>
- <td bgcolor="#f09048"></td>
- <td bgcolor="#15a4a4"></td>
- <td bgcolor="#80a0f0"></td>
- <td bgcolor="#80a0f0"></td>
- <td bgcolor="#f01505"></td>
- <td bgcolor="#80a0f0"></td>
- <td bgcolor="#80a0f0"></td>
- <td bgcolor="#ffff00"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#80a0f0"></td>
- <td bgcolor="#15a4a4"></td>
- <td bgcolor="#80a0f0"></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <td height="24">Zappo</td>
- <td bgcolor="#ffafaf"></td>
- <td bgcolor="#6464ff"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#ff0000"></td>
- <td bgcolor="#ffff00"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#ff0000"></td>
- <td bgcolor="#ff00ff"></td>
- <td bgcolor="#6464ff"></td>
- <td bgcolor="#ffafaf"></td>
- <td bgcolor="#ffafaf"></td>
- <td bgcolor="#6464ff"></td>
- <td bgcolor="#ffafaf"></td>
- <td bgcolor="#ffc800"></td>
- <td bgcolor="#ff00ff"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#ffc800"></td>
- <td bgcolor="#ffc800"></td>
- <td bgcolor="#ffafaf"></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <td>Taylor</td>
- <td bgcolor="#ccff00"></td>
- <td bgcolor="#0000ff"></td>
- <td bgcolor="#cc00ff"></td>
- <td bgcolor="#ff0000"></td>
- <td bgcolor="#ffff00"></td>
- <td bgcolor="#ff00cc"></td>
- <td bgcolor="#ff0066"></td>
- <td bgcolor="#ff9900"></td>
- <td bgcolor="#0066ff"></td>
- <td bgcolor="#66ff00"></td>
- <td bgcolor="#33ff00"></td>
- <td bgcolor="#6600ff"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#00ff66"></td>
- <td bgcolor="#ffcc00"></td>
- <td bgcolor="#ff3300"></td>
- <td bgcolor="#ff6600"></td>
- <td bgcolor="#00ccff"></td>
- <td bgcolor="#00ffcc"></td>
- <td bgcolor="#99ff00"></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <td>Hydrophobicity</td>
- <td bgcolor="#ad0052"></td>
- <td bgcolor="#0000ff"></td>
- <td bgcolor="#0c00f3"></td>
- <td bgcolor="#0c00f3"></td>
- <td bgcolor="#c2003d"></td>
- <td bgcolor="#0c00f3"></td>
- <td bgcolor="#0c00f3"></td>
- <td bgcolor="#6a0095"></td>
- <td bgcolor="#1500ea"></td>
- <td bgcolor="#ff0000"></td>
- <td bgcolor="#ea0015"></td>
- <td bgcolor="#0000ff"></td>
- <td bgcolor="#b0004f"></td>
- <td bgcolor="#cb0034"></td>
- <td bgcolor="#4600b9"></td>
- <td bgcolor="#5e00a1"></td>
- <td bgcolor="#61009e"></td>
- <td bgcolor="#5b00a4"></td>
- <td bgcolor="#4f00b0"></td>
- <td bgcolor="#f60009"></td>
- <td bgcolor="#0c00f3"></td>
- <td bgcolor="#680097"></td>
- <td bgcolor="#0c00f3"></td>
- </tr>
- <tr>
- <td>Helix Propensity</td>
- <td bgcolor="#e718e7"></td>
- <td bgcolor="#6f906f"></td>
- <td bgcolor="#1be41b"></td>
- <td bgcolor="#778877"></td>
- <td bgcolor="#23dc23"></td>
- <td bgcolor="#926d92"></td>
- <td bgcolor="#ff00ff"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#758a75"></td>
- <td bgcolor="#8a758a"></td>
- <td bgcolor="#ae51ae"></td>
- <td bgcolor="#a05fa0"></td>
- <td bgcolor="#ef10ef"></td>
- <td bgcolor="#986798"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#36c936"></td>
- <td bgcolor="#47b847"></td>
- <td bgcolor="#8a758a"></td>
- <td bgcolor="#21de21"></td>
- <td bgcolor="#857a85"></td>
- <td bgcolor="#49b649"></td>
- <td bgcolor="#758a75"></td>
- <td bgcolor="#c936c9"></td>
- </tr>
- <tr>
- <td nowrap>Strand Propensity</td>
- <td bgcolor="#5858a7"></td>
- <td bgcolor="#6b6b94"></td>
- <td bgcolor="#64649b"></td>
- <td bgcolor="#2121de"></td>
- <td bgcolor="#9d9d62"></td>
- <td bgcolor="#8c8c73"></td>
- <td bgcolor="#0000ff"></td>
- <td bgcolor="#4949b6"></td>
- <td bgcolor="#60609f"></td>
- <td bgcolor="#ecec13"></td>
- <td bgcolor="#b2b24d"></td>
- <td bgcolor="#4747b8"></td>
- <td bgcolor="#82827d"></td>
- <td bgcolor="#c2c23d"></td>
- <td bgcolor="#2323dc"></td>
- <td bgcolor="#4949b6"></td>
- <td bgcolor="#9d9d62"></td>
- <td bgcolor="#c0c03f"></td>
- <td bgcolor="#d3d32c"></td>
- <td bgcolor="#ffff00"></td>
- <td bgcolor="#4343bc"></td>
- <td bgcolor="#797986"></td>
- <td bgcolor="#4747b8"></td>
- </tr>
- <tr>
- <td>Turn Propensity</td>
- <td bgcolor="#2cd3d3"></td>
- <td bgcolor="#708f8f"></td>
- <td bgcolor="#ff0000"></td>
- <td bgcolor="#e81717"></td>
- <td bgcolor="#a85757"></td>
- <td bgcolor="#3fc0c0"></td>
- <td bgcolor="#778888"></td>
- <td bgcolor="#ff0000"></td>
- <td bgcolor="#708f8f"></td>
- <td bgcolor="#00ffff"></td>
- <td bgcolor="#1ce3e3"></td>
- <td bgcolor="#7e8181"></td>
- <td bgcolor="#1ee1e1"></td>
- <td bgcolor="#1ee1e1"></td>
- <td bgcolor="#f60909"></td>
- <td bgcolor="#e11e1e"></td>
- <td bgcolor="#738c8c"></td>
- <td bgcolor="#738c8c"></td>
- <td bgcolor="#9d6262"></td>
- <td bgcolor="#07f8f8"></td>
- <td bgcolor="#f30c0c"></td>
- <td bgcolor="#7c8383"></td>
- <td bgcolor="#5ba4a4"></td>
- </tr>
- <tr>
- <td>Buried Index</td>
- <td bgcolor="#00a35c"></td>
- <td bgcolor="#00fc03"></td>
- <td bgcolor="#00eb14"></td>
- <td bgcolor="#00eb14"></td>
- <td bgcolor="#0000ff"></td>
- <td bgcolor="#00f10e"></td>
- <td bgcolor="#00f10e"></td>
- <td bgcolor="#009d62"></td>
- <td bgcolor="#00d52a"></td>
- <td bgcolor="#0054ab"></td>
- <td bgcolor="#007b84"></td>
- <td bgcolor="#00ff00"></td>
- <td bgcolor="#009768"></td>
- <td bgcolor="#008778"></td>
- <td bgcolor="#00e01f"></td>
- <td bgcolor="#00d52a"></td>
- <td bgcolor="#00db24"></td>
- <td bgcolor="#00a857"></td>
- <td bgcolor="#00e619"></td>
- <td bgcolor="#005fa0"></td>
- <td bgcolor="#00eb14"></td>
- <td bgcolor="#00b649"></td>
- <td bgcolor="#00f10e"></td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-</div>
-<p align="center"> </p>
+ <p>
+ <strong>Colour schemes</strong>
+ </p>
+ <p>Jalview allows the user to set a background colour for the
+ whole alignment view or for each group defined on regions within it.</p>
+ <p>To change the background colour, simply select the colour from
+ the "Colour" menu.</p>
+ <p>To change the colour of a group, right click on any residue
+ within a group and use the popup menu to define the group colour.</p>
+ <p>At the top of the "Colour" menu the tick box
+ "Apply Background Colour to all groups". This is ticked by
+ default so that a chosen colour scheme will be applied to all
+ existing groups. If you wish to maintain the colour scheme for
+ defined groups, make sure you deselect this option before changing
+ the background colour.</p>
+ <p>
+ The <strong>"Colour→<a
+ href="../colourSchemes/textcolour.html"
+ >Colour Text...</a>"
+ </strong> entry opens a dialog box to set a different text colour for light
+ and dark background, and the intensity threshold for transition
+ between them.
+ </p>
+ <p>The default colour schemes are summarised in the table below:
+ <div align="center">
+ <p> </p>
+ <p>
+ <strong>Protein Colour Schemes</strong>
+ </p>
+ <table border="1">
+ <tr>
+ <td>
+ <table border="1">
+ <tr>
+ <td nowrap></td>
+ <td>A</td>
+ <td>R</td>
+ <td>N</td>
+ <td>D</td>
+ <td>C</td>
+ <td>Q</td>
+ <td>E</td>
+ <td>G</td>
+ <td>H</td>
+ <td>I</td>
+ <td>L</td>
+ <td>K</td>
+ <td>M</td>
+ <td>F</td>
+ <td>P</td>
+ <td>S</td>
+ <td>T</td>
+ <td>W</td>
+ <td>Y</td>
+ <td>V</td>
+ <td>B</td>
+ <td>X</td>
+ <td>Z</td>
+ </tr>
+ <tr>
+ <td height="24">Clustal</td>
+ <td bgcolor="#80a0f0"></td>
+ <td bgcolor="#f01505"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#c048c0"></td>
+ <td bgcolor="#f08080"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#c048c0"></td>
+ <td bgcolor="#f09048"></td>
+ <td bgcolor="#15a4a4"></td>
+ <td bgcolor="#80a0f0"></td>
+ <td bgcolor="#80a0f0"></td>
+ <td bgcolor="#f01505"></td>
+ <td bgcolor="#80a0f0"></td>
+ <td bgcolor="#80a0f0"></td>
+ <td bgcolor="#ffff00"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#80a0f0"></td>
+ <td bgcolor="#15a4a4"></td>
+ <td bgcolor="#80a0f0"></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td height="24">Zappo</td>
+ <td bgcolor="#ffafaf"></td>
+ <td bgcolor="#6464ff"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#ff0000"></td>
+ <td bgcolor="#ffff00"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#ff0000"></td>
+ <td bgcolor="#ff00ff"></td>
+ <td bgcolor="#6464ff"></td>
+ <td bgcolor="#ffafaf"></td>
+ <td bgcolor="#ffafaf"></td>
+ <td bgcolor="#6464ff"></td>
+ <td bgcolor="#ffafaf"></td>
+ <td bgcolor="#ffc800"></td>
+ <td bgcolor="#ff00ff"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#ffc800"></td>
+ <td bgcolor="#ffc800"></td>
+ <td bgcolor="#ffafaf"></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>Taylor</td>
+ <td bgcolor="#ccff00"></td>
+ <td bgcolor="#0000ff"></td>
+ <td bgcolor="#cc00ff"></td>
+ <td bgcolor="#ff0000"></td>
+ <td bgcolor="#ffff00"></td>
+ <td bgcolor="#ff00cc"></td>
+ <td bgcolor="#ff0066"></td>
+ <td bgcolor="#ff9900"></td>
+ <td bgcolor="#0066ff"></td>
+ <td bgcolor="#66ff00"></td>
+ <td bgcolor="#33ff00"></td>
+ <td bgcolor="#6600ff"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#00ff66"></td>
+ <td bgcolor="#ffcc00"></td>
+ <td bgcolor="#ff3300"></td>
+ <td bgcolor="#ff6600"></td>
+ <td bgcolor="#00ccff"></td>
+ <td bgcolor="#00ffcc"></td>
+ <td bgcolor="#99ff00"></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>Hydrophobicity</td>
+ <td bgcolor="#ad0052"></td>
+ <td bgcolor="#0000ff"></td>
+ <td bgcolor="#0c00f3"></td>
+ <td bgcolor="#0c00f3"></td>
+ <td bgcolor="#c2003d"></td>
+ <td bgcolor="#0c00f3"></td>
+ <td bgcolor="#0c00f3"></td>
+ <td bgcolor="#6a0095"></td>
+ <td bgcolor="#1500ea"></td>
+ <td bgcolor="#ff0000"></td>
+ <td bgcolor="#ea0015"></td>
+ <td bgcolor="#0000ff"></td>
+ <td bgcolor="#b0004f"></td>
+ <td bgcolor="#cb0034"></td>
+ <td bgcolor="#4600b9"></td>
+ <td bgcolor="#5e00a1"></td>
+ <td bgcolor="#61009e"></td>
+ <td bgcolor="#5b00a4"></td>
+ <td bgcolor="#4f00b0"></td>
+ <td bgcolor="#f60009"></td>
+ <td bgcolor="#0c00f3"></td>
+ <td bgcolor="#680097"></td>
+ <td bgcolor="#0c00f3"></td>
+ </tr>
+ <tr>
+ <td>Helix Propensity</td>
+ <td bgcolor="#e718e7"></td>
+ <td bgcolor="#6f906f"></td>
+ <td bgcolor="#1be41b"></td>
+ <td bgcolor="#778877"></td>
+ <td bgcolor="#23dc23"></td>
+ <td bgcolor="#926d92"></td>
+ <td bgcolor="#ff00ff"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#758a75"></td>
+ <td bgcolor="#8a758a"></td>
+ <td bgcolor="#ae51ae"></td>
+ <td bgcolor="#a05fa0"></td>
+ <td bgcolor="#ef10ef"></td>
+ <td bgcolor="#986798"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#36c936"></td>
+ <td bgcolor="#47b847"></td>
+ <td bgcolor="#8a758a"></td>
+ <td bgcolor="#21de21"></td>
+ <td bgcolor="#857a85"></td>
+ <td bgcolor="#49b649"></td>
+ <td bgcolor="#758a75"></td>
+ <td bgcolor="#c936c9"></td>
+ </tr>
+ <tr>
+ <td nowrap>Strand Propensity</td>
+ <td bgcolor="#5858a7"></td>
+ <td bgcolor="#6b6b94"></td>
+ <td bgcolor="#64649b"></td>
+ <td bgcolor="#2121de"></td>
+ <td bgcolor="#9d9d62"></td>
+ <td bgcolor="#8c8c73"></td>
+ <td bgcolor="#0000ff"></td>
+ <td bgcolor="#4949b6"></td>
+ <td bgcolor="#60609f"></td>
+ <td bgcolor="#ecec13"></td>
+ <td bgcolor="#b2b24d"></td>
+ <td bgcolor="#4747b8"></td>
+ <td bgcolor="#82827d"></td>
+ <td bgcolor="#c2c23d"></td>
+ <td bgcolor="#2323dc"></td>
+ <td bgcolor="#4949b6"></td>
+ <td bgcolor="#9d9d62"></td>
+ <td bgcolor="#c0c03f"></td>
+ <td bgcolor="#d3d32c"></td>
+ <td bgcolor="#ffff00"></td>
+ <td bgcolor="#4343bc"></td>
+ <td bgcolor="#797986"></td>
+ <td bgcolor="#4747b8"></td>
+ </tr>
+ <tr>
+ <td>Turn Propensity</td>
+ <td bgcolor="#2cd3d3"></td>
+ <td bgcolor="#708f8f"></td>
+ <td bgcolor="#ff0000"></td>
+ <td bgcolor="#e81717"></td>
+ <td bgcolor="#a85757"></td>
+ <td bgcolor="#3fc0c0"></td>
+ <td bgcolor="#778888"></td>
+ <td bgcolor="#ff0000"></td>
+ <td bgcolor="#708f8f"></td>
+ <td bgcolor="#00ffff"></td>
+ <td bgcolor="#1ce3e3"></td>
+ <td bgcolor="#7e8181"></td>
+ <td bgcolor="#1ee1e1"></td>
+ <td bgcolor="#1ee1e1"></td>
+ <td bgcolor="#f60909"></td>
+ <td bgcolor="#e11e1e"></td>
+ <td bgcolor="#738c8c"></td>
+ <td bgcolor="#738c8c"></td>
+ <td bgcolor="#9d6262"></td>
+ <td bgcolor="#07f8f8"></td>
+ <td bgcolor="#f30c0c"></td>
+ <td bgcolor="#7c8383"></td>
+ <td bgcolor="#5ba4a4"></td>
+ </tr>
+ <tr>
+ <td>Buried Index</td>
+ <td bgcolor="#00a35c"></td>
+ <td bgcolor="#00fc03"></td>
+ <td bgcolor="#00eb14"></td>
+ <td bgcolor="#00eb14"></td>
+ <td bgcolor="#0000ff"></td>
+ <td bgcolor="#00f10e"></td>
+ <td bgcolor="#00f10e"></td>
+ <td bgcolor="#009d62"></td>
+ <td bgcolor="#00d52a"></td>
+ <td bgcolor="#0054ab"></td>
+ <td bgcolor="#007b84"></td>
+ <td bgcolor="#00ff00"></td>
+ <td bgcolor="#009768"></td>
+ <td bgcolor="#008778"></td>
+ <td bgcolor="#00e01f"></td>
+ <td bgcolor="#00d52a"></td>
+ <td bgcolor="#00db24"></td>
+ <td bgcolor="#00a857"></td>
+ <td bgcolor="#00e619"></td>
+ <td bgcolor="#005fa0"></td>
+ <td bgcolor="#00eb14"></td>
+ <td bgcolor="#00b649"></td>
+ <td bgcolor="#00f10e"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <p> </p>
+ <p>
+ <strong>Nucleotide Colour Schemes</strong>
+ </p>
+ <table border="1">
+ <tr>
+ <td>
+ <table border="1">
+ <tr>
+ <td nowrap></td>
+ <td>A</td>
+ <!--Adenine-->
+ <td>C</td>
+ <!--Cytosine-->
+ <td>G</td>
+ <!--Guanine-->
+ <td>T</td>
+ <!--Thymine-->
+ <td>U</td>
+ <!--Uracil-->
+ <td>I</td>
+ <!--Inosine-->
+ <td>X</td>
+ <!--Xanthine-->
+ <td>R</td>
+ <!--Unknown Purine-->
+ <td>Y</td>
+ <!--Unknown Pyrimidine-->
+ <td>N</td>
+ <!--Unknown-->
+ <td>W</td>
+ <!--Weak nucleotide (A or T)-->
+ <td>S</td>
+ <!--Strong nucleotide (G or C)-->
+ <td>M</td>
+ <!--Amino (A or C)-->
+ <td>K</td>
+ <!--Keto (G or T)-->
+ <td>B</td>
+ <!--Not A (G or C or T)-->
+ <td>H</td>
+ <!--Not G (A or C or T)-->
+ <td>D</td>
+ <!--Not C (A or G or T)-->
+ <td>V</td>
+ <!--Not T (A or G or C-->
+ </tr>
+ <tr>
+ <td height="24">Nucleotide</td>
+ <td bgcolor="#64F73F"></td>
+ <td bgcolor="#FFB340"></td>
+ <td bgcolor="#EB413C"></td>
+ <td bgcolor="#3C88EE"></td>
+ <td bgcolor="#3C88EE"></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td height="24">Purine/Pyrimidine</td>
+ <td bgcolor="#FF83FA"></td>
+ <td bgcolor="#40E0D0"></td>
+ <td bgcolor="#FF83FA"></td>
+ <td bgcolor="#40E0D0"></td>
+ <td bgcolor="#40E0D0"></td>
+ <td></td>
+ <td></td>
+ <td bgcolor="#FF83FA"></td>
+ <td bgcolor="#40E0D0"></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+
+
+ </div>
+ <p align="center"> </p>
</body>
</html>
diff --git a/help/html/colourSchemes/nucleotide.html b/help/html/colourSchemes/nucleotide.html
index a0d4c8c..88a894b 100644
--- a/help/html/colourSchemes/nucleotide.html
+++ b/help/html/colourSchemes/nucleotide.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Nucleotide Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Nucleotide Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,16 +31,19 @@ td {
</head>
<body>
-<p><em>Nucleotide Colours</em></p>
-<div align="center">
- <table width="200" border="1">
- <tr>
- <td bgcolor="#64F73F">A</td>
- <td bgcolor="#FFB340">C</td>
- <td bgcolor="#EB413C">G</td>
- <td bgcolor="#3C88EE">T</td>
- </tr>
- </table>
-</div>
+ <p>
+ <strong>Nucleotide Colours</strong>
+ </p>
+ <div align="center">
+ <table width="200" border="1">
+ <tr>
+ <td bgcolor="#64F73F">A</td>
+ <td bgcolor="#FFB340">C</td>
+ <td bgcolor="#EB413C">G</td>
+ <td bgcolor="#3C88EE">T</td>
+ <td bgcolor="#3C88EE">U</td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/colourSchemes/pid.html b/help/html/colourSchemes/pid.html
index 58e8489..20e8330 100644
--- a/help/html/colourSchemes/pid.html
+++ b/help/html/colourSchemes/pid.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Percentage Identity Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Percentage Identity Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,24 +31,28 @@ td {
</head>
<body>
-<p><em>PID Colours</em><br>
- <br>
- The PID option colours the residues (boxes and/or text) according to the percentage
- of the residues in each column that agree with the consensus sequence. Only
- the residues that agree with the consensus residue for each column are coloured.</p>
-<table width="200" border="1">
- <tr>
- <td bgcolor="#6464FF">> 80 %</td>
- </tr>
- <tr>
- <td bgcolor="#9999FF">> 60 %</td>
- </tr>
- <tr>
- <td bgcolor="#CCCCFF">> 40%</td>
- </tr>
- <tr>
- <td>< 40%</td>
- </tr>
-</table>
+ <p>
+ <strong>PID Colours</strong><br> <br> The PID option
+ colours the residues (boxes and/or text) according to the percentage
+ of the residues in each column that agree with the consensus
+ sequence. Only the residues that agree with the consensus residue
+ for each column are coloured.
+ </p>
+ <div align="center">
+ <table width="200" border="1">
+ <tr>
+ <td bgcolor="#6464FF">> 80 %</td>
+ </tr>
+ <tr>
+ <td bgcolor="#9999FF">> 60 %</td>
+ </tr>
+ <tr>
+ <td bgcolor="#CCCCFF">> 40%</td>
+ </tr>
+ <tr>
+ <td>< 40%</td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/colourSchemes/purinepyrimidine.html b/help/html/colourSchemes/purinepyrimidine.html
new file mode 100644
index 0000000..e24b082
--- /dev/null
+++ b/help/html/colourSchemes/purinepyrimidine.html
@@ -0,0 +1,48 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Purine/Pyrimidine Colour Scheme</title>
+<style type="text/css">
+<!--
+td {
+ text-align: center;
+}
+-->
+</style>
+</head>
+
+<body>
+ <p>
+ <strong>Purine/Pyrimidine Colours</strong>
+ </p>
+ <div align="center">
+ <table width="200" border="1">
+ <tr>
+ <td bgcolor="#FF83FA">Purines <BR> A, G, R
+ </td>
+ <td bgcolor="#40E0D0">Pyrimidines <BR> C, U, T, Y
+ </td>
+ </tr>
+ </table>
+ </div>
+</body>
+</html>
diff --git a/help/html/colourSchemes/rnahelicesColouring.html b/help/html/colourSchemes/rnahelicesColouring.html
new file mode 100644
index 0000000..a49a9e5
--- /dev/null
+++ b/help/html/colourSchemes/rnahelicesColouring.html
@@ -0,0 +1,68 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>RNA Helices Colouring</title>
+</head>
+
+<body>
+ <p>
+ <strong> RNA Helices Colouring </strong>
+ </p>
+ <p>
+ An RNA alignment loaded from a Stockholm file can be coloured based
+ on its helices. The helices are determined from the secondary
+ structure line in the Stockholm file (#GC SS_cons) written in WUSS
+ notation that specifies base pairing. See <a
+ href="http://en.wikipedia.org/wiki/Stockholm_format"
+ > Wikipedia</a> or <a
+ href="http://jalview-rnasupport.blogspot.com/2010/06/parsing-wuss-notation-of-rna-secondary.html"
+ > Jalview RNA Support Blog</a> for more information about Stockholm
+ files and WUSS notation.
+ </p>
+ Select "Colour"
+ <strong>→</strong> " By RNA Helices" to colour the
+ alignment by RNA helices.
+ <br>
+ <br>
+ <p>
+ <em>Features</em>
+ </p>
+ <ul>
+ <li>Colours are generated randomly for the number of helices
+ present. Reselect the "By RNA Helices" option to generate another
+ set of random colors.</li>
+ <li>Sequence logo is in <a href="purinepyrimidine.html">
+ Purine/Pyrimidine colour scheme</a>.
+ </li>
+ <li>Line above the "Secondary Structure" line in annotation
+ panel is WUSS notation present in the input file.</li>
+ </ul>
+
+
+
+ <div align="center">
+ <img src="rnahelicescoloring.png" width="600" height="140">
+ </div>
+
+
+</body>
+</html>
diff --git a/help/html/colourSchemes/rnahelicescoloring.png b/help/html/colourSchemes/rnahelicescoloring.png
new file mode 100644
index 0000000..05e9230
Binary files /dev/null and b/help/html/colourSchemes/rnahelicescoloring.png differ
diff --git a/help/html/colourSchemes/strand.html b/help/html/colourSchemes/strand.html
index 33f1d34..93c6fed 100644
--- a/help/html/colourSchemes/strand.html
+++ b/help/html/colourSchemes/strand.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Strand Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Strand Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,43 +31,46 @@ td {
</head>
<body>
-<p><em>Strand propensity</em></p>
-<div align="center">
- <table width="400" border="1">
- <tr>
- <td bgcolor="#ffff00">V</td>
- <td bgcolor="#ecec13">I</td>
- <td bgcolor="#d3d32c">Y</td>
- <td bgcolor="#c2c23d">F</td>
- <td bgcolor="#c0c03f">W</td>
- </tr>
- <tr>
- <td bgcolor="#b2b24d">L</td>
- <td bgcolor="#9d9d62">T</td>
- <td bgcolor="#9d9d62">C</td>
- <td bgcolor="#8c8c73">Q</td>
- <td bgcolor="#82827d">M</td>
- </tr>
- <tr>
- <td bgcolor="#797986">X</td>
- <td bgcolor="#6b6b94">R</td>
- <td bgcolor="#64649b">N</td>
- <td bgcolor="#60609f">H</td>
- <td bgcolor="#5858a7">A</td>
- </tr>
- <tr>
- <td bgcolor="#4949b6">S</td>
- <td bgcolor="#4949b6">G</td>
- <td bgcolor="#4747b8">Z</td>
- <td bgcolor="#4747b8">K</td>
- <td bgcolor="#4343bc">B</td>
- </tr>
- <tr> </td>
- <td bgcolor="#2323dc">P</td>
- <td bgcolor="#2121de">D</td>
- <td bgcolor="#0000ff">E</td>
- </tr>
- </table>
-</div>
+ <p>
+ <strong>Strand propensity</strong>
+ </p>
+ <div align="center">
+ <table width="400" border="1">
+ <tr>
+ <td bgcolor="#ffff00">V</td>
+ <td bgcolor="#ecec13">I</td>
+ <td bgcolor="#d3d32c">Y</td>
+ <td bgcolor="#c2c23d">F</td>
+ <td bgcolor="#c0c03f">W</td>
+ </tr>
+ <tr>
+ <td bgcolor="#b2b24d">L</td>
+ <td bgcolor="#9d9d62">T</td>
+ <td bgcolor="#9d9d62">C</td>
+ <td bgcolor="#8c8c73">Q</td>
+ <td bgcolor="#82827d">M</td>
+ </tr>
+ <tr>
+ <td bgcolor="#797986">X</td>
+ <td bgcolor="#6b6b94">R</td>
+ <td bgcolor="#64649b">N</td>
+ <td bgcolor="#60609f">H</td>
+ <td bgcolor="#5858a7">A</td>
+ </tr>
+ <tr>
+ <td bgcolor="#4949b6">S</td>
+ <td bgcolor="#4949b6">G</td>
+ <td bgcolor="#4747b8">Z</td>
+ <td bgcolor="#4747b8">K</td>
+ <td bgcolor="#4343bc">B</td>
+ </tr>
+ <tr>
+ </td>
+ <td bgcolor="#2323dc">P</td>
+ <td bgcolor="#2121de">D</td>
+ <td bgcolor="#0000ff">E</td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/colourSchemes/taylor.html b/help/html/colourSchemes/taylor.html
index 41edf24..cf19eb8 100644
--- a/help/html/colourSchemes/taylor.html
+++ b/help/html/colourSchemes/taylor.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Taylor Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Taylor Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,42 +31,45 @@ td {
</head>
<body>
-<p><em><a name="taylor">Taylor</a></em></p>
-<p>These colours were invented by Willie Taylor and an entertaining description
- of their birth can be found in Protein Engineering, Vol 10 , 743-746 (1997)</p>
-<div align="center">
- <table width="400" border="1">
- <tr>
- <td bgcolor="#ccff00">A</td>
- <td bgcolor="#99ff00">V</td>
- <td bgcolor="#66ff00">I</td>
- <td bgcolor="#33ff00">L</td>
- </tr>
- <tr>
- <td bgcolor="#00ff00">M</td>
- <td bgcolor="#00ff66">F</td>
- <td bgcolor="#00ffcc">Y</td>
- <td bgcolor="#00ccff">W</td>
- </tr>
- <tr>
- <td bgcolor="#0066ff">H</td>
- <td bgcolor="#0000ff">R</td>
- <td bgcolor="#6600ff">K</td>
- <td bgcolor="#cc00ff">N</td>
- </tr>
- <tr>
- <td bgcolor="#ff00cc">Q</td>
- <td bgcolor="#ff0066">E</td>
- <td bgcolor="#ff0000">D</td>
- <td bgcolor="#ff3300">S</td>
- </tr>
- <tr>
- <td bgcolor="#ff6600">T</td>
- <td bgcolor="#ff9900">G</td>
- <td bgcolor="#ffcc00">P</td>
- <td bgcolor="#ffff00">C</td>
- </tr>
- </table>
-</div>
+ <p>
+ <strong><a name="taylor">Taylor</a></strong>
+ </p>
+ <p>These colours were invented by Willie Taylor and an
+ entertaining description of their birth can be found in Protein
+ Engineering, Vol 10 , 743-746 (1997)</p>
+ <div align="center">
+ <table width="400" border="1">
+ <tr>
+ <td bgcolor="#ccff00">A</td>
+ <td bgcolor="#99ff00">V</td>
+ <td bgcolor="#66ff00">I</td>
+ <td bgcolor="#33ff00">L</td>
+ </tr>
+ <tr>
+ <td bgcolor="#00ff00">M</td>
+ <td bgcolor="#00ff66">F</td>
+ <td bgcolor="#00ffcc">Y</td>
+ <td bgcolor="#00ccff">W</td>
+ </tr>
+ <tr>
+ <td bgcolor="#0066ff">H</td>
+ <td bgcolor="#0000ff">R</td>
+ <td bgcolor="#6600ff">K</td>
+ <td bgcolor="#cc00ff">N</td>
+ </tr>
+ <tr>
+ <td bgcolor="#ff00cc">Q</td>
+ <td bgcolor="#ff0066">E</td>
+ <td bgcolor="#ff0000">D</td>
+ <td bgcolor="#ff3300">S</td>
+ </tr>
+ <tr>
+ <td bgcolor="#ff6600">T</td>
+ <td bgcolor="#ff9900">G</td>
+ <td bgcolor="#ffcc00">P</td>
+ <td bgcolor="#ffff00">C</td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/colourSchemes/textcolour.html b/help/html/colourSchemes/textcolour.html
index de18633..979e950 100644
--- a/help/html/colourSchemes/textcolour.html
+++ b/help/html/colourSchemes/textcolour.html
@@ -1,37 +1,42 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head>
-Background Dependent Text Colour
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>Background Dependent Text Colour
</head>
<body>
-<strong>Background Dependent Text Colour</strong>
-<p>The <strong>Colour→Text Colour</strong> menu entry opens
-the <strong>"Adjust Foreground Text Colour Threshold"</strong>
-dialog box, allowing the colour of symbols rendered on dark or light
-backgrounds to be set for the current selection or the whole alignment.
-</p>
-<p><img src="textcolour.gif"></p>
-<p>The dialog box contains a slider, and two colour icons showing
-the text colour for dark backgrounds (left hand end of slider), and
-light backgrounds (right hand end of slider). Drag the slider to change
-the threshold for transitioning between dark and light background
-colours, and select either of the colour boxes to open a colour chooser
-to select a different text colour.</p>
+ <strong>Background Dependent Text Colour</strong>
+ <p>
+ The <strong>Colour→Text Colour</strong> menu entry opens the <strong>"Adjust
+ Foreground Text Colour Threshold"</strong> dialog box, allowing the
+ colour of symbols rendered on dark or light backgrounds to be set
+ for the current selection or the whole alignment.
+ </p>
+ <p>
+ <img src="textcolour.gif">
+ </p>
+ <p>The dialog box contains a slider, and two colour icons showing
+ the text colour for dark backgrounds (left hand end of slider), and
+ light backgrounds (right hand end of slider). Drag the slider to
+ change the threshold for transitioning between dark and light
+ background colours, and select either of the colour boxes to open a
+ colour chooser to select a different text colour.</p>
</body>
</html>
diff --git a/help/html/colourSchemes/turn.html b/help/html/colourSchemes/turn.html
index 928c5ee..fa83414 100644
--- a/help/html/colourSchemes/turn.html
+++ b/help/html/colourSchemes/turn.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Turn Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Turn Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,43 +31,46 @@ td {
</head>
<body>
-<p><em>Turn propensity</em></p>
-<div align="center">
- <table width="400" border="1">
- <tr>
- <td bgcolor="#ff0000">N</td>
- <td bgcolor="#ff0000">G</td>
- <td bgcolor="#f60909">P</td>
- <td bgcolor="#f30c0c">B</td>
- <td bgcolor="#e81717">D</td>
- </tr>
- <tr>
- <td bgcolor="#e11e1e">S</td>
- <td bgcolor="#a85757">C</td>
- <td bgcolor="#9d6262">Y</td>
- <td bgcolor="#7e8181">K</td>
- <td bgcolor="#7c8383">X</td>
- </tr>
- <tr>
- <td bgcolor="#778888">Q</td>
- <td bgcolor="#738c8c">W</td>
- <td bgcolor="#738c8c">T</td>
- <td bgcolor="#708f8f">R</td>
- <td bgcolor="#708f8f">H</td>
- </tr>
- <tr>
- <td bgcolor="#5ba4a4">Z</td>
- <td bgcolor="#3fc0c0">E</td>
- <td bgcolor="#2cd3d3">A</td>
- <td bgcolor="#1ee1e1">F</td>
- <td bgcolor="#1ee1e1">M</td>
- </tr>
- <tr> </td>
- <td bgcolor="#1ce3e3">L</td>
- <td bgcolor="#07f8f8">V</td>
- <td bgcolor="#00ffff">I</td>
- </tr>
- </table>
-</div>
+ <p>
+ <strong>Turn propensity</strong>
+ </p>
+ <div align="center">
+ <table width="400" border="1">
+ <tr>
+ <td bgcolor="#ff0000">N</td>
+ <td bgcolor="#ff0000">G</td>
+ <td bgcolor="#f60909">P</td>
+ <td bgcolor="#f30c0c">B</td>
+ <td bgcolor="#e81717">D</td>
+ </tr>
+ <tr>
+ <td bgcolor="#e11e1e">S</td>
+ <td bgcolor="#a85757">C</td>
+ <td bgcolor="#9d6262">Y</td>
+ <td bgcolor="#7e8181">K</td>
+ <td bgcolor="#7c8383">X</td>
+ </tr>
+ <tr>
+ <td bgcolor="#778888">Q</td>
+ <td bgcolor="#738c8c">W</td>
+ <td bgcolor="#738c8c">T</td>
+ <td bgcolor="#708f8f">R</td>
+ <td bgcolor="#708f8f">H</td>
+ </tr>
+ <tr>
+ <td bgcolor="#5ba4a4">Z</td>
+ <td bgcolor="#3fc0c0">E</td>
+ <td bgcolor="#2cd3d3">A</td>
+ <td bgcolor="#1ee1e1">F</td>
+ <td bgcolor="#1ee1e1">M</td>
+ </tr>
+ <tr>
+ </td>
+ <td bgcolor="#1ce3e3">L</td>
+ <td bgcolor="#07f8f8">V</td>
+ <td bgcolor="#00ffff">I</td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/colourSchemes/user.html b/help/html/colourSchemes/user.html
index 1f48afa..100e8ee 100644
--- a/help/html/colourSchemes/user.html
+++ b/help/html/colourSchemes/user.html
@@ -1,39 +1,63 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>User Defined Colours</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>User Defined Colours</title>
+</head>
<body>
-<p><em>User Defined Colours</em></p>
-<p><img src="userDefined.gif" width="719" height="368"> </p>
-<p>You may define any number of new colour schemes, each with a unique name. <br>
- <br>
- Each of the residues in a new colour scheme may be assigned a new user defined
- colour. <br>
+ <p>
+ <strong>User Defined Colours</strong>
+ </p>
+ <p>
+ <img src="userDefined_java6.gif" width="815" height="402">
+ </p>
+ <p>
+ You may define any number of new colour schemes, each with a unique
+ name. <br> <br> Each of the residues in a colour scheme
+ may be assigned any chosen colour. <br> Select one or more
+ residues, then select the desired colour.<br /> Use Ctrl-click to
+ select multiple residues, or click then Shift-click to select a
+ block.<br /> Note that the currently selected buttons are
+ highlighted by a lighter text colour.
+ <p>
+ The <strong>Case Sensitive</strong> option allows you to choose
+ distinct colours for upper and lower case residue codes.
+ <p>
+ Click <strong>Apply</strong> or <strong>OK</strong> to set your new
+ colours on the active alignment window.<br /> Click <strong>Cancel</strong>
+ to undo your changes if you pressed the <strong>Apply</strong>
+ button.
+ </p>
+ If you save your colour scheme with a unique name, the colour scheme
+ name will be added to the
+ <strong>Colour</strong> menu on each new alignment window.
<br>
- Click "Apply" or "OK" to set your new colours on the active
- alignment window. </p>
-<p>Click "Cancel" to undo your changes if you pressed the "Apply"
- button. <br>
+ <br> Any saved colour schemes will be automatically loaded the
+ next time you use Jalview.
<br>
- If you save your colour scheme with a unique name the colour scheme name will
- be added to the "Colour" menu on each new alignment window.<br>
<br>
- Any saved colour schemes will be automatically loaded the next time you use
- Jalview.</p>
+ <em>Note: the screenshot shows the appearance when running Java
+ version 6. For Java 7 (from Jalview 2.8.2) only the Swatches colour
+ chooser is currently supported (for reasons of available screen
+ space).</em>
+ <p />
</body>
</html>
diff --git a/help/html/colourSchemes/userDefined_java6.gif b/help/html/colourSchemes/userDefined_java6.gif
new file mode 100644
index 0000000..d737e80
Binary files /dev/null and b/help/html/colourSchemes/userDefined_java6.gif differ
diff --git a/help/html/colourSchemes/userDefined_java7.gif b/help/html/colourSchemes/userDefined_java7.gif
new file mode 100644
index 0000000..f0ced11
Binary files /dev/null and b/help/html/colourSchemes/userDefined_java7.gif differ
diff --git a/help/html/colourSchemes/zappo.html b/help/html/colourSchemes/zappo.html
index 327c9b1..eca1df9 100644
--- a/help/html/colourSchemes/zappo.html
+++ b/help/html/colourSchemes/zappo.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Zappo Colour Scheme</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Zappo Colour Scheme</title>
<style type="text/css">
<!--
td {
@@ -27,41 +31,41 @@ td {
</head>
<body>
-<p><em>Zappo Colours</em><br>
- <br>
- The residues are coloured according to their physicochemical properties as
- follows: </p>
-<div align="center">
- <table width="400" border="1">
- <tr>
- <td > Aliphatic/hydrophobic</td>
- <td bgcolor="#ffafaf">ILVAM </td>
- </tr>
- <tr>
- <td>Aromatic</td>
- <td bgcolor="#ffc800">FWY</td>
- </tr>
- <tr>
- <td>Positive</td>
- <td bgcolor="#6464ff">KRH</td>
- </tr>
- <tr>
- <td> Negative</td>
- <td bgcolor="#ff0000">DE</td>
- </tr>
- <tr>
- <td>Hydrophilic</td>
- <td bgcolor="#00ff00">STNQ</td>
- </tr>
- <tr>
- <td>conformationally special</td>
- <td bgcolor="#ff00ff">PG</td>
- </tr>
- <tr>
- <td>Cysteine</td>
- <td bgcolor="#ffff00">C</td>
- </tr>
- </table>
-</div>
+ <p>
+ <strong>Zappo Colours</strong><br> <br> The residues are
+ coloured according to their physicochemical properties as follows:
+ </p>
+ <div align="center">
+ <table width="400" border="1">
+ <tr>
+ <td>Aliphatic/hydrophobic</td>
+ <td bgcolor="#ffafaf">ILVAM</td>
+ </tr>
+ <tr>
+ <td>Aromatic</td>
+ <td bgcolor="#ffc800">FWY</td>
+ </tr>
+ <tr>
+ <td>Positive</td>
+ <td bgcolor="#6464ff">KRH</td>
+ </tr>
+ <tr>
+ <td>Negative</td>
+ <td bgcolor="#ff0000">DE</td>
+ </tr>
+ <tr>
+ <td>Hydrophilic</td>
+ <td bgcolor="#00ff00">STNQ</td>
+ </tr>
+ <tr>
+ <td>conformationally special</td>
+ <td bgcolor="#ff00ff">PG</td>
+ </tr>
+ <tr>
+ <td>Cysteine</td>
+ <td bgcolor="#ffff00">C</td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/editing/index.html b/help/html/editing/index.html
index 1a1bc31..2dfbde6 100644
--- a/help/html/editing/index.html
+++ b/help/html/editing/index.html
@@ -1,73 +1,109 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Editing</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Editing</title>
+</head>
<body>
-<p><strong>Editing</strong></p>
-<p>There are two major ways to edit alignments - in 'Normal mode',
-gaps are inserted and deleted at the mouse pointer in various ways by
-clicking the left mouse button and pressing a combination of either
-shift and control (or the apple key on Macs) and dragging the mouse. Pressing
-<em>F2</em> toggles the alternative <a href="../features/cursorMode.html">'Cursor
-mode'</a> keyboard editing facility, where the space bar and delete
-keys add and remove gaps at the current editing position. The key
-strokes for both these modes are summarised in the <a
-href="../keys.html">keystrokes table</a>.</p>
-<p><strong>Tip:</strong> For large alignments, deselect "Calculate ->
- Autocalculate Consensus" to prevent the alignment performing lengthy calculations
- after every edit. </p>
-<p><em>Inserting / removing gaps</em> - hold down the
- "Shift" key. Click on a residue with the mouse and drag it
- to the left or right to insert gaps and remove gaps.<br>
- If the current selection is a group over all sequences in the
- alignment, or a group over some sequences or all columns in the
- alignment, then hold down either "Control"
- key and drag the residue left or right to edit all sequences in the defined
- group at once.</p>
-<p><em>Copy/paste/cut/delete</em> - any sequences which are in the current selection
- box (indicated in red) may be cut and / or copied to a new alignment or deleted.
-</p>
-<p><em>Undo / redo</em> - editing of sequences (insertion/removal of gaps, removal
- of sequences, trimming sequences etc) may be undone or redone at any time using
- the appropriate menu items from the edit menu. The undo history list only allows
- a maximum of 10 actions.
-<p><em>Trimming alignment</em> - First select a column by clicking the scale indicator
- (above the sequences) The alignment may then be trimmed to the left or right
- of this column. If multiple columns are selected, the alignment is trimmed to
- the right of the rightmost selected column (or to the left of the leftmost selected
- column)</p>
-<p><em>Remove gapped columns</em> - Removes columns within the alignment which
- contain only space characters ("-" or "." or " ")</p>
-<p><em>Removing gaps</em> - Removes all gaps from the alignment. Gaps are "-"
- or "." or " ".</p>
-<p><em>Set gap character</em> - Switches the gap character between "."
- and "-". If the "Render Gaps" option from the "View"
- menu is unticked all gaps will appear as blank spaces.</p>
-<p> </p>
-<p><strong>Editing In Selection Areas</strong></p>
-Editing can be restricted to the current selection area.
-This allows the user to "Lock" the alignment either side of the selection
-area. Any gap insertions or deletions will only affect the current selection area.
-<p><img src="editing.jpg" width="428" height="186" align="top"></p>
-<p>In this example, if Sequence IL2RA_MACMU has gaps removed from position 98-104,
- the same number of gaps will be inserted at position 116, (between M and L).
-</p>
-<p><em>Locked selection area based editing was introduced in Jalview 2.08</em></p>
-<p> </p>
+ <p>
+ <strong>Editing</strong>
+ </p>
+ <p>
+ There are two major ways to edit alignments - in 'Normal mode', gaps
+ are inserted and deleted at the mouse pointer in various ways by
+ clicking the left mouse button and pressing a combination of either
+ shift and control (or the alt, option or apple key on Macs) and
+ dragging the mouse. Pressing <em>F2</em> toggles the alternative <a
+ href="../features/cursorMode.html"
+ >'Cursor mode'</a> keyboard editing facility, where the space bar and
+ delete keys add and remove gaps at the current editing position. The
+ key strokes for both these modes are summarised in the <a
+ href="../keys.html"
+ >keystrokes table</a>.
+ </p>
+ <p>
+ <strong>Tip:</strong> For large alignments, deselect "Calculate
+ -> Autocalculate Consensus" to prevent the alignment
+ performing lengthy calculations after every edit.
+ </p>
+ <p>
+ <em>Inserting / removing gaps</em> - hold down the "Shift"
+ key. Click on a residue with the mouse and drag it to the left or
+ right to insert gaps and remove gaps.<br> If the current
+ selection is a group over all sequences in the alignment, or a group
+ over some sequences or all columns in the alignment, then hold down
+ either "Control" key (or the "Alt;" on OSX if
+ "Control" does not work) and drag the residue left or
+ right to edit all sequences in the defined group at once.
+ </p>
+ <p>
+ <em>Copy/paste/cut/delete</em> - any sequences which are in the
+ current selection box (indicated in red) may be cut and / or copied
+ to a new alignment or deleted.
+ </p>
+ <p>
+ <em>Undo / redo</em> - editing of sequences (insertion/removal of
+ gaps, removal of sequences, trimming sequences etc) may be undone or
+ redone at any time using the appropriate menu items from the edit
+ menu. The undo history list only allows a maximum of 10 actions.
+ <p>
+ <em>Trimming alignment</em> - First select a column by clicking the
+ scale indicator (above the sequences) The alignment may then be
+ trimmed to the left or right of this column. If multiple columns are
+ selected, the alignment is trimmed to the right of the rightmost
+ selected column (or to the left of the leftmost selected column)
+ </p>
+ <p>
+ <em>Remove gapped columns</em> - Removes columns within the
+ alignment which contain only space characters ("-" or
+ "." or " ")
+ </p>
+ <p>
+ <em>Removing gaps</em> - Removes all gaps from the alignment. Gaps
+ are "-" or "." or " ".
+ </p>
+ <p>
+ <em>Set gap character</em> - Switches the gap character between
+ "." and "-". If the "Render Gaps"
+ option from the "View" menu is unticked all gaps will
+ appear as blank spaces.
+ </p>
+ <p> </p>
+ <p>
+ <strong>Editing In Selection Areas</strong>
+ </p>
+ Editing can be restricted to the current selection area. This allows
+ the user to "Lock" the alignment either side of the
+ selection area. Any gap insertions or deletions will only affect the
+ current selection area.
+ <p>
+ <img src="editing.jpg" width="428" height="186" align="top">
+ </p>
+ <p>In this example, if Sequence IL2RA_MACMU has gaps removed from
+ position 98-104, the same number of gaps will be inserted at
+ position 116, (between M and L).</p>
+ <p>
+ <em>Locked selection area based editing was introduced in
+ Jalview 2.08</em>
+ </p>
+ <p> </p>
</body>
</html>
diff --git a/help/html/features/AnnotationColumnSelectionWithSM.gif b/help/html/features/AnnotationColumnSelectionWithSM.gif
new file mode 100644
index 0000000..4373493
Binary files /dev/null and b/help/html/features/AnnotationColumnSelectionWithSM.gif differ
diff --git a/help/html/features/AnnotationColumnSelectionWithoutSM.gif b/help/html/features/AnnotationColumnSelectionWithoutSM.gif
new file mode 100644
index 0000000..921f028
Binary files /dev/null and b/help/html/features/AnnotationColumnSelectionWithoutSM.gif differ
diff --git a/help/html/features/annotation.html b/help/html/features/annotation.html
index 4e4ea73..078dc8b 100644
--- a/help/html/features/annotation.html
+++ b/help/html/features/annotation.html
@@ -1,21 +1,24 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head><title>Alignment Annotation</title></head>
<body>
<p><strong>Alignment Annotation</strong></p>
@@ -27,11 +30,24 @@
Annotation</strong> is not ticked). Any displayed annotation row can be hidden (using the pop-up
menu obtained by right-clicking the label), or re-ordered by dragging the label to a new
position with the left mouse button.</p>
-<p>Web services can also add annotation to an alignment (see the
- <a href="../webServices/jnet.html">JNet web service</a>), and as of Jalview 2.08 quantitative and symbolic
- annotations can be added to an alignment via an <a href="annotationsFormat.html">Annotations
- File</a> dragged into the alignment window or loaded from the
- alignment's file menu.</p>
+<p>
+Web services can also add annotation to an alignment (see the <a
+href="../webServices/jnet.html">JNet</a> and <a
+href="../webServices/proteinDisorder.html">Disorder</a> protein
+structure prediction services), and as of Jalview 2.08 quantitative
+and symbolic annotations can be added to an alignment via an <a
+href="annotationsFormat.html">Annotations File</a> dragged into the
+alignment window or loaded from the alignment's file menu.
+</p>
+<p><a name="seqannots"/><strong>Sequence Reference Annotation</strong>
+</p>
+<p>
+ Sequence reference annotation is created from 3D structure
+ data, and from the results of sequence based prediction of
+ <a href="../webServices/jnet.html">secondary structure</a> and <a
+ href="../webServices/proteinDisorder.html">disordered region</a>
+ prediction methods.
+</p>
<p><strong>Interactive Alignment Annotation</strong></p>
<p>
Annotation rows are added using the <strong>Annotation Label</strong>
@@ -39,16 +55,23 @@ menu, which is obtained by clicking anywhere on the annotation row labels
area (below the sequence ID area).
</p>
<ul>
- <li>Add New Row<br>
+ <li><strong>Add New Row</strong><br>
<em>Adds a new, named annotation row (a dialog box will pop up for you to
enter the label for the new row). </em> </li>
- <li>Hide Row<br>
+ <li><strong>Edit Label/Description</strong><br>
+ <em>This opens a dialog where you can change the name (displayed label), or the description
+ (as shown on the label tooltip) of the clicked annotation. </em> </li>
+ <li><strong>Hide This Row</strong><br>
<em>Hides the annotation row whose label was clicked in order to bring up
the menu.</em> </li>
- <li>Delete Row<br>
+ <li><strong>Hide All <em><label></em></strong><br>
+ <em>Hides all annotation rows whose label matches the one clicked.
+ (This option is only shown for annotations that relate to individual sequences,
+ not for whole alignment annotations. Since Jalview 2.8.2.)</em> </li>
+ <li><strong>Delete This Row</strong><br>
<em>Deletes the annotation row whose label was clicked in order to bring up
the menu.</em> </li>
- <li>Show All Hidden Rows<br>
+ <li><strong>Show All Hidden Rows</strong><br>
<em>Shows all hidden annotation rows.</em> </li>
<li><strong>Export Annotation</strong> <em>(Application only)</em><br>
<em>Annotations can be saved to file or output to a text window in either the
@@ -82,6 +105,16 @@ arrow oriented from left to right), and optional text label (see
below). A dialog box will open for you to enter the text. Consecutive
arrows will be joined together to form a single green arrow.</em>
</li>
+<li><a name="rna">RNA Helix</a> (only shown when working with nucleotide sequences)<br>
+<em>Mark selected positions as participating in a base pair
+either upstream or downstream. When the dialog box opens, enter a
+'(' to indicate these bases pair with columns upstream (to right),
+and ')' to indicate this region pairs with bases to the left of the
+highlighted columns.<br />If any brackets do not match up, then an
+orange square will highlight the first position where a bracket was
+found not to match.
+</em>
+</li>
<li>Label<br><em>Set the text label at the selected positions. A
dialog box will open for you to enter the text. If
more that one consecutive position is marked with the same label, only
@@ -99,7 +132,7 @@ href="../features/jalarchive.html">Jalview Archives</a>.
</p>
<p><em>Current Limitations</em></p>
<p>As of version 2.5, the Jalview user interface does not support the
-creation and editing quantitative annotation (histograms and line graphs), or
+creation and editing of quantitative annotation (histograms and line graphs), or
to create annotation associated with a specific sequence. It is also incapable of
annotation grouping or changing the style of existing annotation (to change between line or bar charts, or to make multiple line graphs). These annotation capabilities are only possible by the import of an
<a href="annotationsFormat.html">Annotation file</a>.<br>
diff --git a/help/html/features/annotationsFormat.html b/help/html/features/annotationsFormat.html
index 3705569..afd3586 100644
--- a/help/html/features/annotationsFormat.html
+++ b/help/html/features/annotationsFormat.html
@@ -1,193 +1,412 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>The Alignment Annotations File</title>
</head>
<body>
-<p><strong>The Alignment Annotations File</strong></p>
-<p>Alignment annotations can be imported onto an alignment since
-version 2.08 of Jalview, via an annotations file. It is a simple ASCII
-text file consisting of tab delimited records similar to the <a
- href="featuresFormat.html">Sequence Features File</a>, and introduced
-primarily for use with the Jalview applet.</p>
-<p>Alignment annotations files are imported into Jalview in the
-following ways:<br>
-<ul>
- <li>from the command line<strong><pre>
+ <p>
+ <strong>The Alignment Annotations File</strong>
+ </p>
+ <p>
+ Alignment annotations can be imported onto an alignment since
+ version 2.08 of Jalview, via an annotations file. It is a simple
+ ASCII text file consisting of tab delimited records similar to the <a
+ href="featuresFormat.html"
+ >Sequence Features File</a>, and introduced primarily for use with the
+ Jalview applet.
+ </p>
+
+ <p>
+ <strong>Importing annotation files</strong><br /> Alignment
+ annotations files are imported into Jalview in the following ways:<br />
+ <ul>
+ <li>from the command line<strong><pre>
-annotations <<em>Annotations filename</em>></pre></strong></li>
- <li>Dragging an annotations file onto an alignment window</li>
- <li>Via the "Load Features / Annotations" entry in the <strong>File</strong>
- menu of an alignment window.</li>
-</ul>
-</p>
-<p><h3><font face="Arial, Helvetica, sans-serif">Format of an Annotations File</font></h3>
-<p>The file consists of lines containing an instruction followed by
-tab delimited fields, and any lines starting with "#" are
-ignored. The first non-commented out line of a valid Annotations file
-must begin with :<strong><pre>JALVIEW_ANNOTATION</pre></strong></p>
-<p>A row of annotation is added with a line like <strong><pre><em>GRAPH_TYPE</em> <em>Label</em> <em>Description</em> (optional) <em>Values</em></pre></strong></p>
- <p>
- The <em>GRAPH_TYPE</em> field, which appears first, defines the
- appearance of the annotation row when rendered by Jalview. The next
- field is the row <em>label</em> for the annotation. This may be
- followed by a <em>description</em> for the row, which is shown in a
- tooltip when the user mouses over the annotation row's label. Since
- Jalview 2.7, the description field may also contain html in the same
- way as a <a href="featuresFile.html">sequence feature's</a> label,
- providing the html is enclosed in an <html/> tag.
-
- <ul><em>Please note: URL links embedded in HTML descriptions will
- be supported in a future release of Jalview</em>
- </ul>
- </p>
- <p>The final <em>Values</em>
- field contains a series of "|" separated value fields. Each
- value field is itself a comma separated list of fields of a particular
- type defined by the annotation row's GRAPH_TYPE. The allowed values of
- GRAPH_TYPE and the format of their respective value fields (with the
- trailing "<strong>|</strong>" symbol) are shown below:
-
- <ul>
- <li>BAR_GRAPH<br> Plots a histogram with labels below each
- bar.<br> <em>number</em>,<em>text character</em>,<em>Tooltip
- text</em>
- </li>
- <li>LINE_GRAPH<br> Draws a line between values on the
- annotation row.<br> <em>number</em>
- </li>
- <li>NO_GRAPH<br> For a row consisting of text labels and/or
- secondary structure symbols.<br> <em>{Secondary Structure
- Symbol}</em>,<em>text label</em>,<em>Tooltip text</em><br> Currently
- supported secondary structure structure symbols are <em>H</em> (for
- helix) and <em>E</em> (for strand)</li>
- </ul>
- Any or all value fields may be left empty, as well as the BAR_GRAPH's
-text character field, and either or both of the text-label and secondary
-structure symbol fields of the NO_GRAPH type annotation rows.</p>
-<p>Color strings can be embedded in a value field by enclosing an RGB triplet in square brackets to colour that position in an annotation row.
-</p>
-<p><h3><font face="Arial, Helvetica, sans-serif">SEQUENCE_REF and GROUP_REF</font></h3>
- By
- default, annotation is associated with the alignment as a whole.
- However, it is also possible to have an annotation row associated with
- a specific sequence, or a sequence group. Clicking the annotation
- label for sequence or group associated annotation will highlight the
- associated rows in the alignment, and double clicking will select
- those rows, allowing further analysis. While group associated
- annotation remains associated with a particular alignment, sequence
- associated annotation can move with a sequence - so copying a sequence
- to another alignment will also copy its associated annotation.
- </p>
- <p>You can associate an annotation with a sequence by preceding its
-definition with the line:
-<pre>SEQUENCE_REF <em>seq_name</em> <em>[startIndex]</em></pre>
-All Annotations defined after a SEQUENCE_REF command will then be
-associated with that sequence, and the first field in the Value field
-list will (optionally) be placed at the <em>startIndex</em>'th column.</p>
+ <li>Dragging an annotations file onto an alignment window</li>
+ <li>Via the "Load Features / Annotations" entry in
+ the <strong>File</strong> menu of an alignment window.
+ </li>
+ </ul>
+ </p>
+ <p>
+ <strong>Exporting annotation files</strong><br /> An annotation
+ file can be created for any alignment view from the "Export
+ Annotations ..." entry in the <strong>File</strong> menu of an
+ alignment window.
+ </p>
+ <p>
+ <strong>THE ANNOTATION FILE FORMAT</strong> <br />An annotation file
+ consists of lines containing an instruction followed by tab
+ delimited fields. Any lines starting with "#" are
+ considered comments, and ignored. The sections below describe the
+ structure of an annotation file.
+ </p>
+ <ul>
+ <li><a href="#annheader">JALVIEW_ANNOTATION</a> mandatory
+ header</li>
+ <li><a href="#annrows">LINE_GRAPH, BAR_GRAPH and NO_GRAPH</a>
+ to create annotation rows</li>
+ <li><a href="#combine">COMBINE, COLOUR and GRAPHLINE</a> for
+ thresholds and complex line graphs</li>
+ <li><a href="#annrowprops">ROWPROPERTIES</a> control the
+ display of individual annotation rows</li>
+ <li><a href="#groupdefs">SEQUENCE_GROUP</a> to define groups of
+ sequences for further annotation</li>
+ <li><a href="#groupprops">PROPERTIES</a> to set visualisation
+ properties for sequence groups</li>
+ <li><a href="#seqgrprefs">SEQUENCE_REF and GROUP_REF</a> for
+ specifying target sequences and groups for annotation, reference
+ sequence and column visibilty commands.</li>
+ <li><a href="#refsandviews">VIEW_SETREF, VIEW_HIDECOLS and
+ HIDE_INSERTIONS</a> for assigning the reference sequence on the
+ alignment and hiding columns.</li>
+ </ul>
+ <p>
+ At the end of this document, you can also find notes on <a
+ href="#compatibility"
+ >compatibility</a> of annotation files across different versions of
+ Jalview. An <a href="#exampleann">example annotation file</a> is
+ also provided along with instructions on how to import it to
+ Jalview.
+ </p>
+ <hr />
+ <p>
+ <strong><em><a name="annheader">Header line</a></em></strong><br />The
+ first non-commented out line of a valid Annotations file must begin
+ with :<strong><pre>JALVIEW_ANNOTATION</pre></strong>
+ </p>
+ <hr />
+ <p>
+ <strong><em><a name="annrows">LINE_GRAPH,
+ BAR_GRAPH and NO_GRAPH</a></em></strong><br /> Labels, secondary structure,
+ histograms and line graphs are added with a line like <strong><pre>
+ <em>GRAPH_TYPE</em> <em>Label</em> <em>Description</em> (optional) <em>Values</em>
+ </pre></strong>
+ </p>
+ <p>
+ Here, the <em>GRAPH_TYPE</em> field in the first column defines the
+ appearance of the annotation row when rendered by Jalview. The next
+ field is the row <em>label</em> for the annotation. This may be
+ followed by a <em>description</em> for the row, which is shown in a
+ tooltip when the user mouses over the annotation row's label. Since
+ Jalview 2.7, the description field may also contain HTML tags (in
+ the same way as a <a href="featuresFile.html">sequence feature's</a>
+ label), providing the text is enclosed in an <html/> tag.
+ <ul>
+ <em>Please note: URL links embedded in HTML descriptions are
+ not yet supported.</em>
+ </ul>
+ </p>
+ <p>
+ The final <em>Values</em> field contains a series of "|"
+ separated value fields. Each value field is itself a comma separated
+ list of fields of a particular type defined by the annotation row's
+ <em>GRAPH_TYPE</em>. The allowed values of <em>GRAPH_TYPE</em> and
+ corresponding interpretation of each <em>Value</em> are shown below:
-<p>Sequence associations are turned off for subsequent annotation
-definitions by:
-<pre>SEQUENCE_REF ALIGNMENT</pre>
-</p>
-<p>Similarly, since Jalview 2.5, group associated annotation can be defined by preceding the row definitions with the line:
-<pre>GROUP_REF <em>group_name</em></pre>
-Group association is turned off for subsequent annotation rows by:
-<pre>GROUP_REF <em>ALIGNMENT</em></pre>
-</p>
-<h3><font face="Arial, Helvetica, sans-serif">LINE_GRAPH Grouping</font></h3>
-<p><em>LINE_GRAPH</em> type annotations can be given a colour
-(specified as 24 bit RGB triplet in hexadecimal or comma separated
-values), combined onto the same vertical axis, and have ordinate lines
-(horizontal lines at a particular vertical axis value) using the
-following commands (respectively):
-<pre>COLOUR <em>graph_name</em> <em>colour</em>
+
+ <ul>
+ <li><strong>BAR_GRAPH</strong><br> Plots a histogram with
+ labels below each bar.<br> <em>number</em>,<em>text
+ character</em>,<em>Tooltip text</em></li>
+ <li><strong>LINE_GRAPH</strong><br> Draws a line between
+ values on the annotation row.<br> <em>number</em></li>
+ <li><strong>NO_GRAPH</strong><br>For a row consisting of
+ text labels and/or secondary structure symbols.<br> <em>{Secondary
+ Structure Symbol}</em>,<em>text label</em>,<em>Tooltip text</em><br />
+ <br />The type of secondary structure symbol depends on the
+ alignment being annotated being either Protein or RNA. <br />For
+ proteins, structure symbols are <em>H</em> (for helix) and <em>E</em>
+ (for strand)<br /> <br />For RNA structures, VIENNA, WUSS, and
+ extended notations can be used to specify paired positions.
+ <ul>e.g. "(|(||)|)" or
+ "|A|A|A|(|a|a|a|)")
+ </ul></li>
+ </ul>
+ Any or all value fields may be left empty, as well as the BAR_GRAPH's
+ text character field, and either or both of the text-label and
+ secondary structure symbol fields of the NO_GRAPH type annotation
+ rows.
+ </p>
+ <p>Color strings can be embedded in a value field by enclosing an
+ RGB triplet in square brackets to colour that position in an
+ annotation row.</p>
+ <hr />
+ <p>
+ <strong><a name="combine">COMBINE, COLOUR and GRAPHLINE</a>
+ for line graphs</font></strong><br /> <em>LINE_GRAPH</em> type annotations can be
+ given a colour (specified as 24 bit RGB triplet in hexadecimal or
+ comma separated values), combined onto the same vertical axis, and
+ have ordinate lines (horizontal lines at a particular vertical axis
+ value) using the following commands (respectively):
+ <pre>COLOUR <em>graph_name</em> <em>colour</em>
COMBINE <em>graph_1_name</em> <em>graph_2_name</em>
GRAPHLINE <em>graph_name</em> <em>value</em> <em>label</em> <em>colour</em><strong><em>
-</em></strong></pre>
-</p>
-<h3><font face="Arial, Helvetica, sans-serif">(Since Jalview 2.5) ROWPROPERTIES</font></h3>
-<p>The visual display properties for a set of annotation rows can be modified using the following tab-delimited line:</p>
-<pre>ROWPROPERTIES <em>Row label</em> <em>centrelabs=true( or false)</em> <em>showalllabs=true(default is false)</em> <em>scaletofit=true (default is false)</em></pre>
-<p>This sets the visual display properties according to the given values for all the annotation rows with labels matching <em>Row label</em>. The properties mostly affect the display of multi-character column labels, and are as follows:
-<ul><li><em>centrelabs</em> Centre each label on its column.</li>
-<li><em>showalllabs</em> Show every column label rather than only the first of a run of identical labels (setting this to true can have a drastic effect on secondary structure rows).</li>
-<li><em>scaletofit</em> Shrink each label's font size so that the label fits within the column. Useful when annotating an alignment with a specific column numbering system. (<em>Not available in Jalview applet due to AWT 1.1 limitations</em>)</li>
-</ul></p>
-<h3><font face="Arial, Helvetica, sans-serif">(Since Jalview 2.2.1) SEQUENCE_GROUP</font></h3>
-<p>Groups of sequences can be defined using the tab delimited line</p>
-<pre>SEQUENCE_GROUP Group_Name Group_Start Group_End Sequences</pre>
-<p>The sequences can be defined by alignment index and a range of sequences can
- be defined in a comma delimited field such as</p>
-<p>2-5,8-15,20,22</p>
-<p>Enter * to select all groups. </p>
-<p>If the alignment indices are not known, enter -1 then a tab delimited list
- of sequence ids. </p>
-<p>If the SEQUENCE_REF has been defined, the group_start and group_end will be
- relative to the sequence residue numbering, otherwise the group_start and group_end
- will be the alignment column indices. </p>
-<p>The group can (optionally) be assigned various visualisation properties via
- another tab delimited line thus:</p>
-<pre>PROPERTIES Group_name tab_delimited_key_value_pairs
+</em></strong>
+ </pre>
+ </p>
+ <hr />
+ <p>
+ <strong><a name="annrowprops">ROWPROPERTIES</a></strong><br /> The
+ visual display properties for a set of annotation rows can be
+ modified using the following tab-delimited line:
+ </p>
+ <pre>ROWPROPERTIES <em>Row label</em> <em>centrelabs=true( or false)</em> <em>showalllabs=true(default is false)</em> <em>scaletofit=true (default is false)</em>
+ </pre>
+ <p>
+ This sets the visual display properties according to the given
+ values for all the annotation rows with labels matching <em>Row
+ label</em>. The properties mostly affect the display of multi-character
+ column labels, and are as follows:
+ <ul>
+ <li><em>centrelabs</em> Centre each label on its column.</li>
+ <li><em>showalllabs</em> Show every column label rather than
+ only the first of a run of identical labels (setting this to true
+ can have a drastic effect on secondary structure rows).</li>
+ <li><em>scaletofit</em> Shrink each label's font size so that
+ the label fits within the column. Useful when annotating an
+ alignment with a specific column numbering system. (<em>Not
+ available in Jalview applet due to AWT 1.1 limitations</em>)</li>
+ </ul>
+ </p>
+ <p>
+ <strong><a name="groupdefs">SEQUENCE_GROUP</a></strong><br /> Groups
+ of sequences and column ranges can be defined using a tab delimited
+ statement like:
+ </p>
+ <pre>SEQUENCE_GROUP Group_Name Group_Start Group_End <em>Sequences</em>
+ </pre>
+ <p>The sequences can be defined by alignment index and a range of
+ sequences can be defined in a comma delimited field such as</p>
+ <p>2-5,8-15,20,22</p>
+ <p>Enter * to select all groups.</p>
+ <p>
+ <strong>Note:</strong> If the alignment indices are not known, enter
+ -1, followed by a tab and then a tab delimited list of sequence IDs.
+ </p>
+ <p>
+ If a <a href="#seqgrprefs"><strong>SEQUENCE_REF</strong></a> has
+ been defined, then <em>group_start</em> and <em>group_end</em> will
+ be relative to the sequence residue numbering, otherwise the <em>group_start</em>
+ and <em>group_end</em> will be alignment column indices.
+ </p>
+ <hr />
+ <p>
+ <strong><a name="groupprops">PROPERTIES</a></strong><br />This
+ statement allows various visualisation properties to be assigned to
+ a named group. This takes a series of tab-delimited <em>key</em>=<em>value</em>
+ pairs:
+ </p>
+ <pre>PROPERTIES Group_name tab_delimited_key_value_pairs
</pre>
-<p>The key_value_pairs allow you to define a description and to colour the group
- in various ways. All, none or some of the following values could be used for
- a group:</p>
-<p>description=Text <br>
- colour=Helix Propensity<br>
- pidThreshold=0<br>
- consThreshold=0<br>
- outlineColour=red <br>
- displayBoxes=true<br>
- displayText=false<br>
- colourText=false<br>
- textCol1=black<br>
- textCol2=black<br>
- textColThreshold=0<br>
- idColour=ff3322<br>
- <!-- Not yet implemented in 2.5 release
- hide=false<br>
- hidecols=false<br> -->
- showunconserved=false</p>
-<ul><li><em>New Features in 2.4:</em><br>if the <strong>idColour</strong> property
-is given without specifying a colour scheme with the <strong>colour</strong>
-property, then the idColour will also be used to colour the sequence.</li>
-<li>the <strong>colour</strong> property can take either a colour scheme name,
- or a single colour specification (either a colour name like 'red' or an RGB
- triplet like 'ff0066'). If a single colour is specified, then the group
- will be coloured with that colour.</li>
- <!-- <li><em>New Features in 2.5</em></li>
- <li>hide and hidecols instruct jalview to hide the sequences or columns covered by the group.</li> -->
- <li>Sequence associated Groups<br>If a group is defined after a valid
- <em>SEQUENCE_REF</em> sequence reference statement, the sequence representative
- for the group will be set to the referenced sequence.<!-- <br><strong>Note:</strong> if the <em>hide</em>
- property is set then only the representative sequence for the group will be shown in the alignment.--></li>
-</ul>
-<p> </p>
-<p>An example Annotation file is given below:
-<pre>#Comment lines follow the hash symbol
+ <p>The currently supported set of sequence group key-value pairs
+ that can be provided here are :</p>
+ <table border="1">
+ <tbody>
+ <tr>
+ <td width="50%">Key</td>
+ <td>Value</td>
+ </tr>
+ <tr>
+ <td width="50%">description</td>
+ <td>Text - may include simple HTML tags</td>
+ </tr>
+ <tr>
+ <td width="50%">colour</td>
+ <td>A string resolving to a valid Jalview colourscheme
+ (e.g. Helix Propensity)</td>
+ </tr>
+ <tr>
+ <td width="50%">pidThreshold</td>
+ <td>A number from 0-100 specifying the Percent Identity
+ Threshold for colouring columns in the group or alignment</td>
+ </tr>
+ <tr>
+ <td width="50%">consThreshold</td>
+ <td>A number from 0-100 specifying the degree of bleaching
+ applied for conservation colouring</td>
+ </tr>
+ <tr>
+ <td width="50%">outlineColour</td>
+ <td>Line colour used for outlining the group (default is
+ red)</td>
+ </tr>
+ <tr>
+ <td width="50%">displayBoxes</td>
+ <td>Boolean (default true) controlling display of shaded
+ box for each alignment position</td>
+ </tr>
+ <tr>
+ <td width="50%">displayText</td>
+ <td>Boolean (default true) controlling display of text for
+ each alignment position</td>
+ </tr>
+ <tr>
+ <td width="50%">colourText</td>
+ <td>Boolean (default false) specifying whether text should
+ be shaded by applied colourscheme</td>
+ </tr>
+ <tr>
+ <td width="50%">textCol1</td>
+ <td>Colour for text when shown on a light background</td>
+ </tr>
+ <tr>
+ <td width="50%">textCol2</td>
+ <td>Colour for text when shown on a dark background</td>
+ </tr>
+ <tr>
+ <td width="50%">textColThreshold</td>
+ <td>Number from 0-100 specifying switching threshold
+ between light and dark background</td>
+ </tr>
+ <tr>
+ <td width="50%">idColour</td>
+ <td>Colour for highlighting the Sequence ID labels for this
+ group<br />If <em>idColour</em> is given but <em>colour</em>
+ is not, then idColor will also be used for the group
+ background colour.
+ </td>
+ </tr>
+ <tr>
+ <td width="50%">showunconserved</td>
+ <td>Boolean (default false) indicating whether residues
+ should only be shown that are different from current reference
+ or consensus sequence</td>
+ </tr>
+ <tr>
+ <td width="50%">hide</td>
+ <td>Boolean (default false) indicating whether the rows in
+ this group should be marked as hidden.<br />
+ <em>Note:</em> if the group is sequence associated (specified by
+ SEQUENCE_REF), then all members will be hidden and marked as
+ represented by the reference sequence.
+ </td>
+ </tr>
+ <!-- <tr><td width="50%">hidecols</td><td>Boolean (default false) indicating whether columns in this groushould be marked as hidden</td></tr> -->
+ </tbody>
+ </table>
+
+ <p>
+ <strong>Specifying colours in PROPERTIES key-value pairs</strong><br />
+ The <strong>colour</strong> property can take either a colour scheme
+ name, or a single colour specification (either a colour name like
+ 'red' or an RGB triplet like 'ff0066'). If a single colour is
+ specified, then the group will be coloured with that colour.
+ </p>
+ <hr />
+ <p>
+ <strong><a name="seqgrprefs">SEQUENCE_REF and GROUP_REF</a></strong><br />
+ By default, annotation is associated with the alignment as a whole.
+ However, it is also possible to have an annotation row associated
+ with a specific sequence, or a sequence group. Clicking the
+ annotation label for sequence or group associated annotation will
+ highlight the associated rows in the alignment, and double clicking
+ will select those rows, allowing further analysis. While group
+ associated annotation remains associated with a particular
+ alignment, sequence associated annotation can move with a sequence -
+ so copying a sequence to another alignment will also copy its
+ associated annotation.
+ </p>
+ <p>You can associate an annotation with a sequence by preceding
+ its definition with the line:
+ <pre>SEQUENCE_REF <em>seq_name</em> <em>[startIndex]</em>
+ </pre>
+ All Annotations defined after a SEQUENCE_REF command will then be
+ associated with that sequence, and the first field in the Value field
+ list will (optionally) be placed at the
+ <em>startIndex</em>'th column.
+ </p>
+
+ <p>Sequence associations are turned off for subsequent annotation
+ definitions by:
+ <pre>SEQUENCE_REF ALIGNMENT</pre>
+ </p>
+ <p>Similarly, since Jalview 2.5, group associated annotation can
+ be defined by preceding the row definitions with the line:
+ <pre>GROUP_REF <em>group_name</em>
+ </pre>
+ Group association is turned off for subsequent annotation rows by:
+ <pre>GROUP_REF <em>ALIGNMENT</em>
+ </pre>
+ </p>
+ <hr />
+ <p>
+ <strong><a name="refsandviews">VIEW_SETREF,
+ VIEW_HIDECOL and HIDE_INSERTIONS</a></strong><br /> Since Jalview 2.9, the
+ Annotations file has also supported the definition of reference
+ sequences and hidden regions for an alignment view.
+ </p>
+ <!-- <p>
+ <em>VIEW_DEF</em> allows the current view to be named according to the
+ first argument after the tab character. If a second argument is
+ provided, then a new view is created with the given name, and
+ properties.
+ </p> -->
+ <p>
+ <em>VIEW_SETREF</em><br />Marks the first sequence in the
+ alignment, or alternately, the one specified by the most recent <em>SEQUENCE_REF</em>
+ statement, as the <a href="../calculations/referenceseq.html">reference
+ sequence</a> for the alignment.
+ </p>
+ <p>
+ <em>HIDE_INSERTIONS</em><br />This command hides all gapped
+ positions in the current target sequence. Any columns already hidden
+ will be re-displayed.<br /> <br>The current target sequence is
+ either the one specified by the most recent <em>SEQUENCE_REF</em>
+ statement, the alignment's reference sequence, or the first sequence
+ in the alignment.
+ </p>
+ <p>
+ <em>VIEW_HIDECOLS</em><br />Modifies the visibility of columns in
+ the view. The statement is followed by a single argument consisting
+ of a comma separated series of single integers or integer pairs
+ (like <em>3-4</em>). These define columns (starting from the
+ left-hand column 0) that should be marked as hidden in the alignment
+ view.
+ </p>
+
+ <hr />
+ <p>
+ <strong><a name="compatibility">COMPATIBILITY NOTES</a></strong><br />
+ The interpretation of the COMBINE statement in <em>Version
+ 2.8.1</em> was refined so that only annotation line graphs with the
+ given names ands the same <strong>SEQUENCE_REF</strong> and <strong>GROUP_REF</strong>
+ scope are grouped.
+ </p>
+ <hr />
+
+ <p>
+ <strong><a name="exampleann">EXAMPLES</a></strong><br /> An example
+ Annotation file is given below. Copy and paste the contents into a
+ text file and load it onto the Jalview example protein alignment.
+ </p>
+ <pre>#Comment lines follow the hash symbol
JALVIEW_ANNOTATION
SEQUENCE_REF FER1_MESCR 5
BAR_GRAPH Bar Graph 1 <html>an <em>html tooltip</em> for Bar graph 1.</html> ||-100,-|-200,-|-300,-|-400,-|200,+|300,+|150,+
LINE_GRAPH Green Values 1.1|2.2|1.3|3.4|0.7|1.4|3.3|2.2|2.1|-1.1|3.2
LINE_GRAPH Red Values 2.1|3.2|1.3|-1.4|5.5|1.4|1.3|4.2|-1.1|1.1|3.2
-BAR_GRAPH Bar Graph 2 1,.|2,*|3,:|4,.|5,*|4,:|3,.|2|1|1|2|3|4|5|4
+BAR_GRAPH Bar Graph 2 1,.|2,*|3,:|4,.|5,*|4,:|3,.|2|1|1|2|3|4|5|4
NO_GRAPH Icons ||||E,Sheet1|E|E||||H,Sheet 2|H|H|H||||||
NO_GRAPH Purple Letters m|y|p|r|o|t|e|i|n
COLOUR Bar Graph 2 blue
@@ -197,13 +416,13 @@ COLOUR Purple Letters 151,52,228
COMBINE Green Values Red Values
GRAPHLINE Red Values 2.6 threshold black
-SEQUENCE_GROUP Group_A 30 50 *
-SEQUENCE_GROUP Group_B 1 351 2-5
-SEQUENCE_GROUP Group_C 12 14 -1 seq1 seq2 seq3
-PROPERTIES Group_A description=This is the description colour=Helix Propensity pidThreshold=0 outlineColour=red displayBoxes=true displayText=false colourText=false textCol1=black textCol2=black textColThreshold=0
-PROPERTIES Group_B outlineColour=red
-PROPERTIES Group_C colour=Clustal
+SEQUENCE_GROUP Group_A 30 50 *
+SEQUENCE_GROUP Group_B 1 351 2-5
+SEQUENCE_GROUP Group_C 12 14 -1 seq1 seq2 seq3
+PROPERTIES Group_A description=This is the description colour=Helix Propensity pidThreshold=0 outlineColour=red displayBoxes=true displayText=false colourText=false textCol1=black textCol2=black textColThreshold=0
+PROPERTIES Group_B outlineColour=red
+PROPERTIES Group_C colour=Clustal
</pre>
-</p>
+ </p>
</body>
</html>
diff --git a/help/html/features/bioJsonFormat.html b/help/html/features/bioJsonFormat.html
new file mode 100644
index 0000000..f1a5b4e
--- /dev/null
+++ b/help/html/features/bioJsonFormat.html
@@ -0,0 +1,83 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>BioJSON in Jalviwe</title>
+</head>
+<body>
+ <p>
+ <strong>BioJSON support in Jalview</strong>
+ </p>
+ <p>BioJSON is a JavaScript Object Notation (JSON) specification
+ for the representation and exchange of multiple sequence alignment
+ data.</p>
+ <p>
+ Jalview 2.9 includes support for reading and writing BioJSON v1.0
+ data directly, or embedded in HTML documents. It can also generate
+ HTML pages which employ the <a href="biojsmsa.html">BioJS MSA
+ viewer</a> for interactive display of BioJSON data.
+ </p>
+ <p>
+ <strong>Finding out more about BioJSON</strong>
+ </p>
+ <p>
+ The BioJSON specification is published at <a
+ href="http://jalview.github.io/biojson/"
+ >http://jalview.github.io/biojson/</a>.
+ </p>
+ <p>
+ <em>Import of BioJSON data from HTML pages</em>
+ </p>
+ <p>When importing embedded data in an HTML document, Jalview
+ searches for a hidden (usually) input or div element named
+ "seqData":</p>
+ <pre>
+ <code><div name="seqData" id="seqData" style="display: none;">#valid BioJSON data#</div></code>
+ </pre>
+ <strong>OR</strong>
+ <pre>
+ <code><input type="hidden" id="seqData" name="seqData" value='#valid BioJSON data#'/></code>
+ </pre>
+ <p>Jalview can also import BioJSON data directly.</p>
+
+ <p>
+ <strong>Jalview's Support for BioJSON v1.0</strong>
+ </p>
+ <p>BioJSON exports of an alignment view include the following
+ additional data:</p>
+ <ul>
+ <li>Alignment Annotations</li>
+ <li>Alignment Features</li>
+ <li>Alignment Sequences</li>
+ <li>Color Scheme</li>
+ <li>Hidden Columns</li>
+ <li>Hidden Sequences</li>
+ <li>Sequence Groups</li>
+ </ul>
+ <p>The following data are NOT currently preserved on export:</p>
+ <ul>
+ <li>Alignment Reference sequences</li>
+ <li>Representative sequence groups</li>
+ <li>Trees</li>
+ <li>3D Structures</li>
+ </ul>
+</body>
+</html>
diff --git a/help/html/features/biojsmsa.html b/help/html/features/biojsmsa.html
new file mode 100644
index 0000000..89180d5
--- /dev/null
+++ b/help/html/features/biojsmsa.html
@@ -0,0 +1,58 @@
+<html>
+<!--
+ *Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ *Copyright (C) 2015 The Jalview Authors
+ *
+ *This file is part of Jalview.
+ *
+ *Jalview is free software: you can redistribute it and/or
+ *modify it under the terms of the GNU General Public License
+ *as published by the Free Software Foundation, either version 3
+ *of the License, or (at your option) any later version.
+ *
+ *Jalview is distributed in the hope that it will be useful, but
+ *WITHOUT ANY WARRANTY; without even the implied warranty
+ *of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *PURPOSE. See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ *The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<title>BioJS MSA Viewer Export</title>
+<body>
+ <p>
+ <strong>Exporting Alignments for viewing with the BioJS MSA
+ Viewer</strong>
+ </p>
+ <p>
+ Since Jalview 2.9, HTML files can be generated from an alignment
+ within the Jalview desktop application that show the alignment in an
+ interactive viewer called 'BioJS-MSA'. These pages embed Jalview's
+ alignment data as <a href="bioJsonFormat.html">BioJSON</a>, which
+ can be imported back into Jalview, and also interpreted by the BioJS
+ MSA viewer. The BioJS MSA Viewer is a full-featured JavaScript based
+ multiple sequence alignment visualisation system created by a
+ community of biological data visualisation developers, and is
+ developed independently of Jalview.
+ </p>
+ <p>
+ To find out more about the BioJS MSA Viewer, please go to <a
+ href="http://msa.biojs.net/">http://msa.biojs.net/</a>.
+ </p>
+
+ <p>
+ <strong>Making sure your BioJS MSA export uses the latest
+ BioJS MSA Viewer</strong>
+ </p>
+ <p>In order to allow Jalview to export data with the latest
+ version of the MSA viewer, the Jalview Desktop will download
+ templates for HTML export from our public GitHub Repository.
+ Normally, this should happen without you needing to do anything, but
+ if you do encounter problems, then please get in contact via the
+ jalview-discuss mailing list, or file a bug report.</p>
+ <p>Templates are downloaded to a directory called
+ '.biojs_templates' in your user's home storage space (e.g.
+ ~/.biojs_templates).</p>
+</body>
+</html>
diff --git a/help/html/features/chimera.html b/help/html/features/chimera.html
new file mode 100644
index 0000000..e80d0e2
--- /dev/null
+++ b/help/html/features/chimera.html
@@ -0,0 +1,254 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>The Chimera PDB Viewer</title>
+</head>
+<body>
+ <p>
+ <strong>The Chimera Viewer</strong>
+ </p>
+ <p>
+ Since Jalview 2.8.2, <a href="http://www.cgl.ucsf.edu/chimera/">Chimera</a>
+ (http://www.cgl.ucsf.edu/chimera/) has been integrated into Jalview
+ for interactively viewing structures opened by entries in the <strong>"Structure"</strong>
+ submenu in the <a href="../menus/popupMenu.html">sequence id
+ pop-up menu</a> (if you can't see this, then you need to <a
+ href="viewingpdbs.html"
+ >associate a PDB structure</a> with the sequence). Chimera is
+ available from the Jalview desktop, provided Chimera has been
+ separately installed.
+ </p>
+ <p>
+ You can set a default choice of Jmol or Chimera structure viewer in
+ <a href="preferences.html#structure"> Preferences</a>. You can also
+ optionally specify the path to the Chimera program here (if it
+ differs from the standard paths searched by Jalview).
+ <p>
+ If you save your Jalview session as a project file, the state of any
+ open Chimera windows will also be saved, and can be reopened by
+ loading the project file on any machine with Chimera installed. <em>Since
+ Jalview 2.9.</em>
+ <!-- <p>The following menu entries are provided for viewing structure data<br>
+ <ul>
+ <li>The <strong>"Structure→View
+ Structure→</strong> submenu allows a single PDB structure to be chosen
+ for display from the available structures for a sequence.
+ </li>
+ <li>The <strong>"Structure→View all <em>N</em>
+ structures
+ </strong> option will open a new window containing all structures associated
+ with the current selection.
+ </li>
+ <li>The <strong>"Structure→View all <em>N</em>
+ representative structures
+ </strong> option will open a new window containing exactly one structure per
+ currently selected sequence.<br /></li>
+ </ul>
+ <br>
+</p> -->
+ <p>
+ <a name="align"><strong>Superposing structures based on
+ their aligned sequences</strong></a><br> If several structures are
+ available on the alignment, you may add additional structures to an
+ existing Chimera view by selecting their entry in the appropriate
+ pop-up menu. Jalview will ask you if you wish to add the structure
+ to the existing alignment, and if you do, it will import and
+ superimpose the new PDB file using the corresponding positions from
+ the alignment. If the alignment is subsequently edited, you can use
+ the <a href="#sAlign"><em>Chimera→Align</em></a> menu option
+ from the menu bar of the structure view window to superpose the
+ structures using the updated alignment.<br>
+ </p>
+ <p>
+ <strong>Chimera Controls</strong><br> The structure is by
+ default rendered as a ribbon diagram. Moving the mouse over the
+ structure brings up tooltips giving the residue name, PDB residue
+ number and chain code ([RES]Num:Chain). Moving the mouse over an
+ associated residue in an alignment window highlights the associated
+ atoms in the displayed structures. When residues are selected in the
+ Chimera window, they are highlighted on the alignment. For
+ comprehensive details of Chimera's commands, refer to the tool's
+ Help menu.
+ <p>
+ Basic screen operations (see <a
+ href="http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/mouse.html"
+ >Chimera help</a> at
+ http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/mouse.html
+ for full details).
+ <table border="1">
+ <tr>
+ <td><strong>Action</strong></td>
+ <td><strong>Windows</strong></td>
+ <td><strong>Unix</strong></td>
+ <td><strong>Mac/OSX</strong></td>
+ </tr>
+ <tr>
+ <td>Rotate View</td>
+ <td>Left Click and Drag</td>
+ <td>Left Click and Drag</td>
+ <td>Left Click and Drag</td>
+ </tr>
+ <tr>
+ <td>Zoom</td>
+ <td>Right Click<br> drag mouse up or down
+ </td>
+ <td>Right Click<br>drag mouse up or down
+ </td>
+ <td>cmd or Right + Click and drag mouse up or down, <br>or
+ use mouse scroll button
+ </td>
+ </tr>
+ <tr>
+ <td>Move Origin</td>
+ <td>Middle Button + Drag</td>
+ <td>Middle Button and drag</td>
+ <td>alt + Click<br> and drag
+ </td>
+ </tr>
+ <tr>
+ <td>Select Residues</td>
+ <td>Ctrl + Click (and drag to select a region)</td>
+ <td>Ctrl + Click (and drag)</td>
+ <td>Ctrl + Click (and drag)</td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <strong>Jalview Controls</strong>
+ <p>The Jalview Chimera View window has up to five menus:</p>
+ <ul>
+ <li><Strong>File<br>
+ </strong>
+ <ul>
+ <li><strong>View Mapping<br>
+ </strong><em> Opens a text window showing the alignment between the
+ residues corresponding to alpha-carbon atoms in the PDB
+ structure and the residues in the associated sequence.</em></li>
+ </ul></li>
+ <li><strong>View</strong>
+ <ul>
+ <li><strong>Show Chains<br>
+ </strong><em>Select which of the PDB file's chains (if more than
+ one) are to be displayed.</em></li>
+ <li><strong>Colour by ..<br></strong><em>Submenu
+ allowing specific alignment views to be selected for
+ colouring associated chains in the structure display. This
+ menu contains all the alignment views associated with the
+ structure view, with those used to colour the view indicated
+ by ticks. Addditionally, it contains the following menu
+ entries:</em>
+ <ul>
+ <li><strong>Select many views<br></strong><em>When
+ this option is enabled, selecting an alignment view adds
+ it to the set used to colour the structures. Use this
+ when colouring structures related to a number of
+ alignments involving different domains or chains which
+ are shown in the same structure view.</em></li>
+ <li><strong>Select all views<br></strong><em>This
+ is only enabled when </em><strong>Select many views</strong><em>
+ is also enabled, and will add all associated views to
+ the set used to colour the structure display.</em></li>
+ <li><strong>Invert selection<br></strong><em>This
+ is only enabled when </em><strong>Select many views</strong><em>
+ is also enabled, and will replace the current set of
+ views with any remaining views not currently used to
+ colour the structure display.</em></li>
+ </ul></li>
+ </ul>
+ <li><strong>Colours<br>
+ </strong>
+ <ul>
+ <li><strong>By Sequence<br>
+ </strong><em> Colours each residue in the structure with the colour
+ of its corresponding residue in the associated sequence as
+ rendered in the associated alignment views, including any
+ Uniprot sequence features or region colourings.<br />Pick
+ which of the associated alignment views are used to colour
+ the structures using the <strong>View→Colour
+ by ..</strong> sub menu.
+ </em><br> Residues which only exist in the PDB structure are
+ coloured white if they are insertions (relative to the
+ associated sequence in the alignment) and grey if they are N
+ or C terminal flanks outside the region mapped to the
+ alignment window's sequence.</em></li>
+ <li><strong>By Chain<br>
+ </strong><em>Uses the Chimera 'rainbow chain' command to apply a
+ different colour to each chain.</em></li>
+ <li><strong>Charge & Cysteine<br>
+ </strong><em> Highlights cysteines in yellow, anionic (Aspartic Acid
+ or Glutamic Acid) residues in red, and cationic (Lysine or
+ Arginine) residues in blue.</em></li>
+ <li><strong>Colour with Chimera<br></strong><em>Defers
+ any colouring operations to Chimera. Select this if you want
+ to use the Chimera scripting interface or menu to modify the
+ view directly.</em></li>
+ <li><strong>Standard and User Defined Jalview
+ colourschemes.<br>
+ </strong><em>The remaining entries apply the colourschemes available
+ from the standard and user defined <a
+ href="../colourSchemes/index.html"
+ >amino acid colours</a>.
+ </em></li>
+ </ul></li>
+ <li><strong>Chimera<br>
+ </strong><em>This pulldown menu is only displayed if there are multiple
+ structures shown in the Chimera window, and Jalview can also
+ locate at least two of the structures in the currently
+ associated alignment view.</em>
+ <ul>
+ <li><strong><a name="sAlign">Align</a> <br> </strong><em>
+ When selected, the associated alignment will be used to
+ superimpose all the structures in the view onto the first
+ structure in the alignment. The regions used to calculate
+ the superposition will be highlighted using the 'Cartoon'
+ rendering style, and the remaining data shown as a chain
+ trace.<br>
+ </em></li>
+ </ul></li>
+ <li><strong>Help<br>
+ </strong>
+ <ul>
+ <li><strong>Chimera Help<br>
+ </strong><em>Access the Chimera Help documentation in a new browser
+ window.</em></li>
+ </ul></li>
+ </ul>
+ <p>
+ <strong>Chimera and Windows Firewall</strong>
+ </p>
+ Jalview and Chimera communicate using Chimera's
+ <a
+ href="http://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/restserver/restserver.html"
+ >REST service</a>
+ (http://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/restserver/restserver.html).
+ <br> Technically this requires both Chimera and Jalview to open
+ ports on the local network, and this may be blocked by Windows
+ Firewall with a warning message such as
+ <br /> "Windows Firewall has blocked some features of this program"
+ (where the program may be jp2launcher.exe for Jalview Webstart, or
+ java.exe or javaw.exe for the InstallAnywhere version).
+ <br /> To allow Jalview and Chimera to interact, you may need to add
+ permission for the program to communicate over the network. This can
+ be done from the warning dialogue, or in Control Panel, Firewall
+ settings.
+</body>
+</html>
diff --git a/help/html/features/clarguments.html b/help/html/features/clarguments.html
index 9a50c86..b514e65 100644
--- a/help/html/features/clarguments.html
+++ b/help/html/features/clarguments.html
@@ -1,196 +1,252 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<title>Jalview Command Line Arguments
-</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<title>Jalview Command Line Arguments</title>
<body>
- <p><strong>The Jalview Executable's Command Line
- Arguments</strong></p>
- See <a href="commandline.html">running Jalview from the command
- line</a> for more information.<br>
- <table width="100%" border="1" cellspacing="0" cellpadding="0">
- <tr >
- <td width="27%"><div align="center">-nodisplay</div></td>
- <td width="73%"><div align="left">Run Jalview without User Interface. (automatically disables questionnaire, version and usage stats checks)</div></td>
- </tr>
+ <p>
+ <strong>The Jalview Executable's Command Line Arguments</strong>
+ </p>
+ See
+ <a href="commandline.html">running Jalview from the command line</a>
+ for more information.
+ <br>
+ <table width="100%" border="1" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="27%"><div align="center">-nodisplay</div></td>
+ <td width="73%"><div align="left">Run Jalview without
+ User Interface. (automatically disables questionnaire, version
+ and usage stats checks)</div></td>
+ </tr>
- <tr>
- <td><div align="center">-props FILE/URL</div></td>
- <td><div align="left">Use the given Jalview properties file instead
- of users default.</div></td>
- </tr>
- <tr>
- <td><div align="center">-features FILE/URL</div></td>
- <td><div align="left">
- <p>Use the given file to add sequence features to an alignment.
- See <a href="featuresFormat.html" target="NEW">Features
- File</a> (Known as Groups file prior to 2.08) description. </p>
+ <tr>
+ <td><div align="center">-props FILE/URL</div></td>
+ <td><div align="left">Use the given Jalview properties
+ file instead of users default.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-features FILE/URL</div></td>
+ <td><div align="left">
+ <p>
+ Use the given file to add sequence features to an alignment.
+ See <a href="featuresFormat.html" target="NEW">Features
+ File</a> (Known as Groups file prior to 2.08) description.
+ </p>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-colour COLOURSCHEME</div>
- </td>
- <td>Set the colourscheme for the alignment. This can be any of
- the built-in colourschemes, a name of a predefined colourscheme
- (defined in the jalview properties file), or an 'inline' colourscheme
- (see the applet's colour parameter for more information).</td>
- </tr>
- <tr>
- <td>
- <div align="center">-annotations FILE/URL</div>
- </td>
- <td>Add precalculated annotations to the alignment. See <a
- href="annotationsFormat.html" target="NEW">Annotation File</a>
- description.</td>
- </tr>
- <tr>
- <td>
- <div align="center">-tree FILE/URL</div>
- <td>
- <div align="left">Load the given newick format tree file onto
- the alignment</div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-questionnaire URL</div>
- <td>
- <div align="left">Queries the given URL for information about
- any Jalview user questionnaires</div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-noquestionnaire</div>
- <td>
- <div align="left">Turn off questionnaire check</div>
- </td>
- </tr>
- <tr><td>
- <div align="center">-nousagestats</div>
- <td>
- <div align="left">Turn off google analytics usage tracking</div>
- </td>
- </tr>
- <tr><td>
- <div align="center">-[no]sortbytree</div>
- <td>
- <div align="left">Enable or disable automatic sorting of associated view when a new tree is displayed</div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-dasserver nickname=URL</div>
- <td>
- <div align="left">Add and enable a <a href="dassettings.html">DAS server</a> with given
- nickname (alphanumeric or underscores only) for retrieval of features
- for all alignments<br>
- Sources that also support the sequence command may be specified by prepending the URL with 'sequence:'<br>
- <em>e.g.</em> sequence:http://localdas.somewhere.org/das/source</div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-fetchfrom nickname</div>
- <td>
- <div align="left">Query a <a href="dassettings.html">DAS source</a> called nickname for features for the alignments
- and display them</div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-groovy FILE/URL</div>
- <td>
- <div align="left">Execute groovy script in FILE (where FILE may be 'STDIN' to read from the standard input) after all other
- arguments have been processed</div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-vdoc VAMSAS DOCUMENT FILE/URL</div>
- <td>
- <div align="left">Import the given vamsas document into a new session.<br><em>New in 2.5</em></div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-vsess VAMSAS SESSION URL</div>
- <td>
- <div align="left">Join the given vamsas session<br>If a document was also specified, this will be imported first and then committed as new data from Jalview to the specified session (Experimental - not yet enabled!).<em>New in 2.5</em></div></div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-fasta FILE</div>
- </td>
+ </div></td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-colour COLOURSCHEME</div>
+ </td>
+ <td>Set the colourscheme for the alignment. This can be any
+ of the built-in colourschemes, a name of a predefined
+ colourscheme (defined in the Jalview properties file), or an
+ 'inline' colourscheme (see the applet's colour parameter for
+ more information).</td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-annotations FILE/URL</div>
+ </td>
+ <td>Add precalculated annotations to the alignment. See <a
+ href="annotationsFormat.html" target="NEW"
+ >Annotation File</a> description.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-tree FILE/URL</div>
+ <td>
+ <div align="left">Load the given newick format tree file
+ onto the alignment</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-questionnaire URL</div>
+ <td>
+ <div align="left">Queries the given URL for information
+ about any Jalview user questionnaires</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-noquestionnaire</div>
+ <td>
+ <div align="left">Turn off questionnaire check</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-nousagestats</div>
+ <td>
+ <div align="left">Turn off google analytics usage tracking</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-[no]sortbytree</div>
+ <td>
+ <div align="left">Enable or disable automatic sorting of
+ associated view when a new tree is displayed</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-dasserver nickname=URL</div>
+ <td>
+ <div align="left">
+ Add and enable a <a href="dassettings.html">DAS server</a>
+ with given nickname (alphanumeric or underscores only) for
+ retrieval of features for all alignments<br> Sources that
+ also support the sequence command may be specified by
+ prepending the URL with 'sequence:'<br> <em>e.g.</em>
+ sequence:http://localdas.somewhere.org/das/source
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-fetchfrom nickname</div>
+ <td>
+ <div align="left">
+ Query a <a href="dassettings.html">DAS source</a> called
+ nickname for features for the alignments and display them
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-groovy FILE/URL</div>
+ <td>
+ <div align="left">Execute groovy script in FILE (where
+ FILE may be 'STDIN' to read from the standard input) after all
+ other arguments have been processed</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-jabaws URL</div>
+ <td>
+ <div align="left">Specify the URL of the preferred JABAWS
+ server</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-vdoc VAMSAS DOCUMENT FILE/URL</div>
+ <td>
+ <div align="left">
+ Import the given vamsas document into a new session.<br>
+ <em>New in 2.5</em>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-vsess VAMSAS SESSION URL</div>
+ <td>
+ <div align="left">
+ Join the given vamsas session<br>If a document was also
+ specified, this will be imported first and then committed as
+ new data from Jalview to the specified session (Experimental -
+ not yet enabled!).<em>New in 2.5</em>
+ </div>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">-fasta FILE</div>
+ </td>
- <td>
- <div align="left">Create alignment file FILE in Fasta format.</div>
- </td>
- </tr>
- <tr>
- <td><div align="center">-clustal FILE</div></td>
- <td><div align="left">Create alignment file FILE in Clustal format.</div></td>
- </tr>
- <tr>
- <td><div align="center">-msf FILE</div></td>
+ <td>
+ <div align="left">Create alignment file FILE in Fasta
+ format.</div>
+ </td>
+ </tr>
+ <tr>
+ <td><div align="center">-clustal FILE</div></td>
+ <td><div align="left">Create alignment file FILE in
+ Clustal format.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-msf FILE</div></td>
- <td><div align="left">Create alignment file FILE in MSF format.</div></td>
- </tr>
- <tr>
- <td><div align="center">-pileup FILE</div></td>
- <td><div align="left">Create alignment file FILE in Pileup format.</div></td>
- </tr>
- <tr>
- <td><div align="center">-pir FILE</div></td>
+ <td><div align="left">Create alignment file FILE in MSF
+ format.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-pileup FILE</div></td>
+ <td><div align="left">Create alignment file FILE in
+ Pileup format.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-pir FILE</div></td>
- <td><div align="left">Create alignment file FILE in PIR format.</div></td>
- </tr>
- <tr>
- <td><div align="center">-pfam FILE</div></td>
- <td><div align="left">Create alignment file FILE in PFAM format.</div></td>
- </tr>
- <tr>
- <td><div align="center">-blc FILE</div></td>
- <td><div align="left">Create alignment file FILE in BLC format.</div></td>
- </tr>
- <tr>
- <td><div align="center">-jalview FILE</div></td>
+ <td><div align="left">Create alignment file FILE in PIR
+ format.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-pfam FILE</div></td>
+ <td><div align="left">Create alignment file FILE in
+ PFAM format.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-blc FILE</div></td>
+ <td><div align="left">Create alignment file FILE in BLC
+ format.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-json FILE</div></td>
+ <td><div align="left">Create alignment file FILE in
+ JSON format.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-jalview FILE</div></td>
- <td><div align="left">Create alignment file FILE in Jalview format.</div></td>
- </tr>
- <tr>
- <td><div align="center">-png FILE</div></td>
- <td><div align="left">Create PNG image FILE from alignment.</div></td>
- </tr>
- <tr>
- <td><div align="center">-imgMap FILE</div></td>
+ <td><div align="left">Create alignment file FILE in
+ Jalview format.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-png FILE</div></td>
+ <td><div align="left">Create PNG image FILE from
+ alignment.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-imgMap FILE</div></td>
- <td><div align="left">Create HTML file FILE with image map of PNG
- image.</div></td>
- </tr>
- <tr>
- <td><div align="center">-eps FILE</div></td>
- <td><div align="left">Create EPS file FILE from alignment.</div></td>
- </tr>
- </table>
+ <td><div align="left">Create HTML file FILE with image
+ map of PNG image.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-eps FILE</div></td>
+ <td><div align="left">Create EPS file FILE from
+ alignment.</div></td>
+ </tr>
+ <tr>
+ <td><div align="center">-svg FILE</div></td>
+ <td><div align="left">Create Scalable Vector Graphics
+ file FILE from alignment.</div></td>
+ </tr>
+ </table>
</body>
</html>
diff --git a/help/html/features/codingfeatures.html b/help/html/features/codingfeatures.html
index 5977ae5..e4b8950 100644
--- a/help/html/features/codingfeatures.html
+++ b/help/html/features/codingfeatures.html
@@ -1,33 +1,39 @@
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head>
-<title>DNA Sequence Coding Region Definition</title>
-</head>
-<body>
-<p><strong>DNA Sequence Coding Region Definition</strong></p>
-<p>Jalview includes the standard DNA codon translation table in
-order to be able to dynamically translate cDNA to its expressed
-protein sequence. DNA Sequence Coding Regions are sequence
-features that can be defined on any DNA sequence in order to
-mark stretches of cDNA that will be concatenated to form the
-series of codons that are translated by the <strong>"
-Calculate→Translate cDNA"</strong> menu function.
-</p>
-</body>
-</html>
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>DNA Sequence Coding Region Definition</title>
+</head>
+<body>
+ <p>
+ <strong>DNA Sequence Coding Region Definition</strong>
+ </p>
+ <p>
+ Jalview includes the standard DNA codon translation table in order
+ to be able to dynamically translate cDNA to its expressed protein
+ sequence. DNA Sequence Coding Regions are sequence features that can
+ be defined on any DNA sequence in order to mark stretches of cDNA
+ that will be concatenated to form the series of codons that are
+ translated by the <strong>" Calculate→Translate
+ cDNA"</strong> menu function.
+ </p>
+</body>
+</html>
diff --git a/help/html/features/columnFilterByAnnotation.html b/help/html/features/columnFilterByAnnotation.html
new file mode 100644
index 0000000..128b478
--- /dev/null
+++ b/help/html/features/columnFilterByAnnotation.html
@@ -0,0 +1,83 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Select/Hide Columns by Annotation</title>
+</head>
+
+<body>
+ <p>
+ <strong>Select/Hide Columns by Annotation</strong>
+ </p>
+ <p>
+ The 'Select/Hide by Annotation' window allows columns to be selected
+ or hidden according to annotation rows on the alignment. The dialog
+ box is opened <em>via</em> "<strong>Select→Select/Hide
+ Columns by Annotation...</strong>", and different filters are
+ presented dependent upon the data shown in the selected annotation
+ row.
+ </p>
+ <table>
+ <tr>
+ <td><img src="annotationColumnSelectionWithSM.gif"></td>
+ <td><img src="annotationColumnSelectionWithoutSM.gif"></td>
+ </tr>
+ </table>
+
+ <p>If an annotation with numeric values is selected, the threshold
+ filter option is activated. For other types of annotation, use the
+ text box and secondary structure check boxes (right). The radio
+ buttons at the bottom of the dialog specify the action applied to
+ columns matching the query.</p>
+ <ul>
+ <li><strong>Search Filter</strong>
+ <ul>
+ <li>Enter text or regular expressions in the text box to
+ activate the 'Display Label' and 'Description' options.</li>
+ <li>Selecting the description or label options will
+ activate the filter, and any matching columns will be
+ highlighted or hidden.</li>
+ </ul>
+ <li><strong>Structure Filter</strong>
+ <ul>
+ <li>Select the checkboxes to filter by secondary structure
+ type.</li>
+ </ul>
+ <li><strong>Threshold Filter</strong>
+ <ul>
+ <li>This filter is only activated for annotation which
+ contain numeric values</li>
+ <li>Select whether to filter the alignment above or below
+ the threshold.</li>
+ <li>Change the threshold value with the slider, or enter it
+ in the text box.</li>
+ </ul>
+ <li><strong>Actions</strong>
+ <ul>
+ <li>'Select' (the default), selects columns matching the
+ query settings.</li>
+ <li>'Hide' causes matching columns to be hidden.</li>
+ </ul></li>
+ </ul>
+ <p>Hit 'Cancel' to restore the alignment view to its previous
+ state before any filtering was applied.</p>
+</body>
+</html>
diff --git a/help/html/features/commandline.html b/help/html/features/commandline.html
index 0d6cd2f..7b58a34 100644
--- a/help/html/features/commandline.html
+++ b/help/html/features/commandline.html
@@ -1,52 +1,65 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Running Jalview from the command line</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Running Jalview from the command line</title>
+</head>
<body>
- <p><strong>Running Jalview from the command line</strong></p>
- <p>Jalview is most easily run from the command line if you have built
- it from source, or via the 'Jalview' executable created from the
- InstallAnywhere jalview installation. Both of these mechanisms allow
- true command line execution of jalview - allowing you to provide
- additional options.</p><p>
-The Java Webstart version of
- jalview can be executed from the command line using something like
- :
- <pre>javaws http://www.jalview.org/webstart/jalview.jnlp -open
- <em>yourFileName</em></pre>
- But, this is not guaranteed to work on all versions of webstart on all
- operating systems, and doesn't let you execute Jalview with any
- additional parameters.
- <p><strong>Running jalview from the InstallAnywhere
- installation</strong></p>
- <p>If you install with InstallAnywhere you can use several more commands.
- However, if you call the application with the link provided by InstallAnywhere
- any output from the application will be sent to output.txt, not standard
- out.<br>
- The jalview application also requires a number of additional
- libraries on the class path. The command line below adds the Jalview
- installation's 'lib' directory to the list of directories that are
- searched for jars to be added to the classpath:</p>
-<pre>java -Djava.ext.dirs=$INSTALL_DIR$/lib -cp $INSTALL_DIR$/jalview.jar jalview.bin.Jalview -open [FILE] </pre>
- <p>Use '-help' to get more information on the <a
- href="clarguments.html">command line arguments</a> that Jalview
- accepts.</p>
- <p> </p>
- <p> </p>
- </body>
- </html>
+ <p>
+ <strong>Running Jalview from the command line</strong>
+ </p>
+ <p>Jalview is most easily run from the command line if you have
+ built it from source, or via the 'Jalview' executable created from
+ the InstallAnywhere Jalview installation. Both of these mechanisms
+ allow true command line execution of Jalview - allowing you to
+ provide additional options.</p>
+ <p>The Java Webstart version of Jalview can be executed from the
+ command line using something like :
+ <pre>javaws http://www.jalview.org/webstart/jalview.jnlp -open
+ <em>yourFileName</em>
+ </pre>
+ But, this is not guaranteed to work on all versions of webstart on all
+ operating systems, and doesn't let you execute Jalview with any
+ additional parameters.
+ <p>
+ <strong>Running Jalview from the InstallAnywhere
+ installation</strong>
+ </p>
+ <p>
+ If you install with InstallAnywhere you can use several more
+ commands. However, if you call the application with the link
+ provided by InstallAnywhere any output from the application will be
+ sent to output.txt, not standard out.<br> The Jalview
+ application also requires a number of additional libraries on the
+ class path. The command line below adds the Jalview installation's
+ 'lib' directory to the list of directories that are searched for
+ jars to be added to the classpath:
+ </p>
+ <pre>java -Djava.ext.dirs=$INSTALL_DIR$/lib -cp $INSTALL_DIR$/jalview.jar jalview.bin.Jalview -open [FILE] </pre>
+ <p>
+ Use '-help' to get more information on the <a
+ href="clarguments.html"
+ >command line arguments</a> that Jalview accepts.
+ </p>
+ <p> </p>
+ <p> </p>
+</body>
+</html>
diff --git a/help/html/features/creatinFeatures.html b/help/html/features/creatinFeatures.html
index c820e45..643c8a3 100644
--- a/help/html/features/creatinFeatures.html
+++ b/help/html/features/creatinFeatures.html
@@ -1,55 +1,65 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Creating Sequence Features</title>
</head>
<body>
-<strong>Creating Sequence Features</strong>
-<p>Jalview can create sequence features from the matches of a <a
- href="search.html">regular expression search</a>, or from the currently
-selected area via the <strong>"selection→Create
-sequence feature"</strong> entry in the <a href="../menus/popupMenu.html">selection area popup menu</a>. In both
-cases, the <strong>Create Features</strong> dialog box will then be
-opened:</p>
-<p><img src="crnewfeature.gif"></p>
-<p>Select or enter the attributes for the features being created,
-and then press OK to create the new features.</p>
-<p>Each attribute is described below:
-<ul>
- <li><strong>Sequence Feature Name</strong>
- <p>Either give the new features a new name or use the menu to
- re-use an existing feature name.</p>
- </li>
- <li><strong>Feature group</strong>
- <p>Enter a new group name, or re-use an existing group from the
- pull-down menu.</p>
- </li>
- <li><strong>Feature Colour</strong>
- <p>Keep the existing colour for this feature's name and group, or
- select the colour box to open a colour chooser to pick a different one.</p>
- </li>
- <li><strong>Description</strong>
- <p>Enter a description for all the features being created. Each
- feature defined on a sequence may have its own description that will be
- displayed in the tooltip for the feature in that region.</p>
- </li>
-</ul>
-</p><p><em>Sequence Feature Creation was introduced in Jalview Version 2.2</em></p>
+ <strong>Creating Sequence Features</strong>
+ <p>
+ Jalview can create sequence features from the matches of a <a
+ href="search.html"
+ >regular expression search</a>, or from the currently selected area
+ via the <strong>"selection→Create sequence
+ feature"</strong> entry in the <a href="../menus/popupMenu.html">selection
+ area popup menu</a>. In both cases, the <strong>Create
+ Features</strong> dialog box will then be opened:
+ </p>
+ <p>
+ <img src="crnewfeature.gif">
+ </p>
+ <p>Select or enter the attributes for the features being created,
+ and then press OK to create the new features.</p>
+ <p>Each attribute is described below:
+ <ul>
+ <li><strong>Sequence Feature Name</strong>
+ <p>Either give the new features a new name or use the menu to
+ re-use an existing feature name.</p></li>
+ <li><strong>Feature group</strong>
+ <p>Enter a new group name, or re-use an existing group from
+ the pull-down menu.</p></li>
+ <li><strong>Feature Colour</strong>
+ <p>Keep the existing colour for this feature's name and group,
+ or select the colour box to open a colour chooser to pick a
+ different one.</p></li>
+ <li><strong>Description</strong>
+ <p>Enter a description for all the features being created.
+ Each feature defined on a sequence may have its own description
+ that will be displayed in the tooltip for the feature in that
+ region.</p></li>
+ </ul>
+ </p>
+ <p>
+ <em>Sequence Feature Creation was introduced in Jalview Version
+ 2.2</em>
+ </p>
</body>
</html>
diff --git a/help/html/features/cursorMode.html b/help/html/features/cursorMode.html
index b43e79e..d257f1b 100644
--- a/help/html/features/cursorMode.html
+++ b/help/html/features/cursorMode.html
@@ -1,72 +1,87 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Cursor Mode</title>
</head>
<body>
-<p><strong>Cursor Mode</strong></p>
-<p>Cursor mode is a new feature in Jalview 2.08, and allows more
-precise selection and editing of alignments through the use of the
-keyboard for both navigation and the input of editing and selection commands.</p>
-<p><em>F2</em> Toggles between normal and cursor editing modes. When
-in cursor mode, a black cursor appears in the residue area of the
-alignment, and any mouse clicks on that area will move the cursor to
-that position (this means that the region selection menu is
-unavailable in cursor mode).</p>
-<p><b>Navigation</b>
-<ul>
- <li>Cursor keys - Move cursor around the alignment.</li>
-</ul>
-<ul>
- <li>S - Type a number x then press 'S' to jump to sequence x.</li>
-</ul>
-<ul>
- <li>C - Type a number x then press 'C' to jump to column x.</li>
-</ul>
-<ul>
- <li>P - Type a number x then press 'P' to jump to position x in current sequence.</li>
-</ul>
-<ul>
- <li>65,82<return> - Quick jump to column 65, sequence 82</li>
-</ul>
-</p>
-<p><b>Defining Regions</b>
-<ul>
- <li>Q - Define the top left corner of the selection area</li>
-</ul>
-<ul>
- <li>M - Define the bottom right corner of the selection area<br>
- </li>
-</ul>
-<p><b>Editing The Alignment</b>
-<ul>
- <li>Space - Insert a gap at the cursor position. <br>
- To insert 12 spaces at the current cursor, type 12 before pressing Space.<br>
- To group insert, hold control or shift together with space.</li>
-</ul>
-<ul>
- <li>Delete (or backspace) - Delete a gap at the cursor position.<br>
- To delete 12 spaces at the current cursor, type 12 before pressing
- Delete (or backspace).<br>
- To group delete, hold down control or shift together with Delete
- (or backspace).</li>
-</ul>
-</p>
+ <p>
+ <strong>Cursor Mode</strong>
+ </p>
+ <p>Cursor mode is a new feature in Jalview 2.08, and allows more
+ precise selection and editing of alignments through the use of the
+ keyboard for both navigation and the input of editing and selection
+ commands.</p>
+ <p>
+ <em>F2</em> Toggles between normal and cursor editing modes. When in
+ cursor mode, a black cursor appears in the residue area of the
+ alignment, and any mouse clicks on that area will move the cursor to
+ that position (this means that the region selection menu is
+ unavailable in cursor mode).
+ </p>
+ <p>
+ <b>Navigation</b>
+ <ul>
+ <li>Cursor keys - Move cursor around the alignment.</li>
+ </ul>
+ <ul>
+ <li>S - Type a number x then press 'S' to jump to sequence x.</li>
+ </ul>
+ <ul>
+ <li>C - Type a number x then press 'C' to jump to column x.</li>
+ </ul>
+ <ul>
+ <li>P - Type a number x then press 'P' to jump to position x in
+ current sequence.</li>
+ </ul>
+ <ul>
+ <li>65,82<return> - Quick jump to column 65, sequence 82</li>
+ </ul>
+ </p>
+ <p>
+ <b>Defining Regions</b>
+ <ul>
+ <li>Q - Define the top left corner of the selection area</li>
+ </ul>
+ <ul>
+ <li>M - Define the bottom right corner of the selection area<br>
+ </li>
+ </ul>
+ <p>
+ <b>Editing The Alignment</b>
+ <ul>
+ <li>Space - Insert a gap at the cursor position. <br> To
+ insert 12 spaces at the current cursor, type 12 before pressing
+ Space.<br> To group insert, hold control or shift together
+ with space.
+ </li>
+ </ul>
+ <ul>
+ <li>Delete (or backspace) - Delete a gap at the cursor
+ position.<br> To delete 12 spaces at the current cursor, type
+ 12 before pressing Delete (or backspace).<br> To group
+ delete, hold down control or shift together with Delete (or
+ backspace).
+ </li>
+ </ul>
+ </p>
</body>
</html>
diff --git a/help/html/features/dasfeatures.html b/help/html/features/dasfeatures.html
index 9bd70ff..5b88ca9 100644
--- a/help/html/features/dasfeatures.html
+++ b/help/html/features/dasfeatures.html
@@ -1,62 +1,74 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>DAS Features</title>
</head>
<body>
-<p><strong>DAS Sequence Feature Retrieval</strong></p>
-<p>Jalview includes a client for retrieving sequences and their features via
-the <a href="http://www.biodas.org">Distributed Annotation System</a>.</p>
-<ol>
- <li>Open the Feature Settings panel by selecting "View ->
- Feature Settings..."</li>
- <li>Click on the "<a href="dassettings.html">DAS Settings</a>"
- tabbed pane.</li>
- <li>Select the sources to use for DAS feature retrieval, then
- click the "Fetch DAS Features" button.
- <ul>
- <li>Cancelling Feature Retrieval<br>
- Press the <strong>Cancel Fetch</strong> button to immediately stop
- feature retrieval. This will not remove any features already added to
- the alignment, but will halt any outstanding DAS requests.<em>The
- cancel fetch button is of particular use when one or more DAS
- annotation servers are not responding!</em>
- </ul>
- </li>
-</ol>
-<p>If your DAS source selection contains sources which use Uniprot
-accession ids, you will be asked whether Jalview should find Uniprot
-Accession ids for the given sequence names. It is important to realise
-that many DAS sources only use Uniprot accession ids, rather than
-Swissprot/Uniprot sequence names.<br>
-The <a href="../webservices/dbreffetcher.html">database reference
-fetcher</a> documentation describes how Jalview discovers what database
-references are appropriate for the sequences in the alignment.
-<ul>
- <li><em>Note</em><br>
- Please remember to save your alignment if either the start/end
- numbering, or the sequence IDs were updated during the ID
- retrieval process.</li>
-</ul>
-<p>
-<p><em>DAS support was introduced in Jalview Version 2.1.</em></p>
-<p>
+ <p>
+ <strong>DAS Sequence Feature Retrieval</strong>
+ </p>
+ <p>
+ Jalview includes a client for retrieving sequences and their
+ features via the <a href="http://www.biodas.org">Distributed
+ Annotation System</a>.
+ </p>
+ <ol>
+ <li>Open the Feature Settings panel by selecting "View
+ -> Feature Settings..."</li>
+ <li>Click on the "<a href="dassettings.html">DAS
+ Settings</a>" tabbed pane.
+ </li>
+ <li>Select the sources to use for DAS feature retrieval, then
+ click the "Fetch DAS Features" button.
+ <ul>
+ <li>Cancelling Feature Retrieval<br> Press the <strong>Cancel
+ Fetch</strong> button to immediately stop feature retrieval. This
+ will not remove any features already added to the alignment,
+ but will halt any outstanding DAS requests.<em>The cancel
+ fetch button is of particular use when one or more DAS
+ annotation servers are not responding!</em>
+ </ul>
+ </li>
+ </ol>
+ <p>
+ If your DAS source selection contains sources which use Uniprot
+ accession ids, you will be asked whether Jalview should find Uniprot
+ Accession ids for the given sequence names. It is important to
+ realise that many DAS sources only use Uniprot accession ids, rather
+ than Swissprot/Uniprot sequence names.<br> The <a
+ href="../webServices/dbreffetcher.html"
+ >database reference fetcher</a> documentation describes how Jalview
+ discovers what database references are appropriate for the sequences
+ in the alignment.
+ <ul>
+ <li><em>Note</em><br> Please remember to save your
+ alignment if either the start/end numbering, or the sequence IDs
+ were updated during the ID retrieval process.</li>
+ </ul>
+ <p>
+ <p>
+ <em>DAS support was introduced in Jalview Version 2.1.</em>
+ </p>
+ <p>
</body>
</html>
diff --git a/help/html/features/dassettings.html b/help/html/features/dassettings.html
index b9fe144..1a0c863 100644
--- a/help/html/features/dassettings.html
+++ b/help/html/features/dassettings.html
@@ -1,54 +1,75 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>DAS Settings</title>
</head>
<body>
-<p><strong>DAS Settings</strong></p>
-<p>Jalview can retrieve sequences and features from many <a
- href="http://biodas.org/">DAS</a> sources. The DAS sources that
-it uses are discovered and selected <em>via</em> the DAS settings panel,
-opened either from the <a href="featuresettings.html">View→Feature
-Settings</a> dialog box from the alignment window's menu bar, or the <a
- href="featuresettings.html">Tools→Preferences</a> dialog box
-opened from the Desktop menu bar.</p>
-<p><img src="das.gif">
-<p>The available sources are listed in the table using each source's
-Nickname as its identifier. Clicking on a source's entry in the table
-reveals more information about that service in the panel to the right.
-Select the tickbox in the "Use Source" column for a source to
-add it to the set Jalview queries for alignment and sequence features.</p>
-<p>You can filter the visible DAS sources by authority, type and
-"label". You should read the DAS documentation to understand
-more about these values.
-<p><strong>Updating the list of sources</strong></p>
-<p>When the DAS Settings panel is first opened, and when the <strong>'Refresh
-source'</strong> buton is pressed, a list of DAS sources is retrieved from the
-DAS registry URL (set by default to the DAS registration server at
-http://das.sanger.ac.uk/registry/das1/sources/).</p>
-<p><strong>Adding your own DAS Sources</strong></p>
-<p>You can add your own DAS source to the list by clicking the
-"Add Local Source" button. Enter the URL and nickname of your
-additional service. It should be noted that Jalview 2.1 will not query
-additional sources for more information, but this will be implemented in
-future editions.
-<p>
+ <p>
+ <strong>DAS Settings</strong>
+ </p>
+ <p>
+ Jalview can retrieve sequences and features from many <a
+ href="http://biodas.org/"
+ >DAS</a> sources. The DAS sources that it uses are discovered and
+ selected <em>via</em> the DAS settings panel, opened either from the
+ <a href="featuresettings.html">View→Feature Settings</a>
+ dialog box from the alignment window's menu bar, or the <a
+ href="featuresettings.html"
+ >Tools→Preferences</a> dialog box opened from the Desktop menu
+ bar.
+ </p>
+ <p>
+ <img src="das.gif">
+ <p>The available sources are listed in the table using each
+ source's Nickname as its identifier. Clicking on a source's entry in
+ the table reveals more information about that service in the panel
+ to the right. Select the tickbox in the "Use Source"
+ column for a source to add it to the set Jalview queries for
+ alignment and sequence features.</p>
+ <p>You can filter the visible DAS sources by authority, type and
+ "label". You should read the DAS documentation to
+ understand more about these values.
+ <p>
+ <strong>Updating the list of sources</strong>
+ </p>
+ <p>
+ When the DAS Settings panel is first opened, and when the <strong>'Refresh
+ source'</strong> buton is pressed, a list of DAS sources is retrieved from
+ the DAS registry URL. Note that the registry hosted at
+ http://www.dasregistry.org/das/ was retired at the start of 2015. An
+ alternative service is currently hosted at
+ http://www.ebi.ac.uk/das-srv/registry/das/. To connect to this
+ service, ensure your .jalview_properties file includes the following
+ line:<br> <b>DAS_REGISTRY_URL=http\://www.ebi.ac.uk/das-srv/registry/das/</b>
+ </p>
+ <p>
+ <strong>Adding your own DAS Sources</strong>
+ </p>
+ <p>You can add your own DAS source to the list by clicking the
+ "Add Local Source" button. Enter the URL and nickname of
+ your additional service. It should be noted that Jalview 2.1 will
+ not query additional sources for more information, but this will be
+ implemented in future editions.
+ <p>
</body>
</html>
diff --git a/help/html/features/editingFeatures.html b/help/html/features/editingFeatures.html
index 5439609..5fc36c6 100644
--- a/help/html/features/editingFeatures.html
+++ b/help/html/features/editingFeatures.html
@@ -1,43 +1,58 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Amending or Deleting Sequence Features</title>
</head>
<body>
-<strong>Amending or Deleting Sequence Features</strong>
-<p>Double clicking a position in the alignment with one or more
-displayed sequence features opens the <strong>"Amend/Delete
-Features"</strong> dialog box.</p>
-<p><img src="amendfeature.gif"></p>
-<p>The dialog box only allows one of the features at the
-double-clicked position to be edited or deleted at a time, and it will
-also be highlighted in black in the alignment window.</p>
-<p>Choose which feature is to be modified by selecting it from the <strong>Sequence
-Feature Name</strong> <!-- and <strong>Feature Group</strong> --> pull down
-menu. In addition to the Name, group, colour and description attributes
-described for the <a href="creatinFeatures.html">new feature dialog
-box</a>, a feature's start and end position can be changed either by
-entering a new position directly or by using the adjacent up and down
-buttons.</p>
-<p>Select <strong>Amend</strong> to update the feature, <strong>Delete</strong>
-to remove the selected feature, or <strong>Cancel</strong> to leave the
-feature unchanged.</p>
-<p><em>Sequence feature editing was implemented in Jalview 2.2</em></p>
+ <strong>Amending or Deleting Sequence Features</strong>
+ <p>
+ Double clicking a position in the alignment with one or more
+ displayed sequence features opens the <strong>"Amend/Delete
+ Features"</strong> dialog box.
+ </p>
+ <p>
+ <img src="amendfeature.gif">
+ </p>
+ <p>The dialog box only allows one of the features at the
+ double-clicked position to be edited or deleted at a time, and it
+ will also be highlighted in black in the alignment window.</p>
+ <p>
+ Choose which feature is to be modified by selecting it from the <strong>Sequence
+ Feature Name</strong>
+ <!-- and <strong>Feature Group</strong> -->
+ pull down menu. In addition to the Name, group, colour and
+ description attributes described for the <a
+ href="creatinFeatures.html"
+ >new feature dialog box</a>, a feature's start and end position can be
+ changed either by entering a new position directly or by using the
+ adjacent up and down buttons.
+ </p>
+ <p>
+ Select <strong>Amend</strong> to update the feature, <strong>Delete</strong>
+ to remove the selected feature, or <strong>Cancel</strong> to leave
+ the feature unchanged.
+ </p>
+ <p>
+ <em>Sequence feature editing was implemented in Jalview 2.2</em>
+ </p>
</body>
</html>
diff --git a/help/html/features/featuresFormat.html b/help/html/features/featuresFormat.html
index 8693756..9d354dc 100644
--- a/help/html/features/featuresFormat.html
+++ b/help/html/features/featuresFormat.html
@@ -1,192 +1,199 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>Sequence Features File</title>
</head>
<body>
-<p><strong>Sequence Features File</strong><p>
-<p>
-The Sequence features file (which used to be known as the
-"Groups file" prior to version 2.08) is a simple way of getting
-your own sequence annotations into Jalview. It was introduced to
-allow sequence features to be rendered in the Jalview applet, and
-so is intentionally lightweight and minimal because the applet is
-often used in situations where data file size must be kept to a
-minimum, and no XML parser is available.</p>
-
-<p>Features files are imported into Jalview in the following
-ways:<br>
-
-<ul>
-<li>from the command line
-
-<pre>
+ <p>
+ <strong>Sequence Features File</strong>
+ <p>
+ <p>The Sequence features file (which used to be known as the
+ "Groups file" prior to version 2.08) is a simple way of getting your
+ own sequence annotations into Jalview. It was introduced to allow
+ sequence features to be rendered in the Jalview applet, and so is
+ intentionally lightweight and minimal because the applet is often
+ used in situations where data file size must be kept to a minimum,
+ and no XML parser is available.</p>
+
+ <p>
+ Features files are imported into Jalview in the following ways:<br>
+ <ul>
+ <li>from the command line <pre>
<strong> -features <<em>Features filename</em>></strong>
</pre>
-</li>
-
-<li>Dragging a features file onto an alignment window</li>
-
-<li>Via the "Load Features / Annotations" entry in the
-<strong>File</strong> menu of an alignment window.</li>
-</ul>
-
-</p>
-
-<p><strong>Sequence Features File Format</strong></p>
-<p>
-A features file is a simple ASCII text file, where each line
-contains tab separated text fields. <strong>No comments are
-allowed</strong>.</p>
-<p>
-The first set of lines contain type definitions:
-
-<pre>
+ </li>
+
+ <li>Dragging a features file onto an alignment window</li>
+
+ <li>Via the "Load Features / Annotations" entry in
+ the <strong>File</strong> menu of an alignment window.
+ </li>
+ </ul>
+
+ </p>
+
+ <p>
+ <strong>Sequence Features File Format</strong>
+ </p>
+ <p>
+ A features file is a simple ASCII text file, where each line
+ contains tab separated text fields. <strong>No comments are
+ allowed</strong>.
+ </p>
+ <p>The first set of lines contain type definitions:
+ <pre>
<strong><em>Feature label</em> <em>Feature Colour</em>
<!-- <em>Feature links</em> --></strong>
</pre>
-A feature type has a text label, and a colour specification. This
-can be either:
-
-<ul>
-<li>A single colour specified as either a red,green,blue 24 bit
-triplet in hexadecimal (eg. 00ff00) or as comma separated numbers
-(ranging from 0 to 255))</li>
+ A feature type has a text label, and a colour specification. This can
+ be either:
-<li>A <a href="featureschemes.html">graduated colourscheme</a>
-specified as a "|" separated list of fields:
+ <ul>
+ <li>A single colour specified as either a red,green,blue 24 bit
+ triplet in hexadecimal (eg. 00ff00) or as comma separated numbers
+ (ranging from 0 to 255))</li>
-<pre>
+ <li>A <a href="featureschemes.html">graduated colourscheme</a>
+ specified as a "|" separated list of fields: <pre>
[label|]<mincolor>|<maxcolor>|[absolute|]<minvalue>|<maxvalue>[|<thresholdtype>|[<threshold value>]]
-</pre>
-
-The fields are as follows:
-
-<ul>
-<li><em>label</em><br>
- Indicate that the feature description should be used to create a
-colour for features of this type.<br>
-<em>Note: if no threshold value is needed then the final '|' may be
-ommitted.<br>
-This keyword was added in Jalview 2.6</em></li>
-
-<li><em>mincolor</em> and <em>maxcolor</em><br>
- Colour triplets specified as hexadecimal or comma separated values
-(may be left blank for a <em>label</em> style colourscheme, but
-remember to specify the remaining fields)</li>
-
-<li><em>absolute</em><br>
- An optional switch indicating that the <em>minvalue</em> and
-<em>maxvalue</em> parameters should be left as is, rather than
-rescaled according to the range of scores for this feature
-type.</li>
-
-<li><em>minvalue</em> and <em>maxvalue</em><br>
- Minimum and maximum values defining the range of scores for which
-the colour range will be defined over. If minvalue is greater than
-maxvalue then the linear mapping will have negative gradient.</li>
-
-<li><em>thresholdtype</em><br>
- Either "none", "below", or "above". <em>below</em> and
-<em>above</em> require an additional <em>threshold value</em> which
-is used to control the display of features with a score either
-below or above the value.</li>
-</ul>
-</li>
-</ul>
-</p>
-
-<p>The remaining lines in the file are the sequence annotation
-definitions, where the now defined features are attached to regions
-on particular sequences. Each feature can optionally include some descriptive text
-which is displayed in a tooltip when the mouse is near the feature on that
-sequence (and can also be used to generate a colour the feature).</p>
-
-<p>If your sequence annotation is already available in GFF Format (see <a href="http://www.sanger.ac.uk/resources/software/gff/spec.html">http://www.sanger.ac.uk/resources/software/gff/spec.html</a>),
-then you can leave it as is, after first adding a line containing
-only 'GFF' after any Jalview feature colour definitions (<em>this mixed format capability was added in Jalview 2.6</em>). Alternately, you can use Jalview's own sequence feature
-annotation format, which additionally allows HTML and URLs to be
-directly attached to each piece of annotation.</p>
-
-<p><strong>Jalview's sequence feature annotation format</strong></p>
-<p>
-Each feature is specified as a tab-separated series of columns as defined below:
-<pre>
+</pre> The fields are as follows:
+
+ <ul>
+ <li><em>label</em><br> Indicate that the feature
+ description should be used to create a colour for features of
+ this type.<br> <em>Note: if no threshold value is
+ needed then the final '|' may be ommitted.<br> This
+ keyword was added in Jalview 2.6
+ </em></li>
+
+ <li><em>mincolor</em> and <em>maxcolor</em><br> Colour
+ triplets specified as hexadecimal or comma separated values
+ (may be left blank for a <em>label</em> style colourscheme,
+ but remember to specify the remaining fields)</li>
+
+ <li><em>absolute</em><br> An optional switch
+ indicating that the <em>minvalue</em> and <em>maxvalue</em>
+ parameters should be left as is, rather than rescaled
+ according to the range of scores for this feature type.</li>
+
+ <li><em>minvalue</em> and <em>maxvalue</em><br>
+ Minimum and maximum values defining the range of scores for
+ which the colour range will be defined over. If minvalue is
+ greater than maxvalue then the linear mapping will have
+ negative gradient.</li>
+
+ <li><em>thresholdtype</em><br> Either
+ "none", "below", or "above". <em>below</em>
+ and <em>above</em> require an additional <em>threshold
+ value</em> which is used to control the display of features with
+ a score either below or above the value.</li>
+ </ul>
+ </li>
+ </ul>
+ </p>
+
+ <p>The remaining lines in the file are the sequence annotation
+ definitions, where the now defined features are attached to regions
+ on particular sequences. Each feature can optionally include some
+ descriptive text which is displayed in a tooltip when the mouse is
+ near the feature on that sequence (and can also be used to generate
+ a colour the feature).</p>
+
+ <p>
+ If your sequence annotation is already available in GFF Format (see
+ <a href="http://www.sanger.ac.uk/resources/software/gff/spec.html">http://www.sanger.ac.uk/resources/software/gff/spec.html</a>),
+ then you can leave it as is, after first adding a line containing
+ only 'GFF' after any Jalview feature colour definitions (<em>this
+ mixed format capability was added in Jalview 2.6</em>). Alternately,
+ you can use Jalview's own sequence feature annotation format, which
+ additionally allows HTML and URLs to be directly attached to each
+ piece of annotation.
+ </p>
+
+ <p>
+ <strong>Jalview's sequence feature annotation format</strong>
+ </p>
+ <p>Each feature is specified as a tab-separated series of columns
+ as defined below:
+ <pre>
<em>description</em> <em>sequenceId</em> <em>sequenceIndex</em> <em>start</em> <em>end</em> <em>featureType</em> <em>score (optional)</em>
</pre>
-This format allows two alternate ways of referring to a sequence, either by
-its text ID, or its index in an associated alignment. Normally, sequence features are associated with sequences rather
-than alignments, and the sequenceIndex field is given as "-1". In
-order to specify a sequence by its index in a particular alignment,
-the sequenceId should be given as "ID_NOT_SPECIFIED", otherwise the
-sequenceId field will be used in preference to the sequenceIndex
-field.
-</p>
-
-
-<p>The description may contain simple HTML document body tags if
-enclosed by "<html></html>" and these will be rendered
-as formatted tooltips in the Jalview Application (the Jalview
-applet is not capable of rendering HTML tooltips, so all formatting
-tags will be removed).<br>
-<em>Attaching Links to Sequence Features</em><br>
-Any anchor tags in an html formatted description line will be
-translated into URL links. A link symbol will be displayed adjacent
-to any feature which includes links, and these are made available
-from the <a href="../menus/popupMenu.html#sqid.popup">links
-submenu</a> of the popup menu which is obtained by right-clicking
-when a link symbol is displayed in the tooltip.<br>
-<em>Non-positional features</em><br>
-Specify the <em>start</em> and <em>end</em> for a feature to be
-<strong>0</strong> in order to attach it to the whole sequence.
-Non-positional features are shown in a tooltip when the mouse
-hovers over the sequence ID panel, and any embedded links can be
-accessed from the popup menu. <em>Scores</em><br>
-Scores can be associated with sequence features, and used to sort
-sequences or shade the alignment (this was added in jalview 2.5).
-The score field is optional, and malformed scores will be
-ignored.</p>
-
-<p>Feature annotations can be collected into named groups by
-prefixing definitions with lines of the form:
-
-<pre>
+ This format allows two alternate ways of referring to a sequence,
+ either by its text ID, or its index in an associated alignment.
+ Normally, sequence features are associated with sequences rather than
+ alignments, and the sequenceIndex field is given as "-1". In
+ order to specify a sequence by its index in a particular alignment,
+ the sequenceId should be given as "ID_NOT_SPECIFIED",
+ otherwise the sequenceId field will be used in preference to the
+ sequenceIndex field.
+ </p>
+
+
+ <p>
+ The description may contain simple HTML document body tags if
+ enclosed by "<html></html>" and these will be
+ rendered as formatted tooltips in the Jalview Application (the
+ Jalview applet is not capable of rendering HTML tooltips, so all
+ formatting tags will be removed).<br> <em>Attaching Links
+ to Sequence Features</em><br> Any anchor tags in an html formatted
+ description line will be translated into URL links. A link symbol
+ will be displayed adjacent to any feature which includes links, and
+ these are made available from the <a
+ href="../menus/popupMenu.html#sqid.popup"
+ >links submenu</a> of the popup menu which is obtained by
+ right-clicking when a link symbol is displayed in the tooltip.<br>
+ <em>Non-positional features</em><br> Specify the <em>start</em>
+ and <em>end</em> for a feature to be <strong>0</strong> in order to
+ attach it to the whole sequence. Non-positional features are shown
+ in a tooltip when the mouse hovers over the sequence ID panel, and
+ any embedded links can be accessed from the popup menu.<br /> <em>Scores</em><br>
+ Scores can be associated with sequence features, and used to sort
+ sequences or shade the alignment (this was added in Jalview 2.5).
+ The score field is optional, and malformed scores will be ignored.
+ </p>
+
+ <p>Feature annotations can be collected into named groups by
+ prefixing definitions with lines of the form:
+ <pre>
<strong>startgroup groupname</strong>
</pre>
-.. and subsequently post-fixing the group with:
+ .. and subsequently post-fixing the group with:
-<pre>
+ <pre>
<strong>endgroup groupname</strong>
</pre>
-Feature grouping was introduced in version 2.08, and used to
-control whether a set of features are either hidden or shown
-together in the <a href="seqfeatures.html">sequence Feature
-settings dialog box</a>.</p>
-
+ Feature grouping was introduced in version 2.08, and used to control
+ whether a set of features are either hidden or shown together in the
+ <a href="seqfeatures.html">sequence Feature settings dialog box</a>.
+ </p>
+
-<p>A complete example is shown below :
-<pre>
+ <p>A complete example is shown below :
+ <pre>
domain red
metal ion-binding site 00ff00
transit peptide 0,105,215
diff --git a/help/html/features/featureschemes.html b/help/html/features/featureschemes.html
index e5b30ae..fa91c59 100644
--- a/help/html/features/featureschemes.html
+++ b/help/html/features/featureschemes.html
@@ -1,73 +1,106 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Sequence feature colour schemes</title>
</head>
<body>
-<p><strong>Sequence feature colour schemes</strong></p>
-<p>Jalview can visualize annotation present on parts of a sequence by
-overlaying colours according to the annotation present at each position.
-It allows features to be colored either according to type, or for a
-particular type, according to an individual feature's associated label
-or score. The <a href="featuresettings.html">Feature Settings dialog
-box</a> controls the order and display of each sequence annotation type, and
-also allows the colour scheme used for the the feature to be changed <em>via</em>
-the 'Graduated Colour' option in the sequence feature pop-up menu
-(obtained by right-clicking on a sequence feature).</p>
+ <p>
+ <strong>Sequence feature colour schemes</strong>
+ </p>
+ <p>
+ Jalview can visualize annotation present on parts of a sequence by
+ overlaying colours according to the annotation present at each
+ position. It allows features to be colored either according to type,
+ or for a particular type, according to an individual feature's
+ associated label or score. The <a href="featuresettings.html">Feature
+ Settings dialog box</a> controls the order and display of each
+ sequence annotation type, and also allows the colour scheme used for
+ the the feature to be changed <em>via</em> the 'Graduated Colour'
+ option in the sequence feature pop-up menu (obtained by
+ right-clicking on a sequence feature).
+ </p>
-<center><img src="featurecoloursettings.gif"><br/>Graduated
-feature colour scheme settings dialog box</img></center>
-<p>The Graduated Feature Colour dialog box has the following
-controls:
-<ul>
- <li><em>Colour by Label</em> - when checked this derives a colour
- for each feature based on the label text.</li>
- <li><em>Min and Max Color boxes</em> - Click on these boxes to set
- the minimum and maximum colours used to shade features by their
- associated score.</li>
- <li><em>Threshold type combo box</em> - Allows features to be
- hidden features if their score is below or above a given threshold.<br />
- <em>Set the threshold using the slider or type it in to the text
- box. The threshold cannot be set outside the available range of feature
- scores.</em>
- </li>
- <li><em>Threshold is Min/Max</em> - When checked, the threshold
- will be used as the upper or lower limit when shading the features
- according to their score using the Min and Max colour.</li>
-</ul>
-</p>
-<p><strong>Icon styles for graduated feature styles</strong><br/>
-<p>When a graduated colourscheme is applied to a feature, it is indicated in the feature settings or amend feature dialog box by the following types of icon:<br/>
-<center><table width="50%" border="1">
-<tr><td><strong>Type of Colouring</strong></td><td><strong>Icon</strong></td></tr>
-<tr><td><em>Graduated colour by Feature Score</em></td><td><img src="fcsminmax.gif"/></td></tr>
-<tr><td><em>Graduated colour thresholded (less than) by feature Score</em></td><td><img src="fcsltthan.gif"/></td></tr>
-<tr><td><em>Graduated colour thresholded (greater than) by feature Score</em></td><td><img src="fcsgtthan.gif"/></td></tr>
-<tr><td><em>Colour by Feature Label (may also be thresholded)</em></td><td><img src="fcsntlabel.gif"/></td></tr>
-<tr>
- <td align="center" colspan="2">
- <em>
- <strong>The current threshold is given in the
- icon's tooltip.</strong>
- </em>
- </td></tr></table></center></p>
-<em>Graduated feature colours were introduced in Jalview 2.5</em>
+ <center>
+ <img src="featurecoloursettings.gif"><br />Graduated feature
+ colour scheme settings dialog box</img>
+ </center>
+ <p>The Graduated Feature Colour dialog box has the following
+ controls:
+ <ul>
+ <li><em>Colour by Label</em> - when checked this derives a
+ colour for each feature based on the label text.</li>
+ <li><em>Min and Max Color boxes</em> - Click on these boxes to
+ set the minimum and maximum colours used to shade features by
+ their associated score.</li>
+ <li><em>Threshold type combo box</em> - Allows features to be
+ hidden features if their score is below or above a given
+ threshold.<br /> <em>Set the threshold using the slider or
+ type it in to the text box. The threshold cannot be set outside
+ the available range of feature scores.</em></li>
+ <li><em>Threshold is Min/Max</em> - When checked, the threshold
+ will be used as the upper or lower limit when shading the features
+ according to their score using the Min and Max colour.</li>
+ </ul>
+ </p>
+ <p>
+ <strong>Icon styles for graduated feature styles</strong><br />
+ <p>
+ When a graduated colourscheme is applied to a feature, it is
+ indicated in the feature settings or amend feature dialog box by the
+ following types of icon:<br />
+ <center>
+ <table width="50%" border="1">
+ <tr>
+ <td><strong>Type of Colouring</strong></td>
+ <td><strong>Icon</strong></td>
+ </tr>
+ <tr>
+ <td><em>Graduated colour by Feature Score</em></td>
+ <td><img src="fcsminmax.gif" /></td>
+ </tr>
+ <tr>
+ <td><em>Graduated colour thresholded (less than) by
+ feature Score</em></td>
+ <td><img src="fcsltthan.gif" /></td>
+ </tr>
+ <tr>
+ <td><em>Graduated colour thresholded (greater than) by
+ feature Score</em></td>
+ <td><img src="fcsgtthan.gif" /></td>
+ </tr>
+ <tr>
+ <td><em>Colour by Feature Label (may also be
+ thresholded)</em></td>
+ <td><img src="fcsntlabel.gif" /></td>
+ </tr>
+ <tr>
+ <td align="center" colspan="2"><em> <strong>The
+ current threshold is given in the icon's tooltip.</strong>
+ </em></td>
+ </tr>
+ </table>
+ </center>
+ </p>
+ <em>Graduated feature colours were introduced in Jalview 2.5</em>
</body>
</html>
diff --git a/help/html/features/featuresettings.html b/help/html/features/featuresettings.html
index c1d08a9..54c6dcb 100644
--- a/help/html/features/featuresettings.html
+++ b/help/html/features/featuresettings.html
@@ -1,79 +1,127 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Sequence Feature Settings Dialog Box</title>
</head>
<body>
-<p><strong>Sequence Feature Settings Dialog Box</strong></p>
-<p>Select <strong>View→Feature Settings...</strong> menu entry
-in an alignment window to open the feature settings dialog box, which
-allows you to precisely control the presence and appearance of sequence
-features for the current alignment.</p>
-<center><img src="featureSettings.gif" width="400" height="452">
-<br>
-Sequence Feature Settings for the Jalview Application</img></center>
-<p>The top section of the dialog box lists all the sequence feature
-groups, along with a tickbox for each that controls whether its features
-are displayed. The table in the middle lists all the features in the
-currently selected groups, along with their display style and whether
-they are currently being displayed (only the ticked features and groups
-are displayed). <strong><em>You can change the colour or
-shading style used for a feature in the associated alignment by clicking
-on its colour box.</em></strong></p>
-<p><strong><em>Feature settings pop-up menu</em></strong><br>
-<strong>Right-click</strong> on a feature to open a pop-up menu that
-allows you to sort the alignment or current selection using that feature
-type (see below), or toggle the type of colouring used for the feature.
-Features may be highlighted with either a single colour or a <a
- href="featureschemes.html">feature colourscheme</a> based on either the
-scores associated with that feature or from the feature's description
-(e.g. to distinguish different names associated with a DOMAIN feature).</p>
-<p><strong>Ordering alignment by features</strong><br>
-The 'Seq Sort by Score' and 'Seq Sort by Density' buttons will sort the
-alignment based on the average score or total number of currently active
-features and groups on each sequence. To order the alignment using a
-specific feature type, use the <em>sort by ..</em> entries in the pop-up
-menu for that type.<br>
-<em>Feature sorting and graduated feature colouring was introduced
-in jalview 2.5</em></p>
+ <p>
+ <strong>Sequence Feature Settings Dialog Box</strong>
+ </p>
+ <p>
+ Select <strong>View→Feature Settings...</strong> menu entry in
+ an alignment window to open the feature settings dialog box, which
+ allows you to precisely control the presence and appearance of
+ sequence features for the current alignment.
+ </p>
+ <center>
+ <img src="featureSettings.gif" width="400" height="452"> <br>
+ Sequence Feature Settings for the Jalview Application</img>
+ </center>
+ <p>
+ The top section of the dialog box lists all the sequence feature
+ groups, along with a tickbox for each that controls whether its
+ features are displayed. The table in the middle lists all the
+ features in the currently selected groups, along with their display
+ style and whether they are currently being displayed (only the
+ ticked features and groups are displayed). <strong><em>You
+ can change the colour or shading style used for a feature in the
+ associated alignment by clicking on its colour box.</em></strong>
+ </p>
+ <p>
+ <a name="selectbyfeature"><strong><em>Selecting
+ alignment columns by feature</em></strong></a><br> <strong>Double-clicking
+ a feature type</strong> in the <strong>Feature Settings</strong> dialog
+ allows you to select columns in the alignment that contain (or do
+ not contain) features of that type. If a region of the alignment is
+ currently selected, then only features in the current selection will
+ be searched. The following keys affect the way in which selections
+ are made:
+ <ul>
+ <li>Hold down <strong>Alt</strong> to select columns not
+ containing features of a particular type.
+ </li>
+ <li>Hold down <strong>Shift</strong> to add columns to the
+ current selection.
+ </li>
+ <li>Press <strong>Command/Windows key</strong> to toggle column
+ selection state (XOR)
+ </li>
+ </ul>
+ Options are also provided in the feature's pop-up menu (see below).
+ <br />
+ <em>Select columns by feature was added in Jalview 2.8.1</em>
+ </p>
+ <p>
+ <strong><em>Feature settings pop-up menu</em></strong><br> <strong>Right-click</strong>
+ on a feature to open a pop-up menu that allows you to sort the
+ alignment or current selection using that feature type (see below),
+ or toggle the type of colouring used for the feature. Features may
+ be highlighted with either a single colour or a <a
+ href="featureschemes.html"
+ >feature colourscheme</a> based on either the scores associated with
+ that feature or from the feature's description (e.g. to distinguish
+ different names associated with a DOMAIN feature).
+ </p>
+ <p>
+ <strong>Ordering alignment by features</strong><br> The 'Seq
+ Sort by Score' and 'Seq Sort by Density' buttons will sort the
+ alignment based on the average score or total number of currently
+ active features and groups on each sequence. To order the alignment
+ using a specific feature type, use the <em>sort by ..</em> entries
+ in the pop-up menu for that type.<br> <em>Feature sorting
+ and graduated feature colouring were introduced in Jalview 2.5</em>
+ </p>
-<p><strong>Transparency and Feature Ordering</strong></p>
-<p>It is important to realise that sequence features are often not
-distinct and often overlap (for example, a metal binding site feature
-may be attached to one position along a stretch of sequence marked with
-a secondary structure feature).</p>
-<p>The ordering of the sequence features in the dialog box list is
-the order used by jalview for rendering sequence features. A feature at
-the bottom of the list is rendered <em>below</em> a feature higher up in
-the list.<br>
-<em><strong>You can change the order of a feature by
-dragging it up and down the list with the mouse</strong></em>.</p>
-<p>The <strong><em>Optimise order</em></strong> button (currently
-only available in the application) will re-order the feature render
-ordering based on the average length of each feature type.</p>
-<p>The <strong><em>transparency slider setting</em></strong>
-(currently only available in the application version) controls the
-visibility of features rendered below other features. Reducing the
-transparency will mean that features at the top of the list can obscure
-features lower down, and increasing it allows the user to 'see through'
-the upper layers of a set of features.</p>
-<p><strong><em>You can save all features, with their
-current colours and visibility in a Jalview format file. </em></strong></p>
+ <p>
+ <strong>Transparency and Feature Ordering</strong>
+ </p>
+ <p>It is important to realise that sequence features are often not
+ distinct and often overlap (for example, a metal binding site
+ feature may be attached to one position along a stretch of sequence
+ marked with a secondary structure feature).</p>
+ <p>
+ The ordering of the sequence features in the dialog box list is the
+ order used by Jalview for rendering sequence features. A feature at
+ the bottom of the list is rendered <em>below</em> a feature higher
+ up in the list.<br> <em><strong>You can change
+ the order of a feature by dragging it up and down the list with
+ the mouse</strong></em>.
+ </p>
+ <p>
+ The <strong><em>Optimise order</em></strong> button (currently only
+ available in the application) will re-order the feature render
+ ordering based on the average length of each feature type.
+ </p>
+ <p>
+ The <strong><em>transparency slider setting</em></strong> (currently
+ only available in the application version) controls the visibility
+ of features rendered below other features. Reducing the transparency
+ will mean that features at the top of the list can obscure features
+ lower down, and increasing it allows the user to 'see through' the
+ upper layers of a set of features.
+ </p>
+ <p>
+ <strong><em>You can save all features, with their
+ current colours and visibility in a Jalview format file. </em></strong>
+ </p>
</body>
</html>
diff --git a/help/html/features/groovy.html b/help/html/features/groovy.html
index 77888dd..bdaeab6 100644
--- a/help/html/features/groovy.html
+++ b/help/html/features/groovy.html
@@ -1,94 +1,99 @@
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head>
-<title>Groovy Shell</title>
-</head>
-<body>
- <p>
- <strong>The Groovy Shell</strong>
- </p>
- <p>
- <a href="http://groovy.codehaus.org/">Groovy</a> is an "<em>agile
- and dynamic language for the Java platform</em>". The groovy
- scripting language makes it extremely easy to programmatically
- interact with Java programs, in much the same way that Javascript is
- used to generate and interact with applets and other objects on the
- page.
- </p>
- <p>
- <strong><em>Getting Groovy...</em>
- </strong><br> Jalview Groovy support is only possible if the core groovy
- jars which include the GroovyShell are present on the CLASSPATH when
- Jalview is started.
- </p>
- <p>
- The jars are obtained from the <em>embedded</em> directory within the
- <a href="http://dist.codehaus.org/groovy/distributions">groovy
- distribution</a>. The easiest way of adding them to the Jalview classpath
- is to download and build jalview from it's source distribution, and
- then add the groovy-all-*.jar to the lib directory whose path is given
- in the java.ext.dirs property.
- </p>
- <p>
- <strong>Opening Jalview's Groovy Console</strong><br>If groovy is
- available, then the <strong>Tools→Groovy Console...</strong>
- menu entry will be available from the Jalview Desktop's drop-down
- menu. Selecting this will open the <a
- href="http://groovy.codehaus.org/Groovy+Console">Groovy Console</a>
- which allows you to interactively execute Groovy scripts within the
- Jalview run-time environment.
- </p>
- <p>
- <strong>Executing groovy scripts on Jalview startup</strong><br>
- The -groovy <script> option on the <a href="commandline.html" />
- Jalview command line</a> will execute the contents of <script>.
- <script> may be a file, a URL, or alternatively if it is
- "STDIN" then the standard input will be used.<br>
- <em>Note: The groovy script will be executed <strong>after</strong>
- any data is loaded, and <strong>before</strong> images or any output
- files are written. This allows you to perform customised jalview
- analysis workflows with groovy.</em>
- </p>
- <p>
- <strong>Access to Jalview's functions from Groovy Scripts</strong><br>
- There is as yet no properly defined scripting interface to Jalview,
- but all the public methods of the jalview class hierarchy can be
- called from Groovy scripts. The access point for this is the <strong>Jalview</strong>
- object defined in the groovy environent which corresponds to the
- <pre>jalview.gui.Desktop</pre>
- object which manages all the Jalview windows.
- </p>
- Here's an example to get you started:
- <br>
- <ul>
- <li>Getting the title, alignment and first sequence from the
- current alignFrame<br> <pre>
-def alf = Jalview.getAlignframes();
-print alf[0].getTitle();
-def alignment = alf[0].viewport.alignment;
-def seq = alignment.getSequenceAt(0);
-</pre></li>
-<li>When running a groovy script from the command line, the alignment that was just loaded can be referred to like so:<br><pre>
-print currentAlFrame.getTitle();</pre>
- </ul>
- </p>
-
- <p> </p>
-</body>
-</html>
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Groovy Shell</title>
+</head>
+<body>
+ <p>
+ <strong>The Groovy Shell</strong>
+ </p>
+ <p>
+ <a href="http://groovy.codehaus.org/">Groovy</a> is an "<em>agile
+ and dynamic language for the Java platform</em>". The groovy
+ scripting language makes it extremely easy to programmatically
+ interact with Java programs, in much the same way that Javascript is
+ used to generate and interact with applets and other objects on the
+ page.
+ </p>
+ <p>
+ <strong><em>Getting Groovy...</em> </strong><br> Jalview Groovy
+ support is only possible if the core groovy jars which include the
+ GroovyShell are present on the CLASSPATH when Jalview is started.
+ </p>
+ <p>
+ The jars are obtained from the <em>embedded</em> directory within
+ the <a href="http://dist.codehaus.org/groovy/distributions">groovy
+ distribution</a>. The easiest way of adding them to the Jalview
+ classpath is to download and build Jalview from its source
+ distribution, and then add the groovy-all-*.jar to the lib directory
+ whose path is given in the java.ext.dirs property.
+ </p>
+ <p>
+ <strong>Opening Jalview's Groovy Console</strong><br>If groovy
+ is available, then the <strong>Tools→Groovy
+ Console...</strong> menu entry will be available from the Jalview Desktop's
+ drop-down menu. Selecting this will open the <a
+ href="http://groovy.codehaus.org/Groovy+Console"
+ >Groovy Console</a> which allows you to interactively execute Groovy
+ scripts within the Jalview run-time environment.
+ </p>
+ <p>
+ <strong>Executing groovy scripts on Jalview startup</strong><br>
+ The -groovy <script> option on the <a href="commandline.html">
+ Jalview command line</a> will execute the contents of <script>.
+ <script> may be a file, a URL, or alternatively if it is
+ "STDIN" then the standard input will be used.<br> <em>Note:
+ The groovy script will be executed <strong>after</strong> any data
+ is loaded, and <strong>before</strong> images or any output files
+ are written. This allows you to perform customised Jalview
+ analysis workflows with groovy.
+ </em>
+ </p>
+ <p>
+ <strong>Access to Jalview's functions from Groovy Scripts</strong><br>
+ There is as yet no properly defined scripting interface to Jalview,
+ but all the public methods of the jalview class hierarchy can be
+ called from Groovy scripts. The access point for this is the <strong>Jalview</strong>
+ object defined in the groovy environent which corresponds to the
+ <pre>jalview.gui.Desktop</pre>
+ object which manages all the Jalview windows. Here's an example to get
+ you started:
+ <br>
+ <ul>
+ <li>Getting the title, alignment and first sequence from the
+ current alignFrame<br> <pre>
+def alf = Jalview.getAlignFrames();
+print alf[0].getTitle();
+def alignment = alf[0].viewport.alignment;
+def seq = alignment.getSequenceAt(0);
+</pre>
+ </li>
+ <li>When running a groovy script from the command line, the
+ alignment that was just loaded can be referred to like so:<br>
+ <pre>
+print currentAlFrame.getTitle();</pre>
+ </ul>
+ If you have downloaded the InstallAnywhere version of Jalview, you can
+ find additional groovy scripts in the examples/groovy subfolder of the
+ installation directory.
+</body>
+</html>
diff --git a/help/html/features/hiddenRegions.html b/help/html/features/hiddenRegions.html
index 3bfa293..eab0df4 100644
--- a/help/html/features/hiddenRegions.html
+++ b/help/html/features/hiddenRegions.html
@@ -1,98 +1,114 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Hidden Regions</title>
</head>
<body>
-<p><strong>Hidden Regions</strong></p>
-<p>Use the keyboard key "H" to hide / reveal selected
-columns and sequences. To hide / reveal only selected sequences, use
-"Shift H", to hide / reveal only selected columns, use
-"Control H". You can also use "Shift" and
-"Control" together to hide everything but the currently
-selected region.</p>
-<p><strong><em>Hiding Sequences</em></strong><br>
-To hide selected sequences in an alignment, use the <strong>"View
--> Hide -> Selected Sequences"</strong> menu item or simply select <strong>"Hide
-Sequences"</strong> from the Popup menu after a right click on the sequence
-Ids.</p>
-<p>Hidden sequences will not be used in any calculations, editing or
-web service alignments performed on visible sequences.</p>
-<p><strong><em>Hidden Sequences Representatives</em></strong><br>
-A more advanced hide involves a right-mouse click on a sequence, then
-selecting <strong>"SequenceID -> Represent Group with
-SequenceId"</strong>. Using this method of hiding sequences, any edits
-performed on the visible group representative will be propogated to all
-the sequences in that group. <br>
-The hidden representative sequences will not be used in any calculations
-or web service alignments (<em>nb. this may change in the future</em>).
-<p><strong><em>Hidden Sequence Representatives and
-Multiple Views</em></strong><br>
-<em>A word of warning: hidden representative sequence groups are
-(still) only partly implemented in the jalview 2.5 release, and we hope
-to deal with the following issues in the future.</em><br>
-Currently, represented hidden groups are only made correctly if there is
-just one alignment view. When multiple views on an alignment exist, then
-the represented group will be displayed correctly in the view in which
-it was made, but in other views, both representative and hidden
-sequences will be visible, but will behave as if they are grouped. <br>
-Hidden representatives are propagated correctly to a new view if they
-exist in the current view. However, if the represented sequences are
-revealed in any one view, then in all other views they will simply be
-marked as hidden, and their association with the representative sequence
-will be lost.<br>
-</blockquote>
-</p>
-<p><strong><em>Hiding Columns</em></strong><br>
-To hide selected columns in an alignment, use the <strong>"View
--> Hide -> Selected Columns"</strong> menu item, or right click within
-a region of selected columns in the scale above the alignment (only
-available in non wrapped mode) and select <strong>"Hide
-Columns"</strong>.</p>
-<p>When an alignment view contains hidden columns, certain
-constraints apply:
-<ul>
- <li>Editing the alignment is bound by the hidden columns, <em>i.e.</em>
- you cannot move residues across a hidden column boundary.</li>
- <li><strong><a href="../calculations/tree.html">Tree</a></strong>,
- <strong><a href="../calculations/pairwise.html">pairwise
- alignment</a></strong> and <strong><a href="../calculations/pca.html">PCA</a></strong>
- calculations will only be performed using the <em>visible</em> parts of
- the alignment.</li>
- <li><a href="../webservices/msaclient.html">Multiple Sequence
- Alignments</a> are performed locally on on each visible chunk of the input,
- and concatenated with the hidden regions to form the final result.
-</p>
-</li>
-</ul>
-<p><strong>Column Separability</strong><br>
-Calculations where hidden columns are excluded, and a single analysis
-performed on the result, are termed <em>column-separable</em>. The
-simple Tree and PCA calculations are column separable because
-essentially the same results would be obtained if the excluded hidden
-columns were replaced by gaps as the input to the calculation.</p>
-<p>Multiple Sequence alignment and secondary structure prediction
-are both non-column-separable, and so the exclusion of hidden regions
-leads to only 'locally optimal' results - sometimes different to that
-obtained when using the full alignment.</p>
-<p> </p>
-<p> </p>
-<p> </p>
+ <p>
+ <strong>Hidden Regions</strong>
+ </p>
+ <p>Use the keyboard key "H" to hide / reveal selected
+ columns and sequences. To hide / reveal only selected sequences, use
+ "Shift H", to hide / reveal only selected columns, use
+ "Control H". You can also use "Shift" and
+ "Control" together to hide everything but the currently
+ selected region.</p>
+ <p>
+ <strong><em>Hiding Sequences</em></strong><br> To hide selected
+ sequences in an alignment, use the <strong>"View ->
+ Hide -> Selected Sequences"</strong> menu item or simply select <strong>"Hide
+ Sequences"</strong> from the Popup menu after a right click on the
+ sequence Ids.
+ </p>
+ <p>Hidden sequences will not be used in any calculations, editing
+ or web service alignments performed on visible sequences.</p>
+ <p>
+ <strong><em>Hidden Sequences Representatives</em></strong><br>
+ A more advanced hide involves a right-mouse click on a sequence,
+ then selecting <strong>"SequenceID -> Represent
+ Group with SequenceId"</strong>. Using this method of hiding
+ sequences, any edits performed on the visible group representative
+ will be propagated to all the sequences in that group. <br> The
+ hidden representative sequences will not be used in any calculations
+ or web service alignments (<em>nb. this may change in the
+ future</em>).
+ <p>
+ <strong><em>Hidden Sequence Representatives and
+ Multiple Views</em></strong><br> <em>A word of warning: hidden
+ representative sequence groups are (still) only partly implemented
+ in the Jalview 2.5 release, and we hope to deal with the following
+ issues in the future.</em><br> Currently, represented hidden
+ groups are only made correctly if there is just one alignment view.
+ When multiple views on an alignment exist, then the represented
+ group will be displayed correctly in the view in which it was made,
+ but in other views, both representative and hidden sequences will be
+ visible, but will behave as if they are grouped. <br> Hidden
+ representatives are propagated correctly to a new view if they exist
+ in the current view. However, if the represented sequences are
+ revealed in any one view, then in all other views they will simply
+ be marked as hidden, and their association with the representative
+ sequence will be lost.<br>
+ </blockquote>
+ </p>
+ <p>
+ <strong><em>Hiding Columns</em></strong><br> To hide selected
+ columns in an alignment, use the <strong>"View ->
+ Hide -> Selected Columns"</strong> menu item, or right click within
+ a region of selected columns in the scale above the alignment (only
+ available in non wrapped mode) and select <strong>"Hide
+ Columns"</strong>.
+ </p>
+ <p>When an alignment view contains hidden columns, certain
+ constraints apply:
+ <ul>
+ <li>Editing the alignment is bound by the hidden columns, <em>i.e.</em>
+ you cannot move residues across a hidden column boundary.
+ </li>
+ <li><strong><a href="../calculations/tree.html">Tree</a></strong>,
+ <strong><a href="../calculations/pairwise.html">pairwise
+ alignment</a></strong> and <strong><a
+ href="../calculations/pca.html"
+ >PCA</a></strong> calculations will only be performed using the <em>visible</em>
+ parts of the alignment.</li>
+ <li><a href="../webServices/msaclient.html">Multiple
+ Sequence Alignments</a> are performed locally on on each visible
+ chunk of the input, and concatenated with the hidden regions to
+ form the final result.
+ </p></li>
+ </ul>
+ <p>
+ <strong>Column Separability</strong><br> Calculations where
+ hidden columns are excluded, and a single analysis performed on the
+ result, are termed <em>column-separable</em>. The simple Tree and
+ PCA calculations are column separable because essentially the same
+ results would be obtained if the excluded hidden columns were
+ replaced by gaps as the input to the calculation.
+ </p>
+ <p>Multiple Sequence alignment and secondary structure prediction
+ are both non-column-separable, and so the exclusion of hidden
+ regions leads to only 'locally optimal' results - sometimes
+ different to that obtained when using the full alignment.</p>
+ <p> </p>
+ <p> </p>
+ <p> </p>
</body>
</html>
diff --git a/help/html/features/jalarchive.html b/help/html/features/jalarchive.html
index 3694d07..8e81024 100644
--- a/help/html/features/jalarchive.html
+++ b/help/html/features/jalarchive.html
@@ -1,38 +1,45 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Jalview Archives</title>
</head>
<body>
-<p><strong>Jalview Project Archives</strong>
-</p>
+ <p>
+ <strong>Jalview Project Archives</strong>
+ </p>
-<p>These are java archives of an XML file containing alignments, trees and Jalview
- display information. A data exchange standard is currently being developed,
- so there is no stable schema yet, but Jalview web services will soon make use
- of the same interchange format.</p>
-<p>For those who want to know...<br>
- Jalview uses java classes automatically created using <a href="http://www.castor.org">Castor</a>.
- Jalview 2.08 uses descriptor classes which significantly increase the speed
- of marshalling / unmarshalling java objects into XML. Files created prior to
- Jalview 2.08 can still be read in, but they will be saved in the new format.
-</p>
+ <p>These are java archives of an XML file containing alignments,
+ trees and Jalview display information. A data exchange standard is
+ currently being developed, so there is no stable schema yet, but
+ Jalview web services will soon make use of the same interchange
+ format.</p>
+ <p>
+ For those who want to know...<br> Jalview uses java classes
+ automatically created using <a href="http://www.castor.org">Castor</a>.
+ Jalview 2.08 uses descriptor classes which significantly increase
+ the speed of marshalling / unmarshalling java objects into XML.
+ Files created prior to Jalview 2.08 can still be read in, but they
+ will be saved in the new format.
+ </p>
</body>
</html>
diff --git a/help/html/features/jmol.html b/help/html/features/jmol.html
index 93146a5..b9e7e84 100644
--- a/help/html/features/jmol.html
+++ b/help/html/features/jmol.html
@@ -1,214 +1,280 @@
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head>
-<title>The Jmol PDB Viewer</title>
-</head>
-<body>
-<p><strong>The Jmol PDB Viewer</strong></p>
-<p>Since Jalview 2.3, <a href="http://jmol.sourceforge.net/">Jmol</a>
-has been integrated into Jalview for interactively viewing structures
-opened by selecting the <strong>"Sequence→View PDB
-entry:"</strong> option in the <a href="../menus/popupMenu.html">sequence
-id pop-up menu</a> (if you can't see this, then you need to <a
- href="viewingpdbs.html">associate a PDB structure</a> with the
-sequence). Jmol is available from the Jalview desktop and should also
-run in the JalviewLite applet, providing the browser supports Java 1.5.
-If Jmol is not available, then the original <a href="pdbviewer.html">internal
-pdb viewer</a> will be used as a fallback.</p>
-<p><a name="align"><strong>Superposing structures based
-on their aligned sequences</strong></a><br>
-If several structures are available on the alignment, you may add
-additional structures to an existing Jmol view by selecting their entry
-in the appropriate pop-up menu. Jalview will ask you if you wish to add
-the structure to the existing alignment, and if you do, it will import
-and superimpose the new PDB file using the corresponding positions from
-the alignment. If the alignment is subsequently edited, you can use the
-<a href="#sAlign"><em>Jmol→Align</em></a> menu option from the
-menu bar of the structure view window to superpose the structures using
-the updated alignment.<br>
-<em>Sequence based structure superposition was added in Jalview 2.6</em>
-</p>
-<p><strong>Controls</strong><br>
-The structure is by default rendered as a ribbon diagram. Moving the
-mouse over the structure brings up tooltips giving the residue name, PDB
-residue number and chain code, atom name and number
-([RES]Num:Chain.AtomName#AtomNumber). If a mapping exists to a residue
-in any associated sequences, then this will be highlighted in each one's
-alignment window. The converse also occurs - moving the mouse over an
-associated residue in an alignment window highlights the associated
-atoms in the displayed structures.</p>
-<p>Selecting a residue highlights its associated sequence residue
-and alpha carbon location. Double clicking an atom allows distances to
-be measured from it to any other atom in the structure.</p>
-<p>
-<table>
- <tr>
- <td><strong>Action</strong></td>
- <td><strong>Windows</strong></td>
- <td><strong>Unix</strong></td>
- <td><strong>Mac/OSX</strong></td>
- </tr>
- <tr>
- <td>Rotate View</td>
- <td>Left Click and Drag</td>
- <td>Left Click and Drag</td>
- <td>Click and Drag</td>
- </tr>
- <tr>
- <td>Zoom</td>
- <td>Shift + Left Click<br>
- drag mouse up or down</td>
- <td>Shift + Left Click<br>
- or middle button<br>
- drag mouse up or down</td>
- <td>Left-Alt + Click and drag mouse up or down</td>
- </tr>
- <tr>
- <td>Select/<br>
- Deselect<br>
- Residue</td>
- <td>Left Click</td>
- <td>Left Click</td>
- <td>Click</td>
- </tr>
- <tr>
- <td>Roll View</td>
- <td>Shift + Left Click<br>
- drag mouse to left or right</td>
- <td>Shift + Left Click<br>
- or middle button<br>
- drag mouse to left or right</td>
- <td>Left-Alt + Click and drag mouse to left or right</td>
- </tr>
- <tr>
- <td>Move Origin</td>
- <td>Shift+Control+Left Click<br>
- or Middle Button<br>
- + Drag</td>
- <td>Middle-Button<br>
- and<br>
- drag</td>
- <td>Shift+Control+Left Click<br>
- or Middle Button<br>
- and drag</td>
- </tr>
- <tr>
- <td>Jmol Menu</td>
- <td>Right-Click</td>
- <td>Right-Click</td>
- <td>Apple-Click</td>
- </tr>
-</table>
-</p>
-<p>The window has up to five menus:
-<ul>
- <li><Strong>File<br>
- </strong>
- <ul>
- <li><strong>Save As<br>
- </strong><em>Save the displayed PDB File, or the current view as an EPS or
- PNG file.</em></li>
- <li><strong>View Mapping<br>
- </strong><em> Opens a text window showing the alignment between the
- residues corresponding to alpha-carbon atoms in the PDB structure and
- the residues in the associated sequence.</em></li>
- </ul>
- </li>
- <li><strong>View</strong>
- <ul>
- <li><strong>Show Chains<br>
- </strong><em>Select which of the PDB file's chains are to be displayed.</em></li>
- <li><strong>Colour by ..<br></strong><em>Submenu allowing specific alignment views to be selected for colouring associated chains in the structure display. This menu contains all the alignment views associated with the structure view, with those used to colour the view indicated by ticks. Addditionally, it contains the following menu entries:</em>
- <ul><li><strong>Select many views<br></strong><em>When this option is enabled, selecting an alignment view adds it to the set used to colour the structures. Use this when colouring structures related to a number of alignments involving different domains or chains which are shown in the same structure view.</em>
- </li>
- <li><strong>Select all views<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will add all associated views to the set used to colour the structure display.</em>
- </li>
- <li><strong>Invert selection<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will replace the current set of views with any remaining views not currently used to colour the structure display.</em>
- </li></ul></li>
- <li><strong>Colours<br>
- </strong>
- <ul>
- <li><strong>By Sequence<br>
- </strong><em> Colours each residue in the structure with the colour of its
- corresponding residue in the associated sequence as rendered in the
- associated alignment views, including any Uniprot sequence features or
- region colourings.<br/>Pick which of the associated alignment views are used to colour the structures using the <strong>View→Colour by ..</strong> sub menu.</em><br>
- Residues which only exist in the PDB structure are coloured white if
- they are insertions (relative to the associated sequence in the
- alignment) and grey if they are N or C terminal flanks outside the
- region mapped to the alignment window's sequence.</em></li>
- <li><strong>By Chain<br>
- </strong><em> Assigns a random colour to each PDB chain.</em>
- <li><strong>Charge & Cysteine<br>
- </strong><em> Highlights cysteines in yellow, anionic (Aspartic Acid or
- Glutamic Acid) residues in red, and cationic (Lysine or Arginine)
- residues in blue.</em></li>
- <li><strong>Colour with Jmol<br></strong><em>Defers any colouring operations to Jmol. Select this if you want to use the Jmol scripting interface or menu to modify the view directly.</em></li>
- <li><strong>Standard and User Defined Jalview
- colourschemes.<br>
- </strong><em>The remaining entries apply the colourschemes available from
- the standard and user defined <a href="../colourSchemes/index.html">amino
- acid colours</a>.</em></li>
- </ul>
- </li>
- <li><strong>Jmol<br>
- </strong><em>This pulldown menu is only displayed if there are multiple
- structures shown in the Jmol window, and Jalview can also locate at
- least two of the structures in the currently associated alignment view.</em>
- <ul>
- <li><strong><a name="sAlign">Align</a> <br>
- </strong><em> When selected, the associated alignment will be used to
- superimpose all the structures in the view onto the first structure in
- the alignment. The regions used to calculate the superposition will be
- highlighted using the 'Cartoon' rendering style, and the remaining
- data shown as a chain trace.<br>
- (This option was introduced in Jalview 2.6)</em></li>
- </ul>
- </li>
- <li><strong>Help<br>
- </strong>
- <ul>
- <li><strong>Jmol Help<br>
- </strong><em>Access the Jmol Help documentation in a new browser window.</em></li>
- </ul>
- </li>
-</ul>
-</p>
-<p><strong>Functionality provided by Jmol</strong></p>
-<p>Jmol's own functions are accessed by clicking the 'Jmol' logo or
-right-clicking in the structure display area. Either way will open the
-Jmol pop-up menu, which provides access to a number of features for
-controlling the colour and display of molecules, adding measurements and
-labels, plotting surfaces, and display animation. The 'Set Picking' menu
-controls the behaviour of single and double mouse clicking on the
-structure, and the 'Console' option opens the Jmol scripting console.</p>
-<p>The state of each Jmol display is stored within <a
- href="jalarchive.html">jalview archives</a> as a Jmol state recovery
-script file. This means that any Jmol visualization effects that you add
-beyond those provided by Jalview will be able to be stored and recovered
-along with the displayed alignments in Jalview.</p>
-<p><strong>More Information</strong></p>
-<p>Jmol is a sophisticated program in its own right, with its own
-command console and scripting language. Only the essentials have been
-described here - the interested reader is referred to <a
- href="http://jmol.sourceforge.net/docs/">Jmol's own comprehensive
-online documentation</a>.</p>
-</p>
-</body>
-</html>
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>The Jmol PDB Viewer</title>
+</head>
+<body>
+ <p>
+ <strong>The Jmol PDB Viewer</strong>
+ </p>
+ <p>
+ Since Jalview 2.3, <a href="http://jmol.sourceforge.net/">Jmol</a>
+ has been integrated into Jalview for interactively viewing
+ structures opened by entries in the <strong>"Structure"</strong>
+ submenu in the <a href="../menus/popupMenu.html">sequence id
+ pop-up menu</a> (if you can't see this, then you need to <a
+ href="viewingpdbs.html"
+ >associate a PDB structure</a> with the sequence). Jmol is available
+ from the Jalview desktop and should also run in the JalviewLite
+ applet, providing the browser supports Java 1.5. If Jmol is not
+ available, then the original <a href="pdbviewer.html">internal
+ pdb viewer</a> will be used as a fallback.
+ </p>
+ <!-- <p>The following menu entries are provided for viewing structure data<br>
+ <ul>
+ <li>The <strong>"Structure→View
+ Structure→</strong> submenu allows a single PDB structure to be chosen
+ for display from the available structures for a sequence.
+ </li>
+ <li>The <strong>"Structure→View all <em>N</em>
+ structures
+ </strong> option will open a new window containing all structures associated
+ with the current selection.
+ </li>
+ <li>The <strong>"Structure→View all <em>N</em>
+ representative structures
+ </strong> option will open a new window containing exactly one structure per
+ currently selected sequence.<br />
+ <em>The View representative structures option was introduced in
+ Jalview 2.8.1</em></li>
+ </ul>
+ <br>
+</p> -->
+ <p>
+ <a name="align"><strong>Superposing structures based on
+ their aligned sequences</strong></a><br> If several structures are
+ available on the alignment, you may add additional structures to an
+ existing Jmol view by selecting their entry in the appropriate
+ pop-up menu. Jalview will ask you if you wish to add the structure
+ to the existing alignment, and if you do, it will import and
+ superimpose the new PDB file using the corresponding positions from
+ the alignment. If the alignment is subsequently edited, you can use
+ the <a href="#sAlign"><em>Jmol→Align</em></a> menu option from
+ the menu bar of the structure view window to superpose the
+ structures using the updated alignment.<br> <em>Sequence
+ based structure superposition was added in Jalview 2.6</em>
+ </p>
+ <p>
+ <strong>Controls</strong><br> The structure is by default
+ rendered as a ribbon diagram. Moving the mouse over the structure
+ brings up tooltips giving the residue name, PDB residue number and
+ chain code, atom name and number
+ ([RES]Num:Chain.AtomName#AtomNumber). If a mapping exists to a
+ residue in any associated sequences, then this will be highlighted
+ in each one's alignment window. The converse also occurs - moving
+ the mouse over an associated residue in an alignment window
+ highlights the associated atoms in the displayed structures.
+ </p>
+ <p>Selecting a residue highlights its associated sequence residue
+ and alpha carbon location. Double clicking an atom allows distances
+ to be measured from it to any other atom in the structure.</p>
+ <p>
+ <table border="1">
+ <tr>
+ <td><strong>Action</strong></td>
+ <td><strong>Windows</strong></td>
+ <td><strong>Unix</strong></td>
+ <td><strong>Mac/OSX</strong></td>
+ </tr>
+ <tr>
+ <td>Rotate View</td>
+ <td>Left Click and Drag</td>
+ <td>Left Click and Drag</td>
+ <td>Click and Drag</td>
+ </tr>
+ <tr>
+ <td>Zoom</td>
+ <td>Shift + Left Click<br> drag mouse up or down
+ </td>
+ <td>Shift + Left Click<br> or middle button<br>
+ drag mouse up or down
+ </td>
+ <td>Left-Alt + Click and drag mouse up or down</td>
+ </tr>
+ <tr>
+ <td>Select/<br> Deselect<br> Residue
+ </td>
+ <td>Left Click</td>
+ <td>Left Click</td>
+ <td>Click</td>
+ </tr>
+ <tr>
+ <td>Roll View</td>
+ <td>Shift + Left Click<br> drag mouse to left or right
+ </td>
+ <td>Shift + Left Click<br> or middle button<br>
+ drag mouse to left or right
+ </td>
+ <td>Left-Alt + Click and drag mouse to left or right</td>
+ </tr>
+ <tr>
+ <td>Move Origin</td>
+ <td>Shift+Control+Left Click<br> or Middle Button<br>
+ + Drag
+ </td>
+ <td>Middle-Button<br> and<br> drag
+ </td>
+ <td>Shift+Control+Left Click<br> or Middle Button<br>
+ and drag
+ </td>
+ </tr>
+ <tr>
+ <td>Jmol Menu</td>
+ <td>Right-Click</td>
+ <td>Right-Click</td>
+ <td>Apple-Click</td>
+ </tr>
+ </table>
+ </p>
+ <p>The window has up to five menus:
+ <ul>
+ <li><Strong>File<br>
+ </strong>
+ <ul>
+ <li><strong>Save As<br>
+ </strong><em>Save the displayed PDB File, or the current view as an
+ EPS or PNG file.</em></li>
+ <li><strong>View Mapping<br>
+ </strong><em> Opens a text window showing the alignment between the
+ residues corresponding to alpha-carbon atoms in the PDB
+ structure and the residues in the associated sequence.</em></li>
+ </ul></li>
+ <li><strong>View</strong>
+ <ul>
+ <li><strong>Show Chains<br>
+ </strong><em>Select which of the PDB file's chains are to be
+ displayed.</em></li>
+ <li><strong>Colour by ..<br></strong><em>Submenu
+ allowing specific alignment views to be selected for
+ colouring associated chains in the structure display. This
+ menu contains all the alignment views associated with the
+ structure view, with those used to colour the view indicated
+ by ticks. Addditionally, it contains the following menu
+ entries:</em>
+ <ul>
+ <li><strong>Select many views<br></strong><em>When
+ this option is enabled, selecting an alignment view adds
+ it to the set used to colour the structures. Use this
+ when colouring structures related to a number of
+ alignments involving different domains or chains which
+ are shown in the same structure view.</em></li>
+ <li><strong>Select all views<br></strong><em>This
+ is only enabled when </em><strong>Select many views</strong><em>
+ is also enabled, and will add all associated views to
+ the set used to colour the structure display.</em></li>
+ <li><strong>Invert selection<br></strong><em>This
+ is only enabled when </em><strong>Select many views</strong><em>
+ is also enabled, and will replace the current set of
+ views with any remaining views not currently used to
+ colour the structure display.</em></li>
+ </ul></li>
+ </ul>
+ <li><strong>Colours<br>
+ </strong>
+ <ul>
+ <li><strong>By Sequence<br>
+ </strong><em> Colours each residue in the structure with the colour
+ of its corresponding residue in the associated sequence as
+ rendered in the associated alignment views, including any
+ Uniprot sequence features or region colourings.<br />Pick
+ which of the associated alignment views are used to colour
+ the structures using the <strong>View→Colour
+ by ..</strong> sub menu.
+ </em><br> Residues which only exist in the PDB structure are
+ coloured white if they are insertions (relative to the
+ associated sequence in the alignment) and grey if they are N
+ or C terminal flanks outside the region mapped to the
+ alignment window's sequence.</em></li>
+ <li><strong>By Chain<br>
+ </strong><em> Assigns a random colour to each PDB chain.</em>
+ <li><strong>Charge & Cysteine<br>
+ </strong><em> Highlights cysteines in yellow, anionic (Aspartic Acid
+ or Glutamic Acid) residues in red, and cationic (Lysine or
+ Arginine) residues in blue.</em></li>
+ <li><strong>Colour with Jmol<br></strong><em>Defers
+ any colouring operations to Jmol. Select this if you want to
+ use the Jmol scripting interface or menu to modify the view
+ directly.</em></li>
+ <li><strong>Standard and User Defined Jalview
+ colourschemes.<br>
+ </strong><em>The remaining entries apply the colourschemes available
+ from the standard and user defined <a
+ href="../colourSchemes/index.html"
+ >amino acid colours</a>.
+ </em></li>
+ </ul></li>
+ <li><strong>Jmol<br>
+ </strong><em>This pulldown menu is only displayed if there are multiple
+ structures shown in the Jmol window, and Jalview can also locate
+ at least two of the structures in the currently associated
+ alignment view.</em>
+ <ul>
+ <li><strong><a name="sAlign">Align</a> <br> </strong><em>
+ When selected, the associated alignment will be used to
+ superimpose all the structures in the view onto the first
+ structure in the alignment. The regions used to calculate
+ the superposition will be highlighted using the 'Cartoon'
+ rendering style, and the remaining data shown as a chain
+ trace.<br> (This option was introduced in Jalview 2.6)
+ </em></li>
+ </ul></li>
+ <li><strong>Help<br>
+ </strong>
+ <ul>
+ <li><strong>Jmol Help<br>
+ </strong><em>Access the Jmol Help documentation in a new browser
+ window.</em></li>
+ </ul></li>
+ </ul>
+ </p>
+ <p>
+ <strong>Functionality provided by Jmol</strong>
+ </p>
+ <p>Jmol's own functions are accessed by clicking the 'Jmol' logo
+ or right-clicking in the structure display area. Either way will
+ open the Jmol pop-up menu, which provides access to a number of
+ features for controlling the colour and display of molecules, adding
+ measurements and labels, plotting surfaces, and display animation.
+ The 'Set Picking' menu controls the behaviour of single and double
+ mouse clicking on the structure, and the 'Console' option opens the
+ Jmol scripting console.</p>
+ <p>
+ The state of each Jmol display is stored within <a
+ href="jalarchive.html"
+ >Jalview archives</a> as a Jmol state recovery script file. This means
+ that any Jmol visualization effects that you add beyond those
+ provided by Jalview will be able to be stored and recovered along
+ with the displayed alignments in Jalview.
+ </p>
+ <p>
+ <strong>More Information</strong>
+ </p>
+ <p>
+ Jmol is a sophisticated program in its own right, with its own
+ command console and scripting language. Only the essentials have
+ been described here - the interested reader is referred to <a
+ href="http://jmol.sourceforge.net/docs/"
+ >Jmol's own comprehensive online documentation</a>.
+ </p>
+ </p>
+</body>
+</html>
diff --git a/help/html/features/multipleViews.html b/help/html/features/multipleViews.html
index 1e4852a..65aeb80 100644
--- a/help/html/features/multipleViews.html
+++ b/help/html/features/multipleViews.html
@@ -1,76 +1,104 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Multiple Alignment Views</title>
</head>
<body>
-<p><strong>Multiple Alignment Views</strong></p>
-<p>Multiple alignment views allows the same alignment to be viewed
-independently in many different ways simultaneously. Each view is an
-independent visualization of the same alignment, so each may have a
-different ordering, colouring, row and column hiding and seuqence
-feature and annotation display setting, but alignment, feature and
-annotation edits are common to all, since this affects the underlying
-data.</p>
-<p>Create a new view using the <strong>"View→New
-View"</strong> menu item, or by pressing <strong>Control+T</strong>. A newly
-created view will be identical to the view it was created from, but any
-changes to the way the alignment is coloured or displayed will only
-affect the new view.</p>
-<!-- TODO sharing selections between views -->
-<p>A particular view may focus on some specific aspect of an
-alignment - for example, hiding all but the region of an alignment
-containing a particular domain. <strong>Right-clicking</strong> a view's
-tab opens the View Name dialog box, allowing it to be renamed to
-something more meaningful.</p>
-<p><strong>Viewing Multiple Views Simultaneously</strong></p>
-<p>Multiple views of an alignment are, by default, gathered together
-as tabs within a single alignment window. They can be viewed
-simultanously by pressing <strong>X</strong> (or via <strong>"View→Expand"</strong>)
-to expand each view into its own linked alignment window. Expanded views
-are gathered back into into a single tabbed alignment window by pressing
-<strong>G</strong>, or by selecting <strong>"View→Gather"</strong>).
-</p>
-<p><strong>Hidden Sequence Representatives and Multiple
-Views</strong></p>
-<p>There are some unexpected interactions between hidden sequence
-representatives and their display in multiple views. See the
-corresponding entry in the <a href="hiddenRegions.html">documentation
-for hidden regions</a>.</p>
-<p><strong>Structure and Analysis Viewers and Multiple
-Views</strong></p>
-<p>A tree calculated on a particular view, or loaded onto it, is by
-default associated with just that view. However, the <a
- href="../calculations/treeviewer.html">Tree Viewer's</a> <strong>"View→Associate
-leaves"</strong> submenu allows a tree's view association to be changed to
-to any or all other views.</p>
-<p>The results of a <a href="../calculations/pca.html">PCA
-calculation</a> on a particular view may also be associated with other
-views, using the PCA Viewer's <strong>"View→Associate
-Nodes"</strong> submenu.</p>
-<p><a href="jmol.html">PDB Structure Viewers</a>
-opened on a structure associated with a sequence in a particular view are now (as of Jalview 2.3) associated with the same sequence in all views. This means that when 'Colour by Sequence' is selected in the structure view, the colour will be updated to the colours given in the view with the current input focus.
-<!--
+ <p>
+ <strong>Multiple Alignment Views</strong>
+ </p>
+ <p>Multiple alignment views allow the same alignment to be viewed
+ independently in many different ways simultaneously. Each view is an
+ independent visualization of the same alignment, so each may have a
+ different ordering, colouring, row and column hiding and sequence
+ feature and annotation display setting, but alignment, feature and
+ annotation edits are common to all, since this affects the
+ underlying data.</p>
+ <p>
+ Create a new view using the <strong>"View→New
+ View"</strong> menu item, or by pressing <strong>Control+T</strong>. A
+ newly created view will be identical to the view it was created
+ from, but any changes to the way the alignment is coloured or
+ displayed will only affect the new view.
+ </p>
+ <!-- TODO sharing selections between views -->
+ <p>
+ A particular view may focus on some specific aspect of an alignment
+ - for example, hiding all but the region of an alignment containing
+ a particular domain. <strong>Right-clicking</strong> a view's tab
+ opens the View Name dialog box, allowing it to be renamed to
+ something more meaningful.
+ </p>
+ <p>
+ <strong>Viewing Multiple Views Simultaneously</strong>
+ </p>
+ <p>
+ Multiple views of an alignment are, by default, gathered together as
+ tabs within a single alignment window. They can be viewed
+ simultanously by pressing <strong>X</strong> (or via <strong>"View→Expand"</strong>)
+ to expand each view into its own linked alignment window. Expanded
+ views are gathered back into a single tabbed alignment window by
+ pressing <strong>G</strong>, or by selecting <strong>"View→Gather"</strong>.
+ </p>
+ <p>
+ <strong>Hidden Sequence Representatives and Multiple Views</strong>
+ </p>
+ <p>
+ There are some unexpected interactions between hidden sequence
+ representatives and their display in multiple views. See the
+ corresponding entry in the <a href="hiddenRegions.html">documentation
+ for hidden regions</a>.
+ </p>
+ <p>
+ <strong>Structure and Analysis Viewers and Multiple Views</strong>
+ </p>
+ <p>
+ A tree calculated on a particular view, or loaded onto it, is by
+ default associated with just that view. However, the <a
+ href="../calculations/treeviewer.html"
+ >Tree Viewer's</a> <strong>"View→Associate
+ leaves"</strong> submenu allows a tree's view association to be
+ changed to to any or all other views.
+ </p>
+ <p>
+ The results of a <a href="../calculations/pca.html">PCA
+ calculation</a> on a particular view may also be associated with other
+ views, using the PCA Viewer's <strong>"View→Associate
+ Nodes"</strong> submenu.
+ </p>
+ <p>
+ <a href="jmol.html">PDB Structure Viewers</a> opened on a structure
+ associated with a sequence in a particular view are now (as of
+ Jalview 2.3) associated with the same sequence in all views. This
+ means that when 'Colour by Sequence' is selected in the structure
+ view, the colour will be updated to the colours given in the view
+ with the current input focus.
+ <!--
also, by default, only be associated
with the sequence as it is displayed in that view. The
"View→Associate View" submenu allows the association of
alternative views.</p> -->
-<p><em>Multiple Views were introduced in Jalview 2.2</em></p>
+ <p>
+ <em>Multiple Views were introduced in Jalview 2.2</em>
+ </p>
</body>
</html>
diff --git a/help/html/features/newkeystrokes.html b/help/html/features/newkeystrokes.html
index 4f93219..78d18a6 100644
--- a/help/html/features/newkeystrokes.html
+++ b/help/html/features/newkeystrokes.html
@@ -1,50 +1,58 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<title>New Key Strokes and Menus</title>
<body>
-<strong>New Key Strokes and Menus</strong>
-<p>Many new <a href="../keys.html">keyboard shortcuts</a> have been
-added in Jalview 2.2 to make editing, selecting and navigating an
-alignment even easier. The selection commands in the <strong>Edit</strong>
-menu, and the alignment formatting controls within the <strong>View</strong>
-menu have also been moved into their own respective <strong>Select</strong>
-and <strong>Format</strong> menus.</p>
-<p>Some of the more important new keystrokes are shown below :
-<ul>
- <li><strong>Page Up</strong> and <strong>Page Down</strong>
- scrolls through the alignment view.</li>
- <li><strong>Control I</strong> inverts the currently selected
- sequence set, and <strong>Control Alt I</strong> will invert the
- currently selected set of columns.
- <li><strong>Control V</strong> will paste the contents of the
- clipboard to the current alignment window, and <strong>Control
- Shift V</strong> pastes the data to a new window.</li>
- <li><strong>Control O</strong> opens the file browser for loading
- a new alignment or Jalview archive.</li>
- <li><strong>Control S</strong> saves the alignment with the
- current filename and format, and <strong>Control Shift S</strong> opens
- the <strong>Save As...</strong> dialog box.</li>
- <li><strong>Control T</strong> creates a new alignment view, and <strong>Control
- W</strong> closes the current view, or if none remain, then the whole alignment.</li>
- <li><strong>Control E</strong> will remove gapped columns in the alignment.</li>
- <li><strong>Control D</strong> opens the <strong>Remove Redundancy</strong> dialog box.</li>
-</ul>
-</p>
+ <strong>New Key Strokes and Menus</strong>
+ <p>
+ Many new <a href="../keys.html">keyboard shortcuts</a> have been
+ added in Jalview 2.2 to make editing, selecting and navigating an
+ alignment even easier. The selection commands in the <strong>Edit</strong>
+ menu, and the alignment formatting controls within the <strong>View</strong>
+ menu have also been moved into their own respective <strong>Select</strong>
+ and <strong>Format</strong> menus.
+ </p>
+ <p>Some of the more important new keystrokes are shown below :
+ <ul>
+ <li><strong>Page Up</strong> and <strong>Page Down</strong>
+ scrolls through the alignment view.</li>
+ <li><strong>Control I</strong> inverts the currently selected
+ sequence set, and <strong>Control Alt I</strong> will invert the
+ currently selected set of columns.
+ <li><strong>Control V</strong> will paste the contents of the
+ clipboard to the current alignment window, and <strong>Control
+ Shift V</strong> pastes the data to a new window.</li>
+ <li><strong>Control O</strong> opens the file browser for
+ loading a new alignment or Jalview archive.</li>
+ <li><strong>Control S</strong> saves the alignment with the
+ current filename and format, and <strong>Control Shift S</strong>
+ opens the <strong>Save As...</strong> dialog box.</li>
+ <li><strong>Control T</strong> creates a new alignment view,
+ and <strong>Control W</strong> closes the current view, or if none
+ remain, then the whole alignment.</li>
+ <li><strong>Control E</strong> will remove gapped columns in
+ the alignment.</li>
+ <li><strong>Control D</strong> opens the <strong>Remove
+ Redundancy</strong> dialog box.</li>
+ </ul>
+ </p>
</body>
</html>
diff --git a/help/html/features/overview.html b/help/html/features/overview.html
index c5dc93d..a002c92 100644
--- a/help/html/features/overview.html
+++ b/help/html/features/overview.html
@@ -1,29 +1,39 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Overview Window</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Overview Window</title>
+</head>
<body>
-<p><strong>View→Overview window</strong></p>
-<p>Select the overview window menu item to get a navigable image of the whole alignment.
-</p>
-<p>The red box indicates the currently viewed region of the alignment, this
- may be moved by clicking and dragging with the mouse.</p>
-<p><img src="overview.gif" width="407" height="137"></p>
-<p> </p>
+ <p>
+ <strong>View→Overview window</strong>
+ </p>
+ <p>Select the overview window menu item to get a navigable image
+ of the whole alignment.</p>
+ <p>The red box indicates the currently viewed region of the
+ alignment, this may be moved by clicking and dragging with the
+ mouse.</p>
+ <p>
+ <img src="overview.gif" width="407" height="137">
+ </p>
+ <p> </p>
</body>
</html>
diff --git a/help/html/features/pdbseqfetcher.png b/help/html/features/pdbseqfetcher.png
new file mode 100644
index 0000000..b243168
Binary files /dev/null and b/help/html/features/pdbseqfetcher.png differ
diff --git a/help/html/features/pdbsequencefetcher.html b/help/html/features/pdbsequencefetcher.html
new file mode 100644
index 0000000..c26575e
--- /dev/null
+++ b/help/html/features/pdbsequencefetcher.html
@@ -0,0 +1,103 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>The PDB Sequence Fetcher</title>
+</head>
+<body>
+
+ <strong>The PDB Sequence Fetcher</strong>
+ <p>
+ Jalview provides a specialised interface that allows fast and
+ efficient discovery and retrieval of data from the PDB database,
+ based on the EMBL-EBI's PDBe BioSOLR query interface. It allows
+ interactive querying of PDB metadata with free text and structured
+ queries, so structures can be located without prior knowledge of
+ their database accessions, or <em>via</em> manual cross-referencing
+ with other bioinformatics websites.
+ </p>
+ <p>
+ To open the PDB Sequence Fetcher, select PDB as the database from
+ any <a href="seqfetch.html">Sequence Fetcher</a> dialog (opened <em>via</em>
+ <strong>"File →Fetch Sequences"</strong>).
+ </p>
+ <img src="pdbseqfetcher.png" align="left"
+ alt="PDB sequence fetcher (introduced in Jalview 2.9)"
+ />
+
+ <p>
+ <strong>Searching the PDB Database</strong>
+ </p>
+ <p>
+ To search the PDB, begin typing in the text box. The results of your
+ query are shown in the search results tab, which updates every time
+ you type in the search text box. You can sort results according to
+ the displayed columns, and select entries with the mouse and
+ keyboard. Once you have selected one or more entries, hit the <strong>OK</strong>
+ button to retrieve and view them in Jalview.
+ </p>
+ <p>
+ <ul>
+ <li><strong>Searching a specific PDB field</strong><br />If you
+ want to find structures based on a specific PDB metadata field,
+ you can select it from the drop-down menu.</li>
+ <li><strong>Retrieving a unique chain for a PDB entry</strong><br>To
+ retrieve a specific chain for a PDB entry, append the PDB ID with
+ a colon followed by the chain code in the search box.<br /> e.g
+ 1xyz:A</li>
+
+ <li><strong>Bulk PDB retrieval</strong><br>Multiple PDB
+ IDs can be specified by separating them with a semi-colon.<br />
+ e.g. 1xyz;2xyz;3xyz<br />Hitting Return or OK will automatically
+ fetch those IDs, like the default Sequence Fetcher interface.</li>
+
+ <li><strong>Wild card searching</strong><br>The following
+ wild cards are supported by the EMBL-EBI PDBe query service:
+ <ul>
+ <li><strong>?</strong> matches a single character<br />The
+ search string te?t would match both test and text.</li>
+ <li><strong>*</strong> matches multiple characters<br />The
+ search string: tes* - would match test, testing, and tester.</li>
+ </ul> <em>Note:</em> you can use wildcard characters anywhere in a
+ query string.<br />For example: te*t - would match test and text.
+ *est - would match pest and test.</li>
+ <li><strong>Structured queries</strong><br />The PDBe SOLR
+ interface supports boolean query syntax, allowing quoted search
+ strings to be combined with AND, OR, and NOT. Currently, no
+ special support for constructing these queries is provided in the
+ query dialog box.</li>
+ </ul>
+ <p>
+ <strong>Customising The PDB Sequence Fetcher</strong>
+ </p>
+ <p>
+ To change the displayed meta-data in the search result, click the
+ 'Configure Displayed Columns' tab, and select the fields you'd like
+ displayed. These fields can also be configured <em>via</em> the
+ Structure tab of the <a href="preferences.html#structure">Jalview
+ Desktop Preferences</a>.
+ </p>
+ <p>
+ <em>The PDB Sequence Fetcher interface was introduced in
+ Jalview 2.9</em>
+ </p>
+</body>
+</html>
\ No newline at end of file
diff --git a/help/html/features/pdbviewer.html b/help/html/features/pdbviewer.html
index 743f2a9..0d7a51b 100644
--- a/help/html/features/pdbviewer.html
+++ b/help/html/features/pdbviewer.html
@@ -1,160 +1,176 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>PDB Viewer</title>
</head>
<body>
-<p><strong>The Jalview internal PDB Viewer</strong><br>
-Since Jalview 2.3, the <a href="jmol.html">Jmol PDB Viewer</a> is
-the main method for <a href="viewingpdbs.html">viewing PDB
-structures</a>. The documentation below concerns the original Jalview
-PDB viewer, which is only used in situations where Jmol is unavailable
-or cannot operate.</p>
-<p><strong>The PDB Viewer Window</strong>
-<p>This interactive structure viewing window is opened by selecting
-the <strong>"Sequence→View PDB entry:"</strong> entry in
-the <a href="../menus/popupMenu.html">sequence id pop-up menu</a>. This
-can only be done for sequences which have an <a href="viewingpdbs.html">associated
-PDB structure</a>, and the PDB Viewer will only be associated with the
-particular alignment view from which it was opened.</p>
-<p><strong>Controls</strong></p>
-<p>The structure is rendered as an alpha-carbon trace. Moving the
-mouse over the structure brings up tooltips with a residue name and PDB
-sequence position. If a mapping exists to a residue in the associated
-sequence, then this will be highlighted in the associated view in its
-alignment window, and vice versa for viewing the coordinates associated
-with a particular residue in the sequence in a particular view on the
-alignment.</p>
-<p>Selecting a residue highlights its associated sequence residue
-and alpha carbon location.</p>
-<p>
-<table>
- <tr>
- <td><strong>Action</strong></td>
- <td><strong>Windows</strong></td>
- <td><strong>Unix</strong></td>
- <td><strong>Mac/OSX</strong></td>
- </tr>
- <tr>
- <td>Select/<br>
- Deselect<br>
- Residue</td>
- <td>Left Click</td>
- <td>Left Click</td>
- <td>Click</td>
- </tr>
- <tr>
- <td>Rotate View</td>
- <td>Left Click and Drag</td>
- <td>Left Click and Drag</td>
- <td>Click and Drag</td>
- </tr>
- <tr>
- <td>Roll View</td>
- <td>Right Click and drag</td>
- <td>Right Click and Drag</td>
- <td>TODO</td>
- </tr>
- <tr>
- <td>Move Origin</td>
- <td>Middle-Button and Drag</td>
- <td>Middle-Button and Drag</td>
- <td>TODO</td>
- </tr>
- <tr>
- <td>Zoom In</td>
- <td>Up Arrow</td>
- <td>Up Arrow</td>
- <td>Up Arrow</td>
- </tr>
- <tr>
- <td>Zoom Out</td>
- <td>Down Arrow</td>
- <td>Down Arrow</td>
- <td>Down Arrow</td>
- </tr>
-</table>
-</p>
-<p>There are three menus:
-<ul>
- <li><Strong>File<br>
- </strong>
- <ul>
- <li><strong>Save As<br>
- </strong><em>Saves the current view as an EPS or PNG file.</em></li>
- <li><strong>View Mapping<br>
- </strong><em> Opens a text window showing the alignment between the
- residues corresponding to alpha-carbon atoms in the PDB structure and
- the residues in the associated sequence.</em></li>
- </ul>
- </li>
- <li><strong>Colours<br>
- </strong>
- <ul>
- <li><strong>By Sequence<br>
- </strong><em> Colours each residue in the structure with the colour of its
- corresponding residue in the associated sequence as rendered in the
- associated alignment view, including any Uniprot sequence features or
- region colourings.<br>
- Residues which only exist in the PDB structure are coloured white if
- they are insertions (relative to the associated sequence in the
- alignment) and grey if they are N or C terminal flanks outside the
- region mapped to the alignment window's sequence.</em></li>
- <li><strong>By Chain<br>
- </strong><em> Assigns a random colour to each PDB chain.</em>
- <li><strong>Charge & Cysteine<br>
- </strong><em> Highlights cysteines in yellow, anionic (Aspartic Acid or
- Glutamic Acid) residues in red, and cationic (Lysine or Arginine)
- residues in blue.</em></li>
- <li><strong><em>Standard and User Defined Jalview
- colourschemes.<br>
- </em></strong> The remaining entries apply the colourschemes available from the
- standard and user defined <a href="../colourSchemes/index.html">amino
- acid colours</a>.</em></li>
- </ul>
- </li>
- <li><strong>View<br>
- </strong><em> These options can be turned off to improve performance when
- viewing large structures, some at the expense of visual clarity.</em>
- <ul>
- <li><strong>Wireframe<br>
- </strong><em> Draws thin lines rather than thick lines for the
- alpha-carbon trace.</em></li>
- <li><strong>Depthcue<br>
- </strong><em>Shades the structure so parts of the structure near the front
- of the view are brighter than those further away.</em></li>
- <li><strong>Z Buffering<br>
- </strong><em> Applies depth sorting to correctly render occluded regions
- of the backbone trace.</em></li>
- <li><strong>Show All Chains<br>
- </strong><em> When turned on, shows all chains in the PDB file, not just
- the one associated with a sequence in the alignment window.</em></li>
- <!-- NOT YET IMPLEMENTED <li><strong>Associate View</strong><br>
+ <p>
+ <strong>The Jalview internal PDB Viewer</strong><br> Since
+ Jalview 2.3, the <a href="jmol.html">Jmol PDB Viewer</a> is the main
+ method for <a href="viewingpdbs.html">viewing PDB structures</a>.
+ The documentation below concerns the original Jalview PDB viewer,
+ which is only used in situations where Jmol is unavailable or cannot
+ operate.
+ </p>
+ <p>
+ <strong>The PDB Viewer Window</strong>
+ <p>
+ This interactive structure viewing window is opened by selecting
+ entries from the <strong>"Structure→"</strong>
+ submenu of the <a href="../menus/popupMenu.html">sequence id
+ pop-up menu</a>. The internal PDB viewer is not able to show
+ superpositions, so no other options are provided. Structures can
+ only be viewed for sequences which have an <a
+ href="viewingpdbs.html"
+ >associated PDB structure</a>, and the PDB Viewer will only be
+ associated with the particular alignment view from which it was
+ opened.
+ </p>
+ <p>
+ <strong>Controls</strong>
+ </p>
+ <p>The structure is rendered as an alpha-carbon trace. Moving the
+ mouse over the structure brings up tooltips with a residue name and
+ PDB sequence position. If a mapping exists to a residue in the
+ associated sequence, then this will be highlighted in the associated
+ view in its alignment window, and vice versa for viewing the
+ coordinates associated with a particular residue in the sequence in
+ a particular view on the alignment.</p>
+ <p>Selecting a residue highlights its associated sequence residue
+ and alpha carbon location.</p>
+ <p>
+ <table>
+ <tr>
+ <td><strong>Action</strong></td>
+ <td><strong>Windows</strong></td>
+ <td><strong>Unix</strong></td>
+ <td><strong>Mac/OSX</strong></td>
+ </tr>
+ <tr>
+ <td>Select/<br> Deselect<br> Residue
+ </td>
+ <td>Left Click</td>
+ <td>Left Click</td>
+ <td>Click</td>
+ </tr>
+ <tr>
+ <td>Rotate View</td>
+ <td>Left Click and Drag</td>
+ <td>Left Click and Drag</td>
+ <td>Click and Drag</td>
+ </tr>
+ <tr>
+ <td>Roll View</td>
+ <td>Right Click and drag</td>
+ <td>Right Click and Drag</td>
+ <td>TODO</td>
+ </tr>
+ <tr>
+ <td>Move Origin</td>
+ <td>Middle-Button and Drag</td>
+ <td>Middle-Button and Drag</td>
+ <td>TODO</td>
+ </tr>
+ <tr>
+ <td>Zoom In</td>
+ <td>Up Arrow</td>
+ <td>Up Arrow</td>
+ <td>Up Arrow</td>
+ </tr>
+ <tr>
+ <td>Zoom Out</td>
+ <td>Down Arrow</td>
+ <td>Down Arrow</td>
+ <td>Down Arrow</td>
+ </tr>
+ </table>
+ </p>
+ <p>There are three menus:
+ <ul>
+ <li><Strong>File<br>
+ </strong>
+ <ul>
+ <li><strong>Save As<br>
+ </strong><em>Saves the current view as an EPS or PNG file.</em></li>
+ <li><strong>View Mapping<br>
+ </strong><em> Opens a text window showing the alignment between the
+ residues corresponding to alpha-carbon atoms in the PDB
+ structure and the residues in the associated sequence.</em></li>
+ </ul></li>
+ <li><strong>Colours<br>
+ </strong>
+ <ul>
+ <li><strong>By Sequence<br>
+ </strong><em> Colours each residue in the structure with the colour
+ of its corresponding residue in the associated sequence as
+ rendered in the associated alignment view, including any
+ Uniprot sequence features or region colourings.<br>
+ Residues which only exist in the PDB structure are coloured
+ white if they are insertions (relative to the associated
+ sequence in the alignment) and grey if they are N or C
+ terminal flanks outside the region mapped to the alignment
+ window's sequence.
+ </em></li>
+ <li><strong>By Chain<br>
+ </strong><em> Assigns a random colour to each PDB chain.</em>
+ <li><strong>Charge & Cysteine<br>
+ </strong><em> Highlights cysteines in yellow, anionic (Aspartic Acid
+ or Glutamic Acid) residues in red, and cationic (Lysine or
+ Arginine) residues in blue.</em></li>
+ <li><strong><em>Standard and User Defined
+ Jalview colourschemes.<br>
+ </em></strong> The remaining entries apply the colourschemes available from
+ the standard and user defined <a
+ href="../colourSchemes/index.html"
+ >amino acid colours</a>.</em></li>
+ </ul></li>
+ <li><strong>View<br>
+ </strong><em> These options can be turned off to improve performance
+ when viewing large structures, some at the expense of visual
+ clarity.</em>
+ <ul>
+ <li><strong>Wireframe<br>
+ </strong><em> Draws thin lines rather than thick lines for the
+ alpha-carbon trace.</em></li>
+ <li><strong>Depthcue<br>
+ </strong><em>Shades the structure so parts of the structure near the
+ front of the view are brighter than those further away.</em></li>
+ <li><strong>Z Buffering<br>
+ </strong><em> Applies depth sorting to correctly render occluded
+ regions of the backbone trace.</em></li>
+ <li><strong>Show All Chains<br>
+ </strong><em> When turned on, shows all chains in the PDB file, not
+ just the one associated with a sequence in the alignment
+ window.</em></li>
+ <!-- NOT YET IMPLEMENTED <li><strong>Associate View</strong><br>
Change which view on the associated sequence's alignment is to be
associated with the PDB viewer.-->
- </ul>
- </li>
-</ul>
-</p>
-<p><strong>Notes for PDB Viewing in the Jalview Applet</strong>
-<p>The applet can only load PDB files by copying and pasting the
-text into the popup window which appears when "Show PDB
-Structure" is selected after right clicking on a sequence name.</p>
+ </ul></li>
+ </ul>
+ </p>
+ <p>
+ <strong>Notes for PDB Viewing in the Jalview Applet</strong>
+ <p>The applet can only load PDB files by copying and pasting the
+ text into the popup window which appears when "Show PDB
+ Structure" is selected after right clicking on a sequence name.</p>
</body>
</html>
diff --git a/help/html/features/preferences.html b/help/html/features/preferences.html
index 61e3eb0..235ce3f 100644
--- a/help/html/features/preferences.html
+++ b/help/html/features/preferences.html
@@ -1,177 +1,335 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Preferences</title>
</head>
<body>
-<p><strong>Preferences</strong></p>
-<p>There are six tabs in the Preferences dialog box:
-<ul>
- <li>The <a href="#visual"><strong>"Visual"</strong>
- Preferences</a> tab allows you to configure the default display for a new
- alignment window.</li>
- <li>The <a href="#colours"><strong>"Colours"</strong>
- Preferences</a> tab allows you to configure default colourschemes for a new
- alignment window.</li>
- <li>The <a href="#connections"><strong>"Connections"</strong>
- Preferences</a> tab allows you to change the links made from Jalview to
- your default web browser.</li>
- <li>The <a href="#output"><strong>"Output"</strong>
- Preferences</a> tab contains settings affecting the export of sequence
- alignments and EPS files.</li>
- <li>The <a href="#editing"><strong>"Editing"</strong>
- Preferences</a> tab contains settings affecting the export of sequence
- alignments and EPS files.</li>
- <li>The <a href="dassettings.html"><strong>"DAS
- Settings"</strong> Preferences</a> tab allows you to select which DAS sources
- to use when fetching DAS Features.</li>
- <li>The <a href="../webServices/webServicesPrefs.html"><strong>"Web Service"</strong> Preferences</a> tab allows you to configure the <a href="http://www.compbio.dundee.ac.uk/jabaws">JABAWS</a> servers that Jalview uses, and change the layout of the alignment's Web Services menu.</li>
-</ul>
-</p>
-<p><strong><a name="visual">Visual</a> Preferences tab</strong></p>
-<p><em>Maximise Window</em> - If this is selected, a new alignment
-window will stretch to fit the available space.</p>
-<p><em>Open Overview Window</em> - When this is selected, the <a
- href="overview.html">alignment overview</a> panel is opened by default
-for a new alignment window.</p>
-<p><em>Show Annotations</em> - If this is selected the new window
-will display an annotation panel below the sequences. This annotation
-panel may have several rows describing the whole alignment. The 3
-standard annotations <em>Conservation</em>, <em>Quality</em> and <em>Consensus</em>
-for the alignment may be shown or hidden by default using the checkboxes
-below.</p>
-<p><em>Show group: Conservation and Consensus</em> controls the
-display of per-group automatic annotation.</p>
-<p><em>Consensus: Histogram and Logo</em> checkboxes control the
-display of the consensus histogram and sequence logo for consensus
-annotation rows.</p>
-<p><em>Full Sequence ID</em> - If selected the ID panel will display
-the name of a sequence plus the start and end residues in the format
-name/start-end. If not selected, the displayed ID will be the name of
-the sequence.</p>
-<p><em>Right Align IDs</em> - select to align all sequence IDs to
-the left-hand edge of the sequence alignment, rather than the left-hand
-edge of the alignment display window.</p>
-<p><em>Font</em> - The default font name, size and style can be set
-for a new alignment window.</p>
-<p><em>Sequence ID Tooltip</em>: Control the display of Database
-References and Non-positional annotation in the tooltip displayed when
-the mouse is over a sequence's ID.</p>
-<p><em>Sequence Name Italics</em> - select to apply the italicised
-vbersion of the font to sequence labels.</p>
-<p><em>Smooth Font</em> - Toggles anti-aliasing on / off for faster
-rendering of the alignment.</p>
-<p><em>Wrap Alignment</em> - Select whether to open new alignment
-windows in wrapped mode or not.</p>
-<p><em>Gap Symbol</em> - The default gap symbol may be set to either
-"-" or "."</p>
-<p><em>Sort by</em> - When the alignment is loaded in, it will can
-be sorted by Id or pairwise identity.</p>
-<p><em>Open file</em> - If this is selected then the default
-alignment file will be opened when Jalview is started. You can change
-the default file by clicking on file name and either typing in the file
-path or selecting it from the file chooser window.</p>
-<p><a name="colours"><strong>"Colours" Preferences tab</strong></p>
-<p><em>Alignment Colour</em> - The default colour scheme for a new alignment
-window. If the chosen option is "User Defined" then the last
-User Defined Colour loaded or saved via the User Defined Colours panel
-will be loaded.</p>
- <p>
- <em>Annotation Shading Default</em> - set the default minimum
- and maximum colours used when <a
- href="../colourSchemes/annotationColouring.html">Colour by
- Annotation ..</a> is selected from the alignment window's colours menu.
- </p>
- <br>
- </p>
-<p><a name="connections"><strong>"Connections"
-Preferences tab</strong></a></p>
-<p><em>URL Link From Sequence ID</em><br>
-These definitions are used to generate URLs from a sequence's ID or
-database cross references. Read more about <a
- href="../webServices/urllinks.html#urllinks">configuring URL links
-here</a>.</p>
-<p><em>Default Browser (Unix)</em><br>
-Its difficult in Java to detect the default web browser for Unix users.
-If Jalview can't find your default web browser, enter the name or full
-path to your web browser application.</p>
-<p><em>Proxy Server</em><br>
-If you normally use a proxy server for using the internet, you must tick
-the box "Use a Proxy Server" and enter the address and port
-details as necessary. Web Services will not work if you are using a
-proxy server and do not enter the settings here.</p>
-<p><em>Usage statistics, Questionnaire and Version checks</em><br>
-Uncheck these options to prevent Jalview from submitting usage
-statistics to google analytics, checking for jalview questionnaires or
-retrieving details of the latest release version (at www.jalview.org).
-See the <a href="../privacy.html">user privacy statement</a> for more
-information.</p>
-<p><a name="output"><strong>Output Preferences tab</strong></a></p>
-<p><em>EPS Rendering Style</em><br>
-This is a selection box which allows the user to set a default rendering
-style for EPS export:
-<ul>
- <li>"Lineart"<br>
- EPS files will accurately reproduce the alignment view in Jalview and
- all characters will be converted into line art. Files generated in this
- way are large and are not easily editable, but have no font table
- dependencies.</li>
- <li>"Text"<br>
- EPS files will be a mixture of text and lineart. This produces compact
- files that can be edited easily in programs like Microsoft Word and
- Adobe Illustrator, but can be problematic if the fonts available to
- jalview are not accessible by the program reading the EPS file.
- <li>"Prompt each time"<br>
- Choose this to be asked select between Lineart and Text each time you
- make an EPS file.</li>
-</ul>
-</p>
-<p><em>Sequence//Start-End Numbering</em><br>
-The output tab also has a group of checkboxes for each file format. If
-these are ticked, then Jalview will write files with the start and end
-sequence positions appended to each sequence id: <pre>
+ <p>
+ <strong>Preferences</strong>
+ </p>
+ <p>
+ The preferences panel is opened from the Jalview Desktop’s <strong><em>Tools</em></strong>
+ menu.
+ </p>
+ <p>There are eight tabs in the Preferences dialog box:
+ <ul>
+ <li>The <a href="#visual"><strong>"Visual"</strong>
+ Preferences</a> tab allows you to configure the default display for
+ a new alignment window.
+ </li>
+ <li>The <a href="#colours"><strong>"Colours"</strong>
+ Preferences</a> tab allows you to configure default colourschemes
+ for a new alignment window.
+ </li>
+ <li>The <a href="#structure"><strong>"Structure"</strong>
+ Preferences</a> tab allows you to configure options for obtaining
+ and displaying structure information.
+ </li>
+ <li>The <a href="#connections"><strong>"Connections"</strong>
+ Preferences</a> tab allows you to change the links made from Jalview
+ to your default web browser.
+ </li>
+ <li>The <a href="#output"><strong>"Output"</strong>
+ Preferences</a> tab contains settings affecting the export of
+ sequence alignments and EPS files.
+ </li>
+ <li>The <a href="#editing"><strong>"Editing"</strong>
+ Preferences</a> tab contains settings affecting the export of
+ sequence alignments and EPS files.
+ </li>
+ <li>The <a href="dassettings.html"><strong>"DAS
+ Settings"</strong> Preferences</a> tab allows you to select which DAS
+ sources to use when fetching DAS Features.
+ </li>
+ <li>The <a href="../webServices/webServicesPrefs.html"><strong>"Web
+ Service"</strong> Preferences</a> tab allows you to configure the <a
+ href="http://www.compbio.dundee.ac.uk/jabaws"
+ >JABAWS</a> servers that Jalview uses, and change the layout of the
+ alignment's Web Services menu.
+ </li>
+ </ul>
+ </p>
+ <p>
+ <strong><a name="visual">Visual</a> Preferences tab</strong>
+ </p>
+ <p>
+ <em>Maximise Window</em> - If this is selected, a new alignment
+ window will stretch to fit the available space.
+ </p>
+ <p>
+ <em>Open Overview Window</em> - When this is selected, the <a
+ href="overview.html"
+ >alignment overview</a> panel is opened by default for a new alignment
+ window.
+ </p>
+ <p>
+ <em>Show Annotations</em> - If this is selected the new window will
+ display an annotation panel below the sequences. This annotation
+ panel may have several rows describing the whole alignment. The 3
+ standard annotations <em>Conservation</em>, <em>Quality</em> and <em>Consensus</em>
+ for the alignment may be shown or hidden by default using the
+ checkboxes below.
+ </p>
+ <p>
+ <em>Show group: Conservation and Consensus</em> controls the display
+ of per-group automatic annotation.
+ </p>
+ <p>
+ <em>Consensus: Histogram and Logo</em> checkboxes control the
+ display of the consensus histogram and sequence logo for consensus
+ annotation rows.
+ </p>
+ <p>
+ <em>Full Sequence ID</em> - If selected the ID panel will display
+ the name of a sequence plus the start and end residues in the format
+ name/start-end. If not selected, the displayed ID will be the name
+ of the sequence.
+ </p>
+ <p>
+ <em>Right Align IDs</em> - select to align all sequence IDs to the
+ left-hand edge of the sequence alignment, rather than the left-hand
+ edge of the alignment display window.
+ </p>
+ <p>
+ <em>Font</em> - The default font name, size and style can be set for
+ a new alignment window.
+ </p>
+ <p>
+ <em>Sequence ID Tooltip</em>: Control the display of Database
+ References and Non-positional annotation in the tooltip displayed
+ when the mouse is over a sequence's ID.
+ </p>
+ <p>
+ <em>Show Unconserved</em> - When this is selected, all consensus
+ sequence symbols will be rendered as a '.', highlighting mutations
+ in highly conserved alignments.
+ </p>
+ <p>
+ <em>Sequence Name Italics</em> - select to apply the italicised
+ version of the font to sequence labels.
+ </p>
+ <p>
+ <em>Smooth Font</em> - Toggles anti-aliasing on / off for faster
+ rendering of the alignment.
+ </p>
+ <p>
+ <em>Gap Symbol</em> - The default gap symbol may be set to either
+ "-" or "."
+ </p>
+ <p>
+ <em>Wrap Alignment</em> - Select whether to open new alignment
+ windows in wrapped mode or not.
+ </p>
+ <p>
+ <em>Sort alignment by</em> - When the alignment is loaded in, it can
+ be ordered as read (No sort), or sorted by Id or pairwise identity.
+ </p>
+ <p>
+ <em>Sort annotations by</em> - Annotations can be unsorted, sorted
+ by the order of the related sequences in the alignment, or by label.
+ Autocalculated annotations (e.g. Consensus) can be shown either last
+ (below sequence annotations) or first (above sequence annotations).
+ <em>Since Jalview 2.8.2.</em>
+ </p>
+ <p>
+ <em>Open file</em> - If this is selected then the default alignment
+ file will be opened when Jalview is started. You can change the
+ default file by clicking on file name and either typing in the file
+ path or selecting it from the file chooser window.<br />
+ <em>Note: The default example alignment is updated periodically
+ to demonstrate new features in Jalview.</em>
+ </p>
+ <p>
+ <a name="colours"><strong>"Colours"
+ Preferences tab</strong>
+ </p>
+ <p>
+ <em>Alignment Colour</em> - The default colour scheme for a new
+ alignment window. If the chosen option is "User Defined"
+ then the last User Defined Colour loaded or saved via the User
+ Defined Colours panel will be loaded.
+ </p>
+ <p>
+ <em>Annotation Shading Default</em> - set the default minimum and
+ maximum colours used when <a
+ href="../colourSchemes/annotationColouring.html"
+ >Colour by Annotation...</a> is selected from the alignment window's
+ colours menu.
+ </p>
+ <p>
+ <a name="structure"><strong>"Structure"
+ Preferences tab</strong></a><em> added in Jalview 2.8.2</em>
+ </p>
+ <p>
+ <em>Process secondary structure from PDB</em> - if selected, then
+ structure information read from PDB will be processed and annotation
+ added to associated sequences.
+ <p>
+ <em>Use RNAView for secondary structure</em> - if selected, the
+ pyRNA RNAView service (<a href="https://github.com/fjossinet/PyRNA">https://github.com/fjossinet/PyRNA</a>)
+ will be called to derive secondary structure information for RNA
+ chains.
+ <p>
+ <em>Add secondary structure annotation to alignment</em> - if
+ selected, <a href="http://swift.cmbi.ru.nl/gv/dssp/">Jmol's
+ implementation DSSP</a> will be used to add annotation to polypeptide
+ chains in the structure.
+ <p>
+ <em>Add Temperature Factor annotation to alignment</em> - if
+ selected, values extracted from the Temperature Factor column for
+ the backbone atoms in the PDB file will be extracted as annotation
+ lines shown on the alignment.
+ <p>
+ <em>Default structure viewer</em> - choose JMOL or CHIMERA for
+ viewing 3D structures.
+ <p>
+ <em>Path to Chimera program</em> - Optional, as Jalview will search
+ standard installation paths for Windows, Linux or MacOS. If you have
+ installed Chimera in a non-standard location, you can specify it
+ here, by entering the full path to the Chimera executable program.
+ Double-click this field to open a file chooser dialog.
+ <p>
+ <a name="connections"><strong>"Connections"
+ Preferences tab</strong></a>
+ </p>
+ <p>
+ <em>URL Link From Sequence ID</em><br> These definitions are
+ used to generate URLs from a sequence's ID or database cross
+ references. Read more about <a
+ href="../webServices/urllinks.html#urllinks"
+ >configuring URL links here</a>.
+ </p>
+ <p>
+ <em>Default Browser (Unix)</em><br> Its difficult in Java to
+ detect the default web browser for Unix users. If Jalview can't find
+ your default web browser, enter the name or full path to your web
+ browser application.
+ </p>
+ <p>
+ <em>Proxy Server</em><br> If you normally use a proxy server
+ for using the internet, you must tick the box "Use a Proxy
+ Server" and enter the address and port details as necessary.
+ Web Services will not work if you are using a proxy server and do
+ not enter the settings here.
+ </p>
+ <p>
+ <em>Usage statistics, Questionnaire and Version checks</em><br>
+ Uncheck these options to prevent Jalview from submitting usage
+ statistics to google analytics, checking for Jalview questionnaires
+ or retrieving details of the latest release version (at
+ www.jalview.org). See the <a href="../privacy.html">user privacy
+ statement</a> for more information.
+ </p>
+ <p>
+ <a name="output"><strong>Output Preferences tab</strong></a>
+ </p>
+ <p>
+ <em>EPS Rendering Style</em><br> This is a selection box which
+ allows the user to set a default rendering style for EPS export:
+ <ul>
+ <li>"Prompt each time"<br> Choose this to be
+ asked select between Lineart and Text each time you make an EPS
+ file.
+ </li>
+ <li>"Lineart"<br> EPS files will accurately
+ reproduce the alignment view in Jalview and all characters will be
+ converted into line art. Files generated in this way are large and
+ are not easily editable, but have no font table dependencies.
+ </li>
+ <li>"Text"<br> EPS files will be a mixture of
+ text and lineart. This produces compact files that can be edited
+ easily in programs like Microsoft Word and Adobe Illustrator, but
+ can be problematic if the fonts available to Jalview are not
+ accessible by the program reading the EPS file.
+ </ul>
+ <p>
+ <em>Automatically set ID width</em><br> When enabled, the
+ column containing sequence and annotation labels at the left hand
+ side of an exported figure will be made large enough to display each
+ sequence ID and annotation label in its own line. Enable this if you
+ have particularly long sequence IDs and need to generate EPS or PNG
+ figures or web pages.
+ </p>
+ <p>
+ <em>Figure ID column width</em><br> Manually specify the width
+ of the left hand column where sequence IDs and annotation labels
+ will be rendered in exported alignment figures. This setting will be
+ ignored if <em>"Automatically set ID width"</em> is set.
+ </p>
+ <p>
+ <em>Sequence//Start-End Numbering</em><br> The output tab also
+ has a group of checkboxes for each file format. If these are ticked,
+ then Jalview will write files with the start and end sequence
+ positions appended to each sequence id:
+ <pre>
>ID/1-10
AACDEAAFEA
</pre>
-<p>If the boxes are left unchecked for a particular format, the
-sequence limits will not be appended to the sequence id.</p>
-</p>
-<p><em>Use Modeller Output</em></p>
-<p>This option only applies to PIR format output. Jalview
-automatically reads PIR files with sequence descriptions compatible with
-the program <a href="http://salilab.org/modeller/">Modeller</a>. If this
-option is selected <a href="../io/modellerpir.html">Jalview will
-write Modeller style PIR files</a> with correct start/end numbering and PDB
-file association (if available). The Jalview id/start-end option is
-ignored if Modeller output is selected.
-<p><a name="editing"><strong>Editing Preferences tab</strong></a></p>
-<p>There are currently 2 options available which can be selected /
-deselected.</p>
-<p><em>AutoCalculate Consensus</em> - For large alignments it can be
-useful to deselect "Autocalculate Consensus" when editing.
-This prevents lengthy calculations which are performed after each
-sequence edit. New alignment windows will have their "Autocalculate
-Consensus" option set according to this setting.</p>
-<p><em>Pad gaps when editing</em> - New alignment windows will
-"Pad Gaps" according to this setting.</p>
-<p> </p>
-<p> </p>
+ <p>If the boxes are left unchecked for a particular format, the
+ sequence limits will not be appended to the sequence id.</p>
+ <p>
+ <em>Embed BioJSON to HTML export</em>
+ </p>
+ <p>
+ When this option is enabled, Jalview embeds <a
+ href="bioJsonFormat.html"
+ >BioJSON</a> data within HTML files exported from Jalview at
+ generation time. This enables the exported HTML files to be
+ extracted and imported back into the Jalview desktop application at
+ a later time.
+ <p>
+ <em>Use Modeller Output</em>
+ </p>
+ <p>
+ This option only applies to PIR format output. Jalview automatically
+ reads PIR files with sequence descriptions compatible with the
+ program <a href="http://salilab.org/modeller/">Modeller</a>. If this
+ option is selected <a href="../io/modellerpir.html">Jalview will
+ write Modeller style PIR files</a> with correct start/end numbering
+ and PDB file association (if available). The Jalview id/start-end
+ option is ignored if Modeller output is selected.
+ <p>
+ <a name="editing"><strong>Editing Preferences tab</strong></a>
+ </p>
+ <p>There are currently three options available which can be
+ selected / deselected.</p>
+ <p>
+ <em>AutoCalculate Consensus</em> - For large alignments it can be
+ useful to deselect "Autocalculate Consensus" when editing.
+ This prevents lengthy calculations which are performed after each
+ sequence edit. New alignment windows will have their
+ "Autocalculate Consensus" option set according to this
+ setting.
+ </p>
+ <p>
+ <em>Pad Gaps when Editing</em> - New alignment windows will
+ "Pad Gaps" according to this setting.
+ </p>
+ <p>
+ <em>Sort with New Tree</em> - When selected, any trees calculated or
+ loaded onto the alignment will automatically sort the alignment.
+ </p>
+ <p> </p>
+ <p> </p>
</body>
</html>
diff --git a/help/html/features/schooser_enter-id.png b/help/html/features/schooser_enter-id.png
new file mode 100644
index 0000000..f551c50
Binary files /dev/null and b/help/html/features/schooser_enter-id.png differ
diff --git a/help/html/features/schooser_main.png b/help/html/features/schooser_main.png
new file mode 100644
index 0000000..ab69427
Binary files /dev/null and b/help/html/features/schooser_main.png differ
diff --git a/help/html/features/search.html b/help/html/features/search.html
index 0c733e4..2c1ed0f 100644
--- a/help/html/features/search.html
+++ b/help/html/features/search.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Search</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Search</title>
<style type="text/css">
<!--
td {
@@ -27,90 +31,103 @@ td {
</head>
<body>
-<p><strong>Search</strong></p>
-<p>The search box is displayed by pressing Control and F or
- selecting "Find..." from the "Search" menu.</p>
-<img src="search.gif" width="339" height="110">
-<p>"Find next" will find the next occurence of the specified and adjust
- the alignment window view to show it, and "Find all" highlights all
- matches for a pattern. The "New Feature" is a quick way to highlight
- and group residues matching the specified search pattern throughout the alignment.
-<ul>
- <li>The search uses regular expressions. (understands a mixture of posix and
- perl style regex - see below for a summary)</li>
- <li>Gaps are ignored when matching the query to the sequences in the alignment.</li>
- <li>The search is applied to both sequences and their IDs.</li>
- <li>If a region is selected, then search will <strong>only</strong> be performed
- on that region. </li>
- <li>To quickly clear the current selection, press the "Escape" key.</li>
- <li>Tick the "Match Case" box to perform a case sensitive search.</li>
-</ul>
-<p><strong>Creating Features from Search Results</strong></p>
-<p>
- If "New Feature" is selected, the feature can be given a name from
- a popup input box. Use the "Feature Settings" under the "View"
- menu to change the visibility and colour of the new sequence feature.</p>
-<p><strong>A quick Regular Expression Guide</strong></p>
-<p>A regular expression is not just a simple text query - although it
-can be used like one, the query is not parsed literally, but
-interpreted like a series of instructions defining the features of the
-match. For example, a simple query like "ACDED" would
-match all occurences of that string, but "ACD+ED" matches
-both 'ACDDED' and 'ACDDDDDDDDED'. More usefully, the query
-"[ILGVMA]{;5,}" would find stretches of small,
-hydrophobic amino acids of at least five residues in length.
-</p>
-<p> The table
-below describes some of the regular expression syntax:<br></p>
-<table width="100%" border="1">
- <tr>
- <td width="24%">Regular Expression Element</td>
- <td width="76%">Effect</td>
- </tr>
- <tr>
- <td width="24%">.</td>
- <td width="76%">Matches any single character</td>
- </tr>
- <tr>
- <td>[]</td>
- <td>Matches any one of the characters in the brackets</td>
- </tr>
- <tr>
- <td>^</td>
- <td>Matches at the start of an ID or sequence</td>
- </tr>
- <tr>
- <td>$</td>
- <td>Matches at the end of an ID or sequence</td>
- </tr>
- <tr>
- <td>*</td>
- <td>Matches if the preceding element matches zero or more times</td>
- </tr>
- <tr>
- <td>?</td>
- <td>Matches if the preceding element matched once or not at all</td>
- </tr>
- <tr>
- <td>+</td>
- <td>Matches if the preceding element matched at least once</td>
- </tr>
- <tr>
- <td>{count}</td>
- <td>Matches if the preceding element matches a specified number of
- times
- </td>
- </tr>
- <tr>
- <td>{min,}</td>
- <td> Matches of the preceding element matched at least the
- specified number of times</td>
- </tr>
- <tr>
- <td>{min,max} </td>
- <td>Matches if the preceding element matches min or at most max
- number of times</td>
- </tr>
-</table>
+ <p>
+ <strong>Search</strong>
+ </p>
+ <p>The search box is displayed by pressing Control and F or
+ selecting "Find..." from the "Search" menu.</p>
+ <img src="search.gif" width="339" height="110">
+ <p>"Find next" will find the next occurence of the
+ specified and adjust the alignment window view to show it, and
+ "Find all" highlights all matches for a pattern. The
+ "New Feature" is a quick way to highlight and group
+ residues matching the specified search pattern throughout the
+ alignment.
+ <ul>
+ <li>The search uses regular expressions. (understands a mixture
+ of posix and perl style regex - see below for a summary)</li>
+ <li>Gaps are ignored when matching the query to the sequences
+ in the alignment.</li>
+ <li>The search is applied to both sequences and their IDs.</li>
+ <li>If a region is selected, then search will <strong>only</strong>
+ be performed on that region.
+ </li>
+ <li>To quickly clear the current selection, press the
+ "Escape" key.</li>
+ <li>Tick the "Match Case" box to perform a case
+ sensitive search.</li>
+ </ul>
+ <p>
+ <strong>Creating Features from Search Results</strong>
+ </p>
+ <p>If "New Feature" is selected, the feature can be
+ given a name from a popup input box. Use the "Feature
+ Settings" under the "View" menu to change the
+ visibility and colour of the new sequence feature.</p>
+ <p>
+ <strong>A quick Regular Expression Guide</strong>
+ </p>
+ <p>A regular expression is not just a simple text query - although
+ it can be used like one, the query is not parsed literally, but
+ interpreted like a series of instructions defining the features of
+ the match. For example, a simple query like "ACDED" would
+ match all occurences of that string, but "ACD+ED" matches
+ both 'ACDDED' and 'ACDDDDDDDDED'. More usefully, the query
+ "[ILGVMA]{;5,}" would find stretches of small, hydrophobic
+ amino acids of at least five residues in length.</p>
+ <p>
+ The table below describes some of the regular expression syntax:<br>
+ </p>
+ <table width="100%" border="1">
+ <tr>
+ <td width="24%">Regular Expression Element</td>
+ <td width="76%">Effect</td>
+ </tr>
+ <tr>
+ <td width="24%">.</td>
+ <td width="76%">Matches any single character</td>
+ </tr>
+ <tr>
+ <td>[]</td>
+ <td>Matches any one of the characters in the brackets</td>
+ </tr>
+ <tr>
+ <td>^</td>
+ <td>Matches at the start of an ID or sequence</td>
+ </tr>
+ <tr>
+ <td>$</td>
+ <td>Matches at the end of an ID or sequence</td>
+ </tr>
+ <tr>
+ <td>*</td>
+ <td>Matches if the preceding element matches zero or more
+ times</td>
+ </tr>
+ <tr>
+ <td>?</td>
+ <td>Matches if the preceding element matched once or not at
+ all</td>
+ </tr>
+ <tr>
+ <td>+</td>
+ <td>Matches if the preceding element matched at least once</td>
+ </tr>
+ <tr>
+ <td>{count}</td>
+ <td>Matches if the preceding element matches a specified
+ number of times</td>
+ </tr>
+ <tr>
+ <td>{min,}</td>
+ <td>Matches of the preceding element matched at least the
+ specified number of times</td>
+ </tr>
+ <tr>
+ <td>{min,max}</td>
+ <td>Matches if the preceding element matches min or at most
+ max number of times</td>
+ </tr>
+ </table>
</body>
</html>
diff --git a/help/html/features/selectfetchdb.gif b/help/html/features/selectfetchdb.gif
new file mode 100644
index 0000000..6e1ce10
Binary files /dev/null and b/help/html/features/selectfetchdb.gif differ
diff --git a/help/html/features/seqfeatures.html b/help/html/features/seqfeatures.html
index e77ec85..99b008e 100644
--- a/help/html/features/seqfeatures.html
+++ b/help/html/features/seqfeatures.html
@@ -1,81 +1,112 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Sequence Features</title>
</head>
<body>
-<p><strong>Sequence Features</strong></p>
-<p>Jalview can colour parts of a sequence based on the presence of
-sequence features - which may be retrieved from database records (such
-as Uniprot), the result of <a href="search.html">sequence motif
-searches</a> or simply read from a <a href="featuresFormat.html">sequence
-features file</a>. You can also <a href="creatinFeatures.html">create
-features</a> from the results of searches or the current selection, and <a
- href="editingFeatures.html">edit features</a> by double clicking on
-them.</p>
-<p><strong>Sequence Feature Colouring Styles</strong></p>
-<p>By default, Jalview will assign a color to each feature based on
-its type. These colours can be changed from the <a
- href="featuresettings.html">feature settings</a> and <a
- href="editingFeatures.html">amend features</a> dialog boxes. Since
-Jalview 2.5, it is also possible to define <a href="featureschemes.html">feature
-colourschemes</a> to shade features based on their associated scores or text
-labels.</p>
-<p><strong>Sequence Feature Groups</strong></p>
-<p>Since Jalview 2.08, sequence features assigned to a sequence can
-be organised into groups, which may indicate that the features were all
-retrieved from the same database (such as Uniprot features), or
-generated by the same analysis process (as might be specified in a <a
- href="featuresFormat.html">sequence features file</a>).</p>
-<p><strong>Sequence Feature Inheritance</strong></p>
-<p>Since Jalview 2.08, sequence features are <em>global</em> to a
-set of sequences appearing (independently or together) in many different
-alignments. Practically, this means features loaded onto one alignment
-can be viewed in any alignments involving the same sequences. The same
-sequence appears in different alignments when a new alignment is
-generated by submitting an existing set of sequences to one of the
-alignment or prediction web services, and when sequences are copied and
-pasted into other alignment windows.</p>
-<p><strong>View→Show Sequence Features</strong></p>
-<p>Toggle the display of sequence features in this alignment. If
-feature retrieval has not already been carried out, then Jalview will
-automatically try to fetch sequence features (as described below).</p>
-<p><strong>View→Sequence Feature Settings...</strong></p>
-<p>Once sequence features have been loaded, their display can be
-fully controlled using the alignment window's <a
- href="featuresettings.html">Sequence Feature Settings</a> dialog box.
-Feature colour schemes and display parameters are unique to a particular
-alignment, so it is possible to colour the same sequence features
-differently in different alignment views.<br>
-Since Jalview 2.1, it is possible to add <a href="dassettings.html">DAS
-features</a> to an alignment via the DAS tabbed pane of the feature settings
-window.</p>
-<p><strong>View→Sequence ID Tooltip→Show
-Non-Positional features</strong><br>
-<em>Only available in application</em></br>
-</p>
-<p>Toggles the display of non-positional features in the sequence ID
-tooltip, and whether they will be included when sequence features are
-exported using "File→Export Features".</p>
-<p>Precalculated Sequence Features may be added to an alignment from
-the command line, drag and drop, or from the "File→Load
-Features / Annotations" menu item. See the <a
- href="featuresFormat.html">Features File Format</a> for more details.</p>
+ <p>
+ <strong>Sequence Features</strong>
+ </p>
+ <p>
+ Jalview can colour parts of a sequence based on the presence of
+ sequence features - which may be retrieved from database records
+ (such as Uniprot), the result of <a href="search.html">sequence
+ motif searches</a> or simply read from a <a href="featuresFormat.html">sequence
+ features file</a>. You can also <a href="creatinFeatures.html">create
+ features</a> from the results of searches or the current selection,
+ and <a href="editingFeatures.html">edit features</a> by double
+ clicking on them.
+ </p>
+ <p>
+ <strong>Sequence Feature Colouring Styles</strong>
+ </p>
+ <p>
+ By default, Jalview will assign a color to each feature based on its
+ type. These colours can be changed from the <a
+ href="featuresettings.html"
+ >feature settings</a> and <a href="editingFeatures.html">amend
+ features</a> dialog boxes. Since Jalview 2.5, it is also possible to
+ define <a href="featureschemes.html">feature colourschemes</a> to
+ shade features based on their associated scores or text labels.
+ </p>
+ <p>
+ <strong>Sequence Feature Groups</strong>
+ </p>
+ <p>
+ Since Jalview 2.08, sequence features assigned to a sequence can be
+ organised into groups, which may indicate that the features were all
+ retrieved from the same database (such as Uniprot features), or
+ generated by the same analysis process (as might be specified in a <a
+ href="featuresFormat.html"
+ >sequence features file</a>).
+ </p>
+ <p>
+ <strong>Sequence Feature Inheritance</strong>
+ </p>
+ <p>
+ Since Jalview 2.08, sequence features are <em>global</em> to a set
+ of sequences appearing (independently or together) in many different
+ alignments. Practically, this means features loaded onto one
+ alignment can be viewed in any alignments involving the same
+ sequences. The same sequence appears in different alignments when a
+ new alignment is generated by submitting an existing set of
+ sequences to one of the alignment or prediction web services, and
+ when sequences are copied and pasted into other alignment windows.
+ </p>
+ <p>
+ <strong>View→Show Sequence Features</strong>
+ </p>
+ <p>Toggle the display of sequence features in this alignment. If
+ feature retrieval has not already been carried out, then Jalview
+ will automatically try to fetch sequence features (as described
+ below).</p>
+ <p>
+ <strong>View→Sequence Feature Settings...</strong>
+ </p>
+ <p>
+ Once sequence features have been loaded, their display can be fully
+ controlled using the alignment window's <a
+ href="featuresettings.html"
+ >Sequence Feature Settings</a> dialog box. Feature colour schemes and
+ display parameters are unique to a particular alignment, so it is
+ possible to colour the same sequence features differently in
+ different alignment views.<br> Since Jalview 2.1, it is
+ possible to add <a href="dassettings.html">DAS features</a> to an
+ alignment via the DAS tabbed pane of the feature settings window.
+ </p>
+ <p>
+ <strong>View→Sequence ID Tooltip→Show
+ Non-Positional features</strong><br> <em>Only available in
+ application</em></br>
+ </p>
+ <p>Toggles the display of non-positional features in the sequence
+ ID tooltip, and whether they will be included when sequence features
+ are exported using "File→Export Features".</p>
+ <p>
+ Precalculated Sequence Features may be added to an alignment from
+ the command line, drag and drop, or from the "File→Load
+ Features / Annotations" menu item. See the <a
+ href="featuresFormat.html"
+ >Features File Format</a> for more details.
+ </p>
</body>
</html>
diff --git a/help/html/features/seqfetch.html b/help/html/features/seqfetch.html
index cca5c66..8870550 100644
--- a/help/html/features/seqfetch.html
+++ b/help/html/features/seqfetch.html
@@ -1,72 +1,99 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Sequence Fetcher</title>
</head>
<body>
-<p><strong>Sequence Fetcher</strong></p>
-<p>Jalview can retrieve sequences from certain databases using
-either the WSDBFetch service provided by the European Bioinformatics
-Institute, and, since Jalview 2.4, DAS servers capable of the <em>sequence</em>
-command (configured in <a href="dassettings.html">DAS settings</a>).</p>
-<img src="seqfetcher.gif" align="center"
- alt="The Jalview Sequence Fetcher Dialog Box">
-<p>The Sequence Fetcher dialog box can be opened via the
-"File" menu on the main desktop in order to retrieve sequences
-as a new alignment, or opened via the "File" menu of an
-existing alignment to import additional sequences. Please note, there
-will be a short delay when the sequence fetcher is first opened, whilst
-Jalview compiles the list of available sequence datasources from the
-currently defined DAS server registry.</strong></p>
-<p>First, select the database you want to retrieve sequences from.
-Then, enter one or more accession ids (as a semi-colon separated list),
-or press the "Example" button to paste the example accession
-for the currently selected database into the retrieval box. Finally,
-press "OK" to initiate the retrieval.</p>
-<p><em>Fetching Individual PDB Chains</em><br>
-If you are retrieving sequences from the PDB, you can retrieve specific
-chains by appending a colon and the chain id to the PDB id. For example
-:<br>
-<pre> 1GAQ:A</pre>
-</p>
-<p><em>Retrieving parts of large sequence records</em><br>
-When retrieving from DAS sequence sources, coordinate range arguments
-can be passed to the server using the standard DAS sequence command
-format:<pre>
- <AccessionId>:<start>,<end></pre> If you know a source
-understands this type of query format, then you should untick the
-checkbox for 'replace commas with semi-colons' so the range query can be
-passed to the server; otherwise, the query will be split into two (e.g
-'Mito:1' and '85779' rather than 'Mito:1,85779'). In most cases,
-however, a source that supports range queries will include a range
-qualification in its example query, and Jalview will then automatically
-disable the 'replace commas with semi-colons' option.<br>
-<em>The option to disable the comma to semi-colon translation was
-added in Jalview 2.6</em></p>
-<p>If you use the WSDBFetch sequence fetcher services (EMBL,
-Uniprot, PDB and PFAM) in work for publication, please cite:</p>
-<p>Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S.,
-Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez
-R. <br>
-SOAP-based services provided by the European Bioinformatics Institute.<br>
-Nucleic Acids Res. 33(1):W25-W28 (2005) <br>
-<br>
-</p>
+ <p>
+ <strong>Sequence Fetcher</strong>
+ </p>
+ <p>
+ Jalview can retrieve sequences from certain databases using either
+ the DBFetch service provided by the EMBL European Bioinformatics
+ Institute, or, since Jalview 2.4, DAS servers capable of the <em>sequence</em>
+ command (configured in <a href="dassettings.html">DAS settings</a>).
+ </p>
+ <img src="seqfetcher.gif" align="center"
+ alt="The Jalview Sequence Fetcher Dialog Box"
+ >
+ <p>The Sequence Fetcher dialog box can be opened via the
+ "File" menu on the main desktop in order to retrieve
+ sequences as a new alignment, or opened via the "File"
+ menu of an existing alignment to import additional sequences. There
+ may be a short delay when the sequence fetcher is first opened,
+ whilst Jalview compiles the list of available sequence datasources
+ from the currently defined DAS server registry.</p>
+ <p>
+ First, <strong>select the database you want to retrieve
+ sequences from</strong> by clicking the button labeled 'Select database
+ retrieval source'. If a database source is already selected, then
+ the button's label will change to show the currently selected
+ database.
+ </p>
+ <img src="selectfetchdb.gif" align="left"
+ alt="Database selection dialog for fetching sequences (introduced in Jalview 2.8)"
+ >
+ <p>Since Jalview 2.8, the available databases are shown as a tree
+ in a popup dialog box. The databases are ordered alphabetically, and
+ if there are many sources for the same type of sequence identifier,
+ they will be grouped together in a sub-branch branch labeled with
+ the identifier.</p>
+ <p>
+ Once you have selected the sequence database using the popup dialog
+ box, <strong>enter one or more accession ids</strong> (as a
+ semi-colon separated list), or press the "Example" button
+ to paste the example accession for the currently selected database
+ into the retrieval box. Finally, press "OK" to initiate
+ the retrieval.
+ </p>
+ <p>
+ <strong>Fetching from The PDB with the EMBL-EBI PDBe Search
+ Interface</strong>
+ </p>
+ <p>
+ Since Jalview 2.9, selecting PDB as the sequence database will open
+ the <a href="pdbsequencefetcher.html">PDB Sequence Fetcher</a> for
+ discovering and retrieving structures.
+ </p>
+ <p>
+ <strong>Only retrieving part of a sequence</strong>
+ </p>
+ <p>
+ DAS sources (indicated by a "<em>(DAS)</em>") allow a
+ range to be specified in addition to a sequence ID. To retrieve 50
+ residues starting at position 35 in UNIPROT sequence P73137 using
+ the UNIPROT DAS server, you would enter "'P73137:35,84'.<br />
+ <em>Full support for DAS range queries was introduced in
+ Jalview 2.8</em>
+ </p>
+
+ <p>If you use the WSDBFetch sequence fetcher services (EMBL,
+ Uniprot, PFAM, and RFAM) in work for publication, please cite:</p>
+ <p>
+ Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate
+ J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez
+ R. <br> SOAP-based services provided by the European
+ Bioinformatics Institute.<br> Nucleic Acids Res. 33(1):W25-W28
+ (2005) <br> <br>
+ </p>
</body>
</html>
diff --git a/help/html/features/seqfetcher.gif b/help/html/features/seqfetcher.gif
index 652976f..03ddd79 100644
Binary files a/help/html/features/seqfetcher.gif and b/help/html/features/seqfetcher.gif differ
diff --git a/help/html/features/seqmappings.html b/help/html/features/seqmappings.html
index bb93c97..1b078d0 100644
--- a/help/html/features/seqmappings.html
+++ b/help/html/features/seqmappings.html
@@ -1,39 +1,46 @@
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head>
-<title>Mapping Between Different Sequences</title>
-</head>
-<body>
-<p><strong>Mapping Between Different Sequences</strong></p>
-<p>A new feature in Jalview 2.3 is the ability to map between sequences in different
- domains, based on alignment, or by the use of explicit mappings provided by
- databases. </p>
-<p>The most familiar mapping is the one used to identify
-the coordinates corresponding to a displayed sequence when
-viewing a PDB file associated with a sequence (see
-<a href="viewingpdbs.html">"Viewing PDB Files"</a>
-for more information.</p>
-<p>The newest form of mapping supported by Jalview is the
-correspondence between DNA and protein sequences. This mapping
-can be imported directly from EMBL and EMBLCDS database records
-retrieved by the <a href="seqfetch.html">Sequence Fetcher</a>,
-and allows sequence features to be mapped directly from Uniprot
-das sources to their coding region on EMBL sequence records.
-</body>
-</html>
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Mapping Between Different Sequences</title>
+</head>
+<body>
+ <p>
+ <strong>Mapping Between Different Sequences</strong>
+ </p>
+ <p>A new feature in Jalview 2.3 is the ability to map between
+ sequences in different domains, based on alignment, or by the use of
+ explicit mappings provided by databases.</p>
+ <p>
+ The most familiar mapping is the one used to identify the
+ coordinates corresponding to a displayed sequence when viewing a PDB
+ file associated with a sequence (see <a href="viewingpdbs.html">"Viewing
+ PDB Files"</a> for more information.
+ </p>
+ <p>
+ The newest form of mapping supported by Jalview is the
+ correspondence between DNA and protein sequences. This mapping can
+ be imported directly from EMBL and EMBLCDS database records
+ retrieved by the <a href="seqfetch.html">Sequence Fetcher</a>, and
+ allows sequence features to be mapped directly from Uniprot das
+ sources to their coding region on EMBL sequence records.
+</body>
+</html>
diff --git a/help/html/features/splitView.html b/help/html/features/splitView.html
new file mode 100644
index 0000000..f91b8e5
--- /dev/null
+++ b/help/html/features/splitView.html
@@ -0,0 +1,163 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Split Frame Views</title>
+</head>
+<body>
+ <p>
+ <strong>Split Frame Views</strong>
+ </p>
+ <p>
+ Jalview provides a special viewing mode to show Coding DNA (cDNA)
+ and protein product alignments as a split view, with cDNA above and
+ protein below. The two alignments are linked, allowing editing and
+ analysis to be performed at both the peptide and nucleotide level.
+ Linked protein alignments also have an additional <strong>cDNA
+ Consensus</strong> annotation row, showing the distribution of codons at
+ each column of the protein alignment.
+ </p>
+ <p>
+ Split Frame views can be <a href="#opensplit">created in a
+ number of ways</a>. In the Jalview Desktop, Split Frame views are
+ saved in Jalview Projects, like any other alignment view.
+ </p>
+ <p>
+ <strong>Operations supported in Split Frame Mode</strong>
+ </p>
+ <p>Split Frame views allow the following:
+ <ul>
+ <li>Mouseover or scrolling of either alignment is followed by
+ the other (unless you turn off <strong><a
+ href="../menus/alwview.html"
+ >"View→Automatic Scrolling"</a></strong>)
+ </li>
+ <li>On selecting rows, columns or regions in one alignment, the
+ corresponding selection is made in the other</li>
+ <li>Sequence ordering in one alignment (using the cursor, or <strong><a
+ href="../calculate/sorting.html"
+ >"Calculate→Sort")</a></strong> is also applied to the other
+ </li>
+ <li>Editing (gap insertion / deletion) in the protein alignment
+ is reflected in the cDNA (but not vice versa)</li>
+ <li>Any trees imported or created with <strong><a
+ href="../calculations/tree.html"
+ >"Calculate Tree"</a></strong> on one of the views allow both cDNA and
+ Protein views to be grouped, coloured or sorted.
+ </li>
+ <li>To allow for the different widths in cDNA and Protein
+ alignments, the <strong><a href="../menus/alwformat.html">"Format→Font"</a></strong>
+ menu option has an option 'Scale protein residues to codons'. This
+ option will make each protein residue the same width as a DNA
+ codon (so the alignments 'line up' vertically)
+ </li>
+ <li><strong>"View→Protein"</strong> (in the cDNA panel)
+ or <strong>"View→Nucleotide"</strong> (in the protein panel)
+ allows you to show or hide one or other of the linked alignment
+ panels.</li>
+ <li>Panel heights are adjusted dragging the divider between
+ them using the mouse</li>
+ <li><a href="menus/alwview.html"><strong>"View→New
+ View / Expand Views / Gather Views"</strong></a> behave as for a normal
+ alignment window, but always create new views as Split Frames</li>
+ </ul>
+ <p>
+ An alignment annotation row on the protein alignment shows the <strong><a
+ href="../calculations/consensus.html"
+ >cDNA consensus</a></strong> for each peptide column.<br /> This consensus may
+ reveal variation in nucleotides coding for conserved protein
+ residues.
+ </p>
+
+ <a name="opensplit" />
+ <p>
+ <strong>Opening a Split Frame View</strong>
+ </p>
+ <p>A Split Frame View can be opened in one of the following ways:</p>
+ <p>
+ <strong><em>Add Sequences</em></strong>
+ </p>
+ <p>
+ If you add (coding) DNA sequences to an open peptide alignment, or
+ vice versa, <em>and</em> at least one DNA sequence translates to one
+ of the peptide sequences, then the option to open in a split window
+ is offered. The DNA may include start and/or stop codons, but no
+ non-coding (intron) sequence.<br> If more than one cDNA variant
+ is present in the alignment, Jalview will first try to match these
+ to protein sequences based on any retrieved cross-references, and
+ failing that, pairwise as they are ordered in the alignments.
+ <p>This option is available in Jalview Desktop (when adding
+ sequences by any supported method), and Jalview applet (adding from
+ textbox). The additional options below apply to Jalview Desktop
+ only.</p>
+
+ <p>
+ <strong><em>Translate as cDNA</em></strong>
+ </p>
+ <p>
+ Menu option <strong><a href="../menus/alwcalculate.html">"Calculate→Translate
+ as cDNA"</a></strong> is available for a nucleotide alignment. Selecting this
+ option shows the DNA and its calculated protein product in a Split
+ Frame view.
+ </p>
+
+ <p>
+ <strong><em>Get Cross-References</em></strong>
+ </p>
+ <p>
+ Menu option <strong><a href="../menus/alwcalculate.html">"Calculate→Get
+ Cross-References"</a></strong> is available for fetched sequences which have
+ cross-references to other databases. On selecting protein
+ cross-references (for a cDNA alignment), or DNA xrefs (for peptide),
+ a Split Frame view is opened showing cDNA and peptide.
+ </p>
+
+ <p>
+ <strong><em>Realign a Split View</em></strong>
+ </p>
+ <p>If you invoke a web service to realign either half of a Split
+ Frame, then the resulting realignment is displayed in a new Split
+ Frame.</p>
+ <ul>
+ <li>the alignment you chose to realign (for example, peptide)
+ is displayed as aligned by the external web service</li>
+ <li>Jalview reconstructs the alignment of its complement (in
+ this case, cDNA) by inserting gaps in the corresponding positions</li>
+ </ul>
+ <p>
+ <a name="reconalignment" /><strong>Reconstructed
+ Alignments</strong>
+ </p>
+ <p>
+ Reconstructed alignments are typically <em>not</em> the same as the
+ alignment produced by aligning the complement sequence set directly
+ with the external service. However, in the case of protein
+ alignments, a reconstructed cDNA alignment is often more reliable
+ than one calculated without coding information. Reconstructed cDNA
+ alignments are also more informative than the original protein
+ alignment when calculating phylogenetic trees or performing other
+ kinds of molecular evolution analysis.
+ </p>
+ <p>
+ <em>Split Frame Views were introduced in Jalview 2.9</em>
+ </p>
+</body>
+</html>
diff --git a/help/html/features/structurechooser.html b/help/html/features/structurechooser.html
new file mode 100644
index 0000000..30825c5
--- /dev/null
+++ b/help/html/features/structurechooser.html
@@ -0,0 +1,127 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Structure Chooser</title>
+</head>
+
+<body>
+ <p>
+ <strong>Structure Chooser</strong>
+ </p>
+
+ The Structure Chooser interface provides a smart technique for
+ selecting PDB structures to view in Jalview by querying readily
+ available meta-data of structures. The Interface can be invoked by
+ selecting the
+ <strong>"3D Structure Data.."</strong> option from a sequence's
+ <a href="../menus/popupMenu.html">pop-up menu</a>. Some of the main
+ features it provides are listed below:
+ <ul>
+ <li>Automatic discovery, retrieval and association of PDB
+ entries for an alignment's sequences</li>
+ <li>Visualisation of discovered structures' meta-data</li>
+ <li>Ability to configure the meta-data entries to visualise</li>
+ <li>Auto-selection of the best structure via filtering by the
+ available metric parameters in the meta-data (i.e. resolution,
+ quality etc).</li>
+ <li>Selection of multiple structures in a single operation</li>
+ </ul>
+ Additionally, the Structure Chooser retains the following contemporary
+ features of Jalview:
+ <ul>
+ <li>Manual association of PDB entries via entering the PDB Id
+ or From File</li>
+ <li>Ability to view cached PDB entries</li>
+ </ul>
+
+
+ <strong>Associating PDB files with Sequences</strong>
+ <br> Discovery/Association of PDB entries to a sequence now
+ happens automatically during the initialisation of the Structure
+ Chooser Interface. Jalview uses the sequence's ID to query the PDB
+ Rest API provided by the EBI to discover PDB Ids associated with the
+ sequence.
+
+ <br>
+ <br>
+ <strong>Configuring displayed meta-data for Structures</strong>
+ <br> To configure the visible meta-data displayed for the
+ discovered structures, click the 'Configure Displayed Columns' tab,
+ then tick the options which you intend to make visible.
+
+ <br>
+ <br>
+ <strong>Auto-selection of best Structures</strong>
+ <br> Jalview can automatically filter and select the best
+ structures using various metric categories avaialble from the
+ meta-data of the structures. To perform this simply select any of the
+ following options from the drop-down menu in the Structure Chooser
+ interface: Best Uniprot coverage, Higest Resolution, Best Quality,
+ Highest Protein Chain etc. When the 'Invert' option is selected,
+ Jalview returns an inverse result for the current selected option in
+ the drop-down menu.
+ <p>
+
+ <img src="schooser_main.png" style="width: 464px; height: 369px;">
+ <!-- <p><img src="schooser_config.png" style="width: 463px; height: 369px; ">
+ <p><img src="schooser_drop-down.png" style="width: 464px; height: 368px; ">
+ <p><img src="schooser_enter-id.png" style="width: 467px; height: 373px; ">
+ <p><img src="schooser_from-file.png" style="width: 468px; height: 370px; ">
+ <p><img src="schooser_cached.png"> -->
+ <br>The screenshot above shows the Structure Chooser interface
+ along with the meta-data of auto-discovered structures for the
+ sample alignment. Note however that if no structures were
+ auto-discovered, a different interface for manual association will
+ be invoked as seen in the screenshot below.
+ <p>
+ <img src="schooser_enter-id.png"
+ style="width: 464px; height: 369px;"
+ >
+ <p>
+ <strong>Manual selection/association of PDB files with
+ Sequences</strong>
+ </p>
+ <p>To manually associate PDB files with a sequence, select any of
+ the follwing options listed below from the drop-down menu in the
+ interface:
+ <ul>
+ <li><strong>From File</strong> - You can load a PDB file from
+ the local machine or network and associate it with the selected
+ sequence. PDB files associated in this way will also be saved in
+ the <a href="jalarchive.html">Jalview Archive file</a>.<br></li>
+ <li><strong>Enter PDB Id</strong> - Jalview will use the PDB
+ Rest API, provided by the EBI, to fetch the PDB file with the
+ entered Id.<br></li>
+ <li><strong>Cached PDB Entries</strong> - You can view PDB
+ structures which have previously been downloaded/viewed using this
+ option. Jalview caches previously downloaded PDB entries in the
+ computer memory. However, if the project is saved before exiting
+ Jalview, Jalview will serialize the cached entries to the file
+ system.</li>
+ </ul>
+
+ <p>
+ <em>The Structure Chooser interface was introduced in Jalview
+ 2.9. </em>
+ </p>
+</body>
+</html>
\ No newline at end of file
diff --git a/help/html/features/varna.html b/help/html/features/varna.html
new file mode 100644
index 0000000..0ce3139
--- /dev/null
+++ b/help/html/features/varna.html
@@ -0,0 +1,93 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>The VARNA RNA Viewer</title>
+</head>
+<body>
+ <p>
+ <strong>The VARNA RNA Viewer</strong>
+ </p>
+ <p>
+ <a href="http://varna.lri.fr/index.html">VARNA</a> was integrated
+ into Jalview 2.8 to allow interactive viewing of RNA secondary
+ structure annotation. It is opened by selecting the <strong>"Structure→View
+ Structure:"</strong> option in the <a href="../menus/popupMenu.html">sequence
+ id pop-up menu</a> (if you can't see this, then no RNA structure is
+ associated with your sequence or alignment). In the pop-up menu all
+ structures that are associated with this sequence and all sequences
+ that are associated with the alignment are available.
+ <p>
+ Saving a Jalview session as a project file includes the state of any
+ Varna viewers, which are reopened when the project is reloaded <em>(since
+ Jalview 2.9)</em>.
+ <p>
+ <strong>Different structures</strong>
+ </p>
+ <ul>
+ <li><b>Alignment structures</b>: Structures associated with the
+ alignment are marked by having "consensus" attached to
+ their name. VARNA contains two different entries for consensus
+ structures.
+ <ul>
+ <li>Consensus structure: the individual sequence folded
+ into the consensus structure</li>
+ <li>Trimmed consensus structure: the individual sequence
+ folded into the the gap-free consensus structure. That means
+ all columns that contained gaps in the individual sequence
+ were removed. If this breaks a base-pair the pairing is
+ removed also. This can be considered as an approximation for
+ the individual structure.
+ </ul></li>
+ <li><b>Individual structures</b>: this is a structure
+ associated with the individual sequence and therefore not related
+ to the alignment</li>
+ </ul>
+ <p>
+ <strong>Controls</strong><br>
+ <ul>
+ <li>Rotate view - Left Click and drag</li>
+ <li>Zoom in - Press '+'</li>
+ <li>Zoom out - Press '-'</li>
+ <li>Choose a different structure - Left click on structure in
+ the left hand panel</li>
+ <li>Highlighting bases - Move mouse over columns in the Jalview
+ alignment panel</li>
+ </ul>
+
+ <p>
+ <strong>Functionality provided by VARNA</strong>
+ </p>
+ <p>VARNA's own functions are accessed by right-clicking in the
+ structure display area. That will open the VARNA pop-up menu, which
+ provides access to a number of features like different draw
+ algorithm, color highlighting or annotations.</p>
+ <p>
+ <strong>More Information</strong>
+ </p>
+ <p>
+ VARNA is a very powerful RNA viewer on its own. Only the essentials
+ have been described here - the interested reader is referred to <a
+ href="http://varna.lri.fr/index.php?page=manual&css=varna"
+ >VARNA's own comprehensive online documentation</a>.
+ </p>
+</body>
+</html>
diff --git a/help/html/features/viewingpdbs.html b/help/html/features/viewingpdbs.html
index fc12b3b..f993204 100644
--- a/help/html/features/viewingpdbs.html
+++ b/help/html/features/viewingpdbs.html
@@ -1,121 +1,165 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>PDB Viewing</title>
</head>
<body>
-<p><strong>Viewing PDB Structures</strong></p>
-
-<p>Jalview can view protein structures associated with a sequence
-via the <strong>"Structure→View PDB entry:"</strong> entries from a
-sequence's <a href="../menus/popupMenu.html">pop-up menu</a>. Once a pdb
-structure is selected, one of the following will happen:</p>
+ <p>
+ <strong>Viewing PDB Structures</strong>
+ </p>
+ Jalview can be used to view protein structures by following the steps
+ below:
+ <ol>
+ <li>Select the <strong>"3D Structure Data..."</strong> option
+ from a sequence's <a href="../menus/popupMenu.html">pop-up
+ menu</a> to open the <a href="structurechooser.html">Structure
+ Chooser</a> dialog box.
+ <ul>
+ <li>If one or more structures exists for the given
+ sequence, the <a href="structurechooser.html">Structure
+ Chooser</a> dialog will open with them listed in the results
+ pane.
+ </li>
+ <li>However, if no structure was found, the <a
+ href="structurechooser.html"
+ >Structure Chooser</a> interface will present options for manual
+ association of PDB structures.
+ </li>
+ </ul>
+ </li>
+ <li><strong>Selecting Structures</strong><br /> If structures
+ have been discovered, then some will already be selected according
+ to predefined selection criteria, such as structures with the
+ highest resolution. Use the drop down menu to select structures
+ according to different criteria, or, alternatively, choose
+ structures manually by selecting with the keyboard and mouse.
+ <ul>
+ <li><strong>Viewing Cached Structures</strong><br />If you
+ have previously downloaded structures for your sequences, they
+ can be viewed by selecting the <strong>Cached PDB
+ Entries</strong> option from the drop down menu at the top of the
+ dialog box.</li>
+ </ul></li>
+ <li>To view selected structures, click the <strong>"View"</strong>
+ button.
+ </li>
+ </ol>
-<ul>
- <li>If no structures are open, then an interactive display of the
- structure will be opened in a new window</li>
+ The
+ <a href="jmol.html">Jmol viewer</a> has been included since Jalview
+ 2.3. Jalview 2.8.2 included support for
+ <a href="chimera.html">Chimera</a>, provided it is installed and can
+ be launched by Jalview. The default viewer can be configured in the
+ <a href="preferences.html#structure">Structure tab</a> in the
+ <strong>Tools→Preferences</strong> dialog box.
+ <p>
+ Structure data imported into Jalview can also be processed to
+ display secondary structure and temperature factor annotation. See
+ the <a href="xsspannotation.html">Annotation from Structure</a> page
+ for more information.
+ </p>
- <li>If another structure is already shown for the current
- alignment, then you will be asked if you want to add and <a
- href="jmol.html#align">align this structure</a> to the structure in
- the existing view. (<em>new feature in Jalview 2.6</em>)</li>
+ <p>
+ If a <strong>single</strong> PDB structure is selected, one of the
+ following will happen:
+ </p>
- <li>If the structure is already shown, then you will be prompted
- to associate the sequence with an existing view of the selected
- structure. This is useful when working with multi-domain or multi-chain PDB files.</li>
+ <ul>
+ <li>If no structures are open, then an interactive display of
+ the structure will be opened in a new window.</li>
- <li style="list-style: none">See the <a href="jmol.html">Jmol
- PDB viewer</a> help page for more information about the display.</li>
-</ul>
- <p>
- <em>Opening structures associated with the current selection</em><br />
- If one or more of the sequences in the alignment are selected, then
- the Structure submenu of the <a href="../menus/popupMenu.html">Sequence
- ID popup menu</a> will contain will include either a 'View all <em>X</em>
- structures' entry in the submenu or a 'View structure for <em>Sequence</em>'
- entry. Both these options will open a new Jmol view containing one, or
- all the structures available for all selected sequences, superimposed
- using the currently selected region of the alignment. (<em>This
- capability was added in Jalview 2.7</em>)
- </p>
- <p><strong>Associating PDB files with Sequences</strong></p>
- <p>To associate PDB files with a sequence, right click on a sequence
-ID and select "Structure<strong>→</strong> Associate Structure with
-Sequence", and one of the submenus:</p>
+ <li>If another structure is already shown for the current
+ alignment, then you will be asked if you want to add and <a
+ href="jmol.html#align"
+ >align this structure</a> to the structure in the existing view. (<em>new
+ feature in Jalview 2.6</em>).
+ </li>
-<ul>
- <li>From File - You can load a PDB file from the local machine or
- network and associate it with the selected sequence. PDB files
- associated in this way will also be saved in the <a
- href="jalarchive.html">Jalview Archive file</a>.<br>
- </li>
+ <li>If the structure is already shown, then you will be
+ prompted to associate the sequence with an existing view of the
+ selected structure. This is useful when working with multi-domain
+ or multi-chain PDB files.</li>
- <li>Enter PDB Id - Jalview will use WSDBFetch, provided by the
- EBI, to fetch the PDB file with the entered Id.<br>
- </li>
+ <li style="list-style: none">See the <a href="jmol.html">Jmol
+ </a> and <a href="chimera.html">Chimera</a> PDB viewer help pages for
+ more information about the display.
+ </li>
+ </ul>
- <li>Discover PDB Ids - Jalview uses the sequence's ID to query WSDBFetch, provided by the
- EBI, and any enabled DAS servers, to discover PDB ids associated with the sequence.</li>
-</ul>
-<p><strong>Importing PDB Entries or files in PDB format</strong><br>
-You can retrieve sequences from the PDB using the <a
- href="seqfetch.html">Sequence Fetcher</a>. Any sequences retrieved with
-this service are automatically associated with their source database
-entry. For PDB sequences, simply select PDB as the database and enter
-your known PDB id (appended with ':' and a chain code, if desired).<br>
-Jalview will also read PDB files directly. Simply load in the file as
-you would an alignment file. The sequences of any peptide chains will be
-extracted from the file and viewed in the alignment window.</p>
+ <p>
+ <strong>Importing PDB Entries or files in PDB format</strong><br>
+ You can retrieve sequences from the PDB using the <a
+ href="pdbsequencefetcher.html"
+ >Sequence Fetcher</a>. Any sequences retrieved with this service are
+ automatically associated with their source database entry. For PDB
+ sequences, simply select PDB as the database and enter your known
+ PDB id (appended with ':' and a chain code, if desired).<br>
+ Jalview will also read PDB files directly. Simply load in the file
+ as you would an alignment file. The sequences of any protein or
+ nucleotide chains will be extracted from the file and viewed in the
+ alignment window.
+ </p>
-<p>
-<strong>Associating a large number of PDB files to sequences
-in an alignment</strong><br /> It is often the case when working with
-structure alignments that you will have a directory of PDB files, and
-an alignment involving one or more of the structures. If you drag a
-number of PDB files onto an alignment in the Jalview desktop, Jalview
-will give you the option of associating PDB files with sequences that
-have the same filename. This means, for example, you can automatically
-associate PDB files with names like '1gaq.pdb' with sequences that
-have an ID like '1gaq'.
-<br/><em>Note: This feature was added in Jalview 2.7</em>
-</p>
-<p><em>Note for jalview applet users:<br>
-Due to the applet security constraints, PDB Files can currently only be
-imported by cut and paste of the PDB file text into the text box opened
-by the 'From File' entry of the structure menu.</em></p>
+ <p>
+ <strong>Associating a large number of PDB files to
+ sequences in an alignment</strong><br /> It is often the case when working
+ with structure alignments that you will have a directory of PDB
+ files, and an alignment involving one or more of the structures. If
+ you drag a number of PDB files onto an alignment in the Jalview
+ desktop, Jalview will give you the option of associating PDB files
+ with sequences that have the same filename. This means, for example,
+ you can automatically associate PDB files with names like '1gaq.pdb'
+ with sequences that have an ID like '1gaq'. <br />
+ <em>Note: This feature was added in Jalview 2.7</em>
+ </p>
+ <p>
+ <em>Note for Jalview applet users:<br> Due to the applet
+ security constraints, PDB Files can currently only be imported by
+ cut and paste of the PDB file text into the text box opened by the
+ 'From File' entry of the structure menu.
+ </em>
+ </p>
-<p><strong>Viewing the PDB Residue Numbering</strong><br>
-Sequences which have PDB entry or PDB file associations are annotated
-with sequence features from a group named with the associated PDB
-accession number or file name. Each feature gives the corresponding PDB
-Residue Number for each mapped residue in the sequence. The display of
-these features is controlled through the <strong>"View→Sequence
-Features"</strong> menu item and the <a href="featuresettings.html">Feature
-Settings dialog box</a>.</p>
+ <p>
+ <strong>Viewing the PDB Residue Numbering</strong><br>
+ Sequences which have PDB entry or PDB file associations are
+ annotated with sequence features from a group named with the
+ associated PDB accession number or file name. Each feature gives the
+ corresponding PDB Residue Number for each mapped residue in the
+ sequence. The display of these features is controlled through the <strong>"View→Sequence
+ Features"</strong> menu item and the <a href="featuresettings.html">Feature
+ Settings dialog box</a>.
+ </p>
-<p><em><strong>Outstanding problem with cut'n'pasted
-files in Jalview 2.6 and Jalview 2.7</strong><br>
-Structures imported via the cut'n'paste dialog box will not be correctly
-highlighted or coloured when they are displayed in structure views,
-especially if they contain more than one PDB structure. See the bug
-report at http://issues.jalview.org/browse/JAL-623 for news on this problem.</em></p>
+ <p>
+ <em><strong>Outstanding problem with cut'n'pasted
+ files in Jalview 2.6 and Jalview 2.7</strong><br> Structures
+ imported via the cut'n'paste dialog box will not be correctly
+ highlighted or coloured when they are displayed in structure
+ views, especially if they contain more than one PDB structure. See
+ the bug report at http://issues.jalview.org/browse/JAL-623 for
+ news on this problem.</em>
+ </p>
</body>
</html>
diff --git a/help/html/features/wrap.html b/help/html/features/wrap.html
index 689d516..8f562eb 100644
--- a/help/html/features/wrap.html
+++ b/help/html/features/wrap.html
@@ -1,334 +1,343 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Wrap Alignment</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Wrap Alignment</title>
+</head>
<body>
-<p><strong>View→Wrap alignment </strong></p>
-<p>Use this feature to wrap an alignment to the screen width. </p>
-<p>All output (HTML, Printing, JPG etc) will also be in this wrapped format.</p>
-<p>This is most useful when looking at alignments with less than 20 sequences.
-</p>
-<table width="480" border="1">
- <tr><td>
+ <p>
+ <strong>View→Wrap alignment </strong>
+ </p>
+ <p>Use this feature to wrap an alignment to the screen width.</p>
+ <p>All output (HTML, Printing, JPG etc) will also be in this
+ wrapped format.</p>
+ <p>This is most useful when looking at alignments with less than
+ 20 sequences.</p>
+ <table width="480" border="1">
+ <tr>
+ <td>
-<table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td colspan="6"> </td>
- <td colspan="9">10<br>
- |</td>
- <td></td>
- <td colspan="9">20<br>
- |</td>
- <td></td>
- </tr>
- <tr>
- <td nowrap>ADHR_DROPS/7-107 </td>
- <td bgcolor="#e6331a">K</td>
- <td bgcolor="#1ab3b3">H</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#80b3e6">C</td>
- <td bgcolor="#1ab3b3">Y</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#80b3e6">A</td>
- <td>D</td>
- <td bgcolor="#80b3e6">C</td>
- <td bgcolor="#e6994d">G</td>
- <td bgcolor="#e6994d">G</td>
- <td bgcolor="#80b3e6">I</td>
- <td>A</td>
- <td bgcolor="#80b3e6">L</td>
- <td>E</td>
- <td bgcolor="#1acc1a">T</td>
- <td bgcolor="#1acc1a">S</td>
- <td bgcolor="#e6331a">K</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#80b3e6">M</td>
- <td>T</td>
- <td bgcolor="#e6331a">K</td>
- <td>N</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#80b3e6">A</td>
- </tr>
- <tr>
- <td nowrap>ADH_DROHE/5-105 </td>
- <td>S</td>
- <td>N</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#80b3e6">F</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#80b3e6">A</td>
- <td bgcolor="#e6994d">G</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#e6994d">G</td>
- <td bgcolor="#e6994d">G</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#e6994d">G</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#cc4dcc">D</td>
- <td bgcolor="#1acc1a">T</td>
- <td bgcolor="#1acc1a">S</td>
- <td bgcolor="#e6331a">R</td>
- <td>E</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#80b3e6">V</td>
- <td>K</td>
- <td>S</td>
- <td bgcolor="#e6994d">G</td>
- <td bgcolor="#cccc00">P</td>
- <td>K</td>
- </tr>
- <tr>
- <td nowrap>PGDH_HUMAN/6-106 </td>
- <td bgcolor="#e6331a">K</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#80b3e6">A</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#1acc1a">T</td>
- <td bgcolor="#e6994d">G</td>
- <td>A</td>
- <td bgcolor="#80b3e6">A</td>
- <td>Q</td>
- <td bgcolor="#e6994d">G</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#e6994d">G</td>
- <td>R</td>
- <td>A</td>
- <td>F</td>
- <td>A</td>
- <td bgcolor="#cc4dcc">E</td>
- <td bgcolor="#80b3e6">A</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#80b3e6">L</td>
- <td>L</td>
- <td bgcolor="#e6331a">K</td>
- <td bgcolor="#e6994d">G</td>
- <td>.</td>
- <td bgcolor="#80b3e6">A</td>
- </tr>
- <tr>
- <td height="5"></td>
- </tr>
- <tr>
- <td colspan="6"> </td>
- <td colspan="9">36<br>
- |</td>
- <td></td>
- <td colspan="9">46<br>
- |</td>
- <td></td>
- </tr>
- <tr>
- <td nowrap>ADHR_DROPS/7-107 </td>
- <td bgcolor="#e6331a">K</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#80b3e6">A</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#80b3e6">L</td>
- <td>Q</td>
- <td>S</td>
- <td bgcolor="#80b3e6">V</td>
- <td>E</td>
- <td bgcolor="#1acc1a">N</td>
- <td bgcolor="#cccc00">P</td>
- <td bgcolor="#cccc00">P</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>A</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#80b3e6">A</td>
- <td bgcolor="#1acc1a">Q</td>
- <td bgcolor="#80b3e6">L</td>
- <td>Q</td>
- </tr>
- <tr>
- <td nowrap>ADH_DROHE/5-105 </td>
- <td>N</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#cc4dcc">D</td>
- <td>R</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#cc4dcc">D</td>
- <td bgcolor="#1acc1a">N</td>
- <td bgcolor="#cccc00">P</td>
- <td bgcolor="#80b3e6">A</td>
- <td>A</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#80b3e6">A</td>
- <td bgcolor="#cc4dcc">E</td>
- <td bgcolor="#80b3e6">L</td>
- <td>K</td>
- </tr>
- <tr>
- <td nowrap>PGDH_HUMAN/6-106 </td>
- <td bgcolor="#e6331a">K</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#80b3e6">A</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#cc4dcc">D</td>
- <td>W</td>
- <td>N</td>
- <td>L</td>
- <td>E</td>
- <td bgcolor="#80b3e6">A</td>
- <td bgcolor="#e6994d">G</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>V</td>
- <td>Q</td>
- <td bgcolor="#80b3e6">C</td>
- <td>K</td>
- <td>A</td>
- <td bgcolor="#80b3e6">A</td>
- <td>L</td>
- </tr>
- <tr>
- <td height="5"></td>
- </tr>
- <tr>
- <td colspan="6"> </td>
- <td colspan="9">62<br>
- |</td>
- <td></td>
- <td colspan="9">72<br>
- |</td>
- <td></td>
- </tr>
- <tr>
- <td nowrap>ADHR_DROPS/7-107 </td>
- <td>S</td>
- <td bgcolor="#80b3e6">I</td>
- <td>K</td>
- <td bgcolor="#1ab3b3">H</td>
- <td>S</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>T</td>
- <td>Q</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#80b3e6">F</td>
- <td bgcolor="#80b3e6">F</td>
- <td bgcolor="#80b3e6">W</td>
- <td>T</td>
- <td bgcolor="#80b3e6">F</td>
- <td bgcolor="#cc4dcc">D</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#1acc1a">T</td>
- <td bgcolor="#80b3e6">M</td>
- <td bgcolor="#80b3e6">A</td>
- <td>R</td>
- <td bgcolor="#cc4dcc">E</td>
- <td bgcolor="#cc4dcc">E</td>
- <td>M</td>
- </tr>
- <tr>
- <td nowrap>ADH_DROHE/5-105 </td>
- <td>A</td>
- <td bgcolor="#80b3e6">L</td>
- <td>N</td>
- <td bgcolor="#cccc00">P</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>K</td>
- <td>V</td>
- <td>T</td>
- <td bgcolor="#80b3e6">I</td>
- <td bgcolor="#1acc1a">T</td>
- <td bgcolor="#80b3e6">F</td>
- <td bgcolor="#1ab3b3">Y</td>
- <td bgcolor="#cccc00">P</td>
- <td bgcolor="#1ab3b3">Y</td>
- <td bgcolor="#cc4dcc">D</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#1acc1a">T</td>
- <td bgcolor="#80b3e6">V</td>
- <td bgcolor="#cccc00">P</td>
- <td>L</td>
- <td>A</td>
- <td bgcolor="#cc4dcc">E</td>
- <td>T</td>
- </tr>
- <tr>
- <td nowrap>PGDH_HUMAN/6-106 </td>
- <td>D</td>
- <td>E</td>
- <td>Q</td>
- <td bgcolor="#80b3e6">F</td>
- <td>E</td>
- <td bgcolor="#cccc00">P</td>
- <td>.</td>
- <td>.</td>
- <td>.</td>
- <td>Q</td>
- <td>K</td>
- <td bgcolor="#1acc1a">T</td>
- <td bgcolor="#80b3e6">L</td>
- <td bgcolor="#80b3e6">F</td>
- <td bgcolor="#80b3e6">I</td>
- <td>Q</td>
- <td bgcolor="#80b3e6">C</td>
- <td bgcolor="#cc4dcc">D</td>
- <td bgcolor="#80b3e6">V</td>
- <td>A</td>
- <td>D</td>
- <td>Q</td>
- <td>Q</td>
- <td bgcolor="#1acc1a">Q</td>
- <td>L</td>
- <td>.</td>
- </tr>
- <tr>
- <td height="5"></td>
- </tr>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td colspan="6"> </td>
+ <td colspan="9">10<br> |
+ </td>
+ <td></td>
+ <td colspan="9">20<br> |
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td nowrap>ADHR_DROPS/7-107 </td>
+ <td bgcolor="#e6331a">K</td>
+ <td bgcolor="#1ab3b3">H</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#80b3e6">C</td>
+ <td bgcolor="#1ab3b3">Y</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td>D</td>
+ <td bgcolor="#80b3e6">C</td>
+ <td bgcolor="#e6994d">G</td>
+ <td bgcolor="#e6994d">G</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td>A</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td>E</td>
+ <td bgcolor="#1acc1a">T</td>
+ <td bgcolor="#1acc1a">S</td>
+ <td bgcolor="#e6331a">K</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#80b3e6">M</td>
+ <td>T</td>
+ <td bgcolor="#e6331a">K</td>
+ <td>N</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#80b3e6">A</td>
+ </tr>
+ <tr>
+ <td nowrap>ADH_DROHE/5-105 </td>
+ <td>S</td>
+ <td>N</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#80b3e6">F</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td bgcolor="#e6994d">G</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#e6994d">G</td>
+ <td bgcolor="#e6994d">G</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#e6994d">G</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#cc4dcc">D</td>
+ <td bgcolor="#1acc1a">T</td>
+ <td bgcolor="#1acc1a">S</td>
+ <td bgcolor="#e6331a">R</td>
+ <td>E</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td>K</td>
+ <td>S</td>
+ <td bgcolor="#e6994d">G</td>
+ <td bgcolor="#cccc00">P</td>
+ <td>K</td>
+ </tr>
+ <tr>
+ <td nowrap>PGDH_HUMAN/6-106 </td>
+ <td bgcolor="#e6331a">K</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#1acc1a">T</td>
+ <td bgcolor="#e6994d">G</td>
+ <td>A</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td>Q</td>
+ <td bgcolor="#e6994d">G</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#e6994d">G</td>
+ <td>R</td>
+ <td>A</td>
+ <td>F</td>
+ <td>A</td>
+ <td bgcolor="#cc4dcc">E</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td>L</td>
+ <td bgcolor="#e6331a">K</td>
+ <td bgcolor="#e6994d">G</td>
+ <td>.</td>
+ <td bgcolor="#80b3e6">A</td>
+ </tr>
+ <tr>
+ <td height="5"></td>
+ </tr>
+ <tr>
+ <td colspan="6"> </td>
+ <td colspan="9">36<br> |
+ </td>
+ <td></td>
+ <td colspan="9">46<br> |
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td nowrap>ADHR_DROPS/7-107 </td>
+ <td bgcolor="#e6331a">K</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td>Q</td>
+ <td>S</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td>E</td>
+ <td bgcolor="#1acc1a">N</td>
+ <td bgcolor="#cccc00">P</td>
+ <td bgcolor="#cccc00">P</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>A</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td bgcolor="#1acc1a">Q</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td>Q</td>
+ </tr>
+ <tr>
+ <td nowrap>ADH_DROHE/5-105 </td>
+ <td>N</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#cc4dcc">D</td>
+ <td>R</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#cc4dcc">D</td>
+ <td bgcolor="#1acc1a">N</td>
+ <td bgcolor="#cccc00">P</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td>A</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td bgcolor="#cc4dcc">E</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td>K</td>
+ </tr>
+ <tr>
+ <td nowrap>PGDH_HUMAN/6-106 </td>
+ <td bgcolor="#e6331a">K</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#cc4dcc">D</td>
+ <td>W</td>
+ <td>N</td>
+ <td>L</td>
+ <td>E</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td bgcolor="#e6994d">G</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>V</td>
+ <td>Q</td>
+ <td bgcolor="#80b3e6">C</td>
+ <td>K</td>
+ <td>A</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td>L</td>
+ </tr>
+ <tr>
+ <td height="5"></td>
+ </tr>
+ <tr>
+ <td colspan="6"> </td>
+ <td colspan="9">62<br> |
+ </td>
+ <td></td>
+ <td colspan="9">72<br> |
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td nowrap>ADHR_DROPS/7-107 </td>
+ <td>S</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td>K</td>
+ <td bgcolor="#1ab3b3">H</td>
+ <td>S</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>T</td>
+ <td>Q</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#80b3e6">F</td>
+ <td bgcolor="#80b3e6">F</td>
+ <td bgcolor="#80b3e6">W</td>
+ <td>T</td>
+ <td bgcolor="#80b3e6">F</td>
+ <td bgcolor="#cc4dcc">D</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#1acc1a">T</td>
+ <td bgcolor="#80b3e6">M</td>
+ <td bgcolor="#80b3e6">A</td>
+ <td>R</td>
+ <td bgcolor="#cc4dcc">E</td>
+ <td bgcolor="#cc4dcc">E</td>
+ <td>M</td>
+ </tr>
+ <tr>
+ <td nowrap>ADH_DROHE/5-105 </td>
+ <td>A</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td>N</td>
+ <td bgcolor="#cccc00">P</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>K</td>
+ <td>V</td>
+ <td>T</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td bgcolor="#1acc1a">T</td>
+ <td bgcolor="#80b3e6">F</td>
+ <td bgcolor="#1ab3b3">Y</td>
+ <td bgcolor="#cccc00">P</td>
+ <td bgcolor="#1ab3b3">Y</td>
+ <td bgcolor="#cc4dcc">D</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#1acc1a">T</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td bgcolor="#cccc00">P</td>
+ <td>L</td>
+ <td>A</td>
+ <td bgcolor="#cc4dcc">E</td>
+ <td>T</td>
+ </tr>
+ <tr>
+ <td nowrap>PGDH_HUMAN/6-106 </td>
+ <td>D</td>
+ <td>E</td>
+ <td>Q</td>
+ <td bgcolor="#80b3e6">F</td>
+ <td>E</td>
+ <td bgcolor="#cccc00">P</td>
+ <td>.</td>
+ <td>.</td>
+ <td>.</td>
+ <td>Q</td>
+ <td>K</td>
+ <td bgcolor="#1acc1a">T</td>
+ <td bgcolor="#80b3e6">L</td>
+ <td bgcolor="#80b3e6">F</td>
+ <td bgcolor="#80b3e6">I</td>
+ <td>Q</td>
+ <td bgcolor="#80b3e6">C</td>
+ <td bgcolor="#cc4dcc">D</td>
+ <td bgcolor="#80b3e6">V</td>
+ <td>A</td>
+ <td>D</td>
+ <td>Q</td>
+ <td>Q</td>
+ <td bgcolor="#1acc1a">Q</td>
+ <td>L</td>
+ <td>.</td>
+ </tr>
+ <tr>
+ <td height="5"></td>
+ </tr>
- </table>
-</table>
+ </table>
+ </table>
</body>
diff --git a/help/html/features/xsspannotation.html b/help/html/features/xsspannotation.html
new file mode 100644
index 0000000..fcc2b21
--- /dev/null
+++ b/help/html/features/xsspannotation.html
@@ -0,0 +1,96 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Annotation from 3D structure data</title>
+</head>
+<body>
+ <p>
+ <strong>Working with annotation from 3D structure data</strong>
+ </p>
+ <p>
+ Jalview can process PDB data associated with sequences to display
+ values extracted from the <em>Temperature Factor</em> column for
+ corresponding sites, and secondary structure from DSSP or RNAView
+ (as appropriate).
+ </p>
+ <p>
+ <strong>Extracting data from PDB files<br /></strong>Annotation is
+ created for structure files retrieved directly from the PDB loaded
+ from the file system (via the <strong>Structure→Associate
+ Structure...→From file</strong> option, or when displayed via the View
+ Structures Menu.<br /> Structure annotation is not automatically
+ added to an alignment, but any available structure annotation rows
+ for the current selection or a particular sequence can be added via
+ the <strong>Add Reference Annotation</strong> in the <strong>Selection</strong>
+ and <strong>Sequence ID</strong> sub-menus of the Sequence ID
+ Panel's popup menu.<br /> <em>Please note:</em>Protein structures
+ are analysed <em>in situ</em>, but Jalview employs a web service to
+ process RNA structures which can cause long delays if your internet
+ connection is slow.
+ </p>
+ <p>
+ The <a href="../menus/alwannotation.html"><em>Annotations</em>
+ alignment menu</a> provides settings useful for controlling the
+ display of secondary structure annotation.
+ </p>
+ <p>
+ <strong>Shading sequences by associated structure
+ annotation<br />
+ </strong>The annotation colouring dialog (opened by the <strong>Colour→By
+ Annotation</strong> option) allows sequences with associated secondary
+ structure data to be shaded according to secondary structure type.
+ Once the dialog is opened, select the <em>Per Sequence</em> option
+ and then choose <em>Secondary structure</em> from the dropdown menu.<br />When
+ colouring alignments by secondary structure, two modes can be
+ employed. The default is to shade sequences with the same colour as
+ the secondary structure glyph. If, however, <em>original
+ colours</em> is selected and another colourscheme has already been
+ applied, then only portions of the sequence with defined secondary
+ structure will be shaded with the previously applied scheme.<br />
+ </p>
+ <p>
+ <strong>Configuration options for processing PDB files<br /></strong>
+ Occasionally, you may wish to disable secondary structure
+ processing. Configuration options in the <strong>Structure</strong>
+ tab in the <strong>Tools→Preferences</strong> dialog allow the
+ processing of structure data to be disabled, or selectively enabled.
+ For more information, take a look at the <a
+ href="preferences.html#structure"
+ >documentation for the structure panel</a>.
+ </p>
+ <p>
+ <em>The display of secondary structure data was introduced in
+ Jalview 2.8.2, and is made possible by Jalview's use of <a
+ href="jmol.html"
+ >Jmol's DSSP implementation</a>, based on the original <a
+ href="http://www.ncbi.nlm.nih.gov/pubmed/6667333"
+ >Kabsch and Sander algorithm</a> ported by <a
+ href="http://swift.cmbi.ru.nl/gv/dssp/"
+ >Robbie P. Joosten and colleagues</a>, and a client for <a
+ href="https://github.com/fjossinet/PyRNA"
+ >Fabrice Jossinet's pyRNA services</a> that was developed by Anne
+ Menard, Jim Procter and Yann Ponty as part of the Jalview Summer
+ of Code 2012.
+ </em>
+ </p>
+</body>
+</html>
diff --git a/help/html/index.html b/help/html/index.html
index 0957962..c1a4b60 100644
--- a/help/html/index.html
+++ b/help/html/index.html
@@ -1,36 +1,104 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Jalview Documentation</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Jalview Documentation</title>
+</head>
<body>
-<IMG src="align.jpg"><font size="4">
-<br><br>
-<strong>Jalview Documentation</strong></font>
-<br><br>
-Jalview (2009) is a fast Java multiple alignment editor and analysis tool. It
-features many of the functions of <a href="http://www.compbio.dundee.ac.uk/Software/Amas/amas.html">AMAS</a>,
-for the analysis of sub-families and the prediction of functional sites, but is
-fully interactive. (View the <a href="http://www.jalview.org">Jalview homepage</a> at www.jalview.org).
-<p></p>
-<p> If you use Jalview in your work, please cite the Jalview 2 paper in Bioinformatics: </p>
-<p>Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M., Barton, G.J (2009), <br>
- "Jalview version 2: A Multiple Sequence Alignment and Analysis Workbench,"<br>
- <em>Bioinformatics</em> <strong>25</strong> (9) 1189-1191 doi: 10.1093/bioinformatics/btp033
+ <IMG src="Jalview_Logo.png">
+ <p>
+ <strong>Welcome to Jalview's built in documentation.</strong>
+ </p>
+ <p>Here are some good places to start:</p>
+ <ul>
+ <li><a href="whatsNew.html">What's New</a> summarises the new
+ features in this release of Jalview.</li>
+ <li>Learn how to <a href="editing/index.html">edit
+ alignments</a> with Jalview.
+ </li>
+ <li><a href="features/seqfeatures.html">Import and display
+ sequence features on your alignment</a></li>
+ <li>Use <a href="features/viewingpdbs.html">Jmol to view
+ and superpose 3D structures</a> associated with sequences in the
+ alignment
+ </li>
+ </ul>
+ <p>
+ For more information, you might also want to take a look at the
+ documentation section of the Jalview website (<a
+ href="http://www-test.jalview.org/about/documentation"
+ >http://www.jalview.org/about/documentation</a>).
+ </p>
+ <p>
+ If you are using the Jalview Desktop application and are looking for
+ something specific, then try the search box (next to the print
+ icon). If you're already viewing this in your web browser, then
+ google the online version of these pages. If you don't find what you
+ are looking for, or want to report a bug or make a feature request,
+ then get in contact over at <a
+ href="http://www.jalview.org/community"
+ >http://www.jalview.org/community</a>
+ </p>
+
+ <p>
+ <strong>Citing Jalview</strong><br />If you use Jalview in your
+ work, please cite the Jalview 2 paper in Bioinformatics:
+ </p>
+ <p>
+ Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M., Barton,
+ G.J (2009), <br> "Jalview version 2: A Multiple Sequence
+ Alignment and Analysis Workbench,"<br> <em>Bioinformatics</em>
+ <strong>25</strong> (9) 1189-1191 doi: 10.1093/bioinformatics/btp033
+ </p>
+ <p>
+ <strong>The Jalview Authors</strong><br /> The following people have
+ contributed to Jalview's development:
+ <ul>
+ <li>Jalview 1
+ <ul>
+ <li>Michele Clamp</li>
+ <li>James Cuff</li>
+ <li>Steve Searle</li>
+ <li>David Martin</li>
+ <li>Geoff Barton</li>
+ </ul>
+ </li>
+ <li>Jalview 2
+ <ul>
+ <li>Jim Procter</li>
+ <li>Andrew Waterhouse</li>
+ <li>Mungo Carstairs</li>
+ <li>Tochukwu 'Charles' Ofoegbu</li>
+ <li>Jan Engelhardt</li>
+ <li>Lauren Lui</li>
+ <li>Anne Menard</li>
+ <li>Natasha Sherstnev</li>
+ <li>Daniel Barton</li>
+ <li>David Roldan-Martinez</li>
+ <li>David Martin</li>
+ <li>Geoff Barton</li>
+ </ul>
+ </li>
+ </ul>
+ </p>
</body>
</html>
diff --git a/help/html/io/export.html b/help/html/io/export.html
index b5a86da..709d297 100644
--- a/help/html/io/export.html
+++ b/help/html/io/export.html
@@ -1,57 +1,91 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Exporting alignments as artwork</title>
</head>
<body>
-<p><strong>Exporting alignments as graphics and lineart<a name="export"></a></strong></p>
-<p>The alignment view can be printed using
-<strong>File→Print</strong>, or exported in a number of ways via the
-<strong>File→Export</strong> menu:
-<ul>
-<li>HTML<br><em>for viewing in a web browser</em>
-</li>
-<li>PNG - a Portable Networks Graphics image<br><em>For low quality
-diagrams and powerpoint presentations</em>
-</li>
-<li>EPS - an Encapsulated Postscript Document<br><em>For high quality
-diagrams and publications.</em>
-</li></ul>
-
-<p><em>Tips for working with EPS Files</em></p>
-<li>The EPS file generated by jalview contains vector graphics which are directly
- editable in graphics applications such as Adobe Illustrator.</li>
-<li>EPS files can be produced as "Text" or "Lineart". Use
- "Text" if you want the final document to be MUCH smaller in diskspace
- and be able to search, edit and select text. Use "Lineart" if you
- want an exact image of the alignment as displayed in Jalview. This is useful
- if a 3rd Party EPS viewer does not have the same Font which the EPS file was
- created with.</li>
-<li>When importing an EPS into to a Microsoft office document, a snapshot image of the
- file will be displayed which often looks blurred. Right-click the
- image and choose "Edit image." to convert it to word
- drawing objects which give a truer WYSIWIG representation.
- </li>
- <li>
- Mac OSX users will find that eps files are automatically converted into
- PDF files.
- </li>
-</p>
+ <p>
+ <strong>Exporting alignments as graphics and lineart<a
+ name="export"
+ ></a></strong>
+ </p>
+ <p>
+ The alignment view can be printed using <strong>File→Print</strong>,
+ or exported in a number of ways via the <strong>File→Export</strong>
+ menu:
+ <ul>
+ <li>HTML<br> <em>for viewing in a web browser</em>
+ </li>
+ <li>PNG - a Portable Networks Graphics image<br> <em>For
+ low quality diagrams and powerpoint presentations</em>
+ </li>
+ <li>EPS - an Encapsulated Postscript Document<br> <em>For
+ high quality diagrams and publications.</em>
+ <li>SVG - a Scalable Vector Graphics document<br> <em>For
+ high quality diagrams in publications and on the web.</em>
+ </li>
+ <li>BioJS MSA - A JavaScript based multiple sequence alignment
+ viewer. <br> <em>For interactive alignment data
+ visualisation in a web browser.<br />Get more info about the
+ BioJS MSA viewer at a
+ href="http://msa.biojs.net/">http://msa.biojs.net/</a>
+ </em>
+ </li>
+
+ </ul>
+ <a name="htmlexport" />
+ <p>
+ <strong>Exporting alignments as Web Pages</strong>
+ <p>
+ In Jalview 2.9, new HTML exporting options were introduced. The
+ standard HTML export option displays alignments as SVG documents
+ embedded as scollable panes. Exported pages can optionally also
+ include <a href="../features/bioJsonFormat.html">BioJSON</a> data,
+ which allows Jalview to extract the original data used to create the
+ page. Jalview can also generate HTML pages which embed BioJSON data
+ and the BioJS MSA viewer, a pure javascript alignment viewer that
+ provides a range of interactive analysis capabiltiies.
+ </p>
+ <p>
+ <p>
+ <strong>Tips for working with EPS Files</strong>
+ </p>
+ <li>The EPS file generated by Jalview contains vector graphics
+ which are directly editable in graphics applications such as Adobe
+ Illustrator.</li>
+ <li>EPS files can be produced as "Text" or
+ "Lineart". Use "Text" if you want the final
+ document to be MUCH smaller in diskspace and be able to search, edit
+ and select text. Use "Lineart" if you want an exact image
+ of the alignment as displayed in Jalview. This is useful if a 3rd
+ Party EPS viewer does not have the same Font which the EPS file was
+ created with.</li>
+ <li>When importing an EPS file into a Microsoft office document,
+ a snapshot image of the file will be displayed which often looks
+ blurred. Right-click the image and choose "Edit image." to
+ convert it to word drawing objects which give a truer WYSIWIG
+ representation.</li>
+ <li>Mac OSX users will find that eps files are automatically
+ converted into PDF files.</li>
+ </p>
</body>
</html>
diff --git a/help/html/io/exportseqreport.html b/help/html/io/exportseqreport.html
new file mode 100644
index 0000000..8e99d0e
--- /dev/null
+++ b/help/html/io/exportseqreport.html
@@ -0,0 +1,59 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Viewing and exporting sequence annotation reports</title>
+</head>
+<body>
+ <p>
+ <strong>Viewing and exporting sequence annotation reports</strong> <br />
+ Much of the information retrieved by Jalview about a sequence is
+ visualized on the alignment. Often, however, there are a huge number
+ of ontology terms, cross-references, links to publications and other
+ kinds of data shown in the sequence ID tooltip that cannot be
+ examined. In this case, you can view and export the information
+ shown in a sequence's ID tooltip by right-clicking and selecting the
+ <strong>"<em>(sequence's name)</em></em>→Sequence
+ Details ..."
+ </strong> entry from the <a href="../menus/popupMenu.html">pop-up menu</a>.
+ </p>
+ <p>
+ <strong>Annotation Reports for a range of sequences</strong><br />
+ If you would like to view the tooltips for a number of sequences,
+ simply select them all and then use the <strong>Selection→Sequence
+ Details ...</strong> entry in the <a href="../menus/popupMenu.html">pop-up
+ menu</a>.
+ </p>
+ <img src="seqreport.gif"
+ alt="Sequence Annotation is displayed as HTML in a report window"
+ />
+ <p>
+ <strong>Copying and pasting annotation to other programs</strong><br>
+ The <strong>File→Save</strong> option in the sequence
+ annotation report window allows the report to be saved as HTML,
+ which will preserve links and any other metadata. It is also
+ possible to copy and paste the text to other programs, but in some
+ cases, the HTML will not be preserved. In that case, you can toggle
+ the display of HTML source code with the <strong>Edit→Show
+ HTML Source</strong> drop down menu entry.
+ </p>
+</body>
+</html>
diff --git a/help/html/io/fileformats.html b/help/html/io/fileformats.html
index 9172b28..8f88c26 100644
--- a/help/html/io/fileformats.html
+++ b/help/html/io/fileformats.html
@@ -1,21 +1,24 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Alignment Fileformats</title>
<style type="text/css">
@@ -28,45 +31,80 @@ td {
</head>
<body>
-<p><strong>Alignment Fileformats</strong>
-<p>Jalview understands a wide range of sequence alignment formats. In
-order to determine which format has been used for an alignment,
-jalview tries to detect some text or formatting unique to one of the formats:
-</p>
-<table width="100%" border="1">
-<tr><td width="17%">Format</td>
-<td width="60%">Unique File Feature</td>
-<td width="23%">File Extension</td>
-<tr>
-<td width="17%">FASTA</td>
-<td width="60%">>SequenceName<br>
-THISISASEQENCE<br></td>
-<td width="23%">.fa, .fasta</td>
-</tr><tr><td width="17%">MSF</td>
-<td width="60%">!! AA_MULTIPLE_ALIGNMENT 1.0<br>
-<em>..</em><br>
-//<br></td>
-<td width="23%">.msf</td>
-</tr><tr><td width="17%">CLUSTALW</td>
-<td width="60%">CLUSTAL</td>
-<td width="23%">.aln</td>
-</tr><tr><td width="17%">PILEUP</td>
-<td width="60%">PileUp</td>
-<td width="23%"></td>
-</tr><tr><td width="17%">PIR</td>
-<td width="60%">>P1;</td>
-<td width="23%">.pir</td>
-</tr><tr><td width="17%">BLC</td>
-<td width="60%">>Seq1<br>
->Seq2</td>
-<td width="23%">.blc</td>
-</tr><tr><td width="17%">PFAM</td>
-<td width="60%">SequenceName THISISASEQENCE</td>
-<td width="23%">.pfam</td>
-</tr>
-</table>
-<p>The file extensions are used to associate jalview alignment icons
-with alignment files: <img src="file.png" width=12 height=12 >
-</p>
+ <p>
+ <strong>Alignment File Formats</strong>
+ <p>Jalview understands a wide range of sequence alignment formats.
+ In order to determine which format has been used for an alignment,
+ Jalview tries to detect some text or formatting unique to one of the
+ formats:</p>
+ <table width="100%" border="1">
+ <tr>
+ <td width="17%">Format</td>
+ <td width="60%">Unique File Feature</td>
+ <td width="23%">File Extension</td>
+ <tr>
+ <td width="17%">FASTA</td>
+ <td width="60%">>SequenceName<br> THISISASEQUENCE<br></td>
+ <td width="23%">.fa, .fasta</td>
+ </tr>
+ <tr>
+ <td width="17%">MSF</td>
+ <td width="60%">!! AA_MULTIPLE_ALIGNMENT 1.0<br> <em>..</em><br>
+ //<br></td>
+ <td width="23%">.msf</td>
+ </tr>
+ <tr>
+ <td width="17%">CLUSTALW</td>
+ <td width="60%">CLUSTAL</td>
+ <td width="23%">.aln</td>
+ </tr>
+ <tr>
+ <td width="17%">PILEUP</td>
+ <td width="60%">PileUp</td>
+ <td width="23%"></td>
+ </tr>
+ <tr>
+ <td width="17%">PIR</td>
+ <td width="60%">>P1;</td>
+ <td width="23%">.pir</td>
+ </tr>
+ <tr>
+ <td width="17%">BLC</td>
+ <td width="60%">>Seq1<br> >Seq2
+ </td>
+ <td width="23%">.blc</td>
+ </tr>
+ <tr>
+ <td width="17%">PFAM</td>
+ <td width="60%">SequenceName THISISASEQUENCE</td>
+ <td width="23%">.pfam</td>
+ </tr>
+ <tr>
+ <td width="17%">Stockholm</td>
+ <td width="60%"># STOCKHOLM VersionNumber<br> <em>...</em><br>//
+ </td>
+ <td width="23%">.stk, .sto</td>
+ </tr>
+ <tr>
+ <td width="17%">Phylip</td>
+ <td width="60%">Line starts with two numbers separated by
+ white space<br> <em>...</em><br>//
+ </td>
+ <td width="23%">.phy</td>
+ </tr>
+ <tr>
+ <td width="17%">JSON</td>
+ <td width="60%">Data starts with '{' <br>Data ends with
+ '}' <br>
+ <br>See <a href="../features/bioJsonFormat.html">BioJSON</a>
+ for more infomation about the Jalview JSON format <br></td>
+ <td width="23%">.json</td>
+ </tr>
+
+ </table>
+ <p>
+ The file extensions are used to associate Jalview alignment icons
+ with alignment files: <img src="file.png" width=12 height=12>
+ </p>
</body>
</html>
diff --git a/help/html/io/index.html b/help/html/io/index.html
index be803bb..57f0416 100644
--- a/help/html/io/index.html
+++ b/help/html/io/index.html
@@ -1,74 +1,106 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Input/Output</title>
</head>
<body>
-<p><strong>Input</strong></p>
-<p>Jalview can read alignment files in any of the following standard
-formats:</p>
-<p><em>Fasta (Pearson), GCG-MSF, ALN/ClustalW, AMPS Block file,
-NBRF/PIR (including MODELLER variant), Pfam/Stockholm</em></p>
-<p>The EBI has <a href="http://www.ebi.ac.uk/help/formats.html">examples</a>
-of these file formats.</p>
-<p>Additionally, whole sets of coloured and annotated alignments and
-trees can be read from a <a href="../features/jalarchive.html">Jalview
-(jar) format</a> file using <strong>Desktop→Load Project</strong>.</p>
-<p>Press "Control O" to open a file browser, or use
-the <strong>Desktop→Input Alignment</strong> menu to read in
-alignments from:</p>
-<ul>
- <li><strong>From File</strong>: the local file system</li>
- <li><strong>From URL</strong>: the web (please use the full url)</li>
- <li><strong>from Textbox</strong>: a copy and paste into the
- "Cut & Paste" text window</li>
-</ul>
-<p>Jalview will try to recognise the file type automatically (using
-some special <a href="fileformats.html">features</a>). If a file is of
-an unknown format or there is any other error reading the alignment file
-then you will be given an error message. If you think Jalview really
-should be able to read your file, then send an email containing the
-problem file to help at jalview.org.</p>
-<p>Jalview can also read jalview specific files for <a
- href="../features/featuresFormat.html">sequence features</a> and <a
- href="../features/annotationsFormat.html">alignment annotation</a>.</p>
-<p><strong>Output</strong></p>
-<p>Each alignment, whether it is the original or an edited version
-may be saved in the standard formats using <strong>File→Save
-As</strong></p>
-<p><em>Fasta (Pearson), GCG-MSF, ALN/ClustalW, AMPS Block file,
-NBRF/PIR, Pfam/Stockholm</em></p>
-Jalview will by default append the sequence start and end to each
-sequence name, in the format /start-end. If you do not want this
-behaviour for a particular file output, open the "Output" tab
-on the
-<a href="../features/preferences.html">Preferences</a>
-window where you can select which file formats you want to append the
-start and end sequence positions for. In the case of PIR format, the
-output tab also contains a switch for turning on the output of Modeller
-style structured description lines.
-<p>Quantitative and symbolic <a href="../features/annotation.html">alignment
-annotation</a> can be exported as a comma separated value file by right
-clicking on an annotation row under the alignment.</p>
-<p>You can also save the current set of alignments and their
-colours, annotations and trees in a Jalview archive file using <strong>Desktop→Save
-project</strong>.</p>
-<p> </p>
+ <p>
+ <strong>Input</strong>
+ </p>
+ <p>Jalview can read alignment files in any of the following
+ standard formats:</p>
+ <p>
+ <em>Fasta (Pearson), GCG-MSF, ALN/ClustalW, AMPS Block file,
+ NBRF/PIR (including MODELLER variant), Pfam/Stockholm</em>
+ </p>
+ <p>
+ The EBI has <a href="http://www.ebi.ac.uk/help/formats.html">examples</a>
+ of these file formats.
+ </p>
+ <p>
+ Additionally, whole sets of coloured and annotated alignments and
+ trees can be read from a <a href="../features/jalarchive.html">Jalview
+ (jar) format</a> file using <strong>Desktop→Load
+ Project</strong>.
+ </p>
+ <p>
+ Press "Control O" to open a file browser, or use the <strong>Desktop→Input
+ Alignment</strong> menu to read in alignments from:
+ </p>
+ <ul>
+ <li><strong>From File</strong>: the local file system</li>
+ <li><strong>From URL</strong>: the web (please use the full
+ url)</li>
+ <li><strong>from Textbox</strong>: a copy and paste into the
+ "Cut & Paste" text window</li>
+ </ul>
+ <p>
+ Jalview will try to recognise the file type automatically (using
+ some special <a href="fileformats.html">features</a>). If a file is
+ of an unknown format or there is any other error reading the
+ alignment file then you will be given an error message. If you think
+ Jalview really should be able to read your file, then send an email
+ containing the problem file to help at jalview.org.
+ </p>
+ <p>
+ Jalview can also read Jalview specific files for <a
+ href="../features/featuresFormat.html"
+ >sequence features</a> and <a
+ href="../features/annotationsFormat.html"
+ >alignment annotation</a>.
+ </p>
+ <p>
+ <strong>Output</strong>
+ </p>
+ <p>
+ Each alignment, whether it is the original or an edited version may
+ be saved in the standard formats using <strong>File→Save
+ As</strong>
+ </p>
+ <p>
+ <em>Fasta (Pearson), GCG-MSF, ALN/ClustalW, AMPS Block file,
+ NBRF/PIR, Pfam/Stockholm</em>
+ </p>
+ Jalview will by default append the sequence start and end to each
+ sequence name, in the format /start-end. If you do not want this
+ behaviour for a particular file output, open the "Output"
+ tab on the
+ <a href="../features/preferences.html">Preferences</a> window where
+ you can select which file formats you want to append the start and end
+ sequence positions for. In the case of PIR format, the output tab also
+ contains a switch for turning on the output of Modeller style
+ structured description lines.
+ <p>
+ Quantitative and symbolic <a href="../features/annotation.html">alignment
+ annotation</a> can be exported as a comma separated value file by
+ right clicking on an annotation row under the alignment.
+ </p>
+ <p>
+ You can also save the current set of alignments and their colours,
+ annotations and trees in a Jalview archive file using <strong>Desktop→Save
+ project</strong>.<br>The project data includes the state of any open
+ structure viewers (Jmol, and <em>since Jalview 2.9</em> also Chimera
+ and Varna).
+ </p>
+ <p> </p>
</body>
</html>
diff --git a/help/html/io/modellerpir.html b/help/html/io/modellerpir.html
index 7d12827..0290721 100644
--- a/help/html/io/modellerpir.html
+++ b/help/html/io/modellerpir.html
@@ -1,32 +1,40 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Modeller PIR Format IO</title>
</head>
<body>
-<p><strong>Modeller PIR Format IO</strong></p>
-<p>The homology modelling program, <a
-href="http://salilab.org/modeller/">Modeller</a> uses a special form
-of the PIR format where information about sequence numbering and chain
-codes are written into the 'description' line between the PIR protein
-tag and the protein alignment entry:</p>
-<pre>>P1;Q93Z60_ARATH
+ <p>
+ <strong>Modeller PIR Format IO</strong>
+ </p>
+ <p>
+ The homology modelling program, <a
+ href="http://salilab.org/modeller/"
+ >Modeller</a> uses a special form of the PIR format where information
+ about sequence numbering and chain codes are written into the
+ 'description' line between the PIR protein tag and the protein
+ alignment entry:
+ </p>
+ <pre>>P1;Q93Z60_ARATH
sequence:Q93Z60_ARATH:1:.:118:.:.
----MASTALSSAIVSTSFLRRQQTPISLRSLPFANT-QSLFGLKS-STARGGRVTAMATYKVKFITPEGEQ
EVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSD------QSFLD-D-------------
@@ -37,26 +45,30 @@ structureX:1FER:1:.:105:.:.
EV-CPVDCFY----EGPNFLVIHPDECIDCALCEPECPAQAIFSEDEVPEDMQEFIQLNAELAEVWPNITEK
KDPLPDAEDWDGVKGKLQHLE*
</pre>
-<p>Jalview will attempt to parse any PIR entries conforming to the
-Modeller/PIR format, in order to extract the sequence start and end
-numbering and (possibly) a PDB file reference. The description line
-information is always stored in the sequence description string - so
-no information is lost if this parsing process fails.</p>
-<p>The 'Modeller Output' flag in the 'Output' tab of the Jalview <a href="../features/preferences.html">Preferences dialog
-box</a> controls whether Jalview will also output MODELLER style PIR
-files. In this case, any existing 'non-modeller PIR' header
-information in the description string of an alignment is appended to
-an automatically generated modeller description line for that
-sequence.</p>
-<p>The general format used for generating the Modeller/PIR sequence
-description line is shown below :
-<pre>>P1;<em>Primary_Sequence_ID</em>
+ <p>Jalview will attempt to parse any PIR entries conforming to the
+ Modeller/PIR format, in order to extract the sequence start and end
+ numbering and (possibly) a PDB file reference. The description line
+ information is always stored in the sequence description string - so
+ no information is lost if this parsing process fails.</p>
+ <p>
+ The 'Modeller Output' flag in the 'Output' tab of the Jalview <a
+ href="../features/preferences.html"
+ >Preferences dialog box</a> controls whether Jalview will also output
+ MODELLER style PIR files. In this case, any existing 'non-modeller
+ PIR' header information in the description string of an alignment is
+ appended to an automatically generated modeller description line for
+ that sequence.
+ </p>
+ <p>The general format used for generating the Modeller/PIR
+ sequence description line is shown below :
+ <pre>>P1;<em>Primary_Sequence_ID</em>
<em>sequence or structureX</em>:<em>pdb-reference if
available</em>:<em>start residue</em>:<em>start chain code</em>:<em>end
- residue</em>:<em>end chain code</em>:. <em>description text</em></pre>
-The first field is either sequence or structureX, depending upon the
-presence of a PDB database ID for the sequence. If the protein has no
-PDB reference, then the chain code is not specified, unless one
-already existed when the sequence was imported into Jalview.
+ residue</em>:<em>end chain code</em>:. <em>description text</em>
+ </pre>
+ The first field is either sequence or structureX, depending upon the
+ presence of a PDB database ID for the sequence. If the protein has no
+ PDB reference, then the chain code is not specified, unless one
+ already existed when the sequence was imported into Jalview.
</body>
</html>
diff --git a/help/html/io/seqreport.gif b/help/html/io/seqreport.gif
new file mode 100644
index 0000000..79fdec6
Binary files /dev/null and b/help/html/io/seqreport.gif differ
diff --git a/help/html/io/tcoffeescores.html b/help/html/io/tcoffeescores.html
new file mode 100644
index 0000000..5bc6f7d
--- /dev/null
+++ b/help/html/io/tcoffeescores.html
@@ -0,0 +1,84 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>T-COFFEE Annotation Scores</title>
+</head>
+<body>
+ <p>
+ <strong>Loading and viewing T-COFFEE Annotation Scores</strong>
+ </p>
+ <p>
+ T-COFFEE score files like the <a href="#tcoffeeeg">one below</a> can
+ be displayed on the alignment using the <strong><em>Colours→T-COFFEE
+ Scores</em></strong> or <strong><em>Colour → <a
+ href="../colourSchemes/annotationColouring.html"
+ >Colour by Annotation</a></em></strong> options.
+ </p>
+ <img src="../colourSchemes/colbytcoffee.png" />
+ <p>
+ <strong><a name="tcoffeeeg">Example T-COFFEE Score file</a></strong><br />
+ T-COFFEE score files like the one below can be dropped directly onto
+ the corresponding alignment to visualize alignment confidence
+ scores.
+ </p>
+ <pre>
+T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)
+Cedric Notredame
+CPU TIME:0 sec.
+SCORE=90
+*
+ BAD AVG GOOD
+*
+1PHT : 89
+1BB9 : 90
+1UHC : 94
+1YCS : 94
+1OOT : 93
+1ABO : 94
+1FYN : 94
+1QCF : 94
+cons : 90
+
+1PHT 999999999999999999999999998762112222543211112134
+1BB9 99999999999999999999999999987-------4322----2234
+1UHC 99999999999999999999999999987-------5321----2246
+1YCS 99999999999999999999999999986-------4321----1-35
+1OOT 999999999999999999999999999861-------3------1135
+1ABO 99999999999999999999999999986-------422-------34
+1FYN 99999999999999999999999999985-------32--------35
+1QCF 99999999999999999999999999974-------2---------24
+cons 999999999999999999999999999851000110321100001134
+
+
+1PHT ----------5666642367889999999999889
+1BB9 1111111111676653-355679999999999889
+1UHC ----------788774--66789999999999889
+1YCS ----------78777--356789999999999889
+1OOT ----------78877--356789999999997-67
+1ABO ----------687774--56779999999999889
+1FYN ----------6888842356789999999999889
+1QCF ----------6878742356789999999999889
+cons 00100000006877641356789999999999889
+</pre>
+
+</body>
+</html>
diff --git a/help/html/jalviewjnlp.html b/help/html/jalviewjnlp.html
deleted file mode 100644
index 6f31a7a..0000000
--- a/help/html/jalviewjnlp.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head>
-<title>Jalview local Jnlp File</title>
-</head>
-<body>
-<h1>Jalview local Jnlp File</h1>
-<pre>
-<jnlp spec="1.0+" codebase="http://www.jalview.org/webstart/">
- <information>
- <title>Jalview</title>
- <vendor>The Barton Group</vendor>
- <homepage href="http://www.jalview.org"/>
- <description>Jalview Multiple Alignment Editor</description>
- <description kind="short">Jalview</description>
- <icon href="http://www.jalview.org/webstart/logo_big.gif" kind="default"/>
- <association extensions="fa" mime-type="application-x/ext-file"/>
- <association extensions="fasta" mime-type="application-x/ext-file"/>
- <association extensions="fastq" mime-type="application-x/ext-file"/>
- <association extensions="blc" mime-type="application-x/ext-file"/>
- <association extensions="msf" mime-type="application-x/ext-file"/>
- <association extensions="pfam" mime-type="application-x/ext-file"/>
- <association extensions="aln" mime-type="application-x/ext-file"/>
- <association extensions="pir" mime-type="application-x/ext-file"/>
- <association extensions="stk" mime-type="application-x/ext-file"/>
- <offline-allowed/>
- </information>
- <security>
- <all-permissions/>
- </security>
- <resources>
- <!-- <em>the additional memory parameters are here</em> -->
- <j2se version="1.5+" initial-heap-size="500M" max-heap-size="1000M"/>
- <jar href="jalview.jar"/>
- <jar href="JGoogleAnalytics-0.2.1-SNAPSHOT.jar"/>
- <jar href="Jmol-12.1.13.jar"/>
- <jar href="activation.jar"/>
- <jar href="axis.jar"/>
- <jar href="castor-1.1-cycle-xml.jar"/>
- <jar href="commons-discovery.jar"/>
- <jar href="commons-logging.jar"/>
- <jar href="jaxrpc.jar"/>
- <jar href="jhall.jar"/>
- <jar href="log4j-1.2.8.jar"/>
- <jar href="mail.jar"/>
- <jar href="min-jaba-client.jar"/>
- <jar href="regex.jar"/>
- <jar href="saaj.jar"/>
- <jar href="vamsas-client.jar"/>
- <jar href="wsdl4j.jar"/>
- <jar href="xercesImpl.jar"/>
- <jar href="xml-apis.jar"/>
- <property name="jalview.version" value="2.6.1"/>
- </resources>
- <application-desc main-class="jalview.bin.Jalview"/>
-</jnlp>
-</pre>
-<address><a
- href="http://www.jalview.org/mailman/listinfo/jalview-discuss">If
-you have problems, send an email to jalview-discuss</a></address>
-</body>
-</html>
diff --git a/help/html/keys.html b/help/html/keys.html
index ee526e8..6a88c5c 100644
--- a/help/html/keys.html
+++ b/help/html/keys.html
@@ -1,264 +1,344 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Key Strokes</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Key Strokes</title>
+</head>
<body>
-<p><strong>Key Strokes</strong></p>
-<p>
-Jalview has two distinct modes of keyboard operation - in 'Normal'
- mode, single keystrokes (including those shown next to menu items)
- provide short cuts to common commands. In <a
- href="features/cursorMode.html">'Cursor'</a> mode (enabled by
- <em>F2</em>), some of these are disabled and more complex 'Compound
- Keystrokes' can be entered to perform precise navigation, selection
- and editing operations.
-</p>
-<table border="1">
- <tr>
- <td><strong>Key</strong></td>
- <td><strong>Which Mode</strong></td>
- <td><strong>Action</strong></td>
- </tr>
- <!--<tr>
+ <p>
+ <strong>Key Strokes</strong>
+ </p>
+ <p>
+ Jalview has two distinct modes of keyboard operation - in 'Normal'
+ mode, single keystrokes (including those shown next to menu items)
+ provide short cuts to common commands. In <a
+ href="features/cursorMode.html"
+ >'Cursor'</a> mode (enabled by <em>F2</em>), some of these are
+ disabled and more complex 'Compound Keystrokes' can be entered to
+ perform precise navigation, selection and editing operations.
+ </p>
+ <table border="1">
+ <tr>
+ <td><strong>Key</strong></td>
+ <td><strong>Which Mode</strong></td>
+ <td><strong>Action</strong></td>
+ </tr>
+ <!--<tr>
<td><strong>Escape</strong></td><td>Both</td>
<td>The Panic button.</td></tr>
<tr> -->
- <tr>
- <td><strong> Escape</strong></td>
- <td>Normal</td>
- <td>Clears the current selection region, highlighted columns and highlghted
- residues. </td>
- </tr>
- <tr>
- <td><strong>Escape</strong></td>
- <td>Cursor</td>
- <td>As in normal mode, but also cancels any partially entered commands</td>
- </tr>
- <tr>
- <td><strong><em>F1</em></strong></td>
- <td>Both</td>
- <td>Show Help Documentation</td>
- </tr>
- <tr>
- <td><strong><em>F2</em></strong></td>
- <td></td>
- <td>Toggle Cursor mode on / off</td>
- </tr>
- <tr>
- <td><strong>Control 'Z'</strong></td>
- <td>Both</td>
- <td>Undoes the last sequence edit</td>
- </tr>
- <tr>
- <td><strong>Control 'Y'</strong></td>
- <td>Both</td>
- <td>Redo the last sequence edit undone.</td>
- </tr>
- <tr>
- <td><strong>Up Arrow</strong></td>
- <td>Normal</td>
- <td>Moves selected sequence(s) up the alignment</td>
- </tr>
- <tr>
- <td><strong>Down Arrow</strong></td>
- <td>Normal</td>
- <td>Moves selected sequence(s) down the alignment.</td>
- </tr>
- <tr>
- <td><strong>Left Arrow</strong></td>
- <td>Normal </td>
- <td>Slides selected sequence(s) left. Press Alt key to slide in cursor mode</td>
- </tr>
- <tr>
- <td><strong>Right Arrow</strong></td>
- <td>Normal</td>
- <td>Slides selected sequence(s) right. Press Alt key to slide in cursor mode</td>
- </tr>
- <tr>
- <td><strong>Cursor Keys<br>
- (Arrow Keys)</strong></td>
- <td>Cursor</td>
- <td>Move cursor around alignment</td>
- </tr>
- <tr>
- <td><strong>Page Up</strong></td>
- <td>Both</td>
- <td>Scroll up the alignment view</td>
- </tr>
- <tr>
- <td><strong>Page Down</strong></td>
- <td>Both</td>
- <td>Scroll down the alignment view</td>
- </tr>
- <tr>
- <td><strong>Control 'A'</strong></td>
- <td>Both</td>
- <td>Selects all sequences in the alignment</td>
- </tr>
- <tr>
- <td><strong>Control 'I'</strong></td>
- <td>Both </td>
- <td>Invert sequence selection. </td>
- </tr>
- <tr>
- <td><strong>Control Alt 'I'</strong></td>
- <td>Both </td>
- <td>Invert column selection. </td>
- </tr>
- <tr>
- <td><strong>Control 'C'</strong></td>
- <td>Both</td>
- <td>Copies the selected region into the clipboard as a Fasta format file<br>
- <em>nb. not available in applet, as no clipboard is available</em></td>
- </tr>
- <tr>
- <td><strong>Control 'V'</strong></td>
- <td>Both</td>
- <td> Paste the contents of the clipboard to the current alignment window.
- (Alignment Window->Edit->Paste->Add to this Alignment)<br> <em>nb. if the
- paste is from a Jalview alignment, any sequence and alignment annotations
- will also be copied over.</em></td>
- </tr>
- <tr>
- <td><strong>Control Shift 'V'</strong></td>
- <td>Both</td>
- <td>Paste the contents of the clipboard to a new alignment window. (Alignment
- Window->Edit->Paste->To New Alignment)</td>
- </tr>
- <tr>
- <td><strong>Control 'X'</strong></td>
- <td>Both</td>
- <td>Cuts the (fully) selected sequences from the alignment.
- <!-- not yet in this version
+ <tr>
+ <td><strong> Escape</strong></td>
+ <td>Normal</td>
+ <td>Clears the current selection region, highlighted columns
+ and highlghted residues.</td>
+ </tr>
+ <tr>
+ <td><strong>Escape</strong></td>
+ <td>Cursor</td>
+ <td>As in normal mode, but also cancels any partially entered
+ commands</td>
+ </tr>
+ <tr>
+ <td><strong><em>F1</em></strong></td>
+ <td>Both</td>
+ <td>Show Help Documentation</td>
+ </tr>
+ <tr>
+ <td><strong><em>F2</em></strong></td>
+ <td></td>
+ <td>Toggle Cursor mode on / off</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'Z'</strong></td>
+ <td>Both</td>
+ <td>Undoes the last sequence edit</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'Y'</strong></td>
+ <td>Both</td>
+ <td>Redo the last sequence edit undone.</td>
+ </tr>
+ <tr>
+ <td><strong>Up Arrow</strong></td>
+ <td>Normal</td>
+ <td>Moves selected sequence(s) up the alignment</td>
+ </tr>
+ <tr>
+ <td><strong>Down Arrow</strong></td>
+ <td>Normal</td>
+ <td>Moves selected sequence(s) down the alignment.</td>
+ </tr>
+ <tr>
+ <td><strong>Left Arrow</strong></td>
+ <td>Normal</td>
+ <td>Slides selected sequence(s) left. Press Alt key to slide
+ in cursor mode</td>
+ </tr>
+ <tr>
+ <td><strong>Right Arrow</strong></td>
+ <td>Normal</td>
+ <td>Slides selected sequence(s) right. Press Alt key to slide
+ in cursor mode</td>
+ </tr>
+ <tr>
+ <td><strong>Cursor Keys<br> (Arrow Keys)
+ </strong></td>
+ <td>Cursor</td>
+ <td>Move cursor around alignment</td>
+ </tr>
+ <tr>
+ <td><strong>Page Up</strong></td>
+ <td>Both</td>
+ <td>Scroll up the alignment view</td>
+ </tr>
+ <tr>
+ <td><strong>Page Down</strong></td>
+ <td>Both</td>
+ <td>Scroll down the alignment view</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'A'</strong></td>
+ <td>Both</td>
+ <td>Selects all sequences in the alignment</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'I'</strong></td>
+ <td>Both</td>
+ <td>Invert sequence selection.</td>
+ </tr>
+ <tr>
+ <td><strong>Control Alt 'I'</strong></td>
+ <td>Both</td>
+ <td>Invert column selection.</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'C'</strong></td>
+ <td>Both</td>
+ <td>Copies the selected region into the clipboard as a Fasta
+ format file<br> <em>nb. not available in applet, as no
+ clipboard is available</em>
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Control 'V'</strong></td>
+ <td>Both</td>
+ <td>Paste the contents of the clipboard to the current
+ alignment window. (Alignment Window->Edit->Paste->Add to this
+ Alignment)<br> <em>nb. if the paste is from a Jalview
+ alignment, any sequence and alignment annotations will also be
+ copied over.</em>
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Control Shift 'V'</strong></td>
+ <td>Both</td>
+ <td>Paste the contents of the clipboard to a new alignment
+ window. (Alignment Window->Edit->Paste->To New Alignment)</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'X'</strong></td>
+ <td>Both</td>
+ <td>Cuts the (fully) selected sequences from the alignment. <!-- not yet in this version
This will not happen if only some
columns are selected, you should use the <a href="features/regionHiding.html">Hide Regions feature</a> instead.-->
- </td>
- </tr>
- <tr>
- <td><strong>Control 'F'</strong></td>
- <td>Both</td>
- <td>Launches the search window</td>
- </tr>
- <tr>
- <td><strong>H</strong></td>
- <td>Both</td>
- <td>Hides / Reveals selected columns and sequences</td>
- </tr>
- <tr>
- <td><strong>Control 'H'</strong></td>
- <td>Both</td>
- <td>Hides / Reveals selected columns</td>
- </tr>
- <tr>
- <td><strong>Shift 'H'</strong></td>
- <td>Both</td>
- <td>Hides / Reveals selected sequences</td>
- </tr>
- <tr>
- <td><strong>Control + Shift 'H'</strong></td>
- <td>Both</td>
- <td>Hides everything but the current selection</td>
- </tr>
- <tr>
- <td><strong>Control 'O'</strong></td>
- <td>Both</td>
- <td>Input new alignment from file</td>
- </tr>
- <tr>
- <td><strong>Control 'S'</strong></td>
- <td>Both</td>
- <td>Save alignment with current filename and format</td>
- </tr>
- <tr>
- <td><strong>Control Shift 'S'</strong></td>
- <td>Both</td>
- <td>Save alignment as a new file or with a different format</td>
- </tr>
- <tr>
- <td><strong>Control 'P'</strong></td>
- <td>Both</td>
- <td>Opens the print dialog box to print the current view</td>
- </tr>
- <tr>
- <td><strong>Control 'W'</strong></td>
- <td>Both</td>
- <td>Closes the current view or the current alignment</td>
- </tr>
- <tr>
- <td><strong>Backspace</strong></td>
- <td>Normal</td>
- <td>Delete the currently selected rows or columns from the alignment.</td>
- </tr>
- <tr>
- <td><strong>Control 'L'</strong></td>
- <td>Left</td>
- <td>Remove columns to left of left-most column marker.</td>
- </tr>
- <tr>
- <td><strong>Control 'R'</strong></td>
- <td>Both</td>
- <td>Remove columns to right of right-most column marker.</td>
- </tr>
- <tr>
- <td><strong>Control 'E'</strong></td>
- <td>Both</td>
- <td>Remove gapped columns</td>
- </tr>
- <tr>
- <td><strong>Control Shift 'E'</strong></td>
- <td>Both</td>
- <td>Remove all gaps</td>
- </tr>
- <tr>
- <td><strong>Control 'D'</strong></td>
- <td>Both</td>
- <td>Open the 'Remove redundancy' Dialog box.</td>
- </tr>
- <tr>
- <td><strong></strong></td>
- <td>Normal</td>
- <td></td>
- </tr>
-</table>
-<p>The compound commands available in the Cursor mode are summarised
-below. Single letter commands can be prefixed by digits to specify a repetition
-number, and some more complex commands take one or more numeric
-parameters (prefixing the command key and separated by commas).</p>
-<table border=1><tr><td><strong>Compound
-Command</strong></td><td>Mode</td><td>Action (and parameter description)</td></tr>
-<tr><td><strong>0-9</strong></td><td>Cursor</td><td>Begin entering a
-numeric parameter (<strong><em>p</em></strong>) or repetition number for a cursor movement or edit
-command.</td></tr>
-<tr><td><strong>,</strong></td><td>Cursor</td><td>Separates one or
-more numeric parameters (<em>e.g. <strong>p1</strong>,<strong>p2</strong></em>) for a command.</td></tr>
-<tr><td><strong><strong><em>p1</em></strong>,<strong><em>p2</em></strong><br>Return</strong></td><td>Cursor</td><td>Move cursor to a particular column (<strong><em>p1</em></strong>) and row (<strong><em>p2</em></strong>) in the alignment.<br><em>e.g. '5,6<Return>' moves the cursor to the 5th column in the 6th sequence.</em></td></tr>
-<tr><td><strong><em>p</em>S</strong></td><td>Cursor</td><td>Jump to the <strong><em>p</em></strong>'th sequence in the alignment.</td></tr>
-<tr><td><strong><em>p</em>P</strong></td><td>Cursor</td><td>Jump to <em><strong>p</strong></em>'th amino acid in current sequence.</td></tr>
-<tr><td><strong><em>p</em>C</strong></td><td>Cursor</td><td>Jump to <em><strong>p</strong></em>'th column in the alignment.</td></tr>
-<tr><td><strong>Q</strong></td><td>Cursor</td><td>Marks the top left corner of the selection area</td></tr>
-<tr><td><strong>M</strong></td><td>Cursor</td><td>Marks the bottom right corner of the selection area</td></tr>
-<tr><td><strong><em>[p]</em><br>Space</strong></td><td>Cursor</td><td>Inserts
-one (or optionally <strong><em>p</em></strong>) gaps at the current position.<br><em>Hold down Control or Shift to insert gaps over a sequence group</em></td></tr>
-<tr><td><strong><em>[p]</em><br>Delete<br></strong></td><td>Cursor</td><td>Removes
-one (or optionally <strong><em>p</em></strong>) gaps at the cursor position.<br><em>Hold down Control or Shift to insert gaps over a sequence group</em></td></tr>
-<tr><td><strong><em>[p]</em><br>Backspace<br></strong></td><td>Cursor</td><td>Removes
-one (or optionally <strong><em>p</em></strong>) gaps at the cursor position.<br><em>Hold down Control or Shift to insert gaps over a sequence group</em></td></tr></table>
-<p> </p>
-<p> </p>
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Control 'F'</strong></td>
+ <td>Both</td>
+ <td>Launches the search window</td>
+ </tr>
+ <tr>
+ <td><strong>H</strong></td>
+ <td>Both</td>
+ <td>Hides / Reveals selected columns and sequences</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'H'</strong></td>
+ <td>Both</td>
+ <td>Hides / Reveals selected columns</td>
+ </tr>
+ <tr>
+ <td><strong>Shift 'H'</strong></td>
+ <td>Both</td>
+ <td>Hides / Reveals selected sequences</td>
+ </tr>
+ <tr>
+ <td><strong>Control + Shift 'H'</strong></td>
+ <td>Both</td>
+ <td>Hides everything but the current selection</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'O'</strong></td>
+ <td>Both</td>
+ <td>Input new alignment from file</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'S'</strong></td>
+ <td>Both</td>
+ <td>Save alignment with current filename and format</td>
+ </tr>
+ <tr>
+ <td><strong>Control Shift 'S'</strong></td>
+ <td>Both</td>
+ <td>Save alignment as a new file or with a different format</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'P'</strong></td>
+ <td>Both</td>
+ <td>Opens the print dialog box to print the current view</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'W'</strong></td>
+ <td>Both</td>
+ <td>Closes the current view or the current alignment</td>
+ </tr>
+ <tr>
+ <td><strong>Backspace</strong></td>
+ <td>Normal</td>
+ <td>Delete the currently selected rows or columns from the
+ alignment.</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'L'</strong></td>
+ <td>Left</td>
+ <td>Remove columns to left of left-most column marker.</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'R'</strong></td>
+ <td>Both</td>
+ <td>Remove columns to right of right-most column marker.</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'E'</strong></td>
+ <td>Both</td>
+ <td>Remove gapped columns</td>
+ </tr>
+ <tr>
+ <td><strong>Control Shift 'E'</strong></td>
+ <td>Both</td>
+ <td>Remove all gaps</td>
+ </tr>
+ <tr>
+ <td><strong>Control 'D'</strong></td>
+ <td>Both</td>
+ <td>Open the 'Remove redundancy' Dialog box.</td>
+ </tr>
+ <tr>
+ <td><strong></strong></td>
+ <td>Normal</td>
+ <td></td>
+ </tr>
+ </table>
+ <p>The compound commands available in the Cursor mode are
+ summarised below. Single letter commands can be prefixed by digits
+ to specify a repetition number, and some more complex commands take
+ one or more numeric parameters (prefixing the command key and
+ separated by commas).</p>
+ <table border=1>
+ <tr>
+ <td><strong>Compound Command</strong></td>
+ <td>Mode</td>
+ <td>Action (and parameter description)</td>
+ </tr>
+ <tr>
+ <td><strong>0-9</strong></td>
+ <td>Cursor</td>
+ <td>Begin entering a numeric parameter (<strong><em>p</em></strong>)
+ or repetition number for a cursor movement or edit command.
+ </td>
+ </tr>
+ <tr>
+ <td><strong>,</strong></td>
+ <td>Cursor</td>
+ <td>Separates one or more numeric parameters (<em>e.g. <strong>p1</strong>,<strong>p2</strong></em>)
+ for a command.
+ </td>
+ </tr>
+ <tr>
+ <td><strong><strong><em>p1</em></strong>,<strong><em>p2</em></strong><br>Return</strong></td>
+ <td>Cursor</td>
+ <td>Move cursor to a particular column (<strong><em>p1</em></strong>)
+ and row (<strong><em>p2</em></strong>) in the alignment.<br>
+ <em>e.g. '5,6<Return>' moves the cursor to the 5th
+ column in the 6th sequence.</em></td>
+ </tr>
+ <tr>
+ <td><strong><em>p</em>S</strong></td>
+ <td>Cursor</td>
+ <td>Jump to the <strong><em>p</em></strong>'th sequence in
+ the alignment.
+ </td>
+ </tr>
+ <tr>
+ <td><strong><em>p</em>P</strong></td>
+ <td>Cursor</td>
+ <td>Jump to <em><strong>p</strong></em>'th amino acid in
+ current sequence.
+ </td>
+ </tr>
+ <tr>
+ <td><strong><em>p</em>C</strong></td>
+ <td>Cursor</td>
+ <td>Jump to <em><strong>p</strong></em>'th column in the
+ alignment.
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Q</strong></td>
+ <td>Cursor</td>
+ <td>Marks the top left corner of the selection area</td>
+ </tr>
+ <tr>
+ <td><strong>M</strong></td>
+ <td>Cursor</td>
+ <td>Marks the bottom right corner of the selection area</td>
+ </tr>
+ <tr>
+ <td><strong><em>[p]</em><br>Space</strong></td>
+ <td>Cursor</td>
+ <td>Inserts one (or optionally <strong><em>p</em></strong>)
+ gaps at the current position.<br>
+ <em>Hold down Control or Shift to insert gaps over a sequence
+ group</em></td>
+ </tr>
+ <tr>
+ <td><strong><em>[p]</em><br>Delete<br></strong></td>
+ <td>Cursor</td>
+ <td>Removes one (or optionally <strong><em>p</em></strong>)
+ gaps at the cursor position.<br>
+ <em>Hold down Control or Shift to insert gaps over a sequence
+ group</em></td>
+ </tr>
+ <tr>
+ <td><strong><em>[p]</em><br>Backspace<br></strong></td>
+ <td>Cursor</td>
+ <td>Removes one (or optionally <strong><em>p</em></strong>)
+ gaps at the cursor position.<br>
+ <em>Hold down Control or Shift to insert gaps over a sequence
+ group</em></td>
+ </tr>
+ </table>
+ <p> </p>
+ <p> </p>
</body>
</html>
diff --git a/help/html/memory.html b/help/html/memory.html
index 366c073..edc277c 100644
--- a/help/html/memory.html
+++ b/help/html/memory.html
@@ -1,118 +1,146 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Memory Settings</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Memory Settings</title>
+</head>
<body>
-<h2>
- <center>
- <strong>Memory Usage Settings for Jalview</strong>
- </center>
-</h2>
-<p>Jalview sometimes runs out of memory. This is because of the way that Java
- runs on a computer - what is actually run is a program called a virtual machine
- (the JVM) which executes the java instructions. The JVM has limits on the memory
- that can be allocated to the java program - and you might need to increase them
- if you are working with particularly large datasets.<br>
- If Jalview has not explicitly told you that it has run out of memory, then a
- common sign is that a function that normally works seems to have no effect when
- working with a larger set of sequences (this might include open dialog boxes
- for saving PNG files, or when interpreting the result of a web service calculation).</p>
- <p><em>Jalview Memory Usage Monitor</em>: If you are concerned about memory, or think that things might be behaving
- strangely because of a shortage of memory, then you can check this by enabling the
- memory usage monitor. This is done by selecting the <strong>Tools→Show Memory Usage</strong>
- option. Once enabled, the memory usage monitor displays the currently
- available memory, the total memory, and the percentage free at the
- bottom left hand side of the Jalview Desktop window's background.</p>
-<p><em>Increasing the memory available to Jalview</em><br>
-The way you increase the memory settings for the JVM depends on which installation
- of Jalview you use:</p>
-<ul>
- <li><em><font size="3">Web Start Version</font></em>
- <p>JavaWS sets the JVM parameters through special tags in the JNLP file. You'll
- need to <a href="jalviewjnlp.html">make your own jnlp file</a> and add the following parameter into the
- <resources> element.
- <pre>
-<j2se version="1.5+" initial-heap-size="500M" max-heap-size="1000M"/>
-</pre>
- Save the jnlp file somewhere and then - if you start Jalview through your
- web browser, point your browser at the file's url, othewise simply run javaws
- with the file location as its argument. The file's url is something like :<br>
- <pre>
+ <h2>
+ <center>
+ <strong>Memory Usage Settings for Jalview</strong>
+ </center>
+ </h2>
+ <p>
+ Jalview sometimes runs out of memory. This is because of the way
+ that Java runs on a computer - what is actually run is a program
+ called a virtual machine (the JVM) which executes the java
+ instructions. The JVM has limits on the memory that can be allocated
+ to the java program - and you might need to increase them if you are
+ working with particularly large datasets.<br> If Jalview has
+ not explicitly told you that it has run out of memory, then a common
+ sign is that a function that normally works seems to have no effect
+ when working with a larger set of sequences (this might include open
+ dialog boxes for saving PNG files, or when interpreting the result
+ of a web service calculation).
+ </p>
+ <p>
+ <em>Jalview Memory Usage Monitor</em>: If you are concerned about
+ memory, or think that things might be behaving strangely because of
+ a shortage of memory, then you can check this by enabling the memory
+ usage monitor. This is done by selecting the <strong>Tools→Show
+ Memory Usage</strong> option. Once enabled, the memory usage monitor
+ displays the currently available memory, the total memory, and the
+ percentage free at the bottom left hand side of the Jalview Desktop
+ window's background.
+ </p>
+ <p>
+ <em>Increasing the memory available to Jalview</em><br> The way
+ you increase the memory settings for the JVM depends on which
+ installation of Jalview you use:
+ </p>
+ <ul>
+ <li><em><font size="3">Web Start Version</font></em>
+ <p>
+ JavaWS sets the JVM parameters through special tags in the JNLP
+ file. You can obtain a JNLP file with modified memory settings
+ from our service with the following link (replace 2G with
+ desired memory in G or M):<br /> <a
+ href="http://www.jalview.org/services/launchApp?jvm-max-heap=2G"
+ >http://www.jalview.org/services/launchApp?jvm-max-heap=2G</a>
+ </p>
+ <p>
+ Alternatively, if you want to create your own JNLP file then
+ please download the latest JNLP file from <a
+ href="http://www.jalview.org/webstart/jalview.jnlp"
+ >http://www.jalview.org/webstart/jalview.jnlp</a> and modify the
+ max-heap-size parameter for the j2se tag in the
+ <resources> element. e.g.
+ <pre>
+<j2se version="1.7+" initial-heap-size="500M" max-heap-size="1000M"/>
+</pre> In both cases, you should save your new jnlp file somewhere and then
+ either point your web browser at the file's url, launch it from
+ your file browser, or from a terminal window run javaws (located
+ in your Java installation's bin directory) with the file location
+ as its argument. The file's url is something like :<br> <pre>
file://<full path to file>
-</pre>
- If jalview doesn't start up, see <a href="#memsetting">below</a>. You'll have
- to edit the above settings in the JNLP file using a text editor, save it,
- and try starting Jalview with it once more.
- <p></li>
- <li><em><font size="3">Install Anywhere version</font></em>
- <p> You need to change the InstallAnywhere configuration settings for the
- application. These are found in different places depending upon which operating
- system you have :
- <ul>
- <li><em>Unix/Windows</em>
- <p> Take a look inside the Jalview program installation directory (this
- might be in C:\Program Files\Jalview on windows). You should find a
- file called 'Jalview.lax' in it - make a backup, and then add the following
- lines to the end of the original file :
- <pre>
+</pre> If Jalview doesn't start up, see <a href="#memsetting">below</a>.
+ You'll have to edit the above settings in the JNLP file using a
+ text editor, save it, and try starting Jalview with it once more.
+ </p></li>
+ <li><em><font size="3">Install Anywhere version</font></em>
+ <p>You need to change the InstallAnywhere configuration
+ settings for the application. These are found in different
+ places depending upon which operating system you have :
+ <ul>
+ <li><em>Unix/Windows</em>
+ <p>Take a look inside the Jalview program installation
+ directory (this might be in C:\Program Files\Jalview on
+ windows). You should find a file called 'Jalview.lax' in it
+ - make a backup, and then add the following lines to the end
+ of the original file :
+ <pre>
lax.nl.java.option.java.heap.size.max=1000m
lax.nl.java.option.java.heap.size.initial=500m
-</pre>
- Case and (lack of) spaces are important here! Do not add any spaces after
- the m in each line, and do not put any spaces before 'lax'.<br>
- Also there MUST be a carriage return after the final line.
- <p></p>
- </li>
- <li><em>Mac OSX</em>
- <p>The lines you need to change are in the <em>Info.plist</em> file inside
- the <em>Jalview.app/Contents</em> directory (which is where the installAnywhere
- installation was made) :
- <pre>
+</pre> Case and (lack of) spaces are important here! Do not add any spaces
+ after the m in each line, and do not put any spaces before
+ 'lax'.<br> Also there MUST be a carriage return after the
+ final line.
+ <p></p></li>
+ <li><em>Mac OSX</em>
+ <p>
+ The lines you need to change are in the <em>Info.plist</em>
+ file inside the <em>Jalview.app/Contents</em> directory
+ (which is where the installAnywhere installation was made) :
+
+ <pre>
<key&ht;VMOptions</key&ht;
<array>
! <string>-Xms2M</string>
! <string>-Xmx64M</string>
</array>
-</pre>
- Exchange the above two string tags for :
- <pre>
+</pre> Exchange the above two string tags for : <pre>
<string>-Xms500M</string>
<string>-Xmx1000M</string>
</pre>
- <p></p>
- </li>
- </ul>
- <li><font size="3"><em>In all cases</em></font><br>
- Save the file and try to start Jalview in the normal way. If it doesn't start,
- see below... </li>
-</ul>
-<font size="3"><em>Jalview doesn't start... What do the memory settings mean ?<a name="memsetting"></a></em></font>
-<p> The 1000m value corresponds to the maximum number of megabytes of space that
- java objects can occupy. The 500m is the initial heap size that java will run
- in - increasing this can speed up memory allocation if you know you will need
- 500 meg of memory to begin with (ie it should speed up loading large alignments).
-</p>
-<p> If, after setting the initial and maximum heap size to some large value, you
- cannot actually start Jalview, then the max and initial sizes are too big for
- your machine (there seems to be a physical limit related to physical RAM - email
- the usual address to enlighten us if you know better!). Our experiments found
- 1000m to be the biggest setting that could be used on a 1GB machine. Just try
- reducing the sizes until Jalview starts up properly! </p>
-<p> </p>
+ <p></p></li>
+ </ul>
+ <li><font size="3"><em>In all cases</em></font><br> Save
+ the file and try to start Jalview in the normal way. If it doesn't
+ start, see below...</li>
+ </ul>
+ <font size="3"><em>Jalview doesn't start... What do the
+ memory settings mean ?<a name="memsetting"></a>
+ </em></font>
+ <p>The 1000m value corresponds to the maximum number of megabytes
+ of space that java objects can occupy. The 500m is the initial heap
+ size that java will run in - increasing this can speed up memory
+ allocation if you know you will need 500 meg of memory to begin with
+ (ie it should speed up loading large alignments).</p>
+ <p>If, after setting the initial and maximum heap size to some
+ large value, you cannot actually start Jalview, then the max and
+ initial sizes are too big for your machine (there seems to be a
+ physical limit related to physical RAM - email the usual address to
+ enlighten us if you know better!). Our experiments found 1000m to be
+ the biggest setting that could be used on a 1GB machine. Just try
+ reducing the sizes until Jalview starts up properly!</p>
+ <p> </p>
</body>
</html>
diff --git a/help/html/menus/alignmentMenu.html b/help/html/menus/alignmentMenu.html
index ff74139..5f60ba5 100644
--- a/help/html/menus/alignmentMenu.html
+++ b/help/html/menus/alignmentMenu.html
@@ -1,567 +1,678 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Alignment Window Menus</title>
</head>
<body>
- <p>
- <strong>Alignment Window Menus</strong>
- </p>
- <ul>
- <li><strong>File</strong>
- <ul>
- <li><strong>Fetch Sequence</strong><br> <em>Shows a
- dialog window in which you can select known ids from Uniprot,
- EMBL, EMBLCDS or PDB database using Web Services provided by the
- European Bioinformatics Institute. See <a
- href="../features/seqfetch.html">Sequence Fetcher</a> </em>.</li>
- <li><strong>Add Sequences</strong><em><br> Add
- sequences to the visible alignment from file, URL, or cut &
- paste window </em>
- </li>
- <li><strong>Reload</strong><em><br> Reloads the
- alignment from the original file, if available.<br> <strong>Warning:
- This will delete any edits, analyses and colourings applied since
- the alignment was last saved, and cannot be undone.</strong> </em>
- </li>
- <li><strong>Save (Control S)</strong><em><br> Saves
- the alignment to the file it was loaded from (if available), in
- the same format, updating the original in place. </em>
- </li>
- <li><strong>Save As (Control Shift S)<br> </strong><em>Save
- the alignment to local file. A file selection window will open,
- use the "Files of type:" selection box to determine
- which <a href="../io/index.html">alignment format</a> to save as.</em>
- </li>
- <li><strong>Output to Textbox<br> </strong><em>The
- alignment will be displayed in plain text in a new window, which
- you can "Copy and Paste" using the pull down menu, or
- your standard operating system copy and paste keys. The output
- window also has a <strong>"New Window"</strong> button
- to import the (possibly edited) text as a new alignment.<br>
- Select the format of the text by selecting one of the following
- menu items.</em>
- <ul>
- <li><strong>FASTA</strong> <em></em>
- </li>
- <li><strong>MSF</strong>
- </li>
- <li><strong>CLUSTAL</strong>
- </li>
- <li><strong>BLC</strong>
- </li>
- <li><strong>PIR</strong>
- </li>
- <li><strong>PFAM</strong>
- </li>
- </ul></li>
- <li><strong>Print (Control P)<br> </strong><em>Jalview
- will print the alignment using the current fonts and colours of
- your alignment. If the alignment has annotations visible, these
- will be printed below the alignment. If the alignment is wrapped
- the number of residues per line of your alignment will depend on
- the paper width or your alignment window width, whichever is the
- smaller. </em>
- </li>
- <li><strong>Export Image</strong> <em><br> Creates an
- alignment graphic with the current view's annotation, alignment
- background colours and group colours. If the alignment is <a
- href="../features/wrap.html">wrapped</a>, the output will also be
- wrapped and will have the same visible residue width as the open
- alignment. </em>
- <ul>
- <li><strong>HTML<br> </strong><em>Create a <a
- href="../io/export.html">web page</a> from your alignment.</em>
- </li>
- <li><strong>EPS<br> </strong><em>Create an <a
- href="../io/export.html">Encapsulated Postscript</a> file from
- your alignment.</em>
- </li>
- <li><strong>PNG<br> </strong><em>Create a <a
- href="../io/export.html">Portable Network Graphics</a> file from
- your alignment.</em>
- </li>
- </ul></li>
- <li><strong>Export Features</strong><em><br> All
- features visible on the alignment can be saved to file or
- displayed in a textbox in either Jalview or GFF format</em>
- </li>
- <li><strong>Export Annotations</strong><em><br> All
- annotations visible on the alignment can be saved to file or
- displayed in a textbox in Jalview annotations format. </em>
- </li>
- <li><strong>Load Associated Tree<br> </strong><em>Jalview
- can <a href="../calculations/treeviewer.html">view trees</a>
- stored in the Newick file format, and associate them with the
- alignment. Note: the ids of the tree file and your alignment MUST
- be the same.</em></li>
- <li><strong>Load Features / Annotations<br> </strong><em>Load
- files describing precalculated <a
- href="../features/featuresFormat.html">sequence features</a> or <a
- href="../features/annotationsFormat.html">alignment
- annotations</a>.</em></li>
- <li><strong>Close (Control W)</strong><br> <em>Close
- the alignment window. Make sure you have saved your alignment
- before you close - either as a Jalview project or by using the <strong>Save
- As</strong> menu.</em>
- </li>
- </ul></li>
- <li><strong>Edit</strong>
- <ul>
- <li><strong>Undo (Control Z)</strong><em><br> This
- will undo any edits you make to the alignment. This applies to
- insertion or deletion of gaps, cutting residues or sequences from
- the alignment or pasting sequences to the current alignment or
- sorting the alignment. <strong>NOTE:</strong> It DOES NOT undo
- colour changes, adjustments to group sizes, or changes to the
- annotation panel. </em>
- </li>
- <li><strong>Redo (Control Y)<br> </strong><em>Any
- actions which you undo can be redone using redo. </em>
- </li>
- <li><strong>Cut (Control X)<br> </strong><em>This
- will make a copy of the currently selected residues before
- removing them from your alignment. Click on a sequence name if you
- wish to select a whole sequence. <br> Use <CTRL> and X
- (<APPLE> and X on MacOSX) to cut.</em>
- </li>
- <li><strong>Copy (Control C)</strong><br> <em>Copies
- the currently selected residues to the system clipboard - you can
- also do this by pressing <CTRL> and C (<APPLE> and C
- on MacOSX). <br> If you try to paste the clipboard contents
- to a text editor, you will see the format of the copied residues
- FASTA.</em></li>
- <li><strong>Paste </strong>
- <ul>
- <li><strong>To New Alignment (Control Shift V)<br>
- </strong><em>A new alignment window will be created from sequences
- previously copied or cut to the system clipboard. <br> Use
- <CTRL> and <SHIFT> and V(<APPLE> and
- <SHIFT;> and and V on MacOSX) to paste.</em>
- </li>
- <li><strong>Add To This Alignment (Control V)<br>
- </strong><em>Copied sequences from another alignment window can be
- added to the current Jalview alignment. </em>
- </li>
- </ul></li>
- <li><strong>Delete (Backspace)<br> </strong><em>This
- will delete the currently selected residues without copying them
- to the clipboard. Like the other edit operations, this can be
- undone with <strong>Undo</strong>.</em>
- </li>
- <li><strong>Remove Left (Control L)<br> </strong><em>If
- the alignment has marked columns, the alignment will be trimmed to
- the left of the leftmost marked column. To mark a column, mouse
- click the scale bar above the alignment. Click again to unmark a
- column, or select "Deselect All" to deselect all
- columns.</em></li>
- <li><strong>Remove Right (Control R)<br> </strong><em>If
- the alignment has marked columns, the alignment will be trimmed to
- the left of the leftmost marked column. To mark a column, mouse
- click the scale bar above the alignment. Click again to unmark a
- column, or select "Deselect All" to deselect all
- columns.</em></li>
- <li><strong>Remove Empty Columns (Control E)<br>
- </strong><em>All columns which only contain gap characters
- ("-", ".") will be deleted.<br> You may
- set the default gap character in <a
- href="../features/preferences.html">preferences</a>. </em>
- </li>
- <li><strong>Remove All Gaps (Control Shift E)</strong><br>
- <em>Gap characters ("-", ".") will be
- deleted from the selected area of the alignment. If no selection
- is made, ALL the gaps in the alignment will be removed.<br>
- You may set the default gap character in <a
- href="../features/preferences.html">preferences</a>. </em>
- </li>
- <li><strong>Remove Redundancy (Control D)<br> </strong><em>Selecting
- this option brings up a window asking you to select a threshold.
- If the percentage identity between any two sequences (under the
- current alignment) exceeds this value then one of the sequences
- (the shorter) is discarded. Press the "Apply" button to
- remove redundant sequences. The "Undo" button will undo
- the last redundancy deletion.</em>
- </li>
- <li><strong>Pad Gaps<br> </strong><em>When selected,
- the alignment will be kept at minimal width (so there no empty
- columns before or after the first or last aligned residue) and all
- sequences will be padded with gap characters to the before and
- after their terminating residues.<br> This switch is useful
- when making a tree using unaligned sequences and when working with
- alignment analysis programs which require 'properly aligned
- sequences' to be all the same length.<br> You may set the
- default for <strong>Pad Gaps</strong> in the <a
- href="../features/preferences.html">preferences</a>. </em>
- </li>
- </ul></li>
- <li><strong>Select</strong>
- <ul>
- <li><strong><a href="../features/search.html">Find...
- (Control F)</a> </strong><em><br> Opens the Find dialog box to
- search for residues, sequence name or residue position within the
- alignment and create new sequence features from the queries. </em>
- </li>
- <li><strong>Select All (Control A)<br> </strong><em>Selects
- all the sequences and residues in the alignment. <br> Use
- <CTRL> and A (<APPLE> and A on a MacOSX) to select
- all.</em></li>
- <li><strong>Deselect All (Escape)<br> </strong><em>Removes
- the current selection box (red dashed box) from the alignment
- window. All selected sequences, residues and marked columns will
- be deselected. </em><em> <br> Use <ESCAPE> to deselect
- all.</em></li>
- <li><strong>Invert Sequence Selection (Control I)<br>
- </strong><em>Any sequence ids currently not selected will replace the
- current selection. </em>
- </li>
- <li><strong>Invert Column Selection (Control Alt I)<br>
- </strong><em>Any columns currently not selected will replace the current
- column selection. </em>
- </li>
- <li><strong>Undefine Groups (Control U)<br> </strong><em>The
- alignment will be reset with no defined groups.<br> <strong>WARNING</strong>:
- This cannot be undone.</em>
- </li>
- <li><strong>Make Groups<br /> </strong> <em>The currently
- selected groups of the alignment will be subdivided according to
- the contents of the currently selected region. <br />Use this to
- subdivide an alignment based on the different combinations of
- residues observed at specific positions. (new in jalview 2.5)</em>
- </li>
- </ul></li>
- <li><strong>View</strong>
- <ul>
- <li><strong>New View (Control T)</strong><em><br>
- Creates a new view from the current alignment view. </em>
- </li>
- <li><strong>Expand Views (X)</strong><em><br> Display
- each view associated with the alignment in its own alignment
- window, allowing several views to be displayed simultaneously. </em>
- </li>
- <li><strong>Gather Views (G)</strong><em><br> Each
- view associated with the alignment will be displayed within its
- own tab on the current alignment window. </em>
- </li>
- <li><strong>Show→(all Columns / Sequences /
- Sequences and Columns)</strong><em><br> All hidden Columns /
- Sequences / Sequences and Columns will be revealed. </em>
- </li>
- <li><strong>Hide→(all Columns / Sequences /
- Selected Region / All but Selected Region )</strong><em><br>
- Hides the all the currently selected Columns / Sequences / Region
- or everything but the selected Region.</em>
- </li>
- <li><strong>Automatic Scrolling<br> </strong><em>When
- selected, the view will automatically scroll to display the
- highlighted sequence position corresponding to the position under
- the mouse pointer in a linked alignment or structure view.</em></li>
- <li><strong>Show Annotations<br> </strong><em>If this
- is selected the "Annotation Panel" will be displayed
- below the alignment. The default setting is to display the
- conservation calculation, quality calculation and consensus values
- as bar charts. </em>
- </li>
- <li><strong>Autocalculated Annotation<br> </strong><em>Settings
- for the display of autocalculated annotation.</em>
- <ul>
- <li><strong>Apply to all groups<br> </strong><em> When
- ticked, any modification to the current settings will be applied
- to all autocalculated annotation.</em></li>
- <li><strong>Show Consensus Histogram<br> </strong><em>
- Enable or disable the display of the histogram above the
- consensus sequence.</em></li>
- <li><strong>Show Consensus Profile<br> </strong><em> Enable
- or disable the display of the sequence logo above the consensus
- sequence.</em></li>
- <li><strong>Group Conservation<br> </strong><em> When
- ticked, display a conservation row for all groups (only available
- for protein alignments).</em></li>
- <li><strong>Apply to all groups<br> </strong><em> When
- ticked, display a consensus row for all groups.</em></li>
- </ul></li>
- <li><strong>Show Sequence Features</strong><br> <em>Show
- or hide sequence features on this alignment.</em>
- </li>
- <li><strong><a href="../features/featuresettings.html">Seqence
- Feature Settings...</a> </strong><em><br> <em>Opens the
- Sequence Feature Settings dialog box to control the colour and
- display of sequence features on the alignment, and configure and
- retrieve features from DAS annotation servers.</em>
- </li>
- <li><strong>Sequence ID Tooltip</strong><em> (application
- only) <br>This submenu's options allow the inclusion or
- exclusion of non-positional sequence features or database cross
- references from the tooltip shown when the mouse hovers over the
- sequence ID panel.</em>
- </li>
- <li><strong>Alignment Properties...<br /> </strong><em>Displays
- some simple statistics computed for the current alignment view and
- any named properties defined on the whole alignment.</em>
- </li>
- <li><strong><a href="../features/overview.html">Overview
- Window</a><br> </strong><em>A scaled version of the alignment will
- be displayed in a small window. A red box will indicate the
- currently visible area of the alignment. Move the visible region
- using the mouse. </em>
- </li>
- </ul></li>
- <li><strong>Alignment Window Format Menu</strong>
- <ul>
- <li><strong>Font...<br> </strong><em>Opens the
- "Choose Font" dialog box, in order to change the font of
- the display and enable or disable 'smooth fonts' (anti-aliasing)
- for faster alignment rendering. </em></li>
- <li><strong>Wrap<br> </strong><em>When ticked, the
- alignment display is "<a href="../features/wrap.html">wrapped</a>"
- to the width of the alignment window. This is useful if your
- alignment has only a few sequences to view its full width at once.</em><br>
- Additional options for display of sequence numbering and scales are
- also visible in wrapped layout mode:<br>
- <ul>
- <li><strong>Scale Above</strong><br><em> Show the alignment
- column position scale.</em></li>
- <li><strong>Scale Left</strong><br><em> Show the sequence
- position for the first aligned residue in each row in the left
- column of the alignment.</em></li>
- <li><strong>Scale Right</strong><br><em> Show the sequence
- position for the last aligned residue in each row in the
- right-most column of the alignment.</em></li>
- <li><strong>Show Sequence Limits<br> </strong><em>If
- this box is selected the sequence name will have the start and
- end position of the sequence appended to the name, in the format
- NAME/START-END</em>
- </li>
- <li><strong>Right Align Sequence ID<br> </strong><em>If
- this box is selected then the sequence names displayed in the
- sequence label area will be aligned against the left-hand edge
- of the alignment display, rather than the left-hand edge of the
- alignment window.
- </li>
- <li><strong>Show Hidden Markers<br> </strong><em>When
- this box is selected, positions in the alignment where rows and
- columns are hidden will be marked by blue arrows.
- </li>
- <li><strong>Boxes</strong><em><br> If this is
- selected the background of a residue will be coloured using the
- selected background colour. Useful if used in conjunction with
- "Colour Text." </em>
- </li>
- <li><strong>Text<br> </strong><em>If this is
- selected the residues will be displayed using the standard 1
- character amino acid alphabet.</em>
- </li>
- <li><strong>Colour Text<br> </strong><em>If this is
- selected the residues will be coloured according to the
- background colour associated with that residue. The colour is
- slightly darker than background so the amino acid symbol remains
- visible. </em>
- </li>
- <li><strong>Show Gaps<br> </strong><em>When this is
- selected, gap characters will be displayed as "." or
- "-". If unselected, then gap characters will appear as
- blank spaces. <br> You may set the default gap character in
- <a href="../features/preferences.html">preferences</a>.</em>
- </li>
- <li><strong>Centre Annotation Labels<br> </strong><em>Select
- this to center labels along an annotation row relative to their
- associated column (default is off, i.e. left-justified).</em>
- </li>
- <li><strong>Show Unconserved<br> </strong><em>When
- this is selected, all consensus sequence symbols will be
- rendered as a '.', highlighting mutations in highly conserved
- alignments. </em>
- </li>
+ <!-- NOTE: THIS PAGE COLLECTS TOGETHER THE INDIVIDUAL ALIGNMENT WINDOW MENU PAGES - DON"T EDIT INDIVIDUAL ENTRIES HERE! -->
+ <p>
+ <strong>Alignment Window Menus</strong>
+ </p>
+ <ul>
+ <li><strong>File</strong>
+ <ul>
+ <li><strong>Fetch Sequence</strong><br> <em>Shows
+ a dialog window in which you can retrieve known ids from
+ Uniprot, EMBL, EMBLCDS, PFAM, Rfam, or PDB database using
+ Web Services provided by the European Bioinformatics
+ Institute. See <a href="../features/seqfetch.html">Sequence
+ Fetcher</a>
+ </em>.</li>
+ <li><strong>Add Sequences</strong><em><br> Add
+ sequences to the visible alignment from file, URL, or cut
+ & paste window </em></li>
+ <li><strong>Reload</strong><em><br> Reloads the
+ alignment from the original file, if available.<br> <strong>Warning:
+ This will delete any edits, analyses and colourings
+ applied since the alignment was last saved, and cannot be
+ undone.</strong> </em></li>
+ <li><strong>Save (Control S)</strong><em><br>
+ Saves the alignment to the file it was loaded from (if
+ available), in the same format, updating the original in
+ place. </em></li>
+ <li><strong>Save As (Control Shift S)<br>
+ </strong><em>Save the alignment to local file. A file selection
+ window will open, use the "Files of type:"
+ selection box to determine which <a href="../io/index.html">alignment
+ format</a> to save as.
+ </em></li>
+ <li><strong>Output to Textbox<br>
+ </strong><em>The alignment will be displayed in plain text in a new
+ window, which you can "Copy and Paste" using the
+ pull down menu, or your standard operating system copy and
+ paste keys. The output window also has a <strong>"New
+ Window"</strong> button to import the (possibly edited) text
+ as a new alignment.<br> Select the format of the text
+ by selecting one of the following menu items.
+ </em>
+ <ul>
+ <li><strong>FASTA</strong></li>
+ <li><strong>MSF</strong></li>
+ <li><strong>CLUSTAL</strong></li>
+ <li><strong>BLC</strong></li>
+ <li><strong>PIR</strong></li>
+ <li><strong>PFAM</strong></li>
+ <li><strong>PileUp</strong></li>
+ <li><strong>AMSA</strong></li>
+ <li><strong>STH</strong></li>
+ <li><strong>Phylip</strong></li>
+ <li><strong>JSON</strong></li>
+ </ul></li>
+ <li><strong>Page Setup ...</strong><br> <em>Open
+ the printing system's Page Setup dialog box, to control page
+ size, layout and orientation.</em></li>
+ <li><strong>Print (Control P)<br>
+ </strong><em>Jalview will print the alignment using the current
+ fonts and colours of your alignment. If the alignment has
+ annotations visible, these will be printed below the
+ alignment. If the alignment is wrapped the number of
+ residues per line of your alignment will depend on the paper
+ width or your alignment window width, whichever is the
+ smaller. </em></li>
+ <li><strong>Export Image</strong> <em><br>
+ Creates an alignment graphic with the current view's
+ annotation, alignment background colours and group colours.
+ If the alignment is <a href="../features/wrap.html">wrapped</a>,
+ the output will also be wrapped and will have the same
+ visible residue width as the open alignment. </em>
+ <ul>
+ <li><strong>HTML<br>
+ </strong><em>Create a <a href="../io/export.html">web page</a>
+ from your alignment.
+ </em></li>
+ <li><strong>EPS<br>
+ </strong><em>Create an <a href="../io/export.html">Encapsulated
+ Postscript</a> file from your alignment.
+ </em></li>
+ <li><strong>PNG<br>
+ </strong><em>Create a <a href="../io/export.html">Portable
+ Network Graphics</a> file from your alignment.
+ </em></li>
+ <li><strong>SVG<br>
+ </strong><em>Create a <a href="../io/export.html">Scalable
+ Vector Graphics</a> file from your alignment for embedding
+ in web pages.
+ </em></li>
+ <li><strong>BioJS<br>
+ </strong><em>Create a <a href="../io/export.html">BioJS MSA
+ Viewer HTML </a> file from your alignment.
+ </em></li>
+ </ul></li>
+ <li><strong>Export Features</strong><em><br> All
+ features visible on the alignment can be saved to file or
+ displayed in a textbox in either Jalview or GFF format</em></li>
+ <li><strong>Export Annotations</strong><em><br>
+ All annotations visible on the alignment can be saved to
+ file or displayed in a textbox in Jalview annotations
+ format. </em></li>
+ <li><strong>Load Associated Tree<br>
+ </strong><em>Jalview can <a href="../calculations/treeviewer.html">view
+ trees</a> stored in the Newick file format, and associate them
+ with the alignment. Note: the ids of the tree file and your
+ alignment MUST be the same.
+ </em></li>
+ <li><strong>Load Features / Annotations<br>
+ </strong><em>Load files describing precalculated <a
+ href="../features/featuresFormat.html"
+ >sequence features</a> or <a
+ href="../features/annotationsFormat.html"
+ >alignment annotations</a>.
+ </em></li>
+ <li><strong>Close (Control W)</strong><br> <em>Close
+ the alignment window. Make sure you have saved your
+ alignment before you close - either from the Desktop's <strong>Save
+ Project</strong> File menu option, or by using the <strong>Save
+ As</strong> menu.
+ </em></li>
+ </ul></li>
+ <li><strong>Edit</strong>
+ <ul>
+ <li><strong>Undo (Control Z)</strong><em><br>
+ This will undo any edits you make to the alignment. This
+ applies to insertion or deletion of gaps, cutting residues
+ or sequences from the alignment or pasting sequences to the
+ current alignment or sorting the alignment. <strong>NOTE:</strong>
+ It DOES NOT undo colour changes, adjustments to group sizes,
+ or changes to the annotation panel. </em></li>
+ <li><strong>Redo (Control Y)<br>
+ </strong><em>Any actions which you undo can be redone using redo. </em></li>
+ <li><strong>Cut (Control X)<br>
+ </strong><em>This will make a copy of the currently selected
+ residues before removing them from your alignment. Click on
+ a sequence name if you wish to select a whole sequence. <br>
+ Use <CTRL> and X (<APPLE> and X on MacOSX) to
+ cut.
+ </em></li>
+ <li><strong>Copy (Control C)</strong><br> <em>Copies
+ the currently selected residues to the system clipboard -
+ you can also do this by pressing <CTRL> and C
+ (<APPLE> and C on MacOSX). <br> If you try to
+ paste the clipboard contents to a text editor, you will see
+ the format of the copied residues FASTA.
+ </em></li>
+ <li><strong>Paste </strong>
+ <ul>
+ <li><strong>To New Alignment (Control Shift V)<br>
+ </strong><em>A new alignment window will be created from
+ sequences previously copied or cut to the system
+ clipboard. <br> Use <CTRL> and <SHIFT>
+ and V(<APPLE> and <SHIFT;> and and V on
+ MacOSX) to paste.
+ </em></li>
+ <li><strong>Add To This Alignment (Control V)<br>
+ </strong><em>Copied sequences from another alignment window can
+ be added to the current Jalview alignment. </em></li>
+ </ul></li>
+ <li><strong>Delete (Backspace)<br>
+ </strong><em>This will delete the currently selected residues
+ without copying them to the clipboard. Like the other edit
+ operations, this can be undone with <strong>Undo</strong>.
+ </em></li>
+ <li><strong>Remove Left (Control L)<br>
+ </strong><em>If the alignment has marked columns, the alignment will
+ be trimmed to the left of the leftmost marked column. To
+ mark a column, mouse click the scale bar above the
+ alignment. Click again to unmark a column, or select
+ "Deselect All" to deselect all columns.</em></li>
+ <li><strong>Remove Right (Control R)<br>
+ </strong><em>If the alignment has marked columns, the alignment will
+ be trimmed to the left of the leftmost marked column. To
+ mark a column, mouse click the scale bar above the
+ alignment. Click again to unmark a column, or select
+ "Deselect All" to deselect all columns.</em></li>
+ <li><strong>Remove Empty Columns (Control E)<br>
+ </strong><em>All columns which only contain gap characters
+ ("-", ".") will be deleted.<br> You
+ may set the default gap character in <a
+ href="../features/preferences.html"
+ >preferences</a>.
+ </em></li>
+ <li><strong>Remove All Gaps (Control Shift E)</strong><br>
+ <em>Gap characters ("-", ".") will be
+ deleted from the selected area of the alignment. If no
+ selection is made, ALL the gaps in the alignment will be
+ removed.<br> You may set the default gap character in <a
+ href="../features/preferences.html"
+ >preferences</a>.
+ </em></li>
+ <li><strong>Remove Redundancy (Control D)<br>
+ </strong><em>Selecting this option brings up a window asking you to
+ select a threshold. If the percentage identity between any
+ two sequences (under the current alignment) exceeds this
+ value then one of the sequences (the shorter) is discarded.
+ Press the "Apply" button to remove redundant
+ sequences. The "Undo" button will undo the last
+ redundancy deletion.</em></li>
+ <li><strong>Pad Gaps<br>
+ </strong><em>When selected, the alignment will be kept at minimal
+ width (so there are no empty columns before or after the
+ first or last aligned residue) and all sequences will be
+ padded with gap characters before and after their
+ terminating residues.<br> This switch is useful when
+ making a tree using unaligned sequences and when working
+ with alignment analysis programs which require 'properly
+ aligned sequences' to be all the same length.<br> You
+ may set the default for <strong>Pad Gaps</strong> in the <a
+ href="../features/preferences.html"
+ >preferences</a>.
+ </em></li>
+ </ul></li>
+ <li><strong>Select</strong>
+ <ul>
+ <li><a href="../features/search.html"><strong>Find...
+ (Control F)</strong></a><br> <em>Opens the Find dialog box to
+ search for residues, sequence name or residue position
+ within the alignment and create new sequence features from
+ the queries. </em>
+ <li><strong>Select All (Control A)</strong><strong><br>
+ </strong><em>Selects all the sequences and residues in the
+ alignment. <br> Use <CTRL> and A (<APPLE>
+ and A on a MacOSX) to select all.
+ </em></em></li>
+ <li><strong>Deselect All (Escape)<br>
+ </strong><em>Removes the current selection box (red dashed box) from
+ the alignment window. All selected sequences, residues and
+ marked columns will be deselected. </em><em> <br> Use
+ <ESCAPE> to deselect all.
+ </em></li>
+ <li><strong>Invert Sequence Selection (Control I)<br>
+ </strong><em>Any sequence ids currently not selected will replace
+ the current selection. </em></li>
+ <li><strong>Invert Column Selection (Control Alt
+ I)<br>
+ </strong><em>Any columns currently not selected will replace the
+ current column selection. </em></li>
+ <li><strong>Create Group (Control G)<br></strong> <em>Create
+ a group containing the currently selected sequences.</em></li>
+ <li><strong>Remove Group (Shift Control G)<br></strong>
+ <em>Ungroup the currently selected sequence group.</em></li>
+ <li><strong>Make Groups for selection<br /></strong> <em>The
+ currently selected groups of the alignment will be
+ subdivided according to the contents of the currently
+ selected region. <br />Use this to subdivide an alignment
+ based on the different combinations of residues at marked
+ columns.
+ </em></li>
+ <li><strong>Undefine Groups (Control U)<br>
+ </strong><em>The alignment will be reset with no defined groups.<br>
+ <strong>WARNING</strong>: This cannot be undone.
+ </em></li>
+ <li><strong><a
+ href="../features/columnFilterByAnnotation.html"
+ >Select/Hide Columns by Annotation</a></strong> <br /> <em>Select
+ or Hide columns in the alignment according to secondary
+ structure, labels and values shown in alignment annotation
+ rows. </em></li>
+ </ul></li>
+ <li><strong>View</strong>
+ <ul>
+ <li><strong>New View (Control T)</strong><em><br>
+ Creates a new view from the current alignment view. </em></li>
+ <li><strong>Expand Views (X)</strong><em><br>
+ Display each view associated with the alignment in its own
+ alignment window, allowing several views to be displayed
+ simultaneously. </em></li>
+ <li><strong>Gather Views (G)</strong><em><br>
+ Each view associated with the alignment will be displayed
+ within its own tab on the current alignment window. </em></li>
+ <li><strong>Show→(all Columns / Sequences /
+ Sequences and Columns)</strong><em><br> All hidden Columns
+ / Sequences / Sequences and Columns will be revealed. </em></li>
+ <li><strong>Hide→(all Columns / Sequences /
+ Selected Region / All but Selected Region )</strong><em><br>
+ Hides the all the currently selected Columns / Sequences /
+ Region or everything but the selected Region.</em></li>
+ <li><strong>Automatic Scrolling<br>
+ </strong><em>When selected, the view will automatically scroll to
+ display the highlighted sequence position corresponding to
+ the position under the mouse pointer in a linked alignment
+ or structure view.</em></li>
+ <li><strong>Show Sequence Features</strong><br> <em>Show
+ or hide sequence features on this alignment.</em></li>
+ <li><strong><a
+ href="../features/featuresettings.html"
+ >Sequence Feature Settings...</a> </strong><em><br> <em>Opens
+ the Sequence Feature Settings dialog box to control the
+ colour and display of sequence features on the alignment,
+ and configure and retrieve features from DAS annotation
+ servers.</em></li>
+ <li><strong>Sequence ID Tooltip</strong><em>
+ (application only) <br>This submenu's options allow the
+ inclusion or exclusion of non-positional sequence features
+ or database cross references from the tooltip shown when the
+ mouse hovers over the sequence ID panel.
+ </em></li>
+ <li><strong>Alignment Properties...<br />
+ </strong><em>Displays some simple statistics computed for the
+ current alignment view and any named properties defined on
+ the whole alignment.</em></li>
+ <li><strong><a href="../features/overview.html">Overview
+ Window</a><br> </strong><em>A scaled version of the alignment
+ will be displayed in a small window. A red box will indicate
+ the currently visible area of the alignment. Move the
+ visible region using the mouse. </em></li>
+ </ul></li>
+ <li><strong>Annotations</strong><em> (Since Jalview 2.8.2)</em>
+ <ul>
+ <li><strong>Show Annotations<br>
+ </strong><em>If this is selected the "Annotation Panel"
+ will be displayed below the alignment. The default setting
+ is to display the conservation calculation, quality
+ calculation and consensus values as bar charts. </em></li>
+ <li><strong>Show Alignment Related</strong><em><br>
+ Show all annotations that are for the alignment as a whole
+ (for example, Consensus, or secondary structure prediction
+ from alignment).</em></li>
+ <li><strong>Hide Alignment Related</strong><em><br>
+ Hide all annotations that are for the alignment as a whole.</em></li>
+ <li><strong>Show Sequence Related</strong><em><br>
+ Show all annotations that are for individual sequences.</em></li>
+ <li><strong>Hide Sequence Related</strong><em><br>
+ Hide all annotations that are for individual sequences.</em></li>
+ <li><em>You can also selectively show or hide
+ annotations from the <a href="./popupMenu.html">Popup</a> or
+ <a href="../features/annotation.html">Annotation</a> menus.
+ </em></li>
+ <li><strong>Sort by Sequence</strong><em><br>Sort
+ sequence-specific annotations by sequence order in the
+ alignment (and within that, by label).</em></li>
+ <li><strong>Sort by Label</strong><em><br>Sort
+ sequence-specific annotations by label (and within that, by
+ sequence order). If neither sort order is selected, no
+ sorting is applied, allowing you to make a manual ordering
+ of the annotations.</em></li>
+ <li><strong>Autocalculated Annotation<br>
+ </strong><em>Settings for the display of autocalculated annotation.</em>
+ <ul>
+ <li><strong>Show first<br></strong><em> Show
+ autocalculated annotations above sequence-specific
+ annotations. Note this also applies to other annotations
+ for the alignment, for example secondary structure
+ prediction from alignment.</em></li>
+ <li><strong>Show last<br></strong><em> Show
+ autocalculated / alignment annotations below
+ sequence-specific annotations.</em></li>
+ <li><strong>Apply to all groups<br>
+ </strong><em> When ticked, any modification to the current
+ settings will be applied to all autocalculated
+ annotation.</em></li>
+ <li><strong>Show Consensus Histogram<br>
+ </strong><em> Enable or disable the display of the histogram
+ above the consensus sequence.</em></li>
+ <li><strong>Show Consensus Logo<br>
+ </strong><em> Enable or disable the display of the Consensus
+ Logo above the consensus sequence.</em></li>
+ <li><strong>Normalise Consensus Logo<br>
+ </strong><em>When enabled, scales all logo stacks to the same
+ height, making it easier to compare symbol diversity in
+ highly variable regions.</em></li>
+ <li><strong>Group Conservation<br>
+ </strong><em> When ticked, display a conservation row for all
+ groups (only available for protein alignments).</em></li>
+ <li><strong>Group Consensus<br>
+ </strong><em> When ticked, display a consensus row for all
+ groups.</em></li>
+ </ul></li>
+ </ul></li>
+ <li><strong>Alignment Window Format Menu</strong>
+ <ul>
+ <li><strong>Font...<br>
+ </strong><em>Opens the "Choose Font" dialog box, in order
+ to change the font of the display and enable or disable
+ 'smooth fonts' (anti-aliasing) for faster alignment
+ rendering. </em></li>
+ <li><strong>Wrap<br>
+ </strong><em>When ticked, the alignment display is "<a
+ href="../features/wrap.html"
+ >wrapped</a>" to the width of the alignment window. This is
+ useful if your alignment has only a few sequences to view
+ its full width at once.
+ </em><br> Additional options for display of sequence numbering
+ and scales are also visible in wrapped layout mode:<br>
+ <ul>
+ <li><strong>Scale Above</strong><br>
+ <em> Show the alignment column position scale.</em></li>
+ <li><strong>Scale Left</strong><br>
+ <em> Show the sequence position for the first aligned
+ residue in each row in the left column of the alignment.</em></li>
+ <li><strong>Scale Right</strong><br>
+ <em> Show the sequence position for the last aligned
+ residue in each row in the right-most column of the
+ alignment.</em></li>
+ <li><strong>Show Sequence Limits<br>
+ </strong><em>If this box is selected the sequence name will have
+ the start and end position of the sequence appended to
+ the name, in the format NAME/START-END</em></li>
+ <li><strong>Right Align Sequence ID<br>
+ </strong><em>If this box is selected then the sequence names
+ displayed in the sequence label area will be aligned
+ against the left-hand edge of the alignment display,
+ rather than the left-hand edge of the alignment window.
+ </li>
+ <li><strong>Show Hidden Markers<br>
+ </strong><em>When this box is selected, positions in the
+ alignment where rows and columns are hidden will be
+ marked by blue arrows. </li>
+ <li><strong>Boxes</strong><em><br> If this is
+ selected the background of a residue will be coloured
+ using the selected background colour. Useful if used in
+ conjunction with "Colour Text." </em></li>
+ <li><strong>Text<br>
+ </strong><em>If this is selected the residues will be displayed
+ using the standard 1 character amino acid alphabet.</em></li>
+ <li><strong>Colour Text<br>
+ </strong><em>If this is selected the residues will be coloured
+ according to the background colour associated with that
+ residue. The colour is slightly darker than background
+ so the amino acid symbol remains visible. </em></li>
+ <li><strong>Show Gaps<br>
+ </strong><em>When this is selected, gap characters will be
+ displayed as "." or "-". If
+ unselected, then gap characters will appear as blank
+ spaces. <br> You may set the default gap character
+ in <a href="../features/preferences.html">preferences</a>.
+ </em></li>
+ <li><strong>Centre Annotation Labels<br>
+ </strong><em>Select this to center labels along an annotation
+ row relative to their associated column (default is off,
+ i.e. left-justified).</em></li>
+ <li><strong>Show Unconserved<br>
+ </strong><em>When this is selected, all consensus sequence
+ symbols will be rendered as a '.', highlighting
+ mutations in highly conserved alignments. </em></li>
+
+ </ul></li>
+ </ul></li>
- </ul></li>
- </ul>
- </li>
+ </ul>
+ </li>
- <li><strong>Colour</strong>
- <ul>
- <li><strong>Apply Colour To All Groups<br> </strong><em>If
- this is selected, any changes made to the background colour will
- be applied to all currently defined groups.<br> </em>
- </li>
- <li><strong><a href="../colourSchemes/textcolour.html">Colour
- Text...</a> </strong><em><br> Opens the Colour Text dialog box to
- set a different text colour for light and dark background, and the
- intensity threshold for transition between them. </em>
- </li>
- <li>Colour Scheme options: <strong>None, ClustalX,
- Blosum62 Score, Percentage Identity, Zappo, Taylor,
- Hydrophobicity, Helix Propensity, Strand Propensity, Turn
- Propensity, Buried Index, Nucleotide, User Defined<br> </strong> <em>See
- <a href="../colourSchemes/index.html">colours</a> for a
- description of all colour schemes.</em><br></li>
- <li><strong>By Conservation<br> </strong><em>See <a
- href="../colourSchemes/conservation.html">Colouring by
- Conservation</a>.</em><br></li>
- <li><strong>Modify Conservation Threshold<br> </strong><em>Use
- this to display the conservation threshold slider window. Useful
- if the window has been closed, or if the 'by conservation' option
- appears to be doing nothing!</em><br></li>
- <li><strong>Above Identity Threshold<br> </strong><em>See
- <a href="../colourSchemes/abovePID.html">Above Percentage
- Identity</a> </em><strong>.<br> </strong>
- </li>
- <li><strong>Modify Identity Threshold<br> </strong><em>Use
- this to set the threshold value for colouring above Identity.
- Useful if the window has been closed.<br> </em>
- </li>
- <li><strong>By Annotation</strong><br> <em>Colours
- the alignment on a per-column value from a specified annotation.
- See <a href="../colourSchemes/annotationColouring.html">Annotation
- Colouring</a>.</em><br></li>
- </ul></li>
- <li><strong>Calculate</strong>
- <ul>
- <li><strong>Sort </strong>
- <ul>
- <li><strong>by ID</strong><em><br> This will sort
- the sequences according to sequence name. If the sort is
- repeated, the order of the sorted sequences will be inverted. </em>
- </li>
- <li><strong>by Length</strong><em><br> This will
- sort the sequences according to their length (excluding gap
- characters). If the sort is repeated, the order of the sorted
- sequences will be inverted. </em></li>
- <li><strong>by Group</strong><strong><br> </strong><em>This
- will sort the sequences according to sequence name. If the sort
- is repeated, the order of the sorted sequences will be inverted.
- </em><strong></strong></li>
- <li><strong>by Pairwise Identity<br> </strong><em>This
- will sort the selected sequences by their percentage identity to
- the consensus sequence. The most similar sequence is put at the
- top. </em></li>
- <li><em>The <a href="../calculations/sorting.html">Sort
- menu</a> will have some additional options if you have just done a
- multiple alignment calculation, or opened a tree viewer window.</em><br>
- </li>
- </ul>
- </li>
- <li><strong>Calculate Tree </strong> <br> <em>Functions
- for calculating trees on the alignment or the currently selected
- region. See <a href="../calculations/tree.html">calculating
- trees</a>.</em>
- <ul>
- <li><strong>Average Distance Using % Identity</strong></li>
- <li><strong>Neighbour Joining Using % Identity</strong></li>
- <li><strong>Average Distance Using Blosum62</strong></li>
- <li><strong>Neighbour Joining Using Blosum62<br>
- </strong></li>
- </ul>
- </li>
- <li><strong>Pairwise Alignments</strong><br> <em>Applies
- Smith and Waterman algorithm to selected sequences. See <a
- href="../calculations/pairwise.html">pairwise alignments</a>.</em><br>
- </li>
- <li><strong>Principal Component Analysis</strong><br> <em>Shows
- a spatial clustering of the sequences based on the BLOSUM62 scores
- in the alignment. See <a href="../calculations/pca.html">Principal
- Component Analysis</a>.</em> <br>
- </li>
- <li><strong>Extract Scores ... (optional)</strong><br> <em>This
- option is only visible if Jalview detects one or more white-space
- separated values in the description line of the alignment
- sequences.<br> When selected, these numbers are parsed into
- sequence associated annotation which can then be used to sort the
- alignment via the Sort by→Score menu.</em> <br>
- </li>
- <li><strong>Autocalculate Consensus</strong><br> <em>For
- large alignments it can be useful to deselect "Autocalculate
- Consensus" when editing. This prevents the sometimes lengthy
- calculations performed after each sequence edit.</em> <br>
- </li>
- <li><strong>Sort With New Tree</strong><br> <em>When
- enabled, Jalview will automatically sort the alignment when a new
- tree is calculated or loaded onto it.</em> <br></li>
- </ul></li>
+ <li><strong>Colour</strong>
+ <ul>
+ <li><strong>Apply Colour To All Groups<br>
+ </strong><em>If this is selected, any changes made to the background
+ colour will be applied to all currently defined groups.<br>
+ </em></li>
+ <li><strong><a
+ href="../colourSchemes/textcolour.html"
+ >Colour Text...</a> </strong><em><br> Opens the Colour Text
+ dialog box to set a different text colour for light and dark
+ background, and the intensity threshold for transition between
+ them. </em></li>
+ <li>Colour Scheme options: <strong>None, ClustalX,
+ Blosum62 Score, Percentage Identity, Zappo, Taylor,
+ Hydrophobicity, Helix Propensity, Strand Propensity, Turn
+ Propensity, Buried Index, Nucleotide, Purine/Pyrimidine, User
+ Defined<br>
+ </strong> <em>See <a href="../colourSchemes/index.html">colours</a>
+ for a description of all colour schemes.
+ </em><br></li>
+ <li><strong>By Conservation<br>
+ </strong><em>See <a href="../colourSchemes/conservation.html">Colouring
+ by Conservation</a>.
+ </em><br></li>
+ <li><strong>Modify Conservation Threshold<br>
+ </strong><em>Use this to display the conservation threshold slider
+ window. Useful if the window has been closed, or if the 'by
+ conservation' option appears to be doing nothing!</em><br></li>
+ <li><strong>Above Identity Threshold<br>
+ </strong><em>See <a href="../colourSchemes/abovePID.html">Above
+ Percentage Identity</a>
+ </em><strong>.<br>
+ </strong></li>
+ <li><strong>Modify Identity Threshold<br>
+ </strong><em>Use this to set the threshold value for colouring above
+ Identity. Useful if the window has been closed.<br>
+ </em></li>
+ <li><strong>By Annotation</strong><br> <em>Colours
+ the alignment on a per-column value from a specified
+ annotation. See <a
+ href="../colourSchemes/annotationColouring.html"
+ >Annotation Colouring</a>.
+ </em><br></li>
+ <li><strong>By RNA Helices</strong><br> <em>Colours
+ the helices of an RNA alignment loaded from a Stockholm file.
+ See <a href="../colourSchemes/rnahelicesColouring.html">RNA
+ Helices Colouring</a>.
+ </em><br></li>
+ </ul></li>
+ <li><strong>Calculate</strong>
+ <ul>
+ <li><strong>Sort </strong>
+ <ul>
+ <li><strong>by ID</strong><em><br> This will
+ sort the sequences according to sequence name. If the sort
+ is repeated, the order of the sorted sequences will be
+ inverted. </em></li>
+ <li><strong>by Length</strong><em><br> This
+ will sort the sequences according to their length
+ (excluding gap characters). If the sort is repeated, the
+ order of the sorted sequences will be inverted. </em></li>
+ <li><strong>by Group</strong><strong><br> </strong><em>This
+ will sort the sequences according to sequence name. If the
+ sort is repeated, the order of the sorted sequences will
+ be inverted. </em><strong></strong></li>
+ <li><strong>by Pairwise Identity<br>
+ </strong><em>This will sort the selected sequences by their
+ percentage identity to the consensus sequence. The most
+ similar sequence is put at the top. </em></li>
+ <li><em>The <a href="../calculations/sorting.html">Sort
+ menu</a> will have some additional options if you have just
+ done a multiple alignment calculation, or opened a tree
+ viewer window.
+ </em><br></li>
+ </ul></li>
+ <li><strong>Calculate Tree </strong> <br> <em>Functions
+ for calculating trees on the alignment or the currently
+ selected region. See <a href="../calculations/tree.html">calculating
+ trees</a>.
+ </em>
+ <ul>
+ <li><strong>Neighbour Joining Using PAM250 </strong></li>
+ <li><strong>Neighbour Joining Using Sequence
+ Feature Similarity</strong></li>
+ <li><strong>Neighbour Joining Using Blosum62 </strong></li>
+ <li><strong>Neighbour Joining Using % Identity</strong></li>
+ <li><strong>Average Distance Using PAM250 </strong></li>
+ <li><strong>Average Distance Using Sequence
+ Feature Similarity</strong></li>
+ <li><strong>Average Distance Using Blosum62</strong></li>
+ <li><strong>Average Distance Using % Identity</strong></li>
+ </ul> <strong>Note: Since Version 2.8.1, a number of
+ additional similarity measures for tree calculation are
+ provided in this menu.</strong></li>
+ <li><strong>Pairwise Alignments</strong><br> <em>Applies
+ Smith and Waterman algorithm to selected sequences. See <a
+ href="../calculations/pairwise.html"
+ >pairwise alignments</a>.
+ </em><br></li>
+ <li><strong>Principal Component Analysis</strong><br> <em>Shows
+ a spatial clustering of the sequences based on similarity
+ scores calculated with the alignment. See <a
+ href="../calculations/pca.html"
+ >Principal Component Analysis</a>.
+ </em> <br></li>
+ <li><strong>Extract Scores ... (optional)</strong><br> <em>This
+ option is only visible if Jalview detects one or more
+ white-space separated values in the description line of the
+ alignment sequences.<br> When selected, these numbers are
+ parsed into sequence associated annotation which can then be
+ used to sort the alignment via the Sort by→Score menu.
+ </em> <br></li>
+ <li><strong>Autocalculate Consensus</strong><br> <em>For
+ large alignments it can be useful to deselect
+ "Autocalculate Consensus" when editing. This
+ prevents the sometimes lengthy calculations performed after
+ each sequence edit.</em> <br></li>
+ <li><strong>Sort With New Tree</strong><br> <em>When
+ enabled, Jalview will automatically sort the alignment when a
+ new tree is calculated or loaded onto it.</em> <br></li>
+ <li><strong>Show Flanking Regions</strong><br> <em>Opens
+ a new alignment window showing any additional sequence data
+ either side of the current alignment. Useful in conjunction
+ with 'Fetch Database References' when the 'Trim Retrieved
+ Sequences' option is disabled to retrieve full length
+ sequences for a set of aligned peptides. </em></li>
+ </ul></li>
- <li><strong>Web Service Menu</strong><br /> <em>This menu
- is dynamic, and may contain user-defined web service entries in
- addition to any of the following ones:</em>
- <ul>
- <li><strong>Fetch DB References</strong><br> <em>This
- will use any of the database services that Jalview is aware of
- (e.g. DAS sequence servers and the WSDBFetch service provided by
- the EBI) to verify the sequence and retrieve all database cross
- references and PDB ids associated with all or just the selected
- sequences in the alignment. <br />'Standard Databases' will check
- sequences against the EBI databases plus any active DAS sequence
- sources, or you can verify against a specific source from one of
- the sub-menus.</em><br></li>
- <li><strong>Envision2 Services</strong><br /><em> Submits one or
- more sequences, sequence IDs or database references to analysis
- workflows provided by the <a
- href="http://www.ebi.ac.uk/enfin-srv/envision2">EnVision2 web
- application</a>. This allows Jalview users to easily access the EnCore
- network of databases and analysis services developed by members of
- <a href="http://www.enfin.org">ENFIN</a></em>.</li>
- </ul>
- <p>Selecting items from the following submenus will start a
- remote service on compute facilities at the University of Dundee, or
- elsewhere. You need a continuous network connection in order to use
- these services through Jalview.
- </p>
- <ul>
- <li><strong>Alignment</strong><br /><em> Align the currently
- selected sequences or all sequences in the alignment, or re-align
- unaligned sequences to the aligned sequences. Entries in this menu
- provide access to the various alignment programs supported by <a
- href="../webServices/JABAWS.html">JABAWS</a>. See the <a
- href="../webServices/msaclient.html">Multiple Sequence
- Alignment webservice client</a> entry for more information.</em></li>
- <li><strong>Secondary Structure Prediction</strong>
- <ul>
- <li><strong>JPred Secondary Structure Prediction</strong><br>
- <em>Secondary structure prediction by network consensus. See
- the <a href="../webServices/jnet.html">Jpred3</a> client entry for
- more information. The behaviour of this calculation depends on
- the current selection:
- <ul>
- <li>If nothing is selected, and the displayed sequences
- appear to be aligned, then a JNet prediction will be run for
- the first sequence in the alignment, using the current
- alignment. Otherwise the first sequence will be submitted for
- prediction.</li>
- <li>If just one sequence (or a region on one sequence) has
- been selected, it will be submitted to the automatic JNet
- prediction server for homolog detection and prediction.</li>
- <li>If a set of sequences are selected, and they appear to
- be aligned, then the alignment will be used for a Jnet
- prediction on the <strong>first</strong> sequence in the set
- (that is, the one that appears first in the alignment window).
- </li>
- </ul> </em>
- </ul></li>
- <li><strong>Analysis</strong><br />
- <ul>
- <li><strong>Multi-Harmony</strong><br> <em>Performs
- functional residue analysis on a protein family alignment with
- sub-families defined on it. See the <a
- href="../webServices/shmr.html">Multi-Harmony service</a> entry for more
- information.</em>
- </li>
- </ul></li>
- </ul></li>
- </ul>
+ <li><strong>Web Service Menu</strong><br /> <em>This menu
+ is dynamic, and may contain user-defined web service entries in
+ addition to any of the following ones:</em>
+ <ul>
+ <li><strong>Fetch DB References</strong><br> <em>This
+ submenu contains options for accessing any of the database
+ services that Jalview is aware of (e.g. DAS sequence servers
+ and the WSDBFetch service provided by the EBI) to verify
+ sequence start/end positions and retrieve all database cross
+ references and PDB ids associated with all or just the
+ selected sequences in the alignment.
+ <ul>
+ <li>'Trim Retrieved Sequences' - when checked, Jalview
+ will discard any additional sequence data for accessions
+ associated with sequences in the alignment. <br> <strong>Note:
+ Disabling this could cause out of memory errors when
+ working with genomic sequence records !</strong><br> <strong>Added
+ in Jalview 2.8.1</strong>
+ </li>
+ <li>'Standard Databases' will check sequences against
+ the EBI databases plus any active DAS sequence sources<</li>
+ </ul> Other sub-menus allow you to pick a specific source to query
+ - sources are listed alphabetically according to their
+ nickname.
+ </em><br></li>
+ </ul>
+ <p>Selecting items from the following submenus will start a
+ remote service on compute facilities at the University of Dundee,
+ or elsewhere. You need a continuous network connection in order to
+ use these services through Jalview.</p>
+ <ul>
+ <li><strong>Alignment</strong><br />
+ <em> Align the currently selected sequences or all sequences
+ in the alignment, or re-align unaligned sequences to the
+ aligned sequences. Entries in this menu provide access to the
+ various alignment programs supported by <a
+ href="../webServices/JABAWS.html"
+ >JABAWS</a>. See the <a href="../webServices/msaclient.html">Multiple
+ Sequence Alignment webservice client</a> entry for more
+ information.
+ </em></li>
+ <li><strong>Secondary Structure Prediction</strong>
+ <ul>
+ <li><strong>JPred Secondary Structure Prediction</strong><br>
+ <em>Secondary structure prediction by network
+ consensus. See the <a href="../webServices/jnet.html">Jpred3</a>
+ client entry for more information. The behaviour of this
+ calculation depends on the current selection:
+ <ul>
+ <li>If nothing is selected, and the displayed
+ sequences appear to be aligned, then a JNet prediction
+ will be run for the first sequence in the alignment,
+ using the current alignment. Otherwise the first
+ sequence will be submitted for prediction.</li>
+ <li>If just one sequence (or a region on one
+ sequence) has been selected, it will be submitted to
+ the automatic JNet prediction server for homolog
+ detection and prediction.</li>
+ <li>If a set of sequences are selected, and they
+ appear to be aligned, then the alignment will be used
+ for a Jnet prediction on the <strong>first</strong>
+ sequence in the set (that is, the one that appears
+ first in the alignment window).
+ </li>
+ </ul>
+ </em>
+ </ul></li>
+ <li><strong>Analysis</strong><br />
+ <ul>
+ <li><strong>Multi-Harmony</strong><br> <em>Performs
+ functional residue analysis on a protein family alignment
+ with sub-families defined on it. See the <a
+ href="../webServices/shmr.html"
+ >Multi-Harmony service</a> entry for more information.
+ </em></li>
+ </ul></li>
+ </ul></li>
+ </ul>
</body>
</html>
diff --git a/help/html/menus/alwannotation.html b/help/html/menus/alwannotation.html
new file mode 100644
index 0000000..843486d
--- /dev/null
+++ b/help/html/menus/alwannotation.html
@@ -0,0 +1,91 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Alignment Window Menus</title>
+</head>
+
+<body>
+ <p>
+ <strong>Alignment Window Annotations Menu</strong> (Since Jalview
+ 2.8.2)
+ </p>
+ <ul>
+ <li><strong>Show Alignment Related</strong><em><br>
+ Show all annotations that are for the alignment as a whole (for
+ example, Consensus, or secondary structure prediction from
+ alignment)).</em></li>
+ <li><strong>Hide Alignment Related</strong><em><br>
+ Hide all annotations that are for the alignment as a whole.</em></li>
+ <li><strong>Show Sequence Related</strong><em><br>
+ Show all annotations that are for individual sequences.</em></li>
+ <li><strong>Hide Sequence Related</strong><em><br>
+ Hide all annotations that are for individual sequences.</em></li>
+ <li><strong>Show Alignment Related</strong><em><br>
+ Show all annotations that are for the alignment as a whole (for
+ example, Consensus).</em></li>
+ <li><em>You can also selectively show or hide annotations
+ from the <a href="./popupMenu.html">Popup</a> or <a
+ href="../features/annotation.html"
+ >Annotation</a> menus.
+ </em></li>
+ <li><strong>Sort by Sequence</strong><em><br>Sort
+ sequence-specific annotations by sequence order in the alignment
+ (and within that, by label).</em></li>
+ <li><strong>Sort by Label</strong><em><br>Sort
+ sequence-specific annotations by label (and within that, by
+ sequence order). If neither sort order is selected, no sorting
+ is applied, allowing you to make a manual ordering of the
+ annotations.</em></li>
+ <li><strong>Autocalculated Annotation<br>
+ </strong><em>Settings for the display of autocalculated annotation.</em>
+ <ul>
+ <li><strong>Show first<br></strong><em> Show
+ autocalculated annotations above sequence-specific
+ annotations. Note this also applies to other annotations for
+ the alignment, for example secondary structure prediction
+ from alignment.</em></li>
+ <li><strong>Show last<br></strong><em> Show
+ autocalculated / alignment annotations below
+ sequence-specific annotations.</em></li>
+ <li><strong>Apply to all groups<br>
+ </strong><em> When ticked, any modification to the current settings
+ will be applied to all autocalculated annotation.</em></li>
+ <li><strong>Show Consensus Histogram<br>
+ </strong><em> Enable or disable the display of the histogram above
+ the consensus sequence.</em></li>
+ <li><strong>Show Consensus Logo<br>
+ </strong><em> Enable or disable the display of the Consensus Logo
+ above the consensus sequence.</em></li>
+ <li><strong>Normalise Consensus Logo<br>
+ </strong><em>When enabled, scales all logo stacks to the same
+ height, making it easier to compare symbol diversity in
+ highly variable regions.</em></li>
+ <li><strong>Group Conservation<br>
+ </strong><em> When ticked, display a conservation row for all groups
+ (only available for protein alignments).</em></li>
+ <li><strong>Group Consensus<br>
+ </strong><em> When ticked, display a consensus row for all groups.</em></li>
+ </ul></li>
+ </ul>
+ <p> </p>
+</body>
+</html>
diff --git a/help/html/menus/alwannotationpanel.html b/help/html/menus/alwannotationpanel.html
new file mode 100644
index 0000000..8d49744
--- /dev/null
+++ b/help/html/menus/alwannotationpanel.html
@@ -0,0 +1,117 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Annotation Panel Menus</title>
+</head>
+<body>
+ <p>
+ <strong>Annotation Panel Menus</strong>
+ </p>
+ <ul>
+ <li><strong>Annotation Label Popup Menu</strong><br> <em>This
+ menu is opened by clicking anywhere on the annotation row labels
+ area (below the sequence ID area).</em>
+ <ul>
+ <li><strong>Add New Row</strong><br> <em>Adds a
+ new, named annotation row (a dialog box will pop up for you
+ to enter the label for the new row). </em></li>
+ <li><strong>Edit Label/Description</strong><br> <em>This
+ opens a dialog where you can change the name (displayed
+ label), or the description (as shown on the label tooltip)
+ of the clicked annotation. </em></li>
+ <li><strong>Hide This Row</strong><br> <em>Hides
+ the annotation row whose label was clicked in order to bring
+ up the menu.</em></li>
+ <li><strong>Hide All <em><label></em></strong><br>
+ <em>Hides all annotation rows whose label matches the one
+ clicked. (This option is only shown for annotations that
+ relate to individual sequences, not for whole alignment
+ annotations. Since Jalview 2.8.2.)</em></li>
+ <li><strong>Delete Row</strong><br> <em>Deletes
+ the annotation row whose label was clicked in order to bring
+ up the menu.</em></li>
+ <li><strong>Show All Hidden Rows</strong><br> <em>Shows
+ all hidden annotation rows.</em></li>
+ <li><strong>Export Annotation</strong> <em>(Application
+ only)</em><br> <em>Annotations can be saved to file or
+ output to a text window in either the Jalview annotations
+ format or as a spreadsheet style set of comma separated
+ values (CSV). </em></li>
+ <li><strong>Show Values in Text Box</strong> <em>(applet
+ only)</em><br> <em>Opens a text box with a list of
+ comma-separated values corresponding to the annotation
+ (numerical or otherwise) at each position in the row. This
+ is useful to export alignment quality measurements for
+ further analysis.</em></li>
+ </ul> <em>The following additional entries are available when the
+ popup menu is opened on a consensus sequence annotation row:</em>
+ <ul>
+
+ <li><strong>Ignore Gaps in Consensus</strong><br> If
+ this checkbox is selected, all consensus calculations
+ performed in the current Alignment window will be done without
+ counting gaps as a consensus character.</li>
+ <li><strong>Show Consensus Histogram<br></strong>
+ Enable or disable the display of the histogram above the
+ consensus sequence.</li>
+ <li><strong>Show Consensus Logo<br></strong> Enable or
+ disable the display of the sequence logo above the consensus
+ sequence.</li>
+ <li><strong>Normalise Consensus Logo<br>
+ </strong><em>When enabled, scales all logo stacks to the same
+ height, making it easier to compare symbol diversity in
+ highly variable regions.</em></li>
+
+ <li>
+ <li><strong>Copy Consensus Sequence</strong><br>
+ Copies the consensus sequence to the clipboard in Fasta
+ format, to allow the consensus sequence to be added to an
+ alignment. Note the copied sequence is not accessible to other
+ programs if Jalview is running as an applet in a web page.</li>
+ </ul></li>
+ <li><strong>Annotation Popup Menu<br>
+ </strong><em>This menu is opened when right-clicking on the selected
+ positions of an annotation.</em>
+ <ul>
+ <li><strong>Helix</strong><br> <em>Mark selected
+ positions with a helix glyph (a red oval), and optional text
+ label (see below). Consecutive ovals will be rendered as an
+ unbroken red line.</em></li>
+ <li><strong>Sheet</strong><br> <em>Mark selected
+ positions with a sheet glyph (a green arrow oriented from
+ left to right), and optional text label (see below).
+ Consecutive arrows will be joined together to form a single
+ green arrow.</em></li>
+ <li><strong>Label</strong><br> <em>Sets the text
+ label at the selected positions. If more that one
+ consecutive position is marked with the same label, only the
+ first position's label will be rendered.</em></li>
+ <li><strong>Colour</strong><br> <em>Changes the
+ colour of the annotation text label.</em></li>
+ <li><strong>Remove Annotation</strong><br> <em>Blanks
+ any annotation at the selected positions on the row. Note: <strong>This
+ cannot be undone</strong>
+ </em></li>
+ </ul></li>
+ </ul>
+</body>
+</html>
diff --git a/help/html/menus/alwannotations.html b/help/html/menus/alwannotations.html
deleted file mode 100644
index bd1eda6..0000000
--- a/help/html/menus/alwannotations.html
+++ /dev/null
@@ -1,87 +0,0 @@
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head>
-<title>Annotation Panel Menus</title>
-</head>
-<body>
-<p><strong>Annotation Panel Menus</strong></p>
-<ul>
- <li> <strong>Annotation Label Popup Menu</strong><br>
- <em>This menu is opened by clicking anywhere on the annotation row labels
- area (below the sequence ID area).</em>
- <ul>
- <li><strong> Add New Row</strong><br>
- <em>Adds a new, named annotation row (a dialog box will pop up for you
- to enter the label for the new row). </em> </li>
- <li><strong>Hide Row</strong><br>
- <em>Hides the annotation row whose label was clicked in order to bring
- up the menu.</em> </li>
- <li><strong>Delete Row</strong><br>
- <em>Deletes the annotation row whose label was clicked in order to bring
- up the menu.</em> </li>
- <li><strong>Show All Hidden Rows</strong><br>
- <em>Shows all hidden annotation rows.</em> </li>
- <li><strong>Export Annotation</strong> <em>(Application only)</em><br>
- <em>Annotations can be saved to file or output to a text window in either the
- Jalview annotations format or as a spreadsheet style set of comma separated values (CSV). </em> </li>
- <li><strong>Show Values in Text Box</strong> <em>(applet only)</em><br>
- <em>Opens a text box with a list of comma-separated values corresponding
- to the annotation (numerical or otherwise) at each position in the row.
- This is useful to export alignment quality measurements for further analysis.</em>
- </li>
- </ul>
- <em>The following additional entries are avalable when the popup menu is opened on a consensus sequence annotation row:</em>
- <ul>
- <li><strong>Ignore Gaps in Consensus</strong><br>
- If this checkbox is selected, all consensus calculations performed in
- the current Alignment window will be done without counting gaps as a consensus
- character.</li>
- <li><strong>Copy Consensus Sequence</strong><br>
- Copies the consensus sequence to the clipboard in Fasta format, to allow
- the consensus sequence to be added to an alignment. Note the copied sequence
- is not accessible to other programs if Jalview is running as an applet
- in a web page.</li>
- </ul>
- </li>
- <li><strong>Annotation Popup Menu<br>
- </strong><em>This menu is opened when right-clicking on the selected positions
- of an annotation.</em>
- <ul>
- <li><strong>Helix</strong><br>
- <em>Mark selected positions with a helix glyph (a red oval), and optional
- text label (see below). Consecutive ovals will be rendered as an unbroken
- red line.</em> </li>
- <li><strong>Sheet</strong><br>
- <em>Mark selected positions with a sheet glyph (a green arrow oriented
- from left to right), and optional text label (see below). Consecutive
- arrows will be joined together to form a single green arrow.</em> </li>
- <li><strong>Label</strong><br>
- <em>Sets the text label at the selected positions. If more that one consecutive
- position is marked with the same label, only the first position's label
- will be rendered.</em> </li>
- <li><strong>Colour</strong><br>
- <em>Changes the colour of the annotation text label.</em> </li>
- <li><strong>Remove Annotation</strong><br>
- <em>Blanks any annotation at the selected positions on the row. Note:
- <strong>This cannot be undone</strong></em> </li>
- </ul>
- </li>
-</ul>
-</body>
-</html>
diff --git a/help/html/menus/alwcalculate.html b/help/html/menus/alwcalculate.html
index 444dfe3..d39afa0 100644
--- a/help/html/menus/alwcalculate.html
+++ b/help/html/menus/alwcalculate.html
@@ -1,93 +1,129 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Alignment Window Menus</title>
</head>
<body>
- <p>
- <strong>Alignment Window Calculate Menu</strong>
- </p>
- <ul>
- <li><strong>Sort </strong>
- <ul>
- <li><strong>by ID</strong><em><br> This will sort the
- sequences according to sequence name. If the sort is repeated, the
- order of the sorted sequences will be inverted. </em>
- </li>
- <li><strong>by Length</strong><em><br> This will sort
- the sequences according to their length (excluding gap
- characters). If the sort is repeated, the order of the sorted
- sequences will be inverted. </em>
- </li>
- <li><strong>by Group</strong><strong><br> </strong><em>This
- will sort the sequences according to sequence name. If the sort is
- repeated, the order of the sorted sequences will be inverted. </em><strong></strong>
- </li>
- <li><strong>by Pairwise Identity<br> </strong><em>This
- will sort the selected sequences by their percentage identity to
- the consensus sequence. The most similar sequence is put at the
- top. </em>
- </li>
- <li><em>The <a href="../calculations/sorting.html">Sort
- menu</a> will have some additional options if the alignment has any
- associated score annotation, or you have just done a multiple
- alignment calculation or opened a tree viewer window.</em><br></li>
- </ul></li>
- <li><strong>Calculate Tree </strong> <br> <em>Functions
- for calculating trees on the alignment or the currently selected
- region. See <a href="../calculations/tree.html">calculating
- trees</a>.</em>
- <ul>
- <li><strong>Average Distance Using % Identity</strong>
- </li>
- <li><strong>Neighbour Joining Using % Identity</strong>
- </li>
- <li><strong>Average Distance Using Blosum62</strong>
- </li>
- <li><strong>Neighbour Joining Using Blosum62<br>
- </strong>
- </li>
- </ul></li>
- <li><strong>Pairwise Alignments</strong><br> <em>Applies
- Smith and Waterman algorithm to selected sequences. See <a
- href="../calculations/pairwise.html">pairwise alignments</a>.</em><br>
- </li>
- <li><strong>Principal Component Analysis</strong><br> <em>Shows
- a spatial clustering of the sequences based on the BLOSUM62 scores
- in the alignment. See <a href="../calculations/pca.html">Principal
- Component Analysis</a>.</em> <br></li>
- <li><strong>Extract Scores ... (optional)</strong><br> <em>This
- option is only visible if Jalview detects one or more white-space
- separated values in the description line of the alignment sequences.<br>
- When selected, these numbers are parsed into sequence associated
- annotation which can then be used to sort the alignment via the Sort
- by→Score menu.</em> <br></li>
-
- <li><strong>Autocalculate Consensus</strong><br> <em>For
- large alignments it can be useful to deselect "Autocalculate
- Consensus" when editing. This prevents the sometimes lengthy
- calculations performed after each sequence edit.</em> <br></li>
- <li><strong>Sort Alignment With New Tree</strong><br> <em>If
- this option is selected, the alignment will be automatically sorted
- whenever a new tree is calculated or loaded.</em> <br>
- </li>
- </ul>
+ <p>
+ <strong>Alignment Window Calculate Menu</strong>
+ </p>
+ <ul>
+ <li><strong>Sort </strong>
+ <ul>
+ <li><strong>By ID</strong><em><br> This will sort
+ the sequences according to sequence name. If the sort is
+ repeated, the order of the sorted sequences will be
+ inverted. </em></li>
+ <li><strong>By Length</strong><em><br> This will
+ sort the sequences according to their length (excluding gap
+ characters). If the sort is repeated, the order of the
+ sorted sequences will be inverted. </em></li>
+ <li><strong>By Group</strong><strong><br> </strong><em>This
+ will sort the sequences according to sequence name. If the
+ sort is repeated, the order of the sorted sequences will be
+ inverted. </em><strong></strong></li>
+ <li><strong>By Pairwise Identity<br>
+ </strong><em>This will sort the selected sequences by their
+ percentage identity to the consensus sequence. The most
+ similar sequence is put at the top. </em></li>
+ <li><em>The <a href="../calculations/sorting.html">Sort
+ menu</a> will have some additional options if the alignment
+ has any associated score annotation, or you have just done a
+ multiple alignment calculation or opened a tree viewer
+ window.
+ </em><br></li>
+ </ul></li>
+ <li><strong>Calculate Tree </strong> <br> <em>Functions
+ for calculating trees on the alignment or the currently selected
+ region. See <a href="../calculations/tree.html">calculating
+ trees</a>.
+ </em>
+ <ul>
+ <li><strong>Neighbour Joining Using PAM250<br>
+ </strong></li>
+ <li><strong>Neighbour Joining Using Sequence
+ Feature Similarity</strong></li>
+ <li><strong>Neighbour Joining Using Blosum62<br>
+ </strong></li>
+ <li><strong>Neighbour Joining Using % Identity</strong></li>
+ <li><strong>Average Distance Using PAM250<br>
+ </strong></li>
+ <li><strong>Average Distance Using Sequence
+ Feature Similarity</strong></li>
+ <li><strong>Average Distance Using Blosum62</strong></li>
+ <li><strong>Average Distance Using % Identity</strong></li>
+ </ul></li>
+ <li><strong>Pairwise Alignments</strong><br> <em>Applies
+ Smith and Waterman algorithm to selected sequences. See <a
+ href="../calculations/pairwise.html"
+ >pairwise alignments</a>.
+ </em><br></li>
+ <li><strong>Principal Component Analysis</strong><br> <em>Shows
+ a spatial clustering of the sequences based on similarity scores
+ calculated over the alignment.. See <a
+ href="../calculations/pca.html"
+ >Principal Component Analysis</a>.
+ </em> <br></li>
+ <li><strong>Extract Scores ... (optional)</strong><br> <em>This
+ option is only visible if Jalview detects one or more
+ white-space separated values in the description line of the
+ alignment sequences.<br> When selected, these numbers are
+ parsed into sequence associated annotation which can then be
+ used to sort the alignment via the Sort by→Score menu.
+ </em> <br></li>
+ <li><strong>Translate as cDNA</strong> (not applet)<br>
+ <em>This option is visible for nucleotide alignments. Selecting
+ this option shows the DNA's calculated protein product in a new
+ <a href="../features/splitView.html">split frame</a> window.
+ Note that the translation is not frame- or intron-aware; it
+ simply translates all codons in each sequence, using the
+ standard <a href="../misc/geneticCode.html">genetic code</a>
+ (any incomplete final codon is discarded). You can perform this
+ action on the whole alignment, or selected rows, columns, or
+ regions.
+ </em> <br></li>
+ <li><strong>Get Cross-References</strong> (not applet)<br>
+ <em>This option is visible where sequences have
+ cross-references to other standard databases; for example, an
+ EMBL entry may have cross-references to one or more UNIPROT
+ entries. Select the database to view all cross-referenced
+ sequences in a new <a href="../features/splitView.html">split
+ frame</a> window.
+ </em> <br></li>
+ <li><strong>Autocalculate Consensus</strong><br> <em>For
+ large alignments it can be useful to deselect
+ "Autocalculate Consensus" when editing. This prevents
+ the sometimes lengthy calculations performed after each sequence
+ edit.</em> <br></li>
+ <li><strong>Sort Alignment With New Tree</strong><br> <em>If
+ this option is selected, the alignment will be automatically
+ sorted whenever a new tree is calculated or loaded.</em> <br></li>
+ <li><strong>Show Flanking Regions</strong><br> <em>Opens
+ a new alignment window showing any additional sequence data
+ either side of the current alignment. Useful in conjunction with
+ 'Fetch Database References' when the 'Trim Retrieved Sequences'
+ option is disabled to retrieve full length sequences for a set
+ of aligned peptides. </em></li>
+ </ul>
</body>
</html>
diff --git a/help/html/menus/alwcolour.html b/help/html/menus/alwcolour.html
index 3093edd..72df8f7 100644
--- a/help/html/menus/alwcolour.html
+++ b/help/html/menus/alwcolour.html
@@ -1,61 +1,76 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Alignment Window Menus</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Alignment Window Menus</title>
+</head>
<body>
-<p><strong>Alignment Window Colour Menu</strong></p>
+ <p>
+ <strong>Alignment Window Colour Menu</strong>
+ </p>
<ul>
<li><strong>Apply Colour To All Groups<br>
- </strong><em>If this is selected, any changes made to the background colour
- will be applied to all currently defined groups.<br>
- </em></li>
- <li><strong><a href="../colourSchemes/textcolour.html">Colour
- Text ...</a></strong><em><br>
- Opens the Colour Text dialog box to set a different text colour for light and dark background, and the intensity threshold for transition between them.
- </em></li>
- <li>Colour Scheme options: <strong>None, ClustalX, Blosum62 Score, Percentage
- Identity, Zappo, Taylor, Hydrophobicity, Helix Propensity, Strand Propensity,
- Turn Propensity, Buried Index, Nucleotide, User Defined<br>
- </strong> <em>See <a href="../colourSchemes/index.html">colours</a> for
- a description of all colour schemes.</em><br>
+ </strong><em>If this is selected, any changes made to the background
+ colour will be applied to all currently defined groups.<br>
+ </em></li>
+ <li><strong><a href="../colourSchemes/textcolour.html">Colour
+ Text ...</a></strong><em><br> Opens the Colour Text dialog box to
+ set a different text colour for light and dark background, and
+ the intensity threshold for transition between them. </em></li>
+ <li>Colour Scheme options: <strong>None, ClustalX,
+ Blosum62 Score, Percentage Identity, Zappo, Taylor,
+ Hydrophobicity, Helix Propensity, Strand Propensity, Turn
+ Propensity, Buried Index, Nucleotide, Purine/Pyrimidine, User
+ Defined<br>
+ </strong> <em>See <a href="../colourSchemes/index.html">colours</a> for
+ a description of all colour schemes.
+ </em><br>
</li>
<li><strong>By Conservation<br>
- </strong><em>See <a href="../colourSchemes/conservation.html">Colouring
- by Conservation</a>.</em><br>
- </li>
+ </strong><em>See <a href="../colourSchemes/conservation.html">Colouring
+ by Conservation</a>.
+ </em><br></li>
<li><strong>Modify Conservation Threshold<br>
- </strong><em>Use this to display the conservation threshold slider window.
- Useful if the window has been closed, or if the 'by conservation' option
- appears to be doing nothing!</em><br>
- </li>
+ </strong><em>Use this to display the conservation threshold slider
+ window. Useful if the window has been closed, or if the 'by
+ conservation' option appears to be doing nothing!</em><br></li>
<li><strong>Above Identity Threshold<br>
- </strong><em>See <a href="../colourSchemes/abovePID.html">Above Percentage
- Identity</a></em><strong>.<br>
- </strong></li>
+ </strong><em>See <a href="../colourSchemes/abovePID.html">Above
+ Percentage Identity</a></em><strong>.<br>
+ </strong></li>
<li><strong>Modify Identity Threshold<br>
- </strong><em>Use this to set the threshold value for colouring above Identity.
- Useful if the window has been closed.<br>
- </em></li>
- <li><strong>By Annotation</strong><br>
- <em>Colours the alignment on a per-column value from a specified annotation.
- See <a href="../colourSchemes/annotationColouring.html">Annotation Colouring</a>.</em><br>
- </li>
+ </strong><em>Use this to set the threshold value for colouring above
+ Identity. Useful if the window has been closed.<br>
+ </em></li>
+ <li><strong>By Annotation</strong><br> <em>Colours
+ the alignment on a per-column value from a specified annotation.
+ See <a href="../colourSchemes/annotationColouring.html">Annotation
+ Colouring</a>.
+ </em><br></li>
+ <li><strong>By RNA Helices</strong><br> <em>Colours
+ the helices of an RNA alignment loaded from a Stockholm file.
+ See <a href="../colourSchemes/rnahelicesColouring.html">RNA
+ Helices Colouring</a>.
+ </em><br></li>
</ul>
</body>
</html>
diff --git a/help/html/menus/alwedit.html b/help/html/menus/alwedit.html
index 488e2f0..1ead68a 100644
--- a/help/html/menus/alwedit.html
+++ b/help/html/menus/alwedit.html
@@ -1,101 +1,117 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Alignment Window Menus</title>
</head>
<body>
-<p><strong>Alignment Window Edit Menu</strong></p>
-<ul>
- <li><strong>Undo (Control Z)</strong><em><br>
- This will undo any edits you make to the alignment. This applies to
- insertion or deletion of gaps, cutting residues or sequences from the
- alignment or pasting sequences to the current alignment or sorting the
- alignment. <strong>NOTE:</strong> It DOES NOT undo colour changes,
- adjustments to group sizes, or changes to the annotation panel. </em></li>
- <li><strong>Redo (Control Y)<br>
- </strong><em>Any actions which you undo can be redone using redo. </em></li>
- <li><strong>Cut (Control X)<br>
- </strong><em>This will make a copy of the currently selected residues
- before removing them from your alignment. Click on a sequence name if
- you wish to select a whole sequence. <br>
- Use <CTRL> and X (<APPLE> and X on MacOSX) to cut.</em></li>
- <li><strong>Copy (Control C)</strong><br>
- <em>Copies the currently selected residues to the system clipboard
- - you can also do this by pressing <CTRL> and C (<APPLE>
- and C on MacOSX). <br>
- If you try to paste the clipboard contents to a text editor, you will
- see the format of the copied residues FASTA.</em></li>
- <li><strong>Paste </strong>
- <ul>
- <li><strong>To New Alignment (Control Shift V)<br>
- </strong><em>A new alignment window will be created from sequences
- previously copied or cut to the system clipboard. <br>
- Use <CTRL> and <SHIFT> and V(<APPLE> and
- <SHIFT;> and and V on MacOSX) to paste.</em></li>
- <li><strong>Add To This Alignment (Control V)<br>
- </strong><em>Copied sequences from another alignment window can be added
- to the current Jalview alignment. </em></li>
- </ul>
- </li>
- <li><strong>Delete (Backspace)<br>
- </strong><em>This will delete the currently selected residues without
- copying them to the clipboard. Like the other edit operations, this can
- be undone with <strong>Undo</strong>.</em></li>
- <li><strong>Remove Left (Control L)<br>
- </strong><em>If the alignment has marked columns, the alignment will be
- trimmed to the left of the leftmost marked column. To mark a column,
- mouse click the scale bar above the alignment. Click again to unmark a
- column, or select "Deselect All" to deselect all columns.</em></li>
- <li><strong>Remove Right (Control R)<br>
- </strong><em>If the alignment has marked columns, the alignment will be
- trimmed to the left of the leftmost marked column. To mark a column,
- mouse click the scale bar above the alignment. Click again to unmark a
- column, or select "Deselect All" to deselect all columns.</em></li>
- <li><strong>Remove Empty Columns (Control E)<br>
- </strong><em>All columns which only contain gap characters ("-",
- ".") will be deleted.<br>
- You may set the default gap character in <a
- href="../features/preferences.html">preferences</a>. </em></li>
- <li><strong>Remove All Gaps (Control Shift E)</strong><br>
- <em>Gap characters ("-", ".") will be deleted
- from the selected area of the alignment. If no selection is made, ALL
- the gaps in the alignment will be removed.<br>
- You may set the default gap character in <a
- href="../features/preferences.html">preferences</a>. </em></li>
- <li><strong>Remove Redundancy (Control D)<br>
- </strong><em>Selecting this option brings up a window asking you to select
- a threshold. If the percentage identity between any two sequences
- (under the current alignment) exceeds this value then one of the
- sequences (the shorter) is discarded. Press the "Apply"
- button to remove redundant sequences. The "Undo" button will
- undo the last redundancy deletion.</em></li>
- <li><strong>Pad Gaps<br>
- </strong><em>When selected, the alignment will be kept at minimal width (so
- there no empty columns before or after the first or last aligned
- residue) and all sequences will be padded with gap characters to the
- before and after their terminating residues.<br>
- This switch is useful when making a tree using unaligned sequences and
- when working with alignment analysis programs which require 'properly
- aligned sequences' to be all the same length.<br>
- You may set the default for <strong>Pad Gaps</strong> in the <a
- href="../features/preferences.html">preferences</a>. </em></li>
-</ul>
+ <p>
+ <strong>Alignment Window Edit Menu</strong>
+ </p>
+ <ul>
+ <li><strong>Undo (Control Z)</strong><em><br> This
+ will undo any edits you make to the alignment. This applies to
+ insertion or deletion of gaps, cutting residues or sequences
+ from the alignment or pasting sequences to the current alignment
+ or sorting the alignment. <strong>NOTE:</strong> It DOES NOT
+ undo colour changes, adjustments to group sizes, or changes to
+ the annotation panel. </em></li>
+ <li><strong>Redo (Control Y)<br>
+ </strong><em>Any actions which you undo can be redone using redo. </em></li>
+ <li><strong>Cut (Control X)<br>
+ </strong><em>This will make a copy of the currently selected residues
+ before removing them from your alignment. Click on a sequence
+ name if you wish to select a whole sequence. <br> Use
+ <CTRL> and X (<APPLE> and X on MacOSX) to cut.
+ </em></li>
+ <li><strong>Copy (Control C)</strong><br> <em>Copies
+ the currently selected residues to the system clipboard - you
+ can also do this by pressing <CTRL> and C (<APPLE>
+ and C on MacOSX). <br> If you try to paste the clipboard
+ contents to a text editor, you will see the format of the copied
+ residues FASTA.
+ </em></li>
+ <li><strong>Paste </strong>
+ <ul>
+ <li><strong>To New Alignment (Control Shift V)<br>
+ </strong><em>A new alignment window will be created from sequences
+ previously copied or cut to the system clipboard. <br>
+ Use <CTRL> and <SHIFT> and V(<APPLE> and
+ <SHIFT;> and and V on MacOSX) to paste.
+ </em></li>
+ <li><strong>Add To This Alignment (Control V)<br>
+ </strong><em>Copied sequences from another alignment window can be
+ added to the current Jalview alignment. </em></li>
+ </ul></li>
+ <li><strong>Delete (Backspace)<br>
+ </strong><em>This will delete the currently selected residues without
+ copying them to the clipboard. Like the other edit operations,
+ this can be undone with <strong>Undo</strong>.
+ </em></li>
+ <li><strong>Remove Left (Control L)<br>
+ </strong><em>If the alignment has marked columns, the alignment will be
+ trimmed to the left of the leftmost marked column. To mark a
+ column, mouse click the scale bar above the alignment. Click
+ again to unmark a column, or select "Deselect All" to
+ deselect all columns.</em></li>
+ <li><strong>Remove Right (Control R)<br>
+ </strong><em>If the alignment has marked columns, the alignment will be
+ trimmed to the left of the leftmost marked column. To mark a
+ column, mouse click the scale bar above the alignment. Click
+ again to unmark a column, or select "Deselect All" to
+ deselect all columns.</em></li>
+ <li><strong>Remove Empty Columns (Control E)<br>
+ </strong><em>All columns which only contain gap characters
+ ("-", ".") will be deleted.<br> You may
+ set the default gap character in <a
+ href="../features/preferences.html"
+ >preferences</a>.
+ </em></li>
+ <li><strong>Remove All Gaps (Control Shift E)</strong><br>
+ <em>Gap characters ("-", ".") will be
+ deleted from the selected area of the alignment. If no selection
+ is made, ALL the gaps in the alignment will be removed.<br>
+ You may set the default gap character in <a
+ href="../features/preferences.html"
+ >preferences</a>.
+ </em></li>
+ <li><strong>Remove Redundancy (Control D)<br>
+ </strong><em>Selecting this option brings up a window asking you to
+ select a threshold. If the percentage identity between any two
+ sequences (under the current alignment) exceeds this value then
+ one of the sequences (the shorter) is discarded. Press the
+ "Apply" button to remove redundant sequences. The
+ "Undo" button will undo the last redundancy deletion.</em></li>
+ <li><strong>Pad Gaps<br>
+ </strong><em>When selected, the alignment will be kept at minimal width
+ (so there are no empty columns before or after the first or last
+ aligned residue) and all sequences will be padded with gap
+ characters before and after their terminating residues.<br>
+ This switch is useful when making a tree using unaligned
+ sequences and when working with alignment analysis programs
+ which require 'properly aligned sequences' to be all the same
+ length.<br> You may set the default for <strong>Pad
+ Gaps</strong> in the <a href="../features/preferences.html">preferences</a>.
+ </em></li>
+ </ul>
</body>
</html>
diff --git a/help/html/menus/alwfile.html b/help/html/menus/alwfile.html
index af3e105..3e4cf68 100644
--- a/help/html/menus/alwfile.html
+++ b/help/html/menus/alwfile.html
@@ -1,111 +1,141 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Alignment Window Menus</title>
</head>
<body>
-<p><strong>Alignment Window File Menu</strong></p>
-<ul>
- <li><strong>Fetch Sequence</strong><br>
- <em>Shows a dialog window in which you can select known ids from
- Uniprot, EMBL, EMBLCDS or PDB database using Web Services provided by
- the European Bioinformatics Institute. See <a
- href="../features/seqfetch.html">Sequence Fetcher</a></em>.</li>
- <li><strong>Add Sequences</strong><em><br>
- Add sequences to the visible alignment from file, URL, or cut &
- paste window </em></li>
- <li><strong>Reload</strong><em><br>
- Reloads the alignment from the original file, if available.<br>
- <strong>Warning: This will delete any edits, analyses and
- colourings applied since the alignment was last saved, and cannot be
- undone.</strong></em></li>
- <li><strong>Save (Control S)</strong><em><br>
- Saves the alignment to the file it was loaded from (if available), in
- the same format, updating the original in place. </em></li>
- <li><strong>Save As (Control Shift S)<br>
- </strong><em>Save the alignment to local file. A file selection window will
- open, use the "Files of type:" selection box to determine
- which <a href="../io/index.html">alignment format</a> to save as.</em></li>
- <li><strong>Output to Textbox<br>
- </strong><em>The alignment will be displayed in plain text in a new window,
- which you can "Copy and Paste" using the pull down menu, or
- your standard operating system copy and paste keys. The output window
- also has a <strong>"New Window"</strong> button to import the
- (possibly edited) text as a new alignment.<br>
- Select the format of the text by selecting one of the following menu
- items.</em>
- <ul>
- <li><strong>FASTA</strong> <em></em></li>
- <li><strong>MSF</strong></li>
- <li><strong>CLUSTAL</strong></li>
- <li><strong>BLC</strong></li>
- <li><strong>PIR</strong></li>
- <li><strong>PFAM</strong></li>
- </ul>
- </li>
- <li><strong>Page Setup ...</strong><br>
- <em>Open the printing system's Page Setup dialog box, to
- control page size, layout and orientation.</em></li>
- <li><strong>Print (Control P)<br>
- </strong><em>Jalview will print the alignment using the current fonts and
- colours of your alignment. If the alignment has annotations visible,
- these will be printed below the alignment. If the alignment is wrapped
- the number of residues per line of your alignment will depend on the
- paper width or your alignment window width, whichever is the smaller. </em></li>
- <li><strong>Export Image</strong> <em><br>
- Creates an alignment graphic with the current view's annotation,
- alignment background colours and group colours. If the alignment is <a
- href="../features/wrap.html">wrapped</a>, the output will also be
- wrapped and will have the same visible residue width as the open
- alignment. </em>
- <ul>
- <li><strong>HTML<br>
- </strong><em>Create a <a href="../io/export.html">web page</a> from your
- alignment.</em></li>
- <li><strong>EPS<br>
- </strong><em>Create an <a href="../io/export.html">Encapsulated
- Postscript</a> file from your alignment.</em></li>
- <li><strong>PNG<br>
- </strong><em>Create a <a href="../io/export.html">Portable Network
- Graphics</a> file from your alignment.</em></li>
- </ul>
- </li>
- <li><strong>Export Features</strong><em><br>
- All features visible on the alignment can be saved to file or displayed
- in a textbox in either Jalview or GFF format</em></li>
- <li><strong>Export Annotations</strong><em><br>
- All annotations visible on the alignment can be saved to file or
- displayed in a textbox in Jalview annotations format. </em></li>
- <li><strong>Load Associated Tree<br>
- </strong><em>Jalview can <a href="../calculations/treeviewer.html">view
- trees</a> stored in the Newick file format, and associate them with the
- alignment. Note: the ids of the tree file and your alignment MUST be
- the same.</em></li>
- <li><strong>Load Features / Annotations<br>
- </strong><em>Load files describing precalculated <a
- href="../features/featuresFormat.html">sequence features</a> or <a
- href="../features/annotationsFormat.html">alignment annotations</a>.</em></li>
- <li><strong>Close (Control W)</strong><br>
- <em>Close the alignment window. Make sure you have saved your
- alignment before you close - either as a Jalview project or by using
- the <strong>Save As</strong> menu.</em></li>
-</ul>
+ <p>
+ <strong>Alignment Window File Menu</strong>
+ </p>
+ <ul>
+ <li><strong>Fetch Sequence</strong><br> <em>Shows a
+ dialog window in which you can select known ids from Uniprot,
+ EMBL, EMBLCDS, PDB, PFAM, or RFAM databases using Web Services
+ provided by the European Bioinformatics Institute. See <a
+ href="../features/seqfetch.html"
+ >Sequence Fetcher</a>
+ </em>.</li>
+ <li><strong>Add Sequences</strong><em><br> Add
+ sequences to the visible alignment from file, URL, or cut &
+ paste window </em></li>
+ <li><strong>Reload</strong><em><br> Reloads the
+ alignment from the original file, if available.<br> <strong>Warning:
+ This will delete any edits, analyses and colourings applied
+ since the alignment was last saved, and cannot be undone.</strong></em></li>
+ <li><strong>Save (Control S)</strong><em><br> Saves
+ the alignment to the file it was loaded from (if available), in
+ the same format, updating the original in place. </em></li>
+ <li><strong>Save As (Control Shift S)<br>
+ </strong><em>Save the alignment to local file. A file selection window
+ will open, use the "Files of type:" selection box to
+ determine which <a href="../io/index.html">alignment format</a>
+ to save as.
+ </em></li>
+ <li><strong>Output to Textbox<br>
+ </strong><em>The alignment will be displayed in plain text in a new
+ window, which you can "Copy and Paste" using the pull
+ down menu, or your standard operating system copy and paste
+ keys. The output window also has a <strong>"New
+ Window"</strong> button to import the (possibly edited) text as a
+ new alignment.<br> Select the format of the text by
+ selecting one of the following menu items.
+ </em>
+ <ul>
+ <li><strong>FASTA</strong> <em></em></li>
+ <li><strong>MSF</strong></li>
+ <li><strong>CLUSTAL</strong></li>
+ <li><strong>BLC</strong></li>
+ <li><strong>PIR</strong></li>
+ <li><strong>PFAM</strong></li>
+ <li><strong>PileUp</strong></li>
+ <li><strong>AMSA</strong></li>
+ <li><strong>STH</strong></li>
+ <li><strong>PHYLIP</strong></li>
+ <li><strong>JSON</strong></li>
+ </ul></li>
+ <li><strong>Page Setup ...</strong><br> <em>Open the
+ printing system's Page Setup dialog box, to control page size,
+ layout and orientation.</em></li>
+ <li><strong>Print (Control P)<br>
+ </strong><em>Jalview will print the alignment using the current fonts
+ and colours of your alignment. If the alignment has annotations
+ visible, these will be printed below the alignment. If the
+ alignment is wrapped the number of residues per line of your
+ alignment will depend on the paper width or your alignment
+ window width, whichever is the smaller. </em></li>
+ <li><strong>Export Image</strong> <em><br> Creates an
+ alignment graphic with the current view's annotation, alignment
+ background colours and group colours. If the alignment is <a
+ href="../features/wrap.html"
+ >wrapped</a>, the output will also be wrapped and will have the same
+ visible residue width as the open alignment. </em>
+ <ul>
+ <li><strong>HTML<br>
+ </strong><em>Create a <a href="../io/export.html">web page</a> from
+ your alignment.
+ </em></li>
+ <li><strong>EPS<br>
+ </strong><em>Create an <a href="../io/export.html">Encapsulated
+ Postscript</a> file from your alignment.
+ </em></li>
+ <li><strong>PNG<br>
+ </strong><em>Create a <a href="../io/export.html">Portable
+ Network Graphics</a> file from your alignment.
+ </em></li>
+ <li><strong>SVG<br>
+ </strong><em>Create a <a href="../io/export.html">Scalable
+ Vector Graphics</a> file from your alignment for embedding in
+ web pages.
+ </em></li>
+ <li><strong>BioJS<br>
+ </strong><em>Create a <a href="../io/export.html">BioJS MSA
+ Viewer HTML </a> file from your alignment.
+ </em></li>
+ </ul></li>
+ <li><strong>Export Features</strong><em><br> All
+ features visible on the alignment can be saved to file or
+ displayed in a textbox in either Jalview or GFF format</em></li>
+ <li><strong>Export Annotations</strong><em><br> All
+ annotations visible on the alignment can be saved to file or
+ displayed in a textbox in Jalview annotations format. </em></li>
+ <li><strong>Load Associated Tree<br>
+ </strong><em>Jalview can <a href="../calculations/treeviewer.html">view
+ trees</a> stored in the Newick file format, and associate them
+ with the alignment. Note: the ids of the tree file and your
+ alignment MUST be the same.
+ </em></li>
+ <li><strong>Load Features / Annotations<br>
+ </strong><em>Load files describing precalculated <a
+ href="../features/featuresFormat.html"
+ >sequence features</a> or <a
+ href="../features/annotationsFormat.html"
+ >alignment annotations</a>.
+ </em></li>
+ <li><strong>Close (Control W)</strong><br> <em>Close
+ the alignment window. Make sure you have saved your alignment
+ before you close - either as a Jalview project or by using the <strong>Save
+ As</strong> menu.
+ </em></li>
+ </ul>
</body>
</html>
diff --git a/help/html/menus/alwformat.html b/help/html/menus/alwformat.html
index 62fdf93..2c6b4f7 100644
--- a/help/html/menus/alwformat.html
+++ b/help/html/menus/alwformat.html
@@ -1,79 +1,89 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
-<p><strong>Alignment Window Format Menu</strong></p>
+<p>
+ <strong>Alignment Window Format Menu</strong>
+</p>
<ul>
- <li><strong>Font...</strong><br>
- <em>Opens the "Choose Font" dialog box, in order to change the font
- of the display and enable or disable 'smooth fonts' (anti-aliasing) for faster
- alignment rendering. </em></em></li>
+ <li><strong>Font...</strong><br> <em>Opens the
+ "Choose Font" dialog box, in order to change the font of
+ the display and enable or disable 'smooth fonts' (anti-aliasing)
+ for faster alignment rendering. </em></em></li>
<li><strong>Wrap<br>
- </strong><em>When ticked, the alignment display is "<a
- href="../features/wrap.html">wrapped</a>" to the width of the alignment
- window. This is useful if your alignment has only a few sequences to view
- its full width at once.<br>
- Additional options for display of sequence numbering and scales are also visible
- in wrapped layout mode:</em>
+ </strong><em>When ticked, the alignment display is "<a
+ href="../features/wrap.html"
+ >wrapped</a>" to the width of the alignment window. This is
+ useful if your alignment has only a few sequences to view its full
+ width at once.<br> Additional options for display of sequence
+ numbering and scales are also visible in wrapped layout mode:
+ </em>
<ul>
- <li><strong>Scale Left</strong><br>
- <em>Show the sequence position for the first aligned residue in each row
- in the left column of the alignment.</em></li>
- <li><strong>Scale Right</strong><br>
- <em>Show the sequence position for the last aligned residue in each row
- in the right-most column of the alignment.</em></li>
- <li><strong>Scale Above</strong><br>
- <em>Show the alignment column position scale.</em></li>
+ <li><strong>Scale Left</strong><br> <em>Show the
+ sequence position for the first aligned residue in each row in
+ the left column of the alignment.</em></li>
+ <li><strong>Scale Right</strong><br> <em>Show the
+ sequence position for the last aligned residue in each row in
+ the right-most column of the alignment.</em></li>
+ <li><strong>Scale Above</strong><br> <em>Show the
+ alignment column position scale.</em></li>
</ul>
<li><strong>Show Sequence Limits<br>
- </strong><em>If this box is selected the sequence name will have the start
- and end position of the sequence appended to the name, in the format NAME/START-END</em></li>
+ </strong><em>If this box is selected the sequence name will have the start
+ and end position of the sequence appended to the name, in the
+ format NAME/START-END</em></li>
<li><strong>Right Align Sequence ID<br>
- </strong> <em>If this box is selected then the sequence names displayed in
- the sequence label area will be aligned against the left-hand edge of the
- alignment display, rather than the left-hand edge of the alignment window.</em></li>
+ </strong> <em>If this box is selected then the sequence names displayed in
+ the sequence label area will be aligned against the left-hand edge
+ of the alignment display, rather than the left-hand edge of the
+ alignment window.</em></li>
<li><strong>Show Hidden Markers<br>
- </strong><em>When this box is selected, positions in the alignment where rows
- and columns are hidden will be marked by blue arrows.</em></li>
- <li><strong>Boxes</strong><em><br>
- If this is selected the background of a residue will be coloured using the
- selected background colour. Useful if used in conjunction with "Colour
- Text." </em></li>
+ </strong><em>When this box is selected, positions in the alignment where
+ rows and columns are hidden will be marked by blue arrows.</em></li>
+ <li><strong>Boxes</strong><em><br> If this is selected
+ the background of a residue will be coloured using the selected
+ background colour. Useful if used in conjunction with "Colour
+ Text." </em></li>
<li><strong>Text<br>
- </strong><em>If this is selected the residues will be displayed using the
- standard 1 character amino acid alphabet.</em></li>
+ </strong><em>If this is selected the residues will be displayed using the
+ standard 1 character amino acid alphabet.</em></li>
<li><strong>Colour Text<br>
- </strong><em>If this is selected the residues will be coloured according to
- the background colour associated with that residue. The colour is slightly
- darker than background so the amino acid symbol remains visible. </em></li>
+ </strong><em>If this is selected the residues will be coloured according
+ to the background colour associated with that residue. The colour
+ is slightly darker than background so the amino acid symbol
+ remains visible. </em></li>
<li><strong>Show Gaps<br>
- </strong><em>When this is selected, gap characters will be displayed as "."
- or "-". If unselected, then gap characters will appear as blank
- spaces. <br>
- You may set the default gap character in <a
- href="../features/preferences.html">preferences</a>.</em></li>
- <li><strong>Centre Column Labels<br>
- </strong><em>When this is selected, the text labels within each annotation row will be centred on the column that they are associated with.
- </em></li>
- <li><strong>Show Unconserved<br>
- </strong><em>When this is selected, all consensus sequence symbols will be rendered as a '.', highlighting mutations in highly conserved alignments.
- </em></li>
-
+ </strong><em>When this is selected, gap characters will be displayed as
+ "." or "-". If unselected, then gap characters
+ will appear as blank spaces. <br> You may set the default gap
+ character in <a href="../features/preferences.html">preferences</a>.
+ </em></li>
+ <li><strong>Centre Column Labels<br>
+ </strong><em>When this is selected, the text labels within each annotation
+ row will be centred on the column that they are associated with. </em></li>
+ <li><strong>Show Unconserved<br>
+ </strong><em>When this is selected, all consensus sequence symbols will be
+ rendered as a '.', highlighting mutations in highly conserved
+ alignments. </em></li>
+
</ul>
</body>
</html>
diff --git a/help/html/menus/alwselect.html b/help/html/menus/alwselect.html
index 6cbaad3..013ae4b 100644
--- a/help/html/menus/alwselect.html
+++ b/help/html/menus/alwselect.html
@@ -1,48 +1,72 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><body>
-<p><strong>Alignment Window Select Menu</strong></p>
-<ul>
-
- <li><a href="../features/search.html"><strong>Find... (Control F)</strong></a><br>
- <em>Opens the Find dialog box to search for residues, sequence name or residue
- position within the alignment and create new sequence features from the queries.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<body>
+ <p>
+ <strong>Alignment Window Select Menu</strong>
+ </p>
+ <ul>
+
+ <li><a href="../features/search.html"><strong>Find...
+ (Control F)</strong></a><br> <em>Opens the Find dialog box to
+ search for residues, sequence name or residue position within
+ the alignment and create new sequence features from the queries.
</em>
- <li><strong>Select All (Control A)</strong><strong><br>
+ <li><strong>Select All (Control A)</strong><strong><br>
</strong><em>Selects all the sequences and residues in the alignment. <br>
- Use <CTRL> and A (<APPLE> and A on a MacOSX) to select all.</em></em></li>
- <li><strong>Deselect All (Escape)<br>
- </strong><em>Removes the current selection box (red dashed box) from the
- alignment window. All selected sequences, residues and marked columns
- will be deselected. </em><em> <br>
- Use <ESCAPE> to deselect all.</em></li>
- <li><strong>Invert Sequence Selection (Control I)<br>
- </strong><em>Any sequence ids currently not selected will replace the
- current selection. </em></li>
- <li><strong>Invert Column Selection (Control Alt I)<br>
- </strong><em>Any columns currently not selected will replace the current
- column selection. </em></li>
- <li><strong>Undefine Groups (Control U)<br>
- </strong><em>The alignment will be reset with no defined groups.<br>
- <strong>WARNING</strong>: This cannot be undone.</em></li>
- <li><strong>Make Groups<br/></strong>
- <em>The currently selected groups of the alignment will be subdivided according to the contents of the currently selected region. <br/>Use this to subdivide an alignment based on the different combinations of residues observed at specific positions. (new in jalview 2.5)</em></li>
-</ul>
+ Use <CTRL> and A (<APPLE> and A on a MacOSX) to
+ select all.
+ </em></em></li>
+ <li><strong>Deselect All (Escape)<br>
+ </strong><em>Removes the current selection box (red dashed box) from the
+ alignment window. All selected sequences, residues and marked
+ columns will be deselected. </em><em> <br> Use
+ <ESCAPE> to deselect all.
+ </em></li>
+ <li><strong>Invert Sequence Selection (Control I)<br>
+ </strong><em>Any sequence ids currently not selected will replace the
+ current selection. </em></li>
+ <li><strong>Invert Column Selection (Control Alt I)<br>
+ </strong><em>Any columns currently not selected will replace the current
+ column selection. </em></li>
+ <li><strong>Create Group (Control G)<br></strong> <em>Create
+ a group containing the currently selected sequences.</em></li>
+ <li><strong>Remove Group (Shift Control G)<br></strong> <em>Ungroup
+ the currently selected sequence group.</em></li>
+ <li><strong>Make Groups for selection<br /></strong> <em>The
+ currently selected groups of the alignment will be subdivided
+ according to the contents of the currently selected region. <br />Use
+ this to subdivide an alignment based on the different
+ combinations of residues at marked columns.
+ </em></li>
+ <li><strong>Undefine Groups (Control U)<br>
+ </strong><em>The alignment will be reset with no defined groups.<br>
+ <strong>WARNING</strong>: This cannot be undone.
+ </em></li>
+ <li><strong><a
+ href="../features/columnFilterByAnnotation.html"
+ >Select/Hide Columns by Annotation</a></strong> <br /> <em>Select or
+ Hide columns in the alignment according to secondary structure,
+ labels and values shown in alignment annotation rows. </em></li>
+ </ul>
</body>
</html>
diff --git a/help/html/menus/alwview.html b/help/html/menus/alwview.html
index b533452..d18b6f0 100644
--- a/help/html/menus/alwview.html
+++ b/help/html/menus/alwview.html
@@ -1,91 +1,76 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Alignment Window Menus</title>
</head>
<body>
-<p><strong>Alignment Window View Menu</strong></p>
-<ul>
- <li><strong>New View (Control T)</strong><em><br>
- Creates a new view from the current alignment view. </em></li>
- <li><strong>Expand Views (X)</strong><em><br>
- Display each view associated with the alignment in its own alignment window,
- allowing several views to be displayed simultaneously. </em></li>
- <li><strong>Gather Views (G)</strong><em><br>
- Each view associated with the alignment will be displayed within its own tab
- on the current alignment window. </em></li>
- <li><strong>Show→(all Columns / Sequences / Sequences and Columns</strong> )</strong><em><br>
- All hidden Columns / Sequences / Sequences and Columns will be revealed. </em></li>
- <li><strong>Hide→(all Columns / Sequences / Selected Region / All but Selected Region)</strong><em><br>
- Hides the currently selected Columns / Sequences / Region or everything but the selected Region.</em></li>
- <li><strong>Show Annotations<br>
- </strong><em>If this is selected the "Annotation Panel" will be
- displayed below the alignment. The default setting is to display the conservation
- calculation, quality calculation and consensus values as bar charts. </em></li>
- <li><strong>Autocalculated Annotation<br></strong>Settings for the display of autocalculated annotation.
- <ul><li>
- <strong>Apply to all groups<br></strong>
- When ticked, any modification to the current settings will be applied to all autocalculated annotation.
- </li>
- <li>
- <strong>Show Consensus Histogram<br></strong>
- Enable or disable the display of the histogram above the consensus sequence.
- </li>
- <li>
- <strong>Show Consensus Profile<br></strong>
- Enable or disable the display of the sequence logo above the consensus sequence.
- </li>
- <li>
- <strong>Group Conservation<br></strong>
- When ticked, display a conservation row for all groups (only available for protein alignments).
- </li>
- <li>
- <strong>Apply to all groups<br></strong>
- When ticked, display a consensus row for all groups.
- </li>
- </ul>
- </li>
- <li><strong>Automatic Scrolling<br>
- </strong><em>When selected, the view will automatically scroll to display the
- highlighted sequence position corresponding to the position under the mouse
- pointer in a linked alignment or structure view.</em>
- </li>
- <li><strong>Show Sequence Features</strong><br>
- <em>Show or hide sequence features on this alignment.</em></li>
- <li><strong><a href="../features/featuresettings.html">Seqence Feature Settings...</a></strong><em><br>
- Opens the Sequence Feature Settings dialog box to control the colour and display
- of sequence features on the alignment, and configure and retrieve features
- from DAS annotation servers.</em></li>
- <li><strong>Sequence ID Tooltip</strong><em> (application only)
- <br>This submenu's options allow the inclusion or exclusion of
- non-positional sequence features or database cross references
- from the tooltip shown when the mouse hovers over the sequence ID panel.</em></li>
- <li><strong>Alignment Properties...<br>
- </strong><em>Displays some simple statistics computed for the
- current alignment view and any named properties defined on the
- whole alignment.</em></li>
- <li><strong><a href="../features/overview.html">Overview Window</a><br>
- </strong><em>A scaled version of the alignment will be displayed in a small
- window. A red box will indicate the currently visible area of the alignment.
- Move the visible region using the mouse. </em></li>
-</ul>
-<p> </p>
+ <p>
+ <strong>Alignment Window View Menu</strong>
+ </p>
+ <ul>
+ <li><strong>New View (Control T)</strong><em><br>
+ Creates a new view from the current alignment view. </em></li>
+ <li><strong>Expand Views (X)</strong><em><br> Display
+ each view associated with the alignment in its own alignment
+ window, allowing several views to be displayed simultaneously. </em></li>
+ <li><strong>Gather Views (G)</strong><em><br> Each
+ view associated with the alignment will be displayed within its
+ own tab on the current alignment window. </em></li>
+ <li><strong>Show→(all Columns / Sequences /
+ Sequences and Columns</strong>)</strong><em><br> All hidden Columns /
+ Sequences / Sequences and Columns will be revealed. </em></li>
+ <li><strong>Hide→(all Columns / Sequences /
+ Selected Region / All but Selected Region)</strong><em><br>
+ Hides the currently selected Columns / Sequences / Region or
+ everything but the selected Region.</em></li>
+ <li><strong>Automatic Scrolling<br>
+ </strong><em>When selected, the view will automatically scroll to
+ display the highlighted sequence position corresponding to the
+ position under the mouse pointer in a linked alignment or
+ structure view.</em></li>
+ <li><strong>Show Sequence Features</strong><br> <em>Show
+ or hide sequence features on this alignment.</em></li>
+ <li><strong><a href="../features/featuresettings.html">Sequence
+ Feature Settings...</a></strong><em><br> Opens the Sequence
+ Feature Settings dialog box to control the colour and display of
+ sequence features on the alignment, and configure and retrieve
+ features from DAS annotation servers.</em></li>
+ <li><strong>Sequence ID Tooltip</strong><em> (application
+ only) <br>This submenu's options allow the inclusion or
+ exclusion of non-positional sequence features or database cross
+ references from the tooltip shown when the mouse hovers over the
+ sequence ID panel.
+ </em></li>
+ <li><strong>Alignment Properties...<br>
+ </strong><em>Displays some simple statistics computed for the current
+ alignment view and any named properties defined on the whole
+ alignment.</em></li>
+ <li><strong><a href="../features/overview.html">Overview
+ Window</a><br> </strong><em>A scaled version of the alignment
+ will be displayed in a small window. A red box will indicate the
+ currently visible area of the alignment. Move the visible region
+ using the mouse. </em></li>
+ </ul>
+ <p> </p>
</body>
</html>
diff --git a/help/html/menus/desktopMenu.html b/help/html/menus/desktopMenu.html
index 4098c67..9c41b7e 100644
--- a/help/html/menus/desktopMenu.html
+++ b/help/html/menus/desktopMenu.html
@@ -1,126 +1,146 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Desktop Menus</title>
</head>
<body>
-<p><strong>Desktop Menus</strong></p>
-<ul>
- <li><em> <strong>File</strong></em>
- <ul>
- <li><strong>Input Alignment from</strong><em> (See more on <a
- href="../io/index.html">file formats</a>) </em>
- <ul>
- <li><strong>File (Control O)</strong><br>
- <em>open file(s) on your local file system</em></li>
- <li><strong>URL</strong><br>
- <em>open a file from a website. The URL MUST start with http://</em></li>
- <li><strong>Textbox</strong><br>
- <em>copy and paste an alignment into a text window</em></li>
- </ul>
- </li>
- <li><strong>Fetch Sequence<br>
- </strong><em>Shows a dialog window in which you can select known ids from
- Uniprot, EMBL, EMBLCDS or PDB database using Web Services provided by
- the European Bioinformatics Institute.</em></li>
- <li><strong>Save Project</strong><br>
- <em>Saves all currently open alignment windows with their current
- view settings and any associated trees, as a <a
- href="../features/jalarchive.html">Jalview Archive</a> (which has a
- .jar extension).</em></li>
- <li><strong>Load Project</strong><br>
- <em>Loads Jalview archives <strong>only</strong>.</em></li>
- <li><strong>Quit</strong><br>
- <em>Close Jalview. <br>
- <strong>Note - any annotation you have made on alignments will be lost
- unless you Save your work before quitting.</strong></em><br>
- </li>
- </ul>
- </li>
- <li><strong>Tools</strong>
- <ul>
- <li><strong><a href="../features/preferences.html">Preferences<br>
- </a></strong><em>Change the default visual settings for opening new alignment
- windows.</em></li>
- <li><strong>Show Memory Usage<br></strong>
- <em>When ticked, the currently available memory will be displayed in the
- bottom right of the desktop background area.<br>
- See the <a href="../memory.html">help on jalview memory settings</a> for more information.</em></li>
- <li><strong>Collect Garbage<br></strong>
- <em>Selecting this will initiate the Java Virtual Machine garbage collector, which might help free up some memory... perhaps.
- </em></li>
- <li><strong>Java Console<br/></strong>
- <em>Toggles the display of a the Jalview Java Console window. This setting will be remembered in your user preferences.</em></li>
- <li><strong>Jalview News<br/></strong>
- <em>Opens the <a href="../webServices/newsreader.html">Jalview News</a> dialog box. </em></li>
- <li><strong>Groovy Console...<em> (only available if groovy is on the classpath)</em><br></strong>
- <em>Open's the <a href="../groovy.html">Groovy Console</a> for interactive scripting.</em><strong><br></strong></li>
-
- </ul>
- </li>
- <li><strong>Vamsas</strong>
- <em>For more details, read the <a href="../vamsas/index.html">Jalview VAMSAS documentation</a>.<br/>
- When no session is active, the menu provides options for initiating a new VAMSAS session:</em>
- <ul>
- <li><strong>Connect to<br/></strong>
- <em>Connect to one of the existing sessions available.</em></li>
- <li><strong>New VAMSAS session<br/></strong>
- <em>Initiates a new local VAMSAS session.</em></li>
- <li><strong>Load VAMSAS session...<br/></strong>
- <em>Opens a file browser allowing you to choose a VAMSAS document to import into a new local session.</em></li>
- </ul>
- <em>When Jalview is joined to a VAMSAS session, the menu contains the following:</em>
- <ul>
- <li><strong>Session Update<br/></strong>
- <em>Sends alignment data in the Jalview desktop to the VAMSAS session.</em></li>
- <li><strong>Save VAMSAS Session...<br/></strong>
- <em>Saves the current session to a VAMSAS document archive.</em></li>
- <li><strong>Stop VAMSAS Session<br/></strong>
- <em>Disconnects from the current session. You may be asked if you want to save the current session's data if no other VAMSAS clients are connected.</em></li>
- </ul>
- </li>
- <li><strong>Help </strong>
- <ul>
- <li><strong>About<br>
- </strong><em>Displays the version and creation date of the application, as
- well as acknowledgements and a citation reference. </em></li>
- <li><strong>Documentation<br>
- </strong><em>Displays help files as a browseable, searchable set of pages
- with a table of contents. </em><strong><br>
- </strong></li>
- </ul>
- </li>
- <li><strong>Window</strong><br>
- <em>Each time a new window is added to the Jalview Desktop a
- corresponding menu item will be added to the "Window" menu
- that will bring the window to the top of the pile when it is selected.
- <ul>
- <li><strong>Close All</strong><br>
- Close all alignment and analysis windows.<br><strong>Note: This will erase all alignments from memory, and cannot be undone!</strong></li>
- <li><strong>Raise Associated Windows</strong><br>
- Bring all windows associated with the current alignment to the top of the pile.
- </li>
- <li><strong>Minimise Associated Windows</strong><br>
- Hide all windows related to the current alignment behind icons on the Jalview Desktop.
- </ul>
- </em></li>
- </ul>
+ <p>
+ <strong>Desktop Menus</strong>
+ </p>
+ <ul>
+ <li><em> <strong>File</strong></em>
+ <ul>
+ <li><strong>Input Alignment from</strong><em> (See
+ more on <a href="../io/index.html">file formats</a>)
+ </em>
+ <ul>
+ <li><strong>File (Control O)</strong><br> <em>open
+ file(s) on your local file system</em></li>
+ <li><strong>URL</strong><br> <em>open a file
+ from a website. The URL MUST start with http://</em></li>
+ <li><strong>Textbox</strong><br> <em>copy and
+ paste an alignment into a text window</em></li>
+ </ul></li>
+ <li><strong>Fetch Sequence<br>
+ </strong><em>Shows a dialog window in which you can select known ids
+ from Uniprot, EMBL, EMBLCDS or PDB database using Web
+ Services provided by the European Bioinformatics Institute.</em></li>
+ <li><strong>Save Project</strong><br> <em>Saves
+ all currently open alignment windows with their current view
+ settings and any associated trees, as a <a
+ href="../features/jalarchive.html"
+ >Jalview Archive</a> (which has a .jar extension).
+ </em></li>
+ <li><strong>Load Project</strong><br> <em>Loads
+ Jalview archives <strong>only</strong>.
+ </em></li>
+ <li><strong>Quit</strong><br> <em>Close Jalview.
+ <br> <strong>Note - any annotation you have
+ made on alignments will be lost unless you Save your work
+ before quitting.</strong>
+ </em><br></li>
+ </ul></li>
+ <li><strong>Tools</strong>
+ <ul>
+ <li><strong><a href="../features/preferences.html">Preferences<br>
+ </a></strong><em>Change the default visual settings for opening new
+ alignment windows.</em></li>
+ <li><strong>Show Memory Usage<br></strong> <em>When
+ ticked, the currently available memory will be displayed in
+ the bottom right of the desktop background area.<br>
+ See the <a href="../memory.html">help on Jalview memory
+ settings</a> for more information.
+ </em></li>
+ <li><strong>Collect Garbage<br></strong> <em>Selecting
+ this will initiate the Java Virtual Machine garbage
+ collector, which might help free up some memory... perhaps.
+ </em></li>
+ <li><strong>Java Console<br /></strong> <em>Toggles
+ the display of a the Jalview Java Console window. This
+ setting will be remembered in your user preferences.</em></li>
+ <li><strong>Jalview News<br /></strong> <em>Opens the
+ <a href="../webServices/newsreader.html">Jalview News</a>
+ dialog box.
+ </em></li>
+ <li><strong>Groovy Console...<em> (only
+ available if groovy is on the classpath)</em><br></strong> <em>Open's
+ the <a href="../groovy.html">Groovy Console</a> for
+ interactive scripting.
+ </em><strong><br></strong></li>
+
+ </ul></li>
+ <li><strong>Vamsas</strong> <em>For more details, read the
+ <a href="../vamsas/index.html">Jalview VAMSAS documentation</a>.<br />
+ When no session is active, the menu provides options for
+ initiating a new VAMSAS session:
+ </em>
+ <ul>
+ <li><strong>Connect to<br /></strong> <em>Connect to
+ one of the existing sessions available.</em></li>
+ <li><strong>New VAMSAS session<br /></strong> <em>Initiates
+ a new local VAMSAS session.</em></li>
+ <li><strong>Load VAMSAS session...<br /></strong> <em>Opens
+ a file browser allowing you to choose a VAMSAS document to
+ import into a new local session.</em></li>
+ </ul> <em>When Jalview is joined to a VAMSAS session, the menu
+ contains the following:</em>
+ <ul>
+ <li><strong>Session Update<br /></strong> <em>Sends
+ alignment data in the Jalview desktop to the VAMSAS session.</em></li>
+ <li><strong>Save VAMSAS Session...<br /></strong> <em>Saves
+ the current session to a VAMSAS document archive.</em></li>
+ <li><strong>Stop VAMSAS Session<br /></strong> <em>Disconnects
+ from the current session. You may be asked if you want to
+ save the current session's data if no other VAMSAS clients
+ are connected.</em></li>
+ </ul></li>
+ <li><strong>Help </strong>
+ <ul>
+ <li><strong>About<br>
+ </strong><em>Displays the version and creation date of the
+ application, as well as acknowledgements and a citation
+ reference. </em></li>
+ <li><strong>Documentation<br>
+ </strong><em>Displays help files as a browseable, searchable set of
+ pages with a table of contents. </em><strong><br> </strong></li>
+ </ul></li>
+ <li><strong>Window</strong><br> <em>Each time a new
+ window is added to the Jalview Desktop a corresponding menu item
+ will be added to the "Window" menu that will bring the
+ window to the top of the pile when it is selected.
+ <ul>
+ <li><strong>Close All</strong><br> Close all
+ alignment and analysis windows.<br>
+ <strong>Note: This will erase all alignments from
+ memory, and cannot be undone!</strong></li>
+ <li><strong>Raise Associated Windows</strong><br>
+ Bring all windows associated with the current alignment to
+ the top of the pile.</li>
+ <li><strong>Minimise Associated Windows</strong><br>
+ Hide all windows related to the current alignment behind
+ icons on the Jalview Desktop.
+ </ul>
+ </em></li>
+ </ul>
</body>
</html>
diff --git a/help/html/menus/index.html b/help/html/menus/index.html
index 436dc35..4f40e96 100644
--- a/help/html/menus/index.html
+++ b/help/html/menus/index.html
@@ -1,39 +1,53 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Jalview's Menus</title>
</head>
<body>
-<p><strong>Jalview's Menus</strong></p>
-<p>Menus are used in 3 places in Jalview - the "Desktop
-Menu", the "Alignment Menu" and the "Popup
-Menu".</p>
-<p>The <a href="desktopMenu.html">Desktop Menu</a> is always visible
-and is the starting point for loading new alignments.</p>
-<p>The <a href="alignmentMenu.html">Alignment Window Menus</a> are
-accessible once an alignment has been opened.</p>
-<p>The <a href="popupMenu.html">Popup Menus</a> are opened by
-clicking with the right mouse button in the alignment display area or on
-a sequence label in the alignment window.</p>
-<p>The <a href="alwannotations.html">Annotations Menu</a> is opened
-by right-clicking on an annotation row label or in an annotation row.</p>
+ <p>
+ <strong>Jalview's Menus</strong>
+ </p>
+ <p>Menus are used in 3 places in Jalview - the "Desktop
+ Menu", the "Alignment Menu" and the "Popup
+ Menu".</p>
+ <p>
+ The <a href="desktopMenu.html">Desktop Menu</a> is always visible
+ and is the starting point for loading new alignments.
+ </p>
+ <p>
+ The <a href="alignmentMenu.html">Alignment Window Menus</a> are
+ accessible once an alignment has been opened.
+ </p>
+ <p>
+ The <a href="popupMenu.html">Popup Menus</a> are opened by clicking
+ with the right mouse button in the alignment display area or on a
+ sequence label in the alignment window.
+ </p>
+ <p>
+ The <a href="alwannotationpanel.html">Annotations Menu</a> is opened
+ by right-clicking on an annotation row label or in an annotation
+ row.
+ </p>
</body>
</html>
diff --git a/help/html/menus/popupMenu.html b/help/html/menus/popupMenu.html
index f875672..20169c4 100644
--- a/help/html/menus/popupMenu.html
+++ b/help/html/menus/popupMenu.html
@@ -1,166 +1,198 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Popup Menu</title>
</head>
<body>
-<p><strong>Popup Menu</strong><br>
-<em>This menu is visible when right clicking either within a
-selected region on the alignment or on a selected sequence name. It may
-not be accessible when in 'Cursor Mode' (toggled with the F2 key).</em></p>
-<ul>
- <li><strong>Selection</strong>
- <ul>
- <li><strong>Edit </strong>
- <ul>
- <li><strong>Copy</strong><br>
- <em>Copys the selected region. In the applet version, the copied sequences
- are not available to the system clipboard.</em></li>
- <li><strong>Cut<br>
- </strong><em>Cuts the selected region from the alignment. In the applet
- version, the copied sequences are not available to the system clipboard.</em></li>
- <li><strong>Edit Sequence</strong><br>
- <em>Edit the selected sequence(s) directly. Spaces will be converted
- to the current gap character.</em></li>
- <li><strong>To Upper Case</strong><em><strong><br>
- </strong><em>Changes the case of selected region to lower case.</em>
- </em></li>
- <li><strong>To Lower Case<br>
- </strong><em>Changes the case of selected region to upper case.</em><strong>
- </strong></li>
- <li><strong>Toggle Case</strong><br>
- <em>Switches the case of all residues within the selected region.</em></li>
- </ul>
- </li>
- <li><strong>Output to Textbox<br>
- </strong><em>The selection area will be output to a a text window in the
- selected alignment format. </em></li>
- <li><strong><a href="../features/creatinFeatures.html">Create Sequence Feature...</a></strong><br>
- <em>Opens the dialog box for creating sequence features over the currently
- selected region on each selected sequence.</em></li>
- <li><strong>Group</strong><br>
- <em>Group Operations</em>
- <ul>
- <li><strong>Group</strong><em>This is the first entry in the
- menu, and will display the currently selected group's
- name. Selecting it displays a window allowing the name and
- description for this group to be edited. Click OK to set the
- new name and decription, and cancel to leave the existing
- name and description unchanged.</em></li>
- <li><strong>Remove Group<br>
- </strong><em>This will undefine the selected group. </em><strong>
+ <p>
+ <strong>Popup Menu</strong><br> <em>This menu is visible
+ when right clicking either within a selected region on the
+ alignment or on a selected sequence name. It may not be accessible
+ when in 'Cursor Mode' (toggled with the F2 key).</em>
+ </p>
+ <ul>
+ <li><strong>Selection</strong>
+ <ul>
+ <li><a name="sqreport"><strong>Sequence
+ Details...<br>
+ </strong></a><em>(Since Jalview 2.8)<br>Open an <a
+ href="../io/exportseqreport.html"
+ >HTML report containing the annotation and database cross
+ references</a> normally shown in the sequence's tooltip.
+ </em></li>
+ <li><strong>Show Annotations...<br>
+ </strong><em>Choose to show (unhide) either All or a selected type
+ of annotation for the selected sequences. (Since Jalview
+ 2.8.2)</em></li>
+ <li><strong>Hide Annotations...<br>
+ </strong><em>Choose to hide either All or a selected type of
+ annotation for the selected sequences. (Since Jalview 2.8.2)</em></li>
+ <li><a name="addrefannot"><strong>Add
+ Reference Annotations<br>
+ </strong><em>Add to the alignment window any annotations on the
+ selected sequences which have been read from reference
+ sources or calculated (for example, secondary structure
+ derived from 3D structure). (Since Jalview 2.8.2)</em></li>
+ <li><strong>Edit </strong>
+ <ul>
+ <li><strong>Copy</strong><br> <em>Copies the
+ selected region. In the applet version, the copied
+ sequences are not available to the system clipboard.</em></li>
+ <li><strong>Cut<br>
+ </strong><em>Cuts the selected region from the alignment. In the
+ applet version, the copied sequences are not available
+ to the system clipboard.</em></li>
+ <li><strong>Edit Sequence</strong><br> <em>Edit
+ the selected sequence(s) directly. Spaces will be
+ converted to the current gap character.</em></li>
+ <li><strong>To Upper Case</strong><em><strong><br>
+ </strong><em>Changes the case of selected region to lower
+ case.</em> </em></li>
+ <li><strong>To Lower Case<br>
+ </strong><em>Changes the case of selected region to upper case.</em><strong>
</strong></li>
- <li><strong>Group Colour<br>
- </strong><em>Sets the <a href="../colourSchemes/index.html">colour</a>
- of the group.</em><strong> </strong></li>
- <li><strong>Boxes<br>
- </strong><em>If selected the background of a residue within the selected
- group will be coloured according to the assigned colour scheme.</em><strong>
- </strong></li>
- <li><strong>Text<br>
- </strong><em>If selected the selected group will display text. </em></li>
- <li><strong>Colour Text<br>
- </strong><em>If selected the selected group will display text in a
- colour slightly darker than the background colour of that residue.</em></li>
- <li><strong>Border Colour <br>
- </strong><em>Selecting this will display a "Colour Chooser"
- window. Select a colour than press OK to set the border colour of
- a group.</em></li>
- <li><strong>Show Unconserved<br>
- </strong><em>When this is selected, all symbols in the group matching the consensus sequence at that column will be rendered as a '.', highlighting mutations in the group area.
- </em></li>
- </ul>
- </li>
-<!-- not available in 2.5 yet
- <li><strong>Group Links<br>
- </strong><em>This menu is only visible if there are group links available for the current selection.
- </em>
- <ul>
- <li><em>ID links</em> allow you to send IDs associated with the current selection to a web server.</li>
- <li><em>Sequence links</em> allow you to send the sequences in the currently selected region to a web server.</li>
- <li><em>Sequence and ID links</em> allow you to send sets of IDs and sequences associated with the current selection to a web server.</li>
- </ul>
- <em>Group Links were added in Jalview 2.5</em></li>
---> </ul>
- </li>
- <li><strong>Sequence Id<br>
- </strong><em>This menu is only visible if you right-click on a sequence name.
- </em>
- <ul>
- <li><strong>Edit Name/Description<br>
- </strong><em>You may edit the name and description of each sequence. A
- window will be displayed asking for a new sequence name and sequence description
- to be entered. Press OK to accept your edit. To save sequence descriptions,
- you must save in Fasta, PIR or Jalview File format.</em></li>
- <li><em> </em></li>
- <li><strong>Represent Group With (Sequence Id)</strong><br>
- <em>All sequences in the current selection group will be hidden, apart
- from (Sequence Id). Any edits performed on the visible representative
- sequence will be propagated to the hidden sequences. </em></li>
- <li><a name="sqid.popup"><strong>Link</strong><br>
- <em>This menu item lists all links which have been set up in the <a href="../features/preferences.html">Preferences</a>
- Connections tab.<br>
- Since Jalview 2.4, links will also be made for database cross
- references (where the database name exactly matches the link name set up in <a href="../features/preferences.html">Preferences</a>).
- <br>Since Jalview 2.5, links are also shown for non-positional sequence features attached to
- the sequence, and any regular-expression based URL links that
- matched the description line.
- </em><strong><br>
+ <li><strong>Toggle Case</strong><br> <em>Switches
+ the case of all residues within the selected region.</em></li>
+ </ul></li>
+ <li><strong>Output to Textbox<br>
+ </strong><em>The selection area will be output to a a text window in
+ the selected alignment format. </em></li>
+ <li><strong><a
+ href="../features/creatinFeatures.html"
+ >Create Sequence Feature...</a></strong><br> <em>Opens the
+ dialog box for creating sequence features over the currently
+ selected region on each selected sequence.</em></li>
+ <li><strong>Create Group<br>
+ </strong><em>This will define a new group from the current
+ selection.</em><strong> </strong></li>
+ <li><strong>Remove Group<br>
+ </strong><em>This will undefine the selected group. </em><strong>
</strong></li>
- </ul>
- </li>
- <li><strong>Structure</strong>
- </strong><em>This menu is only visible if you right-click on a sequence name.
- </em>
- <ul>
- <li><strong>Associate Structure with Sequence</strong>
- <ul>
- <li><strong>From File<br>
- </strong><em>Load a PDB file from local disk which will be associated
- with this sequence. This file will be used if the user subsequently
- clicks on "View PDB Structure" menu item.</em></li>
- <li><strong>Enter PDB id<br>
- </strong><em>Enter the PDB id from an input window. This PDB id will
- be used by the service WSDBFetch, provided by the EBI, to fetch the
- PDB file if the user subsequently clicks on "View PDB Structure"
- menu item. </em></li>
- <li><strong>Discover PDB ids<br>
- </strong><em>This will use the service WSDBFetch, provided by the
- EBI, to retrieve all PDB ids associated with the sequences in the
- alignment if the sequences have valid Uniprot names or accession ids.
- </em></li>
- </ul>
- </li>
- <li><strong>View Structure<br>
- </strong><em> If the sequence has an associated PDB file added by one
- of the methods described above, Jalview will open a 3D interactive
- view of the file.<br>
- These entries will only be present if the sequence has <a
- href="../features/viewingpdbs.html">associated PDB structures</a>.</em><br>
- </li>
- </ul>
- </li>
- <li><strong>Hide Sequences</strong><br>
- <em>Hides the currently selected sequences in this alignment view.</em><strong><br>
- <br>
+ <li><strong>Edit (New) Group</strong><br> <em>Group
+ Editing Menu</em> <br />Options in this menu modify the name and
+ display properties of the currently selected group, or a new
+ group defined using the current selection.
+ <ul>
+ <li><strong>Name: <Group></strong> or <strong>Edit
+ name and description</strong><br> <em>The first entry
+ in the menu displays the name for the currently selected
+ group, if it has one. Selecting this option opens a
+ window allowing the name and description for this group
+ to be edited. Click OK to set the new name and
+ decription, and cancel to leave the existing name and
+ description unchanged.</em></li>
+ <li><strong>Group Colour<br>
+ </strong><em>Sets the <a href="../colourSchemes/index.html">colour</a>
+ of the group.
+ </em><strong> </strong></li>
+ <li><strong>Boxes<br>
+ </strong><em>If selected the background of a residue within the
+ selected group will be coloured according to the
+ assigned colour scheme.</em><strong> </strong></li>
+ <li><strong>Text<br>
+ </strong><em>If selected the selected group will display text. </em></li>
+ <li><strong>Colour Text<br>
+ </strong><em>If selected the selected group will display text in
+ a colour slightly darker than the background colour of
+ that residue.</em></li>
+ <li><strong>Border Colour <br>
+ </strong><em>Selecting this will display a "Colour
+ Chooser" window. Select a colour than press OK to
+ set the border colour of a group.</em></li>
+ <li><strong>Show Unconserved<br>
+ </strong><em>When this is selected, all symbols in the group
+ matching the consensus sequence at that column will be
+ rendered as a '.', highlighting mutations in the group
+ area. </em></li>
+ </ul></li>
+
+ </ul></li>
+ <li><strong>Sequence Id<br>
+ </strong><em>This menu is only visible if you right-click on a sequence
+ name. </em>
+ <ul>
+ <li><a name="sqreport"><strong>Sequence
+ Details ...<br>
+ </strong></a><em>(Since Jalview 2.8)<br>Open an <a
+ href="../io/exportseqreport.html"
+ >HTML report containing the annotation and database cross
+ references</a> normally shown in the sequence's tooltip.
+ </em></li>
+ <li><strong>Edit Name/Description<br>
+ </strong><em>You may edit the name and description of each sequence.
+ A window will be displayed asking for a new sequence name
+ and sequence description to be entered. Press OK to accept
+ your edit. To save sequence descriptions, you must save in
+ Fasta, PIR or Jalview File format.</em></li>
+ <li><a href="sqaddrefannot"><strong>Add
+ Reference Annotations<br>
+ </strong><em>When enabled, copies any available alignment
+ annotation for this sequence to the current view.</em></li>
+ <li><strong>Set as Reference</strong> or <strong>Unmark
+ as Reference</strong><br /> Sets or unsets the reference sequence for
+ the the alignment.</li>
+
+ <li><strong>Represent Group With (Sequence Id)</strong><br>
+ <em>All sequences in the current selection group will be
+ hidden, apart from (Sequence Id). Any edits performed on the
+ visible representative sequence will be propagated to the
+ hidden sequences. </em></li>
+ <li><a name="sqid.popup"><strong>Link</strong><br>
+ <em>This menu item lists all links which have been set
+ up in the <a href="../features/preferences.html">Preferences</a>
+ Connections tab.<br> Since Jalview 2.4, links will
+ also be made for database cross references (where the
+ database name exactly matches the link name set up in <a
+ href="../features/preferences.html"
+ >Preferences</a>). <br>Since Jalview 2.5, links are also
+ shown for non-positional sequence features attached to the
+ sequence, and any regular-expression based URL links that
+ matched the description line.
+ </em><strong><br> </strong></li>
+ </ul></li>
+ <li><strong>3D Structure Data...</strong> </strong><em>This menu is
+ visible when you right-click on a sequence name. When this
+ option is clicked, Jalview will open a <a
+ href="../features/structurechooser.html"
+ >'Structure Chooser' </a> dialogue with options to select the
+ structure which will eventually be opened in a 3D interactive
+ view.<br> These entries will only be present if the
+ sequence has <a href="../features/viewingpdbs.html">associated
+ PDB structures</a>.
+ </em></li>
+ <li><strong>VARNA 2D Structure</strong><br />
+ <em> If the sequence or alignment has RNA structure, then <strong>VARNA
+ 2D Structure</strong> entries will also be present enabling you to open
+ a linked view of the RNA structure in <a
+ href="../features/varna.html"
+ >VARNA</a>.
+ </em></li>
+ <li><a name="hideinserts"><strong>Hide Insertions</strong></a><br />
+ <em>Hides columns containing gaps in the current sequence or
+ selected region, and reveals columns not including gaps.</em>
+ <li><strong>Hide Sequences</strong><br> <em>Hides the
+ currently selected sequences in this alignment view.</em><strong><br>
</strong></li>
-</ul>
+ </ul>
</body>
</html>
diff --git a/help/html/menus/wsmenu.html b/help/html/menus/wsmenu.html
index fb16551..753f4f6 100644
--- a/help/html/menus/wsmenu.html
+++ b/help/html/menus/wsmenu.html
@@ -1,90 +1,105 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Web Service Menu</title></head>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Web Service Menu</title>
+</head>
<body>
- <p><strong>Web Service Menu</strong><br /> <em>This menu
- is dynamic, and may contain user-defined web service entries in
- addition to any of the following ones:</em>
- <ul>
- <li><strong>Fetch DB References</strong><br> <em>This
- will use any of the database services that Jalview is aware of
- (e.g. DAS sequence servers and the WSDBFetch service provided by
- the EBI) to verify the sequence and retrieve all database cross
- references and PDB ids associated with all or just the selected
- sequences in the alignment. <br />'Standard Databases' will check
- sequences against the EBI databases plus any active DAS sequence
- sources, or you can verify against a specific source from one of
- the sub-menus.</em><br></li>
- <li><strong>Envision2 Services</strong><br /><em> Submits one or
- more sequences, sequence IDs or database references to analysis
- workflows provided by the <a
- href="http://www.ebi.ac.uk/enfin-srv/envision2">EnVision2 web
- application</a>. This allows Jalview users to easily access the EnCore
- network of databases and analysis services developed by members of
- <a href="http://www.enfin.org">ENFIN</a></em>.</li>
- </ul>
- <p>Selecting items from the following submenus will start a
- remote service on compute facilities at the University of Dundee, or
- elsewhere. You need a continuous network connection in order to use
- these services through Jalview.
- </p>
- <ul>
- <li><strong>Alignment</strong><br /><em> Align the currently
- selected sequences or all sequences in the alignment, or re-align
- unaligned sequences to the aligned sequences. Entries in this menu
- provide access to the various alignment programs supported by <a
- href="../webServices/JABAWS.html">JABAWS</a>. See the <a
- href="../webServices/msaclient.html">Multiple Sequence
- Alignment webservice client</a> entry for more information.</em></li>
- <li><strong>Secondary Structure Prediction</strong>
- <ul>
- <li><strong>JPred Secondary Structure Prediction</strong><br>
- <em>Secondary structure prediction by network consensus. See
- the <a href="../webServices/jnet.html">Jpred3</a> client entry for
- more information. The behaviour of this calculation depends on
- the current selection:
- <ul>
- <li>If nothing is selected, and the displayed sequences
- appear to be aligned, then a JNet prediction will be run for
- the first sequence in the alignment, using the current
- alignment. Otherwise the first sequence will be submitted for
- prediction.</li>
- <li>If just one sequence (or a region on one sequence) has
- been selected, it will be submitted to the automatic JNet
- prediction server for homolog detection and prediction.</li>
- <li>If a set of sequences are selected, and they appear to
- be aligned, then the alignment will be used for a Jnet
- prediction on the <strong>first</strong> sequence in the set
- (that is, the one that appears first in the alignment window).
- </li>
- </ul> </em>
- </ul></li>
- <li><strong>Analysis</strong><br />
- <ul>
- <li><strong>Multi-Harmony</strong><br> <em>Performs
- functional residue analysis on a protein family alignment with
- sub-families defined on it. See the <a
- href="../webServices/shmr.html">Multi-Harmony service</a> entry for more
- information.</em>
- </li>
- </ul></li>
- </ul>
+ <p>
+ <strong>Web Service Menu</strong><br /> <em>This menu is
+ dynamic, and may contain user-defined web service entries in
+ addition to any of the following ones:</em>
+ <ul>
+ <li><strong>Fetch DB References</strong><br> <em>This
+ submenu contains options for accessing any of the database
+ services that Jalview is aware of (e.g. DAS sequence servers and
+ the WSDBFetch service provided by the EBI) to verify sequence
+ start/end positions and retrieve all database cross references
+ and PDB ids associated with all or just the selected sequences
+ in the alignment.
+ <ul>
+ <li>'Retrieve full Sequence' - when checked, Jalview will
+ retrieve the full sequence for any accessions associated
+ with sequences in the alignment. <br> <strong>Note:
+ This could cause out of memory errors when working with
+ genomic sequence records !</strong><br> <strong>Added
+ in Jalview 2.8.1</strong>
+ </li>
+ <li>'Standard Databases' will check sequences against the
+ EBI databases plus any active DAS sequence sources<</li>
+ </ul> Other submenus allow you to pick a specific source to query -
+ sources are listed alphabetically according to their nickname.
+ </em></li>
+ </ul>
+ <p>Selecting items from the following submenus will start a remote
+ service on compute facilities at the University of Dundee, or
+ elsewhere. You need a continuous network connection in order to use
+ these services through Jalview.</p>
+ <ul>
+ <li><strong>Alignment</strong><br />
+ <em> Align the currently selected sequences or all sequences in
+ the alignment, or re-align unaligned sequences to the aligned
+ sequences. Entries in this menu provide access to the various
+ alignment programs supported by <a
+ href="../webServices/JABAWS.html"
+ >JABAWS</a>. See the <a href="../webServices/msaclient.html">Multiple
+ Sequence Alignment webservice client</a> entry for more
+ information.
+ </em></li>
+ <li><strong>Secondary Structure Prediction</strong>
+ <ul>
+ <li><strong>JPred Secondary Structure Prediction</strong><br>
+ <em>Secondary structure prediction by network consensus.
+ See the <a href="../webServices/jnet.html">Jpred3</a> client
+ entry for more information. The behaviour of this
+ calculation depends on the current selection:
+ <ul>
+ <li>If nothing is selected, and the displayed
+ sequences appear to be aligned, then a JNet prediction
+ will be run for the first sequence in the alignment,
+ using the current alignment. Otherwise the first
+ sequence will be submitted for prediction.</li>
+ <li>If just one sequence (or a region on one
+ sequence) has been selected, it will be submitted to the
+ automatic JNet prediction server for homolog detection
+ and prediction.</li>
+ <li>If a set of sequences are selected, and they
+ appear to be aligned, then the alignment will be used
+ for a Jnet prediction on the <strong>first</strong>
+ sequence in the set (that is, the one that appears first
+ in the alignment window).
+ </li>
+ </ul>
+ </em>
+ </ul></li>
+ <li><strong>Analysis</strong><br />
+ <ul>
+ <li><strong>Multi-Harmony</strong><br> <em>Performs
+ functional residue analysis on a protein family alignment
+ with sub-families defined on it. See the <a
+ href="../webServices/shmr.html"
+ >Multi-Harmony service</a> entry for more information.
+ </em></li>
+ </ul></li>
+ </ul>
</body>
</html>
diff --git a/help/html/misc/aaproperties.html b/help/html/misc/aaproperties.html
index 3c5221e..88b85b9 100644
--- a/help/html/misc/aaproperties.html
+++ b/help/html/misc/aaproperties.html
@@ -1,31 +1,36 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Amino Acid Properties</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Amino Acid Properties</title>
</head>
-<body><div align="center">
-<h1>Amino Acid Properties</h1>
- <img src="properties.gif">
- <br>
- <table width="295" border="1" cellspacing="0" cellpadding="0">
- <tr>
- <td width="291"><pre><font size="4" face="Courier New, Courier, mono"><strong>ILVCAGMFYWHKREQDNSTPBZX-</strong>
-XXXXXXXXXXX·�·····X···XX Hydrophobic
+<body>
+ <div align="center">
+ <h1>Amino Acid Properties</h1>
+ <img src="properties.gif"> <br>
+ <table width="295" border="1" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="291"><pre>
+ <font size="4" face="Courier New, Courier, mono"><strong>ILVCAGMFYWHKREQDNSTPBZX-</strong>
+XXXXXXXXXXX·······X···XX Hydrophobic
········XXXXXXXXXX·XXXXX Polar
··XXXX·········XXXXX··XX Small
···················X··XX Proline
@@ -34,15 +39,18 @@ XXX·········&midd
·······XXXX···········XX Aromatic
··········XXX·········XX Positive
·············X·X······XX Negative
-··········XXXX·X······XX Charged</font></pre></td>
- </tr>
- </table>
+··········XXXX·X······XX Charged</font>
+ </pre></td>
+ </tr>
+ </table>
</div>
-<p><br>
- From Livingstone, C. D. and Barton, G. J. (1993), <br>
- "Protein Sequence Alignments: A Strategy for the Hierarchical Analysis of Residue
- Conservation", Comp. Appl. Bio. Sci., 9, 745-756. </p>
+ <p>
+ <br> From Livingstone, C. D. and Barton, G. J. (1993), <br>
+ "Protein Sequence Alignments: A Strategy for the Hierarchical
+ Analysis of Residue Conservation", Comp. Appl. Bio. Sci., 9,
+ 745-756.
+ </p>
<br>
-</div>
+ </div>
</body>
</html>
diff --git a/help/html/misc/aminoAcids.html b/help/html/misc/aminoAcids.html
index 494db99..c692586 100644
--- a/help/html/misc/aminoAcids.html
+++ b/help/html/misc/aminoAcids.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Amino Acids</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Amino Acids</title>
<style type="text/css">
<!--
td {
@@ -30,279 +34,244 @@ td {
<body>
-<div align="center">
- <table width="450" BORDER ="1" cellpadding="3" BGCOLOR="#FFFFFF">
- <tr>
- <td width="15">A</td>
- <td width="25">Ala</td>
- <td width="90">Alanine</td>
- <td width="80">aliphatic<br>
- hydrophobic<br>
- neutral </td>
- <td width="43" valign="middle">GCT<br>
- GCC<br>
- GCA<br>
- GCG</td>
- <td width="125"><img src="ala.jpg" width="94" height="81"></td>
- </tr>
- <tr>
- <td>B</td>
- <td> </td>
- <td>either aspartic acid or asparagine</td>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td>C</td>
- <td>Cys</td>
- <td>Cysteine</td>
- <td>polar<br>
- hydrophobic<br>
- neutral </td>
- <td>TGT<br>
- TGC</td>
- <td><img src="cys.jpg" width="82" height="95"></td>
- </tr>
- <tr>
- <td>D</td>
- <td>Asp</td>
- <td>Aspartic Acid</td>
- <td>polar<br>
- hydrophilic<br>
- charged (-) </td>
- <td>GAT<br>
- GAC</td>
- <td><img src="aspartate.jpg" width="95" height="103"></td>
- </tr>
- <tr>
- <td>E</td>
- <td>Glu</td>
- <td>Glutamic Acid</td>
- <td>polar<br>
- hydrophilic<br>
- charged (-) </td>
- <td>GAA<br>
- GAG</td>
- <td><img src="glutamate.jpg" width="93" height="128"></td>
- </tr>
- <tr>
- <td>F</td>
- <td>Phe</td>
- <td>Phenylalanine</td>
- <td>aromatic<br>
- hydrophobic<br>
- neutral</td>
- <td>TTT<br>
- TTC</td>
- <td><img src="phe.jpg" width="87" height="134"></td>
- </tr>
- <tr>
- <td>G</td>
- <td>Gly</td>
- <td>Glycine</td>
- <td> </td>
- <td>GGT<br>
- GGC<br>
- GGA<br>
- GGG</td>
- <td><img src="gly.jpg" width="97" height="79"></td>
- </tr>
- <tr>
- <td>H</td>
- <td>His</td>
- <td>Histidine</td>
- <td>aromatic<br>
- polar<br>
- hydrophilic<br>
- charged (+) </td>
- <td>CAT<br>
- CAC</td>
- <td><img src="his.jpg" width="97" height="142"></td>
- </tr>
- <tr>
- <td>I</td>
- <td>Ile</td>
- <td>Isoleucine</td>
- <td>aliphatic<br>
- hydrophobic<br>
- neutral </td>
- <td>ATT<br>
- ATC<br>
- ATA</td>
- <td><img src="iso.jpg" width="101" height="125"></td>
- </tr>
- <tr>
- <td>K</td>
- <td>Lys</td>
- <td>Lysine</td>
- <td> </td>
- <td>AAA<br>
- AAG</td>
- <td><img src="lys.jpg" width="79" height="167"></td>
- </tr>
- <tr>
- <td>L</td>
- <td>Leu</td>
- <td>Leucine</td>
- <td>aliphatic<br>
- hydrophobic<br>
- neutral </td>
- <td>TTG<br>
- TTA<br>
- CTT<br>
- CTC<br>
- CTA<br>
- CTG</td>
- <td><img src="leu.jpg" width="97" height="120"></td>
- </tr>
- <tr>
- <td>M</td>
- <td>Met</td>
- <td>Methionine</td>
- <td>hydrophobic<br>
- neutral </td>
- <td>ATG</td>
- <td><img src="met.jpg" width="86" height="151"></td>
- </tr>
- <tr>
- <td>N</td>
- <td>Asn</td>
- <td>Asparagine</td>
- <td>polar<br>
- hydrophilic<br>
- neutral </td>
- <td>AAT<br>
- AAC</td>
- <td><img src="asparagine.jpg" width="84" height="116"></td>
- </tr>
- <tr>
- <td>P</td>
- <td>Pro</td>
- <td>Proline</td>
- <td>hydrophobic<br>
- neutral</td>
- <td>CCT<br>
- CCC<br>
- CCA<br>
- CCG</td>
- <td><img src="pro.jpg" width="101" height="90"></td>
- </tr>
- <tr>
- <td>Q</td>
- <td>Gln</td>
- <td>Glutamine</td>
- <td>polar<br>
- hydrophilic<br>
- neutral</td>
- <td>CAA<br>
- CAG</td>
- <td><img src="glutamine.jpg" width="81" height="137"></td>
- </tr>
- <tr>
- <td>R</td>
- <td>Arg</td>
- <td>Arginine</td>
- <td>polar<br>
- hydrophilic<br>
- charged (+) </td>
- <td>CGT<br>
- CGC<br>
- CGA<br>
- CGG<br>
- AGA<br>
- AGG</td>
- <td><img src="arg.jpg" width="95" height="187"></td>
- </tr>
- <tr>
- <td>S</td>
- <td>Ser</td>
- <td>Serine</td>
- <td>polar<br>
- hydrophilic<br>
- neutral </td>
- <td>TCT<br>
- TCC<br>
- TCA<br>
- TCG<br>
- AGT<br>
- AGC</td>
- <td><img src="ser.jpg" width="96" height="74"></td>
- </tr>
- <tr>
- <td>T</td>
- <td>Thr</td>
- <td>Threonine</td>
- <td>polar<br>
- hydrophilic<br>
- neutral </td>
- <td>ACT<br>
- ACC<br>
- ACA<br>
- ACG</td>
- <td><img src="thr.jpg" width="94" height="96"></td>
- </tr>
- <tr>
- <td>V</td>
- <td>Val</td>
- <td>Valine</td>
- <td>aliphatic<br>
- hydrophobic<br>
- neutral </td>
- <td>GTT<br>
- GTC<br>
- GTA<br>
- GTG</td>
- <td><img src="val.jpg" width="99" height="98"></td>
- </tr>
- <tr>
- <td>W</td>
- <td>Trp</td>
- <td>Tryptophan</td>
- <td>aromatic<br>
- hydrophobic<br>
- neutral</td>
- <td>TGG</td>
- <td><img src="tryp.jpg" width="106" height="173"></td>
- </tr>
- <tr>
- <td>X</td>
- <td> </td>
- <td>UNKNOWN</td>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td>Y</td>
- <td>Tyr</td>
- <td>Tyrosine</td>
- <td>aromatic<br>
- polar<br>
- hydrophobic </td>
- <td>TAT<br>
- TAC</td>
- <td><img src="tyr.jpg" width="85" height="152"></td>
- </tr>
- <tr>
- <td>Z</td>
- <td> </td>
- <td>either glutamic acid or glutamine</td>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td>End</td>
- <td>Terminator</td>
- <td> </td>
- <td>TAA<br>
- TAG<br>
- TGA</td>
- <td> </td>
- </tr>
- </table>
+ <div align="center">
+ <table width="450" BORDER="1" cellpadding="3" BGCOLOR="#FFFFFF">
+ <tr>
+ <td width="15">A</td>
+ <td width="25">Ala</td>
+ <td width="90">Alanine</td>
+ <td width="80">aliphatic<br> hydrophobic<br>
+ neutral
+ </td>
+ <td width="43" valign="middle">GCT<br> GCC<br>
+ GCA<br> GCG
+ </td>
+ <td width="125"><img src="ala.jpg" width="94" height="81"></td>
+ </tr>
+ <tr>
+ <td>B</td>
+ <td> </td>
+ <td>either aspartic acid or asparagine</td>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>C</td>
+ <td>Cys</td>
+ <td>Cysteine</td>
+ <td>polar<br> hydrophobic<br> neutral
+ </td>
+ <td>TGT<br> TGC
+ </td>
+ <td><img src="cys.jpg" width="82" height="95"></td>
+ </tr>
+ <tr>
+ <td>D</td>
+ <td>Asp</td>
+ <td>Aspartic Acid</td>
+ <td>polar<br> hydrophilic<br> charged (-)
+ </td>
+ <td>GAT<br> GAC
+ </td>
+ <td><img src="aspartate.jpg" width="95" height="103"></td>
+ </tr>
+ <tr>
+ <td>E</td>
+ <td>Glu</td>
+ <td>Glutamic Acid</td>
+ <td>polar<br> hydrophilic<br> charged (-)
+ </td>
+ <td>GAA<br> GAG
+ </td>
+ <td><img src="glutamate.jpg" width="93" height="128"></td>
+ </tr>
+ <tr>
+ <td>F</td>
+ <td>Phe</td>
+ <td>Phenylalanine</td>
+ <td>aromatic<br> hydrophobic<br> neutral
+ </td>
+ <td>TTT<br> TTC
+ </td>
+ <td><img src="phe.jpg" width="87" height="134"></td>
+ </tr>
+ <tr>
+ <td>G</td>
+ <td>Gly</td>
+ <td>Glycine</td>
+ <td> </td>
+ <td>GGT<br> GGC<br> GGA<br> GGG
+ </td>
+ <td><img src="gly.jpg" width="97" height="79"></td>
+ </tr>
+ <tr>
+ <td>H</td>
+ <td>His</td>
+ <td>Histidine</td>
+ <td>aromatic<br> polar<br> hydrophilic<br>
+ charged (+)
+ </td>
+ <td>CAT<br> CAC
+ </td>
+ <td><img src="his.jpg" width="97" height="142"></td>
+ </tr>
+ <tr>
+ <td>I</td>
+ <td>Ile</td>
+ <td>Isoleucine</td>
+ <td>aliphatic<br> hydrophobic<br> neutral
+ </td>
+ <td>ATT<br> ATC<br> ATA
+ </td>
+ <td><img src="iso.jpg" width="101" height="125"></td>
+ </tr>
+ <tr>
+ <td>K</td>
+ <td>Lys</td>
+ <td>Lysine</td>
+ <td> </td>
+ <td>AAA<br> AAG
+ </td>
+ <td><img src="lys.jpg" width="79" height="167"></td>
+ </tr>
+ <tr>
+ <td>L</td>
+ <td>Leu</td>
+ <td>Leucine</td>
+ <td>aliphatic<br> hydrophobic<br> neutral
+ </td>
+ <td>TTG<br> TTA<br> CTT<br> CTC<br> CTA<br>
+ CTG
+ </td>
+ <td><img src="leu.jpg" width="97" height="120"></td>
+ </tr>
+ <tr>
+ <td>M</td>
+ <td>Met</td>
+ <td>Methionine</td>
+ <td>hydrophobic<br> neutral
+ </td>
+ <td>ATG</td>
+ <td><img src="met.jpg" width="86" height="151"></td>
+ </tr>
+ <tr>
+ <td>N</td>
+ <td>Asn</td>
+ <td>Asparagine</td>
+ <td>polar<br> hydrophilic<br> neutral
+ </td>
+ <td>AAT<br> AAC
+ </td>
+ <td><img src="asparagine.jpg" width="84" height="116"></td>
+ </tr>
+ <tr>
+ <td>P</td>
+ <td>Pro</td>
+ <td>Proline</td>
+ <td>hydrophobic<br> neutral
+ </td>
+ <td>CCT<br> CCC<br> CCA<br> CCG
+ </td>
+ <td><img src="pro.jpg" width="101" height="90"></td>
+ </tr>
+ <tr>
+ <td>Q</td>
+ <td>Gln</td>
+ <td>Glutamine</td>
+ <td>polar<br> hydrophilic<br> neutral
+ </td>
+ <td>CAA<br> CAG
+ </td>
+ <td><img src="glutamine.jpg" width="81" height="137"></td>
+ </tr>
+ <tr>
+ <td>R</td>
+ <td>Arg</td>
+ <td>Arginine</td>
+ <td>polar<br> hydrophilic<br> charged (+)
+ </td>
+ <td>CGT<br> CGC<br> CGA<br> CGG<br> AGA<br>
+ AGG
+ </td>
+ <td><img src="arg.jpg" width="95" height="187"></td>
+ </tr>
+ <tr>
+ <td>S</td>
+ <td>Ser</td>
+ <td>Serine</td>
+ <td>polar<br> hydrophilic<br> neutral
+ </td>
+ <td>TCT<br> TCC<br> TCA<br> TCG<br> AGT<br>
+ AGC
+ </td>
+ <td><img src="ser.jpg" width="96" height="74"></td>
+ </tr>
+ <tr>
+ <td>T</td>
+ <td>Thr</td>
+ <td>Threonine</td>
+ <td>polar<br> hydrophilic<br> neutral
+ </td>
+ <td>ACT<br> ACC<br> ACA<br> ACG
+ </td>
+ <td><img src="thr.jpg" width="94" height="96"></td>
+ </tr>
+ <tr>
+ <td>V</td>
+ <td>Val</td>
+ <td>Valine</td>
+ <td>aliphatic<br> hydrophobic<br> neutral
+ </td>
+ <td>GTT<br> GTC<br> GTA<br> GTG
+ </td>
+ <td><img src="val.jpg" width="99" height="98"></td>
+ </tr>
+ <tr>
+ <td>W</td>
+ <td>Trp</td>
+ <td>Tryptophan</td>
+ <td>aromatic<br> hydrophobic<br> neutral
+ </td>
+ <td>TGG</td>
+ <td><img src="tryp.jpg" width="106" height="173"></td>
+ </tr>
+ <tr>
+ <td>X</td>
+ <td> </td>
+ <td>UNKNOWN</td>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>Y</td>
+ <td>Tyr</td>
+ <td>Tyrosine</td>
+ <td>aromatic<br> polar<br> hydrophobic
+ </td>
+ <td>TAT<br> TAC
+ </td>
+ <td><img src="tyr.jpg" width="85" height="152"></td>
+ </tr>
+ <tr>
+ <td>Z</td>
+ <td> </td>
+ <td>either glutamic acid or glutamine</td>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td>End</td>
+ <td>Terminator</td>
+ <td> </td>
+ <td>TAA<br> TAG<br> TGA
+ </td>
+ <td> </td>
+ </tr>
+ </table>
</div>
</body>
</html>
diff --git a/help/html/misc/geneticCode.html b/help/html/misc/geneticCode.html
index a57bc0a..fdcb06e 100644
--- a/help/html/misc/geneticCode.html
+++ b/help/html/misc/geneticCode.html
@@ -1,22 +1,26 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head><title>Genetic Code</title>
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Genetic Code</title>
<style type="text/css">
<!--
td {
@@ -29,64 +33,83 @@ td {
<body>
-<div align="center">
- <h2>The Genetic Code </h2>
- <table width="474" border="0">
- <tr>
- <td width="16%"> </td>
- <td width="70%">2nd Position</td>
- <td width="14%"> </td>
- </tr>
- <tr>
- <td><p>1st Position</p>
- <p>(5' end)</p></td>
- <td><table border=1 cellpadding=3>
- <tr align=center bgcolor="#FFFFEE">
- <td width="24"></td>
- <td width="55"><h2>U</h2></td>
- <td width="70"><h2>C</h2></td>
- <td width="55"><h2>A</h2></td>
- <td width="55"><h2>G</h2></td>
- <td width="22"></td>
- </tr>
- <tr align=center bgcolor="#FFFFEE">
- <td><h1>U</h1></td>
- <td>Phe<br>Phe<br>Leu<br>Leu</td>
- <td>Ser<br>Ser<br>Ser<br>Ser</td>
- <td>Tyr<br>Tyr<br>STOP</i><br>STOP</i></td>
- <td>Cys<br>Cys<br>STOP</i><br>Trp</td>
+ <div align="center">
+ <h2>The Genetic Code</h2>
+ <table width="474" border="0">
+ <tr>
+ <td width="16%"> </td>
+ <td width="70%">2nd Position</td>
+ <td width="14%"> </td>
+ </tr>
+ <tr>
+ <td><p>1st Position</p>
+ <p>(5' end)</p></td>
+ <td><table border=1 cellpadding=3>
+ <tr align=center bgcolor="#FFFFEE">
+ <td width="24"></td>
+ <td width="55"><h2>U</h2></td>
+ <td width="70"><h2>C</h2></td>
+ <td width="55"><h2>A</h2></td>
+ <td width="55"><h2>G</h2></td>
+ <td width="22"></td>
+ </tr>
+ <tr align=center bgcolor="#FFFFEE">
+ <td><h1>U</h1></td>
+ <td>Phe<br>Phe<br>Leu<br>Leu
+ </td>
+ <td>Ser<br>Ser<br>Ser<br>Ser
+ </td>
+ <td>Tyr<br>Tyr<br>STOP</i><br>STOP</i></td>
+ <td>Cys<br>Cys<br>STOP</i><br>Trp
+ </td>
- <td>U<br>C<br>A<br>G</td>
- </tr>
- <tr bgcolor="#FFFFEE">
- <td><h1>C</h1></td>
- <td>Leu<br>Leu<br>Leu<br>Leu</td>
- <td>Pro<br>Pro<br>Pro<br>Pro</td>
- <td>His<br>His<br>Gln<br>Gln</td>
- <td>Arg<br>Arg<br>Arg<br>Arg</td>
- <td>U<br>C<br>A<br>G</td>
- </tr>
- <tr bgcolor="#FFFFEE">
- <td><h1>A</h1></td>
- <td>Ile<br>Ile<br>Ile<br>Met</td>
- <td>Thr<br>Thr<br>Thr<br>Thr</td>
- <td>Asn<br>Asn<br>Lys<br>Lys</td>
- <td>Ser<br>Ser<br>Arg<br>Arg</td>
- <td>U<br>C<br>A<br>G</td>
- </tr>
- <tr bgcolor="#FFFFEE">
- <td><h1>G</h1></td>
- <td>Val<br>Val<br>Val<br>Val</td>
- <td>Ala<br>Ala<br>Ala<br>Ala</td>
- <td>Asp<br>Asp<br>Glu<br>Glu</td>
- <td>Gly<br>Gly<br>Gly<br>Gly</td>
- <td>U<br>C<br>A<br>G</td>
- </tr>
- </table></td>
- <td><p>3rd Position</p>
- <p>(3'end)</p></td>
- </tr>
- </table>
-</div>
+ <td>U<br>C<br>A<br>G
+ </td>
+ </tr>
+ <tr bgcolor="#FFFFEE">
+ <td><h1>C</h1></td>
+ <td>Leu<br>Leu<br>Leu<br>Leu
+ </td>
+ <td>Pro<br>Pro<br>Pro<br>Pro
+ </td>
+ <td>His<br>His<br>Gln<br>Gln
+ </td>
+ <td>Arg<br>Arg<br>Arg<br>Arg
+ </td>
+ <td>U<br>C<br>A<br>G
+ </td>
+ </tr>
+ <tr bgcolor="#FFFFEE">
+ <td><h1>A</h1></td>
+ <td>Ile<br>Ile<br>Ile<br>Met
+ </td>
+ <td>Thr<br>Thr<br>Thr<br>Thr
+ </td>
+ <td>Asn<br>Asn<br>Lys<br>Lys
+ </td>
+ <td>Ser<br>Ser<br>Arg<br>Arg
+ </td>
+ <td>U<br>C<br>A<br>G
+ </td>
+ </tr>
+ <tr bgcolor="#FFFFEE">
+ <td><h1>G</h1></td>
+ <td>Val<br>Val<br>Val<br>Val
+ </td>
+ <td>Ala<br>Ala<br>Ala<br>Ala
+ </td>
+ <td>Asp<br>Asp<br>Glu<br>Glu
+ </td>
+ <td>Gly<br>Gly<br>Gly<br>Gly
+ </td>
+ <td>U<br>C<br>A<br>G
+ </td>
+ </tr>
+ </table></td>
+ <td><p>3rd Position</p>
+ <p>(3'end)</p></td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
diff --git a/help/html/na/index.html b/help/html/na/index.html
new file mode 100644
index 0000000..956307b
--- /dev/null
+++ b/help/html/na/index.html
@@ -0,0 +1,124 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Nucleic Acid Support</title>
+<style type="text/css">
+<!--
+td {
+ font-family: "Courier New", Courier, mono;
+ font-style: normal;
+ font-size: medium;
+}
+-->
+</style>
+</head>
+<body>
+ <p>
+ <strong>Nucleic Acid Support</strong>
+ </p>
+ <p>
+ <em>Colour Schemes</em>
+ </p>
+ <p>Jalview has color schemes for nucleic acid based sequences,
+ ability to fetch sequences from RFAM and RNA secondary structure
+ coloring</p>
+ <p>
+ Information on the <a href="../colourSchemes/nucleotide.html">Nucleotide
+ colour scheme</a> and <a href="../colourSchemes/purinepyrimidine.html">
+ Purine/Pyrimidine colour scheme</a> are available under the Colour
+ Menu. See <a href="../colourSchemes/index.html">Colour Schemes</a>.
+ </p>
+ <p>
+ <em>RNA Support</em>
+ </p>
+ Jalview supports annotation of RNA sequences with secondary structure
+ information. You can interactively
+ <a href="../features/annotation.html#rna">create and edit RNA
+ secondary structure annotation rows</a>, or import data in the following
+ way:
+ <ul>
+ <li><em>RFAM</em> - Sequences can be <a
+ href="../features/seqfetch.html"
+ >fetched</a> from the RFAM database by accession number or ID.</li>
+ <li><em>Stockholm files</em> - WUSS (or VIENNA) dot-bracket
+ notation found in the secondary structure annotation line will be
+ imported as sequence or alignment associated secondary structure
+ annotation.</li>
+ <li><em>Clustal files</em> - certain RNA alignment programs,
+ such as <a
+ href="http://rna.informatik.uni-freiburg.de:8080/LocARNA.jsp"
+ >LocaRNA</a> output consensus RNA secondary structure lines in the
+ line normally reserved for the Clustal consensus line in a clustal
+ file.</li>
+ <li><em>RNAML</em> Jalview can import RNAML files containing
+ sequences and extended secondary structure annotation derived from
+ RNA 3D structure</li>
+ </ul>
+ <p>
+ <strong>RNA Secondary Structure Visualization and Analysis</strong><br />
+ If a sequence or RNA alignment has secondary structure information,
+ the alignment will have a secondary structure line shown below it,
+ and a number of additional options become available:
+ <ul>
+ <li><a href="../colourschemes/rnaHelicesColouring.html">RNA
+ Helix colouring</a> - highlights columns of alignment involved in
+ particular RNA helices, Uses the first displayed secondary
+ structure annotation.</li>
+ <li><a href="../calculations/structureconsensus.html">Base
+ Pair Conservation Analysis</a> - shown as a histogram and base-pair
+ logo below the alignment. Uses the first displayed secondary
+ structure annotation row.</li>
+ <li><a href="../features/varna.html">2D Structure
+ Visualization in VARNA</a> - allows linked viewing of the consensus
+ or an individual sequence's structure. Accessed via the Sequence
+ ID popup menu.</li>
+ <li><strong>per sequence secondary structure
+ annotation</strong><br /> Sequence associated secondary structure
+ annotation imported via stockholm, PDB files, or other sources can
+ be shown on the alignment with the <strong>Colours→By
+ Annotation</strong> dialog box. Colours are assigned according to RNA
+ helix topology number (number of distinct nested helices).
+ Alignments can also be sorted by RNA helix secondary structure
+ topology number, <em>via</em> the <strong>Calculations→Sort→By
+ Annotation→Secondary Structure</strong> option (only present when
+ per-sequence secondary structure is available).</li>
+ </ul>
+ <p>
+ <strong>Pseudo-knots</strong><br /> Jalview 2.8.2 introduced limited
+ support for working with structures including pseudoknots. Where
+ possible, extended WUSS symbols (e.g. different types of
+ parentheses, or upper and lower case letters) are preserved when
+ parsing RNA structure annotation and will be shaded differently when
+ displayed in the structure.<br /> Extended WUSS annotation is also
+ employed to distinguish different base pair interactions obtained
+ from RNAML files.
+ </p>
+
+ <p>
+ <strong>Limitations when working with RNA in Jalview</strong><br />
+ Currently, Jalview is not able to export RNA secondary structure
+ annotation in any format other than Jalview annotation </br> <em>Jalview's
+ RNA handling capabilities were introduced in v2.8</em>
+ </p>
+ <p align="center"> </p>
+</body>
+</html>
diff --git a/help/html/privacy.html b/help/html/privacy.html
index b1e12c2..b6bd728 100644
--- a/help/html/privacy.html
+++ b/help/html/privacy.html
@@ -1,76 +1,87 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Jalview Privacy Statement</title>
</head>
<body>
-<p><strong>Privacy for Jalview Users</strong><br>
-<p>The Jalview Desktop application which is available from the
-www.jalview.org site does not contain code designed collect personal or
-private information without your consent. However, we do collect usage
-statistics to work out who is using Jalview, so we can apply for funding
-to support Jalview development, and make it better for our users.</p>
-<p>Usage data is collected from the logs of various web services that the Jalview Desktop contacts through its normal operation.
-These are described below:</p>
-<ul>
- <li><em>HTTP logs on the Jalview website</em><br>
- We record IP addresses of machines which access the web site, either
- via the browser when downloading the application, or when the Jalview
- Desktop user interface is launched.<br><br>
- <ul>
- <li><i>The JNLP file at www.jalview.org/webstart/jalview.jnlp
- is retrieved to determine if you are running the latest version of
- Jalview.</i></li>
- <li><i>The questionnaire web service at
- www.jalview.org/cgi-bin/questionnaire.pl is checked and a unique
- cookie for the current questionnaire is stored in the Jalview
- properties file.</i></li>
- <li><i>The Jalview web services stack is contacted to
- retrieve the currently available web services. All interactions with
- the public jalview web services are logged, but we delete all job data
- (input data and results) after about two weeks.</i></li>
- </ul><br>
- </li>
- <li><em>Google Analytics</em><br>
- Since jalview 2.4.0b2, the Jalview Desktop records usage data with
- Google Analytics via the <a
- href="http://code.google.com/p/jgoogleanalytics/">JGoogleAnalytics</a>
- class.<br>
- The Google Analytics logs for Jalview version 2.4 only record the fact
- that the application was started, but in the future, we will use this
- mechanism to improve the Desktop user interface, by tracking which
- parts of the user interface are being used most often.</li>
-</ul>
-</p>
-<p><strong>Stopping Jalview from calling home</strong><br>
-If you run Jalview in 'headless mode' via the command line, then the
-program shouldn't try to contact any of the web servers mentioned above
-(if it does, then it's a bug!). You can also specify some <a
- href="features/commandline.html">command line options</a> to disable
-the questionnaire and usage statistics check. Finally, the <a
- href="features/preferences.html#connections">Connections Tab</a> of the
-jalview preferences contains options for controlling the submission of
-usage statistics.
-<p><strong>Other Web Clients in Jalview</strong><br>
-The Jalview desktop is intended to make it easier to interact with
-web-based bioinformatics resources. However, we can't take any
-responsibility for the integrity of any external services you might
-access via the program. Sorry!</p>
+ <p>
+ <strong>Privacy for Jalview Users</strong><br>
+ <p>The Jalview Desktop application which is available from the
+ www.jalview.org site does not contain code designed to collect
+ personal or private information without your consent. However, we do
+ collect usage statistics to work out who is using Jalview, so we can
+ apply for funding to support Jalview development, and make it better
+ for our users.</p>
+ <p>Usage data is collected from the logs of various web services
+ that the Jalview Desktop contacts through its normal operation.
+ These are described below:</p>
+ <ul>
+ <li><em>HTTP logs on the Jalview website</em><br> We
+ record IP addresses of machines which access the web site, either
+ via the browser when downloading the application, or when the
+ Jalview Desktop user interface is launched.<br>
+ <br>
+ <ul>
+ <li><i>The JNLP file at
+ www.jalview.org/webstart/jalview.jnlp is retrieved to
+ determine if you are running the latest version of Jalview.</i></li>
+ <li><i>The questionnaire web service at
+ www.jalview.org/cgi-bin/questionnaire.pl is checked and a
+ unique cookie for the current questionnaire is stored in the
+ Jalview properties file.</i></li>
+ <li><i>The Jalview web services stack is contacted to
+ retrieve the currently available web services. All
+ interactions with the public Jalview web services are
+ logged, but we delete all job data (input data and results)
+ after about two weeks.</i></li>
+ </ul>
+ <br></li>
+ <li><em>Google Analytics</em><br> Since Jalview 2.4.0b2,
+ the Jalview Desktop records usage data with Google Analytics via
+ the <a href="http://code.google.com/p/jgoogleanalytics/">JGoogleAnalytics</a>
+ class.<br> The Google Analytics logs for Jalview version 2.4
+ only record the fact that the application was started, but in the
+ future, we will use this mechanism to improve the Desktop user
+ interface, by tracking which parts of the user interface are being
+ used most often.</li>
+ </ul>
+ </p>
+ <p>
+ <strong>Stopping Jalview from calling home</strong><br> If you
+ run Jalview in 'headless mode' via the command line, then the
+ program shouldn't try to contact any of the web servers mentioned
+ above (if it does, then it's a bug!). You can also specify some <a
+ href="features/commandline.html"
+ >command line options</a> to disable the questionnaire and usage
+ statistics check. Finally, the <a
+ href="features/preferences.html#connections"
+ >Connections Tab</a> of the Jalview preferences contains options for
+ controlling the submission of usage statistics.
+ <p>
+ <strong>Other Web Clients in Jalview</strong><br> The Jalview
+ desktop is intended to make it easier to interact with web-based
+ bioinformatics resources. However, we can't take any responsibility
+ for the integrity of any external services you might access via the
+ program. Sorry!
+ </p>
</body>
</html>
diff --git a/help/html/releases.html b/help/html/releases.html
index 88bd1dc..7fc0939 100644
--- a/help/html/releases.html
+++ b/help/html/releases.html
@@ -1,1139 +1,2035 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Release History</title>
</head>
<body>
-<p><strong>Release History</strong></p>
-<table border="1">
- <tr>
- <td width="60" nowrap>
- <div align="center"><em><strong>Release</strong></em></div>
- </td>
- <td>
- <div align="center"><em><strong>New Features</strong></em></div>
- </td>
- <td>
- <div align="center"><em><strong>Issues Resolved</strong></em></div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">
- <strong><a name="Jalview2.7">2.7</a>
- </strong><br> <em>27/09/2011</em>
- </div></td>
- <td><em>Application</em>
- <ul>
- <li>Jalview Desktop News Reader</li>
- <li>Tweaked default layout of web services menu</li>
- <li>View/alignment association menu to enable user to easily
- specify which alignment a multi-structure view takes its
- colours/correspondences from</li>
- <li>Allow properties file location to be specified as URL </li>
- <li>Extend jalview project to preserve associations between
- many alignment views and a single Jmol display</li>
- <li>Store annotation row height in jalview project file</li>
- <li>Annotation row column label formatting attributes stored
- in project file</li>
- <li>Annotation row order for auto-calculated annotation rows
- preserved in jalview project file</li>
- <li>Visual progress indication when Jalview state is saved
- using Desktop window menu</li>
- <li>Visual indication that command line arguments are still
- being processed</li>
- <li>Groovy script execution from URL</li>
- <li>Colour by annotation default min and max colours in
- preferences</li>
- <li>Automatically associate PDB files dragged onto an
- alignment with sequences that have high similarity and matching
- IDs</li>
- <li>Update JGoogleAnalytics to latest release (0.3)</li>
- <li>'view structures' option to open many structures
- in same window</li>
- <li>Sort associated views menu option for tree panel</li>
- <li>Group all JABA and non-JABA services for a particular
- analysis function in its own submenu</li>
- </ul> <em>Applet</em>
- <ul>
- <li>Userdefined and autogenerated annotation rows for groups</li>
- <li>Adjustment of alignment annotation pane height</li>
- <li>Annotation scrollbar for annotation panel</li>
- <li>Drag to reorder annotation rows in annotation panel</li>
- <li>'automaticScrolling' parameter</li>
- <li>Allow sequences with partial ID string matches to be
- annotated from GFF/jalview features files</li>
- <li>Sequence logo annotation row in applet</li>
- <li>Absolute paths relative to host server in applet
- parameters are treated as such</li>
- <li>New in the JalviewLite javascript API:
- <ul>
- <li>JalviewLite.js javascript library</li>
- <li>Javascript callbacks for
- <ul>
- <li>Applet initialisation</li>
- <li>Sequence/alignment mouse-overs and selections</li>
- </ul>
- </li>
- <li>scrollTo row and column alignment scrolling functions</li>
- <li>Select sequence/alignment regions from javascript</li>
- <li>javascript structure viewer harness to pass messages
- between Jmol and Jalview when running as distinct applets</li>
- <li>sortBy method</li>
- <li>Set of applet and application examples shipped with
- documentation</li>
- <li>New example to demonstrate jalviewLite and Jmol
- javascript message exchange</li>
- </ul>
- </ul> <em>General</em>
- <ul>
- <li>Enable Jmol displays to be associated with multiple
- multiple alignments</li>
- <li>Option to automatically sort alignment with new tree</li>
- <li>User configurable link to enable redirects to a
- www.jalview.org mirror</li>
- <li>Jmol colours option for Jmol displays</li>
- <li>Configurable newline string when writing alignment and
- other flat files</li>
- <li>Allow alignment annotation description lines to contain
- html tags</li>
- </ul> <em>Documentation and Development</em>
- <ul>
- <li>Add groovy test harness for bulk load testing to examples
- </li>
- <li>Groovy script to load and align a set of sequences using a
- web service before displaying the result in the Jalview desktop</li>
- <li>Restructured javascript and applet api documentation</li>
- <li>Ant target to publish example html files with applet archive</li>
- <li>Netbeans project for building jalview from source</li>
- <li>ant task to create online javadoc for jalview source</li>
- </ul></td>
- <td><em>Application</em>
- <ul>
- <li>User defined colourscheme throws exception when current
- built in colourscheme is saved as new scheme</li>
- <li>AlignFrame->Save in application pops up save dialog for
- valid filename/format</li>
- <li>Cannot view associated structure for Uniprot sequence</li>
- <li>PDB file association breaks for Uniprot sequence P37173</li>
- <li>Associate PDB from file dialog does not tell you which
- sequence is to be associated with the file</li>
- <li>Find All raises null pointer exception when query only
- matches sequence IDs</li>
- <li>Pre 2.6 Jalview project cannot be loaded into v2.6</li>
- <li>Jalview project with Jmol views created with Jalview 2.4
- cannot be loaded</li>
- <li>Filetype associations not installed for webstart launch</li>
- <li>Two or more chains in a single PDB file associated with
- sequences in different alignments do not get coloured by their
- associated sequence</li>
- <li>Visibility status of autocalculated annotation row not
- preserved when project is loaded</li>
- <li>Annotation row height and visibility attributes not stored
- in jalview project</li>
- <li>Tree bootstraps are not preserved when saved as a jalview
- project</li>
- <li>Envision2 workflow tooltips are corrupted</li>
- <li>Enabling show group conservation also enables colour by
- conservation</li>
- <li>Duplicate group associated conservation or consensus
- created on new view</li>
- <li>Annotation scrollbar not displayed after 'show all
- hidden annotation rows' option selected</li>
- <li>Alignment quality not updated after alignment annotation
- row is hidden then shown</li>
- <li>Preserve colouring of structures coloured by sequences in pre
- jalview 2.7 projects</li>
- <li>Web service job parameter dialog is not laid out properly
- </li>
- <li>Web services menu not refreshed after 'reset
- services' button is pressed in preferences</li>
- <li>Annotation off by one in jalview v2_3 example project</li>
- <li>Structures imported from file and saved in project get
- name like jalview_pdb1234.txt when reloaded</li>
- <li>Jalview does not always retrieve progress of a JABAWS job
- execution in full once it is complete</li>
- </ul> <em>Applet</em>
+ <p>
+ <strong>Release History</strong>
+ </p>
+ <table border="1">
+ <tr>
+ <td width="60" nowrap>
+ <div align="center">
+ <em><strong>Release</strong></em>
+ </div>
+ </td>
+ <td>
+ <div align="center">
+ <em><strong>New Features</strong></em>
+ </div>
+ </td>
+ <td>
+ <div align="center">
+ <em><strong>Issues Resolved</strong></em>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td><div align="center">
+ <strong><a name="Jalview.2.9">2.9</a><br /> <em>10/9/2015</em></strong>
+ </div></td>
+ <td><em>General</em>
+ <ul>
+ <li>Linked visualisation and analysis of DNA and Protein
+ alignments:
+ <ul>
+ <li>Translated cDNA alignments shown as split protein
+ and DNA alignment views</li>
+ <li>Codon consensus annotation for linked protein and
+ cDNA alignment views</li>
+ <li>Link cDNA or Protein product sequences by loading
+ them onto Protein or cDNA alignments</li>
+ <li>Reconstruct linked cDNA alignment from aligned
+ protein sequences</li>
+ </ul>
+ </li>
+ <li>Jmol integration updated to Jmol v14.2.14</li>
+ <li>Import and export of Jalview alignment views as <a
+ href="features/bioJsonFormat.html">BioJSON</a></li>
+ <li>New alignment annotation file statements for
+ reference sequences and marking hidden columns</li>
+ <li>Reference sequence based alignment shading to
+ highlight variation</li>
+ <li>Select or hide columns according to alignment
+ annotation</li>
+ <li>Find option for locating sequences by description</li>
+ <li>Conserved physicochemical properties shown in amino
+ acid conservation row</li>
+ <li>Alignments can be sorted by number of RNA helices</li>
+ </ul> <em>Application</em>
+ <ul>
+ <li>New cDNA/Protein analysis capabilities
+ <ul>
+ <li>Get Cross-References should open a Split Frame
+ view with cDNA/Protein</li>
+ <li>Detect when nucleotide sequences and protein
+ sequences are placed in the same alignment</li>
+ <li>Split cDNA/Protein views are saved in Jalview
+ projects</li>
+ </ul>
+ </li>
+
+ <li>Use REST API to talk to Chimera</li>
+ <li>Selected regions in Chimera are highlighted in linked
+ Jalview windows</li>
+
+ <li>VARNA RNA viewer updated to v3.93</li>
+ <li>VARNA views are saved in Jalview Projects</li>
+ <li>Pseudoknots displayed as Jalview RNA annotation can
+ be shown in VARNA</li>
+
+ <li>Make groups for selection uses marked columns as well
+ as the active selected region</li>
+
+ <li>Calculate UPGMA and NJ trees using sequence feature
+ similarity</li>
+ <li>New Export options
+ <ul>
+ <li>New Export Settings dialog to control hidden
+ region export in flat file generation</li>
+
+ <li>Export alignment views for display with the <a
+ href="http://biojs.io/d/msa">BioJS MSAViewer</a></li>
+
+ <li>Export scrollable SVG in HTML page</li>
+ <li>Optional embedding of BioJSON data when exporting
+ alignment figures to HTML</li>
+ </li>
+ <li>3D structure retrieval and display
+ <ul>
+ <li>Free text and structured queries with the PDBe
+ Search API</li>
+ <li>PDBe Search API based discovery and selection of
+ PDB structures for a sequence set</li>
+ </ul>
+ </li>
+
+ <li>JPred4 employed for protein secondary structure
+ predictions</li>
+ <li>Hide Insertions menu option to hide unaligned columns
+ for one or a group of sequences</li>
+ <li>Automatically hide insertions in alignments imported
+ from the JPred4 web server</li>
+ <li>(Nearly) Native 'Quaqua' dialogs for browsing file
+ system on OSX<br />LGPL libraries courtesy of <a
+ href="http://www.randelshofer.ch/quaqua/">http://www.randelshofer.ch/quaqua/</a>
+ </li>
+ <li>changed 'View nucleotide structure' submenu to 'View
+ VARNA 2D Structure'</li>
+ <li>change "View protein structure" menu option to "3D
+ Structure ..."</li>
+
+ </ul> <em>Applet</em>
+ <ul>
+ <li>New layout for applet example pages</li>
+ <li>New parameters to enable SplitFrame view
+ (file2,enableSplitFrame, scaleProteinAsCdna)</li>
+ <li>New example demonstrating linked viewing of cDNA and
+ Protein alignments</li>
+ </ul> <em>Development and deployment</em>
+ <ul>
+ <li>Java 1.7 minimum requirement for Jalview 2.9</li>
+ <li>Include installation type and git revision in build
+ properties and console log output</li>
+ <li>Jalview Github organisation, and new github site for
+ storing BioJsMSA Templates</li>
+ <li>Jalview's unit tests now managed with TestNG</li>
+ </ul></td>
+ <td>
+ <!-- <em>General</em>
+ <ul>
+ </ul> --> <!-- issues resolved --> <em>Application</em>
+ <ul>
+ <li>Escape should close any open find dialogs</li>
+ <li>Typo in select-by-features status report</li>
+ <li>Consensus RNA secondary secondary structure
+ predictions are not highlighted in amber</li>
+ <li>Missing gap character in v2.7 example file means
+ alignment appears unaligned when pad-gaps is not enabled</li>
+ <li>First switch to RNA Helices colouring doesn't colour
+ associated structure views</li>
+ <li>ID width preference option is greyed out when auto
+ width checkbox not enabled</li>
+ <li>Stopped a warning dialog from being shown when
+ creating user defined colours</li>
+ <li>'View Mapping' in structure viewer shows sequence
+ mappings for just that viewer's sequences</li>
+ <li>Workaround for superposing PDB files containing
+ multiple models in Chimera</li>
+ <li>Report sequence position in status bar when hovering
+ over Jmol structure</li>
+ <li>Cannot output gaps as '.' symbols with Selection ->
+ output to text box</li>
+ <li>Flat file exports of alignments with hidden columns
+ have incorrect sequence start/end</li>
+ <li>'Aligning' a second chain to a Chimera structure from
+ Jalview fails</li>
+ <li>Colour schemes applied to structure viewers don't
+ work for nucleotide</li>
+ <li>Loading/cut'n'pasting an empty or invalid file leads
+ to a grey/invisible alignment window</li>
+ <li>Exported Jpred annotation from a sequence region
+ imports to different position</li>
+ <li>Space at beginning of sequence feature tooltips shown
+ on some platforms</li>
+ <li>Chimera viewer 'View | Show Chain' menu is not
+ populated</li>
+ <li>'New View' fails with a Null Pointer Exception in
+ console if Chimera has been opened</li>
+ <li>Mouseover to Chimera not working</li>
+ <li>Miscellaneous ENA XML feature qualifiers not
+ retrieved</li>
+ <li>NPE in annotation renderer after 'Extract Scores'</li>
+ <li>If two structures in one Chimera window, mouseover of
+ either sequence shows on first structure</li>
+ <li>'Show annotations' options should not make
+ non-positional annotations visible</li>
+ <li>Subsequence secondary structure annotation not shown
+ in right place after 'view flanking regions'</li>
+ <li>File Save As type unset when current file format is
+ unknown</li>
+ <li>Save as '.jar' option removed for saving Jalview
+ projects</li>
+ <li>Colour by Sequence colouring in Chimera more
+ responsive</li>
+ <li>Cannot 'add reference annotation' for a sequence in
+ several views on same alignment</li>
+ <li>Cannot show linked products for EMBL / ENA records</li>
+ <li>Jalview's tooltip wraps long texts containing no
+ spaces</li>
+ </ul> <em>Applet</em>
+ <ul>
+ <li>Jmol to JalviewLite mouseover/link not working</li>
+ <li>JalviewLite can't import sequences with ID
+ descriptions containing angle brackets</li>
+ </ul> <em>General</em>
+ <ul>
+ <li>Cannot export and reimport RNA secondary structure
+ via jalview annotation file</li>
+ <li>Random helix colour palette for colour by annotation
+ with RNA secondary structure</li>
+ <li>Mouseover to cDNA from STOP residue in protein
+ translation doesn't work.</li>
+ <li>hints when using the select by annotation dialog box</li>
+ <li>Jmol alignment incorrect if PDB file has alternate CA
+ positions</li>
+ <li>FontChooser message dialog appears to hang after
+ choosing 1pt font</li>
+ <li>Peptide secondary structure incorrectly imported from
+ annotation file when annotation display text includes 'e' or
+ 'h'</li>
+ <li>Cannot set colour of new feature type whilst creating
+ new feature</li>
+ <li>cDNA translation alignment should not be sequence
+ order dependent</li>
+ <li>'Show unconserved' doesn't work for lower case
+ sequences</li>
+ <li>Nucleotide ambiguity codes involving R not recognised</li>
+ </ul> <em>Deployment and Documentation</em>
+ <ul>
+ <li>Applet example pages appear different to the rest of
+ www.jalview.org</li>
+ </ul> <em>Application Known issues</em>
+ <ul>
+ <li>Incomplete sequence extracted from PDB entry 3a6s</li>
+ <li>Misleading message appears after trying to delete
+ solid column.</li>
+ <li>Jalview icon not shown in dock after InstallAnywhere
+ version launches</li>
+ <li>Fetching EMBL reference for an RNA sequence results
+ fails with a sequence mismatch</li>
+ <li>Corrupted or unreadable alignment display when
+ scrolling alignment to right</li>
+ <li>ArrayIndexOutOfBoundsException thrown when remove
+ empty columns called on alignment with ragged gapped ends</li>
+ <li>auto calculated alignment annotation rows do not get
+ placed above or below non-autocalculated rows</li>
+ <li>Jalview dekstop becomes sluggish at full screen in
+ ultra-high resolution</li>
+ <li>Cannot disable consensus calculation independently of
+ quality and conservation</li>
+ <li>Mouseover highlighting between cDNA and protein can
+ become sluggish with more than one splitframe shown</li>
+ </ul> <em>Applet Known Issues</em>
+ <ul>
+ <li>Core PDB parsing code requires Jmol</li>
+ <li>Sequence canvas panel goes white when alignment
+ window is being resized</li>
+
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td width="60" nowrap>
+ <div align="center">
+ <strong><a name="Jalview.2.8.2b1">2.8.2b1</a><br />
+ <em>15/12/2014</em></strong>
+ </div>
+ </td>
+ <td>
+ <div align="center"></div>
+ </td>
+ <td>
+ <div align="center">
+ <ul>
+ <li>Reinstated the display of default example file on
+ startup</li>
+ <li>All pairs shown in Jalview window when viewing
+ result of pairwise alignment</li>
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td><div align="center">
+ <strong><a name="Jalview.2.8.2">2.8.2</a><br /> <em>3/12/2014</em></strong>
+ </div></td>
+ <td><em>General</em>
+ <ul>
+ <li>Updated Java code signing certificate donated by
+ Certum.PL.</li>
+ <li>Features and annotation preserved when performing
+ pairwise alignment</li>
+ <li>RNA pseudoknot annotation can be
+ imported/exported/displayed</li>
+ <li>'colour by annotation' can colour by RNA and
+ protein secondary structure</li>
+ <li>Warn user if 'Find' regular expression is invalid (<em>mentioned
+ post-hoc with 2.9 release</em>)
+ </li>
+
+ </ul> <em>Application</em>
+ <ul>
+ <li>Extract and display secondary structure for sequences
+ with 3D structures</li>
+ <li>Support for parsing RNAML</li>
+ <li>Annotations menu for layout
+ <ul>
+ <li>sort sequence annotation rows by alignment</li>
+ <li>place sequence annotation above/below alignment
+ annotation</li>
+ </ul>
+ <li>Output in Stockholm format</li>
+ <li>Internationalisation: improved Spanish (es)
+ translation</li>
+ <li>Structure viewer preferences tab</li>
+ <li>Disorder and Secondary Structure annotation tracks
+ shared between alignments</li>
+ <li>UCSF Chimera launch and linked highlighting from
+ Jalview</li>
+ <li>Show/hide all sequence associated annotation rows for
+ all or current selection</li>
+ <li>disorder and secondary structure predictions
+ available as dataset annotation</li>
+ <li>Per-sequence rna helices colouring</li>
+
+
+ <li>Sequence database accessions imported when fetching
+ alignments from Rfam</li>
+ <li>update VARNA version to 3.91</li>
+
+ <li>New groovy scripts for exporting aligned positions,
+ conservation values, and calculating sum of pairs scores.</li>
+ <li>Command line argument to set default JABAWS server</li>
+ <li>include installation type in build properties and
+ console log output</li>
+ <li>Updated Jalview project format to preserve dataset
+ annotation</li>
+ </ul></td>
+ <td>
+ <!-- issues resolved --> <em>Application</em>
+ <ul>
+ <li>Distinguish alignment and sequence associated RNA
+ structure in structure->view->VARNA</li>
+ <li>Raise dialog box if user deletes all sequences in an
+ alignment</li>
+ <li>Pressing F1 results in documentation opening twice</li>
+ <li>Sequence feature tooltip is wrapped</li>
+ <li>Double click on sequence associated annotation
+ selects only first column</li>
+ <li>Redundancy removal doesn't result in unlinked
+ leaves shown in tree</li>
+ <li>Undos after several redundancy removals don't undo
+ properly</li>
+ <li>Hide sequence doesn't hide associated annotation</li>
+ <li>User defined colours dialog box too big to fit on
+ screen and buttons not visible</li>
+ <li>author list isn't updated if already written to
+ Jalview properties</li>
+ <li>Popup menu won't open after retrieving sequence
+ from database</li>
+ <li>File open window for associate PDB doesn't open</li>
+ <li>Left-then-right click on a sequence id opens a
+ browser search window</li>
+ <li>Cannot open sequence feature shading/sort popup menu
+ in feature settings dialog</li>
+ <li>better tooltip placement for some areas of Jalview
+ desktop</li>
+ <li>Allow addition of JABAWS Server which doesn't
+ pass validation</li>
+ <li>Web services parameters dialog box is too large to
+ fit on screen</li>
+ <li>Muscle nucleotide alignment preset obscured by
+ tooltip</li>
+ <li>JABAWS preset submenus don't contain newly
+ defined user preset</li>
+ <li>MSA web services warns user if they were launched
+ with invalid input</li>
+ <li>Jalview cannot contact DAS Registy when running on
+ Java 8</li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1273'>JAL-1273</a>] -->
+ 'Superpose with' submenu not shown when new view
+ created
+ </li>
+
+ </ul> <!-- <em>Applet</em>
<ul>
- <li>Alignment height set incorrectly when lots of annotation
- rows are displayed</li>
- <li>Relative URLs in feature HTML text not resolved to
- codebase</li>
- <li>View follows highlighting does not work for positions in
- sequences</li>
- <li><= shown as = in tooltip</li>
- <li>Export features raises exception when no features exist</li>
- <li>Separator string used for serialising lists of IDs for
- javascript api is modified when separator string provided as
- parameter</li>
- <li>Null pointer exception when selecting tree leaves for
- alignment with no existing selection</li>
- <li>Relative URLs for datasources assumed to be relative to
- applet's codebase</li>
- <li>Status bar not updated after finished searching and search
- wraps around to first result</li>
- <li>StructureSelectionManager instance shared between several
- jalview applets causes race conditions and memory leaks</li>
- <li>Hover tooltip and mouseover of position on structure not
- sent from Jmol in applet</li>
- <li>Certain sequences of javascript method calls to applet API
- fatally hang browser</li>
</ul> <em>General</em>
- <ul>
- <li>View follows structure mouseover scrolls beyond position
- with wrapped view and hidden regions</li>
- <li>Find sequence position moves to wrong residue with/without
- hidden columns</li>
- <li>Sequence length given in alignment properties window is
- off by 1</li>
- <li>InvalidNumberFormat exceptions thrown when trying to
- import PDB like structure files</li>
- <li>Positional search results are only highlighted between
- user-supplied sequence start/end bounds</li>
- <li>End attribute of sequence is not validated</li>
- <li>Find dialog only finds first sequence containing a given
- sequence position</li>
- <li>Sequence numbering not preserved in MSF alignment output</li>
- <li>Jalview PDB file reader does not extract sequence from
- nucleotide chains correctly</li>
- <li>Structure colours not updated when tree partition changed
- in alignment</li>
- <li>Sequence associated secondary structure not correctly
- parsed in interleaved stockholm</li>
- <li>Colour by annotation dialog does not restore current state
- </li>
- <li>Hiding (nearly) all sequences doesn't work properly</li>
- <li>Sequences containing lowercase letters are not properly
- associated with their pdb files</li>
- </ul> <em>Documentation and Development</em>
- <ul>
- <li>schemas/JalviewWsParamSet.xsd corrupted by ApplyCopyright
- tool</li>
- </ul></td>
- </tr>
- <tr>
- <td>
- <div align="center">
- <strong><a name="Jalview2.6.1">2.6.1</a>
- </strong><br> <em>15/11/2010</em>
- </div></td>
- <td><em>Application</em>
- <ul>
- <li>New warning dialog when the Jalview Desktop cannot contact
- web services</li>
- <li>JABA service parameters for a preset are shown in service
- job window</li>
- <li>JABA Service menu entries reworded</li>
- </ul></td>
- <td>
- <ul>
- <li>Modeller PIR IO broken - cannot correctly import a pir
- file emitted by jalview</li>
- <li>Existing feature settings transferred to new alignment
- view created from cut'n'paste</li>
- <li>Improved test for mixed amino/nucleotide chains when
- parsing PDB files</li>
- <li>Consensus and conservation annotation rows occasionally
- become blank for all new windows</li>
- <li>Exception raised when right clicking above sequences in
- wrapped view mode</li>
- </ul> <em>Application</em>
- <ul>
- <li>multiple multiply aligned structure views cause cpu usage
- to hit 100% and computer to hang</li>
- <li>Web Service parameter layout breaks for long user
- parameter names</li>
- <li>Jaba service discovery hangs desktop if Jaba server is
- down</li>
- </ul></td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong><a name="Jalview2.6">2.6</a></strong><br>
- <em>26/9/2010</em></div>
- </td>
- <td><em>Application</em>
- <ul>
- <li>Support for <strong>Ja</strong>va <strong>b</strong>ioinformatics
- <strong>a</strong>nalysis <strong>w</strong>eb <strong>s</strong>ervices (JABAWS)</li>
- <li>Web Services preference tab</li>
- <li>Analysis parameters dialog box and user defined preferences</li>
- <li>Improved speed and layout of Envision2 service menu</li>
- <li>Superpose structures using associated sequence alignment</li>
- <li>Export coordinates and projection as CSV from PCA viewer</li>
- </ul>
- <em>Applet</em>
- <ul>
- <li>enable javascript: execution by the applet via the link out
- mechanism</li>
- </ul>
- <em>Other</em>
- <ul>
- <li>Updated the Jmol Jalview interface to work with Jmol series
- 12</li>
- <li>The Jalview Desktop and JalviewLite applet now require Java
- 1.5</li>
- <li>Allow Jalview feature colour specification for GFF sequence
- annotation files</li>
- <li>New 'colour by label' keword in jalview feature file type
- colour specification</li>
- <li>New Jalview Desktop Groovy API method that allows a script
- to check if it being run in an interactive session or in a batch
- operation from the jalview command line</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>clustalx colourscheme colours Ds preferentially when both
- D+E are present in over 50% of the column</li>
- </ul>
+ <ul>
+ </ul>--> <em>Deployment and Documentation</em>
+ <ul>
+ <li>2G and 1G options in launchApp have no effect on
+ memory allocation</li>
+ <li>launchApp service doesn't automatically open
+ www.jalview.org/examples/exampleFile.jar if no file is given</li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1511'>JAL-1511</a>] -->
+ InstallAnywhere reports cannot find valid JVM when Java
+ 1.7_055 is available
+ </li>
+ </ul> <em>Application Known issues</em>
+ <ul>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-830'>JAL-830</a>] -->
+ corrupted or unreadable alignment display when scrolling
+ alignment to right
+ </li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1329'>JAL-1329</a>] -->
+ retrieval fails but progress bar continues for DAS retrieval
+ with large number of ID
+ </li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1486'>JAL-1486</a>] -->
+ flatfile output of visible region has incorrect sequence
+ start/end
+ </li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1487'>JAL-1487</a>] -->
+ rna structure consensus doesn't update when secondary
+ structure tracks are rearranged
+ </li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1591'>JAL-1591</a>] -->
+ invalid rna structure positional highlighting does not
+ highlight position of invalid base pairs
+ </li>
+ <li>
+ <!-- <a href='http://issues.jalview.org/browse/JAL-1539'>JAL-1539</a>] -->
+ out of memory errors are not raised when saving Jalview
+ project from alignment window file menu
+ </li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1576'>JAL-1576</a>] -->
+ Switching to RNA Helices colouring doesn't propagate to
+ structures
+ </li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1577'>JAL-1577</a>] -->
+ colour by RNA Helices not enabled when user created
+ annotation added to alignment
+ </li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1439'>JAL-1439</a>] -->
+ Jalview icon not shown on dock in Mountain Lion/Webstart
+ </li>
+ </ul> <em>Applet Known Issues</em>
+ <ul>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1394'>JAL-1394</a>] -->
+ JalviewLite needs JmolApplet and VARNA-3.91 jar dependencies
+ </li>
+ <li>
+ <!-- [<a href='http://issues.jalview.org/browse/JAL-1510'>JAL-1510</a>] -->
+ Jalview and Jmol example not compatible with IE9
+ </li>
- <em>Application</em>
- <ul>
- <li>typo in AlignmentFrame->View->Hide->all but
- selected Regions menu item</li>
- <li>sequence fetcher replaces ',' for ';' when the ',' is part
- of a valid accession ID</li>
- <li>fatal OOM if object retrieved by sequence fetcher runs out
- of memory</li>
- <li>unhandled Out of Memory Error when viewing pca analysis
- results</li>
- <li>InstallAnywhere builds fail to launch on OS X java 10.5
- update 4 (due to apple Java 1.6 update)</li>
- <li>Installanywhere Jalview silently fails to launch</li>
- </ul>
- <em>Applet</em>
- <ul>
- <li>Jalview.getFeatureGroups() raises an
- ArrayIndexOutOfBoundsException if no feature groups are defined.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong><a name="Jalview2.5.1">2.5.1</a></strong><br>
- <em>14/6/2010</em></div>
- </td>
- <td></td>
- <td>
- <ul>
- <li>Alignment prettyprinter doesn't cope with long sequence IDs
- </li>
- <li>clustalx colourscheme colours Ds preferentially when both
- D+E are present in over 50% of the column</li>
- <li>nucleic acid structures retrieved from PDB do not import
- correctly</li>
- <li>More columns get selected than were clicked on when a number
- of columns are hidden</li>
- <li>annotation label popup menu not providing correct
- add/hide/show options when rows are hidden or none are present</li>
- <li>Stockholm format shown in list of readable formats, and
- parser copes better with alignments from RFAM.</li>
- <li>CSV output of consensus only includes the percentage of all
- symbols if sequence logo display is enabled</li>
+ <li>Sort by annotation score doesn't reverse order
+ when selected</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td><div align="center">
+ <strong><a name="Jalview.2.8.1">2.8.1</a><br /> <em>4/6/2014</em></strong>
+ </div></td>
+ <td>
+ <!-- New features --> <!-- For major releases, split into sections: Application | Applet | General | Deployment and Documentation -->
+ <em>General</em>
+ <ul>
+ <li>Internationalisation of user interface (usually
+ called i18n support) and translation for Spanish locale</li>
+ <li>Define/Undefine group on current selection with
+ Ctrl-G/Shift Ctrl-G</li>
+ <li>Improved group creation/removal options in
+ alignment/sequence Popup menu</li>
+ <li>Sensible precision for symbol distribution
+ percentages shown in logo tooltip.</li>
+ <li>Annotation panel height set according to amount of
+ annotation when alignment first opened</li>
+ </ul> <em>Application</em>
+ <ul>
+ <li>Interactive consensus RNA secondary structure
+ prediction VIENNA RNAAliFold JABA 2.1 service</li>
+ <li>Select columns containing particular features from
+ Feature Settings dialog</li>
+ <li>View all 'representative' PDB structures for selected
+ sequences</li>
+ <li>Update Jalview project format:
+ <ul>
+ <li>New file extension for Jalview projects '.jvp'</li>
+ <li>Preserve sequence and annotation dataset (to
+ store secondary structure annotation,etc)</li>
+ <li>Per group and alignment annotation and RNA helix
+ colouring</li>
+ </ul>
+ </li>
+ <li>New similarity measures for PCA and Tree calculation
+ (PAM250)</li>
+ <li>Experimental support for retrieval and viewing of
+ flanking regions for an alignment</li>
+ </ul>
+ </td>
+ <td>
+ <!-- issues resolved --> <em>Application</em>
+ <ul>
+ <li>logo keeps spinning and status remains at queued or
+ running after job is cancelled</li>
+ <li>cannot export features from alignments imported from
+ Jalview/VAMSAS projects</li>
+ <li>Buggy slider for web service parameters that take
+ float values</li>
+ <li>Newly created RNA secondary structure line doesn't
+ have 'display all symbols' flag set</li>
+ <li>T-COFFEE alignment score shading scheme and other
+ annotation shading not saved in Jalview project</li>
+ <li>Local file cannot be loaded in freshly downloaded
+ Jalview</li>
+ <li>Jalview icon not shown on dock in Mountain
+ Lion/Webstart</li>
+ <li>Load file from desktop file browser fails</li>
+ <li>Occasional NPE thrown when calculating large trees</li>
+ <li>Cannot reorder or slide sequences after dragging an
+ alignment onto desktop</li>
+ <li>Colour by annotation dialog throws NPE after using
+ 'extract scores' function</li>
+ <li>Loading/cut'n'pasting an empty file leads to a grey
+ alignment window</li>
+ <li>Disorder thresholds rendered incorrectly after
+ performing IUPred disorder prediction</li>
+ <li>Multiple group annotated consensus rows shown when
+ changing 'normalise logo' display setting</li>
+ <li>Find shows blank dialog after 'finished searching' if
+ nothing matches query</li>
+ <li>Null Pointer Exceptions raised when sorting by
+ feature with lots of groups<!-- possibly JAL-599 but commit 7c7a5a297e063d3892dd7e629bc317cdde837b81 associated with JAL-971 -->
+ </li>
+ <li>Errors in Jmol console when structures in alignment
+ don't overlap <!-- JAL-1476 Work in progress - don't send junk to Jmol -->
+ </li>
+ <li>Not all working JABAWS services are shown in
+ Jalview's menu</li>
+ <li>JAVAWS version of Jalview fails to launch with
+ 'invalid literal/length code'</li>
+ <li>Annotation/RNA Helix colourschemes cannot be applied
+ to alignment with groups (actually fixed in 2.8.0b1)</li>
+ <li>RNA Helices and T-Coffee Scores available as default
+ colourscheme</li>
- </ul>
- <em>Applet</em>
- <ul>
- <li>annotation panel disappears when annotation is
- hidden/removed</li>
- </ul>
- <em>Application</em>
- <ul>
- <li>Alignment view not redrawn properly when new alignment
- opened where annotation panel is visible but no annotations are
- present on alignment</li>
- <li>pasted region containing hidden columns is incorrectly
- displayed in new alignment window</li>
- <li>Jalview slow to complete operations when stdout is flooded
- (fix is to close the Jalview console)</li>
- <li>typo in AlignmentFrame->View->Hide->all but
- selected Rregions menu item.</li>
- <li>inconsistent group submenu and Format submenu entry 'Un' or
- 'Non'conserved</li>
- <li>Sequence feature settings are being shared by multiple
- distinct alignments</li>
- <li>group annotation not recreated when tree partition is
- changed</li>
- <li>double click on group annotation to select sequences does
- not propagate to associated trees</li>
- <li>Mac OSX specific issues:
- <ul>
- <li>exception raised when mouse clicked on desktop window
- background</li>
- <li>Desktop menu placed on menu bar and application name set
- correctly</li>
- <li>sequence feature settings not wide enough for the save
- feature colourscheme button</li>
- </ul>
- </li>
- </ul>
- </td>
- </tr>
- <tr>
+ </ul> <em>Applet</em>
+ <ul>
+ <li>Remove group option is shown even when selection is
+ not a group</li>
+ <li>Apply to all groups ticked but colourscheme changes
+ don't affect groups</li>
+ <li>Documented RNA Helices and T-Coffee Scores as valid
+ colourscheme name</li>
+ <li>Annotation labels drawn on sequence IDs when
+ Annotation panel is not displayed</li>
+ <li>Increased font size for dropdown menus on OSX and
+ embedded windows</li>
+ </ul> <em>Other</em>
+ <ul>
+ <li>Consensus sequence for alignments/groups with a
+ single sequence were not calculated</li>
+ <li>annotation files that contain only groups imported as
+ annotation and junk sequences</li>
+ <li>Fasta files with sequences containing '*' incorrectly
+ recognised as PFAM or BLC</li>
+ <li>conservation/PID slider apply all groups option
+ doesn't affect background (2.8.0b1)
+ <li></li>
+ <li>redundancy highlighting is erratic at 0% and 100%</li>
+ <li>Remove gapped columns fails for sequences with ragged
+ trailing gaps</li>
+ <li>AMSA annotation row with leading spaces is not
+ registered correctly on import</li>
+ <li>Jalview crashes when selecting PCA analysis for
+ certain alignments</li>
+ <li>Opening the colour by annotation dialog for an
+ existing annotation based 'use original colours'
+ colourscheme loses original colours setting</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td><div align="center">
+ <strong><a name="Jalview.2.8.0b1">2.8.0b1</a><br />
+ <em>30/1/2014</em></strong>
+ </div></td>
+ <td>
+ <ul>
+ <li>Trusted certificates for JalviewLite applet and
+ Jalview Desktop application<br />Certificate was donated by
+ <a href="https://www.certum.eu">Certum</a> to the Jalview
+ open source project).
+ </li>
+ <li>Jalview SRS links replaced by Uniprot and EBI-search
+ </li>
+ <li>Output in Stockholm format</li>
+ <li>Allow import of data from gzipped files</li>
+ <li>Export/import group and sequence associated line
+ graph thresholds</li>
+ <li>Nucleotide substitution matrix that supports RNA and
+ ambiguity codes</li>
+ <li>Allow disorder predictions to be made on the current
+ selection (or visible selection) in the same way that JPred
+ works</li>
+ <li>Groovy scripting for headless Jalview operation</li>
+ </ul> <em>Other improvements</em>
+ <ul>
+ <li>Upgrade desktop installer to InstallAnywhere 2013</li>
+ <li>COMBINE statement uses current SEQUENCE_REF and
+ GROUP_REF scope to group annotation rows</li>
+ <li>Support '' style escaping of quotes in Newick
+ files</li>
+ <li>Group options for JABAWS service by command line name</li>
+ <li>Empty tooltip shown for JABA service options with a
+ link but no description</li>
+ <li>Select primary source when selecting authority in
+ database fetcher GUI</li>
+ <li>Add .mfa to FASTA file extensions recognised by
+ Jalview</li>
+ <li>Annotation label tooltip text wrap</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Slow scrolling when lots of annotation rows are
+ displayed</li>
+ <li>Lots of NPE (and slowness) after creating RNA
+ secondary structure annotation line</li>
+ <li>Sequence database accessions not imported when
+ fetching alignments from Rfam</li>
+ <li>Incorrect SHMR submission for sequences with
+ identical IDs</li>
+ <li>View all structures does not always superpose
+ structures</li>
+ <li>Option widgets in service parameters not updated to
+ reflect user or preset settings</li>
+ <li>Null pointer exceptions for some services without
+ presets or adjustable parameters</li>
+ <li>Discover PDB IDs entry in structure menu doesn't
+ discover PDB xRefs</li>
+ <li>Exception encountered while trying to retrieve
+ features with DAS</li>
+ <li>Lowest value in annotation row isn't coloured
+ when colour by annotation (per sequence) is coloured</li>
+ <li>Keyboard mode P jumps to start of gapped region when
+ residue follows a gap</li>
+ <li>Jalview appears to hang importing an alignment with
+ Wrap as default or after enabling Wrap</li>
+ <li>'Right click to add annotations' message
+ shown in wrap mode when no annotations present</li>
+ <li>Disorder predictions fail with NPE if no automatic
+ annotation already exists on alignment</li>
+ <li>oninit javascript function should be called after
+ initialisation completes</li>
+ <li>Remove redundancy after disorder prediction corrupts
+ alignment window display</li>
+ <li>Example annotation file in documentation is invalid</li>
+ <li>Grouped line graph annotation rows are not exported
+ to annotation file</li>
+ <li>Multi-harmony analysis cannot be run when only two
+ groups created</li>
+ <li>Cannot create multiple groups of line graphs with
+ several 'combine' statements in annotation file</li>
+ <li>Pressing return several times causes Number Format
+ exceptions in keyboard mode</li>
+ <li>Multi-harmony (SHMMR) method doesn't submit
+ correct partitions for input data</li>
+ <li>Translation from DNA to Amino Acids fails</li>
+ <li>Jalview fail to load newick tree with quoted label</li>
+ <li>--headless flag isn't understood</li>
+ <li>ClassCastException when generating EPS in headless
+ mode</li>
+ <li>Adjusting sequence-associated shading threshold only
+ changes one row's threshold</li>
+ <li>Preferences and Feature settings panel panel
+ doesn't open</li>
+ <li>hide consensus histogram also hides conservation and
+ quality histograms</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td><div align="center">
+ <strong><a name="Jalview2.8">2.8</a></strong><br /> <em>12/11/2012</em>
+ </div></td>
+ <td><em>Application</em>
+ <ul>
+ <li>Support for JABAWS 2.0 Services (AACon alignment
+ conservation, protein disorder and Clustal Omega)</li>
+ <li>JABAWS server status indicator in Web Services
+ preferences</li>
+ <li>VARNA (http://varna.lri.fr) viewer for RNA structures
+ in Jalview alignment window</li>
+ <li>Updated Jalview build and deploy framework for OSX
+ mountain lion, windows 7, and 8</li>
+ <li>Nucleotide substitution matrix for PCA that supports
+ RNA and ambiguity codes</li>
- <td>
- <div align="center"><strong><a name="Jalview2.5">2.5</a></strong><br>
- <em>30/4/2010</em></div>
- </td>
- <td><em>New Capabilities</em>
- <ul>
- <li>URL links generated from description line for
- regular-expression based URL links (applet and application)
- <li>Non-positional feature URL links are shown in link menu</li>
- <li>Linked viewing of nucleic acid sequences and structures</li>
- <li>Automatic Scrolling option in View menu to display the
- currently highlighted region of an alignment.</li>
- <li>Order an alignment by sequence length, or using the average
- score or total feature count for each sequence.</li>
- <li>Shading features by score or associated description</li>
- <li>Subdivide alignment and groups based on identity of selected
- subsequence (Make Groups from Selection).</li>
- <li>New hide/show options including Shift+Control+H to hide
- everything but the currently selected region.</li>
- <!-- introduced but not yet documented <li>Experimental blast report parser</li> -->
- </ul>
- <em>Application</em>
- <ul>
- <li>Fetch DB References capabilities and UI expanded to support
- retrieval from DAS sequence sources</li>
- <li>Local DAS Sequence sources can be added via the command line
- or via the Add local source dialog box.</li>
- <li>DAS Dbref and DbxRef feature types are parsed as database
- references and protein_name is parsed as description line (BioSapiens
- terms).</li>
- <li>Enable or disable non-positional feature and database
- references in sequence ID tooltip from View menu in application.</li>
- <!-- <li>New hidden columns and rows and representatives capabilities
- in annotations file (in progress - not yet fully implemented)</li> -->
- <li>Group-associated consensus, sequence logos and conservation
- plots</li>
- <li>Symbol distributions for each column can be exported and
- visualized as sequence logos</li>
- <li>Optionally scale multi-character column labels to fit within
- each column of annotation row<!-- todo for applet --></li>
- <li>Optional automatic sort of associated alignment view when a
- new tree is opened.</li>
- <li>Jalview Java Console</li>
- <li>Better placement of desktop window when moving between
- different screens.</li>
- <li>New preference items for sequence ID tooltip and consensus
- annotation</li>
- <li>Client to submit sequences and IDs to <a
- href="webServices/index.html#envision2">Envision2</a> Workflows</li>
- <li><em>Vamsas Capabilities</em>
- <ul>
- <li>Improved VAMSAS synchronization (jalview archive used to
- preserve views, structures, and tree display settings)</li>
- <li>Import of vamsas documents from disk or URL via command
- line</li>
- <li>Sharing of selected regions between views and with other
- VAMSAS applications (Experimental feature!)</li>
- <li>Updated API to VAMSAS version 0.2</li>
- </ul>
- </li>
- </ul>
- <em>Applet</em>
- <ul>
- <li>Middle button resizes annotation row height</li>
- <li>New Parameters
- <ul>
- <li>sortByTree (true/false) - automatically sort the associated
- alignment view by the tree when a new tree is opened.</li>
- <li>showTreeBootstraps (true/false) - show or hide branch
- bootstraps (default is to show them if available)</li>
- <li>showTreeDistances (true/false) - show or hide branch
- lengths (default is to show them if available)</li>
- <li>showUnlinkedTreeNodes (true/false) - indicate if
- unassociated nodes should be highlighted in the tree view</li>
- <li>heightScale and widthScale (1.0 or more) - increase the
- height or width of a cell in the alignment grid relative to the
- current font size.</li>
- </ul>
- </li>
- <li>Non-positional features displayed in sequence ID tooltip</li>
- </ul>
- <em>Other</em>
- <ul>
- <li>Features format: graduated colour definitions and
- specification of feature scores</li>
- <li>Alignment Annotations format: new keywords for group
- associated annotation (GROUP_REF) and annotation row display
- properties (ROW_PROPERTIES)</li>
- <li>XML formats extended to support graduated feature
- colourschemes, group associated annotation, and profile visualization
- settings.</li>
- </td>
- <td>
- <ul>
- <li>Source field in GFF files parsed as feature source rather
- than description</li>
- <li>Non-positional features are now included in sequence feature
- and gff files (controlled via non-positional feature visibility in
- tooltip).</li>
- <li>URL links generated for all feature links (bugfix)</li>
- <li>Added URL embedding instructions to features file
- documentation.</li>
- <li>Codons containing ambiguous nucleotides translated as 'X' in
- peptide product</li>
- <li>Match case switch in find dialog box works for both sequence
- ID and sequence string and query strings do not have to be in upper
- case to match case-insensitively.</li>
- <li>AMSA files only contain first column of multi-character
- column annotation labels</li>
- <li>Jalview Annotation File generation/parsing consistent with
- documentation (e.g. Stockholm annotation can be exported and
- re-imported)</li>
- <li>PDB files without embedded PDB IDs given a friendly name</li>
- <li>Find incrementally searches ID string matches as well as
- subsequence matches, and correctly reports total number of both.</li>
- <li>Application:
- <ul>
- <li>Better handling of exceptions during sequence retrieval</li>
- <li>Dasobert generated non-positional feature URL link text
- excludes the start_end suffix</li>
- <li>DAS feature and source retrieval buttons disabled when
- fetch or registry operations in progress.</li>
- <li>PDB files retrieved from URLs are cached properly</li>
- <li>Sequence description lines properly shared via VAMSAS</li>
- <li>Sequence fetcher fetches multiple records for all data
- sources</li>
- <li>Ensured that command line das feature retrieval completes
- before alignment figures are generated.</li>
- <li>Reduced time taken when opening file browser for first
- time.</li>
- <li>isAligned check prior to calculating tree, PCA or
- submitting an MSA to JNet now excludes hidden sequences.</li>
- <li>User defined group colours properly recovered from Jalview
- projects.</li>
- </ul>
- </li>
- </ul>
- </td>
+ <li>Improved sequence database retrieval GUI</li>
+ <li>Support fetching and database reference look up
+ against multiple DAS sources (Fetch all from in 'fetch db
+ refs')</li>
+ <li>Jalview project improvements
+ <ul>
+ <li>Store and retrieve the 'belowAlignment'
+ flag for annotation</li>
+ <li>calcId attribute to group annotation rows on the
+ alignment</li>
+ <li>Store AACon calculation settings for a view in
+ Jalview project</li>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.4.0.b2</strong><br>
- 28/10/2009</div>
- </td>
- <td>
- <ul>
- <li>Experimental support for google analytics usage tracking.</li>
- <li>Jalview privacy settings (user preferences and docs).</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Race condition in applet preventing startup in jre1.6.0u12+.</li>
- <li>Exception when feature created from selection beyond length
- of sequence.</li>
- <li>Allow synthetic PDB files to be imported gracefully</li>
- <li>Sequence associated annotation rows associate with all
- sequences with a given id</li>
- <li>Find function matches case-insensitively for sequence ID
- string searches</li>
- <li>Non-standard characters do not cause pairwise alignment to
- fail with exception</li>
- </ul>
- <em>Application Issues</em>
- <ul>
- <li>Sequences are now validated against EMBL database</li>
- <li>Sequence fetcher fetches multiple records for all data
- sources</li>
- </ul>
- <em>InstallAnywhere Issues</em>
- <ul>
- <li>Dock icon works for Mac OS X java (Mac 1.6 update issue with
- installAnywhere mechanism)</li>
- <li>Command line launching of JARs from InstallAnywhere version
- (java class versioning error fixed)</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
+ </ul>
+ </li>
+ <li>horizontal scrolling gesture support</li>
+ <li>Visual progress indicator when PCA calculation is
+ running</li>
+ <li>Simpler JABA web services menus</li>
+ <li>visual indication that web service results are still
+ being retrieved from server</li>
+ <li>Serialise the dialogs that are shown when Jalview
+ starts up for first time</li>
+ <li>Jalview user agent string for interacting with HTTP
+ services</li>
+ <li>DAS 1.6 and DAS 2.0 source support using new JDAS
+ client library</li>
+ <li>Examples directory and Groovy library included in
+ InstallAnywhere distribution</li>
+ </ul> <em>Applet</em>
+ <ul>
+ <li>RNA alignment and secondary structure annotation
+ visualization applet example</li>
+ </ul> <em>General</em>
+ <ul>
+ <li>Normalise option for consensus sequence logo</li>
+ <li>Reset button in PCA window to return dimensions to
+ defaults</li>
+ <li>Allow seqspace or Jalview variant of alignment PCA
+ calculation</li>
+ <li>PCA with either nucleic acid and protein substitution
+ matrices
+ <li>Allow windows containing HTML reports to be exported
+ in HTML</li>
+ <li>Interactive display and editing of RNA secondary
+ structure contacts</li>
+ <li>RNA Helix Alignment Colouring</li>
+ <li>RNA base pair logo consensus</li>
+ <li>Parse sequence associated secondary structure
+ information in Stockholm files</li>
+ <li>HTML Export database accessions and annotation
+ information presented in tooltip for sequences</li>
+ <li>Import secondary structure from LOCARNA clustalw
+ style RNA alignment files</li>
+ <li>import and visualise T-COFFEE quality scores for an
+ alignment</li>
+ <li>'colour by annotation' per sequence option to
+ shade each sequence according to its associated alignment
+ annotation</li>
+ <li>New Jalview Logo</li>
+ </ul> <em>Documentation and Development</em>
+ <ul>
+ <li>documentation for score matrices used in Jalview</li>
+ <li>New Website!</li>
+ </ul></td>
+ <td><em>Application</em>
+ <ul>
+ <li>PDB, Unprot and EMBL (ENA) databases retrieved via
+ wsdbfetch REST service</li>
+ <li>Stop windows being moved outside desktop on OSX</li>
+ <li>Filetype associations not installed for webstart
+ launch</li>
+ <li>Jalview does not always retrieve progress of a JABAWS
+ job execution in full once it is complete</li>
+ <li>revise SHMR RSBS definition to ensure alignment is
+ uploaded via ali_file parameter</li>
+ <li>Jalview 2.7 is incompatible with Jmol-12.2.2</li>
+ <li>View all structures superposed fails with exception</li>
+ <li>Jnet job queues forever if a very short sequence is
+ submitted for prediction</li>
+ <li>Cut and paste menu not opened when mouse clicked on
+ desktop window</li>
+ <li>Putting fractional value into integer text box in
+ alignment parameter dialog causes Jalview to hang</li>
+ <li>Structure view highlighting doesn't work on
+ windows 7</li>
+ <li>View all structures fails with exception shown in
+ structure view</li>
+ <li>Characters in filename associated with PDBEntry not
+ escaped in a platform independent way</li>
+ <li>Jalview desktop fails to launch with exception when
+ using proxy</li>
+ <li>Tree calculation reports 'you must have 2 or more
+ sequences selected' when selection is empty</li>
+ <li>Jalview desktop fails to launch with jar signature
+ failure when java web start temporary file caching is
+ disabled</li>
+ <li>DAS Sequence retrieval with range qualification
+ results in sequence xref which includes range qualification</li>
+ <li>Errors during processing of command line arguments
+ cause progress bar (JAL-898) to be removed</li>
+ <li>Replace comma for semi-colon option not disabled for
+ DAS sources in sequence fetcher</li>
+ <li>Cannot close news reader when JABAWS server warning
+ dialog is shown</li>
+ <li>Option widgets not updated to reflect user settings</li>
+ <li>Edited sequence not submitted to web service</li>
+ <li>Jalview 2.7 Webstart does not launch on mountain lion</li>
+ <li>InstallAnywhere installer doesn't unpack and run
+ on OSX Mountain Lion</li>
+ <li>Annotation panel not given a scroll bar when
+ sequences with alignment annotation are pasted into the
+ alignment</li>
+ <li>Sequence associated annotation rows not associated
+ when loaded from Jalview project</li>
+ <li>Browser launch fails with NPE on java 1.7</li>
+ <li>JABAWS alignment marked as finished when job was
+ cancelled or job failed due to invalid input</li>
+ <li>NPE with v2.7 example when clicking on Tree
+ associated with all views</li>
+ <li>Exceptions when copy/paste sequences with grouped
+ annotation rows to new window</li>
+ </ul> <em>Applet</em>
+ <ul>
+ <li>Sequence features are momentarily displayed before
+ they are hidden using hidefeaturegroups applet parameter</li>
+ <li>loading features via javascript API automatically
+ enables feature display</li>
+ <li>scrollToColumnIn javascript API method doesn't
+ work</li>
+ </ul> <em>General</em>
+ <ul>
+ <li>Redundancy removal fails for rna alignment</li>
+ <li>PCA calculation fails when sequence has been selected
+ and then deselected</li>
+ <li>PCA window shows grey box when first opened on OSX</li>
+ <li>Letters coloured pink in sequence logo when alignment
+ coloured with clustalx</li>
+ <li>Choosing fonts without letter symbols defined causes
+ exceptions and redraw errors</li>
+ <li>Initial PCA plot view is not same as manually
+ reconfigured view</li>
+ <li>Grouped annotation graph label has incorrect line
+ colour</li>
+ <li>Grouped annotation graph label display is corrupted
+ for lots of labels</li>
+ </ul>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong><a name="Jalview2.7">2.7</a> </strong><br> <em>27/09/2011</em>
+ </div>
+ </td>
+ <td><em>Application</em>
+ <ul>
+ <li>Jalview Desktop News Reader</li>
+ <li>Tweaked default layout of web services menu</li>
+ <li>View/alignment association menu to enable user to
+ easily specify which alignment a multi-structure view takes
+ its colours/correspondences from</li>
+ <li>Allow properties file location to be specified as URL</li>
+ <li>Extend Jalview project to preserve associations
+ between many alignment views and a single Jmol display</li>
+ <li>Store annotation row height in Jalview project file</li>
+ <li>Annotation row column label formatting attributes
+ stored in project file</li>
+ <li>Annotation row order for auto-calculated annotation
+ rows preserved in Jalview project file</li>
+ <li>Visual progress indication when Jalview state is
+ saved using Desktop window menu</li>
+ <li>Visual indication that command line arguments are
+ still being processed</li>
+ <li>Groovy script execution from URL</li>
+ <li>Colour by annotation default min and max colours in
+ preferences</li>
+ <li>Automatically associate PDB files dragged onto an
+ alignment with sequences that have high similarity and
+ matching IDs</li>
+ <li>Update JGoogleAnalytics to latest release (0.3)</li>
+ <li>'view structures' option to open many
+ structures in same window</li>
+ <li>Sort associated views menu option for tree panel</li>
+ <li>Group all JABA and non-JABA services for a particular
+ analysis function in its own submenu</li>
+ </ul> <em>Applet</em>
+ <ul>
+ <li>Userdefined and autogenerated annotation rows for
+ groups</li>
+ <li>Adjustment of alignment annotation pane height</li>
+ <li>Annotation scrollbar for annotation panel</li>
+ <li>Drag to reorder annotation rows in annotation panel</li>
+ <li>'automaticScrolling' parameter</li>
+ <li>Allow sequences with partial ID string matches to be
+ annotated from GFF/Jalview features files</li>
+ <li>Sequence logo annotation row in applet</li>
+ <li>Absolute paths relative to host server in applet
+ parameters are treated as such</li>
+ <li>New in the JalviewLite javascript API:
+ <ul>
+ <li>JalviewLite.js javascript library</li>
+ <li>Javascript callbacks for
+ <ul>
+ <li>Applet initialisation</li>
+ <li>Sequence/alignment mouse-overs and selections</li>
+ </ul>
+ </li>
+ <li>scrollTo row and column alignment scrolling
+ functions</li>
+ <li>Select sequence/alignment regions from javascript</li>
+ <li>javascript structure viewer harness to pass
+ messages between Jmol and Jalview when running as
+ distinct applets</li>
+ <li>sortBy method</li>
+ <li>Set of applet and application examples shipped
+ with documentation</li>
+ <li>New example to demonstrate JalviewLite and Jmol
+ javascript message exchange</li>
+ </ul>
+ </ul> <em>General</em>
+ <ul>
+ <li>Enable Jmol displays to be associated with multiple
+ multiple alignments</li>
+ <li>Option to automatically sort alignment with new tree</li>
+ <li>User configurable link to enable redirects to a
+ www.Jalview.org mirror</li>
+ <li>Jmol colours option for Jmol displays</li>
+ <li>Configurable newline string when writing alignment
+ and other flat files</li>
+ <li>Allow alignment annotation description lines to
+ contain html tags</li>
+ </ul> <em>Documentation and Development</em>
+ <ul>
+ <li>Add groovy test harness for bulk load testing to
+ examples</li>
+ <li>Groovy script to load and align a set of sequences
+ using a web service before displaying the result in the
+ Jalview desktop</li>
+ <li>Restructured javascript and applet api documentation</li>
+ <li>Ant target to publish example html files with applet
+ archive</li>
+ <li>Netbeans project for building Jalview from source</li>
+ <li>ant task to create online javadoc for Jalview source</li>
+ </ul></td>
+ <td><em>Application</em>
+ <ul>
+ <li>User defined colourscheme throws exception when
+ current built in colourscheme is saved as new scheme</li>
+ <li>AlignFrame->Save in application pops up save
+ dialog for valid filename/format</li>
+ <li>Cannot view associated structure for Uniprot sequence</li>
+ <li>PDB file association breaks for Uniprot sequence
+ P37173</li>
+ <li>Associate PDB from file dialog does not tell you
+ which sequence is to be associated with the file</li>
+ <li>Find All raises null pointer exception when query
+ only matches sequence IDs</li>
+ <li>Pre 2.6 Jalview project cannot be loaded into v2.6</li>
+ <li>Jalview project with Jmol views created with Jalview
+ 2.4 cannot be loaded</li>
+ <li>Filetype associations not installed for webstart
+ launch</li>
+ <li>Two or more chains in a single PDB file associated
+ with sequences in different alignments do not get coloured
+ by their associated sequence</li>
+ <li>Visibility status of autocalculated annotation row
+ not preserved when project is loaded</li>
+ <li>Annotation row height and visibility attributes not
+ stored in Jalview project</li>
+ <li>Tree bootstraps are not preserved when saved as a
+ Jalview project</li>
+ <li>Envision2 workflow tooltips are corrupted</li>
+ <li>Enabling show group conservation also enables colour
+ by conservation</li>
+ <li>Duplicate group associated conservation or consensus
+ created on new view</li>
+ <li>Annotation scrollbar not displayed after 'show
+ all hidden annotation rows' option selected</li>
+ <li>Alignment quality not updated after alignment
+ annotation row is hidden then shown</li>
+ <li>Preserve colouring of structures coloured by
+ sequences in pre Jalview 2.7 projects</li>
+ <li>Web service job parameter dialog is not laid out
+ properly</li>
+ <li>Web services menu not refreshed after 'reset
+ services' button is pressed in preferences</li>
+ <li>Annotation off by one in Jalview v2_3 example project</li>
+ <li>Structures imported from file and saved in project
+ get name like jalview_pdb1234.txt when reloaded</li>
+ <li>Jalview does not always retrieve progress of a JABAWS
+ job execution in full once it is complete</li>
+ </ul> <em>Applet</em>
+ <ul>
+ <li>Alignment height set incorrectly when lots of
+ annotation rows are displayed</li>
+ <li>Relative URLs in feature HTML text not resolved to
+ codebase</li>
+ <li>View follows highlighting does not work for positions
+ in sequences</li>
+ <li><= shown as = in tooltip</li>
+ <li>Export features raises exception when no features
+ exist</li>
+ <li>Separator string used for serialising lists of IDs
+ for javascript api is modified when separator string
+ provided as parameter</li>
+ <li>Null pointer exception when selecting tree leaves for
+ alignment with no existing selection</li>
+ <li>Relative URLs for datasources assumed to be relative
+ to applet's codebase</li>
+ <li>Status bar not updated after finished searching and
+ search wraps around to first result</li>
+ <li>StructureSelectionManager instance shared between
+ several Jalview applets causes race conditions and memory
+ leaks</li>
+ <li>Hover tooltip and mouseover of position on structure
+ not sent from Jmol in applet</li>
+ <li>Certain sequences of javascript method calls to
+ applet API fatally hang browser</li>
+ </ul> <em>General</em>
+ <ul>
+ <li>View follows structure mouseover scrolls beyond
+ position with wrapped view and hidden regions</li>
+ <li>Find sequence position moves to wrong residue
+ with/without hidden columns</li>
+ <li>Sequence length given in alignment properties window
+ is off by 1</li>
+ <li>InvalidNumberFormat exceptions thrown when trying to
+ import PDB like structure files</li>
+ <li>Positional search results are only highlighted
+ between user-supplied sequence start/end bounds</li>
+ <li>End attribute of sequence is not validated</li>
+ <li>Find dialog only finds first sequence containing a
+ given sequence position</li>
+ <li>Sequence numbering not preserved in MSF alignment
+ output</li>
+ <li>Jalview PDB file reader does not extract sequence
+ from nucleotide chains correctly</li>
+ <li>Structure colours not updated when tree partition
+ changed in alignment</li>
+ <li>Sequence associated secondary structure not correctly
+ parsed in interleaved stockholm</li>
+ <li>Colour by annotation dialog does not restore current
+ state</li>
+ <li>Hiding (nearly) all sequences doesn't work
+ properly</li>
+ <li>Sequences containing lowercase letters are not
+ properly associated with their pdb files</li>
+ </ul> <em>Documentation and Development</em>
+ <ul>
+ <li>schemas/JalviewWsParamSet.xsd corrupted by
+ ApplyCopyright tool</li>
+ </ul></td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong><a name="Jalview2.6.1">2.6.1</a> </strong><br> <em>15/11/2010</em>
+ </div>
+ </td>
+ <td><em>Application</em>
+ <ul>
+ <li>New warning dialog when the Jalview Desktop cannot
+ contact web services</li>
+ <li>JABA service parameters for a preset are shown in
+ service job window</li>
+ <li>JABA Service menu entries reworded</li>
+ </ul></td>
+ <td>
+ <ul>
+ <li>Modeller PIR IO broken - cannot correctly import a
+ pir file emitted by Jalview</li>
+ <li>Existing feature settings transferred to new
+ alignment view created from cut'n'paste</li>
+ <li>Improved test for mixed amino/nucleotide chains when
+ parsing PDB files</li>
+ <li>Consensus and conservation annotation rows
+ occasionally become blank for all new windows</li>
+ <li>Exception raised when right clicking above sequences
+ in wrapped view mode</li>
+ </ul> <em>Application</em>
+ <ul>
+ <li>multiple multiply aligned structure views cause cpu
+ usage to hit 100% and computer to hang</li>
+ <li>Web Service parameter layout breaks for long user
+ parameter names</li>
+ <li>Jaba service discovery hangs desktop if Jaba server
+ is down</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong><a name="Jalview2.6">2.6</a></strong><br> <em>26/9/2010</em>
+ </div>
+ </td>
+ <td><em>Application</em>
+ <ul>
+ <li>Support for <strong>Ja</strong>va <strong>b</strong>ioinformatics
+ <strong>a</strong>nalysis <strong>w</strong>eb <strong>s</strong>ervices
+ (JABAWS)
+ </li>
+ <li>Web Services preference tab</li>
+ <li>Analysis parameters dialog box and user defined
+ preferences</li>
+ <li>Improved speed and layout of Envision2 service menu</li>
+ <li>Superpose structures using associated sequence
+ alignment</li>
+ <li>Export coordinates and projection as CSV from PCA
+ viewer</li>
+ </ul> <em>Applet</em>
+ <ul>
+ <li>enable javascript: execution by the applet via the
+ link out mechanism</li>
+ </ul> <em>Other</em>
+ <ul>
+ <li>Updated the Jmol Jalview interface to work with Jmol
+ series 12</li>
+ <li>The Jalview Desktop and JalviewLite applet now
+ require Java 1.5</li>
+ <li>Allow Jalview feature colour specification for GFF
+ sequence annotation files</li>
+ <li>New 'colour by label' keword in Jalview feature file
+ type colour specification</li>
+ <li>New Jalview Desktop Groovy API method that allows a
+ script to check if it being run in an interactive session or
+ in a batch operation from the Jalview command line</li>
+ </ul></td>
+ <td>
+ <ul>
+ <li>clustalx colourscheme colours Ds preferentially when
+ both D+E are present in over 50% of the column</li>
+ </ul> <em>Application</em>
+ <ul>
+ <li>typo in AlignmentFrame->View->Hide->all but
+ selected Regions menu item</li>
+ <li>sequence fetcher replaces ',' for ';' when the ',' is
+ part of a valid accession ID</li>
+ <li>fatal OOM if object retrieved by sequence fetcher
+ runs out of memory</li>
+ <li>unhandled Out of Memory Error when viewing pca
+ analysis results</li>
+ <li>InstallAnywhere builds fail to launch on OS X java
+ 10.5 update 4 (due to apple Java 1.6 update)</li>
+ <li>Installanywhere Jalview silently fails to launch</li>
+ </ul> <em>Applet</em>
+ <ul>
+ <li>Jalview.getFeatureGroups() raises an
+ ArrayIndexOutOfBoundsException if no feature groups are
+ defined.</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong><a name="Jalview2.5.1">2.5.1</a></strong><br> <em>14/6/2010</em>
+ </div>
+ </td>
+ <td></td>
+ <td>
+ <ul>
+ <li>Alignment prettyprinter doesn't cope with long
+ sequence IDs</li>
+ <li>clustalx colourscheme colours Ds preferentially when
+ both D+E are present in over 50% of the column</li>
+ <li>nucleic acid structures retrieved from PDB do not
+ import correctly</li>
+ <li>More columns get selected than were clicked on when a
+ number of columns are hidden</li>
+ <li>annotation label popup menu not providing correct
+ add/hide/show options when rows are hidden or none are
+ present</li>
+ <li>Stockholm format shown in list of readable formats,
+ and parser copes better with alignments from RFAM.</li>
+ <li>CSV output of consensus only includes the percentage
+ of all symbols if sequence logo display is enabled</li>
+
+ </ul> <em>Applet</em>
+ <ul>
+ <li>annotation panel disappears when annotation is
+ hidden/removed</li>
+ </ul> <em>Application</em>
+ <ul>
+ <li>Alignment view not redrawn properly when new
+ alignment opened where annotation panel is visible but no
+ annotations are present on alignment</li>
+ <li>pasted region containing hidden columns is
+ incorrectly displayed in new alignment window</li>
+ <li>Jalview slow to complete operations when stdout is
+ flooded (fix is to close the Jalview console)</li>
+ <li>typo in AlignmentFrame->View->Hide->all but
+ selected Rregions menu item.</li>
+ <li>inconsistent group submenu and Format submenu entry
+ 'Un' or 'Non'conserved</li>
+ <li>Sequence feature settings are being shared by
+ multiple distinct alignments</li>
+ <li>group annotation not recreated when tree partition is
+ changed</li>
+ <li>double click on group annotation to select sequences
+ does not propagate to associated trees</li>
+ <li>Mac OSX specific issues:
+ <ul>
+ <li>exception raised when mouse clicked on desktop
+ window background</li>
+ <li>Desktop menu placed on menu bar and application
+ name set correctly</li>
+ <li>sequence feature settings not wide enough for the
+ save feature colourscheme button</li>
+ </ul>
+ </li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+
+ <td>
+ <div align="center">
+ <strong><a name="Jalview2.5">2.5</a></strong><br> <em>30/4/2010</em>
+ </div>
+ </td>
+ <td><em>New Capabilities</em>
+ <ul>
+ <li>URL links generated from description line for
+ regular-expression based URL links (applet and application)
+
+ <li>Non-positional feature URL links are shown in link
+ menu</li>
+ <li>Linked viewing of nucleic acid sequences and
+ structures</li>
+ <li>Automatic Scrolling option in View menu to display
+ the currently highlighted region of an alignment.</li>
+ <li>Order an alignment by sequence length, or using the
+ average score or total feature count for each sequence.</li>
+ <li>Shading features by score or associated description</li>
+ <li>Subdivide alignment and groups based on identity of
+ selected subsequence (Make Groups from Selection).</li>
+ <li>New hide/show options including Shift+Control+H to
+ hide everything but the currently selected region.</li>
+ <!-- introduced but not yet documented <li>Experimental blast report parser</li> -->
+ </ul> <em>Application</em>
+ <ul>
+ <li>Fetch DB References capabilities and UI expanded to
+ support retrieval from DAS sequence sources</li>
+ <li>Local DAS Sequence sources can be added via the
+ command line or via the Add local source dialog box.</li>
+ <li>DAS Dbref and DbxRef feature types are parsed as
+ database references and protein_name is parsed as
+ description line (BioSapiens terms).</li>
+ <li>Enable or disable non-positional feature and database
+ references in sequence ID tooltip from View menu in
+ application.</li>
+ <!-- <li>New hidden columns and rows and representatives capabilities
+ in annotations file (in progress - not yet fully implemented)</li> -->
+ <li>Group-associated consensus, sequence logos and
+ conservation plots</li>
+ <li>Symbol distributions for each column can be exported
+ and visualized as sequence logos</li>
+ <li>Optionally scale multi-character column labels to fit
+ within each column of annotation row<!-- todo for applet -->
+ </li>
+ <li>Optional automatic sort of associated alignment view
+ when a new tree is opened.</li>
+ <li>Jalview Java Console</li>
+ <li>Better placement of desktop window when moving
+ between different screens.</li>
+ <li>New preference items for sequence ID tooltip and
+ consensus annotation</li>
+ <li>Client to submit sequences and IDs to <a
+ href="webServices/index.html#envision2">Envision2</a>
+ Workflows
+ </li>
+ <li><em>Vamsas Capabilities</em>
+ <ul>
+ <li>Improved VAMSAS synchronization (Jalview archive
+ used to preserve views, structures, and tree display
+ settings)</li>
+ <li>Import of vamsas documents from disk or URL via
+ command line</li>
+ <li>Sharing of selected regions between views and
+ with other VAMSAS applications (Experimental feature!)</li>
+ <li>Updated API to VAMSAS version 0.2</li>
+ </ul></li>
+ </ul> <em>Applet</em>
+ <ul>
+ <li>Middle button resizes annotation row height</li>
+ <li>New Parameters
+ <ul>
+ <li>sortByTree (true/false) - automatically sort the
+ associated alignment view by the tree when a new tree is
+ opened.</li>
+ <li>showTreeBootstraps (true/false) - show or hide
+ branch bootstraps (default is to show them if available)</li>
+ <li>showTreeDistances (true/false) - show or hide
+ branch lengths (default is to show them if available)</li>
+ <li>showUnlinkedTreeNodes (true/false) - indicate if
+ unassociated nodes should be highlighted in the tree
+ view</li>
+ <li>heightScale and widthScale (1.0 or more) -
+ increase the height or width of a cell in the alignment
+ grid relative to the current font size.</li>
+ </ul>
+ </li>
+ <li>Non-positional features displayed in sequence ID
+ tooltip</li>
+ </ul> <em>Other</em>
+ <ul>
+ <li>Features format: graduated colour definitions and
+ specification of feature scores</li>
+ <li>Alignment Annotations format: new keywords for group
+ associated annotation (GROUP_REF) and annotation row display
+ properties (ROW_PROPERTIES)</li>
+ <li>XML formats extended to support graduated feature
+ colourschemes, group associated annotation, and profile
+ visualization settings.</li></td>
+ <td>
+ <ul>
+ <li>Source field in GFF files parsed as feature source
+ rather than description</li>
+ <li>Non-positional features are now included in sequence
+ feature and gff files (controlled via non-positional feature
+ visibility in tooltip).</li>
+ <li>URL links generated for all feature links (bugfix)</li>
+ <li>Added URL embedding instructions to features file
+ documentation.</li>
+ <li>Codons containing ambiguous nucleotides translated as
+ 'X' in peptide product</li>
+ <li>Match case switch in find dialog box works for both
+ sequence ID and sequence string and query strings do not
+ have to be in upper case to match case-insensitively.</li>
+ <li>AMSA files only contain first column of
+ multi-character column annotation labels</li>
+ <li>Jalview Annotation File generation/parsing consistent
+ with documentation (e.g. Stockholm annotation can be
+ exported and re-imported)</li>
+ <li>PDB files without embedded PDB IDs given a friendly
+ name</li>
+ <li>Find incrementally searches ID string matches as well
+ as subsequence matches, and correctly reports total number
+ of both.</li>
+ <li>Application:
+ <ul>
+ <li>Better handling of exceptions during sequence
+ retrieval</li>
+ <li>Dasobert generated non-positional feature URL
+ link text excludes the start_end suffix</li>
+ <li>DAS feature and source retrieval buttons disabled
+ when fetch or registry operations in progress.</li>
+ <li>PDB files retrieved from URLs are cached properly</li>
+ <li>Sequence description lines properly shared via
+ VAMSAS</li>
+ <li>Sequence fetcher fetches multiple records for all
+ data sources</li>
+ <li>Ensured that command line das feature retrieval
+ completes before alignment figures are generated.</li>
+ <li>Reduced time taken when opening file browser for
+ first time.</li>
+ <li>isAligned check prior to calculating tree, PCA or
+ submitting an MSA to JNet now excludes hidden sequences.</li>
+ <li>User defined group colours properly recovered
+ from Jalview projects.</li>
+ </ul>
+ </li>
+ </ul>
+ </td>
- <div align="center"><strong>2.4</strong><br>
- 27/8/2008</div>
- </td>
- <td><em>User Interface</em>
- <ul>
- <li>Linked highlighting of codon and amino acid from translation
- and protein products</li>
- <li>Linked highlighting of structure associated with residue
- mapping to codon position</li>
- <li>Sequence Fetcher provides example accession numbers and
- 'clear' button</li>
- <li>MemoryMonitor added as an option under Desktop's Tools menu</li>
- <li>Extract score function to parse whitespace separated numeric
- data in description line</li>
- <li>Column labels in alignment annotation can be centred.</li>
- <li>Tooltip for sequence associated annotation give name of
- sequence</li>
- </ul>
- <em>Web Services and URL fetching</em>
- <ul>
- <li>JPred3 web service</li>
- <li>Prototype sequence search client (no public services
- available yet)</li>
- <li>Fetch either seed alignment or full alignment from PFAM</li>
- <li>URL Links created for matching database cross references as
- well as sequence ID</li>
- <li>URL Links can be created using regular-expressions</li>
- </ul>
- <em>Sequence Database Connectivity</em>
- <ul>
- <li>Retrieval of cross-referenced sequences from other databases
- </li>
- <li>Generalised database reference retrieval and validation to
- all fetchable databases</li>
- <li>Fetch sequences from DAS sources supporting the sequence
- command</li>
- </ul>
- <em>Import and Export</em>
- <li>export annotation rows as CSV for spreadsheet import</li>
- <li>Jalview projects record alignment dataset associations, EMBL
- products, and cDNA sequence mappings</li>
- <li>Sequence Group colour can be specified in Annotation File</li>
- <li>Ad-hoc colouring of group in Annotation File using RGB
- triplet as name of colourscheme</li>
- </ul>
- <em>VAMSAS Client capabilities (Experimental)</em>
- <ul>
- <li>treenode binding for VAMSAS tree exchange</li>
- <li>local editing and update of sequences in VAMSAS alignments
- (experimental)</li>
- <li>Create new or select existing session to join</li>
- <li>load and save of vamsas documents</li>
- </ul>
- <em>Application command line</em>
- <ul>
- <li>-tree parameter to open trees (introduced for passing from
- applet)</li>
- <li>-fetchfrom command line argument to specify nicknames of DAS
- servers to query for alignment features</li>
- <li>-dasserver command line argument to add new servers that are
- also automatically queried for features</li>
- <li>-groovy command line argument executes a given groovy script
- after all input data has been loaded and parsed</li>
- </ul>
- <em>Applet-Application data exchange</em>
- <ul>
- <li>Trees passed as applet parameters can be passed to
- application (when using "View in full application")</li>
- </ul>
- <em>Applet Parameters</em>
- <ul>
- <li>feature group display control parameter</li>
- <li>debug parameter</li>
- <li>showbutton parameter</li>
- </ul>
- <em>Applet API methods</em>
- <ul>
- <li>newView public method</li>
- <li>Window (current view) specific get/set public methods</li>
- <li>Feature display control methods</li>
- <li>get list of currently selected sequences</li>
- </ul>
- <em>New Jalview distribution features</em>
- <ul>
- <li>InstallAnywhere Installer upgraded to IA 2008 VP1</li>
- <li>RELEASE file gives build properties for the latest Jalview
- release.</li>
- <li>Java 1.1 Applet build made easier and donotobfuscate
- property controls execution of obfuscator</li>
- <li>Build target for generating source distribution</li>
- <li>Debug flag for javacc</li>
- <li>.jalview_properties file is documented (slightly) in
- jalview.bin.Cache</li>
- <li>Continuous Build Integration for stable and development
- version of Application, Applet and source distribution</li>
- </ul>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.4.0.b2</strong><br> 28/10/2009
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Experimental support for google analytics usage
+ tracking.</li>
+ <li>Jalview privacy settings (user preferences and docs).</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Race condition in applet preventing startup in
+ jre1.6.0u12+.</li>
+ <li>Exception when feature created from selection beyond
+ length of sequence.</li>
+ <li>Allow synthetic PDB files to be imported gracefully</li>
+ <li>Sequence associated annotation rows associate with
+ all sequences with a given id</li>
+ <li>Find function matches case-insensitively for sequence
+ ID string searches</li>
+ <li>Non-standard characters do not cause pairwise
+ alignment to fail with exception</li>
+ </ul> <em>Application Issues</em>
+ <ul>
+ <li>Sequences are now validated against EMBL database</li>
+ <li>Sequence fetcher fetches multiple records for all
+ data sources</li>
+ </ul> <em>InstallAnywhere Issues</em>
+ <ul>
+ <li>Dock icon works for Mac OS X java (Mac 1.6 update
+ issue with installAnywhere mechanism)</li>
+ <li>Command line launching of JARs from InstallAnywhere
+ version (java class versioning error fixed)</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
- </td>
- <td>
- <ul>
- <li>selected region output includes visible annotations (for
- certain formats)</li>
- <li>edit label/displaychar contains existing label/char for
- editing</li>
- <li>update PDBEntries when DBRefEntries change (vamsas)</li>
- <li>shorter peptide product names from EMBL records</li>
- <li>Newick string generator makes compact representations</li>
- <li>bootstrap values parsed correctly for tree files with
- comments</li>
- <li>pathological filechooser bug avoided by not allowing
- filenames containing a ':'</li>
- <li>Fixed exception when parsing GFF files containing global
- sequence features</li>
- <li>Alignment datasets are finalized only when number of
- references from alignment sequences goes to zero</li>
- <li>Close of tree branch colour box without colour selection
- causes cascading exceptions</li>
- <li>occasional negative imgwidth exceptions</li>
- <li>better reporting of non-fatal warnings to user when file
- parsing fails.</li>
- <li>Save works when Jalview project is default format</li>
- <li>Save as dialog opened if current alignment format is not a
- valid output format</li>
- <li>Uniprot canonical names introduced for both das and vamsas</li>
- <li>Histidine should be midblue (not pink!) in Zappo</li>
- <li>error messages passed up and output when data read fails</li>
- <li>edit undo recovers previous dataset sequence when sequence
- is edited</li>
- <li>allow PDB files without pdb ID HEADER lines (like those
- generated by MODELLER) to be read in properly</li>
- <li>allow reading of JPred concise files as a normal filetype</li>
- <li>Stockholm annotation parsing and alignment properties import
- fixed for PFAM records</li>
- <li>Structure view windows have correct name in Desktop window
- list</li>
- <li>annotation consisting of sequence associated scores can be
- read and written correctly to annotation file</li>
- <li>Aligned cDNA translation to aligned peptide works correctly</li>
- <li>Fixed display of hidden sequence markers and non-italic font
- for representatives in Applet</li>
- <li>Applet Menus are always embedded in applet window on Macs.</li>
- <li>Newly shown features appear at top of stack (in Applet)</li>
- <li>Annotations added via parameter not drawn properly due to
- null pointer exceptions</li>
- <li>Secondary structure lines are drawn starting from first
- column of alignment</li>
- <li>Uniprot XML import updated for new schema release in July
- 2008</li>
- <li>Sequence feature to sequence ID match for Features file is
- case-insensitive</li>
- <li>Sequence features read from Features file appended to all
- sequences with matching IDs</li>
- <li>PDB structure coloured correctly for associated views
- containing a sub-sequence</li>
- <li>PDB files can be retrieved by applet from Jar files</li>
- <li>feature and annotation file applet parameters referring to
- different directories are retrieved correctly</li>
- <!--<li>DAS Histogram Features display ( (Prlic et al) </li>-->
- <li>Fixed application hang whilst waiting for splash-screen
- version check to complete</li>
- <li>Applet properly URLencodes input parameter values when
- passing them to the launchApp service</li>
- <li>display name and local features preserved in results
- retrieved from web service</li>
- <li>Visual delay indication for sequence retrieval and sequence
- fetcher initialisation</li>
- <li>updated Application to use DAS 1.53e version of dasobert DAS
- client</li>
- <li>Re-instated Full AMSA support and .amsa file association</li>
- <li>Fixed parsing of JNet Concise annotation <em>sans</em>
- sequences</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.3</strong><br>
- 9/5/07</div>
- </td>
- <td>
- <ul>
- <li>Jmol 11.0.2 integration</li>
- <li>PDB views stored in Jalview XML files</li>
- <li>Slide sequences</li>
- <li>Edit sequence in place</li>
- <li>EMBL CDS features</li>
- <li>DAS Feature mapping</li>
- <li>Feature ordering</li>
- <li>Alignment Properties</li>
- <li>Annotation Scores</li>
- <li>Sort by scores</li>
- <li>Feature/annotation editing in applet</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Headless state operation in 2.2.1</li>
- <li>Incorrect and unstable DNA pairwise alignment</li>
- <li>Cut and paste of sequences with annotation</li>
- <li>Feature group display state in XML</li>
- <li>Feature ordering in XML</li>
- <li>blc file iteration selection using filename # suffix</li>
- <li>Stockholm alignment properties</li>
- <li>Stockhom alignment secondary structure annotation</li>
- <li>2.2.1 applet had no feature transparency</li>
- <li>Number pad keys can be used in cursor mode</li>
- <li>Structure Viewer mirror image resolved</li>
- </ul>
- </td>
+ <div align="center">
+ <strong>2.4</strong><br> 27/8/2008
+ </div>
+ </td>
+ <td><em>User Interface</em>
+ <ul>
+ <li>Linked highlighting of codon and amino acid from
+ translation and protein products</li>
+ <li>Linked highlighting of structure associated with
+ residue mapping to codon position</li>
+ <li>Sequence Fetcher provides example accession numbers
+ and 'clear' button</li>
+ <li>MemoryMonitor added as an option under Desktop's
+ Tools menu</li>
+ <li>Extract score function to parse whitespace separated
+ numeric data in description line</li>
+ <li>Column labels in alignment annotation can be centred.</li>
+ <li>Tooltip for sequence associated annotation give name
+ of sequence</li>
+ </ul> <em>Web Services and URL fetching</em>
+ <ul>
+ <li>JPred3 web service</li>
+ <li>Prototype sequence search client (no public services
+ available yet)</li>
+ <li>Fetch either seed alignment or full alignment from
+ PFAM</li>
+ <li>URL Links created for matching database cross
+ references as well as sequence ID</li>
+ <li>URL Links can be created using regular-expressions</li>
+ </ul> <em>Sequence Database Connectivity</em>
+ <ul>
+ <li>Retrieval of cross-referenced sequences from other
+ databases</li>
+ <li>Generalised database reference retrieval and
+ validation to all fetchable databases</li>
+ <li>Fetch sequences from DAS sources supporting the
+ sequence command</li>
+ </ul> <em>Import and Export</em>
+ <li>export annotation rows as CSV for spreadsheet import</li>
+ <li>Jalview projects record alignment dataset associations,
+ EMBL products, and cDNA sequence mappings</li>
+ <li>Sequence Group colour can be specified in Annotation
+ File</li>
+ <li>Ad-hoc colouring of group in Annotation File using RGB
+ triplet as name of colourscheme</li>
+ </ul> <em>VAMSAS Client capabilities (Experimental)</em>
+ <ul>
+ <li>treenode binding for VAMSAS tree exchange</li>
+ <li>local editing and update of sequences in VAMSAS
+ alignments (experimental)</li>
+ <li>Create new or select existing session to join</li>
+ <li>load and save of vamsas documents</li>
+ </ul> <em>Application command line</em>
+ <ul>
+ <li>-tree parameter to open trees (introduced for passing
+ from applet)</li>
+ <li>-fetchfrom command line argument to specify nicknames
+ of DAS servers to query for alignment features</li>
+ <li>-dasserver command line argument to add new servers
+ that are also automatically queried for features</li>
+ <li>-groovy command line argument executes a given groovy
+ script after all input data has been loaded and parsed</li>
+ </ul> <em>Applet-Application data exchange</em>
+ <ul>
+ <li>Trees passed as applet parameters can be passed to
+ application (when using "View in full
+ application")</li>
+ </ul> <em>Applet Parameters</em>
+ <ul>
+ <li>feature group display control parameter</li>
+ <li>debug parameter</li>
+ <li>showbutton parameter</li>
+ </ul> <em>Applet API methods</em>
+ <ul>
+ <li>newView public method</li>
+ <li>Window (current view) specific get/set public methods</li>
+ <li>Feature display control methods</li>
+ <li>get list of currently selected sequences</li>
+ </ul> <em>New Jalview distribution features</em>
+ <ul>
+ <li>InstallAnywhere Installer upgraded to IA 2008 VP1</li>
+ <li>RELEASE file gives build properties for the latest
+ Jalview release.</li>
+ <li>Java 1.1 Applet build made easier and donotobfuscate
+ property controls execution of obfuscator</li>
+ <li>Build target for generating source distribution</li>
+ <li>Debug flag for javacc</li>
+ <li>.jalview_properties file is documented (slightly) in
+ jalview.bin.Cache</li>
+ <li>Continuous Build Integration for stable and
+ development version of Application, Applet and source
+ distribution</li>
+ </ul></td>
+ <td>
+ <ul>
+ <li>selected region output includes visible annotations
+ (for certain formats)</li>
+ <li>edit label/displaychar contains existing label/char
+ for editing</li>
+ <li>update PDBEntries when DBRefEntries change (vamsas)</li>
+ <li>shorter peptide product names from EMBL records</li>
+ <li>Newick string generator makes compact representations</li>
+ <li>bootstrap values parsed correctly for tree files with
+ comments</li>
+ <li>pathological filechooser bug avoided by not allowing
+ filenames containing a ':'</li>
+ <li>Fixed exception when parsing GFF files containing
+ global sequence features</li>
+ <li>Alignment datasets are finalized only when number of
+ references from alignment sequences goes to zero</li>
+ <li>Close of tree branch colour box without colour
+ selection causes cascading exceptions</li>
+ <li>occasional negative imgwidth exceptions</li>
+ <li>better reporting of non-fatal warnings to user when
+ file parsing fails.</li>
+ <li>Save works when Jalview project is default format</li>
+ <li>Save as dialog opened if current alignment format is
+ not a valid output format</li>
+ <li>Uniprot canonical names introduced for both das and
+ vamsas</li>
+ <li>Histidine should be midblue (not pink!) in Zappo</li>
+ <li>error messages passed up and output when data read
+ fails</li>
+ <li>edit undo recovers previous dataset sequence when
+ sequence is edited</li>
+ <li>allow PDB files without pdb ID HEADER lines (like
+ those generated by MODELLER) to be read in properly</li>
+ <li>allow reading of JPred concise files as a normal
+ filetype</li>
+ <li>Stockholm annotation parsing and alignment properties
+ import fixed for PFAM records</li>
+ <li>Structure view windows have correct name in Desktop
+ window list</li>
+ <li>annotation consisting of sequence associated scores
+ can be read and written correctly to annotation file</li>
+ <li>Aligned cDNA translation to aligned peptide works
+ correctly</li>
+ <li>Fixed display of hidden sequence markers and
+ non-italic font for representatives in Applet</li>
+ <li>Applet Menus are always embedded in applet window on
+ Macs.</li>
+ <li>Newly shown features appear at top of stack (in
+ Applet)</li>
+ <li>Annotations added via parameter not drawn properly
+ due to null pointer exceptions</li>
+ <li>Secondary structure lines are drawn starting from
+ first column of alignment</li>
+ <li>Uniprot XML import updated for new schema release in
+ July 2008</li>
+ <li>Sequence feature to sequence ID match for Features
+ file is case-insensitive</li>
+ <li>Sequence features read from Features file appended to
+ all sequences with matching IDs</li>
+ <li>PDB structure coloured correctly for associated views
+ containing a sub-sequence</li>
+ <li>PDB files can be retrieved by applet from Jar files</li>
+ <li>feature and annotation file applet parameters
+ referring to different directories are retrieved correctly</li>
+ <!--<li>DAS Histogram Features display ( (Prlic et al) </li>-->
+ <li>Fixed application hang whilst waiting for
+ splash-screen version check to complete</li>
+ <li>Applet properly URLencodes input parameter values
+ when passing them to the launchApp service</li>
+ <li>display name and local features preserved in results
+ retrieved from web service</li>
+ <li>Visual delay indication for sequence retrieval and
+ sequence fetcher initialisation</li>
+ <li>updated Application to use DAS 1.53e version of
+ dasobert DAS client</li>
+ <li>Re-instated Full AMSA support and .amsa file
+ association</li>
+ <li>Fixed parsing of JNet Concise annotation <em>sans</em>
+ sequences
+ </li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.3</strong><br> 9/5/07
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Jmol 11.0.2 integration</li>
+ <li>PDB views stored in Jalview XML files</li>
+ <li>Slide sequences</li>
+ <li>Edit sequence in place</li>
+ <li>EMBL CDS features</li>
+ <li>DAS Feature mapping</li>
+ <li>Feature ordering</li>
+ <li>Alignment Properties</li>
+ <li>Annotation Scores</li>
+ <li>Sort by scores</li>
+ <li>Feature/annotation editing in applet</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Headless state operation in 2.2.1</li>
+ <li>Incorrect and unstable DNA pairwise alignment</li>
+ <li>Cut and paste of sequences with annotation</li>
+ <li>Feature group display state in XML</li>
+ <li>Feature ordering in XML</li>
+ <li>blc file iteration selection using filename # suffix</li>
+ <li>Stockholm alignment properties</li>
+ <li>Stockhom alignment secondary structure annotation</li>
+ <li>2.2.1 applet had no feature transparency</li>
+ <li>Number pad keys can be used in cursor mode</li>
+ <li>Structure Viewer mirror image resolved</li>
+ </ul>
+ </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.2.1</strong><br>
- 12/2/07</div>
- </td>
- <td>
- <ul>
- <li>Non standard characters can be read and displayed
- <li>Annotations/Features can be imported/exported to the applet
- via textbox
- <li>Applet allows editing of sequence/annotation/group name
- & description
- <li>Preference setting to display sequence name in italics
- <li>Annotation file format extended to allow Sequence_groups to
- be defined
- <li>Default opening of alignment overview panel can be specified
- in preferences
- <li>PDB residue numbering annotation added to associated
- sequences
- </ul>
- </td>
- <td>
- <ul>
- <li>Applet crash under certain Linux OS with Java 1.6 installed
- <li>Annotation file export / import bugs fixed
- <li>PNG / EPS image output bugs fixed
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.2</strong><br>
- 27/11/06</div>
- </td>
- <td>
- <ul>
- <li>Multiple views on alignment
- <li>Sequence feature editing
- <li>"Reload" alignment
- <li>"Save" to current filename
- <li>Background dependent text colour
- <li>Right align sequence ids
- <li>User-defined lower case residue colours
- <li>Format Menu
- <li>Select Menu
- <li>Menu item accelerator keys
- <li>Control-V pastes to current alignment
- <li>Cancel button for DAS Feature Fetching
- <li>PCA and PDB Viewers zoom via mouse roller
- <li>User-defined sub-tree colours and sub-tree selection
- <li>'New Window' button on the 'Output to Text box'
- </ul>
- </td>
- <td>
- <ul>
- <li>New memory efficient Undo/Redo System
- <li>Optimised symbol lookups and conservation/consensus
- calculations
- <li>Region Conservation/Consensus recalculated after edits
- <li>Fixed Remove Empty Columns Bug (empty columns at end of
- alignment)
- <li>Slowed DAS Feature Fetching for increased robustness.
- <li>Made angle brackets in ASCII feature descriptions display
- correctly
- <li>Re-instated Zoom function for PCA
- <li>Sequence descriptions conserved in web service analysis
- results
- <li>Uniprot ID discoverer uses any word separated by ∣
- <li>WsDbFetch query/result association resolved
- <li>Tree leaf to sequence mapping improved
- <li>Smooth fonts switch moved to FontChooser dialog box.
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.1.1</strong><br>
- 12/9/06</div>
- </td>
- <td>
- <ul>
- <li>Copy consensus sequence to clipboard</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Image output - rightmost residues are rendered if sequence
- id panel has been resized</li>
- <li>Image output - all offscreen group boundaries are rendered</li>
- <li>Annotation files with sequence references - all elements in
- file are relative to sequence position</li>
- <li>Mac Applet users can use Alt key for group editing</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.1</strong><br>
- 22/8/06</div>
- </td>
- <td>
- <ul>
- <li>MAFFT Multiple Alignment in default Web Service list</li>
- <li>DAS Feature fetching</li>
- <li>Hide sequences and columns</li>
- <li>Export Annotations and Features</li>
- <li>GFF file reading / writing</li>
- <li>Associate structures with sequences from local PDB files</li>
- <li>Add sequences to exisiting alignment</li>
- <li>Recently opened files / URL lists</li>
- <li>Applet can launch the full application</li>
- <li>Applet has transparency for features (Java 1.2 required)</li>
- <li>Applet has user defined colours parameter</li>
- <li>Applet can load sequences from parameter "sequence<em>x</em>"</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Redundancy Panel reinstalled in the Applet</li>
- <li>Monospaced font - EPS / rescaling bug fixed</li>
- <li>Annotation files with sequence references bug fixed</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.08.1</strong><br>
- 2/5/06</div>
- </td>
- <td>
- <ul>
- <li>Change case of selected region from Popup menu</li>
- <li>Choose to match case when searching</li>
- <li>Middle mouse button and mouse movement can compress / expand
- the visible width and height of the alignment</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Annotation Panel displays complete JNet results</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.08b</strong><br>
- 18/4/06</div>
- </td>
- <td> </td>
- <td>
- <ul>
- <li>Java 1.5 bug - InternalMessageDialog fix for threads</li>
- <li>Righthand label on wrapped alignments shows correct value</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.08</strong><br>
- 10/4/06</div>
- </td>
- <td>
- <ul>
- <li>Editing can be locked to the selection area</li>
- <li>Keyboard editing</li>
- <li>Create sequence features from searches</li>
- <li>Precalculated annotations can be loaded onto alignments</li>
- <li>Features file allows grouping of features</li>
- <li>Annotation Colouring scheme added</li>
- <li>Smooth fonts off by default - Faster rendering</li>
- <li>Choose to toggle Autocalculate Consensus On/Off</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Drag & Drop fixed on Linux</li>
- <li>Jalview Archive file faster to load/save, sequence
- descriptions saved.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.07</strong><br>
- 12/12/05</div>
- </td>
- <td>
- <ul>
- <li>PDB Structure Viewer enhanced</li>
- <li>Sequence Feature retrieval and display enhanced</li>
- <li>Choose to output sequence start-end after sequence name for
- file output</li>
- <li>Sequence Fetcher WSDBFetch at EBI</li>
- <li>Applet can read feature files, PDB files and can be used for
- HTML form input</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>HTML output writes groups and features</li>
- <li>Group editing is Control and mouse click</li>
- <li>File IO bugs</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.06</strong><br>
- 28/9/05</div>
- </td>
- <td>
- <ul>
- <li>View annotations in wrapped mode</li>
- <li>More options for PCA viewer</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>GUI bugs resolved</li>
- <li>Runs with -nodisplay from command line</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td height="63">
- <div align="center"><strong>2.05b</strong><br>
- 15/9/05</div>
- </td>
- <td>
- <ul>
- <li>Choose EPS export as lineart or text</li>
- <li>Jar files are executable</li>
- <li>Can read in Uracil - maps to unknown residue</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Known OutOfMemory errors give warning message</li>
- <li>Overview window calculated more efficiently</li>
- <li>Several GUI bugs resolved</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.05</strong><br>
- 30/8/05</div>
- </td>
- <td>
- <ul>
- <li>Edit and annotate in "Wrapped" view</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Several GUI bugs resolved</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.04</strong><br>
- 24/8/05</div>
- </td>
- <td>
- <ul>
- <li>Hold down mouse wheel & scroll to change font size</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Improved JPred client reliability</li>
- <li>Improved loading of Jalview files</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.03</strong><br>
- 18/8/05</div>
- </td>
- <td>
- <ul>
- <li>Set Proxy server name and port in preferences</li>
- <li>Multiple URL links from sequence ids</li>
- <li>User Defined Colours can have a scheme name and added to
- Colour Menu</li>
- <li>Choose to ignore gaps in consensus calculation</li>
- <li>Unix users can set default web browser</li>
- <li>Runs without GUI for batch processing</li>
- <li>Dynamically generated Web Service Menus</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>InstallAnywhere download for Sparc Solaris</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.02</strong><br>
- 18/7/05</div>
- </td>
- <td> </td>
- <td>
- <ul>
- <li>Copy & Paste order of sequences maintains alignment
- order.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.01</strong><br>
- 12/7/05</div>
- </td>
- <td>
- <ul>
- <li>Use delete key for deleting selection.</li>
- <li>Use Mouse wheel to scroll sequences.</li>
- <li>Help file updated to describe how to add alignment
- annotations.</li>
- <li>Version and build date written to build properties file.</li>
- <li>InstallAnywhere installation will check for updates at
- launch of Jalview.</li>
- </ul>
- </td>
- <td>
- <ul>
- <li>Delete gaps bug fixed.</li>
- <li>FileChooser sorts columns.</li>
- <li>Can remove groups one by one.</li>
- <li>Filechooser icons installed.</li>
- <li>Finder ignores return character when searching. Return key
- will initiate a search.<br>
- </li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center"><strong>2.0</strong><br>
- 20/6/05</div>
- </td>
- <td>
- <ul>
- <li>New codebase</li>
- </ul>
- </td>
- <td> </td>
- </tr>
-</table>
-<p> </p>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.2.1</strong><br> 12/2/07
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Non standard characters can be read and displayed
+ <li>Annotations/Features can be imported/exported to the
+ applet via textbox
+ <li>Applet allows editing of sequence/annotation/group
+ name & description
+ <li>Preference setting to display sequence name in
+ italics
+ <li>Annotation file format extended to allow
+ Sequence_groups to be defined
+ <li>Default opening of alignment overview panel can be
+ specified in preferences
+ <li>PDB residue numbering annotation added to associated
+ sequences
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Applet crash under certain Linux OS with Java 1.6
+ installed
+ <li>Annotation file export / import bugs fixed
+ <li>PNG / EPS image output bugs fixed
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.2</strong><br> 27/11/06
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Multiple views on alignment
+ <li>Sequence feature editing
+ <li>"Reload" alignment
+ <li>"Save" to current filename
+ <li>Background dependent text colour
+ <li>Right align sequence ids
+ <li>User-defined lower case residue colours
+ <li>Format Menu
+ <li>Select Menu
+ <li>Menu item accelerator keys
+ <li>Control-V pastes to current alignment
+ <li>Cancel button for DAS Feature Fetching
+ <li>PCA and PDB Viewers zoom via mouse roller
+ <li>User-defined sub-tree colours and sub-tree selection
+
+ <li>'New Window' button on the 'Output to Text box'
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>New memory efficient Undo/Redo System
+ <li>Optimised symbol lookups and conservation/consensus
+ calculations
+ <li>Region Conservation/Consensus recalculated after
+ edits
+ <li>Fixed Remove Empty Columns Bug (empty columns at end
+ of alignment)
+ <li>Slowed DAS Feature Fetching for increased robustness.
+
+ <li>Made angle brackets in ASCII feature descriptions
+ display correctly
+ <li>Re-instated Zoom function for PCA
+ <li>Sequence descriptions conserved in web service
+ analysis results
+ <li>Uniprot ID discoverer uses any word separated by
+ ∣
+ <li>WsDbFetch query/result association resolved
+ <li>Tree leaf to sequence mapping improved
+ <li>Smooth fonts switch moved to FontChooser dialog box.
+
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.1.1</strong><br> 12/9/06
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Copy consensus sequence to clipboard</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Image output - rightmost residues are rendered if
+ sequence id panel has been resized</li>
+ <li>Image output - all offscreen group boundaries are
+ rendered</li>
+ <li>Annotation files with sequence references - all
+ elements in file are relative to sequence position</li>
+ <li>Mac Applet users can use Alt key for group editing</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.1</strong><br> 22/8/06
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>MAFFT Multiple Alignment in default Web Service list</li>
+ <li>DAS Feature fetching</li>
+ <li>Hide sequences and columns</li>
+ <li>Export Annotations and Features</li>
+ <li>GFF file reading / writing</li>
+ <li>Associate structures with sequences from local PDB
+ files</li>
+ <li>Add sequences to exisiting alignment</li>
+ <li>Recently opened files / URL lists</li>
+ <li>Applet can launch the full application</li>
+ <li>Applet has transparency for features (Java 1.2
+ required)</li>
+ <li>Applet has user defined colours parameter</li>
+ <li>Applet can load sequences from parameter
+ "sequence<em>x</em>"
+ </li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Redundancy Panel reinstalled in the Applet</li>
+ <li>Monospaced font - EPS / rescaling bug fixed</li>
+ <li>Annotation files with sequence references bug fixed</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.08.1</strong><br> 2/5/06
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Change case of selected region from Popup menu</li>
+ <li>Choose to match case when searching</li>
+ <li>Middle mouse button and mouse movement can compress /
+ expand the visible width and height of the alignment</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Annotation Panel displays complete JNet results</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.08b</strong><br> 18/4/06
+ </div>
+ </td>
+ <td> </td>
+ <td>
+ <ul>
+ <li>Java 1.5 bug - InternalMessageDialog fix for threads</li>
+ <li>Righthand label on wrapped alignments shows correct
+ value</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.08</strong><br> 10/4/06
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Editing can be locked to the selection area</li>
+ <li>Keyboard editing</li>
+ <li>Create sequence features from searches</li>
+ <li>Precalculated annotations can be loaded onto
+ alignments</li>
+ <li>Features file allows grouping of features</li>
+ <li>Annotation Colouring scheme added</li>
+ <li>Smooth fonts off by default - Faster rendering</li>
+ <li>Choose to toggle Autocalculate Consensus On/Off</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Drag & Drop fixed on Linux</li>
+ <li>Jalview Archive file faster to load/save, sequence
+ descriptions saved.</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.07</strong><br> 12/12/05
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>PDB Structure Viewer enhanced</li>
+ <li>Sequence Feature retrieval and display enhanced</li>
+ <li>Choose to output sequence start-end after sequence
+ name for file output</li>
+ <li>Sequence Fetcher WSDBFetch at EBI</li>
+ <li>Applet can read feature files, PDB files and can be
+ used for HTML form input</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>HTML output writes groups and features</li>
+ <li>Group editing is Control and mouse click</li>
+ <li>File IO bugs</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.06</strong><br> 28/9/05
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>View annotations in wrapped mode</li>
+ <li>More options for PCA viewer</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>GUI bugs resolved</li>
+ <li>Runs with -nodisplay from command line</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td height="63">
+ <div align="center">
+ <strong>2.05b</strong><br> 15/9/05
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Choose EPS export as lineart or text</li>
+ <li>Jar files are executable</li>
+ <li>Can read in Uracil - maps to unknown residue</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Known OutOfMemory errors give warning message</li>
+ <li>Overview window calculated more efficiently</li>
+ <li>Several GUI bugs resolved</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.05</strong><br> 30/8/05
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Edit and annotate in "Wrapped" view</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Several GUI bugs resolved</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.04</strong><br> 24/8/05
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Hold down mouse wheel & scroll to change font
+ size</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Improved JPred client reliability</li>
+ <li>Improved loading of Jalview files</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.03</strong><br> 18/8/05
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Set Proxy server name and port in preferences</li>
+ <li>Multiple URL links from sequence ids</li>
+ <li>User Defined Colours can have a scheme name and added
+ to Colour Menu</li>
+ <li>Choose to ignore gaps in consensus calculation</li>
+ <li>Unix users can set default web browser</li>
+ <li>Runs without GUI for batch processing</li>
+ <li>Dynamically generated Web Service Menus</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>InstallAnywhere download for Sparc Solaris</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.02</strong><br> 18/7/05
+ </div>
+ </td>
+ <td> </td>
+ <td>
+ <ul>
+ <li>Copy & Paste order of sequences maintains
+ alignment order.</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.01</strong><br> 12/7/05
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>Use delete key for deleting selection.</li>
+ <li>Use Mouse wheel to scroll sequences.</li>
+ <li>Help file updated to describe how to add alignment
+ annotations.</li>
+ <li>Version and build date written to build properties
+ file.</li>
+ <li>InstallAnywhere installation will check for updates
+ at launch of Jalview.</li>
+ </ul>
+ </td>
+ <td>
+ <ul>
+ <li>Delete gaps bug fixed.</li>
+ <li>FileChooser sorts columns.</li>
+ <li>Can remove groups one by one.</li>
+ <li>Filechooser icons installed.</li>
+ <li>Finder ignores return character when searching.
+ Return key will initiate a search.<br>
+ </li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div align="center">
+ <strong>2.0</strong><br> 20/6/05
+ </div>
+ </td>
+ <td>
+ <ul>
+ <li>New codebase</li>
+ </ul>
+ </td>
+ <td> </td>
+ </tr>
+ </table>
+ <p> </p>
</body>
</html>
diff --git a/help/html/vamsas/index.html b/help/html/vamsas/index.html
index 20c0897..87b6102 100644
--- a/help/html/vamsas/index.html
+++ b/help/html/vamsas/index.html
@@ -1,136 +1,158 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>VAMSAS Interoperation</title>
</head>
<body>
-<p><strong>VAMSAS Interoperation</strong></p>
-<p>Jalview can interact with other applications using "the <strong>VAMSAS
-Interoperation framework</strong>" which is an experimental model for
-interoperation between bioinformatics applications (<strong>V</strong>isualization
-and <strong>A</strong>nalysis of <strong>Molecular</strong> <strong>S</strong>equences,
-<strong>Alignements</strong> and <strong>S</strong>tructures).
-Currently, the only other VAMSAS enabled application is <a
- href="http://www.topali.org">TOPALi</a> - a user friendly program for
-phylogenetics and evolutionary analysis.
-<p>VAMSAS enabled applications access a shared bioinformatics
-dataset containing sequences, alignments, annotation and trees, which
-can be represented by an XML document analogous to a <a
- href="../features/jalarchive.html">Jalview Project Archive</a>.</p>
-<br>
-<strong>Connecting to a VAMSAS session</strong><br>
-The VAMSAS functionality in Jalview is accessed through the Desktop's <strong>Vamsas</strong>
-menu. The options available in this menu depend on whether the
-application is currently interacting with a VAMSAS dataset in a <strong>VAMSAS
-session</strong>. When the application is not connected to a session is active,
-the menu options are as follows:<br>
-<ul>
- <li><em>Connect to an existing session</em><br>
- If visible, this submenu contains a list of existing sessions that the
- VAMSAS framework has discovered on your computer. <br>
- Choose one to connect to it.</li>
- <li><em>New VAMSAS Session</em><br>
- This option will create a new session on your computer.</li>
- <li><em>Load VAMSAS Session...</em><br>
- This option will open a file browser window allowing you to select a
- VAMSAS session archive from which a new session will be created.<br/>
- <em>New in 2.5:</em>Sessions created from an imported document inherit
- the file or URL for the document.</li>
+ <p>
+ <strong>VAMSAS Interoperation</strong>
+ </p>
+ <p>
+ Jalview can interact with other applications using "the <strong>VAMSAS
+ Interoperation framework</strong>" which is an experimental model for
+ interoperation between bioinformatics applications (<strong>V</strong>isualization
+ and <strong>A</strong>nalysis of <strong>Molecular</strong> <strong>S</strong>equences,
+ <strong>Alignements</strong> and <strong>S</strong>tructures).
+ Currently, the only other VAMSAS enabled application is <a
+ href="http://www.topali.org"
+ >TOPALi</a> - a user friendly program for phylogenetics and
+ evolutionary analysis.
+ <p>
+ VAMSAS enabled applications access a shared bioinformatics dataset
+ containing sequences, alignments, annotation and trees, which can be
+ represented by an XML document analogous to a <a
+ href="../features/jalarchive.html"
+ >Jalview Project Archive</a>.
+ </p>
+ <br>
+ <strong>Connecting to a VAMSAS session</strong>
+ <br> The VAMSAS functionality in Jalview is accessed through the
+ Desktop's
+ <strong>Vamsas</strong> menu. The options available in this menu
+ depend on whether the application is currently interacting with a
+ VAMSAS dataset in a
+ <strong>VAMSAS session</strong>. When the application is not connected
+ to a session is active, the menu options are as follows:
+ <br>
+ <ul>
+ <li><em>Connect to an existing session</em><br> If
+ visible, this submenu contains a list of existing sessions that
+ the VAMSAS framework has discovered on your computer. <br>
+ Choose one to connect to it.</li>
+ <li><em>New VAMSAS Session</em><br> This option will
+ create a new session on your computer.</li>
+ <li><em>Load VAMSAS Session...</em><br> This option will
+ open a file browser window allowing you to select a VAMSAS session
+ archive from which a new session will be created.<br /> <em>New
+ in 2.5:</em>Sessions created from an imported document inherit the
+ file or URL for the document.</li>
-</ul>
-<br>
-<strong>VAMSAS and Firewalls</strong>: VAMSAS uses sockets to
-communicate between different programs. This means that after starting a
-session, your firewall software may ask you whether to allow the java
-executable access to the internet (port 53782). If you do not allow
-this, messages will not be exchanged with other VAMSAS applications.</br>
-<br>
-Once you have successfully connected to a VAMSAS session, any data made
-available by other VAMSAS applications will be automatically imported
-into Jalview. However, in order to share the data in Jalview with other
-VAMSAS applications, you must manually select the <strong>Vamsas→"Session
-Update"</strong> entry that is visible when a session is active. Selecting
-this option will update the VAMSAS session document, with the data
-loaded into Jalview. Any new alignments, trees and annotation will be
-written to the session, in addition to any edits you have made to data
-originally stored in the document. <br>
-<strong>Saving the current session</strong><br>
-You can save the current session as a VAMSAS Session archive using the <strong>Vamsas→"Session
-Update"</strong>. The file contains a snapshot of the current VAMSAS
-session, including data from any other applications connected to the
-session. <strong>Leaving a VAMSAS session</strong><br>
-A session can be disconnected from at any time using the <strong>Vamsas→"Stop
-Session"</strong> option. Selecting this option will only disconnect Jalview
-from the session - any other applications will remain connected to the
-session. If Jalview is the only application connected to the session and
-you have not yet saved the VAMSAS session then you will be prompted with
-an optional 'Save VAMSAS session...' dialog box, allowing the session to
-be saved and returned to at a later date. <br>
-<strong>VAMSAS Session Persistence</strong><br>
-VAMSAS sessions are persistent - this means that they exist
-independently of any VAMSAS applications that are connected to them.
-This means that if something goes wrong with a VAMSAS application and it
-crashes or otherwise fails, the VAMSAS session it is connected to will
-(hopefully) be unaffected. For instance, if Jalview is killed or crashes
-whilst it is still connected to a session, that session can be recovered
-in a new Jalview instance using the <strong>Vamsas→"Existing
-session"</strong> sub menu.</p>
-<strong>A quick Demo</strong>
-<br>
-Jalview can talk to itself through VAMSAS. Simply start two copies of
-the application, create a new vamsas session in one, and connect to the
-new session in the other. Then load your data into one of the
-applications, and use the
-<strong>Vamsas→"Session Update"</strong>
-menu entry to try to propagate the data to the other application.
-<br>
-<table>
- <tr>
- <td>Data Sharing Capability</td>
- <td>Jalview Version</td>
- </tr>
- <tr>
- <td>Alignments, sequences and annotation, trees, database
- references, cDNA/protein mappings.</td>
- <td>2.4</td>
- </tr>
- <tr>
- <td>Mouseover location across linked DNA, protein and structure
- positions.</td>
- <td>2.4</td>
- </tr>
- <tr>
- <td>Jalview project settings (Multiple views, groups, tree
- partitions, colouring, window positions)</td>
- <td>2.5</td>
- </tr>
- <tr>
- <td>Sequence region and column selections</td>
- <td>2.5</td>
- </tr>
-</table>
-<br />
-<p>Version 0.2 of the VAMSAS client library is used in <em>Jalview
-2.5</em>. For further details about the VAMSAS framework, please check the
-<a href="http://www.vamsas.ac.uk">VAMSAS website</a>. The VAMSAS
-framework is implemented as a Java 1.4 Library and depends on a number
-of other open source projects. Its source is released under the
-LGPL license. </p>
+ </ul>
+ <br>
+ <strong>VAMSAS and Firewalls</strong>: VAMSAS uses sockets to
+ communicate between different programs. This means that after starting
+ a session, your firewall software may ask you whether to allow the
+ java executable access to the internet (port 53782). If you do not
+ allow this, messages will not be exchanged with other VAMSAS
+ applications.
+ </br>
+ <br> Once you have successfully connected to a VAMSAS session,
+ any data made available by other VAMSAS applications will be
+ automatically imported into Jalview. However, in order to share the
+ data in Jalview with other VAMSAS applications, you must manually
+ select the
+ <strong>Vamsas→"Session Update"</strong> entry that is
+ visible when a session is active. Selecting this option will update
+ the VAMSAS session document, with the data loaded into Jalview. Any
+ new alignments, trees and annotation will be written to the session,
+ in addition to any edits you have made to data originally stored in
+ the document.
+ <br>
+ <strong>Saving the current session</strong>
+ <br> You can save the current session as a VAMSAS Session archive
+ using the
+ <strong>Vamsas→"Session Update"</strong>. The file
+ contains a snapshot of the current VAMSAS session, including data from
+ any other applications connected to the session.
+ <strong>Leaving a VAMSAS session</strong>
+ <br> A session can be disconnected from at any time using the
+ <strong>Vamsas→"Stop Session"</strong> option.
+ Selecting this option will only disconnect Jalview from the session -
+ any other applications will remain connected to the session. If
+ Jalview is the only application connected to the session and you have
+ not yet saved the VAMSAS session then you will be prompted with an
+ optional 'Save VAMSAS session...' dialog box, allowing the session to
+ be saved and returned to at a later date.
+ <br>
+ <strong>VAMSAS Session Persistence</strong>
+ <br> VAMSAS sessions are persistent - this means that they exist
+ independently of any VAMSAS applications that are connected to them.
+ This means that if something goes wrong with a VAMSAS application and
+ it crashes or otherwise fails, the VAMSAS session it is connected to
+ will (hopefully) be unaffected. For instance, if Jalview is killed or
+ crashes whilst it is still connected to a session, that session can be
+ recovered in a new Jalview instance using the
+ <strong>Vamsas→"Existing session"</strong> sub menu.
+ </p>
+ <p>
+ <strong>A quick Demo</strong> <br> Jalview can talk to itself
+ through VAMSAS. Simply start two copies of the application, create a
+ new vamsas session in one, and connect to the new session in the
+ other. Then load your data into one of the applications, and use the
+ <strong>Vamsas→"Session Update"</strong> menu entry
+ to try to propagate the data to the other application. <br>
+ <table>
+ <tr>
+ <td>Data Sharing Capability</td>
+ <td>Jalview Version</td>
+ </tr>
+ <tr>
+ <td>Alignments, sequences and annotation, trees, database
+ references, cDNA/protein mappings.</td>
+ <td>2.4</td>
+ </tr>
+ <tr>
+ <td>Mouseover location across linked DNA, protein and
+ structure positions.</td>
+ <td>2.4</td>
+ </tr>
+ <tr>
+ <td>Jalview project settings (Multiple views, groups, tree
+ partitions, colouring, window positions)</td>
+ <td>2.5</td>
+ </tr>
+ <tr>
+ <td>Sequence region and column selections</td>
+ <td>2.5</td>
+ </tr>
+ </table>
+ <br />
+ <p>
+ Version 0.2 of the VAMSAS client library is used in <em>Jalview
+ 2.5</em>. For further details about the VAMSAS framework, please check
+ the <a href="http://www.vamsas.ac.uk">VAMSAS website</a>. The VAMSAS
+ framework is implemented as a Java 1.4 Library and depends on a
+ number of other open source projects. Its source is released under
+ the LGPL license.
+ </p>
</body>
</html>
diff --git a/help/html/webServices/AACon.html b/help/html/webServices/AACon.html
new file mode 100644
index 0000000..07473f2
--- /dev/null
+++ b/help/html/webServices/AACon.html
@@ -0,0 +1,74 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>AACon Web Service</title>
+</head>
+<body>
+ <strong>AACon Alignment Conservation Calculation Service</strong>
+ <p>The JABAWS AACon service implements 17 different conservation
+ scores for protein sequence alignments.</p>
+ <p>
+ The majority of these scores were described by Valdar in 2002
+ (Scoring residue conservation. <em>Proteins: Structure,
+ Function, and Genetics</em> 43(2): 227-241. <a
+ href="http://www.ncbi.nlm.nih.gov/pubmed/12112692"
+ >PubMed</a> or available on the <a
+ href="http://www.well.ox.ac.uk/~valdar/publications.html"
+ >Valdar Group publications page</a>), but the SMERFs score was
+ developed later and described by Manning et al. in 2008 (<a
+ href="http://www.biomedcentral.com/1471-2105/9/51"
+ >BMC Bioinformatics 2008, 9:51 doi:10.1186/1471-2105-9-51</a>).
+ </p>
+ <p>
+ <strong>Enabling and disabling AACon calculations</strong><br />
+ When the <strong>AACon Calculation</strong> entry in the <strong>Web
+ Services→Conservation</strong> is ticked, AACon calculations will be
+ performed every time the alignment is modified. Selecting the menu
+ item will enable or disable automatic recalculation.
+ </p>
+ <p>
+ <strong>Configuring which AACon calculations are performed</strong><br />
+ The <strong>Web Services→Conservation→Change
+ AACon Settings ...</strong> menu entry will open a <a
+ href="webServicesParams.html"
+ >web services parameter dialog</a> for the currently configured AACon
+ server. Standard presets are provided for quick and more expensive
+ conservation calculations, and parameters are also provided to
+ change the way that SMERFS calculations are performed.<br /> <em>AACon
+ settings for an alignment are saved in <a
+ href="../features/jalarchive.html"
+ >Jalview projects</a> along with the latest calculation results.
+ </em>
+ </p>
+ <p>
+ <strong>Changing the server used for AACon calculations</strong><br />
+ If you are working with alignments too large to analyse with the
+ public JABAWS server, then you will most likely have already
+ configured <a href="webServicesPrefs.html">additional JABAWS
+ servers</a>. By default, Jalview will chose the first AACon service
+ available from the list of JABAWS servers available. If available,
+ you can switch to use another AACon service by selecting it from the
+ <strong>Web Services→Conservation→Switch Server</strong>
+ submenu.
+ </p>
+</body>
+</html>
diff --git a/help/html/webServices/JABAWS.html b/help/html/webServices/JABAWS.html
index 58950b9..f12b081 100644
--- a/help/html/webServices/JABAWS.html
+++ b/help/html/webServices/JABAWS.html
@@ -1,61 +1,81 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>The JABAWS system</title>
</head>
<body>
-<p><strong>The</strong> <strong><em>JA</em></strong>va <strong><em>B</em></strong>ioinformatics
-<strong><em>A</em></strong>nalysis <strong><em>W</em></strong>eb <strong><em>S</em></strong>ervices
-<strong>system</strong> (<strong>JABAWS</strong>)<br>
-Jalview includes a client for interacting with programmatic (SOAP) web
-services for the <a href="http://www.compbio.dundee.ac.uk/jabaws">JABAWS</a>
-service model, developed at the University of Dundee by Peter Troshin
-and Geoff Barton. This is an open source system that provides a
-framework for wrapping command line bioinformatics analysis programs
-that enables them to be executed locally or on a cluster using data and
-analysis parameters provided by a program linked with the JABA engine directly or
-accessing it remotely <em>via</em> its web services interface.</p>
-<p>The list of JABAWS servers known to the Jalview desktop is shown
-in the <a href="webServicesPrefs.html">Web Services Preferences
-Panel</a>, and detailed information about a particular service is available
-from the help text and web pages accessible from its <a
- href="webServicesParams.html">job parameters dialog box</a>.</p>
-<p><strong>Obtaining JABAWS</strong><br>
-One of the aims of JABAWS is to enable you to easily perform
-computationally intensive bioinformatics analysis tasks using your own
-computational facilities. It can be installed on a workstation to
-provide stand-alone execution of analysis programs, or as a job
-submission engine - enabling larger numbers of jobs to be handled. If
-you would like to download and install JABAWS for your own use, please
-go to <a href="http://www.compbio.dundee.ac.uk/jabaws">http://www.compbio.dundee.ac.uk/jabaws</a>
-for more information.</p>
-<p><strong>Configuring your own JABAWS services for use by
-Jalview</strong><br>
-Once you have downloaded and installed JABAWS, and verified it is
-working, all that is needed is to add the URL for your JABAWS server(s) to
-the list in the <a href="webServicesPrefs.html">Web Services
-Preferences Panel</a>. After adding your service and saving your preferences
-or hitting the 'refresh web services' button, you should be able to
-submit jobs to the server via the alignment window's web services menu.
-Your JABAWS servers list is stored in your Jalview preferences, so you
-will only have to configure Jalview once for each new server.</p>
-<p><em>Support for accessing JABAWS servers was introduced in
-Jalview 2.6.</em></p>
+ <p>
+ <strong>The</strong> <strong><em>JA</em></strong>va <strong><em>B</em></strong>ioinformatics
+ <strong><em>A</em></strong>nalysis <strong><em>W</em></strong>eb <strong><em>S</em></strong>ervices
+ <strong>system</strong> (<strong>JABAWS</strong>)<br> Jalview
+ includes a client for interacting with programmatic (SOAP) web
+ services for the <a href="http://www.compbio.dundee.ac.uk/jabaws">JABAWS</a>
+ service model, developed at the University of Dundee by Peter
+ Troshin and Geoff Barton. This is an open source system that
+ provides a framework for wrapping command line bioinformatics
+ analysis programs that enables them to be executed locally or on a
+ cluster using data and analysis parameters provided by a program
+ linked with the JABA engine directly or accessing it remotely <em>via</em>
+ its web services interface.
+ </p>
+ <p>
+ The list of JABAWS servers known to the Jalview desktop is shown in
+ the <a href="webServicesPrefs.html">Web Services Preferences
+ Panel</a>, and detailed information about a particular service is
+ available from the help text and web pages accessible from its <a
+ href="webServicesParams.html"
+ >job parameters dialog box</a>.
+ </p>
+ <p>
+ <strong>Obtaining JABAWS</strong><br> One of the aims of JABAWS
+ is to enable you to easily perform computationally intensive
+ bioinformatics analysis tasks using your own computational
+ facilities. It can be installed on a workstation to provide
+ stand-alone execution of analysis programs, or as a job submission
+ engine - enabling larger numbers of jobs to be handled. If you would
+ like to download and install JABAWS for your own use, please go to <a
+ href="http://www.compbio.dundee.ac.uk/jabaws"
+ >http://www.compbio.dundee.ac.uk/jabaws</a> for more information.
+ </p>
+ <p>
+ <strong>Configuring your own JABAWS services for use by
+ Jalview</strong><br> Once you have downloaded and installed JABAWS,
+ and verified it is working, all that is needed is to add the URL for
+ your JABAWS server(s) to the list in the <a
+ href="webServicesPrefs.html"
+ >Web Services Preferences Panel</a>. After adding your service and
+ saving your preferences or hitting the 'refresh web services'
+ button, you should be able to submit jobs to the server via the
+ alignment window's web services menu. Your JABAWS servers list is
+ stored in your Jalview preferences, so you will only have to
+ configure Jalview once for each new server.
+ </p>
+ <p>
+ <em>Support for accessing JABAWS servers was introduced in
+ Jalview 2.6.</em>
+ </p>
+ <p>
+ <em>Option for adding JABAWS servers which fails validation was
+ introduced from version 2.8.2 </em>
+ </p>
</body>
</html>
diff --git a/help/html/webServices/RNAalifold.html b/help/html/webServices/RNAalifold.html
new file mode 100644
index 0000000..60e27cf
--- /dev/null
+++ b/help/html/webServices/RNAalifold.html
@@ -0,0 +1,89 @@
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="ISO-8859-1">
+<title>RNAalifold Web Service</title>
+</head>
+<body>
+ <strong>RNAalifold RNA Alignment Secondary Structure
+ Prediction Service</strong>
+ <p>
+ RNAalifold analyses the pattern of base pair conservation in an RNA
+ alignment in order to predict a consensus secondary structure.<br>It
+ is part of the <a href="http://www.tbi.univie.ac.at/RNA/">Vienna
+ RNA</a> Secondary Structure Prediction and Comparison Package. It was
+ described in 2008 by Ivo L. Hofacker, Sebastian Will, Andreas R.
+ Gruber, and Peter F. Stadler, <em>RNAalifold: Improved
+ consensus structure prediction for RNA alignments</em> (BMC
+ Bioinformatics, 9:474, 2008). Download the paper at <a
+ href="http://www.biomedcentral.com/1471-2105/9/474"
+ >http://www.biomedcentral.com/1471-2105/9/474</a>.
+ </p>
+ <p>
+ <strong>Running RNAalifold from Jalview</strong><br />
+ <p>
+ Jalview supports access to RNAalifold services provided by JABA 2.1
+ servers. To enable RNAalifold predictions for an RNA alignment, go
+ to <strong>Webservices→Secondary Structure Prediction</strong>
+ and select <strong>RNAalifold prediction</strong> to run with
+ current defaults, and <strong>Change settings ...</strong> to adjust
+ prediction parameters. The RNA secondary structure prediction for
+ the alignment will be shown as alignment annotation, and any edits
+ will trigger the prediction to be recalculated.
+ <p>
+ <Strong>RNAalifold prediction parameters</Strong> <br /> JABAWS and
+ Jalview only provide access to a selection of the RNAalifold
+ arguments. For a full description, see the documentation at <a
+ href="http://www.tbi.univie.ac.at/RNA/RNAalifold.html"
+ >http://www.tbi.univie.ac.at/RNA/RNAalifold.html</a>.
+ </p>
+ <p>
+ <strong>Supported Arguments which give alternate structures</strong>
+ </p>
+ <p>
+ <em>Partition Function (-p)</em><br /> Calculate the Partition
+ Function and base pairing probability matrix in addition to the mfe
+ structure. A coarse representation of the pair probabilities in the
+ form of a pseudo bracket notation, as well as the centroid structure
+ derived from the pair probabilities are displayed. The most likely
+ base pairings are stored in a separate file by RNAalifold and
+ represented in Jalview by a bar graph annotation line labeled
+ 'Contact Probabilities'.
+ </p>
+ <p>
+ <em>Maximum Expected Accuracy Structure (--MEA)</em><br />
+ Calculate an MEA structure where the expected Accuracy is computed
+ from the base pair probabilities. A more detailed description can be
+ found in the <strong>RNAfold</strong> program documentation at <a
+ href="http://www.tbi.univie.ac.at/RNA/RNAfold.html"
+ >http://www.tbi.univie.ac.at/RNA/RNAfold.html</a>.
+ </p>
+ <p>
+ <strong>Example RNAalifold Structure Annotation rows</strong>
+ <p>
+ <div align="center">
+ <img src="RNAalifoldAnnotationRows.png" width="500" height="216">
+ </div>
+ <p>
+</body>
+</html>
diff --git a/help/html/webServices/RNAalifoldAnnotationRows.png b/help/html/webServices/RNAalifoldAnnotationRows.png
new file mode 100644
index 0000000..5077d19
Binary files /dev/null and b/help/html/webServices/RNAalifoldAnnotationRows.png differ
diff --git a/help/html/webServices/dbreffetcher.html b/help/html/webServices/dbreffetcher.html
index f62012c..fdf48a1 100644
--- a/help/html/webServices/dbreffetcher.html
+++ b/help/html/webServices/dbreffetcher.html
@@ -1,77 +1,97 @@
-<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-Database Reference Fetching
-</head>
-<p>
-<p><strong>Discovering Database References for Sequences</strong><br>
-Database references are associated with a sequence are displayed as a
-list in the tooltip shown when mousing over its sequence ID. Jalview
-uses references for the retrieval of <a
- href="../features/viewingpdbs.html">PDB structures</a> and <a
- href="../features/dasfeatures.html">DAS features</a>, and for
-retrieving sequence cross-references such as the protein products of a
-DNA sequence.</p>
-<p><strong>Initiating reference retrieval</strong><br>
-The application provides three ways to access the retrieval function. Either:
-<ul><li>select the <strong>Discover PDB IDs</strong> option from the structure submenu of the sequence's popup menu</li>
-<li>Choose one of the options from the 'Fetch DB Refs' submenu in the alignment window's <strong>Web Services</strong> menu:<ul>
-<li><em>Standard Databases</em> will fetch references from the EBI databases plus currently selected DAS sources</li>
-<li>The other entries submenus leading to lists of individual database sources that Jalview can access.</li></ul></li>
-<li>Answer 'Yes' when asked if you wish to retrieve database references for your sequences after initiating a DAS Sequence Feature fetch.</li>
-</ul>
-<p>Jalview discovers references for a sequence by generating a set
-of ID queries from the ID string of each sequence in the alignment. It
-then tries to query a subset of all the databases it can access in order to match
-the alignment sequence to any records retrieved from the database. If a
-match is found, then the sequence is annotated with that database's
-reference, and any cross-references that it's records contain.</p>
-<p><strong>The Sequence Identification Process</strong><br>
-The method of accession id discovery is derived from the method which
-earlier Jalview versions used for Uniprot sequence feature retrieval,
-and was originally restricted to the identifaction of valid Uniprot
-accessions.<br>
-Essentially, Jalview will try to retrieve records from a subset of the databases
-accessible by the <a href="../features/seqfetch.html">sequence
-fetcher</a> using each sequence's ID string (or each string in the ID
-separated by the '∣' symbol).</p>
-<p>If a record (or set of records) is retrieved by any query derived
-from the ID string of a sequence, then the sequence is aligned to the
-ones retrieved to determine the correct start and end residue positions
-(which are displayed when the 'Show Full Sequence ID' option). This is
-important for the correct display of the location of any features
-associated with that database.</p>
-<p>If the alignment reveals differences between the sequence in the
-alignment and the one in the record, then Jalview will assume that the
-aligned sequence is not the one in the retrieved record.</p>
-<p>In some cases, the ID used to retrieve records may be out
-of date and a dialog box will be opened indicating that a 100% match
-between the sequence and the record was identified, but the
-sequence name is different. In this case, the can be manually
-changed (by right clicking on the sequence ID and selecting <strong>Sequence→Edit
-Name</strong>).
-<ul>
- <li><em>Note</em><br>
- Please remember to save your alignment if either the start/end
- numbering, or the sequence IDs were updated during the ID
- retrieval process.</li>
-</ul>
-<body></body>
-</html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>Database Reference Fetching
+</head>
+<p>
+<p>
+ <strong>Discovering Database References for Sequences</strong><br>
+ Database references are associated with a sequence are displayed as a
+ list in the tooltip shown when mousing over its sequence ID. Jalview
+ uses references for the retrieval of <a
+ href="../features/viewingpdbs.html"
+ >PDB structures</a> and <a href="../features/dasfeatures.html">DAS
+ features</a>, and for retrieving sequence cross-references such as the
+ protein products of a DNA sequence.
+</p>
+<p>
+ <strong>Initiating reference retrieval</strong><br> The
+ application provides three ways to access the retrieval function.
+ Either:
+<ul>
+ <li>select the <strong>Discover PDB IDs</strong> option from the
+ structure submenu of the sequence's popup menu
+ </li>
+ <li>Choose one of the options from the 'Fetch DB Refs' submenu in
+ the alignment window's <strong>Web Services</strong> menu:
+ <ul>
+ <li><em>Standard Databases</em> will fetch references from
+ the EBI databases plus currently selected DAS sources</li>
+ <li>The other entries submenus leading to lists of individual
+ database sources that Jalview can access.</li>
+ </ul>
+ </li>
+ <li>Answer 'Yes' when asked if you wish to retrieve database
+ references for your sequences after initiating a DAS Sequence
+ Feature fetch.</li>
+</ul>
+<p>Jalview discovers references for a sequence by generating a set
+ of ID queries from the ID string of each sequence in the alignment. It
+ then tries to query a subset of all the databases it can access in
+ order to match the alignment sequence to any records retrieved from
+ the database. If a match is found, then the sequence is annotated with
+ that database's reference, and any cross-references that its records
+ contain.</p>
+<p>
+ <strong>The Sequence Identification Process</strong><br> The
+ method of accession id discovery is derived from the method which
+ earlier Jalview versions used for Uniprot sequence feature retrieval,
+ and was originally restricted to the identification of valid Uniprot
+ accessions.<br> Essentially, Jalview will try to retrieve records
+ from a subset of the databases accessible by the <a
+ href="../features/seqfetch.html"
+ >sequence fetcher</a> using each sequence's ID string (or each string in
+ the ID separated by the '∣' symbol).
+</p>
+<p>If a record (or set of records) is retrieved by any query derived
+ from the ID string of a sequence, then the sequence is aligned to the
+ ones retrieved to determine the correct start and end residue
+ positions (which are displayed when the 'Show Full Sequence ID'
+ option). This is important for the correct display of the location of
+ any features associated with that database.</p>
+<p>If the alignment reveals differences between the sequence in the
+ alignment and the one in the record, then Jalview will assume that the
+ aligned sequence is not the one in the retrieved record.</p>
+<p>
+ In some cases, the ID used to retrieve records may be out of date and
+ a dialog box will be opened indicating that a 100% match between the
+ sequence and the record was identified, but the sequence name is
+ different. In this case, the can be manually changed (by right
+ clicking on the sequence ID and selecting <strong>Sequence→Edit
+ Name</strong>).
+<ul>
+ <li><em>Note</em><br> Please remember to save your alignment
+ if either the start/end numbering, or the sequence IDs were updated
+ during the ID retrieval process.</li>
+</ul>
+<body></body>
+</html>
diff --git a/help/html/webServices/index.html b/help/html/webServices/index.html
index 21bceca..fd2584a 100644
--- a/help/html/webServices/index.html
+++ b/help/html/webServices/index.html
@@ -1,97 +1,98 @@
-
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<html>
<head>
<title>Web Services</title>
</head>
<body>
- <p>
- <strong>Web services</strong>
- </p>
+ <p>
+ <strong>Web services</strong>
+ </p>
- <p>Jalview includes clients for a variety of web services for both
- bioinformatic data retrieval and analysis.
- <ul>
- <li>The <a href="../features/seqfetch.html">Sequence Fetcher</a>
- utilises web services for sequence, alignment and structure retrieval
- provided by the European Bioinformatics Institute (EBI) and
- Distributed Annotation System servers that are capable of serving
- sequences.</li>
- <li>The <a href="../features/dasfeatures.html">DAS Feature
- Fetcher</a> enables the retrieval and visualization of features from DAS
- annotation sources</li>
- <li>The <a href="dbreffetcher.html">Database Reference
- Fetcher</a> transfers database references from records available from
- DAS or the public sequence databases.</li>
- <li>The <strong>Web Services</strong> menu in each alignment
- window also provides access to the following:
- <ul>
- <li>Programs for <a href="msaclient.html">multiple sequence
- alignment</a>, made available <em>via</em> <a href="JABAWS.html">Java
- Bioinformatic Analysis Web Service (JABAWS)</a> servers.</li>
- <li>Jalview SOAP Web Services for <a href="jnet.html">secondary
- structure prediction</a> based at the University of Dundee.</li>
- <li>Services for alignment analysis, such as <a
- href="shmr.html">Multi-Harmony</a>.
- <li>Services for submitting IDs and sequences to external
- bioinformatics services such as Envision2 (see <a href="#envision2">below</a>).</li>
- </ul>
- <p>
- <strong>Web Service Dialog Box</strong>
- </p> <img src="clwqueued.gif">
- <p>This dialog box is displayed when a web service job is
- submitted. It gives the name of the service and any method citation
- information, and monitors the progress of the calculation. The
- cancel button will permanently cancel the job, but this is only
- possible for some services.</p> The <a href="webServicesPrefs.html">Web
- Services Preference panel</a> controls the display and appearance of the
- submission and analysis services in the <strong>Web Services</strong>
- menu.</li>
- <li>If Jalview encounters problems accessing any services, it may
- display a <a href="webServicesPrefs.html#wswarnings">warning
- dialog box</a> (this can be turned off using the web services
- preferences tab).</li>
- </ul>
- </p>
- <p>
- <strong>More about Jalview's Web Services</strong> <br> Jalview's
- distributed computations utilise <a
- href="http://en.wikipedia.org/wiki/SOAP">SOAP</a> and <a
- href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a>
- web services exposing sequence alignment, analysis, and secondary
- structure prediction programs. Originally, Jalview 2's services were
- maintained by the Barton group at the University of Dundee, and ran
- programs on the Life Sciences High-performace Computing Cluster. With
- the advent of <a href="http://www.compbio.dundee.ac.uk/JABAWS">JABAWS</a>,
- however, it is possible for anyone to host Jalview web services.
- </p>
- <p>
- <strong><a name="envision2">Envision2 Services</a>
- </strong>
- </p>
- <p>
- Since version 2.5, Jalview has included a client to enable the user to
- submit one or more sequences or sequence IDs to analysis workflows
- provided by the <a href="http://www.ebi.ac.uk/enfin-srv/envision2">EnVision2
- web application</a>. This allows Jalview users to easily access the
- EnCore network of databases and analysis services developed by ENFIN (<a
- href="http://www.enfin.org">www.enfin.org</a>).
- </p>
+ <p>Jalview includes clients for a variety of web services for both
+ bioinformatic data retrieval and analysis.
+ <ul>
+ <li>The <a href="../features/seqfetch.html">Sequence
+ Fetcher</a> utilises web services for sequence, alignment and
+ structure retrieval provided by the European Bioinformatics
+ Institute (EBI) and Distributed Annotation System servers that are
+ capable of serving sequences.
+ </li>
+ <li>The <a href="../features/dasfeatures.html">DAS Feature
+ Fetcher</a> enables the retrieval and visualization of features from
+ DAS annotation sources
+ </li>
+ <li>The <a href="dbreffetcher.html">Database Reference
+ Fetcher</a> transfers database references from records available
+ from DAS or the public sequence databases.
+ </li>
+ <li>The <strong>Web Services</strong> menu in each alignment
+ window also provides access to the following:
+ <ul>
+ <li>Programs for <a href="msaclient.html">multiple
+ sequence alignment</a>, made available <em>via</em> <a
+ href="JABAWS.html"
+ >Java Bioinformatic Analysis Web Service (JABAWS)</a> servers.
+ </li>
+ <li>Jalview SOAP Web Services for <a href="jnet.html">secondary
+ structure prediction</a> based at the University of Dundee.
+ </li>
+ <li>Services for alignment analysis, such as <a
+ href="shmr.html"
+ >Multi-Harmony</a>.
+ </ul>
+ <p>
+ <strong>Web Service Dialog Box</strong>
+ </p> <img src="clwqueued.gif">
+ <p>This dialog box is displayed when a web service job is
+ submitted. It gives the name of the service and any method
+ citation information, and monitors the progress of the
+ calculation. The cancel button will permanently cancel the job,
+ but this is only possible for some services.</p> The <a
+ href="webServicesPrefs.html"
+ >Web Services Preference panel</a> controls the display and appearance
+ of the submission and analysis services in the <strong>Web
+ Services</strong> menu.
+ </li>
+ <li>If Jalview encounters problems accessing any services, it
+ may display a <a href="webServicesPrefs.html#wswarnings">warning
+ dialog box</a> (this can be turned off using the web services
+ preferences tab).
+ </li>
+ </ul>
+ </p>
+ <p>
+ <strong>More about Jalview's Web Services</strong> <br>
+ Jalview's distributed computations utilise <a
+ href="http://en.wikipedia.org/wiki/SOAP"
+ >SOAP</a> and <a
+ href="http://en.wikipedia.org/wiki/Representational_State_Transfer"
+ >REST</a> web services exposing sequence alignment, analysis, and
+ secondary structure prediction programs. Originally, Jalview 2's
+ services were maintained by the Barton group at the University of
+ Dundee, and ran programs on the Life Sciences High-performace
+ Computing Cluster. With the advent of <a
+ href="http://www.compbio.dundee.ac.uk/JABAWS"
+ >JABAWS</a>, however, it is possible for anyone to host Jalview web
+ services.
+ </p>
</body>
</html>
diff --git a/help/html/webServices/jnet.html b/help/html/webServices/jnet.html
index 3009823..a2fdeb1 100644
--- a/help/html/webServices/jnet.html
+++ b/help/html/webServices/jnet.html
@@ -1,116 +1,139 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>JNet Secondary Structure Prediction</title>
</head>
<body>
-<strong>JNet Secondary Structure Prediction</strong>
-<p>Secondary structure prediction methods attempts to infer the
-likely secondary structure for a protein based on its amino acid
-composition and similarity to sequences with known secondary structure.
-The JNet method uses several different neural networks and decides on
-the most likely prediction via a jury network. <br>
-<ul>
- <li>Cole C., Barber J.D. and Barton G.J. (2008) The Jpred 3
- secondary structure prediction server <em>Nucleic Acids Research</em> <strong>36</strong>
- W197-W201</li>
- <li>Cuff J. A and Barton G.J (1999) Application of enhanced
- multiple sequence alignment profiles to improve protein secondary
- structure prediction <em>Proteins</em> <strong>40</strong> 502-511</li>
-</ul>
-</p>
-The function available from the
-<strong>Web Service→Secondary Structure
-Prediction→JNet Secondary Structure Prediction</strong>
-menu does two different kinds of prediction, dependent upon the
-currently selected region:
-</p>
-<ul>
- <li>If nothing is selected, and the displayed sequences appear to
- be aligned, then a JNet prediction will be run for the first sequence
- in the alignment, using the current alignment. Otherwise the first
- sequence will be submitted for prediction.</li>
- <li>If just one sequence (or a region on one sequence) has been
- selected, it will be submitted to the automatic JNet prediction server
- for homolog detection and prediction.</li>
- <li>If a set of sequences are selected, and they appear to be
- aligned, then the alignment will be used for a Jnet prediction on the <strong>first</strong>
- sequence selected in the set (that is, the one nearest the top of the
- alignment window).</li>
-</ul>
-<p><strong>Note</strong>: JNet secondary structure prediction is a
-'non-column-separable' service - predictions are based on the sequence
-profile of contiguous stretches of amino-acid sequence. A prediction
-will only be made on the visible parts of a sequence (see <a
- href="../features/hiddenRegions.html">hiding columns</a>) as if it were
-a contiguous polypeptide chain. Prediction accuracy at the hidden column
-boundaries may therefore be less than indicated by JNet's own
-reliability score (see below).</p>
-<p>The result of a JNet prediction for a sequence is a new annotated
-alignment window:</p>
-<img src="jnetprediction.gif">
-<p>The sequence for which the prediction was made is the first one
-in the alignment. If a sequence based prediction was made then the
-remaining sequences in the alignment are the aligned parts of homologs
-which were used to construct a sequence profile for the prediction. If
-the prediction was made using a multiple alignment, then the original
-multiple alignment will be returned, annotated with the prediction.</p>
-The annotation bars below the alignment are as follows:
-</p>
-<ul>
- <li>Lupas_21, Lupas_14, Lupas_28<br>
- <em>Coiled-coil predictions for the sequence. These are binary
- predictions for each location.</em></li>
- <li>JNETSOL25,JNETSOL5,JNETSOL0<br>
- <em>Solvent accessibility predictions - binary predictions of 25%,
- 5% or 0% solvent accessibility.</em></li>
- <li>JNetPRED<br>
- <em>The consensus prediction - helices are marked as red tubes,
- and sheets as dark green arrows.</em></li>
- <li>JNetCONF<br>
- <em>The confidence estimate for the prediction. High values mean
- high confidence. prediction - helices are marked as red tubes, and
- sheets as dark green arrows.</em></li>
- <li>JNetALIGN<br>
- <em>Alignment based prediction - helices are marked as red tubes,
- and sheets as dark green arrows.</em></li>
- <li>JNetHMM<br>
- <em>HMM profile based prediction - helices are marked as red
- tubes, and sheets as dark green arrows.</em></li>
- <li>jpred<br>
- <em>Jpred prediction - helices are marked as red tubes, and sheets
- as dark green arrows.</em></li>
- <li>JNETPSSM<br>
- <em>PSSM based prediction - helices are marked as red tubes, and
- sheets as dark green arrows.</em></li>
- <li>JNETFREQ<br>
- <em>Amino Acid frequency based prediction - helices are marked as
- red tubes, and sheets as dark green arrows.</em></li>
- <li>JNETJURY<br>
- <em>A '*' in this annotation indicates that the JNETJURY was
- invoked to rationalise significantly different primary predictions.</em></li>
-</ul>
-</p>
-<em>As of Jalview 2.6, the Jnet service accessed accessed via the
-'Secondary structure prediction' submenu should be considered a legacy
-Jalview SOAP service, and will be replaced in the near future by a
-JABAWS Jnet service.</em>
+ <strong>JNet Secondary Structure Prediction</strong>
+ <p>
+ Secondary structure prediction methods attempts to infer the likely
+ secondary structure for a protein based on its amino acid
+ composition and similarity to sequences with known secondary
+ structure. The most recent version of the method, JPred4, employs a
+ series of neural networks trained to predict different secondary
+ structure types from a sequence profile, and when necessary, employs
+ a jury network to identify the most likely secondary structure
+ prediction.<br>
+ <ul>
+ <li>Drozdetskiy A, Cole C, Procter J & Barton GJ. (2015)<br />
+ JPred4: a protein secondary structure prediction server<br /> <em>Nucleic
+ Acids Research</em>, <strong>Web Server issue</strong> (first
+ published 15th April 2015)<br /> <a
+ href="http://dx.doi.org/10.1093/nar/gkv332"
+ >http://dx.doi.org/10.1093/nar/gkv332</a>
+ </li>
+ <li>Cole C., Barber J.D. and Barton G.J. (2008) The Jpred 3
+ secondary structure prediction server <em>Nucleic Acids
+ Research</em> <strong>36</strong> W197-W201
+ </li>
+ <li>Cuff J. A and Barton G.J (1999) Application of enhanced
+ multiple sequence alignment profiles to improve protein secondary
+ structure prediction <em>Proteins</em> <strong>40</strong> 502-511
+ </li>
+ </ul>
+ </p>
+ The function available from the
+ <strong>Web Service→Secondary Structure
+ Prediction→JNet Secondary Structure Prediction</strong> menu does two
+ different kinds of prediction, dependent upon the currently selected
+ region:
+ </p>
+ <ul>
+ <li>If nothing is selected, and the displayed sequences appear
+ to be aligned, then a JNet prediction will be run for the first
+ sequence in the alignment, using the current alignment. Otherwise
+ the first sequence will be submitted for prediction.</li>
+ <li>If just one sequence (or a region on one sequence) has been
+ selected, it will be submitted to the automatic JNet prediction
+ server for homolog detection and prediction.</li>
+ <li>If a set of sequences are selected, and they appear to be
+ aligned, then the alignment will be used for a Jnet prediction on
+ the <strong>first</strong> sequence selected in the set (that is,
+ the one nearest the top of the alignment window).
+ </li>
+ </ul>
+ <p>
+ <strong>Note</strong>: JNet secondary structure prediction is a
+ 'non-column-separable' service - predictions are based on the
+ sequence profile of contiguous stretches of amino-acid sequence. A
+ prediction will only be made on the visible parts of a sequence (see
+ <a href="../features/hiddenRegions.html">hiding columns</a>) as if
+ it were a contiguous polypeptide chain. Prediction accuracy at the
+ hidden column boundaries may therefore be less than indicated by
+ JNet's own reliability score (see below).
+ </p>
+ <p>The result of a JNet prediction for a sequence is a new
+ annotated alignment window:</p>
+ <img src="jnetprediction.gif">
+ <p>The sequence for which the prediction was made is the first one
+ in the alignment. If a sequence based prediction was made then the
+ remaining sequences in the alignment are the aligned parts of
+ homologs which were used to construct a sequence profile for the
+ prediction. If the prediction was made using a multiple alignment,
+ then the original multiple alignment will be returned, annotated
+ with the prediction.</p>
+ The annotation bars below the alignment are as follows:
+ </p>
+ <ul>
+ <li>Lupas_21, Lupas_14, Lupas_28<br> <em>Coiled-coil
+ predictions for the sequence. These are binary predictions for
+ each location.</em></li>
+ <li>JNETSOL25,JNETSOL5,JNETSOL0<br> <em>Solvent
+ accessibility predictions - binary predictions of 25%, 5% or 0%
+ solvent accessibility.</em></li>
+ <li>JNetPRED<br> <em>The consensus prediction -
+ helices are marked as red tubes, and sheets as dark green
+ arrows.</em></li>
+ <li>JNetCONF<br> <em>The confidence estimate for the
+ prediction. High values mean high confidence. prediction -
+ helices are marked as red tubes, and sheets as dark green
+ arrows.</em></li>
+ <li>JNetALIGN<br> <em>Alignment based prediction -
+ helices are marked as red tubes, and sheets as dark green
+ arrows.</em></li>
+ <li>JNetHMM<br> <em>HMM profile based prediction -
+ helices are marked as red tubes, and sheets as dark green
+ arrows.</em></li>
+ <li>jpred<br> <em>Jpred prediction - helices are
+ marked as red tubes, and sheets as dark green arrows.</em></li>
+ <li>JNETPSSM<br> <em>PSSM based prediction - helices
+ are marked as red tubes, and sheets as dark green arrows.</em></li>
+ <li>JNETFREQ<br> <em>Amino Acid frequency based
+ prediction - helices are marked as red tubes, and sheets as dark
+ green arrows.</em></li>
+ <li>JNETJURY<br> <em>A '*' in this annotation
+ indicates that the JNETJURY was invoked to rationalise
+ significantly different primary predictions.</em></li>
+ </ul>
+ </p>
+ <em>JNet annotation created in Jalview 2.8.2 and later versions
+ can be displayed on other alignments via the <a
+ href="../features/annotation.html#seqannots"
+ >Add reference annotation</a> Sequence ID popup menu option.
+ </em>
+ <em>As of Jalview 2.6, the Jnet service accessed accessed via the
+ 'Secondary structure prediction' submenu should be considered a
+ legacy Jalview SOAP service, and will be replaced in the near future
+ by a JPred4 Rest service.</em>
</body>
</html>
diff --git a/help/html/webServices/msaclient.html b/help/html/webServices/msaclient.html
index 5736258..24851d9 100644
--- a/help/html/webServices/msaclient.html
+++ b/help/html/webServices/msaclient.html
@@ -1,75 +1,94 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Multiple Sequence Alignment Web Service</title>
</head>
<body>
-<strong>Multiple Sequence Alignment Web Services</strong>
- <p>
- Multiple sequence alignment services are accessed from the <strong>Alignment</strong>
- submenu of the Alignment Window's <strong>Web Service</strong> menu.
- When an entry from one of these menus is selected, either the
- currently selected residues, or the whole sequence set (if there is no
- selection or only one sequence is selected) will be submitted for
- multiple sequence alignment.
- </p>
- <p>There are two kinds of multiple sequence alignment operations
-available:
-<ul>
- <li><em>alignment</em> - where a new alignment is constructed from
- the input</li>
- <li><em>realignment</em> - where any aligned sequences will be
- used by the service to construct a profile based alignment of the
- remaining unaligned sequences.</li>
-</ul>
- <strong>JABAWS Alignment services</strong><br> Most alignment services are
- provided by the
- <a href="JABAWS.html">JABAWS framework</a>, which allows you to
- customise the precise parameters used when running each alignment
- prgoram. In addition to the 'Default settings', you may choose from a
- range of alignment preset settings, or create your own using the
- <a href="webServicesParams.html">'Edit Settings And Run ..' dialog
- box</a>.
- </p>
- <p><strong>Alignment programs supported by JABAWS</strong><ul>
- <li><a href="http://www.clustal.org/">ClustalW</a> (version 2.0.12)</li>
- <li><a href="http://align.bmr.kyushu-u.ac.jp/mafft/software/">Mafft</a> (version 6.713)</li>
- <li><a href="http://www.drive5.com/muscle">Muscle</a> (version 3.7) </li>
- <li><a href="http://www.tcoffee.org/Projects_home_page/t_coffee_home_page.html">Tcoffee</a> (version 8.14) </li>
- <li><a href="http://probcons.stanford.edu/">Probcons</a> (version 1.12)</li>
+ <strong>Multiple Sequence Alignment Web Services</strong>
+ <p>
+ Multiple sequence alignment services are accessed from the <strong>Alignment</strong>
+ submenu of the Alignment Window's <strong>Web Service</strong> menu.
+ When an entry from one of these menus is selected, either the
+ currently selected residues, or the whole sequence set (if there is
+ no selection or only one sequence is selected) will be submitted for
+ multiple sequence alignment.
+ </p>
+ <p>There are two kinds of multiple sequence alignment operations
+ available:
+ <ul>
+ <li><em>alignment</em> - where a new alignment is constructed
+ from the input</li>
+ <li><em>realignment</em> - where any aligned sequences will be
+ used by the service to construct a profile based alignment of the
+ remaining unaligned sequences.</li>
+ </ul>
+ <strong>JABAWS Alignment services</strong>
+ <br> Most alignment services are provided by the
+ <a href="JABAWS.html">JABAWS framework</a>, which allows you to
+ customise the precise parameters used when running each alignment
+ prgoram. In addition to the 'Default settings', you may choose from a
+ range of alignment preset settings, or create your own using the
+ <a href="webServicesParams.html">'Edit Settings And Run ..' dialog
+ box</a>.
+ </p>
+ <p>
+ <strong>Alignment programs supported by JABAWS</strong>. <br />Versions
+ shown are those bundled with JABAWS 2.01 - if you are using a
+ different server, check its home page to find out which versions are
+ provided.
+ <ul>
+ <li><a href="http://www.clustal.org/">Clustal Omega and
+ Clustal W</a> (version 2.0.12)</li>
+ <li><a href="http://align.bmr.kyushu-u.ac.jp/mafft/software/">Mafft</a>
+ (version 6.8.57b)</li>
+ <li><a href="http://www.drive5.com/muscle">Muscle</a> (version
+ 3.8.31)</li>
+ <li><a
+ href="http://www.tcoffee.org/Projects_home_page/t_coffee_home_page.html"
+ >Tcoffee</a> (version 8.99)</li>
+ <li><a href="http://probcons.stanford.edu/">Probcons</a>
+ (version 1.12)</li>
</ul>
-</p>
+ </p>
-<p><strong>Multiple Alignments of Sequences with hidden
-columns</strong><br>
-Multiple alignment services are 'column separable' analysis operations.
-If the input contains <a href="../features/hiddenRegions.html">hidden
-columns</a> then each visible segment of the input sequence set will be
-submitted for alignment separately, and the results concatenated (with
-the hidden regions preserved) once all alignment functions have
-completed. Each sub-job's state is reported in its own tab:
-<p>
-<center><strong>Multiple Multiple Sequence Alignment
-sub jobs running at once</strong>
-<center>
-</p>
-<center><img src="multimafftjbs.gif" align="centre"></center>
-</p>
+ <p>
+ <strong>Multiple Alignments of Sequences with hidden
+ columns</strong><br> Multiple alignment services are 'column
+ separable' analysis operations. If the input contains <a
+ href="../features/hiddenRegions.html"
+ >hidden columns</a> then each visible segment of the input sequence
+ set will be submitted for alignment separately, and the results
+ concatenated (with the hidden regions preserved) once all alignment
+ functions have completed. Each sub-job's state is reported in its
+ own tab:
+ <p>
+ <center>
+ <strong>Multiple Multiple Sequence Alignment sub jobs
+ running at once</strong>
+ <center>
+ </p>
+ <center>
+ <img src="multimafftjbs.gif" align="centre">
+ </center>
+ </p>
</body>
</html>
diff --git a/help/html/webServices/newsreader.html b/help/html/webServices/newsreader.html
index cc5bb0d..44bddea 100644
--- a/help/html/webServices/newsreader.html
+++ b/help/html/webServices/newsreader.html
@@ -1,28 +1,50 @@
<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>Jalview Desktop RSS News Reader
</head>
<body>
- <p>
- <strong>The Jalview Desktop RSS News Reader</strong><br /> The
- Jalview Desktop includes a built in news reader for the <a
- href="http://www.jalview.org/feeds/desktop/rss">Jalview Desktop
- News Channel</a>.
- </p>
+ <p>
+ <strong>The Jalview Desktop RSS News Reader</strong><br /> The
+ Jalview Desktop includes a built in news reader for the <a
+ href="http://www.jalview.org/feeds/desktop/rss"
+ >Jalview Desktop News Channel</a>.
+ </p>
- <p>We will use the desktop news channel to keep you informed of
- important updates relevant to users of the Jalview desktop, such as
- web service outages and user community events.</p>
- <p>The news reader will be launched automatically when you start
- the Desktop if new items are available. Should you want to browse
- older items, however, you can open it manually from the 'Jalview news
- reader' option in the Desktop's 'Tools' menu.</p>
- <img src="jalviewrssreader.gif" align="center" width="513" height="337"
- alt="Snapshot of the Jalview Desktop's RSS reader" />
- <p>
- The <em>Jalview news reader</em> was introduced in <a
- href="http://www.jalview.org/releaseHistory.html#Jalview2.7">Jalview
- version 2.7</a>. Its implementation is based on <a
- href="http://jswingreader.sourceforge.net/">JSwingReader</a>.
- </p>
+ <p>We will use the desktop news channel to keep you informed of
+ important updates relevant to users of the Jalview desktop, such as
+ web service outages and user community events.</p>
+ <p>The news reader will be launched automatically when you start
+ the Desktop if new items are available. Should you want to browse
+ older items, however, you can open it manually from the 'Jalview
+ news reader' option in the Desktop's 'Tools' menu.</p>
+ <img src="jalviewrssreader.gif" align="center" width="513"
+ height="337" alt="Snapshot of the Jalview Desktop's RSS reader"
+ />
+ <p>
+ The <em>Jalview news reader</em> was introduced in <a
+ href="http://www.jalview.org/releaseHistory.html#Jalview2.7"
+ >Jalview version 2.7</a>. Its implementation is based on <a
+ href="http://jswingreader.sourceforge.net/"
+ >JSwingReader</a>.
+ </p>
</body>
</html>
diff --git a/help/html/webServices/proteinDisorder.html b/help/html/webServices/proteinDisorder.html
new file mode 100644
index 0000000..8841b5e
--- /dev/null
+++ b/help/html/webServices/proteinDisorder.html
@@ -0,0 +1,253 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>JABAWS Protein Disorder Prediction Services</title>
+</head>
+<body>
+ <p>
+ <strong>JABAWS Protein Disorder Prediction Services</strong> <br />
+ The <strong>Web Services→Disorder</strong> menu in the
+ alignment window allows access to protein disorder prediction
+ services provided by the configured <a
+ href="http://www.compbio.dundee.ac.uk/jabaws"
+ >JABAWS servers</a>. Each service operates on sequences in the
+ alignment or currently selected region (<em>since Jalview
+ 2.8.0b1</em>) to identify regions likely to be unstructured or
+ flexible, or alternately, fold to form globular domains.
+ </p>
+ <p>
+ Predictor results include both <a
+ href="../features/seqfeatures.html"
+ >sequence features</a> and sequence associated <a
+ href="../features/annotation.html"
+ >alignment annotation</a> rows. Features display is controlled from
+ the <a href="../features/featureSettings.html">Feature Settings</a>
+ dialog box. Clicking on the ID for a disorder prediction annotation
+ row will highlight or select (if double clicked) the associated
+ sequence for that row. You can also use the <em>Sequence
+ Associated</em> option in the <a
+ href="../colourSchemes/annotationColouring.html"
+ >Colour By Annotation</a> dialog box to colour sequences according to
+ the results of predictors shown as annotation rows.
+ </p>
+ <p>JABAWS 2.0 provides four disorder predictors which are
+ described below:</p>
+ <ul>
+ <li><a href="#disembl">DisEMBL</a></li>
+ <li><a href="#iupred">IUPred</a></li>
+ <li><a href="#ronn">RONN</a></li>
+ <li><a href="#globplot">GlobPlot</a></li>
+ </ul>
+ <p>
+ <strong><a name="disembl"></a><a href="http://dis.embl.de/">DisEMBL
+ (Linding et al., 2003)</a> </strong> <br /> DisEMBL is a set of
+ machine-learning based predictors trained to recognise
+ disorder-related annotation found on PDB structures.
+ </p>
+ <table border="1">
+ <tr>
+ <td><strong>Name</strong></td>
+ <td><strong>Annotation type</strong></td>
+ <td><strong>Description</strong></td>
+ </tr>
+ <tr>
+ <td><strong>COILS</strong></td>
+ <td>Sequence Feature &<br />Annotation Row
+ </td>
+ <td>Predicts loops/coils according to DSSP definition<a
+ href="#dsspstates"
+ >[1]</a>.<br />Features mark range(s) of residues predicted as
+ loops/coils, and annotation row gives raw value for each
+ residue. Value over 0.516 indicates loop/coil.
+ </td>
+ </tr>
+ <tr>
+ <td><strong>HOTLOOPS</strong></td>
+ <td>Sequence Feature &<br />Annotation Row
+ </td>
+ <td>"Hot loops constitute a refined subset of <strong>COILS</strong>,
+ namely those loops with a high degree of mobility as determined
+ from Cα temperature factors (B factors). It follows that
+ highly dynamic loops should be considered protein
+ disorder."<br /> Features mark range(s) of residues
+ predicted to be hot loops and annotation row gives raw value for
+ each residue. Values over 0.6 indicates hot loop.
+ </td>
+ </tr>
+ <tr>
+ <td><strong>REMARK465</strong></td>
+ <td>Sequence Feature &<br />Annotation Row
+ </td>
+ <td>"Missing coordinates in X-ray structure as defined
+ by remark465 entries in PDB. Nonassigned electron densities most
+ often reflect intrinsic disorder, and have been used early on in
+ disorder prediction."<br /> Features gives range(s) of
+ residues predicted as disordered, and annotation row gives raw
+ value for each residue. Value over 0.1204 indicates disorder.
+ </td>
+ </tr>
+ </table>
+
+ <p>
+ <a name="dsspstates"></a>[1]. DSSP Classification: α-helix
+ (H), 310-helix (G), β-strand (E) are ordered, and all other
+ states (β-bridge (B), β-turn (T), bend (S), π-helix
+ (I), and coil (C)) considered loops or coils.
+ </p>
+
+
+ <p>
+ <strong><a name="ronn"></a><a
+ href="http://www.strubi.ox.ac.uk/RONN"
+ >RONN</a></strong> <em>a.k.a.</em> Regional Order Neural Network<br />This
+ predictor employs an approach known as the 'bio-basis' method to
+ predict regions of disorder in sequences based on their local
+ similarity with a gold-standard set of disordered protein sequences.
+ It yields a set of disorder prediction scores, which are shown as
+ sequence annotation below the alignment.
+ </p>
+ <table border="1">
+ <tr>
+ <td><strong>Name</strong></td>
+ <td><strong>Annotation type</strong></td>
+ <td><strong>Description</strong></td>
+ </tr>
+ <tr>
+ <td><strong>JRonn</strong>[2]</td>
+ <td>Annotation Row</td>
+ <td>RONN score for each residue in the sequence. Scores above
+ 0.5 identify regions of the protein likely to be disordered.</td>
+ </tr>
+ </table>
+ <p>
+ <em>[2]. JRonn denotes the score for this server because JABAWS
+ runs a Java port of RONN developed by Peter Troshin and
+ distributed as part of <a href="http://www.biojava.org/">Biojava
+ 3</a>
+ </em>
+ </p>
+ <p>
+ <strong><a name="iupred"></a><a
+ href="http://iupred.enzim.hu/Help.php"
+ >IUPred</a></strong><br /> IUPred employs an empirical model to estimate
+ likely regions of disorder. There are three different prediction
+ types offered, each using different parameters optimized for
+ slightly different applications. It provides raw scores based on two
+ models for predicting regions of 'long disorder' and 'short
+ disorder'. A third predictor identifies regions likely to form
+ structured domains.
+ </p>
+ <table border="1">
+ <tr>
+ <td><strong>Name</strong></td>
+ <td><strong>Annotation type</strong></td>
+ <td><strong>Description</strong></td>
+ </tr>
+ <tr>
+ <td><strong>Long disorder</strong></td>
+ <td>Annotation Row</td>
+ <td>Prediction of context-independent global disorder that
+ encompasses at least 30 consecutive residues of predicted
+ disorder. Employs a 100 residue window for calculation.<br />Values
+ above 0.5 indicates the residue is intrinsically disordered.
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Short disorder</strong></td>
+ <td>Annotation Row</td>
+ <td>Predictor for short, (and probably) context-dependent,
+ disordered regions, such as missing residues in the X-ray
+ structure of an otherwise globular protein. Employs a 25 residue
+ window for calculation, and includes adjustment parameter for
+ chain termini which favors disorder prediction at the ends.<br />Values
+ above 0.5 indicate short-range disorder.
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Structured domains</strong></td>
+ <td>Sequence Feature</td>
+ <td>Features highlighting likely globular domains useful for
+ structure genomics investigation. <br />Post-analysis of
+ disordered region profile to find continuous regions confidently
+ predicted to be ordered. Neighbouring regions close to each
+ other are merged, while regions shorter than the minimal domain
+ size of at least 30 residues are ignored.
+ </td>
+ </tr>
+ </table>
+ <p>
+ <strong><a name="globplot"></a><a
+ href="http://globplot.embl.de/"
+ >GLOBPLOT</a></strong><br /> Defines regions of globularity or natively
+ unstructured regions based on a running sum of the propensity of
+ residues to be structured or unstructured. The propensity is
+ calculated based on the probability of each amino acid being
+ observed within well defined regions of secondary structure or
+ within regions of random coil. The initial signal is smoothed with a
+ Savitzky-Golay filter, and its first order derivative computed.
+ Residues for which the first order derivative is positive are
+ designated as natively unstructured, whereas those with negative
+ values are structured.<br />
+ <table border="1">
+ <tr>
+ <td><strong>Name</strong></td>
+ <td><strong>Annotation type</strong></td>
+ <td><strong>Description</strong></td>
+ </tr>
+ <tr>
+ <td><strong>Disordered Region</strong></td>
+ <td>Sequence Feature</td>
+ <td><br />Sequence features marking range(s) of residues
+ with positive dydx values (correspond to the #Disorder column
+ from JABAWS results)</td>
+ </tr>
+ <tr>
+ <td><strong>Globular Domain</strong>
+ <td>Sequence Feature</td>
+ <td>Putative globular domains</td>
+ </tr>
+ <tr>
+ <td><strong>Dydx</strong></td>
+ <td>Annotation row</td>
+ <td>First order derivative of smoothed score. Values above 0
+ indicates residue is disordered.</td>
+ </tr>
+ <tr>
+ <td><strong>Smoothed Score<br />Raw Score
+ </strong></td>
+ <td>Annotation Row</td>
+ <td>The smoothed and raw scores used to create the
+ differential signal that indicates the presence of unstructured
+ regions.<br /> <em>These are hidden by default, but can be
+ shown by right-clicking on the alignment annotation panel and
+ selecting <strong>Show hidden annotation</strong>
+ </em>
+ </td>
+ </tr>
+ </table>
+ <p>
+ <em>Documentation and thresholds for the JABAWS Disorder
+ predictors adapted from a personal communication by Nancy Giang,
+ 2012.</em>
+ </p>
+</body>
+</html>
diff --git a/help/html/webServices/shmr.html b/help/html/webServices/shmr.html
index 80f8a28..a19d78e 100644
--- a/help/html/webServices/shmr.html
+++ b/help/html/webServices/shmr.html
@@ -1,65 +1,74 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>Multi-Group Sequence Harmony and Multi-Relief</title>
</head>
<body>
- <strong>Functional residue analysis with Sequence Harmony and
- Multi-Relief</strong>
- <p>
- The Multi-Harmony (a.k.a. Sequence Harmony and Multi-Relief, or SHMR) service (<a
- href="#shmrref">Brandt, Feenstra and Heringa, 2010</a>) available
- from the <em>Analysis</em> sub-menu of the alignment window's web
- services menu provides a method for the identification of significant
- patterns of <em>sub-family variation</em> amongst the columns of an
- alignment.
- </p>
- <p>
- <strong>Instructions for use</strong><br> The service requires a
- protein sequence multiple alignment that has been sub-divided into
- groups containing at least two non-identical protein sequences. An
- easy way to create groups is to use the built-in <a
- href="../calculations/tree.html">neighbour-joining or UPGMA tree</a>
- routines to calculate a tree for the alignment, and then click on the
- tree to subdivide the alignment.
- </p>
- <p>
- The SHMR service operates on the currently selected visible region(s)
- of the alignment. Once submitted, a job progress window will display
- status information about your job, including a URL which allows you to
- visit the status page on the
- <a href="http://zeus.few.vu.nl/programs/shmrwww/">IBIVU SHMR server</a>.
- </p>
- <p>When the job is complete, Jalview will automatically open a new
- window containing the alignment and groups that were submitted for
- analysis, with additional histograms added portraying the SHMR scores
- for each column of the sub-grouped alignment.</p>
- <p>
- If you use this service in your work, please cite :<br /><a name="shmrref"/> Brandt,
- B.W.*, Feenstra, K.A*. and Heringa, J. (2010) Multi-Harmony: detecting
- functional specificity from sequence alignment. <a
- href="http://nar.oxfordjournals.org/cgi/content/abstract/gkq415">Nucleic
- Acids Res. 38: W35-W40.</a> (<em>* joint first authors</em>)
- <p>
- <strong><em>Note:</em></strong> The Multi-Harmony service is implemented with a prototype of Jalview's RESTful
- web service client introduced in Jalview 2.7. A few bugs remain in this prototype, which we intend to fixed in version 2.7.1.
- </ul>
- </p>
+ <strong>Functional residue analysis with Sequence Harmony and
+ Multi-Relief</strong>
+ <p>
+ The Multi-Harmony (a.k.a. Sequence Harmony and Multi-Relief, or
+ SHMR) service (<a href="#shmrref">Brandt, Feenstra and Heringa,
+ 2010</a>) available from the <em>Analysis</em> sub-menu of the
+ alignment window's web services menu provides a method for the
+ identification of significant patterns of <em>sub-family
+ variation</em> amongst the columns of an alignment.
+ </p>
+ <p>
+ <strong>Instructions for use</strong><br> The service requires
+ a protein sequence multiple alignment that has been sub-divided into
+ groups containing at least two non-identical protein sequences. An
+ easy way to create groups is to use the built-in <a
+ href="../calculations/tree.html"
+ >neighbour-joining or UPGMA tree</a> routines to calculate a tree for
+ the alignment, and then click on the tree to subdivide the
+ alignment.
+ </p>
+ <p>
+ The SHMR service operates on the currently selected visible
+ region(s) of the alignment. Once submitted, a job progress window
+ will display status information about your job, including a URL
+ which allows you to visit the status page on the <a
+ href="http://zeus.few.vu.nl/programs/shmrwww/"
+ >IBIVU SHMR server</a>.
+ </p>
+ <p>When the job is complete, Jalview will automatically open a new
+ window containing the alignment and groups that were submitted for
+ analysis, with additional histograms added portraying the SHMR
+ scores for each column of the sub-grouped alignment.</p>
+ <p>
+ If you use this service in your work, please cite :<br />
+ <a name="shmrref" /> Brandt, B.W.*, Feenstra, K.A*. and Heringa, J.
+ (2010) Multi-Harmony: detecting functional specificity from sequence
+ alignment. <a
+ href="http://nar.oxfordjournals.org/cgi/content/abstract/gkq415"
+ >Nucleic Acids Res. 38: W35-W40.</a> (<em>* joint first authors</em>)
+
+ <p>
+ <strong><em>Note:</em></strong> The Multi-Harmony service is
+ implemented with a prototype of Jalview's RESTful web service client
+ introduced in Jalview 2.7. A few bugs remain in this prototype,
+ which we intend to fixed in version 2.7.1.
+ </ul>
+ </p>
</body>
</html>
diff --git a/help/html/webServices/urllinks.html b/help/html/webServices/urllinks.html
index dc01f71..3dac542 100644
--- a/help/html/webServices/urllinks.html
+++ b/help/html/webServices/urllinks.html
@@ -1,89 +1,100 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<head>
-Opening URLs from Jalview
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>Opening URLs from Jalview
</head>
<body>
-<p>
-<p><strong>Opening URLs from Jalview</strong><br>
-Both the applet and the desktop application are able to open URLs as
-'popups' in your web browser. <br>
-Double-clicking on the ID of a sequence will open the first URL that can
-be generated from its sequence ID. This is often the SRS site, but you
-can easily configure your own <a href="#urllinks">sequence URL links</a>.</p>
-<p>Other links for a sequence either derived from any other
-configured URL links, or imported from the sequence's annotation, are
-accessed by right clicking to open the sequence pop-up menu, and
-selecting from the <em>Links</em> submenu.</p>
-<p><strong><a name="urllinks">Configuring URL Links</a></strong>
-<br>URL links are defined in the "Connections" tab of the <a
- href="../features/preferences.html">Jalview desktop preferences</a>, or
-specified as <a
- href="http://www.jalview.org/examples/appletParameters.html#parameters">applet
-parameters</a>. <br>
-By default the item "SRS" is added to this link menu. This
-link will show a web page in your default browser with the selected
-sequence id as part of the URL.<br>
-In the preferences dialog box, click <strong>new</strong> to add a new
-link, and <strong>edit</strong> to modify an existing link, or <strong>delete</strong>
-to remove it.<br>
-You can name the link, this will be displayed on a new menu item under
-the "Link" menu when you right click on a sequence id. <br>
-The URL string must contain a token that can be replaced with a sequence
-ID. The simplest token is "$SEQUENCE_ID$", which will be
-replaced by the chosen sequence id when you click on it.</p>
-<p>eg.<br>
-UniRef100 =
-http://www.ebi.uniprot.org/uniprot-srv/uniRefView.do?proteinAc=$SEQUENCE_ID$&library=uniref100<br>
-Swissprot = http://www.expasy.org/uniprot/$SEQUENCE_ID$ <br>
-<br>
-Links will also be made for any database cross references associated
-with the sequence where the database name exactly matches a URL link
-name. In this case, the $SEQUENCE_ID$ string will be replaced with the
-accession string for the database cross-reference, rather than the
-sequence ID for the sequence (<em>since Jalview 2.4</em>).</p>
-<p><strong>Regular Expression Substitution</strong><br>
-A url may contain a string of the form $SEQUENCE_ID=/<em>regular
-expression</em>/=$. In this case, the regular expression will be applied to
-the full sequence ID string and the resulting match will be inserted
-into the URL. Groups of parentheses can be used to specify which regions
-of the regular expression will be used to generate the URL:
-<ul>
- <li>Each top level parenthesis will yield a URL containing the
- text matched within that parenthesis.</li>
- <li>Regions matching sub-parentheses within a top-level
- parenthesis will be concatenated to form the text inserted into the URL
- for the top-level parenthesis.</li>
- <em>Please Note:
- <ul>
- <li>The regular expressions supported by Jalview are those
- provided by the <a href="www.javaregex.com">Stevesoft javaregex
- package</a>.</li>
- <li>Some characters must be escaped when specifying them as a
- match within a regular expression.</li>
- </ul>
- <br>
- Many Thanks to Bernd Brandt of the Free University of Amsterdam for
- testing this new regular-expression expansion feature! </em>
- <em>
-</ul>
-</p>
-</p>
+ <p>
+ <p>
+ <strong>Opening URLs from Jalview</strong><br> Both the applet
+ and the desktop application are able to open URLs as 'popups' in
+ your web browser. <br> Double-clicking on the ID of a sequence
+ will open the first URL that can be generated from its sequence ID.
+ This is often the SRS site, but you can easily configure your own <a
+ href="#urllinks"
+ >sequence URL links</a>.
+ </p>
+ <p>
+ Other links for a sequence either derived from any other configured
+ URL links, or imported from the sequence's annotation, are accessed
+ by right clicking to open the sequence pop-up menu, and selecting
+ from the <em>Links</em> submenu.
+ </p>
+ <p>
+ <strong><a name="urllinks">Configuring URL Links</a></strong> <br>URL
+ links are defined in the "Connections" tab of the <a
+ href="../features/preferences.html"
+ >Jalview desktop preferences</a>, or specified as <a
+ href="http://www.jalview.org/examples/appletParameters.html#parameters"
+ >applet parameters</a>. <br> By default the item "SRS"
+ is added to this link menu. This link will show a web page in your
+ default browser with the selected sequence id as part of the URL.<br>
+ In the preferences dialog box, click <strong>new</strong> to add a
+ new link, and <strong>edit</strong> to modify an existing link, or <strong>delete</strong>
+ to remove it.<br> You can name the link, this will be displayed
+ on a new menu item under the "Link" menu when you right
+ click on a sequence id. <br> The URL string must contain a
+ token that can be replaced with a sequence ID. The simplest token is
+ "$SEQUENCE_ID$", which will be replaced by the chosen
+ sequence id when you click on it.
+ </p>
+ <p>
+ eg.<br> UniRef100 =
+ http://www.ebi.uniprot.org/uniprot-srv/uniRefView.do?proteinAc=$SEQUENCE_ID$&library=uniref100<br>
+ Swissprot = http://www.expasy.org/uniprot/$SEQUENCE_ID$ <br> <br>
+ Links will also be made for any database cross references associated
+ with the sequence where the database name exactly matches a URL link
+ name. In this case, the $SEQUENCE_ID$ string will be replaced with
+ the accession string for the database cross-reference, rather than
+ the sequence ID for the sequence (<em>since Jalview 2.4</em>).
+ </p>
+ <p>
+ <strong>Regular Expression Substitution</strong><br> A url may
+ contain a string of the form $SEQUENCE_ID=/<em>regular
+ expression</em>/=$. In this case, the regular expression will be
+ applied to the full sequence ID string and the resulting match will
+ be inserted into the URL. Groups of parentheses can be used to
+ specify which regions of the regular expression will be used to
+ generate the URL:
+ <ul>
+ <li>Each top level parenthesis will yield a URL containing the
+ text matched within that parenthesis.</li>
+ <li>Regions matching sub-parentheses within a top-level
+ parenthesis will be concatenated to form the text inserted into
+ the URL for the top-level parenthesis.</li>
+ <em>Please Note:
+ <ul>
+ <li>The regular expressions supported by Jalview are those
+ provided by the <a href="www.javaregex.com">Stevesoft
+ javaregex package</a>.
+ </li>
+ <li>Some characters must be escaped when specifying them as
+ a match within a regular expression.</li>
+ </ul> <br> Many Thanks to Bernd Brandt of the Free University of
+ Amsterdam for testing this new regular-expression expansion
+ feature!
+ </em>
+ <em>
+ </ul>
+ </p>
+ </p>
</body>
</html>
diff --git a/help/html/webServices/webServicesParams.html b/help/html/webServices/webServicesParams.html
index fd0acf6..63d5468 100644
--- a/help/html/webServices/webServicesParams.html
+++ b/help/html/webServices/webServicesParams.html
@@ -1,86 +1,102 @@
-
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<html>
<head>
<title>Web Service Job Parameter Dialog Box</title>
</head>
<body>
-<p><strong>Web service Job Parameter Dialog box</strong></p>
+ <p>
+ <strong>Web service Job Parameter Dialog box</strong>
+ </p>
-<p>Some Jalview services including those provided by <a
- href="JABAWS.html">JABAWS</a>, support a range of parameters and
-options, enabling you to employ the most appropriate settings for the
-input data. In addition to any preset combinations provided by the
-services themselves, the Web services parameters dialog box also allows
-you to create and store your own parameter sets, so they can be accessed
-quickly from the presets menu.</p>
-<p><Strong>Accessing the parameter dialog box</Strong><br>
-The parameters dialog box is opened by selecting the 'Edit and Run' menu
-entries within the JABAWS analysis submenu of the alignment window's web
-services menu. Once opened, it presents the parameters and options
-available for the chosen analysis for you to modify, and and also
-enables you to browse any available service presets and select, create
-or modify your own user defined parameter sets. Once you are satisfied
-with the analysis parameters, press the <strong>Start Job</strong>
-button to initiate the analysis.</p>
-<p><Strong>Getting help on the analysis parameters</Strong><br>
-Each option or parameter shown in the dialog is accompanied by a brief
-description, which is shown as a tooltip when the mouse is moved over
-it. For some, a link symbol will also be shown (as in the example
-below), indicating that further information is available online. In this
-case, right-clicking (or command-click) will open a pop-up menu allowing
-you to select a URL to open in your web browser.</p>
-<p>
-<center><img src="wsparams.gif" align="center" width="480"
- height="499" alt="Analysis Parameters Dialog Box for JABAWS Services">
-<br>
-Parameter settings dialog box for JABAWS MAFFT Service</center>
-</p>
-<p>The menu and text box at the top of the dialog box displays the
-name of the current parameter set. The name can be edited, should you
-wish to change or create a new user defined set, or clicked to present a
-menu enabling other sets to be browsed. The description shown below may
-also be edited (and the box resized to facilitate this), allowing you to
-provide notes to accompany the parameter set. The modification of these
-or any of the option or parameter settings will enable one or more of
-the following buttons, that allow you to:
-<ul>
- <li><em>Revert</em> the changes you have made. This will undo any
- changes you have made to the parameters and options with respect to the
- currently selected parameter set, reverting each setting to its default
- or last saved value.</li>
- <li><em>Create</em> a new parameter set. Selecting this option
- will create a new parameter set with the given name. New parameter sets
- will be saved for the current session, but a file chooser will also
- open which gives you the option to save the set for use in future
- sessions.</li>
- <li><em>Update</em> an existing user defined parameter set. This
- button will save any modifications you have made to the current
- parameter set.</li>
- <li><em>Rename</em> the current user defined parameter set. This
- will update the name recorded for the current parameter set.</li>
- <li><em>Delete</em> the current parameter set. Selecting this will
- erase the current user defined parameter set from memory, and delete
- its associated parameter file (if it exists).</li>
-</ul>
-</p>
-<p><em>Support for adjusting and saving web service parameter
-sets was added in Jalview 2.6</em></p>
+ <p>
+ Some Jalview services, including those provided by <a
+ href="JABAWS.html"
+ >JABAWS</a>, support a range of parameters and options, enabling you
+ to employ the most appropriate settings for the input data. In
+ addition to any preset combinations provided by services themselves,
+ the Web services parameters dialog box also allows you to create and
+ store your own parameter sets, so they can be accessed quickly from
+ the presets menu.
+ </p>
+ <p>
+ <Strong>Accessing the parameter dialog box</Strong><br> The
+ parameters dialog box is opened by selecting the 'Edit and Run' menu
+ entries within the JABAWS analysis submenu of the alignment window's
+ web services menu. Once opened, it presents the parameters and
+ options available for the chosen analysis for you to modify, and and
+ also enables you to browse any available service presets and select,
+ create or modify your own user defined parameter sets. Once you are
+ satisfied with the analysis parameters, press the <strong>Start
+ Job</strong> button to initiate the analysis.
+ </p>
+ <p>
+ <Strong>Getting help on the analysis parameters</Strong><br>
+ Each option or parameter shown in the dialog is accompanied by a
+ brief description, which is shown as a tooltip when the mouse is
+ moved over it. For some, a link symbol will also be shown (as in the
+ example below), indicating that further information is available
+ online. In this case, right-clicking (or command-click) will open a
+ pop-up menu allowing you to select a URL to open in your web
+ browser.
+ </p>
+ <p>
+ <center>
+ <img src="wsparams.gif" align="center" width="480" height="499"
+ alt="Analysis Parameters Dialog Box for JABAWS Services"
+ > <br> Parameter settings dialog box for JABAWS MAFFT Service
+ </center>
+ </p>
+ <p>The menu and text box at the top of the dialog box displays the
+ name of the current parameter set. The name can be edited, should
+ you wish to change or create a new user defined set, or clicked to
+ present a menu enabling other sets to be browsed. The description
+ shown below may also be edited (and the box resized to facilitate
+ this), allowing you to provide notes to accompany the parameter set.
+ The modification of these or any of the option or parameter settings
+ will enable one or more of the following buttons, that allow you to:
+
+ <ul>
+ <li><em>Revert</em> the changes you have made. This will undo
+ any changes you have made to the parameters and options with
+ respect to the currently selected parameter set, reverting each
+ setting to its default or last saved value.</li>
+ <li><em>Create</em> a new parameter set. Selecting this option
+ will create a new parameter set with the given name. New parameter
+ sets will be saved for the current session, but a file chooser
+ will also open which gives you the option to save the set for use
+ in future sessions.</li>
+ <li><em>Update</em> an existing user defined parameter set.
+ This button will save any modifications you have made to the
+ current parameter set.</li>
+ <li><em>Rename</em> the current user defined parameter set.
+ This will update the name recorded for the current parameter set.</li>
+ <li><em>Delete</em> the current parameter set. Selecting this
+ will erase the current user defined parameter set from memory, and
+ delete its associated parameter file (if it exists).</li>
+ </ul>
+ </p>
+ <p>
+ <em>Support for adjusting and saving web service parameter sets
+ was added in Jalview 2.6</em>
+ </p>
</body>
</html>
diff --git a/help/html/webServices/webServicesPrefs.html b/help/html/webServices/webServicesPrefs.html
index 1187204..ac25ed6 100644
--- a/help/html/webServices/webServicesPrefs.html
+++ b/help/html/webServices/webServicesPrefs.html
@@ -1,79 +1,105 @@
-
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<html>
<head>
<title>The Web Services Preferences Dialog Box</title>
</head>
<body>
-<p><strong>The Web Services Preferences Dialog Box</strong></p>
+ <p>
+ <strong>The Web Services Preferences Dialog Box</strong>
+ </p>
-<p>Jalview includes a range of web services clients for data
-retrieval and analysis. The <em>Web Services</em> menu found in each
-alignment window provides access to some of these services, and is
-configured <em>via</em> the web services preference dialog box,
-available from the <em>Preferences</em> panel from the <strong>Tools→Preferences...</strong>
-menu from the Jalview Desktop window's menu bar.</p>
-<p>
-<center><img src="wsprefs.gif" align="center"
- alt="Web Services Preferences Panel" width="500" height="420"><br>
-Web Services Preference Panel</center>
-</p>
-<p><strong>Configuring the list of JABAWS servers</strong><br>
-The main area of the panel shows the list of <a href="JABAWS.html">JABAWS</a>
-servers that Jalview is currently aware of. A server's URL may be added,
-edited by double clicking on it, or deleted by selecting it and using
-the buttons below. After adding or editing a server's URL, you will be
-asked if you wish to test the server. If you wish to do so, then first
-ensure you can view the new server's test report, which will be output
-on Jalview's standard console output (you can open Jalview's built in
-console viewer via the <strong>Tools→Java Console</strong> menu
-option).</p>
-<p><strong>Controlling the layout of the Web Services Menu</strong><br>
-The range of services that Jalview is able to access depends upon your
-requirements, and local computational resources. However, when a large
-number of resources are available, then the entries and sub menus in the
-<strong>web services</strong> menu can quickly become unwieldly. The
-options in the lower part of the dialog box enable you to control the
-display of each type of analysis service client in the web services
-menu. In addition, indexing options are provided that enable you to
-define the layout of the menus provided for JABAWS services by sorting
-them into submenus according to analysis type and/or host server.</p>
-<p><em>The web services preferences panel was added in Jalview
-2.6</em></p>
-<p><strong><a name="wswarnings">Web Services Invalid
-URL warnings</a></strong><br>
-Jalview may inform you of any problems contacting the web services by
-showing a dialog box like the one below:<br>
-<center><img src="invalidurldialog.gif" align="center"
- alt="Web Services Invalid URL Warning dialog box" width="389"
- height="258"><br>
-Web Services Invalid URL Warning dialog box</center>
-<br>
-<strong><em>Note:</em></strong> this warning will be shown if you are running the Jalview desktop
-without any network connection, or if you have configured
-<a href="JABAWS.html">JABA services</a>
-which cannot be accessed from your location. Should you wish to disable
-these warnings, then uncheck the
-<em>Display warnings</em>
-check box in the web services preferences.
-</p>
-<p><em>The web services warnings dialog box was added in
-Jalview 2.6.1</em></p>
+ <p>
+ Jalview includes a range of web services clients for data retrieval
+ and analysis. The <em>Web Services</em> menu found in each alignment
+ window provides access to some of these services, and is configured
+ <em>via</em> the web services preference dialog box, available from
+ the <em>Preferences</em> panel from the <strong>Tools→Preferences...</strong>
+ menu from the Jalview Desktop window's menu bar.
+ </p>
+ <p>
+ <center>
+ <img src="wsprefs.gif" align="center"
+ alt="Web Services Preferences Panel" width="571" height="461"
+ ><br> Web Services Preference Panel
+ </center>
+ </p>
+ <p>
+ <strong>Configuring the list of JABAWS servers</strong><br> The
+ main area of the panel shows the list of <a href="JABAWS.html">JABAWS</a>
+ servers that Jalview is currently aware of. The list includes a
+ colour coded status: green indicates that all services are available
+ for a given server, amber signifies that one or more services on the
+ server are not fully functional, and red highlights servers that
+ could not be contacted or are not functional for some other reason.
+ </p>
+ <p>
+ A server's URL may be added, edited by double clicking on it, or
+ deleted by selecting it and using the buttons below. After adding or
+ editing a server's URL, you will be asked if you wish to test the
+ server. If you wish to do so, then first ensure you can view the new
+ server's test report, which will be output on Jalview's standard
+ console output (you can open Jalview's built in console viewer via
+ the <strong>Tools→Java Console</strong> menu option).
+ </p>
+ <p>
+ <strong>Controlling the layout of the Web Services Menu</strong><br>
+ The range of services that Jalview is able to access depends upon
+ your requirements, and local computational resources. However, when
+ a large number of resources are available, then the entries and sub
+ menus in the <strong>web services</strong> menu can quickly become
+ unwieldly. The options in the lower part of the dialog box enable
+ you to control the display of each type of analysis service client
+ in the web services menu. In addition, indexing options are provided
+ that enable you to define the layout of the menus provided for
+ JABAWS services by sorting them into submenus according to analysis
+ type and/or host server.
+ </p>
+ <p>
+ <em>The web services preferences panel was added in Jalview
+ 2.6, and server status indications added in Jalview 2.8.</em>
+ </p>
+ <p>
+ <strong><a name="wswarnings">Web Services Invalid URL
+ warnings</a></strong><br> Jalview may inform you of any problems
+ contacting the web services by showing a dialog box like the one
+ below:<br>
+ <center>
+ <img src="invalidurldialog.gif" align="center"
+ alt="Web Services Invalid URL Warning dialog box" width="389"
+ height="258"
+ ><br> Web Services Invalid URL Warning dialog box
+ </center>
+ <br>
+ <strong><em>Note:</em></strong> this warning will be shown if you are
+ running the Jalview desktop without any network connection, or if you
+ have configured
+ <a href="JABAWS.html">JABA services</a> which cannot be accessed from
+ your location. Should you wish to disable these warnings, then uncheck
+ the
+ <em>Display warnings</em> check box in the web services preferences.
+ </p>
+ <p>
+ <em>The web services warnings dialog box was added in Jalview
+ 2.6.1</em>
+ </p>
</body>
</html>
diff --git a/help/html/webServices/wsprefs.gif b/help/html/webServices/wsprefs.gif
index d53dd59..da8e47d 100644
Binary files a/help/html/webServices/wsprefs.gif and b/help/html/webServices/wsprefs.gif differ
diff --git a/help/html/whatsNew.html b/help/html/whatsNew.html
index cf96d47..736e786 100644
--- a/help/html/whatsNew.html
+++ b/help/html/whatsNew.html
@@ -1,103 +1,87 @@
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
<head>
<title>What's new ?</title>
</head>
<body>
- <p>
- <strong>What's new ?</strong>
- </p>
- <p>
- The Jalview 2.7 release features new web services, and important
- improvements to the way in which Jalview handles alignments and
- associated PDB structures, as well as numerous minor improvements and
- bug fixes. Version 2.7 of the JalviewLite applet also features a
- significantly enhanced Javascript API enabling it to be more easily
- integrated with javascript based web applications. <br /> For full
- details see the <a href="releases.html#Jalview2.7">Jalview 2.7
- release history</a>.
- </p>
- <p>
- <strong>Highlights in Jalview Desktop Version 2.7</strong>
- </p>
- <ul>
- <li>New <a href="features/viewingpdbs.html">structure viewer
- options</a>:
- <ul>
- <li>Colour and superimpose 3D structures of complexes and
- multi-domain chains using several different alignments</li>
- <li>Drag and drop to associate PDB files with sequences that
- have the same name</li>
- <li>Open and superimpose all associated structures for the
- current selection</li>
- </ul>
- <li>New web services for <a href="webServices/shmr.html">alignment
- analysis</a></li>
- <li>Improved graphical user interface for <a
- href="http://www.compbio.dundee.ac.uk/jabaws">JABAWS</a>services.
- </li>
- <li>Sort associated alignment views option in tree viewer</li>
- <li>Default colours for <a
- href="colourSchemes/annotationColouring.html">shading alignment
- by quantitative annotation</a>.
- </li>
- <li><a href="webServices/newsreader.html">Jalview Desktop RSS
- reader</a> - following important updates at <a
- href="http://www.jalview.org/feeds/desktop/rss">http://www.jalview.org/feeds/desktop/rss</a>
- </ul>
+ <p>
+ <strong>What's new ?</strong>
+ </p>
+ <p>
+ Jalview 2.9 has been in development since December 2014. In addition
+ to a multitude of bug fixes and minor improvements (both small, and
+ rather big!), it also brings major new capabilities for codon-level
+ analysis of protein alignments and the retrieval and manipulation of
+ structural data.</p><p>For the full list of changes, see the
+ <a href="releases.html#Jalview.2.9">Jalview 2.9 Release Notes</a>.
+ </p>
+ <p>
+ <strong>Highlights in Jalview 2.9</strong>
+ <ul>
+ <li><strong>Visualisation, editing and analysis of
+ cDNA and Protein alignments</strong><br />A new <a
+ href="features/splitView.html">Split View</a> window allows linked
+ protein and nucleotide sequence alignments to be viewed, edited,
+ and analysed as one. <br />cDNA alignments can also be
+ reconstructed from protein alignments calculated by Jalview's web
+ services, and update in response to edits in the amino acid view.<br />To
+ start experimenting with cDNA/Protein analysis, jut drop a file
+ containing cDNA sequences which code for proteins in an existing
+ alignment, and Jalview will do the rest.</li>
+ <li><strong>Enhanced Integration of UCSF Chimera</strong> <br>Jalview
+ 2.9 provides full support for the use of Chimera to view 3D
+ structures linked to alignment views in the Jalview Desktop. We've
+ also included support for saving Chimera sessions in Jalview
+ project files.<br />Jalview and Chimera communicate using local
+ web server connections, which may cause firewall alerts on some
+ systems, but has the advantage of allowing bidirectional
+ communication. Communication between Jalview and Chimera is now
+ much more responsive, and selected regions in Chimera are now
+ shown as highlighted regions in the Jalview desktop.</li>
+ <li><strong>Interactive querying of the PDBe</strong><br />Jalview
+ users can now <a href="features/pdbsequencefetcher.html">browse</a> and <a href="features/viewingpdbs.html">retrieve 3D structure</a> data from the PDB
+ via the <a href="http://www.ebi.ac.uk/pdbe/api/doc/search.html">PDBe
+ Search API</a> (<a href="http://dx.doi.org/10.1093%2Fnar%2Fgkt1180">Gutmanas
+ et al 2014</a>). Developed in collaboration with the PDBe group at
+ EMBL-EBI, the interface allows both structured and free-text
+ queries to be performed, and allows automatic selection of the
+ most relevant structures for an alignment acording to a variety of
+ criteria.</li>
+ <li><strong>Improved support for RNA visualisation</strong><br />Jalview
+ 2.9 integrates the latest version of the <a
+ href="features/varna.html">VARNA RNA Viewer</a>, and VARNA views
+ can also now be stored in Jalview projects. We've also dealt with
+ a number of lingering bugs in the VARNA/Jalview interface,
+ including the loss of pseudoknots when RNA secondary structure is
+ shown VARNA.</li>
+ <li><strong>Protein Secondary Structure predictions
+ with JPred4</strong><br />Jalview includes a number of new features for
+ working with secondary structure predictions from the JPred4
+ server. These include new <a href="menus/popupMenu.html#hideinserts">popup menu actions</a> to automatically hide insertions and highlight
+ mutations in an alignment with respect to a <a href="calculations/referenceseq.html">Reference
+ Sequence</a>. Jalview 2.9's new <a href="io/export.html#htmlexport">scrollable
+ SVG HTML export</a> was also developed specifically for the JPred4
+ server.</li>
+ </ul>
- <p>
- <strong>Issues Resolved (a select list - see the <a
- href="releases.html#Jalview2.7">release history</a> for full details)
- </strong>
- </p>
- <p>
- <strong>Issues in the Jalview Desktop</strong>
- <ul>
- <li>Problems viewing associated structures for sequences
- retrieved from UNIPROT</li>
- <li>Problems viewing Jalview projects from older versions in
- version 2.6</li>
- <li>Preservation of hidden annotation rows and tree bootstrap
- values in projects</li>
- <li>Newly added JABAWS servers not always visible in web services
- menu</li>
- </ul>
- <strong>Issues specific to the JalviewLite Applet</strong>
- <ul>
- <li>Layout problems when lots of annotation rows are displayed</li>
- <li><= shown as = in annotation row tooltip</li>
- <li>export features raises exception when no features exist</li>
- <li>relative URLs not handled properly when used in parameters
- and annotation files</li>
- </ul>
- <strong>Issues affecting both applet and application</strong>
- <ul>
- <li>sequence numbering not preserved in MSF alignment output</li>
- <li>sequence associated secondary structure not correctly parsed
- in interleaved stockholm</li>
- <li>sequences containing lowercase letters are not properly
- associated with their pdb files</li>
- <li>Jalview PDB file reader does not extract sequence from deoxy
- nucleotide chains correctly</li>
- <li>Sequence length given in alignment properties window is off
- by 1</li>
- </ul>
</body>
</html>
diff --git a/jalview-jalopy.xml b/jalview-jalopy.xml
index 014f741..c1329cb 100644
--- a/jalview-jalopy.xml
+++ b/jalview-jalopy.xml
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<jalopy>
<general>
diff --git a/nbbuild.xml b/nbbuild.xml
index 830f355..79ee7eb 100644
--- a/nbbuild.xml
+++ b/nbbuild.xml
@@ -1,21 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?><!--
- Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-
- This file is part of Jalview.
-
- Jalview is free software: you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- Jalview is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- -->
-
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<!--
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
index 3298729..158e222 100644
--- a/nbproject/genfiles.properties
+++ b/nbproject/genfiles.properties
@@ -1,18 +1,18 @@
###############################################################################
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+#
# This file is part of Jalview.
-#
+#
# Jalview is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
+#
# Jalview is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
nbbuild.xml.data.CRC32=f5d3c6c2
diff --git a/nbproject/project.properties b/nbproject/project.properties
index 69d1428..ac1a2e3 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -1,18 +1,18 @@
###############################################################################
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+#
# This file is part of Jalview.
-#
+#
# Jalview is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
+#
# Jalview is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
annotation.processing.enabled=true
@@ -59,11 +59,11 @@ file.reference.jalview-src=src
file.reference.jaxrpc.jar=lib/jaxrpc.jar
file.reference.JGoogleAnalytics_0.3.jar=lib/JGoogleAnalytics_0.3.jar
file.reference.jhall.jar=lib/jhall.jar
-file.reference.Jmol-12.1.13.jar=lib/Jmol-12.1.13.jar
-file.reference.JmolApplet-12.1.13.jar=appletlib/JmolApplet-12.1.13.jar
+file.reference.Jmol-14.2.14_2015.06.11.jar=lib/Jmol-14.2.14_2015.06.11.jar
+file.reference.JmolApplet-14.2.14_2015.06.11.jar=appletlib/JmolApplet-14.2.14_2015.06.11.jar
file.reference.log4j-1.2.8.jar=lib/log4j-1.2.8.jar
file.reference.mail.jar=lib/mail.jar
-file.reference.min-jaba-client.jar=lib/min-jaba-client.jar
+file.reference.min-jaba-client.jar=lib/min-jaba-client-2.0.jar
file.reference.regex.jar=lib/regex.jar
file.reference.saaj.jar=lib/saaj.jar
file.reference.vamsas-client.jar=lib/vamsas-client.jar
@@ -71,6 +71,7 @@ file.reference.wsdl4j.jar=lib/wsdl4j.jar
file.reference.xercesImpl.jar=lib/xercesImpl.jar
file.reference.xml-apis.jar=lib/xml-apis.jar
file.reference.miglayout-4.0-swing.jar=lib/miglayout-4.0-swing.jar
+file.reference.varna-3.9-dev.jar=lib/VARNAv3.9.jar
includes=**
jar.compress=false
javac.classpath=\
@@ -91,7 +92,7 @@ javac.classpath=\
${file.reference.jaxrpc.jar}:\
${file.reference.JGoogleAnalytics_0.3.jar}:\
${file.reference.jhall.jar}:\
- ${file.reference.Jmol-12.1.13.jar}:\
+ ${file.reference.Jmol-14.2.14_2015.06.11.jar}:\
${file.reference.miglayout-4.0-swing.jar}:\
${file.reference.log4j-1.2.8.jar}:\
${file.reference.mail.jar}:\
@@ -100,7 +101,8 @@ javac.classpath=\
${file.reference.xml-apis.jar}:\
${file.reference.xercesImpl.jar}:\
${file.reference.wsdl4j.jar}:\
- ${file.reference.JmolApplet-12.1.13.jar}
+ ${file.reference.JmolApplet-14.2.14_2015.06.11.jar} \
+ ${file.reference.varna-3.9-dev.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
diff --git a/nbproject/project.xml b/nbproject/project.xml
index f3db653..efa19b2 100644
--- a/nbproject/project.xml
+++ b/nbproject/project.xml
@@ -1,21 +1,22 @@
-<?xml version="1.0" encoding="UTF-8"?><!--
- Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-
- This file is part of Jalview.
-
- Jalview is free software: you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- Jalview is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- -->
-
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
diff --git a/resources/authors.props b/resources/authors.props
new file mode 100644
index 0000000..d41c2ca
--- /dev/null
+++ b/resources/authors.props
@@ -0,0 +1,4 @@
+YEAR=2014
+AUTHORS=J Procter, AM Waterhouse, M Carstairs, TC Ofoegbu, J Engelhardt, LM Lui, A Menard, D Barton, N Sherstnev, D Roldan-Martinez, M Clamp, S Searle, G Barton
+AUTHORFNAMES=Jim Procter, Andrew Waterhouse, Mungo Carstairs, Tochukwu 'Charles' Ofoegbu, Jan Engelhardt, Lauren Lui, Anne Menard, Daniel Barton, Natasha Sherstnev, David Roldan-Martinez, Michele Clamp, James Cuff, Steve Searle, David Martin & Geoff Barton
+
\ No newline at end of file
diff --git a/resources/embl_mapping.xml b/resources/embl_mapping.xml
index d3af6c7..957d113 100644
--- a/resources/embl_mapping.xml
+++ b/resources/embl_mapping.xml
@@ -1,158 +1,152 @@
-<?xml version="1.0"?>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<mapping xmlns="http://castor.exolab.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://castor.exolab.org/ ../schemas/castor-mapping.xsd">
-<!--
- History: Originally created from EMBL_common_V1.0
- Updated on 24th April 2007 for WsDBFetch Service move to EMBL_Services_V1.1.xsd
- -->
- <class name="jalview.datamodel.xdb.embl.EmblFile">
- <map-to xml="EMBL_Services"/>
- <field name="entries" type="jalview.datamodel.xdb.embl.EmblEntry" collection="vector">
- <bind-xml name="entry"/>
- </field>
-
- <field name="errors" type="jalview.datamodel.xdb.embl.EmblError" collection="vector">
- <bind-xml name="Error"/>
- </field>
- </class>
- <class name="jalview.datamodel.xdb.embl.EmblEntry">
- <map-to xml="entry"/>
- <field name="accession" type="string">
- <bind-xml location="accession" node="attribute"/>
- </field>
- <field name="lastUpdated" type="string">
- <bind-xml location="last-updated" node="attribute"/>
- </field>
- <field name="version" type="string">
- <bind-xml location="version" node="attribute"/>
- </field>
-
- <field name="rCreated" type="string">
- <bind-xml location="releaseCreated" node="attribute"/>
- </field>
- <field name="rLastUpdated" type="string">
- <bind-xml location="releaseLastUpdated" node="attribute"/>
- </field>
- <field name="desc" type="string">
- <bind-xml name="description" node="element"/>
- </field>
- <field name="Keywords" type="string" collection="vector">
- <bind-xml name="keyword" node="element"/>
- </field>
- <field name="features" type="jalview.datamodel.xdb.embl.EmblFeature" collection="vector">
- <bind-xml name="feature"/>
- </field>
- <field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">
- <bind-xml name="dbreference" />
- </field>
- <field name="sequence" type="jalview.datamodel.xdb.embl.EmblSequence">
- <bind-xml name="sequence"/> <!-- location="sequence" node="element"/ -->
- </field>
- </class>
- <class name="jalview.datamodel.xdb.embl.EmblSequence">
- <map-to xml="sequence"/>
- <field name="type" type="string">
- <bind-xml name="type" node="attribute" location="type"/>
- </field>
- <field name="version" type="string">
- <bind-xml name="version" node="attribute" location="version"/>
- </field>
- <field name="sequence" type="string">
- <bind-xml node="text"/>
- </field>
- </class>
- <class name="jalview.datamodel.xdb.embl.EmblFeature" verify-constructable="false">
- <map-to xml="feature"/>
- <field name="name" type="string">
- <bind-xml name="name" node="attribute"/>
- </field>
- <field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">
- <bind-xml name="dbreference" node="element"/>
- </field>
- <field name="qualifiers" type="jalview.datamodel.xdb.embl.Qualifier" collection="vector">
- <bind-xml name="qualifier"/>
- </field>
- <field name="locations" type="jalview.datamodel.xdb.embl.EmblFeatureLocations" collection="vector">
- <bind-xml name="location"/>
- </field>
- </class>
- <class name="jalview.datamodel.DBRefEntry" verify-constructable="false">
- <field name="accessionId" type="java.lang.String"><!-- set-method="setAccessionId" get-method="getAccessionId"> -->
- <bind-xml name="primary" node="attribute"/>
- </field>
- <field name="source" type="java.lang.String"> <!--set-method="setSource" get-method="getSource"> -->
- <bind-xml name="db" node="attribute"/>
- </field>
- <field name="version" type="string"><!-- set-method="setVersion" get-method="getVersion"> -->
- <bind-xml name="secondary" node="attribute"/>
- </field>
- </class>
- <class name="jalview.datamodel.xdb.embl.Qualifier" verify-constructable="false">
- <map-to xml="Qualifier"/>
- <field name="name">
- <bind-xml name="name" node="attribute"/>
- </field>
- <field name="evidence" type="string" collection="array">
- <bind-xml name="evidence" node="element"/>
- </field>
- <field name="values" type="string" collection="array">
- <bind-xml name="value" node="element"/>
- </field>
- </class>
- <class name="jalview.datamodel.xdb.embl.EmblFeatureLocations">
- <map-to xml="location"/>
- <field name="locationType" type="string">
- <bind-xml name="type" node="attribute"/>
- </field>
- <field name="locationComplement" type="boolean">
- <bind-xml name="complement" node="attribute"/>
- </field>
- <field name="locElements" type="jalview.datamodel.xdb.embl.EmblFeatureLocElement" collection="vector">
- <bind-xml name="locationElement"/>
- </field>
- </class>
- <class name="jalview.datamodel.xdb.embl.EmblFeatureLocElement">
- <map-to xml="locationElement"/>
- <field name="type" type="string">
- <bind-xml name="type" node="attribute"/>
- </field>
- <field name="accession" type="string">
- <bind-xml name="accession" node="attribute"/>
- </field>
- <field name="version" type="string">
- <bind-xml name="version" node="attribute"/>
- </field>
- <field name="complement" type="boolean">
- <bind-xml name="complement"/>
- </field>
- <field name="basePositions" type="jalview.datamodel.xdb.embl.BasePosition" collection="array">
- <bind-xml name="basePosition" node="element"/>
- </field>
- </class>
- <class name="jalview.datamodel.xdb.embl.BasePosition">
- <map-to xml="basePosition"/>
- <field name="type">
- <bind-xml name="type" node="attribute"/>
- </field>
- <field name="pos">
- <bind-xml node="text"/>
- </field>
- </class>
-</mapping>
+<?xml version="1.0"?>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<mapping xmlns="http://castor.exolab.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://castor.exolab.org/ ../schemas/castor-mapping.xsd">
+<!--
+ History: Originally created from EMBL_common_V1.0
+ Updated on 24th April 2007 for WsDBFetch Service move to EMBL_Services_V1.1.xsd
+ -->
+ <class name="jalview.datamodel.xdb.embl.EmblFile">
+ <map-to xml="EMBL_Services"/>
+ <field name="entries" type="jalview.datamodel.xdb.embl.EmblEntry" collection="vector">
+ <bind-xml name="entry"/>
+ </field>
+
+ <field name="errors" type="jalview.datamodel.xdb.embl.EmblError" collection="vector">
+ <bind-xml name="Error"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblEntry">
+ <field name="accession" type="string">
+ <bind-xml location="accession" node="attribute"/>
+ </field>
+ <!-- May 2015 changed from last-updated to match xml -->
+ <field name="lastUpdated" type="string">
+ <bind-xml location="lastUpdated" node="attribute"/>
+ </field>
+ <field name="version" type="string">
+ <bind-xml location="version" node="attribute"/>
+ </field>
+ <field name="rCreated" type="string">
+ <bind-xml location="releaseCreated" node="attribute"/>
+ </field>
+ <field name="rLastUpdated" type="string">
+ <bind-xml location="releaseLastUpdated" node="attribute"/>
+ </field>
+ <field name="desc" type="string">
+ <bind-xml name="description" node="element"/>
+ </field>
+ <field name="keywords" type="string" collection="vector">
+ <bind-xml name="keyword" node="element"/>
+ </field>
+ <field name="features" type="jalview.datamodel.xdb.embl.EmblFeature" collection="vector">
+ <bind-xml name="feature"/>
+ </field>
+ <field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">
+ <bind-xml name="dbreference" />
+ </field>
+ <field name="sequence" type="jalview.datamodel.xdb.embl.EmblSequence">
+ <bind-xml name="sequence"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblSequence">
+ <field name="type" type="string">
+ <bind-xml name="type" node="attribute" location="type"/>
+ </field>
+ <field name="version" type="string">
+ <bind-xml name="version" node="attribute" location="version"/>
+ </field>
+ <field name="sequence" type="string">
+ <bind-xml node="text"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblFeature" verify-constructable="false">
+ <field name="name" type="string">
+ <bind-xml name="name" node="attribute"/>
+ </field>
+ <field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">
+ <bind-xml name="dbreference" node="element"/>
+ </field>
+ <field name="qualifiers" type="jalview.datamodel.xdb.embl.Qualifier" collection="vector">
+ <bind-xml name="qualifier"/>
+ </field>
+ <field name="locations" type="jalview.datamodel.xdb.embl.EmblFeatureLocations" collection="vector">
+ <bind-xml name="location"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.DBRefEntry" verify-constructable="false">
+ <field name="accessionId" type="java.lang.String">
+ <bind-xml name="primary" node="attribute"/>
+ </field>
+ <field name="source" type="java.lang.String">
+ <bind-xml name="db" node="attribute"/>
+ </field>
+ <field name="version" type="string">
+ <bind-xml name="secondary" node="attribute"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.Qualifier" verify-constructable="false">
+ <field name="name">
+ <bind-xml name="name" node="attribute"/>
+ </field>
+ <field name="evidence" type="string" collection="array">
+ <bind-xml name="evidence" node="element"/>
+ </field>
+ <field name="values" type="string" collection="array">
+ <bind-xml name="value" node="element"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblFeatureLocations">
+ <field name="locationType" type="string">
+ <bind-xml name="type" node="attribute"/>
+ </field>
+ <field name="locationComplement" type="boolean">
+ <bind-xml name="complement" node="attribute"/>
+ </field>
+ <field name="locElements" type="jalview.datamodel.xdb.embl.EmblFeatureLocElement" collection="vector">
+ <bind-xml name="locationElement"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblFeatureLocElement">
+ <field name="type" type="string">
+ <bind-xml name="type" node="attribute"/>
+ </field>
+ <field name="accession" type="string">
+ <bind-xml name="accession" node="attribute"/>
+ </field>
+ <field name="version" type="string">
+ <bind-xml name="version" node="attribute"/>
+ </field>
+ <field name="complement" type="boolean">
+ <bind-xml name="complement"/>
+ </field>
+ <field name="basePositions" type="jalview.datamodel.xdb.embl.BasePosition" collection="array">
+ <bind-xml name="basePosition" node="element"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.BasePosition">
+ <field name="type">
+ <bind-xml name="type" node="attribute"/>
+ </field>
+ <field name="pos">
+ <bind-xml node="text"/>
+ </field>
+ </class>
+</mapping>
diff --git a/resources/images/JalviewLogo_Huge.png b/resources/images/JalviewLogo_Huge.png
new file mode 100644
index 0000000..340f8e5
Binary files /dev/null and b/resources/images/JalviewLogo_Huge.png differ
diff --git a/resources/images/JalviewLogo_big.png b/resources/images/JalviewLogo_big.png
new file mode 100644
index 0000000..d0ade1e
Binary files /dev/null and b/resources/images/JalviewLogo_big.png differ
diff --git a/resources/images/Jalview_Logo.png b/resources/images/Jalview_Logo.png
new file mode 100644
index 0000000..06429d9
Binary files /dev/null and b/resources/images/Jalview_Logo.png differ
diff --git a/resources/images/Jalview_Logo_small.png b/resources/images/Jalview_Logo_small.png
new file mode 100644
index 0000000..6206a1c
Binary files /dev/null and b/resources/images/Jalview_Logo_small.png differ
diff --git a/resources/images/dna.png b/resources/images/dna.png
new file mode 100644
index 0000000..f9854fe
Binary files /dev/null and b/resources/images/dna.png differ
diff --git a/resources/images/error.png b/resources/images/error.png
new file mode 100644
index 0000000..6d68a8c
Binary files /dev/null and b/resources/images/error.png differ
diff --git a/resources/images/good.png b/resources/images/good.png
new file mode 100644
index 0000000..ebbacc9
Binary files /dev/null and b/resources/images/good.png differ
diff --git a/resources/images/loading.gif b/resources/images/loading.gif
new file mode 100644
index 0000000..23ed238
Binary files /dev/null and b/resources/images/loading.gif differ
diff --git a/resources/images/logo.gif b/resources/images/logo.gif
index 5aa2080..9702313 100644
Binary files a/resources/images/logo.gif and b/resources/images/logo.gif differ
diff --git a/resources/images/logo_big.gif b/resources/images/logo_big.gif
index e898c94..695785e 100644
Binary files a/resources/images/logo_big.gif and b/resources/images/logo_big.gif differ
diff --git a/resources/images/logo_big.gif b/resources/images/logo_big_v2.gif
similarity index 100%
copy from resources/images/logo_big.gif
copy to resources/images/logo_big_v2.gif
diff --git a/resources/images/logo.gif b/resources/images/logo_v2.gif
similarity index 100%
copy from resources/images/logo.gif
copy to resources/images/logo_v2.gif
diff --git a/resources/images/protein.png b/resources/images/protein.png
new file mode 100644
index 0000000..3789793
Binary files /dev/null and b/resources/images/protein.png differ
diff --git a/resources/images/sugar.png b/resources/images/sugar.png
new file mode 100644
index 0000000..5d62ce5
Binary files /dev/null and b/resources/images/sugar.png differ
diff --git a/resources/images/warning.gif b/resources/images/warning.gif
new file mode 100644
index 0000000..3d57c8c
Binary files /dev/null and b/resources/images/warning.gif differ
diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties
new file mode 100644
index 0000000..05d6427
--- /dev/null
+++ b/resources/lang/Messages.properties
@@ -0,0 +1,1282 @@
+action.refresh_services = Refresh Services
+action.reset_services = Reset Services
+action.merge_results = Merge Results
+action.load_scheme = Load scheme
+action.save_scheme = Save scheme
+action.save_image = Save Image
+action.paste = Paste
+action.show_html_source = Show HTML Source
+action.print = Print...
+action.web_service = Web Service
+action.cancel_job = Cancel Job
+action.start_job = Start Job
+action.revert = Revert
+action.move_down = Move Down
+action.move_up = Move Up
+action.remove_return_datatype = Remove return datatype
+action.add_return_datatype = Add return datatype
+action.remove_input_parameter = Remove selected input parameter
+action.add_input_parameter = Add input parameter
+action.edit = Edit
+action.new = New
+action.open_file = Open file
+action.show_unconserved = Show Unconserved
+action.open_new_alignment = Open new alignment
+action.raise_associated_windows = Raise Associated Windows
+action.minimize_associated_windows = Minimize Associated Windows
+action.close_all = Close all
+action.load_project = Load Project
+action.save_project = Save Project
+action.quit = Quit
+action.expand_views = Expand Views
+action.gather_views = Gather Views
+action.page_setup = Page Setup...
+action.reload = Reload
+action.load = Load
+action.open = Open
+action.cancel = Cancel
+action.create = Create
+action.update = Update
+action.delete = Delete
+action.snapshot = Snapshot
+action.clear = Clear
+action.accept = Accept
+action.select_ddbb = --- Select Database ---
+action.undo = Undo
+action.redo = Redo
+action.reset = Reset
+action.remove_left = Remove left
+action.remove_right = Remove right
+action.remove_empty_columns = Remove Empty Columns
+action.remove_all_gaps = Remove All Gaps
+action.left_justify_alignment = Left Justify Alignment
+action.right_justify_alignment = Right Justify Alignment
+action.boxes = Boxes
+action.text = Text
+action.by_pairwise_id = By Pairwise Identity
+action.by_id = By Id
+action.by_length = By Length
+action.by_group = By Group
+action.unmark_as_reference = Unmark as Reference
+action.set_as_reference = Set as Reference
+action.remove = Remove
+action.remove_redundancy = Remove Redundancy...
+action.pairwise_alignment = Pairwise Alignment
+action.by_rna_helixes = By RNA Helices
+action.user_defined = User Defined...
+action.by_conservation = By Conservation
+action.wrap = Wrap
+action.show_gaps = Show Gaps
+action.show_hidden_markers = Show Hidden Markers
+action.find = Find
+action.undefine_groups = Undefine Groups
+action.create_groups = Create Groups
+action.make_groups_selection = Make Groups For Selection
+action.copy = Copy
+action.cut = Cut
+action.font = Font...
+action.scale_above = Scale Above
+action.scale_left = Scale Left
+action.scale_right = Scale Right
+action.by_tree_order = By Tree Order
+action.sort = Sort
+action.calculate_tree = Calculate Tree
+action.help = Help
+action.by_annotation = By Annotation...
+action.invert_sequence_selection = Invert Sequence Selection
+action.invert_column_selection = Invert Column Selection
+action.show = Show
+action.hide = Hide
+action.ok = OK
+action.set_defaults = Defaults
+action.create_group = Create Group
+action.remove_group = Remove Group
+action.edit_group = Edit Group
+action.border_colour = Border colour
+action.edit_new_group = Edit New Group
+action.hide_sequences = Hide Sequences
+action.sequences = Sequences
+action.ids = IDS
+action.ids_sequences = IDS and sequences
+action.reveal_all = Reveal All
+action.reveal_sequences = Reveal Sequences
+action.find_all = Find all
+action.find_next = Find next
+action.file = File
+action.view = View
+action.annotations = Annotations
+action.change_params = Change Parameters
+action.apply = Apply
+action.apply_threshold_all_groups = Apply threshold to all groups
+action.apply_all_groups = Apply to all Groups
+action.by_chain = By Chain
+action.by_sequence = By Sequence
+action.paste_annotations = Paste Annotations
+action.format = Format
+action.select = Select
+action.new_view = New View
+action.close = Close
+action.add = Add
+action.save_as_default = Save as default
+action.save_as = Save as...
+action.save = Save
+action.cancel_fetch = Cancel Fetch
+action.save_omit_hidden_columns = Save / Omit Hidden Regions
+action.change_font = Change Font
+action.change_font_tree_panel = Change Font (Tree Panel)
+action.colour = Colour
+action.calculate = Calculate
+action.select_all = Select all
+action.deselect_all = Deselect all
+action.invert_selection = Invert selection
+action.using_jmol = Using Jmol
+action.link = Link
+action.group_link = Group Link
+action.show_chain = Show Chain
+action.show_group = Show Group
+action.fetch_db_references = Fetch DB References
+action.view_flanking_regions = Show flanking regions
+label.view_flanking_regions = Show sequence data either side of the subsequences involved in this alignment
+label.str = Str:
+label.seq = Seq:
+label.structures_manager = Structures Manager
+label.nickname = Nickname:
+label.url = URL:
+label.input_file_url = Enter URL or Input File
+label.select_feature = Select feature:
+label.name = Name
+label.name_param = Name: {0}
+label.group = Group
+label.group_name = Group Name
+label.group_description = Group Description
+label.edit_group_name_description = Edit Group Name/Description
+label.colour = Colour:
+label.description = Description:
+label.start = Start:
+label.end = End:
+label.current_parameter_set_name = Current parameter set name:
+label.service_action = Service Action:
+label.post_url = POST URL:
+label.url_suffix = URL Suffix
+label.sequence_source = Sequence Source
+label.per_seq = per Sequence
+label.result_vertically_separable = Results are vertically separable
+label.amend = Amend
+label.undo_command = Undo {0}
+label.redo_command = Redo {0}
+label.principal_component_analysis = Principal Component Analysis
+label.average_distance_identity = Average Distance Using % Identity
+label.neighbour_joining_identity = Neighbour Joining Using % Identity
+label.treecalc_title = {0} Using {1}
+label.tree_calc_av = Average Distance
+label.tree_calc_nj = Neighbour Joining
+label.select_score_model = Select score model
+label.score_model_pid = % Identity
+label.score_model_blosum62 = BLOSUM62
+label.score_model_pam250 = PAM 250
+label.score_model_conservation = Physicochemical property conservation
+label.score_model_enhconservation = Physicochemical property conservation
+label.status_bar = Status bar
+label.out_to_textbox = Output to Textbox
+label.clustalx = Clustalx
+label.clustal = Clustal
+label.zappo = Zappo
+label.taylor = Taylor
+label.blc = BLC
+label.fasta = Fasta
+label.msf = MSF
+label.pfam = PFAM
+label.pileup = Pileup
+label.pir = PIR
+label.hydrophobicity = Hydrophobicity
+label.helix_propensity = Helix Propensity
+label.strand_propensity = Strand Propensity
+label.turn_propensity = Turn Propensity
+label.buried_index = Buried Index
+label.purine_pyrimidine = Purine/Pyrimidine
+label.percentage_identity = Percentage Identity
+label.blosum62 = BLOSUM62
+label.blosum62_score = BLOSUM62 Score
+label.tcoffee_scores = T-Coffee Scores
+label.average_distance_bloslum62 = Average Distance Using BLOSUM62
+label.neighbour_blosum62 = Neighbour Joining Using BLOSUM62
+label.show_annotations = Show annotations
+label.hide_annotations = Hide annotations
+label.show_all_seq_annotations = Show sequence related
+label.hide_all_seq_annotations = Hide sequence related
+label.show_all_al_annotations = Show alignment related
+label.hide_all_al_annotations = Hide alignment related
+label.hide_all = Hide all
+label.add_reference_annotations = Add reference annotations
+label.find_tip = Search alignment, selection or sequence ids for a subsequence (ignoring gaps).<br>Accepts regular expressions - search Help for 'regex' for details.
+label.colour_text = Colour Text
+label.show_non_conversed = Show nonconserved
+label.overview_window = Overview Window
+label.none = None
+label.above_identity_threshold = Above Identity Threshold
+label.show_sequence_features = Show Sequence Features
+label.nucleotide = Nucleotide
+label.protein = Protein
+label.to_new_alignment = To New Alignment
+label.to_this_alignment = Add To This Alignment
+label.apply_colour_to_all_groups = Apply Colour To All Groups
+label.modify_identity_thereshold = Modify Identity Threshold...
+label.modify_conservation_thereshold = Modify Conservation Threshold...
+label.input_from_textbox = Input from textbox
+label.centre_column_labels = Centre column labels
+label.automatic_scrolling = Automatic Scrolling
+label.documentation = Documentation
+label.about = About...
+label.show_sequence_limits = Show Sequence Limits
+action.feature_settings = Feature Settings...
+label.feature_settings = Feature Settings
+label.all_columns = All Columns
+label.all_sequences = All Sequences
+label.selected_columns = Selected Columns
+label.selected_sequences = Selected Sequences
+label.except_selected_sequences = All except selected sequences
+label.all_but_selected_region = All but Selected Region (Shift+Ctrl+H)
+label.selected_region = Selected Region
+label.all_sequences_columns = All Sequences and Columns
+label.hide_insertions = Hide columns gapped for selection
+label.hide_selected_annotations = Hide selected annotations
+label.show_selected_annotations = Show selected annotations
+label.group_consensus = Group Consensus
+label.group_conservation = Group Conservation
+label.show_consensus_histogram = Show Consensus Histogram
+label.show_consensus_logo = Show Consensus Logo
+label.norm_consensus_logo = Normalise Consensus Logo
+label.apply_all_groups = Apply to all groups
+label.autocalculated_annotation = Autocalculated Annotation
+label.show_first = Show first
+label.show_last = Show last
+label.struct_from_pdb = Process secondary structure from PDB
+label.use_rnaview = Use RNAView for secondary structure
+label.autoadd_secstr = Add secondary structure annotation to alignment
+label.autoadd_temp = Add Temperature Factor annotation to alignment
+label.structure_viewer = Default structure viewer
+label.chimera_path = Path to Chimera program
+label.chimera_path_tip = Jalview will first try any path entered here, else standard installation locations.<br>Double-click to browse for file.
+label.invalid_chimera_path = Chimera path not found or not executable
+label.chimera_missing = Chimera structure viewer not found.<br/>Please enter the path to Chimera (if installed),<br/>or download and install UCSF Chimera.
+label.chimera_failed = Error opening Chimera - is it installed?\nCheck path in Preferences, Structure
+label.min_colour = Minimum Colour
+label.max_colour = Maximum Colour
+label.use_original_colours = Use Original Colours
+label.threshold_minmax = Threshold is min/max
+label.represent_group_with = Represent Group with {0}
+label.selection = Selection
+label.group_colour = Group Colour
+label.sequence = Sequence
+label.view_pdb_structure = View PDB Structure
+label.min = Min:
+label.max = Max:
+label.colour_by_label = Colour by label
+label.new_feature = New Feature
+label.match_case = Match Case
+label.view_alignment_editor = View in alignment editor
+label.labels = Labels
+label.output_values = Output Values...
+label.output_points = Output points...
+label.output_transformed_points = Output transformed points
+label.input_data = Input Data...
+label.nucleotide_matrix = Nucleotide matrix
+label.protein_matrix = Protein matrix
+label.show_bootstrap_values = Show Bootstrap Values
+label.show_distances = Show distances
+label.mark_unassociated_leaves = Mark Unassociated Leaves
+label.fit_to_window = Fit To Window
+label.newick_format = Newick Format
+label.select_newick_like_tree_file = Select a newick-like tree file
+label.colours = Colours
+label.view_mapping = View Mapping
+label.wireframe = Wireframe
+label.depthcue = Depthcue
+label.z_buffering = Z Buffering
+label.charge_cysteine = Charge & Cysteine
+label.all_chains_visible = All Chains Visible
+label.successfully_added_features_alignment = Successfully added features to alignment
+label.keyboard_editing_mode = Keyboard editing mode is {0}
+label.paste_features_annotations_Tcoffee_here = Paste your features / annotations / T-coffee score file here.
+label.removed_columns = Removed {0} columns.
+label.removed_empty_columns = Removed {0} empty columns.
+label.paste_newick_tree_file = Paste your Newick tree file here.
+label.order_by_params = Order by {0}
+label.html_content = <html>{0}</html>
+label.paste_pdb_file= Paste your PDB file here.
+label.paste_pdb_file_for_sequence = Paste PDB file for sequence {0}
+label.could_not_parse_newick_file = Could not parse Newick file\!\n {0}
+label.successfully_pasted_tcoffee_scores_to_alignment= Successfully pasted T-Coffee scores to alignment.
+label.failed_add_tcoffee_scores = Failed to add T-Coffee scores:
+label.successfully_pasted_annotation_to_alignment= Successfully pasted annotation to alignment.
+label.couldnt_parse_pasted_text_as_valid_annotation_feature_GFF_tcoffee_file = Couldn't parse pasted text as a valid annotation, feature, GFF, or T-Coffee score file
+label.successfully_pasted_alignment_file = Successfully pasted alignment file
+label.paste_your_alignment_file = Paste your alignment file here
+label.paste_your = Paste your
+label.finished_searching = Finished searching
+label.search_results= Search results {0} : {1}
+label.found_match_for = Found match for {0}
+label.font = Font:
+label.size = Size:
+label.style = Style:
+label.enter_redundancy_threshold = Enter the redundancy threshold
+label.calculating = Calculating....
+label.modify_conservation_visibility = Modify conservation visibility
+label.colour_residues_above_occurence = Colour residues above % occurence
+label.set_this_label_text = set this label text
+label.sequences_from = Sequences from {0}
+label.successfully_loaded_file = Successfully loaded file {0}
+label.successfully_saved_to_file_in_format = Successfully saved to file: {0} in {1} format.
+label.copied_sequences_to_clipboard = Copied {0} sequences to clipboard.
+label.check_file_matches_sequence_ids_alignment = Check that the file matches sequence IDs in the alignment.
+label.problem_reading_tcoffee_score_file = Problem reading T-COFFEE score file
+label.source_to_target = {0} ... {1}
+label.per_sequence_only= Per-sequence only
+label.to_file = to File
+label.to_textbox = to Textbox
+label.jalview = Jalview
+label.csv_spreadsheet = CSV (Spreadsheet)
+label.status = Status
+label.channels = Channels
+label.channel_title_item_count = {0} ({1})
+label.blog_item_published_on_date = {0} {1}
+label.select_das_service_from_table = Select a DAS service from the table to read a full description here.</font></html>
+label.session_update = Session Update
+label.new_vamsas_session = New Vamsas Session
+action.load_vamsas_session = Load Vamsas Session...
+action.save_vamsas_session = Save Vamsas Session
+label.select_vamsas_session_opened_as_new_vamsas_session= Select a vamsas session to be opened as a new vamsas session.
+label.open_saved_vamsas_session = Open a saved VAMSAS session
+label.groovy_console = Groovy Console...
+label.lineart = Lineart
+label.dont_ask_me_again = Don't ask me again
+label.select_eps_character_rendering_style = Select EPS character rendering style
+label.invert_selection = Invert Selection
+label.optimise_order = Optimise Order
+label.seq_sort_by_score = Sequence sort by Score
+label.load_colours = Load Colours
+label.save_colours = Save Colours
+label.fetch_das_features = Fetch DAS Features
+label.selected_database_to_fetch_from = Selected {0} database {1} to fetch from {2}
+label.database_param = Database: {0}
+label.example = Example
+label.example_param = Example: {0}
+label.select_file_format_before_saving = You must select a file format before saving!
+label.file_format_not_specified = File format not specified
+label.alignment_contains_hidden_columns = The Alignment contains hidden regions (hidden sequences/columns).\nDo you want to save only the visible alignment?
+label.couldnt_save_file = Couldn't save file: {0}
+label.error_saving_file = Error Saving File
+label.remove_from_default_list = Remove from default list?
+label.remove_user_defined_colour = Remove user defined colour
+label.you_must_select_least_two_sequences = You must select at least 2 sequences.
+label.invalid_selection = Invalid Selection
+label.principal_component_analysis_must_take_least_four_input_sequences = Principal component analysis must take\nat least 4 input sequences.
+label.sequence_selection_insufficient = Sequence selection insufficient
+label.you_need_more_two_sequences_selected_build_tree = You need to have more than two sequences selected to build a tree!
+label.not_enough_sequences = Not enough sequences
+label.selected_region_to_tree_may_only_contain_residues_or_gaps = The selected region to create a tree may\nonly contain residues or gaps.\nTry using the Pad function in the edit menu,\nor one of the multiple sequence alignment web services.
+label.sequences_selection_not_aligned = Sequences in selection are not aligned
+label.sequences_must_be_aligned_before_creating_tree = The sequences must be aligned before creating a tree.\nTry using the Pad function in the edit menu,\n or one of the multiple sequence alignment web services.
+label.sequences_not_aligned = Sequences not aligned
+label.problem_reading_tree_file = Problem reading tree file
+label.possible_problem_with_tree_file = Possible problem with tree file
+label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation = Please select at least three bases in at least one sequence in order to perform a cDNA translation.
+label.translation_failed = Translation Failed
+label.error_when_translating_sequences_submit_bug_report = Unfortunately, something went wrong when translating your sequences.\nPlease take a look in the Jalview java console\nand submit a bug report including the stacktrace.
+label.implementation_error = Implementation error:
+label.automatically_associate_pdb_files_with_sequences_same_name = Do you want to automatically associate the {0} PDB files with sequences in the alignment that have the same name?
+label.automatically_associate_pdb_files_by_name = Automatically Associate PDB files by name
+label.ignore_unmatched_dropped_files_info = <html>Do you want to <em>ignore</em> the {0} files whose names did not match any sequence IDs ?</html>
+label.ignore_unmatched_dropped_files = Ignore unmatched dropped files?
+label.view_name_original = Original
+label.enter_view_name = Enter View Name
+label.enter_label = Enter label
+label.enter_label_for_the_structure = Enter a label for the structure?
+label.pdb_entry_is_already_displayed = {0} is already displayed.\nDo you want to re-use this viewer ?
+label.map_sequences_to_visible_window = Map Sequences to Visible Window: {0}
+label.add_pdbentry_to_view = Do you want to add {0} to the view called\n{1}\n
+label.align_to_existing_structure_view = Align to existing structure view
+label.pdb_entries_couldnt_be_retrieved = The following pdb entries could not be retrieved from the PDB\:\n{0}\nPlease retry, or try downloading them manually.
+label.couldnt_load_file = Couldn't load file
+label.couldnt_find_pdb_id_in_file = Couldn't find a PDB id in the file supplied. Please enter an Id to identify this structure.
+label.no_pdb_id_in_file = No PDB Id in File
+label.couldnt_read_pasted_text = Couldn't read the pasted text {0}
+label.error_parsing_text = Error parsing text
+label.enter_local_das_source = Enter Nickname & URL of Local DAS Source
+label.you_can_only_edit_or_remove_local_das_sources = You can only edit or remove local DAS Sources!
+label.public_das_source = Public DAS source - not editable
+label.input_alignment_from_url = Input Alignment From URL
+label.input_alignment = Input Alignment
+label.couldnt_import_as_vamsas_session = Couldn't import {0} as a new vamsas session.
+label.vamsas_document_import_failed = Vamsas Document Import Failed
+label.couldnt_locate = Couldn't locate {0}
+label.url_not_found = URL not found
+label.no_link_selected = No link selected
+label.new_sequence_url_link = New sequence URL link
+label.cannot_edit_annotations_in_wrapped_view = Cannot edit annotations in wrapped view
+label.wrapped_view_no_edit = Wrapped view - no edit
+label.error_retrieving_data = Error Retrieving Data
+label.user_colour_scheme_must_have_name = User colour scheme must have a name
+label.no_name_colour_scheme = No name for colour scheme
+label.invalid_url = Invalid URL !
+label.error_loading_file = Error loading file
+label.problems_opening_file = Encountered problems opening {0}!!
+label.file_open_error = File open error
+label.no_das_sources_selected_warn = No das sources were selected.\nPlease select some sources and\ntry again.
+label.no_das_sources_selected_title = No DAS Sources Selected
+label.colour_scheme_exists_overwrite = Colour scheme {0} exists.\nContinue saving colour scheme as {1}?"
+label.duplicate_scheme_name = Duplicate scheme name
+label.jalview_new_questionnaire = There is a new Questionnaire available. Would you like to complete it now ?\n
+label.jalview_user_survey = Jalview User Survey
+label.alignment_properties = Alignment Properties: {0}
+label.alignment_props = Alignment Properties
+label.input_cut_paste = Cut & Paste Input
+label.input_cut_paste_params = Cut & Paste Input - {0}
+label.alignment_output_command = Alignment output - {0}
+label.annotations = Annotations
+label.structure_options = Structure Options
+label.features = Features
+label.overview_params = Overview {0}
+label.paste_newick_file = Paste Newick file
+label.load_tree_from_file = From File -
+label.colour_by_annotation = Colour by Annotation
+label.selection_output_command = Selection output - {0}
+label.annotation_for_displayid = <p><h2>Annotation for {0} </h2></p><p>
+label.pdb_sequence_mapping = PDB - Sequence Mapping
+label.pca_details = PCA details
+label.redundancy_threshold_selection = Redundancy threshold selection
+label.user_defined_colours = User defined colours
+label.jalviewLite_release = JalviewLite - Release {0}
+label.jaview_build_date = Build date: {0}
+label.jalview_authors_1 = Authors: Jim Procter, Andrew Waterhouse, Mungo Carstairs, Tochukwu Ofoegbu, Lauren Lui, Jan Engelhardt,
+label.jalview_authors_2 = Natasha Sherstnev, Daniel Barton, Michele Clamp, James Cuff, Steve Searle, David Martin & Geoff Barton.
+label.jalview_dev_managers = Development managed by The Barton Group, University of Dundee, Scotland, UK.
+label.jalview_distribution_lists = For help, see the FAQ at www.jalview.org and/or join the jalview-discuss at jalview.org mailing list
+label.jalview_please_cite = If you use Jalview, please cite:
+label.jalview_cite_1_authors = Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)
+label.jalview_cite_1_title = Jalview Version 2 - a multiple sequence alignment editor and analysis workbench
+label.jalview_cite_1_ref = Bioinformatics doi: 10.1093/bioinformatics/btp033
+label.right_click = Right click
+label.to_add_annotation = to add annotation
+label.alignment_has_no_annotations = Alignment has no annotations
+label.retrieving_pdb_data = Retrieving PDB data...
+label.label = Label
+label.no_features_added_to_this_alignment = No Features added to this alignment!!
+label.features_can_be_added_from_searches_1 = (Features can be added from searches or
+label.features_can_be_added_from_searches_2 = from Jalview / GFF features files)
+label.calculating_pca= Calculating PCA
+label.reveal_columns = Reveal Columns
+label.jalview_cannot_open_file = Jalview can't open file
+label.jalview_applet = Jalview applet
+label.loading_data = Loading data
+label.memory_stats = Total Free Memory: {0} MB; Max Memory: {1} MB; {2} %
+label.calculating_tree = Calculating tree
+label.state_queueing = queuing
+label.state_running = running
+label.state_complete = complete
+label.state_completed = finished
+label.state_job_cancelled = job cancelled!!
+label.state_job_error = job error!
+label.server_error_try_later = Server Error! (try later)
+label.error_loading_pdb_data = Error loading PDB data!!
+label.fetching_pdb_data = Fetching PDB data...
+label.structure_type = Structure type
+label.settings_for_type = Settings for {0}
+label.view_full_application = View in Full Application
+label.load_associated_tree = Load Associated Tree...
+label.load_features_annotations = Load Features/Annotations...
+label.export_features = Export Features...
+label.export_annotations = Export Annotations...
+label.to_upper_case = To Upper Case
+label.to_lower_case = To Lower Case
+label.toggle_case = Toggle Case
+label.edit_name_description = Edit Name/Description...
+label.create_sequence_feature = Create Sequence Feature...
+label.edit_sequence = Edit Sequence
+label.edit_sequences = Edit Sequences
+label.sequence_details = Sequence Details
+label.jmol_help = Jmol Help
+label.chimera_help = Chimera Help
+label.close_viewer = Close Viewer
+label.confirm_close_chimera = This will close Jalview''s connection to {0}.<br>Do you want to close the Chimera window as well?
+label.chimera_help = Chimera Help
+label.all = All
+label.sort_by = Sort alignment by
+label.sort_by_score = Sort by Score
+label.sort_by_density = Sort by Density
+label.sequence_sort_by_density = Sequence sort by Density
+label.sort_ann_by = Sort annotations by
+label.sort_annotations_by_sequence = Sort by sequence
+label.sort_annotations_by_label = Sort by label
+label.reveal = Reveal
+label.hide_columns = Hide Columns
+label.load_jalview_annotations = Load Jalview Annotations or Features File
+label.load_tree_file = Load a tree file
+label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences = Retrieve and parse sequence database records for the alignment or the currently selected sequences
+label.standard_databases = Standard Databases
+label.fetch_embl_uniprot = Fetch from EMBL/EMBLCDS or Uniprot/PDB and any selected DAS sources
+label.reset_min_max_colours_to_defaults = Reset min and max colours to defaults from user preferences.
+label.align_structures_using_linked_alignment_views = Align structures using {0} linked alignment views
+label.connect_to_session = Connect to session {0}
+label.threshold_feature_display_by_score = Threshold the feature display by score.
+label.threshold_feature_no_thereshold = No Threshold
+label.threshold_feature_above_thereshold = Above Threshold
+label.threshold_feature_below_thereshold = Below Threshold
+label.adjust_thereshold = Adjust threshold
+label.toggle_absolute_relative_display_threshold = Toggle between absolute and relative display threshold.
+label.display_features_same_type_different_label_using_different_colour = Display features of the same type with a different label using a different colour. (e.g. domain features)
+label.select_colour_minimum_value = Select Colour for Minimum Value
+label.select_colour_maximum_value = Select Colour for Maximum Value
+label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment = Open a new structure viewer with all structures associated with the current selection and superimpose them using the alignment.
+label.open_url_param = Open URL {0}
+label.open_url_seqs_param = Open URL ({0}..) ({1} seqs)
+label.load_pdb_file_associate_with_sequence = Load a PDB file and associate it with sequence {0}
+label.reveal_hidden_columns = Reveal Hidden Columns with Right Mouse Button
+label.dark_colour = Dark Colour
+label.light_colour = Light Colour
+label.highlightnode = Left click to select leaves.<br>Double-click to invert leaves.<br>Right click to change colour.
+label.load_colour_scheme = Load colour scheme
+label.copy_format_from = Copy format from
+label.toggle_enabled_views = When enabled, allows many views to be selected.
+label.select_all_views = Select all views
+label.select_many_views = Select many views
+label.edit_notes_parameter_set = Click to edit the notes for this parameter set.
+label.open_local_file = Open local file
+label.enable_automatically_sort_alignment_when_open_new_tree = Enable this to automatically sort<br>the alignment when you open<br> a new tree.
+label.listen_for_selections = Listen for selections
+label.selections_mirror_selections_made_same_sequences_other_views = When selected, selections in this view will mirror<br>selections made on the same sequences in other views.
+label.toggle_sequence_visibility = Shift+H toggles sequence visiblity
+label.toggle_columns_visibility = Ctrl+H toggles column visiblity.
+label.toggles_visibility_hidden_selected_regions = H toggles visibility of hidden or selected regions
+label.rename_tab_eXpand_reGroup= Right-click to rename tab <br> Press X to eXpand tabs, G to reGroup.
+label.right_align_sequence_id = Right Align Sequence Id
+label.sequence_id_tooltip = Sequence ID Tooltip
+label.no_services = <No Services>
+label.select_copy_raw_html = Select this if you want to copy raw html
+label.share_data_vamsas_applications = Share data with other vamsas applications
+label.connect_to = Connect to
+label.join_existing_vamsas_session = Join an existing vamsas session
+label.from_url = from URL
+label.any_trees_calculated_or_loaded_alignment_automatically_sort = When selected, any trees calculated or loaded onto the alignment will automatically sort the alignment
+label.sort_with_new_tree = Sort With New Tree
+label.from_textbox = from Textbox
+label.window = Window
+label.preferences = Preferences
+label.tools = Tools
+label.fetch_sequences = Fetch Sequences
+action.fetch_sequences = Fetch Sequences...
+label.stop_vamsas_session = Stop Vamsas Session
+label.collect_garbage = Collect Garbage
+label.show_memory_usage = Show Memory Usage
+label.show_java_console = Show Java Console
+label.show_jalview_news = Show Jalview News
+label.take_snapshot = Take snapshot
+label.monospaced_fonts_faster_to_render = Monospaced fonts are faster to render
+label.anti_alias_fonts = Anti-alias Fonts (Slower to render)
+label.monospaced_font= Monospaced
+label.quality = Quality
+label.maximize_window = Maximize Window
+label.conservation = Conservation
+label.consensus = Consensus
+label.histogram = Histogram
+label.logo = Logo
+label.non_positional_features = List Non-positional Features
+label.database_references = List Database References
+label.share_selection_across_views = Share selection across views
+label.scroll_highlighted_regions = Scroll to highlighted regions
+label.gap_symbol = Gap Symbol
+label.prot_alignment_colour = Protein Alignment Colour
+label.nuc_alignment_colour = Nucleotide Alignment Colour
+label.address = Address
+label.port = Port
+label.default_browser_unix = Default Browser (Unix)
+label.send_usage_statistics = Send usage statistics
+label.check_for_questionnaires = Check for questionnaires
+label.check_for_latest_version = Check for latest version
+label.url_linkfrom_sequence_id = URL link from Sequence ID
+label.use_proxy_server = Use a proxy server
+label.eps_rendering_style = EPS rendering style
+label.append_start_end = Append /start-end (/15-380)
+label.full_sequence_id = Full Sequence Id
+label.smooth_font = Smooth Font
+label.autocalculate_consensus = AutoCalculate Consensus
+label.pad_gaps = Pad Gaps
+label.pad_gaps_when_editing = Pad Gaps When Editing
+label.automatically_set_id_width = Automatically set ID width
+label.figure_id_column_width = Figure ID column width
+label.use_modeller_output = Use Modeller Output
+label.wrap_alignment = Wrap Alignment
+label.right_align_ids = Right Align Ids
+label.sequence_name_italics = Italic Sequence Ids
+label.open_overview = Open Overview
+label.default_colour_scheme_for_alignment = Default Colour Scheme for alignment
+label.annotation_shading_default = Annotation Shading Default
+label.default_minimum_colour_annotation_shading = Default Minimum Colour for annotation shading
+label.default_maximum_colour_annotation_shading = Default Maximum Colour for annotation shading
+label.visual = Visual
+label.connections = Connections
+label.output = Output
+label.editing = Editing
+label.das_settings = DAS Settings
+label.web_services = Web Services
+label.right_click_to_edit_currently_selected_parameter = Right click to edit currently selected parameter.
+label.let_jmol_manage_structure_colours = Let Jmol manage structure colours
+label.let_chimera_manage_structure_colours = Let Chimera manage structure colours
+label.marks_leaves_tree_not_associated_with_sequence = Marks leaves of tree not associated with a sequence
+label.index_web_services_menu_by_host_site = Index web services in menu by the host site
+label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up = Check this option if you want to be informed<br>when a web service URL cannot be accessed by Jalview<br>when it starts up
+label.new_service_url = New Service URL
+label.edit_service_url = Edit Service URL
+label.delete_service_url = Delete Service URL
+label.details = Details
+label.options = Options
+label.parameters = Parameters
+label.available_das_sources = Available DAS Sources
+label.full_details = Full Details
+label.authority = Authority
+label.type = Type
+label.proxy_server = Proxy Server
+label.file_output = File Output
+label.select_input_type = Select input type
+label.set_options_for_type = Set options for type
+label.data_input_parameters = Data input parameters
+label.data_returned_by_service = Data returned by service
+label.rsbs_encoded_service = RSBS Encoded Service
+label.parsing_errors = Parsing errors
+label.simple_bioinformatics_rest_services = Simple Bioinformatics Rest Services
+label.web_service_discovery_urls = Web Service Discovery URLS
+label.input_parameter_name = Input Parameter name
+label.short_descriptive_name_for_service = Short descriptive name for service
+label.function_service_performs = What kind of function the service performs (e.g. alignment, analysis, search, etc).
+label.brief_description_service = Brief description of service
+label.url_post_data_service = URL to post data to service. Include any special parameters needed here
+label.optional_suffix = Optional suffix added to URL when retrieving results from service
+label.preferred_gap_character = Which gap character does this service prefer?
+label.gap_character = Gap character
+label.move_return_type_up_order= Move return type up order
+label.move_return_type_down_order= Move return type down order
+label.update_user_parameter_set = Update this existing user parameter set
+label.delete_user_parameter_set = Delete the currently selected user parameter set
+label.create_user_parameter_set = Create a new parameter set with the current settings.
+label.revert_changes_user_parameter_set = Undo all changes to the current parameter set
+label.start_job_current_settings = Start Job with current settings
+label.cancel_job_close_dialog = Close this dialog and cancel job
+label.input_output = Input/Output
+label.cut_paste = Cut'n'Paste
+label.adjusting_parameters_for_calculation = Adjusting parameters for existing Calculation
+label.2d_rna_structure_line = 2D RNA {0} (alignment)
+label.2d_rna_sequence_name = 2D RNA - {0}
+label.edit_name_and_description_current_group = Edit name and description of current group.
+label.view_structure_for = View structure for {0}
+label.view_all_structures = View all {0} structures.
+label.view_all_representative_structures = View all {0} representative structures.
+label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment = Opens a new structure viewer with all representative structures\nassociated with the current selection\nsuperimposed with the current alignment.
+label.associate_structure_with_sequence = Associate Structure with Sequence
+label.from_file = From File
+label.enter_pdb_id = Enter PDB Id
+label.discover_pdb_ids = Discover PDB IDs
+label.text_colour = Text Colour
+action.set_text_colour = Text Colour...
+label.structure = Structure
+label.view_structure = View Structure
+label.view_protein_structure = View Protein Structure
+label.show_pdbstruct_dialog = 3D Structure Data...
+label.view_rna_structure = VARNA 2D Structure
+label.clustalx_colours = Clustalx colours
+label.above_identity_percentage = Above % Identity
+label.create_sequence_details_report_annotation_for = Annotation for {0}
+label.sequence_details_for = Sequence Details for {0}
+label.sequence_name = Sequence Name
+label.sequence_description = Sequence Description
+label.edit_sequence_name_description = Edit Sequence Name/Description
+label.spaces_converted_to_backslashes = Spaces have been converted to _
+label.no_spaces_allowed_sequence_name = No spaces allowed in Sequence Name
+label.select_outline_colour = Select Outline Colour
+label.web_browser_not_found_unix = Unixers\: Couldn't find default web browser.\nAdd the full path to your browser in Preferences."
+label.web_browser_not_found = Web browser not found
+label.select_pdb_file_for = Select a PDB file for {0}
+label.html = HTML
+label.wrap = Wrap
+label.show_database_refs = Show Database Refs
+label.show_non_positional_features = Show Non-Positional Features
+label.save_png_image = Save As PNG Image
+label.load_tree_for_sequence_set = Load a tree for this sequence set
+label.export_image = Export Image
+label.vamsas_store = VAMSAS store
+label.translate_cDNA = Translate as cDNA
+label.linked_view_title = Linked cDNA and protein view
+label.align = Align
+label.extract_scores = Extract Scores
+label.get_cross_refs = Get Cross-References
+label.sort_alignment_new_tree = Sort Alignment With New Tree
+label.add_sequences = Add Sequences
+label.new_window = New Window
+label.split_window = Split Window
+label.refresh_available_sources = Refresh Available Sources
+label.use_registry = Use Registry
+label.add_local_source = Add Local Source
+label.set_as_default = Set as Default
+label.show_labels = Show labels
+label.background_colour = Background Colour
+action.background_colour = Background Colour...
+label.associate_nodes_with = Associate Nodes With
+label.jalview_pca_calculation = Jalview PCA Calculation
+label.link_name = Link Name
+label.pdb_file = PDB file
+label.colour_with_jmol = Colour with Jmol
+label.colour_with_chimera = Colour with Chimera
+label.align_structures = Align Structures
+label.jmol = Jmol
+label.chimera = Chimera
+label.sort_alignment_by_tree = Sort Alignment By Tree
+label.mark_unlinked_leaves = Mark Unlinked Leaves
+label.associate_leaves_with = Associate Leaves With
+label.save_colour_scheme_with_unique_name_added_to_colour_menu = Save your colour scheme with a unique name and it will be added to the Colour menu
+label.case_sensitive = Case Sensitive
+label.lower_case_colour = Lower Case Colour
+label.index_by_host = Index by Host
+label.index_by_type = Index by Type
+label.enable_jabaws_services = Enable JABAWS Services
+label.display_warnings = Display Warnings
+label.move_url_up = Move URL Up
+label.move_url_down = Move URL Down
+label.add_sbrs_definition = Add a SBRS Definition
+label.edit_sbrs_definition = Edit SBRS Definition
+label.delete_sbrs_definition = Delete SBRS Definition
+label.your_sequences_have_been_verified = Your sequences have been verified against known sequence databases. Some of the ids have been\n altered, most likely the start/end residue will have been updated.\n Save your alignment to maintain the updated id.\n\n
+label.sequence_names_updated = Sequence names updated
+label.dbref_search_completed = DBRef search completed
+label.show_all_chains = Show all chains
+label.fetch_all_param = Fetch all {0}
+label.paste_new_window = Paste To New Window
+label.settings_for_param = Settings for {0}
+label.view_params = View {0}
+label.aacon_calculations = AACon Calculations
+label.aacon_settings = Change AACon Settings...
+tooltip.aacon_calculations = When checked, AACon calculations are updated automatically.
+tooltip.aacon_settings = Modify settings for AACon calculations.
+label.rnalifold_calculations = RNAAliFold Prediction
+label.rnalifold_settings = Change RNAAliFold settings...
+tooltip.rnalifold_calculations = When checked, RNA secondary structure predictions will be calculated for the alignment, and updated when edits are made.
+tooltip.rnalifold_settings = Modify settings for the RNAAliFold prediction. Use this to hide or show different results of the RNA calculation, and change RNA folding parameters.
+label.all_views = All Views
+label.align_sequences_to_existing_alignment = Align sequences to an existing alignment
+label.realign_with_params = Realign with {0}
+label.calcname_with_default_settings = {0} with Defaults
+label.action_with_default_settings = {0} with default settings
+label.edit_settings_and_run = Edit settings and run...
+label.view_and_change_parameters_before_alignment = View and change the parameters before alignment
+label.run_with_preset_params = Run {0} with preset
+label.view_and_change_parameters_before_running_calculation = View and change parameters before running calculation
+label.view_documentation = View documentation
+label.select_return_type = Select return type
+label.translation_of_params = Translation of {0}
+label.features_for_params = Features for - {0}
+label.annotations_for_params = Annotations for - {0}
+label.generating_features_for_params = Generating features for - {0}
+label.generating_annotations_for_params = Generating annotations for - {0}
+label.varna_params = VARNA - {0}
+label.sequence_feature_settings = Sequence Feature Settings
+label.pairwise_aligned_sequences = Pairwise Aligned Sequences
+label.original_data_for_params = Original Data for {0}
+label.points_for_params = Points for {0}
+label.transformed_points_for_params = Transformed points for {0}
+label.graduated_color_for_params = Graduated Feature Colour for {0}
+label.select_backgroud_colour = Select Background Colour
+label.invalid_font = Invalid Font
+label.separate_multiple_accession_ids = Enter one or more PDB accession IDs separated by a semi-colon ";"
+label.separate_multiple_query_values = Enter one or more {0}s separated by a semi-colon ";"
+label.search_all = Enter one or more search values separated by a semi-colon ";" (Note: This Searches the entire PDB database)
+label.replace_commas_semicolons = Replace commas with semi-colons
+label.parsing_failed_syntax_errors_shown_below_param = Parsing failed. Syntax errors shown below {0}
+label.parsing_failed_unrecoverable_exception_thrown_param = \nParsing failed. An unrecoverable exception was thrown\:\n {0}
+label.example_query_param = Example query: {0}
+label.enter_value_increase_conservation_visibility = Enter value to increase conservation visibility
+label.enter_percentage_identity_above_which_colour_residues = Enter % identity above which to colour residues
+label.wswublast_client_credits = To display sequence features an exact Uniprot id with 100% sequence identity match must be entered.\nIn order to display these features, try changing the names of your sequences to the ids suggested below.\n\nRunning WSWUBlast at EBI.\nPlease quote Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R.\nSOAP-based services provided by the European Bioinformatics Institute.\n [...]
+label.blasting_for_unidentified_sequence = BLASTing for unidentified sequences
+label.select_columns_containing = Select columns containing
+label.select_columns_not_containing = Select columns that do not contain
+option.trim_retrieved_seqs = Trim retrieved sequences
+label.trim_retrieved_sequences = When the reference sequence is longer than the sequence that you are working with, only keep the relevant subsequences.
+label.use_sequence_id_1 = Use $SEQUENCE_ID$ or $SEQUENCE_ID=/<regex>/=$
+label.use_sequence_id_2 = \nto embed sequence id in URL
+label.ws_parameters_for = Parameters for {0}
+label.switch_server = Switch server
+label.choose_jabaws_server = Choose a server for running this service
+label.services_at = Services at {0}
+label.rest_client_submit = {0} using {1}
+label.fetch_retrieve_from =Retrieve from {0}</html>
+label.fetch_retrieve_from_all_sources = Retrieve from all {0} sources in {1}<br>First is :{2}<html>
+#label.feature_settings_click_drag = <html>Click/drag feature types up or down to change render order.<br/>Double click to select columns containing feature in alignment/current selection<br/>Pressing Alt will select columns outside features rather than inside<br/>Pressing Shift to modify current selection (rather than clear current selection)<br/>Press CTRL or Command/Meta to toggle columns in/outside features<br/></html>
+label.feature_settings_click_drag = Drag up or down to change render order.<br/>Double click to select columns containing feature.
+label.transparency_tip = Adjust transparency to 'see through' feature colours.
+label.opt_and_params_further_details = see further details by right-clicking
+label.opt_and_params_show_brief_desc_image_link = <html>Click to show brief description<br><img src="{0}"/> Right click for further information.</html>
+label.opt_and_params_show_brief_desc = <html>Click to show brief description<br></html>
+label.adjusts_width_generated_eps_png = <html>Adjusts the width of the generated EPS or PNG file to ensure even the longest sequence ID or annotation label is displayed</html>
+label.manually_specify_width_left_column = <html>Manually specify the width of the left hand column where sequence IDs and annotation labels will be rendered in exported alignment figures. This setting will be ignored if 'Automatically set ID width' is set</html>
+label.job_created_when_checked = <html>When checked, a job is created for every sequence in the current selection.</html>
+label.when_checked_job_visible_region_and_results = <html>When checked, a single job is created for the visible region and results mapped back onto their location in the alignment. Otherwise, a job would be created for every contiguous region visible in the alignment or current selection (e.g. a multiple alignment).</html>
+label.flat_file_representation = <html>Flat file representation of this rest service using the Really Simple Bioinformatics Service formalism</html>
+label.result_of_parsing_rsbs = <html>Results of parsing the RSBS representation</html>
+label.user_preset = User Preset
+label.service_preset = Service Preset
+label.run_with_preset = Run {0} with preset
+label.view_service_doc_url = <html>View <a href="{0}">{1}</a></html>
+label.submit_sequence = <html>Submit {0} {1} {2} {3} to<br/>{4}</html>
+action.by_title_param = By {0}
+label.alignment = Alignment
+label.secondary_structure_prediction = Secondary Structure Prediction
+label.sequence_database_search = Sequence Database Search
+label.analysis = Analysis
+label.protein_disorder = Protein Disorder
+label.source_from_db_source = Sources from {0}
+label.from_msname = from {0}
+label.superpose_with = Superpose with
+action.do = Do
+label.scale_label_to_column = Scale Label to Column
+label.add_new_row = Add New Row
+label.edit_label_description = Edit Label/Description
+label.hide_row = Hide This Row
+label.delete_row = Delete This Row
+label.show_all_hidden_rows = Show All Hidden Rows
+label.export_annotation = Export Annotation
+label.copy_consensus_sequence = Copy Consensus Sequence
+label.helix = Helix
+label.sheet = Sheet
+label.rna_helix = RNA Helix
+label.remove_annotation = Remove Annotation
+label.colour_by = Colour by...
+label.muscle_multiple_protein_sequence_alignment = Muscle Multiple Protein Sequence Alignment
+label.mafft_multiple_sequence_alignment = MAFFT Multiple Sequence Alignment
+label.clustalw_multiple_sequence_alignment = ClustalW Multiple Sequence Alignment
+label.jnet_secondary_structure_prediction = JNet Secondary Structure Prediction
+label.multiharmony = Multi-Harmony
+label.unable_start_web_service_analysis = Unable to start web service analysis
+label.job_couldnt_be_started_check_input = The Job couldn't be started. Please check your input, and the Jalview console for any warning messages.
+label.prompt_each_time = Prompt each time
+label.use_source = Use Source
+label.couldnt_save_project = Couldn't save project
+label.error_whilst_saving_current_state_to = Error whilst saving current state to {0}
+label.error_whilst_loading_project_from = Error whilst loading project from {0}
+label.couldnt_load_project = Couldn't load project
+label.pca_sequences_not_aligned = The sequences must be aligned before calculating PCA.\nTry using the Pad function in the edit menu,\nor one of the multiple sequence alignment web services.
+label.invalid_name_preset_exists = Invalid name - preset already exists.
+label.invalid_name = Invalid name
+label.set_proxy_settings = Please set up your proxy settings in the 'Connections' tab of the Preferences window
+label.proxy_authorization_failed = Proxy Authorization Failed
+label.internal_jalview_error = Internal Jalview Error
+label.secondary_structure_prediction_service_couldnt_be_located = The Secondary Structure Prediction Service named {0} at {1} couldn't be located.
+label.service_called_is_not_msa_service = The Service called \n{0}\nis not a \nMultiple Sequence Alignment Service\!
+label.msa_service_is_unknown = The Multiple Sequence Alignment Service named {0} is unknown
+label.service_called_is_not_seq_search_service = The Service called \n{0}\nis not a \nSequence Search Service\!
+label.seq_search_service_is_unknown = The Sequence Search Service named {0} is unknown
+label.feature_type = Feature Type
+label.display = Display
+label.service_url = Service URL
+label.copied_sequences = Copied sequences
+label.cut_sequences = Cut Sequences
+label.conservation_colour_increment = Conservation Colour Increment ({0})
+label.percentage_identity_thereshold = Percentage Identity Threshold ({0})
+label.error_unsupported_owwner_user_colour_scheme = Unsupported owner for User Colour scheme dialog
+label.save_alignment_to_file = Save Alignment to file
+label.save_features_to_file = Save Features to File
+label.save_annotation_to_file = Save Annotation to File
+label.no_features_on_alignment = No features found on alignment
+label.save_pdb_file = Save PDB File
+label.save_text_to_file = Save Text to File
+label.save_state = Save State
+label.restore_state = Restore State
+label.saving_jalview_project = Saving jalview project {0}
+label.loading_jalview_project = Loading jalview project {0}
+label.save_vamsas_document_archive = Save Vamsas Document Archive
+label.saving_vamsas_doc = Saving VAMSAS Document to {0}
+label.load_feature_colours = Load Feature Colours
+label.save_feature_colours = Save Feature Colour Scheme
+label.dataset_for = {0} Dataset for {1}
+label.select_startup_file = Select startup file
+label.select_default_browser = Select default web browser
+label.save_tree_as_newick = Save tree as newick file
+label.create_eps_from_tree = Create EPS file from tree
+label.create_png_from_tree = Create PNG image from tree
+label.save_colour_scheme = Save colour scheme
+label.edit_params_for = Edit parameters for {0}
+label.choose_filename_for_param_file = Choose a filename for this parameter file
+label.save_as_html = Save as HTML
+label.recently_opened = Recently Opened
+label.blasting_for_unidentified_sequence_jobs_running = BLASTing for unidentified sequences - {0} jobs running.
+label.tree_from = Tree from {0}
+label.webservice_job_title = {0} using {1}
+label.select_visible_region_of = selected {0} region of {1}
+label.visible = Visible
+label.select_unselect_visible_regions_from = select and unselected {0} regions from {1}
+label.visible_region_of = visible region of
+label.webservice_job_title_on = {0} using {1} on {2}
+label.updating_vamsas_session = Updating vamsas session
+label.loading_file = Loading File: {0}
+label.edit_params = Edit {0}
+error.not_implemented = Not implemented
+error.no_such_method_as_clone1_for = No such method as clone1 for {0}
+error.null_from_clone1 = Null from clone1!
+error.implementation_error_sortbyfeature = Implementation Error - sortByFeature method must be one of FEATURE_SCORE, FEATURE_LABEL or FEATURE_DENSITY.
+error.not_yet_implemented = Not yet implemented
+error.unknown_type_dna_or_pep = Unknown Type {0} - dna or pep are the only allowed values.
+error.implementation_error_dont_know_thereshold_annotationcolourgradient = Implementation error: don't know about threshold setting for current AnnotationColourGradient.
+error.implementation_error_embeddedpopup_not_null = Implementation error - embeddedPopup must be non-null
+error.invalid_colour_for_mycheckbox = Invalid color for MyCheckBox
+error.implementation_error_unrecognised_render_object_for_features_type = Implementation Error: Unrecognised render object {0} for features of type {1}
+error.implementation_error_unsupported_feature_colour_object = Implementation error: Unsupported feature colour object.
+error.invalid_separator_parameter = Invalid separator parameter - must be non-zero length
+error.alignment_cigararray_not_implemented = Alignment(CigarArray) not yet implemented
+error.weak_sequencei_equivalence_not_yet_implemented = Weak sequenceI equivalence not yet implemented.
+error.implementation_error_can_only_make_alignmnet_from_cigararray = Implementation Error - can only make an alignment view from a CigarArray of sequences.
+error.empty_view_cannot_be_updated = empty view cannot be updated.
+error.mismatch_between_number_of_sequences_in_block = Mismatch between number of sequences in block {0} ({1}) and the original view ({2})
+error.padding_not_yet_implemented = Padding not yet implemented
+error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view = Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks={0})
+error.unknown_seq_cigar_operation = Unknown SeqCigar operation {0}
+error.implementation_bug_parse_cigar_string = Implementation bug in parseCigarString
+error.implementation_error_invalid_operation_string = Implementation error. Invalid operation string.
+error.invalid_range_string = Invalid range string (must be zero or positive number)
+error.implementation_error_delete_range_out_of_bounds = Implementation Error: deleteRange out of bounds: start must be non-negative and less than end.
+error.implementation_error = Implementation error
+error.implementation_error_unknown_operation = Implementation Error! Unknown operation {0}
+error.implementation_error_unexpected_null_from_get_sequence_and_deletions = Implementation Error - unexpected null from getSequenceAndDeletions
+error.implementation_error_set_seq_null = Implementation Error - _setSeq(null,...)
+error.implementation_error_s = Implementation Error: _s= {0}
+error.implementation_error_seqcigar_possible = SeqCigar: Possible implementation error: sequence is longer than dataset sequence
+error.implmentation_bug_seq_null = Implementation Bug. Null seq
+error.implementation_bug_cigar_operation_list_range_list = Implementation Bug. Cigar Operation list!= range list
+error.not_yet_implemented_cigar_object_from_cigar_string = NOT YET Implemented: Constructing a Cigar object from a cigar string and a gapped sequence.
+error.implementation_bug_cigar_operation = Implementation Bug. Cigar Operation {0} {1} not one of {2}, {3}, or {4}.
+error.implementation_error_for_new_cigar = Implementation error for new Cigar(SequenceI)
+error.implementation_error_cigar_seq_no_operations = Implementation error: {0}th sequence Cigar has no operations.
+error.implementation_error_jmol_getting_data = Implementation error - Jmol seems to be still working on getting its data - report at http://issues.jalview.org/browse/JAL-1016
+error.implementation_error_no_pdbentry_from_index = Implementation error - no corresponding pdbentry (for index {0}) to add sequences mappings to
+error.jmol_version_not_compatible_with_jalview_version = Jmol version {0} is not compatible with this version of Jalview. Report this problem at issues.jalview.org
+error.not_implemented_remove = Remove: Not implemented
+error.not_implemented_clone = Clone: Not implemented
+error.implementation_error_chimera_getting_data = Implementation error - Chimera seems to be still working on getting its data - report at http://issues.jalview.org/browse/JAL-1016
+error.call_setprogressbar_before_registering_handler = call setProgressBar before registering the progress bar's handler.
+label.cancelled_params = Cancelled {0}
+error.implementation_error_cannot_show_view_alignment_frame = Implementation error: cannot show a view from another alignment in an AlignFrame.
+error.implementation_error_dont_know_about_thereshold_setting = Implementation error: don't know about threshold setting for current AnnotationColourGradient.
+error.eps_generation_not_implemented = EPS Generation not yet implemented
+error.png_generation_not_implemented = PNG Generation not yet implemented
+error.try_join_vamsas_session_another = Trying to join a vamsas session when another is already connected
+error.invalid_vamsas_session_id = Invalid vamsas session id
+error.implementation_error_cannot_create_groovyshell = Implementation Error. Cannot create groovyShell without Groovy on the classpath!
+label.groovy_support_failed = Jalview Groovy Support Failed
+label.couldnt_create_groovy_shell = Couldn't create the groovy Shell. Check the error log for the details of what went wrong.
+error.unsupported_version_calcIdparam = Unsupported Version for calcIdparam {0}
+error.implementation_error_cant_reorder_tree = Implementation Error: Can't reorder this tree. Not DefaultMutableTreeNode.
+error.invalid_value_for_option = Invalid value {0} for option {1}
+error.implementation_error_cannot_import_vamsas_doc = Implementation Error - cannot import existing vamsas document into an existing session, Yet!
+label.vamsas_doc_couldnt_be_opened_as_new_session = VAMSAS Document could not be opened as a new session - please choose another
+error.implementation_error_vamsas_operation_not_init = Impementation error! Vamsas Operations when client not initialised and connected
+error.jalview_no_connected_vamsas_session = Jalview not connected to Vamsas session
+error.implementation_error_cannot_recover_vamsas_object_mappings = IMPLEMENTATION ERROR: Cannot recover vamsas object mappings - no backup was made
+error.setstatus_called_non_existent_job_pane = setStatus called for non-existent job pane {0}
+error.implementation_error_cannot_find_marshaller_for_param_set =Implementation error: Can't find a marshaller for the parameter set
+error.implementation_error_old_jalview_object_not_bound =IMPLEMENTATION ERROR: old jalview object is not bound ! ({0})
+error.implementation_error_vamsas_doc_class_should_bind_to_type = Implementation Error: Vamsas Document Class {0} should bind to a {1} (found a {2})
+error.implementation_error_jalview_class_should_bind_to_type = Implementation Error: Jalview Class {0} should bind to a {1} (found a {2})
+error.invalid_vamsas_rangetype_cannot_resolve_lists = Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!
+error.implementation_error_maplist_is_null = Implementation error. MapList is null for initMapType.
+error.implementation_error_cannot_have_null_alignment = Implementation error: Cannot have null alignment property key
+error.implementation_error_null_fileparse = Implementation error. Null FileParse in copy constructor
+error.implementation_error_cannot_map_alignment_sequences = IMPLEMENTATION ERROR: Cannot map an alignment of sequences from different datasets into a single alignment in the vamsas document.
+error.implementation_error_cannot_duplicate_colour_scheme = Serious implementation error: cannot duplicate colourscheme {0}
+error.implementation_error_structure_selection_manager_null = Implementation error. Structure selection manager's context is 'null'
+exception.ssm_context_is_null = SSM context is null
+error.idstring_seqstrings_only_one_per_sequence = idstrings and seqstrings contain one string each per sequence
+error.cannot_have_mixed_length_replacement_vectors = Cannot have mixed length replacement vectors. Replacement vector for {0} is {1} strings long, and have already seen a {2} length vector.
+error.cannot_have_zero_length_vector_replacement_strings = Cannot have zero length vector of replacement strings - either 1 value or n values.
+error.implementation_error_multiple_single_sequence_prediction_jobs_not_supported = Implementation Error! Multiple single sequence prediction jobs are not yet supported
+error.implementation_error_invalid_msa_index_for_job =Implementation Error! Invalid msaIndex for JPredJob on parent MSA input object!
+error.implementation_error_startjob_called = Implementation error - StartJob(JpredJob) called on {0}
+error.multiple_jnet_subjob_merge_not_implemented = Multiple JNet subjob merging not yet implemented
+label.job_never_ran = Job never ran - input returned to user.
+error.implementation_error_minlen_must_be_greater_zero = Implementation error: minlen must be zero or more
+error.implementation_error_msawbjob_called = Implementation error - StartJob(MsaWSJob) called on a WSJobInstance {0}
+error.implementation_error_cannot_attach_ws_menu_entry = IMPLEMENTATION ERROR: cannot attach WS Menu Entry without service handle reference!
+error.parameter_migration_not_implemented_yet = Parameter migration not implemented yet
+error.implementation_error_cannot_set_jaba_option = Implementation error: cannot set Jaba Option to a value outside its allowed value range!
+error.implementation_error_valuetype_doesnt_support_jabaws_type = IMPLEMENTATION ERROR: jalview.ws.params.ValueConstrainI.ValueType does not support the JABAWS type : {0}
+error.cannot_create_jabaws_param_set = Cannot create a JabaWSParamSet from non-JabaWS parameters
+error.cannot_set_arguments_to_jabaws_param_set = Cannot set arguments to a JabaWSParamSet that are not JabaWS arguments
+error.implementation_error_runner_config_not_available = Implementation Error: Runner Config not available for a JABAWS service of type {0} ({1})
+error.implementation_error_cannot_handle_jaba_param = Implementation Error: Cannot handle Jaba parameter object {0}
+error.implementation_error_attempt_to_delete_service_preset = Implementation error: Attempt to delete a service preset!
+error.implementation_error_cannot_locate_oldname_presetname = Implementation error: Can't locate either oldname ({0}) or presetName ({1}in the datastore!"
+error.implementation_error_jabaws_param_set_only_handled_by = Implementation error: JabaWsParamSets can only be handled by JabaParamStore
+error.cannot_set_source_file_for = Cannot set source file for {0}
+error.mismatch_service_instance_preset = Probable mismatch between service instance and preset!
+error.cannot_set_params_for_ws_preset = Cannot set Parameters for a Jaba Web service's preset
+error.implementation_error_can_only_instantiate_jaba_param_sets = Implementation error: Can only instantiate Jaba parameter sets
+error.no_aacon_service_found = No AACon service found
+error.implementation_error_couldnt_copy_value_constraint = Implementation error: could not copy ValueConstrain!
+error.couldnt_encode_as_utf8 = Couldn't encode {0} as UTF-8.
+error.tree_inputtype_not_yet_implemented = Tree InputType not yet implemented
+error.implementation_error_need_to_have_httpresponse = Implementation Error: need to have an HttpResponse to process
+error.dbrefsource_implementation_exception =DBRefSource Implementation Exception
+error.implementation_error_dbinstance_must_implement_interface = Implmentation Error - getDbInstances must be given a class that implements jalview.ws.seqfetcher.DbSourceProxy (was given{0})
+error.implementation_error_must_init_dbsources =Implementation error. Must initialise dbSources
+label.view_controller_toggled_marked = {0} {1} columns {2} containing features of type {3} across {4} sequence(s)
+label.toggled = Toggled
+label.marked = Marked
+label.not = not
+label.no_feature_of_type_found = No features of type {0} found.
+label.submission_params = Submission {0}
+label.empty_alignment_job = Empty Alignment Job
+label.add_new_sbrs_service = Add a new Simple Bioinformatics Rest Service
+label.edit_sbrs_entry = Edit Simple Bioinformatics Rest Service entry
+label.pca_recalculating = Recalculating PCA
+label.pca_calculating = Calculating PCA
+label.select_foreground_colour = Choose foreground colour
+label.select_colour_for_text = Select Colour for Text
+label.adjunst_foreground_text_colour_thereshold = Adjust Foreground Text Colour Threshold
+label.select_subtree_colour = Select Sub-Tree Colour
+label.create_new_sequence_features = Create New Sequence Feature(s)
+label.amend_delete_features = Amend/Delete Features for {0}
+exception.out_of_bounds_for_file = Out of bounds for file: i={0}, Final Buffer: i0={1} iend={2}
+exception.null_string_given_to_regex_search = Null String Given to Regex.search
+exception.null_string_like_given_to_regex_search = Null StringLike Given to Regex.search
+exception.null_string_given_to_regex_reverse_search = Null String Given to Regex.reverseSearch
+exception.null_string_like_given_to_regex_reverse_search = Null StringLike Given to Regex.reverseSearch
+exception.null_string_like_given_to_regex_search_from = Null String Given to Regex.searchFrom
+exception.null_string_like_given_to_regex_search_region = Null String Given to Regex.searchRegion
+exception.replace_null_regex_pointer = Replacer has null Regex pointer
+exception.bad_pattern_to_regex_perl_code = bad pattern to Regex.perlCode: {0}
+exception.no_stub_implementation_for_interface = There is no stub implementation for the interface: {0}
+exception.cannot_set_endpoint_address_unknown_port = Cannot set Endpoint Address for Unknown Port {0}
+exception.querying_matching_opening_parenthesis_for_non_closing_parenthesis = Querying matching opening parenthesis for non-closing parenthesis character {0}
+exception.mismatched_unseen_closing_char = Mismatched (unseen) closing character {0}
+exception.mismatched_closing_char = Mismatched closing character {0}
+exception.mismatched_opening_char = Mismatched opening character {0} at {1}
+exception.invalid_datasource_couldnt_obtain_reader = Invalid datasource. Could not obtain Reader
+exception.index_value_not_in_range = {0}: Index value {1} not in range [0..{2}]
+exception.unterminated_cigar_string = Unterminated cigar string
+exception.unexpected_operation_cigar_string_pos = Unexpected operation {0} in cigar string (position {1} in {2}
+exception.couldnt_parse_responde_from_annotated3d_server = Couldn't parse response from Annotate3d server
+exception.application_test_npe = Application test: throwing an NullPointerException It should arrive at the console
+exception.overwriting_vamsas_id_binding = Overwriting vamsas id binding
+exception.overwriting_jalview_id_binding = Overwriting jalview id binding
+error.implementation_error_unknown_file_format_string = Implementation error: Unknown file format string
+exception.failed_to_resolve_gzip_stream = Failed to resolve GZIP stream
+exception.problem_opening_file_also_tried = Problem opening {0} (also tried {1}) : {2}
+exception.problem_opening_file = Problem opening {0} : {1}
+exception.failed_to_read_data_from_source = Failed to read data from source: {0}
+exception.no_init_source_stream = Unitialised Source Stream
+exception.invalid_source_stream = Invalid Source Stream: {0}
+error.implementation_error_reset_called_for_invalid_source = Implementation Error: Reset called for invalid source.
+exception.number_of_residues_in_query_sequence_differ_from_prediction = Number of residues in {0} supposed query sequence ({1}\n{2})\ndiffer from number of prediction sites in prediction ({3})
+label.mapped = mapped
+exception.jpredconcide_entry_has_unexpected_number_of_columns = JPredConcise: Entry ({0}) has an unexpected number of columns
+exception.couldnt_parse_concise_annotation_for_prediction = Couldn't parse concise annotation for prediction profile.\n{0}
+exception.newfile = NewickFile\: {0}\n
+label.no_tree_read_in = No Tree read in
+exception.rnaml_couldnt_access_datasource = Couldn't access datasource ({0})
+exception.ranml_couldnt_process_data = Couldn't process data as RNAML file ({0})
+exception.ranml_invalid_file = Invalid RNAML file ({0})
+exception.ranml_problem_parsing_data = Problem parsing data as RNAML ({0})
+exception.pfam_no_sequences_found = No sequences found (PFAM input)
+exception.stockholm_invalid_format = This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'
+exception.couldnt_parse_sequence_line = Could not parse sequence line: {0}
+exception.error_parsing_line = Error parsing {0}
+exception.unknown_annotation_detected = Unknown annotation detected: {0} {1}
+exception.couldnt_store_sequence_mappings = Couldn't store sequence mappings for {0}
+exception.matrix_too_many_iteration = Too many iterations in {0} (max is {1})
+exception.browser_not_found = Exception in finding browser: {0}
+exception.browser_unable_to_locate = Unable to locate browser: {0}
+exception.invocation_target_exception_creating_aedesc = InvocationTargetException while creating AEDesc: {0}
+exception.illegal_access_building_apple_evt= IllegalAccessException while building AppleEvent: {0}
+exception.instantiation_creating_aedesc = InstantiationException while creating AEDesc: {0}
+exception.unable_to_launch_url = Unable to launch URL: {0}
+exception.unable_to_create_internet_config = Unable to create an Internet Config instance: {0}
+exception.invocation_target_calling_url = InvocationTargetException while calling openURL: {0}
+exception.illegal_access_calling_url = IllegalAccessException while calling openURL: {0}
+exception.interrupted_launching_browser = InterruptedException while launching browser: {0}
+exception.das_source_doesnt_support_sequence_command = Source {0} does not support the sequence command.
+exception.invalid_das_source = Invalid das source: {0}
+exception.ebiembl_retrieval_failed_on = EBI EMBL XML retrieval failed on {0}:{1}
+label.no_embl_record_found = # No EMBL record retrieved for {0}:{1}
+label.embl_successfully_parsed = # Successfully parsed the {0} queries into an Alignment
+exception.no_pdb_records_for_chain = No PDB Records for {0} chain {1}
+exception.unexpected_handling_rnaml_translation_for_pdb = Unexpected exception when handling RNAML translation of PDB data
+exception.couldnt_recover_sequence_properties_for_alignment = Couldn't recover sequence properties for alignment
+exception.unknown_format_for_file = Unknown format {0} for file \: \n{1}
+label.remove_gaps = Remove Gaps
+exception.couldnt_recover_sequence_props_for_jnet_query = Couldn't recover sequence properties for JNet Query sequence!
+exception.server_timeout_try_later = Server timed out - try again later\n
+exception.web_service_returned_null_try_later= Server at {0} returned null object, it probably cannot be contacted. Try again later.
+exception.cannot_contact_service_endpoint_at = Cannot contact service endpoint at {0}
+error.implementation_error_cannot_find_service_url_in_given_set = Implementation error: Cannot find service url in the given url set!
+error.implementation_error_cannot_find_service_url_in_given_set_param_store = Implementation error: Cannot find service url in the given url set for this service parameter store ({0}}
+exception.jobsubmission_invalid_params_set = Invalid parameter set. Check Jalview implementation
+exception.notvaliddata_group_contains_less_than_min_seqs = Group contains less than {0} sequences.
+exception.outofmemory_loading_pdb_file = Out of memory loading PDB File
+exception.eps_coudnt_write_output_file = Could not write to the output file: {0}
+exception.eps_method_not_supported = Method not currently supported by EpsGraphics2D version {0}
+exception.eps_unable_to_get_inverse_matrix = Unable to get inverse of matrix: {0}
+warn.job_cannot_be_cancelled_close_window = This job cannot be cancelled.\nJust close the window.
+warn.service_not_supported = Service not supported!
+warn.input_is_too_big = Input is too big!
+warn.invalid_job_param_set = Invalid job parameter set!
+warn.oneseq_msainput_selection = The current selection only contains a single sequence. Do you want to submit all sequences for alignment instead ?
+info.job_couldnt_be_run_server_doesnt_support_program = Job could not be run because the server doesn't support this program.\n{0}
+info.job_couldnt_be_run_exceeded_hard_limit = Job could not be run because it exceeded a hard limit on the server.\n{0}
+info.job_couldnt_be_run_incorrect_param_setting = Job could not be run because some of the parameter settings are not supported by the server.\n{0}\nPlease check to make sure you have used the correct parameter set for this service\!\n
+info.no_jobs_ran = No jobs ran
+info.failed_to_submit_prediction = Failed to submit the prediction\:\n{0} {1}
+info.invalid_jnet_job_result_data ={0}\n{1}\nInvalid JNet job result data\!\n{2}
+info.failed_to_submit_sequences_for_alignment = Failed to submit sequences for alignment.\nIt is most likely that there is a problem with the server.\nJust close the window\n
+info.alignment_object_method_notes = \nAlignment Object Method Notes\n
+info.server_exception = \n{0} Server exception\!\n{1}
+info.invalid_msa_input_mininfo = Need at least two sequences with at least 3 residues each, with no hidden regions between them.
+info.invalid_msa_notenough = Not enough sequence data to align
+status.processing_commandline_args = Processing commandline arguments...
+status.das_features_being_retrived = DAS features being retrieved...
+status.searching_for_sequences_from = Searching for sequences from {0}
+status.finished_searching_for_sequences_from = Finished searching for sequences from {0}
+label.eps_file = EPS file
+label.png_image = PNG image
+status.saving_file = Saving {0}
+status.export_complete = Export complete.
+status.fetching_pdb = Fetching PDB {0}
+status.refreshing_news = Refreshing news
+status.importing_vamsas_session_from = Importing VAMSAS session from {0}
+status.opening_params = Opening {0}
+status.waiting_sequence_database_fetchers_init = Waiting for Sequence Database Fetchers to initialise
+status.init_sequence_database_fetchers = Initialising Sequence Database Fetchers
+status.fetching_sequence_queries_from = Fetching {0} sequence queries from {1}
+status.finshed_querying = Finished querying
+status.parsing_results = Parsing results.
+status.processing = Processing...
+status.refreshing_web_service_menus = Refreshing Web Service Menus
+status.collecting_job_results = Collecting job results.
+status.fetching_das_sequence_features = Fetching DAS Sequence Features
+status.no_das_sources_active = No DAS Sources Active
+status.das_feature_fetching_cancelled = DAS Feature Fetching Cancelled
+status.das_feature_fetching_complete = DAS Feature Fetching Complete
+status.fetching_db_refs = Fetching db refs
+status.loading_cached_pdb_entries = Loading Cached PDB Entries
+status.searching_for_pdb_structures = Searching for PDB Structures
+status.opening_file = opening file
+status.colouring_chimera = Colouring Chimera
+label.font_doesnt_have_letters_defined = Font doesn't have letters defined\nso cannot be used\nwith alignment data
+label.font_too_small = Font size is too small
+label.error_loading_file_params = Error loading file {0}
+label.error_loading_jalview_file = Error loading Jalview file
+warn.out_of_memory_when_action = Out of memory when {0}\!\!\nSee help files for increasing Java Virtual Machine memory.
+warn.out_of_memory_loading_file = Out of memory loading file {0}\!\!\nSee help files for increasing Java Virtual Machine memory.
+label.out_of_memory = Out of memory
+label.invalid_id_column_width = Invalid ID Column width
+warn.user_defined_width_requirements = The user defined width for the\nannotation and sequence ID columns\nin exported figures must be\nat least 12 pixels wide.
+label.couldnt_create_sequence_fetcher = Couldn't create SequenceFetcher
+warn.couldnt_create_sequence_fetcher_client = Could not create the sequence fetcher client. Check error logs for details.
+warn.server_didnt_pass_validation = Service did not pass validation.\nCheck the Jalview Console for more details.
+warn.url_must_contain = Sequence URL must contain $SEQUENCE_ID$ or a regex $SEQUENCE_ID=/<regex>/=$
+warn.urls_not_contacted = URLs that could not be contacted
+warn.urls_no_jaba = URLs without any JABA Services
+info.validate_jabaws_server = Validate JabaWS Server ?\n(Look in console output for results)
+label.test_server = Test Server?
+info.you_want_jalview_to_find_uniprot_accessions = Do you want Jalview to find\nUniprot Accession ids for given sequence names?
+label.find_uniprot_accession_ids = Find Uniprot Accession Ids
+label.new_sequence_fetcher = New Sequence Fetcher
+label.additional_sequence_fetcher = Additional Sequence Fetcher
+label.select_database_retrieval_source = Select Database Retrieval Source
+label.overwrite_existing_file = Overwrite existing file?
+label.file_already_exists = File exists
+label.edit_jabaws_url = Edit JABAWS URL
+label.add_jabaws_url = Add new JABAWS URL
+label.news_from_jalview = News from http://www.jalview.org
+label.cut_paste_alignmen_file = Cut & Paste Alignment File
+label.enter_redundancy_thereshold = Enter the redundancy threshold
+label.select_dark_light_set_thereshold = <html><i>Select a dark and light text colour, then set the threshold to<br>switch between colours, based on background colour</i></html>
+label.select_feature_colour = Select Feature Colour
+label.delete_all = Delete all sequences
+warn.delete_all = <html>Deleting all sequences will close the alignment window.<br>Confirm deletion or Cancel.
+label.add_annotations_for = Add annotations for
+action.choose_annotations = Choose Annotations...
+label.choose_annotations = Choose Annotations
+label.find = Find
+label.invalid_search = Search string invalid
+error.invalid_regex = Invalid regular expression
+label.ignore_gaps_consensus = Ignore Gaps In Consensus
+label.show_group_histogram = Show Group Histogram
+label.show_group_logo = Show Group Logo
+label.normalise_group_logo = Normalise Group Logo
+label.show_histogram = Show Histogram
+label.show_logo = Show Logo
+label.normalise_logo = Normalise Logo
+label.no_colour_selection_in_scheme = Please make a colour selection before applying colour scheme
+label.no_colour_selection_warn = Error saving colour scheme
+label.open_split_window? = Would you like to open as a split window, with cDNA and protein linked?
+label.open_split_window = Open split window
+label.no_mappings = No mappings found
+label.mapping_failed = No sequence mapping could be made between the alignments.<br>A mapping requires sequence names to match, and equivalent sequence lengths.
+action.no = No
+action.yes = Yes
+label.for = for
+label.select_by_annotation = Select/Hide Columns by Annotation
+action.select_by_annotation = Select/Hide Columns by Annotation...
+label.threshold_filter = Threshold Filter
+action.hide = Hide
+action.select = Select
+label.alpha_helix = Alpha Helix
+label.beta_strand = Beta Strand
+label.turn = Turn
+label.select_all = Select All
+label.structures_filter = Structures Filter
+label.search_filter = Search Filter
+label.description = Description
+label.include_description= Include Description
+action.back = Back
+label.hide_insertions = Hide Insertions
+label.mark_as_representative = Mark as representative
+label.open_jabaws_web_page = Open JABAWS web page
+label.opens_the_jabaws_server_homepage = Opens the JABAWS server's homepage in web browser
+label.pdb_sequence_getcher = PDB Sequence Fetcher
+label.result = result
+label.results = results
+label.structure_chooser = Structure Chooser
+label.select = Select :
+label.invert = Invert
+label.select_pdb_file = Select PDB File
+info.select_filter_option = Select Filter Option/Manual Entry
+info.associate_wit_sequence = Associate with Sequence
+label.search_result = Search Result
+label.found_structures_summary = Found Structures Summary
+label.configure_displayed_columns = Configure Displayed Columns
+label.start_jalview = Start Jalview
+label.biojs_html_export = BioJS
+label.scale_as_cdna = Scale protein residues to codons
+label.scale_protein_to_cdna = Scale Protein to cDNA
+label.scale_protein_to_cdna_tip = Make protein residues same width as codons in split frame views
+info.select_annotation_row = Select Annotation Row
+info.enter_search_text_here = Enter Search Text Here
+info.enter_search_text_to_enable = Enter Search Text to Enable
+info.search_in_annotation_label = Search in {0} Label
+info.search_in_annotation_description = Search in {0} Description
+info.change_threshold_mode_to_enable = Change Threshold Mode to Enable
+label.couldnt_read_data = Couldn't read data
+label.embbed_biojson = Embed BioJSON to HTML export
+action.export_groups = Export Groups
+action.export_annotations = Export Annotations
+action.export_hidden_columns = Export Hidden Columns
+action.export_hidden_sequences = Export Hidden Sequences
+action.export_features = Export Features
+label.export_settings = Export Settings
+label.save_as_biojs_html = Save as BioJs HTML
+label.pdb_web-service_error = PDB Web-service Error
+label.structure_chooser_manual_association = Structure Chooser - Manual association
+label.structure_chooser_filter_time = Structure Chooser - Filter time ({0})
+label.structure_chooser_no_of_structures = Structure Chooser - {0} Found ({1})
+info.no_pdb_entry_found_for = No PDB entry found for {0}
+exception.unable_to_detect_internet_connection = Jalview is unable to detect an internet connection
+exception.pdb_rest_service_no_longer_available = PDB rest services no longer available!
+exception.resource_not_be_found = The requested resource could not be found
+exception.pdb_server_error = There seems to be an error from the PDB server
+exception.pdb_server_unreachable = Jalview is unable to reach the PDBe Solr server. \nPlease ensure that you are connected to the internet and try again.
diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties
new file mode 100644
index 0000000..6db40cf
--- /dev/null
+++ b/resources/lang/Messages_es.properties
@@ -0,0 +1,1136 @@
+action.refresh_services = Refrescar servicios
+action.reset_services = Reiniciar servicios
+action.merge_results = Unificar resultados
+action.load_scheme = Cargar esquema
+action.save_scheme = Guardar esquema
+action.save_image = Guardar imagen
+action.paste = Pegar
+action.show_html_source = Mostrar c�digo HTML
+action.print = Imprimir
+action.web_service = Servicio web
+action.cancel_job = Cancelar trabajo
+action.start_job = Arrancar trabajo
+action.revert = Deshacer
+action.move_down = Mover hacia abajo
+action.move_up = Mover hacia arriba
+action.remove_return_datatype = Borrar tipo de datos de retorno
+action.add_return_datatype = A�adir tipo de datos de retorno
+action.remove_input_parameter = Borrar el par�metro de entrada seleccionado
+action.add_input_parameter = A�adir par�metro de entrada seleccionado
+action.edit = Editar
+action.new = Nuevo
+action.open_file = Abrir fichero
+action.show_unconserved = Mostrar regiones no conservadas
+action.open_new_alignment = Abrir nuevo alineamiento
+action.raise_associated_windows = Destacar ventanas asociadas
+action.minimize_associated_windows = Minimizar ventanas asociadas
+action.close_all = Cerrar todo
+action.load_project = Cargar proyecto
+action.save_project = Guardar proyecto
+action.quit = Salir
+action.expand_views = Expandir vistas
+action.gather_views = Capturar vistas
+action.page_setup = Configuraci�n de la p�gina
+action.reload = Recargar
+action.load = Cargar
+action.open = Abrir
+action.cancel = Cancelar
+action.create = Crear
+action.update = Actualizar
+action.delete = Borrar
+action.snapshot = Imagen
+action.clear = Limpiar
+action.accept = Aceptar
+action.select_ddbb = --- Seleccionar base de datos ---
+action.undo = Deshacer
+action.redo = Rehacer
+action.reset = Reiniciar
+action.remove_left = Eliminar parte izquierda
+action.remove_right = Eliminar parte derecha
+action.remove_empty_columns = Eliminar las columnas vac�as
+action.remove_all_gaps = Eliminar todos los huecos
+action.left_justify_alignment = Ajustar el alineamiento a la izquierda
+action.right_justify_alignment = Ajustar el alineamiento a la derecha
+action.boxes = Casillas
+action.text = Texto
+action.by_pairwise_id = Identificar por parejas
+action.by_id = Por identificador
+action.by_length = Por longitud
+action.by_group = Por grupo
+action.remove = Eliminar
+action.remove_redundancy = Eliminar redundancia...
+action.pairwise_alignment = Alineamiento de pares...
+action.by_rna_helixes = Por h�lices de RNA
+action.user_defined = Definido por el usuario...
+action.by_conservation = Por conservaci�n
+action.wrap = Envolver
+action.show_gaps = Mostrar huecos
+action.show_hidden_markers = Mostrar marcadores ocultos
+action.find = Buscar
+action.undefine_groups = Grupos sin definir
+action.create_groups = Crear grupos
+action.make_groups_selection = Hacer grupos para seleccionar
+action.copy = Copiar
+action.cut = Cortar
+action.font = Fuente...
+action.scale_above = Escala superior
+action.scale_left = Escala izquierda
+action.scale_right = Escala derecha
+action.by_tree_order = Por orden del �rbol
+action.sort = Ordenar
+action.calculate_tree = Calcular �rbol
+action.help = Ayuda
+action.by_annotation = Por anotaci�n...
+action.invert_sequence_selection = Invertir selecci�n de secuencias
+action.invert_column_selection = Invertir selecci�n de columnas
+action.show = Mostrar
+action.hide = Ocultar
+action.ok = OK
+action.set_defaults = Defecto
+action.create_group = Crear grupo
+action.remove_group = Eliminar grupo
+action.edit_group = Editar grupo
+action.border_colour = Color del borde
+action.edit_new_group = Editar nuevo grupo
+action.hide_sequences = Ocultar secuencias
+action.sequences = Secuencias
+action.ids = IDS
+action.ids_sequences = IDS y secuencias
+action.reveal_all = Revelar todo
+action.reveal_sequences = Revelar secuencias
+action.find_all = Buscar todo
+action.find_next = Buscar siguiente
+action.file = Archivo
+action.view = Ver
+action.change_params = Cambiar par�metros
+action.apply = Aplicar
+action.apply_threshold_all_groups = Aplicar umbral a todos los grupos
+action.apply_all_groups = Aplicar a todos los grupos
+action.by_chain = Por cadena
+action.by_sequence = Por secuencia
+action.paste_annotations = Pegar anotaciones
+action.format = Formato
+action.select = Seleccionar
+action.new_view = Nueva vista
+action.close = Cerrar
+action.add = A�adir
+action.save_as_default = Guardar como por defecto
+action.save_as = Guardar como
+action.save = Guardar
+action.cancel_fetch = Cancelar b�squeda
+action.save_omit_hidden_columns = Guardar / Omitir las columnas ocultas
+action.change_font = Cambiar Fuente
+action.change_font_tree_panel = Cambiar fuente (panel del �rbol)
+action.colour = Color
+action.calculate = Calcular
+action.select_all = Seleccionar Todo
+action.deselect_all = Deseleccionar Todo
+action.invert_selection = Invertir selecci�n
+action.using_jmol = Usar Jmol
+action.link = Enlazar
+action.group_link = Enlazar grupo
+action.show_chain = Mostrar cadena
+action.show_group = Mostrar grupo
+action.fetch_db_references = Recuperar referencias a base de datos
+action.view_flanking_regions = Mostrar flancos
+label.view_flanking_regions = Mostrar los datos de la secuencia a ambos lados de las subsecuencias implicadas en este alineamiento
+label.str = Str:
+label.seq = Seq:
+label.structures_manager = Administrar estructuras
+label.nickname = Sobrenombre:
+label.url = URL:
+label.input_file_url = Introducir URL en el fichero de entrada
+label.select_feature = Seleccionar funci�n:
+label.name = Nombre:
+label.name_param = Nombre: {0}
+label.group = Grupo:
+label.group_name = Nombre del grupo
+label.group_description = Descripci�n del grupo
+label.edit_group_name_description = Editar nombre/descripci�n del grupo
+label.colour = Color:
+label.description = Descripci�n:
+label.start = Comenzar:
+label.end = Terminar:
+label.current_parameter_set_name = Nombre actual del conjunto de par�metros:
+label.service_action = Acci�n de servicio:
+label.post_url = POST URL:
+label.url_suffix = URL Sufijo
+label.sequence_source = Fuente de la secuencia
+label.per_seq = por secuencia
+label.result_vertically_separable = Los resultados son separables verticalmente
+label.amend = Modificar
+label.undo_command = Deshacer {0}
+label.redo_command = Rehacer {0}
+label.principal_component_analysis = An�lisis del Componente Principal
+label.average_distance_identity = Distancia Media Usando % de Identidad
+label.neighbour_joining_identity = Unir vecinos utilizando % de Identidad
+label.treecalc_title = {0} utilizando {1}
+label.tree_calc_av = Distancia media
+label.tree_calc_nj = Unir vecinos
+label.select_score_model = Selecciones modelo de puntuaci�n
+label.score_model_pid = % Identidad
+label.score_model_blosum62 = BLOSUM62
+label.score_model_pam250 = PAM 250
+label.score_model_conservation = Conservaci�n de las propiedades f�sico-qu�micas
+label.score_model_enhconservation = Conservaci�n de las propiedades f�sico-qu�micas
+label.status_bar = Barra de estado
+label.out_to_textbox = Generar cuadro de texto
+label.clustalx = Clustalx
+label.clustal = Clustal
+label.zappo = Zappo
+label.taylor = Taylor
+label.blc = BLC
+label.fasta = Fasta
+label.msf = MSF
+label.pfam = PFAM
+label.pileup = Pileup
+label.pir = PIR
+label.hydrophobicity = Hidrofobicidad
+label.helix_propensity = Tendencia de la h�lice
+label.strand_propensity = Tendencia de la hebra
+label.turn_propensity = Tendencia de giro
+label.buried_index = �ndice de encubrimiento
+label.purine_pyrimidine = Purina/Pirimidina
+label.percentage_identity = Porcentaje de identidad
+label.blosum62 = BLOSUM62
+label.blosum62_score = Puntuaci�n del BLOSUM62
+label.tcoffee_scores = Puntuaci�n del T-Coffee
+label.average_distance_bloslum62 = Distancia Media Usando BLOSUM62
+label.neighbour_blosum62 = Neighbour Joining usando BLOSUM62
+label.show_annotations = Mostrar anotaciones
+label.colour_text = Color del texto
+label.show_non_conversed = Mostrar no conservadas
+label.overview_window = Ventana resumen
+label.none = Ninguno
+label.above_identity_threshold = Por encima del umbral de identidad
+label.show_sequence_features = Mostrar las caracter�sticas de las secuencias
+label.nucleotide = Nucle�tido
+label.to_new_alignment = A nuevo alineamiento
+label.to_this_alignment = A�adir a este alineamiento
+label.apply_colour_to_all_groups = Aplicar color a todos los grupos
+label.modify_identity_thereshold = Modificar el umbral de identidad...
+label.modify_conservation_thereshold = Modificar el umbral de conservaci�n...
+label.input_from_textbox = Introducir desde el cuadro de texto
+label.centre_column_labels = Centrar las etiquetas de las columnas
+label.automatic_scrolling = Desplazamiento autom�tico
+label.documentation = Documentaci�n
+label.about = Acerca de...
+label.show_sequence_limits = Mostrar los l�mites de la secuencia
+label.feature_settings = Ajustar funciones...
+label.sequence_features = Funciones de la secuencia
+label.all_columns = Todas las columnas
+label.all_sequences = Todas las secuencias
+label.selected_columns = Columnas seleccionadas
+label.selected_sequences = Secuencias seleccionadas
+label.all_but_selected_region = Todo menos la regi�n seleccionada (Shift+Ctrl+H)
+label.selected_region = Regi�n seleccionada
+label.all_sequences_columns = Todas las secuencias y columnas
+label.group_consensus = Consenso de grupo
+label.group_conservation = Conservaci�n de grupo
+label.show_consensus_histogram = Mostrar el histograma de consenso
+label.show_consensus_logo = Mostrar el logo de consenso
+label.norm_consensus_logo = Normalizar el logo de consenso
+label.apply_all_groups = Aplicar a todos los grupos
+label.autocalculated_annotation = Anotaci�n autocalculada
+label.min_colour = Color m�nimo
+label.max_colour = Color m�ximo
+label.use_original_colours = Usar colores originales
+label.threshold_minmax = El umbral es m�n/m�x
+label.represent_group_with = Representar al grupo con
+label.selection = Seleccionar
+label.group_colour = Color del grupo
+label.sequence = Secuencia
+label.view_pdb_structure = Ver estructura PDB
+label.min = M�n:
+label.max = M�x:
+label.colour_by_label = Color por etiquetas
+label.new_feature = Nueva funci�n
+label.match_case = Hacer corresponder may�sculas y min�sculas
+label.view_alignment_editor = Ver en el editor de alineamientos
+label.labels = Etiquetas
+label.output_values = Valores de salida...
+label.output_points = Puntos de salida...
+label.output_transformed_points = Puntos de salida transformados
+label.input_data = Datos de entrada...
+label.nucleotide_matrix = Matriz nucleot�dica
+label.protein_matrix = Matriz proteica
+label.show_bootstrap_values = Mostrar valores de Bootstrap
+label.show_distances = Mostrar distancias
+label.mark_unassociated_leaves = Marcar hojas no asociadas
+label.fit_to_window = Ajustar a la ventana
+label.newick_format = Formato Newick
+label.select_newick_like_tree_file = Seleccione un fichero de �rbol tipo Newick
+label.colours = Colores
+label.view_mapping = Ver mapeado
+label.wireframe = Estructura met�lica
+label.depthcue = Clave de profundidad
+label.z_buffering = Tamponamiento Z
+label.charge_cysteine = Carga & Ciste�na
+label.all_chains_visible = Todas las cadenas visibles
+label.successfully_added_features_alignment = Funciones a�adidas exitosamente al alineamiento
+label.keyboard_editing_mode = El modo de editar teclado es {0}
+label.paste_features_annotations_Tcoffee_here = Pegar tus funciones / anotaciones / puntuaci�n del fichero T-coffee aqu�.
+label.removed_columns = {0} columnas eliminadas.
+label.removed_empty_columns = {0} columnas vac�as eliminadas.
+label.paste_newick_tree_file = Pegar su fichero �rbol Newick aqu�.
+label.order_by_params = Ordenar por {0}
+label.html_content = <html>{0}</html>
+label.paste_pdb_file= Pegar tu fichero PDB aqu�.
+label.paste_pdb_file_for_sequence = Pegar fichero PDB para la secuencia {0}
+label.could_not_parse_newick_file = No se pudo analizar el fichero Newick\\\!\\n {0}
+label.successfully_pasted_tcoffee_scores_to_alignment= Pegada exitosamente la puntuaci�n T-Coffee al alineamiento.
+label.failed_add_tcoffee_scores = Fallo al a�adir las puntuaciones T-Coffee:
+label.successfully_pasted_annotation_to_alignment = Anotaci�n pegada exitosamente al alineamiento.
+label.couldnt_parse_pasted_text_as_valid_annotation_feature_GFF_tcoffee_file = No es posible parsear el texto pegado como una anotaci�n caracter�sticas, GFF, o fichero T-Coffee v�lidos
+label.successfully_pasted_alignment_file = Fichero de alineamiento pegado exitosamente
+label.paste_your_alignment_file = Pegar su fichero de alineamiento aqu�
+label.paste_your = Pegar su
+label.finished_searching = B�squeda finalizada
+label.search_results= Buscar Resultados {0} : {1}
+label.found_match_for = Buscar coincidencia para {0}
+label.font = Fuente:
+label.size = Talla:
+label.style = Estilo:
+label.enter_redundancy_threshold = Introducir el umbral de redundancia
+label.calculating = Calculando....
+label.modify_conservation_visibility = Modificar la visibilidad de conservaci�n
+label.colour_residues_above_occurence = Residuos de color por encima del % de aparici�n
+label.set_this_label_text = fijar como etiqueta
+label.sequences_from = Secuencias de {0}
+label.successfully_loaded_file = Fichero cargado exitosamente {0}
+label.successfully_saved_to_file_in_format = Guardado exitosamente en el fichero: {0} en formato {1}.
+label.copied_sequences_to_clipboard = Copiadas {0} secuencias en el portapapeles.
+label.check_file_matches_sequence_ids_alignment = Comprobar que el fichero coincide con el ID de la secuencia en el alineamiento.
+label.problem_reading_tcoffee_score_file = Problema de lectura del fichero de puntuaciones T-COFFEE
+label.source_to_target = {0} a {1}
+label.per_sequence_only= S�lo por secuencia
+label.to_file = a fichero
+label.to_textbox = a cuadro de texto
+label.jalview = Jalview
+label.csv_spreadsheet = CSV (Hoja de c�lculo)
+label.status = [Estado]
+label.channels = Canales
+label.channel_title_item_count = {0} ({1})
+label.blog_item_published_on_date = {0} {1}
+label.select_das_service_from_table = Seleccionar servicio DAS de la tabla para leer una descripci�n completa aqu�.
+label.session_update = Actualizar sesi�n
+label.new_vamsas_session = Nueva sesi�n Vamsas
+label.load_vamsas_session = Cargar sesi�n Vamsas
+label.save_vamsas_session = Guardar sesi�n Vamsas
+label.select_vamsas_session_opened_as_new_vamsas_session= Selecciones una sesi�n vamsas para abrirla como una nueva sesi�n.
+label.open_saved_vamsas_session = Abrir una sesi�n VAMSAS guardada
+label.groovy_console = Consola Groovy
+label.lineart = lineart
+label.dont_ask_me_again = No volver a preguntar
+label.select_eps_character_rendering_style = Seleccionar el car�cter EPS como estilo de visualizaci�n
+label.invert_selection = Invertir selecci�n
+label.optimise_order = Optimizar orden
+label.seq_sort_by_score = Ordenar las secuencias por puntuaci�n
+label.load_colours = Cargar colores
+label.save_colours = Guardar colores
+label.fetch_das_features = Recuperar funciones DAS
+label.selected_database_to_fetch_from = Seleccionada {0} Base de datos {1} para buscar de {2}
+label.database_param = Base de datos: {0}
+label.example = Ejemplo
+label.example_param = Ejemplo: {0}
+label.select_file_format_before_saving = Debe seleccionar un formato de fichero antes de guardar!
+label.file_format_not_specified = Formato de fichero no especificado
+label.alignment_contains_hidden_columns = El alineamiento contiene columnas ocultas.\\nQuieres guardar s\u00F3lo el alineamiento visible?
+label.couldnt_save_file = No se pudo guardar el fichero: {0}
+label.error_saving_file = Error guardando el fichero
+label.remove_from_default_list = eliminar de la lista de defectuosos?
+label.remove_user_defined_colour = Eliminar el color definido por el usuario
+label.you_must_select_least_two_sequences = Debes seleccionar al menos 2 secuencias.
+label.invalid_selection = Selecci�n inv�lida
+label.principal_component_analysis_must_take_least_four_input_sequences = El an\u00E1lisis de la componente principal debe tomar\\nal menos 4 secuencias de entrada.
+label.sequence_selection_insufficient = Selecci�n de secuencias insuficiente
+label.you_need_more_two_sequences_selected_build_tree = necesitas seleccionar m�s de dos secuencias para construir un �rbol!
+label.not_enough_sequences = No suficientes secuencias
+label.selected_region_to_tree_may_only_contain_residues_or_gaps = La regi\u00F3n seleccionada para construir un \u00E1rbol puede\\ncontener s\u00F3lo residuos o espacios.\\nPrueba usando la funci\u00F3n Pad en el men\u00FA de edici\u00F3n,\\n o uno de los m\u00FAltiples servicios web de alineamiento de secuencias.
+label.sequences_selection_not_aligned = Las secuencias seleccionadas no est�n alineadas
+label.sequences_must_be_aligned_before_creating_tree = Las secuencias deben estar alineadas antes de crear el \u00E1rbol.\\nPrueba usando la funci\u00F3n Pad en el men\u00FA de editar,\\n o uno de los m\u00FAltiples servicios web de alineamiento de secuencias.
+label.sequences_not_aligned = Secuencias no alineadas
+label.problem_reading_tree_file = Problema al leer el fichero del �rbol
+label.possible_problem_with_tree_file = Posible problema con el fichero del �rbol
+label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation = Por favor seleccionar al menos tres bases de al menos una secuencia para poder realizar la traducci�n de cDNA.
+label.translation_failed = Translation Failed
+label.error_when_translating_sequences_submit_bug_report = Desafortunadamente, algo fue mal a la hora de traducir tus secuencias.\\nPor favor, revisa la consola Jalview java \\ny presenta un informe de error que incluya el seguimiento.
+label.implementation_error = Error de implementaci�n:
+label.automatically_associate_pdb_files_with_sequences_same_name = Quieres asociar autom�ticamente los {0} ficheros PDB con las secuencias del alineamiento que tengan el mismo nombre?
+label.automatically_associate_pdb_files_by_name = Asociar los ficheros PDB por nombre autom�ticamente
+label.ignore_unmatched_dropped_files_info = Quieres <em>ignorar</em> los {0} ficheros cuyos nombres no coincidan con ning�n IDs de las secuencias ?
+label.ignore_unmatched_dropped_files = Ignorar los ficheros sin coincidencias?
+label.enter_view_name = Introducir nombre visible (�?)
+label.enter_label = Introducir etiqueta
+label.enter_label_for_the_structure = Introducir una etiqueta para la estructura?
+label.pdb_entry_is_already_displayed = {0} Ya est\u00E1 mostrado.\\nQuieres volver a usar este visor?
+label.map_sequences_to_visible_window = Mapa de secuencias en ventana visible: {0}
+label.add_pdbentry_to_view = Quieres a\u00F1adir {0} a la vista llamada\\n{1}\\n
+label.align_to_existing_structure_view = Alinear a una estructura ya existente
+label.pdb_entries_couldnt_be_retrieved = Las siguientes entradas pdb no pueden ser extra\u00EDdas del PDB\\\:\\n{0}\\nPor favor, prueba descarg\u00E1ndolas manualmente.
+label.couldnt_load_file = No se pudo cargar el fichero
+label.couldnt_find_pdb_id_in_file = No se pudo encontrar un Id PDB en el fichero suministrado. Por favor, introduzca un Id para identificar esta estructura.
+label.no_pdb_id_in_file = No hay un Id PDB en el fichero
+label.couldnt_read_pasted_text = No se pudo leer el texto pegado {0}
+label.error_parsing_text = Error analizando el texto
+label.enter_local_das_source = Intruduzca el Nickname & URL de la fuente DAS local
+label.you_can_only_edit_or_remove_local_das_sources = S�lo puedes editar o eliminar fuentes DAS locales!
+label.public_das_source = Fuente p�blica DAS - no editable
+label.input_alignment_from_url = Alineamiento de entrada desde URL
+label.input_alignment = Alineamiento de entrada
+label.couldnt_import_as_vamsas_session = No se pudo importar {0} como una nueva sesi�n Vamsas.
+label.vamsas_document_import_failed = Fallo en la importaci�n del documento Vamsas
+label.couldnt_locate = No se pudo localizar {0}
+label.url_not_found = URL no encontrada
+label.no_link_selected = Enlace no seleccionado
+label.new_sequence_url_link = Enlace a una nueva secuencia URL
+label.cannot_edit_annotations_in_wrapped_view = No se pueden editar anotaciones en vista envolvente
+label.wrapped_view_no_edit = Vista envolvente - no editar
+label.error_retrieving_data = Error en la recuperaci�n de datos
+label.user_colour_scheme_must_have_name = El esquema de colores del usuario debe tener un nombre
+label.no_name_colour_scheme = No hay nombre para el esquema de colores
+label.invalid_url = URL Invalido!
+label.error_loading_file = Error al cargar el fichero
+label.problems_opening_file = Encontrados problemas al abrir el fichero {0}!!
+label.file_open_error = Error al abrir el fichero
+label.no_das_sources_selected_warn = No han sido seleccionadas fuentes DAS.\\nPor favor, seleccione algunas fuentes y\\npruebe de nuevo.
+label.no_das_sources_selected_title = No han sido seleccionadas fuentes DAS
+label.colour_scheme_exists_overwrite = El esquema de colores {0} ya existe.\\nContinuar guardando el esquema de colores como {1}?
+label.duplicate_scheme_name = Duplicar nombre de esquema
+label.jalview_new_questionnaire = Hay un nuevo cuestionario disponible. Querr\u00EDa completarlo ahora ?\\n
+label.jalview_user_survey = Encuesta de usuario Jalview
+label.alignment_properties = Propiedades del alineamiento: {0}
+label.alignment_props = Propiedades del alineamiento
+label.input_cut_paste = Cortar y pegar la entrada
+label.input_cut_paste_params = Cortar y pegar la entrada - {0}
+label.alignment_output_command = Alineamiento de salida - {0}
+label.annotations = Anotaciones
+label.features = Funciones
+label.overview_params = Visi�n general {0}
+label.paste_newick_file = Pegar nuevo fichero Newick
+label.load_tree_from_file = desde fichero -
+label.colour_by_annotation = Color por anotaci�n
+label.selection_output_command = Seleccionar salida - {0}
+label.annotation_for_displayid = <p><h2>Anotaci�n para {0} </h2></p><p>
+label.pdb_sequence_mapping = PDB - Mapeado de secuencia
+label.pca_details = detalles de la PCA
+label.redundancy_threshold_selection = Selecci�n del umbral de redundancia
+label.user_defined_colours = Colores definidos del usuario
+label.jalviewLite_release = JalviewLite - versi�n {0}
+label.jaview_build_date = Fecha de creaci�n: {0}
+label.jalview_authors_1 = Authors: Jim Procter, Andrew Waterhouse, Mungo Carstairs, Tochukwu Ofoegbu, Lauren Lui, Jan Engelhardt,
+label.jalview_authors_2 = Natasha Sherstnev, Daniel Barton, Michele Clamp, James Cuff, Steve Searle, David Martin & Geoff Barton.
+label.jalview_dev_managers = Desarrollo gestionado por The Barton Group, University of Dundee, Scotland, UK.
+label.jalview_distribution_lists = Para ayuda, ver el FAQ at www.jalview.org y/o adjuntar la lista de env�o jalview-discuss at jalview.org
+label.jalview_please_cite = Si usa Jalview incluya la siguiente cita, por favor:
+label.jalview_cite_1_authors = Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)
+label.jalview_cite_1_title = Jalview Version 2 - un editor de alineamiento m�ltiple de secuencias y banco de trabajo de an�lisis
+label.jalview_cite_1_ref = Bioinformaticos doi: 10.1093/bioinformatics/btp033
+label.right_click = clic en el bot�n derecho
+label.to_add_annotation = para a�adir anotaci�n
+label.alignment_has_no_annotations = El alineamiento no tiene anotaciones
+label.retrieving_pdb_data = Recuperaci�n de datos PDB...
+label.label = Etiqueta
+label.no_features_added_to_this_alignment = No hay funciones asociadas a este alineamiento!!
+label.features_can_be_added_from_searches_1 = (Las funciones pueden ser a�adidas de b�squedas o
+label.features_can_be_added_from_searches_2 = de ficheros de funciones Jalview / GFF)
+label.calculating_pca= Calculando PCA
+label.reveal_columns = Mostrar Columnas
+label.jalview_cannot_open_file = Jalview no puede abrir el fichero
+label.jalview_applet = Aplicaci�n Jalview
+label.loading_data = Cargando datos
+label.memory_stats = Memoria libre total: {0} MB; Memoria m�xima: {1} MB; {2} %
+label.calculating_tree = Calculando �rbol
+label.state_queueing = En cola
+label.state_running = Procesando
+label.state_complete = Completar
+label.state_completed = Finalizado
+label.state_job_cancelled = �Trabajo cancelado!
+label.state_job_error = Error del trabajo!
+label.server_error_try_later = �Error del servidor! (Intentar m�s tarde)
+label.error_loading_pdb_data = �Error cargando los datos PDB!
+label.fetching_pdb_data = Buscando los datos PDB...
+label.structure_type = Estructura_tipo
+label.settings_for_type = Ajustes para {0}
+label.view_full_application = Ver en la aplicaci�n completa
+label.load_associated_tree = Cargar �rbol asociado ...
+label.load_features_annotations = Cargar caracter�sticas/anotaciones ...
+label.export_features = Exportar caracter�sticas...
+label.export_annotations = Exportar anotaciones ...
+label.jalview_copy = Copiar (s�lo Jalview)
+label.jalview_cut = Cortar (s�lo Jalview)
+label.to_upper_case = Pasar a may�sculas
+label.to_lower_case = Pasar a min�sculas
+label.toggle_case = Alternar may�sculas y min�sculas
+label.edit_name_description = Editar nombre/descripci�n
+label.create_sequence_feature = Crear funci�n de secuencia
+label.edit_sequence = Editar secuencia
+label.edit_sequences = Editar secuencias
+label.sequence_details = Detalles de la secuencia
+label.jmol_help = Ayuda de Jmol
+label.all = Todo
+label.sort_by = Ordenar por
+label.sort_by_score = Ordenar por puntuaci�n
+label.sort_by_density = Ordenar por densidad
+label.sequence_sort_by_density = Ordenar las secuencias por densidad
+label.reveal = Revelar
+label.hide_columns = Ocultar columnas
+label.load_jalview_annotations = Cargar un fichero de anotaci�n de Jalivew o un fichero de caracter�sticas
+label.load_tree_file = Cargar un fichero de �rbol
+label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences = Recuperar y parsear un registro de secuencia de base de datos para el alineamiento o secuencias actualmente seleccionados
+label.standard_databases = Bases de datos est�ndar
+label.fetch_embl_uniprot = Recuperar de EMBL/EMBLCDS o Uniprot/PDB y de cualquier fuente DAS seleccionada
+label.reset_min_max_colours_to_defaults = Reiniciar los colores min y max colours a los valores por defecto establecidos en las preferencias de usuario
+label.align_structures_using_linked_alignment_views = Alinear las estructuras utlizando las {0} vistas de alineamiento enlazadas
+label.connect_to_session = Conectar a la sesi�n {0}
+label.threshold_feature_display_by_score = Filtrar la caracter�stica mostrada por puntuaci�n.
+label.threshold_feature_no_thereshold = Sin umbral
+label.threshold_feature_above_thereshold = Por encima del umbral
+label.threshold_feature_below_thereshold = Por debajo del umbral
+label.adjust_thereshold = Ajustar umbral
+label.toggle_absolute_relative_display_threshold = Cambiar entre mostrar el umbral absoluto y el relativo.
+label.display_features_same_type_different_label_using_different_colour = Mostrar las caracter�sticas del mismo tipo con una etiqueta diferente y empleando un color distinto (p.e. caracter�sticas del dominio)
+label.select_colour_minimum_value = Seleccionar el color para el valor m�nimo
+label.select_colour_maximum_value = Seleccionar el color para el valor m�ximo
+label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment = Abrir una nueva vista Jmol con todas las estructuras asociadas con la selecci�n acxtual y superponer las utilizando el alineamiento.
+label.open_url_param = Abrir URL {0}
+label.open_url_seqs_param = Abrir URL ({0}..) ({1} secuencias)
+label.load_pdb_file_associate_with_sequence = Cargar un fichero PDB y asociarlo con la secuencia {0}
+label.reveal_hidden_columns = Revelar las columnas ocultas con el bot�n derecho del rat�n
+label.dark_colour = Oscurecer color
+label.light_colour = Aclarar color
+label.highlightnode = Pulse el bot�n izquierdo para seleccionar las hojas.<br>Haga doble clic para invertir las hojas.<br>Pulse el bot�n derecho para cambiar el color.
+label.load_colour_scheme = Cargar esquema crom�tico
+label.toggle_enabled_views = Cuando est� habilitado, permite que se seleccionen varias vistas.
+label.edit_notes_parameter_set = Haga clic para editar las notas de este conjunto de par�metros.
+label.open_local_file = Abrir fichero local
+label.enable_automatically_sort_alignment_when_open_new_tree = Habilite esta opci�n para ordenar autom�ticamente<br>el alineamiento cuando abra<br> un nuevo �rbol.
+label.listen_for_selections = Atenci�n a las selecciones
+label.selections_mirror_selections_made_same_sequences_other_views = Cuando est� habilitado, las selecciones de esta vista ser�n un reflejo<br>de las selecciones realizadas en las mismas secuencias de otras vistas.
+label.toggle_sequence_visibility = Shift+H cambia la visibilidad de la secuencia
+label.toggle_columns_visibility = Ctrl+H cambia la visibilidad de la columna
+label.toggles_visibility_hidden_selected_regions = H cambiar la visibilidad de las regiones ocultas o seleccionadas
+label.rename_tab_eXpand_reGroup= Haga clic en el bot�n derecho para renombrar la pesta�a<br>Presione X para expandir las tablas y G para reagrupar.
+label.right_align_sequence_id = Alinear a la derecha el ID de la secuencia
+label.sequence_id_tooltip = Ayuda del ID de la secuencia
+label.no_services = <Sin Servicios>
+label.select_copy_raw_html = Seleccione esta opci�n si desea copiar el html en bruto
+label.share_data_vamsas_applications = Compartir datos con otras aplicaciones vamsas
+label.connect_to = Conectar a
+label.join_existing_vamsas_session = Unirse a una sesi�n vamsas existente
+label.from_url = desde una URL
+label.any_trees_calculated_or_loaded_alignment_automatically_sort = Cuando est� habilitado, cualquier �rbol calculado o cargado en el alineamiento lo ordenar�
+label.sort_with_new_tree = Ordenar con el nuevo �rbol
+label.from_textbox = desde un �rea de texto
+label.window = Ventana
+label.preferences = Preferencias
+label.tools = Herramientas
+label.fetch_sequences = Recuperar secuencia(s)
+label.stop_vamsas_session = Parar sesi�n vamsas
+label.collect_garbage = Recolector de basura
+label.show_memory_usage = Mostrar uso de memoria
+label.show_java_console = Mostrar consola de Java
+label.show_jalview_news = Mostrar las noticias de Jalview
+label.take_snapshot = Tomar captura
+label.monospaced_fonts_faster_to_render = Las fuentes monoespaciadas son m�s r�pidas de pintar
+label.anti_alias_fonts = Fuentes anti-alias (m�s lentas de pintar)
+label.monospaced_font= Monoespaciadas
+label.quality = Calidad
+label.maximize_window = Maximizar ventana
+label.conservation = Conservaci�n
+label.consensus = Consenso
+label.histogram = Histograma
+label.logo = Logo
+label.non_positional_features = Caracter�sticas no posicionales
+label.database_references = Referencias a base de datos
+label.share_selection_across_views = Compartir la selecci�n en todas las vistas
+label.scroll_highlighted_regions = Desplazarse hasta las regiones resaltadas
+label.gap_symbol = S�mbolo del hueco
+label.alignment_colour = Color del alineamiento
+label.address = Direcci�n
+label.port = Puerto
+label.default_browser_unix = Navegador por defecto (Unix)
+label.send_usage_statistics = Enviar estad�sticas de uso
+label.check_for_questionnaires = Comprobar los cuestionarios
+label.check_for_latest_version = Comprobar la �ltima versi�n
+label.url_linkfrom_sequence_id = URL del enlace del ID de la secuencia
+label.use_proxy_server = Utilizar un servidor proxy
+label.eps_rendering_style = Estilo de visualizaci�n EPS
+label.append_start_end = A�adir /inicio-fin (/15-380)
+label.full_sequence_id = ID de la secuencia completo
+label.smooth_font = Fuente alargada
+label.autocalculate_consensus = Autocalcular consenso
+label.pad_gaps = Rellenar huecos
+label.pad_gaps_when_editing = Rellenar huecos al editar
+label.automatically_set_id_width = Establecer autom�ticamente al anchura del ID
+label.figure_id_column_width = Anchura de la columna del ID de la Figura
+label.use_modeller_output = Utilizar la salidad del Modeller
+label.wrap_alignment = Envolver alineamiento
+label.right_align_ids = Alinear IDs a la derecha
+label.sequence_name_italics = Nombre de la secuencia en cursiva
+label.open_overview = Abrir resumen
+label.default_colour_scheme_for_alignment = Esquema crom�tico por defecto para el alineamiento
+label.annotation_shading_default = Sombreado por defecto de la anotaci�n
+label.default_minimum_colour_annotation_shading = Por m�nimo por defecto para el sombreado de la anotaci�n
+label.default_maximum_colour_annotation_shading = Por m�ximo por defecto para el sombreado de la anotaci�n
+label.visual = Visual
+label.connections = Conexiones
+label.output = Salida
+label.editing = Edici�n
+label.das_settings = Configuraci�n DAS
+label.web_services = Servicios web
+label.right_click_to_edit_currently_selected_parameter = Haga clic en el bot�n derecho para editar el par�metro seleccionado actualmente.
+label.let_jmol_manage_structure_colours = Permitir que Jmol gestione la estructuras crom�ticas
+label.marks_leaves_tree_not_associated_with_sequence = Marcar las hojas del �rbol que no est�n asociadas a una secuencia
+label.index_web_services_menu_by_host_site = Indizar los servicios web en el men� por el host que los aloja
+label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up = Marque esta opci�n si desea ser informado<br>cuando no se pueda acceder a la URL de un servicio web<br>al arrancar Jalview.
+label.new_service_url = Nueva URL del servicio
+label.edit_service_url = Editar la URL del servicio
+label.delete_service_url = Borrar la URL del servicio
+label.details = Detalles
+label.options = Opciones
+label.parameters = Param�tros
+label.available_das_sources = Fuentes DAS disponibles
+label.full_details = Detalles completos
+label.authority = Autoridad
+label.type = Tipo
+label.proxy_server = Servidor proxy
+label.file_output = Fichero de salida
+label.select_input_type = Seleccionar el tipo de entrada
+label.set_options_for_type = Establecer opciones para el tipo
+label.data_input_parameters = Datos de los par�metros de entrada
+label.data_returned_by_service = Datos devueltos por el servicio
+label.rsbs_encoded_service = Servicio RSBS codificado
+label.parsing_errors = Errores de parseo
+label.simple_bioinformatics_rest_services = Simple Bioinformatics Rest Services
+label.web_service_discovery_urls = URL de descubrimiento de servicios web
+label.input_parameter_name = Nombre del par�metro de entrada
+label.short_descriptive_name_for_service = Nombre corto descriptivo del servicio
+label.function_service_performs = Tipo de funci�n que realiza el servicio (p.e. alineamiento, an�lisis, b�squeda, etc).
+label.brief_description_service = Descripci�n breve del servicio
+label.url_post_data_service = URL a la que enviar los datos del servicio. Incluya cualquier par�metro especial que se necesite aqu�
+label.optional_suffix = Sufijo opcional a�adido a la URL al recuperar los resultados del servicio
+label.preferred_gap_character = �Qu� caracter para el hueco prefiere el servicio?
+label.gap_character = Car�cter para hueco
+label.move_return_type_up_order= Mover el tipo de returno hacia arriba en el orden
+label.move_return_type_down_order= Mover el tipo de returno hacia abajo en el orden
+label.update_user_parameter_set = Actualizar el conjunto de par�metros de usuario existente
+label.delete_user_parameter_set = Borrar el conjunto de par�metros de usuario existente
+label.create_user_parameter_set = Crear un nuevo conjunto de par�metro con la configuraci�n actual.
+label.revert_changes_user_parameter_set = Deshacer todos los cambios en el conjunto de par�metros actual
+label.start_job_current_settings = Arrancar trabajo con la configuraci�n actual
+label.cancel_job_close_dialog = Cerrar este di�logo y cancelar el trabajo
+label.input_output = Entrada/Salida
+label.cut_paste = Cortar y pegar
+label.adjusting_parameters_for_calculation = Ajustar los par�metros para el c�lculo existente
+label.2d_rna_structure_line = 2D RNA {0}
+label.2d_rna_sequence_name = 2D RNA - {0}
+label.edit_name_and_description_current_group = Editar el nombre y la descripci�n del grupo actual.
+label.view_structure_for = Visualizar la estructura para {0}
+label.view_all_structures = Visualizar todas las {0} estructuras.
+label.view_all_representative_structures = Visualizar todas las {0} estructuras representativas.
+label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment = Abrir una nueva vista de Jmol con todas las estructuras representativas\nasociadas con la selecci\u00F3n actual\nsuperpuesta con el alineamiento actual.
+label.associate_structure_with_sequence = Asociar estructura con la secuencia
+label.from_file = desde fichero
+label.enter_pdb_id = Introducir PDB Id
+label.discover_pdb_ids = Buscar PDB ids
+label.text_colour = Color del texto
+label.structure = Estructura
+label.view_structure = Visualizar estructura
+label.clustalx_colours = Colores de Clustalx
+label.above_identity_percentage = Sobre % identidad
+label.create_sequence_details_report_annotation_for = Anotaci�n para {0}
+label.sequece_details_for = Detalles de la secuencia para {0}
+label.sequence_name = Nombre de la secuencia
+label.sequence_description = Descripci�n de la secuencia
+label.edit_sequence_name_description = Editar el nombre/descripci�n de la secuencia
+label.spaces_converted_to_backslashes = Los espacios se han convertido en _
+label.no_spaces_allowed_sequence_name = No se permiten espacios en el nombre de la secuencia
+label.select_outline_colour = Seleccionar el color del l�mite
+label.web_browser_not_found_unix = Unixers\: No es posible encontrar el navegador web por defecto.\nA\u00F1ada la ruta completa de su navegador en la pesta\u00F1a de Preferencias.
+label.web_browser_not_found = No se encuentra el navegador web
+label.select_pdb_file_for = Seleccione un fichero PDB para {0}
+label.html = HTML
+label.wrap = Envolver
+label.show_database_refs = Mostrar las referencias en base de datos
+label.show_non_positional_features = Mostrar las caracter�sticas no posicionales
+label.save_png_image = Guardar como imagen PNG
+label.load_tree_for_sequence_set = Cargar un �rbol para este conjunto de secuencias
+label.export_image = Exportar imagen
+label.vamsas_store = Almac�n VAMSAS
+label.translate_cDNA = Traducir cDNA
+label.extract_scores = Extraer puntuaciones
+label.get_cross_refs = Obtener referencias cruzadas
+label.sort_alignment_new_tree = Alinear el alineamiento con el nuevo �rbol
+label.add_sequences = A�adir secuencias
+label.new_window = Nueva ventana
+label.refresh_available_sources = Refrescar las fuentes disponibles
+label.use_registry = Utilizar el registro
+label.add_local_source = A�adir fuente local
+label.set_as_default = Establecer por defecto
+label.show_labels = Mostrar etiquetas
+label.background_colour = Color de fondo
+label.associate_nodes_with = Asociar nodos con
+label.jalview_pca_calculation = C�lculo del PCA por Jalview
+label.link_name = Nombre del enalce
+label.pdb_file = Fichero PDB
+label.colour_with_jmol = Colorear con Jmol
+label.align_structures = Alinear estructuras
+label.jmol = Jmol
+label.sort_alignment_by_tree = Ordenar alineamiento por �rbol
+label.mark_unlinked_leaves = Marcar las hojas como no enlazadas
+label.associate_leaves_with = Asociar hojas con
+label.save_colour_scheme_with_unique_name_added_to_colour_menu = Guarde el esquema crom�ticos con un nombre �nico y se a�adir� al men� de colores
+label.case_sensitive = Sensible a may�sculas
+label.lower_case_colour = Color para las min�sculas
+label.index_by_host = Indizar por host
+label.index_by_type = Indizar por tipo
+label.enable_jabaws_services = Habilitar servicios JABAWS
+label.display_warnings = Mostrar advertencias
+label.move_url_up = Mover la URL hacia arriba
+label.move_url_down = Mover la URL hacia abajo
+label.add_sbrs_definition = A�adir una definici�n SBRS
+label.edit_sbrs_definition = Editar una definici�n SBRS
+label.delete_sbrs_definition = Borrar una definici�n SBRS
+label.your_sequences_have_been_verified = Sus secuencias has sido verificadas en una base de datos de secuencias conocidas. Algunos de sus ID se han alterado y\n, probablemente, el residuo de inicio/fin se haya actualizado.\nGuarde su alineamiento para mantener el ID actualizado.\n\n
+label.sequence_names_updated = Nombres de secuencia actualizados
+label.dbref_search_completed = B�squeda de DBRef terminada
+label.show_all_chains = Mostrar todas las cadenas
+label.fetch_all_param = Recuperar todas {0}
+label.paste_new_window = Pegar en una nueva ventana
+label.settings_for_param = Configuraci�n para {0}
+label.view_params = Visualizar {0}
+label.select_all_views = Seleccionar todas las vistas
+label.align_sequences_to_existing_alignment = Alinear las secuencias con el alineamiento existente
+label.realign_with_params = Realinear con {0}
+label.calcname_with_default_settings = {0} por defecto
+label.action_with_default_settings = {0} con la configuraci�n por defecto
+label.edit_settings_and_run = Editar la configuraci�n y ejecutar...
+label.view_and_change_parameters_before_alignment = Ver y cambiar los par�metros antes del alineamiento
+label.run_with_preset_params = Ejecutar {0} con preconfiguraci�n
+label.view_and_change_parameters_before_running_calculation = Ver y cambiar los par�metros antes de lanzar el c�lculo
+label.view_documentation = Ver documentaci�n
+label.select_return_type = Seleccionar el tipo de retorno
+label.translation_of_params = Traducci�n de {0}
+label.features_for_params = Caracter�sticas de - {0}
+label.annotations_for_params = Anotaciones de - {0}
+label.generating_features_for_params = Generando caracter�sticas de - {0}
+label.generating_annotations_for_params = Generando anotaciones de - {0}
+label.varna_params = VARNA - {0}
+label.sequence_feature_settings = Configuraci�n de las caracter�sticas de la secuencia
+label.pairwise_aligned_sequences = Secuencias alineadas a pares
+label.original_data_for_params = Datos originales de {0}
+label.points_for_params = Puntos de {0}
+label.transformed_points_for_params = Puntos transformados de {0}
+label.graduated_color_for_params = Color graduado para la caracter�stica de {0}
+label.select_backgroud_colour = Seleccionar color de fondo
+label.invalid_font = Fuente no v�lida
+label.separate_multiple_accession_ids = Separar los accession id con un punto y coma ";"
+label.replace_commas_semicolons = Cambiar comas por puntos y comas
+label.parsing_failed_syntax_errors_shown_below_param = Parseo err�neo. A continuaci�n, se muestras los errores de sintaxis {0}
+label.parsing_failed_unrecoverable_exception_thrown_param = \nParseo err\u00F3neo. Se ha lanzado una excepci\u00F3n fatal\:\n {0}
+label.example_query_param = Consulta de ejemplo: {0}
+label.enter_value_increase_conservation_visibility = Introduzca un valor para incrementar la visibilidad de la conservaci�n
+label.enter_percentage_identity_above_which_colour_residues = Introduza un % de identidad por encima del cual se colorear�n los residuos
+label.wswublast_client_credits = Para mostrar las caracter\u00EDsticas de una secuencia, debe indicarse un id de Uniprot cuya secuencia se corresponda al 100 % con la introducida.\nPara mostrar estas caracter\u00EDsticas, prueba a cambar los nombre de sus secuencia con los ID que se sugieren a continuaci\u00F3n.\n\nRunning WSWUBlast at EBI.\nPlease quote Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R [...]
+label.blasting_for_unidentified_sequence = Ejecutar BLAST para la secuencias sin identificar
+label.select_columns_containing = Seleccione las columnas que contengan
+label.select_columns_not_containing = Seleccione las columnas que no contengan
+option.trim_retrieved_seqs = Ajustar las secuencias recuperadas
+label.trim_retrieved_sequences = Cuando la secuencia de referencia es m�s larga que la secuencia con la que est� trabajando, s�lo se mantienen las subsecuencias relevantes.
+label.use_sequence_id_1 = Utilice $SEQUENCE_ID$ o $SEQUENCE_ID=/<regex>/=$
+label.use_sequence_id_2 = \nto para embeber el id de la secuencia en una URL
+label.ws_parameters_for = Par�metros para {0}
+label.switch_server = Cambiar servidor
+label.open_jabaws_web_page = Abra el p�gina principal del servidor JABAWS en un navegador web
+label.choose_jabaws_server = Escoja un servidor para ejecutar este servicio
+label.services_at = Servicios en {0}
+label.rest_client_submit = {0} utilizando {1}
+label.fetch_retrieve_from =Recuperar de {0}
+label.fetch_retrieve_from_all_sources = Recuperar de todas las fuentes {0} en {1}<br>La primera es :{2}
+label.feature_settings_click_drag = Haga clic o arrastre los tipos de las caracter�sticas hacia arriba o hacia abajo para cambiar el orden de visualizaci�n.<br/>Haga doble clic para seleccionar las columnas que contienen las caracter�sticas del alineamiento/selecci�n actual.<br/>
+label.opt_and_params_further_details = ver los detalles adicionales haciendo clic en el bot�n derecho
+label.opt_and_params_show_brief_desc_image_link = Haga clic para ver una descripci�n breve<br><img src="{0}"/>Haga clic en el bot�n derecho para obtener informaci�n adicional.
+label.opt_and_params_show_brief_desc = Haga clic para ver una descripci�n breve<br>
+label.adjusts_width_generated_eps_png = Ajusta la anchura del fichero EPS o PNG generado para asegurar incluso que el ID de la secuencia m�s larga o las etiquetas de anotaci�n se muestran
+label.manually_specify_width_left_column = Especificar manualmente la anchura de la columna izquierda en las etiquetas de los ID de la secuencia y las anotaciones se mostrar en las figuras del alineamiento exportado.Esta configuraic�n se ignorar� si est� marcada la opci�n 'Establecer autom�ticamente al anchura del ID'
+label.job_created_when_checked = Cuando est� habilitado, se crea un trabajo para cada secuencia de la selecci�n actual
+label.when_checked_job_visible_region_and_results = Cuando est� habilitado, se crea un �nico trabajo para la regi�n visible y los resultados de mapean en su ubicaci�n dentro del alineamiento. En caso contrario, se crear� un trabajo para cada regi�n visible y contigua en el alineamiento o selecci�n actual (p.e. un alineamiento m�litple).</html>
+label.flat_file_representation = La representaci�n del fichero plano de este servicio utilizando el formalismo Really Simple Bioinformatics Service</html>
+label.result_of_parsing_rsbs = Resultados de parsear la representaci�n RSBS</html>
+label.user_preset = Preselecci�n de usuario
+label.service_preset = Preselecci�n del servicio
+label.run_with_preset = Ejecutar {0} con preselecci�n
+label.view_service_doc_url = Visualizar <a href="{0}">{1}</a></html>
+label.submit_sequence = Enviar {0} {1} {2} {3} a<br/>{4}</html>
+action.by_title_param = por {0}
+label.alignment = Alineamiento
+label.secondary_structure_prediction = Predicci�n de la estructura secundaria
+label.sequence_database_search = B�squeda en base de datos de secuencias
+label.analysis = An�lisis
+label.protein_disorder = Desorden en la prote�na
+label.source_from_db_source = Fuentes de {0}
+label.from_msname = de {0}
+label.superpose_with = Superponer con...
+action.do = Hacer
+label.scale_label_to_column = Ajustar la etiqueta a la columna
+label.add_new_row = A�adir nuevo fila
+label.edit_label_description = Editar etiqueta/descripci�n
+label.hide_row = Ocultar esta fila
+label.delete_row = Borrar esta fila
+label.show_all_hidden_rows = Mostrar todas las filas ocultas
+label.export_annotation = Exportar anotaci�n
+label.copy_consensus_sequence = Copiar secuencia de consenso
+label.helix = H�lice
+label.sheet = Hoja
+label.rna_helix = H�lice de ARN
+label.remove_annotation = Borrar anotaci�n
+label.colour_by = Colorear por...
+label.muscle_multiple_protein_sequence_alignment = Alineamiento m�ltiple de secuencias de prote�nas con Muscle
+label.mafft_multiple_sequence_alignment = Alineamiento m�ltiple de secuencias con MAFFT
+label.clustalw_multiple_sequence_alignment = Alineamiento m�ltiple de secuencias con ClustalW
+label.jnet_secondary_structure_prediction = Predicci�n de la estructura secundaria con JNet
+label.multiharmony = Multi-Harmony
+label.unable_start_web_service_analysis = No es posible iniciar el servicio web de an�lisis
+label.job_couldnt_be_started_check_input = El trabajo no puede arrancarse. Por favor, compruebe los par�metros de entrada y los mensajes de advertencia de la consola de Jalview.
+label.prompt_each_time = Preguntar siempre
+label.use_source = Fuente
+label.couldnt_save_project = No es posible guardar el proyecto
+label.error_whilst_saving_current_state_to = Error mientras se guardaba el estado a {0}
+label.error_whilst_loading_project_from = Error cargando el proyecto desde {0}
+label.couldnt_load_project = No es posible cargar el proyecto
+label.pca_sequences_not_aligned = Las secuencias deben estar alineadas antes de calcular el PCA.\nPruebe a utilizar la funci\u00F3n de rellenar huecos en el men\u00FA Editar,\no cualquiera de los servicios web de alineamiento m\u00FAltiple.
+label.invalid_name_preset_exists = Nombre no v�lido - esta preconfiguraci�n ya existe.
+label.invalid_name = Nombre no v�lido
+label.set_proxy_settings = Por favor, configure su proxy en la pesta�a 'Conexiones' de la ventana de Preferencia
+label.proxy_authorization_failed = Autorizaci�n del proxy fallida
+label.internal_jalview_error = Error interno de Jalview
+label.secondary_structure_prediction_service_couldnt_be_located = No se ha podido encontrar el Servicio de Predicci�nd de la Estructura Secudaria {0} en {1}.
+label.service_called_is_not_msa_service = El Servicio llamado \n{0}\nno es un \nServicio de Alineamiento M\u00FAltiple de Secuencias\!
+label.msa_service_is_unknown = El Servicio de Alineamiento M�ltiple llamado {0} es desconocido
+label.service_called_is_not_seq_search_service = El Servicio llamando \n{0}\nno es un \nServicio de B\u00FAsqueda de Secuencias\!
+label.seq_search_service_is_unknown = El Servicio de B�squeda de Sencuencias llamado {0} es desconocido
+label.feature_type = Tipo de caracter�stisca
+label.display = Representaci�n
+label.service_url = URL del servicio
+label.copied_sequences = Secuencias copiadas
+label.cut_sequences = Cortar secuencias
+label.conservation_colour_increment = Incremento de Conservaci�n del Color ({0})
+label.percentage_identity_thereshold = Umbral del Porcentaje de Identidad ({0})
+label.error_unsupported_owwner_user_colour_scheme = Propietario no soportado para el di�logo del Esquema Crom�tico del Usuario
+label.save_alignment_to_file = Guardar Alineamiento en fichero
+label.save_features_to_file = Guardar Caracter�sticas en un fichero
+label.save_annotation_to_file = Guardar Anotaci�n en un fichero
+label.no_features_on_alignment = No se han encontrado caracter�sticas en el alineamiento
+label.save_pdb_file = Guardar fichero PDB
+label.save_text_to_file = Guardar Texto en un fichero
+label.save_state = Guardar estado
+label.restore_state = Restaurar estado
+label.saving_jalview_project = Guardando el proyecto de Jalview {0}
+label.loading_jalview_project = Cargando el proyecto de Jalview {0}
+label.save_vamsas_document_archive = Guardar el archivo de documento Vamsas
+label.saving_vamsas_doc = Guardando el documento VAMSAS en {0}
+label.load_feature_colours = Cargar colores de caracter�sticas
+label.save_feature_colours = Guardar esquema crom�tico de caracter�sticas
+label.dataset_for = {0} conjunto de datos para {1}
+label.select_startup_file = Seleccionar fichero de arranque
+label.select_default_browser = Seleccionar navegador web por defecto
+label.save_tree_as_newick = Guardar �rbol como fichero newick
+label.create_eps_from_tree = Crear un fichero EPS a partir de un �rbol
+label.create_png_from_tree = Crear una imagen PNG a partir de un �rbol
+label.save_colour_scheme = Guardar esquema crom�tico
+label.edit_params_for = Editar los par�metros de {0}
+label.choose_filename_for_param_file = Escoja un nombre de fichero para este fichero de par�metros
+label.save_as_html = Guardar como HTML
+label.recently_opened = Abiertos recientemente
+label.blasting_for_unidentified_sequence_jobs_running = Ejecutando BLAST de las secuencias no indentificadas - {0} trabajos en marcha.
+label.tree_from = �rbol de {0}
+label.webservice_job_title = {0} usando {1}
+label.select_visible_region_of = seleccionada {0} regi�n de {1}
+label.visible = Visible
+label.select_unselect_visible_regions_from = seleccionada y deseleccionadas {0} regiones de {1}
+label.visible_region_of = regi�n visible de
+label.webservice_job_title_on = {0} usando {1} de {2}
+label.updating_vamsas_session = Actualizando sesi�n VAMSAS
+label.loading_file = Cargando fichero: {0}
+label.edit_params = Editar {0}
+error.not_implemented = No implementado
+error.no_such_method_as_clone1_for = No existe ese m�todo como un clone1 de {0}
+error.null_from_clone1 = Nulo de clone1!
+error.implementation_error_sortbyfeature = Error de implementaci�n - sortByFeature debe ser uno de FEATURE_SCORE, FEATURE_LABEL o FEATURE_DENSITY.
+error.not_yet_implemented = No se ha implementado todav�a
+error.unknown_type_dna_or_pep = Tipo desconocido {0} - dna o pep son los �nicos valores permitidos
+error.implementation_error_dont_know_thereshold_annotationcolourgradient = Error de implementaci�n: no se conoce el valor umbral para el AnnotationColourGradient actual.
+error.implementation_error_embeddedpopup_not_null = Error de implementaci�n - embeddedPopup debe ser no nulo.
+error.invalid_colour_for_mycheckbox = Color no v�lido para MyCheckBox
+error.implementation_error_unrecognised_render_object_for_features_type = Error de implementaci�n: no se reconoce el objeto de representaci�n {0} para las caracter�sticas de tipo {1}
+error.implementation_error_unsupported_feature_colour_object = Error de implementaci�n: objeto de color de caracter�sticas no soportado.
+error.invalid_separator_parameter = Separador de par�metros no v�lido - debe tener longitud mayor que cero
+error.alignment_cigararray_not_implemented = Alignment(CigarArray) no se ha implementado todav�a
+error.weak_sequencei_equivalence_not_yet_implemented = Equivalencia d�bil sequenceI no se ha implementado todav�a.
+error.implementation_error_can_only_make_alignmnet_from_cigararray = Error de implementaci�n - s�lo se puede construir un vista de alineamiento a partir de una CigarArray de secuencias.
+error.empty_view_cannot_be_updated = una vista vac�a no se puede actualizar.
+error.mismatch_between_number_of_sequences_in_block = No hay coincidencia entre el n�mero de secuencias en el bloque {0} ({1}) y la vista original ({2})
+error.padding_not_yet_implemented = El relleno no se ha implementado todav�a
+error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view = No hay coincidencia entre los bloques visibles para actualizar y el n�mero de contigs en la vista (contigs=0,blocks={0})
+error.unknown_seq_cigar_operation = Operaci�n SeqCigar {0} desconocida
+error.implementation_bug_parse_cigar_string = Bug de implementaci�n en parseCigarString
+error.implementation_error_invalid_operation_string = Error de implementaci�n. Cadena de operaci�n no v�lida.
+error.invalid_range_string = Rango de la cadena no v�lido (debe ser cero o un n�mero positivo)
+error.implementation_error_delete_range_out_of_bounds = Error de implementaci�n: deleteRange fuera de rango: el comienzo debe ser cero o positivo y menor que el final.
+error.implementation_error = Error de implementaci�n
+error.implementation_error_unknown_operation = �Error de implementaci�n! Operaci�n desconocida {0}
+error.implementation_error_unexpected_null_from_get_sequence_and_deletions = Error de implementaci�n - valor nulo no esperado en getSequenceAndDeletions
+error.implementation_error_set_seq_null = Error de implementaci�n - _setSeq(null,...)
+error.implementation_error_s = Error de implementaci�n: _s= {0}
+error.implementation_error_seqcigar_possible = SeqCigar: posible error de implementaci�n: la secuencia es m�s larga de el conjunto de datos de la secuencia
+error.implmentation_bug_seq_null = Bug de implementaci�n. Seq nula
+error.implementation_bug_cigar_operation_list_range_list = Bug de implementaci�n: Cigar Operation list!= range list
+error.not_yet_implemented_cigar_object_from_cigar_string = No implementado todav�a: construcci�n de un objeto Cigar desde una cadena y una secuencia con huecos.
+error.implementation_bug_cigar_operation = Bug de implementaci�n. La operaci�n Cigar {0} {1} no es ni {2}, ni {3} ni {4}.
+error.implementation_error_for_new_cigar = Error de implementaci�n en new Cigar(SequenceI)
+error.implementation_error_cigar_seq_no_operations = Error de implementaci�n: la {0}a secuencia Cigar no tiene operaciones.
+error.implementation_error_jmol_getting_data = Error de implementaci�n - Jmol parece estar todav�a intentando recuperar sus datos - informe de ello en http://issues.jalview.org/browse/JAL-1016
+error.implementation_error_no_pdbentry_from_index = Error de implementaci�n - no existe la correspondiente entrada pdb (para el �ndice {0}) para a�adir el mapeo de secuencias a
+error.jmol_version_not_compatible_with_jalview_version = La versi�n {0} de Jmol no es compatible con esta versi�n de Jalview. Informe de este problema en http://issues.jalview.org
+error.not_implemented_remove = Borrar: no implementado
+error.not_implemented_clone = Clonar: no implementado
+error.implementation_error_chimera_getting_data = Error de implementaci�n - Chimera parece estar todav�a intentando recuperar sus datos - informe de ello en http://issues.jalview.org/browse/JAL-1016
+error.call_setprogressbar_before_registering_handler = llamada a setProgressBar antes de registrar el manejador de la barra de estado
+label.cancelled_params = {0} cancelado
+error.implementation_error_cannot_show_view_alignment_frame = Error de implementaci�n: no es posible mostrar una vista de otro alineamiento en un AlignFrame.
+error.implementation_error_dont_know_about_thereshold_setting = Error de implementaci�n: no se conoce la configuraci�n del umbral para el AnnotationColourGradient actual.
+error.eps_generation_not_implemented = La generaci�n de EPS no se ha implementado todav�a
+error.png_generation_not_implemented = La generaci�n de PNG no se ha implementado todav�a
+error.try_join_vamsas_session_another = Tratando de establecer una sesi�n VAMSAS cuando ya hab�a otra conectada
+error.invalid_vamsas_session_id = Identificador de sesi�n VAMSAS no v�lido
+error.implementation_error_cannot_create_groovyshell = Error de implementaci�n:no se puede crear groovyShell sin Groovy en el classpath
+label.groovy_support_failed = El soporte Groovy de Jalview ha fallado
+label.couldnt_create_groovy_shell = No es posible crear el shell de Groovy. Compruebe el fichero de log para conocer los detalles.
+error.unsupported_version_calcIdparam = Versi�n no soportada de {0}
+error.implementation_error_cant_reorder_tree = Error de implementaci�n: no es posible reordenar este �rbol. No DefaultMutableTreeNode.
+error.invalid_value_for_option = Valor no v�lido de {0} para la opci�n {1}
+error.implementation_error_cannot_import_vamsas_doc = Error de implementaci�n - todav�a no es posible importar el documento VAMSAS existente en una sesi�n existente.
+label.vamsas_doc_couldnt_be_opened_as_new_session = El documento VAMSAS no ha podido abrirse como una nueva sesi�n. Por favor, escoja otra.
+error.implementation_error_vamsas_operation_not_init = �Error de implementaci�n! Operaciones VAMSAS cuando el cliente no estaba inicializado ni conectado
+error.jalview_no_connected_vamsas_session = Jalview est� conectado a una sesi�n VAMSAS
+error.implementation_error_cannot_recover_vamsas_object_mappings = Error de implementaci�n: no es posible recuperar los mapeos del objeto VAMSAS - no se ha hecho ning�n backup
+error.setstatus_called_non_existent_job_pane = se lllamado a setStatus para el panel de trabajo {0} no existente
+error.implementation_error_cannot_find_marshaller_for_param_set =Error de implementaci�n: no puede encontrar un marshaller para el conjunto de par�metros
+error.implementation_error_old_jalview_object_not_bound =Error de implementaci�n: �el objeto Jalview antiguo no est� enlazado! ({0})
+error.implementation_error_vamsas_doc_class_should_bind_to_type = Error de implementaci�n: la clase de documento VAMSAS {0} debe enlazar a {1} (pero se ha encontrado que lo est� a {2})
+error.implementation_error_jalview_class_should_bind_to_type = Error de implementaci�n: la clase Jalview {0} debe enlazar a {1} (pero se ha encontrado que lo est� a {2})
+error.invalid_vamsas_rangetype_cannot_resolve_lists = RangeType VAMSAS no v�lido - �no es posible resolver ambas listas de Pos y Seg con los valores elegidos!
+error.implementation_error_maplist_is_null = Error de implementaci�n. MapList es nulo en initMapType.
+error.implementation_error_cannot_have_null_alignment = Error de implementaci�n: no es posible tener una clave nula en el alineamiento
+error.implementation_error_null_fileparse = Error de implementaci�n. FileParse nulo en el construictor de copia
+error.implementation_error_cannot_map_alignment_sequences = Error de implementaci�n: no es posible maper un alineamiento de secuencias desde distintos conjuntos de datos en un �nico alineamiento en el documento VAMSAS.
+error.implementation_error_cannot_duplicate_colour_scheme = Error grave de implementaci�n: no es posible duplicar el esquema crom�tico {0}
+error.implementation_error_structure_selection_manager_null = Error de implementaci�n. El contexto structure selection manager's es nulo
+exception.ssm_context_is_null = El contexto SSM es nulo
+error.idstring_seqstrings_only_one_per_sequence = idstrings y seqstrings contienen una cadena por cada secuencia
+error.cannot_have_mixed_length_replacement_vectors = No es posible tener vectores de reemplazo de distinta longitud. El vector de reemplazo para {0} es de {1} cadenas de largo, pero se ha considerado ya como un vector de longitud {2}.
+error.cannot_have_zero_length_vector_replacement_strings = No es posible tener un vector de cadenas de reemplazo de longitud cero - debe ser uno o n.
+error.implementation_error_multiple_single_sequence_prediction_jobs_not_supported = �Error de implementaci�n! Todav�a no se soportan varios trabajos de predicci�n asociados a una �nica secuencia.
+error.implementation_error_invalid_msa_index_for_job = �Error de implementaci�n! Valor msaIndex no v�lido para JPredJob en el objeto de entrada MSA padre!
+error.implementation_error_startjob_called = Error de implementaci�n - StartJob(JpredJob) invocado en {0}
+error.multiple_jnet_subjob_merge_not_implemented = Todav�a no se han implementado varios subtrabajos JNet conjuntos.
+label.job_never_ran = El trabajo nunca se ejecut� - entrada devuelta al usuario.
+error.implementation_error_minlen_must_be_greater_zero = Error de implementaci�n: minlen debe ser cero o m�s
+error.implementation_error_msawbjob_called = Error de implementaci�n - StartJob(MsaWSJob) invocado en un WSJobInstance {0}
+error.implementation_error_cannot_attach_ws_menu_entry = Error de implementaci�n: �no es posible adjunto una WS Menu Entry sin una referencia a un manejador del servicio!
+error.parameter_migration_not_implemented_yet = La migraci�n de par�metros no se ha implementado todav�a
+error.implementation_error_cannot_set_jaba_option = Error de implementaci�n: no es posible establecer el valor de Jaba Option a un valor fuera de su rango permitido
+error.implementation_error_valuetype_doesnt_support_jabaws_type = Error de implementaci�n: jalview.ws.params.ValueConstrainI.ValueType no soporta el tipo JABAWS: {0}
+error.cannot_create_jabaws_param_set = No es posible crear un JabaWSParamSet con par�metros no JabaWS
+error.cannot_set_arguments_to_jabaws_param_set = No es posible establecer argumentos en JabaWSParamSet que no sean argumentos JabaWS
+error.implementation_error_runner_config_not_available = Error de implementaci�n: Runner Config no est� disponible para un servicio JABAWS de tipo {0} ({1})
+error.implementation_error_cannot_handle_jaba_param = Error de implementaci�n: no es posible manejar el objeto del par�metro Jaba {0}
+error.implementation_error_attempt_to_delete_service_preset = Error de implementaci�n: intento de borrar un servicio preestablecido
+error.implementation_error_cannot_locate_oldname_presetname = Error de implementaci�n: no es posible localizar ni el nombre antiguo ({0}) ni el presetName ({1} en el almac�n de datos.
+error.implementation_error_jabaws_param_set_only_handled_by = Error de implementaci�n: JabaWsParamSets s�lo puede ser manejado por JabaParamStore
+error.cannot_set_source_file_for = No es posible establecer el fichero fuente para {0}
+error.mismatch_service_instance_preset = Posible desajuste entre la instancia del servicio y la prestablecida
+error.cannot_set_params_for_ws_preset = No es posible establecer los par�metros para el servicio web JABA presestablecido
+error.implementation_error_can_only_instantiate_jaba_param_sets = Error de implementaci�n: s�lo se puede instanciar conjuntos de par�metros Jaba
+error.no_aacon_service_found = No se ha encontrado ning�n servicio AACon
+error.implementation_error_couldnt_copy_value_constraint = Error de implementaci�n: �no se puede copiar ValueConstrain!
+error.couldnt_encode_as_utf8 = No se ha podido codificar {0} como UTF-8.
+error.tree_inputtype_not_yet_implemented = No se ha implementado todav�a el �rbol como InputType
+error.implementation_error_need_to_have_httpresponse = Error de implementaci�n: se necesita tener un HttpResponse que procesar
+error.dbrefsource_implementation_exception = Excepci�n de implementaci�n DBRefSource
+error.implementation_error_dbinstance_must_implement_interface = Error de Implementaci�n- getDbInstances debe recibir una clase que implemente jalview.ws.seqfetcher.DbSourceProxy (recibi� {0})
+error.implementation_error_must_init_dbsources =Error de implementaci�n. Debe inicializar dbSources
+label.view_controller_toggled_marked = {0} {1} columnas {2} conteniendo caracter�sticas del tipo {3} en {4} secuencia(s)
+label.toggled = Invertida
+label.marked = Marcada
+label.not = no
+label.no_feature_of_type_found = No se han encontrado caracter�sticas del tipo {0}.
+label.submission_params = Env�o {0}
+label.empty_alignment_job = Trabajo de alineamiento vac�o
+label.add_new_sbrs_service = A�adir un nuevo SBRS
+label.edit_sbrs_entry = Editar entrada SBRS
+label.pca_recalculating = Recalculando PCA
+label.pca_calculating = Calculando PCA
+label.select_foreground_colour = Escoger color del primer plano
+label.select_colour_for_text = Seleccione el color del texto
+label.adjunst_foreground_text_colour_thereshold = Ajustar el umbral del color del texto en primer plano
+label.select_subtree_colour = Seleccioanr el color del sub-�rbol
+label.create_new_sequence_features = Crear nueva(s) caracter�stica(s) de secuencia
+label.amend_delete_features = Arrelgar/Borrar caracter�sticas de {0}
+exception.out_of_bounds_for_file = Fuera de rango para el fichero: i={0}, Buffer final: i0={1} iend={2}
+exception.null_string_given_to_regex_search = Cadena nula enviada a Regex.search
+exception.null_string_like_given_to_regex_search = StringLike nula enviada a Regex.search
+exception.null_string_given_to_regex_reverse_search = Cadena nula enviada a Regex.reverseSearch
+exception.null_string_like_given_to_regex_reverse_search = StringLike nula enviada a Regex.reverseSearch
+exception.null_string_like_given_to_regex_search_from = Cadena nula enviada a Regex.searchFrom
+exception.null_string_like_given_to_regex_search_region = Cadena nula enviada a Regex.searchRegion
+exception.replace_null_regex_pointer = Reemplazador tiene un puntero Regex nulo
+exception.bad_pattern_to_regex_perl_code = patr�n err�neo en Regex.perlCode: {0}
+exception.no_stub_implementation_for_interface = No existe una implementaci�n del stub para la interfaz: {0}
+exception.cannot_set_endpoint_address_unknown_port = No es posible estabelcer la direcci�n de punto final para el puerto desconocido {0}
+exception.querying_matching_opening_parenthesis_for_non_closing_parenthesis = Consultando la coincidencia de apertura de par�ntesis para par�ntesis sin cerrar (?)
+exception.mismatched_unseen_closing_char = Discordancia (no vista) en el car�cter de cierre {0}
+exception.mismatched_closing_char = Car�cter de cierre discordante {0}
+exception.mismatched_opening_char = Car�cter de apertura discordante {0} en {1}
+exception.invalid_datasource_couldnt_obtain_reader = Fuente de datos no v�lida. No es posible obtener el Reader
+exception.index_value_not_in_range = {0}: el valor del �ndice {1} en se encuentra en el rango [0..{2}]
+exception.unterminated_cigar_string = Cadena cigar sin terminar
+exception.unexpected_operation_cigar_string_pos = Operaci�n no esperada {0} en una cadena cigar (posici�n {1} en {2})
+exception.couldnt_parse_responde_from_annotated3d_server = No es posible parsear la respuesta procedente del servidor Annotate3d
+exception.application_test_npe = Prueba de aplicaci�n: lanzando un NullPointerException que debe aparecer en la consola
+exception.overwriting_vamsas_id_binding = Sobreescribiendo la asociaci�n al VAMSAS id
+exception.overwriting_jalview_id_binding = Sobreescribiendo la asociaci�n al Jalview id
+error.implementation_error_unknown_file_format_string = Error de implementaci�n: cadena de formato de fichero desconocido
+exception.failed_to_resolve_gzip_stream = Fallo al resolver el flujo GZIP
+exception.problem_opening_file_also_tried = Problema abriendo {0} (tambi�n se intent� {1}) : {2}
+exception.problem_opening_file = Problema abriendo {0} : {1}
+exception.failed_to_read_data_from_source = Error al leer datos de la fuente: {0}
+exception.no_init_source_stream = Flujo de fuente sin inicializar
+exception.invalid_source_stream = Flujo de fuente no v�lida: {0}
+error.implementation_error_reset_called_for_invalid_source = Error de implementaci�n: se ha invocado un Reset en una fuente no v�lida.
+exception.number_of_residues_in_query_sequence_differ_from_prediction = El n\u00FAmero de residuos en la supuesta secuencia consultada {0} ({1}\n{2})\ndifiere del n\u00FAmero de sitios de predicci\u00F3n en la predicci\u00F3n ({3})
+label.mapped = mapeado
+exception.jpredconcide_entry_has_unexpected_number_of_columns = JPredConcise: La entrada ({0}) tiene un n�mero inesperado de columnas
+exception.couldnt_parse_concise_annotation_for_prediction = No es posible parsear la anotaci\u00F3n concisa para el perfil de predicci\u00F3n.\n{0}
+exception.newfile = Fichero Newick\: {0}\n
+label.no_tree_read_in = No hay lectura de �rbol en
+exception.rnaml_couldnt_access_datasource = No ha sido posible acceder la fuente de datos ({0})
+exception.ranml_couldnt_process_data = No ha sido posible procesar los datos como un fichero RNAML ({0})
+exception.ranml_invalid_file = Fichero RNAML no v�lido ({0})
+exception.ranml_problem_parsing_data = Problema parseando los datos como RNAML ({0})
+exception.pfam_no_sequences_found = No se han encontrado secuencias (entrada PFAM)
+exception.stockholm_invalid_format = Este fichero no es tiene un formato STOCKHOLM v�lido: la primera l�nea no contiene '# STOCKHOLM'
+exception.couldnt_parse_sequence_line = No es posible parse la l�nea de secuencia: {0}
+exception.error_parsing_line = Error parseando {0}
+exception.unknown_annotation_detected = Anotaci�n desconocida detectada: {0} {1}
+exception.couldnt_store_sequence_mappings = No es posible almacenar los mapeos de secuencia para {0}
+exception.matrix_too_many_iteration = Demasiadas iteraciones en {0} (el m�ximo es {1})
+exception.browser_not_found = Excepci�n al buscar el navegador: {0}
+exception.browser_unable_to_locate = Imposible encontrar el navegador: {0}
+exception.invocation_target_exception_creating_aedesc = InvocationTargetException mientras se creaba AEDesc: {0}
+exception.illegal_access_building_apple_evt= IllegalAccessException mientras se constru�a AppleEvent: {0}
+exception.instantiation_creating_aedesc = InstantiationException mientras se creaba AEDesc: {0}
+exception.unable_to_launch_url = Imposible lanzar la URL: {0}
+exception.unable_to_create_internet_config = Imposible crear una instancia de configuraci�n de Internet: {0}
+exception.invocation_target_calling_url = InvocationTargetException mientras se invocaba openURL: {0}
+exception.illegal_access_calling_url = IllegalAccessException mientras se invocaba openURL: {0}
+exception.interrupted_launching_browser = InterruptedException mientras se lanzaba el navegador: {0}
+exception.das_source_doesnt_support_sequence_command = La fuente {0} no soporta el comando sequence.
+exception.invalid_das_source = Fuente DAS no v�lida: {0}
+exception.ebiembl_retrieval_failed_on = La recuperaci�n de datos EBI EMBL XML ha fallado en {0}:{1}
+label.no_embl_record_found = # No se ha recuperado ning�n registro EMBL de {0}:{1}
+label.embl_successfully_parsed = # Se han parseado con �xito las consultas {0} en un alineamiento
+exception.no_pdb_records_for_chain = No se han encontrado registros {0} para la cadena {1}
+exception.unexpected_handling_rnaml_translation_for_pdb = Excepcion inesperada cuando se traduc�an a RNAML los datos PDB
+exception.couldnt_recover_sequence_properties_for_alignment = No es posible recuperar las propiedades de la secuencia para el alineamiento
+exception.unknown_format_for_file = Formato desconocido {0} para el fichero \: \n{1}
+label.remove_gaps = Eliminar huecos
+exception.couldnt_recover_sequence_props_for_jnet_query = No ha sido posible recuperar las propiedades de la secuencia para la secuencia JNet Query!
+exception.server_timeout_try_later = Tiempo de conexi\u00F3n ha expirado - int\u00E9ntelo de nuevo m\u00E1s tarde\n
+exception.web_service_returned_null_try_later= El servidor {0} ha devuelto un objeto nulo, por lo que probablemente no se haya podido contactar con �l. Int�ntelo de nuevo m�s tarde.
+exception.cannot_contact_service_endpoint_at = No es posible contactar por el punto de acceso al servicio en {0}
+error.implementation_error_cannot_find_service_url_in_given_set = Error de implementaci�n: no es posible encontrar la URL del servicio en el conjunto de URL proporcionado
+error.implementation_error_cannot_find_service_url_in_given_set_param_store = Error de implementaci�n: la URL del servicio en el conjunto de URL para este almac�n de par�metros del servicio({0})
+exception.jobsubmission_invalid_params_set = Conjunto de par�metros no v�lido. Comprueba la implementaci�n de Jalview
+exception.notvaliddata_group_contains_less_than_min_seqs = El grupo contiene menos de {0} secuencias.
+exception.outofmemory_loading_pdb_file = Sin menoria al cargar el fichero PDB
+exception.eps_coudnt_write_output_file = No es posible escribir el fichero de salida: {0}
+exception.eps_method_not_supported = M�todo actualmente no suportado por la versi�n {0} de EpsGraphics2D
+exception.eps_unable_to_get_inverse_matrix = Imposible obtener la inversa de la matrix: {0}
+warn.job_cannot_be_cancelled_close_window = Este trabajo no se puede cancelar.\nSimplemente, cierre la ventana.
+warn.service_not_supported = �Servicio no soportado!
+warn.input_is_too_big = �El tama�o de la entrada es demasiado grande!
+warn.invalid_job_param_set = �Conjunto de par�metros del trabajo no v�lido!
+info.job_couldnt_be_run_server_doesnt_support_program = No es posible ejecutar el trabajo porque el servidor no soporta este programa.\n{0}
+info.job_couldnt_be_run_exceeded_hard_limit = No es posible ejecutar el trabajo porque excede los l\u00EDmites del servidor.\n{0}
+info.job_couldnt_be_run_incorrect_param_setting = No es posible ejecutar el trabjao porque el servidor no soporta algunos de los par\u00E1metros.\n{0}\nPor favor, aseg\u00FArese de que ha usado los par\u00E1metros adecuados para este servicio\n
+info.no_jobs_ran = No se ha ejecutado ning�n trabajo
+info.failed_to_submit_prediction = Error al enviar la predicci\u00F3n\:\n{0} {1}
+info.invalid_jnet_job_result_data ={0}\n{1}\nResultados del trabajo JNet no v\u00E1lidos\!\n{2}
+info.failed_to_submit_sequences_for_alignment = Error al enviar la secuencias para el alineamiento.\nLo m\u00E1s probable es que haya un problema en el servidor.\nSimplemente, cierre la ventana\n
+info.alignment_object_method_notes = \nNotas sobre los m\u00E9todos del objeto alineamiento\n
+info.server_exception = \n{0} Excepci\u00F3n del servidor\!\n{1}
+status.processing_commandline_args = Procesando los argumentos de la l�nea de comandos...
+status.das_features_being_retrived = Recuperando caracter�sticas DAS...
+status.searching_for_sequences_from = Buscando secuencias en {0}
+status.finished_searching_for_sequences_from = Finalizada la b�squeda de secuencias en {0}
+label.eps_file = Fichero EPS
+label.png_image = Imagen PNG
+status.saving_file = Guardando {0}
+status.export_complete = Exportaci�n completada.
+status.fetching_pdb = Recuperando PDB {0}
+status.refreshing_news = Refrescando noticias
+status.importing_vamsas_session_from = Importando sesi�n VAMSAS de {0}
+status.opening_params = Abriendo {0}
+status.waiting_sequence_database_fetchers_init = Esperando la inicializaci�n de los recuperadores de bases de datos de secuencias
+status.init_sequence_database_fetchers = Inicializando recuperadores de bases de datos de secuencias
+status.fetching_sequence_queries_from = Recuperando {0} consultas de secuencias de {1}
+status.finshed_querying = Consulta finalizada
+status.parsing_results = Parseando resultados.
+status.processing = Procesando...
+status.refreshing_web_service_menus = Refrescando los men�s de servicios web
+status.collecting_job_results = Recolectando los resultados de los trabajos.
+status.fetching_das_sequence_features = Recuperando las caracter�sticas DAS de las secuencias
+status.no_das_sources_active = No existe ninguna fuente DAS activa
+status.das_feature_fetching_cancelled = Recuperaci�n de caracter�sticas DAS cancelada
+status.das_feature_fetching_complete = Recuperaci�n de caracter�sticas DAS completada
+status.fetching_db_refs = Recuperando db refs
+label.font_doesnt_have_letters_defined = La fuente no tiene letras definidas\npor lo que no puede emplease\ncon datos de alineamientos
+label.font_too_small = Tama�o de la letra es demasiado peque�a
+label.error_loading_file_params = Error cargando el fichero {0}
+label.error_loading_jalview_file = Error cargando el fichero Jalview
+warn.out_of_memory_when_action = Sin memoria al {0}\!\!\nConsulte los ficheros de ayuda para ajustar la memoria de la m\u00E1quina virtual de Java.
+warn.out_of_memory_loading_file = Sin memoria al cargar el fichero {0}\!\!\nConsulte los ficheros de ayuda para ajustar la memoria de la m\u00E1quina virtual de Java.
+label.out_of_memory = Sin memoria
+label.invalid_id_column_width = Identificador de anchura de columna no v�lido
+warn.user_defined_width_requirements = La anchura definida por el usuario para la \nlas columnas de anotaci\u00F3n e identificador de secuencias\nen figuras exportadas debe ser\na, al menos, de 12 p\u00EDxels
+label.couldnt_create_sequence_fetcher = No es posible crear SequenceFetcher
+warn.couldnt_create_sequence_fetcher_client = No es posible crear el cliente de recuperador de secuencias. Comprueba el fichero de log para m�s detalles.
+warn.server_didnt_pass_validation = El servicio no ha pasado la validaci\u00F3n.\nCompruebe la consola de Jalview para m\u00E1s detalles.
+warn.url_must_contain = La URL de la secuencia debe contener $SEQUENCE_ID$ o un regex $SEQUENCE_ID=/<regex>/=$
+info.validate_jabaws_server = \u00BFValidar el servidor JabaWS?\n(Consulte la consola de salida para obtener los resultados)
+label.test_server = �Probar servidor?
+info.you_want_jalview_to_find_uniprot_accessions = \u00BFDesea que Jalview encuentre\nUniprot Accession ids para los nombres de secuencias dados?
+label.find_uniprot_accession_ids = Buscar Uniprot Accession Ids
+label.new_sequence_fetcher = A�adir recuperador de secuencias
+label.additional_sequence_fetcher = Recuperador de secuencia adicional
+label.select_database_retrieval_source = Seleccionar fuente de recuperaci�n de bases de datos
+label.overwrite_existing_file = �Sobreescribir el fichero existente?
+label.file_already_exists = El fichero existe
+label.edit_jabaws_url = Editar JABAWS URL
+label.add_jabaws_url = A�adir nueva JABAWS URL
+label.news_from_jalview = Noticias de http://www.jalview.org
+label.cut_paste_alignmen_file = Cortar & Pegar fichero de alineamiento
+label.enter_redundancy_thereshold = Introducir el umbral de redundancia
+label.select_dark_light_set_thereshold = <i>Seleccionar un color oscuro y un color claro para el texto y establecer el umbral en que<br>cambiar entre colores, bas�ndose en el color de fondo</i>
+label.select_feature_colour = Seleccionar color de las caracter�sticas
+label.ignore_gaps_consensus = Ignorar huecos en el consenso
+label.show_group_histogram = Mostrar histograma de grupo
+label.show_group_logo = Mostrar logo de grupo
+label.normalise_group_logo = Normalizar el logo de grupo
+label.show_histogram = Mostrar histograma
+label.show_logo = Mostrar logo
+label.normalise_logo = Normalizar logo
+label.no_colour_selection_in_scheme = Por favor, seleccione un color antes de aplicar el esquema crom�tico
+label.no_colour_selection_warn = Error guardando el esquema crom�tico
\ No newline at end of file
diff --git a/resources/uniprot_mapping.xml b/resources/uniprot_mapping.xml
index bf971af..96edb05 100644
--- a/resources/uniprot_mapping.xml
+++ b/resources/uniprot_mapping.xml
@@ -1,20 +1,21 @@
<?xml version="1.0"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<mapping>
<class name="jalview.datamodel.UniprotFile">
diff --git a/schemas/JalviewUserColours.xsd b/schemas/JalviewUserColours.xsd
index 1142745..bd43e9d 100644
--- a/schemas/JalviewUserColours.xsd
+++ b/schemas/JalviewUserColours.xsd
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by lj (jl) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="www.jalview.org/colours">
diff --git a/schemas/JalviewWsParamSet.xsd b/schemas/JalviewWsParamSet.xsd
index 7238f18..eec9068 100644
--- a/schemas/JalviewWsParamSet.xsd
+++ b/schemas/JalviewWsParamSet.xsd
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="www.jalview.org/xml/wsparamset">
diff --git a/schemas/castor-mapping.xsd b/schemas/castor-mapping.xsd
index 3d37852..0e83d72 100644
--- a/schemas/castor-mapping.xsd
+++ b/schemas/castor-mapping.xsd
@@ -1,314 +1,315 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<!--DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"
- "http://www.w3.org/TR/2000/WD-xmlschema-1-20000225/structures.dtd"-->
- <!--
- Castor Object Mapping XML Schema
-
- Namespace: http://castor.exolab.org/
- System: http://castor.exolab.org/mapping.xsd
- Public: -//EXOLAB/Castor Object Mapping Schema Version 1.0//EN
-
- *Note*: This schema is under evolution and subject to change.
-
- -->
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://castor.exolab.org/"
- xmlns="http://castor.exolab.org/"
- version="0.9.4">
-
- <xsd:element name="mapping">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
- <xsd:element ref="include" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="class" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="key-generator" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="include">
- <xsd:complexType>
- <xsd:attribute name="href" type="xsd:string" use="required"/>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="class">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
- <xsd:element ref="cache-type" minOccurs="0" maxOccurs="1" />
- <xsd:element ref="map-to" minOccurs="0" maxOccurs="1" />
- <xsd:choice minOccurs="1">
- <xsd:element ref="field" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element ref="container" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:choice>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:ID" use="required"/>
- <xsd:attribute name="extends" type="xsd:IDREF" use="optional"/>
- <xsd:attribute name="depends" type="xsd:IDREF" use="optional"/>
- <xsd:attribute name="identity" type="xsd:NMTOKENS" use="optional"/>
- <xsd:attribute name="access" default="shared" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="read-only"/>
- <xsd:enumeration value="shared"/>
- <xsd:enumeration value="exclusive"/>
- <xsd:enumeration value="db-locked"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="key-generator" type="xsd:string" use="optional"/>
- <xsd:attribute name="auto-complete" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="verify-constructable" type="xsd:boolean" use="optional" default="true"/>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="map-to">
- <xsd:complexType>
- <xsd:attribute name="table" type="xsd:NMTOKEN" use="optional"/>
- <xsd:attribute name="xml" type="xsd:string" use="optional"/>
- <xsd:attribute name="ns-uri" type="xsd:string" use="optional"/>
- <xsd:attribute name="ns-prefix" type="xsd:NMTOKEN" use="optional"/>
- <xsd:attribute name="ldap-dn" type="xsd:string" use="optional"/>
- <xsd:attribute name="ldap-oc" type="xsd:string" use="optional"/>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="field">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
- <xsd:element ref="sql" minOccurs="0" maxOccurs="1"/>
- <xsd:element ref="bind-xml" minOccurs="0" maxOccurs="1"/>
- <xsd:element ref="ldap" minOccurs="0" maxOccurs="1"/>
- </xsd:sequence>
-
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="type" type="xsd:string" use="optional"/>
- <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="transient" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="direct" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="lazy" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="container" type="xsd:boolean" use="optional"/>
- <xsd:attribute name="get-method" type="xsd:string" use="optional"/>
- <xsd:attribute name="has-method" type="xsd:string" use="optional"/>
- <xsd:attribute name="set-method" type="xsd:string" use="optional"/>
- <xsd:attribute name="create-method" type="xsd:string" use="optional"/>
- <xsd:attribute name="handler" type="xsd:string" use="optional"/>
- <xsd:attribute name="collection" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="array"/>
- <xsd:enumeration value="vector"/>
- <xsd:enumeration value="arraylist"/>
- <xsd:enumeration value="hashtable"/>
- <xsd:enumeration value="collection"/>
- <xsd:enumeration value="set"/>
- <xsd:enumeration value="map"/>
- <xsd:enumeration value="enumerate"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="container">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
- <xsd:element ref="field" minOccurs="1"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:NMTOKEN" use="required"/>
- <xsd:attribute name="type" type="xsd:NMTOKEN" use="optional"/>
- <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="direct" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="get-method" type="xsd:NMTOKEN" use="optional"/>
- <xsd:attribute name="set-method" type="xsd:NMTOKEN" use="optional"/>
- <xsd:attribute name="create-method" type="xsd:NMTOKEN" use="optional"/>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="sql">
- <xsd:complexType>
- <xsd:attribute name="name" type="xsd:NMTOKENS" use="optional"/>
- <xsd:attribute name="type" type="xsd:string" use="optional"/>
- <xsd:attribute name="many-table" type="xsd:NMTOKEN" use="optional"/>
- <xsd:attribute name="many-key" type="xsd:NMTOKENS" use="optional"/>
- <xsd:attribute name="read-only" type="xsd:boolean" use="optional" default="false"/>
-
- <!-- signals that this field is transient for database mapping (ie should be ignored) -->
- <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>
-
-
- <xsd:attribute name="dirty" default="check" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="check"/>
- <xsd:enumeration value="ignore"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
- <!--
- The 'bind-xml' element is used for specifying XML specific databinding
- properties and behavior for a specific field. 'bind-xml' may only appear
- as a child of a 'field' element.
- -->
- <xsd:element name="bind-xml">
- <xsd:annotation>
- <xsd:documentation>
- The 'bind-xml' element is used for specifying XML specific databinding
- properties and behavior for a specific field. 'bind-xml' may only appear
- as a child of a 'field' element.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
-
- <xsd:sequence>
- <xsd:element ref="class" minOccurs="0" maxOccurs="1"/>
- <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
-
- <!--
- An optional attribute used for specifying the XML name for the
- field associated with the 'bind-xml' element.
- -->
- <xsd:attribute name="name" type="xsd:QName" use="optional">
- <xsd:annotation>
- <xsd:documentation>
- An optional attribute used for specifying the XML name for the
- field associated with the 'bind-xml' element.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
-
- <xsd:attribute name="type" type="xsd:NMTOKEN" use="optional"/>
-
- <!--
- Allows specifying how Castor should automatically determines
- the XML name of this field when no name has been specified.
- -->
- <xsd:attribute name="auto-naming" use="optional">
- <xsd:annotation>
- <xsd:documentation>
- Allows specifying how Castor should automatically determines
- the XML name of this field when no name has been specified.
- In most cases the XML name is determined by using the field name,
- but in some cases the user may want to use the Class name of
- the field type. This attribute allows choosing between the
- two approaches. If this attribute is not specified, the field
- name is used as the XML name.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="deriveByClass"/>
- <xsd:enumeration value="deriveByField"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
-
- <!--
- Allows specifying a nested location path for this field,
- the value should just be a simplified XPath like value
- where names are separated by "/".
- -->
- <xsd:attribute name="location" type="xsd:string" use="optional">
- <xsd:annotation>
- <xsd:documentation>
- Allows specifying a nested location path for this field,
- the value should just be a simplified XPath like value
- where names are separated by "/".
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
-
- <!-- Allows overriding the matching rule -->
- <xsd:attribute name="matches" type="xsd:string" use="optional"/>
-
-
- <!-- Signal that this field should be marshalled as a reference -->
- <xsd:attribute name="reference" type="xsd:boolean" use="optional"/>
-
- <!-- NodeType for the XML node -->
- <xsd:attribute name="node" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="attribute"/>
- <xsd:enumeration value="element"/>
- <xsd:enumeration value="namespace"/>
- <xsd:enumeration value="text"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
-
- <xsd:attribute name="QName-prefix" type="xsd:NMTOKEN" use="optional"/>
-
- <!-- Signal that this field is transient for XML (ie should be ignored) -->
- <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>
-
- </xsd:complexType>
- </xsd:element>
-
-
-
- <xsd:element name="ldap">
- <xsd:complexType>
- <xsd:attribute name="name" type="xsd:NMTOKEN" use="optional"/>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="key-generator">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="param" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:ID" use="required"/>
- <xsd:attribute name="alias" type="xsd:string" use="optional"/>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="cache-type">
- <xsd:complexType>
- <xsd:attribute name="type" type="xsd:string" use="optional" default="count-limited" />
- <xsd:attribute name="capacity" type="xsd:integer" use="optional"/>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="param">
- <xsd:complexType>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="value" type="xsd:string" use="required"/>
- </xsd:complexType>
- </xsd:element>
-
-
- <xsd:complexType name="propertyType">
- <xsd:sequence>
- <xsd:element name="name" type="xsd:string"/>
- <xsd:element name="value" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
-
-
- </xsd:schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<!--DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"
+ "http://www.w3.org/TR/2000/WD-xmlschema-1-20000225/structures.dtd"-->
+ <!--
+ Castor Object Mapping XML Schema
+
+ Namespace: http://castor.exolab.org/
+ System: http://castor.exolab.org/mapping.xsd
+ Public: -//EXOLAB/Castor Object Mapping Schema Version 1.0//EN
+
+ *Note*: This schema is under evolution and subject to change.
+
+ -->
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://castor.exolab.org/"
+ xmlns="http://castor.exolab.org/"
+ version="0.9.4">
+
+ <xsd:element name="mapping">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="include" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="class" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="key-generator" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="include">
+ <xsd:complexType>
+ <xsd:attribute name="href" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="class">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="cache-type" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="map-to" minOccurs="0" maxOccurs="1" />
+ <xsd:choice minOccurs="1">
+ <xsd:element ref="field" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="container" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:ID" use="required"/>
+ <xsd:attribute name="extends" type="xsd:IDREF" use="optional"/>
+ <xsd:attribute name="depends" type="xsd:IDREF" use="optional"/>
+ <xsd:attribute name="identity" type="xsd:NMTOKENS" use="optional"/>
+ <xsd:attribute name="access" default="shared" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="read-only"/>
+ <xsd:enumeration value="shared"/>
+ <xsd:enumeration value="exclusive"/>
+ <xsd:enumeration value="db-locked"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="key-generator" type="xsd:string" use="optional"/>
+ <xsd:attribute name="auto-complete" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="verify-constructable" type="xsd:boolean" use="optional" default="true"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="map-to">
+ <xsd:complexType>
+ <xsd:attribute name="table" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="xml" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ns-uri" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ns-prefix" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="ldap-dn" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ldap-oc" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="field">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="sql" minOccurs="0" maxOccurs="1"/>
+ <xsd:element ref="bind-xml" minOccurs="0" maxOccurs="1"/>
+ <xsd:element ref="ldap" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="type" type="xsd:string" use="optional"/>
+ <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="transient" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="direct" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="lazy" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="container" type="xsd:boolean" use="optional"/>
+ <xsd:attribute name="get-method" type="xsd:string" use="optional"/>
+ <xsd:attribute name="has-method" type="xsd:string" use="optional"/>
+ <xsd:attribute name="set-method" type="xsd:string" use="optional"/>
+ <xsd:attribute name="create-method" type="xsd:string" use="optional"/>
+ <xsd:attribute name="handler" type="xsd:string" use="optional"/>
+ <xsd:attribute name="collection" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="array"/>
+ <xsd:enumeration value="vector"/>
+ <xsd:enumeration value="arraylist"/>
+ <xsd:enumeration value="hashtable"/>
+ <xsd:enumeration value="collection"/>
+ <xsd:enumeration value="set"/>
+ <xsd:enumeration value="map"/>
+ <xsd:enumeration value="enumerate"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="container">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="field" minOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:NMTOKEN" use="required"/>
+ <xsd:attribute name="type" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="direct" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="get-method" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="set-method" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="create-method" type="xsd:NMTOKEN" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="sql">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:NMTOKENS" use="optional"/>
+ <xsd:attribute name="type" type="xsd:string" use="optional"/>
+ <xsd:attribute name="many-table" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="many-key" type="xsd:NMTOKENS" use="optional"/>
+ <xsd:attribute name="read-only" type="xsd:boolean" use="optional" default="false"/>
+
+ <!-- signals that this field is transient for database mapping (ie should be ignored) -->
+ <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>
+
+
+ <xsd:attribute name="dirty" default="check" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="check"/>
+ <xsd:enumeration value="ignore"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <!--
+ The 'bind-xml' element is used for specifying XML specific databinding
+ properties and behavior for a specific field. 'bind-xml' may only appear
+ as a child of a 'field' element.
+ -->
+ <xsd:element name="bind-xml">
+ <xsd:annotation>
+ <xsd:documentation>
+ The 'bind-xml' element is used for specifying XML specific databinding
+ properties and behavior for a specific field. 'bind-xml' may only appear
+ as a child of a 'field' element.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+
+ <xsd:sequence>
+ <xsd:element ref="class" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <!--
+ An optional attribute used for specifying the XML name for the
+ field associated with the 'bind-xml' element.
+ -->
+ <xsd:attribute name="name" type="xsd:QName" use="optional">
+ <xsd:annotation>
+ <xsd:documentation>
+ An optional attribute used for specifying the XML name for the
+ field associated with the 'bind-xml' element.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+
+ <xsd:attribute name="type" type="xsd:NMTOKEN" use="optional"/>
+
+ <!--
+ Allows specifying how Castor should automatically determines
+ the XML name of this field when no name has been specified.
+ -->
+ <xsd:attribute name="auto-naming" use="optional">
+ <xsd:annotation>
+ <xsd:documentation>
+ Allows specifying how Castor should automatically determines
+ the XML name of this field when no name has been specified.
+ In most cases the XML name is determined by using the field name,
+ but in some cases the user may want to use the Class name of
+ the field type. This attribute allows choosing between the
+ two approaches. If this attribute is not specified, the field
+ name is used as the XML name.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="deriveByClass"/>
+ <xsd:enumeration value="deriveByField"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+ <!--
+ Allows specifying a nested location path for this field,
+ the value should just be a simplified XPath like value
+ where names are separated by "/".
+ -->
+ <xsd:attribute name="location" type="xsd:string" use="optional">
+ <xsd:annotation>
+ <xsd:documentation>
+ Allows specifying a nested location path for this field,
+ the value should just be a simplified XPath like value
+ where names are separated by "/".
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+
+ <!-- Allows overriding the matching rule -->
+ <xsd:attribute name="matches" type="xsd:string" use="optional"/>
+
+
+ <!-- Signal that this field should be marshalled as a reference -->
+ <xsd:attribute name="reference" type="xsd:boolean" use="optional"/>
+
+ <!-- NodeType for the XML node -->
+ <xsd:attribute name="node" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="attribute"/>
+ <xsd:enumeration value="element"/>
+ <xsd:enumeration value="namespace"/>
+ <xsd:enumeration value="text"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+ <xsd:attribute name="QName-prefix" type="xsd:NMTOKEN" use="optional"/>
+
+ <!-- Signal that this field is transient for XML (ie should be ignored) -->
+ <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>
+
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="ldap">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:NMTOKEN" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="key-generator">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="param" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:ID" use="required"/>
+ <xsd:attribute name="alias" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="cache-type">
+ <xsd:complexType>
+ <xsd:attribute name="type" type="xsd:string" use="optional" default="count-limited" />
+ <xsd:attribute name="capacity" type="xsd:integer" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="param">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="value" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:complexType name="propertyType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="value" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ </xsd:schema>
diff --git a/schemas/jalview.nodesc.properties b/schemas/jalview.nodesc.properties
index ed37efc..b5af923 100644
--- a/schemas/jalview.nodesc.properties
+++ b/schemas/jalview.nodesc.properties
@@ -1,30 +1,31 @@
-###############################################################################
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
+##
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+# Copyright (C) 2015 The Jalview Authors
+#
# This file is part of Jalview.
-#
+#
# Jalview is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
+#
# Jalview is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-###############################################################################
-#
-# Property file for SourceCodeGenerator for jalview project XML for parsing without descriptors
-#
-
-#org.exolab.castor.builder.superclass=com.xyz.BaseObject
-
-# XML namespace mapping to Java packages
-#
-org.exolab.castor.builder.nspackages=\
- www.vamsas.ac.uk/jalview/version2=jalview.binding,\
- www.jalview.org/colours=jalview.binding,\
- www.jalview.org=jalview.binding
-
+# The Jalview Authors are detailed in the 'AUTHORS' file.
+##
+#
+# Property file for SourceCodeGenerator for jalview project XML for parsing without descriptors
+#
+
+#org.exolab.castor.builder.superclass=com.xyz.BaseObject
+
+# XML namespace mapping to Java packages
+#
+org.exolab.castor.builder.nspackages=\
+ www.vamsas.ac.uk/jalview/version2=jalview.binding,\
+ www.jalview.org/colours=jalview.binding,\
+ www.jalview.org=jalview.binding
+
diff --git a/schemas/jalview.properties b/schemas/jalview.properties
index 236a53f..42b5ef7 100644
--- a/schemas/jalview.properties
+++ b/schemas/jalview.properties
@@ -1,30 +1,31 @@
-###############################################################################
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
+##
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+# Copyright (C) 2015 The Jalview Authors
+#
# This file is part of Jalview.
-#
+#
# Jalview is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
+#
# Jalview is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-###############################################################################
-#
-# Property file for SourceCodeGenerator for jalview project XML
-#
-
-#org.exolab.castor.builder.superclass=com.xyz.BaseObject
-
-# XML namespace mapping to Java packages
-#
-org.exolab.castor.builder.nspackages=\
- www.vamsas.ac.uk/jalview/version2=jalview.schemabinding.version2,\
- www.jalview.org/colours=jalview.schemabinding.version2,\
- www.jalview.org=jalview.schemabinding.version2
-
+# The Jalview Authors are detailed in the 'AUTHORS' file.
+##
+#
+# Property file for SourceCodeGenerator for jalview project XML
+#
+
+#org.exolab.castor.builder.superclass=com.xyz.BaseObject
+
+# XML namespace mapping to Java packages
+#
+org.exolab.castor.builder.nspackages=\
+ www.vamsas.ac.uk/jalview/version2=jalview.schemabinding.version2,\
+ www.jalview.org/colours=jalview.schemabinding.version2,\
+ www.jalview.org=jalview.schemabinding.version2
+
diff --git a/schemas/jalview.xsd b/schemas/jalview.xsd
index 431fad5..b002618 100644
--- a/schemas/jalview.xsd
+++ b/schemas/jalview.xsd
@@ -1,75 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" xmlns:jalview="www.jalview.org/colours" xmlns:jv="www.jalview.org" targetNamespace="www.jalview.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:import namespace="www.vamsas.ac.uk/jalview/version2" schemaLocation="vamsas.xsd"/>
- <xs:import namespace="www.jalview.org/colours" schemaLocation="JalviewUserColours.xsd"/>
+<!-- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors * * This file is part of
+ Jalview. * * Jalview is free software: you can redistribute it and/or * modify
+ it under the terms of the GNU General Public License * as published by the
+ Free Software Foundation, either version 3 of the License, or (at your option)
+ any later version. * * Jalview is distributed in the hope that it will be
+ useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General
+ Public License for more details. * * You should have received a copy of the
+ GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file. -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" xmlns:jalview="www.jalview.org/colours"
+ xmlns:jv="www.jalview.org" xmlns:jvws="www.jalview.org/xml/wsparamset"
+ targetNamespace="www.jalview.org" elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+ <xs:import namespace="www.vamsas.ac.uk/jalview/version2"
+ schemaLocation="vamsas.xsd" />
+ <xs:import namespace="www.jalview.org/colours"
+ schemaLocation="JalviewUserColours.xsd" />
+ <xs:import namespace="www.jalview.org/xml/wsparamset"
+ schemaLocation="JalviewWsParamSet.xsd" />
<xs:complexType name="JalviewModel">
<xs:sequence>
- <xs:element name="creationDate" type="xs:dateTime"/>
- <xs:element name="version" type="xs:string"/>
- <xs:element name="vamsasModel" type="vamsas:VAMSAS"/>
+ <xs:element name="creationDate" type="xs:dateTime" />
+ <xs:element name="version" type="xs:string" />
+ <xs:element name="vamsasModel" type="vamsas:VAMSAS" />
<xs:sequence>
- <xs:element name="JSeq" maxOccurs="unbounded">
+ <xs:element name="JSeq" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
- <xs:element name="features" type="jv:feature" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="features" type="jv:feature"
+ minOccurs="0" maxOccurs="unbounded" />
<xs:element name="pdbids" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:extension base="jv:pdbentry">
<xs:sequence>
- <xs:element name="structureState" minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="structureState" minOccurs="0"
+ maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attributeGroup ref="jv:swingwindow"/>
- <xs:attribute name="visible" type="xs:boolean"/>
- <xs:attribute name="viewId" type="xs:string" use="optional">
+ <xs:extension base="xs:string">
+ <xs:attributeGroup ref="jv:swingwindow" />
+ <xs:attribute name="visible" type="xs:boolean" />
+ <xs:attribute name="viewId" type="xs:string"
+ use="optional">
<xs:annotation>
- <xs:documentation>additional identifier which properly disambiguates
- the structure view from any other view with the same attributes. This is not an ID,
- because it is possible to have many references to the same physical structure view
- from different sequences in an alignment. A structureState element citing the same
- viewId will appear for each instance.</xs:documentation>
+ <xs:documentation>
+ additional
+ identifier
+ which
+ properly
+ disambiguates
+ the
+ structure
+ view
+ from
+ any
+ other
+ view
+ with
+ the
+ same
+ attributes.
+ This
+ is
+ not
+ an
+ ID,
+ because
+ it
+ is
+ possible
+ to
+ have
+ many
+ references
+ to
+ the
+ same
+ physical
+ structure
+ view
+ from
+ different
+ sequences
+ in
+ an
+ alignment.
+ A
+ structureState
+ element
+ citing
+ the
+ same
+ viewId
+ will
+ appear
+ for
+ each
+ instance.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="alignwithAlignPanel" type="xs:boolean" use="optional" default="true">
- <xs:annotation>
- <xs:documentation>
- Flag set if the alignment panel containing this JSeq should be included in those used to perform a structure superposition (since Jalview 2.7).
- </xs:documentation>
- </xs:annotation>
+ <xs:attribute name="alignwithAlignPanel"
+ type="xs:boolean" use="optional" default="true">
+ <xs:annotation>
+ <xs:documentation>
+ Flag
+ set
+ if
+ the
+ alignment
+ panel
+ containing
+ this
+ JSeq
+ should
+ be
+ included
+ in
+ those
+ used
+ to
+ perform
+ a
+ structure
+ superposition
+ (since
+ Jalview
+ 2.7).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="colourwithAlignPanel"
+ type="xs:boolean" use="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Flag
+ set
+ if
+ the
+ alignment
+ panel
+ containing
+ this
+ JSeq
+ should
+ be
+ included
+ in
+ those
+ used
+ to
+ colour
+ its
+ associated
+ sequences
+ in
+ this
+ structureState(since
+ Jalview
+ 2.7).
+ </xs:documentation>
+ </xs:annotation>
</xs:attribute>
- <xs:attribute name="colourwithAlignPanel" type="xs:boolean" use="optional" default="false">
- <xs:annotation>
- <xs:documentation>
- Flag set if the alignment panel containing this JSeq should be included in those used to colour its associated sequences in this structureState(since Jalview 2.7).
- </xs:documentation>
- </xs:annotation>
+ <xs:attribute name="colourByJmol" type="xs:boolean"
+ use="optional" default="true">
+ <xs:annotation>
+ <xs:documentation>
+ Flag
+ set
+ if
+ the
+ structure
+ display
+ is
+ coloured
+ by
+ the
+ Jmol
+ state,
+ rather
+ than
+ by
+ one
+ or
+ more
+ linked
+ alignment
+ views.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="type" type="xs:string"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ An
+ identifier
+ for
+ the
+ viewer
+ type,
+ currently
+ either
+ JMOL
+ or
+ CHIMERA
+ </xs:documentation>
+ </xs:annotation>
</xs:attribute>
- <xs:attribute name="colourByJmol" type="xs:boolean" use="optional" default="true">
- <xs:annotation><xs:documentation>
- Flag set if the structure display is coloured by the Jmol state, rather than by one or more linked alignment views.
- </xs:documentation></xs:annotation></xs:attribute>
-
+
</xs:extension>
- </xs:simpleContent>
+ </xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
@@ -77,169 +222,329 @@
</xs:complexContent>
</xs:complexType>
</xs:element>
- <xs:element name="hiddenSequences" type="xs:int" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="hiddenSequences" type="xs:int"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="rnaViewer" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>Reference to a viewer showing RNA structure
+ for this sequence. Schema supports one viewer showing multiple
+ annotations for multiple sequences, though currently only one
+ annotation for one sequence (gapped or trimmed) is used
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="secondaryStructure" minOccurs="1"
+ maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="title" type="xs:string" />
+ <xs:attribute name="annotationId" type="xs:string"
+ use="required">
+ <xs:annotation>
+ <xs:documentation>id attribute of Annotation in
+ vamsasModel for
+ the secondary structure annotation shown
+ in the viewer
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="gapped" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>if true the RNA structure is shown with gaps, if false without
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="viewerState" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>name of the project jar entry that holds
+ the VARNA viewer state for the structure
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attributeGroup ref="jv:swingwindow" />
+ <xs:attribute name="title" type="xs:string" />
+ <xs:attribute name="viewId" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>An id unique to the RNA viewer panel
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="dividerLocation" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>horizontal position of split pane divider
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="selectedRna" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Index of the selected structure in the
+ viewer panel
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
</xs:sequence>
- <xs:attribute name="colour" type="xs:int" use="optional"/>
- <xs:attribute name="start" type="xs:int" use="required"/>
- <xs:attribute name="end" type="xs:int" use="required"/>
- <xs:attribute name="id" type="xs:string" use="required"/>
- <xs:attribute name="hidden" type="xs:boolean"/>
+ <xs:attribute name="colour" type="xs:int" use="optional" />
+ <xs:attribute name="start" type="xs:int" use="required" />
+ <xs:attribute name="end" type="xs:int" use="required" />
+ <xs:attribute name="id" type="xs:string" use="required" />
+ <xs:attribute name="hidden" type="xs:boolean" />
</xs:complexType>
</xs:element>
<xs:element name="JGroup" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
- <xs:element name="seq" type="xs:string" maxOccurs="unbounded"/>
+ <xs:element name="seq" type="xs:string" maxOccurs="unbounded" />
+ <xs:element name="annotationColours" type="jv:AnnotationColourScheme"
+ minOccurs="0" maxOccurs="1" />
</xs:sequence>
- <xs:attribute name="start" type="xs:int"/>
- <xs:attribute name="end" type="xs:int"/>
- <xs:attribute name="name" type="xs:string"/>
- <xs:attribute name="colour" type="xs:string"/>
- <xs:attribute name="consThreshold" type="xs:int"/>
- <xs:attribute name="pidThreshold" type="xs:int"/>
- <xs:attribute name="outlineColour" type="xs:int"/>
- <xs:attribute name="displayBoxes" type="xs:boolean"/>
- <xs:attribute name="displayText" type="xs:boolean"/>
- <xs:attribute name="colourText" type="xs:boolean"/>
- <xs:attribute name="textCol1" type="xs:int"/>
- <xs:attribute name="textCol2" type="xs:int"/>
- <xs:attribute name="textColThreshold" type="xs:int"/>
- <xs:attribute name="showUnconserved" type="xs:boolean" use="optional"/>
- <xs:attribute name="ignoreGapsinConsensus" type="xs:boolean" use="optional" default="true"/>
- <xs:attribute name="showConsensusHistogram" type="xs:boolean" use="optional" default="true"/>
- <xs:attribute name="showSequenceLogo" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="id" type="xs:string" use="optional"><xs:annotation>
- <xs:documentation>
- Optional sequence group ID (only needs to be unique for this alignment)
- </xs:documentation>
- </xs:annotation></xs:attribute>
+ <xs:attribute name="start" type="xs:int" />
+ <xs:attribute name="end" type="xs:int" />
+ <xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="colour" type="xs:string" />
+ <xs:attribute name="consThreshold" type="xs:int" />
+ <xs:attribute name="pidThreshold" type="xs:int" />
+ <xs:attribute name="outlineColour" type="xs:int" />
+ <xs:attribute name="displayBoxes" type="xs:boolean" />
+ <xs:attribute name="displayText" type="xs:boolean" />
+ <xs:attribute name="colourText" type="xs:boolean" />
+ <xs:attribute name="textCol1" type="xs:int" />
+ <xs:attribute name="textCol2" type="xs:int" />
+ <xs:attribute name="textColThreshold" type="xs:int" />
+ <xs:attribute name="showUnconserved" type="xs:boolean"
+ use="optional" />
+ <xs:attribute name="ignoreGapsinConsensus" type="xs:boolean"
+ use="optional" default="true" />
+ <xs:attribute name="showConsensusHistogram" type="xs:boolean"
+ use="optional" default="true" />
+ <xs:attribute name="showSequenceLogo" type="xs:boolean"
+ use="optional" default="false" />
+ <xs:attribute name="normaliseSequenceLogo" type="xs:boolean"
+ use="optional" default="false" />
+ <xs:attribute name="id" type="xs:string" use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ Optional sequence group ID (only
+ needs to be
+ unique for this
+ alignment)
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
- <xs:element name="Viewport" maxOccurs="unbounded">
+ <xs:element name="Viewport" maxOccurs="unbounded"
+ minOccurs="0">
<xs:complexType>
<xs:sequence>
- <xs:element name="AnnotationColours" minOccurs="0">
+ <xs:element name="AnnotationColours" type="jv:AnnotationColourScheme"
+ minOccurs="0" maxOccurs="1">
+ </xs:element>
+ <xs:element name="hiddenColumns" minOccurs="0"
+ maxOccurs="unbounded">
<xs:complexType>
- <xs:attribute name="aboveThreshold" type="xs:int"/>
- <xs:attribute name="annotation" type="xs:string"/>
- <xs:attribute name="minColour" type="xs:int"/>
- <xs:attribute name="maxColour" type="xs:int"/>
- <xs:attribute name="colourScheme" type="xs:string"/>
- <xs:attribute name="threshold" type="xs:float"/>
+ <xs:attribute name="start" type="xs:int" />
+ <xs:attribute name="end" type="xs:int" />
</xs:complexType>
</xs:element>
- <xs:element name="hiddenColumns" minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="calcIdParam" minOccurs="0"
+ maxOccurs="unbounded">
<xs:complexType>
- <xs:attribute name="start" type="xs:int"/>
- <xs:attribute name="end" type="xs:int"/>
+ <xs:complexContent>
+ <xs:extension base="jvws:WebServiceParameterSet">
+ <xs:attribute name="calcId" type="xs:string"
+ use="required">
+ <xs:annotation>
+ <xs:documentation>handle for the calculation which uses
+ this parameter set
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="needsUpdate" type="xs:boolean"
+ use="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>should the calculation be performed
+ immediately after loading in order to refresh results
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="autoUpdate" type="xs:boolean"
+ use="required">
+ <xs:annotation>
+ <xs:documentation>should the calculation be automatically
+ performed on edits
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
- <xs:attributeGroup ref="jv:swingwindow"/>
- <xs:attribute name="conservationSelected" type="xs:boolean"/>
- <xs:attribute name="pidSelected" type="xs:boolean"/>
- <xs:attribute name="bgColour" type="xs:string"/>
- <xs:attribute name="consThreshold" type="xs:int"/>
- <xs:attribute name="pidThreshold" type="xs:int"/>
- <xs:attribute name="title" type="xs:string"/>
- <xs:attribute name="showFullId" type="xs:boolean"/>
- <xs:attribute name="rightAlignIds" type="xs:boolean"/>
- <xs:attribute name="showText" type="xs:boolean"/>
- <xs:attribute name="showColourText" type="xs:boolean"/>
- <xs:attribute name="showUnconserved" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="showBoxes" type="xs:boolean"/>
- <xs:attribute name="wrapAlignment" type="xs:boolean"/>
- <xs:attribute name="renderGaps" type="xs:boolean"/>
- <xs:attribute name="showSequenceFeatures" type="xs:boolean"/>
- <xs:attribute name="showNPfeatureTooltip" type="xs:boolean" use="optional"/>
- <xs:attribute name="showDbRefTooltip" type="xs:boolean" use="optional"/>
- <xs:attribute name="followHighlight" type="xs:boolean" use="optional" default="true"/>
- <xs:attribute name="followSelection" type="xs:boolean" use="optional" default="true"/>
- <xs:attribute name="showAnnotation" type="xs:boolean"/>
- <xs:attribute name="centreColumnLabels" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="showGroupConservation" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="showGroupConsensus" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="showConsensusHistogram" type="xs:boolean" use="optional" default="true"/>
- <xs:attribute name="showSequenceLogo" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="ignoreGapsinConsensus" type="xs:boolean" use="optional" default="true"/>
-
- <xs:attribute name="startRes" type="xs:int"/>
- <xs:attribute name="startSeq" type="xs:int"/>
- <xs:attribute name="fontName" type="xs:string"/>
- <xs:attribute name="fontSize" type="xs:int"/>
- <xs:attribute name="fontStyle" type="xs:int"/>
- <xs:attribute name="viewName" type="xs:string"/>
- <xs:attribute name="sequenceSetId" type="xs:string"/>
- <xs:attribute name="gatheredViews" type="xs:boolean"/>
- <xs:attribute name="textCol1" type="xs:int"/>
- <xs:attribute name="textCol2" type="xs:int"/>
- <xs:attribute name="textColThreshold" type="xs:int"/>
+ <xs:attributeGroup ref="jv:swingwindow" />
+ <xs:attribute name="conservationSelected" type="xs:boolean" />
+ <xs:attribute name="pidSelected" type="xs:boolean" />
+ <xs:attribute name="bgColour" type="xs:string" />
+ <xs:attribute name="consThreshold" type="xs:int" />
+ <xs:attribute name="pidThreshold" type="xs:int" />
+ <xs:attribute name="title" type="xs:string" />
+ <xs:attribute name="showFullId" type="xs:boolean" />
+ <xs:attribute name="rightAlignIds" type="xs:boolean" />
+ <xs:attribute name="showText" type="xs:boolean" />
+ <xs:attribute name="showColourText" type="xs:boolean" />
+ <xs:attribute name="showUnconserved" type="xs:boolean"
+ use="optional" default="false" />
+ <xs:attribute name="showBoxes" type="xs:boolean" />
+ <xs:attribute name="wrapAlignment" type="xs:boolean" />
+ <xs:attribute name="renderGaps" type="xs:boolean" />
+ <xs:attribute name="showSequenceFeatures" type="xs:boolean" />
+ <xs:attribute name="showNPfeatureTooltip" type="xs:boolean"
+ use="optional" />
+ <xs:attribute name="showDbRefTooltip" type="xs:boolean"
+ use="optional" />
+ <xs:attribute name="followHighlight" type="xs:boolean"
+ use="optional" default="true" />
+ <xs:attribute name="followSelection" type="xs:boolean"
+ use="optional" default="true" />
+ <xs:attribute name="showAnnotation" type="xs:boolean" />
+ <xs:attribute name="centreColumnLabels" type="xs:boolean"
+ use="optional" default="false" />
+ <xs:attribute name="showGroupConservation" type="xs:boolean"
+ use="optional" default="false" />
+ <xs:attribute name="showGroupConsensus" type="xs:boolean"
+ use="optional" default="false" />
+ <xs:attribute name="showConsensusHistogram" type="xs:boolean"
+ use="optional" default="true" />
+ <xs:attribute name="showSequenceLogo" type="xs:boolean"
+ use="optional" default="false" />
+ <xs:attribute name="normaliseSequenceLogo" type="xs:boolean"
+ use="optional" default="false" />
+ <xs:attribute name="ignoreGapsinConsensus" type="xs:boolean"
+ use="optional" default="true" />
+ <xs:attribute name="startRes" type="xs:int" />
+ <xs:attribute name="startSeq" type="xs:int" />
+ <xs:attribute name="fontName" type="xs:string" />
+ <xs:attribute name="fontSize" type="xs:int" />
+ <xs:attribute name="fontStyle" type="xs:int" />
+ <xs:attribute name="scaleProteinAsCdna" type="xs:boolean" use="optional" default="true" />
+ <xs:attribute name="viewName" type="xs:string" />
+ <xs:attribute name="sequenceSetId" type="xs:string" />
+ <xs:attribute name="gatheredViews" type="xs:boolean" />
+ <xs:attribute name="textCol1" type="xs:int" />
+ <xs:attribute name="textCol2" type="xs:int" />
+ <xs:attribute name="textColThreshold" type="xs:int" />
<xs:attribute name="id" type="xs:ID" use="optional">
<xs:annotation>
<xs:documentation>
- unique id used by jalview to synchronize between stored and instantiated views
+ unique id used by jalview to
+ synchronize
+ between stored and
+ instantiated views
</xs:documentation>
</xs:annotation>
</xs:attribute>
- </xs:complexType>
+ <xs:attribute name="complementId" type="xs:string"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ The viewport id of this viewport's
+ (cdna/protein) coding complement, if any
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
</xs:element>
<xs:element name="UserColours" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
- <xs:element name="UserColourScheme" type="jalview:JalviewUserColours"/>
+ <xs:element name="UserColourScheme" type="jalview:JalviewUserColours" />
</xs:sequence>
- <xs:attribute name="id" type="xs:string"/>
+ <xs:attribute name="id" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="tree" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
- <xs:sequence minOccurs="0">
- <xs:element name="title" type="xs:string"/>
- <xs:element name="newick" type="xs:string"/>
- </xs:sequence>
- <xs:attribute name="fontName" type="xs:string"/>
- <xs:attribute name="fontSize" type="xs:int"/>
- <xs:attribute name="fontStyle" type="xs:int"/>
- <xs:attribute name="threshold" type="xs:float"/>
- <xs:attribute name="showBootstrap" type="xs:boolean"/>
- <xs:attribute name="showDistances" type="xs:boolean"/>
- <xs:attribute name="markUnlinked" type="xs:boolean"/>
- <xs:attribute name="fitToWindow" type="xs:boolean"/>
- <xs:attribute name="currentTree" type="xs:boolean"/>
- <xs:attribute name="id" type="xs:ID" use="optional">
- <xs:annotation><xs:documentation>Tree ID added for binding tree visualization settings to vamsas document trees in jalview 2.4.1</xs:documentation></xs:annotation>
- </xs:attribute>
- <xs:attributeGroup ref="jv:swingwindow"/>
- </xs:complexType>
+ <xs:sequence minOccurs="0">
+ <xs:element name="title" type="xs:string" />
+ <xs:element name="newick" type="xs:string" />
+ </xs:sequence>
+ <xs:attribute name="fontName" type="xs:string" />
+ <xs:attribute name="fontSize" type="xs:int" />
+ <xs:attribute name="fontStyle" type="xs:int" />
+ <xs:attribute name="threshold" type="xs:float" />
+ <xs:attribute name="showBootstrap" type="xs:boolean" />
+ <xs:attribute name="showDistances" type="xs:boolean" />
+ <xs:attribute name="markUnlinked" type="xs:boolean" />
+ <xs:attribute name="fitToWindow" type="xs:boolean" />
+ <xs:attribute name="currentTree" type="xs:boolean" />
+ <xs:attribute name="id" type="xs:ID" use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ Tree ID added for binding tree
+ visualization
+ settings to vamsas
+ document trees in jalview 2.4.1
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attributeGroup ref="jv:swingwindow" />
+ </xs:complexType>
</xs:element>
<xs:element name="FeatureSettings" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="setting" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
- <xs:attribute name="type" type="xs:string" use="required"/>
- <xs:attribute name="colour" type="xs:int" use="required"/>
- <xs:attribute name="display" type="xs:boolean" use="required"/>
- <xs:attribute name="order" type="xs:float" use="optional"/>
+ <xs:attribute name="type" type="xs:string" use="required" />
+ <xs:attribute name="colour" type="xs:int" use="required" />
+ <xs:attribute name="display" type="xs:boolean"
+ use="required" />
+ <xs:attribute name="order" type="xs:float" use="optional" />
<xs:attribute name="mincolour" type="xs:int" use="optional">
- <xs:annotation><xs:documentation>Optional minimum colour for graduated feature colour</xs:documentation>
- </xs:annotation></xs:attribute>
- <xs:attribute name="threshold" type="xs:float" use="optional">
- <xs:annotation><xs:documentation>threshold value for graduated feature colour</xs:documentation>
- </xs:annotation></xs:attribute>
- <xs:attribute name="threshstate" type="xs:int" use="optional">
- <xs:annotation><xs:documentation>threshold type for graduated feature colour</xs:documentation>
- </xs:annotation></xs:attribute>
- <xs:attribute name="max" type="xs:float" use="optional"/>
- <xs:attribute name="min" type="xs:float" use="optional"/>
- <xs:attribute name="colourByLabel" type="xs:boolean" use="optional"/>
- <xs:attribute name="autoScale" type="xs:boolean" use="optional"/>
- </xs:complexType>
+ <xs:annotation>
+ <xs:documentation>
+ Optional minimum colour
+ for graduated
+ feature
+ colour
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="threshold" type="xs:float"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ threshold value for
+ graduated feature colour
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="threshstate" type="xs:int"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ threshold type for
+ graduated feature colour
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="max" type="xs:float" use="optional" />
+ <xs:attribute name="min" type="xs:float" use="optional" />
+ <xs:attribute name="colourByLabel" type="xs:boolean"
+ use="optional" />
+ <xs:attribute name="autoScale" type="xs:boolean"
+ use="optional" />
+ </xs:complexType>
</xs:element>
<xs:element name="group" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="display" type="xs:boolean" use="required"/>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="display" type="xs:boolean"
+ use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
@@ -252,53 +557,60 @@
<xs:sequence>
<xs:element name="otherData" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
- <xs:attribute name="key" type="xs:string" use="required"/>
- <xs:attribute name="value" type="xs:string" use="required"/>
+ <xs:attribute name="key" type="xs:string" use="required" />
+ <xs:attribute name="value" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
- <xs:attribute name="begin" type="xs:int" use="required"/>
- <xs:attribute name="end" type="xs:int" use="required"/>
- <xs:attribute name="type" type="xs:string" use="required"/>
- <xs:attribute name="description" type="xs:string" use="optional"/>
- <xs:attribute name="status" type="xs:string" use="optional"/>
- <xs:attribute name="featureGroup" type="xs:string" use="optional"/>
- <xs:attribute name="score" type="xs:float" use="optional"/>
+ <xs:attribute name="begin" type="xs:int" use="required" />
+ <xs:attribute name="end" type="xs:int" use="required" />
+ <xs:attribute name="type" type="xs:string" use="required" />
+ <xs:attribute name="description" type="xs:string" use="optional" />
+ <xs:attribute name="status" type="xs:string" use="optional" />
+ <xs:attribute name="featureGroup" type="xs:string" use="optional" />
+ <xs:attribute name="score" type="xs:float" use="optional" />
</xs:complexType>
<xs:complexType name="pdbentry">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="property" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="value" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="value" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
- <xs:attribute name="id" type="xs:string" use="required"/>
- <xs:attribute name="type" type="xs:string" use="optional"/>
- <xs:attribute name="file" type="xs:string"/>
+ <xs:attribute name="id" type="xs:string" use="required" />
+ <xs:attribute name="type" type="xs:string" use="optional" />
+ <xs:attribute name="file" type="xs:string" />
</xs:complexType>
- <!--
- <xs:complexType name="reportWindow">
- <xs:annotation>
- <xs:documentation>Generic type for windows containing mime-typed data associated with other jalview windows</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- </xs:sequence>
- <xs:attribute name="id" type="xs:string" use="required"/>
- <xs:attribute name="type" type="xs:string" use="optional"/>
- <xs:attribute name="file" type="xs:string" use="optional"/>
+ <!-- <xs:complexType name="reportWindow"> <xs:annotation> <xs:documentation>Generic
+ type for windows containing mime-typed data associated with other jalview
+ windows</xs:documentation> </xs:annotation> <xs:sequence> </xs:sequence>
+ <xs:attribute name="id" type="xs:string" use="required"/> <xs:attribute name="type"
+ type="xs:string" use="optional"/> <xs:attribute name="file" type="xs:string"
+ use="optional"/> </xs:complexType> -->
+ <xs:attributeGroup name="swingwindow">
+ <xs:annotation>
+ <xs:documentation>
+ base attributes for windows displayed in Jalview
+ desktop.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="width" type="xs:int" />
+ <xs:attribute name="height" type="xs:int" />
+ <xs:attribute name="xpos" type="xs:int" />
+ <xs:attribute name="ypos" type="xs:int" />
+ </xs:attributeGroup>
+ <xs:complexType name="AnnotationColourScheme">
+ <xs:attribute name="aboveThreshold" type="xs:int" />
+ <xs:attribute name="annotation" type="xs:string" />
+ <xs:attribute name="minColour" type="xs:int" />
+ <xs:attribute name="maxColour" type="xs:int" />
+ <xs:attribute name="colourScheme" type="xs:string" />
+ <xs:attribute name="threshold" type="xs:float" />
+ <xs:attribute name="perSequence" type="xs:boolean" use="optional" />
+ <xs:attribute name="predefinedColours" type="xs:boolean"
+ use="optional" />
</xs:complexType>
- -->
- <xs:attributeGroup name="swingwindow">
- <xs:annotation>
- <xs:documentation>
- base attributes for windows displayed in Jalview desktop.
- </xs:documentation>
- </xs:annotation>
- <xs:attribute name="width" type="xs:int"/>
- <xs:attribute name="height" type="xs:int"/>
- <xs:attribute name="xpos" type="xs:int"/>
- <xs:attribute name="ypos" type="xs:int"/>
- </xs:attributeGroup>
+
</xs:schema>
diff --git a/schemas/jalviewJvV1.xsd b/schemas/jalviewJvV1.xsd
index 7c562fb..4bce631 100644
--- a/schemas/jalviewJvV1.xsd
+++ b/schemas/jalviewJvV1.xsd
@@ -1,162 +1,163 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:vamsas="www.vamsas.org"
- xmlns:jalview="www.jalview.org/colours"
- xmlns:jv="www.jalview.org"
- targetNamespace="www.jalview.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
-
- <xs:import schemaLocation="vamsasJvV1.xsd" namespace="www.vamsas.org"/>
- <xs:import schemaLocation="jalviewUserColours.xsd" namespace="www.jalview.org/colours"/>
- <xs:complexType name="JalviewModel">
- <xs:sequence>
- <xs:element name="creationDate" type="xs:dateTime"/>
- <xs:element name="version" type="xs:string"/>
- <xs:element name="vamsasModel" type="vamsas:VAMSAS"/>
- <xs:sequence>
- <xs:element name="JSeq" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="features" type="jv:feature" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="pdbids" type="jv:pdbentry" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
-
- <xs:attribute name="colour" type="xs:int" use="optional"/>
- <xs:attribute name="start" type="xs:int" use="required"/>
- <xs:attribute name="end" type="xs:int" use="required"/>
- <xs:attribute name="id" type="xs:int" use="required"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="JGroup" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element name="seq" maxOccurs="unbounded" type="xs:int"/>
- </xs:sequence>
- <xs:attribute name="start" type="xs:int"/>
- <xs:attribute name="end" type="xs:int"/>
- <xs:attribute name="name" type="xs:string"/>
- <xs:attribute name="colour" type="xs:string"/>
- <xs:attribute name="consThreshold" type="xs:int"/>
- <xs:attribute name="pidThreshold" type="xs:int"/>
- <xs:attribute name="outlineColour" type="xs:int"/>
- <xs:attribute name="displayBoxes" type="xs:boolean"/>
- <xs:attribute name="displayText" type="xs:boolean"/>
- <xs:attribute name="colourText" type="xs:boolean"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Viewport" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="conservationSelected" type="xs:boolean"/>
- <xs:attribute name="pidSelected" type="xs:boolean"/>
- <xs:attribute name="bgColour" type="xs:string"/>
- <xs:attribute name="consThreshold" type="xs:int"/>
- <xs:attribute name="pidThreshold" type="xs:int"/>
- <xs:attribute name="title" type="xs:string"/>
- <xs:attribute name="showFullId" type="xs:boolean"/>
- <xs:attribute name="showText" type="xs:boolean"/>
- <xs:attribute name="showColourText" type="xs:boolean"/>
- <xs:attribute name="showBoxes" type="xs:boolean"/>
- <xs:attribute name="wrapAlignment" type="xs:boolean"/>
- <xs:attribute name="renderGaps" type="xs:boolean"/>
- <xs:attribute name="showSequenceFeatures" type="xs:boolean"/>
- <xs:attribute name="showAnnotation" type="xs:boolean"/>
- <xs:attribute name="showConservation" type="xs:boolean"/>
- <xs:attribute name="showQuality" type="xs:boolean"/>
- <xs:attribute name="showIdentity" type="xs:boolean"/>
- <xs:attribute name="xpos" type="xs:int"/>
- <xs:attribute name="ypos" type="xs:int"/>
- <xs:attribute name="width" type="xs:int"/>
- <xs:attribute name="height" type="xs:int"/>
- <xs:attribute name="startRes" type="xs:int"/>
- <xs:attribute name="startSeq" type="xs:int"/>
- <xs:attribute name="fontName" type="xs:string"/>
- <xs:attribute name="fontSize" type="xs:int"/>
- <xs:attribute name="fontStyle" type="xs:int"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="UserColours" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element name="UserColourScheme" type="jalview:JalviewUserColours"/>
- </xs:sequence>
- <xs:attribute name="id" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="tree" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:element name="title" type="xs:string"/>
- <xs:element name="newick" type="xs:string"/>
- </xs:sequence>
- <xs:attribute name="width" type="xs:int"/>
- <xs:attribute name="height" type="xs:int"/>
- <xs:attribute name="xpos" type="xs:int"/>
- <xs:attribute name="ypos" type="xs:int"/>
- <xs:attribute name="fontName" type="xs:string"/>
- <xs:attribute name="fontSize" type="xs:int"/>
- <xs:attribute name="fontStyle" type="xs:int"/>
- <xs:attribute name="threshold" type="xs:float"/>
- <xs:attribute name="showBootstrap" type="xs:boolean"/>
- <xs:attribute name="showDistances" type="xs:boolean"/>
- <xs:attribute name="markUnlinked" type="xs:boolean"/>
- <xs:attribute name="fitToWindow" type="xs:boolean"/>
- <xs:attribute name="currentTree" type="xs:boolean"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="FeatureSettings" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="setting" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="type" type="xs:string" use="required"/>
- <xs:attribute name="colour" type="xs:int" use="required"/>
- <xs:attribute name="display" type="xs:boolean" use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- </xs:sequence>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="feature">
- <xs:attribute name="begin" type="xs:int" use="required"/>
- <xs:attribute name="end" type="xs:int" use="required"/>
- <xs:attribute name="type" type="xs:string" use="required"/>
- <xs:attribute name="description" type="xs:string" use="optional"/>
- <xs:attribute name="status" type="xs:string" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="pdbentry">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:element name="property" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="value" type="xs:string" use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="id" type="xs:string" use="required"/>
- <xs:attribute name="type" type="xs:string" use="optional"/>
- </xs:complexType>
-
-</xs:schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:vamsas="www.vamsas.org"
+ xmlns:jalview="www.jalview.org/colours"
+ xmlns:jv="www.jalview.org"
+ targetNamespace="www.jalview.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
+
+ <xs:import schemaLocation="vamsasJvV1.xsd" namespace="www.vamsas.org"/>
+ <xs:import schemaLocation="jalviewUserColours.xsd" namespace="www.jalview.org/colours"/>
+ <xs:complexType name="JalviewModel">
+ <xs:sequence>
+ <xs:element name="creationDate" type="xs:dateTime"/>
+ <xs:element name="version" type="xs:string"/>
+ <xs:element name="vamsasModel" type="vamsas:VAMSAS"/>
+ <xs:sequence>
+ <xs:element name="JSeq" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="features" type="jv:feature" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="pdbids" type="jv:pdbentry" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+
+ <xs:attribute name="colour" type="xs:int" use="optional"/>
+ <xs:attribute name="start" type="xs:int" use="required"/>
+ <xs:attribute name="end" type="xs:int" use="required"/>
+ <xs:attribute name="id" type="xs:int" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="JGroup" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence minOccurs="1">
+ <xs:element name="seq" maxOccurs="unbounded" type="xs:int"/>
+ </xs:sequence>
+ <xs:attribute name="start" type="xs:int"/>
+ <xs:attribute name="end" type="xs:int"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="colour" type="xs:string"/>
+ <xs:attribute name="consThreshold" type="xs:int"/>
+ <xs:attribute name="pidThreshold" type="xs:int"/>
+ <xs:attribute name="outlineColour" type="xs:int"/>
+ <xs:attribute name="displayBoxes" type="xs:boolean"/>
+ <xs:attribute name="displayText" type="xs:boolean"/>
+ <xs:attribute name="colourText" type="xs:boolean"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Viewport" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="conservationSelected" type="xs:boolean"/>
+ <xs:attribute name="pidSelected" type="xs:boolean"/>
+ <xs:attribute name="bgColour" type="xs:string"/>
+ <xs:attribute name="consThreshold" type="xs:int"/>
+ <xs:attribute name="pidThreshold" type="xs:int"/>
+ <xs:attribute name="title" type="xs:string"/>
+ <xs:attribute name="showFullId" type="xs:boolean"/>
+ <xs:attribute name="showText" type="xs:boolean"/>
+ <xs:attribute name="showColourText" type="xs:boolean"/>
+ <xs:attribute name="showBoxes" type="xs:boolean"/>
+ <xs:attribute name="wrapAlignment" type="xs:boolean"/>
+ <xs:attribute name="renderGaps" type="xs:boolean"/>
+ <xs:attribute name="showSequenceFeatures" type="xs:boolean"/>
+ <xs:attribute name="showAnnotation" type="xs:boolean"/>
+ <xs:attribute name="showConservation" type="xs:boolean"/>
+ <xs:attribute name="showQuality" type="xs:boolean"/>
+ <xs:attribute name="showIdentity" type="xs:boolean"/>
+ <xs:attribute name="xpos" type="xs:int"/>
+ <xs:attribute name="ypos" type="xs:int"/>
+ <xs:attribute name="width" type="xs:int"/>
+ <xs:attribute name="height" type="xs:int"/>
+ <xs:attribute name="startRes" type="xs:int"/>
+ <xs:attribute name="startSeq" type="xs:int"/>
+ <xs:attribute name="fontName" type="xs:string"/>
+ <xs:attribute name="fontSize" type="xs:int"/>
+ <xs:attribute name="fontStyle" type="xs:int"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="UserColours" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence minOccurs="1">
+ <xs:element name="UserColourScheme" type="jalview:JalviewUserColours"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="tree" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="1">
+ <xs:element name="title" type="xs:string"/>
+ <xs:element name="newick" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="width" type="xs:int"/>
+ <xs:attribute name="height" type="xs:int"/>
+ <xs:attribute name="xpos" type="xs:int"/>
+ <xs:attribute name="ypos" type="xs:int"/>
+ <xs:attribute name="fontName" type="xs:string"/>
+ <xs:attribute name="fontSize" type="xs:int"/>
+ <xs:attribute name="fontStyle" type="xs:int"/>
+ <xs:attribute name="threshold" type="xs:float"/>
+ <xs:attribute name="showBootstrap" type="xs:boolean"/>
+ <xs:attribute name="showDistances" type="xs:boolean"/>
+ <xs:attribute name="markUnlinked" type="xs:boolean"/>
+ <xs:attribute name="fitToWindow" type="xs:boolean"/>
+ <xs:attribute name="currentTree" type="xs:boolean"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="FeatureSettings" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="setting" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="colour" type="xs:int" use="required"/>
+ <xs:attribute name="display" type="xs:boolean" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </xs:sequence>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="feature">
+ <xs:attribute name="begin" type="xs:int" use="required"/>
+ <xs:attribute name="end" type="xs:int" use="required"/>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="description" type="xs:string" use="optional"/>
+ <xs:attribute name="status" type="xs:string" use="optional"/>
+ </xs:complexType>
+
+ <xs:complexType name="pdbentry">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="property" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="type" type="xs:string" use="optional"/>
+ </xs:complexType>
+
+</xs:schema>
diff --git a/schemas/vamsas.xsd b/schemas/vamsas.xsd
index f061b42..9c95d5f 100644
--- a/schemas/vamsas.xsd
+++ b/schemas/vamsas.xsd
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by ioh[ (o[ih[oh) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" targetNamespace="www.vamsas.ac.uk/jalview/version2" elementFormDefault="qualified" attributeFormDefault="unqualified">
@@ -184,6 +185,12 @@
<xs:attribute name="colour" type="xs:int" />
</xs:complexType>
</xs:element>
+ <xs:element name="property" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="value" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
</xs:sequence>
<xs:attribute name="graph" type="xs:boolean" use="required" />
<xs:attribute name="graphType" type="xs:int" use="optional" />
@@ -214,6 +221,11 @@
<xs:attribute name="autoCalculated" type="xs:boolean" use="optional" default="false">
<xs:annotation><xs:documentation>is an autocalculated annotation row</xs:documentation>
</xs:annotation></xs:attribute>
+ <xs:attribute name="belowAlignment" type="xs:boolean" use="optional" default="true">
+ <xs:annotation><xs:documentation>is to be shown below the alignment - introduced in Jalview 2.8 for visualizing T-COFFEE alignment scores</xs:documentation></xs:annotation></xs:attribute>
+ <xs:attribute name="calcId" type="xs:string" use="optional">
+ <xs:annotation><xs:documentation>Optional string identifier used to group sets of annotation produced by a particular calculation. Values are opaque strings but have semantic meaning to Jalview's renderer, data importer and calculation system.</xs:documentation></xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="SequenceSet">
diff --git a/schemas/vamsasJvV1.xsd b/schemas/vamsasJvV1.xsd
index f8bfed0..10587f5 100644
--- a/schemas/vamsasJvV1.xsd
+++ b/schemas/vamsasJvV1.xsd
@@ -1,91 +1,92 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
-<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by ioh[ (o[ih[oh) -->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.org" targetNamespace="www.vamsas.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:complexType name="VAMSAS">
- <xs:sequence>
- <xs:element name="Alignment" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="Annotation" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="vamsas:annotationElement" maxOccurs="unbounded"/>
- <xs:element name="label" type="xs:string"/>
- <xs:element name="description" type="xs:string"/>
- </xs:sequence>
- <xs:attribute name="graph" type="xs:boolean" use="required"/>
- <xs:attribute name="graphType" type="xs:int" use="optional"/>
- </xs:complexType>
- </xs:element>
- <xs:element ref="vamsas:SequenceSet"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Tree" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element ref="vamsas:SequenceSet" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
- <xs:element name="SequenceSet">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="Sequence" type="vamsas:SequenceType" maxOccurs="unbounded"/>
- <xs:element name="Annotation" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="description" type="xs:string" minOccurs="0"/>
- <xs:element name="status" type="xs:string" minOccurs="0"/>
- <xs:element ref="vamsas:annotationElement" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="type" type="xs:string" use="required"/>
- <xs:attribute name="end" type="xs:string" use="required"/>
- <xs:attribute name="begin" type="xs:string" use="required"/>
- <xs:attribute name="seqRef" type="xs:string" use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="gapChar" type="xs:string" use="required"/>
- <xs:attribute name="aligned" type="xs:boolean" use="optional"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="annotationElement">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="displayCharacter" type="xs:string"/>
- <xs:element name="description" type="xs:string"/>
- <xs:element name="secondaryStructure">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:length value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- <xs:element name="value" type="xs:float"/>
- </xs:sequence>
- <xs:attribute name="position" type="xs:int" use="required"/>
- </xs:complexType>
- </xs:element>
- <xs:complexType name="SequenceType">
- <xs:sequence>
- <xs:element name="sequence" type="xs:string"/>
- <xs:element name="name" type="xs:string"/>
- </xs:sequence>
- <xs:attribute name="id" type="xs:string"/>
- </xs:complexType>
-</xs:schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+-->
+<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by ioh[ (o[ih[oh) -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.org" targetNamespace="www.vamsas.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:complexType name="VAMSAS">
+ <xs:sequence>
+ <xs:element name="Alignment" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Annotation" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="vamsas:annotationElement" maxOccurs="unbounded"/>
+ <xs:element name="label" type="xs:string"/>
+ <xs:element name="description" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="graph" type="xs:boolean" use="required"/>
+ <xs:attribute name="graphType" type="xs:int" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element ref="vamsas:SequenceSet"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Tree" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="vamsas:SequenceSet" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="SequenceSet">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Sequence" type="vamsas:SequenceType" maxOccurs="unbounded"/>
+ <xs:element name="Annotation" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="description" type="xs:string" minOccurs="0"/>
+ <xs:element name="status" type="xs:string" minOccurs="0"/>
+ <xs:element ref="vamsas:annotationElement" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="end" type="xs:string" use="required"/>
+ <xs:attribute name="begin" type="xs:string" use="required"/>
+ <xs:attribute name="seqRef" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="gapChar" type="xs:string" use="required"/>
+ <xs:attribute name="aligned" type="xs:boolean" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="annotationElement">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="displayCharacter" type="xs:string"/>
+ <xs:element name="description" type="xs:string"/>
+ <xs:element name="secondaryStructure">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:length value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="value" type="xs:float"/>
+ </xs:sequence>
+ <xs:attribute name="position" type="xs:int" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="SequenceType">
+ <xs:sequence>
+ <xs:element name="sequence" type="xs:string"/>
+ <xs:element name="name" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
+ </xs:complexType>
+</xs:schema>
diff --git a/src/MCview/AppletPDBCanvas.java b/src/MCview/AppletPDBCanvas.java
index 181d85f..9cfb4ea 100644
--- a/src/MCview/AppletPDBCanvas.java
+++ b/src/MCview/AppletPDBCanvas.java
@@ -1,34 +1,53 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.io.*;
-import java.util.*;
-
+import jalview.analysis.AlignSeq;
+import jalview.appletgui.AlignmentPanel;
+import jalview.appletgui.FeatureRenderer;
+import jalview.appletgui.SequenceRenderer;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.structure.AtomSpec;
+import jalview.structure.StructureListener;
+import jalview.structure.StructureMapping;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Event;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Image;
// JBPNote TODO: This class is quite noisy - needs proper log.info/log.debug
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-
-import jalview.appletgui.*;
-import jalview.structure.*;
+import java.awt.Panel;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Vector;
public class AppletPDBCanvas extends Panel implements MouseListener,
MouseMotionListener, StructureListener
@@ -108,7 +127,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
PDBChain mainchain;
- Vector highlightRes;
+ Vector<String> highlightRes;
boolean pdbAction = false;
@@ -132,14 +151,17 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
this.pdbentry = pdbentry;
this.sequence = seq;
- ssm = StructureSelectionManager.getStructureSelectionManager(ap.av.applet);
+ ssm = StructureSelectionManager
+ .getStructureSelectionManager(ap.av.applet);
try
{
pdb = ssm.setMapping(seq, chains, pdbentry.getFile(), protocol);
if (protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
+ {
pdbentry.setFile("INLINE" + pdb.id);
+ }
} catch (Exception ex)
{
@@ -167,20 +189,17 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
{
mappingDetails.append("\n\nPDB Sequence is :\nSequence = "
- + ((PDBChain) pdb.chains.elementAt(i)).sequence
- .getSequenceAsString());
+ + pdb.chains.elementAt(i).sequence.getSequenceAsString());
mappingDetails.append("\nNo of residues = "
- + ((PDBChain) pdb.chains.elementAt(i)).residues.size()
- + "\n\n");
+ + pdb.chains.elementAt(i).residues.size() + "\n\n");
// Now lets compare the sequences to get
// the start and end points.
// Align the sequence to the pdb
// TODO: DNa/Pep switch
AlignSeq as = new AlignSeq(sequence,
- ((PDBChain) pdb.chains.elementAt(i)).sequence,
- ((PDBChain) pdb.chains.elementAt(i)).isNa ? AlignSeq.DNA
- : AlignSeq.PEP);
+ pdb.chains.elementAt(i).sequence,
+ pdb.chains.elementAt(i).isNa ? AlignSeq.DNA : AlignSeq.PEP);
as.calcScoreMatrix();
as.traceAlignment();
PrintStream ps = new PrintStream(System.out)
@@ -213,7 +232,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
mappingDetails.append("\nSEQ start/end " + seqstart + " " + seqend);
}
- mainchain = (PDBChain) pdb.chains.elementAt(maxchain);
+ mainchain = pdb.chains.elementAt(maxchain);
mainchain.pdbstart = pdbstart;
mainchain.pdbend = pdbend;
@@ -262,19 +281,19 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
scale = findScale();
}
- Vector visiblebonds;
+ Vector<Bond> visiblebonds;
void setupBonds()
{
seqColoursReady = false;
// Sort the bonds by z coord
- visiblebonds = new Vector();
+ visiblebonds = new Vector<Bond>();
for (int ii = 0; ii < pdb.chains.size(); ii++)
{
- if (((PDBChain) pdb.chains.elementAt(ii)).isVisible)
+ if (pdb.chains.elementAt(ii).isVisible)
{
- Vector tmp = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
+ Vector<Bond> tmp = pdb.chains.elementAt(ii).bonds;
for (int i = 0; i < tmp.size(); i++)
{
@@ -303,14 +322,12 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
for (int ii = 0; ii < pdb.chains.size(); ii++)
{
- if (((PDBChain) pdb.chains.elementAt(ii)).isVisible)
+ if (pdb.chains.elementAt(ii).isVisible)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
+ Vector<Bond> bonds = pdb.chains.elementAt(ii).bonds;
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond tmp : bonds)
{
- Bond tmp = (Bond) bonds.elementAt(i);
-
if (tmp.start[0] >= max[0])
{
max[0] = tmp.start[0];
@@ -374,9 +391,9 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
}
}
- width[0] = (float) Math.abs(max[0] - min[0]);
- width[1] = (float) Math.abs(max[1] - min[1]);
- width[2] = (float) Math.abs(max[2] - min[2]);
+ width[0] = Math.abs(max[0] - min[0]);
+ width[1] = Math.abs(max[1] - min[1]);
+ width[2] = Math.abs(max[2] - min[2]);
maxwidth = width[0];
@@ -433,22 +450,17 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
// Find centre coordinate
for (int ii = 0; ii < pdb.chains.size(); ii++)
{
- if (((PDBChain) pdb.chains.elementAt(ii)).isVisible)
+ if (pdb.chains.elementAt(ii).isVisible)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
+ Vector<Bond> bonds = pdb.chains.elementAt(ii).bonds;
bsize += bonds.size();
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond b : bonds)
{
- xtot = xtot + ((Bond) bonds.elementAt(i)).start[0]
- + ((Bond) bonds.elementAt(i)).end[0];
-
- ytot = ytot + ((Bond) bonds.elementAt(i)).start[1]
- + ((Bond) bonds.elementAt(i)).end[1];
-
- ztot = ztot + ((Bond) bonds.elementAt(i)).start[2]
- + ((Bond) bonds.elementAt(i)).end[2];
+ xtot = xtot + b.start[0] + b.end[0];
+ ytot = ytot + b.start[1] + b.end[1];
+ ztot = ztot + b.start[2] + b.end[2];
}
}
}
@@ -467,7 +479,9 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
g.fillRect(0, 0, getSize().width, getSize().height);
g.setColor(Color.black);
g.setFont(new Font("Verdana", Font.BOLD, 14));
- g.drawString("Error loading PDB data!!", 50, getSize().height / 2);
+ g.drawString(
+ MessageManager.getString("label.error_loading_pdb_data"), 50,
+ getSize().height / 2);
return;
}
@@ -475,7 +489,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
{
g.setColor(Color.black);
g.setFont(new Font("Verdana", Font.BOLD, 14));
- g.drawString("Fetching PDB data...", 50, getSize().height / 2);
+ g.drawString(MessageManager.getString("label.fetching_pdb_data"), 50,
+ getSize().height / 2);
return;
}
@@ -542,7 +557,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
StructureMapping[] mapping = ssm.getMapping(pdbentry.getFile());
boolean showFeatures = false;
- if (ap.av.getShowSequenceFeatures())
+ if (ap.av.isShowSequenceFeatures())
{
if (fr == null)
{
@@ -559,11 +574,11 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
{
for (int ii = 0; ii < pdb.chains.size(); ii++)
{
- chain = (PDBChain) pdb.chains.elementAt(ii);
+ chain = pdb.chains.elementAt(ii);
for (int i = 0; i < chain.bonds.size(); i++)
{
- Bond tmp = (Bond) chain.bonds.elementAt(i);
+ Bond tmp = chain.bonds.elementAt(i);
tmp.startCol = Color.lightGray;
tmp.endCol = Color.lightGray;
if (chain != mainchain)
@@ -619,13 +634,13 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
zsort = new Zsort();
}
- zsort.Zsort(visiblebonds);
+ zsort.sort(visiblebonds);
}
Bond tmpBond = null;
for (int i = 0; i < visiblebonds.size(); i++)
{
- tmpBond = (Bond) visiblebonds.elementAt(i);
+ tmpBond = visiblebonds.elementAt(i);
xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getSize().width / 2));
ystart = (int) (((centre[1] - tmpBond.start[1]) * scale) + (getSize().height / 2));
@@ -771,23 +786,25 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
repaint();
if (foundchain != -1)
{
- PDBChain chain = (PDBChain) pdb.chains.elementAt(foundchain);
+ PDBChain chain = pdb.chains.elementAt(foundchain);
if (chain == mainchain)
{
if (fatom.alignmentMapping != -1)
{
if (highlightRes == null)
{
- highlightRes = new Vector();
+ highlightRes = new Vector<String>();
}
- if (highlightRes.contains(fatom.alignmentMapping + "" + ""))
+ final String atomString = Integer
+ .toString(fatom.alignmentMapping);
+ if (highlightRes.contains(atomString))
{
- highlightRes.removeElement(fatom.alignmentMapping + "");
+ highlightRes.removeElement(atomString);
}
else
{
- highlightRes.addElement(fatom.alignmentMapping + "");
+ highlightRes.addElement(atomString);
}
}
}
@@ -817,7 +834,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
PDBChain chain = null;
if (foundchain != -1)
{
- chain = (PDBChain) pdb.chains.elementAt(foundchain);
+ chain = pdb.chains.elementAt(foundchain);
if (chain == mainchain)
{
mouseOverStructure(fatom.resNumber, chain.id);
@@ -867,23 +884,19 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
if ((evt.getModifiers() & Event.META_MASK) != 0)
{
- objmat.rotatez((float) ((mx - omx)));
+ objmat.rotatez(((mx - omx)));
}
else
{
- objmat.rotatex((float) ((omy - my)));
- objmat.rotatey((float) ((omx - mx)));
+ objmat.rotatex(((omy - my)));
+ objmat.rotatey(((omx - mx)));
}
// Alter the bonds
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond tmpBond : chain.bonds)
{
- Bond tmpBond = (Bond) bonds.elementAt(i);
-
// Translate the bond so the centre is 0,0,0
tmpBond.translate(-centre[0], -centre[1], -centre[2]);
@@ -917,18 +930,12 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
void drawLabels(Graphics g)
{
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);
-
if (chain.isVisible)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond tmpBond : chain.bonds)
{
- Bond tmpBond = (Bond) bonds.elementAt(i);
-
if (tmpBond.at1.isSelected)
{
labelAtom(g, tmpBond, 1);
@@ -936,7 +943,6 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
if (tmpBond.at2.isSelected)
{
-
labelAtom(g, tmpBond, 2);
}
}
@@ -977,17 +983,17 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
for (int ii = 0; ii < pdb.chains.size(); ii++)
{
- PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);
+ PDBChain chain = pdb.chains.elementAt(ii);
int truex;
Bond tmpBond = null;
if (chain.isVisible)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
+ Vector<Bond> bonds = pdb.chains.elementAt(ii).bonds;
for (int i = 0; i < bonds.size(); i++)
{
- tmpBond = (Bond) bonds.elementAt(i);
+ tmpBond = bonds.elementAt(i);
truex = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getSize().width / 2));
@@ -1024,7 +1030,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
if (fatom != null) // )&& chain.ds != null)
{
- chain = (PDBChain) pdb.chains.elementAt(foundchain);
+ chain = pdb.chains.elementAt(foundchain);
}
}
@@ -1052,7 +1058,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
Bond tmpBond;
for (index = 0; index < mainchain.bonds.size(); index++)
{
- tmpBond = (Bond) mainchain.bonds.elementAt(index);
+ tmpBond = mainchain.bonds.elementAt(index);
if (tmpBond.at1.alignmentMapping == ii - 1)
{
if (highlightBond1 != null)
@@ -1070,13 +1076,13 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
if (index > 0)
{
- highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);
+ highlightBond1 = mainchain.bonds.elementAt(index - 1);
highlightBond1.at2.isSelected = true;
}
if (index != mainchain.bonds.size())
{
- highlightBond2 = (Bond) mainchain.bonds.elementAt(index);
+ highlightBond2 = mainchain.bonds.elementAt(index);
highlightBond2.at1.isSelected = true;
}
@@ -1092,7 +1098,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
{
for (int ii = 0; ii < pdb.chains.size(); ii++)
{
- PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);
+ PDBChain chain = pdb.chains.elementAt(ii);
chain.isVisible = b;
}
mainchain.isVisible = true;
@@ -1104,8 +1110,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
// /StructureListener
public String[] getPdbFile()
{
- return new String[]
- { pdbentry.getFile() };
+ return new String[] { pdbentry.getFile() };
}
String lastMessage;
@@ -1113,7 +1118,9 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
public void mouseOverStructure(int pdbResNum, String chain)
{
if (lastMessage == null || !lastMessage.equals(pdbResNum + chain))
+ {
ssm.mouseOverStructure(pdbResNum, chain, pdbentry.getFile());
+ }
lastMessage = pdbResNum + chain;
}
@@ -1122,24 +1129,45 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
StringBuffer eval = new StringBuffer();
- public void highlightAtom(int atomIndex, int pdbResNum, String chain,
- String pdbfile)
+ /**
+ * Highlight the specified atoms in the structure.
+ *
+ * @param atoms
+ */
+ @Override
+ public void highlightAtoms(List<AtomSpec> atoms)
{
if (!seqColoursReady)
{
return;
}
-
- if (highlightRes != null && highlightRes.contains((atomIndex - 1) + ""))
+ for (AtomSpec atom : atoms)
{
- return;
+ int atomIndex = atom.getAtomIndex();
+
+ if (highlightRes != null
+ && highlightRes.contains((atomIndex - 1) + ""))
+ {
+ continue;
+ }
+
+ highlightAtom(atomIndex);
}
+ redrawneeded = true;
+ repaint();
+ }
+
+ /**
+ * @param atomIndex
+ */
+ protected void highlightAtom(int atomIndex)
+ {
int index = -1;
Bond tmpBond;
for (index = 0; index < mainchain.bonds.size(); index++)
{
- tmpBond = (Bond) mainchain.bonds.elementAt(index);
+ tmpBond = mainchain.bonds.elementAt(index);
if (tmpBond.at1.atomIndex == atomIndex)
{
if (highlightBond1 != null)
@@ -1157,22 +1185,19 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
if (index > 0)
{
- highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);
+ highlightBond1 = mainchain.bonds.elementAt(index - 1);
highlightBond1.at2.isSelected = true;
}
if (index != mainchain.bonds.size())
{
- highlightBond2 = (Bond) mainchain.bonds.elementAt(index);
+ highlightBond2 = mainchain.bonds.elementAt(index);
highlightBond2.at1.isSelected = true;
}
break;
}
}
-
- redrawneeded = true;
- repaint();
}
public Color getColour(int atomIndex, int pdbResNum, String chain,
@@ -1196,7 +1221,22 @@ public class AppletPDBCanvas extends Panel implements MouseListener,
public void releaseReferences(Object svl)
{
// TODO Auto-generated method stub
-
+
}
+ @Override
+ public boolean isListeningFor(SequenceI seq)
+ {
+ if (sequence != null)
+ {
+ for (SequenceI s : sequence)
+ {
+ if (s == seq)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/src/MCview/AppletPDBViewer.java b/src/MCview/AppletPDBViewer.java
index ae255e1..620d3b8 100644
--- a/src/MCview/AppletPDBViewer.java
+++ b/src/MCview/AppletPDBViewer.java
@@ -1,28 +1,49 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.appletgui.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.appletgui.AlignmentPanel;
+import jalview.appletgui.EmbmenuFrame;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.ZappoColourScheme;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.CheckboxGroup;
+import java.awt.CheckboxMenuItem;
+import java.awt.Frame;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
public class AppletPDBViewer extends EmbmenuFrame implements
ActionListener, ItemListener
@@ -60,8 +81,9 @@ public class AppletPDBViewer extends EmbmenuFrame implements
false, null);
Frame frame = new Frame();
frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "PDB - Sequence Mapping",
- 500, 600);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.pdb_sequence_mapping"), 500,
+ 600);
cap.setText(pdbcanvas.mappingDetails.toString());
}
@@ -146,42 +168,43 @@ public class AppletPDBViewer extends EmbmenuFrame implements
private void jbInit() throws Exception
{
setMenuBar(jMenuBar1);
- fileMenu.setLabel("File");
- coloursMenu.setLabel("Colours");
- mapping.setLabel("View Mapping");
+ fileMenu.setLabel(MessageManager.getString("action.file"));
+ coloursMenu.setLabel(MessageManager.getString("label.colours"));
+ mapping.setLabel(MessageManager.getString("label.view_mapping"));
mapping.addActionListener(this);
- wire.setLabel("Wireframe");
+ wire.setLabel(MessageManager.getString("label.wireframe"));
wire.addItemListener(this);
depth.setState(true);
- depth.setLabel("Depthcue");
+ depth.setLabel(MessageManager.getString("label.depthcue"));
depth.addItemListener(this);
zbuffer.setState(true);
- zbuffer.setLabel("Z Buffering");
+ zbuffer.setLabel(MessageManager.getString("label.z_buffering"));
zbuffer.addItemListener(this);
- charge.setLabel("Charge & Cysteine");
+ charge.setLabel(MessageManager.getString("label.charge_cysteine"));
charge.addActionListener(this);
- hydro.setLabel("Hydrophobicity");
+ hydro.setLabel(MessageManager.getString("label.hydrophobicity"));
hydro.addActionListener(this);
- chain.setLabel("By Chain");
+ chain.setLabel(MessageManager.getString("action.by_chain"));
chain.addActionListener(this);
- seqButton.setLabel("By Sequence");
+ seqButton.setLabel(MessageManager.getString("action.by_sequence"));
seqButton.addActionListener(this);
- allchains.setLabel("All Chains Visible");
+ allchains
+ .setLabel(MessageManager.getString("label.all_chains_visible"));
allchains.addItemListener(this);
- viewMenu.setLabel("View");
- zappo.setLabel("Zappo");
+ viewMenu.setLabel(MessageManager.getString("action.view"));
+ zappo.setLabel(MessageManager.getString("label.zappo"));
zappo.addActionListener(this);
- taylor.setLabel("Taylor");
+ taylor.setLabel(MessageManager.getString("label.taylor"));
taylor.addActionListener(this);
- helix.setLabel("Helix Propensity");
+ helix.setLabel(MessageManager.getString("label.helix_propensity"));
helix.addActionListener(this);
- strand.setLabel("Strand Propensity");
+ strand.setLabel(MessageManager.getString("label.strand_propensity"));
strand.addActionListener(this);
- turn.setLabel("Turn Propensity");
+ turn.setLabel(MessageManager.getString("label.turn_propensity"));
turn.addActionListener(this);
- buried.setLabel("Buried Index");
+ buried.setLabel(MessageManager.getString("label.buried_index"));
buried.addActionListener(this);
- user.setLabel("User Defined...");
+ user.setLabel(MessageManager.getString("action.user_defined"));
user.addActionListener(this);
jMenuBar1.add(fileMenu);
jMenuBar1.add(coloursMenu);
diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java
index 9ab7e09..b2fb5f5 100644
--- a/src/MCview/Atom.java
+++ b/src/MCview/Atom.java
@@ -1,23 +1,28 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.awt.*;
+import jalview.schemes.ResidueProperties;
+
+import java.awt.Color;
public class Atom
{
@@ -46,15 +51,19 @@ public class Atom
public String chain;
/**
- * this is a temporary value - designed to store the position in sequence that this atom corresponds to after aligning the chain to a SequenceI object. Do not rely on its value being correct when visualizing sequence colourings on the structure - use the StructureSelectionManager's mapping instead.
+ * this is a temporary value - designed to store the position in sequence that
+ * this atom corresponds to after aligning the chain to a SequenceI object. Do
+ * not rely on its value being correct when visualizing sequence colourings on
+ * the structure - use the StructureSelectionManager's mapping instead.
*/
public int alignmentMapping = -1;
public int atomIndex;
public float occupancy = 0;
-
+
public float tfactor = 0;
+
// need these if we ever want to export Atom data
// public boolean tfacset=true,occset=true;
public boolean isSelected = false;
@@ -66,30 +75,37 @@ public class Atom
name = str.substring(12, 15).trim();
resName = str.substring(17, 20);
+ // JAL-1828 treat MSE Selenomethionine as MET (etc)
+ resName = ResidueProperties.getCanonicalAminoAcid(resName);
chain = str.substring(21, 22);
resNumber = Integer.parseInt(str.substring(22, 26).trim());
resNumIns = str.substring(22, 27);
insCode = str.substring(26, 27).charAt(0);
- this.x = (float) (new Float(str.substring(30, 38).trim()).floatValue());
- this.y = (float) (new Float(str.substring(38, 46).trim()).floatValue());
- this.z = (float) (new Float(str.substring(47, 55).trim()).floatValue());
+ this.x = (new Float(str.substring(30, 38).trim()).floatValue());
+ this.y = (new Float(str.substring(38, 46).trim()).floatValue());
+ this.z = (new Float(str.substring(47, 55).trim()).floatValue());
// optional entries - see JAL-730
String tm = str.substring(54, 60).trim();
- if (tm.length()>0) {
- occupancy = (float) (new Float(tm)).floatValue();
- } else {
+ if (tm.length() > 0)
+ {
+ occupancy = (new Float(tm)).floatValue();
+ }
+ else
+ {
occupancy = 1f; // default occupancy
// see note above: occset=false;
}
tm = str.substring(60, 66).trim();
- if (tm.length()>0)
+ if (tm.length() > 0)
+ {
+ tfactor = (new Float(tm).floatValue());
+ }
+ else
{
- tfactor = (float) (new Float(tm).floatValue());
- } else {
tfactor = 1f;
- //see note above: tfacset=false;
+ // see note above: tfacset=false;
}
}
@@ -99,7 +115,4 @@ public class Atom
this.y = y;
this.z = z;
}
- // public void setColor(Color col) {
- // this.color = col;
- // }
}
diff --git a/src/MCview/Bond.java b/src/MCview/Bond.java
index 9d22b6a..9a8c614 100644
--- a/src/MCview/Bond.java
+++ b/src/MCview/Bond.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.awt.*;
+import java.awt.Color;
public class Bond
{
@@ -33,10 +36,10 @@ public class Bond
public Atom at2;
- public Bond(float[] start, float[] end, Atom at1, Atom at2)
+ public Bond(Atom at1, Atom at2)
{
- this.start = start;
- this.end = end;
+ this.start = new float[] { at1.x, at1.y, at1.z };
+ this.end = new float[] { at2.x, at2.y, at2.z };
this.startCol = at1.color;
this.endCol = at2.color;
this.at1 = at1;
@@ -67,13 +70,13 @@ public class Bond
public void translate(float x, float y, float z)
{
- start[0] = (start[0] + x);
- end[0] = (end[0] + x);
+ start[0] = start[0] + x;
+ end[0] = end[0] + x;
- start[1] = (start[1] + y);
- end[1] = (end[1] + y);
+ start[1] = start[1] + y;
+ end[1] = end[1] + y;
- start[2] = (start[2] + z);
- end[2] = (end[2] + z);
+ start[2] = start[2] + z;
+ end[2] = end[2] + z;
}
}
diff --git a/src/MCview/MCMatrix.java b/src/MCview/MCMatrix.java
index 298fcc4..e3ba289 100644
--- a/src/MCview/MCMatrix.java
+++ b/src/MCview/MCMatrix.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
diff --git a/src/MCview/PDBCanvas.java b/src/MCview/PDBCanvas.java
index fd1b764..fdd673b 100644
--- a/src/MCview/PDBCanvas.java
+++ b/src/MCview/PDBCanvas.java
@@ -1,34 +1,56 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.io.*;
-import java.util.*;
-
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignmentPanel;
+import jalview.gui.FeatureRenderer;
+import jalview.gui.SequenceRenderer;
+import jalview.structure.AtomSpec;
+import jalview.structure.StructureListener;
+import jalview.structure.StructureMapping;
+import jalview.structure.StructureSelectionManager;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Event;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
// JBPNote TODO: This class is quite noisy - needs proper log.info/log.debug
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
-import jalview.structure.*;
+import java.awt.Image;
+import java.awt.RenderingHints;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.JPanel;
+import javax.swing.ToolTipManager;
public class PDBCanvas extends JPanel implements MouseListener,
MouseMotionListener, StructureListener
@@ -101,13 +123,13 @@ public class PDBCanvas extends JPanel implements MouseListener,
PDBChain mainchain;
- Vector highlightRes;
+ Vector<String> highlightRes;
boolean pdbAction = false;
boolean seqColoursReady = false;
- jalview.gui.FeatureRenderer fr;
+ jalview.renderer.seqfeatures.FeatureRenderer fr;
Color backgroundColour = Color.black;
@@ -131,7 +153,9 @@ public class PDBCanvas extends JPanel implements MouseListener,
pdb = ssm.setMapping(seq, chains, pdbentry.getFile(), protocol);
if (protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
+ {
pdbentry.setFile("INLINE" + pdb.id);
+ }
} catch (Exception ex)
{
@@ -164,17 +188,15 @@ public class PDBCanvas extends JPanel implements MouseListener,
{
mappingDetails.append("\n\nPDB Sequence is :\nSequence = "
- + ((PDBChain) pdb.chains.elementAt(i)).sequence
- .getSequenceAsString());
+ + pdb.chains.elementAt(i).sequence.getSequenceAsString());
mappingDetails.append("\nNo of residues = "
- + ((PDBChain) pdb.chains.elementAt(i)).residues.size()
- + "\n\n");
+ + pdb.chains.elementAt(i).residues.size() + "\n\n");
// Now lets compare the sequences to get
// the start and end points.
// Align the sequence to the pdb
AlignSeq as = new AlignSeq(sequence,
- ((PDBChain) pdb.chains.elementAt(i)).sequence, "pep");
+ pdb.chains.elementAt(i).sequence, "pep");
as.calcScoreMatrix();
as.traceAlignment();
PrintStream ps = new PrintStream(System.out)
@@ -207,7 +229,7 @@ public class PDBCanvas extends JPanel implements MouseListener,
mappingDetails.append("\nSEQ start/end " + seqstart + " " + seqend);
}
- mainchain = (PDBChain) pdb.chains.elementAt(maxchain);
+ mainchain = pdb.chains.elementAt(maxchain);
mainchain.pdbstart = pdbstart;
mainchain.pdbend = pdbend;
@@ -241,23 +263,21 @@ public class PDBCanvas extends JPanel implements MouseListener,
ToolTipManager.sharedInstance().setDismissDelay(10000);
}
- Vector visiblebonds;
+ Vector<Bond> visiblebonds;
void setupBonds()
{
seqColoursReady = false;
// Sort the bonds by z coord
- visiblebonds = new Vector();
+ visiblebonds = new Vector<Bond>();
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- if (((PDBChain) pdb.chains.elementAt(ii)).isVisible)
+ if (chain.isVisible)
{
- Vector tmp = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
-
- for (int i = 0; i < tmp.size(); i++)
+ for (Bond bond : chain.bonds)
{
- visiblebonds.addElement(tmp.elementAt(i));
+ visiblebonds.addElement(bond);
}
}
}
@@ -281,16 +301,12 @@ public class PDBCanvas extends JPanel implements MouseListener,
min[1] = (float) 1e30;
min[2] = (float) 1e30;
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- if (((PDBChain) pdb.chains.elementAt(ii)).isVisible)
+ if (chain.isVisible)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond tmp : chain.bonds)
{
- Bond tmp = (Bond) bonds.elementAt(i);
-
if (tmp.start[0] >= max[0])
{
max[0] = tmp.start[0];
@@ -359,9 +375,9 @@ public class PDBCanvas extends JPanel implements MouseListener,
* System.out.println("zmax " + max[2] + " min " + min[2]);
*/
- width[0] = (float) Math.abs(max[0] - min[0]);
- width[1] = (float) Math.abs(max[1] - min[1]);
- width[2] = (float) Math.abs(max[2] - min[2]);
+ width[0] = Math.abs(max[0] - min[0]);
+ width[1] = Math.abs(max[1] - min[1]);
+ width[2] = Math.abs(max[2] - min[2]);
maxwidth = width[0];
@@ -416,24 +432,17 @@ public class PDBCanvas extends JPanel implements MouseListener,
int bsize = 0;
// Find centre coordinate
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- if (((PDBChain) pdb.chains.elementAt(ii)).isVisible)
+ if (chain.isVisible)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
+ bsize += chain.bonds.size();
- bsize += bonds.size();
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond bond : chain.bonds)
{
- xtot = xtot + ((Bond) bonds.elementAt(i)).start[0]
- + ((Bond) bonds.elementAt(i)).end[0];
-
- ytot = ytot + ((Bond) bonds.elementAt(i)).start[1]
- + ((Bond) bonds.elementAt(i)).end[1];
-
- ztot = ztot + ((Bond) bonds.elementAt(i)).start[2]
- + ((Bond) bonds.elementAt(i)).end[2];
+ xtot = xtot + bond.start[0] + bond.end[0];
+ ytot = ytot + bond.start[1] + bond.end[1];
+ ztot = ztot + bond.start[2] + bond.end[2];
}
}
}
@@ -517,7 +526,7 @@ public class PDBCanvas extends JPanel implements MouseListener,
StructureMapping[] mapping = ssm.getMapping(pdbentry.getFile());
boolean showFeatures = false;
- if (ap.av.getShowSequenceFeatures())
+ if (ap.av.isShowSequenceFeatures())
{
if (fr == null)
{
@@ -534,11 +543,11 @@ public class PDBCanvas extends JPanel implements MouseListener,
{
for (int ii = 0; ii < pdb.chains.size(); ii++)
{
- chain = (PDBChain) pdb.chains.elementAt(ii);
+ chain = pdb.chains.elementAt(ii);
for (int i = 0; i < chain.bonds.size(); i++)
{
- Bond tmp = (Bond) chain.bonds.elementAt(i);
+ Bond tmp = chain.bonds.elementAt(i);
tmp.startCol = Color.lightGray;
tmp.endCol = Color.lightGray;
if (chain != mainchain)
@@ -594,13 +603,13 @@ public class PDBCanvas extends JPanel implements MouseListener,
zsort = new Zsort();
}
- zsort.Zsort(visiblebonds);
+ zsort.sort(visiblebonds);
}
Bond tmpBond = null;
for (int i = 0; i < visiblebonds.size(); i++)
{
- tmpBond = (Bond) visiblebonds.elementAt(i);
+ tmpBond = visiblebonds.elementAt(i);
xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getWidth() / 2));
ystart = (int) (((centre[1] - tmpBond.start[1]) * scale) + (getHeight() / 2));
@@ -748,23 +757,25 @@ public class PDBCanvas extends JPanel implements MouseListener,
repaint();
if (foundchain != -1)
{
- PDBChain chain = (PDBChain) pdb.chains.elementAt(foundchain);
+ PDBChain chain = pdb.chains.elementAt(foundchain);
if (chain == mainchain)
{
if (fatom.alignmentMapping != -1)
{
if (highlightRes == null)
{
- highlightRes = new Vector();
+ highlightRes = new Vector<String>();
}
- if (highlightRes.contains(fatom.alignmentMapping + ""))
+ final String atomString = Integer
+ .toString(fatom.alignmentMapping);
+ if (highlightRes.contains(atomString))
{
- highlightRes.remove(fatom.alignmentMapping + "");
+ highlightRes.remove(atomString);
}
else
{
- highlightRes.add(fatom.alignmentMapping + "");
+ highlightRes.add(atomString);
}
}
}
@@ -794,7 +805,7 @@ public class PDBCanvas extends JPanel implements MouseListener,
PDBChain chain = null;
if (foundchain != -1)
{
- chain = (PDBChain) pdb.chains.elementAt(foundchain);
+ chain = pdb.chains.elementAt(foundchain);
if (chain == mainchain)
{
mouseOverStructure(fatom.resNumber, chain.id);
@@ -837,23 +848,19 @@ public class PDBCanvas extends JPanel implements MouseListener,
if ((evt.getModifiers() & Event.META_MASK) != 0)
{
- objmat.rotatez((float) ((mx - omx)));
+ objmat.rotatez(((mx - omx)));
}
else
{
- objmat.rotatex((float) ((my - omy)));
- objmat.rotatey((float) ((omx - mx)));
+ objmat.rotatex(((my - omy)));
+ objmat.rotatey(((omx - mx)));
}
// Alter the bonds
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond tmpBond : chain.bonds)
{
- Bond tmpBond = (Bond) bonds.elementAt(i);
-
// Translate the bond so the centre is 0,0,0
tmpBond.translate(-centre[0], -centre[1], -centre[2]);
@@ -887,18 +894,12 @@ public class PDBCanvas extends JPanel implements MouseListener,
void drawLabels(Graphics g)
{
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (PDBChain chain : pdb.chains)
{
- PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);
-
if (chain.isVisible)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond tmpBond : chain.bonds)
{
- Bond tmpBond = (Bond) bonds.elementAt(i);
-
if (tmpBond.at1.isSelected)
{
labelAtom(g, tmpBond, 1);
@@ -906,7 +907,6 @@ public class PDBCanvas extends JPanel implements MouseListener,
if (tmpBond.at2.isSelected)
{
-
labelAtom(g, tmpBond, 2);
}
}
@@ -945,17 +945,15 @@ public class PDBCanvas extends JPanel implements MouseListener,
for (int ii = 0; ii < pdb.chains.size(); ii++)
{
- PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);
+ PDBChain chain = pdb.chains.elementAt(ii);
int truex;
Bond tmpBond = null;
if (chain.isVisible)
{
- Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;
-
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond bond : chain.bonds)
{
- tmpBond = (Bond) bonds.elementAt(i);
+ tmpBond = bond;
truex = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getWidth() / 2));
@@ -991,8 +989,8 @@ public class PDBCanvas extends JPanel implements MouseListener,
}
if (fatom != null) // )&& chain.ds != null)
- {
- chain = (PDBChain) pdb.chains.elementAt(foundchain);
+ { // dead code? value of chain is either overwritten or discarded
+ chain = pdb.chains.elementAt(foundchain);
}
}
@@ -1017,7 +1015,7 @@ public class PDBCanvas extends JPanel implements MouseListener,
Bond tmpBond;
for (index = 0; index < mainchain.bonds.size(); index++)
{
- tmpBond = (Bond) mainchain.bonds.elementAt(index);
+ tmpBond = mainchain.bonds.elementAt(index);
if (tmpBond.at1.alignmentMapping == ii - 1)
{
if (highlightBond1 != null)
@@ -1035,13 +1033,13 @@ public class PDBCanvas extends JPanel implements MouseListener,
if (index > 0)
{
- highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);
+ highlightBond1 = mainchain.bonds.elementAt(index - 1);
highlightBond1.at2.isSelected = true;
}
if (index != mainchain.bonds.size())
{
- highlightBond2 = (Bond) mainchain.bonds.elementAt(index);
+ highlightBond2 = mainchain.bonds.elementAt(index);
highlightBond2.at1.isSelected = true;
}
@@ -1057,7 +1055,7 @@ public class PDBCanvas extends JPanel implements MouseListener,
{
for (int ii = 0; ii < pdb.chains.size(); ii++)
{
- PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);
+ PDBChain chain = pdb.chains.elementAt(ii);
chain.isVisible = b;
}
mainchain.isVisible = true;
@@ -1069,8 +1067,7 @@ public class PDBCanvas extends JPanel implements MouseListener,
// /StructureListener
public String[] getPdbFile()
{
- return new String[]
- { pdbentry.getFile() };
+ return new String[] { pdbentry.getFile() };
}
String lastMessage;
@@ -1078,7 +1075,9 @@ public class PDBCanvas extends JPanel implements MouseListener,
public void mouseOverStructure(int pdbResNum, String chain)
{
if (lastMessage == null || !lastMessage.equals(pdbResNum + chain))
+ {
ssm.mouseOverStructure(pdbResNum, chain, pdbentry.getFile());
+ }
lastMessage = pdbResNum + chain;
}
@@ -1087,24 +1086,47 @@ public class PDBCanvas extends JPanel implements MouseListener,
StringBuffer eval = new StringBuffer();
- public void highlightAtom(int atomIndex, int pdbResNum, String chain,
- String pdbfile)
+ /**
+ * Highlight the specified atoms in the structure.
+ *
+ * @param atoms
+ */
+ @Override
+ public void highlightAtoms(List<AtomSpec> atoms)
{
if (!seqColoursReady)
{
return;
}
- if (highlightRes != null && highlightRes.contains((atomIndex - 1) + ""))
+ for (AtomSpec atom : atoms)
{
- return;
+ int atomIndex = atom.getAtomIndex();
+ if (highlightRes != null
+ && highlightRes.contains((atomIndex - 1) + ""))
+ {
+ continue;
+ }
+
+ highlightAtom(atomIndex);
}
+ redrawneeded = true;
+ repaint();
+ }
+
+ /**
+ * Highlight the atom at the specified index.
+ *
+ * @param atomIndex
+ */
+ protected void highlightAtom(int atomIndex)
+ {
int index = -1;
Bond tmpBond;
for (index = 0; index < mainchain.bonds.size(); index++)
{
- tmpBond = (Bond) mainchain.bonds.elementAt(index);
+ tmpBond = mainchain.bonds.elementAt(index);
if (tmpBond.at1.atomIndex == atomIndex)
{
if (highlightBond1 != null)
@@ -1122,22 +1144,19 @@ public class PDBCanvas extends JPanel implements MouseListener,
if (index > 0)
{
- highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);
+ highlightBond1 = mainchain.bonds.elementAt(index - 1);
highlightBond1.at2.isSelected = true;
}
if (index != mainchain.bonds.size())
{
- highlightBond2 = (Bond) mainchain.bonds.elementAt(index);
+ highlightBond2 = mainchain.bonds.elementAt(index);
highlightBond2.at1.isSelected = true;
}
break;
}
}
-
- redrawneeded = true;
- repaint();
}
public Color getColour(int atomIndex, int pdbResNum, String chain,
@@ -1161,7 +1180,22 @@ public class PDBCanvas extends JPanel implements MouseListener,
public void releaseReferences(Object svl)
{
// TODO Auto-generated method stub
-
+
}
+ @Override
+ public boolean isListeningFor(SequenceI seq)
+ {
+ if (sequence != null)
+ {
+ for (SequenceI s : sequence)
+ {
+ if (s == seq)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java
index 0004308..a6cd575 100644
--- a/src/MCview/PDBChain.java
+++ b/src/MCview/PDBChain.java
@@ -1,31 +1,40 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.util.*;
-
-import java.awt.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.Mapping;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
import jalview.structure.StructureMapping;
+import java.awt.Color;
+import java.util.List;
+import java.util.Vector;
+
public class PDBChain
{
/**
@@ -37,15 +46,24 @@ public class PDBChain
public String id;
- public Vector bonds = new Vector();
+ public Vector<Bond> bonds = new Vector<Bond>();
- public Vector atoms = new Vector();
+ public Vector<Atom> atoms = new Vector<Atom>();
- public Vector residues = new Vector();
+ public Vector<Residue> residues = new Vector<Residue>();
public int offset;
- public Sequence sequence;
+ /**
+ * sequence is the sequence extracted by the chain parsing code
+ */
+ public SequenceI sequence;
+
+ /**
+ * shadow is the sequence created by any other parsing processes (e.g. Jmol,
+ * RNAview)
+ */
+ public SequenceI shadow = null;
public boolean isNa = false;
@@ -72,6 +90,8 @@ public class PDBChain
*/
protected String newline = System.getProperty("line.separator");
+ public Mapping shadowMap;
+
public void setNewlineString(String nl)
{
newline = nl;
@@ -84,22 +104,22 @@ public class PDBChain
public String print()
{
- String tmp = "";
+ StringBuilder tmp = new StringBuilder(256);
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond b : bonds)
{
- tmp = tmp + ((Bond) bonds.elementAt(i)).at1.resName + " "
- + ((Bond) bonds.elementAt(i)).at1.resNumber + " " + offset
- + newline;
+ tmp.append(b.at1.resName).append(" ").append(b.at1.resNumber)
+ .append(" ").append(offset).append(newline);
}
- return tmp;
+ return tmp.toString();
}
/**
* Annotate the residues with their corresponding positions in s1 using the
- * alignment in as
- * NOTE: This clears all atom.alignmentMapping values on the structure.
+ * alignment in as NOTE: This clears all atom.alignmentMapping values on the
+ * structure.
+ *
* @param as
* @param s1
*/
@@ -108,8 +128,9 @@ public class PDBChain
int pdbpos = as.getSeq2Start() - 2;
int alignpos = s1.getStart() + as.getSeq1Start() - 3;
// first clear out any old alignmentMapping values:
- for (Atom atom: (Vector<Atom>) atoms) {
- atom.alignmentMapping=-1;
+ for (Atom atom : atoms)
+ {
+ atom.alignmentMapping = -1;
}
// and now trace the alignment onto the atom set.
for (int i = 0; i < as.astr1.length(); i++)
@@ -126,11 +147,9 @@ public class PDBChain
if (as.astr1.charAt(i) == as.astr2.charAt(i))
{
- Residue res = (Residue) residues.elementAt(pdbpos);
- Enumeration en = res.atoms.elements();
- while (en.hasMoreElements())
+ Residue res = residues.elementAt(pdbpos);
+ for (Atom atom : res.atoms)
{
- Atom atom = (Atom) en.nextElement();
atom.alignmentMapping = alignpos;
}
}
@@ -174,28 +193,35 @@ public class PDBChain
if (features[i].getFeatureGroup().equals(pdbid))
{
SequenceFeature tx = new SequenceFeature(features[i]);
- tx.setBegin(1 + ((Atom) ((Residue) residues.elementAt(tx.getBegin()
- - offset)).atoms.elementAt(0)).alignmentMapping);
- tx.setEnd(1 + ((Atom) ((Residue) residues.elementAt(tx.getEnd()
- - offset)).atoms.elementAt(0)).alignmentMapping);
+ tx.setBegin(1 + residues.elementAt(tx.getBegin() - offset).atoms
+ .elementAt(0).alignmentMapping);
+ tx.setEnd(1 + residues.elementAt(tx.getEnd() - offset).atoms
+ .elementAt(0).alignmentMapping);
tx.setStatus(status
+ ((tx.getStatus() == null || tx.getStatus().length() == 0) ? ""
: ":" + tx.getStatus()));
if (tx.begin != 0 && tx.end != 0)
+ {
sq.addSequenceFeature(tx);
+ }
}
}
return features;
}
+ /**
+ * Traverses the list of residues and constructs bonds where CA-to-CA atoms or
+ * P-to-P atoms are found. Also sets the 'isNa' flag if more than 99% of
+ * residues contain a P not a CA.
+ */
public void makeCaBondList()
{
boolean na = false;
int numNa = 0;
for (int i = 0; i < (residues.size() - 1); i++)
{
- Residue tmpres = (Residue) residues.elementAt(i);
- Residue tmpres2 = (Residue) residues.elementAt(i + 1);
+ Residue tmpres = residues.elementAt(i);
+ Residue tmpres2 = residues.elementAt(i + 1);
Atom at1 = tmpres.findAtom("CA");
Atom at2 = tmpres2.findAtom("CA");
na = false;
@@ -221,42 +247,57 @@ public class PDBChain
System.out.println("not found " + i);
}
}
- if (numNa > 0 && ((numNa / residues.size()) > 0.99))
+
+ /*
+ * If > 99% 'P', flag as nucleotide; note the count doesn't include the last
+ * residue
+ */
+ if (residues.size() > 0 && (numNa / (residues.size() - 1) > 0.99))
{
isNa = true;
}
}
+ /**
+ * Construct a bond from atom1 to atom2 and add it to the list of bonds for
+ * this chain
+ *
+ * @param at1
+ * @param at2
+ */
public void makeBond(Atom at1, Atom at2)
{
- float[] start = new float[3];
- float[] end = new float[3];
-
- start[0] = at1.x;
- start[1] = at1.y;
- start[2] = at1.z;
-
- end[0] = at2.x;
- end[1] = at2.y;
- end[2] = at2.z;
-
- bonds.addElement(new Bond(start, end, at1, at2));
+ bonds.addElement(new Bond(at1, at2));
}
- public void makeResidueList()
+ /**
+ * Traverses the list of atoms and
+ * <ul>
+ * <li>constructs a list of Residues, each containing all the atoms that share
+ * the same residue number</li>
+ * <li>adds a RESNUM sequence feature for each position</li>
+ * <li>creates the sequence string</li>
+ * <li>determines if nucleotide</li>
+ * <li>saves the residue number of the first atom as 'offset'</li>
+ * <li>adds temp factor annotation if the flag is set to do so</li>
+ * </ul>
+ *
+ * @param visibleChainAnnotation
+ */
+ public void makeResidueList(boolean visibleChainAnnotation)
{
int count = 0;
Object symbol;
- boolean deoxyn=false;
+ boolean deoxyn = false;
boolean nucleotide = false;
- StringBuffer seq = new StringBuffer();
- Vector resFeatures = new Vector();
- Vector resAnnotation = new Vector();
+ StringBuilder seq = new StringBuilder(256);
+ Vector<SequenceFeature> resFeatures = new Vector<SequenceFeature>();
+ Vector<Annotation> resAnnotation = new Vector<Annotation>();
int i, iSize = atoms.size() - 1;
int resNumber = -1;
for (i = 0; i <= iSize; i++)
{
- Atom tmp = (Atom) atoms.elementAt(i);
+ Atom tmp = atoms.elementAt(i);
resNumber = tmp.resNumber;
int res = resNumber;
@@ -265,17 +306,17 @@ public class PDBChain
offset = resNumber;
}
- Vector resAtoms = new Vector();
+ Vector<Atom> resAtoms = new Vector<Atom>();
// Add atoms to a vector while the residue number
// remains the same as the first atom's resNumber (res)
while ((resNumber == res) && (i < atoms.size()))
{
- resAtoms.addElement((Atom) atoms.elementAt(i));
+ resAtoms.add(atoms.elementAt(i));
i++;
if (i < atoms.size())
{
- resNumber = ((Atom) atoms.elementAt(i)).resNumber;
+ resNumber = atoms.elementAt(i).resNumber;
}
else
{
@@ -289,8 +330,8 @@ public class PDBChain
// Make a new Residue object with the new atoms vector
residues.addElement(new Residue(resAtoms, resNumber - 1, count));
- Residue tmpres = (Residue) residues.lastElement();
- Atom tmpat = (Atom) tmpres.atoms.elementAt(0);
+ Residue tmpres = residues.lastElement();
+ Atom tmpat = tmpres.atoms.get(0);
// Make A new SequenceFeature for the current residue numbering
SequenceFeature sf = new SequenceFeature("RESNUM", tmpat.resName
+ ":" + tmpat.resNumIns + " " + pdbid + id, "", offset
@@ -302,10 +343,13 @@ public class PDBChain
if ((symbol = ResidueProperties.getAA3Hash().get(tmpat.resName)) == null)
{
String nucname = tmpat.resName.trim();
- // use the aaIndex rather than call 'toLower' - which would take a bit more time.
- deoxyn=nucname.length()==2 && ResidueProperties.aaIndex[nucname.charAt(0)]==ResidueProperties.aaIndex['D'];
+ // use the aaIndex rather than call 'toLower' - which would take a bit
+ // more time.
+ deoxyn = nucname.length() == 2
+ && ResidueProperties.aaIndex[nucname.charAt(0)] == ResidueProperties.aaIndex['D'];
if (tmpat.name.equalsIgnoreCase("CA")
- || ResidueProperties.nucleotideIndex[nucname.charAt((deoxyn ? 1 : 0))] == -1)
+ || ResidueProperties.nucleotideIndex[nucname
+ .charAt((deoxyn ? 1 : 0))] == -1)
{
seq.append("X");
// System.err.println("PDBReader:Null aa3Hash for " +
@@ -346,102 +390,97 @@ public class PDBChain
// System.out.println("No of residues = " + residues.size());
for (i = 0, iSize = resFeatures.size(); i < iSize; i++)
{
- sequence.addSequenceFeature((SequenceFeature) resFeatures
- .elementAt(i));
+ sequence.addSequenceFeature(resFeatures.elementAt(i));
resFeatures.setElementAt(null, i);
}
- Annotation[] annots = new Annotation[resAnnotation.size()];
- float max = 0;
- for (i = 0, iSize = annots.length; i < iSize; i++)
+ if (visibleChainAnnotation)
{
- annots[i] = (Annotation) resAnnotation.elementAt(i);
- if (annots[i].value > max)
- max = annots[i].value;
- resAnnotation.setElementAt(null, i);
+ Annotation[] annots = new Annotation[resAnnotation.size()];
+ float max = 0;
+ for (i = 0, iSize = annots.length; i < iSize; i++)
+ {
+ annots[i] = resAnnotation.elementAt(i);
+ if (annots[i].value > max)
+ {
+ max = annots[i].value;
+ }
+ resAnnotation.setElementAt(null, i);
+ }
+
+ AlignmentAnnotation tfactorann = new AlignmentAnnotation(
+ "Temperature Factor", "Temperature Factor for " + pdbid + id,
+ annots, 0, max, AlignmentAnnotation.LINE_GRAPH);
+ tfactorann.setSequenceRef(sequence);
+ sequence.addAlignmentAnnotation(tfactorann);
}
- AlignmentAnnotation tfactorann = new AlignmentAnnotation(
- "PDB.TempFactor", "Temperature Factor for "
- + sequence.getName(), annots, 0, max,
- AlignmentAnnotation.LINE_GRAPH);
- tfactorann.setSequenceRef(sequence);
- sequence.addAlignmentAnnotation(tfactorann);
}
+ /**
+ * Colour start/end of bonds by charge
+ * <ul>
+ * <li>ASP and GLU red</li>
+ * <li>LYS and ARG blue</li>
+ * <li>CYS yellow</li>
+ * <li>others light gray</li>
+ * </ul>
+ */
public void setChargeColours()
{
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond b : bonds)
{
- try
+ if (b.at1 != null && b.at2 != null)
{
- Bond b = (Bond) bonds.elementAt(i);
-
- if (b.at1.resName.equalsIgnoreCase("ASP")
- || b.at1.resName.equalsIgnoreCase("GLU"))
- {
- b.startCol = Color.red;
- }
- else if (b.at1.resName.equalsIgnoreCase("LYS")
- || b.at1.resName.equalsIgnoreCase("ARG"))
- {
- b.startCol = Color.blue;
- }
- else if (b.at1.resName.equalsIgnoreCase("CYS"))
- {
- b.startCol = Color.yellow;
- }
- else
- {
- b.startCol = Color.lightGray;
- }
-
- if (b.at2.resName.equalsIgnoreCase("ASP")
- || b.at2.resName.equalsIgnoreCase("GLU"))
- {
- b.endCol = Color.red;
- }
- else if (b.at2.resName.equalsIgnoreCase("LYS")
- || b.at2.resName.equalsIgnoreCase("ARG"))
- {
- b.endCol = Color.blue;
- }
- else if (b.at2.resName.equalsIgnoreCase("CYS"))
- {
- b.endCol = Color.yellow;
- }
- else
- {
- b.endCol = Color.lightGray;
- }
- } catch (Exception e)
+ b.startCol = getChargeColour(b.at1.resName);
+ b.endCol = getChargeColour(b.at2.resName);
+ }
+ else
{
- Bond b = (Bond) bonds.elementAt(i);
b.startCol = Color.gray;
b.endCol = Color.gray;
}
}
}
- public void setChainColours(jalview.schemes.ColourSchemeI cs)
+ public static Color getChargeColour(String resName)
+ {
+ Color result = Color.lightGray;
+ if ("ASP".equals(resName) || "GLU".equals(resName))
+ {
+ result = Color.red;
+ }
+ else if ("LYS".equals(resName) || "ARG".equals(resName))
+ {
+ result = Color.blue;
+ }
+ else if ("CYS".equals(resName))
+ {
+ result = Color.yellow;
+ }
+ return result;
+ }
+
+ /**
+ * Sets the start/end colours of bonds to those of the start/end atoms
+ * according to the specified colour scheme. Note: currently only works for
+ * peptide residues.
+ *
+ * @param cs
+ */
+ public void setChainColours(ColourSchemeI cs)
{
- Bond b;
int index;
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond b : bonds)
{
try
{
- b = (Bond) bonds.elementAt(i);
-
- index = ((Integer) ResidueProperties.aa3Hash.get(b.at1.resName))
- .intValue();
+ index = ResidueProperties.aa3Hash.get(b.at1.resName).intValue();
b.startCol = cs.findColour(ResidueProperties.aa[index].charAt(0));
- index = ((Integer) ResidueProperties.aa3Hash.get(b.at2.resName))
- .intValue();
+ index = ResidueProperties.aa3Hash.get(b.at2.resName).intValue();
b.endCol = cs.findColour(ResidueProperties.aa[index].charAt(0));
} catch (Exception e)
{
- b = (Bond) bonds.elementAt(i);
b.startCol = Color.gray;
b.endCol = Color.gray;
}
@@ -450,65 +489,107 @@ public class PDBChain
public void setChainColours(Color col)
{
- for (int i = 0; i < bonds.size(); i++)
+ for (Bond b : bonds)
{
- Bond tmp = (Bond) bonds.elementAt(i);
- tmp.startCol = col;
- tmp.endCol = col;
+ b.startCol = col;
+ b.endCol = col;
}
}
- public AlignmentAnnotation[] transferResidueAnnotation(SequenceI seq,
- String status)
- {
- AlignmentAnnotation[] transferred = null;
-
- return transferred;
-
- }
-
/**
* copy any sequence annotation onto the sequence mapped using the provided
* StructureMapping
*
* @param mapping
+ * - positional mapping between destination sequence and pdb resnum
+ * @param sqmpping
+ * - mapping between destination sequence and local chain
*/
- public void transferResidueAnnotation(StructureMapping mapping)
+ public void transferResidueAnnotation(StructureMapping mapping,
+ jalview.datamodel.Mapping sqmpping)
{
SequenceI sq = mapping.getSequence();
+ SequenceI dsq = sq;
if (sq != null)
{
- if (sequence != null && sequence.getAnnotation() != null)
+ while (dsq.getDatasetSequence() != null)
{
-
+ dsq = dsq.getDatasetSequence();
}
- float min = -1, max = 0;
- Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1];
- for (int i = sq.getStart(), j = sq.getEnd(), k = 0; i <= j; i++, k++)
+ // any annotation will be transferred onto the dataset sequence
+
+ if (shadow != null && shadow.getAnnotation() != null)
{
- int prn = mapping.getPDBResNum(k + 1);
- an[k] = new Annotation((float) prn);
- if (min == -1)
+ for (AlignmentAnnotation ana : shadow.getAnnotation())
{
- min = k;
- max = k;
+ List<AlignmentAnnotation> transfer = sq.getAlignmentAnnotations(
+ ana.getCalcId(), ana.label);
+ if (transfer == null || transfer.size() == 0)
+ {
+ ana = new AlignmentAnnotation(ana);
+ ana.liftOver(sequence, shadowMap);
+ ana.liftOver(dsq, sqmpping);
+ dsq.addAlignmentAnnotation(ana);
+ }
+ else
+ {
+ continue;
+ }
}
- else
+ }
+ else
+ {
+ if (sequence != null && sequence.getAnnotation() != null)
{
- if (min > k)
+ for (AlignmentAnnotation ana : sequence.getAnnotation())
{
- min = k;
+ List<AlignmentAnnotation> transfer = sq
+ .getAlignmentAnnotations(ana.getCalcId(), ana.label);
+ if (transfer == null || transfer.size() == 0)
+ {
+ ana = new AlignmentAnnotation(ana);
+ ana.liftOver(dsq, sqmpping);
+ // mapping.transfer(ana);
+ }
+ else
+ {
+ continue;
+ }
}
- else if (max < k)
+ }
+ }
+ if (false)
+ {
+ // Useful for debugging mappings - adds annotation for mapped position
+ float min = -1, max = 0;
+ Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1];
+ for (int i = sq.getStart(), j = sq.getEnd(), k = 0; i <= j; i++, k++)
+ {
+ int prn = mapping.getPDBResNum(k + 1);
+
+ an[k] = new Annotation(prn);
+ if (min == -1)
{
+ min = k;
max = k;
}
+ else
+ {
+ if (min > k)
+ {
+ min = k;
+ }
+ else if (max < k)
+ {
+ max = k;
+ }
+ }
}
+ sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM",
+ "PDB Residue Numbering for " + this.pdbid + ":" + this.id,
+ an, min, max, AlignmentAnnotation.LINE_GRAPH));
}
- sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM",
- "PDB Residue Numbering for " + this.pdbid + ":" + this.id,
- an, (float) min, (float) max, AlignmentAnnotation.LINE_GRAPH));
}
}
}
diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java
index a5f050d..364a46e 100644
--- a/src/MCview/PDBViewer.java
+++ b/src/MCview/PDBViewer.java
@@ -1,34 +1,68 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.io.*;
-
-import java.awt.event.*;
-import javax.swing.*;
-
-import jalview.datamodel.*;
-import jalview.gui.*;
-import jalview.io.*;
-import jalview.schemes.*;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignmentPanel;
+import jalview.gui.Desktop;
+import jalview.gui.OOMWarning;
+import jalview.gui.UserDefinedColours;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.UserColourScheme;
+import jalview.schemes.ZappoColourScheme;
+import jalview.util.MessageManager;
import jalview.ws.ebi.EBIFetchClient;
-import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.PrintWriter;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JColorChooser;
+import javax.swing.JInternalFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.SwingUtilities;
public class PDBViewer extends JInternalFrame implements Runnable
{
@@ -52,7 +86,6 @@ public class PDBViewer extends JInternalFrame implements Runnable
public PDBViewer(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
AlignmentPanel ap, String protocol)
-
{
this.pdbentry = pdbentry;
this.seq = seq;
@@ -80,7 +113,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
try
{
tmpPDBFile = pdbentry.getFile();
- PDBfile pdbfile = new PDBfile(tmpPDBFile,
+ PDBfile pdbfile = new PDBfile(false, false, false, tmpPDBFile,
jalview.io.AppletFormatAdapter.FILE);
pdbcanvas.init(pdbentry, seq, chains, ap, protocol);
@@ -122,7 +155,9 @@ public class PDBViewer extends JInternalFrame implements Runnable
.getAbsolutePath());
if (pdbentry.getFile() != null)
+ {
pdbcanvas.init(pdbentry, seq, chains, ap, protocol);
+ }
} catch (Exception ex)
{
pdbcanvas.errorMessage = "Error retrieving file: " + pdbentry.getId();
@@ -141,10 +176,10 @@ public class PDBViewer extends JInternalFrame implements Runnable
});
this.setJMenuBar(jMenuBar1);
- fileMenu.setText("File");
- coloursMenu.setText("Colours");
- saveMenu.setActionCommand("Save Image");
- saveMenu.setText("Save As");
+ fileMenu.setText(MessageManager.getString("action.file"));
+ coloursMenu.setText(MessageManager.getString("label.colours"));
+ saveMenu.setActionCommand(MessageManager.getString("action.save_image"));
+ saveMenu.setText(MessageManager.getString("action.save_as"));
png.setText("PNG");
png.addActionListener(new ActionListener()
{
@@ -161,7 +196,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
eps_actionPerformed(e);
}
});
- mapping.setText("View Mapping");
+ mapping.setText(MessageManager.getString("label.view_mapping"));
mapping.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -169,7 +204,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
mapping_actionPerformed(e);
}
});
- wire.setText("Wireframe");
+ wire.setText(MessageManager.getString("label.wireframe"));
wire.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -178,7 +213,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
}
});
depth.setSelected(true);
- depth.setText("Depthcue");
+ depth.setText(MessageManager.getString("label.depthcue"));
depth.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -187,7 +222,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
}
});
zbuffer.setSelected(true);
- zbuffer.setText("Z Buffering");
+ zbuffer.setText(MessageManager.getString("label.z_buffering"));
zbuffer.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -195,7 +230,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
zbuffer_actionPerformed(e);
}
});
- charge.setText("Charge & Cysteine");
+ charge.setText(MessageManager.getString("label.charge_cysteine"));
charge.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -203,7 +238,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
charge_actionPerformed(e);
}
});
- chain.setText("By Chain");
+ chain.setText(MessageManager.getString("action.by_chain"));
chain.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -212,7 +247,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
}
});
seqButton.setSelected(true);
- seqButton.setText("By Sequence");
+ seqButton.setText(MessageManager.getString("action.by_sequence"));
seqButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -221,7 +256,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
}
});
allchains.setSelected(true);
- allchains.setText("Show All Chains");
+ allchains.setText(MessageManager.getString("label.show_all_chains"));
allchains.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent e)
@@ -229,7 +264,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
allchains_itemStateChanged(e);
}
});
- zappo.setText("Zappo");
+ zappo.setText(MessageManager.getString("label.zappo"));
zappo.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -237,7 +272,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
zappo_actionPerformed(e);
}
});
- taylor.setText("Taylor");
+ taylor.setText(MessageManager.getString("label.taylor"));
taylor.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -245,7 +280,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
taylor_actionPerformed(e);
}
});
- hydro.setText("Hydro");
+ hydro.setText(MessageManager.getString("label.hydrophobicity"));
hydro.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -253,7 +288,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
hydro_actionPerformed(e);
}
});
- helix.setText("Helix");
+ helix.setText(MessageManager.getString("label.helix_propensity"));
helix.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -261,7 +296,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
helix_actionPerformed(e);
}
});
- strand.setText("Strand");
+ strand.setText(MessageManager.getString("label.strand_propensity"));
strand.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -269,7 +304,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
strand_actionPerformed(e);
}
});
- turn.setText("Turn");
+ turn.setText(MessageManager.getString("label.turn_propensity"));
turn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -277,7 +312,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
turn_actionPerformed(e);
}
});
- buried.setText("Buried");
+ buried.setText(MessageManager.getString("label.buried_index"));
buried.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -285,7 +320,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
buried_actionPerformed(e);
}
});
- user.setText("User Defined...");
+ user.setText(MessageManager.getString("action.user_defined"));
user.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -293,8 +328,9 @@ public class PDBViewer extends JInternalFrame implements Runnable
user_actionPerformed(e);
}
});
- viewMenu.setText("View");
- background.setText("Background Colour...");
+ viewMenu.setText(MessageManager.getString("action.view"));
+ background
+ .setText(MessageManager.getString("action.background_colour"));
background.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -302,7 +338,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
background_actionPerformed(e);
}
});
- savePDB.setText("PDB File");
+ savePDB.setText(MessageManager.getString("label.pdb_file"));
savePDB.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -364,8 +400,10 @@ public class PDBViewer extends JInternalFrame implements Runnable
int option = JOptionPane.showInternalConfirmDialog(
jalview.gui.Desktop.desktop,
- "Remove from default list?",
- "Remove user defined colour",
+ MessageManager
+ .getString("label.remove_from_default_list"),
+ MessageManager
+ .getString("label.remove_user_defined_colour"),
JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION)
{
@@ -462,7 +500,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
*/
public void eps_actionPerformed(ActionEvent e)
{
- makePDBImage(jalview.util.ImageMaker.EPS);
+ makePDBImage(jalview.util.ImageMaker.TYPE.EPS);
}
/**
@@ -473,26 +511,34 @@ public class PDBViewer extends JInternalFrame implements Runnable
*/
public void png_actionPerformed(ActionEvent e)
{
- makePDBImage(jalview.util.ImageMaker.PNG);
+ makePDBImage(jalview.util.ImageMaker.TYPE.PNG);
}
- void makePDBImage(int type)
+ void makePDBImage(jalview.util.ImageMaker.TYPE type)
{
int width = pdbcanvas.getWidth();
int height = pdbcanvas.getHeight();
jalview.util.ImageMaker im;
- if (type == jalview.util.ImageMaker.PNG)
+ if (type == jalview.util.ImageMaker.TYPE.PNG)
+ {
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from view",
+ width, height, null, null);
+ }
+ else if (type == jalview.util.ImageMaker.TYPE.EPS)
{
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.PNG,
- "Make PNG image from view", width, height, null, null);
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from view",
+ width, height, null, this.getTitle());
}
else
{
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.EPS,
- "Make EPS file from view", width, height, null,
- this.getTitle());
+
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
+ width, height, null, this.getTitle());
}
if (im.getGraphics() != null)
@@ -566,7 +612,9 @@ public class PDBViewer extends JInternalFrame implements Runnable
try
{
cap.setText(pdbcanvas.mappingDetails.toString());
- Desktop.addInternalFrame(cap, "PDB - Sequence Mapping", 550, 600);
+ Desktop.addInternalFrame(cap,
+ MessageManager.getString("label.pdb_sequence_mapping"), 550,
+ 600);
} catch (OutOfMemoryError oom)
{
new OOMWarning("Opening sequence to structure mapping report", oom);
@@ -629,7 +677,8 @@ public class PDBViewer extends JInternalFrame implements Runnable
public void user_actionPerformed(ActionEvent e)
{
- if (e.getActionCommand().equals("User Defined..."))
+ if (e.getActionCommand().equals(
+ MessageManager.getString("action.user_defined")))
{
// new UserDefinedColours(pdbcanvas, null);
}
@@ -647,7 +696,8 @@ public class PDBViewer extends JInternalFrame implements Runnable
public void background_actionPerformed(ActionEvent e)
{
java.awt.Color col = JColorChooser.showDialog(this,
- "Select Background Colour", pdbcanvas.backgroundColour);
+ MessageManager.getString("label.select_backgroud_colour"),
+ pdbcanvas.backgroundColour);
if (col != null)
{
@@ -663,8 +713,8 @@ public class PDBViewer extends JInternalFrame implements Runnable
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save PDB File");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager.getString("label.save_pdb_file"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
@@ -685,6 +735,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
}
}
out.close();
+ in.close();
} catch (Exception ex)
{
ex.printStackTrace();
diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java
index 3f9bc9d..58f8ed5 100644
--- a/src/MCview/PDBfile.java
+++ b/src/MCview/PDBfile.java
@@ -1,49 +1,97 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.io.*;
-import java.util.*;
-
-import java.awt.*;
-
-import jalview.datamodel.*;
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
import jalview.io.FileParse;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
public class PDBfile extends jalview.io.AlignFile
{
- public Vector chains;
+ private static String CALC_ID_PREFIX = "JalviewPDB";
+
+ public Vector<PDBChain> chains;
public String id;
/**
- * set to true to add chain alignment annotation as visible annotation.
+ * set to true to add derived sequence annotations (temp factor read from
+ * file, or computed secondary structure) to the alignment
+ */
+ private boolean visibleChainAnnotation = false;
+
+ /*
+ * Set true to predict secondary structure (using JMol for protein, Annotate3D
+ * for RNA)
+ */
+ private boolean predictSecondaryStructure = true;
+
+ /*
+ * Set true (with predictSecondaryStructure=true) to predict secondary
+ * structure using an external service (currently Annotate3D for RNA only)
*/
- boolean VisibleChainAnnotation = false;
+ private boolean externalSecondaryStructure = false;
- public PDBfile(String inFile, String inType) throws IOException
+ public PDBfile(boolean addAlignmentAnnotations,
+ boolean predictSecondaryStructure, boolean externalSecStr)
{
- super(inFile, inType);
+ super();
+ this.visibleChainAnnotation = addAlignmentAnnotations;
+ this.predictSecondaryStructure = predictSecondaryStructure;
+ this.externalSecondaryStructure = externalSecStr;
}
- public PDBfile(FileParse source) throws IOException
+ public PDBfile(boolean addAlignmentAnnotations,
+ boolean predictSecondaryStructure, boolean externalSecStr,
+ String file, String protocol) throws IOException
{
- super(source);
+ super(false, file, protocol);
+ this.visibleChainAnnotation = addAlignmentAnnotations;
+ this.predictSecondaryStructure = predictSecondaryStructure;
+ this.externalSecondaryStructure = externalSecStr;
+ doParse();
+ }
+
+ public PDBfile(boolean addAlignmentAnnotations,
+ boolean predictSecondaryStructure, boolean externalSecStr,
+ FileParse source) throws IOException
+ {
+ super(false, source);
+ this.visibleChainAnnotation = addAlignmentAnnotations;
+ this.predictSecondaryStructure = predictSecondaryStructure;
+ this.externalSecondaryStructure = externalSecStr;
+ doParse();
}
public String print()
@@ -56,18 +104,19 @@ public class PDBfile extends jalview.io.AlignFile
// TODO set the filename sensibly - try using data source name.
id = safeName(getDataName());
- chains = new Vector();
-
- PDBChain tmpchain;
- String line=null;
- boolean modelFlag = false;
- boolean terFlag = false;
- String lastID = "";
+ chains = new Vector<PDBChain>();
+ List<SequenceI> rna = new ArrayList<SequenceI>();
+ List<SequenceI> prot = new ArrayList<SequenceI>();
+ PDBChain tmpchain;
+ String line = null;
+ boolean modelFlag = false;
+ boolean terFlag = false;
+ String lastID = "";
- int index = 0;
- String atomnam = null;
- try
- {
+ int indexx = 0;
+ String atomnam = null;
+ try
+ {
while ((line = nextLine()) != null)
{
if (line.indexOf("HEADER") == 0)
@@ -150,50 +199,283 @@ public class PDBfile extends jalview.io.AlignFile
{
id = inFile.getName();
}
- for (int i = 0; i < chains.size(); i++)
+ for (PDBChain chain : chains)
{
- SequenceI dataset = ((PDBChain) chains.elementAt(i)).sequence;
- dataset.setName(id + "|" + dataset.getName());
- PDBEntry entry = new PDBEntry();
- entry.setId(id);
- if (inFile != null)
+ SequenceI chainseq = postProcessChain(chain);
+ if (isRNA(chainseq))
{
- entry.setFile(inFile.getAbsolutePath());
+ rna.add(chainseq);
}
else
{
- // TODO: decide if we should dump the datasource to disk
- entry.setFile(getDataName());
+ prot.add(chainseq);
}
- dataset.addPDBId(entry);
- SequenceI chainseq = dataset.deriveSequence(); // PDBChain objects
- // maintain reference to
- // dataset
- seqs.addElement(chainseq);
- AlignmentAnnotation[] chainannot = chainseq.getAnnotation();
- if (chainannot != null)
+ }
+ if (predictSecondaryStructure)
+ {
+ predictSecondaryStructure(rna, prot);
+ }
+ } catch (OutOfMemoryError er)
+ {
+ System.out.println("OUT OF MEMORY LOADING PDB FILE");
+ throw new IOException(
+ MessageManager
+ .getString("exception.outofmemory_loading_pdb_file"));
+ } catch (NumberFormatException ex)
+ {
+ if (line != null)
+ {
+ System.err.println("Couldn't read number from line:");
+ System.err.println(line);
+ }
+ }
+ markCalcIds();
+ }
+
+ /**
+ * Predict secondary structure for RNA and/or protein sequences and add as
+ * annotations
+ *
+ * @param rnaSequences
+ * @param proteinSequences
+ */
+ protected void predictSecondaryStructure(List<SequenceI> rnaSequences,
+ List<SequenceI> proteinSequences)
+ {
+ /*
+ * Currently using Annotate3D for RNA, but only if the 'use external
+ * prediction' flag is set
+ */
+ if (externalSecondaryStructure && rnaSequences.size() > 0)
+ {
+ try
+ {
+ processPdbFileWithAnnotate3d(rnaSequences);
+ } catch (Exception x)
+ {
+ System.err.println("Exceptions when dealing with RNA in pdb file");
+ x.printStackTrace();
+
+ }
+ }
+
+ /*
+ * Currently using JMol PDB parser for peptide
+ */
+ if (proteinSequences.size() > 0)
+ {
+ try
+ {
+ processPdbFileWithJmol(proteinSequences);
+ } catch (Exception x)
+ {
+ System.err
+ .println("Exceptions from Jmol when processing data in pdb file");
+ x.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Process a parsed chain to construct and return a Sequence, and add it to
+ * the list of sequences parsed.
+ *
+ * @param chain
+ * @return
+ */
+ protected SequenceI postProcessChain(PDBChain chain)
+ {
+ SequenceI dataset = chain.sequence;
+ dataset.setName(id + "|" + dataset.getName());
+ PDBEntry entry = new PDBEntry();
+ entry.setId(id);
+ entry.setType(PDBEntry.Type.PDB);
+ entry.setProperty(new Hashtable());
+ if (chain.id != null)
+ {
+ // entry.getProperty().put("CHAIN", chains.elementAt(i).id);
+ entry.setChainCode(String.valueOf(chain.id));
+ }
+ if (inFile != null)
+ {
+ entry.setFile(inFile.getAbsolutePath());
+ }
+ else
+ {
+ // TODO: decide if we should dump the datasource to disk
+ entry.setFile(getDataName());
+ }
+ dataset.addPDBId(entry);
+ // PDBChain objects maintain reference to dataset
+ SequenceI chainseq = dataset.deriveSequence();
+ seqs.addElement(chainseq);
+
+ AlignmentAnnotation[] chainannot = chainseq.getAnnotation();
+
+ if (chainannot != null && visibleChainAnnotation)
+ {
+ for (int ai = 0; ai < chainannot.length; ai++)
+ {
+ chainannot[ai].visible = visibleChainAnnotation;
+ annotations.addElement(chainannot[ai]);
+ }
+ }
+ return chainseq;
+ }
+
+ public static boolean isCalcIdHandled(String calcId)
+ {
+ return calcId != null && (CALC_ID_PREFIX.equals(calcId));
+ }
+
+ public static boolean isCalcIdForFile(AlignmentAnnotation alan,
+ String pdbFile)
+ {
+ return alan.getCalcId() != null
+ && CALC_ID_PREFIX.equals(alan.getCalcId())
+ && pdbFile.equals(alan.getProperty("PDBID"));
+ }
+
+ public static String relocateCalcId(String calcId,
+ Hashtable<String, String> alreadyLoadedPDB) throws Exception
+ {
+ int s = CALC_ID_PREFIX.length(), end = calcId
+ .indexOf(CALC_ID_PREFIX, s);
+ String between = calcId.substring(s, end - 1);
+ return CALC_ID_PREFIX + alreadyLoadedPDB.get(between) + ":"
+ + calcId.substring(end);
+ }
+
+ private void markCalcIds()
+ {
+ for (SequenceI sq : seqs)
+ {
+ if (sq.getAnnotation() != null)
+ {
+ for (AlignmentAnnotation aa : sq.getAnnotation())
{
- for (int ai = 0; ai < chainannot.length; ai++)
+ String oldId = aa.getCalcId();
+ if (oldId == null)
{
- chainannot[ai].visible = VisibleChainAnnotation;
- annotations.addElement(chainannot[ai]);
+ oldId = "";
}
+ aa.setCalcId(CALC_ID_PREFIX);
+ aa.setProperty("PDBID", id);
+ aa.setProperty("oldCalcId", oldId);
}
}
- } catch (OutOfMemoryError er)
+ }
+ }
+
+ private void processPdbFileWithJmol(List<SequenceI> prot)
+ throws Exception
+ {
+ try
+ {
+ Class cl = Class.forName("jalview.ext.jmol.PDBFileWithJmol");
+ if (cl != null)
+ {
+ final Constructor constructor = cl
+ .getConstructor(new Class[] { FileParse.class });
+ final Object[] args = new Object[] { new FileParse(getDataName(),
+ type) };
+ Object jmf = constructor.newInstance(args);
+ AlignmentI al = new Alignment((SequenceI[]) cl.getMethod(
+ "getSeqsAsArray", new Class[] {}).invoke(jmf));
+ cl.getMethod("addAnnotations", new Class[] { AlignmentI.class })
+ .invoke(jmf, al);
+ for (SequenceI sq : al.getSequences())
+ {
+ if (sq.getDatasetSequence() != null)
+ {
+ sq.getDatasetSequence().getAllPDBEntries().clear();
+ }
+ else
+ {
+ sq.getAllPDBEntries().clear();
+ }
+ }
+ replaceAndUpdateChains(prot, al, AlignSeq.PEP, false);
+ }
+ } catch (ClassNotFoundException q)
{
- System.out.println("OUT OF MEMORY LOADING PDB FILE");
- throw new IOException("Out of memory loading PDB File");
}
- catch (NumberFormatException ex)
+ }
+
+ private void replaceAndUpdateChains(List<SequenceI> prot, AlignmentI al,
+ String pep, boolean b)
+ {
+ List<List<? extends Object>> replaced = AlignSeq
+ .replaceMatchingSeqsWith(seqs, annotations, prot, al, pep,
+ false);
+ for (PDBChain ch : chains)
{
- if (line!=null) {
- System.err.println("Couldn't read number from line:");
- System.err.println(line);
+ int p = 0;
+ for (SequenceI sq : (List<SequenceI>) replaced.get(0))
+ {
+ p++;
+ if (sq == ch.sequence || sq.getDatasetSequence() == ch.sequence)
+ {
+ p = -p;
+ break;
+ }
+ }
+ if (p < 0)
+ {
+ p = -p - 1;
+ // set shadow entry for chains
+ ch.shadow = (SequenceI) replaced.get(1).get(p);
+ ch.shadowMap = ((AlignSeq) replaced.get(2).get(p))
+ .getMappingFromS1(false);
}
}
}
+ private void processPdbFileWithAnnotate3d(List<SequenceI> rna)
+ throws Exception
+ {
+ // System.out.println("this is a PDB format and RNA sequence");
+ // note: we use reflection here so that the applet can compile and run
+ // without the HTTPClient bits and pieces needed for accessing Annotate3D
+ // web service
+ try
+ {
+ Class cl = Class.forName("jalview.ws.jws1.Annotate3D");
+ if (cl != null)
+ {
+ // TODO: use the PDB ID of the structure if one is available, to save
+ // bandwidth and avoid uploading the whole structure to the service
+ Object annotate3d = cl.getConstructor(new Class[] {}).newInstance(
+ new Object[] {});
+ AlignmentI al = ((AlignmentI) cl.getMethod("getRNAMLFor",
+ new Class[] { FileParse.class }).invoke(annotate3d,
+ new Object[] { new FileParse(getDataName(), type) }));
+ for (SequenceI sq : al.getSequences())
+ {
+ if (sq.getDatasetSequence() != null)
+ {
+ if (sq.getDatasetSequence().getAllPDBEntries() != null)
+ {
+ sq.getDatasetSequence().getAllPDBEntries().clear();
+ }
+ }
+ else
+ {
+ if (sq.getAllPDBEntries() != null)
+ {
+ sq.getAllPDBEntries().clear();
+ }
+ }
+ }
+ replaceAndUpdateChains(rna, al, AlignSeq.DNA, false);
+ }
+ } catch (ClassNotFoundException x)
+ {
+ // ignore classnotfounds - occurs in applet
+ }
+ ;
+ }
+
/**
* make a friendly ID string.
*
@@ -214,7 +496,7 @@ public class PDBfile extends jalview.io.AlignFile
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).makeResidueList();
+ chains.elementAt(i).makeResidueList(visibleChainAnnotation);
}
}
@@ -222,7 +504,7 @@ public class PDBfile extends jalview.io.AlignFile
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).makeCaBondList();
+ chains.elementAt(i).makeCaBondList();
}
}
@@ -230,9 +512,9 @@ public class PDBfile extends jalview.io.AlignFile
{
for (int i = 0; i < chains.size(); i++)
{
- if (((PDBChain) chains.elementAt(i)).id.equals(id))
+ if (chains.elementAt(i).id.equals(id))
{
- return (PDBChain) chains.elementAt(i);
+ return chains.elementAt(i);
}
}
@@ -243,7 +525,7 @@ public class PDBfile extends jalview.io.AlignFile
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).setChargeColours();
+ chains.elementAt(i).setChargeColours();
}
}
@@ -251,7 +533,7 @@ public class PDBfile extends jalview.io.AlignFile
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).setChainColours(cs);
+ chains.elementAt(i).setChainColours(cs);
}
}
@@ -259,8 +541,23 @@ public class PDBfile extends jalview.io.AlignFile
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).setChainColours(Color.getHSBColor(
- 1.0f / (float) i, .4f, 1.0f));
+ // divide by zero --> infinity --> 255 ;-)
+ chains.elementAt(i).setChainColours(
+ Color.getHSBColor(1.0f / i, .4f, 1.0f));
+ }
+ }
+
+ public static boolean isRNA(SequenceI seq)
+ {
+ for (char c : seq.getSequence())
+ {
+ if ((c != 'A') && (c != 'C') && (c != 'G') && (c != 'U'))
+ {
+ return false;
+ }
}
+
+ return true;
+
}
}
diff --git a/src/MCview/Residue.java b/src/MCview/Residue.java
index cb3d221..2b0159e 100644
--- a/src/MCview/Residue.java
+++ b/src/MCview/Residue.java
@@ -1,48 +1,49 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.util.*;
+import java.util.Vector;
public class Residue
{
- Vector atoms = new Vector();
+ Vector<Atom> atoms;
int number;
int count;
- int seqnumber;
-
- public Residue(Vector atoms, int number, int count)
+ public Residue(Vector<Atom> resAtoms, int number, int count)
{
- this.atoms = atoms;
+ this.atoms = resAtoms;
this.number = number;
this.count = count;
}
public Atom findAtom(String name)
{
- for (int i = 0; i < atoms.size(); i++)
+ for (Atom atom : atoms)
{
- if (((Atom) atoms.elementAt(i)).name.equals(name))
+ if (atom.name.equals(name))
{
- return (Atom) atoms.elementAt(i);
+ return atom;
}
}
diff --git a/src/MCview/Zsort.java b/src/MCview/Zsort.java
index fd2c210..e7121d3 100644
--- a/src/MCview/Zsort.java
+++ b/src/MCview/Zsort.java
@@ -1,32 +1,41 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
-import java.util.*;
+import java.util.Vector;
public class Zsort
{
- public void Zsort(Vector bonds)
+ /**
+ * Sorts the Bond list in ascending order of the z-value of the bond start
+ * atom
+ *
+ * @param bonds
+ */
+ public void sort(Vector<Bond> bonds)
{
sort(bonds, 0, bonds.size() - 1);
}
- public void sort(Vector bonds, int p, int r)
+ public void sort(Vector<Bond> bonds, int p, int r)
{
int q;
@@ -38,9 +47,9 @@ public class Zsort
}
}
- private int partition(Vector bonds, int p, int r)
+ private int partition(Vector<Bond> bonds, int p, int r)
{
- float x = ((Bond) bonds.elementAt(p)).start[2];
+ float x = bonds.elementAt(p).start[2];
int i = p - 1;
int j = r + 1;
Bond tmp;
@@ -49,17 +58,16 @@ public class Zsort
do
{
j--;
- } while ((j >= 0) && (((Bond) bonds.elementAt(j)).start[2] > x));
+ } while ((j >= 0) && (bonds.elementAt(j).start[2] > x));
do
{
i++;
- } while ((i < bonds.size())
- && (((Bond) bonds.elementAt(i)).start[2] < x));
+ } while ((i < bonds.size()) && (bonds.elementAt(i).start[2] < x));
if (i < j)
{
- tmp = (Bond) bonds.elementAt(i);
+ tmp = bonds.elementAt(i);
bonds.setElementAt(bonds.elementAt(j), i);
bonds.setElementAt(tmp, j);
}
diff --git a/src/com/github/reinert/jjschema/Attributes.java b/src/com/github/reinert/jjschema/Attributes.java
new file mode 100644
index 0000000..c3bd6c4
--- /dev/null
+++ b/src/com/github/reinert/jjschema/Attributes.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, Danilo Reinert (daniloreinert at growbit.com)
+ *
+ * This software is dual-licensed under:
+ *
+ * - the Lesser General Public License (LGPL) version 3.0 or, at your option, any
+ * later version;
+ * - the Apache Software License (ASL) version 2.0.
+ *
+ * The text of both licenses is available under the src/resources/ directory of
+ * this project (under the names LGPL-3.0.txt and ASL-2.0.txt respectively).
+ *
+ * Direct link to the sources:
+ *
+ * - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt
+ * - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
+ */
+
+package com.github.reinert.jjschema;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for the attributes of JSON Schema
+ *
+ * @author reinert
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ ElementType.METHOD, ElementType.FIELD, ElementType.TYPE })
+public @interface Attributes
+{
+ String $ref() default "";
+
+ String id() default "";
+
+ String title() default "";
+
+ String description() default "";
+
+ long maximum() default -1l;
+
+ boolean exclusiveMaximum() default false;
+
+ int minimum() default -1;
+
+ boolean exclusiveMinimum() default false;
+
+ String pattern() default "";
+
+ boolean required() default false;
+
+ String[] enums() default {};
+
+ int minItems() default 0;
+
+ long maxItems() default -1l;
+
+ boolean uniqueItems() default false;
+
+ int multipleOf() default 0;
+
+ int minLength() default 0;
+
+ long maxLength() default -1l;
+}
diff --git a/src/com/stevesoft/pat/Any.java b/src/com/stevesoft/pat/Any.java
index c97599c..dbaa961 100644
--- a/src/com/stevesoft/pat/Any.java
+++ b/src/com/stevesoft/pat/Any.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* This is the '.' character in a Pattern. It matches any character.
diff --git a/src/com/stevesoft/pat/BackG.java b/src/com/stevesoft/pat/BackG.java
index 69f7f61..166b58c 100644
--- a/src/com/stevesoft/pat/BackG.java
+++ b/src/com/stevesoft/pat/BackG.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/** This class represents the \G pattern element. */
class BackG extends Pattern
diff --git a/src/com/stevesoft/pat/BackMatch.java b/src/com/stevesoft/pat/BackMatch.java
index 1b166e9..1d7499e 100644
--- a/src/com/stevesoft/pat/BackMatch.java
+++ b/src/com/stevesoft/pat/BackMatch.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* Provides the ability to match a backreference from within a Pattern.
diff --git a/src/com/stevesoft/pat/Backup.java b/src/com/stevesoft/pat/Backup.java
index 1986460..6602aca 100644
--- a/src/com/stevesoft/pat/Backup.java
+++ b/src/com/stevesoft/pat/Backup.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* Implements the (?<number) Pattern, where number is an integer telling us
diff --git a/src/com/stevesoft/pat/Bits.java b/src/com/stevesoft/pat/Bits.java
index 05b3d34..b47f794 100644
--- a/src/com/stevesoft/pat/Bits.java
+++ b/src/com/stevesoft/pat/Bits.java
@@ -60,8 +60,8 @@ public class Bits
* StringWriter(); static PrintWriter pw_s = new PrintWriter(sw,true); public
* static void test(String var,Tester t) throws Exception {
*
- * char[] ca = new char[(66536 >> 4)+1]; Bits b = new Bits(ca); FileWriter fw =
- * new FileWriter("x.out",true); PrintWriter pw = new PrintWriter(fw);
+ * char[] ca = new char[(66536 >> 4)+1]; Bits b = new Bits(ca); FileWriter fw
+ * = new FileWriter("x.out",true); PrintWriter pw = new PrintWriter(fw);
*
* //pw_s.println(" "+var+"_f();"); pw.println(" public static Bits
* "+var+";"); pw.println(" static void "+var+"_f() {"); pw.println(" char[]
diff --git a/src/com/stevesoft/pat/Boundary.java b/src/com/stevesoft/pat/Boundary.java
index 566b20e..af79f66 100644
--- a/src/com/stevesoft/pat/Boundary.java
+++ b/src/com/stevesoft/pat/Boundary.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/** This class implements the word boundary pattern element: \b. */
class Boundary extends Pattern
diff --git a/src/com/stevesoft/pat/Bracket.java b/src/com/stevesoft/pat/Bracket.java
index cec8af4..adbcded 100644
--- a/src/com/stevesoft/pat/Bracket.java
+++ b/src/com/stevesoft/pat/Bracket.java
@@ -7,7 +7,8 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
+import java.util.Vector;
/**
* The Bracket is a form of the Or class, implements the pattern element [ ].
diff --git a/src/com/stevesoft/pat/Ctrl.java b/src/com/stevesoft/pat/Ctrl.java
index 5d40098..07b9d6d 100644
--- a/src/com/stevesoft/pat/Ctrl.java
+++ b/src/com/stevesoft/pat/Ctrl.java
@@ -9,53 +9,52 @@ com.stevesoft.pat;
public class Ctrl
{
- public final static char[] cmap =
- { (char) 64, (char) 65, (char) 66, (char) 67, (char) 68, (char) 69,
- (char) 70, (char) 71, (char) 72, (char) 73, (char) 74, (char) 75,
- (char) 76, (char) 77, (char) 78, (char) 79, (char) 80, (char) 81,
- (char) 82, (char) 83, (char) 84, (char) 85, (char) 86, (char) 87,
- (char) 88, (char) 89, (char) 90, (char) 91, (char) 92, (char) 93,
- (char) 94, (char) 95, (char) 96, (char) 97, (char) 97, (char) 99,
- (char) 100, (char) 101, (char) 102, (char) 103, (char) 104,
- (char) 105, (char) 106, (char) 107, (char) 108, (char) 109,
- (char) 110, (char) 111, (char) 112, (char) 113, (char) 114,
- (char) 115, (char) 116, (char) 117, (char) 118, (char) 119,
- (char) 120, (char) 121, (char) 122, (char) 123, (char) 124,
- (char) 125, (char) 126, (char) 127, (char) 0, (char) 1, (char) 2,
- (char) 3, (char) 4, (char) 5, (char) 6, (char) 7, (char) 8, (char) 9,
- (char) 10, (char) 11, (char) 12, (char) 13, (char) 14, (char) 15,
- (char) 16, (char) 17, (char) 18, (char) 19, (char) 20, (char) 21,
- (char) 22, (char) 23, (char) 24, (char) 25, (char) 26, (char) 27,
- (char) 27, (char) 29, (char) 30, (char) 31, (char) 32, (char) 1,
- (char) 2, (char) 3, (char) 4, (char) 5, (char) 6, (char) 7, (char) 8,
- (char) 9, (char) 10, (char) 11, (char) 12, (char) 13, (char) 14,
- (char) 15, (char) 16, (char) 17, (char) 18, (char) 19, (char) 20,
- (char) 21, (char) 22, (char) 23, (char) 24, (char) 25, (char) 26,
- (char) 59, (char) 60, (char) 61, (char) 62, (char) 63, (char) 192,
- (char) 193, (char) 194, (char) 195, (char) 196, (char) 197,
- (char) 198, (char) 199, (char) 200, (char) 201, (char) 202,
- (char) 203, (char) 204, (char) 205, (char) 206, (char) 207,
- (char) 208, (char) 209, (char) 210, (char) 211, (char) 212,
- (char) 213, (char) 214, (char) 215, (char) 216, (char) 217,
- (char) 218, (char) 219, (char) 220, (char) 221, (char) 222,
- (char) 223, (char) 224, (char) 225, (char) 226, (char) 227,
- (char) 228, (char) 229, (char) 230, (char) 231, (char) 232,
- (char) 233, (char) 234, (char) 235, (char) 236, (char) 237,
- (char) 238, (char) 239, (char) 240, (char) 241, (char) 242,
- (char) 243, (char) 244, (char) 245, (char) 246, (char) 247,
- (char) 248, (char) 249, (char) 250, (char) 251, (char) 252,
- (char) 253, (char) 254, (char) 255, (char) 128, (char) 129,
- (char) 130, (char) 131, (char) 132, (char) 133, (char) 134,
- (char) 135, (char) 136, (char) 137, (char) 138, (char) 139,
- (char) 140, (char) 141, (char) 142, (char) 143, (char) 144,
- (char) 145, (char) 146, (char) 147, (char) 148, (char) 149,
- (char) 150, (char) 151, (char) 152, (char) 153, (char) 154,
- (char) 155, (char) 156, (char) 157, (char) 158, (char) 159,
- (char) 160, (char) 161, (char) 162, (char) 163, (char) 164,
- (char) 165, (char) 166, (char) 167, (char) 168, (char) 169,
- (char) 170, (char) 171, (char) 172, (char) 173, (char) 174,
- (char) 175, (char) 176, (char) 177, (char) 178, (char) 179,
- (char) 180, (char) 181, (char) 182, (char) 183, (char) 184,
- (char) 185, (char) 186, (char) 187, (char) 188, (char) 189,
- (char) 190, (char) 191 };
+ public final static char[] cmap = { (char) 64, (char) 65, (char) 66,
+ (char) 67, (char) 68, (char) 69, (char) 70, (char) 71, (char) 72,
+ (char) 73, (char) 74, (char) 75, (char) 76, (char) 77, (char) 78,
+ (char) 79, (char) 80, (char) 81, (char) 82, (char) 83, (char) 84,
+ (char) 85, (char) 86, (char) 87, (char) 88, (char) 89, (char) 90,
+ (char) 91, (char) 92, (char) 93, (char) 94, (char) 95, (char) 96,
+ (char) 97, (char) 97, (char) 99, (char) 100, (char) 101, (char) 102,
+ (char) 103, (char) 104, (char) 105, (char) 106, (char) 107,
+ (char) 108, (char) 109, (char) 110, (char) 111, (char) 112,
+ (char) 113, (char) 114, (char) 115, (char) 116, (char) 117,
+ (char) 118, (char) 119, (char) 120, (char) 121, (char) 122,
+ (char) 123, (char) 124, (char) 125, (char) 126, (char) 127, (char) 0,
+ (char) 1, (char) 2, (char) 3, (char) 4, (char) 5, (char) 6, (char) 7,
+ (char) 8, (char) 9, (char) 10, (char) 11, (char) 12, (char) 13,
+ (char) 14, (char) 15, (char) 16, (char) 17, (char) 18, (char) 19,
+ (char) 20, (char) 21, (char) 22, (char) 23, (char) 24, (char) 25,
+ (char) 26, (char) 27, (char) 27, (char) 29, (char) 30, (char) 31,
+ (char) 32, (char) 1, (char) 2, (char) 3, (char) 4, (char) 5,
+ (char) 6, (char) 7, (char) 8, (char) 9, (char) 10, (char) 11,
+ (char) 12, (char) 13, (char) 14, (char) 15, (char) 16, (char) 17,
+ (char) 18, (char) 19, (char) 20, (char) 21, (char) 22, (char) 23,
+ (char) 24, (char) 25, (char) 26, (char) 59, (char) 60, (char) 61,
+ (char) 62, (char) 63, (char) 192, (char) 193, (char) 194, (char) 195,
+ (char) 196, (char) 197, (char) 198, (char) 199, (char) 200,
+ (char) 201, (char) 202, (char) 203, (char) 204, (char) 205,
+ (char) 206, (char) 207, (char) 208, (char) 209, (char) 210,
+ (char) 211, (char) 212, (char) 213, (char) 214, (char) 215,
+ (char) 216, (char) 217, (char) 218, (char) 219, (char) 220,
+ (char) 221, (char) 222, (char) 223, (char) 224, (char) 225,
+ (char) 226, (char) 227, (char) 228, (char) 229, (char) 230,
+ (char) 231, (char) 232, (char) 233, (char) 234, (char) 235,
+ (char) 236, (char) 237, (char) 238, (char) 239, (char) 240,
+ (char) 241, (char) 242, (char) 243, (char) 244, (char) 245,
+ (char) 246, (char) 247, (char) 248, (char) 249, (char) 250,
+ (char) 251, (char) 252, (char) 253, (char) 254, (char) 255,
+ (char) 128, (char) 129, (char) 130, (char) 131, (char) 132,
+ (char) 133, (char) 134, (char) 135, (char) 136, (char) 137,
+ (char) 138, (char) 139, (char) 140, (char) 141, (char) 142,
+ (char) 143, (char) 144, (char) 145, (char) 146, (char) 147,
+ (char) 148, (char) 149, (char) 150, (char) 151, (char) 152,
+ (char) 153, (char) 154, (char) 155, (char) 156, (char) 157,
+ (char) 158, (char) 159, (char) 160, (char) 161, (char) 162,
+ (char) 163, (char) 164, (char) 165, (char) 166, (char) 167,
+ (char) 168, (char) 169, (char) 170, (char) 171, (char) 172,
+ (char) 173, (char) 174, (char) 175, (char) 176, (char) 177,
+ (char) 178, (char) 179, (char) 180, (char) 181, (char) 182,
+ (char) 183, (char) 184, (char) 185, (char) 186, (char) 187,
+ (char) 188, (char) 189, (char) 190, (char) 191 };
}
diff --git a/src/com/stevesoft/pat/Custom.java b/src/com/stevesoft/pat/Custom.java
index 61879ac..3251fa3 100644
--- a/src/com/stevesoft/pat/Custom.java
+++ b/src/com/stevesoft/pat/Custom.java
@@ -7,13 +7,13 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* Simple custom patterns. See <a
* href="http://javaregex.com/code/deriv2.java.html">deriv2.java</a> and <a
- * href="http://javaregex.com/code/deriv3.java.html">deriv3.java</a> in the
- * test directory.
+ * href="http://javaregex.com/code/deriv3.java.html">deriv3.java</a> in the test
+ * directory.
*
* @see com.stevesoft.pat.CustomEndpoint
*/
diff --git a/src/com/stevesoft/pat/CustomEndpoint.java b/src/com/stevesoft/pat/CustomEndpoint.java
index 9608f7e..bf122b7 100644
--- a/src/com/stevesoft/pat/CustomEndpoint.java
+++ b/src/com/stevesoft/pat/CustomEndpoint.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* This class is needed internally to make backtracking work correctly in
diff --git a/src/com/stevesoft/pat/DotMulti.java b/src/com/stevesoft/pat/DotMulti.java
index cc5f094..7fd055b 100644
--- a/src/com/stevesoft/pat/DotMulti.java
+++ b/src/com/stevesoft/pat/DotMulti.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* A special optimization of multi that is used when the common subpattern ".*"
diff --git a/src/com/stevesoft/pat/End.java b/src/com/stevesoft/pat/End.java
index 547f3d6..06aadda 100644
--- a/src/com/stevesoft/pat/End.java
+++ b/src/com/stevesoft/pat/End.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
//class AddToEnd extends RegSyntax {};
diff --git a/src/com/stevesoft/pat/FastBracket.java b/src/com/stevesoft/pat/FastBracket.java
index a10ec2b..af1bc37 100644
--- a/src/com/stevesoft/pat/FastBracket.java
+++ b/src/com/stevesoft/pat/FastBracket.java
@@ -7,7 +7,8 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.BitSet;
+import java.util.Vector;
/**
* Uses table lookup to match [] type constructs, but only if it can use a
diff --git a/src/com/stevesoft/pat/FastMulti.java b/src/com/stevesoft/pat/FastMulti.java
index a8387b4..cad69ee 100644
--- a/src/com/stevesoft/pat/FastMulti.java
+++ b/src/com/stevesoft/pat/FastMulti.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* A special case of Multi, implemented when minChars().equals(maxChars()), and
diff --git a/src/com/stevesoft/pat/FileRegex.java b/src/com/stevesoft/pat/FileRegex.java
index 342d41c..fa57795 100644
--- a/src/com/stevesoft/pat/FileRegex.java
+++ b/src/com/stevesoft/pat/FileRegex.java
@@ -7,61 +7,65 @@
//
package com.stevesoft.pat;
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.util.StringTokenizer;
+import java.util.Vector;
/**
* This class is a different form of Regex designed to work more like the file
* matching utility of a Unix shell. It is implemented by some simple string
- * transformations: <center> <table border=1>
+ * transformations: <center>
+ * <table border=1>
* <tr>
- * <td> FileRegex </td>
- * <td> Regex </td>
+ * <td>FileRegex</td>
+ * <td>Regex</td>
* <tr>
- * <td> * </td>
- * <td> .* </td>
+ * <td>*</td>
+ * <td>.*</td>
* <tr>
- * <td> . </td>
- * <td> \. </td>
+ * <td>.</td>
+ * <td>\.</td>
* <tr>
- * <td> { </td>
- * <td> (?: </td>
+ * <td>{</td>
+ * <td>(?:</td>
* <tr>
- * <td> {?! </td>
- * <td> (?! </td>
+ * <td>{?!</td>
+ * <td>(?!</td>
* <tr>
- * <td> {?= </td>
- * <td> (?= </td>
+ * <td>{?=</td>
+ * <td>(?=</td>
* <tr>
- * <td> {?? </td>
- * <td> (?? </td>
+ * <td>{??</td>
+ * <td>(??</td>
* <tr>
- * <td> } </td>
- * <td> ) </td>
+ * <td></td>
+ * <td>)</td>
* <tr>
- * <td> ? </td>
- * <td> . </td>
+ * <td>?</td>
+ * <td>.</td>
* <tr>
- * <td> {,} </td>
- * <td> (|) </td>
- * </table> </center> Note that a FileRegex pattern always ends with the Regex
- * pattern element "$". If you like to experiment, try making FileRegex's and
- * then printing them out. The toString() method does a decompile of the pattern
- * to a standard Regex. Here are some more complete examples: <center> <table
- * border=3>
+ * <td>{,}</td>
+ * <td>(|)</td>
+ * </table>
+ * </center> Note that a FileRegex pattern always ends with the Regex pattern
+ * element "$". If you like to experiment, try making FileRegex's and then
+ * printing them out. The toString() method does a decompile of the pattern to a
+ * standard Regex. Here are some more complete examples: <center>
+ * <table * border=3>
* <tr>
- * <td> FileRegex </td>
- * <td> Regex </td>
+ * <td>FileRegex</td>
+ * <td>Regex</td>
* <tr>
- * <td>*.java </td>
- * <td> .*\.java$ </td>
+ * <td>*.java</td>
+ * <td>.*\.java$</td>
* <tr>
- * <td>*.{java,html} </td>
- * <td> .*\.(java|html)$ </td>
+ * <td>*.{java,html}</td>
+ * <td>.*\.(java|html)$</td>
* <tr>
- * <td> foo.[chC] </td>
- * <td> foo.[chC]$ </td>
- * </table> </center>
+ * <td>foo.[chC]</td>
+ * <td>foo.[chC]$</td>
+ * </table>
+ * </center>
*/
public class FileRegex extends Regex
{
@@ -82,8 +86,7 @@ public class FileRegex extends Regex
* Compile a new pattern. Throws
*
* @exception com.stevesoft.pat.RegSyntax
- * for nonsensical patterns like "[9-0]+" just as Regex
- * does.
+ * for nonsensical patterns like "[9-0]+" just as Regex does.
* @see com.stevesoft.pat#compile(java.lang.String)
*/
public void compile(String s) throws RegSyntax
diff --git a/src/com/stevesoft/pat/Group.java b/src/com/stevesoft/pat/Group.java
index e6f734c..22d9f81 100644
--- a/src/com/stevesoft/pat/Group.java
+++ b/src/com/stevesoft/pat/Group.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* This class implements the (?@<>) syntax that matches a balanced parenthesis.
diff --git a/src/com/stevesoft/pat/Multi.java b/src/com/stevesoft/pat/Multi.java
index 1fe197d..7798d12 100644
--- a/src/com/stevesoft/pat/Multi.java
+++ b/src/com/stevesoft/pat/Multi.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* Matches any number of instances of sub Pattern this was the hardest method to
@@ -38,11 +38,11 @@ class Multi extends PatternSub
/**
* @param a
- * The fewest number of times the sub pattern can match.
+ * The fewest number of times the sub pattern can match.
* @param b
- * The maximum number of times the sub pattern can match.
+ * The maximum number of times the sub pattern can match.
* @param p
- * The sub pattern.
+ * The sub pattern.
* @see Multi_stage2
* @see MultiMin
*/
diff --git a/src/com/stevesoft/pat/Multi_stage2.java b/src/com/stevesoft/pat/Multi_stage2.java
index b18ad1c..f5a54db 100644
--- a/src/com/stevesoft/pat/Multi_stage2.java
+++ b/src/com/stevesoft/pat/Multi_stage2.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* If Multi were not split into a second stage, then a nested Multi would try to
diff --git a/src/com/stevesoft/pat/NoPattern.java b/src/com/stevesoft/pat/NoPattern.java
index 444d094..37d6384 100644
--- a/src/com/stevesoft/pat/NoPattern.java
+++ b/src/com/stevesoft/pat/NoPattern.java
@@ -7,7 +7,7 @@ package //
//
com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* The idea behind this class is simply to eliminate the need for testing to see
diff --git a/src/com/stevesoft/pat/NullPattern.java b/src/com/stevesoft/pat/NullPattern.java
index 09460de..accd3f1 100644
--- a/src/com/stevesoft/pat/NullPattern.java
+++ b/src/com/stevesoft/pat/NullPattern.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* This pattern matches nothing -- it is found in patterns like (hello|world|)
diff --git a/src/com/stevesoft/pat/Or.java b/src/com/stevesoft/pat/Or.java
index 8d405e5..d5ee673 100644
--- a/src/com/stevesoft/pat/Or.java
+++ b/src/com/stevesoft/pat/Or.java
@@ -7,7 +7,8 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
+import java.util.Vector;
/**
* This class implements the (?: ... ) extended Pattern. It provides a base
diff --git a/src/com/stevesoft/pat/OrMark.java b/src/com/stevesoft/pat/OrMark.java
index 89b8869..ce1ecad 100644
--- a/src/com/stevesoft/pat/OrMark.java
+++ b/src/com/stevesoft/pat/OrMark.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/** Implements the parenthesis pattern subelement. */
class OrMark extends Or
diff --git a/src/com/stevesoft/pat/Pattern.java b/src/com/stevesoft/pat/Pattern.java
index 543391e..1bc74f8 100644
--- a/src/com/stevesoft/pat/Pattern.java
+++ b/src/com/stevesoft/pat/Pattern.java
@@ -7,7 +7,9 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import jalview.util.MessageManager;
+
+import java.util.Hashtable;
/**
Shareware: package pat
@@ -259,7 +261,9 @@ public abstract class Pattern
*/
Pattern clone1(Hashtable h)
{
- throw new Error("No such method as clone1 for " + getClass().getName());
+ throw new Error(MessageManager.formatMessage(
+ "error.no_such_method_as_clone1_for", new String[] { getClass()
+ .getName() }));
}
Pattern clone(Hashtable h)
@@ -272,7 +276,7 @@ public abstract class Pattern
p = clone1(h);
if (p == null)
{
- throw new Error("Null from clone1!");
+ throw new Error(MessageManager.getString("error.null_from_clone1"));
}
h.put(this, p);
h.put(p, p);
diff --git a/src/com/stevesoft/pat/Pthings.java b/src/com/stevesoft/pat/Pthings.java
index 69e8fed..8de2748 100644
--- a/src/com/stevesoft/pat/Pthings.java
+++ b/src/com/stevesoft/pat/Pthings.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.BitSet;
/**
* Things that need to be kept track of during a match. Passed along with
diff --git a/src/com/stevesoft/pat/PushRule.java b/src/com/stevesoft/pat/PushRule.java
index c9aee2b..dd1ac9c 100644
--- a/src/com/stevesoft/pat/PushRule.java
+++ b/src/com/stevesoft/pat/PushRule.java
@@ -9,9 +9,8 @@ package com.stevesoft.pat;
/**
* See the example file <a
- * href="http://javaregex.com/code/trans3.java.html">trans3.java</a> for
- * further examples of how this is used. You will probably not want to call it
- * directly.
+ * href="http://javaregex.com/code/trans3.java.html">trans3.java</a> for further
+ * examples of how this is used. You will probably not want to call it directly.
*/
public class PushRule extends SpecialRule
{
diff --git a/src/com/stevesoft/pat/Range.java b/src/com/stevesoft/pat/Range.java
index 610a4d5..02c5d3a 100644
--- a/src/com/stevesoft/pat/Range.java
+++ b/src/com/stevesoft/pat/Range.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/** Thrown when one encounters things like [z-a] */
class BadRangeArgs extends RegSyntax
diff --git a/src/com/stevesoft/pat/RegOpt.java b/src/com/stevesoft/pat/RegOpt.java
index 0d65139..50d799f 100644
--- a/src/com/stevesoft/pat/RegOpt.java
+++ b/src/com/stevesoft/pat/RegOpt.java
@@ -7,7 +7,9 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
/** This class is just like oneChar, but doesn't worry about case. */
class FastChar extends oneChar
diff --git a/src/com/stevesoft/pat/RegRes.java b/src/com/stevesoft/pat/RegRes.java
index a204c47..a963a17 100644
--- a/src/com/stevesoft/pat/RegRes.java
+++ b/src/com/stevesoft/pat/RegRes.java
@@ -47,9 +47,7 @@ public class RegRes implements Cloneable
for (int i = 0; i < numSubs(); i++)
{
int n = i + 1;
- sb
- .append(" sub(" + n + ")=" + matchedFrom(n) + ":"
- + charsMatched(n));
+ sb.append(" sub(" + n + ")=" + matchedFrom(n) + ":" + charsMatched(n));
}
return sb.toString();
}
diff --git a/src/com/stevesoft/pat/Regex.java b/src/com/stevesoft/pat/Regex.java
index 04bb0da..c00ddad 100644
--- a/src/com/stevesoft/pat/Regex.java
+++ b/src/com/stevesoft/pat/Regex.java
@@ -7,10 +7,14 @@
//
package com.stevesoft.pat;
-import java.io.*;
-import java.util.*;
+import jalview.util.MessageManager;
-import com.stevesoft.pat.wrap.*;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.BitSet;
+import java.util.Hashtable;
+
+import com.stevesoft.pat.wrap.StringWrap;
/** Matches a Unicode punctuation character. */
class UnicodePunct extends UniValidator
@@ -250,7 +254,9 @@ class UnicodeLower extends UniValidator
*
* <pre>
* \d+
- * </pre>, but note that the sequence
+ * </pre>
+ *
+ * , but note that the sequence
*
* <pre>
* (?e=#)
@@ -260,8 +266,8 @@ class UnicodeLower extends UniValidator
* small differences as well. I will either make my package conform or note them
* as I become aware of them.
* <p>
- * This package supports additional patterns not in perl5: <center> <table
- * border=1>
+ * This package supports additional patterns not in perl5: <center>
+ * <table * border=1>
* <tr>
* <td>(?@())</td>
* <td>Group</td>
@@ -275,8 +281,8 @@ class UnicodeLower extends UniValidator
* "look behind." It fails if it attempts to move to a position before the
* beginning of the string. "x(?<1)" is equivalent to "(?=x)". The number, 1
* in this example, is the number of characters to move backwards.</td>
- * </table> </center>
- * </dl>
+ * </table>
+ * </center> </dl>
*
* @author Steven R. Brandt
* @version package com.stevesoft.pat, release 1.5.3
@@ -625,9 +631,8 @@ public class Regex extends RegRes implements FilenameFilter
* search or matchAt methods.
*
* @exception com.stevesoft.pat.RegSyntax
- * is thrown if a syntax error is encountered in the
- * pattern. For example, "x{3,1}" or "*a" are not valid
- * patterns.
+ * is thrown if a syntax error is encountered in the pattern. For
+ * example, "x{3,1}" or "*a" are not valid patterns.
* @see com.stevesoft.pat.Regex#search
* @see com.stevesoft.pat.Regex#matchAt
*/
@@ -775,7 +780,9 @@ public class Regex extends RegRes implements FilenameFilter
{
if (s == null)
{
- throw new NullPointerException("Null String Given to Regex.search");
+ throw new NullPointerException(
+ MessageManager
+ .getString("exception.null_string_given_to_regex_search"));
}
return _search(s, 0, s.length());
}
@@ -785,7 +792,8 @@ public class Regex extends RegRes implements FilenameFilter
if (sl == null)
{
throw new NullPointerException(
- "Null StringLike Given to Regex.search");
+ MessageManager
+ .getString("exception.null_string_like_given_to_regex_search"));
}
return _search(sl, 0, sl.length());
}
@@ -795,7 +803,8 @@ public class Regex extends RegRes implements FilenameFilter
if (s == null)
{
throw new NullPointerException(
- "Null String Given to Regex.reverseSearch");
+ MessageManager
+ .getString("exception.null_string_given_to_regex_reverse_search"));
}
return _reverseSearch(s, 0, s.length());
}
@@ -805,7 +814,8 @@ public class Regex extends RegRes implements FilenameFilter
if (sl == null)
{
throw new NullPointerException(
- "Null StringLike Given to Regex.reverseSearch");
+ MessageManager
+ .getString("exception.null_string_like_given_to_regex_reverse_search"));
}
return _reverseSearch(sl, 0, sl.length());
}
@@ -823,7 +833,8 @@ public class Regex extends RegRes implements FilenameFilter
if (s == null)
{
throw new NullPointerException(
- "Null String Given to Regex.searchFrom");
+ MessageManager
+ .getString("exception.null_string_like_given_to_regex_search_from"));
}
return _search(s, start, s.length());
}
@@ -833,7 +844,8 @@ public class Regex extends RegRes implements FilenameFilter
if (s == null)
{
throw new NullPointerException(
- "Null String Given to Regex.searchFrom");
+ MessageManager
+ .getString("exception.null_string_like_given_to_regex_search_from"));
}
return _search(s, start, s.length());
}
@@ -846,7 +858,8 @@ public class Regex extends RegRes implements FilenameFilter
if (s == null)
{
throw new NullPointerException(
- "Null String Given to Regex.searchRegion");
+ MessageManager
+ .getString("exception.null_string_like_given_to_regex_search_region"));
}
return _search(s, start, end);
}
@@ -967,13 +980,13 @@ public class Regex extends RegRes implements FilenameFilter
* if(skipper == null) { for(long i=start;i<=up;i++) { charsMatched_ =
* thePattern.matchAt(s,i,pt); if(charsMatched_ >= 0) { matchFrom_ =
* thePattern.mfrom; marks = pt.marks; gFlagto = matchFrom_+charsMatched_;
- * return didMatch_=true; } } } else { pt.no_check = true; for(long i=start;i<=up;i++) {
- * i = skipper.find(src,i,up); if(i<0) { charsMatched_ = matchFrom_ = -1;
- * return didMatch_ = false; } charsMatched_ = thePattern.matchAt(s,i,pt);
- * if(charsMatched_ >= 0) { matchFrom_ = thePattern.mfrom; marks = pt.marks;
- * gFlagto = matchFrom_+charsMatched_; gFlags = s; return didMatch_=true; }
- * else { i = s.adjustIndex(i); up = s.adjustEnd(i); } } } return
- * didMatch_=false; }
+ * return didMatch_=true; } } } else { pt.no_check = true; for(long
+ * i=start;i<=up;i++) { i = skipper.find(src,i,up); if(i<0) { charsMatched_ =
+ * matchFrom_ = -1; return didMatch_ = false; } charsMatched_ =
+ * thePattern.matchAt(s,i,pt); if(charsMatched_ >= 0) { matchFrom_ =
+ * thePattern.mfrom; marks = pt.marks; gFlagto = matchFrom_+charsMatched_;
+ * gFlags = s; return didMatch_=true; } else { i = s.adjustIndex(i); up =
+ * s.adjustEnd(i); } } } return didMatch_=false; }
*/
boolean _reverseSearch(String s, int start, int end)
@@ -1101,8 +1114,8 @@ public class Regex extends RegRes implements FilenameFilter
* the Pattern.
*
* @exception com.stevesoft.pat.RegSyntax
- * is thrown when a nonsensensical pattern is supplied. For
- * example, a pattern beginning with *.
+ * is thrown when a nonsensensical pattern is supplied. For
+ * example, a pattern beginning with *.
*/
protected void compile1(StrPos sp, Rthings mk) throws RegSyntax
{
@@ -1907,9 +1920,9 @@ public class Regex extends RegRes implements FilenameFilter
* optimized() method.
* <p>
* This method will attempt to rewrite your pattern in a way that makes it
- * faster (not all patterns execute at the same speed). In general, "(?: ... )"
- * will be faster than "( ... )" so if you don't need the backreference, you
- * should group using the former pattern.
+ * faster (not all patterns execute at the same speed). In general,
+ * "(?: ... )" will be faster than "( ... )" so if you don't need the
+ * backreference, you should group using the former pattern.
* <p>
* It will also introduce new pattern elements that you can't get to
* otherwise, for example if you have a large table of strings, i.e. the
diff --git a/src/com/stevesoft/pat/RegexReader.java b/src/com/stevesoft/pat/RegexReader.java
index 2e10f16..837821e 100644
--- a/src/com/stevesoft/pat/RegexReader.java
+++ b/src/com/stevesoft/pat/RegexReader.java
@@ -7,9 +7,10 @@
//
package com.stevesoft.pat;
-import java.io.*;
+import java.io.IOException;
+import java.io.Reader;
-import com.stevesoft.pat.wrap.*;
+import com.stevesoft.pat.wrap.StringBufferWrap;
/**
* This class allows you to replace the text in strings as you read them in. Be
diff --git a/src/com/stevesoft/pat/RegexTokenizer.java b/src/com/stevesoft/pat/RegexTokenizer.java
index 0378f3a..31fa2ba 100644
--- a/src/com/stevesoft/pat/RegexTokenizer.java
+++ b/src/com/stevesoft/pat/RegexTokenizer.java
@@ -7,7 +7,8 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Enumeration;
+import java.util.Vector;
/**
Shareware: package pat
diff --git a/src/com/stevesoft/pat/RegexWriter.java b/src/com/stevesoft/pat/RegexWriter.java
index a8c3e50..61bcdf6 100644
--- a/src/com/stevesoft/pat/RegexWriter.java
+++ b/src/com/stevesoft/pat/RegexWriter.java
@@ -7,9 +7,10 @@
//
package com.stevesoft.pat;
-import java.io.*;
+import java.io.IOException;
+import java.io.Writer;
-import com.stevesoft.pat.wrap.*;
+import com.stevesoft.pat.wrap.WriterWrap;
/**
* A basic extension of FilterWriter that uses Transformer to make replacements
@@ -77,6 +78,7 @@ public class RegexWriter extends Writer
*
* @deprecated
*/
+ @Deprecated
public char getEOLchar()
{
return EOLchar;
@@ -87,6 +89,7 @@ public class RegexWriter extends Writer
*
* @deprecated
*/
+ @Deprecated
public void setEOLchar(char c)
{
EOLchar = c;
@@ -99,6 +102,7 @@ public class RegexWriter extends Writer
*
* @deprecated
*/
+ @Deprecated
public int getMaxLines()
{
return max_lines;
@@ -109,6 +113,7 @@ public class RegexWriter extends Writer
*
* @deprecated
*/
+ @Deprecated
public void setMaxLines(int ml)
{
max_lines = ml;
@@ -226,51 +231,4 @@ public class RegexWriter extends Writer
{
bufferSize = i;
}
-
- static void test(String re, String inp, int n) throws Exception
- {
- StringWriter sw = new StringWriter();
- Regex rex = Regex.perlCode(re);
- String res1 = rex.replaceAll(inp);
- RegexWriter rw = new RegexWriter(rex, sw);
- for (int i = 0; i < inp.length(); i++)
- {
- rw.write(inp.charAt(i));
- }
- rw.close();
- String res2 = sw.toString();
- if (!res1.equals(res2))
- {
- System.out.println("nmax=" + n);
- System.out.println("re=" + re);
- System.out.println("inp=" + inp);
- System.out.println("res1=" + res1);
- System.out.println("res2=" + res2);
- System.exit(255);
- }
- }
-
- public static void main(String[] args) throws Exception
- {
- for (int n = 1; n <= 1; n++)
- {
- test("s/x/y/", "-----x123456789", n);
- test("s/x/y/", "x123456789", n);
- test("s/x/y/", "-----x", n);
- test("s/x.*?x/y/", ".xx..x..x...x...x....x....x", n);
- test("s/x.*x/[$&]/", "--x........x--xx", n);
- test("s/x.*x/[$&]/", "--x........x------", n);
- test("s/.$/a/m", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbbbbbbbbbbbb", n);
- test("s/.$/a/", "123", n);
- test("s/.$/a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb", n);
- test("s/^./a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb", n);
- test("s/$/a/", "bbb", n);
- test("s/^/a/", "bbb", n);
- test("s/^/a/", "", n);
- test("s{.*}{N}", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", n);
- test("s/.{0,7}/y/", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", n);
- test("s/x/$&/", "xxx", n);
- }
- System.out.println("Success!!!");
- }
}
diff --git a/src/com/stevesoft/pat/ReplaceRule.java b/src/com/stevesoft/pat/ReplaceRule.java
index bf56143..74a7a25 100644
--- a/src/com/stevesoft/pat/ReplaceRule.java
+++ b/src/com/stevesoft/pat/ReplaceRule.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* ReplaceRule is a singly linked list of Objects which describe how to replace
diff --git a/src/com/stevesoft/pat/Replacer.java b/src/com/stevesoft/pat/Replacer.java
index 062a548..6eaf5f6 100644
--- a/src/com/stevesoft/pat/Replacer.java
+++ b/src/com/stevesoft/pat/Replacer.java
@@ -7,7 +7,9 @@
//
package com.stevesoft.pat;
-import com.stevesoft.pat.wrap.*;
+import jalview.util.MessageManager;
+
+import com.stevesoft.pat.wrap.StringWrap;
/** Internally used class. */
class RegHolder
@@ -178,7 +180,9 @@ public class Replacer
lastMatchedTo = 0;
if (rh.me == null)
{
- throw new NullPointerException("Replacer has null Regex pointer");
+ throw new NullPointerException(
+ MessageManager
+ .getString("exception.replace_null_regex_pointer"));
}
if (rh.me._search(s, start, end))
{
diff --git a/src/com/stevesoft/pat/Skip.java b/src/com/stevesoft/pat/Skip.java
index d3f3822..f04653e 100644
--- a/src/com/stevesoft/pat/Skip.java
+++ b/src/com/stevesoft/pat/Skip.java
@@ -175,8 +175,8 @@ public class Skip
else if (p instanceof Or
&& ((Or) p).v.size() == 1
&& !((Or) p).leftForm().equals("(?!")
- && null != (subsk = findSkip((Pattern) ((Or) p).v
- .elementAt(0), ignoreCase, trnc)))
+ && null != (subsk = findSkip(
+ (Pattern) ((Or) p).v.elementAt(0), ignoreCase, trnc)))
{
subsk.offset += offset;
return subsk;
diff --git a/src/com/stevesoft/pat/SkipBMH.java b/src/com/stevesoft/pat/SkipBMH.java
index 1397b90..8257548 100644
--- a/src/com/stevesoft/pat/SkipBMH.java
+++ b/src/com/stevesoft/pat/SkipBMH.java
@@ -7,15 +7,15 @@
//
package com.stevesoft.pat;
-import com.stevesoft.pat.wrap.*;
+import com.stevesoft.pat.wrap.StringWrap;
/**
* Like Skip, but implements a <a
* href="http://www.dcc.uchile.cl/~rbaeza/handbook/algs/7/713b.srch.p.html">
- * Boyer-Moore-Horspool</a> type search method that has been modified to be
- * more like a "T-search" (see the Michael Tamm''s article in <i>C'T, magazin
- * fuer computer und technic</i>, August 97 p 292). Yet another important
- * source of information for me was the <a
+ * Boyer-Moore-Horspool</a> type search method that has been modified to be more
+ * like a "T-search" (see the Michael Tamm''s article in <i>C'T, magazin fuer
+ * computer und technic</i>, August 97 p 292). Yet another important source of
+ * information for me was the <a
* href="http://www.go2net.com/people/paulp/deep/1997/05/14/"> Deep Magic</a>
* article on string searching. As of this writing, I can beat String's indexOf
* method in many cases.
diff --git a/src/com/stevesoft/pat/Skipped.java b/src/com/stevesoft/pat/Skipped.java
index 551166b..2d20845 100644
--- a/src/com/stevesoft/pat/Skipped.java
+++ b/src/com/stevesoft/pat/Skipped.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/**
* Implements the (?<number) Pattern, where number is an integer telling us
@@ -31,8 +31,8 @@ class Skipped extends Pattern
{
// if(pt.no_check || s.regionMatches(pt.ignoreCase,0,pt.src,pos,s.length()))
if (pt.no_check
- || CaseMgr.regionMatches(s, pt.ignoreCase, 0, pt.src, pos, s
- .length()))
+ || CaseMgr.regionMatches(s, pt.ignoreCase, 0, pt.src, pos,
+ s.length()))
{
return nextMatch(pos + s.length(), pt);
}
diff --git a/src/com/stevesoft/pat/Start.java b/src/com/stevesoft/pat/Start.java
index 650e7a7..6cc0ce4 100644
--- a/src/com/stevesoft/pat/Start.java
+++ b/src/com/stevesoft/pat/Start.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/** The '^' or the '\A' Pattern, matches the start of a string. */
class Start extends Pattern
diff --git a/src/com/stevesoft/pat/StringLike.java b/src/com/stevesoft/pat/StringLike.java
index be98ff3..fa01fe6 100644
--- a/src/com/stevesoft/pat/StringLike.java
+++ b/src/com/stevesoft/pat/StringLike.java
@@ -11,10 +11,10 @@ com.stevesoft.pat;
* Package pat can search anything that implements this interface. Package pat
* assumes the following:
* <ul>
- * <li>The StringLike object will not change. Calls to charAt(int) will not
- * vary with time.
- * <li>The length of the object being searched is known before the search
- * begins and does not vary with time.
+ * <li>The StringLike object will not change. Calls to charAt(int) will not vary
+ * with time.
+ * <li>The length of the object being searched is known before the search begins
+ * and does not vary with time.
* </ul>
* Note that searching String is probably faster than searching other objects,
* so searching String is still preferred if possible.
diff --git a/src/com/stevesoft/pat/Transformer.java b/src/com/stevesoft/pat/Transformer.java
index d770f08..901a92d 100644
--- a/src/com/stevesoft/pat/Transformer.java
+++ b/src/com/stevesoft/pat/Transformer.java
@@ -7,7 +7,9 @@
//
package com.stevesoft.pat;
-import com.stevesoft.pat.wrap.*;
+import jalview.util.MessageManager;
+
+import com.stevesoft.pat.wrap.StringWrap;
/**
* Replacement rule used by the Transformer.
@@ -149,7 +151,9 @@ public class Transformer
Regex r = Regex.perlCode(rs);
if (r == null)
{
- throw new NullPointerException("bad pattern to Regex.perlCode: " + rs);
+ throw new NullPointerException(MessageManager.formatMessage(
+ "exception.bad_pattern_to_regex_perl_code",
+ new String[] { rs }));
}
add(r);
}
diff --git a/src/com/stevesoft/pat/lookAhead.java b/src/com/stevesoft/pat/lookAhead.java
index d7d71c3..5f2a1d0 100644
--- a/src/com/stevesoft/pat/lookAhead.java
+++ b/src/com/stevesoft/pat/lookAhead.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/** Implements "(?= )" and "(?! )" */
class lookAhead extends Or
diff --git a/src/com/stevesoft/pat/oneChar.java b/src/com/stevesoft/pat/oneChar.java
index ebbe991..b13c64d 100644
--- a/src/com/stevesoft/pat/oneChar.java
+++ b/src/com/stevesoft/pat/oneChar.java
@@ -7,7 +7,7 @@
//
package com.stevesoft.pat;
-import java.util.*;
+import java.util.Hashtable;
/** This class matches a single character. */
class oneChar extends Pattern
diff --git a/src/com/stevesoft/pat/wrap/CharArrayBufferWrap.java b/src/com/stevesoft/pat/wrap/CharArrayBufferWrap.java
index c014a57..2735f12 100644
--- a/src/com/stevesoft/pat/wrap/CharArrayBufferWrap.java
+++ b/src/com/stevesoft/pat/wrap/CharArrayBufferWrap.java
@@ -7,7 +7,8 @@ package //
//
com.stevesoft.pat.wrap;
-import com.stevesoft.pat.*;
+import com.stevesoft.pat.BasicStringBufferLike;
+import com.stevesoft.pat.StringLike;
/**
* Allows the outcome of a replaceAll() or replaceFirst() to be an array of
diff --git a/src/com/stevesoft/pat/wrap/CharArrayWrap.java b/src/com/stevesoft/pat/wrap/CharArrayWrap.java
index bde9bd1..5fa0fb0 100644
--- a/src/com/stevesoft/pat/wrap/CharArrayWrap.java
+++ b/src/com/stevesoft/pat/wrap/CharArrayWrap.java
@@ -7,7 +7,8 @@
//
package com.stevesoft.pat.wrap;
-import com.stevesoft.pat.*;
+import com.stevesoft.pat.BasicStringBufferLike;
+import com.stevesoft.pat.StringLike;
/**
* This provides a wrapper for a char array so that it can be searched by Regex.
diff --git a/src/com/stevesoft/pat/wrap/RandomAccessFileWrap.java b/src/com/stevesoft/pat/wrap/RandomAccessFileWrap.java
index b4d38dc..66a1014 100644
--- a/src/com/stevesoft/pat/wrap/RandomAccessFileWrap.java
+++ b/src/com/stevesoft/pat/wrap/RandomAccessFileWrap.java
@@ -7,9 +7,14 @@
//
package com.stevesoft.pat.wrap;
-import java.io.*;
+import jalview.util.MessageManager;
-import com.stevesoft.pat.*;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+import com.stevesoft.pat.BasicStringBufferLike;
+import com.stevesoft.pat.Regex;
+import com.stevesoft.pat.StringLike;
/**
* Provides a wrapper for a RandomAccessFile so that it can be searched by
@@ -84,13 +89,16 @@ public class RandomAccessFileWrap implements StringLike
{
}
- throw new ArrayIndexOutOfBoundsException("Out of bounds for file:"
- + " i=" + i + ", Final Buffer: i0=" + i0 + " iend=" + iend);
+ throw new ArrayIndexOutOfBoundsException(MessageManager.formatMessage(
+ "exception.out_of_bounds_for_file", new String[] {
+ Integer.valueOf(i).toString(),
+ Integer.valueOf(i0).toString(),
+ Integer.valueOf(iend).toString() }));
}
public String toString()
{
- throw new Error("Not implemented");
+ throw new Error(MessageManager.getString("error.not_implemented"));
}
public int length()
diff --git a/src/com/stevesoft/pat/wrap/StringBufferWrap.java b/src/com/stevesoft/pat/wrap/StringBufferWrap.java
index d522461..29ec042 100644
--- a/src/com/stevesoft/pat/wrap/StringBufferWrap.java
+++ b/src/com/stevesoft/pat/wrap/StringBufferWrap.java
@@ -7,7 +7,8 @@
//
package com.stevesoft.pat.wrap;
-import com.stevesoft.pat.*;
+import com.stevesoft.pat.BasicStringBufferLike;
+import com.stevesoft.pat.StringLike;
/**
* This provides a wrapper for StringBuffer to capture the output of a
diff --git a/src/com/stevesoft/pat/wrap/StringWrap.java b/src/com/stevesoft/pat/wrap/StringWrap.java
index 3ddf7c5..8396dd9 100644
--- a/src/com/stevesoft/pat/wrap/StringWrap.java
+++ b/src/com/stevesoft/pat/wrap/StringWrap.java
@@ -7,7 +7,8 @@
//
package com.stevesoft.pat.wrap;
-import com.stevesoft.pat.*;
+import com.stevesoft.pat.BasicStringBufferLike;
+import com.stevesoft.pat.StringLike;
/**
* A basic wrapper for the String object. Regex does not search String directly
diff --git a/src/com/stevesoft/pat/wrap/WriterWrap.java b/src/com/stevesoft/pat/wrap/WriterWrap.java
index e72b5fa..189b0f2 100644
--- a/src/com/stevesoft/pat/wrap/WriterWrap.java
+++ b/src/com/stevesoft/pat/wrap/WriterWrap.java
@@ -7,9 +7,11 @@
//
package com.stevesoft.pat.wrap;
-import java.io.*;
+import java.io.IOException;
+import java.io.Writer;
-import com.stevesoft.pat.*;
+import com.stevesoft.pat.BasicStringBufferLike;
+import com.stevesoft.pat.StringLike;
/**
* Allows the outcome of a replaceAll() or replaceFirst() to be directed to a
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java
new file mode 100644
index 0000000..03f51f7
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java
@@ -0,0 +1,951 @@
+package ext.edu.ucsf.rbvi.strucviz2;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
+
+public abstract class ChimUtils
+{
+
+ private static Logger logger = LoggerFactory.getLogger(ChimUtils.class);
+
+ static int MAX_SUB_MODELS = 1000;
+
+ public static final HashMap<String, String> aaNames;
+
+ public static String RESIDUE_ATTR = "ChimeraResidue";
+
+ public static String RINALYZER_ATTR = "RINalyzerResidue";
+
+ public static String DEFAULT_STRUCTURE_KEY = "pdbFileName";
+
+ /**
+ * Parse the model number returned by Chimera and return the int value
+ */
+ // invoked by the ChimeraModel constructor
+ // line = model id #0 type Molecule name 1ert
+ public static int[] parseModelNumber(String inputLine)
+ {
+ int hash = inputLine.indexOf('#');
+ int space = inputLine.indexOf(' ', hash);
+ int decimal = inputLine.substring(hash + 1, space).indexOf('.');
+ // model number is between hash+1 and space
+ int modelNumber = -1;
+ int subModelNumber = 0;
+ try
+ {
+ if (decimal > 0)
+ {
+ subModelNumber = Integer.parseInt(inputLine.substring(decimal
+ + hash + 2, space));
+ space = decimal + hash + 1;
+ }
+ modelNumber = Integer.parseInt(inputLine.substring(hash + 1, space));
+ } catch (Exception e)
+ {
+ logger.warn("Unexpected return from Chimera: " + inputLine, e);
+ }
+ return new int[] { modelNumber, subModelNumber };
+ }
+
+ /**
+ * Parse the model number returned by Chimera and return the int value
+ */
+ // invoked by openModel in ChimeraManager
+ // line: #1, chain A: hiv-1 protease
+ public static int[] parseOpenedModelNumber(String inputLine)
+ {
+ int hash = inputLine.indexOf('#');
+ int space = inputLine.indexOf(',', hash);
+ int decimal = inputLine.substring(hash + 1, space).indexOf('.');
+ // model number is between hash+1 and space
+ int modelNumber = -1;
+ int subModelNumber = 0;
+ try
+ {
+ if (decimal > 0)
+ {
+ subModelNumber = Integer.parseInt(inputLine.substring(decimal
+ + hash + 2, space));
+ space = decimal + hash + 1;
+ }
+ modelNumber = Integer.parseInt(inputLine.substring(hash + 1, space));
+ } catch (Exception e)
+ {
+ logger.warn("Unexpected return from Chimera: " + inputLine, e);
+ }
+ return new int[] { modelNumber, subModelNumber };
+ }
+
+ /**
+ * Parse the model identifier returned by Chimera and return the String value
+ */
+ // invoked by the ChimeraModel constructor
+ // line = model id #0 type Molecule name 1ert
+ public static String parseModelName(String inputLine)
+ {
+ int start = inputLine.indexOf("name ");
+ if (start < 0)
+ return null;
+ // Might get a quoted string (don't understand why, but there you have it)
+ if (inputLine.startsWith("\"", start + 5))
+ {
+ start += 6; // Skip over the first quote
+ int end = inputLine.lastIndexOf('"');
+ if (end >= 1)
+ {
+ return inputLine.substring(start, end);
+ }
+ else
+ return inputLine.substring(start);
+ }
+ else
+ {
+ return inputLine.substring(start + 5);
+ }
+ }
+
+ public static Color parseModelColor(String inputLine)
+ {
+ try
+ {
+ int colorStart = inputLine.indexOf("color ");
+ String colorString = inputLine.substring(colorStart + 6);
+ String[] rgbStrings = colorString.split(",");
+ float[] rgbValues = new float[4];
+ for (int i = 0; i < rgbStrings.length; i++)
+ {
+ Float f = new Float(rgbStrings[i]);
+ rgbValues[i] = f.floatValue();
+ }
+ if (rgbStrings.length == 4)
+ {
+ return new Color(rgbValues[0], rgbValues[1], rgbValues[2],
+ rgbValues[3]);
+ }
+ else
+ {
+ return new Color(rgbValues[0], rgbValues[1], rgbValues[2]);
+ }
+ } catch (Exception ex)
+ {
+ logger.warn("Unexpected return from Chimera: " + inputLine, ex);
+ }
+ return Color.white;
+ }
+
+ /**
+ * Create the key to use for forming the model/submodel key into the modelHash
+ *
+ * @param model
+ * the model number
+ * @param subModel
+ * the submodel number
+ * @return the model key as an Integer
+ */
+ public static Integer makeModelKey(int model, int subModel)
+ {
+ return new Integer(model * MAX_SUB_MODELS + subModel);
+ }
+
+ // invoked by the getResdiue (parseConnectivityReplies in
+ // CreateStructureNetworkTask)
+ // atomSpec = #0:1.A or #1:96.B at N
+ public static ChimeraModel getModel(String atomSpec,
+ ChimeraManager chimeraManager)
+ {
+ // System.out.println("getting model for "+atomSpec);
+ String[] split = atomSpec.split(":");
+ // No model specified....
+ if (split[0].length() == 0)
+ {
+ logger.info("Unexpected return from Chimera: " + atomSpec);
+ return null;
+ }
+ // System.out.println("model = "+split[0].substring(1));
+ int model = 0;
+ int submodel = 0;
+ try
+ {
+ String[] subSplit = split[0].substring(1).split("\\.");
+ if (subSplit.length > 0)
+ model = Integer.parseInt(subSplit[0]);
+ else
+ model = Integer.parseInt(split[0].substring(1));
+
+ if (subSplit.length > 1)
+ submodel = Integer.parseInt(subSplit[1]);
+ } catch (Exception e)
+ {
+ // ignore
+ logger.warn("Unexpected return from Chimera: " + atomSpec, e);
+ }
+ return chimeraManager.getChimeraModel(model, submodel);
+ }
+
+ // invoked by the parseConnectivityReplies in CreateStructureNetworkTask
+ // atomSpec = #0:1.A or #1:96.B at N
+ public static ChimeraResidue getResidue(String atomSpec,
+ ChimeraManager chimeraManager)
+ {
+ // System.out.println("Getting residue from: "+atomSpec);
+ ChimeraModel model = getModel(atomSpec, chimeraManager); // Get the model
+ if (model == null)
+ {
+ model = chimeraManager.getChimeraModel();
+ }
+ return getResidue(atomSpec, model);
+ }
+
+ // invoked by the getResdiue (parseConnectivityReplies in
+ // CreateStructureNetworkTask)
+ // atomSpec = #0:1.A or #1:96.B at N
+ public static ChimeraResidue getResidue(String atomSpec,
+ ChimeraModel model)
+ {
+ // System.out.println("Getting residue from: "+atomSpec);
+ String[] split = atomSpec.split(":|@");
+
+ // Split into residue and chain
+ String[] residueChain = split[1].split("\\.");
+
+ if (residueChain[0].length() == 0)
+ {
+ logger.info("Unexpected return from Chimera: " + atomSpec);
+ return null;
+ }
+
+ if (residueChain.length == 2 && residueChain[1].length() > 0)
+ {
+ ChimeraChain chain = model.getChain(residueChain[1]);
+ return chain.getResidue(residueChain[0]);
+ }
+ return model.getResidue("_", residueChain[0]);
+ }
+
+ public static ChimeraChain getChain(String atomSpec, ChimeraModel model)
+ {
+ String[] split = atomSpec.split(":|@");
+
+ // Split into residue and chain
+ String[] residueChain = split[1].split("\\.");
+ if (residueChain.length == 1)
+ {
+ logger.info("Unexpected return from Chimera: " + atomSpec);
+ return null;
+ }
+ return model.getChain(residueChain[1]);
+ }
+
+ public static String getAtomName(String atomSpec)
+ {
+ String[] split = atomSpec.split("@");
+ if (split.length > 1)
+ {
+ return split[1];
+ }
+ return atomSpec;
+ }
+
+ public static boolean isBackbone(String atom)
+ {
+ if (atom.equals("C") || atom.equals("CA") || atom.equals("N")
+ || atom.equals("O") || atom.equals("H"))
+ return true;
+ return false;
+ }
+
+ public static String getIntSubtype(String node, String atom)
+ {
+ String[] split = node.split("#| ");
+ String resType = "";
+ if (split.length == 2)
+ {
+ resType = split[0].trim().toUpperCase();
+ }
+ else if (split.length == 3)
+ {
+ resType = split[1].trim().toUpperCase();
+ }
+ if (resType.equalsIgnoreCase("HOH") || resType.equalsIgnoreCase("WAT"))
+ {
+ return "water";
+ }
+ else if (aaNames.containsKey(resType))
+ {
+ if (atom.equals("C") || atom.equals("CA") || atom.equals("N")
+ || atom.equals("O") || atom.equals("H"))
+ {
+ return "mc";
+ }
+ else
+ {
+ return "sc";
+ }
+ }
+ else
+ {
+ return "other";
+ }
+ }
+
+ public static String[] getResKeyParts(String resKey)
+ {
+ // [pdbID[.modelNo]#][residueID][.chainID]
+ // pdbID := 4-character code | "URL" | "path"
+ String[] resKeyParts = new String[4];
+ String[] split = resKey.split("#");
+ String resChain = null;
+ // if no "#" then it is either only a pdb id or a residue or a chain
+ if (split.length == 1)
+ {
+ // pdb id without model
+ if (resKey.length() == 4 && resKey.indexOf("\\.") < 0)
+ {
+ parseModelID(resKey, resKeyParts);
+ }
+ // pdb link or file
+ else if (resKey.startsWith("\""))
+ {
+ parseModelID(resKey, resKeyParts);
+ }
+ // chain and residue or model and number
+ else
+ {
+ String[] splitSplit = resKey.split("\\.");
+ if (splitSplit.length == 1)
+ {
+ // only a chain or a residue
+ resChain = resKey;
+ }
+ else
+ {
+ try
+ {
+ // pdb with a model
+ Integer.parseInt(splitSplit[1]);
+ parseModelID(resKey, resKeyParts);
+ } catch (NumberFormatException ex)
+ {
+ // residue and chain
+ resChain = resKey;
+ }
+ }
+ }
+ }
+ else if (split.length == 2)
+ {
+ // model and residue+chain
+ parseModelID(split[0], resKeyParts);
+ resChain = split[1];
+ }
+ else
+ {
+ // model string with "#"
+ // TODO: [Optional] Are there more possibilities?
+ parseModelID(resKey.substring(0, resKey.lastIndexOf("#")),
+ resKeyParts);
+ resChain = resKey.substring(resKey.lastIndexOf("#") + 1,
+ resKey.length());
+ }
+ if (resChain != null)
+ {
+ // System.out.println(resChain);
+ String[] resChainSplit = resChain.split("\\.");
+ if (resChainSplit.length == 1)
+ {
+ // TODO: [Optional] Find a better way to distinguish between chain and
+ // residue
+ // if only one character and not an int, probably a chain
+ if (resChainSplit[0].length() == 1)
+ {
+ try
+ {
+ Integer.parseInt(resChainSplit[0]);
+ resKeyParts[3] = resChainSplit[0];
+ } catch (NumberFormatException ex)
+ {
+ resKeyParts[2] = resChainSplit[0];
+ }
+ }
+ else
+ {
+ resKeyParts[3] = resChainSplit[0];
+ }
+ }
+ else if (resChainSplit.length == 2)
+ {
+ resKeyParts[2] = resChainSplit[0];
+ resKeyParts[3] = resChainSplit[1];
+ }
+ else
+ {
+ // too many dots?
+ logger.info("Could not parse residue identifier: " + resKey);
+ }
+ }
+ // String print = "";
+ // for (int i = 0; i < resKeyParts.length; i++) {
+ // if (resKeyParts[i] == null) {
+ // print += i + ": null\t";
+ // } else {
+ // print += i + ": " + resKeyParts[i] + ";";
+ // }
+ // }
+ // System.out.println(print);
+ return resKeyParts;
+ }
+
+ public static void parseModelID(String modelID, String[] resKeyParts)
+ {
+ if (modelID.startsWith("\""))
+ {
+ if (modelID.endsWith("\""))
+ {
+ resKeyParts[0] = modelID.substring(1, modelID.length() - 1);
+ return;
+ }
+ else
+ {
+ try
+ {
+ Integer.parseInt(modelID.substring(modelID.lastIndexOf("\"") + 2,
+ modelID.length()));
+ resKeyParts[0] = modelID.substring(0,
+ modelID.lastIndexOf("\"") - 1);
+ resKeyParts[1] = modelID.substring(modelID.lastIndexOf("\"") + 2,
+ modelID.length());
+ } catch (NumberFormatException ex)
+ {
+ resKeyParts[0] = modelID.substring(1);
+ }
+ }
+ }
+ else
+ {
+ String[] modelIDNo = modelID.split("\\.");
+ if (modelIDNo.length == 1)
+ {
+ resKeyParts[0] = modelIDNo[0];
+ }
+ else if (modelIDNo.length == 2)
+ {
+ try
+ {
+ Integer.parseInt(modelIDNo[1]);
+ resKeyParts[0] = modelIDNo[0];
+ resKeyParts[1] = modelIDNo[1];
+ } catch (NumberFormatException ex)
+ {
+ resKeyParts[0] = modelID;
+ }
+ }
+ else
+ {
+ logger.info("Could not parse model identifier: " + modelID);
+ }
+ }
+ }
+
+ /**
+ * This method takes a Cytoscape attribute specification
+ * ([structure#][residue][.chainID]) and returns the lowest-level object
+ * referenced by the spec. For example, if the spec is "1tkk", this method
+ * will return a ChimeraModel. If the spec is ".A", it will return a
+ * ChimeraChain, etc.
+ *
+ * @param attrSpec
+ * the specification string
+ * @param chimeraManager
+ * the Chimera object we're currently using
+ * @return a ChimeraStructuralObject of the lowest type
+ */
+ public static ChimeraStructuralObject fromAttributeOld(String attrSpec,
+ ChimeraManager chimeraManager)
+ {
+ if (attrSpec == null || attrSpec.indexOf(',') > 0
+ || attrSpec.indexOf('-') > 0)
+ {
+ // No support for either lists or ranges
+ logger.warn("No support for identifier: " + attrSpec);
+ return null;
+ }
+
+ String residue = null;
+ String model = null;
+ String chain = null;
+
+ ChimeraModel chimeraModel = null;
+ ChimeraChain chimeraChain = null;
+ ChimeraResidue chimeraResidue = null;
+
+ // System.out.println("Getting object from attribute: "+attrSpec);
+ try
+ {
+ String[] split = attrSpec.split("#");
+ String resChain = null;
+ if (split.length == 1)
+ {
+ // no model
+ resChain = split[0];
+ }
+ else if (split.length == 2)
+ {
+ // model and rest
+ model = split[0];
+ resChain = split[1];
+ }
+ else
+ {
+ // model string with "#"
+ model = attrSpec.substring(0, attrSpec.lastIndexOf("#"));
+ resChain = attrSpec.substring(attrSpec.lastIndexOf("#") + 1,
+ attrSpec.length());
+ }
+ if (resChain != null)
+ {
+ String[] resChainSplit = resChain.split("\\.");
+ if (resChainSplit.length == 1)
+ {
+ residue = resChainSplit[0];
+ }
+ else if (resChainSplit.length == 2)
+ {
+ residue = resChainSplit[0];
+ chain = resChainSplit[1];
+ }
+ else
+ {
+ // too many dots?
+ logger.warn("No support for identifier: " + attrSpec);
+ }
+ }
+
+ // if (split.length == 1) {
+ // // No model
+ // residue = split[0];
+ // } else if (split.length == 3) {
+ // // We have all three
+ // model = split[0];
+ // residue = split[1];
+ // chain = split[2];
+ // } else if (split.length == 2 && attrSpec.indexOf('#') > 0) {
+ // // Model and Residue
+ // model = split[0];
+ // residue = split[1];
+ // } else {
+ // // Residue and Chain
+ // residue = split[0];
+ // chain = split[1];
+ // }
+
+ // System.out.println("model = " + model + " chain = " + chain +
+ // " residue = " +
+ // residue);
+ if (model != null)
+ {
+ List<ChimeraModel> models = chimeraManager.getChimeraModels(model,
+ ModelType.PDB_MODEL);
+ if (models.size() == 1)
+ {
+ chimeraModel = models.get(0);
+ }
+ else
+ {
+ try
+ {
+ chimeraModel = chimeraManager.getChimeraModel(
+ Integer.valueOf(model), 0);
+ } catch (NumberFormatException ex)
+ {
+ // ignore
+ }
+ }
+ }
+ if (chimeraModel == null)
+ {
+ chimeraModel = chimeraManager.getChimeraModel();
+ }
+ // System.out.println("ChimeraModel = " + chimeraModel);
+
+ if (chain != null)
+ {
+ chimeraChain = chimeraModel.getChain(chain);
+ // System.out.println("ChimeraChain = " + chimeraChain);
+ }
+ if (residue != null)
+ {
+ if (chimeraChain != null)
+ {
+ chimeraResidue = chimeraChain.getResidue(residue);
+ }
+ else
+ {
+ chimeraResidue = chimeraModel.getResidue("_", residue);
+ }
+ // System.out.println("ChimeraResidue = " + chimeraResidue);
+ }
+
+ if (chimeraResidue != null)
+ return chimeraResidue;
+
+ if (chimeraChain != null)
+ return chimeraChain;
+
+ if (chimeraModel != null)
+ return chimeraModel;
+
+ } catch (Exception ex)
+ {
+ logger.warn("Could not parse residue identifier: " + attrSpec, ex);
+ }
+ return null;
+ }
+
+ public static ChimeraStructuralObject fromAttribute(String attrSpec,
+ ChimeraManager chimeraManager)
+ {
+ // TODO: Make sure it is OK to remove this: || attrSpec.indexOf('-') > 0
+ if (attrSpec == null || attrSpec.indexOf(',') > 0)
+ {
+ // No support for either lists or ranges
+ // System.out.println("No support for identifier: " + attrSpec);
+ logger.warn("No support for identifier: " + attrSpec);
+ return null;
+ }
+ String[] modelIDNoResChain = getResKeyParts(attrSpec);
+
+ ChimeraModel chimeraModel = null;
+ ChimeraChain chimeraChain = null;
+ ChimeraResidue chimeraResidue = null;
+
+ // System.out.println("Getting object from attribute: "+attrSpec);
+ try
+ {
+ if (modelIDNoResChain[0] != null)
+ {
+ String modelID = modelIDNoResChain[0];
+ List<ChimeraModel> models = chimeraManager.getChimeraModels(
+ modelID, ModelType.PDB_MODEL);
+ if (models.size() == 1)
+ { // usual case with only one model
+ chimeraModel = models.get(0);
+ }
+ else if (models.size() > 1 && modelIDNoResChain[1] != null)
+ {
+ // there are several submodels
+ try
+ {
+ int modelNo = Integer.valueOf(modelIDNoResChain[1]);
+ for (ChimeraModel model : models)
+ {
+ if (model.getSubModelNumber() == modelNo)
+ {
+ chimeraModel = model;
+ break;
+ }
+ }
+ } catch (NumberFormatException ex)
+ {
+ // ignore
+ }
+ }
+ else
+ {
+ // TODO: [Optional] What is this doing?
+ try
+ {
+ chimeraModel = chimeraManager.getChimeraModel(
+ Integer.valueOf(modelID), 0);
+ } catch (NumberFormatException ex)
+ {
+ // ignore
+ }
+ }
+ }
+ if (chimeraModel == null)
+ {
+ // TODO: [Optional] Find a better way to handle this case
+ // If no model can be matched, continue
+ // System.out.println("No matching model could be find for " +
+ // attrSpec);
+ return null;
+ // chimeraModel = chimeraManager.getChimeraModel();
+ // logger.warn("No matching model could be find for " + attrSpec +
+ // ". Trying with "
+ // + chimeraModel.toSpec());
+ }
+ // System.out.println("ChimeraModel = " + chimeraModel);
+
+ if (modelIDNoResChain[3] != null)
+ {
+ chimeraChain = chimeraModel.getChain(modelIDNoResChain[3]);
+ // System.out.println("ChimeraChain = " + chimeraChain);
+ }
+ if (modelIDNoResChain[2] != null)
+ {
+ String residue = modelIDNoResChain[2];
+ if (chimeraChain != null)
+ {
+ chimeraResidue = chimeraChain.getResidue(residue);
+ }
+ else if (chimeraModel.getChain("_") != null)
+ {
+ chimeraResidue = chimeraModel.getResidue("_", residue);
+ }
+ else if (chimeraModel.getChainCount() == 1)
+ {
+ chimeraResidue = chimeraModel.getResidue(chimeraModel
+ .getChainNames().iterator().next(), residue);
+ }
+ // System.out.println("ChimeraResidue = " + chimeraResidue);
+ }
+
+ if (chimeraResidue != null)
+ return chimeraResidue;
+
+ if (chimeraChain != null)
+ return chimeraChain;
+
+ if (chimeraModel != null)
+ return chimeraModel;
+
+ } catch (Exception ex)
+ {
+ // System.out.println("Could not parse chimera identifier: " +
+ // attrSpec+"("+ex.getMessage()+")");
+ logger.warn("Could not parse chimera identifier: " + attrSpec, ex);
+ }
+ return null;
+ }
+
+ /**
+ * Search for structure references in the residue list
+ *
+ * @param residueList
+ * the list of residues
+ * @return a concatenated list of structures encoded in the list
+ */
+ public static String findStructures(String residueList)
+ {
+ if (residueList == null)
+ return null;
+ String[] residues = residueList.split(",");
+ Map<String, String> structureNameMap = new HashMap<String, String>();
+ for (int i = 0; i < residues.length; i++)
+ {
+ String[] components = residues[i].split("#");
+ if (components.length > 1)
+ {
+ structureNameMap.put(components[0], components[1]);
+ }
+ }
+ if (structureNameMap.isEmpty())
+ return null;
+
+ String structure = null;
+ for (String struct : structureNameMap.keySet())
+ {
+ if (structure == null)
+ structure = new String();
+ else
+ structure = structure.concat(",");
+ structure = structure.concat(struct);
+ }
+ return structure;
+ }
+
+ // invoked by openStructures in StructureManager
+ public static List<String> parseFuncRes(List<String> residueNames,
+ String modelName)
+ {
+ List<String> resRanges = new ArrayList<String>();
+ for (int i = 0; i < residueNames.size(); i++)
+ {
+ String residue = residueNames.get(i);
+ // Parse out the structure, if there is one
+ String[] components = residue.split("#");
+ if (components.length > 1 && !modelName.equals(components[0]))
+ {
+ continue;
+ }
+ else if (components.length > 1)
+ {
+ residue = components[1];
+ }
+ else if (components.length == 1)
+ {
+ residue = components[0];
+ }
+ // Check to see if we have a range-spec
+ String resRange = "";
+ if (residue == null || residue.equals("") || residue.length() == 0)
+ {
+ continue;
+ }
+ String[] range = residue.split("-", 2);
+ String chain = null;
+ for (int res = 0; res < range.length; res++)
+ {
+ if (res == 1)
+ {
+ resRange = resRange.concat("-");
+ if (chain != null && range[res].indexOf('.') == -1)
+ range[res] = range[res].concat("." + chain);
+ }
+
+ if (res == 0 && range.length >= 2 && range[res].indexOf('.') > 0)
+ {
+ // This is a range spec with the leading residue containing a chain
+ // spec
+ String[] resChain = range[res].split("\\.");
+ chain = resChain[1];
+ range[res] = resChain[0];
+ }
+ // Fix weird SFLD syntax...
+ if (range[res].indexOf('|') > 0
+ && Character.isDigit(range[res].charAt(0)))
+ {
+ int offset = range[res].indexOf('|');
+ String str = range[res].substring(offset + 1)
+ + range[res].substring(0, offset);
+ range[res] = str;
+ }
+
+ // Convert to legal atom-spec
+ if (Character.isDigit(range[res].charAt(0)))
+ {
+ resRange = resRange.concat(range[res]);
+ }
+ else if (Character.isDigit(range[res].charAt(1)))
+ {
+ resRange = resRange.concat(range[res].substring(1));
+ }
+ else if (range[res].charAt(0) == '.')
+ {
+ // Do we have a chain spec?
+ resRange = resRange.concat(range[res]);
+ }
+ else
+ {
+ resRange = resRange.concat(range[res].substring(3));
+ }
+ }
+ if (!resRanges.contains(resRange))
+ {
+ resRanges.add(resRange);
+ }
+ }
+ return resRanges;
+ }
+
+ static
+ {
+ aaNames = new HashMap<String, String>();
+ aaNames.put("ALA", "A Ala Alanine N[C@@H](C)C(O)=O");
+ aaNames.put("ARG", "R Arg Arginine N[C@@H](CCCNC(N)=N)C(O)=O");
+ aaNames.put("ASN", "N Asn Asparagine N[C@@H](CC(N)=O)C(O)=O");
+ aaNames.put("ASP", "D Asp Aspartic_acid N[C@@H](CC(O)=O)C(O)=O");
+ aaNames.put("CYS", "C Cys Cysteine N[C@@H](CS)C(O)=O");
+ aaNames.put("GLN", "Q Gln Glutamine N[C at H](C(O)=O)CCC(N)=O");
+ aaNames.put("GLU", "E Glu Glumatic_acid N[C at H](C(O)=O)CCC(O)=O");
+ aaNames.put("GLY", "G Gly Glycine NCC(O)=O");
+ aaNames.put("HIS", "H His Histidine N[C@@H](CC1=CN=CN1)C(O)=O");
+ aaNames.put("ILE", "I Ile Isoleucine N[C@]([C at H](C)CC)([H])C(O)=O");
+ aaNames.put("LEU", "L Leu Leucine N[C@](CC(C)C)([H])C(O)=O");
+ aaNames.put("LYS", "K Lys Lysine N[C@](CCCCN)([H])C(O)=O");
+ aaNames.put("DLY", "K Dly D-Lysine NCCCC[C@@H](N)C(O)=O");
+ aaNames.put("MET", "M Met Methionine N[C@](CCSC)([H])C(O)=O");
+ aaNames.put("PHE", "F Phe Phenylalanine N[C@](CC1=CC=CC=C1)([H])C(O)=O");
+ aaNames.put("PRO", "P Pro Proline OC([C@@]1([H])NCCC1)=O");
+ aaNames.put("SER", "S Ser Serine OC[C@](C(O)=O)([H])N");
+ aaNames.put("THR", "T Thr Threonine O[C at H](C)[C@](C(O)=O)([H])N");
+ aaNames.put("TRP",
+ "W Trp Tryptophan N[C@@]([H])(CC1=CN([H])C2=C1C=CC=C2)C(O)=O");
+ aaNames.put("TYR", "Y Tyr Tyrosine N[C@@](C(O)=O)([H])CC1=CC=C(O)C=C1");
+ aaNames.put("VAL", "V Val Valine N[C@@](C(O)=O)([H])C(C)C");
+ aaNames.put("ASX", "B Asx Aspartic_acid_or_Asparagine");
+ aaNames.put("GLX", "Z Glx Glutamine_or_Glutamic_acid");
+ aaNames.put("XAA", "X Xaa Any_or_unknown_amino_acid");
+ aaNames.put("HOH", "HOH HOH Water [H]O[H]");
+ }
+
+ /**
+ * Convert the amino acid type to a full name
+ *
+ * @param aaType
+ * the residue type to convert
+ * @return the full name of the residue
+ */
+ public static String toFullName(String aaType)
+ {
+ if (!aaNames.containsKey(aaType))
+ return aaType;
+ String[] ids = ((String) aaNames.get(aaType)).split(" ");
+ return ids[2].replace('_', ' ');
+ }
+
+ /**
+ * Convert the amino acid type to a single letter
+ *
+ * @param aaType
+ * the residue type to convert
+ * @return the single letter representation of the residue
+ */
+ public static String toSingleLetter(String aaType)
+ {
+ if (!aaNames.containsKey(aaType))
+ return aaType;
+ String[] ids = ((String) aaNames.get(aaType)).split(" ");
+ return ids[0];
+ }
+
+ /**
+ * Convert the amino acid type to three letters
+ *
+ * @param aaType
+ * the residue type to convert
+ * @return the three letter representation of the residue
+ */
+ public static String toThreeLetter(String aaType)
+ {
+ if (!aaNames.containsKey(aaType))
+ return aaType;
+ String[] ids = ((String) aaNames.get(aaType)).split(" ");
+ return ids[1];
+ }
+
+ /**
+ * Convert the amino acid type to its SMILES string
+ *
+ * @param aaType
+ * the residue type to convert
+ * @return the SMILES representation of the residue
+ */
+ public static String toSMILES(String aaType)
+ {
+ if (!aaNames.containsKey(aaType))
+ return null;
+ String[] ids = ((String) aaNames.get(aaType)).split(" ");
+ if (ids.length < 4)
+ return null;
+ return ids[3];
+ }
+
+ public static String getAlignName(ChimeraStructuralObject chimObj)
+ {
+ String name = chimObj.getChimeraModel().toString();
+ if (chimObj instanceof ChimeraChain)
+ {
+ name = ((ChimeraChain) chimObj).toString() + " [" + name + "]";
+ }
+ return name;
+ }
+}
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraChain.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraChain.java
new file mode 100644
index 0000000..9a29a99
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraChain.java
@@ -0,0 +1,372 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2006 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package ext.edu.ucsf.rbvi.strucviz2;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.TreeMap;
+
+/**
+ * This class provides the implementation for the ChimeraChain object
+ *
+ * @author scooter
+ *
+ */
+// TODO: [Optional] Implement toAttr() method
+public class ChimeraChain implements ChimeraStructuralObject
+{
+
+ /**
+ * The model/subModel number this chain is a part of
+ */
+ private int modelNumber;
+
+ private int subModelNumber;
+
+ /**
+ * A pointer to the model this chain is a part of
+ */
+ private ChimeraModel chimeraModel;
+
+ /**
+ * The chainID (from the PDB record)
+ */
+ private String chainId;
+
+ /**
+ * The residues that are part of this chain
+ */
+ private TreeMap<String, ChimeraResidue> residueMap;
+
+ /**
+ * userData to associate with this chain
+ */
+ private Object userData;
+
+ /**
+ * Flag to indicate the selection state
+ */
+ private boolean selected = false;
+
+ /**
+ * Constructor to create a new ChimeraChain
+ *
+ * @param model
+ * the model number this chain is part of
+ * @param subModel
+ * the subModel number this chain is part of
+ * @param chainId
+ * the chain ID for this chain
+ */
+ public ChimeraChain(int model, int subModel, String chainId)
+ {
+ this.modelNumber = model;
+ this.subModelNumber = subModel;
+ this.chainId = chainId;
+ residueMap = new TreeMap<String, ChimeraResidue>();
+ }
+
+ /**
+ * set the selected state of this chain
+ *
+ * @param selected
+ * a boolean to set the selected state to
+ */
+ public void setSelected(boolean selected)
+ {
+ this.selected = selected;
+ }
+
+ /**
+ * return the selected state of this chain
+ *
+ * @return the selected state
+ */
+ public boolean isSelected()
+ {
+ return selected;
+ }
+
+ public boolean hasSelectedChildren()
+ {
+ if (selected)
+ {
+ return true;
+ }
+ else
+ {
+ for (ChimeraResidue residue : getResidues())
+ {
+ if (residue.isSelected())
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return the list of selected residues
+ *
+ * @return all selected residues
+ */
+ public List<ChimeraResidue> getSelectedResidues()
+ {
+ List<ChimeraResidue> residueList = new ArrayList<ChimeraResidue>();
+ if (selected)
+ {
+ residueList.addAll(getResidues());
+ }
+ else
+ {
+ for (ChimeraResidue residue : getResidues())
+ {
+ if (residue.isSelected())
+ residueList.add(residue);
+ }
+ }
+ return residueList;
+ }
+
+ /**
+ * Add a residue to the chain.
+ *
+ * @param residue
+ * the ChimeraResidue to add to the chain.
+ */
+ public void addResidue(ChimeraResidue residue)
+ {
+ String index = residue.getIndex();
+ // Put it in our map so that we can return it in order
+ residueMap.put(index, residue);
+ }
+
+ /**
+ * Return the list of residues in this chain in pdb residue order
+ *
+ * @return a Collection of residues in residue order
+ */
+ public Collection<ChimeraResidue> getResidues()
+ {
+ return residueMap.values();
+ }
+
+ /**
+ * Return the list of residues in this chain as a list
+ *
+ * @return List of residues
+ */
+ public List<ChimeraStructuralObject> getChildren()
+ {
+ return new ArrayList<ChimeraStructuralObject>(residueMap.values());
+ }
+
+ /**
+ * Get a specific residue
+ *
+ * @param residueIndex
+ * String representation of the residue index
+ * @return the ChimeraResidue represented by the residueIndex
+ */
+ public ChimeraResidue getResidue(String index)
+ {
+ // Integer index = new Integer(residueIndex);
+ if (residueMap.containsKey(index))
+ return residueMap.get(index);
+ return null;
+ }
+
+ /**
+ * Get a list of residues as a residue range
+ *
+ * @param residueRange
+ * String representation of the residue range
+ * @return the List of ChimeraResidues represented by the range
+ */
+ public List<ChimeraResidue> getResidueRange(String residueRange)
+ {
+ String[] range = residueRange.split("-", 2);
+ if (range[1] == null || range[1].length() == 0)
+ {
+ range[1] = range[0];
+ }
+ List<ChimeraResidue> resultRange = new ArrayList<ChimeraResidue>();
+ int start = Integer.parseInt(range[0]);
+ int end = Integer.parseInt(range[1]);
+ for (int i = start; i <= end; i++)
+ {
+ String index = String.valueOf(i);
+ if (residueMap.containsKey(index))
+ resultRange.add(residueMap.get(index));
+ }
+ return resultRange;
+ }
+
+ /**
+ * Get the ID for this chain
+ *
+ * @return String value of the chainId
+ */
+ public String getChainId()
+ {
+ return chainId;
+ }
+
+ /**
+ * Get the model number for this chain
+ *
+ * @return the model number
+ */
+ public int getModelNumber()
+ {
+ return modelNumber;
+ }
+
+ /**
+ * Get the sub-model number for this chain
+ *
+ * @return the sub-model number
+ */
+ public int getSubModelNumber()
+ {
+ return subModelNumber;
+ }
+
+ /**
+ * Return a string representation of this chain as follows: Chain
+ * <i>chainId</i> (<i>residue_count</i> residues)
+ *
+ * @return String representation of chain
+ */
+ public String displayName()
+ {
+ if (chainId.equals("_"))
+ {
+ return ("Chain (no ID) (" + getResidueCount() + " residues)");
+ }
+ else
+ {
+ return ("Chain " + chainId + " (" + getResidueCount() + " residues)");
+ }
+ }
+
+ /**
+ * Return a string representation of this chain as follows: Node xxx [Model
+ * yyyy Chain <i>chainId</i>]
+ *
+ * @return String representation of chain
+ */
+ public String toString()
+ {
+ String displayName = chimeraModel.getModelName();
+ if (displayName.length() > 14)
+ displayName = displayName.substring(0, 13) + "...";
+ if (chainId.equals("_"))
+ {
+ return (displayName + " Chain (no ID) (" + getResidueCount() + " residues)");
+ }
+ else
+ {
+ return (displayName + " Chain " + chainId + " (" + getResidueCount() + " residues)");
+ }
+ }
+
+ /**
+ * Return the Chimera specification for this chain
+ *
+ * @return Chimera specification
+ */
+ public String toSpec()
+ {
+ if (chainId.equals("_"))
+ {
+ return ("#" + modelNumber + "." + subModelNumber + ":.");
+ }
+ else
+ {
+ return ("#" + modelNumber + "." + subModelNumber + ":." + chainId);
+ }
+ }
+
+ /**
+ * Return the number of residues in this chain
+ *
+ * @return integer number of residues
+ */
+ public int getResidueCount()
+ {
+ return residueMap.size();
+ }
+
+ /**
+ * Set the ChimeraModel for this chain
+ *
+ * @param model
+ * ChimeraModel to associate with this chain
+ */
+ public void setChimeraModel(ChimeraModel model)
+ {
+ this.chimeraModel = model;
+ }
+
+ /**
+ * Get the ChimeraModel for this chain
+ *
+ * @return ChimeraModel associated with this chain
+ */
+ public ChimeraModel getChimeraModel()
+ {
+ return chimeraModel;
+ }
+
+ /**
+ * Get the user data for this Chain
+ *
+ * @return user data
+ */
+ public Object getUserData()
+ {
+ return userData;
+ }
+
+ /**
+ * Set the user data for this Chain
+ *
+ * @param data
+ * the user data to associate with this chain
+ */
+ public void setUserData(Object data)
+ {
+ this.userData = data;
+ }
+}
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java
new file mode 100644
index 0000000..2de2829
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java
@@ -0,0 +1,899 @@
+package ext.edu.ucsf.rbvi.strucviz2;
+
+import jalview.ws.HttpClientUtils;
+
+import java.awt.Color;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.http.NameValuePair;
+import org.apache.http.message.BasicNameValuePair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
+import ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads;
+
+/**
+ * This object maintains the Chimera communication information.
+ */
+public class ChimeraManager
+{
+ private static final boolean debug = false;
+
+ private int chimeraRestPort;
+
+ private Process chimera;
+
+ private ListenerThreads chimeraListenerThread;
+
+ private Map<Integer, ChimeraModel> currentModelsMap;
+
+ private Logger logger = LoggerFactory
+ .getLogger(ext.edu.ucsf.rbvi.strucviz2.ChimeraManager.class);
+
+ private StructureManager structureManager;
+
+ public ChimeraManager(StructureManager structureManager)
+ {
+ this.structureManager = structureManager;
+ chimera = null;
+ chimeraListenerThread = null;
+ currentModelsMap = new HashMap<Integer, ChimeraModel>();
+
+ }
+
+ public List<ChimeraModel> getChimeraModels(String modelName)
+ {
+ List<ChimeraModel> models = getChimeraModels(modelName,
+ ModelType.PDB_MODEL);
+ models.addAll(getChimeraModels(modelName, ModelType.SMILES));
+ return models;
+ }
+
+ public List<ChimeraModel> getChimeraModels(String modelName,
+ ModelType modelType)
+ {
+ List<ChimeraModel> models = new ArrayList<ChimeraModel>();
+ for (ChimeraModel model : currentModelsMap.values())
+ {
+ if (modelName.equals(model.getModelName())
+ && modelType.equals(model.getModelType()))
+ {
+ models.add(model);
+ }
+ }
+ return models;
+ }
+
+ public Map<String, List<ChimeraModel>> getChimeraModelsMap()
+ {
+ Map<String, List<ChimeraModel>> models = new HashMap<String, List<ChimeraModel>>();
+ for (ChimeraModel model : currentModelsMap.values())
+ {
+ String modelName = model.getModelName();
+ if (!models.containsKey(modelName))
+ {
+ models.put(modelName, new ArrayList<ChimeraModel>());
+ }
+ if (!models.get(modelName).contains(model))
+ {
+ models.get(modelName).add(model);
+ }
+ }
+ return models;
+ }
+
+ public ChimeraModel getChimeraModel(Integer modelNumber,
+ Integer subModelNumber)
+ {
+ Integer key = ChimUtils.makeModelKey(modelNumber, subModelNumber);
+ if (currentModelsMap.containsKey(key))
+ {
+ return currentModelsMap.get(key);
+ }
+ return null;
+ }
+
+ public ChimeraModel getChimeraModel()
+ {
+ return currentModelsMap.values().iterator().next();
+ }
+
+ public Collection<ChimeraModel> getChimeraModels()
+ {
+ // this method is invoked by the model navigator dialog
+ return currentModelsMap.values();
+ }
+
+ public int getChimeraModelsCount(boolean smiles)
+ {
+ // this method is invokes by the model navigator dialog
+ int counter = currentModelsMap.size();
+ if (smiles)
+ {
+ return counter;
+ }
+
+ for (ChimeraModel model : currentModelsMap.values())
+ {
+ if (model.getModelType() == ModelType.SMILES)
+ {
+ counter--;
+ }
+ }
+ return counter;
+ }
+
+ public boolean hasChimeraModel(Integer modelNubmer)
+ {
+ return hasChimeraModel(modelNubmer, 0);
+ }
+
+ public boolean hasChimeraModel(Integer modelNubmer, Integer subModelNumber)
+ {
+ return currentModelsMap.containsKey(ChimUtils.makeModelKey(modelNubmer,
+ subModelNumber));
+ }
+
+ public void addChimeraModel(Integer modelNumber, Integer subModelNumber,
+ ChimeraModel model)
+ {
+ currentModelsMap.put(
+ ChimUtils.makeModelKey(modelNumber, subModelNumber), model);
+ }
+
+ public void removeChimeraModel(Integer modelNumber, Integer subModelNumber)
+ {
+ int modelKey = ChimUtils.makeModelKey(modelNumber, subModelNumber);
+ if (currentModelsMap.containsKey(modelKey))
+ {
+ currentModelsMap.remove(modelKey);
+ }
+ }
+
+ public List<ChimeraModel> openModel(String modelPath, ModelType type)
+ {
+ return openModel(modelPath, getFileNameFromPath(modelPath), type);
+ }
+
+ /**
+ * Overloaded method to allow Jalview to pass in a model name.
+ *
+ * @param modelPath
+ * @param modelName
+ * @param type
+ * @return
+ */
+ public List<ChimeraModel> openModel(String modelPath, String modelName,
+ ModelType type)
+ {
+ logger.info("chimera open " + modelPath);
+ // stopListening();
+ List<String> response = null;
+ // TODO: [Optional] Handle modbase models
+ if (type == ModelType.MODBASE_MODEL)
+ {
+ response = sendChimeraCommand("open modbase:" + modelPath, true);
+ // } else if (type == ModelType.SMILES) {
+ // response = sendChimeraCommand("open smiles:" + modelName, true);
+ // modelName = "smiles:" + modelName;
+ }
+ else
+ {
+ response = sendChimeraCommand("open " + modelPath, true);
+ }
+ if (response == null)
+ {
+ // something went wrong
+ logger.warn("Could not open " + modelPath);
+ return null;
+ }
+ List<ChimeraModel> models = new ArrayList<ChimeraModel>();
+ int[] modelNumbers = null;
+ if (type == ModelType.PDB_MODEL)
+ {
+ for (String line : response)
+ {
+ if (line.startsWith("#"))
+ {
+ modelNumbers = ChimUtils.parseOpenedModelNumber(line);
+ if (modelNumbers != null)
+ {
+ int modelNumber = ChimUtils.makeModelKey(modelNumbers[0],
+ modelNumbers[1]);
+ if (currentModelsMap.containsKey(modelNumber))
+ {
+ continue;
+ }
+ ChimeraModel newModel = new ChimeraModel(modelName, type,
+ modelNumbers[0], modelNumbers[1]);
+ currentModelsMap.put(modelNumber, newModel);
+ models.add(newModel);
+
+ //
+ // patch for Jalview - set model name in Chimera
+ // TODO: find a variant that works for sub-models
+ sendChimeraCommand("setattr M name " + modelName + " #"
+ + modelNumbers[0], false);
+ // end patch for Jalview
+
+ modelNumbers = null;
+ }
+ }
+ }
+ }
+ else
+ {
+ // TODO: [Optional] Open smiles from file would fail. Do we need it?
+ // If parsing fails, iterate over all open models to get the right one
+ List<ChimeraModel> openModels = getModelList();
+ for (ChimeraModel openModel : openModels)
+ {
+ String openModelName = openModel.getModelName();
+ if (openModelName.endsWith("..."))
+ {
+ openModelName = openModelName.substring(0,
+ openModelName.length() - 3);
+ }
+ if (modelPath.startsWith(openModelName))
+ {
+ openModel.setModelName(modelPath);
+ int modelNumber = ChimUtils
+ .makeModelKey(openModel.getModelNumber(),
+ openModel.getSubModelNumber());
+ if (!currentModelsMap.containsKey(modelNumber))
+ {
+ currentModelsMap.put(modelNumber, openModel);
+ models.add(openModel);
+ }
+ }
+ }
+ }
+
+ // assign color and residues to open models
+ for (ChimeraModel newModel : models)
+ {
+ // get model color
+ Color modelColor = getModelColor(newModel);
+ if (modelColor != null)
+ {
+ newModel.setModelColor(modelColor);
+ }
+
+ // Get our properties (default color scheme, etc.)
+ // Make the molecule look decent
+ // chimeraSend("repr stick "+newModel.toSpec());
+
+ // Create the information we need for the navigator
+ if (type != ModelType.SMILES)
+ {
+ addResidues(newModel);
+ }
+ }
+
+ sendChimeraCommand("focus", false);
+ // startListening(); // see ChimeraListener
+ return models;
+ }
+
+ /**
+ * Refactored method to extract the last (or only) element delimited by file
+ * path separator.
+ *
+ * @param modelPath
+ * @return
+ */
+ private String getFileNameFromPath(String modelPath)
+ {
+ String modelName = modelPath;
+ if (modelPath == null)
+ {
+ return null;
+ }
+ // TODO: [Optional] Convert path to name in a better way
+ if (modelPath.lastIndexOf(File.separator) > 0)
+ {
+ modelName = modelPath
+ .substring(modelPath.lastIndexOf(File.separator) + 1);
+ }
+ else if (modelPath.lastIndexOf("/") > 0)
+ {
+ modelName = modelPath.substring(modelPath.lastIndexOf("/") + 1);
+ }
+ return modelName;
+ }
+
+ public void closeModel(ChimeraModel model)
+ {
+ // int model = structure.modelNumber();
+ // int subModel = structure.subModelNumber();
+ // Integer modelKey = makeModelKey(model, subModel);
+ stopListening();
+ logger.info("chimera close model " + model.getModelName());
+ if (currentModelsMap.containsKey(ChimUtils.makeModelKey(
+ model.getModelNumber(), model.getSubModelNumber())))
+ {
+ sendChimeraCommand("close " + model.toSpec(), false);
+ // currentModelNamesMap.remove(model.getModelName());
+ currentModelsMap.remove(ChimUtils.makeModelKey(
+ model.getModelNumber(), model.getSubModelNumber()));
+ // selectionList.remove(chimeraModel);
+ }
+ else
+ {
+ logger.warn("Could not find model " + model.getModelName()
+ + " to close.");
+ }
+ startListening();
+ }
+
+ public void startListening()
+ {
+ sendChimeraCommand("listen start models; listen start selection", false);
+ }
+
+ public void stopListening()
+ {
+ sendChimeraCommand("listen stop models ; listen stop selection ", false);
+ }
+
+ /**
+ * Tell Chimera we are listening on the given URI
+ *
+ * @param uri
+ */
+ public void startListening(String uri)
+ {
+ sendChimeraCommand("listen start models url " + uri
+ + ";listen start select prefix SelectionChanged url " + uri,
+ false);
+ }
+
+ /**
+ * Select something in Chimera
+ *
+ * @param command
+ * the selection command to pass to Chimera
+ */
+ public void select(String command)
+ {
+ sendChimeraCommand("listen stop selection; " + command
+ + "; listen start selection", false);
+ }
+
+ public void focus()
+ {
+ sendChimeraCommand("focus", false);
+ }
+
+ public void clearOnChimeraExit()
+ {
+ chimera = null;
+ currentModelsMap.clear();
+ this.chimeraRestPort = 0;
+ structureManager.clearOnChimeraExit();
+ }
+
+ public void exitChimera()
+ {
+ if (isChimeraLaunched() && chimera != null)
+ {
+ sendChimeraCommand("stop really", false);
+ try
+ {
+ chimera.destroy();
+ } catch (Exception ex)
+ {
+ // ignore
+ }
+ }
+ clearOnChimeraExit();
+ }
+
+ public Map<Integer, ChimeraModel> getSelectedModels()
+ {
+ Map<Integer, ChimeraModel> selectedModelsMap = new HashMap<Integer, ChimeraModel>();
+ List<String> chimeraReply = sendChimeraCommand(
+ "list selection level molecule", true);
+ if (chimeraReply != null)
+ {
+ for (String modelLine : chimeraReply)
+ {
+ ChimeraModel chimeraModel = new ChimeraModel(modelLine);
+ Integer modelKey = ChimUtils.makeModelKey(
+ chimeraModel.getModelNumber(),
+ chimeraModel.getSubModelNumber());
+ selectedModelsMap.put(modelKey, chimeraModel);
+ }
+ }
+ return selectedModelsMap;
+ }
+
+ /**
+ * Sends a 'list selection level residue' command to Chimera and returns the
+ * list of selected atomspecs
+ *
+ * @return
+ */
+ public List<String> getSelectedResidueSpecs()
+ {
+ List<String> selectedResidues = new ArrayList<String>();
+ List<String> chimeraReply = sendChimeraCommand(
+ "list selection level residue", true);
+ if (chimeraReply != null)
+ {
+ for (String inputLine : chimeraReply)
+ {
+ String[] inputLineParts = inputLine.split("\\s+");
+ if (inputLineParts.length == 5)
+ {
+ selectedResidues.add(inputLineParts[2]);
+ }
+ }
+ }
+ return selectedResidues;
+ }
+
+ public void getSelectedResidues(
+ Map<Integer, ChimeraModel> selectedModelsMap)
+ {
+ List<String> chimeraReply = sendChimeraCommand(
+ "list selection level residue", true);
+ if (chimeraReply != null)
+ {
+ for (String inputLine : chimeraReply)
+ {
+ ChimeraResidue r = new ChimeraResidue(inputLine);
+ Integer modelKey = ChimUtils.makeModelKey(r.getModelNumber(),
+ r.getSubModelNumber());
+ if (selectedModelsMap.containsKey(modelKey))
+ {
+ ChimeraModel model = selectedModelsMap.get(modelKey);
+ model.addResidue(r);
+ }
+ }
+ }
+ }
+
+ /**
+ * Return the list of ChimeraModels currently open. Warning: if smiles model
+ * name too long, only part of it with "..." is printed.
+ *
+ *
+ * @return List of ChimeraModel's
+ */
+ // TODO: [Optional] Handle smiles names in a better way in Chimera?
+ public List<ChimeraModel> getModelList()
+ {
+ List<ChimeraModel> modelList = new ArrayList<ChimeraModel>();
+ List<String> list = sendChimeraCommand("list models type molecule",
+ true);
+ if (list != null)
+ {
+ for (String modelLine : list)
+ {
+ ChimeraModel chimeraModel = new ChimeraModel(modelLine);
+ modelList.add(chimeraModel);
+ }
+ }
+ return modelList;
+ }
+
+ /**
+ * Return the list of depiction presets available from within Chimera. Chimera
+ * will return the list as a series of lines with the format: Preset type
+ * number "description"
+ *
+ * @return list of presets
+ */
+ public List<String> getPresets()
+ {
+ ArrayList<String> presetList = new ArrayList<String>();
+ List<String> output = sendChimeraCommand("preset list", true);
+ if (output != null)
+ {
+ for (String preset : output)
+ {
+ preset = preset.substring(7); // Skip over the "Preset"
+ preset = preset.replaceFirst("\"", "(");
+ preset = preset.replaceFirst("\"", ")");
+ // string now looks like: type number (description)
+ presetList.add(preset);
+ }
+ }
+ return presetList;
+ }
+
+ public boolean isChimeraLaunched()
+ {
+ boolean launched = false;
+ if (chimera != null)
+ {
+ try
+ {
+ chimera.exitValue();
+ // if we get here, process has ended
+ } catch (IllegalThreadStateException e)
+ {
+ // ok - not yet terminated
+ launched = true;
+ }
+ }
+ return launched;
+ }
+
+ /**
+ * Launch Chimera, unless an instance linked to this object is already
+ * running. Returns true if chimera is successfully launched, or already
+ * running, else false.
+ *
+ * @param chimeraPaths
+ * @return
+ */
+ public boolean launchChimera(List<String> chimeraPaths)
+ {
+ // Do nothing if Chimera is already launched
+ if (isChimeraLaunched())
+ {
+ return true;
+ }
+
+ // Try to launch Chimera (eventually using one of the possible paths)
+ String error = "Error message: ";
+ String workingPath = "";
+ // iterate over possible paths for starting Chimera
+ for (String chimeraPath : chimeraPaths)
+ {
+ File path = new File(chimeraPath);
+ // uncomment the next line to simulate Chimera not installed
+ // path = new File(chimeraPath + "x");
+ if (!path.canExecute())
+ {
+ error += "File '" + path + "' does not exist.\n";
+ continue;
+ }
+ try
+ {
+ List<String> args = new ArrayList<String>();
+ args.add(chimeraPath);
+ // shows Chimera output window but suppresses REST responses:
+ // args.add("--debug");
+ args.add("--start");
+ args.add("RESTServer");
+ ProcessBuilder pb = new ProcessBuilder(args);
+ chimera = pb.start();
+ error = "";
+ workingPath = chimeraPath;
+ break;
+ } catch (Exception e)
+ {
+ // Chimera could not be started
+ error += e.getMessage();
+ }
+ }
+ // If no error, then Chimera was launched successfully
+ if (error.length() == 0)
+ {
+ this.chimeraRestPort = getPortNumber();
+ System.out.println("Chimera REST API started on port "
+ + chimeraRestPort);
+ // structureManager.initChimTable();
+ structureManager.setChimeraPathProperty(workingPath);
+ // TODO: [Optional] Check Chimera version and show a warning if below 1.8
+ // Ask Chimera to give us updates
+ // startListening(); // later - see ChimeraListener
+ return (chimeraRestPort > 0);
+ }
+
+ // Tell the user that Chimera could not be started because of an error
+ logger.warn(error);
+ return false;
+ }
+
+ /**
+ * Read and return the port number returned in the reply to --start RESTServer
+ */
+ private int getPortNumber()
+ {
+ int port = 0;
+ InputStream readChan = chimera.getInputStream();
+ BufferedReader lineReader = new BufferedReader(new InputStreamReader(
+ readChan));
+ StringBuilder responses = new StringBuilder();
+ try
+ {
+ String response = lineReader.readLine();
+ while (response != null)
+ {
+ responses.append("\n" + response);
+ // expect: REST server on host 127.0.0.1 port port_number
+ if (response.startsWith("REST server"))
+ {
+ String[] tokens = response.split(" ");
+ if (tokens.length == 7 && "port".equals(tokens[5]))
+ {
+ port = Integer.parseInt(tokens[6]);
+ break;
+ }
+ }
+ response = lineReader.readLine();
+ }
+ } catch (Exception e)
+ {
+ logger.error("Failed to get REST port number from " + responses
+ + ": " + e.getMessage());
+ } finally
+ {
+ try
+ {
+ lineReader.close();
+ } catch (IOException e2)
+ {
+ }
+ }
+ if (port == 0)
+ {
+ System.err
+ .println("Failed to start Chimera with REST service, response was: "
+ + responses);
+ }
+ logger.info("Chimera REST service listening on port " + chimeraRestPort);
+ return port;
+ }
+
+ /**
+ * Determine the color that Chimera is using for this model.
+ *
+ * @param model
+ * the ChimeraModel we want to get the Color for
+ * @return the default model Color for this model in Chimera
+ */
+ public Color getModelColor(ChimeraModel model)
+ {
+ List<String> colorLines = sendChimeraCommand(
+ "list model spec " + model.toSpec() + " attribute color", true);
+ if (colorLines == null || colorLines.size() == 0)
+ {
+ return null;
+ }
+ return ChimUtils.parseModelColor(colorLines.get(0));
+ }
+
+ /**
+ *
+ * Get information about the residues associated with a model. This uses the
+ * Chimera listr command. We don't return the resulting residues, but we add
+ * the residues to the model.
+ *
+ * @param model
+ * the ChimeraModel to get residue information for
+ *
+ */
+ public void addResidues(ChimeraModel model)
+ {
+ int modelNumber = model.getModelNumber();
+ int subModelNumber = model.getSubModelNumber();
+ // Get the list -- it will be in the reply log
+ List<String> reply = sendChimeraCommand(
+ "list residues spec " + model.toSpec(), true);
+ if (reply == null)
+ {
+ return;
+ }
+ for (String inputLine : reply)
+ {
+ ChimeraResidue r = new ChimeraResidue(inputLine);
+ if (r.getModelNumber() == modelNumber
+ || r.getSubModelNumber() == subModelNumber)
+ {
+ model.addResidue(r);
+ }
+ }
+ }
+
+ public List<String> getAttrList()
+ {
+ List<String> attributes = new ArrayList<String>();
+ final List<String> reply = sendChimeraCommand("list resattr", true);
+ if (reply != null)
+ {
+ for (String inputLine : reply)
+ {
+ String[] lineParts = inputLine.split("\\s");
+ if (lineParts.length == 2 && lineParts[0].equals("resattr"))
+ {
+ attributes.add(lineParts[1]);
+ }
+ }
+ }
+ return attributes;
+ }
+
+ public Map<ChimeraResidue, Object> getAttrValues(String aCommand,
+ ChimeraModel model)
+ {
+ Map<ChimeraResidue, Object> values = new HashMap<ChimeraResidue, Object>();
+ final List<String> reply = sendChimeraCommand("list residue spec "
+ + model.toSpec() + " attribute " + aCommand, true);
+ if (reply != null)
+ {
+ for (String inputLine : reply)
+ {
+ String[] lineParts = inputLine.split("\\s");
+ if (lineParts.length == 5)
+ {
+ ChimeraResidue residue = ChimUtils
+ .getResidue(lineParts[2], model);
+ String value = lineParts[4];
+ if (residue != null)
+ {
+ if (value.equals("None"))
+ {
+ continue;
+ }
+ if (value.equals("True") || value.equals("False"))
+ {
+ values.put(residue, Boolean.valueOf(value));
+ continue;
+ }
+ try
+ {
+ Double doubleValue = Double.valueOf(value);
+ values.put(residue, doubleValue);
+ } catch (NumberFormatException ex)
+ {
+ values.put(residue, value);
+ }
+ }
+ }
+ }
+ }
+ return values;
+ }
+
+ private volatile boolean busy = false;
+
+ /**
+ * Send a command to Chimera.
+ *
+ * @param command
+ * Command string to be send.
+ * @param reply
+ * Flag indicating whether the method should return the reply from
+ * Chimera or not.
+ * @return List of Strings corresponding to the lines in the Chimera reply or
+ * <code>null</code>.
+ */
+ public List<String> sendChimeraCommand(String command, boolean reply)
+ {
+ // System.out.println("chimeradebug>> " + command);
+ if (!isChimeraLaunched() || command == null
+ || "".equals(command.trim()))
+ {
+ return null;
+ }
+ // TODO do we need a maximum wait time before aborting?
+ while (busy)
+ {
+ try
+ {
+ Thread.sleep(25);
+ } catch (InterruptedException q)
+ {
+ }
+ }
+ busy = true;
+ long startTime = System.currentTimeMillis();
+ try
+ {
+ return sendRestCommand(command);
+ } finally
+ {
+ /*
+ * Make sure busy flag is reset come what may!
+ */
+ busy = false;
+ if (debug)
+ {
+ System.out.println("Chimera command took "
+ + (System.currentTimeMillis() - startTime) + "ms: "
+ + command);
+ }
+
+ }
+ }
+
+ /**
+ * Sends the command to Chimera's REST API, and returns any response lines.
+ *
+ * @param command
+ * @return
+ */
+ protected List<String> sendRestCommand(String command)
+ {
+ String restUrl = "http://127.0.0.1:" + this.chimeraRestPort + "/run";
+ List<NameValuePair> commands = new ArrayList<NameValuePair>(1);
+ commands.add(new BasicNameValuePair("command", command));
+
+ List<String> reply = new ArrayList<String>();
+ BufferedReader response = null;
+ try
+ {
+ response = HttpClientUtils
+ .doHttpUrlPost(restUrl, commands, 100, 5000);
+ String line = "";
+ while ((line = response.readLine()) != null)
+ {
+ reply.add(line);
+ }
+ } catch (Exception e)
+ {
+ logger.error("REST call '" + command + "' failed: " + e.getMessage());
+ } finally
+ {
+ if (response != null)
+ {
+ try
+ {
+ response.close();
+ } catch (IOException e)
+ {
+ }
+ }
+ }
+ return reply;
+ }
+
+ /**
+ * Send a command to stdin of Chimera process, and optionally read any
+ * responses.
+ *
+ * @param command
+ * @param readReply
+ * @return
+ */
+ protected List<String> sendStdinCommand(String command, boolean readReply)
+ {
+ chimeraListenerThread.clearResponse(command);
+ String text = command.concat("\n");
+ try
+ {
+ // send the command
+ chimera.getOutputStream().write(text.getBytes());
+ chimera.getOutputStream().flush();
+ } catch (IOException e)
+ {
+ // logger.info("Unable to execute command: " + text);
+ // logger.info("Exiting...");
+ logger.warn("Unable to execute command: " + text);
+ logger.warn("Exiting...");
+ clearOnChimeraExit();
+ return null;
+ }
+ if (!readReply)
+ {
+ return null;
+ }
+ List<String> rsp = chimeraListenerThread.getResponse(command);
+ return rsp;
+ }
+
+ public StructureManager getStructureManager()
+ {
+ return structureManager;
+ }
+
+ public boolean isBusy()
+ {
+ return busy;
+ }
+}
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraModel.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraModel.java
new file mode 100644
index 0000000..0700565
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraModel.java
@@ -0,0 +1,557 @@
+package ext.edu.ucsf.rbvi.strucviz2;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeMap;
+
+import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
+
+/**
+ * This class provides the implementation for the ChimeraModel, ChimeraChain,
+ * and ChimeraResidue objects
+ *
+ * @author scooter
+ *
+ */
+public class ChimeraModel implements ChimeraStructuralObject
+{
+
+ private String name; // The name of this model
+
+ private ModelType type; // The type of the model
+
+ private int modelNumber; // The model number
+
+ private int subModelNumber; // The sub-model number
+
+ private Color modelColor = null; // The color of this model (from Chimera)
+
+ private Object userData = null; // User data associated with this model
+
+ private boolean selected = false; // The selected state of this model
+
+ private TreeMap<String, ChimeraChain> chainMap; // The list of chains
+
+ // private TreeMap<String, ChimeraResidue> residueMap; // The list of residues
+ private HashSet<ChimeraResidue> funcResidues; // List of functional residues
+
+ /**
+ * Constructor to create a model
+ *
+ * @param name
+ * the name of this model
+ * @param color
+ * the model Color
+ * @param modelNumber
+ * the model number
+ * @param subModelNumber
+ * the sub-model number
+ */
+ public ChimeraModel(String name, ModelType type, int modelNumber,
+ int subModelNumber)
+ {
+ this.name = name;
+ this.type = type;
+ this.modelNumber = modelNumber;
+ this.subModelNumber = subModelNumber;
+
+ this.chainMap = new TreeMap<String, ChimeraChain>();
+ this.funcResidues = new HashSet<ChimeraResidue>();
+ }
+
+ /**
+ * Constructor to create a model from the Chimera input line
+ *
+ * @param inputLine
+ * Chimera input line from which to construct this model
+ */
+ // TODO: [Optional] How to distinguish between PDB and MODBASE?
+ // invoked when listing models: listm type molecule; lists level molecule
+ // line = model id #0 type Molecule name 1ert
+ public ChimeraModel(String inputLine)
+ {
+ this.name = ChimUtils.parseModelName(inputLine);
+ // TODO: [Optional] Write a separate method to get model type
+ if (name.startsWith("smiles"))
+ {
+ this.type = ModelType.SMILES;
+ }
+ else
+ {
+ this.type = ModelType.PDB_MODEL;
+ }
+ this.modelNumber = ChimUtils.parseModelNumber(inputLine)[0];
+ this.subModelNumber = ChimUtils.parseModelNumber(inputLine)[1];
+
+ this.chainMap = new TreeMap<String, ChimeraChain>();
+ this.funcResidues = new HashSet<ChimeraResidue>();
+ }
+
+ /**
+ * Add a residue to this model
+ *
+ * @param residue
+ * to add to the model
+ */
+ public void addResidue(ChimeraResidue residue)
+ {
+ residue.setChimeraModel(this);
+ // residueMap.put(residue.getIndex(), residue);
+ String chainId = residue.getChainId();
+ if (chainId != null)
+ {
+ addResidue(chainId, residue);
+ }
+ else
+ {
+ addResidue("_", residue);
+ }
+ // Put it in our map so that we can return it in order
+ // residueMap.put(residue.getIndex(), residue);
+ }
+
+ /**
+ * Add a residue to a chain in this model. If the chain associated with
+ * chainId doesn't exist, it will be created.
+ *
+ * @param chainId
+ * to add the residue to
+ * @param residue
+ * to add to the chain
+ */
+ public void addResidue(String chainId, ChimeraResidue residue)
+ {
+ ChimeraChain chain = null;
+ if (!chainMap.containsKey(chainId))
+ {
+ chain = new ChimeraChain(this.modelNumber, this.subModelNumber,
+ chainId);
+ chain.setChimeraModel(this);
+ chainMap.put(chainId, chain);
+ }
+ else
+ {
+ chain = chainMap.get(chainId);
+ }
+ chain.addResidue(residue);
+ }
+
+ /**
+ * Get the ChimeraModel (required for ChimeraStructuralObject interface)
+ *
+ * @return ChimeraModel
+ */
+ public ChimeraModel getChimeraModel()
+ {
+ return this;
+ }
+
+ /**
+ * Get the model color of this model
+ *
+ * @return model color of this model
+ */
+ public Color getModelColor()
+ {
+ return this.modelColor;
+ }
+
+ /**
+ * Set the color of this model
+ *
+ * @param color
+ * Color of this model
+ */
+ public void setModelColor(Color color)
+ {
+ this.modelColor = color;
+ }
+
+ /**
+ * Return the name of this model
+ *
+ * @return model name
+ */
+ public String getModelName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the name of this model
+ *
+ * @param name
+ * model name
+ */
+ public void setModelName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the model number of this model
+ *
+ * @return integer model number
+ */
+ public int getModelNumber()
+ {
+ return modelNumber;
+ }
+
+ /**
+ * Set the model number of this model
+ *
+ * @param modelNumber
+ * integer model number
+ */
+ public void setModelNumber(int modelNumber)
+ {
+ this.modelNumber = modelNumber;
+ }
+
+ /**
+ * Get the sub-model number of this model
+ *
+ * @return integer sub-model number
+ */
+ public int getSubModelNumber()
+ {
+ return subModelNumber;
+ }
+
+ /**
+ * Set the sub-model number of this model
+ *
+ * @param subModelNumber
+ * integer model number
+ */
+ public void setSubModelNumber(int subModelNumber)
+ {
+ this.subModelNumber = subModelNumber;
+ }
+
+ public ModelType getModelType()
+ {
+ return type;
+ }
+
+ public void setModelType(ModelType type)
+ {
+ this.type = type;
+ }
+
+ public HashSet<ChimeraResidue> getFuncResidues()
+ {
+ return funcResidues;
+ }
+
+ public void setFuncResidues(List<String> residues)
+ {
+ for (String residue : residues)
+ {
+ for (ChimeraChain chain : getChains())
+ {
+ if (residue.indexOf("-") > 0)
+ {
+ funcResidues.addAll(chain.getResidueRange(residue));
+ }
+ else
+ {
+ funcResidues.add(chain.getResidue(residue));
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the user data for this model
+ *
+ * @return user data
+ */
+ public Object getUserData()
+ {
+ return userData;
+ }
+
+ /**
+ * Set the user data for this model
+ *
+ * @param data
+ * user data to associate with this model
+ */
+ public void setUserData(Object data)
+ {
+ this.userData = data;
+ }
+
+ /**
+ * Return the selected state of this model
+ *
+ * @return the selected state
+ */
+ public boolean isSelected()
+ {
+ return selected;
+ }
+
+ /**
+ * Set the selected state of this model
+ *
+ * @param selected
+ * a boolean to set the selected state to
+ */
+ public void setSelected(boolean selected)
+ {
+ this.selected = selected;
+ }
+
+ /**
+ * Return the chains in this model as a List
+ *
+ * @return the chains in this model as a list
+ */
+ public List<ChimeraStructuralObject> getChildren()
+ {
+ return new ArrayList<ChimeraStructuralObject>(chainMap.values());
+ }
+
+ /**
+ * Return the chains in this model as a colleciton
+ *
+ * @return the chains in this model
+ */
+ public Collection<ChimeraChain> getChains()
+ {
+ return chainMap.values();
+ }
+
+ /**
+ * Get the number of chains in this model
+ *
+ * @return integer chain count
+ */
+ public int getChainCount()
+ {
+ return chainMap.size();
+ }
+
+ /**
+ * Get the list of chain names associated with this model
+ *
+ * @return return the list of chain names for this model
+ */
+ public Collection<String> getChainNames()
+ {
+ return chainMap.keySet();
+ }
+
+ /**
+ * Get the residues associated with this model
+ *
+ * @return the list of residues in this model
+ */
+ public Collection<ChimeraResidue> getResidues()
+ {
+ Collection<ChimeraResidue> residues = new ArrayList<ChimeraResidue>();
+ for (ChimeraChain chain : getChains())
+ {
+ residues.addAll(chain.getResidues());
+ }
+ return residues;
+ }
+
+ /**
+ * Get the number of residues in this model
+ *
+ * @return integer residues count
+ */
+ public int getResidueCount()
+ {
+ int count = 0;
+ for (ChimeraChain chain : getChains())
+ {
+ count += chain.getResidueCount();
+ }
+ return count;
+ }
+
+ /**
+ * Get a specific chain from the model
+ *
+ * @param chain
+ * the ID of the chain to return
+ * @return ChimeraChain associated with the chain
+ */
+ public ChimeraChain getChain(String chain)
+ {
+ if (chainMap.containsKey(chain))
+ {
+ return chainMap.get(chain);
+ }
+ return null;
+ }
+
+ /**
+ * Return a specific residue based on its index
+ *
+ * @param index
+ * of the residue to return
+ * @return the residue associated with that index
+ */
+ public ChimeraResidue getResidue(String chainId, String index)
+ {
+ if (chainMap.containsKey(chainId))
+ {
+ return chainMap.get(chainId).getResidue(index);
+ }
+ return null;
+ }
+
+ /**
+ * Checks if this model has selected children.
+ */
+ public boolean hasSelectedChildren()
+ {
+ if (selected)
+ {
+ return true;
+ }
+ else
+ {
+ for (ChimeraChain chain : getChains())
+ {
+ if (chain.hasSelectedChildren())
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return the list of selected residues
+ *
+ * @return all selected residues
+ */
+ public List<ChimeraResidue> getSelectedResidues()
+ {
+ List<ChimeraResidue> residueList = new ArrayList<ChimeraResidue>();
+ for (ChimeraChain chain : getChains())
+ {
+ if (selected)
+ {
+ residueList.addAll(chain.getSelectedResidues());
+ }
+ else
+ {
+ residueList.addAll(getResidues());
+ }
+ }
+ return residueList;
+ }
+
+ /**
+ * Return the Chimera specification for this model.
+ */
+ public String toSpec()
+ {
+ if (subModelNumber == 0)
+ return ("#" + modelNumber);
+ return ("#" + modelNumber + "." + subModelNumber);
+ }
+
+ /**
+ * Return a string representation for the model. Shorten if longer than 100
+ * characters.
+ */
+ public String toString()
+ {
+ String modelName = "";
+ // TODO: [Optional] Change cutoff for shortening model names in the
+ // structure naviagator dialog
+ if (getChainCount() > 0)
+ {
+ modelName = "Model " + toSpec() + " " + name + " (" + getChainCount()
+ + " chains, " + getResidueCount() + " residues)";
+ }
+ else if (getResidueCount() > 0)
+ {
+ modelName = "Model " + toSpec() + " " + name + " ("
+ + getResidueCount() + " residues)";
+ }
+ else
+ {
+ modelName = "Model " + toSpec() + " " + name + "";
+ }
+
+ Set<String> networkNames = new HashSet<String>();
+ Set<String> nodeNames = new HashSet<String>();
+ Set<String> edgeNames = new HashSet<String>();
+
+ String cytoName = " [";
+ if (networkNames.size() > 0)
+ {
+ if (networkNames.size() == 1)
+ {
+ cytoName += "Network {";
+ }
+ else if (networkNames.size() > 1)
+ {
+ cytoName += "Networks {";
+ }
+ for (String cName : networkNames)
+ {
+ cytoName += cName + ",";
+ }
+ cytoName = cytoName.substring(0, cytoName.length() - 1) + "}, ";
+ }
+ if (nodeNames.size() > 0)
+ {
+ if (nodeNames.size() == 1)
+ {
+ cytoName += "Node {";
+ }
+ else if (nodeNames.size() > 1)
+ {
+ cytoName += "Nodes {";
+ }
+ for (String cName : nodeNames)
+ {
+ cytoName += cName + ",";
+ }
+ cytoName = cytoName.substring(0, cytoName.length() - 1) + "}, ";
+ }
+ if (edgeNames.size() > 0)
+ {
+ if (edgeNames.size() == 1)
+ {
+ cytoName += "Edge {";
+ }
+ else if (edgeNames.size() > 1)
+ {
+ cytoName += "Edges {";
+ }
+ for (String cName : edgeNames)
+ {
+ cytoName += cName + ",";
+ }
+ cytoName = cytoName.substring(0, cytoName.length() - 1) + "}, ";
+ }
+ if (cytoName.endsWith(", "))
+ {
+ cytoName = cytoName.substring(0, cytoName.length() - 2);
+ }
+ cytoName += "]";
+ String nodeName = modelName + cytoName;
+ if (nodeName.length() > 100)
+ {
+ nodeName = nodeName.substring(0, 100) + "...";
+ }
+ return nodeName;
+ }
+}
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraResidue.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraResidue.java
new file mode 100644
index 0000000..0045e97
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraResidue.java
@@ -0,0 +1,456 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2006 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package ext.edu.ucsf.rbvi.strucviz2;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class provides the implementation for the ChimeraResidue, object
+ *
+ * @author scooter
+ *
+ */
+
+public class ChimeraResidue implements ChimeraStructuralObject,
+ Comparable<ChimeraResidue>
+{
+
+ /* Constants */
+ public static final int SINGLE_LETTER = 0; // Display residues as a single
+ // letter
+
+ public static final int THREE_LETTER = 1; // Display residues as three letters
+
+ public static final int FULL_NAME = 2; // Display full residue names
+
+ private String type; // Residue type
+
+ private String index; // Residue index
+
+ private String chainId; // ChainID for this residue
+
+ private int modelNumber; // model number for this residue
+
+ private int subModelNumber; // sub-model number for this residue
+
+ protected int residueNumber;
+
+ protected String insertionCode;
+
+ private ChimeraModel chimeraModel; // ChimeraModel the residue is part of
+
+ private Object userData; // user data to associate with this residue
+
+ // public static HashMap<String, String> aaNames = null; // a map of amino
+ // acid
+ // names
+ private static int displayType = THREE_LETTER; // the current display type
+
+ private boolean selected = false; // the selection state
+
+ /**
+ * Constructor to create a new ChimeraResidue
+ *
+ * @param type
+ * the residue type
+ * @param index
+ * the index of the residue
+ * @param modelNumber
+ * the model number this residue is part of
+ */
+ public ChimeraResidue(String type, String index, int modelNumber)
+ {
+ this(type, index, modelNumber, 0);
+ }
+
+ /**
+ * Constructor to create a new ChimeraResidue
+ *
+ * @param type
+ * the residue type
+ * @param index
+ * the index of the residue
+ * @param modelNumber
+ * the model number this residue is part of
+ * @param subModelNumber
+ * the sub-model number this residue is part of
+ */
+ public ChimeraResidue(String type, String index, int modelNumber,
+ int subModelNumber)
+ {
+ this.type = type;
+ this.index = index;
+ this.modelNumber = modelNumber;
+ this.subModelNumber = subModelNumber;
+ splitInsertionCode(this.index);
+ // if (aaNames == null) {
+ // initNames();
+ // }
+ }
+
+ /**
+ * Constructor to create a new ChimeraResidue from an input line
+ *
+ * @param chimeraInputLine
+ * a Chimera residue description
+ */
+ // invoked when listing (selected) residues: listr spec #0; lists level
+ // residue
+ // Line: residue id #0:37.A type MET
+ public ChimeraResidue(String chimeraInputLine)
+ {
+ // initNames();
+ String[] split1 = chimeraInputLine.split(":");
+
+ // First half has model number -- get the number
+ int numberOffset = split1[0].indexOf('#');
+ String model = split1[0].substring(numberOffset + 1);
+ int decimalOffset = model.indexOf('.'); // Do we have a sub-model?
+ try
+ {
+ this.subModelNumber = 0;
+ if (decimalOffset > 0)
+ {
+ this.subModelNumber = Integer.parseInt(model
+ .substring(decimalOffset + 1));
+ this.modelNumber = Integer.parseInt(model.substring(0,
+ decimalOffset));
+ }
+ else
+ {
+ this.modelNumber = Integer.parseInt(model);
+ }
+ } catch (Exception e)
+ {
+ LoggerFactory.getLogger(ChimeraResidue.class).error(
+ "Unexpected return from Chimera: " + model);
+ this.modelNumber = -1;
+ }
+
+ // Second half has residue info: index & type
+ String[] rTokens = split1[1].split(" ");
+ this.type = rTokens[2];
+
+ String[] iTokens = rTokens[0].split("\\.");
+ if (iTokens.length > 0)
+ {
+ this.index = iTokens[0];
+
+ // Careful, might or might not have a chainID
+ if (iTokens.length > 1)
+ this.chainId = iTokens[1];
+ else
+ this.chainId = "_";
+ }
+ else
+ this.index = rTokens[0];
+
+ splitInsertionCode(this.index);
+ }
+
+ /**
+ * Set the selected state for this residue
+ *
+ * @param selected
+ * the selection state to set
+ */
+ public void setSelected(boolean selected)
+ {
+ this.selected = selected;
+ }
+
+ /**
+ * Return the selected state of this residue
+ *
+ * @return the selected state
+ */
+ public boolean isSelected()
+ {
+ return selected;
+ }
+
+ /**
+ * Return an array made up of this residue (required for
+ * ChimeraStructuralObject interface
+ *
+ * @return a List with this residue as its sole member
+ */
+ public List<ChimeraStructuralObject> getChildren()
+ {
+ List<ChimeraStructuralObject> v = new ArrayList<ChimeraStructuralObject>();
+ v.add(this);
+ return v;
+ }
+
+ /**
+ * Return the string representation of this residue as follows:
+ * "<i>residue_name</i> <i>index</i>" where <i>residue_name</i> could be
+ * either the single letter, three letter, or full name representation of the
+ * amino acid.
+ *
+ * @return the string representation
+ */
+ public String displayName()
+ {
+ return toString();
+ }
+
+ /**
+ * Return the string representation of this residue as follows:
+ * "<i>residue_name</i> <i>index</i>" where <i>residue_name</i> could be
+ * either the single letter, three letter, or full name representation of the
+ * amino acid.
+ *
+ * @return the string representation
+ */
+ public String toString()
+ {
+ if (displayType == FULL_NAME)
+ {
+ return (ChimUtils.toFullName(type) + " " + index);
+ }
+ else if (displayType == SINGLE_LETTER)
+ {
+ return (ChimUtils.toSingleLetter(type) + " " + index);
+ }
+ else if (displayType == THREE_LETTER)
+ {
+ return (ChimUtils.toThreeLetter(type) + " " + index);
+ }
+ else
+ {
+ return (type + " " + index);
+ }
+ }
+
+ /**
+ * Return the Chimera specification for this Residue
+ *
+ * @return Chimera specification
+ */
+ public String toSpec()
+ {
+ if (!chainId.equals("_"))
+ return ("#" + modelNumber + ":" + index + "." + chainId);
+ else
+ return ("#" + modelNumber + ":" + index + ".");
+ }
+
+ /**
+ * Get the index of this residue
+ *
+ * @return residue index
+ */
+ public String getIndex()
+ {
+ return this.index;
+ }
+
+ /**
+ * Get the chainID for this residue
+ *
+ * @return String value of the chainId
+ */
+ public String getChainId()
+ {
+ return this.chainId;
+ }
+
+ /**
+ * Get the type for this residue
+ *
+ * @return residue type
+ */
+ public String getType()
+ {
+ return this.type;
+ }
+
+ /**
+ * Get the model number for this residue
+ *
+ * @return the model number
+ */
+ public int getModelNumber()
+ {
+ return this.modelNumber;
+ }
+
+ /**
+ * Get the sub-model number for this residue
+ *
+ * @return the sub-model number
+ */
+ public int getSubModelNumber()
+ {
+ return this.subModelNumber;
+ }
+
+ /**
+ * Get the model this residue is part of
+ *
+ * @return the ChimeraModel
+ */
+ public ChimeraModel getChimeraModel()
+ {
+ return this.chimeraModel;
+ }
+
+ /**
+ * Set the model this residue is part of
+ *
+ * @param chimeraModel
+ * the ChimeraModel this model is part of
+ */
+ public void setChimeraModel(ChimeraModel chimeraModel)
+ {
+ this.chimeraModel = chimeraModel;
+ }
+
+ /**
+ * Get the user data for this residue
+ *
+ * @return user data
+ */
+ public Object getUserData()
+ {
+ return userData;
+ }
+
+ /**
+ * Set the user data for this Residue
+ *
+ * @param data
+ * the user data to associate with this residue
+ */
+ public void setUserData(Object data)
+ {
+ this.userData = data;
+ }
+
+ public int compareTo(ChimeraResidue c2)
+ {
+ if (residueNumber < c2.residueNumber)
+ return -1;
+ else if (residueNumber == c2.residueNumber)
+ {
+ if (insertionCode == null && c2.insertionCode == null)
+ return 0;
+ else if (insertionCode == null)
+ return -1;
+ else if (c2.insertionCode == null)
+ return 1;
+ return (insertionCode.compareTo(c2.insertionCode));
+ }
+ return 1;
+ }
+
+ public void splitInsertionCode(String residue)
+ {
+ // OK, split the index into number and insertion code
+ Pattern p = Pattern.compile("(\\d*)([A-Z]?)");
+ Matcher m = p.matcher(residue);
+ if (m.matches())
+ {
+ this.residueNumber = Integer.parseInt(m.group(1));
+ if (m.groupCount() > 1)
+ this.insertionCode = m.group(2);
+ else
+ this.insertionCode = null;
+ }
+ }
+
+ /**********************************************
+ * Static routines
+ *********************************************/
+
+ /**
+ * Initialize the residue names
+ */
+ // private static void initNames() {
+ // // Create our residue name table
+ // aaNames = new HashMap<String, String>();
+ // aaNames.put("ALA", "A Ala Alanine N[C@@H](C)C(O)=O");
+ // aaNames.put("ARG", "R Arg Arginine N[C@@H](CCCNC(N)=N)C(O)=O");
+ // aaNames.put("ASN", "N Asn Asparagine N[C@@H](CC(N)=O)C(O)=O");
+ // aaNames.put("ASP", "D Asp Aspartic_acid N[C@@H](CC(O)=O)C(O)=O");
+ // aaNames.put("CYS", "C Cys Cysteine N[C@@H](CS)C(O)=O");
+ // aaNames.put("GLN", "Q Gln Glutamine N[C at H](C(O)=O)CCC(N)=O");
+ // aaNames.put("GLU", "E Glu Glumatic_acid N[C at H](C(O)=O)CCC(O)=O");
+ // aaNames.put("GLY", "G Gly Glycine NCC(O)=O");
+ // aaNames.put("HIS", "H His Histidine N[C@@H](CC1=CN=CN1)C(O)=O");
+ // aaNames.put("ILE", "I Ile Isoleucine N[C@]([C at H](C)CC)([H])C(O)=O");
+ // aaNames.put("LEU", "L Leu Leucine N[C@](CC(C)C)([H])C(O)=O");
+ // aaNames.put("LYS", "K Lys Lysine N[C@](CCCCN)([H])C(O)=O");
+ // aaNames.put("DLY", "K Dly D-Lysine NCCCC[C@@H](N)C(O)=O");
+ // aaNames.put("MET", "M Met Methionine N[C@](CCSC)([H])C(O)=O");
+ // aaNames.put("PHE", "F Phe Phenylalanine N[C@](CC1=CC=CC=C1)([H])C(O)=O");
+ // aaNames.put("PRO", "P Pro Proline OC([C@@]1([H])NCCC1)=O");
+ // aaNames.put("SER", "S Ser Serine OC[C@](C(O)=O)([H])N");
+ // aaNames.put("THR", "T Thr Threonine O[C at H](C)[C@](C(O)=O)([H])N");
+ // aaNames.put("TRP",
+ // "W Trp Tryptophan N[C@@]([H])(CC1=CN([H])C2=C1C=CC=C2)C(O)=O");
+ // aaNames.put("TYR", "Y Tyr Tyrosine N[C@@](C(O)=O)([H])CC1=CC=C(O)C=C1");
+ // aaNames.put("VAL", "V Val Valine N[C@@](C(O)=O)([H])C(C)C");
+ // aaNames.put("ASX", "B Asx Aspartic_acid_or_Asparagine");
+ // aaNames.put("GLX", "Z Glx Glutamine_or_Glutamic_acid");
+ // aaNames.put("XAA", "X Xaa Any_or_unknown_amino_acid");
+ // aaNames.put("HOH", "HOH HOH Water [H]O[H]");
+ // }
+
+ /**
+ * Set the display type.
+ *
+ * @param type
+ * the display type
+ */
+ public static void setDisplayType(int type)
+ {
+ displayType = type;
+ }
+
+ public static int getDisplayType()
+ {
+ return displayType;
+ }
+
+ public boolean hasSelectedChildren()
+ {
+ return false;
+ }
+}
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraStructuralObject.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraStructuralObject.java
new file mode 100644
index 0000000..64568a7
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraStructuralObject.java
@@ -0,0 +1,112 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2006 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package ext.edu.ucsf.rbvi.strucviz2;
+
+import java.util.List;
+
+/**
+ * This interface provides a common set of methods that are implemented by the
+ * ChimeraModel, ChimeraChain, and ChimeraResidue classes.
+ *
+ * @author scooter
+ *
+ */
+
+public interface ChimeraStructuralObject
+{
+
+ /**
+ * Return the Chimera selection specification for this object
+ *
+ * @return a String representing a Chimera atom-spec
+ */
+ public String toSpec();
+
+ /**
+ * Return a String representation for this object
+ *
+ * @return a String representing the object name
+ */
+ public String toString();
+
+ /**
+ * Return the userData for this object
+ *
+ * @return an Object representing the userData (usually TreePath)
+ */
+ public Object getUserData();
+
+ /**
+ * Set the userData for this object
+ *
+ * @param userData
+ * the Object representing the userData (usually TreePath)
+ */
+ public void setUserData(Object userData);
+
+ /**
+ * Return the ChimeraModel for this object
+ *
+ * @return the ChimeraModel this object is part of
+ */
+ public ChimeraModel getChimeraModel();
+
+ /**
+ * Set the "selected" state of this object
+ *
+ * @param selected
+ * boolean value as to whether this object is selected
+ */
+ public void setSelected(boolean selected);
+
+ /**
+ * Get the "selected" state of this object
+ *
+ * @return the selected state of this object
+ */
+ public boolean isSelected();
+
+ /**
+ * Get the selected state of this object and its children.
+ *
+ * @return true if any child is selected.
+ */
+ public boolean hasSelectedChildren();
+
+ /**
+ * Get the children of this object (if any)
+ *
+ * @return the children of the object
+ */
+ public List<ChimeraStructuralObject> getChildren();
+}
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraTreeModel.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraTreeModel.java
new file mode 100644
index 0000000..9ecc6a7
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraTreeModel.java
@@ -0,0 +1,216 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2006 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package ext.edu.ucsf.rbvi.strucviz2;
+
+// System imports
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+// Cytoscape imports
+// StructureViz imports
+
+/**
+ * The ChimeraTreeModel class provides the underlying model for the navigation
+ * tree in the ModelNavigatorDialog.
+ *
+ * @author scooter
+ * @see ModelNavigatorDialog
+ */
+public class ChimeraTreeModel extends DefaultTreeModel
+{
+ private ChimeraManager chimeraManager;
+
+ private JTree navigationTree;
+
+ private int residueDisplay = ChimeraResidue.THREE_LETTER;
+
+ /**
+ * Constructor for the ChimeraTreeModel.
+ *
+ * @param chimeraObject
+ * the Chimera object that this tree represents
+ * @param tree
+ * the JTree used to display the object
+ * @see Chimera
+ */
+ public ChimeraTreeModel(ChimeraManager chimeraManager, JTree tree)
+ {
+ super(new DefaultMutableTreeNode());
+ this.chimeraManager = chimeraManager;
+ this.navigationTree = tree;
+ DefaultMutableTreeNode rootNode = buildTree();
+ this.setRoot(rootNode);
+ }
+
+ /**
+ * Set the display type for the residues. The display type must be one of:
+ *
+ * ChimeraResidue.THREE_LETTER ChimeraResidue.SINGLE_LETTER
+ * ChimeraResidue.FULL_NAME
+ *
+ * @param newDisplay
+ * the display type
+ * @see ChimeraResidue
+ */
+ public void setResidueDisplay(int newDisplay)
+ {
+ this.residueDisplay = newDisplay;
+ }
+
+ /**
+ * This method is called to rebuild the tree model "from scratch"
+ */
+ public void reload()
+ {
+ // First, rebuild the tree with the new data
+ DefaultMutableTreeNode rootNode = buildTree();
+ this.setRoot(rootNode);
+
+ // Now let the superclass do all of the work
+ super.reload();
+ }
+
+ /**
+ * Rebuild an existing tree
+ */
+ public void rebuildTree()
+ {
+ DefaultMutableTreeNode rootNode = buildTree();
+ DefaultTreeModel model = (DefaultTreeModel) navigationTree.getModel();
+ model.setRoot(rootNode);
+ model.reload();
+ }
+
+ /**
+ * Build the tree from the current Chimera data
+ *
+ * @return DefaultMutableTreeNode that represents the currently loaded Chimera
+ * models
+ */
+ private DefaultMutableTreeNode buildTree()
+ {
+ int modelCount = chimeraManager.getChimeraModelsCount(true);
+ DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(modelCount
+ + " Open Chimera Models");
+ TreePath rootPath = new TreePath(rootNode);
+
+ TreePath path = null;
+ DefaultMutableTreeNode model = null;
+
+ // Add all of the Chimera models
+ for (ChimeraModel chimeraModel : chimeraManager.getChimeraModels())
+ {
+ model = new DefaultMutableTreeNode(chimeraModel);
+ path = rootPath.pathByAddingChild(model);
+ chimeraModel.setUserData(path);
+ addChainNodes(chimeraModel, model, path);
+ rootNode.add(model);
+ }
+ return rootNode;
+ }
+
+ /**
+ * add chains to a tree model
+ *
+ * @param chimeraModel
+ * the ChimeraModel to get the chains from
+ * @param treeModel
+ * the tree model to add the chains to
+ * @param treePath
+ * the tree path where the chains should be added
+ */
+ private void addChainNodes(ChimeraModel chimeraModel,
+ DefaultMutableTreeNode treeModel, TreePath treePath)
+ {
+ DefaultMutableTreeNode chain = null;
+ TreePath chainPath = null;
+
+ // Get the list of chains
+ Collection<ChimeraChain> chainList = chimeraModel.getChains();
+
+ if (chainList.size() == 0)
+ {
+ // No chains! Just add the residues
+ addResidues(chimeraModel.getResidues(), treeModel, treePath);
+ return;
+ }
+
+ // Iterate over the chains and add the chain and all of
+ // the chain's residues
+ for (ChimeraChain chimeraChain : chainList)
+ {
+ chain = new DefaultMutableTreeNode(chimeraChain);
+ chainPath = treePath.pathByAddingChild(chain);
+ chimeraChain.setUserData(chainPath);
+ addResidues(chimeraChain.getResidues(), chain, chainPath);
+ treeModel.add(chain);
+ }
+ }
+
+ /**
+ * add residues to a tree model
+ *
+ * @param residues
+ * the residues to add
+ * @param treeModel
+ * the tree model to add the residues to
+ * @param treePath
+ * the tree path where the residues should be added
+ */
+ private void addResidues(Collection<ChimeraResidue> residues,
+ DefaultMutableTreeNode treeModel, TreePath treePath)
+ {
+ DefaultMutableTreeNode residue = null;
+ TreePath residuePath = null;
+
+ List<ChimeraResidue> sortedResidues = new ArrayList<ChimeraResidue>(
+ residues);
+ Collections.sort(sortedResidues);
+
+ // Iterate over all residues & add them to the tree
+ for (ChimeraResidue res : sortedResidues)
+ {
+ res.setDisplayType(this.residueDisplay);
+ residue = new DefaultMutableTreeNode(res);
+ residuePath = treePath.pathByAddingChild(residue);
+ res.setUserData(residuePath);
+ treeModel.add(residue);
+ }
+ }
+}
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java
new file mode 100644
index 0000000..6fd6340
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java
@@ -0,0 +1,960 @@
+package ext.edu.ucsf.rbvi.strucviz2;
+
+import jalview.bin.Cache;
+import jalview.gui.Preferences;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This object maintains the relationship between Chimera objects and Cytoscape
+ * objects.
+ */
+
+public class StructureManager
+{
+ static final String[] defaultStructureKeys = { "Structure", "pdb",
+ "pdbFileName", "PDB ID", "structure", "biopax.xref.PDB", "pdb_ids",
+ "ModelName", "ModelNumber" };
+
+ static final String[] defaultChemStructKeys = { "Smiles", "smiles",
+ "SMILES" };
+
+ static final String[] defaultResidueKeys = { "FunctionalResidues",
+ "ResidueList", "Residues" };
+
+ public enum ModelType
+ {
+ PDB_MODEL, MODBASE_MODEL, SMILES
+ };
+
+ public static Properties pathProps;
+
+ private String chimeraCommandAttr = "ChimeraCommand";
+
+ private String chimeraOutputTable = "ChimeraTable";
+
+ private String chimeraOutputAttr = "ChimeraOutput";
+
+ private boolean haveGUI = true;
+
+ private ChimeraManager chimeraManager = null;
+
+ static private List<ChimeraStructuralObject> chimSelectionList;
+
+ private boolean ignoreCySelection = false;
+
+ private File configurationDirectory = null;
+
+ private static Logger logger = LoggerFactory
+ .getLogger(ext.edu.ucsf.rbvi.strucviz2.StructureManager.class);
+
+ public StructureManager(boolean haveGUI)
+ {
+ this.haveGUI = haveGUI;
+ // Create the Chimera interface
+ chimeraManager = new ChimeraManager(this);
+ chimSelectionList = new ArrayList<ChimeraStructuralObject>();
+ pathProps = new Properties();
+ }
+
+ public ChimeraManager getChimeraManager()
+ {
+ return chimeraManager;
+ }
+
+ public boolean openStructures(Collection<List<String>> chimObjNames,
+ ModelType type)
+ {
+ // new models
+ Map<String, List<ChimeraModel>> newModels = new HashMap<String, List<ChimeraModel>>();
+ if (chimObjNames.size() > 0)
+ {
+ List<String> names = chimObjNames.iterator().next();
+ if (names == null)
+ {
+ return false;
+ }
+ for (String chimObjName : names)
+ {
+ // get or open the corresponding models if they already exist
+ List<ChimeraModel> currentModels = chimeraManager.getChimeraModels(
+ chimObjName, type);
+ if (currentModels.size() == 0)
+ {
+ // open and return models
+ currentModels = chimeraManager.openModel(chimObjName, type);
+ if (currentModels == null)
+ {
+ // failed to open model, continue with next
+ continue;
+ }
+ // if (type == ModelType.SMILES) {
+ // newModels.put("smiles:" + chimObjName, currentModels);
+ // } else {
+ newModels.put(chimObjName, currentModels);
+ // }
+ // for each model
+ for (ChimeraModel currentModel : currentModels)
+ {
+ // if not RIN then associate new model with the Cytoscape
+ // node
+ // if (!currentChimMap.containsKey(currentModel)) {
+ // currentChimMap.put(currentModel, new HashSet<CyIdentifiable>());
+ // }
+ }
+ }
+ }
+ }
+ else
+ {
+ return false;
+ }
+ // update dialog
+ // if (mnDialog != null) {
+ // mnDialog.modelChanged();
+ // }
+ // aTask.associate();
+ return true;
+
+ }
+
+ // TODO: [Release] Handle case where one network is associated with two models
+ // that are opened
+ // at the same time
+ /*
+ * public boolean openStructures(CyNetwork network, Map<CyIdentifiable,
+ * List<String>> chimObjNames, ModelType type) { if
+ * (!chimeraManager.isChimeraLaunched() &&
+ * !chimeraManager.launchChimera(getChimeraPaths(network))) {
+ * logger.error("Chimera could not be launched."); return false; } else if
+ * (chimObjNames.size() == 0) { return false; } else if (network == null) {
+ * return openStructures(chimObjNames.values(), type); }
+ *
+ * // potential rins Set<CyNetwork> potentialRINs = new HashSet<CyNetwork>();
+ * // attributes List<String> attrsFound = new ArrayList<String>();
+ * attrsFound.
+ * addAll(CytoUtils.getMatchingAttributes(network.getDefaultNodeTable(),
+ * getCurrentStructureKeys(network)));
+ * attrsFound.addAll(CytoUtils.getMatchingAttributes
+ * (network.getDefaultNodeTable(), getCurrentChemStructKeys(network))); // new
+ * models Map<String, List<ChimeraModel>> newModels = new HashMap<String,
+ * List<ChimeraModel>>(); // for each node that has an associated structure
+ * for (CyIdentifiable cyObj : chimObjNames.keySet()) { // get possible res
+ * specs List<String> specsFound = null; if (cyObj instanceof CyNode) {
+ * specsFound = ChimUtils.getResidueKeys(network.getDefaultNodeTable(), cyObj,
+ * attrsFound); } // save node to track its selection and mapping to chimera
+ * objects if (!currentCyMap.containsKey(cyObj)) { currentCyMap.put(cyObj, new
+ * HashSet<ChimeraStructuralObject>()); } // save node to network mapping to
+ * keep track of selection events if (!networkMap.containsKey(cyObj)) {
+ * networkMap.put(cyObj, new HashSet<CyNetwork>()); }
+ * networkMap.get(cyObj).add(network); // for each structure that has to be
+ * opened for (String chimObjName : chimObjNames.get(cyObj)) { // get or open
+ * the corresponding models if they already exist List<ChimeraModel>
+ * currentModels = chimeraManager.getChimeraModels(chimObjName, type); if
+ * (currentModels.size() == 0) { // open and return models currentModels =
+ * chimeraManager.openModel(chimObjName, type); if (currentModels == null) {
+ * // failed to open model, continue with next continue; } // if (type ==
+ * ModelType.SMILES) { // newModels.put("smiles:" + chimObjName,
+ * currentModels); // } else { newModels.put(chimObjName, currentModels); // }
+ * // for each model for (ChimeraModel currentModel : currentModels) { //
+ * check if it is a RIN boolean foundRIN = false; if
+ * (currentModel.getModelType().equals(ModelType.PDB_MODEL)) { // go through
+ * all node annotations and check if any of them is a residue // or a chain if
+ * (cyObj instanceof CyNode && network.containsNode((CyNode) cyObj) &&
+ * specsFound != null && specsFound.size() > 0) { for (String resSpec :
+ * specsFound) { ChimeraStructuralObject res =
+ * ChimUtils.fromAttribute(resSpec, chimeraManager); if (res != null && (res
+ * instanceof ChimeraResidue || res instanceof ChimeraChain)) { // if so,
+ * assume it might be a RIN potentialRINs.add(network); foundRIN = true;
+ * break; } } } else if (cyObj instanceof CyNetwork) { // if cyObj is a
+ * network, check for residue/chain annotations in an // arbitrary node
+ * CyNetwork rinNet = (CyNetwork) cyObj; if (rinNet.getNodeList().size() > 0)
+ * { specsFound = ChimUtils.getResidueKeys( rinNet.getDefaultNodeTable(),
+ * rinNet.getNodeList().get(0), attrsFound); for (String resSpec : specsFound)
+ * { ChimeraStructuralObject res = ChimUtils.fromAttribute( resSpec,
+ * chimeraManager); if (res != null && (res instanceof ChimeraResidue || res
+ * instanceof ChimeraChain)) { potentialRINs.add(network); foundRIN = true;
+ * break; } } } } } if (foundRIN) { continue; } // if not RIN then associate
+ * new model with the Cytoscape // node if
+ * (!currentChimMap.containsKey(currentModel)) {
+ * currentChimMap.put(currentModel, new HashSet<CyIdentifiable>()); } String
+ * cyObjName = network.getRow(cyObj).get(CyNetwork.NAME, String.class); if
+ * (cyObjName != null && cyObjName.endsWith(currentModel.getModelName())) { //
+ * it is a modbase model, associate directly
+ * currentCyMap.get(cyObj).add(currentModel);
+ * currentChimMap.get(currentModel).add(cyObj);
+ * currentModel.addCyObject(cyObj, network); } else if (specsFound != null &&
+ * specsFound.size() > 0) { for (String resSpec : specsFound) {
+ * ChimeraStructuralObject specModel = ChimUtils.fromAttribute( resSpec,
+ * chimeraManager); if (specModel == null &&
+ * resSpec.equals(currentModel.getModelName())) { specModel =
+ * chimeraManager.getChimeraModel( currentModel.getModelNumber(),
+ * currentModel.getSubModelNumber()); } if (specModel != null &&
+ * currentModel.toSpec().equals(specModel.toSpec()) ||
+ * currentModel.getModelName().equals("smiles:" + resSpec)) {
+ * currentCyMap.get(cyObj).add(currentModel);
+ * currentChimMap.get(currentModel).add(cyObj);
+ * currentModel.addCyObject(cyObj, network);
+ * currentModel.setFuncResidues(ChimUtils.parseFuncRes(
+ * getResidueList(network, cyObj), chimObjName)); } } } } } } } // networks
+ * that contain nodes associated to newly opened models // this will usually
+ * be of length 1 for (CyNetwork net : potentialRINs) {
+ * addStructureNetwork(net); } // update dialog if (mnDialog != null) {
+ * mnDialog.modelChanged(); } aTask.associate(); return true; }
+ */
+ public void closeStructures(Set<String> chimObjNames)
+ {
+ // for each cytoscape object and chimera model pair
+ for (String modelName : chimObjNames)
+ {
+ List<ChimeraModel> models = chimeraManager
+ .getChimeraModels(modelName);
+ for (ChimeraModel model : models)
+ {
+ closeModel(model);
+ }
+ }
+ // if (mnDialog != null) {
+ // mnDialog.modelChanged();
+ // }
+ }
+
+ // TODO: [Optional] Can we make a screenshot of a single molecule?
+ public File saveChimeraImage()
+ {
+ File tmpFile = null;
+ try
+ {
+ // Create the temp file name
+ tmpFile = File.createTempFile("structureViz", ".png");
+ chimeraManager.sendChimeraCommand("set bgTransparency", false);
+ chimeraManager.sendChimeraCommand(
+ "copy file " + tmpFile.getAbsolutePath() + " png", true);
+ chimeraManager.sendChimeraCommand("unset bgTransparency", false);
+ } catch (IOException ioe)
+ {
+ // Log error
+ logger.error("Error writing image", ioe);
+ }
+ return tmpFile;
+ }
+
+ public void closeModel(ChimeraModel model)
+ {
+ // close model in Chimera
+ chimeraManager.closeModel(model);
+ // remove all associations
+ // if (currentChimMap.containsKey(model)) {
+ // for (CyIdentifiable cyObj : model.getCyObjects().keySet()) {
+ // if (cyObj == null) {
+ // continue;
+ // } else if (currentCyMap.containsKey(cyObj)) {
+ // currentCyMap.get(cyObj).remove(model);
+ // } else if (cyObj instanceof CyNetwork) {
+ // for (ChimeraResidue residue : model.getResidues()) {
+ // if (currentChimMap.containsKey(residue)) {
+ // for (CyIdentifiable cyObjRes : currentChimMap.get(residue)) {
+ // if (currentCyMap.containsKey(cyObjRes)) {
+ // currentCyMap.get(cyObjRes).remove(residue);
+ // }
+ // }
+ // currentChimMap.remove(residue);
+ // }
+ // }
+ // }
+ // }
+ // currentChimMap.remove(model);
+ // }
+ }
+
+ // public void addStructureNetwork(CyNetwork rin) {
+ // if (rin == null) {
+ // return;
+ // }
+ // ChimeraModel model = null;
+ // // the network is not added to the model in the currentChimMap
+ // List<String> attrsFound =
+ // CytoUtils.getMatchingAttributes(rin.getDefaultNodeTable(),
+ // getCurrentStructureKeys(rin));
+ // for (CyNode node : rin.getNodeList()) {
+ // if (!networkMap.containsKey(node)) {
+ // networkMap.put(node, new HashSet<CyNetwork>());
+ // }
+ // networkMap.get(node).add(rin);
+ // List<String> specsFound =
+ // ChimUtils.getResidueKeys(rin.getDefaultNodeTable(), node,
+ // attrsFound);
+ // for (String residueSpec : specsFound) {
+ // // if (!rin.getRow(node).isSet(ChimUtils.RESIDUE_ATTR)) {
+ // // continue;
+ // // }
+ // // String residueSpec = rin.getRow(node).get(ChimUtils.RESIDUE_ATTR,
+ // String.class);
+ // ChimeraStructuralObject chimObj = ChimUtils.fromAttribute(residueSpec,
+ // chimeraManager);
+ // // chimObj.getChimeraModel().addCyObject(node, rin);
+ // if (chimObj == null || chimObj instanceof ChimeraModel) {
+ // continue;
+ // }
+ // model = chimObj.getChimeraModel();
+ // if (!currentCyMap.containsKey(node)) {
+ // currentCyMap.put(node, new HashSet<ChimeraStructuralObject>());
+ // }
+ // currentCyMap.get(node).add(chimObj);
+ // if (!currentChimMap.containsKey(chimObj)) {
+ // currentChimMap.put(chimObj, new HashSet<CyIdentifiable>());
+ // }
+ // currentChimMap.get(chimObj).add(node);
+ // }
+ // }
+ // if (model != null) {
+ // model.addCyObject(rin, rin);
+ // if (!currentCyMap.containsKey(rin)) {
+ // currentCyMap.put(rin, new HashSet<ChimeraStructuralObject>());
+ // }
+ // currentCyMap.get(rin).add(model);
+ // }
+ // }
+
+ public void exitChimera()
+ {
+ // // exit chimera, invokes clearOnExitChimera
+ // if (mnDialog != null) {
+ // mnDialog.setVisible(false);
+ // mnDialog = null;
+ // }
+ // if (alDialog != null) {
+ // alDialog.setVisible(false);
+ // }
+ chimeraManager.exitChimera();
+ }
+
+ // invoked by ChimeraManager whenever Chimera exits
+ public void clearOnChimeraExit()
+ {
+ // // clear structures
+ // currentCyMap.clear();
+ // currentChimMap.clear();
+ // networkMap.clear();
+ chimSelectionList.clear();
+ // if (chimTable != null) {
+ // ((CyTableManager)
+ // getService(CyTableManager.class)).deleteTable(chimTable.getSUID());
+ // }
+ // if (mnDialog != null) {
+ // if (mnDialog.isVisible()) {
+ // mnDialog.lostChimera();
+ // mnDialog.setVisible(false);
+ // }
+ // mnDialog = null;
+ // if (alDialog != null) {
+ // alDialog.setVisible(false);
+ // }
+ // }
+ }
+
+ // We need to do this in two passes since some parts of a structure might be
+ // selected and some might not. Our selection model (unfortunately) only
+ // tells
+ // us that something has changed, not what...
+ public void updateCytoscapeSelection()
+ {
+ // List<ChimeraStructuralObject> selectedChimObj
+ ignoreCySelection = true;
+ // System.out.println("update Cytoscape selection");
+ // find all possibly selected Cytoscape objects and unselect them
+ // Set<CyNetwork> networks = new HashSet<CyNetwork>();
+ // for (CyIdentifiable currentCyObj : currentCyMap.keySet()) {
+ // if (!networkMap.containsKey(currentCyObj)) {
+ // continue;
+ // }
+ // Set<CyNetwork> currentCyNetworks = networkMap.get(currentCyObj);
+ // if (currentCyNetworks == null || currentCyNetworks.size() == 0) {
+ //
+ // continue;
+ // }
+ // for (CyNetwork network : currentCyNetworks) {
+ // if ((currentCyObj instanceof CyNode && network.containsNode((CyNode)
+ // currentCyObj))
+ // || (currentCyObj instanceof CyEdge && network
+ // .containsEdge((CyEdge) currentCyObj))) {
+ // network.getRow(currentCyObj).set(CyNetwork.SELECTED, false);
+ // networks.add(network);
+ // }
+ // }
+ // }
+ //
+ // // select only those associated with selected Chimera objects
+ // Set<CyIdentifiable> currentCyObjs = new HashSet<CyIdentifiable>();
+ // for (ChimeraStructuralObject chimObj : chimSelectionList) {
+ // ChimeraModel currentSelModel = chimObj.getChimeraModel();
+ // if (currentChimMap.containsKey(currentSelModel)) {
+ // currentCyObjs.addAll(currentChimMap.get(currentSelModel));
+ // }
+ // if (currentChimMap.containsKey(chimObj)) {
+ // currentCyObjs.addAll(currentChimMap.get(chimObj));
+ // }
+ // // System.out.println(chimObj.toSpec() + ": " +
+ // // currentCyObjs.size());
+ // }
+ // for (CyIdentifiable cyObj : currentCyObjs) {
+ // // System.out.println(cyObj.toString());
+ // if (cyObj == null || !networkMap.containsKey(cyObj)) {
+ // continue;
+ // }
+ // Set<CyNetwork> currentCyNetworks = networkMap.get(cyObj);
+ // if (currentCyNetworks == null || currentCyNetworks.size() == 0) {
+ // continue;
+ // }
+ // for (CyNetwork network : currentCyNetworks) {
+ // if ((cyObj instanceof CyNode && network.containsNode((CyNode) cyObj))
+ // || (cyObj instanceof CyEdge && network.containsEdge((CyEdge) cyObj))) {
+ // network.getRow(cyObj).set(CyNetwork.SELECTED, true);
+ // networks.add(network);
+ // }
+ // }
+ // }
+ //
+ // CyNetworkViewManager cyNetViewManager = (CyNetworkViewManager)
+ // getService(CyNetworkViewManager.class);
+ // // Update network views
+ // for (CyNetwork network : networks) {
+ // Collection<CyNetworkView> views =
+ // cyNetViewManager.getNetworkViews(network);
+ // for (CyNetworkView view : views) {
+ // view.updateView();
+ // }
+ // }
+ ignoreCySelection = false;
+ }
+
+ public void cytoscapeSelectionChanged(Map<Long, Boolean> selectedRows)
+ {
+ // if (ignoreCySelection || currentCyMap.size() == 0) {
+ // return;
+ // }
+ // // clearSelectionList();
+ // // System.out.println("cytoscape selection changed");
+ // // iterate over all cy objects with associated models
+ // for (CyIdentifiable cyObj : currentCyMap.keySet()) {
+ // if (cyObj instanceof CyNetwork ||
+ // !selectedRows.containsKey(cyObj.getSUID())) {
+ // continue;
+ // }
+ // for (ChimeraStructuralObject chimObj : currentCyMap.get(cyObj)) {
+ // if (selectedRows.get(cyObj.getSUID())) {
+ // addChimSelection(chimObj);
+ // if (chimObj instanceof ChimeraResidue) {
+ // if (chimObj.getChimeraModel().isSelected()) {
+ // removeChimSelection(chimObj.getChimeraModel());
+ // } else if (chimObj.getChimeraModel()
+ // .getChain(((ChimeraResidue) chimObj).getChainId()).isSelected()) {
+ // removeChimSelection(chimObj.getChimeraModel().getChain(
+ // ((ChimeraResidue) chimObj).getChainId()));
+ // }
+ // }
+ // } else {
+ // removeChimSelection(chimObj);
+ // if (chimObj.hasSelectedChildren() && chimObj instanceof ChimeraModel) {
+ // for (ChimeraResidue residue : ((ChimeraModel) chimObj)
+ // .getSelectedResidues()) {
+ // removeChimSelection(residue);
+ // }
+ // }
+ // }
+ // }
+ // }
+ // System.out.println("selection list: " + getChimSelectionCount());
+ updateChimeraSelection();
+ selectionChanged();
+ }
+
+ // Save models in a HashMap/Set for better performance?
+ public void updateChimeraSelection()
+ {
+ // System.out.println("update Chimera selection");
+ String selSpec = "";
+ for (int i = 0; i < chimSelectionList.size(); i++)
+ {
+ ChimeraStructuralObject nodeInfo = chimSelectionList.get(i);
+ // we do not care about the model anymore
+ selSpec = selSpec.concat(nodeInfo.toSpec());
+ if (i < chimSelectionList.size() - 1)
+ {
+ selSpec.concat("|");
+ }
+ }
+ if (selSpec.length() > 0)
+ {
+ chimeraManager.select("sel " + selSpec);
+ }
+ else
+ {
+ chimeraManager.select("~sel");
+ }
+ }
+
+ /**
+ * This is called by the selectionListener to let us know that the user has
+ * changed their selection in Chimera. We need to go back to Chimera to find
+ * out what is currently selected and update our list.
+ */
+ public void chimeraSelectionChanged()
+ {
+ // System.out.println("Chimera selection changed");
+ clearSelectionList();
+ // Execute the command to get the list of models with selections
+ Map<Integer, ChimeraModel> selectedModelsMap = chimeraManager
+ .getSelectedModels();
+ // Now get the residue-level data
+ chimeraManager.getSelectedResidues(selectedModelsMap);
+ // Get the selected objects
+ try
+ {
+ for (ChimeraModel selectedModel : selectedModelsMap.values())
+ {
+ int modelNumber = selectedModel.getModelNumber();
+ int subModelNumber = selectedModel.getSubModelNumber();
+ // Get the corresponding "real" model
+ if (chimeraManager.hasChimeraModel(modelNumber, subModelNumber))
+ {
+ ChimeraModel dataModel = chimeraManager.getChimeraModel(
+ modelNumber, subModelNumber);
+ if (dataModel.getResidueCount() == selectedModel
+ .getResidueCount()
+ || dataModel.getModelType() == StructureManager.ModelType.SMILES)
+ {
+ // Select the entire model
+ addChimSelection(dataModel);
+ // dataModel.setSelected(true);
+ }
+ else
+ {
+ for (ChimeraChain selectedChain : selectedModel.getChains())
+ {
+ ChimeraChain dataChain = dataModel.getChain(selectedChain
+ .getChainId());
+ if (selectedChain.getResidueCount() == dataChain
+ .getResidueCount())
+ {
+ addChimSelection(dataChain);
+ // dataChain.setSelected(true);
+ }
+ // else {
+ // Need to select individual residues
+ for (ChimeraResidue res : selectedChain.getResidues())
+ {
+ String residueIndex = res.getIndex();
+ ChimeraResidue residue = dataChain.getResidue(residueIndex);
+ if (residue == null)
+ {
+ continue;
+ }
+ addChimSelection(residue);
+ // residue.setSelected(true);
+ } // resIter.hasNext
+ // }
+ } // chainIter.hasNext()
+ }
+ }
+ } // modelIter.hasNext()
+ } catch (Exception ex)
+ {
+ logger.warn("Could not update selection", ex);
+ }
+ // System.out.println("selection list: " + getChimSelectionCount());
+ // Finally, update the navigator panel
+ selectionChanged();
+ updateCytoscapeSelection();
+ }
+
+ public void selectFunctResidues(Collection<ChimeraModel> models)
+ {
+ clearSelectionList();
+ for (ChimeraModel model : models)
+ {
+ for (ChimeraResidue residue : model.getFuncResidues())
+ {
+ addChimSelection(residue);
+ }
+ }
+ updateChimeraSelection();
+ updateCytoscapeSelection();
+ selectionChanged();
+ }
+
+ // public void selectFunctResidues(CyNode node, CyNetwork network) {
+ // clearSelectionList();
+ // if (currentCyMap.containsKey(node)) {
+ // Set<ChimeraStructuralObject> chimObjects = currentCyMap.get(node);
+ // for (ChimeraStructuralObject obj : chimObjects) {
+ // if (obj instanceof ChimeraModel) {
+ // ChimeraModel model = (ChimeraModel) obj;
+ // for (ChimeraResidue residue : model.getFuncResidues()) {
+ // addChimSelection(residue);
+ // }
+ // }
+ // }
+ // }
+ // updateChimeraSelection();
+ // updateCytoscapeSelection();
+ // selectionChanged();
+ // }
+
+ public List<ChimeraStructuralObject> getChimSelectionList()
+ {
+ return chimSelectionList;
+ }
+
+ public int getChimSelectionCount()
+ {
+ return chimSelectionList.size();
+ }
+
+ /**
+ * Add a selection to the selection list. This is called primarily by the
+ * Model Navigator Dialog to keep the selections in sync
+ *
+ * @param selectionToAdd
+ * the selection to add to our list
+ */
+ public void addChimSelection(ChimeraStructuralObject selectionToAdd)
+ {
+ if (selectionToAdd != null
+ && !chimSelectionList.contains(selectionToAdd))
+ {
+ chimSelectionList.add(selectionToAdd);
+ selectionToAdd.setSelected(true);
+ }
+ }
+
+ /**
+ * Remove a selection from the selection list. This is called primarily by the
+ * Model Navigator Dialog to keep the selections in sync
+ *
+ * @param selectionToRemove
+ * the selection to remove from our list
+ */
+ public void removeChimSelection(ChimeraStructuralObject selectionToRemove)
+ {
+ if (selectionToRemove != null
+ && chimSelectionList.contains(selectionToRemove))
+ {
+ chimSelectionList.remove(selectionToRemove);
+ selectionToRemove.setSelected(false);
+ }
+ }
+
+ /**
+ * Clear the list of selected objects
+ */
+ public void clearSelectionList()
+ {
+ for (ChimeraStructuralObject cso : chimSelectionList)
+ {
+ if (cso != null)
+ {
+ cso.setSelected(false);
+ }
+ }
+ chimSelectionList.clear();
+ }
+
+ /**
+ * Associate a new network with the corresponding Chimera objects.
+ *
+ * @param network
+ */
+
+ /**
+ * Dump and refresh all of our model/chain/residue info
+ */
+ public void updateModels()
+ {
+ // Stop all of our listeners while we try to handle this
+ chimeraManager.stopListening();
+
+ // Get all of the open models
+ List<ChimeraModel> newModelList = chimeraManager.getModelList();
+
+ // Match them up -- assume that the model #'s haven't changed
+ for (ChimeraModel newModel : newModelList)
+ {
+ // Get the color (for our navigator)
+ newModel.setModelColor(chimeraManager.getModelColor(newModel));
+
+ // Get our model info
+ int modelNumber = newModel.getModelNumber();
+ int subModelNumber = newModel.getSubModelNumber();
+
+ // If we already know about this model number, get the Structure,
+ // which tells us about the associated CyNode
+ if (chimeraManager.hasChimeraModel(modelNumber, subModelNumber))
+ {
+ ChimeraModel oldModel = chimeraManager.getChimeraModel(modelNumber,
+ subModelNumber);
+ chimeraManager.removeChimeraModel(modelNumber, subModelNumber);
+ newModel.setModelType(oldModel.getModelType());
+ if (oldModel.getModelType() == ModelType.SMILES)
+ {
+ newModel.setModelName(oldModel.getModelName());
+ }
+ // re-assign associations to cytoscape objects
+ // Map<CyIdentifiable, CyNetwork> oldModelCyObjs =
+ // oldModel.getCyObjects();
+ // for (CyIdentifiable cyObj : oldModelCyObjs.keySet()) {
+ // // add cy objects to the new model
+ // newModel.addCyObject(cyObj, oldModelCyObjs.get(cyObj));
+ // if (currentCyMap.containsKey(cyObj)) {
+ // currentCyMap.get(cyObj).add(newModel);
+ // if (currentCyMap.get(cyObj).contains(oldModel)) {
+ // currentCyMap.get(cyObj).remove(oldModel);
+ // }
+ // }
+ // }
+ // // add new model to the chimera objects map and remove old model
+ // if (currentChimMap.containsKey(oldModel)) {
+ // currentChimMap.put(newModel, currentChimMap.get(oldModel));
+ // currentChimMap.remove(oldModel);
+ // }
+ }
+ // add new model to ChimeraManager
+ chimeraManager.addChimeraModel(modelNumber, subModelNumber, newModel);
+
+ // Get the residue information
+ if (newModel.getModelType() != ModelType.SMILES)
+ {
+ chimeraManager.addResidues(newModel);
+ }
+ // for (CyIdentifiable cyObj : newModel.getCyObjects().keySet()) {
+ // if (cyObj != null && cyObj instanceof CyNetwork) {
+ // addStructureNetwork((CyNetwork) cyObj);
+ // } else if (cyObj != null && cyObj instanceof CyNode) {
+ // newModel.setFuncResidues(ChimUtils.parseFuncRes(
+ // getResidueList(newModel.getCyObjects().get(cyObj), cyObj),
+ // newModel.getModelName()));
+ // }
+ // }
+ }
+
+ // associate all models with any node or network
+ // aTask.associate();
+
+ // Restart all of our listeners
+ chimeraManager.startListening();
+ // Done
+ }
+
+ public void launchModelNavigatorDialog()
+ {
+ // TODO: [Optional] Use haveGUI flag
+ // if (!haveGUI) {
+ // return;
+ // }
+ // if (mnDialog == null) {
+ // CySwingApplication cyApplication = (CySwingApplication)
+ // getService(CySwingApplication.class);
+ // mnDialog = new ModelNavigatorDialog(cyApplication.getJFrame(), this);
+ // mnDialog.pack();
+ // }
+ // mnDialog.setVisible(true);
+ }
+
+ public boolean isMNDialogOpen()
+ {
+ // if (mnDialog != null && mnDialog.isVisible()) {
+ // return true;
+ // }
+ return false;
+ }
+
+ /**
+ * Invoked by the listener thread.
+ */
+ public void modelChanged()
+ {
+ // if (mnDialog != null) {
+ // mnDialog.modelChanged();
+ // }
+ }
+
+ /**
+ * Inform our interface that the selection has changed
+ */
+ public void selectionChanged()
+ {
+ // if (mnDialog != null) {
+ // // System.out.println("update dialog selection");
+ // mnDialog.updateSelection(new
+ // ArrayList<ChimeraStructuralObject>(chimSelectionList));
+ // }
+ }
+
+ public void launchAlignDialog(boolean useChains)
+ {
+ // TODO: [Optional] Use haveGUI flag
+ // Sometimes it does not appear in Windows
+ // if (!haveGUI) {
+ // return;
+ // }
+ // if (alDialog != null) {
+ // alDialog.setVisible(false);
+ // alDialog.dispose();
+ // }
+ // System.out.println("launch align dialog");
+ List<ChimeraStructuralObject> chimObjectList = new ArrayList<ChimeraStructuralObject>();
+ for (ChimeraModel model : chimeraManager.getChimeraModels())
+ {
+ if (useChains)
+ {
+ for (ChimeraChain chain : model.getChains())
+ {
+ chimObjectList.add(chain);
+ }
+ }
+ else
+ {
+ chimObjectList.add(model);
+ }
+ }
+ // Bring up the dialog
+ // CySwingApplication cyApplication = (CySwingApplication)
+ // getService(CySwingApplication.class);
+ // alDialog = new AlignStructuresDialog(cyApplication.getJFrame(), this,
+ // chimObjectList);
+ // alDialog.pack();
+ // alDialog.setVisible(true);
+ }
+
+ public List<String> getAllStructureKeys()
+ {
+ return Arrays.asList(defaultStructureKeys);
+ }
+
+ public List<String> getAllChemStructKeys()
+ {
+ return Arrays.asList(defaultChemStructKeys);
+ }
+
+ public List<String> getAllResidueKeys()
+ {
+ return Arrays.asList(defaultResidueKeys);
+ }
+
+ public List<String> getAllChimeraResidueAttributes()
+ {
+ List<String> attributes = new ArrayList<String>();
+ // attributes.addAll(rinManager.getResAttrs());
+ attributes.addAll(chimeraManager.getAttrList());
+ return attributes;
+ }
+
+ StructureSettings defaultSettings = null;
+
+ // TODO: [Optional] Change priority of Chimera paths
+ public static List<String> getChimeraPaths()
+ {
+ List<String> pathList = new ArrayList<String>();
+
+ // if no network is available and the settings have been modified by the
+ // user, check for a
+ // path to chimera
+ //
+ // For Jalview, Preferences/Cache plays this role instead
+ // if (defaultSettings != null)
+ // {
+ // String defaultPath = defaultSettings.getChimeraPath();
+ // if (defaultPath != null && !defaultPath.equals(""))
+ // {
+ // pathList.add(defaultPath);
+ // return pathList;
+ // }
+ // }
+
+ /*
+ * Jalview addition: check if path set in user preferences.
+ */
+ String userPath = Cache.getDefault(Preferences.CHIMERA_PATH, null);
+ if (userPath != null)
+ {
+ pathList.add(0, userPath);
+ }
+
+ // Add default installation paths
+ String os = System.getProperty("os.name");
+ if (os.startsWith("Linux"))
+ {
+ pathList.add("/usr/local/chimera/bin/chimera");
+ pathList.add("/usr/local/bin/chimera");
+ pathList.add("/usr/bin/chimera");
+ }
+ else if (os.startsWith("Windows"))
+ {
+ pathList.add("\\Program Files\\Chimera\\bin\\chimera");
+ pathList.add("C:\\Program Files\\Chimera\\bin\\chimera.exe");
+ }
+ else if (os.startsWith("Mac"))
+ {
+ pathList.add("/Applications/Chimera.app/Contents/MacOS/chimera");
+ }
+ return pathList;
+ }
+
+ public void setChimeraPathProperty(String path)
+ {
+ // CytoUtils.setDefaultChimeraPath(registrar, chimeraPropertyName,
+ // chimeraPathPropertyKey,
+ // path);
+ }
+
+ public void setStructureSettings(StructureSettings structureSettings)
+ {
+ this.defaultSettings = structureSettings;
+ }
+
+ public String getCurrentChimeraPath(Object object)
+ {
+ if (defaultSettings != null)
+ {
+ return defaultSettings.getChimeraPath();
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ // public void initChimTable() {
+ // CyTableManager manager = (CyTableManager) getService(CyTableManager.class);
+ // CyTableFactory factory = (CyTableFactory) getService(CyTableFactory.class);
+ // for (CyTable table : manager.getGlobalTables()) {
+ // if (table.getTitle().equals(chimeraOutputTable)) {
+ // manager.deleteTable(table.getSUID());
+ // }
+ // }
+ // chimTable = factory.createTable(chimeraOutputTable, chimeraCommandAttr,
+ // String.class,
+ // false, true);
+ // manager.addTable(chimTable);
+ // if (chimTable.getColumn(chimeraOutputAttr) == null) {
+ // chimTable.createListColumn(chimeraOutputAttr, String.class, false);
+ // }
+ // }
+
+ // public void addChimReply(String command, List<String> reply) {
+ // chimTable.getRow(command).set(chimeraOutputAttr, reply);
+ // }
+
+}
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/StructureSettings.java b/src/ext/edu/ucsf/rbvi/strucviz2/StructureSettings.java
new file mode 100644
index 0000000..08a6cb7
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/StructureSettings.java
@@ -0,0 +1,30 @@
+package ext.edu.ucsf.rbvi.strucviz2;
+
+/**
+ * This object maintains the relationship between Chimera objects and Cytoscape
+ * objects.
+ */
+public class StructureSettings
+{
+
+ // @Tunable(description = "Path to UCSF Chimera application", gravity = 4.0)
+ public String chimeraPath = null;
+
+ public StructureSettings(StructureManager manager)
+ {
+
+ chimeraPath = manager.getCurrentChimeraPath(null);
+
+ // This seems a little strange, but it has to do with the order of tunable
+ // interceptor
+ // handling. We need to set these selectors in our structure manager and
+ // dynamically
+ // pull the data out as needed....
+ manager.setStructureSettings(this);
+ }
+
+ public String getChimeraPath()
+ {
+ return chimeraPath;
+ }
+}
diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/port/ListenerThreads.java b/src/ext/edu/ucsf/rbvi/strucviz2/port/ListenerThreads.java
new file mode 100644
index 0000000..2b2ce48
--- /dev/null
+++ b/src/ext/edu/ucsf/rbvi/strucviz2/port/ListenerThreads.java
@@ -0,0 +1,302 @@
+package ext.edu.ucsf.rbvi.strucviz2.port;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
+
+/***************************************************
+ * Thread Classes *
+ **************************************************/
+
+/**
+ * Reply listener thread
+ */
+public class ListenerThreads extends Thread
+{
+ private BufferedReader lineReader = null;
+
+ private Process chimera = null;
+
+ private Map<String, List<String>> replyLog = null;
+
+ private Logger logger;
+
+ private StructureManager structureManager = null;
+
+ private boolean stopMe = false;
+
+ /**
+ * Create a new listener thread to read the responses from Chimera
+ *
+ * @param chimera
+ * a handle to the Chimera Process
+ * @param structureManager
+ * a handle to the Chimera structure manager
+ */
+ public ListenerThreads(Process chimera, StructureManager structureManager)
+ {
+ this.chimera = chimera;
+ this.structureManager = structureManager;
+ replyLog = new HashMap<String, List<String>>();
+ // Get a line-oriented reader
+ InputStream readChan = chimera.getInputStream();
+ lineReader = new BufferedReader(new InputStreamReader(readChan));
+ logger = LoggerFactory
+ .getLogger(ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads.class);
+ }
+
+ /**
+ * Start the thread running
+ */
+ public void run()
+ {
+ // System.out.println("ReplyLogListener running");
+ while (!stopMe)
+ {
+ try
+ {
+ chimeraRead();
+ } catch (IOException e)
+ {
+ logger.warn("UCSF Chimera has exited: " + e.getMessage());
+ return;
+ } finally
+ {
+ if (lineReader != null)
+ {
+ try
+ {
+ lineReader.close();
+ } catch (IOException e)
+ {
+ }
+ }
+ }
+ }
+ }
+
+ public List<String> getResponse(String command)
+ {
+ List<String> reply;
+ // System.out.println("getResponse: "+command);
+ // TODO do we need a maximum wait time before aborting?
+ while (!replyLog.containsKey(command))
+ {
+ try
+ {
+ Thread.currentThread().sleep(100);
+ } catch (InterruptedException e)
+ {
+ }
+ }
+
+ synchronized (replyLog)
+ {
+ reply = replyLog.get(command);
+ // System.out.println("getResponse ("+command+") = "+reply);
+ replyLog.remove(command);
+ }
+ return reply;
+ }
+
+ public void clearResponse(String command)
+ {
+ try
+ {
+ Thread.currentThread().sleep(100);
+ } catch (InterruptedException e)
+ {
+ }
+ if (replyLog.containsKey(command))
+ {
+ replyLog.remove(command);
+ }
+ return;
+ }
+
+ /**
+ * Read input from Chimera
+ *
+ * @return a List containing the replies from Chimera
+ */
+ private void chimeraRead() throws IOException
+ {
+ if (chimera == null)
+ {
+ return;
+ }
+
+ String line = null;
+ while ((line = lineReader.readLine()) != null)
+ {
+ // System.out.println("From Chimera-->" + line);
+ if (line.startsWith("CMD"))
+ {
+ chimeraCommandRead(line.substring(4));
+ }
+ else if (line.startsWith("ModelChanged: "))
+ {
+ (new ModelUpdater()).start();
+ }
+ else if (line.startsWith("SelectionChanged: "))
+ {
+ (new SelectionUpdater()).start();
+ }
+ else if (line.startsWith("Trajectory residue network info:"))
+ {
+ (new NetworkUpdater(line)).start();
+ }
+ }
+ return;
+ }
+
+ private void chimeraCommandRead(String command) throws IOException
+ {
+ // Generally -- looking for:
+ // CMD command
+ // ........
+ // END
+ // We return the text in between
+ List<String> reply = new ArrayList<String>();
+ boolean updateModels = false;
+ boolean updateSelection = false;
+ boolean importNetwork = false;
+ String line = null;
+
+ synchronized (replyLog)
+ {
+ while ((line = lineReader.readLine()) != null)
+ {
+ // System.out.println("From Chimera (" + command + ") -->" + line);
+ if (line.startsWith("CMD"))
+ {
+ logger.warn("Got unexpected command from Chimera: " + line);
+
+ }
+ else if (line.startsWith("END"))
+ {
+ break;
+ }
+ if (line.startsWith("ModelChanged: "))
+ {
+ updateModels = true;
+ }
+ else if (line.startsWith("SelectionChanged: "))
+ {
+ updateSelection = true;
+ }
+ else if (line.length() == 0)
+ {
+ continue;
+ }
+ else if (!line.startsWith("CMD"))
+ {
+ reply.add(line);
+ }
+ else if (line.startsWith("Trajectory residue network info:"))
+ {
+ importNetwork = true;
+ }
+ }
+ replyLog.put(command, reply);
+ }
+ if (updateModels)
+ {
+ (new ModelUpdater()).start();
+ }
+ if (updateSelection)
+ {
+ (new SelectionUpdater()).start();
+ }
+ if (importNetwork)
+ {
+ (new NetworkUpdater(line)).start();
+ }
+ return;
+ }
+
+ /**
+ * Model updater thread
+ */
+ class ModelUpdater extends Thread
+ {
+
+ public ModelUpdater()
+ {
+ }
+
+ public void run()
+ {
+ structureManager.updateModels();
+ structureManager.modelChanged();
+ }
+ }
+
+ /**
+ * Selection updater thread
+ */
+ class SelectionUpdater extends Thread
+ {
+
+ public SelectionUpdater()
+ {
+ }
+
+ public void run()
+ {
+ try
+ {
+ logger.info("Responding to chimera selection");
+ structureManager.chimeraSelectionChanged();
+ } catch (Exception e)
+ {
+ logger.warn("Could not update selection", e);
+ }
+ }
+ }
+
+ /**
+ * Selection updater thread
+ */
+ class NetworkUpdater extends Thread
+ {
+
+ private String line;
+
+ public NetworkUpdater(String line)
+ {
+ this.line = line;
+ }
+
+ public void run()
+ {
+ try
+ {
+ // ((TaskManager<?, ?>) structureManager.getService(TaskManager.class))
+ // .execute(new ImportTrajectoryRINTaskFactory(structureManager, line)
+ // .createTaskIterator());
+ } catch (Exception e)
+ {
+ logger.warn("Could not import trajectory network", e);
+ }
+ }
+ }
+
+ /**
+ * Set a flag that this thread should clean up and exit.
+ */
+ public void requestStop()
+ {
+ this.stopMe = true;
+ }
+}
diff --git a/src/ext/vamsas/IRegistry.java b/src/ext/vamsas/IRegistry.java
index e952e53..cd476f5 100644
--- a/src/ext/vamsas/IRegistry.java
+++ b/src/ext/vamsas/IRegistry.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
diff --git a/src/ext/vamsas/IRegistryService.java b/src/ext/vamsas/IRegistryService.java
index 866fe88..d0d9e53 100644
--- a/src/ext/vamsas/IRegistryService.java
+++ b/src/ext/vamsas/IRegistryService.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
diff --git a/src/ext/vamsas/IRegistryServiceLocator.java b/src/ext/vamsas/IRegistryServiceLocator.java
index d015f63..0bd1696 100644
--- a/src/ext/vamsas/IRegistryServiceLocator.java
+++ b/src/ext/vamsas/IRegistryServiceLocator.java
@@ -1,22 +1,27 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
+import jalview.util.MessageManager;
+
public class IRegistryServiceLocator extends org.apache.axis.client.Service
implements ext.vamsas.IRegistryService
{
@@ -106,10 +111,10 @@ public class IRegistryServiceLocator extends org.apache.axis.client.Service
{
throw new javax.xml.rpc.ServiceException(t);
}
- throw new javax.xml.rpc.ServiceException(
- "There is no stub implementation for the interface: "
- + (serviceEndpointInterface == null ? "null"
- : serviceEndpointInterface.getName()));
+ throw new javax.xml.rpc.ServiceException(MessageManager.formatMessage(
+ "exception.no_stub_implementation_for_interface",
+ new String[] { (serviceEndpointInterface == null ? "null"
+ : serviceEndpointInterface.getName()) }));
}
/**
@@ -167,7 +172,9 @@ public class IRegistryServiceLocator extends org.apache.axis.client.Service
else
{ // Unknown Port Name
throw new javax.xml.rpc.ServiceException(
- " Cannot set Endpoint Address for Unknown Port" + portName);
+ MessageManager.formatMessage(
+ "exception.cannot_set_endpoint_address_unknown_port",
+ new String[] { portName }));
}
}
diff --git a/src/ext/vamsas/Jpred.java b/src/ext/vamsas/Jpred.java
index 06483a6..8cd6797 100644
--- a/src/ext/vamsas/Jpred.java
+++ b/src/ext/vamsas/Jpred.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
diff --git a/src/ext/vamsas/JpredService.java b/src/ext/vamsas/JpredService.java
index 216f411..9d32f29 100644
--- a/src/ext/vamsas/JpredService.java
+++ b/src/ext/vamsas/JpredService.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
diff --git a/src/ext/vamsas/JpredServiceLocator.java b/src/ext/vamsas/JpredServiceLocator.java
index b878c18..937775a 100644
--- a/src/ext/vamsas/JpredServiceLocator.java
+++ b/src/ext/vamsas/JpredServiceLocator.java
@@ -1,22 +1,27 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
+import jalview.util.MessageManager;
+
public class JpredServiceLocator extends org.apache.axis.client.Service
implements ext.vamsas.JpredService
{
@@ -104,10 +109,10 @@ public class JpredServiceLocator extends org.apache.axis.client.Service
{
throw new javax.xml.rpc.ServiceException(t);
}
- throw new javax.xml.rpc.ServiceException(
- "There is no stub implementation for the interface: "
- + (serviceEndpointInterface == null ? "null"
- : serviceEndpointInterface.getName()));
+ throw new javax.xml.rpc.ServiceException(MessageManager.formatMessage(
+ "exception.no_stub_implementation_for_interface",
+ new String[] { (serviceEndpointInterface == null ? "null"
+ : serviceEndpointInterface.getName()) }));
}
/**
@@ -165,7 +170,9 @@ public class JpredServiceLocator extends org.apache.axis.client.Service
else
{ // Unknown Port Name
throw new javax.xml.rpc.ServiceException(
- " Cannot set Endpoint Address for Unknown Port" + portName);
+ MessageManager.formatMessage(
+ "exception.cannot_set_endpoint_address_unknown_port",
+ new String[] { portName }));
}
}
diff --git a/src/ext/vamsas/JpredSoapBindingStub.java b/src/ext/vamsas/JpredSoapBindingStub.java
index 03a2383..079ce85 100644
--- a/src/ext/vamsas/JpredSoapBindingStub.java
+++ b/src/ext/vamsas/JpredSoapBindingStub.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
@@ -274,8 +277,7 @@ public class JpredSoapBindingStub extends org.apache.axis.client.Stub
setRequestHeaders(_call);
setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { seq });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { seq });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -313,8 +315,7 @@ public class JpredSoapBindingStub extends org.apache.axis.client.Stub
setRequestHeaders(_call);
setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { msf });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { msf });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -351,8 +352,8 @@ public class JpredSoapBindingStub extends org.apache.axis.client.Stub
setRequestHeaders(_call);
setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { job_id });
+ java.lang.Object _resp = _call
+ .invoke(new java.lang.Object[] { job_id });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -389,8 +390,8 @@ public class JpredSoapBindingStub extends org.apache.axis.client.Stub
setRequestHeaders(_call);
setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { job_id });
+ java.lang.Object _resp = _call
+ .invoke(new java.lang.Object[] { job_id });
if (_resp instanceof java.rmi.RemoteException)
{
diff --git a/src/ext/vamsas/MuscleWS.java b/src/ext/vamsas/MuscleWS.java
index 249c163..5e1aaba 100644
--- a/src/ext/vamsas/MuscleWS.java
+++ b/src/ext/vamsas/MuscleWS.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
diff --git a/src/ext/vamsas/MuscleWSService.java b/src/ext/vamsas/MuscleWSService.java
index 752f622..18284c4 100644
--- a/src/ext/vamsas/MuscleWSService.java
+++ b/src/ext/vamsas/MuscleWSService.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
diff --git a/src/ext/vamsas/MuscleWSServiceLocator.java b/src/ext/vamsas/MuscleWSServiceLocator.java
index c669d23..c4f83c9 100644
--- a/src/ext/vamsas/MuscleWSServiceLocator.java
+++ b/src/ext/vamsas/MuscleWSServiceLocator.java
@@ -1,22 +1,27 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
+import jalview.util.MessageManager;
+
public class MuscleWSServiceLocator extends org.apache.axis.client.Service
implements ext.vamsas.MuscleWSService
{
@@ -112,10 +117,10 @@ public class MuscleWSServiceLocator extends org.apache.axis.client.Service
throw new javax.xml.rpc.ServiceException(t);
}
- throw new javax.xml.rpc.ServiceException(
- "There is no stub implementation for the interface: "
- + ((serviceEndpointInterface == null) ? "null"
- : serviceEndpointInterface.getName()));
+ throw new javax.xml.rpc.ServiceException(MessageManager.formatMessage(
+ "exception.no_stub_implementation_for_interface",
+ new String[] { (serviceEndpointInterface == null ? "null"
+ : serviceEndpointInterface.getName()) }));
}
/**
@@ -175,7 +180,9 @@ public class MuscleWSServiceLocator extends org.apache.axis.client.Service
else
{ // Unknown Port Name
throw new javax.xml.rpc.ServiceException(
- " Cannot set Endpoint Address for Unknown Port" + portName);
+ MessageManager.formatMessage(
+ "exception.cannot_set_endpoint_address_unknown_port",
+ new String[] { portName }));
}
}
diff --git a/src/ext/vamsas/MuscleWSSoapBindingStub.java b/src/ext/vamsas/MuscleWSSoapBindingStub.java
index e582192..4ea8a26 100644
--- a/src/ext/vamsas/MuscleWSSoapBindingStub.java
+++ b/src/ext/vamsas/MuscleWSSoapBindingStub.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
@@ -312,8 +315,8 @@ public class MuscleWSSoapBindingStub extends org.apache.axis.client.Stub
setRequestHeaders(_call);
setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { seqSet });
+ java.lang.Object _resp = _call
+ .invoke(new java.lang.Object[] { seqSet });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -353,8 +356,8 @@ public class MuscleWSSoapBindingStub extends org.apache.axis.client.Stub
setRequestHeaders(_call);
setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { job_id });
+ java.lang.Object _resp = _call
+ .invoke(new java.lang.Object[] { job_id });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -394,8 +397,8 @@ public class MuscleWSSoapBindingStub extends org.apache.axis.client.Stub
setRequestHeaders(_call);
setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { job_id });
+ java.lang.Object _resp = _call
+ .invoke(new java.lang.Object[] { job_id });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -434,8 +437,7 @@ public class MuscleWSSoapBindingStub extends org.apache.axis.client.Stub
setRequestHeaders(_call);
setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { jobId });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { jobId });
if (_resp instanceof java.rmi.RemoteException)
{
diff --git a/src/ext/vamsas/RegistryServiceSoapBindingStub.java b/src/ext/vamsas/RegistryServiceSoapBindingStub.java
index ca961e2..ffaac05 100644
--- a/src/ext/vamsas/RegistryServiceSoapBindingStub.java
+++ b/src/ext/vamsas/RegistryServiceSoapBindingStub.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
@@ -206,8 +209,7 @@ public class RegistryServiceSoapBindingStub extends
setRequestHeaders(_call);
setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- {});
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
if (_resp instanceof java.rmi.RemoteException)
{
diff --git a/src/ext/vamsas/SeqSearchI.java b/src/ext/vamsas/SeqSearchI.java
index 3af0cf0..acdea32 100644
--- a/src/ext/vamsas/SeqSearchI.java
+++ b/src/ext/vamsas/SeqSearchI.java
@@ -1,37 +1,40 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package ext.vamsas;
-
-public interface SeqSearchI extends java.rmi.Remote
-{
- public java.lang.String getDatabase() throws java.rmi.RemoteException;
-
- public vamsas.objects.simple.SeqSearchResult getResult(
- java.lang.String job_id) throws java.rmi.RemoteException;
-
- public vamsas.objects.simple.WsJobId psearch(
- vamsas.objects.simple.Alignment al, java.lang.String database)
- throws java.rmi.RemoteException;
-
- public vamsas.objects.simple.WsJobId search(
- vamsas.objects.simple.Sequence s, java.lang.String database)
- throws java.rmi.RemoteException;
-
- public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)
- throws java.rmi.RemoteException;
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package ext.vamsas;
+
+public interface SeqSearchI extends java.rmi.Remote
+{
+ public java.lang.String getDatabase() throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.SeqSearchResult getResult(
+ java.lang.String job_id) throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.WsJobId psearch(
+ vamsas.objects.simple.Alignment al, java.lang.String database)
+ throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.WsJobId search(
+ vamsas.objects.simple.Sequence s, java.lang.String database)
+ throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)
+ throws java.rmi.RemoteException;
+}
diff --git a/src/ext/vamsas/SeqSearchServiceLocator.java b/src/ext/vamsas/SeqSearchServiceLocator.java
index bd70635..86c3043 100644
--- a/src/ext/vamsas/SeqSearchServiceLocator.java
+++ b/src/ext/vamsas/SeqSearchServiceLocator.java
@@ -1,183 +1,190 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package ext.vamsas;
-
-public class SeqSearchServiceLocator extends org.apache.axis.client.Service
- implements ext.vamsas.SeqSearchServiceService
-{
-
- public SeqSearchServiceLocator()
- {
- }
-
- public SeqSearchServiceLocator(org.apache.axis.EngineConfiguration config)
- {
- super(config);
- }
-
- // Use to get a proxy class for ScanPSService
- private java.lang.String ScanPSService_address = "http://localhost:8080/TestJWS/services/ScanPSService";
-
- public java.lang.String getSeqSeachServiceAddress()
- {
- return ScanPSService_address;
- }
-
- // The WSDD service name defaults to the port name.
- private java.lang.String ScanPSServiceWSDDServiceName = "ScanPSService";
-
- public java.lang.String getScanPSServiceWSDDServiceName()
- {
- return ScanPSServiceWSDDServiceName;
- }
-
- public void setScanPSServiceWSDDServiceName(java.lang.String name)
- {
- ScanPSServiceWSDDServiceName = name;
- }
-
- public ext.vamsas.SeqSearchI getSeqSearchService()
- throws javax.xml.rpc.ServiceException
- {
- java.net.URL endpoint;
- try
- {
- endpoint = new java.net.URL(ScanPSService_address);
- } catch (java.net.MalformedURLException e)
- {
- throw new javax.xml.rpc.ServiceException(e);
- }
- return getSeqSearchService(endpoint);
- }
-
- public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress)
- throws javax.xml.rpc.ServiceException
- {
- try
- {
- ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(
- portAddress, this);
- _stub.setPortName(getScanPSServiceWSDDServiceName());
- return _stub;
- } catch (org.apache.axis.AxisFault e)
- {
- return null;
- }
- }
-
- public void setScanPSServiceEndpointAddress(java.lang.String address)
- {
- ScanPSService_address = address;
- }
-
- /**
- * For the given interface, get the stub implementation. If this service has
- * no port for the given interface, then ServiceException is thrown.
- */
- public java.rmi.Remote getPort(Class serviceEndpointInterface)
- throws javax.xml.rpc.ServiceException
- {
- try
- {
- if (ext.vamsas.SeqSearchI.class
- .isAssignableFrom(serviceEndpointInterface))
- {
- ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(
- new java.net.URL(ScanPSService_address), this);
- _stub.setPortName(getScanPSServiceWSDDServiceName());
- return _stub;
- }
- } catch (java.lang.Throwable t)
- {
- throw new javax.xml.rpc.ServiceException(t);
- }
- throw new javax.xml.rpc.ServiceException(
- "There is no stub implementation for the interface: "
- + (serviceEndpointInterface == null ? "null"
- : serviceEndpointInterface.getName()));
- }
-
- /**
- * For the given interface, get the stub implementation. If this service has
- * no port for the given interface, then ServiceException is thrown.
- */
- public java.rmi.Remote getPort(javax.xml.namespace.QName portName,
- Class serviceEndpointInterface)
- throws javax.xml.rpc.ServiceException
- {
- if (portName == null)
- {
- return getPort(serviceEndpointInterface);
- }
- java.lang.String inputPortName = portName.getLocalPart();
- if ("ScanPSService".equals(inputPortName))
- {
- return getSeqSearchService();
- }
- else
- {
- java.rmi.Remote _stub = getPort(serviceEndpointInterface);
- ((org.apache.axis.client.Stub) _stub).setPortName(portName);
- return _stub;
- }
- }
-
- public javax.xml.namespace.QName getServiceName()
- {
- return new javax.xml.namespace.QName("vamsas", "ScanPSServiceService");
- }
-
- private java.util.HashSet ports = null;
-
- public java.util.Iterator getPorts()
- {
- if (ports == null)
- {
- ports = new java.util.HashSet();
- ports.add(new javax.xml.namespace.QName("vamsas", "ScanPSService"));
- }
- return ports.iterator();
- }
-
- /**
- * Set the endpoint address for the specified port name.
- */
- public void setEndpointAddress(java.lang.String portName,
- java.lang.String address) throws javax.xml.rpc.ServiceException
- {
- if ("ScanPSService".equals(portName))
- {
- setScanPSServiceEndpointAddress(address);
- }
- else
- { // Unknown Port Name
- throw new javax.xml.rpc.ServiceException(
- " Cannot set Endpoint Address for Unknown Port" + portName);
- }
- }
-
- /**
- * Set the endpoint address for the specified port name.
- */
- public void setEndpointAddress(javax.xml.namespace.QName portName,
- java.lang.String address) throws javax.xml.rpc.ServiceException
- {
- setEndpointAddress(portName.getLocalPart(), address);
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package ext.vamsas;
+
+import jalview.util.MessageManager;
+
+public class SeqSearchServiceLocator extends org.apache.axis.client.Service
+ implements ext.vamsas.SeqSearchServiceService
+{
+
+ public SeqSearchServiceLocator()
+ {
+ }
+
+ public SeqSearchServiceLocator(org.apache.axis.EngineConfiguration config)
+ {
+ super(config);
+ }
+
+ // Use to get a proxy class for ScanPSService
+ private java.lang.String ScanPSService_address = "http://localhost:8080/TestJWS/services/ScanPSService";
+
+ public java.lang.String getSeqSeachServiceAddress()
+ {
+ return ScanPSService_address;
+ }
+
+ // The WSDD service name defaults to the port name.
+ private java.lang.String ScanPSServiceWSDDServiceName = "ScanPSService";
+
+ public java.lang.String getScanPSServiceWSDDServiceName()
+ {
+ return ScanPSServiceWSDDServiceName;
+ }
+
+ public void setScanPSServiceWSDDServiceName(java.lang.String name)
+ {
+ ScanPSServiceWSDDServiceName = name;
+ }
+
+ public ext.vamsas.SeqSearchI getSeqSearchService()
+ throws javax.xml.rpc.ServiceException
+ {
+ java.net.URL endpoint;
+ try
+ {
+ endpoint = new java.net.URL(ScanPSService_address);
+ } catch (java.net.MalformedURLException e)
+ {
+ throw new javax.xml.rpc.ServiceException(e);
+ }
+ return getSeqSearchService(endpoint);
+ }
+
+ public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress)
+ throws javax.xml.rpc.ServiceException
+ {
+ try
+ {
+ ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(
+ portAddress, this);
+ _stub.setPortName(getScanPSServiceWSDDServiceName());
+ return _stub;
+ } catch (org.apache.axis.AxisFault e)
+ {
+ return null;
+ }
+ }
+
+ public void setScanPSServiceEndpointAddress(java.lang.String address)
+ {
+ ScanPSService_address = address;
+ }
+
+ /**
+ * For the given interface, get the stub implementation. If this service has
+ * no port for the given interface, then ServiceException is thrown.
+ */
+ public java.rmi.Remote getPort(Class serviceEndpointInterface)
+ throws javax.xml.rpc.ServiceException
+ {
+ try
+ {
+ if (ext.vamsas.SeqSearchI.class
+ .isAssignableFrom(serviceEndpointInterface))
+ {
+ ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(
+ new java.net.URL(ScanPSService_address), this);
+ _stub.setPortName(getScanPSServiceWSDDServiceName());
+ return _stub;
+ }
+ } catch (java.lang.Throwable t)
+ {
+ throw new javax.xml.rpc.ServiceException(t);
+ }
+ throw new javax.xml.rpc.ServiceException(MessageManager.formatMessage(
+ "exception.no_stub_implementation_for_interface",
+ new String[] { (serviceEndpointInterface == null ? "null"
+ : serviceEndpointInterface.getName()) }));
+ }
+
+ /**
+ * For the given interface, get the stub implementation. If this service has
+ * no port for the given interface, then ServiceException is thrown.
+ */
+ public java.rmi.Remote getPort(javax.xml.namespace.QName portName,
+ Class serviceEndpointInterface)
+ throws javax.xml.rpc.ServiceException
+ {
+ if (portName == null)
+ {
+ return getPort(serviceEndpointInterface);
+ }
+ java.lang.String inputPortName = portName.getLocalPart();
+ if ("ScanPSService".equals(inputPortName))
+ {
+ return getSeqSearchService();
+ }
+ else
+ {
+ java.rmi.Remote _stub = getPort(serviceEndpointInterface);
+ ((org.apache.axis.client.Stub) _stub).setPortName(portName);
+ return _stub;
+ }
+ }
+
+ public javax.xml.namespace.QName getServiceName()
+ {
+ return new javax.xml.namespace.QName("vamsas", "ScanPSServiceService");
+ }
+
+ private java.util.HashSet ports = null;
+
+ public java.util.Iterator getPorts()
+ {
+ if (ports == null)
+ {
+ ports = new java.util.HashSet();
+ ports.add(new javax.xml.namespace.QName("vamsas", "ScanPSService"));
+ }
+ return ports.iterator();
+ }
+
+ /**
+ * Set the endpoint address for the specified port name.
+ */
+ public void setEndpointAddress(java.lang.String portName,
+ java.lang.String address) throws javax.xml.rpc.ServiceException
+ {
+ if ("ScanPSService".equals(portName))
+ {
+ setScanPSServiceEndpointAddress(address);
+ }
+ else
+ { // Unknown Port Name
+ throw new javax.xml.rpc.ServiceException(
+ MessageManager.formatMessage(
+ "exception.cannot_set_endpoint_address_unknown_port",
+ new String[] { portName }));
+ }
+ }
+
+ /**
+ * Set the endpoint address for the specified port name.
+ */
+ public void setEndpointAddress(javax.xml.namespace.QName portName,
+ java.lang.String address) throws javax.xml.rpc.ServiceException
+ {
+ setEndpointAddress(portName.getLocalPart(), address);
+ }
+
+}
diff --git a/src/ext/vamsas/SeqSearchServiceService.java b/src/ext/vamsas/SeqSearchServiceService.java
index f476ec2..f727ea9 100644
--- a/src/ext/vamsas/SeqSearchServiceService.java
+++ b/src/ext/vamsas/SeqSearchServiceService.java
@@ -1,29 +1,32 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package ext.vamsas;
-
-public interface SeqSearchServiceService extends javax.xml.rpc.Service
-{
- public java.lang.String getSeqSeachServiceAddress();
-
- public ext.vamsas.SeqSearchI getSeqSearchService()
- throws javax.xml.rpc.ServiceException;
-
- public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress)
- throws javax.xml.rpc.ServiceException;
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package ext.vamsas;
+
+public interface SeqSearchServiceService extends javax.xml.rpc.Service
+{
+ public java.lang.String getSeqSeachServiceAddress();
+
+ public ext.vamsas.SeqSearchI getSeqSearchService()
+ throws javax.xml.rpc.ServiceException;
+
+ public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress)
+ throws javax.xml.rpc.ServiceException;
+}
diff --git a/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java b/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java
index 118c893..57ce618 100644
--- a/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java
+++ b/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java
@@ -1,488 +1,489 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package ext.vamsas;
-
-public class SeqSearchServiceSoapBindingStub extends
- org.apache.axis.client.Stub implements ext.vamsas.SeqSearchI
-{
- private java.util.Vector cachedSerClasses = new java.util.Vector();
-
- private java.util.Vector cachedSerQNames = new java.util.Vector();
-
- private java.util.Vector cachedSerFactories = new java.util.Vector();
-
- private java.util.Vector cachedDeserFactories = new java.util.Vector();
-
- static org.apache.axis.description.OperationDesc[] _operations;
-
- static
- {
- _operations = new org.apache.axis.description.OperationDesc[5];
- _initOperationDesc1();
- }
-
- private static void _initOperationDesc1()
- {
- org.apache.axis.description.OperationDesc oper;
- oper = new org.apache.axis.description.OperationDesc();
- oper.setName("getDatabase");
- oper.setReturnType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- oper.setReturnClass(java.lang.String.class);
- oper.setReturnQName(new javax.xml.namespace.QName("",
- "getDatabaseReturn"));
- oper.setStyle(org.apache.axis.constants.Style.RPC);
- oper.setUse(org.apache.axis.constants.Use.ENCODED);
- _operations[0] = oper;
-
- oper = new org.apache.axis.description.OperationDesc();
- oper.setName("getResult");
- oper.addParameter(new javax.xml.namespace.QName("", "job_id"),
- new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.setReturnType(new javax.xml.namespace.QName(
- "simple.objects.vamsas", "SeqSearchResult"));
- oper.setReturnClass(vamsas.objects.simple.SeqSearchResult.class);
- oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn"));
- oper.setStyle(org.apache.axis.constants.Style.RPC);
- oper.setUse(org.apache.axis.constants.Use.ENCODED);
- _operations[1] = oper;
-
- oper = new org.apache.axis.description.OperationDesc();
- oper.setName("psearch");
- oper.addParameter(new javax.xml.namespace.QName("", "al"),
- new javax.xml.namespace.QName("simple.objects.vamsas",
- "Alignment"), vamsas.objects.simple.Alignment.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.addParameter(new javax.xml.namespace.QName("", "database"),
- new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.setReturnType(new javax.xml.namespace.QName(
- "simple.objects.vamsas", "WsJobId"));
- oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
- oper.setReturnQName(new javax.xml.namespace.QName("", "psearchReturn"));
- oper.setStyle(org.apache.axis.constants.Style.RPC);
- oper.setUse(org.apache.axis.constants.Use.ENCODED);
- _operations[2] = oper;
-
- oper = new org.apache.axis.description.OperationDesc();
- oper.setName("search");
- oper.addParameter(new javax.xml.namespace.QName("", "s"),
- new javax.xml.namespace.QName("simple.objects.vamsas",
- "Sequence"), vamsas.objects.simple.Sequence.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.addParameter(new javax.xml.namespace.QName("", "database"),
- new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.setReturnType(new javax.xml.namespace.QName(
- "simple.objects.vamsas", "WsJobId"));
- oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
- oper.setReturnQName(new javax.xml.namespace.QName("", "searchReturn"));
- oper.setStyle(org.apache.axis.constants.Style.RPC);
- oper.setUse(org.apache.axis.constants.Use.ENCODED);
- _operations[3] = oper;
-
- oper = new org.apache.axis.description.OperationDesc();
- oper.setName("cancel");
- oper.addParameter(new javax.xml.namespace.QName("", "jobId"),
- new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.setReturnType(new javax.xml.namespace.QName(
- "simple.objects.vamsas", "WsJobId"));
- oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
- oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn"));
- oper.setStyle(org.apache.axis.constants.Style.RPC);
- oper.setUse(org.apache.axis.constants.Use.ENCODED);
- _operations[4] = oper;
-
- }
-
- public SeqSearchServiceSoapBindingStub() throws org.apache.axis.AxisFault
- {
- this(null);
- }
-
- public SeqSearchServiceSoapBindingStub(java.net.URL endpointURL,
- javax.xml.rpc.Service service) throws org.apache.axis.AxisFault
- {
- this(service);
- super.cachedEndpoint = endpointURL;
- }
-
- public SeqSearchServiceSoapBindingStub(javax.xml.rpc.Service service)
- throws org.apache.axis.AxisFault
- {
- if (service == null)
- {
- super.service = new org.apache.axis.client.Service();
- }
- else
- {
- super.service = service;
- }
- java.lang.Class cls;
- javax.xml.namespace.QName qName;
- java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
- java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
- java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
- java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
- java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
- java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
- java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
- java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
- java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
- java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
- qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result");
- cachedSerQNames.add(qName);
- cls = vamsas.objects.simple.Result.class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(beansf);
- cachedDeserFactories.add(beandf);
-
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",
- "WsJobId");
- cachedSerQNames.add(qName);
- cls = vamsas.objects.simple.WsJobId.class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(beansf);
- cachedDeserFactories.add(beandf);
-
- qName = new javax.xml.namespace.QName("http://simple.objects.vamsas",
- "Object");
- cachedSerQNames.add(qName);
- cls = vamsas.objects.simple.Object.class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(beansf);
- cachedDeserFactories.add(beandf);
-
- qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string");
- cachedSerQNames.add(qName);
- cls = java.lang.String[].class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(arraysf);
- cachedDeserFactories.add(arraydf);
-
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",
- "Alignment");
- cachedSerQNames.add(qName);
- cls = vamsas.objects.simple.Alignment.class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(beansf);
- cachedDeserFactories.add(beandf);
-
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",
- "Sequence");
- cachedSerQNames.add(qName);
- cls = vamsas.objects.simple.Sequence.class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(beansf);
- cachedDeserFactories.add(beandf);
-
- qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence");
- cachedSerQNames.add(qName);
- cls = vamsas.objects.simple.Sequence[].class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(arraysf);
- cachedDeserFactories.add(arraydf);
-
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",
- "SeqSearchResult");
- cachedSerQNames.add(qName);
- cls = vamsas.objects.simple.SeqSearchResult.class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(beansf);
- cachedDeserFactories.add(beandf);
-
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",
- "SequenceSet");
- cachedSerQNames.add(qName);
- cls = vamsas.objects.simple.SequenceSet.class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(beansf);
- cachedDeserFactories.add(beandf);
-
- }
-
- protected org.apache.axis.client.Call createCall()
- throws java.rmi.RemoteException
- {
- try
- {
- org.apache.axis.client.Call _call = (org.apache.axis.client.Call) super.service
- .createCall();
- if (super.maintainSessionSet)
- {
- _call.setMaintainSession(super.maintainSession);
- }
- if (super.cachedUsername != null)
- {
- _call.setUsername(super.cachedUsername);
- }
- if (super.cachedPassword != null)
- {
- _call.setPassword(super.cachedPassword);
- }
- if (super.cachedEndpoint != null)
- {
- _call.setTargetEndpointAddress(super.cachedEndpoint);
- }
- if (super.cachedTimeout != null)
- {
- _call.setTimeout(super.cachedTimeout);
- }
- if (super.cachedPortName != null)
- {
- _call.setPortName(super.cachedPortName);
- }
- java.util.Enumeration keys = super.cachedProperties.keys();
- while (keys.hasMoreElements())
- {
- java.lang.String key = (java.lang.String) keys.nextElement();
- _call.setProperty(key, super.cachedProperties.get(key));
- }
- // All the type mapping information is registered
- // when the first call is made.
- // The type mapping information is actually registered in
- // the TypeMappingRegistry of the service, which
- // is the reason why registration is only needed for the first call.
- synchronized (this)
- {
- if (firstCall())
- {
- // must set encoding style before registering serializers
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
- _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
- for (int i = 0; i < cachedSerFactories.size(); ++i)
- {
- java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
- javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames
- .get(i);
- java.lang.Class sf = (java.lang.Class) cachedSerFactories
- .get(i);
- java.lang.Class df = (java.lang.Class) cachedDeserFactories
- .get(i);
- _call.registerTypeMapping(cls, qName, sf, df, false);
- }
- }
- }
- return _call;
- } catch (java.lang.Throwable _t)
- {
- throw new org.apache.axis.AxisFault(
- "Failure trying to get the Call object", _t);
- }
- }
-
- public java.lang.String getDatabase() throws java.rmi.RemoteException
- {
- if (super.cachedEndpoint == null)
- {
- throw new org.apache.axis.NoEndPointException();
- }
- org.apache.axis.client.Call _call = createCall();
- _call.setOperation(_operations[0]);
- _call.setUseSOAPAction(true);
- _call.setSOAPActionURI("");
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
- _call.setOperationName(new javax.xml.namespace.QName("vamsas",
- "getDatabase"));
-
- setRequestHeaders(_call);
- setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- {});
-
- if (_resp instanceof java.rmi.RemoteException)
- {
- throw (java.rmi.RemoteException) _resp;
- }
- else
- {
- extractAttachments(_call);
- try
- {
- return (java.lang.String) _resp;
- } catch (java.lang.Exception _exception)
- {
- return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(
- _resp, java.lang.String.class);
- }
- }
- }
-
- public vamsas.objects.simple.SeqSearchResult getResult(
- java.lang.String job_id) throws java.rmi.RemoteException
- {
- if (super.cachedEndpoint == null)
- {
- throw new org.apache.axis.NoEndPointException();
- }
- org.apache.axis.client.Call _call = createCall();
- _call.setOperation(_operations[1]);
- _call.setUseSOAPAction(true);
- _call.setSOAPActionURI("");
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
- _call.setOperationName(new javax.xml.namespace.QName("vamsas",
- "getResult"));
-
- setRequestHeaders(_call);
- setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { job_id });
-
- if (_resp instanceof java.rmi.RemoteException)
- {
- throw (java.rmi.RemoteException) _resp;
- }
- else
- {
- extractAttachments(_call);
- try
- {
- return (vamsas.objects.simple.SeqSearchResult) _resp;
- } catch (java.lang.Exception _exception)
- {
- return (vamsas.objects.simple.SeqSearchResult) org.apache.axis.utils.JavaUtils
- .convert(_resp, vamsas.objects.simple.SeqSearchResult.class);
- }
- }
- }
-
- public vamsas.objects.simple.WsJobId psearch(
- vamsas.objects.simple.Alignment al, java.lang.String database)
- throws java.rmi.RemoteException
- {
- if (super.cachedEndpoint == null)
- {
- throw new org.apache.axis.NoEndPointException();
- }
- org.apache.axis.client.Call _call = createCall();
- _call.setOperation(_operations[2]);
- _call.setUseSOAPAction(true);
- _call.setSOAPActionURI("");
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
- _call.setOperationName(new javax.xml.namespace.QName("vamsas",
- "psearch"));
-
- setRequestHeaders(_call);
- setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { al, database });
-
- if (_resp instanceof java.rmi.RemoteException)
- {
- throw (java.rmi.RemoteException) _resp;
- }
- else
- {
- extractAttachments(_call);
- try
- {
- return (vamsas.objects.simple.WsJobId) _resp;
- } catch (java.lang.Exception _exception)
- {
- return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils
- .convert(_resp, vamsas.objects.simple.WsJobId.class);
- }
- }
- }
-
- public vamsas.objects.simple.WsJobId search(
- vamsas.objects.simple.Sequence s, java.lang.String database)
- throws java.rmi.RemoteException
- {
- if (super.cachedEndpoint == null)
- {
- throw new org.apache.axis.NoEndPointException();
- }
- org.apache.axis.client.Call _call = createCall();
- _call.setOperation(_operations[3]);
- _call.setUseSOAPAction(true);
- _call.setSOAPActionURI("");
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
- _call.setOperationName(new javax.xml.namespace.QName("vamsas", "search"));
-
- setRequestHeaders(_call);
- setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { s, database });
-
- if (_resp instanceof java.rmi.RemoteException)
- {
- throw (java.rmi.RemoteException) _resp;
- }
- else
- {
- extractAttachments(_call);
- try
- {
- return (vamsas.objects.simple.WsJobId) _resp;
- } catch (java.lang.Exception _exception)
- {
- return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils
- .convert(_resp, vamsas.objects.simple.WsJobId.class);
- }
- }
- }
-
- public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)
- throws java.rmi.RemoteException
- {
- if (super.cachedEndpoint == null)
- {
- throw new org.apache.axis.NoEndPointException();
- }
- org.apache.axis.client.Call _call = createCall();
- _call.setOperation(_operations[4]);
- _call.setUseSOAPAction(true);
- _call.setSOAPActionURI("");
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
- _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel"));
-
- setRequestHeaders(_call);
- setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { jobId });
-
- if (_resp instanceof java.rmi.RemoteException)
- {
- throw (java.rmi.RemoteException) _resp;
- }
- else
- {
- extractAttachments(_call);
- try
- {
- return (vamsas.objects.simple.WsJobId) _resp;
- } catch (java.lang.Exception _exception)
- {
- return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils
- .convert(_resp, vamsas.objects.simple.WsJobId.class);
- }
- }
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package ext.vamsas;
+
+public class SeqSearchServiceSoapBindingStub extends
+ org.apache.axis.client.Stub implements ext.vamsas.SeqSearchI
+{
+ private java.util.Vector cachedSerClasses = new java.util.Vector();
+
+ private java.util.Vector cachedSerQNames = new java.util.Vector();
+
+ private java.util.Vector cachedSerFactories = new java.util.Vector();
+
+ private java.util.Vector cachedDeserFactories = new java.util.Vector();
+
+ static org.apache.axis.description.OperationDesc[] _operations;
+
+ static
+ {
+ _operations = new org.apache.axis.description.OperationDesc[5];
+ _initOperationDesc1();
+ }
+
+ private static void _initOperationDesc1()
+ {
+ org.apache.axis.description.OperationDesc oper;
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getDatabase");
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ oper.setReturnClass(java.lang.String.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("",
+ "getDatabaseReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[0] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getResult");
+ oper.addParameter(new javax.xml.namespace.QName("", "job_id"),
+ new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "SeqSearchResult"));
+ oper.setReturnClass(vamsas.objects.simple.SeqSearchResult.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[1] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("psearch");
+ oper.addParameter(new javax.xml.namespace.QName("", "al"),
+ new javax.xml.namespace.QName("simple.objects.vamsas",
+ "Alignment"), vamsas.objects.simple.Alignment.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(new javax.xml.namespace.QName("", "database"),
+ new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "WsJobId"));
+ oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("", "psearchReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[2] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("search");
+ oper.addParameter(new javax.xml.namespace.QName("", "s"),
+ new javax.xml.namespace.QName("simple.objects.vamsas",
+ "Sequence"), vamsas.objects.simple.Sequence.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(new javax.xml.namespace.QName("", "database"),
+ new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "WsJobId"));
+ oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("", "searchReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[3] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("cancel");
+ oper.addParameter(new javax.xml.namespace.QName("", "jobId"),
+ new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "WsJobId"));
+ oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[4] = oper;
+
+ }
+
+ public SeqSearchServiceSoapBindingStub() throws org.apache.axis.AxisFault
+ {
+ this(null);
+ }
+
+ public SeqSearchServiceSoapBindingStub(java.net.URL endpointURL,
+ javax.xml.rpc.Service service) throws org.apache.axis.AxisFault
+ {
+ this(service);
+ super.cachedEndpoint = endpointURL;
+ }
+
+ public SeqSearchServiceSoapBindingStub(javax.xml.rpc.Service service)
+ throws org.apache.axis.AxisFault
+ {
+ if (service == null)
+ {
+ super.service = new org.apache.axis.client.Service();
+ }
+ else
+ {
+ super.service = service;
+ }
+ java.lang.Class cls;
+ javax.xml.namespace.QName qName;
+ java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
+ java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
+ java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
+ java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
+ java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
+ java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
+ java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
+ java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
+ java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
+ java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Result.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas",
+ "WsJobId");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.WsJobId.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("http://simple.objects.vamsas",
+ "Object");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Object.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string");
+ cachedSerQNames.add(qName);
+ cls = java.lang.String[].class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(arraysf);
+ cachedDeserFactories.add(arraydf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas",
+ "Alignment");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Alignment.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas",
+ "Sequence");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Sequence.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Sequence[].class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(arraysf);
+ cachedDeserFactories.add(arraydf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas",
+ "SeqSearchResult");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.SeqSearchResult.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas",
+ "SequenceSet");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.SequenceSet.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ }
+
+ protected org.apache.axis.client.Call createCall()
+ throws java.rmi.RemoteException
+ {
+ try
+ {
+ org.apache.axis.client.Call _call = (org.apache.axis.client.Call) super.service
+ .createCall();
+ if (super.maintainSessionSet)
+ {
+ _call.setMaintainSession(super.maintainSession);
+ }
+ if (super.cachedUsername != null)
+ {
+ _call.setUsername(super.cachedUsername);
+ }
+ if (super.cachedPassword != null)
+ {
+ _call.setPassword(super.cachedPassword);
+ }
+ if (super.cachedEndpoint != null)
+ {
+ _call.setTargetEndpointAddress(super.cachedEndpoint);
+ }
+ if (super.cachedTimeout != null)
+ {
+ _call.setTimeout(super.cachedTimeout);
+ }
+ if (super.cachedPortName != null)
+ {
+ _call.setPortName(super.cachedPortName);
+ }
+ java.util.Enumeration keys = super.cachedProperties.keys();
+ while (keys.hasMoreElements())
+ {
+ java.lang.String key = (java.lang.String) keys.nextElement();
+ _call.setProperty(key, super.cachedProperties.get(key));
+ }
+ // All the type mapping information is registered
+ // when the first call is made.
+ // The type mapping information is actually registered in
+ // the TypeMappingRegistry of the service, which
+ // is the reason why registration is only needed for the first call.
+ synchronized (this)
+ {
+ if (firstCall())
+ {
+ // must set encoding style before registering serializers
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
+ for (int i = 0; i < cachedSerFactories.size(); ++i)
+ {
+ java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
+ javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames
+ .get(i);
+ java.lang.Class sf = (java.lang.Class) cachedSerFactories
+ .get(i);
+ java.lang.Class df = (java.lang.Class) cachedDeserFactories
+ .get(i);
+ _call.registerTypeMapping(cls, qName, sf, df, false);
+ }
+ }
+ }
+ return _call;
+ } catch (java.lang.Throwable _t)
+ {
+ throw new org.apache.axis.AxisFault(
+ "Failure trying to get the Call object", _t);
+ }
+ }
+
+ public java.lang.String getDatabase() throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[0]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("");
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName("vamsas",
+ "getDatabase"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (java.lang.String) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(
+ _resp, java.lang.String.class);
+ }
+ }
+ }
+
+ public vamsas.objects.simple.SeqSearchResult getResult(
+ java.lang.String job_id) throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[1]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("");
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName("vamsas",
+ "getResult"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call
+ .invoke(new java.lang.Object[] { job_id });
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (vamsas.objects.simple.SeqSearchResult) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (vamsas.objects.simple.SeqSearchResult) org.apache.axis.utils.JavaUtils
+ .convert(_resp, vamsas.objects.simple.SeqSearchResult.class);
+ }
+ }
+ }
+
+ public vamsas.objects.simple.WsJobId psearch(
+ vamsas.objects.simple.Alignment al, java.lang.String database)
+ throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[2]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("");
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName("vamsas",
+ "psearch"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { al,
+ database });
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (vamsas.objects.simple.WsJobId) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils
+ .convert(_resp, vamsas.objects.simple.WsJobId.class);
+ }
+ }
+ }
+
+ public vamsas.objects.simple.WsJobId search(
+ vamsas.objects.simple.Sequence s, java.lang.String database)
+ throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[3]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("");
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName("vamsas", "search"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { s,
+ database });
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (vamsas.objects.simple.WsJobId) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils
+ .convert(_resp, vamsas.objects.simple.WsJobId.class);
+ }
+ }
+ }
+
+ public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)
+ throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[4]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("");
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { jobId });
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (vamsas.objects.simple.WsJobId) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils
+ .convert(_resp, vamsas.objects.simple.WsJobId.class);
+ }
+ }
+ }
+
+}
diff --git a/src/ext/vamsas/ServiceHandle.java b/src/ext/vamsas/ServiceHandle.java
index 3a96d70..27405f9 100644
--- a/src/ext/vamsas/ServiceHandle.java
+++ b/src/ext/vamsas/ServiceHandle.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
@@ -125,15 +128,15 @@ public class ServiceHandle implements java.io.Serializable
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof ServiceHandle))
+ if (obj == null)
{
return false;
}
- ServiceHandle other = (ServiceHandle) obj;
- if (obj == null)
+ if (!(obj instanceof ServiceHandle))
{
return false;
}
+ ServiceHandle other = (ServiceHandle) obj;
if (this == obj)
{
return true;
diff --git a/src/ext/vamsas/ServiceHandles.java b/src/ext/vamsas/ServiceHandles.java
index 64687a1..7ad7c39 100644
--- a/src/ext/vamsas/ServiceHandles.java
+++ b/src/ext/vamsas/ServiceHandles.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package ext.vamsas;
@@ -54,15 +57,15 @@ public class ServiceHandles implements java.io.Serializable
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof ServiceHandles))
+ if (obj == null)
{
return false;
}
- ServiceHandles other = (ServiceHandles) obj;
- if (obj == null)
+ if (!(obj instanceof ServiceHandles))
{
return false;
}
+ ServiceHandles other = (ServiceHandles) obj;
if (this == obj)
{
return true;
diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java
index aadd8f0..3a79959 100644
--- a/src/jalview/analysis/AAFrequency.java
+++ b/src/jalview/analysis/AAFrequency.java
@@ -1,25 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import java.util.*;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceI;
+import jalview.util.Format;
+import jalview.util.MappingUtils;
+import jalview.util.QuickSort;
-import jalview.datamodel.*;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
/**
* Takes in a vector or array of sequences and column start and column end and
@@ -32,8 +45,8 @@ import jalview.datamodel.*;
*/
public class AAFrequency
{
- // No need to store 1000s of strings which are not
- // visible to the user.
+ private static final int TO_UPPER_CASE = 'A' - 'a'; // -32
+
public static final String MAXCOUNT = "C";
public static final String MAXRESIDUE = "R";
@@ -44,51 +57,63 @@ public class AAFrequency
public static final String PROFILE = "P";
- public static final Hashtable[] calculate(Vector sequences, int start,
- int end)
+ public static final String ENCODED_CHARS = "E";
+
+ /*
+ * Quick look-up of String value of char 'A' to 'Z'
+ */
+ private static final String[] CHARS = new String['Z' - 'A' + 1];
+
+ static
+ {
+ for (char c = 'A'; c <= 'Z'; c++)
+ {
+ CHARS[c - 'A'] = String.valueOf(c);
+ }
+ }
+
+ public static final Hashtable[] calculate(List<SequenceI> list,
+ int start, int end)
{
- return calculate(sequences, start, end, false);
+ return calculate(list, start, end, false);
}
- public static final Hashtable[] calculate(Vector sequences, int start,
- int end, boolean profile)
+ public static final Hashtable[] calculate(List<SequenceI> sequences,
+ int start, int end, boolean profile)
{
SequenceI[] seqs = new SequenceI[sequences.size()];
int width = 0;
- for (int i = 0; i < sequences.size(); i++)
+ synchronized (sequences)
{
- seqs[i] = (SequenceI) sequences.elementAt(i);
- if (seqs[i].getLength() > width)
+ for (int i = 0; i < sequences.size(); i++)
{
- width = seqs[i].getLength();
+ seqs[i] = sequences.get(i);
+ if (seqs[i].getLength() > width)
+ {
+ width = seqs[i].getLength();
+ }
}
- }
- Hashtable[] reply = new Hashtable[width];
+ Hashtable[] reply = new Hashtable[width];
- if (end >= width)
- {
- end = width;
- }
-
- calculate(seqs, start, end, reply, profile);
-
- return reply;
- }
+ if (end >= width)
+ {
+ end = width;
+ }
- public static final void calculate(SequenceI[] sequences, int start,
- int end, Hashtable[] result)
- {
- calculate(sequences, start, end, result, false);
+ calculate(seqs, start, end, reply, profile);
+ return reply;
+ }
}
public static final void calculate(SequenceI[] sequences, int start,
int end, Hashtable[] result, boolean profile)
{
Hashtable residueHash;
- int maxCount, nongap, i, j, v, jSize = sequences.length;
+ int maxCount, nongap, i, j, v;
+ int jSize = sequences.length;
String maxResidue;
- char c;
+ char c = '-';
float percentage;
int[] values = new int[255];
@@ -105,9 +130,10 @@ public class AAFrequency
for (j = 0; j < jSize; j++)
{
- if (sequences[j]==null)
+ if (sequences[j] == null)
{
- System.err.println("WARNING: Consensus skipping null sequence - possible race condition.");
+ System.err
+ .println("WARNING: Consensus skipping null sequence - possible race condition.");
continue;
}
seq = sequences[j].getSequence();
@@ -127,7 +153,7 @@ public class AAFrequency
}
else if ('a' <= c && c <= 'z')
{
- c -= 32; // ('a' - 'A');
+ c += TO_UPPER_CASE;
}
nongap++;
@@ -139,43 +165,55 @@ public class AAFrequency
values['-']++;
}
}
-
- for (v = 'A'; v < 'Z'; v++)
+ if (jSize == 1)
{
- if (values[v] < 2 || values[v] < maxCount)
+ maxResidue = String.valueOf(c);
+ maxCount = 1;
+ }
+ else
+ {
+ for (v = 'A'; v <= 'Z'; v++)
{
- continue;
- }
+ // TODO why ignore values[v] == 1?
+ if (values[v] < 1 /* 2 */|| values[v] < maxCount)
+ {
+ continue;
+ }
- if (values[v] > maxCount)
- {
- maxResidue = String.valueOf((char) v);
- }
- else if (values[v] == maxCount)
- {
- maxResidue += String.valueOf((char) v);
+ if (values[v] > maxCount)
+ {
+ maxResidue = CHARS[v - 'A'];
+ }
+ else if (values[v] == maxCount)
+ {
+ maxResidue += CHARS[v - 'A'];
+ }
+ maxCount = values[v];
}
- maxCount = values[v];
}
-
if (maxResidue.length() == 0)
{
maxResidue = "-";
}
if (profile)
{
- residueHash.put(PROFILE, new int[][]
- { values, new int[]
- { jSize, nongap } });
+ // TODO use a 1-dimensional array with jSize, nongap in [0] and [1]
+ residueHash.put(PROFILE, new int[][] { values,
+ new int[] { jSize, nongap } });
}
residueHash.put(MAXCOUNT, new Integer(maxCount));
residueHash.put(MAXRESIDUE, maxResidue);
- percentage = ((float) maxCount * 100) / (float) jSize;
+ percentage = ((float) maxCount * 100) / jSize;
residueHash.put(PID_GAPS, new Float(percentage));
- percentage = ((float) maxCount * 100) / (float) nongap;
+ if (nongap > 0)
+ {
+ // calculate for non-gapped too
+ percentage = ((float) maxCount * 100) / nongap;
+ }
residueHash.put(PID_NOGAPS, new Float(percentage));
+
result[i] = residueHash;
}
}
@@ -191,24 +229,46 @@ public class AAFrequency
* @param width
* @param ignoreGapsInConsensusCalculation
* @param includeAllConsSymbols
+ * @param nseq
*/
public static void completeConsensus(AlignmentAnnotation consensus,
Hashtable[] hconsensus, int iStart, int width,
boolean ignoreGapsInConsensusCalculation,
- boolean includeAllConsSymbols)
+ boolean includeAllConsSymbols, long nseq)
{
completeConsensus(consensus, hconsensus, iStart, width,
- ignoreGapsInConsensusCalculation, includeAllConsSymbols, null); // new
- // char[]
- // { 'A', 'C', 'G', 'T', 'U' });
+ ignoreGapsInConsensusCalculation, includeAllConsSymbols, null,
+ nseq);
}
+ /**
+ * Derive the consensus annotations to be added to the alignment for display.
+ * This does not recompute the raw data, but may be called on a change in
+ * display options, such as 'show logo', which may in turn result in a change
+ * in the derived values.
+ *
+ * @param consensus
+ * the annotation row to add annotations to
+ * @param hconsensus
+ * the source consensus data
+ * @param iStart
+ * start column
+ * @param width
+ * end column
+ * @param ignoreGapsInConsensusCalculation
+ * if true, use the consensus calculated ignoring gaps
+ * @param includeAllConsSymbols
+ * if true include all consensus symbols, else just show modal
+ * residue
+ * @param alphabet
+ * @param nseq
+ * number of sequences
+ */
public static void completeConsensus(AlignmentAnnotation consensus,
Hashtable[] hconsensus, int iStart, int width,
boolean ignoreGapsInConsensusCalculation,
- boolean includeAllConsSymbols, char[] alphabet)
+ boolean includeAllConsSymbols, char[] alphabet, long nseq)
{
- float tval, value;
if (consensus == null || consensus.annotations == null
|| consensus.annotations.length < width)
{
@@ -216,121 +276,417 @@ public class AAFrequency
// initialised properly
return;
}
+
+ final Format fmt = getPercentageFormat(nseq);
+
for (int i = iStart; i < width; i++)
{
- if (i >= hconsensus.length)
+ Hashtable hci;
+ if (i >= hconsensus.length || ((hci = hconsensus[i]) == null))
{
// happens if sequences calculated over were shorter than alignment
// width
consensus.annotations[i] = null;
continue;
}
- value = 0;
- if (ignoreGapsInConsensusCalculation)
- {
- value = ((Float) hconsensus[i].get(AAFrequency.PID_NOGAPS))
- .floatValue();
- }
- else
+ Float fv = (Float) hci
+ .get(ignoreGapsInConsensusCalculation ? PID_NOGAPS : PID_GAPS);
+ if (fv == null)
{
- value = ((Float) hconsensus[i].get(AAFrequency.PID_GAPS))
- .floatValue();
+ consensus.annotations[i] = null;
+ // data has changed below us .. give up and
+ continue;
}
-
- String maxRes = hconsensus[i].get(AAFrequency.MAXRESIDUE).toString();
- String mouseOver = hconsensus[i].get(AAFrequency.MAXRESIDUE) + " ";
+ float value = fv.floatValue();
+ String maxRes = hci.get(AAFrequency.MAXRESIDUE).toString();
+ StringBuilder mouseOver = new StringBuilder(64);
if (maxRes.length() > 1)
{
- mouseOver = "[" + maxRes + "] ";
+ mouseOver.append("[").append(maxRes).append("] ");
maxRes = "+";
}
- int[][] profile = (int[][]) hconsensus[i].get(AAFrequency.PROFILE);
+ else
+ {
+ mouseOver.append(hci.get(AAFrequency.MAXRESIDUE) + " ");
+ }
+ int[][] profile = (int[][]) hci.get(AAFrequency.PROFILE);
if (profile != null && includeAllConsSymbols)
{
- mouseOver = "";
+ int sequenceCount = profile[1][0];
+ int nonGappedCount = profile[1][1];
+ int normalisedBy = ignoreGapsInConsensusCalculation ? nonGappedCount
+ : sequenceCount;
+ mouseOver.setLength(0);
if (alphabet != null)
{
for (int c = 0; c < alphabet.length; c++)
{
- tval = ((float) profile[0][alphabet[c]])
- * 100f
- / (float) profile[1][ignoreGapsInConsensusCalculation ? 1
- : 0];
- mouseOver += ((c == 0) ? "" : "; ") + alphabet[c] + " "
- + ((int) tval) + "%";
+ float tval = profile[0][alphabet[c]] * 100f / normalisedBy;
+ mouseOver
+ .append(((c == 0) ? "" : "; "))
+ .append(alphabet[c])
+ .append(" ")
+ .append(((fmt != null) ? fmt.form(tval) : ((int) tval)))
+ .append("%");
}
}
else
{
- Object[] ca = new Object[profile[0].length];
+ // TODO do this sort once only in calculate()?
+ // char[][] ca = new char[profile[0].length][];
+ char[] ca = new char[profile[0].length];
float[] vl = new float[profile[0].length];
for (int c = 0; c < ca.length; c++)
{
- ca[c] = new char[]
- { (char) c };
- vl[c] = (float) profile[0][c];
+ ca[c] = (char) c;
+ // ca[c] = new char[]
+ // { (char) c };
+ vl[c] = profile[0][c];
}
- ;
- jalview.util.QuickSort.sort(vl, ca);
- for (int p = 0, c = ca.length - 1; profile[0][((char[]) ca[c])[0]] > 0; c--)
+ QuickSort.sort(vl, ca);
+ for (int p = 0, c = ca.length - 1; profile[0][ca[c]] > 0; c--)
{
- if (((char[]) ca[c])[0] != '-')
+ final char residue = ca[c];
+ if (residue != '-')
{
- tval = ((float) profile[0][((char[]) ca[c])[0]])
- * 100f
- / (float) profile[1][ignoreGapsInConsensusCalculation ? 1
- : 0];
- mouseOver += ((p == 0) ? "" : "; ") + ((char[]) ca[c])[0]
- + " " + ((int) tval) + "%";
+ float tval = profile[0][residue] * 100f / normalisedBy;
+ mouseOver
+ .append((((p == 0) ? "" : "; ")))
+ .append(residue)
+ .append(" ")
+ .append(((fmt != null) ? fmt.form(tval)
+ : ((int) tval))).append("%");
p++;
-
}
}
-
}
}
else
{
- mouseOver += ((int) value + "%");
+ mouseOver.append(
+ (((fmt != null) ? fmt.form(value) : ((int) value))))
+ .append("%");
}
- consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ',
- value);
+ consensus.annotations[i] = new Annotation(maxRes,
+ mouseOver.toString(), ' ', value);
+ }
+ }
+
+ /**
+ * Returns a Format designed to show all significant figures for profile
+ * percentages. For less than 100 sequences, returns null (the integer
+ * percentage value will be displayed). For 100-999 sequences, returns "%3.1f"
+ *
+ * @param nseq
+ * @return
+ */
+ protected static Format getPercentageFormat(long nseq)
+ {
+ int scale = 0;
+ while (nseq >= 10)
+ {
+ scale++;
+ nseq /= 10;
}
+ return scale <= 1 ? null : new Format("%3." + (scale - 1) + "f");
}
/**
- * get the sorted profile for the given position of the consensus
+ * Returns the sorted profile for the given consensus data. The returned array
+ * contains
+ *
+ * <pre>
+ * [profileType, numberOfValues, nonGapCount, charValue1, percentage1, charValue2, percentage2, ...]
+ * in descending order of percentage value
+ * </pre>
*
* @param hconsensus
+ * the data table from which to extract and sort values
+ * @param ignoreGaps
+ * if true, only non-gapped values are included in percentage
+ * calculations
* @return
*/
public static int[] extractProfile(Hashtable hconsensus,
- boolean ignoreGapsInConsensusCalculation)
+ boolean ignoreGaps)
{
int[] rtnval = new int[64];
int[][] profile = (int[][]) hconsensus.get(AAFrequency.PROFILE);
if (profile == null)
+ {
return null;
- Object[] ca = new Object[profile[0].length];
+ }
+ char[] ca = new char[profile[0].length];
float[] vl = new float[profile[0].length];
for (int c = 0; c < ca.length; c++)
{
- ca[c] = new char[]
- { (char) c };
- vl[c] = (float) profile[0][c];
+ ca[c] = (char) c;
+ vl[c] = profile[0][c];
+ }
+ QuickSort.sort(vl, ca);
+ int nextArrayPos = 2;
+ int totalPercentage = 0;
+ int distinctValuesCount = 0;
+ final int divisor = profile[1][ignoreGaps ? 1 : 0];
+ for (int c = ca.length - 1; profile[0][ca[c]] > 0; c--)
+ {
+ if (ca[c] != '-')
+ {
+ rtnval[nextArrayPos++] = ca[c];
+ final int percentage = (int) (profile[0][ca[c]] * 100f / divisor);
+ rtnval[nextArrayPos++] = percentage;
+ totalPercentage += percentage;
+ distinctValuesCount++;
+ }
+ }
+ rtnval[0] = distinctValuesCount;
+ rtnval[1] = totalPercentage;
+ int[] result = new int[rtnval.length + 1];
+ result[0] = AlignmentAnnotation.SEQUENCE_PROFILE;
+ System.arraycopy(rtnval, 0, result, 1, rtnval.length);
+
+ return result;
+ }
+
+ /**
+ * Extract a sorted extract of cDNA codon profile data. The returned array
+ * contains
+ *
+ * <pre>
+ * [profileType, numberOfValues, totalCount, charValue1, percentage1, charValue2, percentage2, ...]
+ * in descending order of percentage value, where the character values encode codon triplets
+ * </pre>
+ *
+ * @param hashtable
+ * @return
+ */
+ public static int[] extractCdnaProfile(Hashtable hashtable,
+ boolean ignoreGaps)
+ {
+ // this holds #seqs, #ungapped, and then codon count, indexed by encoded
+ // codon triplet
+ int[] codonCounts = (int[]) hashtable.get(PROFILE);
+ int[] sortedCounts = new int[codonCounts.length - 2];
+ System.arraycopy(codonCounts, 2, sortedCounts, 0,
+ codonCounts.length - 2);
+
+ int[] result = new int[3 + 2 * sortedCounts.length];
+ // first value is just the type of profile data
+ result[0] = AlignmentAnnotation.CDNA_PROFILE;
+
+ char[] codons = new char[sortedCounts.length];
+ for (int i = 0; i < codons.length; i++)
+ {
+ codons[i] = (char) i;
+ }
+ QuickSort.sort(sortedCounts, codons);
+ int totalPercentage = 0;
+ int distinctValuesCount = 0;
+ int j = 3;
+ int divisor = ignoreGaps ? codonCounts[1] : codonCounts[0];
+ for (int i = codons.length - 1; i >= 0; i--)
+ {
+ final int codonCount = sortedCounts[i];
+ if (codonCount == 0)
+ {
+ break; // nothing else of interest here
+ }
+ distinctValuesCount++;
+ result[j++] = codons[i];
+ final int percentage = codonCount * 100 / divisor;
+ result[j++] = percentage;
+ totalPercentage += percentage;
+ }
+ result[2] = totalPercentage;
+
+ /*
+ * Just return the non-zero values
+ */
+ // todo next value is redundant if we limit the array to non-zero counts
+ result[1] = distinctValuesCount;
+ return Arrays.copyOfRange(result, 0, j);
+ }
+
+ /**
+ * Compute a consensus for the cDNA coding for a protein alignment.
+ *
+ * @param alignment
+ * the protein alignment (which should hold mappings to cDNA
+ * sequences)
+ * @param hconsensus
+ * the consensus data stores to be populated (one per column)
+ */
+ public static void calculateCdna(AlignmentI alignment,
+ Hashtable[] hconsensus)
+ {
+ final char gapCharacter = alignment.getGapCharacter();
+ Set<AlignedCodonFrame> mappings = alignment.getCodonFrames();
+ if (mappings == null || mappings.isEmpty())
+ {
+ return;
+ }
+
+ int cols = alignment.getWidth();
+ for (int col = 0; col < cols; col++)
+ {
+ // todo would prefer a Java bean for consensus data
+ Hashtable<String, int[]> columnHash = new Hashtable<String, int[]>();
+ // #seqs, #ungapped seqs, counts indexed by (codon encoded + 1)
+ int[] codonCounts = new int[66];
+ codonCounts[0] = alignment.getSequences().size();
+ int ungappedCount = 0;
+ for (SequenceI seq : alignment.getSequences())
+ {
+ if (seq.getCharAt(col) == gapCharacter)
+ {
+ continue;
+ }
+ char[] codon = MappingUtils.findCodonFor(seq, col, mappings);
+ int codonEncoded = CodingUtils.encodeCodon(codon);
+ if (codonEncoded >= 0)
+ {
+ codonCounts[codonEncoded + 2]++;
+ ungappedCount++;
+ }
+ }
+ codonCounts[1] = ungappedCount;
+ // todo: sort values here, save counts and codons?
+ columnHash.put(PROFILE, codonCounts);
+ hconsensus[col] = columnHash;
+ }
+ }
+
+ /**
+ * Derive displayable cDNA consensus annotation from computed consensus data.
+ *
+ * @param consensusAnnotation
+ * the annotation row to be populated for display
+ * @param consensusData
+ * the computed consensus data
+ * @param showProfileLogo
+ * if true show all symbols present at each position, else only the
+ * modal value
+ * @param nseqs
+ * the number of sequences in the alignment
+ */
+ public static void completeCdnaConsensus(
+ AlignmentAnnotation consensusAnnotation,
+ Hashtable[] consensusData, boolean showProfileLogo, int nseqs)
+ {
+ if (consensusAnnotation == null
+ || consensusAnnotation.annotations == null
+ || consensusAnnotation.annotations.length < consensusData.length)
+ {
+ // called with a bad alignment annotation row - wait for it to be
+ // initialised properly
+ return;
}
- ;
- jalview.util.QuickSort.sort(vl, ca);
- rtnval[0] = 1;
- for (int c = ca.length - 1; profile[0][((char[]) ca[c])[0]] > 0; c--)
+
+ // ensure codon triplet scales with font size
+ consensusAnnotation.scaleColLabel = true;
+ for (int col = 0; col < consensusData.length; col++)
{
- if (((char[]) ca[c])[0] != '-')
+ Hashtable hci = consensusData[col];
+ if (hci == null)
+ {
+ // gapped protein column?
+ continue;
+ }
+ // array holds #seqs, #ungapped, then codon counts indexed by codon
+ final int[] codonCounts = (int[]) hci.get(PROFILE);
+ int totalCount = 0;
+
+ /*
+ * First pass - get total count and find the highest
+ */
+ final char[] codons = new char[codonCounts.length - 2];
+ for (int j = 2; j < codonCounts.length; j++)
{
- rtnval[rtnval[0]++] = ((char[]) ca[c])[0];
- rtnval[rtnval[0]++] = (int) (((float) profile[0][((char[]) ca[c])[0]]) * 100f / (float) profile[1][ignoreGapsInConsensusCalculation ? 1
- : 0]);
+ final int codonCount = codonCounts[j];
+ codons[j - 2] = (char) (j - 2);
+ totalCount += codonCount;
}
+
+ /*
+ * Sort array of encoded codons by count ascending - so the modal value
+ * goes to the end; start by copying the count (dropping the first value)
+ */
+ int[] sortedCodonCounts = new int[codonCounts.length - 2];
+ System.arraycopy(codonCounts, 2, sortedCodonCounts, 0,
+ codonCounts.length - 2);
+ QuickSort.sort(sortedCodonCounts, codons);
+
+ int modalCodonEncoded = codons[codons.length - 1];
+ int modalCodonCount = sortedCodonCounts[codons.length - 1];
+ String modalCodon = String.valueOf(CodingUtils
+ .decodeCodon(modalCodonEncoded));
+ if (sortedCodonCounts.length > 1
+ && sortedCodonCounts[codons.length - 2] == modalCodonEncoded)
+ {
+ modalCodon = "+";
+ }
+ float pid = sortedCodonCounts[sortedCodonCounts.length - 1] * 100
+ / (float) totalCount;
+
+ /*
+ * todo ? Replace consensus hashtable with sorted arrays of codons and
+ * counts (non-zero only). Include total count in count array [0].
+ */
+
+ /*
+ * Scan sorted array backwards for most frequent values first. Show
+ * repeated values compactly.
+ */
+ StringBuilder mouseOver = new StringBuilder(32);
+ StringBuilder samePercent = new StringBuilder();
+ String percent = null;
+ String lastPercent = null;
+ Format fmt = getPercentageFormat(nseqs);
+
+ for (int j = codons.length - 1; j >= 0; j--)
+ {
+ int codonCount = sortedCodonCounts[j];
+ if (codonCount == 0)
+ {
+ /*
+ * remaining codons are 0% - ignore, but finish off the last one if
+ * necessary
+ */
+ if (samePercent.length() > 0)
+ {
+ mouseOver.append(samePercent).append(": ").append(percent)
+ .append("% ");
+ }
+ break;
+ }
+ int codonEncoded = codons[j];
+ final int pct = codonCount * 100 / totalCount;
+ String codon = String
+ .valueOf(CodingUtils.decodeCodon(codonEncoded));
+ percent = fmt == null ? Integer.toString(pct) : fmt.form(pct);
+ if (showProfileLogo || codonCount == modalCodonCount)
+ {
+ if (percent.equals(lastPercent) && j > 0)
+ {
+ samePercent.append(samePercent.length() == 0 ? "" : ", ");
+ samePercent.append(codon);
+ }
+ else
+ {
+ if (samePercent.length() > 0)
+ {
+ mouseOver.append(samePercent).append(": ")
+ .append(lastPercent).append("% ");
+ }
+ samePercent.setLength(0);
+ samePercent.append(codon);
+ }
+ lastPercent = percent;
+ }
+ }
+
+ consensusAnnotation.annotations[col] = new Annotation(modalCodon,
+ mouseOver.toString(), ' ', pid);
}
- return rtnval;
}
}
diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java
index 3db4435..241eeeb 100644
--- a/src/jalview/analysis/AlignSeq.java
+++ b/src/jalview/analysis/AlignSeq.java
@@ -1,29 +1,43 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import java.util.*;
-
-import java.awt.*;
-
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import jalview.util.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Mapping;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.ScoreMatrix;
+import jalview.util.Comparison;
+import jalview.util.Format;
+import jalview.util.MapList;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.StringTokenizer;
/**
*
@@ -37,13 +51,13 @@ public class AlignSeq
public static final String DNA = "dna";
- static String[] dna =
- { "A", "C", "G", "T", "-" };
+ private static final String NEWLINE = System.lineSeparator();
+
+ static String[] dna = { "A", "C", "G", "T", "-" };
// "C", "T", "A", "G", "-"};
- static String[] pep =
- { "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",
- "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "-" };
+ static String[] pep = { "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I",
+ "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "-" };
int[][] score;
@@ -267,16 +281,44 @@ public class AlignSeq
}
/**
- * DOCUMENT ME!
+ *
+ * @return aligned instance of Seq 1
+ */
+ public SequenceI getAlignedSeq1()
+ {
+ SequenceI alSeq1 = new Sequence(s1.getName(), getAStr1());
+ alSeq1.setStart(s1.getStart() + getSeq1Start() - 1);
+ alSeq1.setEnd(s1.getStart() + getSeq1End() - 1);
+ alSeq1.setDatasetSequence(s1.getDatasetSequence() == null ? s1 : s1
+ .getDatasetSequence());
+ return alSeq1;
+ }
+
+ /**
+ *
+ * @return aligned instance of Seq 2
+ */
+ public SequenceI getAlignedSeq2()
+ {
+ SequenceI alSeq2 = new Sequence(s2.getName(), getAStr2());
+ alSeq2.setStart(s2.getStart() + getSeq2Start() - 1);
+ alSeq2.setEnd(s2.getStart() + getSeq2End() - 1);
+ alSeq2.setDatasetSequence(s2.getDatasetSequence() == null ? s2 : s2
+ .getDatasetSequence());
+ return alSeq2;
+ }
+
+ /**
+ * Construct score matrix for sequences with standard DNA or PEPTIDE matrix
*
* @param s1
- * DOCUMENT ME!
+ * - sequence 1
* @param string1
- * - string to align for sequence1
+ * - string to use for s1
* @param s2
- * sequence 2
+ * - sequence 2
* @param string2
- * - string to align for sequence2
+ * - string to use for s2
* @param type
* DNA or PEPTIDE
*/
@@ -289,6 +331,20 @@ public class AlignSeq
SeqInit(string1, string2);
}
+ /**
+ * Construct score matrix for sequences with custom substitution matrix
+ *
+ * @param s1
+ * - sequence 1
+ * @param string1
+ * - string to use for s1
+ * @param s2
+ * - sequence 2
+ * @param string2
+ * - string to use for s2
+ * @param scoreMatrix
+ * - substitution matrix to use for alignment
+ */
public void SeqInit(SequenceI s1, String string1, SequenceI s2,
String string2, ScoreMatrix scoreMatrix)
{
@@ -382,19 +438,19 @@ public class AlignSeq
{
intToStr = pep;
charToInt = ResidueProperties.aaIndex;
- defInt = 23;
+ defInt = ResidueProperties.maxProteinIndex;
}
else if (type.equals(AlignSeq.DNA))
{
intToStr = dna;
charToInt = ResidueProperties.nucleotideIndex;
- defInt = 4;
+ defInt = ResidueProperties.maxNucleotideIndex;
}
else
{
output.append("Wrong type = dna or pep only");
- throw new Error("Unknown Type " + type2
- + " - dna or pep are the only allowed values.");
+ throw new Error(MessageManager.formatMessage(
+ "error.unknown_type_dna_or_pep", new String[] { type2 }));
}
}
@@ -524,21 +580,28 @@ public class AlignSeq
int nochunks = ((aseq1.length - count) / len) + 1;
pid = 0;
- output.append("Score = " + score[maxi][maxj] + "\n");
- output.append("Length of alignment = " + (aseq1.length - count) + "\n");
+ output.append("Score = ").append(score[maxi][maxj]).append(NEWLINE);
+ output.append("Length of alignment = ")
+ .append(String.valueOf(aseq1.length - count)).append(NEWLINE);
output.append("Sequence ");
output.append(new Format("%" + maxid + "s").form(s1.getName()));
- output.append(" : " + s1.getStart() + " - " + s1.getEnd()
- + " (Sequence length = " + s1str.length() + ")\n");
+ output.append(" : ").append(String.valueOf(s1.getStart()))
+ .append(" - ").append(String.valueOf(s1.getEnd()));
+ output.append(" (Sequence length = ")
+ .append(String.valueOf(s1str.length())).append(")")
+ .append(NEWLINE);
output.append("Sequence ");
output.append(new Format("%" + maxid + "s").form(s2.getName()));
- output.append(" : " + s2.getStart() + " - " + s2.getEnd()
- + " (Sequence length = " + s2str.length() + ")\n\n");
+ output.append(" : ").append(String.valueOf(s2.getStart()))
+ .append(" - ").append(String.valueOf(s2.getEnd()));
+ output.append(" (Sequence length = ")
+ .append(String.valueOf(s2str.length())).append(")")
+ .append(NEWLINE).append(NEWLINE);
for (int j = 0; j < nochunks; j++)
{
// Print the first aligned sequence
- output.append(new Format("%" + (maxid) + "s").form(s1id) + " ");
+ output.append(new Format("%" + (maxid) + "s").form(s1id)).append(" ");
for (int i = 0; i < len; i++)
{
@@ -548,8 +611,8 @@ public class AlignSeq
}
}
- output.append("\n");
- output.append(new Format("%" + (maxid) + "s").form(" ") + " ");
+ output.append(NEWLINE);
+ output.append(new Format("%" + (maxid) + "s").form(" ")).append(" ");
// Print out the matching chars
for (int i = 0; i < len; i++)
@@ -583,9 +646,9 @@ public class AlignSeq
}
// Now print the second aligned sequence
- output = output.append("\n");
- output = output.append(new Format("%" + (maxid) + "s").form(s2id)
- + " ");
+ output = output.append(NEWLINE);
+ output = output.append(new Format("%" + (maxid) + "s").form(s2id))
+ .append(" ");
for (int i = 0; i < len; i++)
{
@@ -595,10 +658,10 @@ public class AlignSeq
}
}
- output = output.append("\n\n");
+ output.append(NEWLINE).append(NEWLINE);
}
- pid = pid / (float) (aseq1.length - count) * 100;
+ pid = pid / (aseq1.length - count) * 100;
output = output.append(new Format("Percentage ID = %2.2f\n\n")
.form(pid));
@@ -749,19 +812,23 @@ public class AlignSeq
}
/**
- * DOCUMENT ME!
+ * Returns the given sequence with all of the given gap characters removed.
*
- * @param gapChar
- * DOCUMENT ME!
+ * @param gapChars
+ * a string of characters to be treated as gaps
* @param seq
- * DOCUMENT ME!
+ * the input sequence
*
- * @return DOCUMENT ME!
+ * @return
*/
- public static String extractGaps(String gapChar, String seq)
+ public static String extractGaps(String gapChars, String seq)
{
- StringTokenizer str = new StringTokenizer(seq, gapChar);
- StringBuffer newString = new StringBuffer();
+ if (gapChars == null || seq == null)
+ {
+ return null;
+ }
+ StringTokenizer str = new StringTokenizer(seq, gapChars);
+ StringBuilder newString = new StringBuilder(seq.length());
while (str.hasMoreTokens())
{
@@ -918,4 +985,286 @@ public class AlignSeq
}
}
}
+
+ /**
+ * Compute a globally optimal needleman and wunsch alignment between two
+ * sequences
+ *
+ * @param s1
+ * @param s2
+ * @param type
+ * AlignSeq.DNA or AlignSeq.PEP
+ */
+ public static AlignSeq doGlobalNWAlignment(SequenceI s1, SequenceI s2,
+ String type)
+ {
+ AlignSeq as = new AlignSeq(s1, s2, type);
+
+ as.calcScoreMatrix();
+ as.traceAlignment();
+ return as;
+ }
+
+ /**
+ *
+ * @return mapping from positions in S1 to corresponding positions in S2
+ */
+ public jalview.datamodel.Mapping getMappingFromS1(boolean allowmismatch)
+ {
+ ArrayList<Integer> as1 = new ArrayList<Integer>(), as2 = new ArrayList<Integer>();
+ int pdbpos = s2.getStart() + getSeq2Start() - 2;
+ int alignpos = s1.getStart() + getSeq1Start() - 2;
+ int lp2 = pdbpos - 3, lp1 = alignpos - 3;
+ boolean lastmatch = false;
+ // and now trace the alignment onto the atom set.
+ for (int i = 0; i < astr1.length(); i++)
+ {
+ char c1 = astr1.charAt(i), c2 = astr2.charAt(i);
+ if (c1 != '-')
+ {
+ alignpos++;
+ }
+
+ if (c2 != '-')
+ {
+ pdbpos++;
+ }
+
+ if (allowmismatch || c1 == c2)
+ {
+ // extend mapping interval
+ if (lp1 + 1 != alignpos || lp2 + 1 != pdbpos)
+ {
+ as1.add(Integer.valueOf(alignpos));
+ as2.add(Integer.valueOf(pdbpos));
+ }
+ lastmatch = true;
+ lp1 = alignpos;
+ lp2 = pdbpos;
+ }
+ else
+ {
+ // extend mapping interval
+ if (lastmatch)
+ {
+ as1.add(Integer.valueOf(lp1));
+ as2.add(Integer.valueOf(lp2));
+ }
+ lastmatch = false;
+ }
+ }
+ // construct range pairs
+
+ int[] mapseq1 = new int[as1.size() + (lastmatch ? 1 : 0)], mapseq2 = new int[as2
+ .size() + (lastmatch ? 1 : 0)];
+ int i = 0;
+ for (Integer ip : as1)
+ {
+ mapseq1[i++] = ip;
+ }
+ ;
+ i = 0;
+ for (Integer ip : as2)
+ {
+ mapseq2[i++] = ip;
+ }
+ ;
+ if (lastmatch)
+ {
+ mapseq1[mapseq1.length - 1] = alignpos;
+ mapseq2[mapseq2.length - 1] = pdbpos;
+ }
+ MapList map = new MapList(mapseq1, mapseq2, 1, 1);
+
+ jalview.datamodel.Mapping mapping = new Mapping(map);
+ mapping.setTo(s2);
+ return mapping;
+ }
+
+ /**
+ * matches ochains against al and populates seqs with the best match between
+ * each ochain and the set in al
+ *
+ * @param ochains
+ * @param al
+ * @param dnaOrProtein
+ * @param removeOldAnnots
+ * when true, old annotation is cleared before new annotation
+ * transferred
+ * @return List<List<SequenceI> originals, List<SequenceI> replacement,
+ * List<AlignSeq> alignment between each>
+ */
+ public static List<List<? extends Object>> replaceMatchingSeqsWith(
+ List<SequenceI> seqs, List<AlignmentAnnotation> annotations,
+ List<SequenceI> ochains, AlignmentI al, String dnaOrProtein,
+ boolean removeOldAnnots)
+ {
+ List<SequenceI> orig = new ArrayList<SequenceI>(), repl = new ArrayList<SequenceI>();
+ List<AlignSeq> aligs = new ArrayList<AlignSeq>();
+ if (al != null && al.getHeight() > 0)
+ {
+ ArrayList<SequenceI> matches = new ArrayList<SequenceI>();
+ ArrayList<AlignSeq> aligns = new ArrayList<AlignSeq>();
+
+ for (SequenceI sq : ochains)
+ {
+ SequenceI bestm = null;
+ AlignSeq bestaseq = null;
+ int bestscore = 0;
+ for (SequenceI msq : al.getSequences())
+ {
+ AlignSeq aseq = doGlobalNWAlignment(msq, sq, dnaOrProtein);
+ if (bestm == null || aseq.getMaxScore() > bestscore)
+ {
+ bestscore = aseq.getMaxScore();
+ bestaseq = aseq;
+ bestm = msq;
+ }
+ }
+ System.out.println("Best Score for " + (matches.size() + 1) + " :"
+ + bestscore);
+ matches.add(bestm);
+ aligns.add(bestaseq);
+ al.deleteSequence(bestm);
+ }
+ for (int p = 0, pSize = seqs.size(); p < pSize; p++)
+ {
+ SequenceI sq, sp = seqs.get(p);
+ int q;
+ if ((q = ochains.indexOf(sp)) > -1)
+ {
+ seqs.set(p, sq = matches.get(q));
+ orig.add(sp);
+ repl.add(sq);
+ sq.setName(sp.getName());
+ sq.setDescription(sp.getDescription());
+ Mapping sp2sq;
+ sq.transferAnnotation(sp,
+ sp2sq = aligns.get(q).getMappingFromS1(false));
+ aligs.add(aligns.get(q));
+ int inspos = -1;
+ for (int ap = 0; ap < annotations.size();)
+ {
+ if (annotations.get(ap).sequenceRef == sp)
+ {
+ if (inspos == -1)
+ {
+ inspos = ap;
+ }
+ if (removeOldAnnots)
+ {
+ annotations.remove(ap);
+ }
+ else
+ {
+ AlignmentAnnotation alan = annotations.remove(ap);
+ alan.liftOver(sq, sp2sq);
+ alan.setSequenceRef(sq);
+ sq.addAlignmentAnnotation(alan);
+ }
+ }
+ else
+ {
+ ap++;
+ }
+ }
+ if (sq.getAnnotation() != null && sq.getAnnotation().length > 0)
+ {
+ annotations.addAll(inspos == -1 ? annotations.size() : inspos,
+ Arrays.asList(sq.getAnnotation()));
+ }
+ }
+ }
+ }
+ return Arrays.asList(orig, repl, aligs);
+ }
+
+ /**
+ * compute the PID vector used by the redundancy filter.
+ *
+ * @param originalSequences
+ * - sequences in alignment that are to filtered
+ * @param omitHidden
+ * - null or strings to be analysed (typically, visible portion of
+ * each sequence in alignment)
+ * @param start
+ * - first column in window for calculation
+ * @param end
+ * - last column in window for calculation
+ * @param ungapped
+ * - if true then use ungapped sequence to compute PID
+ * @return vector containing maximum PID for i-th sequence and any sequences
+ * longer than that seuqence
+ */
+ public static float[] computeRedundancyMatrix(
+ SequenceI[] originalSequences, String[] omitHidden, int start,
+ int end, boolean ungapped)
+ {
+ int height = originalSequences.length;
+ float[] redundancy = new float[height];
+ int[] lngth = new int[height];
+ for (int i = 0; i < height; i++)
+ {
+ redundancy[i] = 0f;
+ lngth[i] = -1;
+ }
+
+ // long start = System.currentTimeMillis();
+
+ float pid;
+ String seqi, seqj;
+ for (int i = 0; i < height; i++)
+ {
+
+ for (int j = 0; j < i; j++)
+ {
+ if (i == j)
+ {
+ continue;
+ }
+
+ if (omitHidden == null)
+ {
+ seqi = originalSequences[i].getSequenceAsString(start, end);
+ seqj = originalSequences[j].getSequenceAsString(start, end);
+ }
+ else
+ {
+ seqi = omitHidden[i];
+ seqj = omitHidden[j];
+ }
+ if (lngth[i] == -1)
+ {
+ String ug = AlignSeq.extractGaps(Comparison.GapChars, seqi);
+ lngth[i] = ug.length();
+ if (ungapped)
+ {
+ seqi = ug;
+ }
+ }
+ if (lngth[j] == -1)
+ {
+ String ug = AlignSeq.extractGaps(Comparison.GapChars, seqj);
+ lngth[j] = ug.length();
+ if (ungapped)
+ {
+ seqj = ug;
+ }
+ }
+ pid = Comparison.PID(seqi, seqj);
+
+ // use real sequence length rather than string length
+ if (lngth[j] < lngth[i])
+ {
+ redundancy[j] = Math.max(pid, redundancy[j]);
+ }
+ else
+ {
+ redundancy[i] = Math.max(pid, redundancy[i]);
+ }
+
+ }
+ }
+ return redundancy;
+ }
}
diff --git a/src/jalview/analysis/AlignmentAnnotationUtils.java b/src/jalview/analysis/AlignmentAnnotationUtils.java
new file mode 100644
index 0000000..ca618e3
--- /dev/null
+++ b/src/jalview/analysis/AlignmentAnnotationUtils.java
@@ -0,0 +1,243 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceI;
+import jalview.renderer.AnnotationRenderer;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.BitSet;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class AlignmentAnnotationUtils
+{
+
+ /**
+ * Helper method to populate lists of annotation types for the Show/Hide
+ * Annotations menus. If sequenceGroup is not null, this is restricted to
+ * annotations which are associated with sequences in the selection group.
+ * <p/>
+ * If an annotation row is currently visible, its type (label) is added (once
+ * only per type), to the shownTypes list. If it is currently hidden, it is
+ * added to the hiddenTypesList.
+ * <p/>
+ * For rows that belong to a line graph group, so are always rendered
+ * together:
+ * <ul>
+ * <li>Treat all rows in the group as visible, if at least one of them is</li>
+ * <li>Build a list of all the annotation types that belong to the group</li>
+ * </ul>
+ *
+ * @param shownTypes
+ * a map, keyed by calcId (annotation source), whose entries are the
+ * lists of annotation types found for the calcId; each annotation
+ * type in turn may be a list (in the case of grouped annotations)
+ * @param hiddenTypes
+ * a map, similar to shownTypes, but for hidden annotation types
+ * @param annotations
+ * the annotations on the alignment to scan
+ * @param forSequences
+ * the sequences to restrict search to
+ */
+ public static void getShownHiddenTypes(
+ Map<String, List<List<String>>> shownTypes,
+ Map<String, List<List<String>>> hiddenTypes,
+ List<AlignmentAnnotation> annotations,
+ List<SequenceI> forSequences)
+ {
+ BitSet visibleGraphGroups = AlignmentAnnotationUtils
+ .getVisibleLineGraphGroups(annotations);
+
+ /*
+ * Build a lookup, by calcId (annotation source), of all annotation types in
+ * each graph group.
+ */
+ Map<String, Map<Integer, List<String>>> groupLabels = new HashMap<String, Map<Integer, List<String>>>();
+
+ // trackers for which calcId!label combinations we have dealt with
+ List<String> addedToShown = new ArrayList<String>();
+ List<String> addedToHidden = new ArrayList<String>();
+
+ for (AlignmentAnnotation aa : annotations)
+ {
+ /*
+ * Ignore non-positional annotations, can't render these against an
+ * alignment
+ */
+ if (aa.annotations == null)
+ {
+ continue;
+ }
+ if (forSequences != null
+ && (aa.sequenceRef != null && forSequences
+ .contains(aa.sequenceRef)))
+ {
+ String calcId = aa.getCalcId();
+
+ /*
+ * Build a 'composite label' for types in line graph groups.
+ */
+ final List<String> labelAsList = new ArrayList<String>();
+ final String displayLabel = aa.label;
+ labelAsList.add(displayLabel);
+ if (aa.graph == AlignmentAnnotation.LINE_GRAPH
+ && aa.graphGroup > -1)
+ {
+ if (!groupLabels.containsKey(calcId))
+ {
+ groupLabels.put(calcId, new HashMap<Integer, List<String>>());
+ }
+ Map<Integer, List<String>> groupLabelsForCalcId = groupLabels
+ .get(calcId);
+ if (groupLabelsForCalcId.containsKey(aa.graphGroup))
+ {
+ if (!groupLabelsForCalcId.get(aa.graphGroup).contains(
+ displayLabel))
+ {
+ groupLabelsForCalcId.get(aa.graphGroup).add(displayLabel);
+ }
+ }
+ else
+ {
+ groupLabelsForCalcId.put(aa.graphGroup, labelAsList);
+ }
+ }
+ else
+ /*
+ * 'Simple case' - not a grouped annotation type - list of one label
+ * only
+ */
+ {
+ String rememberAs = calcId + "!" + displayLabel;
+ if (aa.visible && !addedToShown.contains(rememberAs))
+ {
+ if (!shownTypes.containsKey(calcId))
+ {
+ shownTypes.put(calcId, new ArrayList<List<String>>());
+ }
+ shownTypes.get(calcId).add(labelAsList);
+ addedToShown.add(rememberAs);
+ }
+ else
+ {
+ if (!aa.visible && !addedToHidden.contains(rememberAs))
+ {
+ if (!hiddenTypes.containsKey(calcId))
+ {
+ hiddenTypes.put(calcId, new ArrayList<List<String>>());
+ }
+ hiddenTypes.get(calcId).add(labelAsList);
+ addedToHidden.add(rememberAs);
+ }
+ }
+ }
+ }
+ }
+ /*
+ * Finally add the 'composite group labels' to the appropriate lists,
+ * depending on whether the group is identified as visible or hidden. Don't
+ * add the same label more than once (there may be many graph groups that
+ * generate it).
+ */
+ for (String calcId : groupLabels.keySet())
+ {
+ for (int group : groupLabels.get(calcId).keySet())
+ {
+ final List<String> groupLabel = groupLabels.get(calcId).get(group);
+ // don't want to duplicate 'same types in different order'
+ Collections.sort(groupLabel);
+ if (visibleGraphGroups.get(group))
+ {
+ if (!shownTypes.containsKey(calcId))
+ {
+ shownTypes.put(calcId, new ArrayList<List<String>>());
+ }
+ if (!shownTypes.get(calcId).contains(groupLabel))
+ {
+ shownTypes.get(calcId).add(groupLabel);
+ }
+ }
+ else
+ {
+ if (!hiddenTypes.containsKey(calcId))
+ {
+ hiddenTypes.put(calcId, new ArrayList<List<String>>());
+ }
+ if (!hiddenTypes.get(calcId).contains(groupLabel))
+ {
+ hiddenTypes.get(calcId).add(groupLabel);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns a BitSet (possibly empty) of those graphGroups for line graph
+ * annotations, which have at least one member annotation row marked visible.
+ * <p/>
+ * Only one row in each visible group is marked visible, but when it is drawn,
+ * so are all the other rows in the same group.
+ * <p/>
+ * This lookup set allows us to check whether rows apparently marked not
+ * visible are in fact shown.
+ *
+ * @see AnnotationRenderer#drawComponent
+ * @param annotations
+ * @return
+ */
+ public static BitSet getVisibleLineGraphGroups(
+ List<AlignmentAnnotation> annotations)
+ {
+ BitSet result = new BitSet();
+ for (AlignmentAnnotation ann : annotations)
+ {
+ if (ann.graph == AlignmentAnnotation.LINE_GRAPH && ann.visible)
+ {
+ int gg = ann.graphGroup;
+ if (gg > -1)
+ {
+ result.set(gg);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Converts an array of AlignmentAnnotation into a List of
+ * AlignmentAnnotation. A null array is converted to an empty list.
+ *
+ * @param anns
+ * @return
+ */
+ public static List<AlignmentAnnotation> asList(AlignmentAnnotation[] anns)
+ {
+ // TODO use AlignmentAnnotationI instead when it exists
+ return (anns == null ? Collections.<AlignmentAnnotation> emptyList()
+ : Arrays.asList(anns));
+ }
+}
diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java
index d78b5b3..ac861d8 100644
--- a/src/jalview/analysis/AlignmentSorter.java
+++ b/src/jalview/analysis/AlignmentSorter.java
@@ -1,26 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import java.util.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentOrder;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequenceNode;
+import jalview.util.Comparison;
+import jalview.util.MessageManager;
+import jalview.util.QuickSort;
-import jalview.datamodel.*;
-import jalview.util.*;
+import java.util.ArrayList;
+import java.util.List;
/**
* Routines for manipulating the order of a multiple sequence alignment TODO:
@@ -117,7 +129,7 @@ public class AlignmentSorter
seqs[i] = align.getSequenceAt(i);
}
- QuickSort.sort(scores, 0, scores.length - 1, seqs);
+ QuickSort.sort(scores, seqs);
setReverseOrder(align, seqs);
}
@@ -146,11 +158,15 @@ public class AlignmentSorter
}
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work
- for (int i = 0; i < len; i++)
+ List<SequenceI> asq;
+ synchronized (asq = align.getSequences())
{
- // SequenceI tmp = seqs[i];
- align.getSequences().setElementAt(seqs[nSeq - i - 1], i);
- align.getSequences().setElementAt(seqs[i], nSeq - i - 1);
+ for (int i = 0; i < len; i++)
+ {
+ // SequenceI tmp = seqs[i];
+ asq.set(i, seqs[nSeq - i - 1]);
+ asq.set(nSeq - i - 1, seqs[i]);
+ }
}
}
@@ -162,7 +178,7 @@ public class AlignmentSorter
* @param tmp
* sequences as a vector
*/
- private static void setOrder(AlignmentI align, Vector tmp)
+ private static void setOrder(AlignmentI align, List<SequenceI> tmp)
{
setOrder(align, vectorSubsetToArray(tmp, align.getSequences()));
}
@@ -178,24 +194,26 @@ public class AlignmentSorter
public static void setOrder(AlignmentI align, SequenceI[] seqs)
{
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work
- Vector algn = align.getSequences();
- Vector tmp = new Vector();
-
- for (int i = 0; i < seqs.length; i++)
+ List<SequenceI> algn;
+ synchronized (algn = align.getSequences())
{
- if (algn.contains(seqs[i]))
+ List<SequenceI> tmp = new ArrayList<SequenceI>();
+
+ for (int i = 0; i < seqs.length; i++)
{
- tmp.addElement(seqs[i]);
+ if (algn.contains(seqs[i]))
+ {
+ tmp.add(seqs[i]);
+ }
}
- }
- algn.removeAllElements();
- // User may have hidden seqs, then clicked undo or redo
- for (int i = 0; i < tmp.size(); i++)
- {
- algn.addElement(tmp.elementAt(i));
+ algn.clear();
+ // User may have hidden seqs, then clicked undo or redo
+ for (int i = 0; i < tmp.size(); i++)
+ {
+ algn.add(tmp.get(i));
+ }
}
-
}
/**
@@ -247,7 +265,7 @@ public class AlignmentSorter
for (int i = 0; i < nSeq; i++)
{
seqs[i] = align.getSequenceAt(i);
- length[i] = (float) (seqs[i].getEnd() - seqs[i].getStart());
+ length[i] = (seqs[i].getEnd() - seqs[i].getStart());
}
QuickSort.sort(length, seqs);
@@ -276,7 +294,7 @@ public class AlignmentSorter
{
// MAINTAINS ORIGNAL SEQUENCE ORDER,
// ORDERS BY GROUP SIZE
- Vector groups = new Vector();
+ List<SequenceGroup> groups = new ArrayList<SequenceGroup>();
if (groups.hashCode() != lastGroupHash)
{
@@ -290,17 +308,15 @@ public class AlignmentSorter
// SORTS GROUPS BY SIZE
// ////////////////////
- for (int i = 0; i < align.getGroups().size(); i++)
+ for (SequenceGroup sg : align.getGroups())
{
- SequenceGroup sg = (SequenceGroup) align.getGroups().elementAt(i);
-
for (int j = 0; j < groups.size(); j++)
{
- SequenceGroup sg2 = (SequenceGroup) groups.elementAt(j);
+ SequenceGroup sg2 = groups.get(j);
if (sg.getSize() > sg2.getSize())
{
- groups.insertElementAt(sg, j);
+ groups.add(j, sg);
break;
}
@@ -308,22 +324,22 @@ public class AlignmentSorter
if (!groups.contains(sg))
{
- groups.addElement(sg);
+ groups.add(sg);
}
}
// NOW ADD SEQUENCES MAINTAINING ALIGNMENT ORDER
// /////////////////////////////////////////////
- Vector seqs = new Vector();
+ List<SequenceI> seqs = new ArrayList<SequenceI>();
for (int i = 0; i < groups.size(); i++)
{
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
+ SequenceGroup sg = groups.get(i);
SequenceI[] orderedseqs = sg.getSequencesInOrder(align);
for (int j = 0; j < orderedseqs.length; j++)
{
- seqs.addElement(orderedseqs[j]);
+ seqs.add(orderedseqs[j]);
}
}
@@ -339,38 +355,24 @@ public class AlignmentSorter
}
/**
- * Converts Vector to array. java 1.18 does not have Vector.toArray()
- *
- * @param tmp
- * Vector of SequenceI objects
- *
- * @return array of Sequence[]
- */
- private static SequenceI[] vectorToArray(Vector tmp)
- {
- SequenceI[] seqs = new SequenceI[tmp.size()];
-
- for (int i = 0; i < tmp.size(); i++)
- {
- seqs[i] = (SequenceI) tmp.elementAt(i);
- }
-
- return seqs;
- }
-
- /**
- * DOCUMENT ME!
+ * Select sequences in order from tmp that is present in mask, and any
+ * remaining sequences in mask not in tmp
*
* @param tmp
- * DOCUMENT ME!
+ * thread safe collection of sequences
* @param mask
- * DOCUMENT ME!
+ * thread safe collection of sequences
*
- * @return DOCUMENT ME!
+ * @return intersect(tmp,mask)+intersect(complement(tmp),mask)
*/
- private static SequenceI[] vectorSubsetToArray(Vector tmp, Vector mask)
+ private static SequenceI[] vectorSubsetToArray(List<SequenceI> tmp,
+ List<SequenceI> mask)
{
- Vector seqs = new Vector();
+ // or?
+ // tmp2 = tmp.retainAll(mask);
+ // return tmp2.addAll(mask.removeAll(tmp2))
+
+ ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
int i, idx;
boolean[] tmask = new boolean[mask.size()];
@@ -381,12 +383,12 @@ public class AlignmentSorter
for (i = 0; i < tmp.size(); i++)
{
- Object sq = tmp.elementAt(i);
+ SequenceI sq = tmp.get(i);
idx = mask.indexOf(sq);
if (idx > -1 && tmask[idx])
{
tmask[idx] = false;
- seqs.addElement(sq);
+ seqs.add(sq);
}
}
@@ -394,11 +396,11 @@ public class AlignmentSorter
{
if (tmask[i])
{
- seqs.addElement(mask.elementAt(i));
+ seqs.add(mask.get(i));
}
}
- return vectorToArray(seqs);
+ return seqs.toArray(new SequenceI[seqs.size()]);
}
/**
@@ -412,7 +414,7 @@ public class AlignmentSorter
public static void sortBy(AlignmentI align, AlignmentOrder order)
{
// Get an ordered vector of sequences which may also be present in align
- Vector tmp = order.getOrder();
+ List<SequenceI> tmp = order.getOrder();
if (lastOrder == order)
{
@@ -443,11 +445,12 @@ public class AlignmentSorter
*
* @return DOCUMENT ME!
*/
- private static Vector getOrderByTree(AlignmentI align, NJTree tree)
+ private static List<SequenceI> getOrderByTree(AlignmentI align,
+ NJTree tree)
{
int nSeq = align.getHeight();
- Vector tmp = new Vector();
+ List<SequenceI> tmp = new ArrayList<SequenceI>();
tmp = _sortByTree(tree.getTopNode(), tmp, align.getSequences());
@@ -463,8 +466,12 @@ public class AlignmentSorter
if (tmp.size() != nSeq)
{
- System.err.println("WARNING: tmp.size()=" + tmp.size() + " != nseq="
- + nSeq + " in getOrderByTree - tree contains sequences not in alignment");
+ System.err
+ .println("WARNING: tmp.size()="
+ + tmp.size()
+ + " != nseq="
+ + nSeq
+ + " in getOrderByTree - tree contains sequences not in alignment");
}
}
@@ -481,7 +488,7 @@ public class AlignmentSorter
*/
public static void sortByTree(AlignmentI align, NJTree tree)
{
- Vector tmp = getOrderByTree(align, tree);
+ List<SequenceI> tmp = getOrderByTree(align, tree);
// tmp should properly permute align with tree.
if (lastTree != tree)
@@ -509,22 +516,22 @@ public class AlignmentSorter
*
* @param align
* DOCUMENT ME!
- * @param seqs
+ * @param tmp
* DOCUMENT ME!
*/
- private static void addStrays(AlignmentI align, Vector seqs)
+ private static void addStrays(AlignmentI align, List<SequenceI> tmp)
{
int nSeq = align.getHeight();
for (int i = 0; i < nSeq; i++)
{
- if (!seqs.contains(align.getSequenceAt(i)))
+ if (!tmp.contains(align.getSequenceAt(i)))
{
- seqs.addElement(align.getSequenceAt(i));
+ tmp.add(align.getSequenceAt(i));
}
}
- if (nSeq != seqs.size())
+ if (nSeq != tmp.size())
{
System.err
.println("ERROR: Size still not right even after addStrays");
@@ -543,8 +550,8 @@ public class AlignmentSorter
*
* @return DOCUMENT ME!
*/
- private static Vector _sortByTree(SequenceNode node, Vector tmp,
- Vector seqset)
+ private static List<SequenceI> _sortByTree(SequenceNode node,
+ List<SequenceI> tmp, List<SequenceI> seqset)
{
if (node == null)
{
@@ -560,9 +567,11 @@ public class AlignmentSorter
{
if (node.element() instanceof SequenceI)
{
- if (!tmp.contains(node.element())) // && (seqset==null || seqset.size()==0 || seqset.contains(tmp)))
+ if (!tmp.contains(node.element())) // && (seqset==null ||
+ // seqset.size()==0 ||
+ // seqset.contains(tmp)))
{
- tmp.addElement((SequenceI) node.element());
+ tmp.add((SequenceI) node.element());
}
}
}
@@ -709,9 +718,9 @@ public class AlignmentSorter
public static void sortByFeature(String featureLabel, String groupLabel,
int start, int stop, AlignmentI alignment, String method)
{
- sortByFeature(featureLabel == null ? null : new String[]
- { featureLabel }, groupLabel == null ? null : new String[]
- { groupLabel }, start, stop, alignment, method);
+ sortByFeature(featureLabel == null ? null
+ : new String[] { featureLabel }, groupLabel == null ? null
+ : new String[] { groupLabel }, start, stop, alignment, method);
}
private static boolean containsIgnoreCase(final String lab,
@@ -743,7 +752,8 @@ public class AlignmentSorter
&& method != FEATURE_DENSITY)
{
throw new Error(
- "Implementation Error - sortByFeature method must be one of FEATURE_SCORE, FEATURE_LABEL or FEATURE_DENSITY.");
+ MessageManager
+ .getString("error.implementation_error_sortbyfeature"));
}
boolean ignoreScore = method != FEATURE_SCORE;
StringBuffer scoreLabel = new StringBuffer();
@@ -771,10 +781,6 @@ public class AlignmentSorter
for (int i = 0; i < seqs.length; i++)
{
SequenceFeature[] sf = seqs[i].getSequenceFeatures();
- if (sf == null && seqs[i].getDatasetSequence() != null)
- {
- sf = seqs[i].getDatasetSequence().getSequenceFeatures();
- }
if (sf == null)
{
sf = new SequenceFeature[0];
@@ -815,7 +821,7 @@ public class AlignmentSorter
else
{
// or, also take a look at the scores if necessary.
- if (!ignoreScore && sf[f].getScore() != Float.NaN)
+ if (!ignoreScore && !Float.isNaN(sf[f].getScore()))
{
if (seqScores[i] == 0)
{
@@ -923,7 +929,8 @@ public class AlignmentSorter
{
if (method == FEATURE_LABEL)
{
- throw new Error("Not yet implemented.");
+ throw new Error(
+ MessageManager.getString("error.not_yet_implemented"));
}
}
if (lastSortByFeatureScore == null
diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java
new file mode 100644
index 0000000..926317a
--- /dev/null
+++ b/src/jalview/analysis/AlignmentUtils.java
@@ -0,0 +1,1424 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+import jalview.datamodel.AlignedCodon;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.FeatureProperties;
+import jalview.datamodel.Mapping;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ResidueProperties;
+import jalview.util.DBRefUtils;
+import jalview.util.MapList;
+import jalview.util.MappingUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+
+/**
+ * grab bag of useful alignment manipulation operations Expect these to be
+ * refactored elsewhere at some point.
+ *
+ * @author jimp
+ *
+ */
+public class AlignmentUtils
+{
+
+ /**
+ * given an existing alignment, create a new alignment including all, or up to
+ * flankSize additional symbols from each sequence's dataset sequence
+ *
+ * @param core
+ * @param flankSize
+ * @return AlignmentI
+ */
+ public static AlignmentI expandContext(AlignmentI core, int flankSize)
+ {
+ List<SequenceI> sq = new ArrayList<SequenceI>();
+ int maxoffset = 0;
+ for (SequenceI s : core.getSequences())
+ {
+ SequenceI newSeq = s.deriveSequence();
+ final int newSeqStart = newSeq.getStart() - 1;
+ if (newSeqStart > maxoffset
+ && newSeq.getDatasetSequence().getStart() < s.getStart())
+ {
+ maxoffset = newSeqStart;
+ }
+ sq.add(newSeq);
+ }
+ if (flankSize > -1)
+ {
+ maxoffset = Math.min(maxoffset, flankSize);
+ }
+
+ /*
+ * now add offset left and right to create an expanded alignment
+ */
+ for (SequenceI s : sq)
+ {
+ SequenceI ds = s;
+ while (ds.getDatasetSequence() != null)
+ {
+ ds = ds.getDatasetSequence();
+ }
+ int s_end = s.findPosition(s.getStart() + s.getLength());
+ // find available flanking residues for sequence
+ int ustream_ds = s.getStart() - ds.getStart();
+ int dstream_ds = ds.getEnd() - s_end;
+
+ // build new flanked sequence
+
+ // compute gap padding to start of flanking sequence
+ int offset = maxoffset - ustream_ds;
+
+ // padding is gapChar x ( maxoffset - min(ustream_ds, flank)
+ if (flankSize >= 0)
+ {
+ if (flankSize < ustream_ds)
+ {
+ // take up to flankSize residues
+ offset = maxoffset - flankSize;
+ ustream_ds = flankSize;
+ }
+ if (flankSize <= dstream_ds)
+ {
+ dstream_ds = flankSize - 1;
+ }
+ }
+ // TODO use Character.toLowerCase to avoid creating String objects?
+ char[] upstream = new String(ds.getSequence(s.getStart() - 1
+ - ustream_ds, s.getStart() - 1)).toLowerCase().toCharArray();
+ char[] downstream = new String(ds.getSequence(s_end - 1, s_end
+ + dstream_ds)).toLowerCase().toCharArray();
+ char[] coreseq = s.getSequence();
+ char[] nseq = new char[offset + upstream.length + downstream.length
+ + coreseq.length];
+ char c = core.getGapCharacter();
+
+ int p = 0;
+ for (; p < offset; p++)
+ {
+ nseq[p] = c;
+ }
+
+ System.arraycopy(upstream, 0, nseq, p, upstream.length);
+ System.arraycopy(coreseq, 0, nseq, p + upstream.length,
+ coreseq.length);
+ System.arraycopy(downstream, 0, nseq, p + coreseq.length
+ + upstream.length, downstream.length);
+ s.setSequence(new String(nseq));
+ s.setStart(s.getStart() - ustream_ds);
+ s.setEnd(s_end + downstream.length);
+ }
+ AlignmentI newAl = new jalview.datamodel.Alignment(
+ sq.toArray(new SequenceI[0]));
+ for (SequenceI s : sq)
+ {
+ if (s.getAnnotation() != null)
+ {
+ for (AlignmentAnnotation aa : s.getAnnotation())
+ {
+ aa.adjustForAlignment(); // JAL-1712 fix
+ newAl.addAnnotation(aa);
+ }
+ }
+ }
+ newAl.setDataset(core.getDataset());
+ return newAl;
+ }
+
+ /**
+ * Returns the index (zero-based position) of a sequence in an alignment, or
+ * -1 if not found.
+ *
+ * @param al
+ * @param seq
+ * @return
+ */
+ public static int getSequenceIndex(AlignmentI al, SequenceI seq)
+ {
+ int result = -1;
+ int pos = 0;
+ for (SequenceI alSeq : al.getSequences())
+ {
+ if (alSeq == seq)
+ {
+ result = pos;
+ break;
+ }
+ pos++;
+ }
+ return result;
+ }
+
+ /**
+ * Returns a map of lists of sequences in the alignment, keyed by sequence
+ * name. For use in mapping between different alignment views of the same
+ * sequences.
+ *
+ * @see jalview.datamodel.AlignmentI#getSequencesByName()
+ */
+ public static Map<String, List<SequenceI>> getSequencesByName(
+ AlignmentI al)
+ {
+ Map<String, List<SequenceI>> theMap = new LinkedHashMap<String, List<SequenceI>>();
+ for (SequenceI seq : al.getSequences())
+ {
+ String name = seq.getName();
+ if (name != null)
+ {
+ List<SequenceI> seqs = theMap.get(name);
+ if (seqs == null)
+ {
+ seqs = new ArrayList<SequenceI>();
+ theMap.put(name, seqs);
+ }
+ seqs.add(seq);
+ }
+ }
+ return theMap;
+ }
+
+ /**
+ * Build mapping of protein to cDNA alignment. Mappings are made between
+ * sequences where the cDNA translates to the protein sequence. Any new
+ * mappings are added to the protein alignment. Returns true if any mappings
+ * either already exist or were added, else false.
+ *
+ * @param proteinAlignment
+ * @param cdnaAlignment
+ * @return
+ */
+ public static boolean mapProteinToCdna(final AlignmentI proteinAlignment,
+ final AlignmentI cdnaAlignment)
+ {
+ if (proteinAlignment == null || cdnaAlignment == null)
+ {
+ return false;
+ }
+
+ Set<SequenceI> mappedDna = new HashSet<SequenceI>();
+ Set<SequenceI> mappedProtein = new HashSet<SequenceI>();
+
+ /*
+ * First pass - map sequences where cross-references exist. This include
+ * 1-to-many mappings to support, for example, variant cDNA.
+ */
+ boolean mappingPerformed = mapProteinToCdna(proteinAlignment,
+ cdnaAlignment, mappedDna, mappedProtein, true);
+
+ /*
+ * Second pass - map sequences where no cross-references exist. This only
+ * does 1-to-1 mappings and assumes corresponding sequences are in the same
+ * order in the alignments.
+ */
+ mappingPerformed |= mapProteinToCdna(proteinAlignment, cdnaAlignment,
+ mappedDna, mappedProtein, false);
+ return mappingPerformed;
+ }
+
+ /**
+ * Make mappings between compatible sequences (where the cDNA translation
+ * matches the protein).
+ *
+ * @param proteinAlignment
+ * @param cdnaAlignment
+ * @param mappedDna
+ * a set of mapped DNA sequences (to add to)
+ * @param mappedProtein
+ * a set of mapped Protein sequences (to add to)
+ * @param xrefsOnly
+ * if true, only map sequences where xrefs exist
+ * @return
+ */
+ protected static boolean mapProteinToCdna(
+ final AlignmentI proteinAlignment,
+ final AlignmentI cdnaAlignment, Set<SequenceI> mappedDna,
+ Set<SequenceI> mappedProtein, boolean xrefsOnly)
+ {
+ boolean mappingPerformed = false;
+ List<SequenceI> thisSeqs = proteinAlignment.getSequences();
+ for (SequenceI aaSeq : thisSeqs)
+ {
+ boolean proteinMapped = false;
+ AlignedCodonFrame acf = new AlignedCodonFrame();
+
+ for (SequenceI cdnaSeq : cdnaAlignment.getSequences())
+ {
+ /*
+ * Always try to map if sequences have xref to each other; this supports
+ * variant cDNA or alternative splicing for a protein sequence.
+ *
+ * If no xrefs, try to map progressively, assuming that alignments have
+ * mappable sequences in corresponding order. These are not
+ * many-to-many, as that would risk mixing species with similar cDNA
+ * sequences.
+ */
+ if (xrefsOnly && !AlignmentUtils.haveCrossRef(aaSeq, cdnaSeq))
+ {
+ continue;
+ }
+
+ /*
+ * Don't map non-xrefd sequences more than once each. This heuristic
+ * allows us to pair up similar sequences in ordered alignments.
+ */
+ if (!xrefsOnly
+ && (mappedProtein.contains(aaSeq) || mappedDna
+ .contains(cdnaSeq)))
+ {
+ continue;
+ }
+ if (!mappingExists(proteinAlignment.getCodonFrames(),
+ aaSeq.getDatasetSequence(), cdnaSeq.getDatasetSequence()))
+ {
+ MapList map = mapProteinToCdna(aaSeq, cdnaSeq);
+ if (map != null)
+ {
+ acf.addMap(cdnaSeq, aaSeq, map);
+ mappingPerformed = true;
+ proteinMapped = true;
+ mappedDna.add(cdnaSeq);
+ mappedProtein.add(aaSeq);
+ }
+ }
+ }
+ if (proteinMapped)
+ {
+ proteinAlignment.addCodonFrame(acf);
+ }
+ }
+ return mappingPerformed;
+ }
+
+ /**
+ * Answers true if the mappings include one between the given (dataset)
+ * sequences.
+ */
+ public static boolean mappingExists(Set<AlignedCodonFrame> set,
+ SequenceI aaSeq, SequenceI cdnaSeq)
+ {
+ if (set != null)
+ {
+ for (AlignedCodonFrame acf : set)
+ {
+ if (cdnaSeq == acf.getDnaForAaSeq(aaSeq))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Build a mapping (if possible) of a protein to a cDNA sequence. The cDNA
+ * must be three times the length of the protein, possibly after ignoring
+ * start and/or stop codons, and must translate to the protein. Returns null
+ * if no mapping is determined.
+ *
+ * @param proteinSeqs
+ * @param cdnaSeq
+ * @return
+ */
+ public static MapList mapProteinToCdna(SequenceI proteinSeq,
+ SequenceI cdnaSeq)
+ {
+ /*
+ * Here we handle either dataset sequence set (desktop) or absent (applet).
+ * Use only the char[] form of the sequence to avoid creating possibly large
+ * String objects.
+ */
+ final SequenceI proteinDataset = proteinSeq.getDatasetSequence();
+ char[] aaSeqChars = proteinDataset != null ? proteinDataset
+ .getSequence() : proteinSeq.getSequence();
+ final SequenceI cdnaDataset = cdnaSeq.getDatasetSequence();
+ char[] cdnaSeqChars = cdnaDataset != null ? cdnaDataset.getSequence()
+ : cdnaSeq.getSequence();
+ if (aaSeqChars == null || cdnaSeqChars == null)
+ {
+ return null;
+ }
+
+ /*
+ * cdnaStart/End, proteinStartEnd are base 1 (for dataset sequence mapping)
+ */
+ final int mappedLength = 3 * aaSeqChars.length;
+ int cdnaLength = cdnaSeqChars.length;
+ int cdnaStart = 1;
+ int cdnaEnd = cdnaLength;
+ final int proteinStart = 1;
+ final int proteinEnd = aaSeqChars.length;
+
+ /*
+ * If lengths don't match, try ignoring stop codon.
+ */
+ if (cdnaLength != mappedLength && cdnaLength > 2)
+ {
+ String lastCodon = String.valueOf(cdnaSeqChars, cdnaLength - 3, 3)
+ .toUpperCase();
+ for (String stop : ResidueProperties.STOP)
+ {
+ if (lastCodon.equals(stop))
+ {
+ cdnaEnd -= 3;
+ cdnaLength -= 3;
+ break;
+ }
+ }
+ }
+
+ /*
+ * If lengths still don't match, try ignoring start codon.
+ */
+ if (cdnaLength != mappedLength
+ && cdnaLength > 2
+ && String.valueOf(cdnaSeqChars, 0, 3).toUpperCase()
+ .equals(ResidueProperties.START))
+ {
+ cdnaStart += 3;
+ cdnaLength -= 3;
+ }
+
+ if (cdnaLength != mappedLength)
+ {
+ return null;
+ }
+ if (!translatesAs(cdnaSeqChars, cdnaStart - 1, aaSeqChars))
+ {
+ return null;
+ }
+ MapList map = new MapList(new int[] { cdnaStart, cdnaEnd }, new int[] {
+ proteinStart, proteinEnd }, 3, 1);
+ return map;
+ }
+
+ /**
+ * Test whether the given cdna sequence, starting at the given offset,
+ * translates to the given amino acid sequence, using the standard translation
+ * table. Designed to fail fast i.e. as soon as a mismatch position is found.
+ *
+ * @param cdnaSeqChars
+ * @param cdnaStart
+ * @param aaSeqChars
+ * @return
+ */
+ protected static boolean translatesAs(char[] cdnaSeqChars, int cdnaStart,
+ char[] aaSeqChars)
+ {
+ if (cdnaSeqChars == null || aaSeqChars == null)
+ {
+ return false;
+ }
+
+ int aaResidue = 0;
+ for (int i = cdnaStart; i < cdnaSeqChars.length - 2
+ && aaResidue < aaSeqChars.length; i += 3, aaResidue++)
+ {
+ String codon = String.valueOf(cdnaSeqChars, i, 3);
+ final String translated = ResidueProperties.codonTranslate(codon);
+ /*
+ * allow * in protein to match untranslatable in dna
+ */
+ final char aaRes = aaSeqChars[aaResidue];
+ if ((translated == null || "STOP".equals(translated)) && aaRes == '*')
+ {
+ continue;
+ }
+ if (translated == null || !(aaRes == translated.charAt(0)))
+ {
+ // debug
+ // System.out.println(("Mismatch at " + i + "/" + aaResidue + ": "
+ // + codon + "(" + translated + ") != " + aaRes));
+ return false;
+ }
+ }
+ // fail if we didn't match all of the aa sequence
+ return (aaResidue == aaSeqChars.length);
+ }
+
+ /**
+ * Align sequence 'seq' to match the alignment of a mapped sequence. Note this
+ * currently assumes that we are aligning cDNA to match protein.
+ *
+ * @param seq
+ * the sequence to be realigned
+ * @param al
+ * the alignment whose sequence alignment is to be 'copied'
+ * @param gap
+ * character string represent a gap in the realigned sequence
+ * @param preserveUnmappedGaps
+ * @param preserveMappedGaps
+ * @return true if the sequence was realigned, false if it could not be
+ */
+ public static boolean alignSequenceAs(SequenceI seq, AlignmentI al,
+ String gap, boolean preserveMappedGaps,
+ boolean preserveUnmappedGaps)
+ {
+ /*
+ * Get any mappings from the source alignment to the target (dataset)
+ * sequence.
+ */
+ // TODO there may be one AlignedCodonFrame per dataset sequence, or one with
+ // all mappings. Would it help to constrain this?
+ List<AlignedCodonFrame> mappings = al.getCodonFrame(seq);
+ if (mappings == null || mappings.isEmpty())
+ {
+ return false;
+ }
+
+ /*
+ * Locate the aligned source sequence whose dataset sequence is mapped. We
+ * just take the first match here (as we can't align cDNA like more than one
+ * protein sequence).
+ */
+ SequenceI alignFrom = null;
+ AlignedCodonFrame mapping = null;
+ for (AlignedCodonFrame mp : mappings)
+ {
+ alignFrom = mp.findAlignedSequence(seq.getDatasetSequence(), al);
+ if (alignFrom != null)
+ {
+ mapping = mp;
+ break;
+ }
+ }
+
+ if (alignFrom == null)
+ {
+ return false;
+ }
+ alignSequenceAs(seq, alignFrom, mapping, gap, al.getGapCharacter(),
+ preserveMappedGaps, preserveUnmappedGaps);
+ return true;
+ }
+
+ /**
+ * Align sequence 'alignTo' the same way as 'alignFrom', using the mapping to
+ * match residues and codons. Flags control whether existing gaps in unmapped
+ * (intron) and mapped (exon) regions are preserved or not. Gaps linking intro
+ * and exon are only retained if both flags are set.
+ *
+ * @param alignTo
+ * @param alignFrom
+ * @param mapping
+ * @param myGap
+ * @param sourceGap
+ * @param preserveUnmappedGaps
+ * @param preserveMappedGaps
+ */
+ public static void alignSequenceAs(SequenceI alignTo,
+ SequenceI alignFrom, AlignedCodonFrame mapping, String myGap,
+ char sourceGap, boolean preserveMappedGaps,
+ boolean preserveUnmappedGaps)
+ {
+ // TODO generalise to work for Protein-Protein, dna-dna, dna-protein
+ final char[] thisSeq = alignTo.getSequence();
+ final char[] thatAligned = alignFrom.getSequence();
+ StringBuilder thisAligned = new StringBuilder(2 * thisSeq.length);
+
+ // aligned and dataset sequence positions, all base zero
+ int thisSeqPos = 0;
+ int sourceDsPos = 0;
+
+ int basesWritten = 0;
+ char myGapChar = myGap.charAt(0);
+ int ratio = myGap.length();
+
+ /*
+ * Traverse the aligned protein sequence.
+ */
+ int sourceGapMappedLength = 0;
+ boolean inExon = false;
+ for (char sourceChar : thatAligned)
+ {
+ if (sourceChar == sourceGap)
+ {
+ sourceGapMappedLength += ratio;
+ continue;
+ }
+
+ /*
+ * Found a residue. Locate its mapped codon (start) position.
+ */
+ sourceDsPos++;
+ // Note mapping positions are base 1, our sequence positions base 0
+ int[] mappedPos = mapping.getMappedRegion(alignTo, alignFrom,
+ sourceDsPos);
+ if (mappedPos == null)
+ {
+ /*
+ * Abort realignment if unmapped protein. Or could ignore it??
+ */
+ System.err.println("Can't align: no codon mapping to residue "
+ + sourceDsPos + "(" + sourceChar + ")");
+ return;
+ }
+
+ int mappedCodonStart = mappedPos[0]; // position (1...) of codon start
+ int mappedCodonEnd = mappedPos[mappedPos.length - 1]; // codon end pos
+ StringBuilder trailingCopiedGap = new StringBuilder();
+
+ /*
+ * Copy dna sequence up to and including this codon. Optionally, include
+ * gaps before the codon starts (in introns) and/or after the codon starts
+ * (in exons).
+ *
+ * Note this only works for 'linear' splicing, not reverse or interleaved.
+ * But then 'align dna as protein' doesn't make much sense otherwise.
+ */
+ int intronLength = 0;
+ while (basesWritten < mappedCodonEnd && thisSeqPos < thisSeq.length)
+ {
+ final char c = thisSeq[thisSeqPos++];
+ if (c != myGapChar)
+ {
+ basesWritten++;
+
+ if (basesWritten < mappedCodonStart)
+ {
+ /*
+ * Found an unmapped (intron) base. First add in any preceding gaps
+ * (if wanted).
+ */
+ if (preserveUnmappedGaps && trailingCopiedGap.length() > 0)
+ {
+ thisAligned.append(trailingCopiedGap.toString());
+ intronLength += trailingCopiedGap.length();
+ trailingCopiedGap = new StringBuilder();
+ }
+ intronLength++;
+ inExon = false;
+ }
+ else
+ {
+ final boolean startOfCodon = basesWritten == mappedCodonStart;
+ int gapsToAdd = calculateGapsToInsert(preserveMappedGaps,
+ preserveUnmappedGaps, sourceGapMappedLength, inExon,
+ trailingCopiedGap.length(), intronLength, startOfCodon);
+ for (int i = 0; i < gapsToAdd; i++)
+ {
+ thisAligned.append(myGapChar);
+ }
+ sourceGapMappedLength = 0;
+ inExon = true;
+ }
+ thisAligned.append(c);
+ trailingCopiedGap = new StringBuilder();
+ }
+ else
+ {
+ if (inExon && preserveMappedGaps)
+ {
+ trailingCopiedGap.append(myGapChar);
+ }
+ else if (!inExon && preserveUnmappedGaps)
+ {
+ trailingCopiedGap.append(myGapChar);
+ }
+ }
+ }
+ }
+
+ /*
+ * At end of protein sequence. Copy any remaining dna sequence, optionally
+ * including (intron) gaps. We do not copy trailing gaps in protein.
+ */
+ while (thisSeqPos < thisSeq.length)
+ {
+ final char c = thisSeq[thisSeqPos++];
+ if (c != myGapChar || preserveUnmappedGaps)
+ {
+ thisAligned.append(c);
+ }
+ }
+
+ /*
+ * All done aligning, set the aligned sequence.
+ */
+ alignTo.setSequence(new String(thisAligned));
+ }
+
+ /**
+ * Helper method to work out how many gaps to insert when realigning.
+ *
+ * @param preserveMappedGaps
+ * @param preserveUnmappedGaps
+ * @param sourceGapMappedLength
+ * @param inExon
+ * @param trailingCopiedGap
+ * @param intronLength
+ * @param startOfCodon
+ * @return
+ */
+ protected static int calculateGapsToInsert(boolean preserveMappedGaps,
+ boolean preserveUnmappedGaps, int sourceGapMappedLength,
+ boolean inExon, int trailingGapLength, int intronLength,
+ final boolean startOfCodon)
+ {
+ int gapsToAdd = 0;
+ if (startOfCodon)
+ {
+ /*
+ * Reached start of codon. Ignore trailing gaps in intron unless we are
+ * preserving gaps in both exon and intron. Ignore them anyway if the
+ * protein alignment introduces a gap at least as large as the intronic
+ * region.
+ */
+ if (inExon && !preserveMappedGaps)
+ {
+ trailingGapLength = 0;
+ }
+ if (!inExon && !(preserveMappedGaps && preserveUnmappedGaps))
+ {
+ trailingGapLength = 0;
+ }
+ if (inExon)
+ {
+ gapsToAdd = Math.max(sourceGapMappedLength, trailingGapLength);
+ }
+ else
+ {
+ if (intronLength + trailingGapLength <= sourceGapMappedLength)
+ {
+ gapsToAdd = sourceGapMappedLength - intronLength;
+ }
+ else
+ {
+ gapsToAdd = Math.min(intronLength + trailingGapLength
+ - sourceGapMappedLength, trailingGapLength);
+ }
+ }
+ }
+ else
+ {
+ /*
+ * second or third base of codon; check for any gaps in dna
+ */
+ if (!preserveMappedGaps)
+ {
+ trailingGapLength = 0;
+ }
+ gapsToAdd = Math.max(sourceGapMappedLength, trailingGapLength);
+ }
+ return gapsToAdd;
+ }
+
+ /**
+ * Returns a list of sequences mapped from the given sequences and aligned
+ * (gapped) in the same way. For example, the cDNA for aligned protein, where
+ * a single gap in protein generates three gaps in cDNA.
+ *
+ * @param sequences
+ * @param gapCharacter
+ * @param mappings
+ * @return
+ */
+ public static List<SequenceI> getAlignedTranslation(
+ List<SequenceI> sequences, char gapCharacter,
+ Set<AlignedCodonFrame> mappings)
+ {
+ List<SequenceI> alignedSeqs = new ArrayList<SequenceI>();
+
+ for (SequenceI seq : sequences)
+ {
+ List<SequenceI> mapped = getAlignedTranslation(seq, gapCharacter,
+ mappings);
+ alignedSeqs.addAll(mapped);
+ }
+ return alignedSeqs;
+ }
+
+ /**
+ * Returns sequences aligned 'like' the source sequence, as mapped by the
+ * given mappings. Normally we expect zero or one 'mapped' sequences, but this
+ * will support 1-to-many as well.
+ *
+ * @param seq
+ * @param gapCharacter
+ * @param mappings
+ * @return
+ */
+ protected static List<SequenceI> getAlignedTranslation(SequenceI seq,
+ char gapCharacter, Set<AlignedCodonFrame> mappings)
+ {
+ List<SequenceI> result = new ArrayList<SequenceI>();
+ for (AlignedCodonFrame mapping : mappings)
+ {
+ if (mapping.involvesSequence(seq))
+ {
+ SequenceI mapped = getAlignedTranslation(seq, gapCharacter, mapping);
+ if (mapped != null)
+ {
+ result.add(mapped);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns the translation of 'seq' (as held in the mapping) with
+ * corresponding alignment (gaps).
+ *
+ * @param seq
+ * @param gapCharacter
+ * @param mapping
+ * @return
+ */
+ protected static SequenceI getAlignedTranslation(SequenceI seq,
+ char gapCharacter, AlignedCodonFrame mapping)
+ {
+ String gap = String.valueOf(gapCharacter);
+ boolean toDna = false;
+ int fromRatio = 1;
+ SequenceI mapTo = mapping.getDnaForAaSeq(seq);
+ if (mapTo != null)
+ {
+ // mapping is from protein to nucleotide
+ toDna = true;
+ // should ideally get gap count ratio from mapping
+ gap = String.valueOf(new char[] { gapCharacter, gapCharacter,
+ gapCharacter });
+ }
+ else
+ {
+ // mapping is from nucleotide to protein
+ mapTo = mapping.getAaForDnaSeq(seq);
+ fromRatio = 3;
+ }
+ StringBuilder newseq = new StringBuilder(seq.getLength()
+ * (toDna ? 3 : 1));
+
+ int residueNo = 0; // in seq, base 1
+ int[] phrase = new int[fromRatio];
+ int phraseOffset = 0;
+ int gapWidth = 0;
+ boolean first = true;
+ final Sequence alignedSeq = new Sequence("", "");
+
+ for (char c : seq.getSequence())
+ {
+ if (c == gapCharacter)
+ {
+ gapWidth++;
+ if (gapWidth >= fromRatio)
+ {
+ newseq.append(gap);
+ gapWidth = 0;
+ }
+ }
+ else
+ {
+ phrase[phraseOffset++] = residueNo + 1;
+ if (phraseOffset == fromRatio)
+ {
+ /*
+ * Have read a whole codon (or protein residue), now translate: map
+ * source phrase to positions in target sequence add characters at
+ * these positions to newseq Note mapping positions are base 1, our
+ * sequence positions base 0.
+ */
+ SearchResults sr = new SearchResults();
+ for (int pos : phrase)
+ {
+ mapping.markMappedRegion(seq, pos, sr);
+ }
+ newseq.append(sr.getCharacters());
+ if (first)
+ {
+ first = false;
+ // Hack: Copy sequence dataset, name and description from
+ // SearchResults.match[0].sequence
+ // TODO? carry over sequence names from original 'complement'
+ // alignment
+ SequenceI mappedTo = sr.getResultSequence(0);
+ alignedSeq.setName(mappedTo.getName());
+ alignedSeq.setDescription(mappedTo.getDescription());
+ alignedSeq.setDatasetSequence(mappedTo);
+ }
+ phraseOffset = 0;
+ }
+ residueNo++;
+ }
+ }
+ alignedSeq.setSequence(newseq.toString());
+ return alignedSeq;
+ }
+
+ /**
+ * Realigns the given protein to match the alignment of the dna, using codon
+ * mappings to translate aligned codon positions to protein residues.
+ *
+ * @param protein
+ * the alignment whose sequences are realigned by this method
+ * @param dna
+ * the dna alignment whose alignment we are 'copying'
+ * @return the number of sequences that were realigned
+ */
+ public static int alignProteinAsDna(AlignmentI protein, AlignmentI dna)
+ {
+ List<SequenceI> unmappedProtein = new ArrayList<SequenceI>();
+ unmappedProtein.addAll(protein.getSequences());
+
+ Set<AlignedCodonFrame> mappings = protein.getCodonFrames();
+
+ /*
+ * Map will hold, for each aligned codon position e.g. [3, 5, 6], a map of
+ * {dnaSequence, {proteinSequence, codonProduct}} at that position. The
+ * comparator keeps the codon positions ordered.
+ */
+ Map<AlignedCodon, Map<SequenceI, String>> alignedCodons = new TreeMap<AlignedCodon, Map<SequenceI, String>>(
+ new CodonComparator());
+ for (SequenceI dnaSeq : dna.getSequences())
+ {
+ for (AlignedCodonFrame mapping : mappings)
+ {
+ Mapping seqMap = mapping.getMappingForSequence(dnaSeq);
+ SequenceI prot = mapping.findAlignedSequence(
+ dnaSeq.getDatasetSequence(), protein);
+ if (prot != null)
+ {
+ addCodonPositions(dnaSeq, prot, protein.getGapCharacter(),
+ seqMap, alignedCodons);
+ unmappedProtein.remove(prot);
+ }
+ }
+ }
+ return alignProteinAs(protein, alignedCodons, unmappedProtein);
+ }
+
+ /**
+ * Update the aligned protein sequences to match the codon alignments given in
+ * the map.
+ *
+ * @param protein
+ * @param alignedCodons
+ * an ordered map of codon positions (columns), with sequence/peptide
+ * values present in each column
+ * @param unmappedProtein
+ * @return
+ */
+ protected static int alignProteinAs(AlignmentI protein,
+ Map<AlignedCodon, Map<SequenceI, String>> alignedCodons,
+ List<SequenceI> unmappedProtein)
+ {
+ /*
+ * Prefill aligned sequences with gaps before inserting aligned protein
+ * residues.
+ */
+ int alignedWidth = alignedCodons.size();
+ char[] gaps = new char[alignedWidth];
+ Arrays.fill(gaps, protein.getGapCharacter());
+ String allGaps = String.valueOf(gaps);
+ for (SequenceI seq : protein.getSequences())
+ {
+ if (!unmappedProtein.contains(seq))
+ {
+ seq.setSequence(allGaps);
+ }
+ }
+
+ int column = 0;
+ for (AlignedCodon codon : alignedCodons.keySet())
+ {
+ final Map<SequenceI, String> columnResidues = alignedCodons
+ .get(codon);
+ for (Entry<SequenceI, String> entry : columnResidues.entrySet())
+ {
+ // place translated codon at its column position in sequence
+ entry.getKey().getSequence()[column] = entry.getValue().charAt(0);
+ }
+ column++;
+ }
+ return 0;
+ }
+
+ /**
+ * Populate the map of aligned codons by traversing the given sequence
+ * mapping, locating the aligned positions of mapped codons, and adding those
+ * positions and their translation products to the map.
+ *
+ * @param dna
+ * the aligned sequence we are mapping from
+ * @param protein
+ * the sequence to be aligned to the codons
+ * @param gapChar
+ * the gap character in the dna sequence
+ * @param seqMap
+ * a mapping to a sequence translation
+ * @param alignedCodons
+ * the map we are building up
+ */
+ static void addCodonPositions(SequenceI dna, SequenceI protein,
+ char gapChar, Mapping seqMap,
+ Map<AlignedCodon, Map<SequenceI, String>> alignedCodons)
+ {
+ Iterator<AlignedCodon> codons = seqMap.getCodonIterator(dna, gapChar);
+ while (codons.hasNext())
+ {
+ AlignedCodon codon = codons.next();
+ Map<SequenceI, String> seqProduct = alignedCodons.get(codon);
+ if (seqProduct == null)
+ {
+ seqProduct = new HashMap<SequenceI, String>();
+ alignedCodons.put(codon, seqProduct);
+ }
+ seqProduct.put(protein, codon.product);
+ }
+ }
+
+ /**
+ * Returns true if a cDNA/Protein mapping either exists, or could be made,
+ * between at least one pair of sequences in the two alignments. Currently,
+ * the logic is:
+ * <ul>
+ * <li>One alignment must be nucleotide, and the other protein</li>
+ * <li>At least one pair of sequences must be already mapped, or mappable</li>
+ * <li>Mappable means the nucleotide translation matches the protein sequence</li>
+ * <li>The translation may ignore start and stop codons if present in the
+ * nucleotide</li>
+ * </ul>
+ *
+ * @param al1
+ * @param al2
+ * @return
+ */
+ public static boolean isMappable(AlignmentI al1, AlignmentI al2)
+ {
+ if (al1 == null || al2 == null)
+ {
+ return false;
+ }
+
+ /*
+ * Require one nucleotide and one protein
+ */
+ if (al1.isNucleotide() == al2.isNucleotide())
+ {
+ return false;
+ }
+ AlignmentI dna = al1.isNucleotide() ? al1 : al2;
+ AlignmentI protein = dna == al1 ? al2 : al1;
+ Set<AlignedCodonFrame> mappings = protein.getCodonFrames();
+ for (SequenceI dnaSeq : dna.getSequences())
+ {
+ for (SequenceI proteinSeq : protein.getSequences())
+ {
+ if (isMappable(dnaSeq, proteinSeq, mappings))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if the dna sequence is mapped, or could be mapped, to the
+ * protein sequence.
+ *
+ * @param dnaSeq
+ * @param proteinSeq
+ * @param mappings
+ * @return
+ */
+ protected static boolean isMappable(SequenceI dnaSeq,
+ SequenceI proteinSeq, Set<AlignedCodonFrame> mappings)
+ {
+ if (dnaSeq == null || proteinSeq == null)
+ {
+ return false;
+ }
+
+ SequenceI dnaDs = dnaSeq.getDatasetSequence() == null ? dnaSeq : dnaSeq
+ .getDatasetSequence();
+ SequenceI proteinDs = proteinSeq.getDatasetSequence() == null ? proteinSeq
+ : proteinSeq.getDatasetSequence();
+
+ /*
+ * Already mapped?
+ */
+ for (AlignedCodonFrame mapping : mappings)
+ {
+ if (proteinDs == mapping.getAaForDnaSeq(dnaDs))
+ {
+ return true;
+ }
+ }
+
+ /*
+ * Just try to make a mapping (it is not yet stored), test whether
+ * successful.
+ */
+ return mapProteinToCdna(proteinDs, dnaDs) != null;
+ }
+
+ /**
+ * Finds any reference annotations associated with the sequences in
+ * sequenceScope, that are not already added to the alignment, and adds them
+ * to the 'candidates' map. Also populates a lookup table of annotation
+ * labels, keyed by calcId, for use in constructing tooltips or the like.
+ *
+ * @param sequenceScope
+ * the sequences to scan for reference annotations
+ * @param labelForCalcId
+ * (optional) map to populate with label for calcId
+ * @param candidates
+ * map to populate with annotations for sequence
+ * @param al
+ * the alignment to check for presence of annotations
+ */
+ public static void findAddableReferenceAnnotations(
+ List<SequenceI> sequenceScope,
+ Map<String, String> labelForCalcId,
+ final Map<SequenceI, List<AlignmentAnnotation>> candidates,
+ AlignmentI al)
+ {
+ if (sequenceScope == null)
+ {
+ return;
+ }
+
+ /*
+ * For each sequence in scope, make a list of any annotations on the
+ * underlying dataset sequence which are not already on the alignment.
+ *
+ * Add to a map of { alignmentSequence, <List of annotations to add> }
+ */
+ for (SequenceI seq : sequenceScope)
+ {
+ SequenceI dataset = seq.getDatasetSequence();
+ if (dataset == null)
+ {
+ continue;
+ }
+ AlignmentAnnotation[] datasetAnnotations = dataset.getAnnotation();
+ if (datasetAnnotations == null)
+ {
+ continue;
+ }
+ final List<AlignmentAnnotation> result = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation dsann : datasetAnnotations)
+ {
+ /*
+ * Find matching annotations on the alignment. If none is found, then
+ * add this annotation to the list of 'addable' annotations for this
+ * sequence.
+ */
+ final Iterable<AlignmentAnnotation> matchedAlignmentAnnotations = al
+ .findAnnotations(seq, dsann.getCalcId(), dsann.label);
+ if (!matchedAlignmentAnnotations.iterator().hasNext())
+ {
+ result.add(dsann);
+ if (labelForCalcId != null)
+ {
+ labelForCalcId.put(dsann.getCalcId(), dsann.label);
+ }
+ }
+ }
+ /*
+ * Save any addable annotations for this sequence
+ */
+ if (!result.isEmpty())
+ {
+ candidates.put(seq, result);
+ }
+ }
+ }
+
+ /**
+ * Adds annotations to the top of the alignment annotations, in the same order
+ * as their related sequences.
+ *
+ * @param annotations
+ * the annotations to add
+ * @param alignment
+ * the alignment to add them to
+ * @param selectionGroup
+ * current selection group (or null if none)
+ */
+ public static void addReferenceAnnotations(
+ Map<SequenceI, List<AlignmentAnnotation>> annotations,
+ final AlignmentI alignment, final SequenceGroup selectionGroup)
+ {
+ for (SequenceI seq : annotations.keySet())
+ {
+ for (AlignmentAnnotation ann : annotations.get(seq))
+ {
+ AlignmentAnnotation copyAnn = new AlignmentAnnotation(ann);
+ int startRes = 0;
+ int endRes = ann.annotations.length;
+ if (selectionGroup != null)
+ {
+ startRes = selectionGroup.getStartRes();
+ endRes = selectionGroup.getEndRes();
+ }
+ copyAnn.restrict(startRes, endRes);
+
+ /*
+ * Add to the sequence (sets copyAnn.datasetSequence), unless the
+ * original annotation is already on the sequence.
+ */
+ if (!seq.hasAnnotation(ann))
+ {
+ seq.addAlignmentAnnotation(copyAnn);
+ }
+ // adjust for gaps
+ copyAnn.adjustForAlignment();
+ // add to the alignment and set visible
+ alignment.addAnnotation(copyAnn);
+ copyAnn.visible = true;
+ }
+ }
+ }
+
+ /**
+ * Set visibility of alignment annotations of specified types (labels), for
+ * specified sequences. This supports controls like
+ * "Show all secondary structure", "Hide all Temp factor", etc.
+ *
+ * @al the alignment to scan for annotations
+ * @param types
+ * the types (labels) of annotations to be updated
+ * @param forSequences
+ * if not null, only annotations linked to one of these sequences are
+ * in scope for update; if null, acts on all sequence annotations
+ * @param anyType
+ * if this flag is true, 'types' is ignored (label not checked)
+ * @param doShow
+ * if true, set visibility on, else set off
+ */
+ public static void showOrHideSequenceAnnotations(AlignmentI al,
+ Collection<String> types, List<SequenceI> forSequences,
+ boolean anyType, boolean doShow)
+ {
+ for (AlignmentAnnotation aa : al.getAlignmentAnnotation())
+ {
+ if (anyType || types.contains(aa.label))
+ {
+ if ((aa.sequenceRef != null)
+ && (forSequences == null || forSequences
+ .contains(aa.sequenceRef)))
+ {
+ aa.visible = doShow;
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns true if either sequence has a cross-reference to the other
+ *
+ * @param seq1
+ * @param seq2
+ * @return
+ */
+ public static boolean haveCrossRef(SequenceI seq1, SequenceI seq2)
+ {
+ // Note: moved here from class CrossRef as the latter class has dependencies
+ // not availability to the applet's classpath
+ return hasCrossRef(seq1, seq2) || hasCrossRef(seq2, seq1);
+ }
+
+ /**
+ * Returns true if seq1 has a cross-reference to seq2. Currently this assumes
+ * that sequence name is structured as Source|AccessionId.
+ *
+ * @param seq1
+ * @param seq2
+ * @return
+ */
+ public static boolean hasCrossRef(SequenceI seq1, SequenceI seq2)
+ {
+ if (seq1 == null || seq2 == null)
+ {
+ return false;
+ }
+ String name = seq2.getName();
+ final DBRefEntry[] xrefs = seq1.getDBRef();
+ if (xrefs != null)
+ {
+ for (DBRefEntry xref : xrefs)
+ {
+ String xrefName = xref.getSource() + "|" + xref.getAccessionId();
+ // case-insensitive test, consistent with DBRefEntry.equalRef()
+ if (xrefName.equalsIgnoreCase(name))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Constructs an alignment consisting of the mapped exon regions in the given
+ * nucleotide sequences, and updates mappings to match.
+ *
+ * @param dna
+ * aligned dna sequences
+ * @param mappings
+ * from dna to protein; these are replaced with new mappings
+ * @return an alignment whose sequences are the exon-only parts of the dna
+ * sequences (or null if no exons are found)
+ */
+ public static AlignmentI makeExonAlignment(SequenceI[] dna,
+ Set<AlignedCodonFrame> mappings)
+ {
+ Set<AlignedCodonFrame> newMappings = new LinkedHashSet<AlignedCodonFrame>();
+ List<SequenceI> exonSequences = new ArrayList<SequenceI>();
+
+ for (SequenceI dnaSeq : dna)
+ {
+ final SequenceI ds = dnaSeq.getDatasetSequence();
+ List<AlignedCodonFrame> seqMappings = MappingUtils
+ .findMappingsForSequence(ds, mappings);
+ for (AlignedCodonFrame acf : seqMappings)
+ {
+ AlignedCodonFrame newMapping = new AlignedCodonFrame();
+ final List<SequenceI> mappedExons = makeExonSequences(ds, acf,
+ newMapping);
+ if (!mappedExons.isEmpty())
+ {
+ exonSequences.addAll(mappedExons);
+ newMappings.add(newMapping);
+ }
+ }
+ }
+ AlignmentI al = new Alignment(
+ exonSequences.toArray(new SequenceI[exonSequences.size()]));
+ al.setDataset(null);
+
+ /*
+ * Replace the old mappings with the new ones
+ */
+ mappings.clear();
+ mappings.addAll(newMappings);
+
+ return al;
+ }
+
+ /**
+ * Helper method to make exon-only sequences and populate their mappings to
+ * protein products
+ * <p>
+ * For example, if ggCCaTTcGAg has mappings [3, 4, 6, 7, 9, 10] to protein
+ * then generate a sequence CCTTGA with mapping [1, 6] to the same protein
+ * residues
+ * <p>
+ * Typically eukaryotic dna will include exons encoding for a single peptide
+ * sequence i.e. return a single result. Bacterial dna may have overlapping
+ * exon mappings coding for multiple peptides so return multiple results
+ * (example EMBL KF591215).
+ *
+ * @param dnaSeq
+ * a dna dataset sequence
+ * @param mapping
+ * containing one or more mappings of the sequence to protein
+ * @param newMapping
+ * the new mapping to populate, from the exon-only sequences to their
+ * mapped protein sequences
+ * @return
+ */
+ protected static List<SequenceI> makeExonSequences(SequenceI dnaSeq,
+ AlignedCodonFrame mapping, AlignedCodonFrame newMapping)
+ {
+ List<SequenceI> exonSequences = new ArrayList<SequenceI>();
+ List<Mapping> seqMappings = mapping.getMappingsForSequence(dnaSeq);
+ final char[] dna = dnaSeq.getSequence();
+ for (Mapping seqMapping : seqMappings)
+ {
+ StringBuilder newSequence = new StringBuilder(dnaSeq.getLength());
+
+ /*
+ * Get the codon regions as { [2, 5], [7, 12], [14, 14] etc }
+ */
+ final List<int[]> dnaExonRanges = seqMapping.getMap().getFromRanges();
+ for (int[] range : dnaExonRanges)
+ {
+ for (int pos = range[0]; pos <= range[1]; pos++)
+ {
+ newSequence.append(dna[pos - 1]);
+ }
+ }
+
+ SequenceI exon = new Sequence(dnaSeq.getName(),
+ newSequence.toString());
+
+ /*
+ * Locate any xrefs to CDS database on the protein product and attach to
+ * the CDS sequence. Also add as a sub-token of the sequence name.
+ */
+ // default to "CDS" if we can't locate an actual gene id
+ String cdsAccId = FeatureProperties
+ .getCodingFeature(DBRefSource.EMBL);
+ DBRefEntry[] cdsRefs = DBRefUtils.selectRefs(seqMapping.getTo()
+ .getDBRef(), DBRefSource.CODINGDBS);
+ if (cdsRefs != null)
+ {
+ for (DBRefEntry cdsRef : cdsRefs)
+ {
+ exon.addDBRef(new DBRefEntry(cdsRef));
+ cdsAccId = cdsRef.getAccessionId();
+ }
+ }
+ exon.setName(exon.getName() + "|" + cdsAccId);
+ exon.createDatasetSequence();
+
+ /*
+ * Build new mappings - from the same protein regions, but now to
+ * contiguous exons
+ */
+ List<int[]> exonRange = new ArrayList<int[]>();
+ exonRange.add(new int[] { 1, newSequence.length() });
+ MapList map = new MapList(exonRange, seqMapping.getMap()
+ .getToRanges(), 3, 1);
+ newMapping.addMap(exon.getDatasetSequence(), seqMapping.getTo(), map);
+ MapList cdsToDnaMap = new MapList(dnaExonRanges, exonRange, 1, 1);
+ newMapping.addMap(dnaSeq, exon.getDatasetSequence(), cdsToDnaMap);
+
+ exonSequences.add(exon);
+ }
+ return exonSequences;
+ }
+}
diff --git a/src/jalview/analysis/AnnotationSorter.java b/src/jalview/analysis/AnnotationSorter.java
new file mode 100644
index 0000000..c1dd6a7
--- /dev/null
+++ b/src/jalview/analysis/AnnotationSorter.java
@@ -0,0 +1,416 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A helper class to sort all annotations associated with an alignment in
+ * various ways.
+ *
+ * @author gmcarstairs
+ *
+ */
+public class AnnotationSorter
+{
+
+ /**
+ * enum for annotation sort options. The text description is used in the
+ * Preferences drop-down options. The enum name is saved in the preferences
+ * file.
+ *
+ * @author gmcarstairs
+ *
+ */
+ public enum SequenceAnnotationOrder
+ {
+ // Text descriptions surface in the Preferences Sort by... options
+ SEQUENCE_AND_LABEL("Sequence"), LABEL_AND_SEQUENCE("Label"), NONE(
+ "No sort");
+
+ private String description;
+
+ private SequenceAnnotationOrder(String s)
+ {
+ description = s;
+ }
+
+ @Override
+ public String toString()
+ {
+ return description;
+ }
+
+ public static SequenceAnnotationOrder forDescription(String d)
+ {
+ for (SequenceAnnotationOrder order : values())
+ {
+ if (order.toString().equals(d))
+ {
+ return order;
+ }
+ }
+ return null;
+ }
+ }
+
+ // the alignment with respect to which annotations are sorted
+ private final AlignmentI alignment;
+
+ // user preference for placement of non-sequence annotations
+ private boolean showAutocalcAbove;
+
+ // working map of sequence index in alignment
+ private final Map<SequenceI, Integer> sequenceIndices = new HashMap<SequenceI, Integer>();
+
+ /**
+ * Constructor given an alignment and the location (top or bottom) of
+ * Consensus and similar.
+ *
+ * @param alignmentI
+ * @param showAutocalculatedAbove
+ */
+ public AnnotationSorter(AlignmentI alignmentI,
+ boolean showAutocalculatedAbove)
+ {
+ this.alignment = alignmentI;
+ this.showAutocalcAbove = showAutocalculatedAbove;
+ }
+
+ /**
+ * Default comparator sorts as follows by annotation type within sequence
+ * order:
+ * <ul>
+ * <li>annotations with a reference to a sequence in the alignment are sorted
+ * on sequence ordering</li>
+ * <li>other annotations go 'at the end', with their mutual order unchanged</li>
+ * <li>within the same sequence ref, sort by label (non-case-sensitive)</li>
+ * </ul>
+ */
+ private final Comparator<? super AlignmentAnnotation> bySequenceAndLabel = new Comparator<AlignmentAnnotation>()
+ {
+ @Override
+ public int compare(AlignmentAnnotation o1, AlignmentAnnotation o2)
+ {
+ if (o1 == null && o2 == null)
+ {
+ return 0;
+ }
+ if (o1 == null)
+ {
+ return -1;
+ }
+ if (o2 == null)
+ {
+ return 1;
+ }
+
+ // TODO how to treat sequence-related autocalculated annotation
+ boolean o1auto = o1.autoCalculated && o1.sequenceRef == null;
+ boolean o2auto = o2.autoCalculated && o2.sequenceRef == null;
+ /*
+ * Ignore label (keep existing ordering) for
+ * Conservation/Quality/Consensus etc
+ */
+ if (o1auto && o2auto)
+ {
+ return 0;
+ }
+
+ /*
+ * Sort autocalculated before or after sequence-related.
+ */
+ if (o1auto)
+ {
+ return showAutocalcAbove ? -1 : 1;
+ }
+ if (o2auto)
+ {
+ return showAutocalcAbove ? 1 : -1;
+ }
+ int sequenceOrder = compareSequences(o1, o2);
+ return sequenceOrder == 0 ? compareLabels(o1, o2) : sequenceOrder;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Sort by sequence and label";
+ }
+ };
+
+ /**
+ * This comparator sorts as follows by sequence order within annotation type
+ * <ul>
+ * <li>annotations with a reference to a sequence in the alignment are sorted
+ * on label (non-case-sensitive)</li>
+ * <li>other annotations go 'at the end', with their mutual order unchanged</li>
+ * <li>within the same label, sort by order of the related sequences</li>
+ * </ul>
+ */
+ private final Comparator<? super AlignmentAnnotation> byLabelAndSequence = new Comparator<AlignmentAnnotation>()
+ {
+ @Override
+ public int compare(AlignmentAnnotation o1, AlignmentAnnotation o2)
+ {
+ if (o1 == null && o2 == null)
+ {
+ return 0;
+ }
+ if (o1 == null)
+ {
+ return -1;
+ }
+ if (o2 == null)
+ {
+ return 1;
+ }
+
+ // TODO how to treat sequence-related autocalculated annotation
+ boolean o1auto = o1.autoCalculated && o1.sequenceRef == null;
+ boolean o2auto = o2.autoCalculated && o2.sequenceRef == null;
+ /*
+ * Ignore label (keep existing ordering) for
+ * Conservation/Quality/Consensus etc
+ */
+ if (o1auto && o2auto)
+ {
+ return 0;
+ }
+
+ /*
+ * Sort autocalculated before or after sequence-related.
+ */
+ if (o1auto)
+ {
+ return showAutocalcAbove ? -1 : 1;
+ }
+ if (o2auto)
+ {
+ return showAutocalcAbove ? 1 : -1;
+ }
+ int labelOrder = compareLabels(o1, o2);
+ return labelOrder == 0 ? compareSequences(o1, o2) : labelOrder;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Sort by label and sequence";
+ }
+ };
+
+ /**
+ * noSort leaves sort order unchanged, within sequence- and autocalculated
+ * annotations, but may switch the ordering of these groups. Note this is
+ * guaranteed (at least in Java 7) as Arrays.sort() is guaranteed to be
+ * 'stable' (not change ordering of equal items).
+ */
+ private Comparator<? super AlignmentAnnotation> noSort = new Comparator<AlignmentAnnotation>()
+ {
+ @Override
+ public int compare(AlignmentAnnotation o1, AlignmentAnnotation o2)
+ {
+ // TODO how to treat sequence-related autocalculated annotation
+ boolean o1auto = o1.autoCalculated && o1.sequenceRef == null;
+ boolean o2auto = o2.autoCalculated && o2.sequenceRef == null;
+ // TODO skip this test to allow customised ordering of all annotations
+ // - needs a third option: place autocalculated first / last / none
+ if (o1 != null && o2 != null)
+ {
+ if (o1auto && !o2auto)
+ {
+ return showAutocalcAbove ? -1 : 1;
+ }
+ if (!o1auto && o2auto)
+ {
+ return showAutocalcAbove ? 1 : -1;
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "No sort";
+ }
+ };
+
+ /**
+ * Sort by the specified ordering of sequence-specific annotations.
+ *
+ * @param alignmentAnnotations
+ * @param order
+ */
+ public void sort(AlignmentAnnotation[] alignmentAnnotations,
+ SequenceAnnotationOrder order)
+ {
+ if (alignmentAnnotations == null)
+ {
+ return;
+ }
+ // cache 'alignment sequence position' for the annotations
+ saveSequenceIndices(alignmentAnnotations);
+
+ Comparator<? super AlignmentAnnotation> comparator = getComparator(order);
+
+ if (alignmentAnnotations != null)
+ {
+ synchronized (alignmentAnnotations)
+ {
+ Arrays.sort(alignmentAnnotations, comparator);
+ }
+ }
+ }
+
+ /**
+ * Calculate and save in a temporary map the position of each annotation's
+ * sequence (if it has one) in the alignment. Faster to do this once than for
+ * every annotation comparison.
+ *
+ * @param alignmentAnnotations
+ */
+ private void saveSequenceIndices(
+ AlignmentAnnotation[] alignmentAnnotations)
+ {
+ sequenceIndices.clear();
+ for (AlignmentAnnotation ann : alignmentAnnotations)
+ {
+ SequenceI seq = ann.sequenceRef;
+ if (seq != null)
+ {
+ int index = AlignmentUtils.getSequenceIndex(alignment, seq);
+ sequenceIndices.put(seq, index);
+ }
+ }
+ }
+
+ /**
+ * Get the comparator for the specified sort order.
+ *
+ * @param order
+ * @return
+ */
+ private Comparator<? super AlignmentAnnotation> getComparator(
+ SequenceAnnotationOrder order)
+ {
+ if (order == null)
+ {
+ return noSort;
+ }
+ switch (order)
+ {
+ case NONE:
+ return this.noSort;
+ case SEQUENCE_AND_LABEL:
+ return this.bySequenceAndLabel;
+ case LABEL_AND_SEQUENCE:
+ return this.byLabelAndSequence;
+ default:
+ throw new UnsupportedOperationException(order.toString());
+ }
+ }
+
+ /**
+ * Non-case-sensitive comparison of annotation labels. Returns zero if either
+ * argument is null.
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ private int compareLabels(AlignmentAnnotation o1, AlignmentAnnotation o2)
+ {
+ if (o1 == null || o2 == null)
+ {
+ return 0;
+ }
+ String label1 = o1.label;
+ String label2 = o2.label;
+ if (label1 == null && label2 == null)
+ {
+ return 0;
+ }
+ if (label1 == null)
+ {
+ return -1;
+ }
+ if (label2 == null)
+ {
+ return 1;
+ }
+ return label1.toUpperCase().compareTo(label2.toUpperCase());
+ }
+
+ /**
+ * Comparison based on position of associated sequence (if any) in the
+ * alignment. Returns zero if either argument is null.
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ private int compareSequences(AlignmentAnnotation o1,
+ AlignmentAnnotation o2)
+ {
+ SequenceI seq1 = o1.sequenceRef;
+ SequenceI seq2 = o2.sequenceRef;
+ if (seq1 == null && seq2 == null)
+ {
+ return 0;
+ }
+ /*
+ * Sort non-sequence-related before or after sequence-related.
+ */
+ if (seq1 == null)
+ {
+ return showAutocalcAbove ? -1 : 1;
+ }
+ if (seq2 == null)
+ {
+ return showAutocalcAbove ? 1 : -1;
+ }
+ // get sequence index - but note -1 means 'at end' so needs special handling
+ int index1 = sequenceIndices.get(seq1);
+ int index2 = sequenceIndices.get(seq2);
+ if (index1 == index2)
+ {
+ return 0;
+ }
+ if (index1 == -1)
+ {
+ return -1;
+ }
+ if (index2 == -1)
+ {
+ return 1;
+ }
+ return Integer.compare(index1, index2);
+ }
+}
diff --git a/src/jalview/analysis/CodingUtils.java b/src/jalview/analysis/CodingUtils.java
new file mode 100644
index 0000000..91c14c0
--- /dev/null
+++ b/src/jalview/analysis/CodingUtils.java
@@ -0,0 +1,139 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+/**
+ * A utility class to provide encoding/decoding schemes for data.
+ *
+ * @author gmcarstairs
+ *
+ */
+public class CodingUtils
+{
+
+ /*
+ * Number of bits used when encoding codon characters. 2 is enough for ACGT.
+ * To accommodate more (e.g. ambiguity codes), simply increase this number
+ * (and adjust unit tests to match).
+ */
+ private static final int CODON_ENCODING_BITSHIFT = 2;
+
+ /**
+ * Encode a codon from e.g. ['A', 'G', 'C'] to a number in the range 0 - 63.
+ * Converts lower to upper case, U to T, then assembles a binary value by
+ * encoding A/C/G/T as 00/01/10/11 respectively and shifting.
+ *
+ * @param codon
+ * @return the encoded codon, or a negative number if unexpected characters
+ * found
+ */
+ public static int encodeCodon(char[] codon)
+ {
+ if (codon == null)
+ {
+ return -1;
+ }
+ return encodeCodon(codon[2])
+ + (encodeCodon(codon[1]) << CODON_ENCODING_BITSHIFT)
+ + (encodeCodon(codon[0]) << (2 * CODON_ENCODING_BITSHIFT));
+ }
+
+ /**
+ * Encodes aA/cC/gG/tTuU as 0/1/2/3 respectively. Returns Integer.MIN_VALUE (a
+ * large negative value) for any other character.
+ *
+ * @param c
+ * @return
+ */
+ public static int encodeCodon(char c)
+ {
+ int result = Integer.MIN_VALUE;
+ switch (c)
+ {
+ case 'A':
+ case 'a':
+ result = 0;
+ break;
+ case 'C':
+ case 'c':
+ result = 1;
+ break;
+ case 'G':
+ case 'g':
+ result = 2;
+ break;
+ case 'T':
+ case 't':
+ case 'U':
+ case 'u':
+ result = 3;
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * Converts a binary encoded codon into an ['A', 'C', 'G'] (or 'T') triplet.
+ *
+ * The two low-order bits encode for A/C/G/T as 0/1/2/3, etc.
+ *
+ * @param encoded
+ * @return
+ */
+ public static char[] decodeCodon(int encoded)
+ {
+ char[] result = new char[3];
+ result[2] = decodeNucleotide(encoded & 3);
+ encoded = encoded >>> CODON_ENCODING_BITSHIFT;
+ result[1] = decodeNucleotide(encoded & 3);
+ encoded = encoded >>> CODON_ENCODING_BITSHIFT;
+ result[0] = decodeNucleotide(encoded & 3);
+ return result;
+ }
+
+ /**
+ * Convert value 0/1/2/3 to 'A'/'C'/'G'/'T'
+ *
+ * @param i
+ * @return
+ */
+ public static char decodeNucleotide(int i)
+ {
+ char result = '0';
+ switch (i)
+ {
+ case 0:
+ result = 'A';
+ break;
+ case 1:
+ result = 'C';
+ break;
+ case 2:
+ result = 'G';
+ break;
+ case 3:
+ result = 'T';
+ break;
+ }
+ return result;
+ }
+
+}
diff --git a/src/jalview/analysis/CodonComparator.java b/src/jalview/analysis/CodonComparator.java
new file mode 100644
index 0000000..e978193
--- /dev/null
+++ b/src/jalview/analysis/CodonComparator.java
@@ -0,0 +1,111 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+import jalview.datamodel.AlignedCodon;
+
+import java.util.Comparator;
+
+/**
+ * Implements rules for comparing two aligned codons, i.e. determining whether
+ * they should occupy the same position in a translated protein alignment, or
+ * one or the other should 'follow' (by preceded by a gap).
+ *
+ * @author gmcarstairs
+ *
+ */
+public final class CodonComparator implements Comparator<AlignedCodon>
+{
+
+ @Override
+ public int compare(AlignedCodon ac1, AlignedCodon ac2)
+ {
+ if (ac1 == null || ac2 == null || ac1.equals(ac2))
+ {
+ return 0;
+ }
+
+ /**
+ * <pre>
+ * Case 1: if one starts before the other, and doesn't end after it, then it
+ * precedes. We ignore the middle base position here.
+ * A--GT
+ * -CT-G
+ * </pre>
+ */
+ if (ac1.pos1 < ac2.pos1 && ac1.pos3 <= ac2.pos3)
+ {
+ return -1;
+ }
+ if (ac2.pos1 < ac1.pos1 && ac2.pos3 <= ac1.pos3)
+ {
+ return 1;
+ }
+
+ /**
+ * <pre>
+ * Case 2: if one ends after the other, and doesn't start before it, then it
+ * follows. We ignore the middle base position here.
+ * -TG-A
+ * G-TC
+ * </pre>
+ */
+ if (ac1.pos3 > ac2.pos3 && ac1.pos1 >= ac2.pos1)
+ {
+ return 1;
+ }
+ if (ac2.pos3 > ac1.pos3 && ac2.pos1 >= ac1.pos1)
+ {
+ return -1;
+ }
+
+ /*
+ * Case 3: if start and end match, compare middle base positions.
+ */
+ if (ac1.pos1 == ac2.pos1 && ac1.pos3 == ac2.pos3)
+ {
+ return Integer.compare(ac1.pos2, ac2.pos2);
+ }
+
+ /*
+ * That just leaves the 'enclosing' case - one codon starts after but ends
+ * before the other. If the middle bases don't match, use their comparison
+ * (majority vote).
+ */
+ int compareMiddles = Integer.compare(ac1.pos2, ac2.pos2);
+ if (compareMiddles != 0)
+ {
+ return compareMiddles;
+ }
+
+ /**
+ * <pre>
+ * Finally just leaves overlap with matching middle base, e.g.
+ * -A-A-A
+ * G--GG
+ * In this case the choice is arbitrary whether to compare based on
+ * first or last base position. We pick the first. Note this preserves
+ * symmetricality of the comparison.
+ * </pre>
+ */
+ return Integer.compare(ac1.pos1, ac2.pos1);
+ }
+}
diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java
index 2a065f6..f12d801 100644
--- a/src/jalview/analysis/Conservation.java
+++ b/src/jalview/analysis/Conservation.java
@@ -1,26 +1,35 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import java.awt.Color;
-import java.util.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.awt.Color;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
/**
* Calculates conservation values for a given set of sequences
@@ -68,6 +77,8 @@ public class Conservation
int[][] cons2;
+ private String[] consSymbs;
+
/**
* Creates a new Conservation object.
*
@@ -85,9 +96,8 @@ public class Conservation
* end residue position
*/
public Conservation(String name, Hashtable propHash, int threshold,
- Vector sequences, int start, int end)
+ List<SequenceI> sequences, int start, int end)
{
-
this.name = name;
this.propHash = propHash;
this.threshold = threshold;
@@ -100,20 +110,22 @@ public class Conservation
int s, sSize = sequences.size();
SequenceI[] sarray = new SequenceI[sSize];
this.sequences = sarray;
- try {
- for (s = 0; s < sSize; s++)
+ try
{
- sarray[s] = (SequenceI) sequences.elementAt(s);
- if (sarray[s].getLength() > maxLength)
+ for (s = 0; s < sSize; s++)
{
- maxLength = sarray[s].getLength();
+ sarray[s] = sequences.get(s);
+ if (sarray[s].getLength() > maxLength)
+ {
+ maxLength = sarray[s].getLength();
+ }
}
- }
} catch (ArrayIndexOutOfBoundsException ex)
{
- // bail - another thread has modified the sequence array, so the current calculation is probably invalid.
- this.sequences=new SequenceI[0];
- maxLength=0;
+ // bail - another thread has modified the sequence array, so the current
+ // calculation is probably invalid.
+ this.sequences = new SequenceI[0];
+ maxLength = 0;
}
}
@@ -268,8 +280,7 @@ public class Conservation
resultHash.put(type, ht.get("-"));
}
}
- else if (((Integer) resultHash.get(type)).equals((Integer) ht
- .get(res)) == false)
+ else if (((Integer) resultHash.get(type)).equals(ht.get(res)) == false)
{
resultHash.put(type, new Integer(-1));
}
@@ -277,7 +288,8 @@ public class Conservation
}
}
- if (total.length>0) {
+ if (total.length > 0)
+ {
total[i - start] = resultHash;
}
}
@@ -361,17 +373,17 @@ public class Conservation
{
consString.append('-');
}
-
+ consSymbs = new String[end - start + 1];
for (int i = start; i <= end; i++)
{
gapcons = countConsNGaps(i);
totGaps = gapcons[1];
- pgaps = ((float) totGaps * 100) / (float) sequences.length;
+ pgaps = ((float) totGaps * 100) / sequences.length;
+ consSymbs[i - start] = new String();
if (percentageGaps > pgaps)
{
resultHash = total[i - start];
-
// Now find the verdict
count = 0;
enumeration = resultHash.keys();
@@ -380,12 +392,12 @@ public class Conservation
{
type = (String) enumeration.nextElement();
result = (Integer) resultHash.get(type);
-
// Do we want to count +ve conservation or +ve and -ve cons.?
if (consflag)
{
if (result.intValue() == 1)
{
+ consSymbs[i - start] = type + " " + consSymbs[i - start];
count++;
}
}
@@ -393,6 +405,17 @@ public class Conservation
{
if (result.intValue() != -1)
{
+ {
+ if (result.intValue() == 0)
+ {
+ consSymbs[i - start] = consSymbs[i - start] + " !" + type;
+ }
+ else
+ {
+ consSymbs[i - start] = type + " " + consSymbs[i - start];
+ }
+ }
+
count++;
}
}
@@ -664,7 +687,7 @@ public class Conservation
if (Character.isDigit(c))
{
- value = (int) (c - '0');
+ value = c - '0';
}
else if (c == '*')
{
@@ -677,10 +700,12 @@ public class Conservation
float vprop = value - min;
vprop /= max;
+ int consp = i - start;
+ String conssym = (value > 0 && consp > -1 && consp < consSymbs.length) ? consSymbs[consp]
+ : "";
conservation.annotations[i] = new Annotation(String.valueOf(c),
- String.valueOf(value), ' ', value, new Color(minR
- + (maxR * vprop), minG + (maxG * vprop), minB
- + (maxB * vprop)));
+ conssym, ' ', value, new Color(minR + (maxR * vprop), minG
+ + (maxG * vprop), minB + (maxB * vprop)));
// Quality calc
if (quality2 != null)
@@ -695,4 +720,61 @@ public class Conservation
}
}
}
+
+ /**
+ * construct and call the calculation methods on a new Conservation object
+ *
+ * @param name
+ * - name of conservation
+ * @param consHash
+ * - hash table of properties for each amino acid (normally
+ * ResidueProperties.propHash)
+ * @param threshold
+ * - minimum number of conserved residues needed to indicate
+ * conservation (typically 3)
+ * @param seqs
+ * @param start
+ * first column in calculation window
+ * @param end
+ * last column in calculation window
+ * @param posOrNeg
+ * positive (true) or negative (false) conservation
+ * @param consPercGaps
+ * percentage of gaps tolerated in column
+ * @param calcQuality
+ * flag indicating if alignment quality should be calculated
+ * @return Conservation object ready for use in visualization
+ */
+ public static Conservation calculateConservation(String name,
+ Hashtable consHash, int threshold, List<SequenceI> seqs,
+ int start, int end, boolean posOrNeg, int consPercGaps,
+ boolean calcQuality)
+ {
+ Conservation cons = new Conservation(name, consHash, threshold, seqs,
+ start, end);
+ return calculateConservation(cons, posOrNeg, consPercGaps, calcQuality);
+ }
+
+ /**
+ * @param b
+ * positive (true) or negative (false) conservation
+ * @param consPercGaps
+ * percentage of gaps tolerated in column
+ * @param calcQuality
+ * flag indicating if alignment quality should be calculated
+ * @return Conservation object ready for use in visualization
+ */
+ public static Conservation calculateConservation(Conservation cons,
+ boolean b, int consPercGaps, boolean calcQuality)
+ {
+ cons.calculate();
+ cons.verdict(b, consPercGaps);
+
+ if (calcQuality)
+ {
+ cons.findQuality();
+ }
+
+ return cons;
+ }
}
diff --git a/src/jalview/analysis/CrossRef.java b/src/jalview/analysis/CrossRef.java
index 1420c9a..83317c1 100644
--- a/src/jalview/analysis/CrossRef.java
+++ b/src/jalview/analysis/CrossRef.java
@@ -1,598 +1,590 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.analysis;
-
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.Hashtable;
-
-import jalview.datamodel.AlignedCodonFrame;
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefSource;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceI;
-import jalview.ws.SequenceFetcher;
-import jalview.ws.seqfetcher.ASequenceFetcher;
-
-/**
- * Functions for cross-referencing sequence databases. user must first specify
- * if cross-referencing from protein or dna (set dna==true)
- *
- * @author JimP
- *
- */
-public class CrossRef
-{
- /**
- * get the DNA or protein references for a protein or dna sequence
- *
- * @param dna
- * @param rfs
- * @return
- */
- public static DBRefEntry[] findXDbRefs(boolean dna, DBRefEntry[] rfs)
- {
- if (dna)
- {
- rfs = jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS);
- }
- else
- {
- rfs = jalview.util.DBRefUtils.selectRefs(rfs,
- DBRefSource.DNACODINGDBS); // could attempt to find other cross
- // refs and return here - ie PDB xrefs
- // (not dna, not protein seq)
- }
- return rfs;
- }
-
- public static Hashtable classifyDbRefs(DBRefEntry[] rfs)
- {
- Hashtable classes = new Hashtable();
- classes.put(DBRefSource.PROTEINDBS,
- jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS));
- classes.put(DBRefSource.DNACODINGDBS, jalview.util.DBRefUtils
- .selectRefs(rfs, DBRefSource.DNACODINGDBS));
- classes.put(DBRefSource.DOMAINDBS,
- jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.DOMAINDBS));
- // classes.put(OTHER, )
- return classes;
- }
-
- /**
- * @param dna
- * true if seqs are DNA seqs
- * @param seqs
- * @return a list of sequence database cross reference source types
- */
- public static String[] findSequenceXrefTypes(boolean dna, SequenceI[] seqs)
- {
- return findSequenceXrefTypes(dna, seqs, null);
- }
-
- /**
- * Indirect references are references from other sequences from the dataset to
- * any of the direct DBRefEntrys on the given sequences.
- *
- * @param dna
- * true if seqs are DNA seqs
- * @param seqs
- * @return a list of sequence database cross reference source types
- */
- public static String[] findSequenceXrefTypes(boolean dna,
- SequenceI[] seqs, AlignmentI dataset)
- {
- String[] dbrefs = null;
- Vector refs = new Vector();
- for (int s = 0; s < seqs.length; s++)
- {
- if (seqs[s] != null)
- {
-
- SequenceI dss = seqs[s];
- while (dss.getDatasetSequence() != null)
- {
- dss = dss.getDatasetSequence();
- }
- DBRefEntry[] rfs = findXDbRefs(dna, dss.getDBRef());
- for (int r = 0; rfs != null && r < rfs.length; r++)
- {
- if (!refs.contains(rfs[r].getSource()))
- {
- refs.addElement(rfs[r].getSource());
- }
- }
- if (dataset != null)
- {
- // search for references to this sequence's direct references.
- DBRefEntry[] lrfs = CrossRef
- .findXDbRefs(!dna, seqs[s].getDBRef());
- Vector rseqs = new Vector();
- CrossRef.searchDatasetXrefs(seqs[s], !dna, lrfs, dataset, rseqs,
- null); // don't need to specify codon frame for mapping here
- Enumeration lr = rseqs.elements();
- while (lr.hasMoreElements())
- {
- SequenceI rs = (SequenceI) lr.nextElement();
- DBRefEntry[] xrs = findXDbRefs(dna, rs.getDBRef());
- for (int r = 0; rfs != null && r < rfs.length; r++)
- {
- if (!refs.contains(rfs[r].getSource()))
- {
- refs.addElement(rfs[r].getSource());
- }
- }
- }
- }
- }
- }
- if (refs.size() > 0)
- {
- dbrefs = new String[refs.size()];
- refs.copyInto(dbrefs);
- }
- return dbrefs;
- }
-
- /*
- * if (dna) { if (rfs[r].hasMap()) { // most likely this is a protein cross
- * reference if (!refs.contains(rfs[r].getSource())) {
- * refs.addElement(rfs[r].getSource()); } } }
- */
- public static boolean hasCdnaMap(SequenceI[] seqs)
- {
- String[] reftypes = findSequenceXrefTypes(false, seqs);
- for (int s = 0; s < reftypes.length; s++)
- {
- if (reftypes.equals(DBRefSource.EMBLCDS))
- {
- return true;
- // no map
- }
- }
- return false;
- }
-
- public static SequenceI[] getCdnaMap(SequenceI[] seqs)
- {
- Vector cseqs = new Vector();
- for (int s = 0; s < seqs.length; s++)
- {
- DBRefEntry[] cdna = findXDbRefs(true, seqs[s].getDBRef());
- for (int c = 0; c < cdna.length; c++)
- {
- if (cdna[c].getSource().equals(DBRefSource.EMBLCDS))
- {
- System.err
- .println("TODO: unimplemented sequence retrieval for coding region sequence.");
- // TODO: retrieve CDS dataset sequences
- // need global dataset sequence retriever/resolver to reuse refs
- // and construct Mapping entry.
- // insert gaps in CDS according to peptide gaps.
- // add gapped sequence to cseqs
- }
- }
- }
- if (cseqs.size() > 0)
- {
- SequenceI[] rsqs = new SequenceI[cseqs.size()];
- cseqs.copyInto(rsqs);
- return rsqs;
- }
- return null;
-
- }
-
- /**
- *
- * @param dna
- * @param seqs
- * @return
- */
- public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna,
- String source)
- {
- return findXrefSequences(seqs, dna, source, null);
- }
-
- /**
- *
- * @param seqs
- * @param dna
- * @param source
- * @param dataset
- * alignment to search for product sequences.
- * @return products (as dataset sequences)
- */
- public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna,
- String source, AlignmentI dataset)
- {
- Vector rseqs = new Vector();
- Alignment ral = null;
- AlignedCodonFrame cf = new AlignedCodonFrame(0); // nominal width
- for (int s = 0; s < seqs.length; s++)
- {
- SequenceI dss = seqs[s];
- while (dss.getDatasetSequence() != null)
- {
- dss = dss.getDatasetSequence();
- }
- boolean found = false;
- DBRefEntry[] xrfs = CrossRef.findXDbRefs(dna, dss.getDBRef());
- if ((xrfs == null || xrfs.length == 0) && dataset != null)
- {
- System.out.println("Attempting to find ds Xrefs refs.");
- DBRefEntry[] lrfs = CrossRef.findXDbRefs(!dna, seqs[s].getDBRef()); // less
- // ambiguous
- // would
- // be a
- // 'find
- // primary
- // dbRefEntry'
- // method.
- // filter for desired source xref here
- found = CrossRef.searchDatasetXrefs(dss, !dna, lrfs, dataset,
- rseqs, cf);
- }
- for (int r = 0; xrfs != null && r < xrfs.length; r++)
- {
- if (source != null && !source.equals(xrfs[r].getSource()))
- continue;
- if (xrfs[r].hasMap())
- {
- if (xrfs[r].getMap().getTo() != null)
- {
- Sequence rsq = new Sequence(xrfs[r].getMap().getTo());
- rseqs.addElement(rsq);
- if (xrfs[r].getMap().getMap().getFromRatio() != xrfs[r]
- .getMap().getMap().getToRatio())
- {
- // get sense of map correct for adding to product alignment.
- if (dna)
- {
- // map is from dna seq to a protein product
- cf.addMap(dss, rsq, xrfs[r].getMap().getMap());
- }
- else
- {
- // map should be from protein seq to its coding dna
- cf.addMap(rsq, dss, xrfs[r].getMap().getMap().getInverse());
- }
- }
- found = true;
- }
- }
- if (!found)
- {
- // do a bit more work - search for sequences with references matching
- // xrefs on this sequence.
- if (dataset != null)
- {
- found |= searchDataset(dss, xrfs[r], dataset, rseqs, cf); // ,false,!dna);
- if (found)
- xrfs[r] = null; // we've recovered seqs for this one.
- }
- }
- }
- if (!found)
- {
- if (xrfs != null && xrfs.length > 0)
- {
- // Try and get the sequence reference...
- /*
- * Ideal world - we ask for a sequence fetcher implementation here if
- * (jalview.io.RunTimeEnvironment.getSequenceFetcher()) (
- */
- ASequenceFetcher sftch = new SequenceFetcher();
- SequenceI[] retrieved = null;
- int l = xrfs.length;
- for (int r = 0; r < xrfs.length; r++)
- {
- // filter out any irrelevant or irretrievable references
- if (xrfs[r] == null
- || ((source != null && !source.equals(xrfs[r]
- .getSource())) || !sftch.isFetchable(xrfs[r]
- .getSource())))
- {
- l--;
- xrfs[r] = null;
- }
- }
- if (l > 0)
- {
- System.out
- .println("Attempting to retrieve cross referenced sequences.");
- DBRefEntry[] t = new DBRefEntry[l];
- l = 0;
- for (int r = 0; r < xrfs.length; r++)
- {
- if (xrfs[r] != null)
- t[l++] = xrfs[r];
- }
- xrfs = t;
- try
- {
- retrieved = sftch.getSequences(xrfs); // problem here is we don't
- // know which of xrfs
- // resulted in which
- // retrieved element
- } catch (Exception e)
- {
- System.err
- .println("Problem whilst retrieving cross references for Sequence : "
- + seqs[s].getName());
- e.printStackTrace();
- }
- if (retrieved != null)
- {
- for (int rs = 0; rs < retrieved.length; rs++)
- {
- // TODO: examine each sequence for 'redundancy'
- jalview.datamodel.DBRefEntry[] dbr = retrieved[rs]
- .getDBRef();
- if (dbr != null && dbr.length > 0)
- {
- for (int di = 0; di < dbr.length; di++)
- {
- // find any entry where we should put in the sequence being
- // cross-referenced into the map
- jalview.datamodel.Mapping map = dbr[di].getMap();
- if (map != null)
- {
- if (map.getTo() != null && map.getMap() != null)
- {
- // should search the local dataset to find any existing
- // candidates for To !
- try
- {
- // compare ms with dss and replace with dss in mapping
- // if map is congruent
- SequenceI ms = map.getTo();
- int sf = map.getMap().getToLowest();
- int st = map.getMap().getToHighest();
- SequenceI mappedrg = ms.getSubSequence(sf, st);
- SequenceI loc = dss.getSubSequence(sf, st);
- if (mappedrg.getLength() > 0
- && mappedrg.getSequenceAsString().equals(
- loc.getSequenceAsString()))
- {
- System.err
- .println("Mapping updated for retrieved crossreference");
- // method to update all refs of existing To on
- // retrieved sequence with dss and merge any props
- // on To onto dss.
- map.setTo(dss);
- }
- } catch (Exception e)
- {
- System.err
- .println("Exception when consolidating Mapped sequence set...");
- e.printStackTrace(System.err);
- }
- }
- }
- }
- }
- retrieved[rs].updatePDBIds();
- rseqs.addElement(retrieved[rs]);
- }
- }
- }
- }
- }
- }
- if (rseqs.size() > 0)
- {
- SequenceI[] rsqs = new SequenceI[rseqs.size()];
- rseqs.copyInto(rsqs);
- ral = new Alignment(rsqs);
- if (cf != null && cf.getProtMappings() != null)
- {
- ral.addCodonFrame(cf);
- }
- }
- return ral;
- }
-
- /**
- * find references to lrfs in the cross-reference set of each sequence in
- * dataset (that is not equal to sequenceI) Identifies matching DBRefEntry
- * based on source and accession string only - Map and Version are nulled.
- *
- * @param sequenceI
- * @param lrfs
- * @param dataset
- * @param rseqs
- * @return true if matches were found.
- */
- private static boolean searchDatasetXrefs(SequenceI sequenceI,
- boolean dna, DBRefEntry[] lrfs, AlignmentI dataset, Vector rseqs,
- AlignedCodonFrame cf)
- {
- boolean found = false;
- if (lrfs == null)
- return false;
- for (int i = 0; i < lrfs.length; i++)
- {
- DBRefEntry xref = new DBRefEntry(lrfs[i]);
- // add in wildcards
- xref.setVersion(null);
- xref.setMap(null);
- found = searchDataset(sequenceI, xref, dataset, rseqs, cf, false, dna);
- }
- return found;
- }
-
- /**
- * search a given sequence dataset for references matching cross-references to
- * the given sequence
- *
- * @param sequenceI
- * @param xrf
- * @param dataset
- * @param rseqs
- * set of unique sequences
- * @param cf
- * @return true if one or more unique sequences were found and added
- */
- public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf,
- AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf)
- {
- return searchDataset(sequenceI, xrf, dataset, rseqs, cf, true, false);
- }
-
- /**
- * TODO: generalise to different protein classifications Search dataset for
- * DBRefEntrys matching the given one (xrf) and add the associated sequence to
- * rseq.
- *
- * @param sequenceI
- * @param xrf
- * @param dataset
- * @param rseqs
- * @param direct
- * - search all references or only subset
- * @param dna
- * search dna or protein xrefs (if direct=false)
- * @return true if relationship found and sequence added.
- */
- public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf,
- AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf,
- boolean direct, boolean dna)
- {
- boolean found = false;
- SequenceI[] typer = new SequenceI[1];
- if (dataset == null)
- return false;
- if (dataset.getSequences() == null)
- {
- System.err.println("Empty dataset sequence set - NO VECTOR");
- return false;
- }
- Enumeration e = dataset.getSequences().elements();
- while (e.hasMoreElements())
- {
- SequenceI nxt = (SequenceI) e.nextElement();
- if (nxt != null)
- {
- if (nxt.getDatasetSequence() != null)
- {
- System.err
- .println("Implementation warning: getProducts passed a dataset alignment without dataset sequences in it!");
- }
- if (nxt != sequenceI && nxt != sequenceI.getDatasetSequence())
- {
- // check if this is the correct sequence type
- {
- typer[0] = nxt;
- boolean isDna = jalview.util.Comparison.isNucleotide(typer);
- if ((direct && isDna == dna) || (!direct && isDna != dna))
- {
- // skip this sequence because it is same molecule type
- continue;
- }
- }
-
- // look for direct or indirect references in common
- DBRefEntry[] poss = nxt.getDBRef(), cands = null;
- if (direct)
- {
- cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);
- }
- else
- {
- poss = CrossRef.findXDbRefs(dna, poss); //
- cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);
- }
- if (cands != null)
- {
- if (!rseqs.contains(nxt))
- {
- rseqs.addElement(nxt);
- boolean foundmap = cf != null; // don't search if we aren't given
- // a codon map object
- for (int r = 0; foundmap && r < cands.length; r++)
- {
- if (cands[r].hasMap())
- {
- if (cands[r].getMap().getTo() != null
- && cands[r].getMap().getMap().getFromRatio() != cands[r]
- .getMap().getMap().getToRatio())
- {
- foundmap = true;
- // get sense of map correct for adding to product alignment.
- if (dna)
- {
- // map is from dna seq to a protein product
- cf.addMap(sequenceI, nxt, cands[r].getMap().getMap());
- }
- else
- {
- // map should be from protein seq to its coding dna
- cf.addMap(nxt, sequenceI, cands[r].getMap().getMap()
- .getInverse());
- }
- }
- }
- }
- // TODO: add mapping between sequences if necessary
- found = true;
- }
- }
-
- }
- }
- }
- return found;
- }
-
- /**
- * precalculate different products that can be found for seqs in dataset and
- * return them.
- *
- * @param dna
- * @param seqs
- * @param dataset
- * @param fake
- * - don't actually build lists - just get types
- * @return public static Object[] buildXProductsList(boolean dna, SequenceI[]
- * seqs, AlignmentI dataset, boolean fake) { String types[] =
- * jalview.analysis.CrossRef.findSequenceXrefTypes( dna, seqs,
- * dataset); if (types != null) { System.out.println("Xref Types for:
- * "+(dna ? "dna" : "prot")); for (int t = 0; t < types.length; t++) {
- * System.out.println("Type: " + types[t]); SequenceI[] prod =
- * jalview.analysis.CrossRef.findXrefSequences(seqs, dna, types[t]);
- * System.out.println("Found " + ((prod == null) ? "no" : "" +
- * prod.length) + " products"); if (prod!=null) { for (int p=0;
- * p<prod.length; p++) { System.out.println("Prod "+p+":
- * "+prod[p].getDisplayId(true)); } } } } else {
- * System.out.println("Trying getProducts for
- * "+al.getSequenceAt(0).getDisplayId(true));
- * System.out.println("Search DS Xref for: "+(dna ? "dna" : "prot"));
- * // have a bash at finding the products amongst all the retrieved
- * sequences. SequenceI[] prod =
- * jalview.analysis.CrossRef.findXrefSequences(al
- * .getSequencesArray(), dna, null, ds); System.out.println("Found " +
- * ((prod == null) ? "no" : "" + prod.length) + " products"); if
- * (prod!=null) { // select non-equivalent sequences from dataset list
- * for (int p=0; p<prod.length; p++) { System.out.println("Prod "+p+":
- * "+prod[p].getDisplayId(true)); } } } }
- */
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.util.DBRefUtils;
+import jalview.ws.SequenceFetcher;
+import jalview.ws.seqfetcher.ASequenceFetcher;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * Functions for cross-referencing sequence databases. user must first specify
+ * if cross-referencing from protein or dna (set dna==true)
+ *
+ * @author JimP
+ *
+ */
+public class CrossRef
+{
+ /**
+ * Select just the DNA or protein references for a protein or dna sequence
+ *
+ * @param fromDna
+ * if true, select references from DNA (i.e. Protein databases), else
+ * DNA database references
+ * @param refs
+ * a set of references to select from
+ * @return
+ */
+ public static DBRefEntry[] findXDbRefs(boolean fromDna, DBRefEntry[] refs)
+ {
+ return DBRefUtils.selectRefs(refs, fromDna ? DBRefSource.PROTEINDBS
+ : DBRefSource.DNACODINGDBS);
+ // could attempt to find other cross
+ // refs here - ie PDB xrefs
+ // (not dna, not protein seq)
+ }
+
+ /**
+ * @param dna
+ * true if seqs are DNA seqs
+ * @param seqs
+ * @return a list of sequence database cross reference source types
+ */
+ public static String[] findSequenceXrefTypes(boolean dna, SequenceI[] seqs)
+ {
+ return findSequenceXrefTypes(dna, seqs, null);
+ }
+
+ /**
+ * Indirect references are references from other sequences from the dataset to
+ * any of the direct DBRefEntrys on the given sequences.
+ *
+ * @param dna
+ * true if seqs are DNA seqs
+ * @param seqs
+ * @return a list of sequence database cross reference source types
+ */
+ public static String[] findSequenceXrefTypes(boolean dna,
+ SequenceI[] seqs, AlignmentI dataset)
+ {
+ String[] dbrefs = null;
+ List<String> refs = new ArrayList<String>();
+ for (int s = 0; s < seqs.length; s++)
+ {
+ if (seqs[s] != null)
+ {
+ SequenceI dss = seqs[s];
+ while (dss.getDatasetSequence() != null)
+ {
+ dss = dss.getDatasetSequence();
+ }
+ DBRefEntry[] rfs = findXDbRefs(dna, dss.getDBRef());
+ for (int r = 0; rfs != null && r < rfs.length; r++)
+ {
+ if (!refs.contains(rfs[r].getSource()))
+ {
+ refs.add(rfs[r].getSource());
+ }
+ }
+ if (dataset != null)
+ {
+ // search for references to this sequence's direct references.
+ DBRefEntry[] lrfs = CrossRef
+ .findXDbRefs(!dna, seqs[s].getDBRef());
+ List<SequenceI> rseqs = new ArrayList<SequenceI>();
+ CrossRef.searchDatasetXrefs(seqs[s], !dna, lrfs, dataset, rseqs,
+ null); // don't need to specify codon frame for mapping here
+ for (SequenceI rs : rseqs)
+ {
+ DBRefEntry[] xrs = findXDbRefs(dna, rs.getDBRef()); // not used??
+ for (int r = 0; rfs != null && r < rfs.length; r++)
+ {
+ if (!refs.contains(rfs[r].getSource()))
+ {
+ refs.add(rfs[r].getSource());
+ }
+ }
+ }
+ }
+ }
+ }
+ if (refs.size() > 0)
+ {
+ dbrefs = new String[refs.size()];
+ refs.toArray(dbrefs);
+ }
+ return dbrefs;
+ }
+
+ /*
+ * if (dna) { if (rfs[r].hasMap()) { // most likely this is a protein cross
+ * reference if (!refs.contains(rfs[r].getSource())) {
+ * refs.addElement(rfs[r].getSource()); } } }
+ */
+ public static boolean hasCdnaMap(SequenceI[] seqs)
+ {
+ String[] reftypes = findSequenceXrefTypes(false, seqs);
+ for (int s = 0; s < reftypes.length; s++)
+ {
+ if (reftypes.equals(DBRefSource.EMBLCDS))
+ {
+ return true;
+ // no map
+ }
+ }
+ return false;
+ }
+
+ public static SequenceI[] getCdnaMap(SequenceI[] seqs)
+ {
+ Vector cseqs = new Vector();
+ for (int s = 0; s < seqs.length; s++)
+ {
+ DBRefEntry[] cdna = findXDbRefs(true, seqs[s].getDBRef());
+ for (int c = 0; c < cdna.length; c++)
+ {
+ if (cdna[c].getSource().equals(DBRefSource.EMBLCDS))
+ {
+ System.err
+ .println("TODO: unimplemented sequence retrieval for coding region sequence.");
+ // TODO: retrieve CDS dataset sequences
+ // need global dataset sequence retriever/resolver to reuse refs
+ // and construct Mapping entry.
+ // insert gaps in CDS according to peptide gaps.
+ // add gapped sequence to cseqs
+ }
+ }
+ }
+ if (cseqs.size() > 0)
+ {
+ SequenceI[] rsqs = new SequenceI[cseqs.size()];
+ cseqs.copyInto(rsqs);
+ return rsqs;
+ }
+ return null;
+
+ }
+
+ /**
+ *
+ * @param dna
+ * @param seqs
+ * @return
+ */
+ public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna,
+ String source)
+ {
+ return findXrefSequences(seqs, dna, source, null);
+ }
+
+ /**
+ *
+ * @param seqs
+ * @param dna
+ * @param source
+ * @param dataset
+ * alignment to search for product sequences.
+ * @return products (as dataset sequences)
+ */
+ public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna,
+ String source, AlignmentI dataset)
+ {
+ List<SequenceI> rseqs = new ArrayList<SequenceI>();
+ Alignment ral = null;
+ AlignedCodonFrame cf = new AlignedCodonFrame(); // nominal width
+ for (int s = 0; s < seqs.length; s++)
+ {
+ SequenceI dss = seqs[s];
+ while (dss.getDatasetSequence() != null)
+ {
+ dss = dss.getDatasetSequence();
+ }
+ boolean found = false;
+ DBRefEntry[] xrfs = CrossRef.findXDbRefs(dna, dss.getDBRef());
+ if ((xrfs == null || xrfs.length == 0) && dataset != null)
+ {
+ System.out.println("Attempting to find ds Xrefs refs.");
+ DBRefEntry[] lrfs = CrossRef.findXDbRefs(!dna, seqs[s].getDBRef());
+ // less ambiguous would be a 'find primary dbRefEntry' method.
+ // filter for desired source xref here
+ found = CrossRef.searchDatasetXrefs(dss, !dna, lrfs, dataset,
+ rseqs, cf);
+ }
+ for (int r = 0; xrfs != null && r < xrfs.length; r++)
+ {
+ if (source != null && !source.equals(xrfs[r].getSource()))
+ {
+ continue;
+ }
+ if (xrfs[r].hasMap())
+ {
+ if (xrfs[r].getMap().getTo() != null)
+ {
+ SequenceI rsq = new Sequence(xrfs[r].getMap().getTo());
+ rseqs.add(rsq);
+ if (xrfs[r].getMap().getMap().getFromRatio() != xrfs[r]
+ .getMap().getMap().getToRatio())
+ {
+ // get sense of map correct for adding to product alignment.
+ if (dna)
+ {
+ // map is from dna seq to a protein product
+ cf.addMap(dss, rsq, xrfs[r].getMap().getMap());
+ }
+ else
+ {
+ // map should be from protein seq to its coding dna
+ cf.addMap(rsq, dss, xrfs[r].getMap().getMap().getInverse());
+ }
+ }
+ found = true;
+ }
+ }
+ if (!found)
+ {
+ // do a bit more work - search for sequences with references matching
+ // xrefs on this sequence.
+ if (dataset != null)
+ {
+ found |= searchDataset(dss, xrfs[r], dataset, rseqs, cf); // ,false,!dna);
+ if (found)
+ {
+ xrfs[r] = null; // we've recovered seqs for this one.
+ }
+ }
+ }
+ }
+ if (!found)
+ {
+ if (xrfs != null && xrfs.length > 0)
+ {
+ // Try and get the sequence reference...
+ /*
+ * Ideal world - we ask for a sequence fetcher implementation here if
+ * (jalview.io.RunTimeEnvironment.getSequenceFetcher()) (
+ */
+ ASequenceFetcher sftch = new SequenceFetcher();
+ SequenceI[] retrieved = null;
+ int l = xrfs.length;
+ for (int r = 0; r < xrfs.length; r++)
+ {
+ // filter out any irrelevant or irretrievable references
+ if (xrfs[r] == null
+ || ((source != null && !source.equals(xrfs[r]
+ .getSource())) || !sftch.isFetchable(xrfs[r]
+ .getSource())))
+ {
+ l--;
+ xrfs[r] = null;
+ }
+ }
+ if (l > 0)
+ {
+ System.out
+ .println("Attempting to retrieve cross referenced sequences.");
+ DBRefEntry[] t = new DBRefEntry[l];
+ l = 0;
+ for (int r = 0; r < xrfs.length; r++)
+ {
+ if (xrfs[r] != null)
+ {
+ t[l++] = xrfs[r];
+ }
+ }
+ xrfs = t;
+ try
+ {
+ retrieved = sftch.getSequences(xrfs); // problem here is we don't
+ // know which of xrfs
+ // resulted in which
+ // retrieved element
+ } catch (Exception e)
+ {
+ System.err
+ .println("Problem whilst retrieving cross references for Sequence : "
+ + seqs[s].getName());
+ e.printStackTrace();
+ }
+ if (retrieved != null)
+ {
+ for (int rs = 0; rs < retrieved.length; rs++)
+ {
+ // TODO: examine each sequence for 'redundancy'
+ jalview.datamodel.DBRefEntry[] dbr = retrieved[rs]
+ .getDBRef();
+ if (dbr != null && dbr.length > 0)
+ {
+ for (int di = 0; di < dbr.length; di++)
+ {
+ // find any entry where we should put in the sequence being
+ // cross-referenced into the map
+ jalview.datamodel.Mapping map = dbr[di].getMap();
+ if (map != null)
+ {
+ if (map.getTo() != null && map.getMap() != null)
+ {
+ // should search the local dataset to find any existing
+ // candidates for To !
+ try
+ {
+ // compare ms with dss and replace with dss in mapping
+ // if map is congruent
+ SequenceI ms = map.getTo();
+ int sf = map.getMap().getToLowest();
+ int st = map.getMap().getToHighest();
+ SequenceI mappedrg = ms.getSubSequence(sf, st);
+ SequenceI loc = dss.getSubSequence(sf, st);
+ if (mappedrg.getLength() > 0
+ && mappedrg.getSequenceAsString().equals(
+ loc.getSequenceAsString()))
+ {
+ System.err
+ .println("Mapping updated for retrieved crossreference");
+ // method to update all refs of existing To on
+ // retrieved sequence with dss and merge any props
+ // on To onto dss.
+ map.setTo(dss);
+ }
+ } catch (Exception e)
+ {
+ System.err
+ .println("Exception when consolidating Mapped sequence set...");
+ e.printStackTrace(System.err);
+ }
+ }
+ }
+ }
+ }
+ retrieved[rs].updatePDBIds();
+ rseqs.add(retrieved[rs]);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (rseqs.size() > 0)
+ {
+ SequenceI[] rsqs = new SequenceI[rseqs.size()];
+ rseqs.toArray(rsqs);
+ ral = new Alignment(rsqs);
+ if (cf != null && cf.getProtMappings() != null)
+ {
+ ral.addCodonFrame(cf);
+ }
+ }
+ return ral;
+ }
+
+ /**
+ * find references to lrfs in the cross-reference set of each sequence in
+ * dataset (that is not equal to sequenceI) Identifies matching DBRefEntry
+ * based on source and accession string only - Map and Version are nulled.
+ *
+ * @param sequenceI
+ * @param lrfs
+ * @param dataset
+ * @param rseqs
+ * @return true if matches were found.
+ */
+ private static boolean searchDatasetXrefs(SequenceI sequenceI,
+ boolean dna, DBRefEntry[] lrfs, AlignmentI dataset,
+ List<SequenceI> rseqs, AlignedCodonFrame cf)
+ {
+ boolean found = false;
+ if (lrfs == null)
+ {
+ return false;
+ }
+ for (int i = 0; i < lrfs.length; i++)
+ {
+ DBRefEntry xref = new DBRefEntry(lrfs[i]);
+ // add in wildcards
+ xref.setVersion(null);
+ xref.setMap(null);
+ found = searchDataset(sequenceI, xref, dataset, rseqs, cf, false, dna);
+ }
+ return found;
+ }
+
+ /**
+ * search a given sequence dataset for references matching cross-references to
+ * the given sequence
+ *
+ * @param sequenceI
+ * @param xrf
+ * @param dataset
+ * @param rseqs
+ * set of unique sequences
+ * @param cf
+ * @return true if one or more unique sequences were found and added
+ */
+ public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf,
+ AlignmentI dataset, List<SequenceI> rseqs, AlignedCodonFrame cf)
+ {
+ return searchDataset(sequenceI, xrf, dataset, rseqs, cf, true, false);
+ }
+
+ /**
+ * TODO: generalise to different protein classifications Search dataset for
+ * DBRefEntrys matching the given one (xrf) and add the associated sequence to
+ * rseq.
+ *
+ * @param sequenceI
+ * @param xrf
+ * @param dataset
+ * @param rseqs
+ * @param direct
+ * - search all references or only subset
+ * @param dna
+ * search dna or protein xrefs (if direct=false)
+ * @return true if relationship found and sequence added.
+ */
+ public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf,
+ AlignmentI dataset, List<SequenceI> rseqs, AlignedCodonFrame cf,
+ boolean direct, boolean dna)
+ {
+ boolean found = false;
+ SequenceI[] typer = new SequenceI[1];
+ if (dataset == null)
+ {
+ return false;
+ }
+ if (dataset.getSequences() == null)
+ {
+ System.err.println("Empty dataset sequence set - NO VECTOR");
+ return false;
+ }
+ List<SequenceI> ds;
+ synchronized (ds = dataset.getSequences())
+ {
+ for (SequenceI nxt : ds)
+ {
+ if (nxt != null)
+ {
+ if (nxt.getDatasetSequence() != null)
+ {
+ System.err
+ .println("Implementation warning: getProducts passed a dataset alignment without dataset sequences in it!");
+ }
+ if (nxt != sequenceI && nxt != sequenceI.getDatasetSequence())
+ {
+ // check if this is the correct sequence type
+ {
+ typer[0] = nxt;
+ boolean isDna = jalview.util.Comparison.isNucleotide(typer);
+ if ((direct && isDna == dna) || (!direct && isDna != dna))
+ {
+ // skip this sequence because it is same molecule type
+ continue;
+ }
+ }
+
+ // look for direct or indirect references in common
+ DBRefEntry[] poss = nxt.getDBRef(), cands = null;
+ if (direct)
+ {
+ cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);
+ }
+ else
+ {
+ poss = CrossRef.findXDbRefs(dna, poss); //
+ cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);
+ }
+ if (cands != null)
+ {
+ if (!rseqs.contains(nxt))
+ {
+ rseqs.add(nxt);
+ boolean foundmap = cf != null;
+ // don't search if we aren't given a codon map object
+ for (int r = 0; foundmap && r < cands.length; r++)
+ {
+ if (cands[r].hasMap())
+ {
+ if (cands[r].getMap().getTo() != null
+ && cands[r].getMap().getMap().getFromRatio() != cands[r]
+ .getMap().getMap().getToRatio())
+ {
+ foundmap = true;
+ // get sense of map correct for adding to product
+ // alignment.
+ if (dna)
+ {
+ // map is from dna seq to a protein product
+ cf.addMap(sequenceI, nxt, cands[r].getMap()
+ .getMap());
+ }
+ else
+ {
+ // map should be from protein seq to its coding dna
+ cf.addMap(nxt, sequenceI, cands[r].getMap()
+ .getMap().getInverse());
+ }
+ }
+ }
+ }
+ // TODO: add mapping between sequences if necessary
+ found = true;
+ }
+ }
+
+ }
+ }
+ }
+ }
+ return found;
+ }
+
+ /**
+ * precalculate different products that can be found for seqs in dataset and
+ * return them.
+ *
+ * @param dna
+ * @param seqs
+ * @param dataset
+ * @param fake
+ * - don't actually build lists - just get types
+ * @return public static Object[] buildXProductsList(boolean dna, SequenceI[]
+ * seqs, AlignmentI dataset, boolean fake) { String types[] =
+ * jalview.analysis.CrossRef.findSequenceXrefTypes( dna, seqs,
+ * dataset); if (types != null) { System.out.println("Xref Types for:
+ * "+(dna ? "dna" : "prot")); for (int t = 0; t < types.length; t++) {
+ * System.out.println("Type: " + types[t]); SequenceI[] prod =
+ * jalview.analysis.CrossRef.findXrefSequences(seqs, dna, types[t]);
+ * System.out.println("Found " + ((prod == null) ? "no" : "" +
+ * prod.length) + " products"); if (prod!=null) { for (int p=0;
+ * p<prod.length; p++) { System.out.println("Prod "+p+":
+ * "+prod[p].getDisplayId(true)); } } } } else {
+ * System.out.println("Trying getProducts for
+ * "+al.getSequenceAt(0).getDisplayId(true));
+ * System.out.println("Search DS Xref for: "+(dna ? "dna" : "prot"));
+ * // have a bash at finding the products amongst all the retrieved
+ * sequences. SequenceI[] prod =
+ * jalview.analysis.CrossRef.findXrefSequences(al
+ * .getSequencesArray(), dna, null, ds); System.out.println("Found " +
+ * ((prod == null) ? "no" : "" + prod.length) + " products"); if
+ * (prod!=null) { // select non-equivalent sequences from dataset list
+ * for (int p=0; p<prod.length; p++) { System.out.println("Prod "+p+":
+ * "+prod[p].getDisplayId(true)); } } } }
+ */
+}
diff --git a/src/jalview/analysis/Dna.java b/src/jalview/analysis/Dna.java
index 49c37df..515bd91 100644
--- a/src/jalview/analysis/Dna.java
+++ b/src/jalview/analysis/Dna.java
@@ -1,716 +1,809 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.analysis;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import jalview.datamodel.AlignedCodonFrame;
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.Annotation;
-import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.FeatureProperties;
-import jalview.datamodel.Mapping;
-import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceFeature;
-import jalview.datamodel.SequenceI;
-import jalview.schemes.ResidueProperties;
-import jalview.util.MapList;
-import jalview.util.ShiftList;
-
-public class Dna
-{
- /**
- *
- * @param cdp1
- * @param cdp2
- * @return -1 if cdp1 aligns before cdp2, 0 if in the same column or cdp2 is
- * null, +1 if after cdp2
- */
- private static int compare_codonpos(int[] cdp1, int[] cdp2)
- {
- if (cdp2 == null
- || (cdp1[0] == cdp2[0] && cdp1[1] == cdp2[1] && cdp1[2] == cdp2[2]))
- return 0;
- if (cdp1[0] < cdp2[0] || cdp1[1] < cdp2[1] || cdp1[2] < cdp2[2])
- return -1; // one base in cdp1 precedes the corresponding base in the
- // other codon
- return 1; // one base in cdp1 appears after the corresponding base in the
- // other codon.
- }
-
- /**
- * DNA->mapped protein sequence alignment translation given set of sequences
- * 1. id distinct coding regions within selected region for each sequence 2.
- * generate peptides based on inframe (or given) translation or (optionally
- * and where specified) out of frame translations (annotated appropriately) 3.
- * align peptides based on codon alignment
- */
- /**
- * id potential products from dna 1. search for distinct products within
- * selected region for each selected sequence 2. group by associated DB type.
- * 3. return as form for input into above function
- */
- /**
- *
- */
- /**
- * create a new alignment of protein sequences by an inframe translation of
- * the provided NA sequences
- *
- * @param selection
- * @param seqstring
- * @param viscontigs
- * @param gapCharacter
- * @param annotations
- * @param aWidth
- * @param dataset
- * destination dataset for translated sequences and mappings
- * @return
- */
- public static AlignmentI CdnaTranslate(SequenceI[] selection,
- String[] seqstring, int viscontigs[], char gapCharacter,
- AlignmentAnnotation[] annotations, int aWidth, Alignment dataset)
- {
- return CdnaTranslate(selection, seqstring, null, viscontigs,
- gapCharacter, annotations, aWidth, dataset);
- }
-
- /**
- *
- * @param selection
- * @param seqstring
- * @param product
- * - array of DbRefEntry objects from which exon map in seqstring is
- * derived
- * @param viscontigs
- * @param gapCharacter
- * @param annotations
- * @param aWidth
- * @param dataset
- * @return
- */
- public static AlignmentI CdnaTranslate(SequenceI[] selection,
- String[] seqstring, DBRefEntry[] product, int viscontigs[],
- char gapCharacter, AlignmentAnnotation[] annotations, int aWidth,
- Alignment dataset)
- {
- AlignedCodonFrame codons = new AlignedCodonFrame(aWidth); // stores hash of
- // subsequent
- // positions for
- // each codon
- // start position
- // in alignment
- int s, sSize = selection.length;
- Vector pepseqs = new Vector();
- for (s = 0; s < sSize; s++)
- {
- SequenceI newseq = translateCodingRegion(selection[s], seqstring[s],
- viscontigs, codons, gapCharacter,
- (product != null) ? product[s] : null); // possibly anonymous
- // product
- if (newseq != null)
- {
- pepseqs.addElement(newseq);
- SequenceI ds = newseq;
- while (ds.getDatasetSequence() != null)
- {
- ds = ds.getDatasetSequence();
- }
- dataset.addSequence(ds);
- }
- }
- if (codons.aaWidth == 0)
- return null;
- SequenceI[] newseqs = new SequenceI[pepseqs.size()];
- pepseqs.copyInto(newseqs);
- AlignmentI al = new Alignment(newseqs);
- al.padGaps(); // ensure we look aligned.
- al.setDataset(dataset);
- translateAlignedAnnotations(annotations, al, codons);
- al.addCodonFrame(codons);
- return al;
- }
-
- /**
- * fake the collection of DbRefs with associated exon mappings to identify if
- * a translation would generate distinct product in the currently selected
- * region.
- *
- * @param selection
- * @param viscontigs
- * @return
- */
- public static boolean canTranslate(SequenceI[] selection,
- int viscontigs[])
- {
- for (int gd = 0; gd < selection.length; gd++)
- {
- SequenceI dna = selection[gd];
- jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils
- .selectRefs(dna.getDBRef(),
- jalview.datamodel.DBRefSource.DNACODINGDBS);
- if (dnarefs != null)
- {
- // intersect with pep
- // intersect with pep
- Vector mappedrefs = new Vector();
- DBRefEntry[] refs = dna.getDBRef();
- for (int d = 0; d < refs.length; d++)
- {
- if (refs[d].getMap() != null && refs[d].getMap().getMap() != null
- && refs[d].getMap().getMap().getFromRatio() == 3
- && refs[d].getMap().getMap().getToRatio() == 1)
- {
- mappedrefs.addElement(refs[d]); // add translated protein maps
- }
- }
- dnarefs = new DBRefEntry[mappedrefs.size()];
- mappedrefs.copyInto(dnarefs);
- for (int d = 0; d < dnarefs.length; d++)
- {
- Mapping mp = dnarefs[d].getMap();
- if (mp != null)
- {
- for (int vc = 0; vc < viscontigs.length; vc += 2)
- {
- int[] mpr = mp.locateMappedRange(viscontigs[vc],
- viscontigs[vc + 1]);
- if (mpr != null)
- {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- /**
- * generate a set of translated protein products from annotated sequenceI
- *
- * @param selection
- * @param viscontigs
- * @param gapCharacter
- * @param dataset
- * destination dataset for translated sequences
- * @param annotations
- * @param aWidth
- * @return
- */
- public static AlignmentI CdnaTranslate(SequenceI[] selection,
- int viscontigs[], char gapCharacter, Alignment dataset)
- {
- int alwidth = 0;
- Vector cdnasqs = new Vector();
- Vector cdnasqi = new Vector();
- Vector cdnaprod = new Vector();
- for (int gd = 0; gd < selection.length; gd++)
- {
- SequenceI dna = selection[gd];
- jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils
- .selectRefs(dna.getDBRef(),
- jalview.datamodel.DBRefSource.DNACODINGDBS);
- if (dnarefs != null)
- {
- // intersect with pep
- Vector mappedrefs = new Vector();
- DBRefEntry[] refs = dna.getDBRef();
- for (int d = 0; d < refs.length; d++)
- {
- if (refs[d].getMap() != null && refs[d].getMap().getMap() != null
- && refs[d].getMap().getMap().getFromRatio() == 3
- && refs[d].getMap().getMap().getToRatio() == 1)
- {
- mappedrefs.addElement(refs[d]); // add translated protein maps
- }
- }
- dnarefs = new DBRefEntry[mappedrefs.size()];
- mappedrefs.copyInto(dnarefs);
- for (int d = 0; d < dnarefs.length; d++)
- {
- Mapping mp = dnarefs[d].getMap();
- StringBuffer sqstr = new StringBuffer();
- if (mp != null)
- {
- Mapping intersect = mp.intersectVisContigs(viscontigs);
- // generate seqstring for this sequence based on mapping
-
- if (sqstr.length() > alwidth)
- alwidth = sqstr.length();
- cdnasqs.addElement(sqstr.toString());
- cdnasqi.addElement(dna);
- cdnaprod.addElement(intersect);
- }
- }
- }
- SequenceI[] cdna = new SequenceI[cdnasqs.size()];
- DBRefEntry[] prods = new DBRefEntry[cdnaprod.size()];
- String[] xons = new String[cdnasqs.size()];
- cdnasqs.copyInto(xons);
- cdnaprod.copyInto(prods);
- cdnasqi.copyInto(cdna);
- return CdnaTranslate(cdna, xons, prods, viscontigs, gapCharacter,
- null, alwidth, dataset);
- }
- return null;
- }
-
- /**
- * translate na alignment annotations onto translated amino acid alignment al
- * using codon mapping codons
- *
- * @param annotations
- * @param al
- * @param codons
- */
- public static void translateAlignedAnnotations(
- AlignmentAnnotation[] annotations, AlignmentI al,
- AlignedCodonFrame codons)
- {
- // //////////////////////////////
- // Copy annotations across
- //
- // Can only do this for columns with consecutive codons, or where
- // annotation is sequence associated.
-
- int pos, a, aSize;
- if (annotations != null)
- {
- for (int i = 0; i < annotations.length; i++)
- {
- // Skip any autogenerated annotation
- if (annotations[i].autoCalculated)
- {
- continue;
- }
-
- aSize = codons.getaaWidth(); // aa alignment width.
- jalview.datamodel.Annotation[] anots = (annotations[i].annotations == null) ? null
- : new jalview.datamodel.Annotation[aSize];
- if (anots != null)
- {
- for (a = 0; a < aSize; a++)
- {
- // process through codon map.
- if (codons.codons[a] != null
- && codons.codons[a][0] == (codons.codons[a][2] - 2))
- {
- anots[a] = getCodonAnnotation(codons.codons[a],
- annotations[i].annotations);
- }
- }
- }
-
- jalview.datamodel.AlignmentAnnotation aa = new jalview.datamodel.AlignmentAnnotation(
- annotations[i].label, annotations[i].description, anots);
- aa.graph = annotations[i].graph;
- aa.graphGroup = annotations[i].graphGroup;
- aa.graphHeight = annotations[i].graphHeight;
- if (annotations[i].getThreshold() != null)
- {
- aa.setThreshold(new jalview.datamodel.GraphLine(annotations[i]
- .getThreshold()));
- }
- if (annotations[i].hasScore)
- {
- aa.setScore(annotations[i].getScore());
- }
- if (annotations[i].sequenceRef != null)
- {
- SequenceI aaSeq = codons
- .getAaForDnaSeq(annotations[i].sequenceRef);
- if (aaSeq != null)
- {
- // aa.compactAnnotationArray(); // throw away alignment annotation
- // positioning
- aa.setSequenceRef(aaSeq);
- aa.createSequenceMapping(aaSeq, aaSeq.getStart(), true); // rebuild
- // mapping
- aa.adjustForAlignment();
- aaSeq.addAlignmentAnnotation(aa);
- }
-
- }
- al.addAnnotation(aa);
- }
- }
- }
-
- private static Annotation getCodonAnnotation(int[] is,
- Annotation[] annotations)
- {
- // Have a look at all the codon positions for annotation and put the first
- // one found into the translated annotation pos.
- int contrib = 0;
- Annotation annot = null;
- for (int p = 0; p < 3; p++)
- {
- if (annotations[is[p]] != null)
- {
- if (annot == null)
- {
- annot = new Annotation(annotations[is[p]]);
- contrib = 1;
- }
- else
- {
- // merge with last
- Annotation cpy = new Annotation(annotations[is[p]]);
- if (annot.colour == null)
- {
- annot.colour = cpy.colour;
- }
- if (annot.description == null || annot.description.length() == 0)
- {
- annot.description = cpy.description;
- }
- if (annot.displayCharacter == null)
- {
- annot.displayCharacter = cpy.displayCharacter;
- }
- if (annot.secondaryStructure == 0)
- {
- annot.secondaryStructure = cpy.secondaryStructure;
- }
- annot.value += cpy.value;
- contrib++;
- }
- }
- }
- if (contrib > 1)
- {
- annot.value /= (float) contrib;
- }
- return annot;
- }
-
- /**
- * Translate a na sequence
- *
- * @param selection
- * sequence displayed under viscontigs visible columns
- * @param seqstring
- * ORF read in some global alignment reference frame
- * @param viscontigs
- * mapping from global reference frame to visible seqstring ORF read
- * @param codons
- * Definition of global ORF alignment reference frame
- * @param gapCharacter
- * @param newSeq
- * @return sequence ready to be added to alignment.
- */
- public static SequenceI translateCodingRegion(SequenceI selection,
- String seqstring, int[] viscontigs, AlignedCodonFrame codons,
- char gapCharacter, DBRefEntry product)
- {
- Vector skip = new Vector();
- int skipint[] = null;
- ShiftList vismapping = new ShiftList(); // map from viscontigs to seqstring
- // intervals
- int vc, scontigs[] = new int[viscontigs.length];
- int npos = 0;
- for (vc = 0; vc < viscontigs.length; vc += 2)
- {
- if (vc == 0)
- {
- vismapping.addShift(npos, viscontigs[vc]);
- }
- else
- {
- // hidden region
- vismapping.addShift(npos, viscontigs[vc] - viscontigs[vc - 1] + 1);
- }
- scontigs[vc] = viscontigs[vc];
- scontigs[vc + 1] = viscontigs[vc + 1];
- }
-
- StringBuffer protein = new StringBuffer();
- String seq = seqstring.replace('U', 'T');
- char codon[] = new char[3];
- int cdp[] = new int[3], rf = 0, lastnpos = 0, nend;
- int aspos = 0;
- int resSize = 0;
- for (npos = 0, nend = seq.length(); npos < nend; npos++)
- {
- if (!jalview.util.Comparison.isGap(seq.charAt(npos)))
- {
- cdp[rf] = npos; // store position
- codon[rf++] = seq.charAt(npos); // store base
- }
- // filled an RF yet ?
- if (rf == 3)
- {
- String aa = ResidueProperties.codonTranslate(new String(codon));
- rf = 0;
- if (aa == null)
- {
- aa = String.valueOf(gapCharacter);
- if (skipint == null)
- {
- skipint = new int[]
- { cdp[0], cdp[2] };
- }
- skipint[1] = cdp[2];
- }
- else
- {
- if (skipint != null)
- {
- // edit scontigs
- skipint[0] = vismapping.shift(skipint[0]);
- skipint[1] = vismapping.shift(skipint[1]);
- for (vc = 0; vc < scontigs.length; vc += 2)
- {
- if (scontigs[vc + 1] < skipint[0])
- {
- continue;
- }
- if (scontigs[vc] <= skipint[0])
- {
- if (skipint[0] == scontigs[vc])
- {
-
- }
- else
- {
- int[] t = new int[scontigs.length + 2];
- System.arraycopy(scontigs, 0, t, 0, vc - 1);
- // scontigs[vc]; //
- }
- }
- }
- skip.addElement(skipint);
- skipint = null;
- }
- if (aa.equals("STOP"))
- {
- aa = "X";
- }
- resSize++;
- }
- // insert/delete gaps prior to this codon - if necessary
- boolean findpos = true;
- while (findpos)
- {
- // first ensure that the codons array is long enough.
- codons.checkCodonFrameWidth(aspos);
- // now check to see if we place the aa at the current aspos in the
- // protein alignment
- switch (Dna.compare_codonpos(cdp, codons.codons[aspos]))
- {
- case -1:
- codons.insertAAGap(aspos, gapCharacter);
- findpos = false;
- break;
- case +1:
- // this aa appears after the aligned codons at aspos, so prefix it
- // with a gap
- aa = "" + gapCharacter + aa;
- aspos++;
- // if (aspos >= codons.aaWidth)
- // codons.aaWidth = aspos + 1;
- break; // check the next position for alignment
- case 0:
- // codon aligns at aspos position.
- findpos = false;
- }
- }
- // codon aligns with all other sequence residues found at aspos
- protein.append(aa);
- lastnpos = npos;
- if (codons.codons[aspos] == null)
- {
- // mark this column as aligning to this aligned reading frame
- codons.codons[aspos] = new int[]
- { cdp[0], cdp[1], cdp[2] };
- }
- if (aspos >= codons.aaWidth)
- {
- // update maximum alignment width
- // (we can do this without calling checkCodonFrameWidth because it was
- // already done above)
- codons.setAaWidth(aspos);
- }
- // ready for next translated reading frame alignment position (if any)
- aspos++;
- }
- }
- if (resSize > 0)
- {
- SequenceI newseq = new Sequence(selection.getName(),
- protein.toString());
- if (rf != 0)
- {
- jalview.bin.Cache.log
- .debug("trimming contigs for incomplete terminal codon.");
- // map and trim contigs to ORF region
- vc = scontigs.length - 1;
- lastnpos = vismapping.shift(lastnpos); // place npos in context of
- // whole dna alignment (rather
- // than visible contigs)
- // incomplete ORF could be broken over one or two visible contig
- // intervals.
- while (vc >= 0 && scontigs[vc] > lastnpos)
- {
- if (vc > 0 && scontigs[vc - 1] > lastnpos)
- {
- vc -= 2;
- }
- else
- {
- // correct last interval in list.
- scontigs[vc] = lastnpos;
- }
- }
-
- if (vc > 0 && (vc + 1) < scontigs.length)
- {
- // truncate map list to just vc elements
- int t[] = new int[vc + 1];
- System.arraycopy(scontigs, 0, t, 0, vc + 1);
- scontigs = t;
- }
- if (vc <= 0)
- scontigs = null;
- }
- if (scontigs != null)
- {
- npos = 0;
- // map scontigs to actual sequence positions on selection
- for (vc = 0; vc < scontigs.length; vc += 2)
- {
- scontigs[vc] = selection.findPosition(scontigs[vc]); // not from 1!
- scontigs[vc + 1] = selection.findPosition(scontigs[vc + 1]); // exclusive
- if (scontigs[vc + 1] == selection.getEnd())
- break;
- }
- // trim trailing empty intervals.
- if ((vc + 2) < scontigs.length)
- {
- int t[] = new int[vc + 2];
- System.arraycopy(scontigs, 0, t, 0, vc + 2);
- scontigs = t;
- }
- /*
- * delete intervals in scontigs which are not translated. 1. map skip
- * into sequence position intervals 2. truncate existing ranges and add
- * new ranges to exclude untranslated regions. if (skip.size()>0) {
- * Vector narange = new Vector(); for (vc=0; vc<scontigs.length; vc++) {
- * narange.addElement(new int[] {scontigs[vc]}); } int sint=0,iv[]; vc =
- * 0; while (sint<skip.size()) { skipint = (int[]) skip.elementAt(sint);
- * do { iv = (int[]) narange.elementAt(vc); if (iv[0]>=skipint[0] &&
- * iv[0]<=skipint[1]) { if (iv[0]==skipint[0]) { // delete beginning of
- * range } else { // truncate range and create new one if necessary iv =
- * (int[]) narange.elementAt(vc+1); if (iv[0]<=skipint[1]) { // truncate
- * range iv[0] = skipint[1]; } else { } } } else if (iv[0]<skipint[0]) {
- * iv = (int[]) narange.elementAt(vc+1); } } while (iv[0]) } }
- */
- MapList map = new MapList(scontigs, new int[]
- { 1, resSize }, 3, 1);
-
- // update newseq as if it was generated as mapping from product
-
- if (product != null)
- {
- newseq.setName(product.getSource() + "|"
- + product.getAccessionId());
- if (product.getMap() != null)
- {
- // Mapping mp = product.getMap();
- // newseq.setStart(mp.getPosition(scontigs[0]));
- // newseq.setEnd(mp
- // .getPosition(scontigs[scontigs.length - 1]));
- }
- }
- transferCodedFeatures(selection, newseq, map, null, null);
- SequenceI rseq = newseq.deriveSequence(); // construct a dataset
- // sequence for our new
- // peptide, regardless.
- // store a mapping (this actually stores a mapping between the dataset
- // sequences for the two sequences
- codons.addMap(selection, rseq, map);
- return rseq;
- }
- }
- // register the mapping somehow
- //
- return null;
- }
-
- /**
- * Given a peptide newly translated from a dna sequence, copy over and set any
- * features on the peptide from the DNA. If featureTypes is null, all features
- * on the dna sequence are searched (rather than just the displayed ones), and
- * similarly for featureGroups.
- *
- * @param dna
- * @param pep
- * @param map
- * @param featureTypes
- * hash who's keys are the displayed feature type strings
- * @param featureGroups
- * hash where keys are feature groups and values are Boolean objects
- * indicating if they are displayed.
- */
- private static void transferCodedFeatures(SequenceI dna, SequenceI pep,
- MapList map, Hashtable featureTypes, Hashtable featureGroups)
- {
- SequenceFeature[] sf = dna.getDatasetSequence().getSequenceFeatures();
- Boolean fgstate;
- jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils
- .selectRefs(dna.getDBRef(),
- jalview.datamodel.DBRefSource.DNACODINGDBS);
- if (dnarefs != null)
- {
- // intersect with pep
- for (int d = 0; d < dnarefs.length; d++)
- {
- Mapping mp = dnarefs[d].getMap();
- if (mp != null)
- {
- }
- }
- }
- if (sf != null)
- {
- for (int f = 0; f < sf.length; f++)
- {
- fgstate = (featureGroups == null) ? null : ((Boolean) featureGroups
- .get(sf[f].featureGroup));
- if ((featureTypes == null || featureTypes.containsKey(sf[f]
- .getType())) && (fgstate == null || fgstate.booleanValue()))
- {
- if (FeatureProperties.isCodingFeature(null, sf[f].getType()))
- {
- // if (map.intersectsFrom(sf[f].begin, sf[f].end))
- {
-
- }
- }
- }
- }
- }
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AlignedCodon;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.FeatureProperties;
+import jalview.datamodel.GraphLine;
+import jalview.datamodel.Mapping;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ResidueProperties;
+import jalview.util.Comparison;
+import jalview.util.DBRefUtils;
+import jalview.util.MapList;
+import jalview.util.ShiftList;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
+public class Dna
+{
+ private static final String STOP_ASTERIX = "*";
+
+ private static final Comparator<AlignedCodon> comparator = new CodonComparator();
+
+ /*
+ * 'final' variables describe the inputs to the translation, which should not
+ * be modified.
+ */
+ final private List<SequenceI> selection;
+
+ final private String[] seqstring;
+
+ final private int[] contigs;
+
+ final private char gapChar;
+
+ final private AlignmentAnnotation[] annotations;
+
+ final private int dnaWidth;
+
+ final private Alignment dataset;
+
+ /*
+ * Working variables for the translation.
+ *
+ * The width of the translation-in-progress protein alignment.
+ */
+ private int aaWidth = 0;
+
+ /*
+ * This array will be built up so that position i holds the codon positions
+ * e.g. [7, 9, 10] that match column i (base 0) in the aligned translation.
+ * Note this implies a contract that if two codons do not align exactly, their
+ * translated products must occupy different column positions.
+ */
+ private AlignedCodon[] alignedCodons;
+
+ /**
+ * Constructor given a viewport and the visible contigs.
+ *
+ * @param viewport
+ * @param visibleContigs
+ */
+ public Dna(AlignViewportI viewport, int[] visibleContigs)
+ {
+ this.selection = Arrays.asList(viewport.getSequenceSelection());
+ this.seqstring = viewport.getViewAsString(true);
+ this.contigs = visibleContigs;
+ this.gapChar = viewport.getGapCharacter();
+ this.annotations = viewport.getAlignment().getAlignmentAnnotation();
+ this.dnaWidth = viewport.getAlignment().getWidth();
+ this.dataset = viewport.getAlignment().getDataset();
+ }
+
+ /**
+ * Test whether codon positions cdp1 should align before, with, or after cdp2.
+ * Returns zero if all positions match (or either argument is null). Returns
+ * -1 if any position in the first codon precedes the corresponding position
+ * in the second codon. Else returns +1 (some position in the second codon
+ * precedes the corresponding position in the first).
+ *
+ * Note this is not necessarily symmetric, for example:
+ * <ul>
+ * <li>compareCodonPos([2,5,6], [3,4,5]) returns -1</li>
+ * <li>compareCodonPos([3,4,5], [2,5,6]) also returns -1</li>
+ * </ul>
+ *
+ * @param ac1
+ * @param ac2
+ * @return
+ */
+ public static final int compareCodonPos(AlignedCodon ac1, AlignedCodon ac2)
+ {
+ return comparator.compare(ac1, ac2);
+ // return jalview_2_8_2compare(ac1, ac2);
+ }
+
+ /**
+ * Codon comparison up to Jalview 2.8.2. This rule is sequence order dependent
+ * - see http://issues.jalview.org/browse/JAL-1635
+ *
+ * @param ac1
+ * @param ac2
+ * @return
+ */
+ private static int jalview_2_8_2compare(AlignedCodon ac1, AlignedCodon ac2)
+ {
+ if (ac1 == null || ac2 == null || (ac1.equals(ac2)))
+ {
+ return 0;
+ }
+ if (ac1.pos1 < ac2.pos1 || ac1.pos2 < ac2.pos2 || ac1.pos3 < ac2.pos3)
+ {
+ // one base in cdp1 precedes the corresponding base in the other codon
+ return -1;
+ }
+ // one base in cdp1 appears after the corresponding base in the other codon.
+ return 1;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public AlignmentI translateCdna()
+ {
+ AlignedCodonFrame acf = new AlignedCodonFrame();
+
+ alignedCodons = new AlignedCodon[dnaWidth];
+
+ int s;
+ int sSize = selection.size();
+ List<SequenceI> pepseqs = new ArrayList<SequenceI>();
+ for (s = 0; s < sSize; s++)
+ {
+ SequenceI newseq = translateCodingRegion(selection.get(s),
+ seqstring[s], acf, pepseqs);
+
+ if (newseq != null)
+ {
+ pepseqs.add(newseq);
+ SequenceI ds = newseq;
+ if (dataset != null)
+ {
+ while (ds.getDatasetSequence() != null)
+ {
+ ds = ds.getDatasetSequence();
+ }
+ dataset.addSequence(ds);
+ }
+ }
+ }
+
+ SequenceI[] newseqs = pepseqs.toArray(new SequenceI[pepseqs.size()]);
+ AlignmentI al = new Alignment(newseqs);
+ // ensure we look aligned.
+ al.padGaps();
+ // link the protein translation to the DNA dataset
+ al.setDataset(dataset);
+ translateAlignedAnnotations(al, acf);
+ al.addCodonFrame(acf);
+ return al;
+ }
+
+ /**
+ * fake the collection of DbRefs with associated exon mappings to identify if
+ * a translation would generate distinct product in the currently selected
+ * region.
+ *
+ * @param selection
+ * @param viscontigs
+ * @return
+ */
+ public static boolean canTranslate(SequenceI[] selection,
+ int viscontigs[])
+ {
+ for (int gd = 0; gd < selection.length; gd++)
+ {
+ SequenceI dna = selection[gd];
+ DBRefEntry[] dnarefs = DBRefUtils.selectRefs(dna.getDBRef(),
+ jalview.datamodel.DBRefSource.DNACODINGDBS);
+ if (dnarefs != null)
+ {
+ // intersect with pep
+ List<DBRefEntry> mappedrefs = new ArrayList<DBRefEntry>();
+ DBRefEntry[] refs = dna.getDBRef();
+ for (int d = 0; d < refs.length; d++)
+ {
+ if (refs[d].getMap() != null && refs[d].getMap().getMap() != null
+ && refs[d].getMap().getMap().getFromRatio() == 3
+ && refs[d].getMap().getMap().getToRatio() == 1)
+ {
+ mappedrefs.add(refs[d]); // add translated protein maps
+ }
+ }
+ dnarefs = mappedrefs.toArray(new DBRefEntry[mappedrefs.size()]);
+ for (int d = 0; d < dnarefs.length; d++)
+ {
+ Mapping mp = dnarefs[d].getMap();
+ if (mp != null)
+ {
+ for (int vc = 0; vc < viscontigs.length; vc += 2)
+ {
+ int[] mpr = mp.locateMappedRange(viscontigs[vc],
+ viscontigs[vc + 1]);
+ if (mpr != null)
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Translate nucleotide alignment annotations onto translated amino acid
+ * alignment using codon mapping codons
+ *
+ * @param al
+ * the translated protein alignment
+ */
+ protected void translateAlignedAnnotations(AlignmentI al,
+ AlignedCodonFrame acf)
+ {
+ // Can only do this for columns with consecutive codons, or where
+ // annotation is sequence associated.
+
+ if (annotations != null)
+ {
+ for (AlignmentAnnotation annotation : annotations)
+ {
+ /*
+ * Skip hidden or autogenerated annotation. Also (for now), RNA
+ * secondary structure annotation. If we want to show this against
+ * protein we need a smarter way to 'translate' without generating
+ * invalid (unbalanced) structure annotation.
+ */
+ if (annotation.autoCalculated || !annotation.visible
+ || annotation.isRNA())
+ {
+ continue;
+ }
+
+ int aSize = aaWidth;
+ Annotation[] anots = (annotation.annotations == null) ? null
+ : new Annotation[aSize];
+ if (anots != null)
+ {
+ for (int a = 0; a < aSize; a++)
+ {
+ // process through codon map.
+ if (a < alignedCodons.length && alignedCodons[a] != null
+ && alignedCodons[a].pos1 == (alignedCodons[a].pos3 - 2))
+ {
+ anots[a] = getCodonAnnotation(alignedCodons[a],
+ annotation.annotations);
+ }
+ }
+ }
+
+ AlignmentAnnotation aa = new AlignmentAnnotation(annotation.label,
+ annotation.description, anots);
+ aa.graph = annotation.graph;
+ aa.graphGroup = annotation.graphGroup;
+ aa.graphHeight = annotation.graphHeight;
+ if (annotation.getThreshold() != null)
+ {
+ aa.setThreshold(new GraphLine(annotation.getThreshold()));
+ }
+ if (annotation.hasScore)
+ {
+ aa.setScore(annotation.getScore());
+ }
+
+ final SequenceI seqRef = annotation.sequenceRef;
+ if (seqRef != null)
+ {
+ SequenceI aaSeq = acf.getAaForDnaSeq(seqRef);
+ if (aaSeq != null)
+ {
+ // aa.compactAnnotationArray(); // throw away alignment annotation
+ // positioning
+ aa.setSequenceRef(aaSeq);
+ // rebuild mapping
+ aa.createSequenceMapping(aaSeq, aaSeq.getStart(), true);
+ aa.adjustForAlignment();
+ aaSeq.addAlignmentAnnotation(aa);
+ }
+ }
+ al.addAnnotation(aa);
+ }
+ }
+ }
+
+ private static Annotation getCodonAnnotation(AlignedCodon is,
+ Annotation[] annotations)
+ {
+ // Have a look at all the codon positions for annotation and put the first
+ // one found into the translated annotation pos.
+ int contrib = 0;
+ Annotation annot = null;
+ for (int p = 1; p <= 3; p++)
+ {
+ int dnaCol = is.getBaseColumn(p);
+ if (annotations[dnaCol] != null)
+ {
+ if (annot == null)
+ {
+ annot = new Annotation(annotations[dnaCol]);
+ contrib = 1;
+ }
+ else
+ {
+ // merge with last
+ Annotation cpy = new Annotation(annotations[dnaCol]);
+ if (annot.colour == null)
+ {
+ annot.colour = cpy.colour;
+ }
+ if (annot.description == null || annot.description.length() == 0)
+ {
+ annot.description = cpy.description;
+ }
+ if (annot.displayCharacter == null)
+ {
+ annot.displayCharacter = cpy.displayCharacter;
+ }
+ if (annot.secondaryStructure == 0)
+ {
+ annot.secondaryStructure = cpy.secondaryStructure;
+ }
+ annot.value += cpy.value;
+ contrib++;
+ }
+ }
+ }
+ if (contrib > 1)
+ {
+ annot.value /= contrib;
+ }
+ return annot;
+ }
+
+ /**
+ * Translate a na sequence
+ *
+ * @param selection
+ * sequence displayed under viscontigs visible columns
+ * @param seqstring
+ * ORF read in some global alignment reference frame
+ * @param acf
+ * Definition of global ORF alignment reference frame
+ * @param proteinSeqs
+ * @return sequence ready to be added to alignment.
+ */
+ protected SequenceI translateCodingRegion(SequenceI selection,
+ String seqstring, AlignedCodonFrame acf,
+ List<SequenceI> proteinSeqs)
+ {
+ List<int[]> skip = new ArrayList<int[]>();
+ int skipint[] = null;
+ ShiftList vismapping = new ShiftList(); // map from viscontigs to seqstring
+ // intervals
+ int vc;
+ int[] scontigs = new int[contigs.length];
+ int npos = 0;
+ for (vc = 0; vc < contigs.length; vc += 2)
+ {
+ if (vc == 0)
+ {
+ vismapping.addShift(npos, contigs[vc]);
+ }
+ else
+ {
+ // hidden region
+ vismapping.addShift(npos, contigs[vc] - contigs[vc - 1] + 1);
+ }
+ scontigs[vc] = contigs[vc];
+ scontigs[vc + 1] = contigs[vc + 1];
+ }
+
+ // allocate a roughly sized buffer for the protein sequence
+ StringBuilder protein = new StringBuilder(seqstring.length() / 2);
+ String seq = seqstring.replace('U', 'T').replace('u', 'T');
+ char codon[] = new char[3];
+ int cdp[] = new int[3];
+ int rf = 0;
+ int lastnpos = 0;
+ int nend;
+ int aspos = 0;
+ int resSize = 0;
+ for (npos = 0, nend = seq.length(); npos < nend; npos++)
+ {
+ if (!Comparison.isGap(seq.charAt(npos)))
+ {
+ cdp[rf] = npos; // store position
+ codon[rf++] = seq.charAt(npos); // store base
+ }
+ if (rf == 3)
+ {
+ /*
+ * Filled up a reading frame...
+ */
+ AlignedCodon alignedCodon = new AlignedCodon(cdp[0], cdp[1], cdp[2]);
+ String aa = ResidueProperties.codonTranslate(new String(codon));
+ rf = 0;
+ final String gapString = String.valueOf(gapChar);
+ if (aa == null)
+ {
+ aa = gapString;
+ if (skipint == null)
+ {
+ skipint = new int[] { alignedCodon.pos1, alignedCodon.pos3 /*
+ * cdp[0],
+ * cdp[2]
+ */};
+ }
+ skipint[1] = alignedCodon.pos3; // cdp[2];
+ }
+ else
+ {
+ if (skipint != null)
+ {
+ // edit scontigs
+ skipint[0] = vismapping.shift(skipint[0]);
+ skipint[1] = vismapping.shift(skipint[1]);
+ for (vc = 0; vc < scontigs.length;)
+ {
+ if (scontigs[vc + 1] < skipint[0])
+ {
+ // before skipint starts
+ vc += 2;
+ continue;
+ }
+ if (scontigs[vc] > skipint[1])
+ {
+ // finished editing so
+ break;
+ }
+ // Edit the contig list to include the skipped region which did
+ // not translate
+ int[] t;
+ // from : s1 e1 s2 e2 s3 e3
+ // to s: s1 e1 s2 k0 k1 e2 s3 e3
+ // list increases by one unless one boundary (s2==k0 or e2==k1)
+ // matches, and decreases by one if skipint intersects whole
+ // visible contig
+ if (scontigs[vc] <= skipint[0])
+ {
+ if (skipint[0] == scontigs[vc])
+ {
+ // skipint at start of contig
+ // shift the start of this contig
+ if (scontigs[vc + 1] > skipint[1])
+ {
+ scontigs[vc] = skipint[1];
+ vc += 2;
+ }
+ else
+ {
+ if (scontigs[vc + 1] == skipint[1])
+ {
+ // remove the contig
+ t = new int[scontigs.length - 2];
+ if (vc > 0)
+ {
+ System.arraycopy(scontigs, 0, t, 0, vc - 1);
+ }
+ if (vc + 2 < t.length)
+ {
+ System.arraycopy(scontigs, vc + 2, t, vc, t.length
+ - vc + 2);
+ }
+ scontigs = t;
+ }
+ else
+ {
+ // truncate contig to before the skipint region
+ scontigs[vc + 1] = skipint[0] - 1;
+ vc += 2;
+ }
+ }
+ }
+ else
+ {
+ // scontig starts before start of skipint
+ if (scontigs[vc + 1] < skipint[1])
+ {
+ // skipint truncates end of scontig
+ scontigs[vc + 1] = skipint[0] - 1;
+ vc += 2;
+ }
+ else
+ {
+ // divide region to new contigs
+ t = new int[scontigs.length + 2];
+ System.arraycopy(scontigs, 0, t, 0, vc + 1);
+ t[vc + 1] = skipint[0];
+ t[vc + 2] = skipint[1];
+ System.arraycopy(scontigs, vc + 1, t, vc + 3,
+ scontigs.length - (vc + 1));
+ scontigs = t;
+ vc += 4;
+ }
+ }
+ }
+ }
+ skip.add(skipint);
+ skipint = null;
+ }
+ if (aa.equals("STOP"))
+ {
+ aa = STOP_ASTERIX;
+ }
+ resSize++;
+ }
+ boolean findpos = true;
+ while (findpos)
+ {
+ /*
+ * Compare this codon's base positions with those currently aligned to
+ * this column in the translation.
+ */
+ final int compareCodonPos = compareCodonPos(alignedCodon,
+ alignedCodons[aspos]);
+ switch (compareCodonPos)
+ {
+ case -1:
+
+ /*
+ * This codon should precede the mapped positions - need to insert a
+ * gap in all prior sequences.
+ */
+ insertAAGap(aspos, proteinSeqs);
+ findpos = false;
+ break;
+
+ case +1:
+
+ /*
+ * This codon belongs after the aligned codons at aspos. Prefix it
+ * with a gap and try the next position.
+ */
+ aa = gapString + aa;
+ aspos++;
+ break;
+
+ case 0:
+
+ /*
+ * Exact match - codon 'belongs' at this translated position.
+ */
+ findpos = false;
+ }
+ }
+ protein.append(aa);
+ lastnpos = npos;
+ if (alignedCodons[aspos] == null)
+ {
+ // mark this column as aligning to this aligned reading frame
+ alignedCodons[aspos] = alignedCodon;
+ }
+ else if (!alignedCodons[aspos].equals(alignedCodon))
+ {
+ throw new IllegalStateException("Tried to coalign "
+ + alignedCodons[aspos].toString() + " with "
+ + alignedCodon.toString());
+ }
+ if (aspos >= aaWidth)
+ {
+ // update maximum alignment width
+ aaWidth = aspos;
+ }
+ // ready for next translated reading frame alignment position (if any)
+ aspos++;
+ }
+ }
+ if (resSize > 0)
+ {
+ SequenceI newseq = new Sequence(selection.getName(),
+ protein.toString());
+ if (rf != 0)
+ {
+ final String errMsg = "trimming contigs for incomplete terminal codon.";
+ System.err.println(errMsg);
+ // map and trim contigs to ORF region
+ vc = scontigs.length - 1;
+ lastnpos = vismapping.shift(lastnpos); // place npos in context of
+ // whole dna alignment (rather
+ // than visible contigs)
+ // incomplete ORF could be broken over one or two visible contig
+ // intervals.
+ while (vc >= 0 && scontigs[vc] > lastnpos)
+ {
+ if (vc > 0 && scontigs[vc - 1] > lastnpos)
+ {
+ vc -= 2;
+ }
+ else
+ {
+ // correct last interval in list.
+ scontigs[vc] = lastnpos;
+ }
+ }
+
+ if (vc > 0 && (vc + 1) < scontigs.length)
+ {
+ // truncate map list to just vc elements
+ int t[] = new int[vc + 1];
+ System.arraycopy(scontigs, 0, t, 0, vc + 1);
+ scontigs = t;
+ }
+ if (vc <= 0)
+ {
+ scontigs = null;
+ }
+ }
+ if (scontigs != null)
+ {
+ npos = 0;
+ // map scontigs to actual sequence positions on selection
+ for (vc = 0; vc < scontigs.length; vc += 2)
+ {
+ scontigs[vc] = selection.findPosition(scontigs[vc]); // not from 1!
+ scontigs[vc + 1] = selection.findPosition(scontigs[vc + 1]); // exclusive
+ if (scontigs[vc + 1] == selection.getEnd())
+ {
+ break;
+ }
+ }
+ // trim trailing empty intervals.
+ if ((vc + 2) < scontigs.length)
+ {
+ int t[] = new int[vc + 2];
+ System.arraycopy(scontigs, 0, t, 0, vc + 2);
+ scontigs = t;
+ }
+ /*
+ * delete intervals in scontigs which are not translated. 1. map skip
+ * into sequence position intervals 2. truncate existing ranges and add
+ * new ranges to exclude untranslated regions. if (skip.size()>0) {
+ * Vector narange = new Vector(); for (vc=0; vc<scontigs.length; vc++) {
+ * narange.addElement(new int[] {scontigs[vc]}); } int sint=0,iv[]; vc =
+ * 0; while (sint<skip.size()) { skipint = (int[]) skip.elementAt(sint);
+ * do { iv = (int[]) narange.elementAt(vc); if (iv[0]>=skipint[0] &&
+ * iv[0]<=skipint[1]) { if (iv[0]==skipint[0]) { // delete beginning of
+ * range } else { // truncate range and create new one if necessary iv =
+ * (int[]) narange.elementAt(vc+1); if (iv[0]<=skipint[1]) { // truncate
+ * range iv[0] = skipint[1]; } else { } } } else if (iv[0]<skipint[0]) {
+ * iv = (int[]) narange.elementAt(vc+1); } } while (iv[0]) } }
+ */
+ MapList map = new MapList(scontigs, new int[] { 1, resSize }, 3, 1);
+
+ transferCodedFeatures(selection, newseq, map, null, null);
+
+ /*
+ * Construct a dataset sequence for our new peptide.
+ */
+ SequenceI rseq = newseq.deriveSequence();
+
+ /*
+ * Store a mapping (between the dataset sequences for the two
+ * sequences).
+ */
+ // SIDE-EFFECT: acf stores the aligned sequence reseq; to remove!
+ acf.addMap(selection, rseq, map);
+ return rseq;
+ }
+ }
+ // register the mapping somehow
+ //
+ return null;
+ }
+
+ /**
+ * Insert a gap into the aligned proteins and the codon mapping array.
+ *
+ * @param pos
+ * @param proteinSeqs
+ * @return
+ */
+ protected void insertAAGap(int pos, List<SequenceI> proteinSeqs)
+ {
+ aaWidth++;
+ for (SequenceI seq : proteinSeqs)
+ {
+ seq.insertCharAt(pos, gapChar);
+ }
+
+ checkCodonFrameWidth();
+ if (pos < aaWidth)
+ {
+ aaWidth++;
+
+ /*
+ * Shift from [pos] to the end one to the right, and null out [pos]
+ */
+ System.arraycopy(alignedCodons, pos, alignedCodons, pos + 1,
+ alignedCodons.length - pos - 1);
+ alignedCodons[pos] = null;
+ }
+ }
+
+ /**
+ * Check the codons array can accommodate a single insertion, if not resize
+ * it.
+ */
+ protected void checkCodonFrameWidth()
+ {
+ if (alignedCodons[alignedCodons.length - 1] != null)
+ {
+ /*
+ * arraycopy insertion would bump a filled slot off the end, so expand.
+ */
+ AlignedCodon[] c = new AlignedCodon[alignedCodons.length + 10];
+ System.arraycopy(alignedCodons, 0, c, 0, alignedCodons.length);
+ alignedCodons = c;
+ }
+ }
+
+ /**
+ * Given a peptide newly translated from a dna sequence, copy over and set any
+ * features on the peptide from the DNA. If featureTypes is null, all features
+ * on the dna sequence are searched (rather than just the displayed ones), and
+ * similarly for featureGroups.
+ *
+ * @param dna
+ * @param pep
+ * @param map
+ * @param featureTypes
+ * hash whose keys are the displayed feature type strings
+ * @param featureGroups
+ * hash where keys are feature groups and values are Boolean objects
+ * indicating if they are displayed.
+ */
+ private static void transferCodedFeatures(SequenceI dna, SequenceI pep,
+ MapList map, Map<String, Object> featureTypes,
+ Map<String, Boolean> featureGroups)
+ {
+ SequenceFeature[] sfs = dna.getSequenceFeatures();
+ Boolean fgstate;
+ DBRefEntry[] dnarefs = DBRefUtils.selectRefs(dna.getDBRef(),
+ DBRefSource.DNACODINGDBS);
+ if (dnarefs != null)
+ {
+ // intersect with pep
+ for (int d = 0; d < dnarefs.length; d++)
+ {
+ Mapping mp = dnarefs[d].getMap();
+ if (mp != null)
+ {
+ }
+ }
+ }
+ if (sfs != null)
+ {
+ for (SequenceFeature sf : sfs)
+ {
+ fgstate = (featureGroups == null) ? null : featureGroups
+ .get(sf.featureGroup);
+ if ((featureTypes == null || featureTypes.containsKey(sf.getType()))
+ && (fgstate == null || fgstate.booleanValue()))
+ {
+ if (FeatureProperties.isCodingFeature(null, sf.getType()))
+ {
+ // if (map.intersectsFrom(sf[f].begin, sf[f].end))
+ {
+
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java
index 2dd6a74..fae459f 100644
--- a/src/jalview/analysis/Finder.java
+++ b/src/jalview/analysis/Finder.java
@@ -1,25 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import java.util.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
-import jalview.datamodel.*;
+import java.util.Vector;
public class Finder
{
@@ -36,6 +42,8 @@ public class Finder
boolean caseSensitive = false;
+ private boolean includeDescription = false;
+
boolean findAll = false;
com.stevesoft.pat.Regex regex = null;
@@ -84,7 +92,6 @@ public class Finder
boolean found = false;
int end = alignment.getHeight();
-
// /////////////////////////////////////////////
if (selection != null)
@@ -99,7 +106,7 @@ public class Finder
while (!found && (seqIndex < end))
{
seq = (Sequence) alignment.getSequenceAt(seqIndex);
-
+
if ((selection != null && selection.getSize() > 0)
&& !selection.getSequences(null).contains(seq))
{
@@ -121,9 +128,10 @@ public class Finder
{
searchResults.addResult(seq, res, res);
hasResults = true;
- //resIndex=seq.getLength();
+ // resIndex=seq.getLength();
// seqIndex++;
- if (!findAll) {
+ if (!findAll)
+ {
found = true;
break;
}
@@ -143,6 +151,19 @@ public class Finder
break;
}
}
+
+ if (isIncludeDescription() && seq.getDescription() != null
+ && regex.search(seq.getDescription()))
+ {
+ idMatch.addElement(seq);
+ hasResults = true;
+ if (!findAll)
+ {
+ // stop and return the match
+ found = true;
+ break;
+ }
+ }
}
item = seq.getSequenceAsString();
@@ -185,7 +206,7 @@ public class Finder
{
continue;
}
-
+ // if invalid string used, then regex has no matched to/from
int sres = seq
.findPosition(resIndex
+ Integer.parseInt(spaces.elementAt(resIndex)
@@ -355,4 +376,14 @@ public class Finder
{
this.seqIndex = seqIndex;
}
+
+ public boolean isIncludeDescription()
+ {
+ return includeDescription;
+ }
+
+ public void setIncludeDescription(boolean includeDescription)
+ {
+ this.includeDescription = includeDescription;
+ }
}
diff --git a/src/jalview/analysis/Grouping.java b/src/jalview/analysis/Grouping.java
index 57f1dcf..18c1bb9 100644
--- a/src/jalview/analysis/Grouping.java
+++ b/src/jalview/analysis/Grouping.java
@@ -1,29 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.Vector;
/**
@@ -42,57 +46,135 @@ public class Grouping
*
* @param sequences
* @param selectedChars
- * @param exgroups
+ * @param list
* @return
*/
public static SequenceGroup[] makeGroupsFrom(SequenceI[] sequences,
- String[] selectedChars, Vector exgroups)
+ String[] selectedChars, List<SequenceGroup> list)
{
// TODO: determine how to get/recover input data for group generation
- Hashtable gps = new Hashtable();
+ Map<String, List<SequenceI>> gps = new HashMap<String, List<SequenceI>>();
int width = 0, i;
- Hashtable pgroup = new Hashtable();
- if (exgroups != null)
+ Map<String, SequenceGroup> pgroup = new HashMap<String, SequenceGroup>();
+ if (list != null)
{
- SequenceGroup sg;
- for (Enumeration g = exgroups.elements(); g.hasMoreElements();)
+ for (SequenceGroup sg : list)
{
- sg = (SequenceGroup) g.nextElement();
- for (Enumeration sq = sg.getSequences(null).elements(); sq
- .hasMoreElements();)
- pgroup.put(sq.nextElement().toString(), sg);
+ for (SequenceI sq : sg.getSequences(null))
+ {
+ pgroup.put(sq.toString(), sg);
+ }
}
}
for (i = 0; i < sequences.length; i++)
{
String schar = selectedChars[i];
- SequenceGroup pgp = (SequenceGroup) pgroup
- .get(((Object) sequences[i]).toString());
+ SequenceGroup pgp = pgroup.get(((Object) sequences[i]).toString());
if (pgp != null)
{
schar = pgp.getName() + ":" + schar;
}
- Vector svec = (Vector) gps.get(schar);
+ List<SequenceI> svec = gps.get(schar);
if (svec == null)
{
- svec = new Vector();
+ svec = new ArrayList<SequenceI>();
gps.put(schar, svec);
}
if (width < sequences[i].getLength())
{
width = sequences[i].getLength();
}
- svec.addElement(sequences[i]);
+ svec.add(sequences[i]);
+ }
+ // make some groups
+ SequenceGroup[] groups = new SequenceGroup[gps.size()];
+ i = 0;
+ for (String key : gps.keySet())
+ {
+ SequenceGroup group = new SequenceGroup(gps.get(key), "Subseq: "
+ + key, null, true, true, false, 0, width - 1);
+
+ groups[i++] = group;
+ }
+ gps.clear();
+ pgroup.clear();
+ return groups;
+ }
+
+ /**
+ * Divide the given sequences based on the equivalence of characters at
+ * selected columns If exgroups is provided, existing groups will be
+ * subdivided.
+ *
+ * @param sequences
+ * @param columnSelection
+ * @param list
+ * @return
+ */
+ public static SequenceGroup[] makeGroupsFromCols(SequenceI[] sequences,
+ ColumnSelection cs, List<SequenceGroup> list)
+ {
+ // TODO: determine how to get/recover input data for group generation
+ Map<String, List<SequenceI>> gps = new HashMap<String, List<SequenceI>>();
+ Map<String, SequenceGroup> pgroup = new HashMap<String, SequenceGroup>();
+ if (list != null)
+ {
+ for (SequenceGroup sg : list)
+ {
+ for (SequenceI sq : sg.getSequences(null))
+ {
+ pgroup.put(sq.toString(), sg);
+ }
+ }
+ }
+ int[] spos = new int[cs.getSelected().size()];
+ int width = -1;
+ int i = 0;
+ for (Integer pos : cs.getSelected())
+ {
+ spos[i++] = pos.intValue();
+ }
+ ;
+ for (i = 0; i < sequences.length; i++)
+ {
+ int slen = sequences[i].getLength();
+ if (width < slen)
+ {
+ width = slen;
+ }
+
+ SequenceGroup pgp = pgroup.get(((Object) sequences[i]).toString());
+ StringBuilder schar = new StringBuilder();
+ if (pgp != null)
+ {
+ schar.append(pgp.getName() + ":");
+ }
+ for (int p : spos)
+ {
+ if (p >= slen)
+ {
+ schar.append("~");
+ }
+ else
+ {
+ schar.append(sequences[i].getCharAt(p));
+ }
+ }
+ List<SequenceI> svec = gps.get(schar.toString());
+ if (svec == null)
+ {
+ svec = new ArrayList<SequenceI>();
+ gps.put(schar.toString(), svec);
+ }
+ svec.add(sequences[i]);
}
// make some groups
- java.util.Enumeration sge = gps.keys();
SequenceGroup[] groups = new SequenceGroup[gps.size()];
i = 0;
- while (sge.hasMoreElements())
+ for (String key : gps.keySet())
{
- String key = (String) sge.nextElement();
- SequenceGroup group = new SequenceGroup((Vector) gps.get(key),
- "Subseq: " + key, null, true, true, false, 0, width - 1);
+ SequenceGroup group = new SequenceGroup(gps.get(key), "Subseq: "
+ + key, null, true, true, false, 0, width - 1);
groups[i++] = group;
}
diff --git a/src/jalview/analysis/NJTree.java b/src/jalview/analysis/NJTree.java
index e9e1cd7..e3a68ca 100644
--- a/src/jalview/analysis/NJTree.java
+++ b/src/jalview/analysis/NJTree.java
@@ -1,28 +1,40 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import java.util.*;
-
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.schemes.*;
-import jalview.util.*;
+import jalview.api.analysis.ScoreModelI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.BinaryNode;
+import jalview.datamodel.CigarArray;
+import jalview.datamodel.NodeTransformI;
+import jalview.datamodel.SeqCigar;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequenceNode;
+import jalview.io.NewickFile;
+import jalview.schemes.ResidueProperties;
+
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
/**
* DOCUMENT ME!
@@ -206,7 +218,7 @@ public class NJTree
* DOCUMENT ME!
*/
public NJTree(SequenceI[] sequence, AlignmentView seqData, String type,
- String pwtype, int start, int end)
+ String pwtype, ScoreModelI sm, int start, int end)
{
this.sequence = sequence;
this.node = new Vector();
@@ -233,7 +245,7 @@ public class NJTree
type = "AV";
}
- if (!(pwtype.equals("PID")))
+ if (sm == null && !(pwtype.equals("PID")))
{
if (ResidueProperties.getScoreMatrix(pwtype) == null)
{
@@ -253,8 +265,7 @@ public class NJTree
noseqs = i++;
- distance = findDistances(this.seqData
- .getSequenceStrings(Comparison.GapChars.charAt(0)));
+ distance = findDistances(sm);
// System.err.println("Made distances");// dbg
makeLeaves();
// System.err.println("Made leaves");// dbg
@@ -275,18 +286,18 @@ public class NJTree
{
jalview.io.NewickFile fout = new jalview.io.NewickFile(getTopNode());
- return fout.print(isHasBootstrap(),
- isHasDistances(), isHasRootDistance()); // output all data available for tree
+ return fout.print(isHasBootstrap(), isHasDistances(),
+ isHasRootDistance()); // output all data available for tree
}
/**
*
* used when the alignment associated to a tree has changed.
*
- * @param alignment
- * Vector
+ * @param list
+ * Sequence set to be associated with tree nodes
*/
- public void UpdatePlaceHolders(Vector alignment)
+ public void UpdatePlaceHolders(List<SequenceI> list)
{
Vector leaves = new Vector();
findLeaves(top, leaves);
@@ -299,7 +310,7 @@ public class NJTree
{
SequenceNode leaf = (SequenceNode) leaves.elementAt(i++);
- if (alignment.contains(leaf.element()))
+ if (list.contains(leaf.element()))
{
leaf.setPlaceholder(false);
}
@@ -308,11 +319,11 @@ public class NJTree
if (seqmatcher == null)
{
// Only create this the first time we need it
- SequenceI[] seqs = new SequenceI[alignment.size()];
+ SequenceI[] seqs = new SequenceI[list.size()];
for (int j = 0; j < seqs.length; j++)
{
- seqs[j] = (SequenceI) alignment.elementAt(j);
+ seqs[j] = list.get(j);
}
seqmatcher = new SequenceIdMatcher(seqs);
@@ -346,24 +357,29 @@ public class NJTree
}
}
}
+
/**
- * rename any nodes according to their associated sequence.
- * This will modify the tree's metadata! (ie the original NewickFile or newly generated BinaryTree's label data)
+ * rename any nodes according to their associated sequence. This will modify
+ * the tree's metadata! (ie the original NewickFile or newly generated
+ * BinaryTree's label data)
*/
- public void renameAssociatedNodes() {
- applyToNodes(new NodeTransformI() {
+ public void renameAssociatedNodes()
+ {
+ applyToNodes(new NodeTransformI()
+ {
@Override
public void transform(BinaryNode node)
{
Object el = node.element();
- if (el!=null && el instanceof SequenceI)
+ if (el != null && el instanceof SequenceI)
{
- node.setName(((SequenceI)el).getName());
+ node.setName(((SequenceI) el).getName());
}
}
});
}
+
/**
* DOCUMENT ME!
*/
@@ -710,100 +726,26 @@ public class NJTree
}
/**
- * DOCUMENT ME!
+ * Calculate a distance matrix given the sequence input data and score model
*
- * @return DOCUMENT ME!
+ * @return similarity matrix used to compute tree
*/
- public float[][] findDistances(String[] sequenceString)
+ public float[][] findDistances(ScoreModelI _pwmatrix)
{
- float[][] distance = new float[noseqs][noseqs];
- if (pwtype.equals("PID"))
- {
- for (int i = 0; i < (noseqs - 1); i++)
- {
- for (int j = i; j < noseqs; j++)
- {
- if (j == i)
- {
- distance[i][i] = 0;
- }
- else
- {
- distance[i][j] = 100 - Comparison.PID(sequenceString[i],
- sequenceString[j]);
-
- distance[j][i] = distance[i][j];
- }
- }
- }
- }
- else
+ float[][] distance = new float[noseqs][noseqs];
+ if (_pwmatrix == null)
{
- // Pairwise substitution score (with no gap penalties)
- ScoreMatrix pwmatrix = ResidueProperties.getScoreMatrix(pwtype);
- if (pwmatrix == null)
- {
- pwmatrix = ResidueProperties.getScoreMatrix("BLOSUM62");
- }
- int maxscore = 0;
- int end = sequenceString[0].length();
- for (int i = 0; i < (noseqs - 1); i++)
+ // Resolve substitution model
+ _pwmatrix = ResidueProperties.getScoreModel(pwtype);
+ if (_pwmatrix == null)
{
- for (int j = i; j < noseqs; j++)
- {
- int score = 0;
-
- for (int k = 0; k < end; k++)
- {
- try
- {
- score += pwmatrix.getPairwiseScore(
- sequenceString[i].charAt(k),
- sequenceString[j].charAt(k));
- } catch (Exception ex)
- {
- System.err.println("err creating BLOSUM62 tree");
- ex.printStackTrace();
- }
- }
-
- distance[i][j] = (float) score;
-
- if (score > maxscore)
- {
- maxscore = score;
- }
- }
+ _pwmatrix = ResidueProperties.getScoreMatrix("BLOSUM62");
}
-
- for (int i = 0; i < (noseqs - 1); i++)
- {
- for (int j = i; j < noseqs; j++)
- {
- distance[i][j] = (float) maxscore - distance[i][j];
- distance[j][i] = distance[i][j];
- }
- }
-
}
+ distance = _pwmatrix.findDistances(seqData);
return distance;
- // else
- /*
- * else if (pwtype.equals("SW")) { float max = -1;
- *
- * for (int i = 0; i < (noseqs - 1); i++) { for (int j = i; j < noseqs; j++)
- * { AlignSeq as = new AlignSeq(sequence[i], sequence[j], "pep");
- * as.calcScoreMatrix(); as.traceAlignment(); as.printAlignment(System.out);
- * distance[i][j] = (float) as.maxscore;
- *
- * if (max < distance[i][j]) { max = distance[i][j]; } } }
- *
- * for (int i = 0; i < (noseqs - 1); i++) { for (int j = i; j < noseqs; j++)
- * { distance[i][j] = max - distance[i][j]; distance[j][i] = distance[i][j];
- * } } }/
- */
}
/**
@@ -925,12 +867,12 @@ public class NJTree
{
System.out
.println("Leaf = " + ((SequenceI) node.element()).getName());
- System.out.println("Dist " + ((SequenceNode) node).dist);
+ System.out.println("Dist " + node.dist);
System.out.println("Boot " + node.getBootstrap());
}
else
{
- System.out.println("Dist " + ((SequenceNode) node).dist);
+ System.out.println("Dist " + node.dist);
printNode((SequenceNode) node.left());
printNode((SequenceNode) node.right());
}
@@ -951,11 +893,11 @@ public class NJTree
if ((node.left() == null) && (node.right() == null))
{
- float dist = ((SequenceNode) node).dist;
+ float dist = node.dist;
if (dist > maxDistValue)
{
- maxdist = (SequenceNode) node;
+ maxdist = node;
maxDistValue = dist;
}
}
@@ -1157,9 +1099,8 @@ public class NJTree
+ ((SequenceI) node.element()).getName());
}
- System.out.println(" dist = " + ((SequenceNode) node).dist + " "
- + ((SequenceNode) node).count + " "
- + ((SequenceNode) node).height);
+ System.out.println(" dist = " + node.dist + " " + node.count + " "
+ + node.height);
}
/**
@@ -1205,13 +1146,13 @@ public class NJTree
SequenceNode l = (SequenceNode) node.left();
SequenceNode r = (SequenceNode) node.right();
- ((SequenceNode) node).count = l.count + r.count;
- ((SequenceNode) node).ycount = (l.ycount + r.ycount) / 2;
+ node.count = l.count + r.count;
+ node.ycount = (l.ycount + r.ycount) / 2;
}
else
{
- ((SequenceNode) node).count = 1;
- ((SequenceNode) node).ycount = ycount++;
+ node.count = 1;
+ node.ycount = ycount++;
}
_lycount--;
}
@@ -1350,7 +1291,9 @@ public class NJTree
{
for (Enumeration nodes = node.elements(); nodes.hasMoreElements(); nodeTransformI
.transform((BinaryNode) nodes.nextElement()))
+ {
;
+ }
}
}
diff --git a/src/jalview/analysis/PCA.java b/src/jalview/analysis/PCA.java
index ff4ed38..ace4ca4 100644
--- a/src/jalview/analysis/PCA.java
+++ b/src/jalview/analysis/PCA.java
@@ -1,26 +1,32 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import java.io.*;
+import jalview.datamodel.BinarySequence;
+import jalview.datamodel.BinarySequence.InvalidSequenceTypeException;
+import jalview.math.Matrix;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.ScoreMatrix;
-import jalview.datamodel.*;
-import jalview.math.*;
+import java.io.PrintStream;
/**
* Performs Principal Component Analysis on given sequences
@@ -43,31 +49,75 @@ public class PCA implements Runnable
StringBuffer details = new StringBuffer();
/**
- * Creates a new PCA object.
+ * Creates a new PCA object. By default, uses blosum62 matrix to generate
+ * sequence similarity matrices
*
* @param s
- * Set of sequences to perform PCA on
+ * Set of amino acid sequences to perform PCA on
*/
public PCA(String[] s)
{
+ this(s, false);
+ }
+
+ /**
+ * Creates a new PCA object. By default, uses blosum62 matrix to generate
+ * sequence similarity matrices
+ *
+ * @param s
+ * Set of sequences to perform PCA on
+ * @param nucleotides
+ * if true, uses standard DNA/RNA matrix for sequence similarity
+ * calculation.
+ */
+ public PCA(String[] s, boolean nucleotides)
+ {
+ this(s, nucleotides, null);
+ }
+
+ public PCA(String[] s, boolean nucleotides, String s_m)
+ {
BinarySequence[] bs = new BinarySequence[s.length];
int ii = 0;
while ((ii < s.length) && (s[ii] != null))
{
- bs[ii] = new BinarySequence(s[ii]);
+ bs[ii] = new BinarySequence(s[ii], nucleotides);
bs[ii].encode();
ii++;
}
BinarySequence[] bs2 = new BinarySequence[s.length];
ii = 0;
-
+ ScoreMatrix smtrx = null;
+ String sm = s_m;
+ if (sm != null)
+ {
+ smtrx = ResidueProperties.getScoreMatrix(sm);
+ }
+ if (smtrx == null)
+ {
+ // either we were given a non-existent score matrix or a scoremodel that
+ // isn't based on a pairwise symbol score matrix
+ smtrx = ResidueProperties.getScoreMatrix(sm = (nucleotides ? "DNA"
+ : "BLOSUM62"));
+ }
+ details.append("PCA calculation using " + sm
+ + " sequence similarity matrix\n========\n\n");
while ((ii < s.length) && (s[ii] != null))
{
- bs2[ii] = new BinarySequence(s[ii]);
- bs2[ii].blosumEncode();
+ bs2[ii] = new BinarySequence(s[ii], nucleotides);
+ if (smtrx != null)
+ {
+ try
+ {
+ bs2[ii].matrixEncode(smtrx);
+ } catch (InvalidSequenceTypeException x)
+ {
+ details.append("Unexpected mismatch of sequence type and score matrix. Calculation will not be valid!\n\n");
+ }
+ }
ii++;
}
@@ -204,12 +254,6 @@ public class PCA implements Runnable
*/
public void run()
{
- Matrix mt = m.transpose();
-
- details.append(" --- OrigT * Orig ---- \n");
- // eigenvector = mt.preMultiply(m); // standard seqspace comparison matrix
- eigenvector = mt.preMultiply(m2); // jalview variation on seqsmace method
-
PrintStream ps = new PrintStream(System.out)
{
public void print(String x)
@@ -223,22 +267,47 @@ public class PCA implements Runnable
}
};
- eigenvector.print(ps);
+ try
+ {
+ details.append("PCA Calculation Mode is "
+ + (jvCalcMode ? "Jalview variant" : "Original SeqSpace")
+ + "\n");
+ Matrix mt = m.transpose();
- symm = eigenvector.copy();
+ details.append(" --- OrigT * Orig ---- \n");
+ if (!jvCalcMode)
+ {
+ eigenvector = mt.preMultiply(m); // standard seqspace comparison matrix
+ }
+ else
+ {
+ eigenvector = mt.preMultiply(m2); // jalview variation on seqsmace
+ // method
+ }
- eigenvector.tred();
+ eigenvector.print(ps);
- details.append(" ---Tridiag transform matrix ---\n");
- details.append(" --- D vector ---\n");
- eigenvector.printD(ps);
- ps.println();
- details.append("--- E vector ---\n");
- eigenvector.printE(ps);
- ps.println();
+ symm = eigenvector.copy();
+
+ eigenvector.tred();
+
+ details.append(" ---Tridiag transform matrix ---\n");
+ details.append(" --- D vector ---\n");
+ eigenvector.printD(ps);
+ ps.println();
+ details.append("--- E vector ---\n");
+ eigenvector.printE(ps);
+ ps.println();
- // Now produce the diagonalization matrix
- eigenvector.tqli();
+ // Now produce the diagonalization matrix
+ eigenvector.tqli();
+ } catch (Exception q)
+ {
+ q.printStackTrace();
+ details.append("\n*** Unexpected exception when performing PCA ***\n"
+ + q.getLocalizedMessage());
+ details.append("*** Matrices below may not be fully diagonalised. ***\n");
+ }
details.append(" --- New diagonalization matrix ---\n");
eigenvector.print(ps);
@@ -252,4 +321,11 @@ public class PCA implements Runnable
* ps.print(","+component(seq, ev)); } ps.println(); }
*/
}
+
+ boolean jvCalcMode = true;
+
+ public void setJvCalcMode(boolean calcMode)
+ {
+ this.jvCalcMode = calcMode;
+ }
}
diff --git a/src/jalview/analysis/ParseProperties.java b/src/jalview/analysis/ParseProperties.java
index 3649a29..d186fc8 100644
--- a/src/jalview/analysis/ParseProperties.java
+++ b/src/jalview/analysis/ParseProperties.java
@@ -1,25 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import com.stevesoft.pat.Regex;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import com.stevesoft.pat.Regex;
public class ParseProperties
{
@@ -52,9 +57,8 @@ public class ParseProperties
public int getScoresFromDescription(String ScoreName,
String ScoreDescriptions, String regex, boolean repeat)
{
- return getScoresFromDescription(new String[]
- { ScoreName }, new String[]
- { ScoreDescriptions }, regex, repeat);
+ return getScoresFromDescription(new String[] { ScoreName },
+ new String[] { ScoreDescriptions }, regex, repeat);
}
public int getScoresFromDescription(String[] ScoreNames,
@@ -98,7 +102,9 @@ public class ParseProperties
ScoreNames = tnames;
String descrbase = ScoreDescriptions[onamelen - 1];
if (descrbase == null)
+ {
descrbase = "Score parsed from (" + regex + ")";
+ }
tnames = new String[pattern.numSubs() + 1];
System.arraycopy(ScoreDescriptions, 0, tnames, 0,
ScoreDescriptions.length);
@@ -113,7 +119,9 @@ public class ParseProperties
{
String descr = seqs[i].getDescription();
if (descr == null)
+ {
continue;
+ }
int pos = 0;
boolean added = false;
int reps = 0;
@@ -137,7 +145,8 @@ public class ParseProperties
+ ((reps > 0) ? "_" + reps : ""),
ScoreDescriptions[cols], null);
an.setScore(score);
- System.out.println("Score: " + ScoreNames[cols] + "=" + score); // DEBUG
+ System.out.println(seqs[i].getName() + " score: '"
+ + ScoreNames[cols] + "' = " + score); // DEBUG
an.setSequenceRef(seqs[i]);
seqs[i].addAlignmentAnnotation(an);
al.addAnnotation(an);
@@ -152,29 +161,4 @@ public class ParseProperties
}
return count;
}
-
- public static void main(String argv[])
- {
- SequenceI[] seqs = new SequenceI[]
- { new Sequence("sq1", "THISISAPLACEHOLDER"),
- new Sequence("sq2", "THISISAPLACEHOLDER"),
- new Sequence("sq3", "THISISAPLACEHOLDER"),
- new Sequence("sq4", "THISISAPLACEHOLDER") };
- seqs[0].setDescription("1 mydescription1");
- seqs[1].setDescription("mydescription2");
- seqs[2].setDescription("2. 0.1 mydescription3");
- seqs[3].setDescription("3 0.01 mydescription4");
- // seqs[4].setDescription("5 mydescription5");
- Alignment al = new Alignment(seqs);
- ParseProperties pp = new ParseProperties(al);
- String regex = ".*([-0-9.+]+)";
- System.out.println("Matched "
- + pp.getScoresFromDescription("my Score",
- "my Score Description", regex, true) + " for " + regex);
- regex = ".*([-0-9.+]+).+([-0-9.+]+).*";
- System.out.println("Matched "
- + pp.getScoresFromDescription("my Score",
- "my Score Description", regex, true) + " for " + regex);
- System.out.println("Finished.");
- }
}
diff --git a/src/jalview/analysis/Rna.java b/src/jalview/analysis/Rna.java
new file mode 100644
index 0000000..588ea6e
--- /dev/null
+++ b/src/jalview/analysis/Rna.java
@@ -0,0 +1,284 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+/* Author: Lauren Michelle Lui
+ * Methods are based on RALEE methods http://personalpages.manchester.ac.uk/staff/sam.griffiths-jones/software/ralee/
+ * Additional Author: Jan Engelhart (2011) - Structure consensus and bug fixing
+ * Additional Author: Anne Menard (2012) - Pseudoknot support and secondary structure consensus
+ * */
+
+package jalview.analysis;
+
+import jalview.analysis.SecStrConsensus.SimpleBP;
+import jalview.datamodel.SequenceFeature;
+import jalview.util.MessageManager;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Stack;
+import java.util.Vector;
+
+public class Rna
+{
+
+ static Hashtable<Integer, Integer> pairHash = new Hashtable();
+
+ private static final Character[] openingPars = { '(', '[', '{', '<', 'A',
+ 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
+
+ private static final Character[] closingPars = { ')', ']', '}', '>', 'a',
+ 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
+
+ private static HashSet<Character> openingParsSet = new HashSet<Character>(
+ Arrays.asList(openingPars));
+
+ private static HashSet<Character> closingParsSet = new HashSet<Character>(
+ Arrays.asList(closingPars));
+
+ private static Hashtable<Character, Character> closingToOpening = new Hashtable<Character, Character>()
+ // Initializing final data structure
+ {
+ private static final long serialVersionUID = 1L;
+ {
+ for (int i = 0; i < openingPars.length; i++)
+ {
+ // System.out.println(closingPars[i] + "->" + openingPars[i]);
+ put(closingPars[i], openingPars[i]);
+ }
+ }
+ };
+
+ private static boolean isOpeningParenthesis(char c)
+ {
+ return openingParsSet.contains(c);
+ }
+
+ private static boolean isClosingParenthesis(char c)
+ {
+ return closingParsSet.contains(c);
+ }
+
+ private static char matchingOpeningParenthesis(char closingParenthesis)
+ throws WUSSParseException
+ {
+ if (!isClosingParenthesis(closingParenthesis))
+ {
+ throw new WUSSParseException(
+ MessageManager.formatMessage(
+ "exception.querying_matching_opening_parenthesis_for_non_closing_parenthesis",
+ new String[] { new StringBuffer(closingParenthesis)
+ .toString() }), -1);
+ }
+
+ return closingToOpening.get(closingParenthesis);
+ }
+
+ /**
+ * Based off of RALEE code ralee-get-base-pairs. Keeps track of open bracket
+ * positions in "stack" vector. When a close bracket is reached, pair this
+ * with the last element in the "stack" vector and store in "pairs" vector.
+ * Remove last element in the "stack" vector. Continue in this manner until
+ * the whole string is processed.
+ *
+ * @param line
+ * Secondary structure line of an RNA Stockholm file
+ * @return Array of SequenceFeature; type = RNA helix, begin is open base
+ * pair, end is close base pair
+ */
+ public static Vector<SimpleBP> GetSimpleBPs(CharSequence line)
+ throws WUSSParseException
+ {
+ Hashtable<Character, Stack<Integer>> stacks = new Hashtable<Character, Stack<Integer>>();
+ Vector<SimpleBP> pairs = new Vector<SimpleBP>();
+ int i = 0;
+ while (i < line.length())
+ {
+ char base = line.charAt(i);
+
+ if (isOpeningParenthesis(base))
+ {
+ if (!stacks.containsKey(base))
+ {
+ stacks.put(base, new Stack<Integer>());
+ }
+ stacks.get(base).push(i);
+
+ }
+ else if (isClosingParenthesis(base))
+ {
+
+ char opening = matchingOpeningParenthesis(base);
+
+ if (!stacks.containsKey(opening))
+ {
+ throw new WUSSParseException(MessageManager.formatMessage(
+ "exception.mismatched_unseen_closing_char",
+ new String[] { new StringBuffer(base).toString() }), i);
+ }
+
+ Stack<Integer> stack = stacks.get(opening);
+ if (stack.isEmpty())
+ {
+ // error whilst parsing i'th position. pass back
+ throw new WUSSParseException(MessageManager.formatMessage(
+ "exception.mismatched_closing_char",
+ new String[] { new StringBuffer(base).toString() }), i);
+ }
+ int temp = stack.pop();
+
+ pairs.add(new SimpleBP(temp, i));
+ }
+ i++;
+ }
+ for (char opening : stacks.keySet())
+ {
+ Stack<Integer> stack = stacks.get(opening);
+ if (!stack.empty())
+ {
+ throw new WUSSParseException(MessageManager.formatMessage(
+ "exception.mismatched_opening_char",
+ new String[] { new StringBuffer(opening).toString(),
+ Integer.valueOf(stack.pop()).toString() }), i);
+ }
+ }
+ return pairs;
+ }
+
+ public static SequenceFeature[] GetBasePairs(CharSequence line)
+ throws WUSSParseException
+ {
+ Vector<SimpleBP> bps = GetSimpleBPs(line);
+ SequenceFeature[] outPairs = new SequenceFeature[bps.size()];
+ for (int p = 0; p < bps.size(); p++)
+ {
+ SimpleBP bp = bps.elementAt(p);
+ outPairs[p] = new SequenceFeature("RNA helix", "", "", bp.getBP5(),
+ bp.getBP3(), "");
+ }
+ return outPairs;
+ }
+
+ public static ArrayList<SimpleBP> GetModeleBP(CharSequence line)
+ throws WUSSParseException
+ {
+ Vector<SimpleBP> bps = GetSimpleBPs(line);
+ return new ArrayList<SimpleBP>(bps);
+ }
+
+ /**
+ * Function to get the end position corresponding to a given start position
+ *
+ * @param indice
+ * - start position of a base pair
+ * @return - end position of a base pair
+ */
+ /*
+ * makes no sense at the moment :( public int findEnd(int indice){ //TODO:
+ * Probably extend this to find the start to a given end? //could be done by
+ * putting everything twice to the hash ArrayList<Integer> pair = new
+ * ArrayList<Integer>(); return pairHash.get(indice); }
+ */
+
+ /**
+ * Figures out which helix each position belongs to and stores the helix
+ * number in the 'featureGroup' member of a SequenceFeature Based off of RALEE
+ * code ralee-helix-map.
+ *
+ * @param pairs
+ * Array of SequenceFeature (output from Rna.GetBasePairs)
+ */
+ public static void HelixMap(SequenceFeature[] pairs)
+ {
+
+ int helix = 0; // Number of helices/current helix
+ int lastopen = 0; // Position of last open bracket reviewed
+ int lastclose = 9999999; // Position of last close bracket reviewed
+ int i = pairs.length; // Number of pairs
+
+ int open; // Position of an open bracket under review
+ int close; // Position of a close bracket under review
+ int j; // Counter
+
+ Hashtable helices = new Hashtable(); // Keep track of helix number for each
+ // position
+
+ // Go through each base pair and assign positions a helix
+ for (i = 0; i < pairs.length; i++)
+ {
+
+ open = pairs[i].getBegin();
+ close = pairs[i].getEnd();
+
+ // System.out.println("open " + open + " close " + close);
+ // System.out.println("lastclose " + lastclose + " lastopen " + lastopen);
+
+ // we're moving from right to left based on closing pair
+ /*
+ * catch things like <<..>>..<<..>> |
+ */
+ if (open > lastclose)
+ {
+ helix++;
+ }
+
+ /*
+ * catch things like <<..<<..>>..<<..>>>> |
+ */
+ j = pairs.length - 1;
+ while (j >= 0)
+ {
+ int popen = pairs[j].getBegin();
+
+ // System.out.println("j " + j + " popen " + popen + " lastopen "
+ // +lastopen + " open " + open);
+ if ((popen < lastopen) && (popen > open))
+ {
+ if (helices.containsValue(popen)
+ && (((Integer) helices.get(popen)) == helix))
+ {
+ continue;
+ }
+ else
+ {
+ helix++;
+ break;
+ }
+ }
+
+ j -= 1;
+ }
+
+ // Put positions and helix information into the hashtable
+ helices.put(open, helix);
+ helices.put(close, helix);
+
+ // Record helix as featuregroup
+ pairs[i].setFeatureGroup(Integer.toString(helix));
+
+ lastopen = open;
+ lastclose = close;
+
+ }
+ }
+}
diff --git a/src/jalview/analysis/SecStrConsensus.java b/src/jalview/analysis/SecStrConsensus.java
new file mode 100644
index 0000000..bf75811
--- /dev/null
+++ b/src/jalview/analysis/SecStrConsensus.java
@@ -0,0 +1,254 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+public class SecStrConsensus
+{
+
+ /**
+ * Internal class to represent a simple base-pair.
+ *
+ * @author Yawn [JBPNote: ^^ is that Anne Menard or Ya(w)nn Ponty, I wonder !
+ * ]
+ */
+ public static class SimpleBP
+ {
+ int bp5;
+
+ int bp3;
+
+ public SimpleBP()
+ {
+
+ }
+
+ public SimpleBP(int i5, int i3)
+ {
+ bp5 = i5;
+ bp3 = i3;
+ }
+
+ public void setBP5(int i5)
+ {
+ bp5 = i5;
+ }
+
+ public void setBP3(int i3)
+ {
+ bp3 = i3;
+ }
+
+ public int getBP5()
+ {
+ return bp5;
+ }
+
+ public int getBP3()
+ {
+ return bp3;
+ }
+
+ public String toString()
+ {
+ return "(" + bp5 + "," + bp3 + ")";
+ }
+
+ }
+
+ public static int[] extractConsensus(ArrayList<ArrayList<SimpleBP>> bps)
+ {
+ // We do not currently know the length of the alignment
+ // => Estimate it as the biggest index of a base-pair plus one.
+ int maxlength = 0;
+ for (ArrayList<SimpleBP> strs : bps)
+ {
+ for (SimpleBP bp : strs)
+ {
+
+ maxlength = Math.max(1 + Math.max(bp.bp5, bp.bp3), maxlength);
+
+ }
+ }
+ // Now we have a good estimate for length, allocate and initialize data
+ // to be fed to the dynamic programming procedure.
+ ArrayList<Hashtable<Integer, Double>> seq = new ArrayList<Hashtable<Integer, Double>>();
+ for (int i = 0; i < maxlength; i++)
+ {
+ seq.add(new Hashtable<Integer, Double>());
+ }
+ for (ArrayList<SimpleBP> strs : bps)
+ {
+ for (SimpleBP bp : strs)
+ {
+ int i = bp.bp5;
+ int j = bp.bp3;
+ Hashtable<Integer, Double> h = seq.get(i);
+ if (!h.containsKey(j))
+ {
+ h.put(j, 0.0);
+ }
+ h.put(j, h.get(j) + 1.);
+ }
+ }
+ // At this point, seq contains, at each position i, a hashtable which
+ // associates,
+ // to each possible end j, the number of time a base-pair (i,j) occurs in
+ // the alignment
+
+ // We can now run the dynamic programming procedure on this data
+ double[][] mat = fillMatrix(seq);
+ ArrayList<SimpleBP> res = backtrack(mat, seq);
+
+ // Convert it to an array, ie finalres[i] = j >= 0 iff a base-pair (i,j) is
+ // present
+ // in the consensus, or -1 otherwise
+ int[] finalres = new int[seq.size()];
+ for (int i = 0; i < seq.size(); i++)
+ {
+ finalres[i] = -1;
+ }
+ for (SimpleBP bp : res)
+ {
+ finalres[bp.bp5] = bp.bp3;
+ finalres[bp.bp3] = bp.bp5;
+ }
+
+ return finalres;
+ }
+
+ private static boolean canBasePair(
+ ArrayList<Hashtable<Integer, Double>> seq, int i, int k)
+ {
+ return seq.get(i).containsKey(k);
+ }
+
+ // Returns the score of a potential base-pair, ie the number of structures in
+ // which it is found.
+ private static double basePairScore(
+ ArrayList<Hashtable<Integer, Double>> seq, int i, int k)
+ {
+ return seq.get(i).get(k);
+ }
+
+ private static double[][] fillMatrix(
+ ArrayList<Hashtable<Integer, Double>> seq)
+ {
+ int n = seq.size();
+ double[][] tab = new double[n][n];
+ for (int m = 1; m <= n; m++)
+ {
+ for (int i = 0; i < n - m + 1; i++)
+ {
+ int j = i + m - 1;
+ tab[i][j] = 0;
+ if (i < j)
+ {
+ tab[i][j] = Math.max(tab[i][j], tab[i + 1][j]);
+ for (int k = i + 1; k <= j; k++)
+ {
+ if (canBasePair(seq, i, k))
+ {
+ double fact1 = 0;
+ if (k > i + 1)
+ {
+ fact1 = tab[i + 1][k - 1];
+ }
+ double fact2 = 0;
+ if (k < j)
+ {
+ fact2 = tab[k + 1][j];
+ }
+ tab[i][j] = Math.max(tab[i][j], basePairScore(seq, i, k)
+ + fact1 + fact2);
+ }
+ }
+ }
+ }
+ }
+ return tab;
+ }
+
+ private static ArrayList<SimpleBP> backtrack(double[][] tab,
+ ArrayList<Hashtable<Integer, Double>> seq)
+ {
+ return backtrack(tab, seq, 0, seq.size() - 1);
+ }
+
+ private static ArrayList<SimpleBP> backtrack(double[][] tab,
+ ArrayList<Hashtable<Integer, Double>> seq, int i, int j)
+ {
+ ArrayList<SimpleBP> result = new ArrayList<SimpleBP>();
+ if (i < j)
+ {
+ ArrayList<Integer> indices = new ArrayList<Integer>();
+ indices.add(-1);
+ for (int k = i + 1; k <= j; k++)
+ {
+ indices.add(k);
+ }
+ for (int k : indices)
+ {
+ if (k == -1)
+ {
+ if (tab[i][j] == tab[i + 1][j])
+ {
+ result = backtrack(tab, seq, i + 1, j);
+ }
+ }
+ else
+ {
+ if (canBasePair(seq, i, k))
+ {
+ double fact1 = 0;
+ if (k > i + 1)
+ {
+ fact1 = tab[i + 1][k - 1];
+ }
+ double fact2 = 0;
+ if (k < j)
+ {
+ fact2 = tab[k + 1][j];
+ }
+ if (tab[i][j] == basePairScore(seq, i, k) + fact1 + fact2)
+ {
+ result = backtrack(tab, seq, i + 1, k - 1);
+ result.addAll(backtrack(tab, seq, k + 1, j));
+ result.add(new SimpleBP(i, k));
+ }
+ }
+ }
+ }
+ }
+ else if (i == j)
+ {
+
+ }
+ else
+ {
+
+ }
+ return result;
+ }
+
+}
diff --git a/src/jalview/analysis/SeqsetUtils.java b/src/jalview/analysis/SeqsetUtils.java
index f28fa05..c742892 100644
--- a/src/jalview/analysis/SeqsetUtils.java
+++ b/src/jalview/analysis/SeqsetUtils.java
@@ -1,25 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import java.util.*;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
public class SeqsetUtils
{
@@ -52,8 +60,9 @@ public class SeqsetUtils
}
}
sqinfo.put("SeqFeatures", sfeat);
- sqinfo.put("PdbId", (seq.getPDBId() != null) ? seq.getPDBId()
- : new Vector());
+ sqinfo.put("PdbId",
+ (seq.getAllPDBEntries() != null) ? seq.getAllPDBEntries()
+ : new Vector<PDBEntry>());
sqinfo.put("datasetSequence",
(seq.getDatasetSequence() != null) ? seq.getDatasetSequence()
: new Sequence("THISISAPLACEHOLDER", ""));
@@ -81,7 +90,7 @@ public class SeqsetUtils
Integer start = (Integer) sqinfo.get("Start");
Integer end = (Integer) sqinfo.get("End");
Vector sfeatures = (Vector) sqinfo.get("SeqFeatures");
- Vector pdbid = (Vector) sqinfo.get("PdbId");
+ Vector<PDBEntry> pdbid = (Vector<PDBEntry>) sqinfo.get("PdbId");
String description = (String) sqinfo.get("Description");
Sequence seqds = (Sequence) sqinfo.get("datasetSequence");
if (oldname == null)
diff --git a/src/jalview/analysis/SequenceIdMatcher.java b/src/jalview/analysis/SequenceIdMatcher.java
index a8ce33d..c029ea9 100644
--- a/src/jalview/analysis/SequenceIdMatcher.java
+++ b/src/jalview/analysis/SequenceIdMatcher.java
@@ -1,25 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.analysis;
-import java.util.*;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Vector;
/**
* Routines for approximate Sequence Id resolution by name using string
@@ -29,26 +37,42 @@ import jalview.datamodel.*;
*/
public class SequenceIdMatcher
{
- private Hashtable names;
+ private HashMap<SeqIdName, SequenceI> names;
+
+ public SequenceIdMatcher(List<SequenceI> seqs)
+ {
+ names = new HashMap<SeqIdName, SequenceI>();
+ addAll(seqs);
+ }
- public SequenceIdMatcher(SequenceI[] seqs)
+ /**
+ * add more sequences to this matcher - also used by the constructor
+ *
+ * @param seqs
+ */
+ public void addAll(List<SequenceI> seqs)
{
- names = new Hashtable();
- for (int i = 0; i < seqs.length; i++)
+ for (SequenceI seq : seqs)
{
- // TODO: deal with ID collisions - SequenceI should be appended to list associated with this key.
- names.put(new SeqIdName(seqs[i].getDisplayId(true)), seqs[i]);
+ // TODO: deal with ID collisions - SequenceI should be appended to list
+ // associated with this key.
+ names.put(new SeqIdName(seq.getDisplayId(true)), seq);
+ SequenceI dbseq = seq;
+ while (dbseq.getDatasetSequence() != null)
+ {
+ dbseq = dbseq.getDatasetSequence();
+ }
// add in any interesting identifiers
- if (seqs[i].getDBRef() != null)
+ if (dbseq.getDBRef() != null)
{
- DBRefEntry dbr[] = seqs[i].getDBRef();
+ DBRefEntry dbr[] = dbseq.getDBRef();
SeqIdName sid = null;
for (int r = 0; r < dbr.length; r++)
{
sid = new SeqIdName(dbr[r].getAccessionId());
- if (!names.contains(sid))
+ if (!names.containsKey(sid))
{
- names.put(sid, seqs[i]);
+ names.put(sid, seq);
}
}
}
@@ -56,20 +80,32 @@ public class SequenceIdMatcher
}
/**
+ * convenience method to make a matcher from concrete array
+ *
+ * @param sequences
+ */
+ public SequenceIdMatcher(SequenceI[] sequences)
+ {
+ this(Arrays.asList(sequences));
+ }
+
+ /**
* returns the closest SequenceI in matches to SeqIdName and returns all the
* matches to the names hash.
*
* @param candName
* SeqIdName
* @param matches
- * Vector of SequenceI objects
+ * List of SequenceI objects
* @return SequenceI closest SequenceI to SeqIdName
*/
- private SequenceI pickbestMatch(SeqIdName candName, Vector matches)
+ private SequenceI pickbestMatch(SeqIdName candName,
+ List<SequenceI> matches)
{
- SequenceI[] st= pickbestMatches(candName, matches);
- return st==null || st.length==0 ? null : st[0];
+ List<SequenceI> st = pickbestMatches(candName, matches);
+ return st == null || st.size() == 0 ? null : st.get(0);
}
+
/**
* returns the closest SequenceI in matches to SeqIdName and returns all the
* matches to the names hash.
@@ -78,18 +114,18 @@ public class SequenceIdMatcher
* SeqIdName
* @param matches
* Vector of SequenceI objects
- * @return Object[] { SequenceI closest SequenceI to SeqIdName, SequenceI[] ties }
+ * @return Object[] { SequenceI closest SequenceI to SeqIdName, SequenceI[]
+ * ties }
*/
- private SequenceI[] pickbestMatches(SeqIdName candName, Vector matches)
+ private List<SequenceI> pickbestMatches(SeqIdName candName,
+ List<SequenceI> matches)
{
- ArrayList best=new ArrayList();
- SequenceI match = null;
+ ArrayList<SequenceI> best = new ArrayList<SequenceI>();
if (candName == null || matches == null || matches.size() == 0)
{
return null;
}
- match = (SequenceI) matches.elementAt(0);
- matches.removeElementAt(0);
+ SequenceI match = matches.remove(0);
best.add(match);
names.put(new SeqIdName(match.getName()), match);
int matchlen = match.getName().length();
@@ -97,12 +133,12 @@ public class SequenceIdMatcher
while (matches.size() > 0)
{
// look through for a better one.
- SequenceI cand = (SequenceI) matches.elementAt(0);
- matches.remove(0);
+ SequenceI cand = matches.remove(0);
names.put(new SeqIdName(cand.getName()), cand);
- int q,w,candlen = cand.getName().length();
+ int q, w, candlen = cand.getName().length();
// keep the one with an id 'closer' to the given seqnam string
- if ((q=Math.abs(matchlen - namlen)) > (w=Math.abs(candlen - namlen))
+ if ((q = Math.abs(matchlen - namlen)) > (w = Math.abs(candlen
+ - namlen))
&& candlen > matchlen)
{
best.clear();
@@ -110,14 +146,18 @@ public class SequenceIdMatcher
matchlen = candlen;
best.add(match);
}
- if (q==w && candlen==matchlen)
+ if (q == w && candlen == matchlen)
{
// record any ties
best.add(cand);
}
}
- if (best.size()==0) { return null; };
- return (SequenceI[]) best.toArray(new SequenceI[0]);
+ if (best.size() == 0)
+ {
+ return null;
+ }
+ ;
+ return best;
}
/**
@@ -140,14 +180,22 @@ public class SequenceIdMatcher
}
/**
- * Find all matches for a given sequence name.
- * @param seqnam string to query Matcher with.
+ * Find all matches for a given sequence name.
+ *
+ * @param seqnam
+ * string to query Matcher with.
+ * @return a new array or (possibly) null
*/
public SequenceI[] findAllIdMatches(String seqnam)
{
SeqIdName nam = new SeqIdName(seqnam);
- return findAllIdMatches(nam);
+ List<SequenceI> m = findAllIdMatches(nam);
+ if (m != null)
+ {
+ return m.toArray(new SequenceI[m.size()]);
+ }
+ return null;
}
/**
@@ -204,6 +252,7 @@ public class SequenceIdMatcher
}
return pickbestMatch(nam, matches);
}
+
/**
* core findIdMatch search method for finding all equivalent matches
*
@@ -211,19 +260,18 @@ public class SequenceIdMatcher
* SeqIdName
* @return SequenceI[]
*/
- private SequenceI[] findAllIdMatches(
+ private List<SequenceI> findAllIdMatches(
jalview.analysis.SequenceIdMatcher.SeqIdName nam)
{
- Vector matches = new Vector();
+ ArrayList<SequenceI> matches = new ArrayList<SequenceI>();
while (names.containsKey(nam))
{
- matches.addElement(names.remove(nam));
+ matches.add(names.remove(nam));
}
- SequenceI[] r=pickbestMatches(nam, matches);
+ List<SequenceI> r = pickbestMatches(nam, matches);
return r;
}
-
private class SeqIdName
{
String id;
@@ -240,14 +288,20 @@ public class SequenceIdMatcher
}
}
+ @Override
public int hashCode()
{
return ((id.length() >= 4) ? id.substring(0, 4).hashCode() : id
.hashCode());
}
+ @Override
public boolean equals(Object s)
{
+ if (s == null)
+ {
+ return false;
+ }
if (s instanceof SeqIdName)
{
return this.equals((SeqIdName) s);
@@ -269,7 +323,8 @@ public class SequenceIdMatcher
* arbritrarily extended sequence id's (like portions of an aligned set of
* repeats from one sequence)
*/
- private String WORD_SEP = "~. |#\\/<>!\""+((char)0x00A4)+"$%^*)}[@',?_";
+ private String WORD_SEP = "~. |#\\/<>!\"" + ((char) 0x00A4)
+ + "$%^*)}[@',?_";
/**
* matches if one ID properly contains another at a whitespace boundary.
@@ -282,7 +337,8 @@ public class SequenceIdMatcher
*/
public boolean equals(SeqIdName s)
{
- // TODO: JAL-732 patch for cases when name includes a list of IDs, and the match contains one ID flanked
+ // TODO: JAL-732 patch for cases when name includes a list of IDs, and the
+ // match contains one ID flanked
if (id.length() > s.id.length())
{
return id.startsWith(s.id) ? (WORD_SEP.indexOf(id.charAt(s.id
diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java
new file mode 100644
index 0000000..0fe85d9
--- /dev/null
+++ b/src/jalview/analysis/StructureFrequency.java
@@ -0,0 +1,541 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.util.Format;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+/**
+ * Takes in a vector or array of sequences and column start and column end and
+ * returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied.
+ * This class is used extensively in calculating alignment colourschemes that
+ * depend on the amount of conservation in each alignment column.
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class StructureFrequency
+{
+ public static final int STRUCTURE_PROFILE_LENGTH = 74;
+
+ // No need to store 1000s of strings which are not
+ // visible to the user.
+ public static final String MAXCOUNT = "C";
+
+ public static final String MAXRESIDUE = "R";
+
+ public static final String PID_GAPS = "G";
+
+ public static final String PID_NOGAPS = "N";
+
+ public static final String PROFILE = "P";
+
+ public static final String PAIRPROFILE = "B";
+
+ /**
+ * Returns the 3' position of a base pair
+ *
+ * @param pairs
+ * Secondary structure annotation
+ * @param indice
+ * 5' position of a base pair
+ * @return 3' position of a base pair
+ */
+ public static int findPair(SequenceFeature[] pairs, int indice)
+ {
+
+ for (int i = 0; i < pairs.length; i++)
+ {
+ if (pairs[i].getBegin() == indice)
+
+ {
+
+ return pairs[i].getEnd();
+
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Method to calculate a 'base pair consensus row', very similar to nucleotide
+ * consensus but takes into account a given structure
+ *
+ * @param sequences
+ * @param start
+ * @param end
+ * @param result
+ * @param profile
+ * @param rnaStruc
+ */
+ public static final void calculate(SequenceI[] sequences, int start,
+ int end, Hashtable[] result, boolean profile,
+ AlignmentAnnotation rnaStruc)
+ {
+
+ Hashtable residueHash;
+ String maxResidue;
+ char[] struc = rnaStruc.getRNAStruc().toCharArray();
+
+ SequenceFeature[] rna = rnaStruc._rnasecstr;
+ char c, s, cEnd;
+ int count = 0, nonGap = 0, i, bpEnd = -1, j, jSize = sequences.length;
+ int[] values;
+ int[][] pairs;
+ float percentage;
+ boolean wooble = true;
+ for (i = start; i < end; i++) // foreach column
+ {
+ residueHash = new Hashtable();
+ maxResidue = "-";
+ values = new int[255];
+ pairs = new int[255][255];
+ bpEnd = -1;
+ // System.out.println("s="+struc[i]);
+ if (i < struc.length)
+ {
+ s = struc[i];
+
+ }
+ else
+ {
+ s = '-';
+ }
+ if (s == '.' || s == ' ')
+ {
+ s = '-';
+ }
+
+ if (s != '(' && s != '[')
+ {
+ if (s == '-')
+ {
+ values['-']++;
+ }
+ }
+ else
+ {
+
+ bpEnd = findPair(rna, i);
+
+ if (bpEnd > -1)
+ {
+ for (j = 0; j < jSize; j++) // foreach row
+ {
+ if (sequences[j] == null)
+ {
+ System.err
+ .println("WARNING: Consensus skipping null sequence - possible race condition.");
+ continue;
+ }
+ c = sequences[j].getCharAt(i);
+ // System.out.println("c="+c);
+
+ // standard representation for gaps in sequence and structure
+ if (c == '.' || c == ' ')
+ {
+ c = '-';
+ }
+
+ if (c == '-')
+ {
+ values['-']++;
+ continue;
+ }
+ cEnd = sequences[j].getCharAt(bpEnd);
+
+ // System.out.println("pairs ="+c+","+cEnd);
+ if (checkBpType(c, cEnd) == true)
+ {
+ values['(']++; // H means it's a helix (structured)
+ maxResidue = "(";
+ wooble = true;
+ // System.out.println("It's a pair wc");
+
+ }
+ if (checkBpType(c, cEnd) == false)
+ {
+ wooble = false;
+ values['[']++; // H means it's a helix (structured)
+ maxResidue = "[";
+
+ }
+ pairs[c][cEnd]++;
+
+ }
+ }
+ // nonGap++;
+ }
+ // UPDATE this for new values
+ if (profile)
+ {
+ // TODO 1-dim array with jsize in [0], nongapped in [1]; or Pojo
+ residueHash.put(PROFILE, new int[][] { values,
+ new int[] { jSize, (jSize - values['-']) } });
+
+ residueHash.put(PAIRPROFILE, pairs);
+ }
+ if (wooble == true)
+ {
+ count = values['('];
+ }
+ if (wooble == false)
+ {
+ count = values['['];
+ }
+ residueHash.put(MAXCOUNT, new Integer(count));
+ residueHash.put(MAXRESIDUE, maxResidue);
+
+ percentage = ((float) count * 100) / jSize;
+ residueHash.put(PID_GAPS, new Float(percentage));
+
+ // percentage = ((float) count * 100) / (float) nongap;
+ // residueHash.put(PID_NOGAPS, new Float(percentage));
+ if (result[i] == null)
+ {
+ result[i] = residueHash;
+ }
+ if (bpEnd > 0)
+ {
+ values[')'] = values['('];
+ values[']'] = values['['];
+ values['('] = 0;
+ values['['] = 0;
+ residueHash = new Hashtable();
+ if (wooble == true)
+ {
+ // System.out.println(maxResidue+","+wooble);
+ maxResidue = ")";
+ }
+ if (wooble == false)
+ {
+ // System.out.println(maxResidue+","+wooble);
+ maxResidue = "]";
+ }
+ if (profile)
+ {
+ residueHash.put(PROFILE, new int[][] { values,
+ new int[] { jSize, (jSize - values['-']) } });
+
+ residueHash.put(PAIRPROFILE, pairs);
+ }
+
+ residueHash.put(MAXCOUNT, new Integer(count));
+ residueHash.put(MAXRESIDUE, maxResidue);
+
+ percentage = ((float) count * 100) / jSize;
+ residueHash.put(PID_GAPS, new Float(percentage));
+
+ result[bpEnd] = residueHash;
+
+ }
+ }
+ }
+
+ /**
+ * Method to check if a base-pair is a canonical or a wobble bp
+ *
+ * @param up
+ * 5' base
+ * @param down
+ * 3' base
+ * @return True if it is a canonical/wobble bp
+ */
+ public static boolean checkBpType(char up, char down)
+ {
+ if (up > 'Z')
+ {
+ up -= 32;
+ }
+ if (down > 'Z')
+ {
+ down -= 32;
+ }
+
+ switch (up)
+ {
+ case 'A':
+ switch (down)
+ {
+ case 'T':
+ return true;
+ case 'U':
+ return true;
+ }
+ break;
+ case 'C':
+ switch (down)
+ {
+ case 'G':
+ return true;
+ }
+ break;
+ case 'T':
+ switch (down)
+ {
+ case 'A':
+ return true;
+ case 'G':
+ return true;
+ }
+ break;
+ case 'G':
+ switch (down)
+ {
+ case 'C':
+ return true;
+ case 'T':
+ return true;
+ case 'U':
+ return true;
+ }
+ break;
+ case 'U':
+ switch (down)
+ {
+ case 'A':
+ return true;
+ case 'G':
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * Compute all or part of the annotation row from the given consensus
+ * hashtable
+ *
+ * @param consensus
+ * - pre-allocated annotation row
+ * @param hconsensus
+ * @param iStart
+ * @param width
+ * @param ignoreGapsInConsensusCalculation
+ * @param includeAllConsSymbols
+ */
+ public static void completeConsensus(AlignmentAnnotation consensus,
+ Hashtable[] hconsensus, int iStart, int width,
+ boolean ignoreGapsInConsensusCalculation,
+ boolean includeAllConsSymbols, long nseq)
+ {
+ float tval, value;
+ if (consensus == null || consensus.annotations == null
+ || consensus.annotations.length < width)
+ {
+ // called with a bad alignment annotation row - wait for it to be
+ // initialised properly
+ return;
+ }
+ String fmtstr = "%3.1f";
+ int precision = 2;
+ while (nseq > 100)
+ {
+ precision++;
+ nseq /= 10;
+ }
+ if (precision > 2)
+ {
+ fmtstr = "%" + (2 + precision) + "." + precision + "f";
+ }
+ Format fmt = new Format(fmtstr);
+
+ for (int i = iStart; i < width; i++)
+ {
+ Hashtable hci;
+ if (i >= hconsensus.length || ((hci = hconsensus[i]) == null))
+ {
+ // happens if sequences calculated over were shorter than alignment
+ // width
+ consensus.annotations[i] = null;
+ continue;
+ }
+ value = 0;
+ Float fv;
+ if (ignoreGapsInConsensusCalculation)
+ {
+ fv = (Float) hci.get(StructureFrequency.PID_NOGAPS);
+ }
+ else
+ {
+ fv = (Float) hci.get(StructureFrequency.PID_GAPS);
+ }
+ if (fv == null)
+ {
+ consensus.annotations[i] = null;
+ // data has changed below us .. give up and
+ continue;
+ }
+ value = fv.floatValue();
+ String maxRes = hci.get(StructureFrequency.MAXRESIDUE).toString();
+ String mouseOver = hci.get(StructureFrequency.MAXRESIDUE) + " ";
+ if (maxRes.length() > 1)
+ {
+ mouseOver = "[" + maxRes + "] ";
+ maxRes = "+";
+ }
+ int[][] profile = (int[][]) hci.get(StructureFrequency.PROFILE);
+ int[][] pairs = (int[][]) hci.get(StructureFrequency.PAIRPROFILE);
+
+ if (pairs != null && includeAllConsSymbols) // Just responsible for the
+ // tooltip
+ // TODO Update tooltips for Structure row
+ {
+ mouseOver = "";
+
+ /*
+ * TODO It's not sure what is the purpose of the alphabet and wheter it
+ * is useful for structure?
+ *
+ * if (alphabet != null) { for (int c = 0; c < alphabet.length; c++) {
+ * tval = ((float) profile[0][alphabet[c]]) 100f / (float)
+ * profile[1][ignoreGapsInConsensusCalculation ? 1 : 0]; mouseOver +=
+ * ((c == 0) ? "" : "; ") + alphabet[c] + " " + ((int) tval) + "%"; } }
+ * else {
+ */
+ int[][] ca = new int[625][];
+ float[] vl = new float[625];
+ int x = 0;
+ for (int c = 65; c < 90; c++)
+ {
+ for (int d = 65; d < 90; d++)
+ {
+ ca[x] = new int[] { c, d };
+ vl[x] = pairs[c][d];
+ x++;
+ }
+ }
+ jalview.util.QuickSort.sort(vl, ca);
+ int p = 0;
+
+ /*
+ * profile[1] is {total, ungappedTotal}
+ */
+ final int divisor = profile[1][ignoreGapsInConsensusCalculation ? 1
+ : 0];
+ for (int c = 624; c > 0; c--)
+ {
+ if (vl[c] > 0)
+ {
+ tval = (vl[c] * 100f / divisor);
+ mouseOver += ((p == 0) ? "" : "; ") + (char) ca[c][0]
+ + (char) ca[c][1] + " " + fmt.form(tval) + "%";
+ p++;
+
+ }
+ }
+
+ // }
+ }
+ else
+ {
+ mouseOver += (fmt.form(value) + "%");
+ }
+ consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ',
+ value);
+ }
+ }
+
+ /**
+ * get the sorted base-pair profile for the given position of the consensus
+ *
+ * @param hconsensus
+ * @return profile of the given column
+ */
+ public static int[] extractProfile(Hashtable hconsensus,
+ boolean ignoreGapsInConsensusCalculation)
+ {
+ int[] rtnval = new int[STRUCTURE_PROFILE_LENGTH]; // 2*(5*5)+2
+ int[][] profile = (int[][]) hconsensus.get(StructureFrequency.PROFILE);
+ int[][] pairs = (int[][]) hconsensus
+ .get(StructureFrequency.PAIRPROFILE);
+
+ if (profile == null)
+ {
+ return null;
+ }
+
+ // TODO fix the object length, also do it in completeConsensus
+ // Object[] ca = new Object[625];
+ int[][] ca = new int[625][];
+ float[] vl = new float[625];
+ int x = 0;
+ for (int c = 65; c < 90; c++)
+ {
+ for (int d = 65; d < 90; d++)
+ {
+ ca[x] = new int[] { c, d };
+ vl[x] = pairs[c][d];
+ x++;
+ }
+ }
+ jalview.util.QuickSort.sort(vl, ca);
+
+ int valuesCount = 0;
+ rtnval[1] = 0;
+ int offset = 2;
+ final int divisor = profile[1][ignoreGapsInConsensusCalculation ? 1 : 0];
+ for (int c = 624; c > 0; c--)
+ {
+ if (vl[c] > 0)
+ {
+ rtnval[offset++] = ca[c][0];
+ rtnval[offset++] = ca[c][1];
+ rtnval[offset] = (int) (vl[c] * 100f / divisor);
+ rtnval[1] += rtnval[offset++];
+ valuesCount++;
+ }
+ }
+ rtnval[0] = valuesCount;
+
+ // insert profile type code in position 0
+ int[] result = new int[rtnval.length + 1];
+ result[0] = AlignmentAnnotation.STRUCTURE_PROFILE;
+ System.arraycopy(rtnval, 0, result, 1, rtnval.length);
+ return result;
+ }
+
+ public static void main(String args[])
+ {
+ // Short test to see if checkBpType works
+ ArrayList<String> test = new ArrayList<String>();
+ test.add("A");
+ test.add("c");
+ test.add("g");
+ test.add("T");
+ test.add("U");
+ for (String i : test)
+ {
+ for (String j : test)
+ {
+ System.out.println(i + "-" + j + ": "
+ + StructureFrequency.checkBpType(i.charAt(0), j.charAt(0)));
+ }
+ }
+ }
+}
diff --git a/src/jalview/analysis/WUSSParseException.java b/src/jalview/analysis/WUSSParseException.java
new file mode 100644
index 0000000..b8b4f09
--- /dev/null
+++ b/src/jalview/analysis/WUSSParseException.java
@@ -0,0 +1,43 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+public class WUSSParseException extends Exception
+{
+ private long problemPos;
+
+ public WUSSParseException(long problemPos)
+ {
+ this("Invalid WUSS Notation", problemPos);
+ }
+
+ public WUSSParseException(String message, long problemPos)
+ {
+ super(message + " at or near position " + problemPos);
+ this.problemPos = problemPos;
+ }
+
+ public long getProblemPos()
+ {
+ return problemPos;
+ }
+
+}
diff --git a/src/jalview/analysis/scoremodels/FeatureScoreModel.java b/src/jalview/analysis/scoremodels/FeatureScoreModel.java
new file mode 100644
index 0000000..2218a0e
--- /dev/null
+++ b/src/jalview/analysis/scoremodels/FeatureScoreModel.java
@@ -0,0 +1,158 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis.scoremodels;
+
+import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.ViewBasedAnalysisI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.util.Comparison;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.List;
+
+public class FeatureScoreModel implements ScoreModelI, ViewBasedAnalysisI
+{
+ jalview.api.FeatureRenderer fr;
+
+ @Override
+ public boolean configureFromAlignmentView(
+ jalview.api.AlignmentViewPanel view)
+ {
+ fr = view.cloneFeatureRenderer();
+ return true;
+ }
+
+ @Override
+ public float[][] findDistances(AlignmentView seqData)
+ {
+ int nofeats = 0;
+ List<String> dft = Arrays.asList(fr.getDisplayedFeatureTypes());
+
+ if (dft != null)
+ {
+ nofeats = dft.size();
+ }
+
+ SequenceI[] sequenceString = seqData.getVisibleAlignment(
+ Comparison.GapChars.charAt(0)).getSequencesArray();
+ int noseqs = sequenceString.length;
+ int cpwidth = seqData.getWidth();
+ float[][] distance = new float[noseqs][noseqs];
+ if (nofeats == 0)
+ {
+ for (float[] d : distance)
+ {
+ for (int i = 0; i < d.length; d[i++] = 0f)
+ {
+ ;
+ }
+ }
+ return distance;
+ }
+ float max = 0;
+ for (int cpos = 0; cpos < cpwidth; cpos++)
+ {
+ // get visible features at cpos under view's display settings and compare
+ // them
+ List<Hashtable<String, SequenceFeature>> sfap = new ArrayList<Hashtable<String, SequenceFeature>>();
+ for (int i = 0; i < noseqs; i++)
+ {
+ Hashtable<String, SequenceFeature> types = new Hashtable<String, SequenceFeature>();
+ List<SequenceFeature> sfs = fr.findFeaturesAtRes(sequenceString[i],
+ sequenceString[i].findPosition(cpos));
+ for (SequenceFeature sf : sfs)
+ {
+ types.put(sf.getType(), sf);
+ }
+ sfap.add(types);
+ }
+ for (int i = 0; i < (noseqs - 1); i++)
+ {
+ if (cpos == 0)
+ {
+ distance[i][i] = 0f;
+ }
+ for (int j = i + 1; j < noseqs; j++)
+ {
+ int sfcommon = 0;
+ // compare the two lists of features...
+ Hashtable<String, SequenceFeature> fi = sfap.get(i), fk, fj = sfap
+ .get(j);
+ if (fi.size() > fj.size())
+ {
+ fk = fj;
+ }
+ else
+ {
+ fk = fi;
+ fi = fj;
+ }
+ for (String k : fi.keySet())
+ {
+ SequenceFeature sfj = fk.get(k);
+ if (sfj != null)
+ {
+ sfcommon++;
+ }
+ }
+ distance[i][j] += (fi.size() + fk.size() - 2f * sfcommon);
+ distance[j][i] += distance[i][j];
+ }
+ }
+ }
+ for (int i = 0; i < noseqs; i++)
+ {
+ for (int j = i + 1; j < noseqs; j++)
+ {
+ distance[i][j] /= cpwidth;
+ distance[j][i] = distance[i][j];
+ }
+ }
+ return distance;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "Sequence Feature Similarity";
+ }
+
+ @Override
+ public boolean isDNA()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isProtein()
+ {
+ return true;
+ }
+
+ public String toString()
+ {
+ return "Score between sequences based on hamming distance between binary vectors marking features displayed at each column";
+ }
+}
diff --git a/src/jalview/analysis/scoremodels/PIDScoreModel.java b/src/jalview/analysis/scoremodels/PIDScoreModel.java
new file mode 100644
index 0000000..b297213
--- /dev/null
+++ b/src/jalview/analysis/scoremodels/PIDScoreModel.java
@@ -0,0 +1,75 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis.scoremodels;
+
+import jalview.api.analysis.ScoreModelI;
+import jalview.datamodel.AlignmentView;
+import jalview.util.Comparison;
+
+public class PIDScoreModel implements ScoreModelI
+{
+
+ @Override
+ public float[][] findDistances(AlignmentView seqData)
+ {
+ String[] sequenceString = seqData
+ .getSequenceStrings(Comparison.GapChars.charAt(0));
+ int noseqs = sequenceString.length;
+ float[][] distance = new float[noseqs][noseqs];
+ for (int i = 0; i < (noseqs - 1); i++)
+ {
+ for (int j = i; j < noseqs; j++)
+ {
+ if (j == i)
+ {
+ distance[i][i] = 0;
+ }
+ else
+ {
+ distance[i][j] = 100 - Comparison.PID(sequenceString[i],
+ sequenceString[j]);
+
+ distance[j][i] = distance[i][j];
+ }
+ }
+ }
+ return distance;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "PID";
+ }
+
+ @Override
+ public boolean isDNA()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isProtein()
+ {
+ return true;
+ }
+
+}
diff --git a/src/jalview/analysis/scoremodels/PairwiseSeqScoreModel.java b/src/jalview/analysis/scoremodels/PairwiseSeqScoreModel.java
new file mode 100644
index 0000000..46cbee6
--- /dev/null
+++ b/src/jalview/analysis/scoremodels/PairwiseSeqScoreModel.java
@@ -0,0 +1,80 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis.scoremodels;
+
+import jalview.api.analysis.ScoreModelI;
+import jalview.datamodel.AlignmentView;
+import jalview.util.Comparison;
+
+public abstract class PairwiseSeqScoreModel implements ScoreModelI
+{
+ abstract public int getPairwiseScore(char c, char d);
+
+ public float[][] findDistances(AlignmentView seqData)
+ {
+ String[] sequenceString = seqData
+ .getSequenceStrings(Comparison.GapChars.charAt(0));
+ int noseqs = sequenceString.length;
+ float[][] distance = new float[noseqs][noseqs];
+
+ int maxscore = 0;
+ int end = sequenceString[0].length();
+ for (int i = 0; i < (noseqs - 1); i++)
+ {
+ for (int j = i; j < noseqs; j++)
+ {
+ int score = 0;
+
+ for (int k = 0; k < end; k++)
+ {
+ try
+ {
+ score += getPairwiseScore(sequenceString[i].charAt(k),
+ sequenceString[j].charAt(k));
+ } catch (Exception ex)
+ {
+ System.err.println("err creating " + getName() + " tree");
+ ex.printStackTrace();
+ }
+ }
+
+ distance[i][j] = (float) score;
+
+ if (score > maxscore)
+ {
+ maxscore = score;
+ }
+ }
+ }
+
+ for (int i = 0; i < (noseqs - 1); i++)
+ {
+ for (int j = i; j < noseqs; j++)
+ {
+ distance[i][j] = (float) maxscore - distance[i][j];
+ distance[j][i] = distance[i][j];
+ }
+ }
+ return distance;
+ }
+
+ abstract public int[][] getMatrix();
+}
diff --git a/src/jalview/analysis/scoremodels/SWScoreModel.java b/src/jalview/analysis/scoremodels/SWScoreModel.java
new file mode 100644
index 0000000..9ba5273
--- /dev/null
+++ b/src/jalview/analysis/scoremodels/SWScoreModel.java
@@ -0,0 +1,94 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis.scoremodels;
+
+import jalview.analysis.AlignSeq;
+import jalview.api.analysis.ScoreModelI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SequenceI;
+import jalview.util.Comparison;
+
+public class SWScoreModel implements ScoreModelI
+{
+
+ @Override
+ public float[][] findDistances(AlignmentView seqData)
+ {
+ SequenceI[] sequenceString = seqData.getVisibleAlignment(
+ Comparison.GapChars.charAt(0)).getSequencesArray();
+ int noseqs = sequenceString.length;
+ float[][] distance = new float[noseqs][noseqs];
+
+ float max = -1;
+
+ for (int i = 0; i < (noseqs - 1); i++)
+ {
+ for (int j = i; j < noseqs; j++)
+ {
+ AlignSeq as = new AlignSeq(sequenceString[i], sequenceString[j],
+ seqData.isNa() ? "dna" : "pep");
+ as.calcScoreMatrix();
+ as.traceAlignment();
+ as.printAlignment(System.out);
+ distance[i][j] = (float) as.maxscore;
+
+ if (max < distance[i][j])
+ {
+ max = distance[i][j];
+ }
+ }
+ }
+
+ for (int i = 0; i < (noseqs - 1); i++)
+ {
+ for (int j = i; j < noseqs; j++)
+ {
+ distance[i][j] = max - distance[i][j];
+ distance[j][i] = distance[i][j];
+ }
+ }
+
+ return distance;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "Smith Waterman Score";
+ }
+
+ @Override
+ public boolean isDNA()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isProtein()
+ {
+ return true;
+ }
+
+ public String toString()
+ {
+ return "Score between two sequences aligned with Smith Waterman with default Peptide/Nucleotide matrix";
+ }
+}
diff --git a/src/jalview/api/AlignCalcManagerI.java b/src/jalview/api/AlignCalcManagerI.java
new file mode 100644
index 0000000..3261f5b
--- /dev/null
+++ b/src/jalview/api/AlignCalcManagerI.java
@@ -0,0 +1,161 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+import java.util.List;
+
+public interface AlignCalcManagerI
+{
+
+ /**
+ * tell manager that a worker is initialised and has started to run
+ *
+ * @param worker
+ */
+ void notifyStart(AlignCalcWorkerI worker);
+
+ /**
+ * check if a calculation of this type is already active
+ *
+ * @param worker
+ * @return
+ */
+ boolean alreadyDoing(AlignCalcWorkerI worker);
+
+ /**
+ * tell manager that worker is now processing data
+ *
+ * @param worker
+ */
+ boolean notifyWorking(AlignCalcWorkerI worker);
+
+ /**
+ * notify manager that the worker has completed, and results may be ready to
+ * collect
+ *
+ * @param worker
+ */
+ void workerComplete(AlignCalcWorkerI worker);
+
+ /**
+ * indicate that a worker like this cannot run on the platform and shouldn't
+ * be started again
+ *
+ * @param worker
+ */
+ void workerCannotRun(AlignCalcWorkerI worker);
+
+ /**
+ * indicate that a worker like this may be run on the platform.
+ *
+ * @param worker
+ * of class to be removed from the execution blacklist
+ */
+ void workerMayRun(AlignCalcWorkerI worker);
+
+ /**
+ * launch a new worker
+ *
+ * @param worker
+ */
+ void startWorker(AlignCalcWorkerI worker);
+
+ /**
+ *
+ * @param worker
+ * @return
+ */
+ boolean isWorking(AlignCalcWorkerI worker);
+
+ /**
+ * if any worker thread is operational, return true!
+ *
+ * @return
+ */
+ boolean isWorking();
+
+ /**
+ * register a restartable worker
+ *
+ * @param worker
+ */
+ void registerWorker(AlignCalcWorkerI worker);
+
+ /**
+ * restart any registered workers
+ */
+ void restartWorkers();
+
+ /**
+ *
+ * @param alignmentAnnotation
+ * @return true if a currently registered and working worker indicates its
+ * involvement with the given alignmentAnnotation
+ */
+ boolean workingInvolvedWith(AlignmentAnnotation alignmentAnnotation);
+
+ /**
+ * kick any known instances of the given worker class to update their
+ * annotation
+ *
+ * @param workerClass
+ */
+ void updateAnnotationFor(Class workerClass);
+
+ /**
+ * return any registered workers of the given class
+ *
+ * @param workerClass
+ * @return null or one or more workers of the given class
+ */
+ List<AlignCalcWorkerI> getRegisteredWorkersOfClass(Class workerClass);
+
+ /**
+ * start any workers of the given class
+ *
+ * @param workerClass
+ * @return false if no workers of given class were registered (note -
+ * blacklisted classes cannot be restarted, so this method will return
+ * true for blacklisted workers)
+ */
+ boolean startRegisteredWorkersOfClass(Class workerClass);
+
+ /**
+ * work out if there is an instance of a worker that is *waiting* to start
+ * calculating
+ *
+ * @param workingClass
+ * @return true if workingClass is already waiting to calculate. false if it
+ * is calculating, or not queued.
+ */
+ boolean isPending(AlignCalcWorkerI workingClass);
+
+ /**
+ * deregister and otherwise remove any registered and working instances of the
+ * given worker type
+ *
+ * @param typeToRemove
+ */
+ void removeRegisteredWorkersOfClass(Class typeToRemove);
+
+}
diff --git a/src/jalview/api/AlignCalcWorkerI.java b/src/jalview/api/AlignCalcWorkerI.java
new file mode 100644
index 0000000..3145382
--- /dev/null
+++ b/src/jalview/api/AlignCalcWorkerI.java
@@ -0,0 +1,33 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+public interface AlignCalcWorkerI extends Runnable
+{
+
+ public boolean involves(AlignmentAnnotation annot);
+
+ public void updateAnnotation();
+
+ void removeOurAnnotation();
+}
diff --git a/src/jalview/api/AlignExportSettingI.java b/src/jalview/api/AlignExportSettingI.java
new file mode 100644
index 0000000..72a4164
--- /dev/null
+++ b/src/jalview/api/AlignExportSettingI.java
@@ -0,0 +1,73 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.api;
+
+/**
+ * Abstract interface implemented by Alignment Export dialog to retrieve user
+ * configurations
+ *
+ * @author tcnofoegbu
+ *
+ */
+public interface AlignExportSettingI
+{
+ /**
+ * Checks if hidden sequences should be exported
+ *
+ * @return
+ */
+ public boolean isExportHiddenSequences();
+
+ /**
+ * Checks if hidden columns shoulb be exported
+ *
+ * @return
+ */
+ public boolean isExportHiddenColumns();
+
+ /**
+ * Checks if Annotations should be exported, note this is available for
+ * complex flat file exports like JSON, HTML, GFF
+ *
+ * @return
+ */
+ public boolean isExportAnnotations();
+
+ /**
+ * Checks if SequenceFeatures should be exported, note this is available for
+ * complex flat file exports like JSON, HTML, GFF
+ *
+ * @return
+ */
+ public boolean isExportFeatures();
+
+ /**
+ * Checks if SequenceGroups should be exported, note this is available for
+ * complex flat file exports like JSON, HTML, GFF
+ *
+ * @return
+ */
+ public boolean isExportGroups();
+
+ public boolean isCancelled();
+
+}
diff --git a/src/jalview/api/AlignViewControllerGuiI.java b/src/jalview/api/AlignViewControllerGuiI.java
new file mode 100644
index 0000000..db429bc
--- /dev/null
+++ b/src/jalview/api/AlignViewControllerGuiI.java
@@ -0,0 +1,65 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+import jalview.commands.CommandI;
+import jalview.schemes.ColourSchemeI;
+
+/**
+ * Interface implemented by gui implementations managing a Jalview Alignment
+ * View
+ *
+ * @author jimp
+ *
+ */
+public interface AlignViewControllerGuiI
+{
+
+ /**
+ * display the given string in the GUI's status bar
+ *
+ * @param string
+ */
+ void setStatus(String string);
+
+ void addHistoryItem(CommandI command);
+
+ void setShowSeqFeatures(boolean show);
+
+ void setMenusForViewport();
+
+ void changeColour(ColourSchemeI cs);
+
+ /**
+ * trigger an update of the UI in response to a model data change, and if
+ * necessary enable the display of sequence feature annotation on the view.
+ *
+ * @param enableIfNecessary
+ */
+ void refreshFeatureUI(boolean enableIfNecessary);
+
+ /**
+ * get the Feature Settings control panel for the alignment view if one exists
+ *
+ * @return
+ */
+ FeatureSettingsControllerI getFeatureSettingsUI();
+}
diff --git a/src/jalview/api/AlignViewControllerI.java b/src/jalview/api/AlignViewControllerI.java
new file mode 100644
index 0000000..d379553
--- /dev/null
+++ b/src/jalview/api/AlignViewControllerI.java
@@ -0,0 +1,98 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+/**
+ * prototype abstract controller for a Jalview alignment view
+ *
+ * @author jimp
+ *
+ * All operations should return true if the view has changed as a result
+ * of the operation
+ *
+ * The controller holds methods that operate on an alignment view,
+ * modifying its state in some way that may result in side effects
+ * reflected in an associated GUI
+ *
+ */
+public interface AlignViewControllerI
+{
+
+ public boolean makeGroupsFromSelection();
+
+ public boolean createGroup();
+
+ public boolean unGroup();
+
+ public boolean deleteGroups();
+
+ public void setViewportAndAlignmentPanel(AlignViewportI viewport,
+ AlignmentViewPanel alignPanel);
+
+ /**
+ * Mark columns in the current column selection according to positions of
+ * sequence features
+ *
+ * @param invert
+ * - when set, mark all but columns containing given type
+ * @param extendCurrent
+ * - when set, do not clear existing column selection
+ * @param toggle
+ * - rather than explicitly set, toggle selection state
+ * @param featureType
+ * - feature type string
+ * @return true if operation affected state
+ */
+ boolean markColumnsContainingFeatures(boolean invert,
+ boolean extendCurrent, boolean clearColumns, String featureType);
+
+ /**
+ * sort the alignment or current selection by average score over the given set
+ * of features
+ *
+ * @param typ
+ * list of feature names or null to use currently displayed features
+ */
+ void sortAlignmentByFeatureScore(String[] typ);
+
+ /**
+ * sort the alignment or current selection by distribution of the given set of
+ * features
+ *
+ * @param typ
+ * list of feature names or null to use currently displayed features
+ */
+ void sortAlignmentByFeatureDensity(String[] typ);
+
+ /**
+ * add a features file of some kind to the current view
+ *
+ * @param file
+ * @param protocol
+ * @param relaxedIdMatching
+ * if true, try harder to match up IDs with local sequence data
+ * @return true if parsing resulted in something being imported to the view or
+ * dataset
+ */
+ public boolean parseFeaturesFile(String file, String protocol,
+ boolean relaxedIdMatching);
+
+}
diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java
new file mode 100644
index 0000000..e533683
--- /dev/null
+++ b/src/jalview/api/AlignViewportI.java
@@ -0,0 +1,378 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+import jalview.analysis.Conservation;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.CigarArray;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
+
+import java.awt.Color;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author jimp
+ *
+ */
+public interface AlignViewportI extends ViewStyleI
+{
+
+ int getEndRes();
+
+ /**
+ * calculate the height for visible annotation, revalidating bounds where
+ * necessary ABSTRACT GUI METHOD
+ *
+ * @return total height of annotation
+ */
+ public int calcPanelHeight();
+
+ boolean hasHiddenColumns();
+
+ boolean isValidCharWidth();
+
+ boolean isShowConsensusHistogram();
+
+ boolean isShowSequenceLogo();
+
+ boolean isNormaliseSequenceLogo();
+
+ ColourSchemeI getGlobalColourScheme();
+
+ AlignmentI getAlignment();
+
+ ColumnSelection getColumnSelection();
+
+ Hashtable[] getSequenceConsensusHash();
+
+ /**
+ * Get consensus data table for the cDNA complement of this alignment (if any)
+ *
+ * @return
+ */
+ Hashtable[] getComplementConsensusHash();
+
+ Hashtable[] getRnaStructureConsensusHash();
+
+ boolean isIgnoreGapsConsensus();
+
+ boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
+
+ AlignmentAnnotation getAlignmentQualityAnnot();
+
+ AlignmentAnnotation getAlignmentConservationAnnotation();
+
+ /**
+ * get the container for alignment consensus annotation
+ *
+ * @return
+ */
+ AlignmentAnnotation getAlignmentConsensusAnnotation();
+
+ /**
+ * get the container for cDNA complement consensus annotation
+ *
+ * @return
+ */
+ AlignmentAnnotation getComplementConsensusAnnotation();
+
+ /**
+ * Test to see if viewport is still open and active
+ *
+ * @return true indicates that all references to viewport should be dropped
+ */
+ boolean isClosed();
+
+ /**
+ * get the associated calculation thread manager for the view
+ *
+ * @return
+ */
+ AlignCalcManagerI getCalcManager();
+
+ /**
+ * get the percentage gaps allowed in a conservation calculation
+ *
+ */
+ public int getConsPercGaps();
+
+ /**
+ * set the consensus result object for the viewport
+ *
+ * @param hconsensus
+ */
+ void setSequenceConsensusHash(Hashtable[] hconsensus);
+
+ /**
+ * Set the cDNA complement consensus for the viewport
+ *
+ * @param hconsensus
+ */
+ void setComplementConsensusHash(Hashtable[] hconsensus);
+
+ /**
+ *
+ * @return the alignment annotatino row for the structure consensus
+ * calculation
+ */
+ AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
+
+ /**
+ * set the Rna structure consensus result object for the viewport
+ *
+ * @param hStrucConsensus
+ */
+ void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
+
+ /**
+ * set global colourscheme
+ *
+ * @param rhc
+ */
+ void setGlobalColourScheme(ColourSchemeI rhc);
+
+ Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
+
+ void setHiddenRepSequences(
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
+
+ /**
+ * hides or shows dynamic annotation rows based on groups and group and
+ * alignment associated auto-annotation state flags apply the current
+ * group/autoannotation settings to the alignment view. Usually you should
+ * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
+ * ensure the annotation panel bounds are set correctly.
+ *
+ * @param applyGlobalSettings
+ * - apply to all autoannotation rows or just the ones associated
+ * with the current visible region
+ * @param preserveNewGroupSettings
+ * - don't apply global settings to groups which don't already have
+ * group associated annotation
+ */
+ void updateGroupAnnotationSettings(boolean applyGlobalSettings,
+ boolean preserveNewGroupSettings);
+
+ void setSequenceColour(SequenceI seq, Color col);
+
+ Color getSequenceColour(SequenceI seq);
+
+ void updateSequenceIdColours();
+
+ SequenceGroup getSelectionGroup();
+
+ /**
+ * get the currently selected sequence objects or all the sequences in the
+ * alignment. TODO: change to List<>
+ *
+ * @return array of references to sequence objects
+ */
+ SequenceI[] getSequenceSelection();
+
+ void clearSequenceColours();
+
+ /**
+ * This method returns the visible alignment as text, as seen on the GUI, ie
+ * if columns are hidden they will not be returned in the result. Use this for
+ * calculating trees, PCA, redundancy etc on views which contain hidden
+ * columns.
+ *
+ * @return String[]
+ */
+ CigarArray getViewAsCigars(boolean selectedRegionOnly);
+
+ /**
+ * return a compact representation of the current alignment selection to pass
+ * to an analysis function
+ *
+ * @param selectedOnly
+ * boolean true to just return the selected view
+ * @return AlignmentView
+ */
+ AlignmentView getAlignmentView(boolean selectedOnly);
+
+ /**
+ * return a compact representation of the current alignment selection to pass
+ * to an analysis function
+ *
+ * @param selectedOnly
+ * boolean true to just return the selected view
+ * @param markGroups
+ * boolean true to annotate the alignment view with groups on the
+ * alignment (and intersecting with selected region if selectedOnly
+ * is true)
+ * @return AlignmentView
+ */
+ AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
+
+ /**
+ * This method returns the visible alignment as text, as seen on the GUI, ie
+ * if columns are hidden they will not be returned in the result. Use this for
+ * calculating trees, PCA, redundancy etc on views which contain hidden
+ * columns.
+ *
+ * @return String[]
+ */
+ String[] getViewAsString(boolean selectedRegionOnly);
+
+ void setSelectionGroup(SequenceGroup sg);
+
+ char getGapCharacter();
+
+ void setColumnSelection(ColumnSelection cs);
+
+ void setConservation(Conservation cons);
+
+ /**
+ * get a copy of the currently visible alignment annotation
+ *
+ * @param selectedOnly
+ * if true - trim to selected regions on the alignment
+ * @return an empty list or new alignment annotation objects shown only
+ * visible columns trimmed to selected region only
+ */
+ List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
+ boolean selectedOnly);
+
+ FeaturesDisplayedI getFeaturesDisplayed();
+
+ String getSequenceSetId();
+
+ boolean areFeaturesDisplayed();
+
+ void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
+
+ void alignmentChanged(AlignmentViewPanel ap);
+
+ /**
+ * @return the padGaps
+ */
+ boolean isPadGaps();
+
+ /**
+ * @param padGaps
+ * the padGaps to set
+ */
+ void setPadGaps(boolean padGaps);
+
+ /**
+ * return visible region boundaries within given column range
+ *
+ * @param min
+ * first column (inclusive, from 0)
+ * @param max
+ * last column (exclusive)
+ * @return int[][] range of {start,end} visible positions
+ */
+ List<int[]> getVisibleRegionBoundaries(int min, int max);
+
+ /**
+ * This method returns an array of new SequenceI objects derived from the
+ * whole alignment or just the current selection with start and end points
+ * adjusted
+ *
+ * @note if you need references to the actual SequenceI objects in the
+ * alignment or currently selected then use getSequenceSelection()
+ * @return selection as new sequenceI objects
+ */
+ SequenceI[] getSelectionAsNewSequence();
+
+ void invertColumnSelection();
+
+ /**
+ * broadcast selection to any interested parties
+ */
+ void sendSelection();
+
+ /**
+ * calculate the row position for alignmentIndex if all hidden sequences were
+ * shown
+ *
+ * @param alignmentIndex
+ * @return adjusted row position
+ */
+ int adjustForHiddenSeqs(int alignmentIndex);
+
+ boolean hasHiddenRows();
+
+ /**
+ *
+ * @return a copy of this view's current display settings
+ */
+ public ViewStyleI getViewStyle();
+
+ /**
+ * update the view's display settings with the given style set
+ *
+ * @param settingsForView
+ */
+ public void setViewStyle(ViewStyleI settingsForView);
+
+ /**
+ * Returns a viewport which holds the cDna for this (protein), or vice versa,
+ * or null if none is set.
+ *
+ * @return
+ */
+ AlignViewportI getCodingComplement();
+
+ /**
+ * Sets the viewport which holds the cDna for this (protein), or vice versa.
+ * Implementation should guarantee that the reciprocal relationship is always
+ * set, i.e. each viewport is the complement of the other.
+ */
+ void setCodingComplement(AlignViewportI sl);
+
+ /**
+ * Answers true if viewport hosts DNA/RNA, else false.
+ *
+ * @return
+ */
+ boolean isNucleotide();
+
+ /**
+ * Returns an id guaranteed to be unique for this viewport.
+ *
+ * @return
+ */
+ String getViewId();
+
+ /**
+ * Return true if view should scroll to show the highlighted region of a
+ * sequence
+ *
+ * @return
+ */
+ boolean isFollowHighlight();
+
+ /**
+ * Set whether view should scroll to show the highlighted region of a sequence
+ */
+ void setFollowHighlight(boolean b);
+}
diff --git a/src/jalview/api/AlignmentViewPanel.java b/src/jalview/api/AlignmentViewPanel.java
index a7acc66..0408fb1 100644
--- a/src/jalview/api/AlignmentViewPanel.java
+++ b/src/jalview/api/AlignmentViewPanel.java
@@ -1,21 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.api;
import jalview.datamodel.AlignmentI;
@@ -23,12 +25,41 @@ import jalview.structure.StructureSelectionManager;
/**
* abstract interface implemented by alignment panels holding an alignment view
+ *
* @author JimP
- *
+ *
*/
-public interface AlignmentViewPanel
+public interface AlignmentViewPanel extends OOMHandlerI
{
+ AlignViewportI getAlignViewport();
+
AlignmentI getAlignment();
+
StructureSelectionManager getStructureSelectionManager();
+
+ /**
+ * repaint the alignment view after a datamodel update.
+ *
+ * @param updateOverview
+ * - if true, the overview panel will also be updated and repainted
+ */
+
+ void paintAlignment(boolean updateOverview);
+
+ /**
+ * automatically adjust annotation panel height for new annotation whilst
+ * ensuring the alignment is still visible.
+ */
+ void adjustAnnotationHeight();
+
+ FeatureRenderer getFeatureRenderer();
+
+ FeatureRenderer cloneFeatureRenderer();
+
+ /**
+ *
+ * @return displayed name for the view
+ */
+ String getViewName();
}
diff --git a/src/jalview/api/BuildDetailsI.java b/src/jalview/api/BuildDetailsI.java
new file mode 100644
index 0000000..8b99aa4
--- /dev/null
+++ b/src/jalview/api/BuildDetailsI.java
@@ -0,0 +1,30 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+public interface BuildDetailsI
+{
+ public String getBuildDate();
+
+ public String getVersion();
+
+ public String getInstallation();
+}
diff --git a/src/jalview/api/ComplexAlignFile.java b/src/jalview/api/ComplexAlignFile.java
new file mode 100644
index 0000000..4349382
--- /dev/null
+++ b/src/jalview/api/ComplexAlignFile.java
@@ -0,0 +1,69 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
+
+/**
+ * This interface should be implemented by complex file parser with the ability
+ * to store linked data and complex view states in addition to Alignment data
+ *
+ *
+ */
+public interface ComplexAlignFile
+{
+ /**
+ * Determines if Sequence features should be shown
+ *
+ * @return
+ */
+ public boolean isShowSeqFeatures();
+
+ /**
+ * Obtains the colour scheme from a complex file parser
+ *
+ * @return
+ */
+ public ColourSchemeI getColourScheme();
+
+ /**
+ * Retrieves the Column selection/hidden column from a complex file parser
+ *
+ * @return
+ */
+ public ColumnSelection getColumnSelection();
+
+ /**
+ * Retrieves hidden sequences from a complex file parser
+ *
+ * @return
+ */
+ public SequenceI[] getHiddenSequences();
+
+ /**
+ * Retrieves displayed features from a complex file parser
+ *
+ * @return
+ */
+ public FeaturesDisplayedI getDisplayedFeatures();
+}
diff --git a/src/jalview/api/FeatureRenderer.java b/src/jalview/api/FeatureRenderer.java
index fe3786d..d5adea6 100644
--- a/src/jalview/api/FeatureRenderer.java
+++ b/src/jalview/api/FeatureRenderer.java
@@ -1,25 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.api;
+import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import java.awt.Color;
+import java.util.List;
+import java.util.Map;
/**
* Abstract feature renderer interface
@@ -30,8 +36,145 @@ import java.awt.Color;
public interface FeatureRenderer
{
+ /**
+ * compute the perceived colour for a given column position in sequenceI,
+ * taking transparency and feature visibility into account.
+ *
+ * @param col
+ * - background colour (due to alignment/group shading schemes, etc).
+ * @param sequenceI
+ * - sequence providing features
+ * @param r
+ * - column position
+ * @return
+ */
Color findFeatureColour(Color col, SequenceI sequenceI, int r);
+ /**
+ * trigger the feature discovery process for a newly created feature renderer.
+ */
void featuresAdded();
+ /**
+ *
+ * @param ft
+ * @return display style for a feature
+ */
+ Object getFeatureStyle(String ft);
+
+ /**
+ * update the feature style for a particular feature
+ *
+ * @param ft
+ * @param ggc
+ * - currently allows java.awt.Color and
+ * jalview.schemes.GraduatedColor
+ */
+ void setColour(String ft, Object ggc);
+
+ AlignViewportI getViewport();
+
+ /**
+ *
+ * @return container managing list of feature types and their visibility
+ */
+ FeaturesDisplayedI getFeaturesDisplayed();
+
+ /**
+ * get display style for all features types - visible or invisible
+ *
+ * @return
+ */
+ Map<String, Object> getFeatureColours();
+
+ /**
+ * query the alignment view to find all features
+ *
+ * @param newMadeVisible
+ * - when true, automatically make newly discovered types visible
+ */
+ void findAllFeatures(boolean newMadeVisible);
+
+ /**
+ * get display style for all features types currently visible
+ *
+ * @return
+ */
+ Map<String, Object> getDisplayedFeatureCols();
+
+ /**
+ * get all registered groups
+ *
+ * @return
+ */
+ List<String> getFeatureGroups();
+
+ /**
+ * get groups that are visible/invisible
+ *
+ * @param visible
+ * @return
+ */
+ List<String> getGroups(boolean visible);
+
+ /**
+ * change visibility for a range of groups
+ *
+ * @param toset
+ * @param visible
+ */
+ void setGroupVisibility(List<String> toset, boolean visible);
+
+ /**
+ * change visibiilty of given group
+ *
+ * @param group
+ * @param visible
+ */
+ void setGroupVisibility(String group, boolean visible);
+
+ /**
+ * locate features at a particular position on the given sequence
+ *
+ * @param sequence
+ * @param res
+ * @return
+ */
+ List<SequenceFeature> findFeaturesAtRes(SequenceI sequence, int res);
+
+ /**
+ *
+ * @return true if the rendering platform supports transparency
+ */
+ boolean isTransparencyAvailable();
+
+ /**
+ * get current displayed types
+ *
+ * @return
+ */
+
+ String[] getDisplayedFeatureTypes();
+
+ /**
+ * get current displayed groups
+ *
+ * @return
+ */
+ String[] getDisplayedFeatureGroups();
+
+ /**
+ * display all features of these types
+ *
+ * @param featureTypes
+ */
+ void setAllVisible(List<String> featureTypes);
+
+ /**
+ * display featureType
+ *
+ * @param featureType
+ */
+ void setVisible(String featureType);
+
}
diff --git a/src/jalview/api/FeatureSettingsControllerI.java b/src/jalview/api/FeatureSettingsControllerI.java
new file mode 100644
index 0000000..e2701f2
--- /dev/null
+++ b/src/jalview/api/FeatureSettingsControllerI.java
@@ -0,0 +1,28 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+public interface FeatureSettingsControllerI
+{
+
+ void discoverAllFeatureData();
+
+}
diff --git a/src/jalview/api/FeatureSettingsModelI.java b/src/jalview/api/FeatureSettingsModelI.java
new file mode 100644
index 0000000..7bf680e
--- /dev/null
+++ b/src/jalview/api/FeatureSettingsModelI.java
@@ -0,0 +1,26 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+public interface FeatureSettingsModelI
+{
+
+}
diff --git a/src/jalview/api/FeaturesDisplayedI.java b/src/jalview/api/FeaturesDisplayedI.java
new file mode 100644
index 0000000..a7dc52f
--- /dev/null
+++ b/src/jalview/api/FeaturesDisplayedI.java
@@ -0,0 +1,49 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+public interface FeaturesDisplayedI
+{
+
+ Iterator<String> getVisibleFeatures();
+
+ boolean isVisible(String featureType);
+
+ boolean areVisible(Collection<String> featureTypes);
+
+ void clear();
+
+ void setVisible(String featureType);
+
+ void setAllVisible(Collection<String> featureTypes);
+
+ boolean isRegistered(String type);
+
+ void setAllRegisteredVisible();
+
+ int getVisibleFeatureCount();
+
+ int getRegisterdFeaturesCount();
+
+}
diff --git a/src/jalview/api/OOMHandlerI.java b/src/jalview/api/OOMHandlerI.java
new file mode 100644
index 0000000..23d018c
--- /dev/null
+++ b/src/jalview/api/OOMHandlerI.java
@@ -0,0 +1,28 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+public interface OOMHandlerI
+{
+
+ void raiseOOMWarning(String string, OutOfMemoryError error);
+
+}
diff --git a/src/jalview/api/RotatableCanvasI.java b/src/jalview/api/RotatableCanvasI.java
new file mode 100644
index 0000000..d28693a
--- /dev/null
+++ b/src/jalview/api/RotatableCanvasI.java
@@ -0,0 +1,39 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+import jalview.datamodel.SequencePoint;
+
+import java.util.Vector;
+
+/**
+ * interface implemented by RotatatableCanvas GUI elements (such as point clouds
+ * and simple structure views)
+ *
+ * @author jimp
+ *
+ */
+public interface RotatableCanvasI
+{
+
+ void setPoints(Vector<SequencePoint> points, int rows);
+
+}
diff --git a/src/jalview/api/SequenceRenderer.java b/src/jalview/api/SequenceRenderer.java
index a4ec373..55efb8d 100644
--- a/src/jalview/api/SequenceRenderer.java
+++ b/src/jalview/api/SequenceRenderer.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.api;
@@ -26,4 +29,6 @@ public interface SequenceRenderer
Color getResidueBoxColour(SequenceI sequenceI, int r);
+ Color getResidueColour(SequenceI seq, int position, FeatureRenderer fr);
+
}
diff --git a/src/jalview/api/SequenceStructureBinding.java b/src/jalview/api/SequenceStructureBinding.java
index b5938bb..d1e658a 100644
--- a/src/jalview/api/SequenceStructureBinding.java
+++ b/src/jalview/api/SequenceStructureBinding.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.api;
@@ -26,6 +29,23 @@ package jalview.api;
public interface SequenceStructureBinding
{
- // todo: decide what this really means - we could return a reference to the
- // alignment/jmol binding, or some other binding.
+ /**
+ *
+ * @return true if Jalview or the Viewer is still restoring state or loading
+ * is still going on (see setFinishedLoadingFromArchive)
+ */
+ void setLoadingFromArchive(boolean loadingFromArchive);
+
+ boolean isLoadingFromArchive();
+
+ /**
+ * modify flag which controls if sequence colouring events are honoured by the
+ * binding. Should be true for normal operation
+ *
+ * @param finishedLoading
+ */
+ void setFinishedLoadingFromArchive(boolean finishedLoading);
+
+ boolean isLoadingFinished();
+
}
diff --git a/src/jalview/api/SplitContainerI.java b/src/jalview/api/SplitContainerI.java
new file mode 100644
index 0000000..23439c6
--- /dev/null
+++ b/src/jalview/api/SplitContainerI.java
@@ -0,0 +1,58 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+import jalview.datamodel.AlignmentI;
+
+/**
+ * Describes a visual container that can show two alignments.
+ *
+ * @author gmcarstairs
+ *
+ */
+public interface SplitContainerI
+{
+
+ /**
+ * Set visibility of the specified split view component.
+ *
+ * @param alignFrame
+ * @param show
+ */
+ // TODO need an interface for AlignFrame?
+ void setComplementVisible(Object alignFrame, boolean show);
+
+ /**
+ * Returns the alignment that is complementary to the one in the given
+ * AlignFrame, or null.
+ */
+ AlignmentI getComplement(Object af);
+
+ /**
+ * Returns the frame title for the alignment that is complementary to the one
+ * in the given AlignFrame, or null.
+ *
+ * @param af
+ * @return
+ */
+ String getComplementTitle(Object af);
+
+}
diff --git a/src/jalview/api/StructureSelectionManagerProvider.java b/src/jalview/api/StructureSelectionManagerProvider.java
index e89aeb5..89a2df0 100644
--- a/src/jalview/api/StructureSelectionManagerProvider.java
+++ b/src/jalview/api/StructureSelectionManagerProvider.java
@@ -1,27 +1,30 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.api;
/**
- * Handles singleton generation/finalisation for a StructureSelectionManager instance in the current context.
+ * Handles singleton generation/finalisation for a StructureSelectionManager
+ * instance in the current context.
*/
public interface StructureSelectionManagerProvider
{
-
+
}
diff --git a/src/jalview/api/ViewStyleI.java b/src/jalview/api/ViewStyleI.java
new file mode 100644
index 0000000..8b313dc
--- /dev/null
+++ b/src/jalview/api/ViewStyleI.java
@@ -0,0 +1,260 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api;
+
+import java.awt.Color;
+
+public interface ViewStyleI
+{
+
+ void setColourAppliesToAllGroups(boolean b);
+
+ boolean getColourAppliesToAllGroups();
+
+ boolean getAbovePIDThreshold();
+
+ void setIncrement(int inc);
+
+ int getIncrement();
+
+ boolean getConservationSelected();
+
+ void setConservationSelected(boolean b);
+
+ void setShowHiddenMarkers(boolean show);
+
+ boolean getShowHiddenMarkers();
+
+ void setScaleRightWrapped(boolean b);
+
+ void setScaleLeftWrapped(boolean b);
+
+ void setScaleAboveWrapped(boolean b);
+
+ boolean getScaleLeftWrapped();
+
+ boolean getScaleAboveWrapped();
+
+ boolean getScaleRightWrapped();
+
+ void setAbovePIDThreshold(boolean b);
+
+ void setThreshold(int thresh);
+
+ int getThreshold();
+
+ boolean getShowJVSuffix();
+
+ void setShowJVSuffix(boolean b);
+
+ void setWrapAlignment(boolean state);
+
+ void setShowText(boolean state);
+
+ void setRenderGaps(boolean state);
+
+ boolean getColourText();
+
+ void setColourText(boolean state);
+
+ void setShowBoxes(boolean state);
+
+ boolean getWrapAlignment();
+
+ boolean getShowText();
+
+ int getWrappedWidth();
+
+ void setWrappedWidth(int w);
+
+ int getCharHeight();
+
+ void setCharHeight(int h);
+
+ int getCharWidth();
+
+ void setCharWidth(int w);
+
+ boolean getShowBoxes();
+
+ boolean getShowUnconserved();
+
+ void setShowUnconserved(boolean showunconserved);
+
+ /**
+ * @return true if a reference sequence is set and should be displayed
+ */
+ boolean isDisplayReferenceSeq();
+
+ /**
+ * @return set the flag for displaying reference sequences when they are
+ * available
+ */
+ void setDisplayReferenceSeq(boolean displayReferenceSeq);
+
+ /**
+ * @return true if colourschemes should render according to reference sequence
+ * rather than consensus if available
+ */
+ boolean isColourByReferenceSeq();
+
+ void setSeqNameItalics(boolean default1);
+
+ void setShowSequenceFeatures(boolean b);
+
+ boolean isShowSequenceFeatures();
+
+ boolean isRightAlignIds();
+
+ void setRightAlignIds(boolean rightAlignIds);
+
+ /**
+ * Returns true if annotation panel should be shown below alignment
+ *
+ * @return
+ */
+ boolean isShowAnnotation();
+
+ /**
+ * Set flag for whether annotation panel should be shown below alignment
+ *
+ * @param b
+ */
+ void setShowAnnotation(boolean b);
+
+ void setShowSequenceFeaturesHeight(boolean selected);
+
+ /**
+ * @return true set flag for deciding if colourschemes should render according
+ * to reference sequence rather than consensus if available
+ */
+ void setColourByReferenceSeq(boolean colourByReferenceSeq);
+
+ Color getTextColour();
+
+ Color getTextColour2();
+
+ int getThresholdTextColour();
+
+ boolean isConservationColourSelected();
+
+ boolean isRenderGaps();
+
+ boolean isShowColourText();
+
+ boolean isShowSequenceFeaturesHeight();
+
+ void setConservationColourSelected(boolean conservationColourSelected);
+
+ void setShowColourText(boolean showColourText);
+
+ void setTextColour(Color textColour);
+
+ void setThresholdTextColour(int thresholdTextColour);
+
+ void setTextColour2(Color textColour2);
+
+ boolean isSeqNameItalics();
+
+ void setUpperCasebold(boolean upperCasebold);
+
+ boolean isUpperCasebold();
+
+ boolean sameStyle(ViewStyleI them);
+
+ void setFontName(String name);
+
+ void setFontStyle(int style);
+
+ void setFontSize(int size);
+
+ int getFontStyle();
+
+ String getFontName();
+
+ int getFontSize();
+
+ /**
+ * @return width of Sequence and Annotation ID margin. If less than zero, then
+ * width will be autocalculated
+ */
+ int getIdWidth();
+
+ /**
+ * Set width if
+ *
+ * @param i
+ */
+
+ void setIdWidth(int i);
+
+ /**
+ * centre columnar annotation labels in displayed alignment annotation
+ */
+ boolean isCentreColumnLabels();
+
+ /**
+ * centre columnar annotation labels in displayed alignment annotation
+ */
+ void setCentreColumnLabels(boolean centreColumnLabels);
+
+ /**
+ * enable or disable the display of Database Cross References in the sequence
+ * ID tooltip
+ */
+ void setShowDBRefs(boolean showdbrefs);
+
+ /**
+ *
+ * @return true if Database References are to be displayed on tooltips.
+ */
+ boolean isShowDBRefs();
+
+ /**
+ *
+ * @return true if Non-positional features are to be displayed on tooltips.
+ */
+ boolean isShowNPFeats();
+
+ /**
+ * enable or disable the display of Non-Positional sequence features in the
+ * sequence ID tooltip
+ *
+ * @param show
+ */
+ void setShowNPFeats(boolean shownpfeats);
+
+ /**
+ * Get flag to scale protein residues 3 times the width of cDNA bases (only
+ * applicable in SplitFrame views)
+ *
+ * @return
+ */
+ boolean isScaleProteinAsCdna();
+
+ /**
+ * Set flag to scale protein residues 3 times the width of cDNA bases (only
+ * applicable in SplitFrame views)
+ *
+ * @return
+ */
+ void setScaleProteinAsCdna(boolean b);
+}
diff --git a/src/jalview/api/analysis/ScoreModelI.java b/src/jalview/api/analysis/ScoreModelI.java
new file mode 100644
index 0000000..4aab6d3
--- /dev/null
+++ b/src/jalview/api/analysis/ScoreModelI.java
@@ -0,0 +1,36 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api.analysis;
+
+import jalview.datamodel.AlignmentView;
+
+public interface ScoreModelI
+{
+
+ float[][] findDistances(AlignmentView seqData);
+
+ String getName();
+
+ boolean isDNA();
+
+ boolean isProtein();
+
+}
diff --git a/src/jalview/api/analysis/ViewBasedAnalysisI.java b/src/jalview/api/analysis/ViewBasedAnalysisI.java
new file mode 100644
index 0000000..d366bcf
--- /dev/null
+++ b/src/jalview/api/analysis/ViewBasedAnalysisI.java
@@ -0,0 +1,37 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api.analysis;
+
+import jalview.api.AlignmentViewPanel;
+
+public interface ViewBasedAnalysisI
+{
+
+ /**
+ * Parameterise the analysis model using the current view
+ *
+ * @param view
+ * @return true if model is applicable and calculation should proceed
+ */
+
+ boolean configureFromAlignmentView(AlignmentViewPanel view);
+
+}
diff --git a/src/jalview/api/structures/JalviewStructureDisplayI.java b/src/jalview/api/structures/JalviewStructureDisplayI.java
new file mode 100644
index 0000000..da16800
--- /dev/null
+++ b/src/jalview/api/structures/JalviewStructureDisplayI.java
@@ -0,0 +1,65 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.api.structures;
+
+import jalview.schemes.ColourSchemeI;
+import jalview.structures.models.AAStructureBindingModel;
+
+public interface JalviewStructureDisplayI
+{
+
+ AAStructureBindingModel getBinding();
+
+ /**
+ * @return true if there is an active GUI handling a structure display
+ */
+ boolean isVisible();
+
+ /**
+ * enable or disable the structure display - note this might just hide or show
+ * a GUI element, but not actually reset the display
+ *
+ * @param b
+ */
+ void setVisible(boolean b);
+
+ /**
+ * free up any external resources that were used by this display and collect
+ * garbage
+ */
+ void dispose();
+
+ /**
+ * Shutdown any Jalview structure viewing processes started by this display
+ *
+ * @param closeExternalViewer
+ * if true, force close any linked external viewer process
+ */
+ void closeViewer(boolean closeExternalViewer);
+
+ /**
+ * apply a colourscheme to the structures in the viewer
+ *
+ * @param colourScheme
+ */
+ void setJalviewColourScheme(ColourSchemeI colourScheme);
+
+}
diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java
index 0727b0c..a726e3c 100644
--- a/src/jalview/appletgui/APopupMenu.java
+++ b/src/jalview/appletgui/APopupMenu.java
@@ -1,37 +1,77 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.analysis.*;
-import jalview.commands.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import jalview.util.UrlLink;
+import jalview.analysis.AAFrequency;
+import jalview.analysis.AlignmentAnnotationUtils;
+import jalview.analysis.AlignmentUtils;
+import jalview.analysis.Conservation;
+import jalview.commands.ChangeCaseCommand;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
import jalview.io.AppletFormatAdapter;
+import jalview.io.SequenceAnnotationReport;
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.ClustalxColourScheme;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.NucleotideColourScheme;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.ZappoColourScheme;
+import jalview.util.MessageManager;
+import jalview.util.UrlLink;
+
+import java.awt.CheckboxMenuItem;
+import java.awt.Frame;
+import java.awt.Menu;
+import java.awt.MenuItem;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Vector;
public class APopupMenu extends java.awt.PopupMenu implements
ActionListener, ItemListener
{
+ private static final String ALL_ANNOTATIONS = "All";
+
Menu groupMenu = new Menu();
MenuItem editGroupName = new MenuItem();
@@ -68,6 +108,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
MenuItem unGroupMenuItem = new MenuItem();
+ MenuItem createGroupMenuItem = new MenuItem();
+
MenuItem nucleotideMenuItem = new MenuItem();
Menu colourMenu = new Menu();
@@ -80,17 +122,38 @@ public class APopupMenu extends java.awt.PopupMenu implements
CheckboxMenuItem displayNonconserved = new CheckboxMenuItem();
- Menu editMenu = new Menu("Edit");
+ Menu seqShowAnnotationsMenu = new Menu(
+ MessageManager.getString("label.show_annotations"));
+
+ Menu seqHideAnnotationsMenu = new Menu(
+ MessageManager.getString("label.hide_annotations"));
+
+ MenuItem seqAddReferenceAnnotations = new MenuItem(
+ MessageManager.getString("label.add_reference_annotations"));
- MenuItem copy = new MenuItem("Copy (Jalview Only)");
+ Menu groupShowAnnotationsMenu = new Menu(
+ MessageManager.getString("label.show_annotations"));
- MenuItem cut = new MenuItem("Cut (Jalview Only)");
+ Menu groupHideAnnotationsMenu = new Menu(
+ MessageManager.getString("label.hide_annotations"));
- MenuItem toUpper = new MenuItem("To Upper Case");
+ MenuItem groupAddReferenceAnnotations = new MenuItem(
+ MessageManager.getString("label.add_reference_annotations"));
- MenuItem toLower = new MenuItem("To Lower Case");
+ Menu editMenu = new Menu(MessageManager.getString("action.edit"));
- MenuItem toggleCase = new MenuItem("Toggle Case");
+ MenuItem copy = new MenuItem(MessageManager.getString("action.copy"));
+
+ MenuItem cut = new MenuItem(MessageManager.getString("action.cut"));
+
+ MenuItem toUpper = new MenuItem(
+ MessageManager.getString("label.to_upper_case"));
+
+ MenuItem toLower = new MenuItem(
+ MessageManager.getString("label.to_lower_case"));
+
+ MenuItem toggleCase = new MenuItem(
+ MessageManager.getString("label.toggle_case"));
Menu outputmenu = new Menu();
@@ -102,24 +165,38 @@ public class APopupMenu extends java.awt.PopupMenu implements
MenuItem repGroup = new MenuItem();
- MenuItem sequenceName = new MenuItem("Edit Name/Description");
+ MenuItem sequenceName = new MenuItem(
+ MessageManager.getString("label.edit_name_description"));
+
+ MenuItem sequenceFeature = new MenuItem(
+ MessageManager.getString("label.create_sequence_feature"));
- MenuItem sequenceFeature = new MenuItem("Create Sequence Feature");
+ MenuItem editSequence = new MenuItem(
+ MessageManager.getString("label.edit_sequence"));
- MenuItem editSequence = new MenuItem("Edit Sequence");
+ MenuItem sequenceDetails = new MenuItem(
+ MessageManager.getString("label.sequence_details"));
- Sequence seq;
+ MenuItem selSeqDetails = new MenuItem(
+ MessageManager.getString("label.sequence_details"));
+
+ MenuItem makeReferenceSeq = new MenuItem();
+
+ SequenceI seq;
MenuItem revealAll = new MenuItem();
MenuItem revealSeq = new MenuItem();
+
/**
* index of sequence to be revealed
*/
- int revealSeq_index=-1;
+ int revealSeq_index = -1;
+
Menu menu1 = new Menu();
- public APopupMenu(AlignmentPanel apanel, final Sequence seq, Vector links)
+ public APopupMenu(AlignmentPanel apanel, final SequenceI seq,
+ Vector<String> links)
{
// /////////////////////////////////////////////////////////
// If this is activated from the sequence panel, the user may want to
@@ -148,19 +225,27 @@ public class APopupMenu extends java.awt.PopupMenu implements
outputmenu.add(item);
}
- SequenceGroup sg = ap.av.getSelectionGroup();
+ buildAnnotationSubmenus();
+ SequenceGroup sg = ap.av.getSelectionGroup();
if (sg != null && sg.getSize() > 0)
{
- editGroupName.setLabel("Name: "+sg.getName());
+ editGroupName.setLabel(MessageManager.formatMessage(
+ "label.name_param", new Object[] { sg.getName() }));
showText.setState(sg.getDisplayText());
showColourText.setState(sg.getColourText());
showBoxes.setState(sg.getDisplayBoxes());
displayNonconserved.setState(sg.getShowNonconserved());
- if (!ap.av.alignment.getGroups().contains(sg))
+ if (!ap.av.getAlignment().getGroups().contains(sg))
{
+ menu1.setLabel(MessageManager.getString("action.edit_new_group"));
groupMenu.remove(unGroupMenuItem);
}
+ else
+ {
+ menu1.setLabel(MessageManager.getString("action.edit_group"));
+ groupMenu.remove(createGroupMenuItem);
+ }
}
else
@@ -171,11 +256,10 @@ public class APopupMenu extends java.awt.PopupMenu implements
if (links != null && links.size() > 0)
{
- Menu linkMenu = new Menu("Link");
- String link;
+ Menu linkMenu = new Menu(MessageManager.getString("action.link"));
for (int i = 0; i < links.size(); i++)
{
- link = links.elementAt(i).toString();
+ String link = links.elementAt(i);
UrlLink urlLink = new UrlLink(link);
if (!urlLink.isValid())
{
@@ -185,13 +269,12 @@ public class APopupMenu extends java.awt.PopupMenu implements
final String target = urlLink.getTarget(); // link.substring(0,
// link.indexOf("|"));
final String label = urlLink.getLabel();
- if (seq!=null && urlLink.isDynamic())
+ if (seq != null && urlLink.isDynamic())
{
// collect matching db-refs
DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs(
- seq.getDBRef(), new String[]
- { target });
+ seq.getDBRef(), new String[] { target });
// collect id string too
String id = seq.getName();
String descr = seq.getDescription();
@@ -293,31 +376,136 @@ public class APopupMenu extends java.awt.PopupMenu implements
if (seq != null)
{
seqMenu.setLabel(seq.getName());
- repGroup.setLabel("Represent Group with " + seq.getName());
+ if (seq == ap.av.getAlignment().getSeqrep())
+ {
+ makeReferenceSeq.setLabel(MessageManager
+ .getString("action.unmark_as_reference"));// Unmark
+ // representative");
+ }
+ else
+ {
+ makeReferenceSeq.setLabel(MessageManager
+ .getString("action.set_as_reference")); // );
+ }
+ repGroup.setLabel(MessageManager.formatMessage(
+ "label.represent_group_with", new Object[] { seq.getName() }));
}
else
{
remove(seqMenu);
}
- if (!ap.av.hasHiddenRows)
+ if (!ap.av.hasHiddenRows())
{
remove(revealAll);
remove(revealSeq);
- } else {
- final int index = ap.av.alignment.findIndex(seq);
+ }
+ else
+ {
+ final int index = ap.av.getAlignment().findIndex(seq);
if (ap.av.adjustForHiddenSeqs(index)
- ap.av.adjustForHiddenSeqs(index - 1) > 1)
{
- revealSeq_index=index;
- } else {
+ revealSeq_index = index;
+ }
+ else
+ {
remove(revealSeq);
}
}
}
/**
+ * Build menus for annotation types that may be shown or hidden, and for
+ * 'reference annotations' that may be added to the alignment.
+ */
+ private void buildAnnotationSubmenus()
+ {
+ /*
+ * First for the currently selected sequence (if there is one):
+ */
+ final List<SequenceI> selectedSequence = (seq == null ? Collections
+ .<SequenceI> emptyList() : Arrays.asList(seq));
+ buildAnnotationTypesMenus(seqShowAnnotationsMenu,
+ seqHideAnnotationsMenu, selectedSequence);
+ configureReferenceAnnotationsMenu(seqAddReferenceAnnotations,
+ selectedSequence);
+
+ /*
+ * and repeat for the current selection group (if there is one):
+ */
+ final List<SequenceI> selectedGroup = (ap.av.getSelectionGroup() == null ? Collections
+ .<SequenceI> emptyList() : ap.av.getSelectionGroup()
+ .getSequences());
+ buildAnnotationTypesMenus(groupShowAnnotationsMenu,
+ groupHideAnnotationsMenu, selectedGroup);
+ configureReferenceAnnotationsMenu(groupAddReferenceAnnotations,
+ selectedGroup);
+ }
+
+ /**
+ * Determine whether or not to enable 'add reference annotations' menu item.
+ * It is enable if there are any annotations, on any of the selected
+ * sequences, which are not yet on the alignment (visible or not).
+ *
+ * @param menu
+ * @param forSequences
+ */
+ private void configureReferenceAnnotationsMenu(MenuItem menuItem,
+ List<SequenceI> forSequences)
+ {
+ menuItem.setEnabled(false);
+
+ /*
+ * Temporary store to hold distinct calcId / type pairs for the tooltip.
+ * Using TreeMap means calcIds are shown in alphabetical order.
+ */
+ Map<String, String> tipEntries = new TreeMap<String, String>();
+ final Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<SequenceI, List<AlignmentAnnotation>>();
+ AlignmentI al = this.ap.av.getAlignment();
+ AlignmentUtils.findAddableReferenceAnnotations(forSequences,
+ tipEntries, candidates, al);
+ if (!candidates.isEmpty())
+ {
+ StringBuilder tooltip = new StringBuilder(64);
+ tooltip.append(MessageManager.getString("label.add_annotations_for"));
+
+ /*
+ * Found annotations that could be added. Enable the menu item, and
+ * configure its action.
+ */
+ menuItem.setEnabled(true);
+
+ menuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ addReferenceAnnotations_actionPerformed(candidates);
+ }
+ });
+ }
+ }
+
+ /**
+ * Add annotations to the sequences and to the alignment.
+ *
+ * @param candidates
+ * a map whose keys are sequences on the alignment, and values a list
+ * of annotations to add to each sequence
+ */
+ protected void addReferenceAnnotations_actionPerformed(
+ Map<SequenceI, List<AlignmentAnnotation>> candidates)
+ {
+ final SequenceGroup selectionGroup = this.ap.av.getSelectionGroup();
+ final AlignmentI alignment = this.ap.getAlignment();
+ AlignmentUtils.addReferenceAnnotations(candidates, alignment,
+ selectionGroup);
+ refresh();
+ }
+
+ /**
* add a show URL menu item to the given linkMenu
*
* @param linkMenu
@@ -446,10 +634,27 @@ public class APopupMenu extends java.awt.PopupMenu implements
unGroupMenuItem_actionPerformed();
}
+ else if (source == createGroupMenuItem)
+ {
+ createGroupMenuItem_actionPerformed();
+ }
+
else if (source == sequenceName)
{
editName();
}
+ else if (source == makeReferenceSeq)
+ {
+ makeReferenceSeq_actionPerformed();
+ }
+ else if (source == sequenceDetails)
+ {
+ showSequenceDetails();
+ }
+ else if (source == selSeqDetails)
+ {
+ showSequenceSelectionDetails();
+ }
else if (source == pdb)
{
addPDB();
@@ -500,7 +705,9 @@ public class APopupMenu extends java.awt.PopupMenu implements
if (sg != null)
{
if (seq == null)
- seq = (Sequence) sg.getSequenceAt(0);
+ {
+ seq = sg.getSequenceAt(0);
+ }
EditNameDialog dialog = new EditNameDialog(seq.getSequenceAsString(
sg.getStartRes(), sg.getEndRes() + 1), null,
@@ -510,11 +717,13 @@ public class APopupMenu extends java.awt.PopupMenu implements
if (dialog.accept)
{
- EditCommand editCommand = new EditCommand("Edit Sequences",
- EditCommand.REPLACE, dialog.getName().replace(' ',
+ EditCommand editCommand = new EditCommand(
+ MessageManager.getString("label.edit_sequences"),
+ Action.REPLACE, dialog.getName().replace(' ',
ap.av.getGapCharacter()),
- sg.getSequencesAsArray(ap.av.hiddenRepSequences),
- sg.getStartRes(), sg.getEndRes() + 1, ap.av.alignment);
+ sg.getSequencesAsArray(ap.av.getHiddenRepSequences()),
+ sg.getStartRes(), sg.getEndRes() + 1,
+ ap.av.getAlignment());
ap.alignFrame.addHistoryItem(editCommand);
@@ -526,47 +735,10 @@ public class APopupMenu extends java.awt.PopupMenu implements
else if (source == toUpper || source == toLower || source == toggleCase)
{
SequenceGroup sg = ap.av.getSelectionGroup();
- Vector regions = new Vector();
if (sg != null)
{
- int start = sg.getStartRes();
- int end = sg.getEndRes() + 1;
-
- do
- {
- if (ap.av.hasHiddenColumns)
- {
- if (start == 0)
- {
- start = ap.av.colSel.adjustForHiddenColumns(start);
- }
-
- end = ap.av.colSel.getHiddenBoundaryRight(start);
- if (start == end)
- {
- end = sg.getEndRes() + 1;
- }
- if (end > sg.getEndRes())
- {
- end = sg.getEndRes() + 1;
- }
- }
-
- regions.addElement(new int[]
- { start, end });
-
- if (ap.av.hasHiddenColumns)
- {
- start = ap.av.colSel.adjustForHiddenColumns(end);
- start = ap.av.colSel.getHiddenBoundaryLeft(start) + 1;
- }
- } while (end < sg.getEndRes());
-
- int[][] startEnd = new int[regions.size()][2];
- for (int i = 0; i < regions.size(); i++)
- {
- startEnd[i] = (int[]) regions.elementAt(i);
- }
+ List<int[]> startEnd = ap.av.getVisibleRegionBoundaries(
+ sg.getStartRes(), sg.getEndRes() + 1);
String description;
int caseChange;
@@ -588,8 +760,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
}
ChangeCaseCommand caseCommand = new ChangeCaseCommand(description,
- sg.getSequencesAsArray(ap.av.hiddenRepSequences), startEnd,
- caseChange);
+ sg.getSequencesAsArray(ap.av.getHiddenRepSequences()),
+ startEnd, caseChange);
ap.alignFrame.addHistoryItem(caseCommand);
@@ -633,7 +805,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
features, true, ap))
{
ap.alignFrame.sequenceFeatures.setState(true);
- ap.av.showSequenceFeatures(true);
+ ap.av.setShowSequenceFeatures(true);
+ ;
ap.highlightSearchResults(null);
}
}
@@ -650,14 +823,56 @@ public class APopupMenu extends java.awt.PopupMenu implements
Frame frame = new Frame();
frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame,
- "Selection output - " + e.getActionCommand(), 600, 500);
+ jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
+ "label.selection_output_command",
+ new Object[] { e.getActionCommand() }), 600, 500);
+ // JBPNote: getSelectionAsNewSequence behaviour has changed - this method
+ // now returns a full copy of sequence data
+ // TODO consider using getSequenceSelection instead here
cap.setText(new jalview.io.AppletFormatAdapter().formatSequences(
- e.getActionCommand(),
- new Alignment(ap.av.getSelectionAsNewSequence()),
- ap.av.showJVSuffix));
+ e.getActionCommand(), ap.av.getShowJVSuffix(), ap, true));
+
+ }
+
+ protected void showSequenceSelectionDetails()
+ {
+ createSequenceDetailsReport(ap.av.getSequenceSelection());
+ }
+
+ protected void showSequenceDetails()
+ {
+ createSequenceDetailsReport(new SequenceI[] { seq });
+ }
+
+ public void createSequenceDetailsReport(SequenceI[] sequences)
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame);
+
+ StringBuffer contents = new StringBuffer();
+ for (SequenceI seq : sequences)
+ {
+ contents.append(MessageManager.formatMessage(
+ "label.annotation_for_displayid",
+ new Object[] { seq.getDisplayId(true) }));
+ new SequenceAnnotationReport(null).createSequenceAnnotationReport(
+ contents,
+ seq,
+ true,
+ true,
+ false,
+ (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr
+ .getMinMax() : null);
+ contents.append("</p>");
+ }
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame, "Sequence Details for "
+ + (sequences.length == 1 ? sequences[0].getDisplayId(true)
+ : "Selection"), 600, 500);
+ cap.setText(MessageManager.formatMessage("label.html_content",
+ new Object[] { contents.toString() }));
}
void editName()
@@ -677,72 +892,92 @@ public class APopupMenu extends java.awt.PopupMenu implements
void addPDB()
{
- if (seq.getPDBId() != null)
+ if (seq.getAllPDBEntries() != null)
{
- PDBEntry entry = (PDBEntry) seq.getPDBId().firstElement();
+ PDBEntry entry = seq.getAllPDBEntries().firstElement();
if (ap.av.applet.jmolAvailable)
- new jalview.appletgui.AppletJmol(entry, new Sequence[]
- { seq }, null, ap, AppletFormatAdapter.URL);
+ {
+ new jalview.appletgui.AppletJmol(entry, new SequenceI[] { seq },
+ null, ap, AppletFormatAdapter.URL);
+ }
else
- new MCview.AppletPDBViewer(entry, new Sequence[]
- { seq }, null, ap, AppletFormatAdapter.URL);
+ {
+ new MCview.AppletPDBViewer(entry, new SequenceI[] { seq }, null,
+ ap, AppletFormatAdapter.URL);
+ }
}
else
{
CutAndPasteTransfer cap = new CutAndPasteTransfer(true, ap.alignFrame);
- cap.setText("Paste your PDB file here.");
+ cap.setText(MessageManager.getString("label.paste_pdb_file"));
cap.setPDBImport(seq);
Frame frame = new Frame();
frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "Paste PDB file for sequence "+seq.getName(), 400, 300);
+ jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
+ "label.paste_pdb_file_for_sequence",
+ new Object[] { seq.getName() }), 400, 300);
}
}
private void jbInit() throws Exception
{
- groupMenu.setLabel("Group");
- groupMenu.setLabel("Selection");
+ groupMenu.setLabel(MessageManager.getString("label.selection"));
sequenceFeature.addActionListener(this);
editGroupName.addActionListener(this);
- unGroupMenuItem.setLabel("Remove Group");
+ unGroupMenuItem.setLabel(MessageManager
+ .getString("action.remove_group"));
unGroupMenuItem.addActionListener(this);
- nucleotideMenuItem.setLabel("Nucleotide");
+ createGroupMenuItem.setLabel(MessageManager
+ .getString("action.create_group"));
+ createGroupMenuItem.addActionListener(this);
+
+ nucleotideMenuItem.setLabel(MessageManager
+ .getString("label.nucleotide"));
nucleotideMenuItem.addActionListener(this);
conservationMenuItem.addItemListener(this);
abovePIDColour.addItemListener(this);
- colourMenu.setLabel("Group Colour");
- showBoxes.setLabel("Boxes");
+ colourMenu.setLabel(MessageManager.getString("label.group_colour"));
+ showBoxes.setLabel(MessageManager.getString("action.boxes"));
showBoxes.setState(true);
showBoxes.addItemListener(this);
sequenceName.addActionListener(this);
- displayNonconserved.setLabel("Show Nonconserved");
+ sequenceDetails.addActionListener(this);
+ selSeqDetails.addActionListener(this);
+ displayNonconserved.setLabel(MessageManager
+ .getString("label.show_non_conversed"));
displayNonconserved.setState(false);
displayNonconserved.addItemListener(this);
- showText.setLabel("Text");
+ showText.setLabel(MessageManager.getString("action.text"));
showText.addItemListener(this);
- showColourText.setLabel("Colour Text");
+ showColourText.setLabel(MessageManager.getString("label.colour_text"));
showColourText.addItemListener(this);
- outputmenu.setLabel("Output to Textbox...");
- seqMenu.setLabel("Sequence");
- pdb.setLabel("View PDB Structure");
- hideSeqs.setLabel("Hide Sequences");
- repGroup.setLabel("Represent Group with");
- revealAll.setLabel("Reveal All");
- revealSeq.setLabel("Reveal Sequences");
- menu1.setLabel("Group");
+ outputmenu.setLabel(MessageManager.getString("label.out_to_textbox"));
+ seqMenu.setLabel(MessageManager.getString("label.sequence"));
+ pdb.setLabel(MessageManager.getString("label.view_pdb_structure"));
+ hideSeqs.setLabel(MessageManager.getString("action.hide_sequences"));
+ repGroup.setLabel(MessageManager.formatMessage(
+ "label.represent_group_with", new Object[] { "" }));
+ revealAll.setLabel(MessageManager.getString("action.reveal_all"));
+ revealSeq.setLabel(MessageManager.getString("action.reveal_sequences"));
+ menu1.setLabel(MessageManager.getString("label.group") + ":");
add(groupMenu);
this.add(seqMenu);
this.add(hideSeqs);
this.add(revealSeq);
this.add(revealAll);
- groupMenu.add(editGroupName);
+ // groupMenu.add(selSeqDetails);
+ groupMenu.add(groupShowAnnotationsMenu);
+ groupMenu.add(groupHideAnnotationsMenu);
+ groupMenu.add(groupAddReferenceAnnotations);
groupMenu.add(editMenu);
groupMenu.add(outputmenu);
groupMenu.add(sequenceFeature);
+ groupMenu.add(createGroupMenuItem);
+ groupMenu.add(unGroupMenuItem);
groupMenu.add(menu1);
colourMenu.add(noColourmenuItem);
@@ -762,34 +997,42 @@ public class APopupMenu extends java.awt.PopupMenu implements
colourMenu.add(abovePIDColour);
colourMenu.add(conservationMenuItem);
- noColourmenuItem.setLabel("None");
+ noColourmenuItem.setLabel(MessageManager.getString("label.none"));
noColourmenuItem.addActionListener(this);
- clustalColour.setLabel("Clustalx colours");
+ clustalColour.setLabel(MessageManager
+ .getString("label.clustalx_colours"));
clustalColour.addActionListener(this);
- zappoColour.setLabel("Zappo");
+ zappoColour.setLabel(MessageManager.getString("label.zappo"));
zappoColour.addActionListener(this);
- taylorColour.setLabel("Taylor");
+ taylorColour.setLabel(MessageManager.getString("label.taylor"));
taylorColour.addActionListener(this);
- hydrophobicityColour.setLabel("Hydrophobicity");
+ hydrophobicityColour.setLabel(MessageManager
+ .getString("label.hydrophobicity"));
hydrophobicityColour.addActionListener(this);
- helixColour.setLabel("Helix propensity");
+ helixColour
+ .setLabel(MessageManager.getString("label.helix_propensity"));
helixColour.addActionListener(this);
- strandColour.setLabel("Strand propensity");
+ strandColour.setLabel(MessageManager
+ .getString("label.strand_propensity"));
strandColour.addActionListener(this);
- turnColour.setLabel("Turn propensity");
+ turnColour.setLabel(MessageManager.getString("label.turn_propensity"));
turnColour.addActionListener(this);
- buriedColour.setLabel("Buried Index");
+ buriedColour.setLabel(MessageManager.getString("label.buried_index"));
buriedColour.addActionListener(this);
- abovePIDColour.setLabel("Above % Identity");
+ abovePIDColour.setLabel(MessageManager
+ .getString("label.above_identity_percentage"));
- userDefinedColour.setLabel("User Defined");
+ userDefinedColour.setLabel(MessageManager
+ .getString("action.user_defined"));
userDefinedColour.addActionListener(this);
- PIDColour.setLabel("Percentage Identity");
+ PIDColour.setLabel(MessageManager
+ .getString("label.percentage_identity"));
PIDColour.addActionListener(this);
BLOSUM62Colour.setLabel("BLOSUM62");
BLOSUM62Colour.addActionListener(this);
- conservationMenuItem.setLabel("Conservation");
+ conservationMenuItem.setLabel(MessageManager
+ .getString("label.conservation"));
editMenu.add(copy);
copy.addActionListener(this);
@@ -804,13 +1047,19 @@ public class APopupMenu extends java.awt.PopupMenu implements
editMenu.add(toLower);
toLower.addActionListener(this);
editMenu.add(toggleCase);
+ seqMenu.add(seqShowAnnotationsMenu);
+ seqMenu.add(seqHideAnnotationsMenu);
+ seqMenu.add(seqAddReferenceAnnotations);
seqMenu.add(sequenceName);
+ seqMenu.add(makeReferenceSeq);
+ // seqMenu.add(sequenceDetails);
+
if (!ap.av.applet.useXtrnalSviewer)
{
seqMenu.add(pdb);
}
seqMenu.add(repGroup);
- menu1.add(unGroupMenuItem);
+ menu1.add(editGroupName);
menu1.add(colourMenu);
menu1.add(showBoxes);
menu1.add(showText);
@@ -822,6 +1071,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
repGroup.addActionListener(this);
revealAll.addActionListener(this);
revealSeq.addActionListener(this);
+ makeReferenceSeq.addActionListener(this);
}
void refresh()
@@ -832,9 +1082,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
protected void clustalColour_actionPerformed()
{
SequenceGroup sg = getGroup();
- sg.cs = new ClustalxColourScheme(
- sg.getSequences(ap.av.hiddenRepSequences),
- ap.av.alignment.getWidth());
+ sg.cs = new ClustalxColourScheme(sg, ap.av.getHiddenRepSequences());
refresh();
}
@@ -896,13 +1144,12 @@ public class APopupMenu extends java.awt.PopupMenu implements
if (abovePIDColour.getState())
{
- sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), 0,
- ap.av.alignment.getWidth()));
+ sg.cs.setConsensus(AAFrequency.calculate(sg.getSequences(ap.av
+ .getHiddenRepSequences()), 0, ap.av.getAlignment().getWidth()));
int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup()
.getName());
- sg.cs.setThreshold(threshold, ap.av.getIgnoreGapsConsensus());
+ sg.cs.setThreshold(threshold, ap.av.isIgnoreGapsConsensus());
SliderPanel.showPIDSlider();
@@ -910,7 +1157,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
else
// remove PIDColouring
{
- sg.cs.setThreshold(0, ap.av.getIgnoreGapsConsensus());
+ sg.cs.setThreshold(0, ap.av.isIgnoreGapsConsensus());
}
refresh();
@@ -926,9 +1173,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
{
SequenceGroup sg = getGroup();
sg.cs = new PIDColourScheme();
- sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), 0,
- ap.av.alignment.getWidth()));
+ sg.cs.setConsensus(AAFrequency.calculate(sg.getSequences(ap.av
+ .getHiddenRepSequences()), 0, ap.av.getAlignment().getWidth()));
refresh();
}
@@ -938,9 +1184,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
sg.cs = new Blosum62ColourScheme();
- sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), 0,
- ap.av.alignment.getWidth()));
+ sg.cs.setConsensus(AAFrequency.calculate(sg.getSequences(ap.av
+ .getHiddenRepSequences()), 0, ap.av.getAlignment().getWidth()));
refresh();
}
@@ -962,16 +1207,10 @@ public class APopupMenu extends java.awt.PopupMenu implements
if (conservationMenuItem.getState())
{
- Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3,
- sg.getSequences(ap.av.hiddenRepSequences), 0,
- ap.av.alignment.getWidth());
-
- c.calculate();
- c.verdict(false, ap.av.ConsPercGaps);
-
- sg.cs.setConservation(c);
-
+ sg.cs.setConservation(Conservation.calculateConservation("Group",
+ ResidueProperties.propHash, 3, sg.getSequences(ap.av
+ .getHiddenRepSequences()), 0, ap.av.getAlignment()
+ .getWidth(), false, ap.av.getConsPercGaps(), false));
SliderPanel.setConservationSlider(ap, sg.cs, sg.getName());
SliderPanel.showConservationSlider();
}
@@ -991,7 +1230,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
// this method won't add a new group if it already exists
if (sg != null)
{
- ap.av.alignment.addGroup(sg);
+ ap.av.getAlignment().addGroup(sg);
}
return sg;
@@ -1000,11 +1239,17 @@ public class APopupMenu extends java.awt.PopupMenu implements
void unGroupMenuItem_actionPerformed()
{
SequenceGroup sg = ap.av.getSelectionGroup();
- ap.av.alignment.deleteGroup(sg);
+ ap.av.getAlignment().deleteGroup(sg);
ap.av.setSelectionGroup(null);
ap.paintAlignment(true);
}
+ void createGroupMenuItem_actionPerformed()
+ {
+ getGroup(); // implicitly create group
+ refresh();
+ }
+
public void showColourText_itemStateChanged()
{
getGroup().setColourText(showColourText.getState());
@@ -1017,6 +1262,29 @@ public class APopupMenu extends java.awt.PopupMenu implements
refresh();
}
+ public void makeReferenceSeq_actionPerformed()
+ {
+ if (!ap.av.getAlignment().hasSeqrep())
+ {
+ // initialise the display flags so the user sees something happen
+ ap.av.setDisplayReferenceSeq(true);
+ ap.av.setColourByReferenceSeq(true);
+ ap.av.getAlignment().setSeqrep(seq);
+ }
+ else
+ {
+ if (ap.av.getAlignment().getSeqrep() == seq)
+ {
+ ap.av.getAlignment().setSeqrep(null);
+ }
+ else
+ {
+ ap.av.getAlignment().setSeqrep(seq);
+ }
+ }
+ refresh();
+ }
+
public void showNonconserved_itemStateChanged()
{
getGroup().setShowNonconserved(this.displayNonconserved.getState());
@@ -1034,8 +1302,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
SequenceGroup sg = ap.av.getSelectionGroup();
if (sg == null || sg.getSize() < 1)
{
- ap.av.hideSequence(new SequenceI[]
- { seq });
+ ap.av.hideSequence(new SequenceI[] { seq });
return;
}
@@ -1063,4 +1330,107 @@ public class APopupMenu extends java.awt.PopupMenu implements
ap.av.sendSelection();
}
+ /**
+ * Add annotation types to 'Show annotations' and/or 'Hide annotations' menus.
+ * "All" is added first, followed by a separator. Then add any annotation
+ * types associated with the current selection. Separate menus are built for
+ * the selected sequence group (if any), and the selected sequence.
+ * <p>
+ * Some annotation rows are always rendered together - these can be identified
+ * by a common graphGroup property > -1. Only one of each group will be marked
+ * as visible (to avoid duplication of the display). For such groups we add a
+ * composite type name, e.g.
+ * <p>
+ * IUPredWS (Long), IUPredWS (Short)
+ *
+ * @param seq
+ */
+ protected void buildAnnotationTypesMenus(Menu showMenu, Menu hideMenu,
+ List<SequenceI> forSequences)
+ {
+ showMenu.removeAll();
+ hideMenu.removeAll();
+
+ final List<String> all = Arrays.asList(ALL_ANNOTATIONS);
+ addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, true);
+ addAnnotationTypeToShowHide(hideMenu, forSequences, "", all, true,
+ false);
+ showMenu.addSeparator();
+ hideMenu.addSeparator();
+
+ final AlignmentAnnotation[] annotations = ap.getAlignment()
+ .getAlignmentAnnotation();
+
+ /*
+ * Find shown/hidden annotations types, distinguished by source (calcId),
+ * and grouped by graphGroup. Using LinkedHashMap means we will retrieve in
+ * the insertion order, which is the order of the annotations on the
+ * alignment.
+ */
+ Map<String, List<List<String>>> shownTypes = new LinkedHashMap<String, List<List<String>>>();
+ Map<String, List<List<String>>> hiddenTypes = new LinkedHashMap<String, List<List<String>>>();
+ AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes,
+ AlignmentAnnotationUtils.asList(annotations), forSequences);
+
+ for (String calcId : hiddenTypes.keySet())
+ {
+ for (List<String> type : hiddenTypes.get(calcId))
+ {
+ addAnnotationTypeToShowHide(showMenu, forSequences, calcId, type,
+ false, true);
+ }
+ }
+ // grey out 'show annotations' if none are hidden
+ showMenu.setEnabled(!hiddenTypes.isEmpty());
+
+ for (String calcId : shownTypes.keySet())
+ {
+ for (List<String> type : shownTypes.get(calcId))
+ {
+ addAnnotationTypeToShowHide(hideMenu, forSequences, calcId, type,
+ false, false);
+ }
+ }
+ // grey out 'hide annotations' if none are shown
+ hideMenu.setEnabled(!shownTypes.isEmpty());
+ }
+
+ /**
+ * Add one annotation type to the 'Show Annotations' or 'Hide Annotations'
+ * menus.
+ *
+ * @param showOrHideMenu
+ * the menu to add to
+ * @param forSequences
+ * the sequences whose annotations may be shown or hidden
+ * @param calcId
+ * @param types
+ * the label to add
+ * @param allTypes
+ * if true this is a special label meaning 'All'
+ * @param actionIsShow
+ * if true, the select menu item action is to show the annotation
+ * type, else hide
+ */
+ protected void addAnnotationTypeToShowHide(Menu showOrHideMenu,
+ final List<SequenceI> forSequences, String calcId,
+ final List<String> types, final boolean allTypes,
+ final boolean actionIsShow)
+ {
+ String label = types.toString(); // [a, b, c]
+ label = label.substring(1, label.length() - 1);
+ final MenuItem item = new MenuItem(label);
+ item.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ AlignmentUtils.showOrHideSequenceAnnotations(ap.getAlignment(),
+ types, forSequences, allTypes, actionIsShow);
+ refresh();
+ }
+ });
+ showOrHideMenu.add(item);
+ }
+
}
diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java
index 759075a..e01c4c9 100644
--- a/src/jalview/appletgui/AlignFrame.java
+++ b/src/jalview/appletgui/AlignFrame.java
@@ -1,3583 +1,4239 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.appletgui;
-
-import java.net.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.analysis.*;
-import jalview.api.SequenceStructureBinding;
-import jalview.bin.JalviewLite;
-import jalview.commands.*;
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.schemes.*;
-import jalview.structure.StructureSelectionManager;
-
-public class AlignFrame extends EmbmenuFrame implements ActionListener,
- ItemListener, KeyListener
-{
- public AlignmentPanel alignPanel;
-
- public AlignViewport viewport;
-
- int DEFAULT_WIDTH = 700;
-
- int DEFAULT_HEIGHT = 500;
-
- String jalviewServletURL;
-
- public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet,
- String title, boolean embedded)
- {
-
- if (applet != null)
- {
- jalviewServletURL = applet.getParameter("APPLICATION_URL");
- }
-
- try
- {
- jbInit();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- viewport = new AlignViewport(al, applet);
- alignPanel = new AlignmentPanel(this, viewport);
-
- viewport.updateConservation(alignPanel);
- viewport.updateConsensus(alignPanel);
-
- annotationPanelMenuItem.setState(viewport.showAnnotation);
- displayNonconservedMenuItem.setState(viewport.getShowunconserved());
- followMouseOverFlag.setState(viewport.getFollowHighlight());
- showGroupConsensus.setState(viewport.showGroupConsensus);
- showGroupConservation.setState(viewport.showGroupConservation);
- showConsensusHistogram.setState(viewport.showConsensusHistogram);
- showSequenceLogo.setState(viewport.showSequenceLogo);
-
- seqLimits.setState(viewport.showJVSuffix);
-
- if (applet != null)
- {
- String param = applet.getParameter("sortBy");
- if (param != null)
- {
- if (param.equalsIgnoreCase("Id"))
- {
- sortIDMenuItem_actionPerformed();
- }
- else if (param.equalsIgnoreCase("Pairwise Identity"))
- {
- sortPairwiseMenuItem_actionPerformed();
- }
- else if (param.equalsIgnoreCase("Length"))
- {
- sortLengthMenuItem_actionPerformed();
- }
- }
-
- param = applet.getParameter("wrap");
- if (param != null)
- {
- if (param.equalsIgnoreCase("true"))
- {
- wrapMenuItem.setState(true);
- wrapMenuItem_actionPerformed();
- }
- }
- param = applet.getParameter("centrecolumnlabels");
- if (param != null)
- {
- centreColumnLabelFlag.setState(true);
- centreColumnLabelFlag_stateChanged();
- }
- try
- {
- param = applet.getParameter("windowWidth");
- if (param != null)
- {
- int width = Integer.parseInt(param);
- DEFAULT_WIDTH = width;
- }
- param = applet.getParameter("windowHeight");
- if (param != null)
- {
- int height = Integer.parseInt(param);
- DEFAULT_HEIGHT = height;
- }
- } catch (Exception ex)
- {
- }
-
- }
-
- // Some JVMS send keyevents to Top frame or lowest panel,
- // Havent worked out why yet. So add to both this frame and seqCanvas for
- // now
- this.addKeyListener(this);
- alignPanel.seqPanel.seqCanvas.addKeyListener(this);
- alignPanel.idPanel.idCanvas.addKeyListener(this);
- alignPanel.scalePanel.addKeyListener(this);
- alignPanel.annotationPanel.addKeyListener(this);
- alignPanel.annotationPanelHolder.addKeyListener(this);
- alignPanel.annotationSpaceFillerHolder.addKeyListener(this);
- alignPanel.alabels.addKeyListener(this);
- createAlignFrameWindow(embedded, title);
-
- validate();
- alignPanel.adjustAnnotationHeight();
- alignPanel.paintAlignment(true);
- }
-
- public AlignViewport getAlignViewport()
- {
- return viewport;
- }
-
- public SeqCanvas getSeqcanvas()
- {
- return alignPanel.seqPanel.seqCanvas;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param String
- * DOCUMENT ME!
- */
-
- public void parseFeaturesFile(String file, String type)
- {
- Hashtable featureLinks = new Hashtable();
- boolean featuresFile = false;
- try
- {
- featuresFile = new jalview.io.FeaturesFile(file, type)
- .parse(viewport.alignment,
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,
- featureLinks, true, viewport.applet.getDefaultParameter("relaxedidmatch", false));
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (featuresFile)
- {
- if (featureLinks.size() > 0)
- {
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureLinks = featureLinks;
- }
- viewport.showSequenceFeatures = true;
- sequenceFeatures.setState(true);
- if (viewport.featureSettings != null)
- {
- viewport.featureSettings.refreshTable();
- }
- alignPanel.paintAlignment(true);
- }
-
- }
-
- public void keyPressed(KeyEvent evt)
- {
- if (viewport.cursorMode
- && ((evt.getKeyCode() >= KeyEvent.VK_0 && evt.getKeyCode() <= KeyEvent.VK_9) || (evt
- .getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt
- .getKeyCode() <= KeyEvent.VK_NUMPAD9))
- && Character.isDigit(evt.getKeyChar()))
- alignPanel.seqPanel.numberPressed(evt.getKeyChar());
-
- switch (evt.getKeyCode())
- {
- case 27: // escape key
- deselectAllSequenceMenuItem_actionPerformed();
-
- alignPanel.alabels.cancelDrag();
- break;
- case KeyEvent.VK_X:
- if (evt.isControlDown() || evt.isMetaDown())
- {
- cut_actionPerformed();
- }
- break;
- case KeyEvent.VK_C:
- if (viewport.cursorMode && !evt.isControlDown())
- {
- alignPanel.seqPanel.setCursorColumn();
- }
- if (evt.isControlDown() || evt.isMetaDown())
- {
- copy_actionPerformed();
- }
- break;
- case KeyEvent.VK_V:
- if (evt.isControlDown())
- {
- paste(evt.isShiftDown());
- }
- break;
- case KeyEvent.VK_A:
- if (evt.isControlDown() || evt.isMetaDown())
- {
- selectAllSequenceMenuItem_actionPerformed();
- }
- break;
- case KeyEvent.VK_DOWN:
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.moveCursor(0, 1);
- }
- else
- {
- moveSelectedSequences(false);
- }
- break;
-
- case KeyEvent.VK_UP:
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.moveCursor(0, -1);
- }
- else
- {
- moveSelectedSequences(true);
- }
- break;
-
- case KeyEvent.VK_LEFT:
- if (evt.isAltDown() || !viewport.cursorMode)
- slideSequences(false, alignPanel.seqPanel.getKeyboardNo1());
- else
- alignPanel.seqPanel.moveCursor(-1, 0);
- break;
-
- case KeyEvent.VK_RIGHT:
- if (evt.isAltDown() || !viewport.cursorMode)
- slideSequences(true, alignPanel.seqPanel.getKeyboardNo1());
- else
- alignPanel.seqPanel.moveCursor(1, 0);
- break;
-
- case KeyEvent.VK_SPACE:
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown()
- || evt.isShiftDown() || evt.isAltDown());
- }
- break;
-
- case KeyEvent.VK_DELETE:
- case KeyEvent.VK_BACK_SPACE:
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown()
- || evt.isShiftDown() || evt.isAltDown());
- }
- else
- {
- cut_actionPerformed();
- alignPanel.seqPanel.seqCanvas.repaint();
- }
- break;
-
- case KeyEvent.VK_S:
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.setCursorRow();
- }
- break;
- case KeyEvent.VK_P:
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.setCursorPosition();
- }
- break;
-
- case KeyEvent.VK_ENTER:
- case KeyEvent.VK_COMMA:
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.setCursorRowAndColumn();
- }
- break;
-
- case KeyEvent.VK_Q:
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.setSelectionAreaAtCursor(true);
- }
- break;
- case KeyEvent.VK_M:
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.setSelectionAreaAtCursor(false);
- }
- break;
-
- case KeyEvent.VK_F2:
- viewport.cursorMode = !viewport.cursorMode;
- statusBar.setText("Keyboard editing mode is "
- + (viewport.cursorMode ? "on" : "off"));
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes;
- alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq;
- }
- break;
-
- case KeyEvent.VK_F:
- if (evt.isControlDown())
- {
- findMenuItem_actionPerformed();
- }
- break;
-
- case KeyEvent.VK_H:
- {
- boolean toggleSeqs = !evt.isControlDown();
- boolean toggleCols = !evt.isShiftDown();
- toggleHiddenRegions(toggleSeqs, toggleCols);
- break;
- }
-
- case KeyEvent.VK_PAGE_UP:
- if (viewport.wrapAlignment)
- {
- alignPanel.scrollUp(true);
- }
- else
- {
- alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
- - viewport.endSeq + viewport.startSeq);
- }
- break;
-
- case KeyEvent.VK_PAGE_DOWN:
- if (viewport.wrapAlignment)
- {
- alignPanel.scrollUp(false);
- }
- else
- {
- alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
- + viewport.endSeq - viewport.startSeq);
- }
- break;
-
- case KeyEvent.VK_Z:
- if (evt.isControlDown())
- {
- undoMenuItem_actionPerformed();
- }
- break;
-
- case KeyEvent.VK_Y:
- if (evt.isControlDown())
- {
- redoMenuItem_actionPerformed();
- }
- break;
-
- case KeyEvent.VK_L:
- if (evt.isControlDown())
- {
- trimAlignment(true);
- }
- break;
-
- case KeyEvent.VK_R:
- if (evt.isControlDown())
- {
- trimAlignment(false);
- }
- break;
-
- case KeyEvent.VK_E:
- if (evt.isControlDown())
- {
- if (evt.isShiftDown())
- {
- this.removeAllGapsMenuItem_actionPerformed();
- }
- else
- {
- removeGappedColumnMenuItem_actionPerformed();
- }
- }
- break;
- case KeyEvent.VK_I:
- if (evt.isControlDown())
- {
- if (evt.isAltDown())
- {
- invertColSel_actionPerformed();
- }
- else
- {
- invertSequenceMenuItem_actionPerformed();
- }
- }
- break;
-
- case KeyEvent.VK_U:
- if (evt.isControlDown())
- {
- this.deleteGroups_actionPerformed();
- }
- break;
-
- case KeyEvent.VK_T:
- if (evt.isControlDown())
- {
- newView(null);
- }
- break;
-
- }
- alignPanel.paintAlignment(true);
- }
-
- /**
- * called by key handler and the hide all/show all menu items
- *
- * @param toggleSeqs
- * @param toggleCols
- */
- private void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols)
- {
- boolean hide = false;
- SequenceGroup sg = viewport.getSelectionGroup();
- if (!toggleSeqs && !toggleCols)
- {
- // Hide everything by the current selection - this is a hack - we do the
- // invert and then hide
- // first check that there will be visible columns after the invert.
- if ((viewport.colSel != null && viewport.colSel.getSelected() != null && viewport.colSel
- .getSelected().size() > 0)
- || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg
- .getEndRes()))
- {
- // now invert the sequence set, if required - empty selection implies
- // that no hiding is required.
- if (sg != null)
- {
- invertSequenceMenuItem_actionPerformed();
- sg = viewport.getSelectionGroup();
- toggleSeqs = true;
-
- }
- viewport.expandColSelection(sg, true);
- // finally invert the column selection and get the new sequence
- // selection and indicate it should be hidden.
- invertColSel_actionPerformed();
- toggleCols = true;
- }
- }
-
- if (toggleSeqs)
- {
- if (sg != null && sg.getSize() != viewport.alignment.getHeight())
- {
- hide = true;
- viewport.hideAllSelectedSeqs();
- }
- else if (!(toggleCols && viewport.colSel.getSelected().size() > 0))
- {
- viewport.showAllHiddenSeqs();
- }
- }
-
- if (toggleCols)
- {
- if (viewport.colSel.getSelected().size() > 0)
- {
- viewport.hideSelectedColumns();
- if (!toggleSeqs)
- {
- viewport.selectionGroup = sg;
- }
- }
- else if (!hide)
- {
- viewport.showAllHiddenColumns();
- }
- }
- }
-
- public void keyReleased(KeyEvent evt)
- {
- }
-
- public void keyTyped(KeyEvent evt)
- {
- }
-
- public void itemStateChanged(ItemEvent evt)
- {
- if (evt.getSource() == displayNonconservedMenuItem)
- {
- displayNonconservedMenuItem_actionPerformed();
- }
- else if (evt.getSource() == colourTextMenuItem)
- {
- colourTextMenuItem_actionPerformed();
- }
- else if (evt.getSource() == wrapMenuItem)
- {
- wrapMenuItem_actionPerformed();
- }
- else if (evt.getSource() == scaleAbove)
- {
- viewport.setScaleAboveWrapped(scaleAbove.getState());
- }
- else if (evt.getSource() == scaleLeft)
- {
- viewport.setScaleLeftWrapped(scaleLeft.getState());
- }
- else if (evt.getSource() == scaleRight)
- {
- viewport.setScaleRightWrapped(scaleRight.getState());
- }
- else if (evt.getSource() == seqLimits)
- {
- seqLimits_itemStateChanged();
- }
- else if (evt.getSource() == viewBoxesMenuItem)
- {
- viewport.setShowBoxes(viewBoxesMenuItem.getState());
- }
- else if (evt.getSource() == viewTextMenuItem)
- {
- viewport.setShowText(viewTextMenuItem.getState());
- }
- else if (evt.getSource() == renderGapsMenuItem)
- {
- viewport.setRenderGaps(renderGapsMenuItem.getState());
- }
- else if (evt.getSource() == annotationPanelMenuItem)
- {
- viewport.setShowAnnotation(annotationPanelMenuItem.getState());
- alignPanel.setAnnotationVisible(annotationPanelMenuItem.getState());
- }
- else if (evt.getSource() == sequenceFeatures)
- {
- viewport.showSequenceFeatures(sequenceFeatures.getState());
- alignPanel.seqPanel.seqCanvas.repaint();
- }
- else if (evt.getSource() == conservationMenuItem)
- {
- conservationMenuItem_actionPerformed();
- }
- else if (evt.getSource() == abovePIDThreshold)
- {
- abovePIDThreshold_actionPerformed();
- }
- else if (evt.getSource() == applyToAllGroups)
- {
- viewport.setColourAppliesToAllGroups(applyToAllGroups.getState());
- }
- else if (evt.getSource() == autoCalculate)
- {
- viewport.autocalculateConsensus = autoCalculate.getState();
- }
- else if (evt.getSource() == sortByTree)
- {
- viewport.sortByTree = sortByTree.getState();
- }
- else if (evt.getSource() == this.centreColumnLabelFlag)
- {
- centreColumnLabelFlag_stateChanged();
- }
- else if (evt.getSource() == this.followMouseOverFlag)
- {
- mouseOverFlag_stateChanged();
- }
- else if (evt.getSource() == showGroupConsensus)
- {
- showGroupConsensus_actionPerformed();
- }
- else if (evt.getSource() == showGroupConservation)
- {
- showGroupConservation_actionPerformed();
- }
- else if (evt.getSource() == showSequenceLogo)
- {
- showSequenceLogo_actionPerformed();
- }
- else if (evt.getSource() == showConsensusHistogram)
- {
- showConsensusHistogram_actionPerformed();
- }
- else if (evt.getSource() == applyAutoAnnotationSettings)
- {
- applyAutoAnnotationSettings_actionPerformed();
- }
- alignPanel.paintAlignment(true);
- }
-
- private void mouseOverFlag_stateChanged()
- {
- viewport.followHighlight = followMouseOverFlag.getState();
- // TODO: could kick the scrollTo mechanism to reset view for current
- // searchresults.
- }
-
- private void centreColumnLabelFlag_stateChanged()
- {
- viewport.centreColumnLabels = centreColumnLabelFlag.getState();
- this.alignPanel.annotationPanel.repaint();
- }
-
- public void actionPerformed(ActionEvent evt)
- {
- Object source = evt.getSource();
-
- if (source == inputText)
- {
- inputText_actionPerformed();
- }
- else if (source == loadTree)
- {
- loadTree_actionPerformed();
- }
- else if (source == loadApplication)
- {
- launchFullApplication();
- }
- else if (source == loadAnnotations)
- {
- loadAnnotations();
- }
- else if (source == outputAnnotations)
- {
- outputAnnotations(true);
- }
- else if (source == outputFeatures)
- {
- outputFeatures(true, "Jalview");
- }
- else if (source == closeMenuItem)
- {
- closeMenuItem_actionPerformed();
- }
- else if (source == copy)
- {
- copy_actionPerformed();
- }
- else if (source == undoMenuItem)
- {
- undoMenuItem_actionPerformed();
- }
- else if (source == redoMenuItem)
- {
- redoMenuItem_actionPerformed();
- }
- else if (source == inputText)
- {
- inputText_actionPerformed();
- }
- else if (source == closeMenuItem)
- {
- closeMenuItem_actionPerformed();
- }
- else if (source == undoMenuItem)
- {
- undoMenuItem_actionPerformed();
- }
- else if (source == redoMenuItem)
- {
- redoMenuItem_actionPerformed();
- }
- else if (source == copy)
- {
- copy_actionPerformed();
- }
- else if (source == pasteNew)
- {
- pasteNew_actionPerformed();
- }
- else if (source == pasteThis)
- {
- pasteThis_actionPerformed();
- }
- else if (source == cut)
- {
- cut_actionPerformed();
- }
- else if (source == delete)
- {
- delete_actionPerformed();
- }
- else if (source == grpsFromSelection)
- {
- makeGrpsFromSelection_actionPerformed();
- }
- else if (source == deleteGroups)
- {
- deleteGroups_actionPerformed();
- }
- else if (source == selectAllSequenceMenuItem)
- {
- selectAllSequenceMenuItem_actionPerformed();
- }
- else if (source == deselectAllSequenceMenuItem)
- {
- deselectAllSequenceMenuItem_actionPerformed();
- }
- else if (source == invertSequenceMenuItem)
- {
- invertSequenceMenuItem_actionPerformed();
- }
- else if (source == invertColSel)
- {
- viewport.invertColumnSelection();
- alignPanel.paintAlignment(true);
- }
- else if (source == remove2LeftMenuItem)
- {
- trimAlignment(true);
- }
- else if (source == remove2RightMenuItem)
- {
- trimAlignment(false);
- }
- else if (source == removeGappedColumnMenuItem)
- {
- removeGappedColumnMenuItem_actionPerformed();
- }
- else if (source == removeAllGapsMenuItem)
- {
- removeAllGapsMenuItem_actionPerformed();
- }
- else if (source == findMenuItem)
- {
- findMenuItem_actionPerformed();
- }
- else if (source == font)
- {
- new FontChooser(alignPanel);
- }
- else if (source == newView)
- {
- newView(null);
- }
- else if (source == showColumns)
- {
- viewport.showAllHiddenColumns();
- alignPanel.paintAlignment(true);
- }
- else if (source == showSeqs)
- {
- viewport.showAllHiddenSeqs();
- alignPanel.paintAlignment(true);
- }
- else if (source == hideColumns)
- {
- viewport.hideSelectedColumns();
- alignPanel.paintAlignment(true);
- }
- else if (source == hideSequences
- && viewport.getSelectionGroup() != null)
- {
- viewport.hideAllSelectedSeqs();
- alignPanel.paintAlignment(true);
- }
- else if (source == hideAllButSelection)
- {
- toggleHiddenRegions(false, false);
- alignPanel.paintAlignment(true);
- }
- else if (source == hideAllSelection)
- {
- SequenceGroup sg = viewport.getSelectionGroup();
- viewport.expandColSelection(sg, false);
- viewport.hideAllSelectedSeqs();
- viewport.hideSelectedColumns();
- alignPanel.paintAlignment(true);
- }
- else if (source == showAllHidden)
- {
- viewport.showAllHiddenColumns();
- viewport.showAllHiddenSeqs();
- alignPanel.paintAlignment(true);
- }
- else if (source == showGroupConsensus)
- {
- showGroupConsensus_actionPerformed();
- }
- else if (source == showGroupConservation)
- {
- showGroupConservation_actionPerformed();
- }
- else if (source == showSequenceLogo)
- {
- showSequenceLogo_actionPerformed();
- }
- else if (source == showConsensusHistogram)
- {
- showConsensusHistogram_actionPerformed();
- }
- else if (source == applyAutoAnnotationSettings)
- {
- applyAutoAnnotationSettings_actionPerformed();
- }
- else if (source == featureSettings)
- {
- new FeatureSettings(alignPanel);
- }
- else if (source == alProperties)
- {
- StringBuffer contents = new jalview.io.AlignmentProperties(
- viewport.alignment).formatAsString();
- CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);
- cap.setText(contents.toString());
- Frame frame = new Frame();
- frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "Alignment Properties: "
- + getTitle(), 400, 250);
- }
- else if (source == overviewMenuItem)
- {
- overviewMenuItem_actionPerformed();
- }
- else if (source == noColourmenuItem)
- {
- changeColour(null);
- }
- else if (source == clustalColour)
- {
- abovePIDThreshold.setState(false);
- changeColour(new ClustalxColourScheme(
- viewport.alignment.getSequences(),
- viewport.alignment.getWidth()));
- }
- else if (source == zappoColour)
- {
- changeColour(new ZappoColourScheme());
- }
- else if (source == taylorColour)
- {
- changeColour(new TaylorColourScheme());
- }
- else if (source == hydrophobicityColour)
- {
- changeColour(new HydrophobicColourScheme());
- }
- else if (source == helixColour)
- {
- changeColour(new HelixColourScheme());
- }
- else if (source == strandColour)
- {
- changeColour(new StrandColourScheme());
- }
- else if (source == turnColour)
- {
- changeColour(new TurnColourScheme());
- }
- else if (source == buriedColour)
- {
- changeColour(new BuriedColourScheme());
- }
- else if (source == nucleotideColour)
- {
- changeColour(new NucleotideColourScheme());
- }
- else if (source == modifyPID)
- {
- modifyPID_actionPerformed();
- }
- else if (source == modifyConservation)
- {
- modifyConservation_actionPerformed();
- }
- else if (source == userDefinedColour)
- {
- new UserDefinedColours(alignPanel, null);
- }
- else if (source == PIDColour)
- {
- changeColour(new PIDColourScheme());
- }
- else if (source == BLOSUM62Colour)
- {
- changeColour(new Blosum62ColourScheme());
- }
- else if (source == annotationColour)
- {
- new AnnotationColourChooser(viewport, alignPanel);
- }
- else if (source == sortPairwiseMenuItem)
- {
- sortPairwiseMenuItem_actionPerformed();
- }
- else if (source == sortIDMenuItem)
- {
- sortIDMenuItem_actionPerformed();
- }
- else if (source == sortLengthMenuItem)
- {
- sortLengthMenuItem_actionPerformed();
- }
- else if (source == sortGroupMenuItem)
- {
- sortGroupMenuItem_actionPerformed();
- }
- else if (source == removeRedundancyMenuItem)
- {
- removeRedundancyMenuItem_actionPerformed();
- }
- else if (source == pairwiseAlignmentMenuItem)
- {
- pairwiseAlignmentMenuItem_actionPerformed();
- }
- else if (source == PCAMenuItem)
- {
- PCAMenuItem_actionPerformed();
- }
- else if (source == averageDistanceTreeMenuItem)
- {
- averageDistanceTreeMenuItem_actionPerformed();
- }
- else if (source == neighbourTreeMenuItem)
- {
- neighbourTreeMenuItem_actionPerformed();
- }
- else if (source == njTreeBlosumMenuItem)
- {
- njTreeBlosumMenuItem_actionPerformed();
- }
- else if (source == avDistanceTreeBlosumMenuItem)
- {
- avTreeBlosumMenuItem_actionPerformed();
- }
- else if (source == documentation)
- {
- documentation_actionPerformed();
- }
- else if (source == about)
- {
- about_actionPerformed();
- }
-
- }
-
- public void inputText_actionPerformed()
- {
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
- Frame frame = new Frame();
- frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "Cut & Paste Input", 500, 500);
- }
-
- protected void outputText_actionPerformed(ActionEvent e)
- {
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
- Frame frame = new Frame();
- frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame,
- "Alignment output - " + e.getActionCommand(), 600, 500);
- cap.setText(new AppletFormatAdapter().formatSequences(
- e.getActionCommand(), viewport.getAlignment(),
- viewport.showJVSuffix));
- }
-
- public void loadAnnotations()
- {
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
- cap.setText("Paste your features / annotations file here.");
- cap.setAnnotationImport();
- Frame frame = new Frame();
- frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "Paste Annotations ", 400, 300);
-
- }
-
- public String outputAnnotations(boolean displayTextbox)
- {
- String annotation = new AnnotationFile().printAnnotations(
- viewport.showAnnotation ? viewport.alignment
- .getAlignmentAnnotation() : null, viewport.alignment
- .getGroups(),
- ((Alignment) viewport.alignment).alignmentProperties);
-
- if (displayTextbox)
- {
- CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);
- Frame frame = new Frame();
- frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "Annotations", 600, 500);
- cap.setText(annotation);
- }
-
- return annotation;
- }
-
- private Hashtable getDisplayedFeatureCols()
- {
- if (alignPanel.getFeatureRenderer() != null && viewport.featuresDisplayed!=null)
- {
- FeatureRenderer fr = alignPanel.getFeatureRenderer();
- Hashtable fcols = new Hashtable();
- Enumeration en = viewport.featuresDisplayed.keys();
- while (en.hasMoreElements())
- {
- Object col = en.nextElement();
- fcols.put(col, fr.featureColours.get(col));
- }
- return fcols;
- }
- return null;
- }
-
- public String outputFeatures(boolean displayTextbox, String format)
- {
- String features;
- if (format.equalsIgnoreCase("Jalview"))
- {
- features = new FeaturesFile().printJalviewFormat(
- viewport.alignment.getSequencesArray(),
- getDisplayedFeatureCols());
- }
- else
- {
- features = new FeaturesFile().printGFFFormat(
- viewport.alignment.getSequencesArray(),
- getDisplayedFeatureCols());
- }
-
- if (displayTextbox)
- {
- boolean frimport=false;
- if (features==null || features.equals("No Features Visible"))
- {
- features = "# No features visible - paste some and import them here.";
- frimport=true;
- }
-
- CutAndPasteTransfer cap = new CutAndPasteTransfer(frimport, this);
- if (frimport)
- {
- cap.setAnnotationImport();
- }
- Frame frame = new Frame();
- frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "Features", 600, 500);
- cap.setText(features);
- } else {
- if (features==null)
- features = "";
- }
-
- return features;
- }
-
- void launchFullApplication()
- {
- StringBuffer url = new StringBuffer(jalviewServletURL);
-
- url.append("?open="
- + appendProtocol(viewport.applet.getParameter("file")));
-
- if (viewport.applet.getParameter("features") != null)
- {
- url.append("&features=");
- url.append(appendProtocol(viewport.applet.getParameter("features")));
- }
-
- if (viewport.applet.getParameter("annotations") != null)
- {
- url.append("&annotations=");
- url.append(appendProtocol(viewport.applet.getParameter("annotations")));
- }
-
- if (viewport.applet.getParameter("jnetfile") != null)
- {
- url.append("&annotations=");
- url.append(appendProtocol(viewport.applet.getParameter("jnetfile")));
- }
-
- if (viewport.applet.getParameter("defaultColour") != null)
- {
- url.append("&colour="
- + removeWhiteSpace(viewport.applet
- .getParameter("defaultColour")));
- }
-
- if (viewport.applet.getParameter("userDefinedColour") != null)
- {
- url.append("&colour="
- + removeWhiteSpace(viewport.applet
- .getParameter("userDefinedColour")));
- }
- if (viewport.applet.getParameter("tree") != null)
- {
- url.append("&tree="
- + appendProtocol(viewport.applet.getParameter("tree")));
- }
- if (viewport.applet.getParameter("treeFile") != null)
- {
- url.append("&tree="
- + appendProtocol(viewport.applet.getParameter("treeFile")));
- }
-
- showURL(url.toString(), "FULL_APP");
- }
-
- String removeWhiteSpace(String colour)
- {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < colour.length(); i++)
- {
- if (Character.isWhitespace(colour.charAt(i)))
- {
- sb.append("%20");
- }
- else
- {
- sb.append(colour.charAt(i));
- }
- }
-
- return sb.toString();
- }
-
- String appendProtocol(String url)
- {
- try
- {
- new URL(url);
- url = URLEncoder.encode(url);
- }
- /*
- * When we finally deprecate 1.1 compatibility, we can start to use
- * URLEncoder.encode(url,"UTF-8") and then we'll need this catch: catch
- * (UnsupportedEncodingException ex) { System.err.println("WARNING -
- * IMPLEMENTATION ERROR - UNSUPPORTED ENCODING EXCEPTION FOR "+url);
- * ex.printStackTrace(); }
- */
- catch (java.net.MalformedURLException ex)
- {
- url = viewport.applet.getCodeBase() + url;
- }
- return url;
- }
-
- public void closeMenuItem_actionPerformed()
- {
- PaintRefresher.RemoveComponent(alignPanel);
- PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);
- PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);
-
- if (PaintRefresher.components.size() == 0 && viewport.applet == null)
- {
- System.exit(0);
- } else {
- }
- viewport = null;
- alignPanel = null;
- this.dispose();
- }
-
- /**
- * DOCUMENT ME!
- */
- void updateEditMenuBar()
- {
-
- if (viewport.historyList.size() > 0)
- {
- undoMenuItem.setEnabled(true);
- CommandI command = (CommandI) viewport.historyList.peek();
- undoMenuItem.setLabel("Undo " + command.getDescription());
- }
- else
- {
- undoMenuItem.setEnabled(false);
- undoMenuItem.setLabel("Undo");
- }
-
- if (viewport.redoList.size() > 0)
- {
- redoMenuItem.setEnabled(true);
-
- CommandI command = (CommandI) viewport.redoList.peek();
- redoMenuItem.setLabel("Redo " + command.getDescription());
- }
- else
- {
- redoMenuItem.setEnabled(false);
- redoMenuItem.setLabel("Redo");
- }
- }
-
- public void addHistoryItem(CommandI command)
- {
- if (command.getSize() > 0)
- {
- viewport.historyList.push(command);
- viewport.redoList.removeAllElements();
- updateEditMenuBar();
- viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void undoMenuItem_actionPerformed()
- {
- if (viewport.historyList.size() < 1)
- {
- return;
- }
-
- CommandI command = (CommandI) viewport.historyList.pop();
- viewport.redoList.push(command);
- command.undoCommand(null);
-
- AlignViewport originalSource = getOriginatingSource(command);
-
- originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
- updateEditMenuBar();
- originalSource.firePropertyChange("alignment", null,
- originalSource.alignment.getSequences());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void redoMenuItem_actionPerformed()
- {
- if (viewport.redoList.size() < 1)
- {
- return;
- }
-
- CommandI command = (CommandI) viewport.redoList.pop();
- viewport.historyList.push(command);
- command.doCommand(null);
-
- AlignViewport originalSource = getOriginatingSource(command);
- originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
-
- updateEditMenuBar();
- originalSource.firePropertyChange("alignment", null,
- originalSource.alignment.getSequences());
- }
-
- AlignViewport getOriginatingSource(CommandI command)
- {
- AlignViewport originalSource = null;
- // For sequence removal and addition, we need to fire
- // the property change event FROM the viewport where the
- // original alignment was altered
- AlignmentI al = null;
- if (command instanceof EditCommand)
- {
- EditCommand editCommand = (EditCommand) command;
- al = editCommand.getAlignment();
- Vector comps = (Vector) PaintRefresher.components.get(viewport
- .getSequenceSetId());
- for (int i = 0; i < comps.size(); i++)
- {
- if (comps.elementAt(i) instanceof AlignmentPanel)
- {
- if (al == ((AlignmentPanel) comps.elementAt(i)).av.alignment)
- {
- originalSource = ((AlignmentPanel) comps.elementAt(i)).av;
- break;
- }
- }
- }
- }
-
- if (originalSource == null)
- {
- // The original view is closed, we must validate
- // the current view against the closed view first
- if (al != null)
- {
- PaintRefresher.validateSequences(al, viewport.alignment);
- }
-
- originalSource = viewport;
- }
-
- return originalSource;
- }
-
- public void moveSelectedSequences(boolean up)
- {
- SequenceGroup sg = viewport.getSelectionGroup();
- if (sg == null)
- {
- return;
- }
-
- if (up)
- {
- for (int i = 1; i < viewport.alignment.getHeight(); i++)
- {
- SequenceI seq = viewport.alignment.getSequenceAt(i);
- if (!sg.getSequences(null).contains(seq))
- {
- continue;
- }
-
- SequenceI temp = viewport.alignment.getSequenceAt(i - 1);
- if (sg.getSequences(null).contains(temp))
- {
- continue;
- }
-
- viewport.alignment.getSequences().setElementAt(temp, i);
- viewport.alignment.getSequences().setElementAt(seq, i - 1);
- }
- }
- else
- {
- for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)
- {
- SequenceI seq = viewport.alignment.getSequenceAt(i);
- if (!sg.getSequences(viewport.hiddenRepSequences).contains(seq))
- {
- continue;
- }
-
- SequenceI temp = viewport.alignment.getSequenceAt(i + 1);
- if (sg.getSequences(viewport.hiddenRepSequences).contains(temp))
- {
- continue;
- }
-
- viewport.alignment.getSequences().setElementAt(temp, i);
- viewport.alignment.getSequences().setElementAt(seq, i + 1);
- }
- }
-
- alignPanel.paintAlignment(true);
- }
-
- synchronized void slideSequences(boolean right, int size)
- {
- Vector sg = new Vector();
- if (viewport.cursorMode)
- {
- sg.addElement(viewport.alignment
- .getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY));
- }
- else if (viewport.getSelectionGroup() != null
- && viewport.getSelectionGroup().getSize() != viewport.alignment
- .getHeight())
- {
- sg = viewport.getSelectionGroup().getSequences(
- viewport.hiddenRepSequences);
- }
-
- if (sg.size() < 1)
- {
- return;
- }
-
- Vector invertGroup = new Vector();
-
- for (int i = 0; i < viewport.alignment.getHeight(); i++)
- {
- if (!sg.contains(viewport.alignment.getSequenceAt(i)))
- invertGroup.addElement(viewport.alignment.getSequenceAt(i));
- }
-
- SequenceI[] seqs1 = new SequenceI[sg.size()];
- for (int i = 0; i < sg.size(); i++)
- seqs1[i] = (SequenceI) sg.elementAt(i);
-
- SequenceI[] seqs2 = new SequenceI[invertGroup.size()];
- for (int i = 0; i < invertGroup.size(); i++)
- seqs2[i] = (SequenceI) invertGroup.elementAt(i);
-
- SlideSequencesCommand ssc;
- if (right)
- ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1,
- size, viewport.getGapCharacter());
- else
- ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2,
- size, viewport.getGapCharacter());
-
- int groupAdjustment = 0;
- if (ssc.getGapsInsertedBegin() && right)
- {
- if (viewport.cursorMode)
- alignPanel.seqPanel.moveCursor(size, 0);
- else
- groupAdjustment = size;
- }
- else if (!ssc.getGapsInsertedBegin() && !right)
- {
- if (viewport.cursorMode)
- alignPanel.seqPanel.moveCursor(-size, 0);
- else
- groupAdjustment = -size;
- }
-
- if (groupAdjustment != 0)
- {
- viewport.getSelectionGroup().setStartRes(
- viewport.getSelectionGroup().getStartRes() + groupAdjustment);
- viewport.getSelectionGroup().setEndRes(
- viewport.getSelectionGroup().getEndRes() + groupAdjustment);
- }
-
- boolean appendHistoryItem = false;
- if (viewport.historyList != null && viewport.historyList.size() > 0
- && viewport.historyList.peek() instanceof SlideSequencesCommand)
- {
- appendHistoryItem = ssc
- .appendSlideCommand((SlideSequencesCommand) viewport.historyList
- .peek());
- }
-
- if (!appendHistoryItem)
- addHistoryItem(ssc);
-
- repaint();
- }
-
- static StringBuffer copiedSequences;
-
- static Vector copiedHiddenColumns;
-
- protected void copy_actionPerformed()
- {
- if (viewport.getSelectionGroup() == null)
- {
- return;
- }
-
- SequenceGroup sg = viewport.getSelectionGroup();
- copiedSequences = new StringBuffer();
- Hashtable orderedSeqs = new Hashtable();
- for (int i = 0; i < sg.getSize(); i++)
- {
- SequenceI seq = sg.getSequenceAt(i);
- int index = viewport.alignment.findIndex(seq);
- orderedSeqs.put(index + "", seq);
- }
-
- int index = 0, startRes, endRes;
- char ch;
-
- if (viewport.hasHiddenColumns && viewport.getSelectionGroup() != null)
- {
- copiedHiddenColumns = new Vector();
- int hiddenOffset = viewport.getSelectionGroup().getStartRes();
- for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns()
- .size(); i++)
- {
- int[] region = (int[]) viewport.getColumnSelection()
- .getHiddenColumns().elementAt(i);
-
- copiedHiddenColumns.addElement(new int[]
- { region[0] - hiddenOffset, region[1] - hiddenOffset });
- }
- }
- else
- {
- copiedHiddenColumns = null;
- }
-
- for (int i = 0; i < sg.getSize(); i++)
- {
- SequenceI seq = null;
-
- while (seq == null)
- {
- if (orderedSeqs.containsKey(index + ""))
- {
- seq = (SequenceI) orderedSeqs.get(index + "");
- index++;
-
- break;
- }
- else
- {
- index++;
- }
- }
-
- // FIND START RES
- // Returns residue following index if gap
- startRes = seq.findPosition(sg.getStartRes());
-
- // FIND END RES
- // Need to find the residue preceeding index if gap
- endRes = 0;
-
- for (int j = 0; j < sg.getEndRes() + 1 && j < seq.getLength(); j++)
- {
- ch = seq.getCharAt(j);
- if (!jalview.util.Comparison.isGap((ch)))
- {
- endRes++;
- }
- }
-
- if (endRes > 0)
- {
- endRes += seq.getStart() - 1;
- }
-
- copiedSequences.append(seq.getName()
- + "\t"
- + startRes
- + "\t"
- + endRes
- + "\t"
- + seq.getSequenceAsString(sg.getStartRes(),
- sg.getEndRes() + 1) + "\n");
- }
-
- }
-
- protected void pasteNew_actionPerformed()
- {
- paste(true);
- }
-
- protected void pasteThis_actionPerformed()
- {
- paste(false);
- }
-
- void paste(boolean newAlignment)
- {
- try
- {
-
- if (copiedSequences == null)
- {
- return;
- }
-
- StringTokenizer st = new StringTokenizer(copiedSequences.toString());
- Vector seqs = new Vector();
- while (st.hasMoreElements())
- {
- String name = st.nextToken();
- int start = Integer.parseInt(st.nextToken());
- int end = Integer.parseInt(st.nextToken());
- seqs.addElement(new Sequence(name, st.nextToken(), start, end));
- }
- SequenceI[] newSeqs = new SequenceI[seqs.size()];
- for (int i = 0; i < seqs.size(); i++)
- {
- newSeqs[i] = (SequenceI) seqs.elementAt(i);
- }
-
- if (newAlignment)
- {
- String newtitle = new String("Copied sequences");
- if (getTitle().startsWith("Copied sequences"))
- {
- newtitle = getTitle();
- }
- else
- {
- newtitle = newtitle.concat("- from " + getTitle());
- }
- AlignFrame af = new AlignFrame(new Alignment(newSeqs),
- viewport.applet, newtitle, false);
- if (copiedHiddenColumns != null)
- {
- for (int i = 0; i < copiedHiddenColumns.size(); i++)
- {
- int[] region = (int[]) copiedHiddenColumns.elementAt(i);
- af.viewport.hideColumns(region[0], region[1]);
- }
- }
-
- jalview.bin.JalviewLite.addFrame(af, newtitle, DEFAULT_WIDTH,
- DEFAULT_HEIGHT);
- }
- else
- {
- addSequences(newSeqs);
- }
-
- } catch (Exception ex)
- {
- } // could be anything being pasted in here
-
- }
-
- void addSequences(SequenceI[] seqs)
- {
- for (int i = 0; i < seqs.length; i++)
- {
- viewport.alignment.addSequence(seqs[i]);
- }
-
- // !newAlignment
- addHistoryItem(new EditCommand("Add sequences", EditCommand.PASTE,
- seqs, 0, viewport.alignment.getWidth(), viewport.alignment));
-
- viewport.setEndSeq(viewport.alignment.getHeight());
- viewport.alignment.getWidth();
- viewport.firePropertyChange("alignment", null,
- viewport.alignment.getSequences());
-
- }
-
- protected void cut_actionPerformed()
- {
- copy_actionPerformed();
- delete_actionPerformed();
- }
-
- protected void delete_actionPerformed()
- {
-
- SequenceGroup sg = viewport.getSelectionGroup();
- if (sg == null)
- {
- return;
- }
-
- Vector seqs = new Vector();
- SequenceI seq;
- for (int i = 0; i < sg.getSize(); i++)
- {
- seq = sg.getSequenceAt(i);
- seqs.addElement(seq);
- }
-
- // If the cut affects all sequences, remove highlighted columns
- if (sg.getSize() == viewport.alignment.getHeight())
- {
- viewport.getColumnSelection().removeElements(sg.getStartRes(),
- sg.getEndRes() + 1);
- }
-
- SequenceI[] cut = new SequenceI[seqs.size()];
- for (int i = 0; i < seqs.size(); i++)
- {
- cut[i] = (SequenceI) seqs.elementAt(i);
- }
-
- /*
- * //ADD HISTORY ITEM
- */
- addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,
- sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
- viewport.alignment));
-
- viewport.setSelectionGroup(null);
- viewport.alignment.deleteGroup(sg);
-
- viewport.firePropertyChange("alignment", null, viewport.getAlignment()
- .getSequences());
-
- if (viewport.getAlignment().getHeight() < 1)
- {
- this.setVisible(false);
- }
- viewport.sendSelection();
- }
-
- /**
- * group consensus toggled
- *
- */
- protected void showGroupConsensus_actionPerformed()
- {
- viewport.setShowGroupConsensus(showGroupConsensus.getState());
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
-
- }
-
- /**
- * group conservation toggled.
- */
- protected void showGroupConservation_actionPerformed()
- {
- viewport.setShowGroupConservation(showGroupConservation.getState());
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt
- * .event.ActionEvent)
- */
- protected void showConsensusHistogram_actionPerformed()
- {
- viewport.setShowConsensusHistogram(showConsensusHistogram.getState());
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
- }
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt
- * .event.ActionEvent)
- */
- protected void showSequenceLogo_actionPerformed()
- {
- viewport.setShowSequenceLogo(showSequenceLogo.getState());
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
- }
-
- protected void applyAutoAnnotationSettings_actionPerformed()
- {
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
- }
-
- protected void makeGrpsFromSelection_actionPerformed()
- {
- if (viewport.getSelectionGroup() != null)
- {
- SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
- viewport.getSequenceSelection(),
- viewport.getAlignmentView(true).getSequenceStrings(
- viewport.getGapCharacter()),
- viewport.alignment.getGroups());
- viewport.alignment.deleteAllGroups();
- viewport.sequenceColours = null;
- viewport.setSelectionGroup(null);
- // set view properties for each group
- for (int g = 0; g < gps.length; g++)
- {
- // gps[g].setShowunconserved(viewport.getShowUnconserved());
- gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
- viewport.alignment.addGroup(gps[g]);
- Color col = new Color((int) (Math.random() * 255),
- (int) (Math.random() * 255), (int) (Math.random() * 255));
- col = col.brighter();
- for (Enumeration sq = gps[g].getSequences(null).elements(); sq
- .hasMoreElements(); viewport.setSequenceColour(
- (SequenceI) sq.nextElement(), col))
- ;
- }
- PaintRefresher.Refresh(this, viewport.getSequenceSetId());
- alignPanel.updateAnnotation();
- alignPanel.paintAlignment(true);
- }
- }
-
- protected void deleteGroups_actionPerformed()
- {
- viewport.alignment.deleteAllGroups();
- viewport.sequenceColours = null;
- viewport.setSelectionGroup(null);
-
- alignPanel.paintAlignment(true);
- }
-
- public void selectAllSequenceMenuItem_actionPerformed()
- {
- SequenceGroup sg = new SequenceGroup();
- for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
- {
- sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);
- }
- sg.setEndRes(viewport.alignment.getWidth() - 1);
- viewport.setSelectionGroup(sg);
- alignPanel.paintAlignment(true);
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
- viewport.sendSelection();
- }
-
- public void deselectAllSequenceMenuItem_actionPerformed()
- {
- if (viewport.cursorMode)
- {
- alignPanel.seqPanel.keyboardNo1 = null;
- alignPanel.seqPanel.keyboardNo2 = null;
- }
- viewport.setSelectionGroup(null);
- viewport.getColumnSelection().clear();
- viewport.setSelectionGroup(null);
- alignPanel.idPanel.idCanvas.searchResults = null;
- alignPanel.seqPanel.seqCanvas.highlightSearchResults(null);
- alignPanel.paintAlignment(true);
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
- viewport.sendSelection();
- }
-
- public void invertSequenceMenuItem_actionPerformed()
- {
- SequenceGroup sg = viewport.getSelectionGroup();
- for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
- {
- sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);
- }
-
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
- viewport.sendSelection();
- }
-
- public void invertColSel_actionPerformed()
- {
- viewport.invertColumnSelection();
- alignPanel.paintAlignment(true);
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
- viewport.sendSelection();
- }
-
- void trimAlignment(boolean trimLeft)
- {
- ColumnSelection colSel = viewport.getColumnSelection();
- int column;
-
- if (colSel.size() > 0)
- {
- if (trimLeft)
- {
- column = colSel.getMin();
- }
- else
- {
- column = colSel.getMax();
- }
-
- SequenceI[] seqs;
- if (viewport.getSelectionGroup() != null)
- {
- seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
- }
- else
- {
- seqs = viewport.alignment.getSequencesArray();
- }
-
- TrimRegionCommand trimRegion;
- if (trimLeft)
- {
- trimRegion = new TrimRegionCommand("Remove Left",
- TrimRegionCommand.TRIM_LEFT, seqs, column,
- viewport.alignment, viewport.colSel,
- viewport.selectionGroup);
- viewport.setStartRes(0);
- }
- else
- {
- trimRegion = new TrimRegionCommand("Remove Right",
- TrimRegionCommand.TRIM_RIGHT, seqs, column,
- viewport.alignment, viewport.colSel,
- viewport.selectionGroup);
- }
-
- statusBar.setText("Removed " + trimRegion.getSize() + " columns.");
-
- addHistoryItem(trimRegion);
-
- Vector groups = viewport.alignment.getGroups();
-
- for (int i = 0; i < groups.size(); i++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
-
- if ((trimLeft && !sg.adjustForRemoveLeft(column))
- || (!trimLeft && !sg.adjustForRemoveRight(column)))
- {
- viewport.alignment.deleteGroup(sg);
- }
- }
-
- viewport.firePropertyChange("alignment", null, viewport
- .getAlignment().getSequences());
- }
- }
-
- public void removeGappedColumnMenuItem_actionPerformed()
- {
- int start = 0, end = viewport.alignment.getWidth() - 1;
-
- SequenceI[] seqs;
- if (viewport.getSelectionGroup() != null)
- {
- seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
- start = viewport.getSelectionGroup().getStartRes();
- end = viewport.getSelectionGroup().getEndRes();
- }
- else
- {
- seqs = viewport.alignment.getSequencesArray();
- }
-
- RemoveGapColCommand removeGapCols = new RemoveGapColCommand(
- "Remove Gapped Columns", seqs, start, end, viewport.alignment);
-
- addHistoryItem(removeGapCols);
-
- statusBar.setText("Removed " + removeGapCols.getSize()
- + " empty columns.");
-
- // This is to maintain viewport position on first residue
- // of first sequence
- SequenceI seq = viewport.alignment.getSequenceAt(0);
- int startRes = seq.findPosition(viewport.startRes);
- // ShiftList shifts;
- // viewport.getAlignment().removeGaps(shifts=new ShiftList());
- // edit.alColumnChanges=shifts.getInverse();
- // if (viewport.hasHiddenColumns)
- // viewport.getColumnSelection().compensateForEdits(shifts);
- viewport.setStartRes(seq.findIndex(startRes) - 1);
- viewport.firePropertyChange("alignment", null, viewport.getAlignment()
- .getSequences());
-
- }
-
- public void removeAllGapsMenuItem_actionPerformed()
- {
- int start = 0, end = viewport.alignment.getWidth() - 1;
-
- SequenceI[] seqs;
- if (viewport.getSelectionGroup() != null)
- {
- seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
- start = viewport.getSelectionGroup().getStartRes();
- end = viewport.getSelectionGroup().getEndRes();
- }
- else
- {
- seqs = viewport.alignment.getSequencesArray();
- }
-
- // This is to maintain viewport position on first residue
- // of first sequence
- SequenceI seq = viewport.alignment.getSequenceAt(0);
- int startRes = seq.findPosition(viewport.startRes);
-
- addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,
- viewport.alignment));
-
- viewport.setStartRes(seq.findIndex(startRes) - 1);
-
- viewport.firePropertyChange("alignment", null, viewport.getAlignment()
- .getSequences());
-
- }
-
- public void findMenuItem_actionPerformed()
- {
- new Finder(alignPanel);
- }
-
- /**
- * create a new view derived from the current view
- *
- * @param viewtitle
- * @return frame for the new view
- */
- public AlignFrame newView(String viewtitle)
- {
- AlignmentI newal;
- if (viewport.hasHiddenRows)
- {
- newal = new Alignment(viewport.getAlignment().getHiddenSequences()
- .getFullAlignment().getSequencesArray());
- }
- else
- {
- newal = new Alignment(viewport.alignment.getSequencesArray());
- }
-
- if (viewport.alignment.getAlignmentAnnotation() != null)
- {
- for (int i = 0; i < viewport.alignment.getAlignmentAnnotation().length; i++)
- {
- if (!viewport.alignment.getAlignmentAnnotation()[i].autoCalculated)
- {
- newal.addAnnotation(viewport.alignment.getAlignmentAnnotation()[i]);
- }
- }
- }
-
- AlignFrame newaf = new AlignFrame(newal, viewport.applet, "", false);
-
- newaf.viewport.sequenceSetID = alignPanel.av.getSequenceSetId();
- PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId());
- PaintRefresher.Register(newaf.alignPanel,
- newaf.alignPanel.av.getSequenceSetId());
-
- PaintRefresher.Register(newaf.alignPanel.idPanel.idCanvas,
- newaf.alignPanel.av.getSequenceSetId());
- PaintRefresher.Register(newaf.alignPanel.seqPanel.seqCanvas,
- newaf.alignPanel.av.getSequenceSetId());
-
- Vector comps = (Vector) PaintRefresher.components.get(viewport
- .getSequenceSetId());
- int viewSize = -1;
- for (int i = 0; i < comps.size(); i++)
- {
- if (comps.elementAt(i) instanceof AlignmentPanel)
- {
- viewSize++;
- }
- }
-
- String title = new String(this.getTitle());
- if (viewtitle != null)
- {
- title = viewtitle + " ( " + title + ")";
- }
- else
- {
- if (title.indexOf("(View") > -1)
- {
- title = title.substring(0, title.indexOf("(View"));
- }
- title += "(View " + viewSize + ")";
- }
-
- newaf.setTitle(title.toString());
-
- newaf.viewport.historyList = viewport.historyList;
- newaf.viewport.redoList = viewport.redoList;
- return newaf;
- }
-
- /**
- *
- * @return list of feature groups on the view
- */
- public String[] getFeatureGroups()
- {
- FeatureRenderer fr = null;
- if (alignPanel != null
- && (fr = alignPanel.getFeatureRenderer()) != null)
- {
- return fr.getGroups();
- }
- return null;
- }
-
- /**
- * get sequence feature groups that are hidden or shown
- *
- * @param visible
- * true is visible
- * @return list
- */
- public String[] getFeatureGroupsOfState(boolean visible)
- {
- FeatureRenderer fr = null;
- if (alignPanel != null
- && (fr = alignPanel.getFeatureRenderer()) != null)
- {
- return fr.getGroups(visible);
- }
- return null;
- }
-
- /**
- * Change the display state for the given feature groups
- *
- * @param groups
- * list of group strings
- * @param state
- * visible or invisible
- */
- public void setFeatureGroupState(String[] groups, boolean state)
- {
- FeatureRenderer fr = null;
- this.sequenceFeatures.setState(true);
- viewport.showSequenceFeatures(true);
- if (alignPanel != null
- && (fr = alignPanel.getFeatureRenderer()) != null)
- {
- fr.setGroupState(groups, state);
- alignPanel.seqPanel.seqCanvas.repaint();
- if (alignPanel.overviewPanel != null)
- {
- alignPanel.overviewPanel.updateOverviewImage();
- }
- }
- }
-
- public void seqLimits_itemStateChanged()
- {
- viewport.setShowJVSuffix(seqLimits.getState());
- alignPanel.fontChanged();
- alignPanel.paintAlignment(true);
- }
-
- protected void colourTextMenuItem_actionPerformed()
- {
- viewport.setColourText(colourTextMenuItem.getState());
- alignPanel.paintAlignment(true);
- }
-
- protected void displayNonconservedMenuItem_actionPerformed()
- {
- viewport.setShowunconserved(displayNonconservedMenuItem.getState());
- alignPanel.paintAlignment(true);
- }
-
- protected void wrapMenuItem_actionPerformed()
- {
- viewport.setWrapAlignment(wrapMenuItem.getState());
- alignPanel.setWrapAlignment(wrapMenuItem.getState());
- scaleAbove.setEnabled(wrapMenuItem.getState());
- scaleLeft.setEnabled(wrapMenuItem.getState());
- scaleRight.setEnabled(wrapMenuItem.getState());
- alignPanel.paintAlignment(true);
- }
-
- public void overviewMenuItem_actionPerformed()
- {
- if (alignPanel.overviewPanel != null)
- {
- return;
- }
-
- Frame frame = new Frame();
- OverviewPanel overview = new OverviewPanel(alignPanel);
- frame.add(overview);
- // +50 must allow for applet frame window
- jalview.bin.JalviewLite.addFrame(frame, "Overview " + this.getTitle(),
- overview.getPreferredSize().width,
- overview.getPreferredSize().height + 50);
-
- frame.pack();
- frame.addWindowListener(new WindowAdapter()
- {
- public void windowClosing(WindowEvent e)
- {
- alignPanel.setOverviewPanel(null);
- };
- });
-
- alignPanel.setOverviewPanel(overview);
-
- }
-
- void changeColour(ColourSchemeI cs)
- {
- int threshold = 0;
-
- if (cs != null)
- {
- if (viewport.getAbovePIDThreshold())
- {
- threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,
- "Background");
-
- cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
-
- viewport.setGlobalColourScheme(cs);
- }
- else
- {
- cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
- }
-
- if (viewport.getConservationSelected())
- {
-
- Alignment al = (Alignment) viewport.alignment;
- Conservation c = new Conservation("All",
- ResidueProperties.propHash, 3, al.getSequences(), 0,
- al.getWidth() - 1);
-
- c.calculate();
- c.verdict(false, viewport.ConsPercGaps);
-
- cs.setConservation(c);
-
- cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel,
- cs, "Background"));
-
- }
- else
- {
- cs.setConservation(null);
- }
-
- cs.setConsensus(viewport.hconsensus);
-
- }
- viewport.setGlobalColourScheme(cs);
-
- if (viewport.getColourAppliesToAllGroups())
- {
- Vector groups = viewport.alignment.getGroups();
- for (int i = 0; i < groups.size(); i++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
-
- if (cs == null)
- {
- sg.cs = null;
- continue;
- }
- if (cs instanceof ClustalxColourScheme)
- {
- sg.cs = new ClustalxColourScheme(
- sg.getSequences(viewport.hiddenRepSequences),
- sg.getWidth());
- }
- else
- {
- try
- {
- sg.cs = (ColourSchemeI) cs.getClass().newInstance();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- sg.cs = cs;
- }
- }
-
- if (viewport.getAbovePIDThreshold()
- || cs instanceof PIDColourScheme
- || cs instanceof Blosum62ColourScheme)
- {
- sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
- sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(viewport.hiddenRepSequences), 0,
- sg.getWidth()));
- }
- else
- {
- sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
- }
-
- if (viewport.getConservationSelected())
- {
- Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3,
- sg.getSequences(viewport.hiddenRepSequences), 0,
- viewport.alignment.getWidth() - 1);
- c.calculate();
- c.verdict(false, viewport.ConsPercGaps);
- sg.cs.setConservation(c);
- }
- else
- {
- sg.cs.setConservation(null);
- sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
- }
-
- }
- }
-
- if (alignPanel.getOverviewPanel() != null)
- {
- alignPanel.getOverviewPanel().updateOverviewImage();
- }
-
- jalview.structure.StructureSelectionManager
- .getStructureSelectionManager(viewport.applet).sequenceColoursChanged(
- alignPanel);
-
- alignPanel.paintAlignment(true);
- }
-
- protected void modifyPID_actionPerformed()
- {
- if (viewport.getAbovePIDThreshold()
- && viewport.globalColourScheme != null)
- {
- SliderPanel.setPIDSliderSource(alignPanel,
- viewport.getGlobalColourScheme(), "Background");
- SliderPanel.showPIDSlider();
- }
- }
-
- protected void modifyConservation_actionPerformed()
- {
- if (viewport.getConservationSelected()
- && viewport.globalColourScheme != null)
- {
- SliderPanel.setConservationSlider(alignPanel,
- viewport.globalColourScheme, "Background");
- SliderPanel.showConservationSlider();
- }
- }
-
- protected void conservationMenuItem_actionPerformed()
- {
- viewport.setConservationSelected(conservationMenuItem.getState());
-
- viewport.setAbovePIDThreshold(false);
- abovePIDThreshold.setState(false);
-
- changeColour(viewport.getGlobalColourScheme());
-
- modifyConservation_actionPerformed();
- }
-
- public void abovePIDThreshold_actionPerformed()
- {
- viewport.setAbovePIDThreshold(abovePIDThreshold.getState());
-
- conservationMenuItem.setState(false);
- viewport.setConservationSelected(false);
-
- changeColour(viewport.getGlobalColourScheme());
-
- modifyPID_actionPerformed();
- }
-
- public void sortPairwiseMenuItem_actionPerformed()
- {
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
- AlignmentSorter.sortByPID(viewport.getAlignment(), viewport
- .getAlignment().getSequenceAt(0), null);
-
- addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,
- viewport.alignment));
- alignPanel.paintAlignment(true);
- }
-
- public void sortIDMenuItem_actionPerformed()
- {
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
- AlignmentSorter.sortByID(viewport.getAlignment());
- addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.alignment));
- alignPanel.paintAlignment(true);
- }
-
- public void sortLengthMenuItem_actionPerformed()
- {
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
- AlignmentSorter.sortByLength(viewport.getAlignment());
- addHistoryItem(new OrderCommand("Length Sort", oldOrder,
- viewport.alignment));
- alignPanel.paintAlignment(true);
- }
-
- public void sortGroupMenuItem_actionPerformed()
- {
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
- AlignmentSorter.sortByGroup(viewport.getAlignment());
- addHistoryItem(new OrderCommand("Group Sort", oldOrder,
- viewport.alignment));
- alignPanel.paintAlignment(true);
-
- }
-
- public void removeRedundancyMenuItem_actionPerformed()
- {
- new RedundancyPanel(alignPanel);
- }
-
- public void pairwiseAlignmentMenuItem_actionPerformed()
- {
- if (viewport.getSelectionGroup() != null
- && viewport.getSelectionGroup().getSize() > 1)
- {
- Frame frame = new Frame();
- frame.add(new PairwiseAlignPanel(alignPanel));
- jalview.bin.JalviewLite.addFrame(frame, "Pairwise Alignment", 600,
- 500);
- }
- }
-
- public void PCAMenuItem_actionPerformed()
- {
- // are the sequences aligned?
- if (!viewport.alignment.isAligned(false))
- {
- SequenceI current;
- int Width = viewport.getAlignment().getWidth();
-
- for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
- {
- current = viewport.getAlignment().getSequenceAt(i);
-
- if (current.getLength() < Width)
- {
- current.insertCharAt(Width - 1, viewport.getGapCharacter());
- }
- }
- alignPanel.paintAlignment(true);
- }
-
- if ((viewport.getSelectionGroup() != null
- && viewport.getSelectionGroup().getSize() < 4 && viewport
- .getSelectionGroup().getSize() > 0)
- || viewport.getAlignment().getHeight() < 4)
- {
- return;
- }
-
- try
- {
- new PCAPanel(viewport);
- } catch (java.lang.OutOfMemoryError ex)
- {
- }
-
- }
-
- public void averageDistanceTreeMenuItem_actionPerformed()
- {
- NewTreePanel("AV", "PID", "Average distance tree using PID");
- }
-
- public void neighbourTreeMenuItem_actionPerformed()
- {
- NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
- }
-
- protected void njTreeBlosumMenuItem_actionPerformed()
- {
- NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
- }
-
- protected void avTreeBlosumMenuItem_actionPerformed()
- {
- NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
- }
-
- void NewTreePanel(String type, String pwType, String title)
- {
- // are the sequences aligned?
- if (!viewport.alignment.isAligned(false))
- {
- SequenceI current;
- int Width = viewport.getAlignment().getWidth();
-
- for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
- {
- current = viewport.getAlignment().getSequenceAt(i);
-
- if (current.getLength() < Width)
- {
- current.insertCharAt(Width - 1, viewport.getGapCharacter());
- }
- }
- alignPanel.paintAlignment(true);
-
- }
-
- if ((viewport.getSelectionGroup() != null && viewport
- .getSelectionGroup().getSize() > 1)
- || (viewport.getSelectionGroup() == null && viewport.alignment
- .getHeight() > 1))
- {
- final TreePanel tp = new TreePanel(alignPanel, type, pwType);
-
- addTreeMenuItem(tp, title);
-
- jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);
- }
- }
-
- void loadTree_actionPerformed()
- {
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
- cap.setText("Paste your Newick tree file here.");
- cap.setTreeImport();
- Frame frame = new Frame();
- frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "Paste Newick file ", 400, 300);
- }
-
- public void loadTree(jalview.io.NewickFile tree, String treeFile)
- {
- TreePanel tp = new TreePanel(alignPanel, treeFile, "From File - ", tree);
- jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);
- addTreeMenuItem(tp, treeFile);
- }
-
- /**
- * sort the alignment using the given treePanel
- *
- * @param treePanel
- * tree used to sort view
- * @param title
- * string used for undo event name
- */
- public void sortByTree(TreePanel treePanel, String title)
- {
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
- AlignmentSorter
- .sortByTree(viewport.getAlignment(), treePanel.getTree());
- // addHistoryItem(new HistoryItem("Sort", viewport.alignment,
- // HistoryItem.SORT));
- addHistoryItem(new OrderCommand("Order by " + title, oldOrder,
- viewport.alignment));
- alignPanel.paintAlignment(true);
- }
-
- /**
- * Do any automatic reordering of the alignment and add the necessary bits to
- * the menu structure for the new tree
- *
- * @param treePanel
- * @param title
- */
- protected void addTreeMenuItem(final TreePanel treePanel,
- final String title)
- {
- final MenuItem item = new MenuItem(title);
- sortByTreeMenu.add(item);
- item.addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- sortByTree(treePanel, title); // treePanel.getTitle());
- }
- });
-
- treePanel.addWindowListener(new WindowAdapter()
- {
- public void windowOpened(WindowEvent e)
- {
- if (viewport.sortByTree)
- {
- sortByTree(treePanel, title);
- }
- super.windowOpened(e);
- }
-
- public void windowClosing(WindowEvent e)
- {
- sortByTreeMenu.remove(item);
- };
- });
- }
- public boolean sortBy(AlignmentOrder alorder, String undoname)
- {
- SequenceI[] oldOrder = viewport.getAlignment()
- .getSequencesArray();
- if (viewport.applet.debug)
- {
- System.err.println("Sorting "+alorder.getOrder().size()+" in alignment '"+getTitle()+"'");
- }
- AlignmentSorter.sortBy(viewport.getAlignment(), alorder);
- if (undoname!=null)
- {
- addHistoryItem(new OrderCommand(undoname, oldOrder, viewport.alignment));
- }
- alignPanel.paintAlignment(true);
- return true;
- }
-
- protected void documentation_actionPerformed()
- {
- alignPanel.av.applet.openJalviewHelpUrl();
- }
-
- protected void about_actionPerformed()
- {
-
- class AboutPanel extends Canvas
- {
- String version;
-
- String builddate;
-
- public AboutPanel(String version, String builddate)
- {
- this.version = version;
- this.builddate = builddate;
- }
-
- public void paint(Graphics g)
- {
- g.setColor(Color.white);
- g.fillRect(0, 0, getSize().width, getSize().height);
- g.setFont(new Font("Helvetica", Font.PLAIN, 12));
- FontMetrics fm = g.getFontMetrics();
- int fh = fm.getHeight();
- int y = 5, x = 7;
- g.setColor(Color.black);
- // TODO: update this text for each release or centrally store it for
- // lite and application
- g.setFont(new Font("Helvetica", Font.BOLD, 14));
- g.drawString("JalviewLite - Release " + version, x, y += fh);
- g.setFont(new Font("Helvetica", Font.BOLD, 12));
- g.drawString("Build date: " + builddate, x, y += fh);
- g.setFont(new Font("Helvetica", Font.PLAIN, 12));
- g.drawString(
- "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,",
- x, y += fh * 1.5);
- g.drawString("David Martin & Geoff Barton.", x + 50, y += fh);
- g.drawString(
- "Development managed by The Barton Group, University of Dundee, Scotland, UK.",
- x, y += fh);
- g.drawString(
- "For help, see the FAQ at www.jalview.org and/or join the jalview-discuss at jalview.org mailing list",
- x, y += fh);
- g.drawString("If you use Jalview, please cite:", x, y += fh + 8);
- g.drawString(
- "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)",
- x, y += fh);
- g.drawString(
- "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench",
- x, y += fh);
- g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033",
- x, y += fh);
- }
- }
-
- Frame frame = new Frame();
- frame.add(new AboutPanel(JalviewLite.getVersion(), JalviewLite
- .getBuildDate()));
- jalview.bin.JalviewLite.addFrame(frame, "Jalview", 580, 220);
-
- }
-
- public void showURL(String url, String target)
- {
- if (viewport.applet == null)
- {
- System.out.println("Not running as applet - no browser available.");
- }
- else
- {
- viewport.applet.showURL(url, target);
- }
- }
-
- // ////////////////////////////////////////////////////////////////////////////////
- // JBuilder Graphics here
-
- MenuBar alignFrameMenuBar = new MenuBar();
-
- Menu fileMenu = new Menu("File");
-
- MenuItem loadApplication = new MenuItem("View in Full Application");
-
- MenuItem loadTree = new MenuItem("Load Associated Tree ...");
-
- MenuItem loadAnnotations = new MenuItem("Load Features/Annotations ...");
-
- MenuItem outputFeatures = new MenuItem("Export Features ...");
-
- MenuItem outputAnnotations = new MenuItem("Export Annotations ...");
-
- MenuItem closeMenuItem = new MenuItem("Close");
-
- Menu editMenu = new Menu("Edit");
-
- Menu viewMenu = new Menu("View");
-
- Menu colourMenu = new Menu("Colour");
-
- Menu calculateMenu = new Menu("Calculate");
-
- MenuItem selectAllSequenceMenuItem = new MenuItem("Select all");
-
- MenuItem deselectAllSequenceMenuItem = new MenuItem("Deselect All");
-
- MenuItem invertSequenceMenuItem = new MenuItem("Invert Selection");
-
- MenuItem remove2LeftMenuItem = new MenuItem();
-
- MenuItem remove2RightMenuItem = new MenuItem();
-
- MenuItem removeGappedColumnMenuItem = new MenuItem();
-
- MenuItem removeAllGapsMenuItem = new MenuItem();
-
- CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem();
-
- CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem();
-
- MenuItem sortPairwiseMenuItem = new MenuItem();
-
- MenuItem sortIDMenuItem = new MenuItem();
-
- MenuItem sortLengthMenuItem = new MenuItem();
-
- MenuItem sortGroupMenuItem = new MenuItem();
-
- MenuItem removeRedundancyMenuItem = new MenuItem();
-
- MenuItem pairwiseAlignmentMenuItem = new MenuItem();
-
- MenuItem PCAMenuItem = new MenuItem();
-
- MenuItem averageDistanceTreeMenuItem = new MenuItem();
-
- MenuItem neighbourTreeMenuItem = new MenuItem();
-
- BorderLayout borderLayout1 = new BorderLayout();
-
- public Label statusBar = new Label();
-
- Menu outputTextboxMenu = new Menu();
-
- MenuItem clustalColour = new MenuItem();
-
- MenuItem zappoColour = new MenuItem();
-
- MenuItem taylorColour = new MenuItem();
-
- MenuItem hydrophobicityColour = new MenuItem();
-
- MenuItem helixColour = new MenuItem();
-
- MenuItem strandColour = new MenuItem();
-
- MenuItem turnColour = new MenuItem();
-
- MenuItem buriedColour = new MenuItem();
-
- MenuItem userDefinedColour = new MenuItem();
-
- MenuItem PIDColour = new MenuItem();
-
- MenuItem BLOSUM62Colour = new MenuItem();
-
- MenuItem njTreeBlosumMenuItem = new MenuItem();
-
- MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();
-
- CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem();
-
- CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem();
-
- CheckboxMenuItem displayNonconservedMenuItem = new CheckboxMenuItem();
-
- MenuItem alProperties = new MenuItem("Alignment Properties...");
-
- MenuItem overviewMenuItem = new MenuItem();
-
- MenuItem undoMenuItem = new MenuItem();
-
- MenuItem redoMenuItem = new MenuItem();
-
- CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();
-
- MenuItem noColourmenuItem = new MenuItem();
-
- CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem();
-
- CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem();
-
- MenuItem findMenuItem = new MenuItem();
-
- CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem();
-
- MenuItem nucleotideColour = new MenuItem();
-
- MenuItem deleteGroups = new MenuItem();
-
- MenuItem grpsFromSelection = new MenuItem();
-
- MenuItem delete = new MenuItem();
-
- MenuItem copy = new MenuItem();
-
- MenuItem cut = new MenuItem();
-
- Menu pasteMenu = new Menu();
-
- MenuItem pasteNew = new MenuItem();
-
- MenuItem pasteThis = new MenuItem();
-
- CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem();
-
- MenuItem font = new MenuItem();
-
- CheckboxMenuItem scaleAbove = new CheckboxMenuItem();
-
- CheckboxMenuItem scaleLeft = new CheckboxMenuItem();
-
- CheckboxMenuItem scaleRight = new CheckboxMenuItem();
-
- MenuItem modifyPID = new MenuItem();
-
- MenuItem modifyConservation = new MenuItem();
-
- CheckboxMenuItem autoCalculate = new CheckboxMenuItem(
- "Autocalculate Consensus", true);
-
- CheckboxMenuItem sortByTree = new CheckboxMenuItem(
- "Sort Alignment With New Tree", true);
-
- Menu sortByTreeMenu = new Menu();
-
- Menu sort = new Menu();
-
- Menu calculate = new Menu();
-
- MenuItem inputText = new MenuItem();
-
- Menu helpMenu = new Menu();
-
- MenuItem documentation = new MenuItem();
-
- MenuItem about = new MenuItem();
-
- CheckboxMenuItem seqLimits = new CheckboxMenuItem();
-
- CheckboxMenuItem centreColumnLabelFlag = new CheckboxMenuItem();
-
- CheckboxMenuItem followMouseOverFlag = new CheckboxMenuItem();
- Menu autoAnnMenu=new Menu();
- CheckboxMenuItem showSequenceLogo= new CheckboxMenuItem();
- CheckboxMenuItem applyAutoAnnotationSettings = new CheckboxMenuItem();
- CheckboxMenuItem showConsensusHistogram = new CheckboxMenuItem();
- CheckboxMenuItem showGroupConsensus = new CheckboxMenuItem();
- CheckboxMenuItem showGroupConservation = new CheckboxMenuItem();
-
- private void jbInit() throws Exception
- {
-
- setMenuBar(alignFrameMenuBar);
-
- MenuItem item;
-
- // dynamically fill save as menu with available formats
- for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)
- {
-
- item = new MenuItem(
- jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);
-
- item.addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- outputText_actionPerformed(e);
- }
- });
-
- outputTextboxMenu.add(item);
- }
- closeMenuItem.addActionListener(this);
- loadApplication.addActionListener(this);
-
- loadTree.addActionListener(this);
- loadAnnotations.addActionListener(this);
- outputFeatures.addActionListener(this);
- outputAnnotations.addActionListener(this);
- selectAllSequenceMenuItem.addActionListener(this);
- deselectAllSequenceMenuItem.addActionListener(this);
- invertSequenceMenuItem.addActionListener(this);
- remove2LeftMenuItem.setLabel("Remove Left");
- remove2LeftMenuItem.addActionListener(this);
- remove2RightMenuItem.setLabel("Remove Right");
- remove2RightMenuItem.addActionListener(this);
- removeGappedColumnMenuItem.setLabel("Remove Empty Columns");
- removeGappedColumnMenuItem.addActionListener(this);
- removeAllGapsMenuItem.setLabel("Remove All Gaps");
- removeAllGapsMenuItem.addActionListener(this);
- viewBoxesMenuItem.setLabel("Boxes");
- viewBoxesMenuItem.setState(true);
- viewBoxesMenuItem.addItemListener(this);
- viewTextMenuItem.setLabel("Text");
- viewTextMenuItem.setState(true);
- viewTextMenuItem.addItemListener(this);
- sortPairwiseMenuItem.setLabel("by Pairwise Identity");
- sortPairwiseMenuItem.addActionListener(this);
- sortIDMenuItem.setLabel("by ID");
- sortIDMenuItem.addActionListener(this);
- sortLengthMenuItem.setLabel("by Length");
- sortLengthMenuItem.addActionListener(this);
- sortGroupMenuItem.setLabel("by Group");
- sortGroupMenuItem.addActionListener(this);
- removeRedundancyMenuItem.setLabel("Remove Redundancy...");
- removeRedundancyMenuItem.addActionListener(this);
- pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments...");
- pairwiseAlignmentMenuItem.addActionListener(this);
- PCAMenuItem.setLabel("Principal Component Analysis");
- PCAMenuItem.addActionListener(this);
- averageDistanceTreeMenuItem
- .setLabel("Average Distance Using % Identity");
- averageDistanceTreeMenuItem.addActionListener(this);
- neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity");
- neighbourTreeMenuItem.addActionListener(this);
- statusBar.setBackground(Color.white);
- statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
- statusBar.setText("Status bar");
- outputTextboxMenu.setLabel("Output to Textbox");
- clustalColour.setLabel("Clustalx");
-
- clustalColour.addActionListener(this);
- zappoColour.setLabel("Zappo");
- zappoColour.addActionListener(this);
- taylorColour.setLabel("Taylor");
- taylorColour.addActionListener(this);
- hydrophobicityColour.setLabel("Hydrophobicity");
- hydrophobicityColour.addActionListener(this);
- helixColour.setLabel("Helix Propensity");
- helixColour.addActionListener(this);
- strandColour.setLabel("Strand Propensity");
- strandColour.addActionListener(this);
- turnColour.setLabel("Turn Propensity");
- turnColour.addActionListener(this);
- buriedColour.setLabel("Buried Index");
- buriedColour.addActionListener(this);
- userDefinedColour.setLabel("User Defined...");
- userDefinedColour.addActionListener(this);
- PIDColour.setLabel("Percentage Identity");
- PIDColour.addActionListener(this);
- BLOSUM62Colour.setLabel("BLOSUM62 Score");
- BLOSUM62Colour.addActionListener(this);
- avDistanceTreeBlosumMenuItem
- .setLabel("Average Distance Using BLOSUM62");
- avDistanceTreeBlosumMenuItem.addActionListener(this);
- njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62");
- njTreeBlosumMenuItem.addActionListener(this);
- annotationPanelMenuItem.setLabel("Show Annotations");
- annotationPanelMenuItem.addItemListener(this);
- colourTextMenuItem.setLabel("Colour Text");
- colourTextMenuItem.addItemListener(this);
- displayNonconservedMenuItem.setLabel("Show nonconserved");
- displayNonconservedMenuItem.addItemListener(this);
- alProperties.addActionListener(this);
- overviewMenuItem.setLabel("Overview Window");
- overviewMenuItem.addActionListener(this);
- undoMenuItem.setEnabled(false);
- undoMenuItem.setLabel("Undo");
- undoMenuItem.addActionListener(this);
- redoMenuItem.setEnabled(false);
- redoMenuItem.setLabel("Redo");
- redoMenuItem.addActionListener(this);
- conservationMenuItem.setLabel("by Conservation");
- conservationMenuItem.addItemListener(this);
- noColourmenuItem.setLabel("None");
- noColourmenuItem.addActionListener(this);
- wrapMenuItem.setLabel("Wrap");
- wrapMenuItem.addItemListener(this);
- renderGapsMenuItem.setLabel("Show Gaps");
- renderGapsMenuItem.setState(true);
- renderGapsMenuItem.addItemListener(this);
- findMenuItem.setLabel("Find...");
- findMenuItem.addActionListener(this);
- abovePIDThreshold.setLabel("Above Identity Threshold");
- abovePIDThreshold.addItemListener(this);
- nucleotideColour.setLabel("Nucleotide");
- nucleotideColour.addActionListener(this);
- deleteGroups.setLabel("Undefine Groups");
- deleteGroups.addActionListener(this);
- grpsFromSelection.setLabel("Make Groups for selection");
- grpsFromSelection.addActionListener(this);
- copy.setLabel("Copy");
- copy.addActionListener(this);
- cut.setLabel("Cut");
- cut.addActionListener(this);
- delete.setLabel("Delete");
- delete.addActionListener(this);
- pasteMenu.setLabel("Paste");
- pasteNew.setLabel("To New Alignment");
- pasteNew.addActionListener(this);
- pasteThis.setLabel("Add To This Alignment");
- pasteThis.addActionListener(this);
- applyToAllGroups.setLabel("Apply Colour To All Groups");
- applyToAllGroups.setState(true);
- applyToAllGroups.addItemListener(this);
- font.setLabel("Font...");
- font.addActionListener(this);
- scaleAbove.setLabel("Scale Above");
- scaleAbove.setState(true);
- scaleAbove.setEnabled(false);
- scaleAbove.addItemListener(this);
- scaleLeft.setEnabled(false);
- scaleLeft.setState(true);
- scaleLeft.setLabel("Scale Left");
- scaleLeft.addItemListener(this);
- scaleRight.setEnabled(false);
- scaleRight.setState(true);
- scaleRight.setLabel("Scale Right");
- scaleRight.addItemListener(this);
- modifyPID.setLabel("Modify Identity Threshold...");
- modifyPID.addActionListener(this);
- modifyConservation.setLabel("Modify Conservation Threshold...");
- modifyConservation.addActionListener(this);
- sortByTreeMenu.setLabel("By Tree Order");
- sort.setLabel("Sort");
- calculate.setLabel("Calculate Tree");
- autoCalculate.addItemListener(this);
- sortByTree.addItemListener(this);
- inputText.setLabel("Input from textbox");
- inputText.addActionListener(this);
- centreColumnLabelFlag.setLabel("Centre column labels");
- centreColumnLabelFlag.addItemListener(this);
- followMouseOverFlag.setLabel("Automatic Scrolling");
- followMouseOverFlag.addItemListener(this);
- helpMenu.setLabel("Help");
- documentation.setLabel("Documentation");
- documentation.addActionListener(this);
-
- about.setLabel("About...");
- about.addActionListener(this);
- seqLimits.setState(true);
- seqLimits.setLabel("Show Sequence Limits");
- seqLimits.addItemListener(this);
- featureSettings.setLabel("Feature Settings...");
- featureSettings.addActionListener(this);
- sequenceFeatures.setLabel("Sequence Features");
- sequenceFeatures.addItemListener(this);
- sequenceFeatures.setState(false);
- annotationColour.setLabel("by Annotation...");
- annotationColour.addActionListener(this);
- invertSequenceMenuItem.setLabel("Invert Sequence Selection");
- invertColSel.setLabel("Invert Column Selection");
- menu1.setLabel("Show");
- showColumns.setLabel("All Columns ");
- showSeqs.setLabel("All Sequences");
- menu2.setLabel("Hide");
- hideColumns.setLabel("Selected Columns");
- hideSequences.setLabel("Selected Sequences");
- hideAllButSelection.setLabel("All but Selected Region (Shift+Ctrl+H)");
- hideAllSelection.setLabel("Selected Region");
- showAllHidden.setLabel("All Sequences and Columns");
- showGroupConsensus.setLabel("Group Consensus");
- showGroupConservation.setLabel("Group Conservation");
- showConsensusHistogram.setLabel("Show Consensus Histogram");
- showSequenceLogo.setLabel("Show Consensus Logo");
- applyAutoAnnotationSettings.setLabel("Apply to all groups");
- applyAutoAnnotationSettings.setState(true);
- autoAnnMenu.setLabel("Autocalculated Annotation");
-
- invertColSel.addActionListener(this);
- showColumns.addActionListener(this);
- showSeqs.addActionListener(this);
- hideColumns.addActionListener(this);
- hideSequences.addActionListener(this);
- hideAllButSelection.addActionListener(this);
- hideAllSelection.addActionListener(this);
- showAllHidden.addActionListener(this);
- showGroupConsensus.addItemListener(this);
- showGroupConservation.addItemListener(this);
- showConsensusHistogram.addItemListener(this);
- showSequenceLogo.addItemListener(this);
- applyAutoAnnotationSettings.addItemListener(this);
- formatMenu.setLabel("Format");
- selectMenu.setLabel("Select");
- newView.setLabel("New View");
- newView.addActionListener(this);
- alignFrameMenuBar.add(fileMenu);
- alignFrameMenuBar.add(editMenu);
- alignFrameMenuBar.add(selectMenu);
- alignFrameMenuBar.add(viewMenu);
- alignFrameMenuBar.add(formatMenu);
- alignFrameMenuBar.add(colourMenu);
- alignFrameMenuBar.add(calculateMenu);
- alignFrameMenuBar.add(helpMenu);
-
- fileMenu.add(inputText);
- fileMenu.add(loadTree);
- fileMenu.add(loadAnnotations);
-
- fileMenu.addSeparator();
- fileMenu.add(outputTextboxMenu);
- fileMenu.add(outputFeatures);
- fileMenu.add(outputAnnotations);
-
- if (jalviewServletURL != null)
- {
- fileMenu.add(loadApplication);
- }
-
- fileMenu.addSeparator();
- fileMenu.add(closeMenuItem);
-
- editMenu.add(undoMenuItem);
- editMenu.add(redoMenuItem);
- editMenu.add(cut);
- editMenu.add(copy);
- editMenu.add(pasteMenu);
- editMenu.add(delete);
- editMenu.addSeparator();
- editMenu.add(remove2LeftMenuItem);
- editMenu.add(remove2RightMenuItem);
- editMenu.add(removeGappedColumnMenuItem);
- editMenu.add(removeAllGapsMenuItem);
- editMenu.add(removeRedundancyMenuItem);
- viewMenu.add(newView);
- viewMenu.addSeparator();
- viewMenu.add(menu1);
- viewMenu.add(menu2);
- viewMenu.addSeparator();
- viewMenu.add(followMouseOverFlag);
- viewMenu.add(annotationPanelMenuItem);
- autoAnnMenu.add(applyAutoAnnotationSettings);
- autoAnnMenu.add(showConsensusHistogram);
- autoAnnMenu.add(showSequenceLogo);
- autoAnnMenu.addSeparator();
- autoAnnMenu.add(showGroupConservation);
- autoAnnMenu.add(showGroupConsensus);
- viewMenu.add(autoAnnMenu);
- viewMenu.addSeparator();
- viewMenu.add(sequenceFeatures);
- viewMenu.add(featureSettings);
- viewMenu.addSeparator();
- viewMenu.add(alProperties);
- viewMenu.addSeparator();
- viewMenu.add(overviewMenuItem);
- colourMenu.add(applyToAllGroups);
- colourMenu.addSeparator();
- colourMenu.add(noColourmenuItem);
- colourMenu.add(clustalColour);
- colourMenu.add(BLOSUM62Colour);
- colourMenu.add(PIDColour);
- colourMenu.add(zappoColour);
- colourMenu.add(taylorColour);
- colourMenu.add(hydrophobicityColour);
- colourMenu.add(helixColour);
- colourMenu.add(strandColour);
- colourMenu.add(turnColour);
- colourMenu.add(buriedColour);
- colourMenu.add(nucleotideColour);
- colourMenu.add(userDefinedColour);
- colourMenu.addSeparator();
- colourMenu.add(conservationMenuItem);
- colourMenu.add(modifyConservation);
- colourMenu.add(abovePIDThreshold);
- colourMenu.add(modifyPID);
- colourMenu.add(annotationColour);
- calculateMenu.add(sort);
- calculateMenu.add(calculate);
- calculateMenu.addSeparator();
- calculateMenu.add(pairwiseAlignmentMenuItem);
- calculateMenu.add(PCAMenuItem);
- calculateMenu.add(autoCalculate);
- calculateMenu.add(sortByTree);
- this.add(statusBar, BorderLayout.SOUTH);
- pasteMenu.add(pasteNew);
- pasteMenu.add(pasteThis);
- sort.add(sortIDMenuItem);
- sort.add(sortLengthMenuItem);
- sort.add(sortByTreeMenu);
- sort.add(sortGroupMenuItem);
- sort.add(sortPairwiseMenuItem);
- calculate.add(averageDistanceTreeMenuItem);
- calculate.add(neighbourTreeMenuItem);
- calculate.add(avDistanceTreeBlosumMenuItem);
- calculate.add(njTreeBlosumMenuItem);
- helpMenu.add(documentation);
- helpMenu.add(about);
- menu1.add(showColumns);
- menu1.add(showSeqs);
- menu1.add(showAllHidden);
- menu2.add(hideColumns);
- menu2.add(hideSequences);
- menu2.add(hideAllSelection);
- menu2.add(hideAllButSelection);
- formatMenu.add(font);
- formatMenu.add(seqLimits);
- formatMenu.add(wrapMenuItem);
- formatMenu.add(scaleAbove);
- formatMenu.add(scaleLeft);
- formatMenu.add(scaleRight);
- formatMenu.add(viewBoxesMenuItem);
- formatMenu.add(viewTextMenuItem);
- formatMenu.add(colourTextMenuItem);
- formatMenu.add(displayNonconservedMenuItem);
- formatMenu.add(renderGapsMenuItem);
- formatMenu.add(centreColumnLabelFlag);
- selectMenu.add(findMenuItem);
- selectMenu.addSeparator();
- selectMenu.add(selectAllSequenceMenuItem);
- selectMenu.add(deselectAllSequenceMenuItem);
- selectMenu.add(invertSequenceMenuItem);
- selectMenu.add(invertColSel);
- selectMenu.add(grpsFromSelection);
- selectMenu.add(deleteGroups);
-
- }
-
- MenuItem featureSettings = new MenuItem();
-
- CheckboxMenuItem sequenceFeatures = new CheckboxMenuItem();
-
- MenuItem annotationColour = new MenuItem();
-
- MenuItem invertColSel = new MenuItem();
-
- Menu menu1 = new Menu();
-
- MenuItem showColumns = new MenuItem();
-
- MenuItem showSeqs = new MenuItem();
-
- Menu menu2 = new Menu();
-
- MenuItem hideColumns = new MenuItem();
-
- MenuItem hideSequences = new MenuItem();
-
- MenuItem hideAllButSelection = new MenuItem();
-
- MenuItem hideAllSelection = new MenuItem();
-
- MenuItem showAllHidden = new MenuItem();
-
- Menu formatMenu = new Menu();
-
- Menu selectMenu = new Menu();
-
- MenuItem newView = new MenuItem();
-
- /**
- * Attach the alignFrame panels after embedding menus, if necessary. This used
- * to be called setEmbedded, but is now creates the dropdown menus in a
- * platform independent manner to avoid OSX/Mac menu appendage daftness.
- *
- * @param reallyEmbedded
- * true to attach the view to the applet area on the page rather than
- * in a new window
- */
- public void createAlignFrameWindow(boolean reallyEmbedded, String title)
- {
- if (reallyEmbedded)
- {
- // ////
- // Explicly build the embedded menu panel for the on-page applet
- //
- // view cannot be closed if its actually on the page
- fileMenu.remove(closeMenuItem);
- fileMenu.remove(3); // Remove Seperator
- embeddedMenu = makeEmbeddedPopupMenu(alignFrameMenuBar, "Arial",
- Font.PLAIN, 10, false); // use our own fonts.
- // and actually add the components to the applet area
- viewport.applet.setLayout(new BorderLayout());
- viewport.applet.add(embeddedMenu, BorderLayout.NORTH);
- viewport.applet.add(statusBar, BorderLayout.SOUTH);
- alignPanel.setSize(viewport.applet.getSize().width,
- viewport.applet.getSize().height - embeddedMenu.HEIGHT
- - statusBar.HEIGHT);
- viewport.applet.add(alignPanel, BorderLayout.CENTER);
- final AlignFrame me = this;
- viewport.applet.addFocusListener(new FocusListener()
- {
-
- @Override
- public void focusLost(FocusEvent e)
- {
- if (me.viewport.applet.currentAlignFrame==me) {
- me.viewport.applet.currentAlignFrame = null;
- }}
-
- @Override
- public void focusGained(FocusEvent e)
- {
- me.viewport.applet.currentAlignFrame = me;
- }
- });
- viewport.applet.validate();
- }
- else
- {
- // //////
- // test and embed menu bar if necessary.
- //
- if (embedMenuIfNeeded(alignPanel))
- {
- // adjust for status bar height too
- alignPanel.setSize(getSize().width, getSize().height
- - statusBar.HEIGHT);
- }
- add(statusBar, BorderLayout.SOUTH);
- add(alignPanel, BorderLayout.CENTER);
- // and register with the applet so it can pass external API calls to us
- jalview.bin.JalviewLite.addFrame(this, title, DEFAULT_WIDTH,
- DEFAULT_HEIGHT);
- }
- }
-
- /**
- * create a new binding between structures in an existing jmol viewer instance
- * and an alignpanel with sequences that have existing PDBFile entries. Note,
- * this does not open a new Jmol window, or modify the display of the
- * structures in the original jmol window. Note This method doesn't work
- * without an additional javascript library to exchange messages between the
- * distinct applets. See http://issues.jalview.org/browse/JAL-621
- *
- * @param viewer
- * JmolViewer instance
- * @param sequenceIds
- * - sequence Ids to search for associations
- */
- public SequenceStructureBinding addStructureViewInstance(
- Object jmolviewer, String[] sequenceIds)
- {
- org.jmol.api.JmolViewer viewer = null;
- try
- {
- viewer = (org.jmol.api.JmolViewer) jmolviewer;
- } catch (ClassCastException ex)
- {
- System.err.println("Unsupported viewer object :"
- + jmolviewer.getClass());
- }
- if (viewer == null)
- {
- System.err.println("Can't use this object as a structure viewer:"
- + jmolviewer.getClass());
- return null;
- }
- SequenceI[] seqs = null;
- if (sequenceIds == null || sequenceIds.length == 0)
- {
- seqs = viewport.getAlignment().getSequencesArray();
- }
- else
- {
- Vector sqi = new Vector();
- AlignmentI al = viewport.getAlignment();
- for (int sid = 0; sid < sequenceIds.length; sid++)
- {
- SequenceI sq = al.findName(sequenceIds[sid]);
- if (sq != null)
- {
- sqi.addElement(sq);
- }
- }
- if (sqi.size() > 0)
- {
- seqs = new SequenceI[sqi.size()];
- for (int sid = 0, sSize = sqi.size(); sid < sSize; sid++)
- {
- seqs[sid] = (SequenceI) sqi.elementAt(sid);
- }
- }
- else
- {
- return null;
- }
- }
- ExtJmol jmv = null;
- // TODO: search for a jmv that involves viewer
- if (jmv == null)
- { // create a new viewer/jalview binding.
- jmv = new ExtJmol(viewer, alignPanel, new SequenceI[][] {seqs});
- }
- return jmv;
-
- }
- /**
- * bind a pdb file to a sequence in the current view
- *
- * @param sequenceId
- * - sequenceId within the dataset.
- * @param pdbEntryString
- * - the short name for the PDB file
- * @param pdbFile
- * - pdb file - either a URL or a valid PDB file.
- * @return true if binding was as success TODO: consider making an exception
- * structure for indicating when PDB parsing or sequenceId location
- * fails.
- */
- public boolean addPdbFile(String sequenceId, String pdbEntryString,
- String pdbFile)
- {
- SequenceI toaddpdb = viewport.getAlignment().findName(sequenceId);
- boolean needtoadd = false;
- if (toaddpdb != null)
- {
- Vector pdbe = toaddpdb.getPDBId();
- PDBEntry pdbentry = null;
- if (pdbe != null && pdbe.size() > 0)
- {
- for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++)
- {
- pdbentry = (PDBEntry) pdbe.elementAt(pe);
- if (!pdbentry.getId().equals(pdbEntryString)
- && !pdbentry.getFile().equals(pdbFile))
- {
- pdbentry = null;
- }
- else
- {
- continue;
- }
- }
- }
- if (pdbentry == null)
- {
- pdbentry = new PDBEntry();
- pdbentry.setId(pdbEntryString);
- pdbentry.setFile(pdbFile);
- needtoadd = true; // add this new entry to sequence.
- }
- // resolve data source
- // TODO: this code should be a refactored to an io package
- String protocol = AppletFormatAdapter.resolveProtocol(pdbFile, "PDB");
- if (protocol == null)
- {
- return false;
- }
- if (needtoadd)
- {
- // make a note of the access mode and add
- if (pdbentry.getProperty() == null)
- {
- pdbentry.setProperty(new Hashtable());
- }
- pdbentry.getProperty().put("protocol", protocol);
- toaddpdb.addPDBId(pdbentry);
- }
- }
- return true;
- }
-
- private Object[] cleanSeqChainArrays(SequenceI[] seqs, String[] chains)
- {
- if (seqs != null)
- {
- Vector sequences = new Vector();
- for (int i = 0; i < seqs.length; i++)
- {
- if (seqs[i] != null)
- {
- sequences.addElement(new Object[]
- { seqs[i], (chains != null) ? chains[i] : null });
- }
- }
- seqs = new SequenceI[sequences.size()];
- chains = new String[sequences.size()];
- for (int i = 0, isize = sequences.size(); i < isize; i++)
- {
- Object[] oj = (Object[]) sequences.elementAt(i);
-
- seqs[i] = (SequenceI) oj[0];
- chains[i] = (String) oj[1];
- }
- }
- return new Object[]
- { seqs, chains };
-
- }
-
- public void newStructureView(JalviewLite applet, PDBEntry pdb,
- SequenceI[] seqs, String[] chains, String protocol)
- {
- // Scrub any null sequences from the array
- Object[] sqch = cleanSeqChainArrays(seqs, chains);
- seqs = (SequenceI[]) sqch[0];
- chains = (String[]) sqch[1];
- if (seqs == null || seqs.length == 0)
- {
- System.err
- .println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to.");
- }
- if (protocol == null || protocol.trim().length() == 0
- || protocol.equals("null"))
- {
- protocol = (String) pdb.getProperty().get("protocol");
- if (protocol == null)
- {
- System.err.println("Couldn't work out protocol to open structure: "
- + pdb.getId());
- return;
- }
- }
- if (applet.useXtrnalSviewer)
- {
- // register the association(s) and quit, don't create any windows.
- if (StructureSelectionManager.getStructureSelectionManager(applet).setMapping(seqs, chains, pdb.getFile(), protocol)==null) {
- System.err.println("Failed to map "+pdb.getFile()+" ("+protocol+") to any sequences");
- }
- return;
- }
- if (applet.isAlignPdbStructures() && applet.jmolAvailable)
- {
- // can only do alignments with Jmol
- // find the last jmol window assigned to this alignment
- jalview.appletgui.AppletJmol ajm = null, tajm;
- Vector jmols = applet
- .getAppletWindow(jalview.appletgui.AppletJmol.class);
- for (int i = 0, iSize = jmols.size(); i < iSize; i++)
- {
- tajm = (jalview.appletgui.AppletJmol) jmols.elementAt(i);
- if (tajm.ap.alignFrame == this)
- {
- ajm = tajm;
- break;
- }
- }
- if (ajm != null)
- {
- System.err
- .println("Incremental adding and aligning structure to existing Jmol view not yet implemented.");
- // try and add the pdb structure
- // ajm.addS
- ajm = null;
- }
- }
- // otherwise, create a new window
- if (applet.jmolAvailable)
- {
- new jalview.appletgui.AppletJmol(pdb, seqs, chains, alignPanel,
- protocol);
- applet.lastFrameX += 40;
- applet.lastFrameY += 40;
- }
- else
- {
- new MCview.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol);
- }
-
- }
-
- public void alignedStructureView(JalviewLite applet, PDBEntry[] pdb,
- SequenceI[][] seqs, String[][] chains, String[] protocols)
- {
- // TODO Auto-generated method stub
- System.err.println("Aligned Structure View: Not yet implemented.");
- }
-
- /**
- * modify the current selection, providing the user has not made a selection already.
- * @param sel - sequences from this alignment
- * @param csel - columns to be selected on the alignment
- */
- public void select(SequenceGroup sel, ColumnSelection csel)
- {
- alignPanel.seqPanel.selection(sel, csel, null);
- }
-
- public void scrollTo(int row, int column)
- {
- alignPanel.seqPanel.scrollTo(row, column);
- }
- public void scrollToRow(int row)
- {
- alignPanel.seqPanel.scrollToRow(row);
- }
- public void scrollToColumn(int column)
- {
- alignPanel.seqPanel.scrollToColumn(column);
- }
- /**
- * @return the alignments unique ID.
- */
- public String getSequenceSetId() {
- return viewport.getSequenceSetId();
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.appletgui;
+
+import jalview.analysis.AlignmentSorter;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.api.AlignViewControllerGuiI;
+import jalview.api.AlignViewControllerI;
+import jalview.api.AlignViewportI;
+import jalview.api.FeatureRenderer;
+import jalview.api.FeatureSettingsControllerI;
+import jalview.api.SequenceStructureBinding;
+import jalview.bin.JalviewLite;
+import jalview.commands.CommandI;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.commands.OrderCommand;
+import jalview.commands.RemoveGapColCommand;
+import jalview.commands.RemoveGapsCommand;
+import jalview.commands.SlideSequencesCommand;
+import jalview.commands.TrimRegionCommand;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentOrder;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.io.AnnotationFile;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.FeaturesFile;
+import jalview.io.TCoffeeScoreFile;
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.ClustalxColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.NucleotideColourScheme;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.RNAHelicesColourChooser;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TCoffeeColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.ZappoColourScheme;
+import jalview.structure.StructureSelectionManager;
+import jalview.structures.models.AAStructureBindingModel;
+import jalview.util.MappingUtils;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.CheckboxMenuItem;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Label;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.jmol.viewer.Viewer;
+
+public class AlignFrame extends EmbmenuFrame implements ActionListener,
+ ItemListener, KeyListener, AlignViewControllerGuiI
+{
+ public AlignViewControllerI avc;
+
+ public AlignmentPanel alignPanel;
+
+ public AlignViewport viewport;
+
+ // width and height may be overridden by applet parameters
+ int frameWidth = 700;
+
+ int frameHeight = 500;
+
+ String jalviewServletURL;
+
+ /*
+ * Flag for showing autocalculated consensus above or below other consensus
+ * rows
+ */
+ private boolean showAutoCalculatedAbove;
+
+ private SequenceAnnotationOrder annotationSortOrder;
+
+ /**
+ * Constructor that creates the frame and adds it to the display.
+ *
+ * @param al
+ * @param applet
+ * @param title
+ * @param embedded
+ */
+ public AlignFrame(AlignmentI al, JalviewLite applet, String title,
+ boolean embedded)
+ {
+ this(al, applet, title, embedded, true);
+ }
+
+ /**
+ * Constructor that optionally allows the frame to be displayed or only
+ * created.
+ *
+ * @param al
+ * @param applet
+ * @param title
+ * @param embedded
+ * @param addToDisplay
+ */
+ public AlignFrame(AlignmentI al, JalviewLite applet, String title,
+ boolean embedded, boolean addToDisplay)
+ {
+ this(al, null, null, applet, title, embedded, addToDisplay);
+ }
+
+ public AlignFrame(AlignmentI al, SequenceI[] hiddenSeqs,
+ ColumnSelection columnSelection, JalviewLite applet,
+ String title, boolean embedded)
+ {
+ this(al, hiddenSeqs, columnSelection, applet, title, embedded, true);
+ }
+
+ public AlignFrame(AlignmentI al, SequenceI[] hiddenSeqs,
+ ColumnSelection columnSelection, JalviewLite applet,
+ String title, boolean embedded, boolean addToDisplay)
+ {
+ if (applet != null)
+ {
+ jalviewServletURL = applet.getParameter("APPLICATION_URL");
+ }
+
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ // need to get window geometry before we calculate alignment layout
+ if (applet != null)
+ {
+ String param;
+ try
+ {
+ param = applet.getParameter("windowWidth");
+ if (param != null)
+ {
+ int width = Integer.parseInt(param);
+ frameWidth = width;
+ }
+ param = applet.getParameter("windowHeight");
+ if (param != null)
+ {
+ int height = Integer.parseInt(param);
+ frameHeight = height;
+ }
+ } catch (Exception ex)
+ {
+ }
+ }
+ viewport = new AlignViewport(al, applet);
+
+ if (hiddenSeqs != null && hiddenSeqs.length > 0)
+ {
+ viewport.hideSequence(hiddenSeqs);
+ }
+ if (columnSelection != null)
+ {
+ viewport.setColumnSelection(columnSelection);
+ }
+
+ alignPanel = new AlignmentPanel(this, viewport);
+ avc = new jalview.controller.AlignViewController(this, viewport,
+ alignPanel);
+ viewport.updateConservation(alignPanel);
+ viewport.updateConsensus(alignPanel);
+
+ displayNonconservedMenuItem.setState(viewport.getShowUnconserved());
+ followMouseOverFlag.setState(viewport.isFollowHighlight());
+ showGroupConsensus.setState(viewport.isShowGroupConsensus());
+ showGroupConservation.setState(viewport.isShowGroupConservation());
+ showConsensusHistogram.setState(viewport.isShowConsensusHistogram());
+ showSequenceLogo.setState(viewport.isShowSequenceLogo());
+ normSequenceLogo.setState(viewport.isNormaliseSequenceLogo());
+ applyToAllGroups.setState(viewport.getColourAppliesToAllGroups());
+ annotationPanelMenuItem.setState(viewport.isShowAnnotation());
+ showAlignmentAnnotations.setState(viewport.isShowAnnotation());
+ showSequenceAnnotations.setState(viewport.isShowAnnotation());
+
+ seqLimits.setState(viewport.getShowJVSuffix());
+
+ if (applet != null)
+ {
+ String param = applet.getParameter("sortBy");
+ if (param != null)
+ {
+ if (param.equalsIgnoreCase("Id"))
+ {
+ sortIDMenuItem_actionPerformed();
+ }
+ else if (param.equalsIgnoreCase("Pairwise Identity"))
+ {
+ sortPairwiseMenuItem_actionPerformed();
+ }
+ else if (param.equalsIgnoreCase("Length"))
+ {
+ sortLengthMenuItem_actionPerformed();
+ }
+ }
+
+ param = applet.getParameter("wrap");
+ if (param != null)
+ {
+ if (param.equalsIgnoreCase("true"))
+ {
+ wrapMenuItem.setState(true);
+ wrapMenuItem_actionPerformed();
+ }
+ }
+ param = applet.getParameter("centrecolumnlabels");
+ if (param != null)
+ {
+ centreColumnLabelFlag.setState(true);
+ centreColumnLabelFlag_stateChanged();
+ }
+
+ }
+ if (viewport.getAlignment().isNucleotide())
+ {
+ viewport.updateStrucConsensus(alignPanel);
+ if (viewport.getAlignment().hasRNAStructure())
+ {
+ RNAHelixColour.setEnabled(true);
+ }
+ else
+ {
+ RNAHelixColour.setEnabled(false);
+ }
+ }
+ else
+ {
+ RNAHelixColour.setEnabled(false);
+ purinePyrimidineColour.setEnabled(false);
+ }
+ // Some JVMS send keyevents to Top frame or lowest panel,
+ // Havent worked out why yet. So add to both this frame and seqCanvas for
+ // now
+ this.addKeyListener(this);
+ alignPanel.seqPanel.seqCanvas.addKeyListener(this);
+ alignPanel.idPanel.idCanvas.addKeyListener(this);
+ alignPanel.scalePanel.addKeyListener(this);
+ alignPanel.annotationPanel.addKeyListener(this);
+ alignPanel.annotationPanelHolder.addKeyListener(this);
+ alignPanel.annotationSpaceFillerHolder.addKeyListener(this);
+ alignPanel.alabels.addKeyListener(this);
+
+ if (addToDisplay)
+ {
+ addToDisplay(embedded);
+ }
+ }
+
+ /**
+ * @param embedded
+ */
+ public void addToDisplay(boolean embedded)
+ {
+ createAlignFrameWindow(embedded);
+ validate();
+ alignPanel.adjustAnnotationHeight();
+ alignPanel.paintAlignment(true);
+ }
+
+ public AlignViewport getAlignViewport()
+ {
+ return viewport;
+ }
+
+ public SeqCanvas getSeqcanvas()
+ {
+ return alignPanel.seqPanel.seqCanvas;
+ }
+
+ /**
+ * Load a features file onto the alignment
+ *
+ * @param file
+ * file URL, content, or other resolvable path
+ * @param type
+ * is protocol for accessing data referred to by file
+ */
+
+ public boolean parseFeaturesFile(String file, String type)
+ {
+ return parseFeaturesFile(file, type, true);
+ }
+
+ /**
+ * Load a features file onto the alignment
+ *
+ * @param file
+ * file URL, content, or other resolvable path
+ * @param type
+ * is protocol for accessing data referred to by file
+ * @param autoenabledisplay
+ * when true, display features flag will be automatically enabled if
+ * features are loaded
+ * @return true if data parsed as a features file
+ */
+ public boolean parseFeaturesFile(String file, String type,
+ boolean autoenabledisplay)
+ {
+ // TODO: test if importing a features file onto an alignment which already
+ // has features with links overwrites the original links.
+
+ Hashtable featureLinks = new Hashtable();
+ boolean featuresFile = false;
+ try
+ {
+ featuresFile = new jalview.io.FeaturesFile(file, type).parse(viewport
+ .getAlignment(), alignPanel.seqPanel.seqCanvas
+ .getFeatureRenderer().getFeatureColours(), featureLinks,
+ true, viewport.applet.getDefaultParameter("relaxedidmatch",
+ false));
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ if (featuresFile)
+ {
+ if (featureLinks.size() > 0)
+ {
+ alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureLinks = featureLinks;
+ }
+ if (autoenabledisplay)
+ {
+ viewport.setShowSequenceFeatures(true);
+ sequenceFeatures.setState(true);
+ }
+ if (alignPanel.seqPanel.seqCanvas.fr != null)
+ {
+ // update the min/max ranges where necessary
+ alignPanel.seqPanel.seqCanvas.fr.findAllFeatures(true);
+ }
+ if (viewport.featureSettings != null)
+ {
+ viewport.featureSettings.refreshTable();
+ }
+ alignPanel.paintAlignment(true);
+ statusBar.setText(MessageManager
+ .getString("label.successfully_added_features_alignment"));
+ }
+ return featuresFile;
+ }
+
+ @Override
+ public void keyPressed(KeyEvent evt)
+ {
+ if (viewport.cursorMode
+ && ((evt.getKeyCode() >= KeyEvent.VK_0 && evt.getKeyCode() <= KeyEvent.VK_9) || (evt
+ .getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt
+ .getKeyCode() <= KeyEvent.VK_NUMPAD9))
+ && Character.isDigit(evt.getKeyChar()))
+ {
+ alignPanel.seqPanel.numberPressed(evt.getKeyChar());
+ }
+
+ switch (evt.getKeyCode())
+ {
+ case 27: // escape key
+ deselectAllSequenceMenuItem_actionPerformed();
+
+ alignPanel.alabels.cancelDrag();
+ break;
+ case KeyEvent.VK_X:
+ if (evt.isControlDown() || evt.isMetaDown())
+ {
+ cut_actionPerformed();
+ }
+ break;
+ case KeyEvent.VK_C:
+ if (viewport.cursorMode && !evt.isControlDown())
+ {
+ alignPanel.seqPanel.setCursorColumn();
+ }
+ if (evt.isControlDown() || evt.isMetaDown())
+ {
+ copy_actionPerformed();
+ }
+ break;
+ case KeyEvent.VK_V:
+ if (evt.isControlDown())
+ {
+ paste(evt.isShiftDown());
+ }
+ break;
+ case KeyEvent.VK_A:
+ if (evt.isControlDown() || evt.isMetaDown())
+ {
+ selectAllSequenceMenuItem_actionPerformed();
+ }
+ break;
+ case KeyEvent.VK_DOWN:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.moveCursor(0, 1);
+ }
+ else
+ {
+ moveSelectedSequences(false);
+ }
+ break;
+
+ case KeyEvent.VK_UP:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.moveCursor(0, -1);
+ }
+ else
+ {
+ moveSelectedSequences(true);
+ }
+ break;
+
+ case KeyEvent.VK_LEFT:
+ if (evt.isAltDown() || !viewport.cursorMode)
+ {
+ slideSequences(false, alignPanel.seqPanel.getKeyboardNo1());
+ }
+ else
+ {
+ alignPanel.seqPanel.moveCursor(-1, 0);
+ }
+ break;
+
+ case KeyEvent.VK_RIGHT:
+ if (evt.isAltDown() || !viewport.cursorMode)
+ {
+ slideSequences(true, alignPanel.seqPanel.getKeyboardNo1());
+ }
+ else
+ {
+ alignPanel.seqPanel.moveCursor(1, 0);
+ }
+ break;
+
+ case KeyEvent.VK_SPACE:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown()
+ || evt.isShiftDown() || evt.isAltDown());
+ }
+ break;
+
+ case KeyEvent.VK_DELETE:
+ case KeyEvent.VK_BACK_SPACE:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown()
+ || evt.isShiftDown() || evt.isAltDown());
+ }
+ else
+ {
+ cut_actionPerformed();
+ alignPanel.seqPanel.seqCanvas.repaint();
+ }
+ break;
+
+ case KeyEvent.VK_S:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setCursorRow();
+ }
+ break;
+ case KeyEvent.VK_P:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setCursorPosition();
+ }
+ break;
+
+ case KeyEvent.VK_ENTER:
+ case KeyEvent.VK_COMMA:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setCursorRowAndColumn();
+ }
+ break;
+
+ case KeyEvent.VK_Q:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setSelectionAreaAtCursor(true);
+ }
+ break;
+ case KeyEvent.VK_M:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setSelectionAreaAtCursor(false);
+ }
+ break;
+
+ case KeyEvent.VK_F2:
+ viewport.cursorMode = !viewport.cursorMode;
+ statusBar.setText(MessageManager.formatMessage(
+ "label.keyboard_editing_mode",
+ new String[] { (viewport.cursorMode ? "on" : "off") }));
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes;
+ alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq;
+ }
+ break;
+
+ case KeyEvent.VK_F:
+ if (evt.isControlDown())
+ {
+ findMenuItem_actionPerformed();
+ }
+ break;
+
+ case KeyEvent.VK_H:
+ {
+ boolean toggleSeqs = !evt.isControlDown();
+ boolean toggleCols = !evt.isShiftDown();
+ toggleHiddenRegions(toggleSeqs, toggleCols);
+ break;
+ }
+
+ case KeyEvent.VK_PAGE_UP:
+ if (viewport.getWrapAlignment())
+ {
+ alignPanel.scrollUp(true);
+ }
+ else
+ {
+ alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
+ - viewport.endSeq + viewport.startSeq);
+ }
+ break;
+
+ case KeyEvent.VK_PAGE_DOWN:
+ if (viewport.getWrapAlignment())
+ {
+ alignPanel.scrollUp(false);
+ }
+ else
+ {
+ alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
+ + viewport.endSeq - viewport.startSeq);
+ }
+ break;
+
+ case KeyEvent.VK_Z:
+ if (evt.isControlDown())
+ {
+ undoMenuItem_actionPerformed();
+ }
+ break;
+
+ case KeyEvent.VK_Y:
+ if (evt.isControlDown())
+ {
+ redoMenuItem_actionPerformed();
+ }
+ break;
+
+ case KeyEvent.VK_L:
+ if (evt.isControlDown())
+ {
+ trimAlignment(true);
+ }
+ break;
+
+ case KeyEvent.VK_R:
+ if (evt.isControlDown())
+ {
+ trimAlignment(false);
+ }
+ break;
+
+ case KeyEvent.VK_E:
+ if (evt.isControlDown())
+ {
+ if (evt.isShiftDown())
+ {
+ this.removeAllGapsMenuItem_actionPerformed();
+ }
+ else
+ {
+ removeGappedColumnMenuItem_actionPerformed();
+ }
+ }
+ break;
+ case KeyEvent.VK_I:
+ if (evt.isControlDown())
+ {
+ if (evt.isAltDown())
+ {
+ invertColSel_actionPerformed();
+ }
+ else
+ {
+ invertSequenceMenuItem_actionPerformed();
+ }
+ }
+ break;
+
+ case KeyEvent.VK_G:
+ if (evt.isControlDown())
+ {
+ if (evt.isShiftDown())
+ {
+ this.unGroup_actionPerformed();
+ }
+ else
+ {
+ this.createGroup_actionPerformed();
+ }
+ }
+ break;
+
+ case KeyEvent.VK_U:
+ if (evt.isControlDown())
+ {
+ this.deleteGroups_actionPerformed();
+ }
+ break;
+
+ case KeyEvent.VK_T:
+ if (evt.isControlDown())
+ {
+ newView(null);
+ }
+ break;
+
+ }
+ alignPanel.paintAlignment(true);
+ }
+
+ /**
+ * called by key handler and the hide all/show all menu items
+ *
+ * @param toggleSeqs
+ * @param toggleCols
+ */
+ private void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols)
+ {
+ boolean hide = false;
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (!toggleSeqs && !toggleCols)
+ {
+ // Hide everything by the current selection - this is a hack - we do the
+ // invert and then hide
+ // first check that there will be visible columns after the invert.
+ if ((viewport.getColumnSelection() != null
+ && viewport.getColumnSelection().getSelected() != null && viewport
+ .getColumnSelection().getSelected().size() > 0)
+ || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg
+ .getEndRes()))
+ {
+ // now invert the sequence set, if required - empty selection implies
+ // that no hiding is required.
+ if (sg != null)
+ {
+ invertSequenceMenuItem_actionPerformed();
+ sg = viewport.getSelectionGroup();
+ toggleSeqs = true;
+
+ }
+ viewport.expandColSelection(sg, true);
+ // finally invert the column selection and get the new sequence
+ // selection and indicate it should be hidden.
+ invertColSel_actionPerformed();
+ toggleCols = true;
+ }
+ }
+
+ if (toggleSeqs)
+ {
+ if (sg != null && sg.getSize() != viewport.getAlignment().getHeight())
+ {
+ hide = true;
+ viewport.hideAllSelectedSeqs();
+ }
+ else if (!(toggleCols && viewport.getColumnSelection().getSelected()
+ .size() > 0))
+ {
+ viewport.showAllHiddenSeqs();
+ }
+ }
+
+ if (toggleCols)
+ {
+ if (viewport.getColumnSelection().getSelected().size() > 0)
+ {
+ viewport.hideSelectedColumns();
+ if (!toggleSeqs)
+ {
+ viewport.setSelectionGroup(sg);
+ }
+ }
+ else if (!hide)
+ {
+ viewport.showAllHiddenColumns();
+ }
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent evt)
+ {
+ }
+
+ @Override
+ public void keyTyped(KeyEvent evt)
+ {
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent evt)
+ {
+ final Object source = evt.getSource();
+ if (source == displayNonconservedMenuItem)
+ {
+ displayNonconservedMenuItem_actionPerformed();
+ }
+ else if (source == colourTextMenuItem)
+ {
+ colourTextMenuItem_actionPerformed();
+ }
+ else if (source == wrapMenuItem)
+ {
+ wrapMenuItem_actionPerformed();
+ }
+ else if (source == scaleAbove)
+ {
+ viewport.setScaleAboveWrapped(scaleAbove.getState());
+ }
+ else if (source == scaleLeft)
+ {
+ viewport.setScaleLeftWrapped(scaleLeft.getState());
+ }
+ else if (source == scaleRight)
+ {
+ viewport.setScaleRightWrapped(scaleRight.getState());
+ }
+ else if (source == seqLimits)
+ {
+ seqLimits_itemStateChanged();
+ }
+ else if (source == viewBoxesMenuItem)
+ {
+ viewport.setShowBoxes(viewBoxesMenuItem.getState());
+ }
+ else if (source == viewTextMenuItem)
+ {
+ viewport.setShowText(viewTextMenuItem.getState());
+ }
+ else if (source == renderGapsMenuItem)
+ {
+ viewport.setRenderGaps(renderGapsMenuItem.getState());
+ }
+ else if (source == annotationPanelMenuItem)
+ {
+ viewport.setShowAnnotation(annotationPanelMenuItem.getState());
+ alignPanel.setAnnotationVisible(annotationPanelMenuItem.getState());
+ }
+ else if (source == sequenceFeatures)
+ {
+ viewport.setShowSequenceFeatures(sequenceFeatures.getState());
+ alignPanel.seqPanel.seqCanvas.repaint();
+ }
+ else if (source == showAlignmentAnnotations)
+ {
+ setAnnotationsVisibility();
+ }
+ else if (source == showSequenceAnnotations)
+ {
+ setAnnotationsVisibility();
+ }
+ else if (source == sortAnnBySequence)
+ {
+ boolean newState = sortAnnBySequence.getState();
+ sortAnnByLabel.setState(false);
+ setAnnotationSortOrder(newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL
+ : SequenceAnnotationOrder.NONE);
+ setViewportAnnotationOrder();
+ }
+ else if (source == sortAnnByLabel)
+ {
+ boolean newState = sortAnnByLabel.getState();
+ sortAnnBySequence.setState(false);
+ setAnnotationSortOrder(newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE
+ : SequenceAnnotationOrder.NONE);
+ setViewportAnnotationOrder();
+ }
+ else if (source == showAutoFirst)
+ {
+ showAutoLast.setState(!showAutoFirst.getState());
+ setShowAutoCalculatedAbove(showAutoFirst.getState());
+ setViewportAnnotationOrder();
+ }
+ else if (source == showAutoLast)
+ {
+ showAutoFirst.setState(!showAutoLast.getState());
+ setShowAutoCalculatedAbove(showAutoFirst.getState());
+ setViewportAnnotationOrder();
+ }
+ else if (source == conservationMenuItem)
+ {
+ conservationMenuItem_actionPerformed();
+ }
+ else if (source == abovePIDThreshold)
+ {
+ abovePIDThreshold_actionPerformed();
+ }
+ else if (source == applyToAllGroups)
+ {
+ viewport.setColourAppliesToAllGroups(applyToAllGroups.getState());
+ }
+ else if (source == autoCalculate)
+ {
+ viewport.autoCalculateConsensus = autoCalculate.getState();
+ }
+ else if (source == sortByTree)
+ {
+ viewport.sortByTree = sortByTree.getState();
+ }
+ else if (source == this.centreColumnLabelFlag)
+ {
+ centreColumnLabelFlag_stateChanged();
+ }
+ else if (source == this.followMouseOverFlag)
+ {
+ mouseOverFlag_stateChanged();
+ }
+ else if (source == showGroupConsensus)
+ {
+ showGroupConsensus_actionPerformed();
+ }
+ else if (source == showGroupConservation)
+ {
+ showGroupConservation_actionPerformed();
+ }
+ else if (source == showSequenceLogo)
+ {
+ showSequenceLogo_actionPerformed();
+ }
+ else if (source == normSequenceLogo)
+ {
+ normSequenceLogo_actionPerformed();
+ }
+ else if (source == showConsensusHistogram)
+ {
+ showConsensusHistogram_actionPerformed();
+ }
+ else if (source == applyAutoAnnotationSettings)
+ {
+ applyAutoAnnotationSettings_actionPerformed();
+ }
+ alignPanel.paintAlignment(true);
+ }
+
+ /**
+ * Set the visibility state of sequence-related and/or alignment-related
+ * annotations depending on checkbox selections. Repaint after calling.
+ *
+ * @param visible
+ */
+ private void setAnnotationsVisibility()
+ {
+ boolean showForAlignment = showAlignmentAnnotations.getState();
+ boolean showForSequences = showSequenceAnnotations.getState();
+ for (AlignmentAnnotation aa : alignPanel.getAlignment()
+ .getAlignmentAnnotation())
+ {
+ boolean visible = (aa.sequenceRef == null ? showForAlignment
+ : showForSequences);
+ aa.visible = visible;
+ }
+ alignPanel.validateAnnotationDimensions(true);
+ validate();
+ repaint();
+ }
+
+ private void setAnnotationSortOrder(SequenceAnnotationOrder order)
+ {
+ this.annotationSortOrder = order;
+ }
+
+ /**
+ * Set flags on the viewport that control annotation ordering
+ */
+ private void setViewportAnnotationOrder()
+ {
+ this.alignPanel.av.setSortAnnotationsBy(this.annotationSortOrder);
+ this.alignPanel.av
+ .setShowAutocalculatedAbove(this.showAutoCalculatedAbove);
+ }
+
+ private void setShowAutoCalculatedAbove(boolean showAbove)
+ {
+ this.showAutoCalculatedAbove = showAbove;
+ }
+
+ private void mouseOverFlag_stateChanged()
+ {
+ viewport.setFollowHighlight(followMouseOverFlag.getState());
+ // TODO: could kick the scrollTo mechanism to reset view for current
+ // searchresults.
+ }
+
+ private void centreColumnLabelFlag_stateChanged()
+ {
+ viewport.centreColumnLabels = centreColumnLabelFlag.getState();
+ this.alignPanel.annotationPanel.repaint();
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt)
+ {
+ viewport.applet.currentAlignFrame = this;
+
+ Object source = evt.getSource();
+
+ if (source == inputText)
+ {
+ inputText_actionPerformed();
+ }
+ else if (source == loadTree)
+ {
+ loadTree_actionPerformed();
+ }
+ else if (source == loadApplication)
+ {
+ launchFullApplication();
+ }
+ else if (source == loadAnnotations)
+ {
+ loadAnnotations();
+ }
+ else if (source == outputAnnotations)
+ {
+ outputAnnotations(true);
+ }
+ else if (source == outputFeatures)
+ {
+ outputFeatures(true, "Jalview");
+ }
+ else if (source == closeMenuItem)
+ {
+ closeMenuItem_actionPerformed();
+ }
+ else if (source == copy)
+ {
+ copy_actionPerformed();
+ }
+ else if (source == undoMenuItem)
+ {
+ undoMenuItem_actionPerformed();
+ }
+ else if (source == redoMenuItem)
+ {
+ redoMenuItem_actionPerformed();
+ }
+ else if (source == inputText)
+ {
+ inputText_actionPerformed();
+ }
+ else if (source == closeMenuItem)
+ {
+ closeMenuItem_actionPerformed();
+ }
+ else if (source == undoMenuItem)
+ {
+ undoMenuItem_actionPerformed();
+ }
+ else if (source == redoMenuItem)
+ {
+ redoMenuItem_actionPerformed();
+ }
+ else if (source == copy)
+ {
+ copy_actionPerformed();
+ }
+ else if (source == pasteNew)
+ {
+ pasteNew_actionPerformed();
+ }
+ else if (source == pasteThis)
+ {
+ pasteThis_actionPerformed();
+ }
+ else if (source == cut)
+ {
+ cut_actionPerformed();
+ }
+ else if (source == delete)
+ {
+ delete_actionPerformed();
+ }
+ else if (source == grpsFromSelection)
+ {
+ makeGrpsFromSelection_actionPerformed();
+ }
+ else if (source == deleteGroups)
+ {
+ deleteGroups_actionPerformed();
+ }
+ else if (source == selectAllSequenceMenuItem)
+ {
+ selectAllSequenceMenuItem_actionPerformed();
+ }
+ else if (source == deselectAllSequenceMenuItem)
+ {
+ deselectAllSequenceMenuItem_actionPerformed();
+ }
+ else if (source == invertSequenceMenuItem)
+ {
+ invertSequenceMenuItem_actionPerformed();
+ }
+ else if (source == invertColSel)
+ {
+ viewport.invertColumnSelection();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == remove2LeftMenuItem)
+ {
+ trimAlignment(true);
+ }
+ else if (source == remove2RightMenuItem)
+ {
+ trimAlignment(false);
+ }
+ else if (source == removeGappedColumnMenuItem)
+ {
+ removeGappedColumnMenuItem_actionPerformed();
+ }
+ else if (source == removeAllGapsMenuItem)
+ {
+ removeAllGapsMenuItem_actionPerformed();
+ }
+ else if (source == findMenuItem)
+ {
+ findMenuItem_actionPerformed();
+ }
+ else if (source == font)
+ {
+ new FontChooser(alignPanel);
+ }
+ else if (source == newView)
+ {
+ newView(null);
+ }
+ else if (source == showColumns)
+ {
+ viewport.showAllHiddenColumns();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == showSeqs)
+ {
+ viewport.showAllHiddenSeqs();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == hideColumns)
+ {
+ viewport.hideSelectedColumns();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == hideSequences
+ && viewport.getSelectionGroup() != null)
+ {
+ viewport.hideAllSelectedSeqs();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == hideAllButSelection)
+ {
+ toggleHiddenRegions(false, false);
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == hideAllSelection)
+ {
+ SequenceGroup sg = viewport.getSelectionGroup();
+ viewport.expandColSelection(sg, false);
+ viewport.hideAllSelectedSeqs();
+ viewport.hideSelectedColumns();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == showAllHidden)
+ {
+ viewport.showAllHiddenColumns();
+ viewport.showAllHiddenSeqs();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == showGroupConsensus)
+ {
+ showGroupConsensus_actionPerformed();
+ }
+ else if (source == showGroupConservation)
+ {
+ showGroupConservation_actionPerformed();
+ }
+ else if (source == showSequenceLogo)
+ {
+ showSequenceLogo_actionPerformed();
+ }
+ else if (source == normSequenceLogo)
+ {
+ normSequenceLogo_actionPerformed();
+ }
+ else if (source == showConsensusHistogram)
+ {
+ showConsensusHistogram_actionPerformed();
+ }
+ else if (source == applyAutoAnnotationSettings)
+ {
+ applyAutoAnnotationSettings_actionPerformed();
+ }
+ else if (source == featureSettings)
+ {
+ new FeatureSettings(alignPanel);
+ }
+ else if (source == alProperties)
+ {
+ StringBuffer contents = new jalview.io.AlignmentProperties(
+ viewport.getAlignment()).formatAsString();
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);
+ cap.setText(contents.toString());
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
+ "label.alignment_properties", new String[] { getTitle() }),
+ 400, 250);
+ }
+ else if (source == overviewMenuItem)
+ {
+ overviewMenuItem_actionPerformed();
+ }
+ else if (source == noColourmenuItem)
+ {
+ changeColour(null);
+ }
+ else if (source == clustalColour)
+ {
+ abovePIDThreshold.setState(false);
+ changeColour(new ClustalxColourScheme(viewport.getAlignment(), null));
+ }
+ else if (source == zappoColour)
+ {
+ changeColour(new ZappoColourScheme());
+ }
+ else if (source == taylorColour)
+ {
+ changeColour(new TaylorColourScheme());
+ }
+ else if (source == hydrophobicityColour)
+ {
+ changeColour(new HydrophobicColourScheme());
+ }
+ else if (source == helixColour)
+ {
+ changeColour(new HelixColourScheme());
+ }
+ else if (source == strandColour)
+ {
+ changeColour(new StrandColourScheme());
+ }
+ else if (source == turnColour)
+ {
+ changeColour(new TurnColourScheme());
+ }
+ else if (source == buriedColour)
+ {
+ changeColour(new BuriedColourScheme());
+ }
+ else if (source == nucleotideColour)
+ {
+ changeColour(new NucleotideColourScheme());
+ }
+ else if (source == purinePyrimidineColour)
+ {
+ changeColour(new PurinePyrimidineColourScheme());
+ }
+ // else if (source == RNAInteractionColour)
+ // {
+ // changeColour(new RNAInteractionColourScheme());
+ // }
+ else if (source == RNAHelixColour)
+ {
+ new RNAHelicesColourChooser(viewport, alignPanel);
+ }
+ else if (source == modifyPID)
+ {
+ modifyPID_actionPerformed();
+ }
+ else if (source == modifyConservation)
+ {
+ modifyConservation_actionPerformed();
+ }
+ else if (source == userDefinedColour)
+ {
+ new UserDefinedColours(alignPanel, null);
+ }
+ else if (source == PIDColour)
+ {
+ changeColour(new PIDColourScheme());
+ }
+ else if (source == BLOSUM62Colour)
+ {
+ changeColour(new Blosum62ColourScheme());
+ }
+ else if (source == tcoffeeColour)
+ {
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
+ }
+ else if (source == annotationColour)
+ {
+ new AnnotationColourChooser(viewport, alignPanel);
+ }
+ else if (source == annotationColumnSelection)
+ {
+ new AnnotationColumnChooser(viewport, alignPanel);
+ }
+ else if (source == sortPairwiseMenuItem)
+ {
+ sortPairwiseMenuItem_actionPerformed();
+ }
+ else if (source == sortIDMenuItem)
+ {
+ sortIDMenuItem_actionPerformed();
+ }
+ else if (source == sortLengthMenuItem)
+ {
+ sortLengthMenuItem_actionPerformed();
+ }
+ else if (source == sortGroupMenuItem)
+ {
+ sortGroupMenuItem_actionPerformed();
+ }
+ else if (source == removeRedundancyMenuItem)
+ {
+ removeRedundancyMenuItem_actionPerformed();
+ }
+ else if (source == pairwiseAlignmentMenuItem)
+ {
+ pairwiseAlignmentMenuItem_actionPerformed();
+ }
+ else if (source == PCAMenuItem)
+ {
+ PCAMenuItem_actionPerformed();
+ }
+ else if (source == averageDistanceTreeMenuItem)
+ {
+ averageDistanceTreeMenuItem_actionPerformed();
+ }
+ else if (source == neighbourTreeMenuItem)
+ {
+ neighbourTreeMenuItem_actionPerformed();
+ }
+ else if (source == njTreeBlosumMenuItem)
+ {
+ njTreeBlosumMenuItem_actionPerformed();
+ }
+ else if (source == avDistanceTreeBlosumMenuItem)
+ {
+ avTreeBlosumMenuItem_actionPerformed();
+ }
+ else if (source == documentation)
+ {
+ documentation_actionPerformed();
+ }
+ else if (source == about)
+ {
+ about_actionPerformed();
+ }
+
+ }
+
+ public void inputText_actionPerformed()
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.input_cut_paste"), 500, 500);
+ }
+
+ protected void outputText_actionPerformed(ActionEvent e)
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
+ "label.alignment_output_command",
+ new Object[] { e.getActionCommand() }), 600, 500);
+
+ FeatureRenderer fr = this.alignPanel.cloneFeatureRenderer();
+ cap.setText(new AppletFormatAdapter(alignPanel).formatSequences(
+ e.getActionCommand(), viewport.getAlignment(),
+ viewport.getShowJVSuffix()));
+ }
+
+ public void loadAnnotations()
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
+ cap.setText(MessageManager
+ .getString("label.paste_features_annotations_Tcoffee_here"));
+ cap.setAnnotationImport();
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("action.paste_annotations"), 400, 300);
+
+ }
+
+ public String outputAnnotations(boolean displayTextbox)
+ {
+ String annotation = new AnnotationFile()
+ .printAnnotationsForView(viewport);
+
+ if (displayTextbox)
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.annotations"), 600, 500);
+ cap.setText(annotation);
+ }
+
+ return annotation;
+ }
+
+ private Map<String, Object> getDisplayedFeatureCols()
+ {
+ if (alignPanel.getFeatureRenderer() != null
+ && viewport.getFeaturesDisplayed() != null)
+ {
+ return alignPanel.getFeatureRenderer().getDisplayedFeatureCols();
+
+ }
+ return null;
+ }
+
+ public String outputFeatures(boolean displayTextbox, String format)
+ {
+ String features;
+ if (format.equalsIgnoreCase("Jalview"))
+ {
+ features = new FeaturesFile().printJalviewFormat(viewport
+ .getAlignment().getSequencesArray(),
+ getDisplayedFeatureCols());
+ }
+ else
+ {
+ features = new FeaturesFile().printGFFFormat(viewport.getAlignment()
+ .getSequencesArray(), getDisplayedFeatureCols());
+ }
+
+ if (displayTextbox)
+ {
+ boolean frimport = false;
+ if (features == null || features.equals("No Features Visible"))
+ {
+ features = "# No features visible - paste some and import them here.";
+ frimport = true;
+ }
+
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(frimport, this);
+ if (frimport)
+ {
+ cap.setAnnotationImport();
+ }
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.features"), 600, 500);
+ cap.setText(features);
+ }
+ else
+ {
+ if (features == null)
+ {
+ features = "";
+ }
+ }
+
+ return features;
+ }
+
+ void launchFullApplication()
+ {
+ StringBuffer url = new StringBuffer(jalviewServletURL);
+
+ // allow servlet parameters to be passed in applet parameter
+ String firstSep = url.lastIndexOf("?") > url.lastIndexOf("/") ? "&"
+ : "?";
+ url.append(firstSep);
+
+ url.append("open="
+ + appendProtocol(viewport.applet.getParameter("file")));
+
+ if (viewport.applet.getParameter("features") != null)
+ {
+ url.append("&features=");
+ url.append(appendProtocol(viewport.applet.getParameter("features")));
+ }
+
+ if (viewport.applet.getParameter("annotations") != null)
+ {
+ url.append("&annotations=");
+ url.append(appendProtocol(viewport.applet.getParameter("annotations")));
+ }
+
+ if (viewport.applet.getParameter("jnetfile") != null)
+ {
+ url.append("&annotations=");
+ url.append(appendProtocol(viewport.applet.getParameter("jnetfile")));
+ }
+
+ if (viewport.applet.getParameter("defaultColour") != null)
+ {
+ url.append("&colour="
+ + removeWhiteSpace(viewport.applet
+ .getParameter("defaultColour")));
+ }
+
+ if (viewport.applet.getParameter("userDefinedColour") != null)
+ {
+ url.append("&colour="
+ + removeWhiteSpace(viewport.applet
+ .getParameter("userDefinedColour")));
+ }
+ if (viewport.applet.getParameter("tree") != null)
+ {
+ url.append("&tree="
+ + appendProtocol(viewport.applet.getParameter("tree")));
+ }
+ if (viewport.applet.getParameter("treeFile") != null)
+ {
+ url.append("&tree="
+ + appendProtocol(viewport.applet.getParameter("treeFile")));
+ }
+
+ showURL(url.toString(), "FULL_APP");
+ }
+
+ String removeWhiteSpace(String colour)
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < colour.length(); i++)
+ {
+ if (Character.isWhitespace(colour.charAt(i)))
+ {
+ sb.append("%20");
+ }
+ else
+ {
+ sb.append(colour.charAt(i));
+ }
+ }
+
+ return sb.toString();
+ }
+
+ String appendProtocol(String url)
+ {
+ try
+ {
+ new URL(url);
+ url = URLEncoder.encode(url);
+ }
+ /*
+ * When we finally deprecate 1.1 compatibility, we can start to use
+ * URLEncoder.encode(url,"UTF-8") and then we'll need this catch: catch
+ * (UnsupportedEncodingException ex) { System.err.println("WARNING -
+ * IMPLEMENTATION ERROR - UNSUPPORTED ENCODING EXCEPTION FOR "+url);
+ * ex.printStackTrace(); }
+ */
+ catch (java.net.MalformedURLException ex)
+ {
+ url = viewport.applet.getCodeBase() + url;
+ }
+ return url;
+ }
+
+ public void closeMenuItem_actionPerformed()
+ {
+ PaintRefresher.RemoveComponent(alignPanel);
+ if (alignPanel.seqPanel != null
+ && alignPanel.seqPanel.seqCanvas != null)
+ {
+ PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);
+ }
+ if (alignPanel.idPanel != null && alignPanel.idPanel.idCanvas != null)
+ {
+ PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);
+ }
+
+ if (PaintRefresher.components.size() == 0 && viewport.applet == null)
+ {
+ System.exit(0);
+ }
+ else
+ {
+ }
+ viewport = null;
+ alignPanel = null;
+ this.dispose();
+ }
+
+ /**
+ * TODO: JAL-1104
+ */
+ void updateEditMenuBar()
+ {
+
+ if (viewport.getHistoryList().size() > 0)
+ {
+ undoMenuItem.setEnabled(true);
+ CommandI command = viewport.getHistoryList().peek();
+ undoMenuItem.setLabel(MessageManager.formatMessage(
+ "label.undo_command",
+ new Object[] { command.getDescription() }));
+ }
+ else
+ {
+ undoMenuItem.setEnabled(false);
+ undoMenuItem.setLabel(MessageManager.getString("action.undo"));
+ }
+
+ if (viewport.getRedoList().size() > 0)
+ {
+ redoMenuItem.setEnabled(true);
+
+ CommandI command = viewport.getRedoList().peek();
+ redoMenuItem.setLabel(MessageManager.formatMessage(
+ "label.redo_command",
+ new Object[] { command.getDescription() }));
+ }
+ else
+ {
+ redoMenuItem.setEnabled(false);
+ redoMenuItem.setLabel(MessageManager.getString("action.redo"));
+ }
+ }
+
+ /**
+ * TODO: JAL-1104
+ */
+ @Override
+ public void addHistoryItem(CommandI command)
+ {
+ if (command.getSize() > 0)
+ {
+ viewport.addToHistoryList(command);
+ viewport.clearRedoList();
+ updateEditMenuBar();
+ viewport.updateHiddenColumns();
+ }
+ }
+
+ /**
+ * TODO: JAL-1104 DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ protected void undoMenuItem_actionPerformed()
+ {
+ if (viewport.getHistoryList().isEmpty())
+ {
+ return;
+ }
+
+ CommandI command = viewport.getHistoryList().pop();
+ viewport.addToRedoList(command);
+ command.undoCommand(null);
+
+ AlignmentViewport originalSource = getOriginatingSource(command);
+ // JBPNote Test
+ if (originalSource != viewport)
+ {
+ System.err
+ .println("Warning: Viewport object mismatch whilst undoing");
+ }
+ originalSource.updateHiddenColumns(); // originalSource.hasHiddenColumns =
+ // viewport.getColumnSelection().getHiddenColumns()
+ // != null;
+ updateEditMenuBar();
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
+ }
+
+ /**
+ * TODO: JAL-1104 DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ protected void redoMenuItem_actionPerformed()
+ {
+ if (viewport.getRedoList().isEmpty())
+ {
+ return;
+ }
+
+ CommandI command = viewport.getRedoList().pop();
+ viewport.addToHistoryList(command);
+ command.doCommand(null);
+
+ AlignmentViewport originalSource = getOriginatingSource(command);
+ // JBPNote Test
+ if (originalSource != viewport)
+ {
+ System.err
+ .println("Warning: Viewport object mismatch whilst re-doing");
+ }
+ originalSource.updateHiddenColumns(); // sethasHiddenColumns(); =
+ // viewport.getColumnSelection().getHiddenColumns()
+ // != null;
+
+ updateEditMenuBar();
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
+ }
+
+ AlignmentViewport getOriginatingSource(CommandI command)
+ {
+ AlignmentViewport originalSource = null;
+ // For sequence removal and addition, we need to fire
+ // the property change event FROM the viewport where the
+ // original alignment was altered
+ AlignmentI al = null;
+ if (command instanceof EditCommand)
+ {
+ EditCommand editCommand = (EditCommand) command;
+ al = editCommand.getAlignment();
+ Vector comps = (Vector) PaintRefresher.components.get(viewport
+ .getSequenceSetId());
+ for (int i = 0; i < comps.size(); i++)
+ {
+ if (comps.elementAt(i) instanceof AlignmentPanel)
+ {
+ if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment())
+ {
+ originalSource = ((AlignmentPanel) comps.elementAt(i)).av;
+ break;
+ }
+ }
+ }
+ }
+
+ if (originalSource == null)
+ {
+ // The original view is closed, we must validate
+ // the current view against the closed view first
+ if (al != null)
+ {
+ PaintRefresher.validateSequences(al, viewport.getAlignment());
+ }
+
+ originalSource = viewport;
+ }
+
+ return originalSource;
+ }
+
+ /**
+ * Move the currently selected sequences up or down one position in the
+ * alignment
+ *
+ * @param up
+ */
+ public void moveSelectedSequences(boolean up)
+ {
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (sg == null)
+ {
+ return;
+ }
+ viewport.getAlignment().moveSelectedSequencesByOne(sg,
+ up ? null : viewport.getHiddenRepSequences(), up);
+ alignPanel.paintAlignment(true);
+
+ /*
+ * Also move cDNA/protein complement sequences
+ */
+ AlignViewportI complement = viewport.getCodingComplement();
+ if (complement != null)
+ {
+ SequenceGroup mappedSelection = MappingUtils.mapSequenceGroup(sg,
+ viewport, complement);
+ complement.getAlignment().moveSelectedSequencesByOne(mappedSelection,
+ up ? null : complement.getHiddenRepSequences(), up);
+ // TODO need to trigger a repaint of the complementary panel - how?
+ // would prefer to handle in SplitFrame but it is not overriding key
+ // listener chiz
+ }
+ }
+
+ synchronized void slideSequences(boolean right, int size)
+ {
+ List<SequenceI> sg = new Vector<SequenceI>();
+ if (viewport.cursorMode)
+ {
+ sg.add(viewport.getAlignment().getSequenceAt(
+ alignPanel.seqPanel.seqCanvas.cursorY));
+ }
+ else if (viewport.getSelectionGroup() != null
+ && viewport.getSelectionGroup().getSize() != viewport
+ .getAlignment().getHeight())
+ {
+ sg = viewport.getSelectionGroup().getSequences(
+ viewport.getHiddenRepSequences());
+ }
+
+ if (sg.size() < 1)
+ {
+ return;
+ }
+
+ Vector<SequenceI> invertGroup = new Vector();
+
+ for (int i = 0; i < viewport.getAlignment().getHeight(); i++)
+ {
+ if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))
+ {
+ invertGroup.addElement(viewport.getAlignment().getSequenceAt(i));
+ }
+ }
+
+ SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]);
+
+ SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup
+ .size()]);
+ for (int i = 0; i < invertGroup.size(); i++)
+ {
+ seqs2[i] = invertGroup.elementAt(i);
+ }
+
+ SlideSequencesCommand ssc;
+ if (right)
+ {
+ ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1,
+ size, viewport.getGapCharacter());
+ }
+ else
+ {
+ ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2,
+ size, viewport.getGapCharacter());
+ }
+
+ int groupAdjustment = 0;
+ if (ssc.getGapsInsertedBegin() && right)
+ {
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.moveCursor(size, 0);
+ }
+ else
+ {
+ groupAdjustment = size;
+ }
+ }
+ else if (!ssc.getGapsInsertedBegin() && !right)
+ {
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.moveCursor(-size, 0);
+ }
+ else
+ {
+ groupAdjustment = -size;
+ }
+ }
+
+ if (groupAdjustment != 0)
+ {
+ viewport.getSelectionGroup().setStartRes(
+ viewport.getSelectionGroup().getStartRes() + groupAdjustment);
+ viewport.getSelectionGroup().setEndRes(
+ viewport.getSelectionGroup().getEndRes() + groupAdjustment);
+ }
+
+ boolean appendHistoryItem = false;
+ Deque<CommandI> historyList = viewport.getHistoryList();
+ if (historyList != null && historyList.size() > 0
+ && historyList.peek() instanceof SlideSequencesCommand)
+ {
+ appendHistoryItem = ssc
+ .appendSlideCommand((SlideSequencesCommand) historyList
+ .peek());
+ }
+
+ if (!appendHistoryItem)
+ {
+ addHistoryItem(ssc);
+ }
+
+ repaint();
+ }
+
+ static StringBuffer copiedSequences;
+
+ static Vector copiedHiddenColumns;
+
+ protected void copy_actionPerformed()
+ {
+ if (viewport.getSelectionGroup() == null)
+ {
+ return;
+ }
+
+ SequenceGroup sg = viewport.getSelectionGroup();
+ copiedSequences = new StringBuffer();
+ Map<Integer, SequenceI> orderedSeqs = new HashMap<Integer, SequenceI>();
+ for (int i = 0; i < sg.getSize(); i++)
+ {
+ SequenceI seq = sg.getSequenceAt(i);
+ int index = viewport.getAlignment().findIndex(seq);
+ orderedSeqs.put(index, seq);
+ }
+
+ int index = 0, startRes, endRes;
+ char ch;
+
+ if (viewport.hasHiddenColumns() && viewport.getSelectionGroup() != null)
+ {
+ copiedHiddenColumns = new Vector();
+ int hiddenOffset = viewport.getSelectionGroup().getStartRes();
+ for (int[] region : viewport.getColumnSelection().getHiddenColumns())
+ {
+ copiedHiddenColumns.addElement(new int[] {
+ region[0] - hiddenOffset, region[1] - hiddenOffset });
+ }
+ }
+ else
+ {
+ copiedHiddenColumns = null;
+ }
+
+ for (int i = 0; i < sg.getSize(); i++)
+ {
+ SequenceI seq = null;
+
+ while (seq == null)
+ {
+ if (orderedSeqs.containsKey(index))
+ {
+ seq = orderedSeqs.get(index);
+ index++;
+ break;
+ }
+ else
+ {
+ index++;
+ }
+ }
+
+ // FIND START RES
+ // Returns residue following index if gap
+ startRes = seq.findPosition(sg.getStartRes());
+
+ // FIND END RES
+ // Need to find the residue preceeding index if gap
+ endRes = 0;
+
+ for (int j = 0; j < sg.getEndRes() + 1 && j < seq.getLength(); j++)
+ {
+ ch = seq.getCharAt(j);
+ if (!jalview.util.Comparison.isGap((ch)))
+ {
+ endRes++;
+ }
+ }
+
+ if (endRes > 0)
+ {
+ endRes += seq.getStart() - 1;
+ }
+
+ copiedSequences.append(seq.getName()
+ + "\t"
+ + startRes
+ + "\t"
+ + endRes
+ + "\t"
+ + seq.getSequenceAsString(sg.getStartRes(),
+ sg.getEndRes() + 1) + "\n");
+ }
+
+ }
+
+ protected void pasteNew_actionPerformed()
+ {
+ paste(true);
+ }
+
+ protected void pasteThis_actionPerformed()
+ {
+ paste(false);
+ }
+
+ void paste(boolean newAlignment)
+ {
+ try
+ {
+
+ if (copiedSequences == null)
+ {
+ return;
+ }
+
+ StringTokenizer st = new StringTokenizer(copiedSequences.toString());
+ Vector seqs = new Vector();
+ while (st.hasMoreElements())
+ {
+ String name = st.nextToken();
+ int start = Integer.parseInt(st.nextToken());
+ int end = Integer.parseInt(st.nextToken());
+ seqs.addElement(new Sequence(name, st.nextToken(), start, end));
+ }
+ SequenceI[] newSeqs = new SequenceI[seqs.size()];
+ for (int i = 0; i < seqs.size(); i++)
+ {
+ newSeqs[i] = (SequenceI) seqs.elementAt(i);
+ }
+
+ if (newAlignment)
+ {
+ String newtitle = MessageManager
+ .getString("label.copied_sequences");
+ if (getTitle().startsWith(
+ MessageManager.getString("label.copied_sequences")))
+ {
+ newtitle = getTitle();
+ }
+ else
+ {
+ newtitle = newtitle.concat(MessageManager.formatMessage(
+ "label.from_msname", new String[] { getTitle() }));
+ }
+ AlignFrame af = new AlignFrame(new Alignment(newSeqs),
+ viewport.applet, newtitle, false);
+ if (copiedHiddenColumns != null)
+ {
+ for (int i = 0; i < copiedHiddenColumns.size(); i++)
+ {
+ int[] region = (int[]) copiedHiddenColumns.elementAt(i);
+ af.viewport.hideColumns(region[0], region[1]);
+ }
+ }
+
+ jalview.bin.JalviewLite.addFrame(af, newtitle, frameWidth,
+ frameHeight);
+ }
+ else
+ {
+ addSequences(newSeqs);
+ }
+
+ } catch (Exception ex)
+ {
+ } // could be anything being pasted in here
+
+ }
+
+ void addSequences(SequenceI[] seqs)
+ {
+ for (int i = 0; i < seqs.length; i++)
+ {
+ viewport.getAlignment().addSequence(seqs[i]);
+ }
+
+ // !newAlignment
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.add_sequences"), Action.PASTE,
+ seqs, 0, viewport.getAlignment().getWidth(),
+ viewport.getAlignment()));
+
+ viewport.setEndSeq(viewport.getAlignment().getHeight());
+ viewport.getAlignment().getWidth();
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment()
+ .getSequences());
+
+ }
+
+ protected void cut_actionPerformed()
+ {
+ copy_actionPerformed();
+ delete_actionPerformed();
+ }
+
+ protected void delete_actionPerformed()
+ {
+
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (sg == null)
+ {
+ return;
+ }
+
+ Vector seqs = new Vector();
+ SequenceI seq;
+ for (int i = 0; i < sg.getSize(); i++)
+ {
+ seq = sg.getSequenceAt(i);
+ seqs.addElement(seq);
+ }
+
+ // If the cut affects all sequences, remove highlighted columns
+ if (sg.getSize() == viewport.getAlignment().getHeight())
+ {
+ viewport.getColumnSelection().removeElements(sg.getStartRes(),
+ sg.getEndRes() + 1);
+ }
+
+ SequenceI[] cut = new SequenceI[seqs.size()];
+ for (int i = 0; i < seqs.size(); i++)
+ {
+ cut[i] = (SequenceI) seqs.elementAt(i);
+ }
+
+ /*
+ * //ADD HISTORY ITEM
+ */
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.cut_sequences"), Action.CUT,
+ cut, sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
+ viewport.getAlignment()));
+
+ viewport.setSelectionGroup(null);
+ viewport.getAlignment().deleteGroup(sg);
+
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment()
+ .getSequences());
+
+ if (viewport.getAlignment().getHeight() < 1)
+ {
+ this.setVisible(false);
+ }
+ viewport.sendSelection();
+ }
+
+ /**
+ * group consensus toggled
+ *
+ */
+ protected void showGroupConsensus_actionPerformed()
+ {
+ viewport.setShowGroupConsensus(showGroupConsensus.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+
+ }
+
+ /**
+ * group conservation toggled.
+ */
+ protected void showGroupConservation_actionPerformed()
+ {
+ viewport.setShowGroupConservation(showGroupConservation.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt
+ * .event.ActionEvent)
+ */
+ protected void showConsensusHistogram_actionPerformed()
+ {
+ viewport.setShowConsensusHistogram(showConsensusHistogram.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt
+ * .event.ActionEvent)
+ */
+ protected void showSequenceLogo_actionPerformed()
+ {
+ viewport.setShowSequenceLogo(showSequenceLogo.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ protected void normSequenceLogo_actionPerformed()
+ {
+ showSequenceLogo.setState(true);
+ viewport.setShowSequenceLogo(true);
+ viewport.setNormaliseSequenceLogo(normSequenceLogo.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ protected void applyAutoAnnotationSettings_actionPerformed()
+ {
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ protected void makeGrpsFromSelection_actionPerformed()
+ {
+ if (avc.makeGroupsFromSelection())
+ {
+ PaintRefresher.Refresh(this, viewport.getSequenceSetId());
+ alignPanel.updateAnnotation();
+ alignPanel.paintAlignment(true);
+ }
+ }
+
+ protected void createGroup_actionPerformed()
+ {
+ avc.createGroup();
+ }
+
+ protected void unGroup_actionPerformed()
+ {
+ if (avc.unGroup())
+ {
+ alignPanel.alignmentChanged();
+ }
+ }
+
+ protected void deleteGroups_actionPerformed()
+ {
+ if (avc.deleteGroups())
+ {
+ alignPanel.alignmentChanged();
+ }
+ }
+
+ public void selectAllSequenceMenuItem_actionPerformed()
+ {
+ SequenceGroup sg = new SequenceGroup();
+ for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
+ {
+ sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);
+ }
+ sg.setEndRes(viewport.getAlignment().getWidth() - 1);
+ viewport.setSelectionGroup(sg);
+ alignPanel.paintAlignment(true);
+ PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+ viewport.sendSelection();
+ }
+
+ public void deselectAllSequenceMenuItem_actionPerformed()
+ {
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.keyboardNo1 = null;
+ alignPanel.seqPanel.keyboardNo2 = null;
+ }
+ viewport.setSelectionGroup(null);
+ viewport.getColumnSelection().clear();
+ viewport.setSelectionGroup(null);
+ alignPanel.idPanel.idCanvas.searchResults = null;
+ alignPanel.seqPanel.seqCanvas.highlightSearchResults(null);
+ alignPanel.paintAlignment(true);
+ PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+ viewport.sendSelection();
+ }
+
+ public void invertSequenceMenuItem_actionPerformed()
+ {
+ SequenceGroup sg = viewport.getSelectionGroup();
+ for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
+ {
+ sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);
+ }
+
+ PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+ viewport.sendSelection();
+ }
+
+ public void invertColSel_actionPerformed()
+ {
+ viewport.invertColumnSelection();
+ alignPanel.paintAlignment(true);
+ PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+ viewport.sendSelection();
+ }
+
+ void trimAlignment(boolean trimLeft)
+ {
+ ColumnSelection colSel = viewport.getColumnSelection();
+ int column;
+
+ if (colSel.size() > 0)
+ {
+ if (trimLeft)
+ {
+ column = colSel.getMin();
+ }
+ else
+ {
+ column = colSel.getMax();
+ }
+
+ SequenceI[] seqs;
+ if (viewport.getSelectionGroup() != null)
+ {
+ seqs = viewport.getSelectionGroup().getSequencesAsArray(
+ viewport.getHiddenRepSequences());
+ }
+ else
+ {
+ seqs = viewport.getAlignment().getSequencesArray();
+ }
+
+ TrimRegionCommand trimRegion;
+ if (trimLeft)
+ {
+ trimRegion = new TrimRegionCommand("Remove Left",
+ TrimRegionCommand.TRIM_LEFT, seqs, column,
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
+ viewport.setStartRes(0);
+ }
+ else
+ {
+ trimRegion = new TrimRegionCommand("Remove Right",
+ TrimRegionCommand.TRIM_RIGHT, seqs, column,
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
+ }
+
+ statusBar.setText(MessageManager.formatMessage(
+ "label.removed_columns",
+ new String[] { Integer.valueOf(trimRegion.getSize())
+ .toString() }));
+ addHistoryItem(trimRegion);
+
+ for (SequenceGroup sg : viewport.getAlignment().getGroups())
+ {
+ if ((trimLeft && !sg.adjustForRemoveLeft(column))
+ || (!trimLeft && !sg.adjustForRemoveRight(column)))
+ {
+ viewport.getAlignment().deleteGroup(sg);
+ }
+ }
+
+ viewport.firePropertyChange("alignment", null, viewport
+ .getAlignment().getSequences());
+ }
+ }
+
+ public void removeGappedColumnMenuItem_actionPerformed()
+ {
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
+
+ SequenceI[] seqs;
+ if (viewport.getSelectionGroup() != null)
+ {
+ seqs = viewport.getSelectionGroup().getSequencesAsArray(
+ viewport.getHiddenRepSequences());
+ start = viewport.getSelectionGroup().getStartRes();
+ end = viewport.getSelectionGroup().getEndRes();
+ }
+ else
+ {
+ seqs = viewport.getAlignment().getSequencesArray();
+ }
+
+ RemoveGapColCommand removeGapCols = new RemoveGapColCommand(
+ "Remove Gapped Columns", seqs, start, end,
+ viewport.getAlignment());
+
+ addHistoryItem(removeGapCols);
+
+ statusBar.setText(MessageManager.formatMessage(
+ "label.removed_empty_columns",
+ new String[] { Integer.valueOf(removeGapCols.getSize())
+ .toString() }));
+
+ // This is to maintain viewport position on first residue
+ // of first sequence
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
+ int startRes = seq.findPosition(viewport.startRes);
+ // ShiftList shifts;
+ // viewport.getAlignment().removeGaps(shifts=new ShiftList());
+ // edit.alColumnChanges=shifts.getInverse();
+ // if (viewport.hasHiddenColumns)
+ // viewport.getColumnSelection().compensateForEdits(shifts);
+ viewport.setStartRes(seq.findIndex(startRes) - 1);
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment()
+ .getSequences());
+
+ }
+
+ public void removeAllGapsMenuItem_actionPerformed()
+ {
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
+
+ SequenceI[] seqs;
+ if (viewport.getSelectionGroup() != null)
+ {
+ seqs = viewport.getSelectionGroup().getSequencesAsArray(
+ viewport.getHiddenRepSequences());
+ start = viewport.getSelectionGroup().getStartRes();
+ end = viewport.getSelectionGroup().getEndRes();
+ }
+ else
+ {
+ seqs = viewport.getAlignment().getSequencesArray();
+ }
+
+ // This is to maintain viewport position on first residue
+ // of first sequence
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
+ int startRes = seq.findPosition(viewport.startRes);
+
+ addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,
+ viewport.getAlignment()));
+
+ viewport.setStartRes(seq.findIndex(startRes) - 1);
+
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment()
+ .getSequences());
+
+ }
+
+ public void findMenuItem_actionPerformed()
+ {
+ new Finder(alignPanel);
+ }
+
+ /**
+ * create a new view derived from the current view
+ *
+ * @param viewtitle
+ * @return frame for the new view
+ */
+ public AlignFrame newView(String viewtitle)
+ {
+ AlignmentI newal;
+ if (viewport.hasHiddenRows())
+ {
+ newal = new Alignment(viewport.getAlignment().getHiddenSequences()
+ .getFullAlignment().getSequencesArray());
+ }
+ else
+ {
+ newal = new Alignment(viewport.getAlignment().getSequencesArray());
+ }
+
+ if (viewport.getAlignment().getAlignmentAnnotation() != null)
+ {
+ for (int i = 0; i < viewport.getAlignment().getAlignmentAnnotation().length; i++)
+ {
+ if (!viewport.getAlignment().getAlignmentAnnotation()[i].autoCalculated)
+ {
+ newal.addAnnotation(viewport.getAlignment()
+ .getAlignmentAnnotation()[i]);
+ }
+ }
+ }
+
+ AlignFrame newaf = new AlignFrame(newal, viewport.applet, "", false);
+
+ newaf.viewport.setSequenceSetId(alignPanel.av.getSequenceSetId());
+ PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId());
+ PaintRefresher.Register(newaf.alignPanel,
+ newaf.alignPanel.av.getSequenceSetId());
+
+ PaintRefresher.Register(newaf.alignPanel.idPanel.idCanvas,
+ newaf.alignPanel.av.getSequenceSetId());
+ PaintRefresher.Register(newaf.alignPanel.seqPanel.seqCanvas,
+ newaf.alignPanel.av.getSequenceSetId());
+
+ Vector comps = (Vector) PaintRefresher.components.get(viewport
+ .getSequenceSetId());
+ int viewSize = -1;
+ for (int i = 0; i < comps.size(); i++)
+ {
+ if (comps.elementAt(i) instanceof AlignmentPanel)
+ {
+ viewSize++;
+ }
+ }
+
+ String title = new String(this.getTitle());
+ if (viewtitle != null)
+ {
+ title = viewtitle + " ( " + title + ")";
+ }
+ else
+ {
+ if (title.indexOf("(View") > -1)
+ {
+ title = title.substring(0, title.indexOf("(View"));
+ }
+ title += "(View " + viewSize + ")";
+ }
+
+ newaf.setTitle(title.toString());
+
+ newaf.viewport.setHistoryList(viewport.getHistoryList());
+ newaf.viewport.setRedoList(viewport.getRedoList());
+ return newaf;
+ }
+
+ /**
+ *
+ * @return list of feature groups on the view
+ */
+ public String[] getFeatureGroups()
+ {
+ FeatureRenderer fr = null;
+ if (alignPanel != null
+ && (fr = alignPanel.getFeatureRenderer()) != null)
+ {
+ List<String> gps = fr.getFeatureGroups();
+ String[] _gps = gps.toArray(new String[gps.size()]);
+ return _gps;
+ }
+ return null;
+ }
+
+ /**
+ * get sequence feature groups that are hidden or shown
+ *
+ * @param visible
+ * true is visible
+ * @return list
+ */
+ public String[] getFeatureGroupsOfState(boolean visible)
+ {
+ FeatureRenderer fr = null;
+ if (alignPanel != null
+ && (fr = alignPanel.getFeatureRenderer()) != null)
+ {
+ List<String> gps = fr.getGroups(visible);
+ String[] _gps = gps.toArray(new String[gps.size()]);
+ return _gps;
+ }
+ return null;
+ }
+
+ /**
+ * Change the display state for the given feature groups
+ *
+ * @param groups
+ * list of group strings
+ * @param state
+ * visible or invisible
+ */
+ public void setFeatureGroupState(String[] groups, boolean state)
+ {
+ FeatureRenderer fr = null;
+ this.sequenceFeatures.setState(true);
+ viewport.setShowSequenceFeatures(true);
+ if (alignPanel != null
+ && (fr = alignPanel.getFeatureRenderer()) != null)
+ {
+
+ fr.setGroupVisibility(Arrays.asList(groups), state);
+ alignPanel.seqPanel.seqCanvas.repaint();
+ if (alignPanel.overviewPanel != null)
+ {
+ alignPanel.overviewPanel.updateOverviewImage();
+ }
+ }
+ }
+
+ public void seqLimits_itemStateChanged()
+ {
+ viewport.setShowJVSuffix(seqLimits.getState());
+ alignPanel.fontChanged();
+ alignPanel.paintAlignment(true);
+ }
+
+ protected void colourTextMenuItem_actionPerformed()
+ {
+ viewport.setColourText(colourTextMenuItem.getState());
+ alignPanel.paintAlignment(true);
+ }
+
+ protected void displayNonconservedMenuItem_actionPerformed()
+ {
+ viewport.setShowUnconserved(displayNonconservedMenuItem.getState());
+ alignPanel.paintAlignment(true);
+ }
+
+ protected void wrapMenuItem_actionPerformed()
+ {
+ viewport.setWrapAlignment(wrapMenuItem.getState());
+ alignPanel.setWrapAlignment(wrapMenuItem.getState());
+ scaleAbove.setEnabled(wrapMenuItem.getState());
+ scaleLeft.setEnabled(wrapMenuItem.getState());
+ scaleRight.setEnabled(wrapMenuItem.getState());
+ alignPanel.paintAlignment(true);
+ }
+
+ public void overviewMenuItem_actionPerformed()
+ {
+ if (alignPanel.overviewPanel != null)
+ {
+ return;
+ }
+
+ Frame frame = new Frame();
+ OverviewPanel overview = new OverviewPanel(alignPanel);
+ frame.add(overview);
+ // +50 must allow for applet frame window
+ jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
+ "label.overview_params", new String[] { this.getTitle() }),
+ overview.getPreferredSize().width,
+ overview.getPreferredSize().height + 50);
+
+ frame.pack();
+ final AlignmentPanel ap = alignPanel;
+ frame.addWindowListener(new WindowAdapter()
+ {
+ @Override
+ public void windowClosing(WindowEvent e)
+ {
+ if (ap != null)
+ {
+ ap.setOverviewPanel(null);
+ }
+ };
+ });
+
+ alignPanel.setOverviewPanel(overview);
+
+ }
+
+ public void changeColour(ColourSchemeI cs)
+ {
+
+ if (cs != null)
+ {
+ if (viewport.getAbovePIDThreshold())
+ {
+ viewport.setThreshold(SliderPanel.setPIDSliderSource(alignPanel,
+ cs, "Background"));
+ }
+
+ if (viewport.getConservationSelected())
+ {
+ cs.setConservationApplied(true);
+ viewport.setIncrement(SliderPanel.setConservationSlider(alignPanel,
+ cs, "Background"));
+ }
+ else
+ {
+ cs.setConservationApplied(false);
+ }
+ }
+ viewport.setGlobalColourScheme(cs);
+
+ alignPanel.paintAlignment(true);
+ }
+
+ protected void modifyPID_actionPerformed()
+ {
+ if (viewport.getAbovePIDThreshold()
+ && viewport.getGlobalColourScheme() != null)
+ {
+ SliderPanel.setPIDSliderSource(alignPanel,
+ viewport.getGlobalColourScheme(), "Background");
+ SliderPanel.showPIDSlider();
+ }
+ }
+
+ protected void modifyConservation_actionPerformed()
+ {
+ if (viewport.getConservationSelected()
+ && viewport.getGlobalColourScheme() != null)
+ {
+ SliderPanel.setConservationSlider(alignPanel,
+ viewport.getGlobalColourScheme(), "Background");
+ SliderPanel.showConservationSlider();
+ }
+ }
+
+ protected void conservationMenuItem_actionPerformed()
+ {
+ viewport.setConservationSelected(conservationMenuItem.getState());
+
+ viewport.setAbovePIDThreshold(false);
+ abovePIDThreshold.setState(false);
+
+ changeColour(viewport.getGlobalColourScheme());
+
+ modifyConservation_actionPerformed();
+ }
+
+ public void abovePIDThreshold_actionPerformed()
+ {
+ viewport.setAbovePIDThreshold(abovePIDThreshold.getState());
+
+ conservationMenuItem.setState(false);
+ viewport.setConservationSelected(false);
+
+ changeColour(viewport.getGlobalColourScheme());
+
+ modifyPID_actionPerformed();
+ }
+
+ public void sortPairwiseMenuItem_actionPerformed()
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByPID(viewport.getAlignment(), viewport
+ .getAlignment().getSequenceAt(0), null);
+
+ addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+ }
+
+ public void sortIDMenuItem_actionPerformed()
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByID(viewport.getAlignment());
+ addHistoryItem(new OrderCommand("ID Sort", oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+ }
+
+ public void sortLengthMenuItem_actionPerformed()
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByLength(viewport.getAlignment());
+ addHistoryItem(new OrderCommand("Length Sort", oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+ }
+
+ public void sortGroupMenuItem_actionPerformed()
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByGroup(viewport.getAlignment());
+ addHistoryItem(new OrderCommand("Group Sort", oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+
+ }
+
+ public void removeRedundancyMenuItem_actionPerformed()
+ {
+ new RedundancyPanel(alignPanel);
+ }
+
+ public void pairwiseAlignmentMenuItem_actionPerformed()
+ {
+ if (viewport.getSelectionGroup() != null
+ && viewport.getSelectionGroup().getSize() > 1)
+ {
+ Frame frame = new Frame();
+ frame.add(new PairwiseAlignPanel(alignPanel));
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("action.pairwise_alignment"), 600,
+ 500);
+ }
+ }
+
+ public void PCAMenuItem_actionPerformed()
+ {
+ // are the sequences aligned?
+ if (!viewport.getAlignment().isAligned(false))
+ {
+ SequenceI current;
+ int Width = viewport.getAlignment().getWidth();
+
+ for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
+ {
+ current = viewport.getAlignment().getSequenceAt(i);
+
+ if (current.getLength() < Width)
+ {
+ current.insertCharAt(Width - 1, viewport.getGapCharacter());
+ }
+ }
+ alignPanel.paintAlignment(true);
+ }
+
+ if ((viewport.getSelectionGroup() != null
+ && viewport.getSelectionGroup().getSize() < 4 && viewport
+ .getSelectionGroup().getSize() > 0)
+ || viewport.getAlignment().getHeight() < 4)
+ {
+ return;
+ }
+
+ try
+ {
+ new PCAPanel(viewport);
+ } catch (java.lang.OutOfMemoryError ex)
+ {
+ }
+
+ }
+
+ public void averageDistanceTreeMenuItem_actionPerformed()
+ {
+ NewTreePanel("AV", "PID", "Average distance tree using PID");
+ }
+
+ public void neighbourTreeMenuItem_actionPerformed()
+ {
+ NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
+ }
+
+ protected void njTreeBlosumMenuItem_actionPerformed()
+ {
+ NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
+ }
+
+ protected void avTreeBlosumMenuItem_actionPerformed()
+ {
+ NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
+ }
+
+ void NewTreePanel(String type, String pwType, String title)
+ {
+ // are the sequences aligned?
+ if (!viewport.getAlignment().isAligned(false))
+ {
+ SequenceI current;
+ int Width = viewport.getAlignment().getWidth();
+
+ for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
+ {
+ current = viewport.getAlignment().getSequenceAt(i);
+
+ if (current.getLength() < Width)
+ {
+ current.insertCharAt(Width - 1, viewport.getGapCharacter());
+ }
+ }
+ alignPanel.paintAlignment(true);
+
+ }
+
+ if ((viewport.getSelectionGroup() != null && viewport
+ .getSelectionGroup().getSize() > 1)
+ || (viewport.getAlignment().getHeight() > 1))
+ {
+ final TreePanel tp = new TreePanel(alignPanel, type, pwType);
+
+ addTreeMenuItem(tp, title);
+
+ jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);
+ }
+ }
+
+ void loadTree_actionPerformed()
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
+ cap.setText(MessageManager.getString("label.paste_newick_tree_file"));
+ cap.setTreeImport();
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.paste_newick_file"), 400, 300);
+ }
+
+ public void loadTree(jalview.io.NewickFile tree, String treeFile)
+ {
+ TreePanel tp = new TreePanel(alignPanel, treeFile,
+ MessageManager.getString("label.load_tree_from_file"), tree);
+ jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);
+ addTreeMenuItem(tp, treeFile);
+ }
+
+ /**
+ * sort the alignment using the given treePanel
+ *
+ * @param treePanel
+ * tree used to sort view
+ * @param title
+ * string used for undo event name
+ */
+ public void sortByTree(TreePanel treePanel, String title)
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter
+ .sortByTree(viewport.getAlignment(), treePanel.getTree());
+ // addHistoryItem(new HistoryItem("Sort", viewport.alignment,
+ // HistoryItem.SORT));
+ addHistoryItem(new OrderCommand(MessageManager.formatMessage(
+ "label.order_by_params", new String[] { title }), oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+ }
+
+ /**
+ * Do any automatic reordering of the alignment and add the necessary bits to
+ * the menu structure for the new tree
+ *
+ * @param treePanel
+ * @param title
+ */
+ protected void addTreeMenuItem(final TreePanel treePanel,
+ final String title)
+ {
+ final MenuItem item = new MenuItem(title);
+ sortByTreeMenu.add(item);
+ item.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent evt)
+ {
+ sortByTree(treePanel, title); // treePanel.getTitle());
+ }
+ });
+
+ treePanel.addWindowListener(new WindowAdapter()
+ {
+ @Override
+ public void windowOpened(WindowEvent e)
+ {
+ if (viewport.sortByTree)
+ {
+ sortByTree(treePanel, title);
+ }
+ super.windowOpened(e);
+ }
+
+ @Override
+ public void windowClosing(WindowEvent e)
+ {
+ sortByTreeMenu.remove(item);
+ };
+ });
+ }
+
+ public boolean sortBy(AlignmentOrder alorder, String undoname)
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ if (viewport.applet.debug)
+ {
+ System.err.println("Sorting " + alorder.getOrder().size()
+ + " in alignment '" + getTitle() + "'");
+ }
+ AlignmentSorter.sortBy(viewport.getAlignment(), alorder);
+ if (undoname != null)
+ {
+ addHistoryItem(new OrderCommand(undoname, oldOrder,
+ viewport.getAlignment()));
+ }
+ alignPanel.paintAlignment(true);
+ return true;
+ }
+
+ protected void documentation_actionPerformed()
+ {
+ alignPanel.av.applet.openJalviewHelpUrl();
+ }
+
+ protected void about_actionPerformed()
+ {
+
+ class AboutPanel extends Canvas
+ {
+ String version;
+
+ String builddate;
+
+ public AboutPanel(String version, String builddate)
+ {
+ this.version = version;
+ this.builddate = builddate;
+ }
+
+ @Override
+ public void paint(Graphics g)
+ {
+ g.setColor(Color.white);
+ g.fillRect(0, 0, getSize().width, getSize().height);
+ g.setFont(new Font("Helvetica", Font.PLAIN, 12));
+ FontMetrics fm = g.getFontMetrics();
+ int fh = fm.getHeight();
+ int y = 5, x = 7;
+ g.setColor(Color.black);
+ // TODO: update this text for each release or centrally store it for
+ // lite and application
+ g.setFont(new Font("Helvetica", Font.BOLD, 14));
+ g.drawString(MessageManager.formatMessage(
+ "label.jalviewLite_release", new String[] { version }), x,
+ y += fh);
+ g.setFont(new Font("Helvetica", Font.BOLD, 12));
+ g.drawString(MessageManager.formatMessage(
+ "label.jaview_build_date", new String[] { builddate }), x,
+ y += fh);
+ g.setFont(new Font("Helvetica", Font.PLAIN, 12));
+ g.drawString(MessageManager.getString("label.jalview_authors_1"),
+ x, y += fh * 1.5);
+ g.drawString(MessageManager.getString("label.jalview_authors_2"),
+ x + 50, y += fh + 8);
+ g.drawString(
+ MessageManager.getString("label.jalview_dev_managers"), x,
+ y += fh);
+ g.drawString(MessageManager
+ .getString("label.jalview_distribution_lists"), x, y += fh);
+ g.drawString(MessageManager.getString("label.jalview_please_cite"),
+ x, y += fh + 8);
+ g.drawString(
+ MessageManager.getString("label.jalview_cite_1_authors"),
+ x, y += fh);
+ g.drawString(
+ MessageManager.getString("label.jalview_cite_1_title"), x,
+ y += fh);
+ g.drawString(MessageManager.getString("label.jalview_cite_1_ref"),
+ x, y += fh);
+ }
+ }
+
+ Frame frame = new Frame();
+ frame.add(new AboutPanel(JalviewLite.getVersion(), JalviewLite
+ .getBuildDate()));
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.jalview"), 580, 220);
+
+ }
+
+ public void showURL(String url, String target)
+ {
+ if (viewport.applet == null)
+ {
+ System.out.println("Not running as applet - no browser available.");
+ }
+ else
+ {
+ viewport.applet.showURL(url, target);
+ }
+ }
+
+ // ////////////////////////////////////////////////////////////////////////////////
+ // JBuilder Graphics here
+
+ MenuBar alignFrameMenuBar = new MenuBar();
+
+ Menu fileMenu = new Menu(MessageManager.getString("action.file"));
+
+ MenuItem loadApplication = new MenuItem(
+ MessageManager.getString("label.view_full_application"));
+
+ MenuItem loadTree = new MenuItem(
+ MessageManager.getString("label.load_associated_tree"));
+
+ MenuItem loadAnnotations = new MenuItem(
+ MessageManager.getString("label.load_features_annotations"));
+
+ MenuItem outputFeatures = new MenuItem(
+ MessageManager.getString("label.export_features"));
+
+ MenuItem outputAnnotations = new MenuItem(
+ MessageManager.getString("label.export_annotations"));
+
+ MenuItem closeMenuItem = new MenuItem(
+ MessageManager.getString("action.close"));
+
+ MenuItem selectAllSequenceMenuItem = new MenuItem(
+ MessageManager.getString("action.select_all"));
+
+ MenuItem deselectAllSequenceMenuItem = new MenuItem(
+ MessageManager.getString("action.deselect_all"));
+
+ MenuItem invertSequenceMenuItem = new MenuItem(
+ MessageManager.getString("action.invert_selection"));
+
+ MenuItem remove2LeftMenuItem = new MenuItem();
+
+ MenuItem remove2RightMenuItem = new MenuItem();
+
+ MenuItem removeGappedColumnMenuItem = new MenuItem();
+
+ MenuItem removeAllGapsMenuItem = new MenuItem();
+
+ CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem();
+
+ CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem();
+
+ MenuItem sortPairwiseMenuItem = new MenuItem();
+
+ MenuItem sortIDMenuItem = new MenuItem();
+
+ MenuItem sortLengthMenuItem = new MenuItem();
+
+ MenuItem sortGroupMenuItem = new MenuItem();
+
+ MenuItem removeRedundancyMenuItem = new MenuItem();
+
+ MenuItem pairwiseAlignmentMenuItem = new MenuItem();
+
+ MenuItem PCAMenuItem = new MenuItem();
+
+ MenuItem averageDistanceTreeMenuItem = new MenuItem();
+
+ MenuItem neighbourTreeMenuItem = new MenuItem();
+
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ public Label statusBar = new Label();
+
+ MenuItem clustalColour = new MenuItem();
+
+ MenuItem zappoColour = new MenuItem();
+
+ MenuItem taylorColour = new MenuItem();
+
+ MenuItem hydrophobicityColour = new MenuItem();
+
+ MenuItem helixColour = new MenuItem();
+
+ MenuItem strandColour = new MenuItem();
+
+ MenuItem turnColour = new MenuItem();
+
+ MenuItem buriedColour = new MenuItem();
+
+ MenuItem purinePyrimidineColour = new MenuItem();
+
+ // MenuItem RNAInteractionColour = new MenuItem();
+
+ MenuItem RNAHelixColour = new MenuItem();
+
+ MenuItem userDefinedColour = new MenuItem();
+
+ MenuItem PIDColour = new MenuItem();
+
+ MenuItem BLOSUM62Colour = new MenuItem();
+
+ MenuItem tcoffeeColour = new MenuItem();
+
+ MenuItem njTreeBlosumMenuItem = new MenuItem();
+
+ MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();
+
+ CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem();
+
+ CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem();
+
+ CheckboxMenuItem displayNonconservedMenuItem = new CheckboxMenuItem();
+
+ MenuItem alProperties = new MenuItem(
+ MessageManager.getString("label.alignment_props"));
+
+ MenuItem overviewMenuItem = new MenuItem();
+
+ MenuItem undoMenuItem = new MenuItem();
+
+ MenuItem redoMenuItem = new MenuItem();
+
+ CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();
+
+ MenuItem noColourmenuItem = new MenuItem();
+
+ CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem();
+
+ CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem();
+
+ MenuItem findMenuItem = new MenuItem();
+
+ CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem();
+
+ MenuItem nucleotideColour = new MenuItem();
+
+ MenuItem deleteGroups = new MenuItem();
+
+ MenuItem grpsFromSelection = new MenuItem();
+
+ MenuItem createGroup = new MenuItem();
+
+ MenuItem unGroup = new MenuItem();
+
+ MenuItem delete = new MenuItem();
+
+ MenuItem copy = new MenuItem();
+
+ MenuItem cut = new MenuItem();
+
+ Menu pasteMenu = new Menu();
+
+ MenuItem pasteNew = new MenuItem();
+
+ MenuItem pasteThis = new MenuItem();
+
+ CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem();
+
+ MenuItem font = new MenuItem();
+
+ CheckboxMenuItem scaleAbove = new CheckboxMenuItem();
+
+ CheckboxMenuItem scaleLeft = new CheckboxMenuItem();
+
+ CheckboxMenuItem scaleRight = new CheckboxMenuItem();
+
+ MenuItem modifyPID = new MenuItem();
+
+ MenuItem modifyConservation = new MenuItem();
+
+ CheckboxMenuItem autoCalculate = null;
+
+ CheckboxMenuItem sortByTree = new CheckboxMenuItem(
+ "Sort Alignment With New Tree", true);
+
+ Menu sortByTreeMenu = new Menu();
+
+ MenuItem inputText = new MenuItem();
+
+ MenuItem documentation = new MenuItem();
+
+ MenuItem about = new MenuItem();
+
+ CheckboxMenuItem seqLimits = new CheckboxMenuItem();
+
+ CheckboxMenuItem centreColumnLabelFlag = new CheckboxMenuItem();
+
+ CheckboxMenuItem followMouseOverFlag = new CheckboxMenuItem();
+
+ CheckboxMenuItem showSequenceLogo = new CheckboxMenuItem();
+
+ CheckboxMenuItem applyAutoAnnotationSettings = new CheckboxMenuItem();
+
+ CheckboxMenuItem showConsensusHistogram = new CheckboxMenuItem();
+
+ CheckboxMenuItem showGroupConsensus = new CheckboxMenuItem();
+
+ CheckboxMenuItem showGroupConservation = new CheckboxMenuItem();
+
+ CheckboxMenuItem normSequenceLogo = new CheckboxMenuItem();
+
+ /**
+ * Initialise menus and other items
+ *
+ * @throws Exception
+ */
+ private void jbInit() throws Exception
+ {
+ setMenuBar(alignFrameMenuBar);
+
+ /*
+ * Configure File menu items and actions
+ */
+ inputText
+ .setLabel(MessageManager.getString("label.input_from_textbox"));
+ inputText.addActionListener(this);
+ Menu outputTextboxMenu = new Menu(
+ MessageManager.getString("label.out_to_textbox"));
+ for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)
+ {
+
+ MenuItem item = new MenuItem(
+ jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);
+
+ item.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ outputText_actionPerformed(e);
+ }
+ });
+
+ outputTextboxMenu.add(item);
+ }
+ closeMenuItem.addActionListener(this);
+ loadApplication.addActionListener(this);
+ loadTree.addActionListener(this);
+ loadAnnotations.addActionListener(this);
+ outputFeatures.addActionListener(this);
+ outputAnnotations.addActionListener(this);
+
+ /*
+ * Configure Edit menu items and actions
+ */
+ undoMenuItem.setEnabled(false);
+ undoMenuItem.setLabel(MessageManager.getString("action.undo"));
+ undoMenuItem.addActionListener(this);
+ redoMenuItem.setEnabled(false);
+ redoMenuItem.setLabel(MessageManager.getString("action.redo"));
+ redoMenuItem.addActionListener(this);
+ copy.setLabel(MessageManager.getString("action.copy"));
+ copy.addActionListener(this);
+ cut.setLabel(MessageManager.getString("action.cut"));
+ cut.addActionListener(this);
+ delete.setLabel(MessageManager.getString("action.delete"));
+ delete.addActionListener(this);
+ pasteMenu.setLabel(MessageManager.getString("action.paste"));
+ pasteNew.setLabel(MessageManager.getString("label.to_new_alignment"));
+ pasteNew.addActionListener(this);
+ pasteThis.setLabel(MessageManager.getString("label.to_this_alignment"));
+ pasteThis.addActionListener(this);
+ remove2LeftMenuItem.setLabel(MessageManager
+ .getString("action.remove_left"));
+ remove2LeftMenuItem.addActionListener(this);
+ remove2RightMenuItem.setLabel(MessageManager
+ .getString("action.remove_right"));
+ remove2RightMenuItem.addActionListener(this);
+ removeGappedColumnMenuItem.setLabel(MessageManager
+ .getString("action.remove_empty_columns"));
+ removeGappedColumnMenuItem.addActionListener(this);
+ removeAllGapsMenuItem.setLabel(MessageManager
+ .getString("action.remove_all_gaps"));
+ removeAllGapsMenuItem.addActionListener(this);
+ removeRedundancyMenuItem.setLabel(MessageManager
+ .getString("action.remove_redundancy"));
+ removeRedundancyMenuItem.addActionListener(this);
+
+ /*
+ * Configure Select menu items and actions
+ */
+ findMenuItem.setLabel(MessageManager.getString("action.find"));
+ findMenuItem.addActionListener(this);
+ selectAllSequenceMenuItem.addActionListener(this);
+ deselectAllSequenceMenuItem.addActionListener(this);
+ invertSequenceMenuItem.setLabel(MessageManager
+ .getString("action.invert_sequence_selection"));
+ invertSequenceMenuItem.addActionListener(this);
+ invertColSel.setLabel(MessageManager
+ .getString("action.invert_column_selection"));
+ invertColSel.addActionListener(this);
+ deleteGroups.setLabel(MessageManager
+ .getString("action.undefine_groups"));
+ deleteGroups.addActionListener(this);
+ grpsFromSelection.setLabel(MessageManager
+ .getString("action.make_groups_selection"));
+ grpsFromSelection.addActionListener(this);
+ createGroup.setLabel(MessageManager.getString("action.create_group"));
+ unGroup.setLabel(MessageManager.getString("action.remove_group"));
+ annotationColumnSelection.setLabel(MessageManager
+ .getString("action.select_by_annotation"));
+ annotationColumnSelection.addActionListener(this);
+
+ /*
+ * Configure View menu items and actions
+ */
+ newView.setLabel(MessageManager.getString("action.new_view"));
+ newView.addActionListener(this);
+ Menu showMenu = new Menu(MessageManager.getString("action.show"));
+ showColumns.setLabel(MessageManager.getString("label.all_columns"));
+ showSeqs.setLabel(MessageManager.getString("label.all_sequences"));
+ Menu hideMenu = new Menu(MessageManager.getString("action.hide"));
+ hideColumns
+ .setLabel(MessageManager.getString("label.selected_columns"));
+ hideSequences.setLabel(MessageManager
+ .getString("label.selected_sequences"));
+ hideAllButSelection.setLabel(MessageManager
+ .getString("label.all_but_selected_region"));
+ hideAllSelection.setLabel(MessageManager
+ .getString("label.selected_region"));
+ showAllHidden.setLabel(MessageManager
+ .getString("label.all_sequences_columns"));
+ showColumns.addActionListener(this);
+ showSeqs.addActionListener(this);
+ hideColumns.addActionListener(this);
+ hideSequences.addActionListener(this);
+ hideAllButSelection.addActionListener(this);
+ hideAllSelection.addActionListener(this);
+ showAllHidden.addActionListener(this);
+ featureSettings.setLabel(MessageManager
+ .getString("action.feature_settings"));
+ featureSettings.addActionListener(this);
+ sequenceFeatures.setLabel(MessageManager
+ .getString("label.show_sequence_features"));
+ sequenceFeatures.addItemListener(this);
+ sequenceFeatures.setState(false);
+ followMouseOverFlag.setLabel(MessageManager
+ .getString("label.automatic_scrolling"));
+ followMouseOverFlag.addItemListener(this);
+ alProperties.addActionListener(this);
+ overviewMenuItem.setLabel(MessageManager
+ .getString("label.overview_window"));
+ overviewMenuItem.addActionListener(this);
+
+ /*
+ * Configure Annotations menu items and actions
+ */
+ annotationPanelMenuItem.setLabel(MessageManager
+ .getString("label.show_annotations"));
+ annotationPanelMenuItem.addItemListener(this);
+ showGroupConsensus.setLabel(MessageManager
+ .getString("label.group_consensus"));
+ showGroupConservation.setLabel(MessageManager
+ .getString("label.group_conservation"));
+ showConsensusHistogram.setLabel(MessageManager
+ .getString("label.show_consensus_histogram"));
+ showSequenceLogo.setLabel(MessageManager
+ .getString("label.show_consensus_logo"));
+ normSequenceLogo.setLabel(MessageManager
+ .getString("label.norm_consensus_logo"));
+ applyAutoAnnotationSettings.setLabel(MessageManager
+ .getString("label.apply_all_groups"));
+ applyAutoAnnotationSettings.setState(true);
+ Menu autoAnnMenu = new Menu(
+ MessageManager.getString("label.autocalculated_annotation"));
+ showGroupConsensus.addItemListener(this);
+ showGroupConservation.addItemListener(this);
+ showConsensusHistogram.addItemListener(this);
+ showSequenceLogo.addItemListener(this);
+ normSequenceLogo.addItemListener(this);
+ applyAutoAnnotationSettings.addItemListener(this);
+ showAlignmentAnnotations = new CheckboxMenuItem(
+ MessageManager.getString("label.show_all_al_annotations"));
+ showSequenceAnnotations = new CheckboxMenuItem(
+ MessageManager.getString("label.show_all_seq_annotations"));
+ sortAnnBySequence = new CheckboxMenuItem(
+ MessageManager.getString("label.sort_annotations_by_sequence"));
+ sortAnnByLabel = new CheckboxMenuItem(
+ MessageManager.getString("label.sort_annotations_by_label"));
+ showAutoFirst = new CheckboxMenuItem(
+ MessageManager.getString("label.show_first"));
+ showAutoLast = new CheckboxMenuItem(
+ MessageManager.getString("label.show_last"));
+ showAlignmentAnnotations.addItemListener(this);
+ showSequenceAnnotations.addItemListener(this);
+ sortAnnBySequence.addItemListener(this);
+ sortAnnByLabel.addItemListener(this);
+ showAutoFirst.addItemListener(this);
+ showAutoLast.addItemListener(this);
+
+ /*
+ * Configure Format menu items and actions
+ */
+ font.setLabel(MessageManager.getString("action.font"));
+ font.addActionListener(this);
+ scaleAbove.setLabel(MessageManager.getString("action.scale_above"));
+ scaleAbove.setState(true);
+ scaleAbove.setEnabled(false);
+ scaleAbove.addItemListener(this);
+ scaleLeft.setEnabled(false);
+ scaleLeft.setState(true);
+ scaleLeft.setLabel(MessageManager.getString("action.scale_left"));
+ scaleLeft.addItemListener(this);
+ scaleRight.setEnabled(false);
+ scaleRight.setState(true);
+ scaleRight.setLabel(MessageManager.getString("action.scale_right"));
+ scaleRight.addItemListener(this);
+ viewBoxesMenuItem.setLabel(MessageManager.getString("action.boxes"));
+ viewBoxesMenuItem.setState(true);
+ viewBoxesMenuItem.addItemListener(this);
+ viewTextMenuItem.setLabel(MessageManager.getString("action.text"));
+ viewTextMenuItem.setState(true);
+ viewTextMenuItem.addItemListener(this);
+ colourTextMenuItem.setLabel(MessageManager
+ .getString("label.colour_text"));
+ colourTextMenuItem.addItemListener(this);
+ displayNonconservedMenuItem.setLabel(MessageManager
+ .getString("label.show_non_conversed"));
+ displayNonconservedMenuItem.addItemListener(this);
+ wrapMenuItem.setLabel(MessageManager.getString("action.wrap"));
+ wrapMenuItem.addItemListener(this);
+ renderGapsMenuItem.setLabel(MessageManager
+ .getString("action.show_gaps"));
+ renderGapsMenuItem.setState(true);
+ renderGapsMenuItem.addItemListener(this);
+ centreColumnLabelFlag.setLabel(MessageManager
+ .getString("label.centre_column_labels"));
+ centreColumnLabelFlag.addItemListener(this);
+ seqLimits.setState(true);
+ seqLimits.setLabel(MessageManager
+ .getString("label.show_sequence_limits"));
+ seqLimits.addItemListener(this);
+
+ /*
+ * Configure Colour menu items and actions
+ */
+ applyToAllGroups.setLabel(MessageManager
+ .getString("label.apply_colour_to_all_groups"));
+ applyToAllGroups.setState(true);
+ applyToAllGroups.addItemListener(this);
+ clustalColour.setLabel(MessageManager.getString("label.clustalx"));
+ clustalColour.addActionListener(this);
+ zappoColour.setLabel(MessageManager.getString("label.zappo"));
+ zappoColour.addActionListener(this);
+ taylorColour.setLabel(MessageManager.getString("label.taylor"));
+ taylorColour.addActionListener(this);
+ hydrophobicityColour.setLabel(MessageManager
+ .getString("label.hydrophobicity"));
+ hydrophobicityColour.addActionListener(this);
+ helixColour
+ .setLabel(MessageManager.getString("label.helix_propensity"));
+ helixColour.addActionListener(this);
+ strandColour.setLabel(MessageManager
+ .getString("label.strand_propensity"));
+ strandColour.addActionListener(this);
+ turnColour.setLabel(MessageManager.getString("label.turn_propensity"));
+ turnColour.addActionListener(this);
+ buriedColour.setLabel(MessageManager.getString("label.buried_index"));
+ buriedColour.addActionListener(this);
+ purinePyrimidineColour.setLabel(MessageManager
+ .getString("label.purine_pyrimidine"));
+ purinePyrimidineColour.addActionListener(this);
+ // RNAInteractionColour.setLabel(MessageManager
+ // .getString("label.rna_interaction"));
+ // RNAInteractionColour.addActionListener(this);
+ RNAHelixColour.setLabel(MessageManager
+ .getString("action.by_rna_helixes"));
+ RNAHelixColour.addActionListener(this);
+ userDefinedColour.setLabel(MessageManager
+ .getString("action.user_defined"));
+ userDefinedColour.addActionListener(this);
+ PIDColour.setLabel(MessageManager
+ .getString("label.percentage_identity"));
+ PIDColour.addActionListener(this);
+ BLOSUM62Colour.setLabel(MessageManager
+ .getString("label.blosum62_score"));
+ BLOSUM62Colour.addActionListener(this);
+ tcoffeeColour
+ .setLabel(MessageManager.getString("label.tcoffee_scores"));
+ // it will be enabled only if a score file is provided
+ tcoffeeColour.setEnabled(false);
+ tcoffeeColour.addActionListener(this);
+ conservationMenuItem.setLabel(MessageManager
+ .getString("action.by_conservation"));
+ conservationMenuItem.addItemListener(this);
+ noColourmenuItem.setLabel(MessageManager.getString("label.none"));
+ noColourmenuItem.addActionListener(this);
+ abovePIDThreshold.setLabel(MessageManager
+ .getString("label.above_identity_threshold"));
+ abovePIDThreshold.addItemListener(this);
+ nucleotideColour.setLabel(MessageManager.getString("label.nucleotide"));
+ nucleotideColour.addActionListener(this);
+ modifyPID.setLabel(MessageManager
+ .getString("label.modify_identity_thereshold"));
+ modifyPID.addActionListener(this);
+ modifyConservation.setLabel(MessageManager
+ .getString("label.modify_conservation_thereshold"));
+ modifyConservation.addActionListener(this);
+ annotationColour.setLabel(MessageManager
+ .getString("action.by_annotation"));
+ annotationColour.addActionListener(this);
+
+ /*
+ * Configure Calculate menu items and actions
+ */
+ sortPairwiseMenuItem.setLabel(MessageManager
+ .getString("action.by_pairwise_id"));
+ sortPairwiseMenuItem.addActionListener(this);
+ sortIDMenuItem.setLabel(MessageManager.getString("action.by_id"));
+ sortIDMenuItem.addActionListener(this);
+ sortLengthMenuItem.setLabel(MessageManager
+ .getString("action.by_length"));
+ sortLengthMenuItem.addActionListener(this);
+ sortGroupMenuItem.setLabel(MessageManager.getString("action.by_group"));
+ sortGroupMenuItem.addActionListener(this);
+ pairwiseAlignmentMenuItem.setLabel(MessageManager
+ .getString("action.pairwise_alignment"));
+ pairwiseAlignmentMenuItem.addActionListener(this);
+ PCAMenuItem.setLabel(MessageManager
+ .getString("label.principal_component_analysis"));
+ PCAMenuItem.addActionListener(this);
+ autoCalculate = new CheckboxMenuItem(
+ MessageManager.getString("label.autocalculate_consensus"), true);
+ averageDistanceTreeMenuItem.setLabel(MessageManager
+ .getString("label.average_distance_identity"));
+ averageDistanceTreeMenuItem.addActionListener(this);
+ neighbourTreeMenuItem.setLabel(MessageManager
+ .getString("label.neighbour_joining_identity"));
+ neighbourTreeMenuItem.addActionListener(this);
+ avDistanceTreeBlosumMenuItem.setLabel(MessageManager
+ .getString("label.average_distance_bloslum62"));
+ avDistanceTreeBlosumMenuItem.addActionListener(this);
+ njTreeBlosumMenuItem.setLabel(MessageManager
+ .getString("label.neighbour_blosum62"));
+ njTreeBlosumMenuItem.addActionListener(this);
+ sortByTreeMenu.setLabel(MessageManager
+ .getString("action.by_tree_order"));
+ Menu sortMenu = new Menu(MessageManager.getString("action.sort"));
+ Menu calculateTreeMenu = new Menu(
+ MessageManager.getString("action.calculate_tree"));
+ autoCalculate.addItemListener(this);
+ sortByTree.addItemListener(this);
+
+ /*
+ * Configure Help menu items and actions
+ */
+ Menu helpMenu = new Menu(MessageManager.getString("action.help"));
+ documentation.setLabel(MessageManager.getString("label.documentation"));
+ documentation.addActionListener(this);
+ about.setLabel(MessageManager.getString("label.about"));
+ about.addActionListener(this);
+
+ /*
+ * Add top level menus to frame
+ */
+ alignFrameMenuBar.add(fileMenu);
+ Menu editMenu = new Menu(MessageManager.getString("action.edit"));
+ alignFrameMenuBar.add(editMenu);
+ Menu selectMenu = new Menu(MessageManager.getString("action.select"));
+ alignFrameMenuBar.add(selectMenu);
+ Menu viewMenu = new Menu(MessageManager.getString("action.view"));
+ alignFrameMenuBar.add(viewMenu);
+ Menu annotationsMenu = new Menu(
+ MessageManager.getString("action.annotations"));
+ alignFrameMenuBar.add(annotationsMenu);
+ Menu formatMenu = new Menu(MessageManager.getString("action.format"));
+ alignFrameMenuBar.add(formatMenu);
+ Menu colourMenu = new Menu(MessageManager.getString("action.colour"));
+ alignFrameMenuBar.add(colourMenu);
+ Menu calculateMenu = new Menu(
+ MessageManager.getString("action.calculate"));
+ alignFrameMenuBar.add(calculateMenu);
+ alignFrameMenuBar.add(helpMenu);
+
+ /*
+ * File menu
+ */
+ fileMenu.add(inputText);
+ fileMenu.add(loadTree);
+ fileMenu.add(loadAnnotations);
+ fileMenu.addSeparator();
+ fileMenu.add(outputTextboxMenu);
+ fileMenu.add(outputFeatures);
+ fileMenu.add(outputAnnotations);
+ if (jalviewServletURL != null)
+ {
+ fileMenu.add(loadApplication);
+ }
+ fileMenu.addSeparator();
+ fileMenu.add(closeMenuItem);
+
+ /*
+ * Edit menu
+ */
+ editMenu.add(undoMenuItem);
+ editMenu.add(redoMenuItem);
+ editMenu.add(cut);
+ editMenu.add(copy);
+ pasteMenu.add(pasteNew);
+ pasteMenu.add(pasteThis);
+ editMenu.add(pasteMenu);
+ editMenu.add(delete);
+ editMenu.addSeparator();
+ editMenu.add(remove2LeftMenuItem);
+ editMenu.add(remove2RightMenuItem);
+ editMenu.add(removeGappedColumnMenuItem);
+ editMenu.add(removeAllGapsMenuItem);
+ editMenu.add(removeRedundancyMenuItem);
+
+ /*
+ * Select menu
+ */
+ selectMenu.add(findMenuItem);
+ selectMenu.addSeparator();
+ selectMenu.add(selectAllSequenceMenuItem);
+ selectMenu.add(deselectAllSequenceMenuItem);
+ selectMenu.add(invertSequenceMenuItem);
+ selectMenu.add(invertColSel);
+ selectMenu.add(createGroup);
+ selectMenu.add(unGroup);
+ selectMenu.add(grpsFromSelection);
+ selectMenu.add(deleteGroups);
+ selectMenu.add(annotationColumnSelection);
+
+ /*
+ * View menu
+ */
+ viewMenu.add(newView);
+ viewMenu.addSeparator();
+ showMenu.add(showColumns);
+ showMenu.add(showSeqs);
+ showMenu.add(showAllHidden);
+ viewMenu.add(showMenu);
+ hideMenu.add(hideColumns);
+ hideMenu.add(hideSequences);
+ hideMenu.add(hideAllSelection);
+ hideMenu.add(hideAllButSelection);
+ viewMenu.add(hideMenu);
+ viewMenu.addSeparator();
+ viewMenu.add(followMouseOverFlag);
+ viewMenu.addSeparator();
+ viewMenu.add(sequenceFeatures);
+ viewMenu.add(featureSettings);
+ viewMenu.addSeparator();
+ viewMenu.add(alProperties);
+ viewMenu.addSeparator();
+ viewMenu.add(overviewMenuItem);
+
+ /*
+ * Annotations menu
+ */
+ annotationsMenu.add(annotationPanelMenuItem);
+ annotationsMenu.addSeparator();
+ annotationsMenu.add(showAlignmentAnnotations);
+ annotationsMenu.add(showSequenceAnnotations);
+ annotationsMenu.add(sortAnnBySequence);
+ annotationsMenu.add(sortAnnByLabel);
+ annotationsMenu.addSeparator();
+ autoAnnMenu.add(showAutoFirst);
+ autoAnnMenu.add(showAutoLast);
+ autoAnnMenu.addSeparator();
+ autoAnnMenu.add(applyAutoAnnotationSettings);
+ autoAnnMenu.add(showConsensusHistogram);
+ autoAnnMenu.add(showSequenceLogo);
+ autoAnnMenu.add(normSequenceLogo);
+ autoAnnMenu.addSeparator();
+ autoAnnMenu.add(showGroupConservation);
+ autoAnnMenu.add(showGroupConsensus);
+ annotationsMenu.add(autoAnnMenu);
+
+ /*
+ * Format menu
+ */
+ formatMenu.add(font);
+ formatMenu.add(seqLimits);
+ formatMenu.add(wrapMenuItem);
+ formatMenu.add(scaleAbove);
+ formatMenu.add(scaleLeft);
+ formatMenu.add(scaleRight);
+ formatMenu.add(viewBoxesMenuItem);
+ formatMenu.add(viewTextMenuItem);
+ formatMenu.add(colourTextMenuItem);
+ formatMenu.add(displayNonconservedMenuItem);
+ formatMenu.add(renderGapsMenuItem);
+ formatMenu.add(centreColumnLabelFlag);
+
+ /*
+ * Colour menu
+ */
+ colourMenu.add(applyToAllGroups);
+ colourMenu.addSeparator();
+ colourMenu.add(noColourmenuItem);
+ colourMenu.add(clustalColour);
+ colourMenu.add(BLOSUM62Colour);
+ colourMenu.add(PIDColour);
+ colourMenu.add(zappoColour);
+ colourMenu.add(taylorColour);
+ colourMenu.add(hydrophobicityColour);
+ colourMenu.add(helixColour);
+ colourMenu.add(strandColour);
+ colourMenu.add(turnColour);
+ colourMenu.add(buriedColour);
+ colourMenu.add(nucleotideColour);
+ colourMenu.add(purinePyrimidineColour);
+ // colourMenu.add(RNAInteractionColour);
+ colourMenu.add(tcoffeeColour);
+ colourMenu.add(userDefinedColour);
+ colourMenu.addSeparator();
+ colourMenu.add(conservationMenuItem);
+ colourMenu.add(modifyConservation);
+ colourMenu.add(abovePIDThreshold);
+ colourMenu.add(modifyPID);
+ colourMenu.add(annotationColour);
+ colourMenu.add(RNAHelixColour);
+
+ /*
+ * Calculate menu
+ */
+ sortMenu.add(sortIDMenuItem);
+ sortMenu.add(sortLengthMenuItem);
+ sortMenu.add(sortByTreeMenu);
+ sortMenu.add(sortGroupMenuItem);
+ sortMenu.add(sortPairwiseMenuItem);
+ calculateMenu.add(sortMenu);
+ calculateTreeMenu.add(averageDistanceTreeMenuItem);
+ calculateTreeMenu.add(neighbourTreeMenuItem);
+ calculateTreeMenu.add(avDistanceTreeBlosumMenuItem);
+ calculateTreeMenu.add(njTreeBlosumMenuItem);
+ calculateMenu.add(calculateTreeMenu);
+ calculateMenu.addSeparator();
+ calculateMenu.add(pairwiseAlignmentMenuItem);
+ calculateMenu.add(PCAMenuItem);
+ calculateMenu.add(autoCalculate);
+ calculateMenu.add(sortByTree);
+
+ /*
+ * Help menu
+ */
+ helpMenu.add(documentation);
+ helpMenu.add(about);
+
+ /*
+ * Status bar
+ */
+ statusBar.setBackground(Color.white);
+ statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
+ statusBar.setText(MessageManager.getString("label.status_bar"));
+ this.add(statusBar, BorderLayout.SOUTH);
+ }
+
+ public void setStatus(String string)
+ {
+ statusBar.setText(string);
+ };
+
+ MenuItem featureSettings = new MenuItem();
+
+ CheckboxMenuItem sequenceFeatures = new CheckboxMenuItem();
+
+ MenuItem annotationColour = new MenuItem();
+
+ MenuItem annotationColumnSelection = new MenuItem();
+
+ MenuItem invertColSel = new MenuItem();
+
+ MenuItem showColumns = new MenuItem();
+
+ MenuItem showSeqs = new MenuItem();
+
+ MenuItem hideColumns = new MenuItem();
+
+ MenuItem hideSequences = new MenuItem();
+
+ MenuItem hideAllButSelection = new MenuItem();
+
+ MenuItem hideAllSelection = new MenuItem();
+
+ MenuItem showAllHidden = new MenuItem();
+
+ MenuItem newView = new MenuItem();
+
+ private CheckboxMenuItem showAlignmentAnnotations;
+
+ private CheckboxMenuItem showSequenceAnnotations;
+
+ private CheckboxMenuItem sortAnnBySequence;
+
+ private CheckboxMenuItem sortAnnByLabel;
+
+ private CheckboxMenuItem showAutoFirst;
+
+ private CheckboxMenuItem showAutoLast;
+
+ private SplitFrame splitFrame;
+
+ /**
+ * Attach the alignFrame panels after embedding menus, if necessary. This used
+ * to be called setEmbedded, but is now creates the dropdown menus in a
+ * platform independent manner to avoid OSX/Mac menu appendage daftness.
+ *
+ * @param reallyEmbedded
+ * true to attach the view to the applet area on the page rather than
+ * in a new window
+ */
+ public void createAlignFrameWindow(boolean reallyEmbedded)
+ {
+ if (reallyEmbedded)
+ {
+ embedAlignFrameInApplet(viewport.applet);
+ }
+ else
+ {
+ // //////
+ // test and embed menu bar if necessary.
+ //
+ if (embedMenuIfNeeded(alignPanel))
+ {
+ /*
+ * adjust for status bar height too. ? pointless as overridden by layout
+ * manager
+ */
+ alignPanel.setSize(getSize().width,
+ getSize().height - statusBar.getHeight());
+ }
+ add(statusBar, BorderLayout.SOUTH);
+ add(alignPanel, BorderLayout.CENTER);
+ // and register with the applet so it can pass external API calls to us
+ jalview.bin.JalviewLite.addFrame(this, this.getTitle(), frameWidth,
+ frameHeight);
+ }
+ }
+
+ /**
+ * Add the components of this AlignFrame to the applet container.
+ *
+ * @param theApplet
+ */
+ public void embedAlignFrameInApplet(final JalviewLite theApplet)
+ {
+ // ////
+ // Explicitly build the embedded menu panel for the on-page applet
+ //
+ // view cannot be closed if its actually on the page
+ fileMenu.remove(closeMenuItem);
+ fileMenu.remove(3); // Remove Separator
+ // construct embedded menu, using default font
+ embeddedMenu = makeEmbeddedPopupMenu(alignFrameMenuBar, false, false);
+ // and actually add the components to the applet area
+ theApplet.setLayout(new BorderLayout());
+ theApplet.add(embeddedMenu, BorderLayout.NORTH);
+ theApplet.add(statusBar, BorderLayout.SOUTH);
+ // TODO should size be left to the layout manager?
+ alignPanel.setSize(theApplet.getSize().width,
+ theApplet.getSize().height - embeddedMenu.getHeight()
+ - statusBar.getHeight());
+ theApplet.add(alignPanel, BorderLayout.CENTER);
+ final AlignFrame me = this;
+ theApplet.addFocusListener(new FocusListener()
+ {
+
+ @Override
+ public void focusLost(FocusEvent e)
+ {
+ if (theApplet.currentAlignFrame == me)
+ {
+ theApplet.currentAlignFrame = null;
+ }
+ }
+
+ @Override
+ public void focusGained(FocusEvent e)
+ {
+ theApplet.currentAlignFrame = me;
+ }
+ });
+ theApplet.validate();
+ }
+
+ /**
+ * create a new binding between structures in an existing jmol viewer instance
+ * and an alignpanel with sequences that have existing PDBFile entries. Note,
+ * this does not open a new Jmol window, or modify the display of the
+ * structures in the original jmol window. Note This method doesn't work
+ * without an additional javascript library to exchange messages between the
+ * distinct applets. See http://issues.jalview.org/browse/JAL-621
+ *
+ * @param viewer
+ * JmolViewer instance
+ * @param sequenceIds
+ * - sequence Ids to search for associations
+ */
+ public SequenceStructureBinding addStructureViewInstance(
+ Object jmolviewer, String[] sequenceIds)
+ {
+ Viewer viewer = null;
+ try
+ {
+ viewer = (Viewer) jmolviewer;
+ } catch (ClassCastException ex)
+ {
+ System.err.println("Unsupported viewer object :"
+ + jmolviewer.getClass());
+ }
+ if (viewer == null)
+ {
+ System.err.println("Can't use this object as a structure viewer:"
+ + jmolviewer.getClass());
+ return null;
+ }
+ SequenceI[] seqs = null;
+ if (sequenceIds == null || sequenceIds.length == 0)
+ {
+ seqs = viewport.getAlignment().getSequencesArray();
+ }
+ else
+ {
+ Vector sqi = new Vector();
+ AlignmentI al = viewport.getAlignment();
+ for (int sid = 0; sid < sequenceIds.length; sid++)
+ {
+ SequenceI sq = al.findName(sequenceIds[sid]);
+ if (sq != null)
+ {
+ sqi.addElement(sq);
+ }
+ }
+ if (sqi.size() > 0)
+ {
+ seqs = new SequenceI[sqi.size()];
+ for (int sid = 0, sSize = sqi.size(); sid < sSize; sid++)
+ {
+ seqs[sid] = (SequenceI) sqi.elementAt(sid);
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+ AAStructureBindingModel jmv = null;
+ // TODO: search for a jmv that involves viewer
+ if (jmv == null)
+ { // create a new viewer/jalview binding.
+ jmv = new ExtJmol(viewer, alignPanel, new SequenceI[][] { seqs });
+ }
+ return jmv;
+
+ }
+
+ /**
+ * bind a pdb file to a sequence in the current view
+ *
+ * @param sequenceId
+ * - sequenceId within the dataset.
+ * @param pdbEntryString
+ * - the short name for the PDB file
+ * @param pdbFile
+ * - pdb file - either a URL or a valid PDB file.
+ * @return true if binding was as success TODO: consider making an exception
+ * structure for indicating when PDB parsing or sequenceId location
+ * fails.
+ */
+ public boolean addPdbFile(String sequenceId, String pdbEntryString,
+ String pdbFile)
+ {
+ SequenceI toaddpdb = viewport.getAlignment().findName(sequenceId);
+ boolean needtoadd = false;
+ if (toaddpdb != null)
+ {
+ Vector pdbe = toaddpdb.getAllPDBEntries();
+ PDBEntry pdbentry = null;
+ if (pdbe != null && pdbe.size() > 0)
+ {
+ for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++)
+ {
+ pdbentry = (PDBEntry) pdbe.elementAt(pe);
+ if (!pdbentry.getId().equals(pdbEntryString)
+ && !pdbentry.getFile().equals(pdbFile))
+ {
+ pdbentry = null;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+ if (pdbentry == null)
+ {
+ pdbentry = new PDBEntry();
+ pdbentry.setId(pdbEntryString);
+ pdbentry.setFile(pdbFile);
+ needtoadd = true; // add this new entry to sequence.
+ }
+ // resolve data source
+ // TODO: this code should be a refactored to an io package
+ String protocol = AppletFormatAdapter.resolveProtocol(pdbFile, "PDB");
+ if (protocol == null)
+ {
+ return false;
+ }
+ if (needtoadd)
+ {
+ // make a note of the access mode and add
+ if (pdbentry.getProperty() == null)
+ {
+ pdbentry.setProperty(new Hashtable());
+ }
+ pdbentry.getProperty().put("protocol", protocol);
+ toaddpdb.addPDBId(pdbentry);
+ alignPanel.getStructureSelectionManager()
+ .registerPDBEntry(pdbentry);
+ }
+ }
+ return true;
+ }
+
+ private Object[] cleanSeqChainArrays(SequenceI[] seqs, String[] chains)
+ {
+ if (seqs != null)
+ {
+ Vector sequences = new Vector();
+ for (int i = 0; i < seqs.length; i++)
+ {
+ if (seqs[i] != null)
+ {
+ sequences.addElement(new Object[] { seqs[i],
+ (chains != null) ? chains[i] : null });
+ }
+ }
+ seqs = new SequenceI[sequences.size()];
+ chains = new String[sequences.size()];
+ for (int i = 0, isize = sequences.size(); i < isize; i++)
+ {
+ Object[] oj = (Object[]) sequences.elementAt(i);
+
+ seqs[i] = (SequenceI) oj[0];
+ chains[i] = (String) oj[1];
+ }
+ }
+ return new Object[] { seqs, chains };
+
+ }
+
+ public void newStructureView(JalviewLite applet, PDBEntry pdb,
+ SequenceI[] seqs, String[] chains, String protocol)
+ {
+ // Scrub any null sequences from the array
+ Object[] sqch = cleanSeqChainArrays(seqs, chains);
+ seqs = (SequenceI[]) sqch[0];
+ chains = (String[]) sqch[1];
+ if (seqs == null || seqs.length == 0)
+ {
+ System.err
+ .println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to.");
+ }
+ if (protocol == null || protocol.trim().length() == 0
+ || protocol.equals("null"))
+ {
+ protocol = (String) pdb.getProperty().get("protocol");
+ if (protocol == null)
+ {
+ System.err.println("Couldn't work out protocol to open structure: "
+ + pdb.getId());
+ return;
+ }
+ }
+ if (applet.useXtrnalSviewer)
+ {
+ // register the association(s) and quit, don't create any windows.
+ if (StructureSelectionManager.getStructureSelectionManager(applet)
+ .setMapping(seqs, chains, pdb.getFile(), protocol) == null)
+ {
+ System.err.println("Failed to map " + pdb.getFile() + " ("
+ + protocol + ") to any sequences");
+ }
+ return;
+ }
+ if (applet.isAlignPdbStructures() && applet.jmolAvailable)
+ {
+ // can only do alignments with Jmol
+ // find the last jmol window assigned to this alignment
+ jalview.appletgui.AppletJmol ajm = null, tajm;
+ Vector jmols = applet
+ .getAppletWindow(jalview.appletgui.AppletJmol.class);
+ for (int i = 0, iSize = jmols.size(); i < iSize; i++)
+ {
+ tajm = (jalview.appletgui.AppletJmol) jmols.elementAt(i);
+ if (tajm.ap.alignFrame == this)
+ {
+ ajm = tajm;
+ break;
+ }
+ }
+ if (ajm != null)
+ {
+ System.err
+ .println("Incremental adding and aligning structure to existing Jmol view not yet implemented.");
+ // try and add the pdb structure
+ // ajm.addS
+ ajm = null;
+ }
+ }
+ // otherwise, create a new window
+ if (applet.jmolAvailable)
+ {
+ new jalview.appletgui.AppletJmol(pdb, seqs, chains, alignPanel,
+ protocol);
+ applet.lastFrameX += 40;
+ applet.lastFrameY += 40;
+ }
+ else
+ {
+ new MCview.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol);
+ }
+
+ }
+
+ public void alignedStructureView(JalviewLite applet, PDBEntry[] pdb,
+ SequenceI[][] seqs, String[][] chains, String[] protocols)
+ {
+ // TODO Auto-generated method stub
+ System.err.println("Aligned Structure View: Not yet implemented.");
+ }
+
+ /**
+ * modify the current selection, providing the user has not made a selection
+ * already.
+ *
+ * @param sel
+ * - sequences from this alignment
+ * @param csel
+ * - columns to be selected on the alignment
+ */
+ public void select(SequenceGroup sel, ColumnSelection csel)
+ {
+ alignPanel.seqPanel.selection(sel, csel, null);
+ }
+
+ public void scrollTo(int row, int column)
+ {
+ alignPanel.seqPanel.scrollTo(row, column);
+ }
+
+ public void scrollToRow(int row)
+ {
+ alignPanel.seqPanel.scrollToRow(row);
+ }
+
+ public void scrollToColumn(int column)
+ {
+ alignPanel.seqPanel.scrollToColumn(column);
+ }
+
+ /**
+ * @return the alignments unique ID.
+ */
+ public String getSequenceSetId()
+ {
+ return viewport.getSequenceSetId();
+ }
+
+ /**
+ * Load the (T-Coffee) score file from the specified url
+ *
+ * @param source
+ * File/URL/T-COFFEE score file contents
+ * @throws IOException
+ * @return true if alignment was annotated with data from source
+ */
+ public boolean loadScoreFile(String source) throws IOException
+ {
+
+ TCoffeeScoreFile file = new TCoffeeScoreFile(source,
+ AppletFormatAdapter.checkProtocol(source));
+ if (!file.isValid())
+ {
+ // TODO: raise dialog for gui
+ System.err.println("Problems parsing T-Coffee scores: "
+ + file.getWarningMessage());
+ System.err.println("Origin was:\n" + source);
+ return false;
+ }
+
+ /*
+ * check that the score matrix matches the alignment dimensions
+ */
+ AlignmentI aln;
+ if ((aln = viewport.getAlignment()) != null
+ && (aln.getHeight() != file.getHeight() || aln.getWidth() != file
+ .getWidth()))
+ {
+ // TODO: raise a dialog box here rather than bomb out.
+ System.err
+ .println("The scores matrix does not match the alignment dimensions");
+
+ }
+
+ // TODO add parameter to indicate if matching should be done
+ if (file.annotateAlignment(alignPanel.getAlignment(), false))
+ {
+ alignPanel.fontChanged();
+ tcoffeeColour.setEnabled(true);
+ // switch to this color
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
+ return true;
+ }
+ else
+ {
+ System.err.println("Problems resolving T-Coffee scores:");
+ if (file.getWarningMessage() != null)
+ {
+ System.err.println(file.getWarningMessage());
+ }
+ }
+ return false;
+ }
+
+ public SplitFrame getSplitFrame()
+ {
+ return this.splitFrame;
+ }
+
+ public void setSplitFrame(SplitFrame sf)
+ {
+ this.splitFrame = sf;
+ }
+
+ // may not need this
+ @Override
+ public void setShowSeqFeatures(boolean b)
+ {
+ // showSeqFeatures.setSelected(b);
+ viewport.setShowSequenceFeatures(b);
+
+ }
+
+ @Override
+ public void setMenusForViewport()
+ {
+ // setMenusFromViewport(viewport);
+
+ }
+
+ @Override
+ public void refreshFeatureUI(boolean enableIfNecessary)
+ {
+ if (enableIfNecessary)
+ {
+ sequenceFeatures.setState(true);
+ alignPanel.av.setShowSequenceFeatures(true);
+ }
+ }
+
+ @Override
+ public FeatureSettingsControllerI getFeatureSettingsUI()
+ {
+ return alignPanel.av.featureSettings;
+ }
+
+}
diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java
index ff8f7df..f8355c3 100644
--- a/src/jalview/appletgui/AlignViewport.java
+++ b/src/jalview/appletgui/AlignViewport.java
@@ -1,162 +1,78 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.analysis.NJTree;
+import jalview.api.AlignViewportI;
+import jalview.bin.JalviewLite;
+import jalview.commands.CommandI;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.UserColourScheme;
+import jalview.structure.CommandListener;
import jalview.structure.SelectionSource;
import jalview.structure.StructureSelectionManager;
import jalview.structure.VamsasSource;
+import jalview.viewmodel.AlignmentViewport;
-public class AlignViewport implements SelectionSource, VamsasSource
-{
- int startRes;
-
- int endRes;
-
- int startSeq;
-
- int endSeq;
+import java.awt.Font;
+public class AlignViewport extends AlignmentViewport implements
+ SelectionSource, VamsasSource, CommandListener
+{
boolean cursorMode = false;
- boolean showJVSuffix = true;
-
- boolean showText = true;
-
- boolean showColourText = false;
-
- boolean showBoxes = true;
-
- boolean wrapAlignment = false;
-
- boolean renderGaps = true;
-
- boolean showSequenceFeatures = false;
-
- boolean showAnnotation = true;
-
- boolean showConservation = true;
-
- boolean showQuality = true;
-
- boolean showConsensus = true;
-
- boolean upperCasebold = false;
-
- boolean colourAppliesToAllGroups = true;
-
- ColourSchemeI globalColourScheme = null;
-
- boolean conservationColourSelected = false;
-
- boolean abovePIDThreshold = false;
-
- SequenceGroup selectionGroup;
-
- int charHeight;
-
- int charWidth;
-
- int wrappedWidth;
-
Font font = new Font("SansSerif", Font.PLAIN, 10);
boolean validCharWidth = true;
- AlignmentI alignment;
-
- ColumnSelection colSel = new ColumnSelection();
-
- int threshold;
-
- int increment;
-
NJTree currentTree = null;
- boolean scaleAboveWrapped = true;
-
- boolean scaleLeftWrapped = true;
-
- boolean scaleRightWrapped = true;
-
- // The following vector holds the features which are
- // currently visible, in the correct order or rendering
- public Hashtable featuresDisplayed;
-
- boolean hasHiddenColumns = false;
-
- boolean hasHiddenRows = false;
-
- boolean showHiddenMarkers = true;
-
- public Hashtable[] hconsensus;
-
- AlignmentAnnotation consensus;
-
- AlignmentAnnotation conservation;
-
- AlignmentAnnotation quality;
-
- AlignmentAnnotation[] groupConsensus;
-
- AlignmentAnnotation[] groupConservation;
-
- boolean autocalculateConsensus = true;
-
- public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
-
- private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
- this);
-
- boolean ignoreGapsInConsensusCalculation = false;
-
public jalview.bin.JalviewLite applet;
- Hashtable sequenceColours;
-
boolean MAC = false;
- Stack historyList = new Stack();
-
- Stack redoList = new Stack();
-
- String sequenceSetID;
+ private AnnotationColumnChooser annotationColumnSelectionState;
- Hashtable hiddenRepSequences;
-
- public void finalize() {
- applet=null;
- quality=null;
- alignment=null;
- colSel=null;
+ public void finalize()
+ {
+ applet = null;
+ quality = null;
+ alignment = null;
+ colSel = null;
}
public AlignViewport(AlignmentI al, JalviewLite applet)
{
+ super();
+ calculator = new jalview.workers.AlignCalcManager();
this.applet = applet;
- setAlignment(al);
+ alignment = al;
+ // we always pad gaps
+ this.setPadGaps(true);
this.startRes = 0;
this.endRes = al.getWidth() - 1;
this.startSeq = 0;
@@ -180,7 +96,7 @@ public class AlignViewport implements SelectionSource, VamsasSource
+ widthScale + "). Ignoring.");
widthScale = 1;
}
- if (applet.debug)
+ if (JalviewLite.debug)
{
System.err
.println("Alignment character width scaling factor is now "
@@ -203,7 +119,7 @@ public class AlignViewport implements SelectionSource, VamsasSource
+ heightScale + "). Ignoring.");
heightScale = 1;
}
- if (applet.debug)
+ if (JalviewLite.debug)
{
System.err
.println("Alignment character height scaling factor is now "
@@ -217,39 +133,56 @@ public class AlignViewport implements SelectionSource, VamsasSource
if (applet != null)
{
- showJVSuffix = applet.getDefaultParameter("showFullId", showJVSuffix);
+ setShowJVSuffix(applet.getDefaultParameter("showFullId",
+ getShowJVSuffix()));
+
+ setShowAnnotation(applet.getDefaultParameter("showAnnotation",
+ isShowAnnotation()));
+
+ showConservation = applet.getDefaultParameter("showConservation",
+ showConservation);
- showAnnotation = applet.getDefaultParameter("showAnnotation", showAnnotation);
-
- showConservation = applet.getDefaultParameter("showConservation", showConservation);
-
showQuality = applet.getDefaultParameter("showQuality", showQuality);
- showConsensus = applet.getDefaultParameter("showConsensus", showConsensus);
+ showConsensus = applet.getDefaultParameter("showConsensus",
+ showConsensus);
+
+ setShowUnconserved(applet.getDefaultParameter("showUnconserved",
+ getShowUnconserved()));
- showUnconserved = applet.getDefaultParameter("showUnconserved", showUnconserved);
+ setScaleProteinAsCdna(applet.getDefaultParameter(
+ "scaleProteinAsCdna", isScaleProteinAsCdna()));
String param = applet.getParameter("upperCase");
if (param != null)
{
if (param.equalsIgnoreCase("bold"))
{
- upperCasebold = true;
+ setUpperCasebold(true);
}
}
sortByTree = applet.getDefaultParameter("sortByTree", sortByTree);
- followHighlight = applet.getDefaultParameter("automaticScrolling",followHighlight);
- followSelection = followHighlight;
+ setFollowHighlight(applet.getDefaultParameter("automaticScrolling",
+ isFollowHighlight()));
+ followSelection = isFollowHighlight();
+
+ showSequenceLogo = applet.getDefaultParameter("showSequenceLogo",
+ showSequenceLogo);
+
+ normaliseSequenceLogo = applet.getDefaultParameter(
+ "normaliseSequenceLogo", applet.getDefaultParameter(
+ "normaliseLogo", normaliseSequenceLogo));
+
+ showGroupConsensus = applet.getDefaultParameter("showGroupConsensus",
+ showGroupConsensus);
+
+ showGroupConservation = applet.getDefaultParameter(
+ "showGroupConservation", showGroupConservation);
+
+ showConsensusHistogram = applet.getDefaultParameter(
+ "showConsensusHistogram", showConsensusHistogram);
- showSequenceLogo = applet.getDefaultParameter("showSequenceLogo", showSequenceLogo);
-
- showGroupConsensus = applet.getDefaultParameter("showGroupConsensus", showGroupConsensus);
-
- showGroupConservation = applet.getDefaultParameter("showGroupConservation", showGroupConservation);
-
- showConsensusHistogram = applet.getDefaultParameter("showConsensusHistogram", showConsensusHistogram);
-
}
if (applet != null)
@@ -281,332 +214,8 @@ public class AlignViewport implements SelectionSource, VamsasSource
.getParameter("userDefinedColour"));
}
}
- if (hconsensus == null)
- {
- if (!alignment.isNucleotide())
- {
- conservation = new AlignmentAnnotation("Conservation",
- "Conservation of total alignment less than " + ConsPercGaps
- + "% gaps", new Annotation[1], 0f, 11f,
- AlignmentAnnotation.BAR_GRAPH);
- conservation.hasText = true;
- conservation.autoCalculated = true;
-
- if (showConservation)
- {
- alignment.addAnnotation(conservation);
- }
-
- if (showQuality)
- {
- quality = new AlignmentAnnotation("Quality",
- "Alignment Quality based on Blosum62 scores",
- new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
- quality.hasText = true;
- quality.autoCalculated = true;
-
- alignment.addAnnotation(quality);
- }
- }
-
- consensus = new AlignmentAnnotation("Consensus", "PID",
- new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
- consensus.hasText = true;
- consensus.autoCalculated = true;
-
- if (showConsensus)
- {
- alignment.addAnnotation(consensus);
- }
- }
-
- }
-
- public void showSequenceFeatures(boolean b)
- {
- showSequenceFeatures = b;
- }
-
- public boolean getShowSequenceFeatures()
- {
- return showSequenceFeatures;
- }
-
- class ConservationThread extends Thread
- {
- AlignmentPanel ap;
-
- public ConservationThread(AlignmentPanel ap)
- {
- this.ap = ap;
- }
-
- public void run()
- {
- try
- {
- updatingConservation = true;
-
- while (UPDATING_CONSERVATION)
- {
- try
- {
- if (ap != null)
- {
- ap.paintAlignment(false);
- }
- Thread.sleep(200);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- UPDATING_CONSERVATION = true;
-
- int alWidth = (alignment==null) ? -1 : alignment.getWidth();
- if (alWidth < 0)
- {
- updatingConservation = false;
- UPDATING_CONSERVATION = false;
- return;
- }
-
- Conservation cons = new jalview.analysis.Conservation("All",
- jalview.schemes.ResidueProperties.propHash, 3,
- alignment.getSequences(), 0, alWidth - 1);
-
- cons.calculate();
- cons.verdict(false, ConsPercGaps);
-
- if (quality != null)
- {
- cons.findQuality();
- }
-
- char[] sequence = cons.getConsSequence().getSequence();
- float minR;
- float minG;
- float minB;
- float maxR;
- float maxG;
- float maxB;
- minR = 0.3f;
- minG = 0.0f;
- minB = 0f;
- maxR = 1.0f - minR;
- maxG = 0.9f - minG;
- maxB = 0f - minB; // scalable range for colouring both Conservation and
- // Quality
-
- float min = 0f;
- float max = 11f;
- float qmin = 0f;
- float qmax = 0f;
-
- char c;
-
- conservation.annotations = new Annotation[alWidth];
-
- if (quality != null)
- {
- quality.graphMax = cons.qualityRange[1].floatValue();
- quality.annotations = new Annotation[alWidth];
- qmin = cons.qualityRange[0].floatValue();
- qmax = cons.qualityRange[1].floatValue();
- }
-
- for (int i = 0; i < alWidth; i++)
- {
- float value = 0;
-
- c = sequence[i];
-
- if (Character.isDigit(c))
- {
- value = (int) (c - '0');
- }
- else if (c == '*')
- {
- value = 11;
- }
- else if (c == '+')
- {
- value = 10;
- }
- // TODO - refactor to use a graduatedColorScheme to calculate the
- // histogram colors.
- float vprop = value - min;
- vprop /= max;
- conservation.annotations[i] = new Annotation(String.valueOf(c),
- String.valueOf(value), ' ', value, new Color(minR
- + (maxR * vprop), minG + (maxG * vprop), minB
- + (maxB * vprop)));
-
- // Quality calc
- if (quality != null)
- {
- value = ((Double) cons.quality.elementAt(i)).floatValue();
- vprop = value - qmin;
- vprop /= qmax;
- quality.annotations[i] = new Annotation(" ",
- String.valueOf(value), ' ', value, new Color(minR
- + (maxR * vprop), minG + (maxG * vprop), minB
- + (maxB * vprop)));
- }
- }
- } catch (OutOfMemoryError error)
- {
- System.out.println("Out of memory calculating conservation!!");
- conservation = null;
- quality = null;
- System.gc();
- }
-
- UPDATING_CONSERVATION = false;
- updatingConservation = false;
-
- if (ap != null)
- {
- ap.paintAlignment(true);
- }
-
- }
- }
-
- ConservationThread conservationThread;
-
- ConsensusThread consensusThread;
-
- boolean consUpdateNeeded = false;
-
- static boolean UPDATING_CONSENSUS = false;
-
- static boolean UPDATING_CONSERVATION = false;
-
- boolean updatingConsensus = false;
-
- boolean updatingConservation = false;
-
- /**
- * DOCUMENT ME!
- */
- public void updateConservation(final AlignmentPanel ap)
- {
- if (alignment.isNucleotide() || conservation == null)
- {
- return;
- }
-
- conservationThread = new ConservationThread(ap);
- conservationThread.start();
- }
-
- /**
- * DOCUMENT ME!
- */
- public void updateConsensus(final AlignmentPanel ap)
- {
- consensusThread = new ConsensusThread(ap);
- consensusThread.start();
- }
-
- class ConsensusThread extends Thread
- {
- AlignmentPanel ap;
-
- public ConsensusThread(AlignmentPanel ap)
- {
- this.ap = ap;
- }
-
- public void run()
- {
- updatingConsensus = true;
- while (UPDATING_CONSENSUS)
- {
- try
- {
- if (ap != null)
- {
- ap.paintAlignment(false);
- }
-
- Thread.sleep(200);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- UPDATING_CONSENSUS = true;
-
- try
- {
- int aWidth = alignment==null ? -1 : alignment.getWidth();
- if (aWidth < 0)
- {
- UPDATING_CONSENSUS = false;
- updatingConsensus = false;
- return;
- }
-
- consensus.annotations = null;
- consensus.annotations = new Annotation[aWidth];
-
- hconsensus = new Hashtable[aWidth];
- AAFrequency.calculate(alignment.getSequencesArray(), 0,
- alignment.getWidth(), hconsensus, true); // always calculate the
- // full profile
- updateAnnotation(true);
- //AAFrequency.completeConsensus(consensus, hconsensus, 0, aWidth,
- // ignoreGapsInConsensusCalculation,
- // true);
-
- if (globalColourScheme != null)
- {
- globalColourScheme.setConsensus(hconsensus);
- }
-
- } catch (OutOfMemoryError error)
- {
- alignment.deleteAnnotation(consensus);
-
- consensus = null;
- hconsensus = null;
- System.out.println("Out of memory calculating consensus!!");
- System.gc();
- }
- UPDATING_CONSENSUS = false;
- updatingConsensus = false;
-
- if (ap != null)
- {
- ap.paintAlignment(true);
- }
- }
-
- /**
- * update the consensus annotation from the sequence profile data using
- * current visualization settings.
- */
- public void updateAnnotation()
- {
- updateAnnotation(false);
- }
+ initAutoAnnotation();
- protected void updateAnnotation(boolean immediate)
- {
- // TODO: make calls thread-safe, so if another thread calls this method,
- // it will either return or wait until one calculation is finished.
- if (immediate
- || (!updatingConsensus && consensus != null && hconsensus != null))
- {
- AAFrequency.completeConsensus(consensus, hconsensus, 0,
- hconsensus.length, ignoreGapsInConsensusCalculation,
- showSequenceLogo);
- }
- }
}
/**
@@ -625,7 +234,7 @@ public class AlignViewport implements SelectionSource, VamsasSource
{
return null;
}
- StringBuffer seqs = new StringBuffer();
+ StringBuilder seqs = new StringBuilder(consensus.annotations.length);
for (int i = 0; i < consensus.annotations.length; i++)
{
if (consensus.annotations[i] != null)
@@ -646,104 +255,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
return sq;
}
- public SequenceGroup getSelectionGroup()
- {
- return selectionGroup;
- }
-
- public void setSelectionGroup(SequenceGroup sg)
- {
- selectionGroup = sg;
- }
-
- public boolean getConservationSelected()
- {
- return conservationColourSelected;
- }
-
- public void setConservationSelected(boolean b)
- {
- conservationColourSelected = b;
- }
-
- public boolean getAbovePIDThreshold()
- {
- return abovePIDThreshold;
- }
-
- public void setAbovePIDThreshold(boolean b)
- {
- abovePIDThreshold = b;
- }
-
- public int getStartRes()
- {
- return startRes;
- }
-
- public int getEndRes()
- {
- return endRes;
- }
-
- public int getStartSeq()
- {
- return startSeq;
- }
-
- public void setGlobalColourScheme(ColourSchemeI cs)
- {
- globalColourScheme = cs;
- }
-
- public ColourSchemeI getGlobalColourScheme()
- {
- return globalColourScheme;
- }
-
- public void setStartRes(int res)
- {
- this.startRes = res;
- }
-
- public void setStartSeq(int seq)
- {
- this.startSeq = seq;
- }
-
- public void setEndRes(int res)
- {
- if (res > alignment.getWidth() - 1)
- {
- // log.System.out.println(" Corrected res from " + res + " to maximum " +
- // (alignment.getWidth()-1));
- res = alignment.getWidth() - 1;
- }
- if (res < 0)
- {
- res = 0;
- }
- this.endRes = res;
- }
-
- public void setEndSeq(int seq)
- {
- if (seq > alignment.getHeight())
- {
- seq = alignment.getHeight();
- }
- if (seq < 0)
- {
- seq = 0;
- }
- this.endSeq = seq;
- }
-
- public int getEndSeq()
- {
- return endSeq;
- }
-
java.awt.Frame nullFrame;
protected FeatureSettings featureSettings = null;
@@ -761,13 +272,13 @@ public class AlignViewport implements SelectionSource, VamsasSource
java.awt.FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font);
setCharHeight((int) (heightScale * fm.getHeight()));
- charWidth = (int) (widthScale * fm.charWidth('M'));
+ setCharWidth((int) (widthScale * fm.charWidth('M')));
- if (upperCasebold)
+ if (isUpperCasebold())
{
Font f2 = new Font(f.getName(), Font.BOLD, f.getSize());
fm = nullFrame.getGraphics().getFontMetrics(f2);
- charWidth = (int) (widthScale * (fm.stringWidth("MMMMMMMMMMM") / 10));
+ setCharWidth((int) (widthScale * (fm.stringWidth("MMMMMMMMMMM") / 10)));
}
}
@@ -776,986 +287,182 @@ public class AlignViewport implements SelectionSource, VamsasSource
return font;
}
- public int getCharWidth()
+ public void resetSeqLimits(int height)
{
- return charWidth;
+ setEndSeq(height / getCharHeight());
}
- public void setCharHeight(int h)
+ public void setCurrentTree(NJTree tree)
{
- this.charHeight = h;
+ currentTree = tree;
}
- public int getCharHeight()
+ public NJTree getCurrentTree()
{
- return charHeight;
+ return currentTree;
}
- public void setWrappedWidth(int w)
- {
- this.wrappedWidth = w;
- }
+ boolean centreColumnLabels;
- public int getwrappedWidth()
+ public boolean getCentreColumnLabels()
{
- return wrappedWidth;
+ return centreColumnLabels;
}
- public AlignmentI getAlignment()
- {
- return alignment;
- }
-
- public void setAlignment(AlignmentI align)
- {
- this.alignment = align;
- }
-
- public void setWrapAlignment(boolean state)
- {
- wrapAlignment = state;
- }
-
- public void setShowText(boolean state)
- {
- showText = state;
- }
-
- public void setRenderGaps(boolean state)
- {
- renderGaps = state;
- }
-
- public boolean getColourText()
- {
- return showColourText;
- }
-
- public void setColourText(boolean state)
- {
- showColourText = state;
- }
-
- public void setShowBoxes(boolean state)
- {
- showBoxes = state;
- }
-
- public boolean getWrapAlignment()
- {
- return wrapAlignment;
- }
-
- public boolean getShowText()
- {
- return showText;
- }
-
- public boolean getShowBoxes()
- {
- return showBoxes;
- }
-
- public char getGapCharacter()
- {
- return getAlignment().getGapCharacter();
- }
-
- public void setGapCharacter(char gap)
- {
- if (getAlignment() != null)
- {
- getAlignment().setGapCharacter(gap);
- }
- }
-
- public void setThreshold(int thresh)
- {
- threshold = thresh;
- }
-
- public int getThreshold()
- {
- return threshold;
- }
-
- public void setIncrement(int inc)
- {
- increment = inc;
- }
-
- public int getIncrement()
- {
- return increment;
- }
-
- public void setHiddenColumns(ColumnSelection colsel)
- {
- this.colSel = colsel;
- if (colSel.getHiddenColumns() != null)
- {
- hasHiddenColumns = true;
- }
- }
-
- public ColumnSelection getColumnSelection()
- {
- return colSel;
- }
-
- public void resetSeqLimits(int height)
- {
- setEndSeq(height / getCharHeight());
- }
-
- public void setCurrentTree(NJTree tree)
- {
- currentTree = tree;
- }
-
- public NJTree getCurrentTree()
- {
- return currentTree;
- }
-
- public void setColourAppliesToAllGroups(boolean b)
- {
- colourAppliesToAllGroups = b;
- }
-
- public boolean getColourAppliesToAllGroups()
- {
- return colourAppliesToAllGroups;
- }
-
- public boolean getShowJVSuffix()
- {
- return showJVSuffix;
- }
-
- public void setShowJVSuffix(boolean b)
- {
- showJVSuffix = b;
- }
-
- public boolean getShowAnnotation()
- {
- return showAnnotation;
- }
-
- public void setShowAnnotation(boolean b)
- {
- showAnnotation = b;
- }
-
- public boolean getScaleAboveWrapped()
- {
- return scaleAboveWrapped;
- }
-
- public boolean getScaleLeftWrapped()
- {
- return scaleLeftWrapped;
- }
-
- public boolean getScaleRightWrapped()
- {
- return scaleRightWrapped;
- }
-
- public void setScaleAboveWrapped(boolean b)
- {
- scaleAboveWrapped = b;
- }
-
- public void setScaleLeftWrapped(boolean b)
- {
- scaleLeftWrapped = b;
- }
-
- public void setScaleRightWrapped(boolean b)
- {
- scaleRightWrapped = b;
- }
+ public boolean followSelection = true;
- public void setIgnoreGapsConsensus(boolean b)
+ /**
+ * @return true if view selection should always follow the selections
+ * broadcast by other selection sources
+ */
+ public boolean getFollowSelection()
{
- ignoreGapsInConsensusCalculation = b;
- updateConsensus(null);
- if (globalColourScheme != null)
- {
- globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
- ignoreGapsInConsensusCalculation);
-
- }
+ return followSelection;
}
- /**
- * Property change listener for changes in alignment
- *
- * @param listener
- * DOCUMENT ME!
- */
- public void addPropertyChangeListener(
- java.beans.PropertyChangeListener listener)
+ public void sendSelection()
{
- changeSupport.addPropertyChangeListener(listener);
+ getStructureSelectionManager().sendSelection(
+ new SequenceGroup(getSelectionGroup()),
+ new ColumnSelection(getColumnSelection()), this);
}
/**
- * DOCUMENT ME!
+ * Returns an instance of the StructureSelectionManager scoped to this applet
+ * instance.
*
- * @param listener
- * DOCUMENT ME!
+ * @return
*/
- public void removePropertyChangeListener(
- java.beans.PropertyChangeListener listener)
+ @Override
+ public StructureSelectionManager getStructureSelectionManager()
{
- changeSupport.removePropertyChangeListener(listener);
+ return jalview.structure.StructureSelectionManager
+ .getStructureSelectionManager(applet);
}
/**
- * Property change listener for changes in alignment
+ * synthesize a column selection if none exists so it covers the given
+ * selection group. if wholewidth is false, no column selection is made if the
+ * selection group covers the whole alignment width.
*
- * @param prop
- * DOCUMENT ME!
- * @param oldvalue
- * DOCUMENT ME!
- * @param newvalue
- * DOCUMENT ME!
+ * @param sg
+ * @param wholewidth
*/
- public void firePropertyChange(String prop, Object oldvalue,
- Object newvalue)
- {
- changeSupport.firePropertyChange(prop, oldvalue, newvalue);
- }
-
- public boolean getIgnoreGapsConsensus()
- {
- return ignoreGapsInConsensusCalculation;
- }
-
- public void hideSelectedColumns()
- {
- if (colSel.size() < 1)
- {
- return;
- }
-
- colSel.hideSelectedColumns();
- setSelectionGroup(null);
-
- hasHiddenColumns = true;
- }
-
- public void invertColumnSelection()
- {
- for (int i = 0; i < alignment.getWidth(); i++)
- {
- if (colSel.contains(i))
- {
- colSel.removeElement(i);
- }
- else
- {
- if (!hasHiddenColumns || colSel.isVisible(i))
- {
- colSel.addElement(i);
- }
- }
- }
- }
-
- public void hideColumns(int start, int end)
- {
- if (start == end)
- {
- colSel.hideColumns(start);
- }
- else
- {
- colSel.hideColumns(start, end);
- }
-
- hasHiddenColumns = true;
- }
-
- public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
- {
- int sSize = sg.getSize();
- if (sSize < 2)
- {
- return;
- }
-
- if (hiddenRepSequences == null)
- {
- hiddenRepSequences = new Hashtable();
- }
-
- hiddenRepSequences.put(repSequence, sg);
-
- // Hide all sequences except the repSequence
- SequenceI[] seqs = new SequenceI[sSize - 1];
- int index = 0;
- for (int i = 0; i < sSize; i++)
- {
- if (sg.getSequenceAt(i) != repSequence)
- {
- if (index == sSize - 1)
- {
- return;
- }
-
- seqs[index++] = sg.getSequenceAt(i);
- }
- }
-
- hideSequence(seqs);
-
- }
-
- public void hideAllSelectedSeqs()
- {
- if (selectionGroup == null || selectionGroup.getSize() < 1)
- {
- return;
- }
-
- SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
-
- hideSequence(seqs);
-
- setSelectionGroup(null);
- }
-
- public void hideSequence(SequenceI[] seq)
- {
- if (seq != null)
- {
- for (int i = 0; i < seq.length; i++)
- {
- alignment.getHiddenSequences().hideSequence(seq[i]);
- }
-
- hasHiddenRows = true;
- firePropertyChange("alignment", null, alignment.getSequences());
- }
- }
- public void showSequence(int index)
+ public void expandColSelection(SequenceGroup sg, boolean wholewidth)
{
- Vector tmp = alignment.getHiddenSequences().showSequence(index,
- hiddenRepSequences);
- if (tmp.size() > 0)
+ int sgs, sge;
+ if (sg != null
+ && (sgs = sg.getStartRes()) >= 0
+ && sg.getStartRes() <= (sge = sg.getEndRes())
+ && (colSel == null || colSel.getSelected() == null || colSel
+ .getSelected().size() == 0))
{
- if (selectionGroup == null)
- {
- selectionGroup = new SequenceGroup();
- selectionGroup.setEndRes(alignment.getWidth() - 1);
- }
-
- for (int t = 0; t < tmp.size(); t++)
+ if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
{
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+ // do nothing
+ return;
}
- firePropertyChange("alignment", null, alignment.getSequences());
- sendSelection();
- }
-
- if (alignment.getHiddenSequences().getSize() < 1)
- {
- hasHiddenRows = false;
- }
- }
- public void showColumn(int col)
- {
- colSel.revealHiddenColumns(col);
- if (colSel.getHiddenColumns() == null)
- {
- hasHiddenColumns = false;
- }
- }
-
- public void showAllHiddenColumns()
- {
- colSel.revealAllHiddenColumns();
- hasHiddenColumns = false;
- }
-
- public void showAllHiddenSeqs()
- {
- if (alignment.getHiddenSequences().getSize() > 0)
- {
- if (selectionGroup == null)
+ if (colSel == null)
{
- selectionGroup = new SequenceGroup();
- selectionGroup.setEndRes(alignment.getWidth() - 1);
+ colSel = new ColumnSelection();
}
- Vector tmp = alignment.getHiddenSequences().showAll(
- hiddenRepSequences);
- for (int t = 0; t < tmp.size(); t++)
+ for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
{
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+ colSel.addElement(cspos);
}
- firePropertyChange("alignment", null, alignment.getSequences());
- hasHiddenRows = false;
- hiddenRepSequences = null;
- sendSelection();
}
}
- public int adjustForHiddenSeqs(int alignmentIndex)
- {
- return alignment.getHiddenSequences().adjustForHiddenSeqs(
- alignmentIndex);
- }
-
- /**
- * This method returns the a new SequenceI [] with the selection sequence and
- * start and end points adjusted
- *
- * @return String[]
- */
- public SequenceI[] getSelectionAsNewSequence()
- {
- SequenceI[] sequences;
-
- if (selectionGroup == null)
- {
- sequences = alignment.getSequencesArray();
- }
- else
- {
- sequences = selectionGroup.getSelectionAsNewSequences(alignment);
- }
-
- return sequences;
- }
-
- /**
- * get the currently selected sequence objects or all the sequences in the
- * alignment.
- *
- * @return array of references to sequence objects
- */
- public SequenceI[] getSequenceSelection()
+ public boolean isNormaliseSequenceLogo()
{
- SequenceI[] sequences = null;
- if (selectionGroup != null)
- {
- sequences = selectionGroup.getSequencesInOrder(alignment);
- }
- if (sequences == null)
- {
- sequences = alignment.getSequencesArray();
- }
- return sequences;
+ return normaliseSequenceLogo;
}
- /**
- * This method returns the visible alignment as text, as seen on the GUI, ie
- * if columns are hidden they will not be returned in the result. Use this for
- * calculating trees, PCA, redundancy etc on views which contain hidden
- * columns.
- *
- * @return String[]
- */
- public jalview.datamodel.CigarArray getViewAsCigars(
- boolean selectedRegionOnly)
+ public void setNormaliseSequenceLogo(boolean state)
{
- return new jalview.datamodel.CigarArray(alignment, (hasHiddenColumns ? colSel : null), (selectedRegionOnly ? selectionGroup : null));
+ normaliseSequenceLogo = state;
}
/**
- * return a compact representation of the current alignment selection to pass
- * to an analysis function
*
- * @param selectedOnly
- * boolean true to just return the selected view
- * @return AlignmentView
+ * @return true if alignment characters should be displayed
*/
- jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly)
- {
- return getAlignmentView(selectedOnly, false);
- }
-
- /**
- * return a compact representation of the current alignment selection to pass
- * to an analysis function
- *
- * @param selectedOnly
- * boolean true to just return the selected view
- * @param markGroups
- * boolean true to annotate the alignment view with groups on the alignment (and intersecting with selected region if selectedOnly is true)
- * @return AlignmentView
- */
- public jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups)
+ public boolean isValidCharWidth()
{
- return new AlignmentView(alignment, colSel, selectionGroup, hasHiddenColumns, selectedOnly, markGroups);
+ return validCharWidth;
}
- /**
- * This method returns the visible alignment as text, as seen on the GUI, ie
- * if columns are hidden they will not be returned in the result. Use this for
- * calculating trees, PCA, redundancy etc on views which contain hidden
- * columns.
- *
- * @return String[]
- */
- public String[] getViewAsString(boolean selectedRegionOnly)
- {
- String[] selection = null;
- SequenceI[] seqs = null;
- int i, iSize;
- int start = 0, end = 0;
- if (selectedRegionOnly && selectionGroup != null)
- {
- iSize = selectionGroup.getSize();
- seqs = selectionGroup.getSequencesInOrder(alignment);
- start = selectionGroup.getStartRes();
- end = selectionGroup.getEndRes() + 1;
- }
- else
- {
- iSize = alignment.getHeight();
- seqs = alignment.getSequencesArray();
- end = alignment.getWidth();
- }
-
- selection = new String[iSize];
-
- for (i = 0; i < iSize; i++)
- {
- if (hasHiddenColumns)
- {
- StringBuffer visibleSeq = new StringBuffer();
- Vector regions = colSel.getHiddenColumns();
-
- int blockStart = start, blockEnd = end;
- int[] region;
- int hideStart, hideEnd;
-
- for (int j = 0; j < regions.size(); j++)
- {
- region = (int[]) regions.elementAt(j);
- hideStart = region[0];
- hideEnd = region[1];
-
- if (hideStart < start)
- {
- continue;
- }
-
- blockStart = Math.min(blockStart, hideEnd + 1);
- blockEnd = Math.min(blockEnd, hideStart);
-
- if (blockStart > blockEnd)
- {
- break;
- }
-
- visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
- blockStart = hideEnd + 1;
- blockEnd = end;
- }
-
- if (end > blockStart)
- {
- visibleSeq.append(seqs[i].getSequence(blockStart, end));
- }
-
- selection[i] = visibleSeq.toString();
- }
- else
- {
- selection[i] = seqs[i].getSequenceAsString(start, end);
- }
- }
-
- return selection;
- }
-
- public boolean getShowHiddenMarkers()
+ public AnnotationColumnChooser getAnnotationColumnSelectionState()
{
- return showHiddenMarkers;
+ return annotationColumnSelectionState;
}
- public void setShowHiddenMarkers(boolean show)
+ public void setAnnotationColumnSelectionState(
+ AnnotationColumnChooser annotationColumnSelectionState)
{
- showHiddenMarkers = show;
+ this.annotationColumnSelectionState = annotationColumnSelectionState;
}
- public Color getSequenceColour(SequenceI seq)
+ @Override
+ public void mirrorCommand(CommandI command, boolean undo,
+ StructureSelectionManager ssm, VamsasSource source)
{
- if (sequenceColours == null || !sequenceColours.containsKey(seq))
- {
- return Color.white;
- }
- else
- {
- return (Color) sequenceColours.get(seq);
- }
- }
-
- public void setSequenceColour(SequenceI seq, Color col)
- {
- if (sequenceColours == null)
- {
- sequenceColours = new Hashtable();
- }
-
- if (col == null)
+ // TODO refactor so this can be pulled up to superclass or controller
+ /*
+ * Do nothing unless we are a 'complement' of the source. May replace this
+ * with direct calls not via SSM.
+ */
+ if (source instanceof AlignViewportI
+ && ((AlignViewportI) source).getCodingComplement() == this)
{
- sequenceColours.remove(seq);
+ // ok to continue;
}
else
{
- sequenceColours.put(seq, col);
- }
- }
-
- public String getSequenceSetId()
- {
- if (sequenceSetID == null)
- {
- sequenceSetID = alignment.hashCode() + "";
- }
-
- return sequenceSetID;
- }
- /**
- * unique viewId for synchronizing state (e.g. with stored Jalview Project)
- *
- */
- private String viewId = null;
-
- public String getViewId()
- {
- if (viewId == null)
- {
- viewId = this.getSequenceSetId() + "." + this.hashCode() + "";
- }
- return viewId;
- }
-
- public void alignmentChanged(AlignmentPanel ap)
- {
- alignment.padGaps();
-
- if (hconsensus != null && autocalculateConsensus)
- {
- updateConsensus(ap);
- updateConservation(ap);
- }
-
- // Reset endRes of groups if beyond alignment width
- int alWidth = alignment.getWidth();
- Vector groups = alignment.getGroups();
- if (groups != null)
- {
- for (int i = 0; i < groups.size(); i++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
- if (sg.getEndRes() > alWidth)
- {
- sg.setEndRes(alWidth - 1);
- }
- }
- }
-
- if (selectionGroup != null && selectionGroup.getEndRes() > alWidth)
- {
- selectionGroup.setEndRes(alWidth - 1);
- }
-
- resetAllColourSchemes();
-
- // AW alignment.adjustSequenceAnnotations();
- }
-
- void resetAllColourSchemes()
- {
- ColourSchemeI cs = globalColourScheme;
- if (cs != null)
- {
- if (cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) cs).resetClustalX(alignment.getSequences(),
- alignment.getWidth());
- }
-
- cs.setConsensus(hconsensus);
- if (cs.conservationApplied())
- {
- Alignment al = (Alignment) alignment;
- Conservation c = new Conservation("All",
- ResidueProperties.propHash, 3, al.getSequences(), 0,
- al.getWidth() - 1);
- c.calculate();
- c.verdict(false, ConsPercGaps);
-
- cs.setConservation(c);
- }
+ return;
}
- int s, sSize = alignment.getGroups().size();
- for (s = 0; s < sSize; s++)
+ CommandI mappedCommand = ssm.mapCommand(command, undo, getAlignment(),
+ getGapCharacter());
+ if (mappedCommand != null)
{
- SequenceGroup sg = (SequenceGroup) alignment.getGroups().elementAt(s);
- if (sg.cs != null && sg.cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) sg.cs).resetClustalX(
- sg.getSequences(hiddenRepSequences), sg.getWidth());
- }
- sg.recalcConservation();
- }
- }
-
- boolean centreColumnLabels;
+ mappedCommand.doCommand(null);
+ firePropertyChange("alignment", null, getAlignment().getSequences());
- public boolean getCentreColumnLabels()
- {
- return centreColumnLabels;
- }
-
- public void updateSequenceIdColours()
- {
- Vector groups = alignment.getGroups();
- for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(ig);
- if (sg.idColour != null)
- {
- Vector sqs = sg.getSequences(hiddenRepSequences);
- for (int s = 0, sSize = sqs.size(); s < sSize; s++)
- {
- this.setSequenceColour((SequenceI) sqs.elementAt(s), sg.idColour);
- }
- }
+ // ap.scalePanelHolder.repaint();
+ // ap.repaint();
}
}
- public boolean followHighlight = true;
-
- public boolean getFollowHighlight()
+ @Override
+ public VamsasSource getVamsasSource()
{
- return followHighlight;
+ return this;
}
- public boolean followSelection = true;
-
/**
- * @return true if view selection should always follow the selections
- * broadcast by other selection sources
+ * If this viewport has a (Protein/cDNA) complement, then scroll the
+ * complementary alignment to match this one.
*/
- public boolean getFollowSelection()
+ public void scrollComplementaryAlignment(AlignmentPanel complementPanel)
{
- return followSelection;
- }
-
- private long sgrouphash = -1, colselhash = -1;
-
- /**
- * checks current SelectionGroup against record of last hash value, and
- * updates record.
- *
- * @return true if SelectionGroup changed since last call
- */
- boolean isSelectionGroupChanged()
- {
- int hc = (selectionGroup == null) ? -1 : selectionGroup.hashCode();
- if (hc != sgrouphash)
- {
- sgrouphash = hc;
- return true;
- }
- return false;
- }
-
- /**
- * checks current colsel against record of last hash value, and updates
- * record.
- *
- * @return true if colsel changed since last call
- */
- boolean isColSelChanged()
- {
- int hc = (colSel == null) ? -1 : colSel.hashCode();
- if (hc != colselhash)
+ if (complementPanel == null)
{
- colselhash = hc;
- return true;
+ return;
}
- return false;
- }
- public void sendSelection()
- {
- jalview.structure.StructureSelectionManager
- .getStructureSelectionManager(applet).sendSelection(
- new SequenceGroup(getSelectionGroup()),
- new ColumnSelection(getColumnSelection()), this);
- }
-
-
-
-
- /**
- * show non-conserved residues only
- */
- public boolean showUnconserved = false;
-
- /**
- * when set, alignment should be reordered according to a newly opened tree
- */
- public boolean sortByTree = false;
-
- /**
- * @return the showUnconserved
- */
- public boolean getShowunconserved()
- {
- return showUnconserved;
- }
-
- /**
- * @param showNonconserved
- * the showUnconserved to set
- */
- public void setShowunconserved(boolean displayNonconserved)
- {
- this.showUnconserved = displayNonconserved;
- }
-
- /**
- * should conservation rows be shown for groups
- */
- boolean showGroupConservation = false;
-
- /**
- * should consensus rows be shown for groups
- */
- boolean showGroupConsensus = false;
-
- /**
- * should consensus profile be rendered by default
- */
- public boolean showSequenceLogo = false;
- /**
- * should consensus histograms be rendered by default
- */
- public boolean showConsensusHistogram = true;
-
- /**
- * @return the showConsensusProfile
- */
- public boolean isShowSequenceLogo()
- {
- return showSequenceLogo;
- }
-
- /**
- * @param showSequenceLogo
- * the new value
- */
- public void setShowSequenceLogo(boolean showSequenceLogo)
- {
- if (showSequenceLogo != this.showSequenceLogo)
+ /*
+ * Populate a SearchResults object with the mapped location to scroll to. If
+ * there is no complement, or it is not following highlights, or no mapping
+ * is found, the result will be empty.
+ */
+ SearchResults sr = new SearchResults();
+ int seqOffset = findComplementScrollTarget(sr);
+ if (!sr.isEmpty())
{
- // TODO: decouple settings setting from calculation when refactoring
- // annotation update method from alignframe to viewport
- this.showSequenceLogo = showSequenceLogo;
- if (consensusThread != null)
- {
- consensusThread.updateAnnotation();
- }
+ complementPanel.setFollowingComplementScroll(true);
+ complementPanel.scrollToCentre(sr, seqOffset);
}
- this.showSequenceLogo = showSequenceLogo;
- }
-
- /**
- * @param showConsensusHistogram
- * the showConsensusHistogram to set
- */
- public void setShowConsensusHistogram(boolean showConsensusHistogram)
- {
- this.showConsensusHistogram = showConsensusHistogram;
- }
-
- /**
- * @return the showGroupConservation
- */
- public boolean isShowGroupConservation()
- {
- return showGroupConservation;
- }
-
- /**
- * @param showGroupConservation
- * the showGroupConservation to set
- */
- public void setShowGroupConservation(boolean showGroupConservation)
- {
- this.showGroupConservation = showGroupConservation;
}
- /**
- * @return the showGroupConsensus
- */
- public boolean isShowGroupConsensus()
- {
- return showGroupConsensus;
- }
-
- /**
- * @param showGroupConsensus
- * the showGroupConsensus to set
- */
- public void setShowGroupConsensus(boolean showGroupConsensus)
- {
- this.showGroupConsensus = showGroupConsensus;
- }
-
- /**
- *
- * @return flag to indicate if the consensus histogram should be rendered by
- * default
- */
- public boolean isShowConsensusHistogram()
- {
- return this.showConsensusHistogram;
- }
-
- /**
- * synthesize a column selection if none exists so it covers the given
- * selection group. if wholewidth is false, no column selection is made if the
- * selection group covers the whole alignment width.
- *
- * @param sg
- * @param wholewidth
- */
- public void expandColSelection(SequenceGroup sg, boolean wholewidth)
- {
- int sgs, sge;
- if (sg != null
- && (sgs = sg.getStartRes()) >= 0
- && sg.getStartRes() <= (sge = sg.getEndRes())
- && (colSel == null || colSel.getSelected() == null || colSel
- .getSelected().size() == 0))
- {
- if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
- {
- // do nothing
- return;
- }
- if (colSel == null)
- {
- colSel = new ColumnSelection();
- }
- for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
- {
- colSel.addElement(cspos);
- }
- }
- }
}
diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java
index 08d1f85..d0088a1 100644
--- a/src/jalview/appletgui/AlignmentPanel.java
+++ b/src/jalview/appletgui/AlignmentPanel.java
@@ -1,32 +1,50 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
-import java.util.Hashtable;
-import java.util.Vector;
-
+import jalview.analysis.AnnotationSorter;
+import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
-import jalview.datamodel.*;
+import jalview.bin.JalviewLite;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceI;
import jalview.structure.StructureSelectionManager;
-public class AlignmentPanel extends Panel implements AdjustmentListener, AlignmentViewPanel
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Panel;
+import java.awt.Scrollbar;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.util.List;
+
+public class AlignmentPanel extends Panel implements AdjustmentListener,
+ AlignmentViewPanel
{
public AlignViewport av;
@@ -49,19 +67,21 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
// this value is set false when selection area being dragged
boolean fastPaint = true;
-
- public void finalize() {
- alignFrame=null;
- av=null;
- seqPanel=null;
- seqPanelHolder=null;
- sequenceHolderPanel=null;
- scalePanel=null;
- scalePanelHolder=null;
- annotationPanel=null;
- annotationPanelHolder=null;
- annotationSpaceFillerHolder=null;
+
+ public void finalize()
+ {
+ alignFrame = null;
+ av = null;
+ seqPanel = null;
+ seqPanelHolder = null;
+ sequenceHolderPanel = null;
+ scalePanel = null;
+ scalePanelHolder = null;
+ annotationPanel = null;
+ annotationPanelHolder = null;
+ annotationSpaceFillerHolder = null;
}
+
public AlignmentPanel(AlignFrame af, final AlignViewport av)
{
try
@@ -82,10 +102,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
annotationPanelHolder.add(annotationPanel, BorderLayout.CENTER);
sequenceHolderPanel.add(annotationPanelHolder, BorderLayout.SOUTH);
-
alabels = new AnnotationLabels(this);
- setAnnotationVisible(av.showAnnotation);
+ setAnnotationVisible(av.isShowAnnotation());
idPanelHolder.add(idPanel, BorderLayout.CENTER);
idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);
@@ -105,12 +124,14 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
public void componentResized(ComponentEvent evt)
{
setScrollValues(av.getStartRes(), av.getStartSeq());
- if (getSize().height>0 && annotationPanelHolder.getSize().height>0) {
+ if (getSize().height > 0
+ && annotationPanelHolder.getSize().height > 0)
+ {
validateAnnotationDimensions(false);
}
repaint();
}
-
+
});
Dimension d = calculateIdWidth();
@@ -134,7 +155,12 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
}
}
});
+ }
+ @Override
+ public AlignViewportI getAlignViewport()
+ {
+ return av;
}
public SequenceRenderer getSequenceRenderer()
@@ -142,11 +168,20 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
return seqPanel.seqCanvas.sr;
}
- public FeatureRenderer getFeatureRenderer()
+ @Override
+ public jalview.api.FeatureRenderer getFeatureRenderer()
{
return seqPanel.seqCanvas.fr;
}
+ @Override
+ public jalview.api.FeatureRenderer cloneFeatureRenderer()
+ {
+ FeatureRenderer nfr = new FeatureRenderer(av);
+ nfr.transferSettings(seqPanel.seqCanvas.fr);
+ return nfr;
+ }
+
public void alignmentChanged()
{
av.alignmentChanged(this);
@@ -168,8 +203,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
idPanel.idCanvas.image = null;
FontMetrics fm = getFontMetrics(av.getFont());
- scalePanel.setSize(new Dimension(10, av.charHeight + fm.getDescent()));
- idwidthAdjuster.setSize(new Dimension(10, av.charHeight
+ scalePanel.setSize(new Dimension(10, av.getCharHeight()
+ + fm.getDescent()));
+ idwidthAdjuster.setSize(new Dimension(10, av.getCharHeight()
+ fm.getDescent()));
av.updateSequenceIdColours();
annotationPanel.image = null;
@@ -177,10 +213,10 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
Dimension d = calculateIdWidth();
d.setSize(d.width + 4, seqPanel.seqCanvas.getSize().height);
alabels.setSize(d.width + 4, ap);
-
+
idPanel.idCanvas.setSize(d);
hscrollFillerPanel.setSize(d);
-
+
validateAnnotationDimensions(false);
annotationPanel.repaint();
validate();
@@ -196,7 +232,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
{
idPanel.idCanvas.setSize(w, h);
idPanelHolder.setSize(w, idPanelHolder.getSize().height);
- annotationSpaceFillerHolder.setSize(w,annotationSpaceFillerHolder.getSize().height);
+ annotationSpaceFillerHolder.setSize(w,
+ annotationSpaceFillerHolder.getSize().height);
alabels.setSize(w, alabels.getSize().height);
validate();
}
@@ -282,34 +319,66 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
public boolean scrollToPosition(SearchResults results,
boolean redrawOverview)
{
-
+ return scrollToPosition(results, redrawOverview, false);
+ }
+
+ /**
+ * scroll the view to show the position of the highlighted region in results
+ * (if any)
+ *
+ * @param results
+ * @param redrawOverview
+ * - when set, the overview will be recalculated (takes longer)
+ * @return false if results were not found
+ */
+ public boolean scrollToPosition(SearchResults results,
+ boolean redrawOverview, boolean centre)
+ {
// do we need to scroll the panel?
if (results != null && results.getSize() > 0)
{
- int seqIndex = av.alignment.findIndex(results);
+ AlignmentI alignment = av.getAlignment();
+ int seqIndex = alignment.findIndex(results);
if (seqIndex == -1)
{
return false;
}
- SequenceI seq = av.alignment.getSequenceAt(seqIndex);
- int[] r = results.getResults(seq, 0,av.alignment.getWidth());
+ SequenceI seq = alignment.getSequenceAt(seqIndex);
+ int[] r = results.getResults(seq, 0, alignment.getWidth());
if (r == null)
{
- if (av.applet.debug) {// DEBUG
- System.out.println("DEBUG: scroll didn't happen - results not within alignment : "+seq.getStart()+","+seq.getEnd());
+ if (JalviewLite.debug)
+ {// DEBUG
+ System.out
+ .println("DEBUG: scroll didn't happen - results not within alignment : "
+ + seq.getStart() + "," + seq.getEnd());
}
return false;
}
- if (av.applet.debug) {
+ if (JalviewLite.debug)
+ {
// DEBUG
- /*System.out.println("DEBUG: scroll: start=" + r[0]
- + " av.getStartRes()=" + av.getStartRes() + " end=" + r[1]
- + " seq.end=" + seq.getEnd() + " av.getEndRes()="
- + av.getEndRes() + " hextent=" + hextent);
+ /*
+ * System.out.println("DEBUG: scroll: start=" + r[0] +
+ * " av.getStartRes()=" + av.getStartRes() + " end=" + r[1] +
+ * " seq.end=" + seq.getEnd() + " av.getEndRes()=" + av.getEndRes() +
+ * " hextent=" + hextent);
*/
}
int start = r[0];
int end = r[1];
+
+ /*
+ * To centre results, scroll to positions half the visible width
+ * left/right of the start/end positions
+ */
+ if (centre)
+ {
+ int offset = (av.getEndRes() - av.getStartRes() + 1) / 2 - 1;
+ start = Math.max(start - offset, 0);
+ end = Math.min(end + offset, seq.getEnd() - 1);
+ }
+
if (start < 0)
{
return false;
@@ -322,18 +391,20 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
}
return true;
}
- public boolean scrollTo(int ostart, int end, int seqIndex, boolean scrollToNearest, boolean redrawOverview)
+
+ public boolean scrollTo(int ostart, int end, int seqIndex,
+ boolean scrollToNearest, boolean redrawOverview)
{
- int startv, endv, starts, ends, width;
+ int startv, endv, starts, ends, width;
- int start=-1;
- if (av.hasHiddenColumns)
+ int start = -1;
+ if (av.hasHiddenColumns())
{
start = av.getColumnSelection().findColumnPosition(ostart);
end = av.getColumnSelection().findColumnPosition(end);
if (start == end)
{
- if (!scrollToNearest && !av.colSel.isVisible(ostart))
+ if (!scrollToNearest && !av.getColumnSelection().isVisible(ostart))
{
// don't scroll - position isn't visible
return false;
@@ -344,60 +415,80 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
{
start = ostart;
}
- if (!av.wrapAlignment)
- {
- /*
- int spos=av.getStartRes(),sqpos=av.getStartSeq();
- if ((startv = av.getStartRes()) >= start)
- {
- spos=start-1;
-// seqIn
-// setScrollValues(start - 1, seqIndex);
- }
- else if ((endv = av.getEndRes()) <= end)
- {
-// setScrollValues(spos=startv + 1 + end - endv, seqIndex);
- spos=startv + 1 + end - endv;
- }
- else if ((starts = av.getStartSeq()) > seqIndex)
- {
- setScrollValues(av.getStartRes(), seqIndex);
- }
- else if ((ends = av.getEndSeq()) <= seqIndex)
- {
- setScrollValues(av.getStartRes(), starts + seqIndex - ends + 1);
- }
-
- /* */
- if ((av.getStartRes() > end)
- || (av.getEndRes() < start)
- || ((av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex)))
- {
- if (start > av.alignment.getWidth() - hextent)
- {
- start = av.alignment.getWidth() - hextent;
- if (start < 0)
- {
- start = 0;
- }
-
- }
- if (seqIndex > av.alignment.getHeight() - vextent)
- {
- seqIndex = av.alignment.getHeight() - vextent;
- if (seqIndex < 0)
- {
- seqIndex = 0;
- }
- }
- // System.out.println("trying to scroll to: "+start+" "+seqIndex);
- setScrollValues(start, seqIndex);
- }/**/
+ if (!av.getWrapAlignment())
+ {
+ /*
+ * int spos=av.getStartRes(),sqpos=av.getStartSeq(); if ((startv =
+ * av.getStartRes()) >= start) { spos=start-1; // seqIn //
+ * setScrollValues(start - 1, seqIndex); } else if ((endv =
+ * av.getEndRes()) <= end) { // setScrollValues(spos=startv + 1 + end -
+ * endv, seqIndex); spos=startv + 1 + end - endv; } else if ((starts =
+ * av.getStartSeq()) > seqIndex) { setScrollValues(av.getStartRes(),
+ * seqIndex); } else if ((ends = av.getEndSeq()) <= seqIndex) {
+ * setScrollValues(av.getStartRes(), starts + seqIndex - ends + 1); }
+ */
+
+ // below is scrolling logic up to Jalview 2.8.2
+ // if ((av.getStartRes() > end)
+ // || (av.getEndRes() < start)
+ // || ((av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex)))
+ // {
+ // if (start > av.getAlignment().getWidth() - hextent)
+ // {
+ // start = av.getAlignment().getWidth() - hextent;
+ // if (start < 0)
+ // {
+ // start = 0;
+ // }
+ //
+ // }
+ // if (seqIndex > av.getAlignment().getHeight() - vextent)
+ // {
+ // seqIndex = av.getAlignment().getHeight() - vextent;
+ // if (seqIndex < 0)
+ // {
+ // seqIndex = 0;
+ // }
+ // }
+ // setScrollValues(start, seqIndex);
+ // }
+ // logic copied from jalview.gui.AlignmentPanel:
+ if ((startv = av.getStartRes()) >= start)
+ {
+ /*
+ * Scroll left to make start of search results visible
+ */
+ setScrollValues(start - 1, seqIndex);
}
- else
+ else if ((endv = av.getEndRes()) <= end)
+ {
+ /*
+ * Scroll right to make end of search results visible
+ */
+ setScrollValues(startv + 1 + end - endv, seqIndex);
+ }
+ else if ((starts = av.getStartSeq()) > seqIndex)
+ {
+ /*
+ * Scroll up to make start of search results visible
+ */
+ setScrollValues(av.getStartRes(), seqIndex);
+ }
+ else if ((ends = av.getEndSeq()) <= seqIndex)
{
- scrollToWrappedVisible(start);
+ /*
+ * Scroll down to make end of search results visible
+ */
+ setScrollValues(av.getStartRes(), starts + seqIndex - ends + 1);
}
+ /*
+ * Else results are already visible - no need to scroll
+ */
+ }
+ else
+ {
+ scrollToWrappedVisible(start);
+ }
if (redrawOverview && overviewPanel != null)
{
overviewPanel.setBoxPosition();
@@ -429,15 +520,20 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
public void setAnnotationVisible(boolean b)
{
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
annotationSpaceFillerHolder.setVisible(b);
annotationPanelHolder.setVisible(b);
}
+ else
+ {
+ annotationSpaceFillerHolder.setVisible(false);
+ annotationPanelHolder.setVisible(false);
+ }
validate();
repaint();
}
-
+
/**
* automatically adjust annotation panel height for new annotation whilst
* ensuring the alignment is still visible.
@@ -448,7 +544,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
// this is called after loading new annotation onto alignment
if (alignFrame.getSize().height == 0)
{
- System.out.println("NEEDS FIXING");
+ System.out
+ .println("adjustAnnotationHeight frame size zero NEEDS FIXING");
}
fontChanged();
validateAnnotationDimensions(true);
@@ -457,55 +554,66 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
validate();
paintAlignment(true);
}
+
/**
- * calculate the annotation dimensions and refresh slider values accordingly.
- * need to do repaints/notifys afterwards.
+ * Calculate the annotation dimensions and refresh slider values accordingly.
+ * Need to do repaints/notifys afterwards.
*/
- protected void validateAnnotationDimensions(boolean adjustPanelHeight) {
- boolean modified=false;
- int height = annotationPanel.calcPanelHeight();
- int minsize=0;
- if (hscroll.isVisible())
- {
- height += (minsize=hscroll.getPreferredSize().height);
- }
- if (apvscroll.isVisible()) {
- minsize+=apvscroll.getPreferredSize().height;
- }
- int mheight = height;
- Dimension d=sequenceHolderPanel.getSize(),e=idPanel.getSize();
- int seqandannot=d.height-scalePanelHolder.getSize().height;
- // sets initial preferred height
- if ((height+40) > seqandannot / 2)
+ protected void validateAnnotationDimensions(boolean adjustPanelHeight)
+ {
+ int rowHeight = av.getCharHeight();
+ int alignmentHeight = rowHeight * av.getAlignment().getHeight();
+ int annotationHeight = av.calcPanelHeight();
+
+ int mheight = annotationHeight;
+ Dimension d = sequenceHolderPanel.getSize();
+
+ int availableHeight = d.height - scalePanelHolder.getHeight();
+
+ if (adjustPanelHeight)
{
- height = seqandannot / 2;
+ /*
+ * If not enough vertical space, maximize annotation height while keeping
+ * at least two rows of alignment visible
+ */
+ if (annotationHeight + alignmentHeight > availableHeight)
+ {
+ annotationHeight = Math.min(annotationHeight, availableHeight - 2
+ * rowHeight);
+ }
}
- if (!adjustPanelHeight)
+ else
{
// maintain same window layout whilst updating sliders
- height=annotationPanelHolder.getSize().height;
+ annotationHeight = annotationPanelHolder.getSize().height;
}
-
- if (seqandannot-height<5)
+
+ if (availableHeight - annotationHeight < 5)
{
- height = seqandannot;
+ annotationHeight = availableHeight;
}
- annotationPanel.setSize(new Dimension(d.width,height));
- alabels.setSize(new Dimension(e.width,height));
- annotationSpaceFillerHolder.setSize(new Dimension(e.width, height));
- annotationPanelHolder.setSize(new Dimension(d.width, height));
- seqPanelHolder.setSize(d.width,seqandannot-height);
- seqPanel.seqCanvas.setSize(d.width, seqPanel.seqCanvas.getSize().height);
- int s=apvscroll.getValue();
- if (s>mheight-height)
+
+ annotationPanel.setSize(new Dimension(d.width, annotationHeight));
+ annotationPanelHolder.setSize(new Dimension(d.width, annotationHeight));
+ // seqPanelHolder.setSize(d.width, seqandannot - height);
+ seqPanel.seqCanvas
+ .setSize(d.width, seqPanel.seqCanvas.getSize().height);
+
+ Dimension e = idPanel.getSize();
+ alabels.setSize(new Dimension(e.width, annotationHeight));
+ annotationSpaceFillerHolder.setSize(new Dimension(e.width,
+ annotationHeight));
+
+ int s = apvscroll.getValue();
+ if (s > mheight - annotationHeight)
{
s = 0;
}
- apvscroll.setValues(s, height, 0, mheight);
- annotationPanel.setScrollOffset(apvscroll.getValue());
- alabels.setScrollOffset(apvscroll.getValue());
+ apvscroll.setValues(s, annotationHeight, 0, mheight);
+ annotationPanel.setScrollOffset(apvscroll.getValue(), false);
+ alabels.setScrollOffset(apvscroll.getValue(), false);
}
-
+
public void setWrapAlignment(boolean wrap)
{
av.startSeq = 0;
@@ -520,7 +628,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
annotationPanelHolder.setVisible(false);
annotationSpaceFillerHolder.setVisible(false);
}
- else if (av.showAnnotation)
+ else if (av.isShowAnnotation())
{
annotationPanelHolder.setVisible(true);
annotationSpaceFillerHolder.setVisible(true);
@@ -531,6 +639,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
fontChanged(); // This is so that the scalePanel is resized correctly
validate();
+ sequenceHolderPanel.validate();
repaint();
}
@@ -588,18 +697,22 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
public void setScrollValues(int x, int y)
{
- int width = av.alignment.getWidth();
- int height = av.alignment.getHeight();
+ int width = av.getAlignment().getWidth();
+ int height = av.getAlignment().getHeight();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
width = av.getColumnSelection().findColumnPosition(width);
}
- if (x<0) { x = 0; };
+ if (x < 0)
+ {
+ x = 0;
+ }
+ ;
+
+ hextent = seqPanel.seqCanvas.getSize().width / av.getCharWidth();
+ vextent = seqPanel.seqCanvas.getSize().height / av.getCharHeight();
- hextent = seqPanel.seqCanvas.getSize().width / av.charWidth;
- vextent = seqPanel.seqCanvas.getSize().height / av.charHeight;
-
if (hextent > width)
{
hextent = width;
@@ -612,7 +725,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
if ((hextent + x) > width)
{
- System.err.println("hextent was "+hextent+" and x was "+x);
+ System.err.println("hextent was " + hextent + " and x was " + x);
x = width - hextent;
}
@@ -629,21 +742,22 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
if (x < 0)
{
- System.err.println("x was "+x);
+ System.err.println("x was " + x);
x = 0;
}
av.setStartSeq(y);
int endSeq = y + vextent;
- if (endSeq > av.alignment.getHeight())
+ if (endSeq > av.getAlignment().getHeight())
{
- endSeq = av.alignment.getHeight();
+ endSeq = av.getAlignment().getHeight();
}
av.setEndSeq(endSeq);
av.setStartRes(x);
- av.setEndRes((x + (seqPanel.seqCanvas.getSize().width / av.charWidth)) - 1);
+ av.setEndRes((x + (seqPanel.seqCanvas.getSize().width / av
+ .getCharWidth())) - 1);
hscroll.setValues(x, hextent, 0, width);
vscroll.setValues(y, vextent, 0, height);
@@ -654,7 +768,6 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
}
sendViewPosition();
-
}
public void adjustmentValueChanged(AdjustmentEvent evt)
@@ -664,8 +777,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
if (evt == null || evt.getSource() == apvscroll)
{
- annotationPanel.setScrollOffset(apvscroll.getValue());
- alabels.setScrollOffset(apvscroll.getValue());
+ annotationPanel.setScrollOffset(apvscroll.getValue(), false);
+ alabels.setScrollOffset(apvscroll.getValue(), false);
// annotationPanel.image=null;
// alabels.image=null;
// alabels.repaint();
@@ -726,27 +839,128 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
seqPanel.seqCanvas.fastPaint(scrollX, scrollY);
scalePanel.repaint();
- if (av.getShowAnnotation())
+ if (av.isShowAnnotation())
{
annotationPanel.fastPaint(av.getStartRes() - oldX);
}
}
sendViewPosition();
+ /*
+ * If there is one, scroll the (Protein/cDNA) complementary alignment to
+ * match, unless we are ourselves doing that.
+ */
+ if (isFollowingComplementScroll())
+ {
+ setFollowingComplementScroll(false);
+ }
+ else
+ {
+ AlignmentPanel ap = getComplementPanel();
+ av.scrollComplementaryAlignment(ap);
+ }
+
+ }
+
+ /**
+ * A helper method to return the AlignmentPanel in the other (complementary)
+ * half of a SplitFrame view. Returns null if not in a SplitFrame.
+ *
+ * @return
+ */
+ private AlignmentPanel getComplementPanel()
+ {
+ AlignmentPanel ap = null;
+ if (alignFrame != null)
+ {
+ SplitFrame sf = alignFrame.getSplitFrame();
+ if (sf != null)
+ {
+ AlignFrame other = sf.getComplement(alignFrame);
+ if (other != null)
+ {
+ ap = other.alignPanel;
+ }
+ }
+ }
+ return ap;
}
+
+ /**
+ * Follow a scrolling change in the (cDNA/Protein) complementary alignment.
+ * The aim is to keep the two alignments 'lined up' on their centre columns.
+ *
+ * @param sr
+ * holds mapped region(s) of this alignment that we are scrolling
+ * 'to'; may be modified for sequence offset by this method
+ * @param seqOffset
+ * the number of visible sequences to show above the mapped region
+ */
+ protected void scrollToCentre(SearchResults sr, int seqOffset)
+ {
+ /*
+ * To avoid jumpy vertical scrolling (if some sequences are gapped or not
+ * mapped), we can make the scroll-to location a sequence above the one
+ * actually mapped.
+ */
+ SequenceI mappedTo = sr.getResultSequence(0);
+ List<SequenceI> seqs = av.getAlignment().getSequences();
+
+ /*
+ * This is like AlignmentI.findIndex(seq) but here we are matching the
+ * dataset sequence not the aligned sequence
+ */
+ int sequenceIndex = 0;
+ boolean matched = false;
+ for (SequenceI seq : seqs)
+ {
+ if (mappedTo == seq.getDatasetSequence())
+ {
+ matched = true;
+ break;
+ }
+ sequenceIndex++;
+ }
+ if (!matched)
+ {
+ return; // failsafe, shouldn't happen
+ }
+ sequenceIndex = Math.max(0, sequenceIndex - seqOffset);
+ sr.getResults().get(0)
+ .setSequence(av.getAlignment().getSequenceAt(sequenceIndex));
+
+ /*
+ * Scroll to position but centring the target residue. Also set a state flag
+ * to prevent adjustmentValueChanged performing this recursively.
+ */
+ setFollowingComplementScroll(true);
+ scrollToPosition(sr, true, true);
+ }
+
private void sendViewPosition()
{
- StructureSelectionManager.getStructureSelectionManager(av.applet).sendViewPosition(this, av.startRes, av.endRes, av.startSeq, av.endSeq);
+ StructureSelectionManager.getStructureSelectionManager(av.applet)
+ .sendViewPosition(this, av.startRes, av.endRes, av.startSeq,
+ av.endSeq);
}
+ /**
+ * Repaint the alignment and annotations, and, optionally, any overview window
+ */
public void paintAlignment(boolean updateOverview)
{
+ final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
+ av.isShowAutocalculatedAbove());
+ sorter.sort(getAlignment().getAlignmentAnnotation(),
+ av.getSortAnnotationsBy());
repaint();
if (updateOverview)
{
+ // TODO: determine if this paintAlignment changed structure colours
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager(av.applet).sequenceColoursChanged(this);
+ .getStructureSelectionManager(av.applet)
+ .sequenceColoursChanged(this);
if (overviewPanel != null)
{
@@ -764,13 +978,17 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
{
invalidate();
Dimension d = idPanel.idCanvas.getSize();
- idPanel.idCanvas.setSize(d.width, seqPanel.seqCanvas.getSize().height);
-
+ final int canvasHeight = seqPanel.seqCanvas.getSize().height;
+ if (canvasHeight != d.height)
+ {
+ idPanel.idCanvas.setSize(d.width, canvasHeight);
+ }
+
if (av.getWrapAlignment())
{
- int maxwidth = av.alignment.getWidth();
+ int maxwidth = av.getAlignment().getWidth();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
@@ -791,12 +1009,18 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
setScrollValues(av.getStartRes(), av.getStartSeq());
}
- alabels.repaint();
-
seqPanel.seqCanvas.repaint();
- scalePanel.repaint();
- annotationPanel.repaint();
idPanel.idCanvas.repaint();
+ if (!av.getWrapAlignment())
+ {
+ if (av.isShowAnnotation())
+ {
+ alabels.repaint();
+ annotationPanel.repaint();
+ }
+ scalePanel.repaint();
+ }
+
}
protected Panel sequenceHolderPanel = new Panel();
@@ -807,72 +1031,58 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
protected Panel seqPanelHolder = new Panel();
- BorderLayout borderLayout1 = new BorderLayout();
-
- BorderLayout borderLayout3 = new BorderLayout();
-
protected Panel scalePanelHolder = new Panel();
protected Panel idPanelHolder = new Panel();
- BorderLayout borderLayout5 = new BorderLayout();
-
protected Panel idSpaceFillerPanel1 = new Panel();
public Panel annotationSpaceFillerHolder = new Panel();
- BorderLayout borderLayout6 = new BorderLayout();
-
- BorderLayout borderLayout7 = new BorderLayout();
-
- Panel hscrollHolder = new Panel();
-
- BorderLayout borderLayout10 = new BorderLayout();
-
protected Panel hscrollFillerPanel = new Panel();
- BorderLayout borderLayout11 = new BorderLayout();
-
- BorderLayout borderLayout4 = new BorderLayout();
-
- BorderLayout borderLayout2 = new BorderLayout();
-
Panel annotationPanelHolder = new Panel();
protected Scrollbar apvscroll = new Scrollbar();
- BorderLayout borderLayout12 = new BorderLayout();
+ /*
+ * Flag set while scrolling to follow complementary cDNA/protein scroll. When
+ * true, suppresses invoking the same method recursively.
+ */
+ private boolean followingComplementScroll;
private void jbInit() throws Exception
{
// idPanelHolder.setPreferredSize(new Dimension(70, 10));
- this.setLayout(borderLayout7);
+ this.setLayout(new BorderLayout());
- //sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));
- sequenceHolderPanel.setLayout(borderLayout3);
- seqPanelHolder.setLayout(borderLayout1);
+ // sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));
+ sequenceHolderPanel.setLayout(new BorderLayout());
+ seqPanelHolder.setLayout(new BorderLayout());
scalePanelHolder.setBackground(Color.white);
// scalePanelHolder.setPreferredSize(new Dimension(10, 30));
- scalePanelHolder.setLayout(borderLayout6);
- idPanelHolder.setLayout(borderLayout5);
+ scalePanelHolder.setLayout(new BorderLayout());
+ idPanelHolder.setLayout(new BorderLayout());
idSpaceFillerPanel1.setBackground(Color.white);
// idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));
- idSpaceFillerPanel1.setLayout(borderLayout11);
+ idSpaceFillerPanel1.setLayout(new BorderLayout());
annotationSpaceFillerHolder.setBackground(Color.white);
// annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));
- annotationSpaceFillerHolder.setLayout(borderLayout4);
+ annotationSpaceFillerHolder.setLayout(new BorderLayout());
hscroll.setOrientation(Scrollbar.HORIZONTAL);
- hscrollHolder.setLayout(borderLayout10);
+
+ Panel hscrollHolder = new Panel();
+ hscrollHolder.setLayout(new BorderLayout());
hscrollFillerPanel.setBackground(Color.white);
apvscroll.setOrientation(Scrollbar.VERTICAL);
apvscroll.setVisible(true);
apvscroll.addAdjustmentListener(this);
annotationPanelHolder.setBackground(Color.white);
- annotationPanelHolder.setLayout(borderLayout12);
+ annotationPanelHolder.setLayout(new BorderLayout());
annotationPanelHolder.add(apvscroll, BorderLayout.EAST);
// hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));
hscrollHolder.setBackground(Color.white);
@@ -905,79 +1115,57 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
public void updateAnnotation(boolean applyGlobalSettings)
{
- // TODO: this should be merged with other annotation update stuff - that
- // sits on AlignViewport
- boolean updateCalcs = false;
- boolean conv = av.isShowGroupConservation();
- boolean cons = av.isShowGroupConsensus();
- boolean showprf = av.isShowSequenceLogo();
- boolean showConsHist = av.isShowConsensusHistogram();
-
- boolean sortg = true;
-
- // remove old automatic annotation
- // add any new annotation
-
- Vector gr = av.alignment.getGroups(); // OrderedBy(av.alignment.getSequencesArray());
- // intersect alignment annotation with alignment groups
+ updateAnnotation(applyGlobalSettings, false);
+ }
- AlignmentAnnotation[] aan = av.alignment.getAlignmentAnnotation();
- Hashtable oldrfs = new Hashtable();
- if (aan != null)
- {
- for (int an = 0; an < aan.length; an++)
- {
- if (aan[an].autoCalculated && aan[an].groupRef != null)
- {
- oldrfs.put(aan[an].groupRef, aan[an].groupRef);
- av.alignment.deleteAnnotation(aan[an]);
- aan[an] = null;
- }
- }
- }
- SequenceGroup sg;
- if (gr != null)
- {
- for (int g = 0; g < gr.size(); g++)
- {
- updateCalcs = false;
- sg = (SequenceGroup) gr.elementAt(g);
- if (applyGlobalSettings || !oldrfs.containsKey(sg))
- {
- // set defaults for this group's conservation/consensus
- sg.setshowSequenceLogo(showprf);
- sg.setShowConsensusHistogram(showConsHist);
- }
- if (conv)
- {
- updateCalcs = true;
- av.alignment.addAnnotation(sg.getConservationRow(), 0);
- }
- if (cons)
- {
- updateCalcs = true;
- av.alignment.addAnnotation(sg.getConsensus(), 0);
- }
- // refresh the annotation rows
- if (updateCalcs)
- {
- sg.recalcConservation();
- }
- }
- }
- oldrfs.clear();
+ public void updateAnnotation(boolean applyGlobalSettings,
+ boolean preserveNewGroupSettings)
+ {
+ av.updateGroupAnnotationSettings(applyGlobalSettings,
+ preserveNewGroupSettings);
adjustAnnotationHeight();
}
@Override
public AlignmentI getAlignment()
{
- return av.alignment;
+ return av.getAlignment();
}
+
+ @Override
+ public String getViewName()
+ {
+ return getName();
+ }
+
@Override
public StructureSelectionManager getStructureSelectionManager()
{
- return StructureSelectionManager.getStructureSelectionManager(av.applet);
+ return StructureSelectionManager
+ .getStructureSelectionManager(av.applet);
+ }
+
+ @Override
+ public void raiseOOMWarning(String string, OutOfMemoryError error)
+ {
+ // TODO: JAL-960
+ System.err.println("Out of memory whilst '" + string + "'");
+ error.printStackTrace();
+ }
+
+ /**
+ * Set a flag to say we are scrolling to follow a (cDNA/protein) complement.
+ *
+ * @param b
+ */
+ protected void setFollowingComplementScroll(boolean b)
+ {
+ this.followingComplementScroll = b;
+ }
+
+ protected boolean isFollowingComplementScroll()
+ {
+ return this.followingComplementScroll;
}
}
diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java
index 5463ed8..9df3b73 100644
--- a/src/jalview/appletgui/AnnotationColourChooser.java
+++ b/src/jalview/appletgui/AnnotationColourChooser.java
@@ -1,32 +1,52 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import java.awt.Rectangle;
-
-import javax.swing.BoxLayout;
+import jalview.datamodel.SequenceGroup;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.ColourSchemeI;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Checkbox;
+import java.awt.Choice;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.Scrollbar;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.Hashtable;
+import java.util.Vector;
public class AnnotationColourChooser extends Panel implements
ActionListener, AdjustmentListener, ItemListener, MouseListener
@@ -55,14 +75,11 @@ public class AnnotationColourChooser extends Panel implements
}
oldcs = av.getGlobalColourScheme();
- if (av.alignment.getGroups() != null)
+ if (av.getAlignment().getGroups() != null)
{
oldgroupColours = new Hashtable();
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ for (SequenceGroup sg : ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.elementAt(g);
if (sg.cs != null)
{
oldgroupColours.put(sg, sg.cs);
@@ -79,34 +96,40 @@ public class AnnotationColourChooser extends Panel implements
slider.addAdjustmentListener(this);
slider.addMouseListener(this);
- if (av.alignment.getAlignmentAnnotation() == null)
+ if (av.getAlignment().getAlignmentAnnotation() == null)
{
return;
}
setDefaultMinMax();
-
+
+ adjusting = true;
if (oldcs instanceof AnnotationColourGradient)
{
AnnotationColourGradient acg = (AnnotationColourGradient) oldcs;
- currentColours.setState(acg.predefinedColours);
- if (!acg.predefinedColours) {
+ currentColours.setState(acg.isPredefinedColours()
+ || acg.getBaseColour() != null);
+ if (!acg.isPredefinedColours() && acg.getBaseColour() == null)
+ {
minColour.setBackground(acg.getMinColour());
maxColour.setBackground(acg.getMaxColour());
}
+ // seqAssociated.setState(acg.isSeqAssociated());
}
- adjusting = true;
-
Vector list = new Vector();
int index = 1;
- for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
{
- String label = av.alignment.getAlignmentAnnotation()[i].label;
+ String label = av.getAlignment().getAlignmentAnnotation()[i].label;
if (!list.contains(label))
+ {
list.addElement(label);
+ }
else
+ {
list.addElement(label + "_" + (index++));
+ }
}
for (int i = 0; i < list.size(); i++)
@@ -114,29 +137,35 @@ public class AnnotationColourChooser extends Panel implements
annotations.addItem(list.elementAt(i).toString());
}
- threshold.addItem("No Threshold");
- threshold.addItem("Above Threshold");
- threshold.addItem("Below Threshold");
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_no_thereshold"));
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_above_thereshold"));
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_below_thereshold"));
if (oldcs instanceof AnnotationColourGradient)
{
AnnotationColourGradient acg = (AnnotationColourGradient) oldcs;
annotations.select(acg.getAnnotation());
- switch (acg.getAboveThreshold()) {
+ switch (acg.getAboveThreshold())
+ {
case AnnotationColourGradient.NO_THRESHOLD:
- threshold.select("No Threshold");
+ threshold.select(0);
break;
case AnnotationColourGradient.ABOVE_THRESHOLD:
- threshold.select("Above Threshold");
+ threshold.select(1);
break;
case AnnotationColourGradient.BELOW_THRESHOLD:
- threshold.select("Below Threshold");
+ threshold.select(1);
break;
- default:
- throw new Error("Implementation error: don't know about threshold setting for current AnnotationColourGradient.");
+ default:
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_dont_know_thereshold_annotationcolourgradient"));
}
thresholdIsMin.setState(acg.thresholdIsMinMax);
- thresholdValue.setText(""+acg.getAnnotationThreshold());
+ thresholdValue.setText("" + acg.getAnnotationThreshold());
}
adjusting = false;
@@ -145,17 +174,21 @@ public class AnnotationColourChooser extends Panel implements
frame = new Frame();
frame.add(this);
- jalview.bin.JalviewLite.addFrame(frame, "Colour by Annotation", 560,
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.colour_by_annotation"), 560,
175);
validate();
}
private void setDefaultMinMax()
{
- minColour.setBackground(av.applet.getDefaultColourParameter("ANNOTATIONCOLOUR_MIN",Color.orange));
- maxColour.setBackground(av.applet.getDefaultColourParameter("ANNOTATIONCOLOUR_MAX",Color.red));
+ minColour.setBackground(av.applet.getDefaultColourParameter(
+ "ANNOTATIONCOLOUR_MIN", Color.orange));
+ maxColour.setBackground(av.applet.getDefaultColourParameter(
+ "ANNOTATIONCOLOUR_MAX", Color.red));
}
+
public AnnotationColourChooser()
{
try
@@ -170,43 +203,45 @@ public class AnnotationColourChooser extends Panel implements
private void jbInit() throws Exception
{
minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
- minColour.setLabel("Min Colour");
+ minColour.setLabel(MessageManager.getString("label.min_colour"));
minColour.addActionListener(this);
maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
- maxColour.setLabel("Max Colour");
+ maxColour.setLabel(MessageManager.getString("label.max_colour"));
maxColour.addActionListener(this);
thresholdIsMin.addItemListener(this);
- ok.setLabel("OK");
+ ok.setLabel(MessageManager.getString("action.ok"));
ok.addActionListener(this);
- cancel.setLabel("Cancel");
+ cancel.setLabel(MessageManager.getString("action.cancel"));
cancel.addActionListener(this);
- defColours.setLabel("Defaults");
+ defColours.setLabel(MessageManager.getString("action.set_defaults"));
defColours.addActionListener(this);
-
+
annotations.addItemListener(this);
thresholdValue.addActionListener(this);
slider.setBackground(Color.white);
- slider.setPreferredSize(new Dimension(193,21));
+ slider.setPreferredSize(new Dimension(193, 21));
slider.setEnabled(false);
- thresholdValue.setPreferredSize(new Dimension(79,22));
+ thresholdValue.setPreferredSize(new Dimension(79, 22));
thresholdValue.setEnabled(false);
thresholdValue.setColumns(5);
currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
- currentColours.setLabel("Use Original Colours");
+ currentColours.setLabel(MessageManager
+ .getString("label.use_original_colours"));
currentColours.addItemListener(this);
thresholdIsMin.setBackground(Color.white);
- thresholdIsMin.setLabel("Threshold is min/max");
+ thresholdIsMin.setLabel(MessageManager
+ .getString("label.threshold_minmax"));
this.setLayout(borderLayout1);
-
+
jPanel1.setBackground(Color.white);
-
+
jPanel2.setLayout(new FlowLayout());
jPanel2.setBackground(Color.white);
threshold.addItemListener(this);
@@ -216,32 +251,30 @@ public class AnnotationColourChooser extends Panel implements
jPanel4.setLayout(new BorderLayout());
jPanel4.setBackground(Color.white);
-
jPanel1.add(ok);
jPanel1.add(cancel);
-
+
jPanel2.add(annotations);
jPanel2.add(currentColours);
jPanel2.add(minColour);
jPanel2.add(maxColour);
-
-
+
jPanel4.add(thresholdIsMin, BorderLayout.WEST);
jPanel4.add(slider, BorderLayout.CENTER);
jPanel4.add(thresholdValue, BorderLayout.EAST);
-
+
Panel jPanel34 = new Panel();
jPanel34.setLayout(new BorderLayout());
jPanel34.setBackground(Color.white);
jPanel34.add(jPanel2, BorderLayout.NORTH);
jPanel34.add(threshold, BorderLayout.WEST);
jPanel3.add(defColours);
- jPanel34.add(jPanel3, BorderLayout.EAST);
+ jPanel34.add(jPanel3, BorderLayout.EAST);
jPanel34.add(jPanel4, BorderLayout.SOUTH);
-
+
this.add(jPanel34, java.awt.BorderLayout.CENTER);
this.add(jPanel1, java.awt.BorderLayout.SOUTH);
-
+
}
Choice annotations = new Choice();
@@ -253,7 +286,7 @@ public class AnnotationColourChooser extends Panel implements
Button ok = new Button();
Button cancel = new Button();
-
+
Button defColours = new Button();
Panel jPanel1 = new Panel();
@@ -299,11 +332,10 @@ public class AnnotationColourChooser extends Panel implements
}
else if (evt.getSource() == defColours)
{
- defColour_actionPerformed();
+ defColour_actionPerformed();
}
else if (evt.getSource() == ok)
{
- changeColour();
frame.setVisible(false);
}
else if (evt.getSource() == cancel)
@@ -340,14 +372,14 @@ public class AnnotationColourChooser extends Panel implements
{
if (!adjusting)
{
- thresholdValue.setText(((float) slider.getValue() / 1000f) + "");
+ thresholdValue.setText((slider.getValue() / 1000f) + "");
if (currentColours.getState()
&& !(av.getGlobalColourScheme() instanceof AnnotationColourGradient))
{
changeColour();
}
- currentAnnotation.threshold.value = (float) slider.getValue() / 1000f;
+ currentAnnotation.threshold.value = slider.getValue() / 1000f;
ap.paintAlignment(false);
}
}
@@ -380,6 +412,7 @@ public class AnnotationColourChooser extends Panel implements
new UserDefinedColours(this, "Max Colour", maxColour.getBackground());
}
}
+
public void defColour_actionPerformed()
{
setDefaultMinMax();
@@ -387,6 +420,7 @@ public class AnnotationColourChooser extends Panel implements
maxColour.repaint();
changeColour();
}
+
void changeColour()
{
// Check if combobox is still adjusting
@@ -395,15 +429,15 @@ public class AnnotationColourChooser extends Panel implements
return;
}
- currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations
+ currentAnnotation = av.getAlignment().getAlignmentAnnotation()[annotations
.getSelectedIndex()];
int aboveThreshold = -1;
- if (threshold.getSelectedItem().equals("Above Threshold"))
+ if (threshold.getSelectedIndex() == 1)
{
aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD;
}
- else if (threshold.getSelectedItem().equals("Below Threshold"))
+ else if (threshold.getSelectedIndex() == 2)
{
aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;
}
@@ -457,20 +491,18 @@ public class AnnotationColourChooser extends Panel implements
if (currentAnnotation.graphMin == 0f
&& currentAnnotation.graphMax == 0f)
{
- acg.predefinedColours = true;
+ acg.setPredefinedColours(true);
}
acg.thresholdIsMinMax = thresholdIsMin.getState();
av.setGlobalColourScheme(acg);
- if (av.alignment.getGroups() != null)
+ // TODO: per group colour propagation not always desired
+ if (av.getAlignment().getGroups() != null)
{
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ for (SequenceGroup sg : ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.elementAt(g);
if (sg.cs == null)
{
@@ -493,19 +525,17 @@ public class AnnotationColourChooser extends Panel implements
}
// update colours in linked windows
+ ap.alignmentChanged();
ap.paintAlignment(true);
}
void reset()
{
av.setGlobalColourScheme(oldcs);
- if (av.alignment.getGroups() != null)
+ if (av.getAlignment().getGroups() != null)
{
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ for (SequenceGroup sg : ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.elementAt(g);
Object cs = oldgroupColours.get(sg);
if (cs instanceof ColourSchemeI)
{
diff --git a/src/jalview/appletgui/AnnotationColumnChooser.java b/src/jalview/appletgui/AnnotationColumnChooser.java
new file mode 100644
index 0000000..1a68682
--- /dev/null
+++ b/src/jalview/appletgui/AnnotationColumnChooser.java
@@ -0,0 +1,945 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.appletgui;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.util.MessageManager;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
+
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.Checkbox;
+import java.awt.Choice;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.TextEvent;
+import java.awt.event.TextListener;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.swing.JPanel;
+
+//import net.miginfocom.swing.MigLayout;
+
+public class AnnotationColumnChooser extends AnnotationRowFilter implements
+ ActionListener, AdjustmentListener, ItemListener, MouseListener
+{
+
+ private Choice annotations = new Choice();
+
+ private Panel actionPanel = new Panel();
+
+ private TitledPanel thresholdPanel = new TitledPanel();
+
+ private Panel switchableViewsPanel = new Panel(new CardLayout());
+
+ private CardLayout switchableViewsLayout = (CardLayout) (switchableViewsPanel
+ .getLayout());
+
+ private Panel noGraphFilterView = new Panel();
+
+ private Panel graphFilterView = new Panel();
+
+ private Panel annotationComboBoxPanel = new Panel();
+
+ private BorderLayout borderLayout1 = new BorderLayout();
+
+ private BorderLayout gBorderLayout = new BorderLayout();
+
+ private BorderLayout ngBorderLayout = new BorderLayout();
+
+ private Choice threshold = new Choice();
+
+ private StructureFilterPanel gStructureFilterPanel;
+
+ private StructureFilterPanel ngStructureFilterPanel;
+
+ private StructureFilterPanel currentStructureFilterPanel;
+
+ private SearchPanel currentSearchPanel;
+
+ private SearchPanel gSearchPanel;
+
+ private SearchPanel ngSearchPanel;
+
+ private FurtherActionPanel currentFurtherActionPanel;
+
+ private FurtherActionPanel gFurtherActionPanel;
+
+ private FurtherActionPanel ngFurtherActionPanel;
+
+ public static final int ACTION_OPTION_SELECT = 1;
+
+ public static int ACTION_OPTION_HIDE = 2;
+
+ public static String NO_GRAPH_VIEW = "0";
+
+ public static String GRAPH_VIEW = "1";
+
+ private int actionOption = ACTION_OPTION_SELECT;
+
+ private ColumnSelection oldColumnSelection;
+
+ public AnnotationColumnChooser()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap)
+ {
+ super(av, ap);
+ frame = new Frame();
+ frame.add(this);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.select_by_annotation"), 520,
+ 215);
+
+ slider.addAdjustmentListener(this);
+ slider.addMouseListener(this);
+
+ if (av.getAlignment().getAlignmentAnnotation() == null)
+ {
+ return;
+ }
+ setOldColumnSelection(av.getColumnSelection());
+ adjusting = true;
+ Vector list = new Vector();
+ int index = 1;
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ {
+ String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+ if (!list.contains(label))
+ {
+ list.addElement(label);
+ }
+ else
+ {
+ list.addElement(label + "_" + (index++));
+ }
+ }
+
+ for (int i = 0; i < list.size(); i++)
+ {
+ annotations.addItem(list.elementAt(i).toString());
+ }
+
+ populateThresholdComboBox(threshold);
+
+ // restore Object state from the previous session if one exists
+ if (av.getAnnotationColumnSelectionState() != null)
+ {
+ currentSearchPanel = av.getAnnotationColumnSelectionState()
+ .getCurrentSearchPanel();
+ currentStructureFilterPanel = av.getAnnotationColumnSelectionState()
+ .getCurrentStructureFilterPanel();
+ annotations.select(av.getAnnotationColumnSelectionState()
+ .getAnnotations().getSelectedIndex());
+ threshold.select(av.getAnnotationColumnSelectionState()
+ .getThreshold().getSelectedIndex());
+ actionOption = av.getAnnotationColumnSelectionState()
+ .getActionOption();
+ }
+
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ }
+ adjusting = false;
+
+ updateView();
+ frame.invalidate();
+ frame.pack();
+ }
+
+ private void jbInit() throws Exception
+ {
+ ok.setLabel(MessageManager.getString("action.ok"));
+
+ cancel.setLabel(MessageManager.getString("action.cancel"));
+
+ thresholdValue.setEnabled(false);
+ thresholdValue.setColumns(7);
+
+ ok.addActionListener(this);
+ cancel.addActionListener(this);
+ annotations.addItemListener(this);
+ thresholdValue.addActionListener(this);
+ threshold.addItemListener(this);
+
+ slider.setBackground(Color.white);
+ slider.setEnabled(false);
+ slider.setPreferredSize(new Dimension(100, 32));
+
+ thresholdPanel.setBackground(Color.white);
+ // thresholdPanel.setFont(JvSwingUtils.getLabelFont());
+ // thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]"));
+
+ actionPanel.setBackground(Color.white);
+ // actionPanel.setFont(JvSwingUtils.getLabelFont());
+
+ graphFilterView.setLayout(gBorderLayout);
+ graphFilterView.setBackground(Color.white);
+
+ noGraphFilterView.setLayout(ngBorderLayout);
+ noGraphFilterView.setBackground(Color.white);
+
+ annotationComboBoxPanel.setBackground(Color.white);
+ // annotationComboBoxPanel.setFont(JvSwingUtils.getLabelFont());
+
+ gSearchPanel = new SearchPanel(this);
+ ngSearchPanel = new SearchPanel(this);
+ gFurtherActionPanel = new FurtherActionPanel(this);
+ ngFurtherActionPanel = new FurtherActionPanel(this);
+ gStructureFilterPanel = new StructureFilterPanel(this);
+ ngStructureFilterPanel = new StructureFilterPanel(this);
+
+ thresholdPanel.setTitle("Threshold Filter");
+ thresholdPanel.add(getThreshold());
+ thresholdPanel.add(slider);
+ thresholdPanel.add(thresholdValue);
+
+ actionPanel.add(ok);
+ actionPanel.add(cancel);
+
+ JPanel staticPanel = new JPanel();
+ staticPanel.setLayout(new BorderLayout());
+ staticPanel.setBackground(Color.white);
+
+ staticPanel.add(gSearchPanel, java.awt.BorderLayout.NORTH);
+ staticPanel.add(gStructureFilterPanel, java.awt.BorderLayout.SOUTH);
+
+ graphFilterView.add(staticPanel, java.awt.BorderLayout.NORTH);
+ graphFilterView.add(thresholdPanel, java.awt.BorderLayout.CENTER);
+ graphFilterView.add(gFurtherActionPanel, java.awt.BorderLayout.SOUTH);
+
+ noGraphFilterView.add(ngSearchPanel, java.awt.BorderLayout.PAGE_START);
+ noGraphFilterView.add(ngStructureFilterPanel,
+ java.awt.BorderLayout.CENTER);
+ noGraphFilterView.add(ngFurtherActionPanel,
+ java.awt.BorderLayout.CENTER);
+
+ annotationComboBoxPanel.add(getAnnotations());
+ switchableViewsPanel.add(noGraphFilterView,
+ AnnotationColumnChooser.NO_GRAPH_VIEW);
+ switchableViewsPanel.add(graphFilterView,
+ AnnotationColumnChooser.GRAPH_VIEW);
+
+ this.setLayout(borderLayout1);
+ this.add(annotationComboBoxPanel, java.awt.BorderLayout.PAGE_START);
+ this.add(switchableViewsPanel, java.awt.BorderLayout.CENTER);
+ this.add(actionPanel, java.awt.BorderLayout.SOUTH);
+
+ selectedAnnotationChanged();
+ this.validate();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void reset()
+ {
+ if (this.getOldColumnSelection() != null)
+ {
+ av.getColumnSelection().clear();
+
+ if (av.getAnnotationColumnSelectionState() != null)
+ {
+ ColumnSelection oldSelection = av
+ .getAnnotationColumnSelectionState()
+ .getOldColumnSelection();
+ if (oldSelection != null && oldSelection.getHiddenColumns() != null
+ && !oldSelection.getHiddenColumns().isEmpty())
+ {
+ for (Iterator<int[]> itr = oldSelection.getHiddenColumns()
+ .iterator(); itr.hasNext();)
+ {
+ int positions[] = itr.next();
+ av.hideColumns(positions[0], positions[1]);
+ }
+ }
+ av.setColumnSelection(oldSelection);
+ }
+ ap.paintAlignment(true);
+ }
+
+ }
+
+ public void adjustmentValueChanged(AdjustmentEvent evt)
+ {
+ if (!adjusting)
+ {
+ thresholdValue.setText((slider.getValue() / 1000f) + "");
+ valueChanged(!sliderDragging);
+ }
+ }
+
+ protected void addSliderMouseListeners()
+ {
+
+ slider.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mousePressed(MouseEvent e)
+ {
+ sliderDragging = true;
+ super.mousePressed(e);
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e)
+ {
+ sliderDragging = true;
+ super.mouseDragged(e);
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent evt)
+ {
+ if (sliderDragging)
+ {
+ sliderDragging = false;
+ valueChanged(true);
+ }
+ ap.paintAlignment(true);
+ }
+ });
+ }
+
+ public void valueChanged(boolean updateAllAnnotation)
+ {
+ if (slider.isEnabled())
+ {
+ getCurrentAnnotation().threshold.value = slider.getValue() / 1000f;
+ updateView();
+ ap.paintAlignment(false);
+ }
+ }
+
+ public Choice getThreshold()
+ {
+ return threshold;
+ }
+
+ public void setThreshold(Choice threshold)
+ {
+ this.threshold = threshold;
+ }
+
+ public Choice getAnnotations()
+ {
+ return annotations;
+ }
+
+ public void setAnnotations(Choice annotations)
+ {
+ this.annotations = annotations;
+ }
+
+ @Override
+ public void updateView()
+ {
+ // Check if combobox is still adjusting
+ if (adjusting)
+ {
+ return;
+ }
+
+ AnnotationFilterParameter filterParams = new AnnotationFilterParameter();
+ setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[getAnnotations()
+ .getSelectedIndex()]);
+
+ int selectedThresholdItem = getSelectedThresholdItem(getThreshold()
+ .getSelectedIndex());
+
+ slider.setEnabled(true);
+ thresholdValue.setEnabled(true);
+
+ if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD)
+ {
+ slider.setEnabled(false);
+ thresholdValue.setEnabled(false);
+ thresholdValue.setText("");
+ // build filter params
+ }
+ else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD)
+ {
+ if (getCurrentAnnotation().threshold == null)
+ {
+ getCurrentAnnotation()
+ .setThreshold(
+ new jalview.datamodel.GraphLine(
+ (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f,
+ "Threshold", Color.black));
+ }
+
+ adjusting = true;
+ float range = getCurrentAnnotation().graphMax * 1000
+ - getCurrentAnnotation().graphMin * 1000;
+
+ slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000));
+ slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000));
+ slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000));
+ thresholdValue.setText(getCurrentAnnotation().threshold.value + "");
+ // slider.setMajorTickSpacing((int) (range / 10f));
+ slider.setEnabled(true);
+ thresholdValue.setEnabled(true);
+ adjusting = false;
+
+ // build filter params
+ filterParams
+ .setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);
+ if (getCurrentAnnotation().graph != AlignmentAnnotation.NO_GRAPH)
+ {
+ filterParams
+ .setThresholdValue(getCurrentAnnotation().threshold.value);
+
+ if (selectedThresholdItem == AnnotationColourGradient.ABOVE_THRESHOLD)
+ {
+ filterParams
+ .setThresholdType(AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD);
+ }
+ else if (selectedThresholdItem == AnnotationColourGradient.BELOW_THRESHOLD)
+ {
+ filterParams
+ .setThresholdType(AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD);
+ }
+ }
+ }
+
+ if (currentStructureFilterPanel != null)
+ {
+ if (currentStructureFilterPanel.alphaHelix.getState())
+ {
+ filterParams.setFilterAlphaHelix(true);
+ }
+ if (currentStructureFilterPanel.betaStrand.getState())
+ {
+ filterParams.setFilterBetaSheet(true);
+ }
+ if (currentStructureFilterPanel.turn.getState())
+ {
+ filterParams.setFilterTurn(true);
+ }
+ }
+
+ if (currentSearchPanel != null)
+ {
+
+ if (!currentSearchPanel.searchBox.getText().isEmpty())
+ {
+ currentSearchPanel.description.setEnabled(true);
+ currentSearchPanel.displayName.setEnabled(true);
+ filterParams.setRegexString(currentSearchPanel.searchBox.getText());
+ if (currentSearchPanel.displayName.getState())
+ {
+ filterParams
+ .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING);
+ }
+ if (currentSearchPanel.description.getState())
+ {
+ filterParams
+ .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION);
+ }
+ }
+ else
+ {
+ currentSearchPanel.description.setEnabled(false);
+ currentSearchPanel.displayName.setEnabled(false);
+ }
+ }
+
+ av.getColumnSelection().filterAnnotations(
+ getCurrentAnnotation().annotations, filterParams);
+
+ av.showAllHiddenColumns();
+ if (getActionOption() == ACTION_OPTION_HIDE)
+ {
+ av.hideSelectedColumns();
+ }
+
+ filterParams = null;
+ av.setAnnotationColumnSelectionState(this);
+ ap.paintAlignment(true);
+ }
+
+ public ColumnSelection getOldColumnSelection()
+ {
+ return oldColumnSelection;
+ }
+
+ public void setOldColumnSelection(ColumnSelection currentColumnSelection)
+ {
+ if (currentColumnSelection != null)
+ {
+ this.oldColumnSelection = new ColumnSelection(currentColumnSelection);
+ }
+ }
+
+ public FurtherActionPanel getCurrentFutherActionPanel()
+ {
+ return currentFurtherActionPanel;
+ }
+
+ public void setCurrentFutherActionPanel(
+ FurtherActionPanel currentFutherActionPanel)
+ {
+ this.currentFurtherActionPanel = currentFutherActionPanel;
+ }
+
+ public SearchPanel getCurrentSearchPanel()
+ {
+ return currentSearchPanel;
+ }
+
+ public void setCurrentSearchPanel(SearchPanel currentSearchPanel)
+ {
+ this.currentSearchPanel = currentSearchPanel;
+ }
+
+ public int getActionOption()
+ {
+ return actionOption;
+ }
+
+ public void setActionOption(int actionOption)
+ {
+ this.actionOption = actionOption;
+ }
+
+ public StructureFilterPanel getCurrentStructureFilterPanel()
+ {
+ return currentStructureFilterPanel;
+ }
+
+ public void setCurrentStructureFilterPanel(
+ StructureFilterPanel currentStructureFilterPanel)
+ {
+ this.currentStructureFilterPanel = currentStructureFilterPanel;
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ if (e.getSource() == annotations)
+ {
+ selectedAnnotationChanged();
+ }
+ else if (e.getSource() == threshold)
+ {
+ threshold_actionPerformed(null);
+ }
+ }
+
+ public void selectedAnnotationChanged()
+ {
+ String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW;
+ if (av.getAlignment().getAlignmentAnnotation()[getAnnotations()
+ .getSelectedIndex()].graph != AlignmentAnnotation.NO_GRAPH)
+ {
+ currentView = AnnotationColumnChooser.GRAPH_VIEW;
+ }
+
+ gSearchPanel.syncState();
+ gFurtherActionPanel.syncState();
+ gStructureFilterPanel.syncState();
+
+ ngSearchPanel.syncState();
+ ngFurtherActionPanel.syncState();
+ ngStructureFilterPanel.syncState();
+
+ switchableViewsLayout.show(switchableViewsPanel, currentView);
+ updateView();
+ }
+
+ public class FurtherActionPanel extends Panel implements ItemListener
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private Choice furtherAction = new Choice();
+
+ public FurtherActionPanel(AnnotationColumnChooser aColChooser)
+ {
+ this.aColChooser = aColChooser;
+ furtherAction.addItem("Select");
+ furtherAction.addItem("Hide");
+ furtherAction.addItemListener(this);
+ syncState();
+
+ // this.setTitle("Filter Actions");
+ // this.setFont(JvSwingUtils.getLabelFont());
+
+ this.add(furtherAction);
+ }
+
+ public void syncState()
+ {
+ if (aColChooser.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE)
+ {
+ furtherAction.select("Hide");
+ }
+ else
+ {
+ furtherAction.select("Select");
+ }
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ aColChooser.setCurrentFutherActionPanel(this);
+ if (furtherAction.getSelectedItem().equalsIgnoreCase("Select"))
+ {
+ setActionOption(ACTION_OPTION_SELECT);
+ updateView();
+ }
+ else
+ {
+ setActionOption(ACTION_OPTION_HIDE);
+ updateView();
+ }
+
+ }
+ }
+
+ public class StructureFilterPanel extends TitledPanel implements
+ ItemListener
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private Checkbox alphaHelix = new Checkbox();
+
+ private Checkbox betaStrand = new Checkbox();
+
+ private Checkbox turn = new Checkbox();
+
+ private Checkbox all = new Checkbox();
+
+ public StructureFilterPanel(AnnotationColumnChooser aColChooser)
+ {
+ this.aColChooser = aColChooser;
+
+ alphaHelix.setLabel(MessageManager.getString("label.alpha_helix"));
+ alphaHelix.setBackground(Color.white);
+
+ alphaHelix.addItemListener(this);
+
+ betaStrand.setLabel(MessageManager.getString("label.beta_strand"));
+ betaStrand.setBackground(Color.white);
+ betaStrand.addItemListener(this);
+
+ turn.setLabel(MessageManager.getString("label.turn"));
+ turn.setBackground(Color.white);
+ turn.addItemListener(this);
+
+ all.setLabel(MessageManager.getString("label.select_all"));
+ all.setBackground(Color.white);
+ all.addItemListener(this);
+
+ this.setBackground(Color.white);
+ this.setTitle("Structure Filter");
+ // this.setFont(JvSwingUtils.getLabelFont());
+
+ this.add(all);
+ this.add(alphaHelix);
+ this.add(betaStrand);
+ this.add(turn);
+ }
+
+ public void alphaHelix_actionPerformed()
+ {
+ updateSelectAllState();
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void betaStrand_actionPerformed()
+ {
+ updateSelectAllState();
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void turn_actionPerformed()
+ {
+ updateSelectAllState();
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void all_actionPerformed()
+ {
+ if (all.getState())
+ {
+ alphaHelix.setState(true);
+ betaStrand.setState(true);
+ turn.setState(true);
+ }
+ else
+ {
+ alphaHelix.setState(false);
+ betaStrand.setState(false);
+ turn.setState(false);
+ }
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void updateSelectAllState()
+ {
+ if (alphaHelix.getState() && betaStrand.getState() && turn.getState())
+ {
+ all.setState(true);
+ }
+ else
+ {
+ all.setState(false);
+ }
+ }
+
+ public void syncState()
+ {
+ StructureFilterPanel sfp = aColChooser
+ .getCurrentStructureFilterPanel();
+ if (sfp != null)
+ {
+ alphaHelix.setState(sfp.alphaHelix.getState());
+ betaStrand.setState(sfp.betaStrand.getState());
+ turn.setState(sfp.turn.getState());
+ if (sfp.all.getState())
+ {
+ all.setState(true);
+ alphaHelix.setState(true);
+ betaStrand.setState(true);
+ turn.setState(true);
+ }
+ }
+
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ if (e.getSource() == alphaHelix)
+ {
+ alphaHelix_actionPerformed();
+ }
+ else if (e.getSource() == betaStrand)
+ {
+ betaStrand_actionPerformed();
+ }
+ else if (e.getSource() == turn)
+ {
+ turn_actionPerformed();
+ }
+ else if (e.getSource() == all)
+ {
+ all_actionPerformed();
+ }
+ }
+ }
+
+ public class SearchPanel extends TitledPanel implements ItemListener
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private Checkbox displayName = new Checkbox();
+
+ private Checkbox description = new Checkbox();
+
+ private TextField searchBox = new TextField(10);
+
+ public SearchPanel(AnnotationColumnChooser aColChooser)
+ {
+
+ this.aColChooser = aColChooser;
+ searchBox.addTextListener(new TextListener()
+ {
+
+ @Override
+ public void textValueChanged(TextEvent e)
+ {
+ searchStringAction();
+
+ }
+
+ });
+
+ displayName.setLabel(MessageManager.getString("label.label"));
+ displayName.setEnabled(false);
+ displayName.addItemListener(this);
+
+ description.setLabel(MessageManager.getString("label.description"));
+ description.setEnabled(false);
+ description.addItemListener(this);
+ this.setTitle("Search Filter");
+ // this.setFont(JvSwingUtils.getLabelFont());
+
+ syncState();
+ this.add(searchBox);
+ this.add(displayName);
+ this.add(description);
+ }
+
+ public void displayNameCheckboxAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void discriptionCheckboxAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void searchStringAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void syncState()
+ {
+ SearchPanel sp = aColChooser.getCurrentSearchPanel();
+ if (sp != null)
+ {
+ description.setEnabled(sp.description.isEnabled());
+ description.setState(sp.description.getState());
+
+ displayName.setEnabled(sp.displayName.isEnabled());
+ displayName.setState(sp.displayName.getState());
+
+ searchBox.setText(sp.searchBox.getText());
+ }
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ if (e.getSource() == displayName)
+ {
+ displayNameCheckboxAction();
+ }
+ else if (e.getSource() == description)
+ {
+ discriptionCheckboxAction();
+ }
+
+ }
+ }
+
+ public void actionPerformed(ActionEvent evt)
+ {
+ if (evt.getSource() == thresholdValue)
+ {
+ try
+ {
+ float f = new Float(thresholdValue.getText()).floatValue();
+ slider.setValue((int) (f * 1000));
+ adjustmentValueChanged(null);
+ } catch (NumberFormatException ex)
+ {
+ }
+ }
+
+ else if (evt.getSource() == ok)
+ {
+ ok_actionPerformed(null);
+ }
+ else if (evt.getSource() == cancel)
+ {
+ cancel_actionPerformed(null);
+ }
+ else if (evt.getSource() == thresholdValue)
+ {
+ thresholdValue_actionPerformed(null);
+ }
+ else
+ {
+ updateView();
+ }
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e)
+ {
+ if (e.getSource() == slider)
+ {
+ updateView();
+ }
+
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e)
+ {
+ if (e.getSource() == slider)
+ {
+ updateView();
+ }
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e)
+ {
+ if (e.getSource() == slider)
+ {
+ updateView();
+ }
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e)
+ {
+ if (e.getSource() == slider)
+ {
+ updateView();
+ }
+ }
+
+}
diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java
index 5140024..201cfae 100644
--- a/src/jalview/appletgui/AnnotationLabels.java
+++ b/src/jalview/appletgui/AnnotationLabels.java
@@ -1,31 +1,57 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.BufferedImage;
-
-import jalview.datamodel.*;
+import jalview.analysis.AlignmentUtils;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
import jalview.util.ParseHtmlBodyAndLinks;
+import java.awt.Checkbox;
+import java.awt.CheckboxMenuItem;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.PopupMenu;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Vector;
+
public class AnnotationLabels extends Panel implements ActionListener,
MouseListener, MouseMotionListener
{
@@ -92,10 +118,13 @@ public class AnnotationLabels extends Panel implements ActionListener,
this.av = av;
}
- public void setScrollOffset(int y)
+ public void setScrollOffset(int y, boolean repaint)
{
scrollOffset = y;
- repaint();
+ if (repaint)
+ {
+ repaint();
+ }
}
/**
@@ -107,7 +136,8 @@ public class AnnotationLabels extends Panel implements ActionListener,
int getSelectedRow(int y)
{
int row = -2;
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment()
+ .getAlignmentAnnotation();
if (aa == null)
{
@@ -134,20 +164,20 @@ public class AnnotationLabels extends Panel implements ActionListener,
public void actionPerformed(ActionEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (evt.getActionCommand().equals(ADDNEW))
{
AlignmentAnnotation newAnnotation = new AlignmentAnnotation("", null,
- new Annotation[ap.av.alignment.getWidth()]);
+ new Annotation[ap.av.getAlignment().getWidth()]);
if (!editLabelDescription(newAnnotation))
{
return;
}
- ap.av.alignment.addAnnotation(newAnnotation);
- ap.av.alignment.setAnnotationIndex(newAnnotation, 0);
+ ap.av.getAlignment().addAnnotation(newAnnotation);
+ ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0);
}
else if (evt.getActionCommand().equals(EDITNAME))
{
@@ -183,6 +213,14 @@ public class AnnotationLabels extends Panel implements ActionListener,
}
}
+ refresh();
+ }
+
+ /**
+ * Adjust size and repaint
+ */
+ protected void refresh()
+ {
ap.annotationPanel.adjustPanelHeight();
setSize(getSize().width, ap.annotationPanel.getSize().height);
ap.validate();
@@ -215,7 +253,9 @@ public class AnnotationLabels extends Panel implements ActionListener,
return true;
}
else
+ {
return false;
+ }
}
@@ -228,7 +268,10 @@ public class AnnotationLabels extends Panel implements ActionListener,
if (row > -1)
{
- ParseHtmlBodyAndLinks phb = new ParseHtmlBodyAndLinks(av.alignment.getAlignmentAnnotation()[row].getDescription(true), true, "\n");
+ ParseHtmlBodyAndLinks phb = new ParseHtmlBodyAndLinks(
+ av.getAlignment().getAlignmentAnnotation()[row]
+ .getDescription(true),
+ true, "\n");
if (tooltip == null)
{
tooltip = new Tooltip(phb.getNonHtmlContent(), this);
@@ -278,8 +321,8 @@ public class AnnotationLabels extends Panel implements ActionListener,
.getSize(), f = ap.seqPanelHolder.getSize();
int dif = evt.getY() - oldY;
- dif /= ap.av.charHeight;
- dif *= ap.av.charHeight;
+ dif /= ap.av.getCharHeight();
+ dif *= ap.av.getCharHeight();
if ((d.height - dif) > 20 && (f.height + dif) > 20)
{
@@ -290,7 +333,7 @@ public class AnnotationLabels extends Panel implements ActionListener,
ap.annotationPanelHolder.setSize(new Dimension(d.width, d.height
- dif));
ap.apvscroll.setValues(ap.apvscroll.getValue(), d.height - dif, 0,
- ap.annotationPanel.calcPanelHeight());
+ av.calcPanelHeight());
f.height += dif;
ap.seqPanelHolder.setPreferredSize(f);
ap.setScrollValues(av.getStartRes(), av.getStartSeq());
@@ -334,20 +377,20 @@ public class AnnotationLabels extends Panel implements ActionListener,
int end = getSelectedRow(evt.getY() + scrollOffset);
- if (start>-1 && start != end)
+ if (start > -1 && start != end)
{
// Swap these annotations
- AlignmentAnnotation startAA = ap.av.alignment
+ AlignmentAnnotation startAA = ap.av.getAlignment()
.getAlignmentAnnotation()[start];
if (end == -1)
{
- end = ap.av.alignment.getAlignmentAnnotation().length - 1;
+ end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
}
- AlignmentAnnotation endAA = ap.av.alignment
+ AlignmentAnnotation endAA = ap.av.getAlignment()
.getAlignmentAnnotation()[end];
- ap.av.alignment.getAlignmentAnnotation()[end] = startAA;
- ap.av.alignment.getAlignmentAnnotation()[start] = endAA;
+ ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
+ ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
}
}
resizePanel = false;
@@ -391,17 +434,19 @@ public class AnnotationLabels extends Panel implements ActionListener,
{
return;
}
- dragCancelled=false;
+ dragCancelled = false;
// todo: move below to mouseClicked ?
selectedRow = getSelectedRow(evt.getY() + scrollOffset);
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment()
+ .getAlignmentAnnotation();
// DETECT RIGHT MOUSE BUTTON IN AWT
if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
{
- PopupMenu popup = new PopupMenu("Annotations");
+ PopupMenu popup = new PopupMenu(
+ MessageManager.getString("label.annotations"));
MenuItem item = new MenuItem(ADDNEW);
item.addActionListener(this);
@@ -426,6 +471,32 @@ public class AnnotationLabels extends Panel implements ActionListener,
item = new MenuItem(HIDE);
item.addActionListener(this);
popup.add(item);
+
+ /*
+ * Hide all <label>:
+ */
+ if (selectedRow < aa.length)
+ {
+ if (aa[selectedRow].sequenceRef != null)
+ {
+ final String label = aa[selectedRow].label;
+ MenuItem hideType = new MenuItem(
+ MessageManager.getString("label.hide_all") + " " + label);
+ hideType.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ AlignmentUtils.showOrHideSequenceAnnotations(
+ ap.av.getAlignment(), Collections.singleton(label),
+ null, false, false);
+ refresh();
+ }
+ });
+ popup.add(hideType);
+ }
+ }
+
if (hasHiddenRows)
{
item = new MenuItem(SHOWALL);
@@ -444,10 +515,10 @@ public class AnnotationLabels extends Panel implements ActionListener,
{
popup.addSeparator();
final CheckboxMenuItem cbmi = new CheckboxMenuItem(
- "Ignore Gaps In Consensus",
+ MessageManager.getString("label.ignore_gaps_consensus"),
(aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
.getIgnoreGapsConsensus() : ap.av
- .getIgnoreGapsConsensus());
+ .isIgnoreGapsConsensus());
final AlignmentAnnotation aaa = aa[selectedRow];
cbmi.addItemListener(new ItemListener()
{
@@ -460,7 +531,7 @@ public class AnnotationLabels extends Panel implements ActionListener,
}
else
{
- ap.av.setIgnoreGapsConsensus(cbmi.getState());
+ ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
}
ap.paintAlignment(true);
}
@@ -469,7 +540,8 @@ public class AnnotationLabels extends Panel implements ActionListener,
if (aaa.groupRef != null)
{
final CheckboxMenuItem chist = new CheckboxMenuItem(
- "Show Group Histogram",
+ MessageManager
+ .getString("label.show_group_histogram"),
aa[selectedRow].groupRef.isShowConsensusHistogram());
chist.addItemListener(new ItemListener()
{
@@ -488,7 +560,7 @@ public class AnnotationLabels extends Panel implements ActionListener,
});
popup.add(chist);
final CheckboxMenuItem cprofl = new CheckboxMenuItem(
- "Show Group Logo",
+ MessageManager.getString("label.show_group_logo"),
aa[selectedRow].groupRef.isShowSequenceLogo());
cprofl.addItemListener(new ItemListener()
{
@@ -505,12 +577,35 @@ public class AnnotationLabels extends Panel implements ActionListener,
// ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
}
});
+
popup.add(cprofl);
+ final CheckboxMenuItem cprofn = new CheckboxMenuItem(
+ MessageManager
+ .getString("label.normalise_group_logo"),
+ aa[selectedRow].groupRef.isNormaliseSequenceLogo());
+ cprofn.addItemListener(new ItemListener()
+ {
+ public void itemStateChanged(ItemEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ aaa.groupRef.setshowSequenceLogo(true);
+ aaa.groupRef.setNormaliseSequenceLogo(cprofn.getState());
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ popup.add(cprofn);
}
else
{
final CheckboxMenuItem chist = new CheckboxMenuItem(
- "Show Histogram", av.isShowConsensusHistogram());
+ MessageManager.getString("label.show_histogram"),
+ av.isShowConsensusHistogram());
chist.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent e)
@@ -522,13 +617,18 @@ public class AnnotationLabels extends Panel implements ActionListener,
// can be
// updated.
av.setShowConsensusHistogram(chist.getState());
+ ap.alignFrame.showConsensusHistogram.setState(chist
+ .getState()); // TODO: implement
+ // ap.updateGUI()/alignFrame.updateGUI
+ // for applet
ap.repaint();
// ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
}
});
popup.add(chist);
final CheckboxMenuItem cprof = new CheckboxMenuItem(
- "Show Logo", av.isShowSequenceLogo());
+ MessageManager.getString("label.show_logo"),
+ av.isShowSequenceLogo());
cprof.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent e)
@@ -540,11 +640,41 @@ public class AnnotationLabels extends Panel implements ActionListener,
// can be
// updated.
av.setShowSequenceLogo(cprof.getState());
+ ap.alignFrame.showSequenceLogo.setState(cprof.getState()); // TODO:
+ // implement
+ // ap.updateGUI()/alignFrame.updateGUI
+ // for
+ // applet
ap.repaint();
// ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
}
});
popup.add(cprof);
+ final CheckboxMenuItem cprofn = new CheckboxMenuItem(
+ MessageManager.getString("label.normalise_logo"),
+ av.isNormaliseSequenceLogo());
+ cprofn.addItemListener(new ItemListener()
+ {
+ public void itemStateChanged(ItemEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ av.setShowSequenceLogo(true);
+ ap.alignFrame.normSequenceLogo.setState(cprofn.getState()); // TODO:
+ // implement
+ // ap.updateGUI()/alignFrame.updateGUI
+ // for
+ // applet
+ av.setNormaliseSequenceLogo(cprofn.getState());
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ popup.add(cprofn);
}
item = new MenuItem(COPYCONS_SEQ);
@@ -583,17 +713,48 @@ public class AnnotationLabels extends Panel implements ActionListener,
}
else if (aa[selectedRow].sequenceRef != null)
{
- Vector sr = new Vector();
- sr.addElement(aa[selectedRow].sequenceRef);
if (evt.getClickCount() == 1)
{
- ap.seqPanel.ap.idPanel.highlightSearchResults(sr);
+ ap.seqPanel.ap.idPanel
+ .highlightSearchResults(Arrays
+ .asList(new SequenceI[] { aa[selectedRow].sequenceRef }));
}
else if (evt.getClickCount() >= 2)
{
ap.seqPanel.ap.idPanel.highlightSearchResults(null);
- SequenceGroup sg = new SequenceGroup();
- sg.addSequence(aa[selectedRow].sequenceRef, false);
+ SequenceGroup sg = ap.av.getSelectionGroup();
+ if (sg != null)
+ {
+ // we make a copy rather than edit the current selection if no
+ // modifiers pressed
+ // see Enhancement JAL-1557
+ if (!(evt.isControlDown() || evt.isShiftDown()))
+ {
+ sg = new SequenceGroup(sg);
+ sg.clear();
+ sg.addSequence(aa[selectedRow].sequenceRef, false);
+ }
+ else
+ {
+ if (evt.isControlDown())
+ {
+ sg.addOrRemove(aa[selectedRow].sequenceRef, true);
+ }
+ else
+ {
+ // notionally, we should also add intermediate sequences from
+ // last added sequence ?
+ sg.addSequence(aa[selectedRow].sequenceRef, true);
+ }
+ }
+ }
+ else
+ {
+ sg = new SequenceGroup();
+ sg.setStartRes(0);
+ sg.setEndRes(ap.av.getAlignment().getWidth() - 1);
+ sg.addSequence(aa[selectedRow].sequenceRef, false);
+ }
ap.av.setSelectionGroup(sg);
ap.paintAlignment(false);
PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
@@ -622,17 +783,13 @@ public class AnnotationLabels extends Panel implements ActionListener,
jalview.appletgui.AlignFrame.copiedSequences.append(sq.getName() + "\t"
+ sq.getStart() + "\t" + sq.getEnd() + "\t"
+ sq.getSequenceAsString() + "\n");
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
jalview.appletgui.AlignFrame.copiedHiddenColumns = new Vector();
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
+ for (int[] region : av.getColumnSelection().getHiddenColumns())
{
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns()
- .elementAt(i);
-
jalview.appletgui.AlignFrame.copiedHiddenColumns
- .addElement(new int[]
- { region[0], region[1] });
+ .addElement(new int[] { region[0], region[1] });
}
}
}
@@ -646,7 +803,8 @@ public class AnnotationLabels extends Panel implements ActionListener,
{
int w = getSize().width;
int h = getSize().height;
- if (image == null || w != image.getWidth(this) || h!=image.getHeight(this) )
+ if (image == null || w != image.getWidth(this)
+ || h != image.getHeight(this))
{
image = createImage(w, ap.annotationPanel.getSize().height);
}
@@ -665,7 +823,7 @@ public class AnnotationLabels extends Panel implements ActionListener,
g.translate(0, -scrollOffset);
g.setColor(Color.black);
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
int y = 0, fy = g.getFont().getSize();
int x = 0, offset;
@@ -703,11 +861,12 @@ public class AnnotationLabels extends Panel implements ActionListener,
dragEvent.getY());
}
- if ((aa == null) || (aa.length < 1))
+ if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
{
g.setColor(Color.black);
- g.drawString("Right click", 2, 8);
- g.drawString("to add annotation", 2, 18);
+ g.drawString(MessageManager.getString("label.right_click"), 2, 8);
+ g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
+ 18);
}
}
}
diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java
index 7d1333b..2dfa480 100644
--- a/src/jalview/appletgui/AnnotationPanel.java
+++ b/src/jalview/appletgui/AnnotationPanel.java
@@ -1,35 +1,52 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.font.LineMetrics;
-import java.awt.geom.AffineTransform;
-
-import jalview.analysis.AAFrequency;
-import jalview.datamodel.*;
-import jalview.schemes.ColourSchemeI;
-
-public class AnnotationPanel extends Panel implements AdjustmentListener,
- ActionListener, MouseListener, MouseMotionListener
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.renderer.AnnotationRenderer;
+import jalview.renderer.AwtRenderPanelI;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.PopupMenu;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+
+public class AnnotationPanel extends Panel implements AwtRenderPanelI,
+ AdjustmentListener, ActionListener, MouseListener,
+ MouseMotionListener
{
AlignViewport av;
@@ -37,21 +54,24 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
int activeRow = -1;
- Vector activeRes;
+ final String HELIX = "Helix";
- static String HELIX = "Helix";
+ final String SHEET = "Sheet";
- static String SHEET = "Sheet";
+ /**
+ * For RNA secondary structure "stems" aka helices
+ */
+ final String STEM = "RNA Helix";
- static String LABEL = "Label";
+ final String LABEL = "Label";
- static String REMOVE = "Remove Annotation";
+ final String REMOVE = "Remove Annotation";
- static String COLOUR = "Colour";
+ final String COLOUR = "Colour";
- static Color HELIX_COLOUR = Color.red.darker();
+ final Color HELIX_COLOUR = Color.red.darker();
- static Color SHEET_COLOUR = Color.green.darker().darker();
+ final Color SHEET_COLOUR = Color.green.darker().darker();
Image image;
@@ -74,6 +94,8 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
boolean MAC = false;
+ public final AnnotationRenderer renderer;
+
public AnnotationPanel(AlignmentPanel ap)
{
MAC = new jalview.util.Platform().isAMac();
@@ -88,13 +110,16 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
addMouseListener(this);
// ap.annotationScroller.getVAdjustable().addAdjustmentListener( this );
+ renderer = new AnnotationRenderer();
}
public AnnotationPanel(AlignViewport av)
{
this.av = av;
+ renderer = new AnnotationRenderer();
}
+ @Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
}
@@ -105,9 +130,10 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void actionPerformed(ActionEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
@@ -123,9 +149,12 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
}
String label = "";
- if (av.colSel != null && av.colSel.size() > 0
- && anot[av.colSel.getMin()] != null)
+ if (av.getColumnSelection() != null
+ && av.getColumnSelection().size() > 0
+ && anot[av.getColumnSelection().getMin()] != null)
+ {
label = anot[av.getColumnSelection().getMin()].displayCharacter;
+ }
if (evt.getActionCommand().equals(REMOVE))
{
@@ -152,8 +181,10 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
+ {
continue;
+ }
if (anot[index] == null)
{
@@ -174,8 +205,10 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
+ {
continue;
+ }
if (anot[index] == null)
{
@@ -201,6 +234,13 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
symbol = "\u03B2";
}
+ // Added by LML to color stems
+ else if (evt.getActionCommand().equals(STEM))
+ {
+ type = 'S';
+ symbol = "\u03C3";
+ }
+
if (!aa[activeRow].hasIcons)
{
aa[activeRow].hasIcons = true;
@@ -216,25 +256,35 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
if ((label.length() > 0) && !aa[activeRow].hasText)
{
aa[activeRow].hasText = true;
+ if (evt.getActionCommand().equals(STEM))
+ {
+ aa[activeRow].showAllColLabels = true;
+ }
}
for (int i = 0; i < av.getColumnSelection().size(); i++)
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
+ {
continue;
+ }
if (anot[index] == null)
{
anot[index] = new Annotation(label, "", type, 0);
}
- anot[index].secondaryStructure = type;
+ anot[index].secondaryStructure = type != 'S' ? type : label
+ .length() == 0 ? ' ' : label.charAt(0);
anot[index].displayCharacter = label;
}
}
+ av.getAlignment().validateAnnotation(aa[activeRow]);
+
+ ap.alignmentChanged();
adjustPanelHeight();
repaint();
@@ -247,14 +297,19 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
ap.alignFrame, "Enter Label", 400, 200, true);
if (dialog.accept)
+ {
return dialog.getName();
+ }
else
+ {
return null;
+ }
}
+ @Override
public void mousePressed(MouseEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
@@ -295,13 +350,27 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
return;
}
- PopupMenu pop = new PopupMenu("Structure type");
- MenuItem item = new MenuItem(HELIX);
- item.addActionListener(this);
- pop.add(item);
- item = new MenuItem(SHEET);
- item.addActionListener(this);
- pop.add(item);
+ PopupMenu pop = new PopupMenu(
+ MessageManager.getString("label.structure_type"));
+ MenuItem item;
+ /*
+ * Just display the needed structure options
+ */
+ if (av.getAlignment().isNucleotide() == true)
+ {
+ item = new MenuItem(STEM);
+ item.addActionListener(this);
+ pop.add(item);
+ }
+ else
+ {
+ item = new MenuItem(HELIX);
+ item.addActionListener(this);
+ pop.add(item);
+ item = new MenuItem(SHEET);
+ item.addActionListener(this);
+ pop.add(item);
+ }
item = new MenuItem(LABEL);
item.addActionListener(this);
pop.add(item);
@@ -317,14 +386,10 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
return;
}
- if (aa == null)
- {
- return;
- }
-
ap.scalePanel.mousePressed(evt);
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
graphStretch = -1;
@@ -338,24 +403,26 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
ap.scalePanel.mouseReleased(evt);
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
}
boolean needValidating = false;
+ @Override
public void mouseDragged(MouseEvent evt)
{
if (graphStretch > -1)
{
- av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
+ av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
- evt.getY();
- if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
+ if (av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight < 0)
{
- av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
+ av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight = 0;
}
graphStretchY = evt.getY();
- calcPanelHeight();
+ av.calcPanelHeight();
needValidating = true;
ap.paintAlignment(true);
}
@@ -365,9 +432,10 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
}
}
+ @Override
public void mouseMoved(MouseEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
@@ -392,7 +460,7 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
int res = evt.getX() / av.getCharWidth() + av.getStartRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
@@ -409,11 +477,13 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
}
}
+ @Override
public void mouseEntered(MouseEvent evt)
{
ap.scalePanel.mouseEntered(evt);
}
+ @Override
public void mouseExited(MouseEvent evt)
{
ap.scalePanel.mouseExited(evt);
@@ -426,7 +496,7 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
public int adjustPanelHeight(boolean repaint)
{
- int height = calcPanelHeight();
+ int height = av.calcPanelHeight();
this.setSize(new Dimension(getSize().width, height));
if (repaint)
{
@@ -434,65 +504,19 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
}
return height;
}
+
/**
- * calculate the height for visible annotation, revalidating bounds where necessary
- * ABSTRACT GUI METHOD
+ * calculate the height for visible annotation, revalidating bounds where
+ * necessary ABSTRACT GUI METHOD
+ *
* @return total height of annotation
*/
- public int calcPanelHeight()
- {
- // setHeight of panels
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
- int height = 0;
-
- if (aa != null)
- {
- for (int i = 0; i < aa.length; i++)
- {
- if (!aa[i].visible)
- {
- continue;
- }
-
- aa[i].height = 0;
-
- if (aa[i].hasText)
- {
- aa[i].height += av.charHeight;
- }
-
- if (aa[i].hasIcons)
- {
- aa[i].height += 16;
- }
-
- if (aa[i].graph > 0)
- {
- aa[i].height += aa[i].graphHeight;
- }
-
- if (aa[i].height == 0)
- {
- aa[i].height = 20;
- }
-
- height += aa[i].height;
- }
- }
- if (height == 0)
- {
- height = 20;
- }
-
- return height;
-
- }
public void addEditableColumn(int i)
{
if (activeRow == -1)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
@@ -507,32 +531,26 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
}
}
}
-
- if (activeRes == null)
- {
- activeRes = new Vector();
- activeRes.addElement(String.valueOf(i));
- return;
- }
-
- activeRes.addElement(String.valueOf(i));
}
+ @Override
public void update(Graphics g)
{
paint(g);
}
+ @Override
public void paint(Graphics g)
{
Dimension d = getSize();
imgWidth = d.width;
// (av.endRes - av.startRes + 1) * av.charWidth;
- if (imgWidth<1 || d.height<1)
+ if (imgWidth < 1 || d.height < 1)
{
return;
}
- if (image == null || imgWidth != image.getWidth(this) || d.height != image.getHeight(this))
+ if (image == null || imgWidth != image.getWidth(this)
+ || d.height != image.getHeight(this))
{
image = createImage(imgWidth, d.height);
gg = image.getGraphics();
@@ -557,20 +575,21 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
public void fastPaint(int horizontal)
{
- if (horizontal == 0 || av.alignment.getAlignmentAnnotation() == null
- || av.alignment.getAlignmentAnnotation().length < 1)
+ if (horizontal == 0
+ || av.getAlignment().getAlignmentAnnotation() == null
+ || av.getAlignment().getAlignmentAnnotation().length < 1)
{
repaint();
return;
}
- gg.copyArea(0, 0, imgWidth, getSize().height, -horizontal
- * av.charWidth, 0);
+ gg.copyArea(0, 0, imgWidth, getSize().height,
+ -horizontal * av.getCharWidth(), 0);
int sr = av.startRes, er = av.endRes + 1, transX = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
- transX = (er - sr - horizontal) * av.charWidth;
+ transX = (er - sr - horizontal) * av.getCharWidth();
sr = er - horizontal;
}
else if (horizontal < 0)
@@ -604,684 +623,78 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
g.setFont(ofont);
g.setColor(Color.white);
- g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getSize().height);
+ g.fillRect(0, 0, (endRes - startRes) * av.getCharWidth(),
+ getSize().height);
if (fm == null)
{
fm = g.getFontMetrics();
}
- if ((av.alignment.getAlignmentAnnotation() == null)
- || (av.alignment.getAlignmentAnnotation().length < 1))
+ if ((av.getAlignment().getAlignmentAnnotation() == null)
+ || (av.getAlignment().getAlignmentAnnotation().length < 1))
{
g.setColor(Color.white);
g.fillRect(0, 0, getSize().width, getSize().height);
g.setColor(Color.black);
if (av.validCharWidth)
{
- g.drawString("Alignment has no annotations", 20, 15);
+ g.drawString(MessageManager
+ .getString("label.alignment_has_no_annotations"), 20, 15);
}
return;
}
-
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
g.translate(0, -scrollOffset);
- int x = 0;
- int y = 0;
- int column = 0;
- char lastSS;
- int lastSSX;
- int iconOffset = av.charHeight / 2;
- boolean validRes = false;
- boolean validEnd = false;
- boolean labelAllCols = false;
- boolean centreColLabels, centreColLabelsDef = av
- .getCentreColumnLabels();
- boolean scaleColLabel = false;
- boolean[] graphGroupDrawn = new boolean[aa.length];
- int charOffset = 0; // offset for a label
- float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
- // column.
- // \u03B2 \u03B1
- for (int i = 0; i < aa.length; i++)
- {
- AlignmentAnnotation row = aa[i];
-
- if (!row.visible)
- {
- continue;
- }
- centreColLabels = row.centreColLabels || centreColLabelsDef;
- labelAllCols = row.showAllColLabels;
- scaleColLabel = row.scaleColLabel;
- lastSS = ' ';
- lastSSX = 0;
-
- if (row.graph > 0)
- {
- if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
- {
- continue;
- }
-
- // this is so that we draw the characters below the graph
- y += row.height;
-
- if (row.hasText)
- {
- iconOffset = av.charHeight - fm.getDescent();
- y -= av.charHeight;
- }
- }
- // TODO: else is the logic used in application, applet had no 'else'
- else if (row.hasText)
- {
- iconOffset = av.charHeight - fm.getDescent();
-
- }
- else
- {
- iconOffset = 0;
- }
-
- x = 0;
- while (x < endRes - startRes)
- {
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(
- startRes + x);
- if (column > row.annotations.length - 1)
- {
- break;
- }
- }
- else
- {
- column = startRes + x;
- }
-
- if ((row.annotations.length <= column)
- || (row.annotations[column] == null))
- {
- validRes = false;
- }
- else
- {
- validRes = true;
- }
-
- if (activeRow == i)
- {
- g.setColor(Color.red);
-
- if (av.getColumnSelection() != null)
- {
- for (int n = 0; n < av.getColumnSelection().size(); n++)
- {
- int v = av.getColumnSelection().columnAt(n);
-
- if (v == column)
- {
- g.fillRect(x * av.charWidth, y, av.charWidth, av.charHeight);
- }
- }
- }
- }
-
- if (av.validCharWidth
- && validRes
- && (row.annotations[column].displayCharacter != null && row.annotations[column].displayCharacter
- .length() > 0))
- {
-
- if (centreColLabels || scaleColLabel)
- {
- fmWidth = (float) fm.charsWidth(
- row.annotations[column].displayCharacter.toCharArray(),
- 0, row.annotations[column].displayCharacter.length());
-
- if (scaleColLabel)
- {
- // justify the label and scale to fit in column
- if (fmWidth > av.charWidth)
- {
- // scale only if the current font isn't already small enough
- fmScaling = av.charWidth;
- fmScaling /= fmWidth;
- // not 1.1 // g.setFont(new
- // Font(ofont,AffineTransform.getScaleInstance(fmScaling,
- // 1.0)));
- // and update the label's width to reflect the scaling.
- fmWidth = av.charWidth;
- }
- }
- }
- else
- {
- fmWidth = (float) fm
- .charWidth(row.annotations[column].displayCharacter
- .charAt(0));
- }
- charOffset = (int) ((av.charWidth - fmWidth) / 2f);
-
- if (row.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(row.annotations[column].colour);
-
- if (column == 0 || row.graph > 0)
- {
- g.drawString(row.annotations[column].displayCharacter,
- (x * av.charWidth) + charOffset, y + iconOffset + 3); // +
- // 3?
- }
- else if (row.annotations[column - 1] == null
- || (labelAllCols
- || !row.annotations[column].displayCharacter
- .equals(row.annotations[column - 1].displayCharacter) || (row.annotations[column].displayCharacter
- .length() < 2 && row.annotations[column].secondaryStructure == ' ')))
- {
- g.drawString(row.annotations[column].displayCharacter,
- (x * av.charWidth) + charOffset, y + iconOffset + 3); // +3?
- }
- g.setFont(ofont);
- }
-
- if (row.hasIcons)
- {
- if (!validRes
- || (row.annotations[column].secondaryStructure != lastSS))
- {
- switch (lastSS)
- {
- case 'H':
- g.setColor(HELIX_COLOUR);
- if (MAC)
- {
- // Off by 1 offset when drawing rects and ovals
- // to offscreen image on the MAC
- g.fillRoundRect(lastSSX, y + 4 + iconOffset,
- (x * av.charWidth) - lastSSX, 7, 8, 8);
- break;
- }
-
- int sCol = (lastSSX / av.charWidth) + startRes;
- int x1 = lastSSX;
- int x2 = (x * av.charWidth);
-
- if (sCol == 0
- || row.annotations[sCol - 1] == null
- || row.annotations[sCol - 1].secondaryStructure != 'H')
- {
- g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90,
- 180);
- x1 += av.charWidth / 2;
- }
-
- if (!validRes || row.annotations[column] == null
- || row.annotations[column].secondaryStructure != 'H')
- {
- g.fillArc((x * av.charWidth) - av.charWidth, y + 4
- + iconOffset, av.charWidth, 8, 270, 180);
- x2 -= av.charWidth / 2;
- }
-
- g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
- break;
-
- case 'E':
- g.setColor(SHEET_COLOUR);
- g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX - 4, 7);
- g.fillPolygon(new int[]
- { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
- (x * av.charWidth) }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
- 3);
-
- break;
-
- default:
- g.setColor(Color.gray);
- g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
- - lastSSX, 2);
-
- break;
- }
-
- if (validRes)
- {
- lastSS = row.annotations[column].secondaryStructure;
- }
- else
- {
- lastSS = ' ';
- }
-
- lastSSX = (x * av.charWidth);
- }
- }
-
- column++;
- x++;
- }
-
- if (column >= row.annotations.length)
- {
- column = row.annotations.length - 1;
- validEnd = false;
- }
- else
- {
- validEnd = true;
- }
-
- // x ++;
-
- if (row.hasIcons)
- {
- switch (lastSS)
- {
- case 'H':
- g.setColor(HELIX_COLOUR);
- if (MAC)
- {
- // Off by 1 offset when drawing rects and ovals
- // to offscreen image on the MAC
- g.fillRoundRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX, 7, 8, 8);
- break;
- }
-
- int sCol = (lastSSX / av.charWidth) + startRes;
- int x1 = lastSSX;
- int x2 = (x * av.charWidth);
-
- if (sCol == 0 || row.annotations[sCol - 1] == null
- || row.annotations[sCol - 1].secondaryStructure != 'H')
- {
- g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);
- x1 += av.charWidth / 2;
- }
-
- if (row.annotations[column] == null
- || row.annotations[column].secondaryStructure != 'H')
- {
- g.fillArc((x * av.charWidth) - av.charWidth,
- y + 4 + iconOffset, av.charWidth, 8, 270, 180);
- x2 -= av.charWidth / 2;
- }
-
- g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
-
- break;
-
- case 'E':
- g.setColor(SHEET_COLOUR);
-
- if (!validEnd || row.annotations[endRes] == null
- || row.annotations[endRes].secondaryStructure != 'E')
- {
- g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX - 4, 7);
- g.fillPolygon(new int[]
- { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
- (x * av.charWidth) }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset }, 3);
- }
- else
- {
- g.fillRect(lastSSX, y + 4 + iconOffset, x * av.charWidth
- - lastSSX, 7);
- }
- break;
-
- default:
- g.setColor(Color.gray);
- if (!av.wrapAlignment || endRes == av.endRes)
- {
- g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
- - lastSSX, 2);
- }
-
- break;
- }
- }
-
- if (row.graph > 0 && row.graphHeight > 0)
- {
- if (row.graph == AlignmentAnnotation.LINE_GRAPH)
- {
- if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
- {
- float groupmax = -999999, groupmin = 9999999;
- for (int gg = 0; gg < aa.length; gg++)
- {
- if (aa[gg].graphGroup != row.graphGroup)
- {
- continue;
- }
-
- if (aa[gg] != row)
- {
- aa[gg].visible = false;
- }
-
- if (aa[gg].graphMax > groupmax)
- {
- groupmax = aa[gg].graphMax;
- }
- if (aa[gg].graphMin < groupmin)
- {
- groupmin = aa[gg].graphMin;
- }
- }
-
- for (int gg = 0; gg < aa.length; gg++)
- {
- if (aa[gg].graphGroup == row.graphGroup)
- {
- drawLineGraph(g, aa[gg], startRes, endRes, y, groupmin,
- groupmax, row.graphHeight);
- }
- }
-
- graphGroupDrawn[row.graphGroup] = true;
- }
- else
- {
- drawLineGraph(g, row, startRes, endRes, y, row.graphMin,
- row.graphMax, row.graphHeight);
- }
- }
- else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
- {
- drawBarGraph(g, row, startRes, endRes, row.graphMin,
- row.graphMax, y);
- }
- }
-
- if (row.graph > 0 && row.hasText)
- {
- y += av.charHeight;
- }
-
- if (row.graph == 0)
- {
- y += aa[i].height;
- }
- }
+ renderer.drawComponent(this, av, g, activeRow, startRes, endRes);
g.translate(0, +scrollOffset);
}
- public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
- int eRes, int y, float min, float max, int graphHeight)
- {
- if (sRes > aa.annotations.length)
- {
- return;
- }
-
- int x = 0;
-
- // Adjustment for fastpaint to left
- if (eRes < av.endRes)
- {
- eRes++;
- }
-
- eRes = Math.min(eRes, aa.annotations.length);
-
- int y1 = y, y2 = y;
- float range = max - min;
-
- // //Draw origin
- if (min < 0)
- {
- y2 = y - (int) ((0 - min / range) * graphHeight);
- }
-
- g.setColor(Color.gray);
- g.drawLine(x - av.charWidth, y2, (eRes - sRes) * av.charWidth, y2);
-
- eRes = Math.min(eRes, aa.annotations.length);
-
- int column;
- int aaMax = aa.annotations.length - 1;
-
- while (x < eRes - sRes)
- {
- column = sRes + x;
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(column);
- }
-
- if (column > aaMax)
- {
- break;
- }
-
- if (aa.annotations[column] == null) // || coaa.annotations[column - 1] ==
- // null)
- {
- x++;
- continue;
- }
-
- if (aa.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[column].colour);
- if (column == 0 || aa.annotations[column - 1] == null)
- {
- y1 = y
- - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
- }
- else
- {
- y1 = y
- - (int) (((aa.annotations[column - 1].value - min) / range) * graphHeight);
- }
- y2 = y
- - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
-
- g.drawLine(x * av.charWidth - av.charWidth / 2, y1, x * av.charWidth
- + av.charWidth / 2, y2);
- x++;
- }
+ int scrollOffset = 0;
- if (aa.threshold != null)
+ public void setScrollOffset(int value, boolean repaint)
+ {
+ scrollOffset = value;
+ if (repaint)
{
- g.setColor(aa.threshold.colour);
-
- y2 = (int) (y - ((aa.threshold.value - min) / range) * graphHeight);
- g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
+ repaint();
}
}
- public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes,
- int eRes, float min, float max, int y)
+ @Override
+ public FontMetrics getFontMetrics()
{
- ColourSchemeI profcolour = av.getGlobalColourScheme();
- if (profcolour == null)
- {
- profcolour = new jalview.schemes.ZappoColourScheme();
- }
- if (sRes > aa.annotations.length)
- {
- return;
- }
- Font ofont = g.getFont();
- eRes = Math.min(eRes, aa.annotations.length);
-
- int x = 0, y1 = y, y2 = y;
-
- float range = max - min;
-
- if (min < 0)
- {
- y2 = y - (int) ((0 - min / (range)) * aa.graphHeight);
- }
-
- g.setColor(Color.gray);
-
- g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
-
- int column;
- int aaMax = aa.annotations.length - 1;
- boolean renderHistogram = true, renderProfile = false;
- if (aa.autoCalculated && aa.label.startsWith("Consensus"))
- { // TODO: generalise this to have render styles for consensus/profile data
- if (aa.groupRef != null)
- {
- renderHistogram = aa.groupRef.isShowConsensusHistogram();
- renderProfile = aa.groupRef.isShowSequenceLogo();
- }
- else
- {
- renderHistogram = av.isShowConsensusHistogram();
- renderProfile = av.isShowSequenceLogo();
- }
- }
-
- while (x < eRes - sRes)
- {
- column = sRes + x;
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(column);
- }
-
- if (column > aaMax)
- {
- break;
- }
-
- if (aa.annotations[column] == null)
- {
- x++;
- continue;
- }
-
- if (aa.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[column].colour);
-
- y1 = y
- - (int) (((aa.annotations[column].value - min) / (range)) * aa.graphHeight);
-
- if (renderHistogram)
- {
- if (y1 - y2 > 0)
- {
- g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
- }
- else
- {
- g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
- }
- }
- // draw profile if available
- if (aa.annotations[column].value != 0 && renderProfile)
- {
- int profl[] = getProfileFor(aa, column);
- int ht = y1, htn = y2 - y1;// aa.graphHeight;
- float wdth;
- double ht2 = 0;
- char[] dc = new char[1];
- LineMetrics lm;
- for (int c = 1; profl != null && c < profl[0];)
- {
- dc[0] = (char) profl[c++];
- wdth = av.charWidth;
- wdth /= (float) fm.charsWidth(dc, 0, 1);
-
- if (c > 2)
- {
- ht += (int) ht2;
- }
- { // not java 1.1 compatible: Bug # 0060064
- g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
- wdth, (ht2 = (htn * ((double) profl[c++]) / 100.0))
- / av.charHeight)));
- lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
- g.setColor(profcolour.findColour(dc[0]));
- g.drawChars(dc, 0, 1, x * av.charWidth,
- (int) (ht + lm.getHeight()));
- }
- }
- g.setFont(ofont);
- }
-
- x++;
-
- }
- if (aa.threshold != null)
- {
- g.setColor(aa.threshold.colour);
- y2 = (int) (y - ((aa.threshold.value - min) / range) * aa.graphHeight);
- g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
- }
+ return fm;
}
- private int[] getProfileFor(AlignmentAnnotation aa, int column)
+ @Override
+ public Image getFadedImage()
{
- // if (aa.autoCalculated && aa.label.startsWith("Consensus")) {
- if (aa.groupRef != null && aa.groupRef.consensusData != null)
- {
- // && aa.groupRef.isShowSequenceLogo()) {
- return AAFrequency.extractProfile(aa.groupRef.consensusData[column],
- aa.groupRef.getIgnoreGapsConsensus());
- }
- // TODO extend annotation row to enable dynamic and static profile data to
- // be stored
- if (aa.groupRef == null && aa.sequenceRef == null)
- // && av.isShowSequenceLogo())
- {
- return AAFrequency.extractProfile(av.hconsensus[column],
- av.getIgnoreGapsConsensus());
- }
- // }
- return null;
+ return image;
}
- // used by overview window
- public void drawGraph(Graphics g, AlignmentAnnotation aa, int width,
- int y, int sRes, int eRes)
+ @Override
+ public int getFadedImageWidth()
{
- eRes = Math.min(eRes, aa.annotations.length);
- g.setColor(Color.white);
- g.fillRect(0, 0, width, y);
- g.setColor(new Color(0, 0, 180));
-
- int x = 0, height;
-
- for (int j = sRes; j < eRes; j++)
- {
- if (aa.annotations[j].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[j].colour);
-
- height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);
- if (height > y)
- {
- height = y;
- }
- g.fillRect(x, y - height, av.charWidth, height);
- x += av.charWidth;
- }
+ return imgWidth;
}
- int scrollOffset = 0;
+ private int[] bounds = new int[2];
- public void setScrollOffset(int value)
+ @Override
+ public int[] getVisibleVRange()
{
- scrollOffset = value;
- repaint();
+ if (ap != null && ap.alabels != null)
+ {
+ int sOffset = -ap.alabels.scrollOffset;
+ int visHeight = sOffset + ap.annotationPanelHolder.getHeight();
+ bounds[0] = sOffset;
+ bounds[1] = visHeight;
+ return bounds;
+ }
+ else
+ {
+ return null;
+ }
}
}
diff --git a/src/jalview/appletgui/AnnotationRowFilter.java b/src/jalview/appletgui/AnnotationRowFilter.java
new file mode 100644
index 0000000..45f7454
--- /dev/null
+++ b/src/jalview/appletgui/AnnotationRowFilter.java
@@ -0,0 +1,212 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.appletgui;
+
+import jalview.schemes.AnnotationColourGradient;
+import jalview.util.MessageManager;
+
+import java.awt.Button;
+import java.awt.Checkbox;
+import java.awt.Choice;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.Scrollbar;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.util.Vector;
+
+ at SuppressWarnings("serial")
+public abstract class AnnotationRowFilter extends Panel
+{
+ protected AlignViewport av;
+
+ protected AlignmentPanel ap;
+
+ protected int[] annmap;
+
+ protected boolean enableSeqAss = false;
+
+ private jalview.datamodel.AlignmentAnnotation currentAnnotation;
+
+ protected boolean adjusting = false;
+
+ protected Checkbox currentColours = new Checkbox();
+
+ protected Panel minColour = new Panel();
+
+ protected Panel maxColour = new Panel();
+
+ protected Checkbox seqAssociated = new Checkbox();
+
+ protected Checkbox thresholdIsMin = new Checkbox();
+
+ protected Scrollbar slider = new Scrollbar(Scrollbar.HORIZONTAL);
+
+ protected TextField thresholdValue = new TextField(20);
+
+ protected Frame frame;
+
+ protected Button ok = new Button();
+
+ protected Button cancel = new Button();
+
+ /**
+ * enabled if the user is dragging the slider - try to keep updates to a
+ * minimun
+ */
+ protected boolean sliderDragging = false;
+
+ public AnnotationRowFilter(AlignViewport av, final AlignmentPanel ap)
+ {
+ this.av = av;
+ this.ap = ap;
+ }
+
+ public AnnotationRowFilter()
+ {
+
+ }
+
+ public Vector getAnnotationItems(boolean isSeqAssociated)
+ {
+ Vector list = new Vector();
+ int index = 1;
+ int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length];
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ {
+ if (av.getAlignment().getAlignmentAnnotation()[i].sequenceRef == null)
+ {
+ if (isSeqAssociated)
+ {
+ continue;
+ }
+ }
+ else
+ {
+ enableSeqAss = true;
+ }
+ String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+ if (!list.contains(label))
+ {
+ anmap[list.size()] = i;
+ list.add(label);
+
+ }
+ else
+ {
+ if (!isSeqAssociated)
+ {
+ anmap[list.size()] = i;
+ list.add(label + "_" + (index++));
+ }
+ }
+ }
+ this.annmap = new int[list.size()];
+ System.arraycopy(anmap, 0, this.annmap, 0, this.annmap.length);
+ return list;
+ }
+
+ protected int getSelectedThresholdItem(int indexValue)
+ {
+ int selectedThresholdItem = -1;
+ if (indexValue == 1)
+ {
+ selectedThresholdItem = AnnotationColourGradient.ABOVE_THRESHOLD;
+ }
+ else if (indexValue == 2)
+ {
+ selectedThresholdItem = AnnotationColourGradient.BELOW_THRESHOLD;
+ }
+ return selectedThresholdItem;
+ }
+
+ public void modelChanged()
+ {
+ seqAssociated.setEnabled(enableSeqAss);
+ }
+
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ updateView();
+ frame.setVisible(false);
+ }
+
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ reset();
+ ap.paintAlignment(true);
+ frame.setVisible(false);
+ }
+
+ public void thresholdCheck_actionPerformed(ActionEvent e)
+ {
+ updateView();
+ }
+
+ public void annotations_actionPerformed(ActionEvent e)
+ {
+ updateView();
+ }
+
+ public void threshold_actionPerformed(ActionEvent e)
+ {
+ updateView();
+ }
+
+ public void thresholdValue_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ float f = Float.parseFloat(thresholdValue.getText());
+ slider.setValue((int) (f * 1000));
+ updateView();
+ } catch (NumberFormatException ex)
+ {
+ }
+ }
+
+ protected void populateThresholdComboBox(Choice threshold)
+ {
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_no_thereshold"));
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_above_thereshold"));
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_below_thereshold"));
+ }
+
+ public jalview.datamodel.AlignmentAnnotation getCurrentAnnotation()
+ {
+ return currentAnnotation;
+ }
+
+ public void setCurrentAnnotation(
+ jalview.datamodel.AlignmentAnnotation currentAnnotation)
+ {
+ this.currentAnnotation = currentAnnotation;
+ }
+
+ public abstract void valueChanged(boolean updateAllAnnotation);
+
+ public abstract void updateView();
+
+ public abstract void reset();
+}
diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java
index 7bf21a8..c9f275b 100644
--- a/src/jalview/appletgui/AppletJmol.java
+++ b/src/jalview/appletgui/AppletJmol.java
@@ -1,80 +1,124 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.api.SequenceStructureBinding;
-import jalview.datamodel.*;
-import jalview.structure.*;
-import jalview.io.*;
-
-import org.jmol.api.*;
-
-import org.jmol.popup.*;
-import org.jmol.viewer.JmolConstants;
-
-import jalview.schemes.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.FileParse;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.UserColourScheme;
+import jalview.schemes.ZappoColourScheme;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.CheckboxMenuItem;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.TextArea;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
public class AppletJmol extends EmbmenuFrame implements
// StructureListener,
- KeyListener, ActionListener, ItemListener, SequenceStructureBinding
+ KeyListener, ActionListener, ItemListener
{
- Menu fileMenu = new Menu("File");
+ Menu fileMenu = new Menu(MessageManager.getString("action.file"));
+
+ Menu viewMenu = new Menu(MessageManager.getString("action.view"));
+
+ Menu coloursMenu = new Menu(MessageManager.getString("action.colour"));
- Menu viewMenu = new Menu("View");
+ Menu chainMenu = new Menu(MessageManager.getString("action.show_chain"));
- Menu coloursMenu = new Menu("Colours");
+ Menu helpMenu = new Menu(MessageManager.getString("action.help"));
- Menu chainMenu = new Menu("Show Chain");
+ MenuItem mappingMenuItem = new MenuItem(
+ MessageManager.getString("label.view_mapping"));
- Menu helpMenu = new Menu("Help");
+ CheckboxMenuItem seqColour = new CheckboxMenuItem(
+ MessageManager.getString("action.by_sequence"), true);
- MenuItem mappingMenuItem = new MenuItem("View Mapping");
+ CheckboxMenuItem jmolColour = new CheckboxMenuItem(
+ MessageManager.getString("action.using_jmol"), false);
- CheckboxMenuItem seqColour = new CheckboxMenuItem("By Sequence", true);
+ MenuItem chain = new MenuItem(MessageManager.getString("action.by_chain"));
- CheckboxMenuItem jmolColour = new CheckboxMenuItem("Using Jmol", false);
-
- MenuItem chain = new MenuItem("By Chain");
+ MenuItem charge = new MenuItem(
+ MessageManager.getString("label.charge_cysteine"));
- MenuItem charge = new MenuItem("Charge & Cysteine");
+ MenuItem zappo = new MenuItem(MessageManager.getString("label.zappo"));
- MenuItem zappo = new MenuItem("Zappo");
+ MenuItem taylor = new MenuItem(MessageManager.getString("label.taylor"));
- MenuItem taylor = new MenuItem("Taylor");
+ MenuItem hydro = new MenuItem(
+ MessageManager.getString("label.hydrophobicity"));
- MenuItem hydro = new MenuItem("Hydrophobicity");
+ MenuItem helix = new MenuItem(
+ MessageManager.getString("label.helix_propensity"));
- MenuItem helix = new MenuItem("Helix Propensity");
+ MenuItem strand = new MenuItem(
+ MessageManager.getString("label.strand_propensity"));
- MenuItem strand = new MenuItem("Strand Propensity");
+ MenuItem turn = new MenuItem(
+ MessageManager.getString("label.turn_propensity"));
- MenuItem turn = new MenuItem("Turn Propensity");
+ MenuItem buried = new MenuItem(
+ MessageManager.getString("label.buried_index"));
- MenuItem buried = new MenuItem("Buried Index");
+ MenuItem purinepyrimidine = new MenuItem(
+ MessageManager.getString("label.purine_pyrimidine"));
- MenuItem user = new MenuItem("User Defined Colours");
+ MenuItem user = new MenuItem(
+ MessageManager.getString("label.user_defined_colours"));
- MenuItem jmolHelp = new MenuItem("Jmol Help");
+ MenuItem jmolHelp = new MenuItem(
+ MessageManager.getString("label.jmol_help"));
Panel scriptWindow;
@@ -85,7 +129,9 @@ public class AppletJmol extends EmbmenuFrame implements
RenderPanel renderPanel;
AlignmentPanel ap;
- ArrayList _aps = new ArrayList();
+
+ List<AlignmentPanel> _aps = new ArrayList<AlignmentPanel>(); // remove? never
+ // added to
String fileLoadingError;
@@ -125,17 +171,16 @@ public class AppletJmol extends EmbmenuFrame implements
String[][] boundchains, boolean align, AlignmentPanel ap,
String protocol)
{
- throw new Error("Not yet implemented.");
+ throw new Error(MessageManager.getString("error.not_yet_implemented"));
}
public AppletJmol(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
AlignmentPanel ap, String protocol)
{
this.ap = ap;
- jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(), new PDBEntry[]
- { pdbentry }, new SequenceI[][]
- { seq }, new String[][]
- { chains }, protocol);
+ jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(),
+ new PDBEntry[] { pdbentry }, new SequenceI[][] { seq },
+ new String[][] { chains }, protocol);
jmb.setColourBySequence(true);
if (pdbentry.getId() == null || pdbentry.getId().length() < 1)
{
@@ -157,13 +202,14 @@ public class AppletJmol extends EmbmenuFrame implements
}
String alreadyMapped = StructureSelectionManager
- .getStructureSelectionManager(ap.av.applet).alreadyMappedToFile(
- pdbentry.getId());
+ .getStructureSelectionManager(ap.av.applet)
+ .alreadyMappedToFile(pdbentry.getId());
MCview.PDBfile reader = null;
if (alreadyMapped != null)
{
- reader = StructureSelectionManager.getStructureSelectionManager(ap.av.applet)
- .setMapping(seq, chains, pdbentry.getFile(), protocol);
+ reader = StructureSelectionManager.getStructureSelectionManager(
+ ap.av.applet).setMapping(seq, chains, pdbentry.getFile(),
+ protocol);
// PROMPT USER HERE TO ADD TO NEW OR EXISTING VIEW?
// FOR NOW, LETS JUST OPEN A NEW WINDOW
}
@@ -187,8 +233,9 @@ public class AppletJmol extends EmbmenuFrame implements
strand.addActionListener(this);
turn.addActionListener(this);
buried.addActionListener(this);
+ purinepyrimidine.addActionListener(this);
user.addActionListener(this);
-
+
jmolHelp.addActionListener(this);
coloursMenu.add(seqColour);
@@ -201,6 +248,7 @@ public class AppletJmol extends EmbmenuFrame implements
coloursMenu.add(strand);
coloursMenu.add(turn);
coloursMenu.add(buried);
+ coloursMenu.add(purinepyrimidine);
coloursMenu.add(user);
coloursMenu.add(jmolColour);
helpMenu.add(jmolHelp);
@@ -231,7 +279,7 @@ public class AppletJmol extends EmbmenuFrame implements
dispose();
return;
}
- jmb.newJmolPopup(true, "Jmol", true);
+ // jmb.newJmolPopup(true, "Jmol", true);
this.addWindowListener(new WindowAdapter()
{
@@ -298,7 +346,8 @@ public class AppletJmol extends EmbmenuFrame implements
if (freader == null)
{
throw new Exception(
- "Invalid datasource. Could not obtain Reader.");
+ MessageManager
+ .getString("exception.invalid_datasource_couldnt_obtain_reader"));
}
jmb.viewer.openReader(pdbentry.getFile(), pdbentry.getId(),
freader);
@@ -322,20 +371,19 @@ public class AppletJmol extends EmbmenuFrame implements
jmb.loadInline(string);
}
- void setChainMenuItems(Vector chains)
+ void setChainMenuItems(Vector<String> chains)
{
chainMenu.removeAll();
- MenuItem menuItem = new MenuItem("All");
+ MenuItem menuItem = new MenuItem(MessageManager.getString("label.all"));
menuItem.addActionListener(this);
chainMenu.add(menuItem);
CheckboxMenuItem menuItemCB;
- for (int c = 0; c < chains.size(); c++)
+ for (String ch : chains)
{
- menuItemCB = new CheckboxMenuItem(chains.elementAt(c).toString(),
- true);
+ menuItemCB = new CheckboxMenuItem(ch, true);
menuItemCB.addItemListener(this);
chainMenu.add(menuItemCB);
}
@@ -345,9 +393,7 @@ public class AppletJmol extends EmbmenuFrame implements
void centerViewer()
{
- Vector toshow = new Vector();
- String lbl;
- int mlength, p, mnum;
+ Vector<String> toshow = new Vector<String>();
for (int i = 0; i < chainMenu.getItemCount(); i++)
{
if (chainMenu.getItem(i) instanceof CheckboxMenuItem)
@@ -381,13 +427,7 @@ public class AppletJmol extends EmbmenuFrame implements
StringBuffer sb = new StringBuffer();
try
{
- for (int s = 0; s < jmb.pdbentry.length; s++)
- {
- sb.append(jmb.printMapping(
- jmb.pdbentry[s].getFile()));
- sb.append("\n");
- }
- cap.setText(sb.toString());
+ cap.setText(jmb.printMappings());
} catch (OutOfMemoryError ex)
{
frame.dispose();
@@ -395,8 +435,9 @@ public class AppletJmol extends EmbmenuFrame implements
.println("Out of memory when trying to create dialog box with sequence-structure mapping.");
return;
}
- jalview.bin.JalviewLite.addFrame(frame, "PDB - Sequence Mapping",
- 550, 600);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.pdb_sequence_mapping"), 550,
+ 600);
}
else if (evt.getSource() == charge)
{
@@ -444,6 +485,10 @@ public class AppletJmol extends EmbmenuFrame implements
setEnabled(buried);
jmb.setJalviewColourScheme(new BuriedColourScheme());
}
+ else if (evt.getSource() == purinepyrimidine)
+ {
+ jmb.setJalviewColourScheme(new PurinePyrimidineColourScheme());
+ }
else if (evt.getSource() == user)
{
setEnabled(user);
@@ -467,7 +512,9 @@ public class AppletJmol extends EmbmenuFrame implements
for (int i = 0; i < chainMenu.getItemCount(); i++)
{
if (chainMenu.getItem(i) instanceof CheckboxMenuItem)
+ {
((CheckboxMenuItem) chainMenu.getItem(i)).setState(true);
+ }
}
centerViewer();
@@ -476,8 +523,8 @@ public class AppletJmol extends EmbmenuFrame implements
}
/**
- * tick or untick the seqColour menu entry or jmoColour entry depending upon if it was selected
- * or not.
+ * tick or untick the seqColour menu entry or jmoColour entry depending upon
+ * if it was selected or not.
*
* @param itm
*/
@@ -494,14 +541,16 @@ public class AppletJmol extends EmbmenuFrame implements
{
setEnabled(jmolColour);
jmb.setColourBySequence(false);
- } else
- if (evt.getSource() == seqColour)
+ }
+ else if (evt.getSource() == seqColour)
{
setEnabled(seqColour);
- jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap);
+ jmb.colourBySequence(ap);
}
else if (!allChainsSelected)
+ {
centerViewer();
+ }
}
public void keyPressed(KeyEvent evt)
@@ -509,7 +558,7 @@ public class AppletJmol extends EmbmenuFrame implements
if (evt.getKeyCode() == KeyEvent.VK_ENTER && scriptWindow.isVisible())
{
jmb.eval(inputLine.getText());
- history.append("\n$ " + inputLine.getText());
+ addToHistory("$ " + inputLine.getText());
inputLine.setText("");
}
@@ -525,8 +574,8 @@ public class AppletJmol extends EmbmenuFrame implements
public void updateColours(Object source)
{
- AlignmentPanel ap = (AlignmentPanel) source;
- jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap);
+ AlignmentPanel panel = (AlignmentPanel) source;
+ jmb.colourBySequence(panel);
}
public void updateTitleAndMenus()
@@ -537,7 +586,7 @@ public class AppletJmol extends EmbmenuFrame implements
return;
}
setChainMenuItems(jmb.chainNames);
- jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap);
+ jmb.colourBySequence(ap);
setTitle(jmb.getViewerTitle());
}
@@ -592,8 +641,6 @@ public class AppletJmol extends EmbmenuFrame implements
{
Dimension currentSize = new Dimension();
- Rectangle rectClip = new Rectangle();
-
public void update(Graphics g)
{
paint(g);
@@ -602,7 +649,6 @@ public class AppletJmol extends EmbmenuFrame implements
public void paint(Graphics g)
{
currentSize = this.getSize();
- rectClip = g.getClipBounds();
if (jmb.viewer == null)
{
@@ -610,11 +656,13 @@ public class AppletJmol extends EmbmenuFrame implements
g.fillRect(0, 0, currentSize.width, currentSize.height);
g.setColor(Color.white);
g.setFont(new Font("Verdana", Font.BOLD, 14));
- g.drawString("Retrieving PDB data....", 20, currentSize.height / 2);
+ g.drawString(MessageManager.getString("label.retrieving_pdb_data"),
+ 20, currentSize.height / 2);
}
else
{
- jmb.viewer.renderScreenImage(g, currentSize, rectClip);
+ jmb.viewer.renderScreenImage(g, currentSize.width,
+ currentSize.height);
}
}
}
@@ -644,13 +692,27 @@ public class AppletJmol extends EmbmenuFrame implements
public AlignmentPanel getAlignmentPanelFor(AlignmentI alignment)
{
- for (int i=0;i<_aps.size();i++)
+ for (int i = 0; i < _aps.size(); i++)
{
- if (((AlignmentPanel)_aps.get(i)).av.getAlignment()==alignment)
+ if (_aps.get(i).av.getAlignment() == alignment)
{
- return ((AlignmentPanel)_aps.get(i));
+ return (_aps.get(i));
}
}
return ap;
}
+
+ /**
+ * Append the given text to the history object
+ *
+ * @param text
+ */
+ public void addToHistory(String text)
+ {
+ // actually currently never initialised
+ if (history != null)
+ {
+ history.append("\n" + text);
+ }
+ }
}
diff --git a/src/jalview/appletgui/AppletJmolBinding.java b/src/jalview/appletgui/AppletJmolBinding.java
index eca6406..f7a121c 100644
--- a/src/jalview/appletgui/AppletJmolBinding.java
+++ b/src/jalview/appletgui/AppletJmolBinding.java
@@ -1,37 +1,41 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.Container;
-import java.util.BitSet;
-
import jalview.api.AlignmentViewPanel;
-import jalview.datamodel.AlignmentI;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.ext.jmol.JalviewJmolBinding;
import jalview.structure.StructureSelectionManager;
+import java.awt.Container;
+import java.util.Map;
+
+import javajs.awt.Dimension;
+
import org.jmol.api.JmolAppConsoleInterface;
-import org.jmol.api.JmolViewer;
-import org.jmol.applet.AppletConsole;
-import org.jmol.popup.JmolPopup;
+import org.jmol.console.AppletConsole;
+import org.jmol.java.BS;
-class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
+class AppletJmolBinding extends JalviewJmolBinding
{
/**
@@ -39,17 +43,20 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
*/
private AppletJmol appletJmolBinding;
- public AppletJmolBinding(AppletJmol appletJmol, StructureSelectionManager sSm, PDBEntry[] pdbentry,
+ public AppletJmolBinding(AppletJmol appletJmol,
+ StructureSelectionManager sSm, PDBEntry[] pdbentry,
SequenceI[][] seq, String[][] chains, String protocol)
{
super(sSm, pdbentry, seq, chains, protocol);
appletJmolBinding = appletJmol;
}
- public jalview.api.FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
+ @Override
+ public jalview.api.FeatureRenderer getFeatureRenderer(
+ AlignmentViewPanel alignment)
{
- AlignmentPanel ap = (AlignmentPanel)alignment;
- if (appletJmolBinding.ap.av.showSequenceFeatures)
+ AlignmentPanel ap = (AlignmentPanel) alignment;
+ if (appletJmolBinding.ap.av.isShowSequenceFeatures())
{
if (appletJmolBinding.fr == null)
{
@@ -65,34 +72,42 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
return appletJmolBinding.fr;
}
- public jalview.api.SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
+ @Override
+ public jalview.api.SequenceRenderer getSequenceRenderer(
+ AlignmentViewPanel alignment)
{
- return new SequenceRenderer(((AlignmentPanel)alignment).av);
+ return new SequenceRenderer(((AlignmentPanel) alignment).av);
}
+ @Override
public void sendConsoleEcho(String strEcho)
{
if (appletJmolBinding.scriptWindow == null)
+ {
appletJmolBinding.showConsole(true);
+ }
- appletJmolBinding.history.append("\n" + strEcho);
+ appletJmolBinding.addToHistory(strEcho);
}
+ @Override
public void sendConsoleMessage(String strStatus)
{
if (appletJmolBinding.history != null && strStatus != null
&& !strStatus.equals("Script completed"))
{
- appletJmolBinding.history.append("\n" + strStatus);
+ appletJmolBinding.addToHistory(strStatus);
}
}
+ @Override
public void showUrl(String url, String target)
{
appletJmolBinding.ap.alignFrame.showURL(url, target);
}
+ @Override
public void refreshGUI()
{
appletJmolBinding.updateTitleAndMenus();
@@ -101,7 +116,7 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
public void updateColours(Object source)
{
AlignmentPanel ap = (AlignmentPanel) source;
- colourBySequence(ap.av.getShowSequenceFeatures(), ap);
+ colourBySequence(ap);
}
public void showUrl(String url)
@@ -118,26 +133,26 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
public void newJmolPopup(boolean translateLocale, String menuName,
boolean asPopup)
{
-
- jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName,
- asPopup);
+ // jmolpopup = new JmolAwtPopup(); // is this used?
+ // jmolpopup.jpiInitialize((viewer), menuName);
}
+ @Override
public void notifyScriptTermination(String strStatus, int msWalltime)
{
// do nothing.
}
- public void selectionChanged(BitSet arg0)
+ public void selectionChanged(BS arg0)
{
// TODO Auto-generated method stub
}
+ @Override
public void refreshPdbEntries()
{
- // TODO Auto-generated method stub
-
+ // noop
}
@Override
@@ -147,30 +162,19 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
}
@Override
- protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
+ protected JmolAppConsoleInterface createJmolConsole(
Container consolePanel, String buttonsToShow)
{
- return new AppletConsole(viewer2, consolePanel);
+ JmolAppConsoleInterface appc = new AppletConsole();
+ appc.start(viewer);
+ return appc;
}
@Override
protected void releaseUIResources()
{
appletJmolBinding = null;
- if (console != null)
- {
- try
- {
- console.setVisible(false);
- } catch (Error e)
- {
- } catch (Exception x)
- {
- }
- ;
- console = null;
- }
-
+ closeConsole();
}
@Override
@@ -178,4 +182,17 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
{
}
+ @Override
+ public Dimension resizeInnerPanel(String data)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, Object> getJSpecViewProperty(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java
index e5b5e43..c8bb972 100644
--- a/src/jalview/appletgui/CutAndPasteTransfer.java
+++ b/src/jalview/appletgui/CutAndPasteTransfer.java
@@ -1,27 +1,54 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
-import jalview.io.*;
+import jalview.analysis.AlignmentUtils;
+import jalview.api.ComplexAlignFile;
+import jalview.bin.JalviewLite;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.io.AnnotationFile;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.FileParse;
+import jalview.io.IdentifyFile;
+import jalview.io.NewickFile;
+import jalview.io.TCoffeeScoreFile;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.TCoffeeColourScheme;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Dialog;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.TextArea;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
public class CutAndPasteTransfer extends Panel implements ActionListener,
MouseListener
@@ -32,10 +59,12 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
boolean annotationImport = false;
- Sequence seq;
+ SequenceI seq;
AlignFrame alignFrame;
+ FileParse source = null;
+
public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame)
{
try
@@ -64,10 +93,10 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
textarea.setText(text);
}
- public void setPDBImport(Sequence seq)
+ public void setPDBImport(SequenceI seq)
{
this.seq = seq;
- accept.setLabel("Accept");
+ accept.setLabel(MessageManager.getString("action.accept"));
addSequences.setVisible(false);
pdbImport = true;
}
@@ -75,14 +104,14 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
public void setTreeImport()
{
treeImport = true;
- accept.setLabel("Accept");
+ accept.setLabel(MessageManager.getString("action.accept"));
addSequences.setVisible(false);
}
public void setAnnotationImport()
{
annotationImport = true;
- accept.setLabel("Accept");
+ accept.setLabel(MessageManager.getString("action.accept"));
addSequences.setVisible(false);
}
@@ -123,90 +152,287 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
if (pdbImport)
{
- PDBEntry pdb = new PDBEntry();
- pdb.setFile(text);
-
- if (alignFrame.alignPanel.av.applet.jmolAvailable)
- new jalview.appletgui.AppletJmol(pdb, new Sequence[]
- { seq }, null, alignFrame.alignPanel, AppletFormatAdapter.PASTE);
- else
-
- new MCview.AppletPDBViewer(pdb, new Sequence[]
- { seq }, null, alignFrame.alignPanel, AppletFormatAdapter.PASTE);
+ openPdbViewer(text);
}
else if (treeImport)
{
- try
+ if (!loadTree())
{
- jalview.io.NewickFile fin = new jalview.io.NewickFile(
- textarea.getText(), "Paste");
+ return;
+ }
+ }
+ else if (annotationImport)
+ {
+ loadAnnotations();
+ }
+ else if (alignFrame != null)
+ {
+ loadAlignment(text, newWindow, alignFrame.getAlignViewport());
+ }
- fin.parse();
- if (fin.getTree() != null)
- {
- alignFrame.loadTree(fin, "Pasted tree file");
- }
+ // TODO: dialog should indicate if data was parsed correctly or not - see
+ // JAL-1102
+ if (this.getParent() instanceof Frame)
+ {
+ ((Frame) this.getParent()).setVisible(false);
+ }
+ else
+ {
+ ((Dialog) this.getParent()).setVisible(false);
+ }
+ }
+
+ /**
+ * Parses text as Newick Tree format, and loads on to the alignment. Returns
+ * true if successful, else false.
+ */
+ protected boolean loadTree()
+ {
+ try
+ {
+ NewickFile fin = new NewickFile(textarea.getText(), "Paste");
- } catch (Exception ex)
+ fin.parse();
+ if (fin.getTree() != null)
{
- textarea.setText("Could not parse Newick file!\n" + ex);
- return;
+ alignFrame.loadTree(fin, "Pasted tree file");
+ return true;
}
+ } catch (Exception ex)
+ {
+ // TODO: JAL-1102 - should have a warning message in dialog, not simply
+ // overwrite the broken input data with the exception
+ textarea.setText(MessageManager.formatMessage(
+ "label.could_not_parse_newick_file",
+ new Object[] { ex.getMessage() }));
+ return false;
}
- else if (annotationImport)
+ return false;
+ }
+
+ /**
+ * Parse text as an alignment file and add to the current or a new window.
+ *
+ * @param text
+ * @param newWindow
+ */
+ protected void loadAlignment(String text, boolean newWindow,
+ AlignViewport viewport)
+ {
+ AlignmentI al = null;
+
+ String format = new IdentifyFile().Identify(text,
+ AppletFormatAdapter.PASTE);
+ AppletFormatAdapter afa = new AppletFormatAdapter(alignFrame.alignPanel);
+ try
+ {
+ al = afa.readFile(text, AppletFormatAdapter.PASTE, format);
+ source = afa.getAlignFile();
+ } catch (java.io.IOException ex)
+ {
+ ex.printStackTrace();
+ }
+
+ if (al != null)
{
- if (new AnnotationFile().readAnnotationFile(
- alignFrame.viewport.alignment, textarea.getText(),
- jalview.io.AppletFormatAdapter.PASTE))
+ al.setDataset(null); // set dataset on alignment/sequences
+
+ /*
+ * SplitFrame option dependent on applet parameter for now.
+ */
+ boolean allowSplitFrame = alignFrame.viewport.applet
+ .getDefaultParameter("enableSplitFrame", false);
+ if (allowSplitFrame && openSplitFrame(al, format))
{
- alignFrame.alignPanel.fontChanged();
- alignFrame.alignPanel.setScrollValues(0, 0);
+ return;
+ }
+ if (newWindow)
+ {
+ AlignFrame af;
+ if (source instanceof ComplexAlignFile)
+ {
+ ColumnSelection colSel = ((ComplexAlignFile) source)
+ .getColumnSelection();
+ SequenceI[] hiddenSeqs = ((ComplexAlignFile) source)
+ .getHiddenSequences();
+ boolean showSeqFeatures = ((ComplexAlignFile) source)
+ .isShowSeqFeatures();
+ ColourSchemeI cs = ((ComplexAlignFile) source).getColourScheme();
+ af = new AlignFrame(al, hiddenSeqs, colSel,
+ alignFrame.viewport.applet, "Cut & Paste input - "
+ + format, false);
+ af.getAlignViewport().setShowSequenceFeatures(showSeqFeatures);
+ af.changeColour(cs);
+ }
+ else
+ {
+ af = new AlignFrame(al, alignFrame.viewport.applet,
+ "Cut & Paste input - " + format, false);
+ }
+
+ af.statusBar
+ .setText(MessageManager
+ .getString("label.successfully_pasted_annotation_to_alignment"));
}
else
{
- alignFrame.parseFeaturesFile(textarea.getText(),
- jalview.io.AppletFormatAdapter.PASTE);
+ alignFrame.addSequences(al.getSequencesArray());
+ alignFrame.statusBar.setText(MessageManager
+ .getString("label.successfully_pasted_alignment_file"));
}
}
- else if (alignFrame != null)
+ }
+
+ /**
+ * Check whether the new alignment could be mapped to the current one as
+ * cDNA/protein, if so offer the option to open as split frame view. Returns
+ * true if a split frame view is opened, false if not.
+ *
+ * @param al
+ * @return
+ */
+ protected boolean openSplitFrame(AlignmentI al, String format)
+ {
+ final AlignmentI thisAlignment = this.alignFrame.getAlignViewport()
+ .getAlignment();
+ if (thisAlignment.isNucleotide() == al.isNucleotide())
+ {
+ // both nucleotide or both protein
+ return false;
+ }
+ AlignmentI protein = thisAlignment.isNucleotide() ? al : thisAlignment;
+ AlignmentI dna = thisAlignment.isNucleotide() ? thisAlignment : al;
+ boolean mapped = AlignmentUtils.mapProteinToCdna(protein, dna);
+ if (!mapped)
{
- Alignment al = null;
+ return false;
+ }
- String format = new IdentifyFile().Identify(text,
- AppletFormatAdapter.PASTE);
- try
- {
- al = new AppletFormatAdapter().readFile(text,
- AppletFormatAdapter.PASTE, format);
- } catch (java.io.IOException ex)
- {
- ex.printStackTrace();
- }
+ /*
+ * A mapping is possible; ask user if they want a split frame.
+ */
+ String title = MessageManager.getString("label.open_split_window");
+ final JVDialog dialog = new JVDialog((Frame) this.getParent(), title,
+ true, 100, 400);
+ dialog.ok.setLabel(MessageManager.getString("action.yes"));
+ dialog.cancel.setLabel(MessageManager.getString("action.no"));
+ Panel question = new Panel(new BorderLayout());
+ final String text = MessageManager
+ .getString("label.open_split_window?");
+ question.add(new Label(text, Label.CENTER), BorderLayout.CENTER);
+ dialog.setMainPanel(question);
+ dialog.setVisible(true);
+ dialog.toFront();
+
+ if (!dialog.accept)
+ {
+ return false;
+ }
+
+ /*
+ * Open SplitFrame with DNA above and protein below, including the alignment
+ * from textbox and a copy of the original.
+ */
+ final JalviewLite applet = this.alignFrame.viewport.applet;
+ AlignFrame copyFrame = new AlignFrame(
+ this.alignFrame.viewport.getAlignment(), applet,
+ alignFrame.getTitle(), false, false);
+ AlignFrame newFrame = new AlignFrame(al, alignFrame.viewport.applet,
+ "Cut & Paste input - " + format, false, false);
+ AlignFrame dnaFrame = al.isNucleotide() ? newFrame : copyFrame;
+ AlignFrame proteinFrame = al.isNucleotide() ? copyFrame : newFrame;
+ SplitFrame sf = new SplitFrame(dnaFrame, proteinFrame);
+ sf.addToDisplay(false, applet);
+ return true;
+ }
- if (al != null)
+ /**
+ * Parse the text as a TCoffee score file, if successful add scores as
+ * alignment annotations.
+ */
+ protected void loadAnnotations()
+ {
+ TCoffeeScoreFile tcf = null;
+ try
+ {
+ tcf = new TCoffeeScoreFile(textarea.getText(),
+ jalview.io.AppletFormatAdapter.PASTE);
+ if (tcf.isValid())
{
- if (newWindow)
+ if (tcf.annotateAlignment(alignFrame.viewport.getAlignment(), true))
{
- AlignFrame af = new AlignFrame(al, alignFrame.viewport.applet,
- "Cut & Paste input - " + format, false);
- af.statusBar.setText("Successfully pasted alignment file");
+ alignFrame.tcoffeeColour.setEnabled(true);
+ alignFrame.alignPanel.fontChanged();
+ alignFrame.changeColour(new TCoffeeColourScheme(
+ alignFrame.viewport.getAlignment()));
+ alignFrame.statusBar
+ .setText(MessageManager
+ .getString("label.successfully_pasted_tcoffee_scores_to_alignment"));
}
else
{
- alignFrame.addSequences(al.getSequencesArray());
+ // file valid but didn't get added to alignment for some reason
+ alignFrame.statusBar.setText(MessageManager.formatMessage(
+ "label.failed_add_tcoffee_scores",
+ new Object[] { (tcf.getWarningMessage() != null ? tcf
+ .getWarningMessage() : "") }));
}
}
+ else
+ {
+ tcf = null;
+ }
+ } catch (Exception x)
+ {
+ tcf = null;
}
+ if (tcf == null)
+ {
+ if (new AnnotationFile().annotateAlignmentView(alignFrame.viewport,
+ textarea.getText(), jalview.io.AppletFormatAdapter.PASTE))
+ {
+ alignFrame.alignPanel.fontChanged();
+ alignFrame.alignPanel.setScrollValues(0, 0);
+ alignFrame.statusBar
+ .setText(MessageManager
+ .getString("label.successfully_pasted_annotation_to_alignment"));
- if (this.getParent() instanceof Frame)
+ }
+ else
+ {
+ if (!alignFrame.parseFeaturesFile(textarea.getText(),
+ jalview.io.AppletFormatAdapter.PASTE))
+ {
+ alignFrame.statusBar
+ .setText(MessageManager
+ .getString("label.couldnt_parse_pasted_text_as_valid_annotation_feature_GFF_tcoffee_file"));
+ }
+ }
+ }
+ }
+
+ /**
+ * Open a Jmol viewer (if available), failing that the built-in PDB viewer,
+ * passing the input text as the PDB file data.
+ *
+ * @param text
+ */
+ protected void openPdbViewer(String text)
+ {
+ PDBEntry pdb = new PDBEntry();
+ pdb.setFile(text);
+
+ if (alignFrame.alignPanel.av.applet.jmolAvailable)
{
- ((Frame) this.getParent()).setVisible(false);
+ new jalview.appletgui.AppletJmol(pdb, new SequenceI[] { seq }, null,
+ alignFrame.alignPanel, AppletFormatAdapter.PASTE);
}
else
{
- ((Dialog) this.getParent()).setVisible(false);
+ new MCview.AppletPDBViewer(pdb, new SequenceI[] { seq }, null,
+ alignFrame.alignPanel, AppletFormatAdapter.PASTE);
}
}
@@ -238,7 +464,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
private void jbInit() throws Exception
{
textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10));
- textarea.setText("Paste your alignment file here");
+ textarea.setText(MessageManager
+ .getString("label.paste_your_alignment_file"));
textarea.addMouseListener(this);
this.setLayout(borderLayout1);
accept.addActionListener(this);
@@ -253,7 +480,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
public void mousePressed(MouseEvent evt)
{
- if (textarea.getText().startsWith("Paste your"))
+ if (textarea.getText().startsWith(
+ MessageManager.getString("label.paste_your")))
{
textarea.setText("");
}
diff --git a/src/jalview/appletgui/EditNameDialog.java b/src/jalview/appletgui/EditNameDialog.java
index 162750a..3ebe791 100644
--- a/src/jalview/appletgui/EditNameDialog.java
+++ b/src/jalview/appletgui/EditNameDialog.java
@@ -1,23 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.TextField;
public class EditNameDialog extends JVDialog
{
diff --git a/src/jalview/appletgui/EmbmenuFrame.java b/src/jalview/appletgui/EmbmenuFrame.java
index 005f4a3..906933a 100644
--- a/src/jalview/appletgui/EmbmenuFrame.java
+++ b/src/jalview/appletgui/EmbmenuFrame.java
@@ -1,314 +1,272 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.appletgui;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Container;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.GraphicsConfiguration;
-import java.awt.HeadlessException;
-import java.awt.Label;
-import java.awt.Menu;
-import java.awt.MenuBar;
-import java.awt.Panel;
-import java.awt.PopupMenu;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-/**
- * This class implements a pattern form embedding toolbars as a panel with
- * popups for situations where the system menu bar is either invisible or
- * inappropriate. It was derived from the code for embedding the jalview applet
- * alignFrame as a component on the web-page, which requires the local
- * alignFrame menu to be attached to that panel rather than placed on the parent
- * (which isn't allowed anyhow). TODO: try to modify the embeddedMenu display so
- * it looks like a real toolbar menu TODO: modify click/mouse handler for
- * embeddedMenu so it behaves more like a real pulldown menu toolbar
- *
- * @author Jim Procter and Andrew Waterhouse
- *
- */
-public class EmbmenuFrame extends Frame implements MouseListener
-{
- /**
- * map from labels to popup menus for the embedded menubar
- */
- protected Hashtable embeddedPopup;
-
- /**
- * the embedded menu is built on this and should be added to the frame at the
- * appropriate position.
- *
- */
- protected Panel embeddedMenu;
-
- public EmbmenuFrame() throws HeadlessException
- {
- super();
- }
-
- public EmbmenuFrame(String title) throws HeadlessException
- {
- super(title);
- }
-
- /**
- * Check if the applet is running on a platform that requires the Frame
- * menuBar to be embedded, and if so, embeds it.
- *
- * @param tobeAdjusted
- * the panel that is to be reduced to make space for the embedded
- * menu bar
- * @return true if menuBar was embedded and tobeAdjusted's height modified
- */
- protected boolean embedMenuIfNeeded(Panel tobeAdjusted)
- {
- MenuBar topMenuBar = getMenuBar();
- if (topMenuBar == null)
- {
- return false;
- }
- // DEBUG Hint: can test embedded menus by inserting true here.
- if (new jalview.util.Platform().isAMac())
- {
- // Build the embedded menu panel
- embeddedMenu = makeEmbeddedPopupMenu(topMenuBar, "Arial", Font.PLAIN,
- 10, true); // try to pickup system font.
- setMenuBar(null);
- // add the components to the TreePanel area.
- add(embeddedMenu, BorderLayout.NORTH);
- tobeAdjusted.setSize(getSize().width, getSize().height
- - embeddedMenu.HEIGHT);
- return true;
- }
- return false;
- }
-
- /**
- * move all menus on menuBar onto embeddedMenu. embeddedPopup is used to store
- * the popups for each menu removed from the menuBar and added to the panel.
- * NOTE: it is up to the caller to remove menuBar from the Frame if it is
- * already attached.
- *
- * @param menuBar
- * @param fn
- * @param fstyle
- * @param fsz
- * @param overrideFonts
- * true if we take the menuBar fonts in preference to the supplied
- * defaults
- * @return the embedded menu instance to be added to the frame.
- */
- protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn,
- int fstyle, int fsz, boolean overrideFonts)
- {
- return makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz, overrideFonts,
- false);
- }
-
- /**
- * Create or add elements to the embedded menu from menuBar. This removes all
- * menu from menuBar and it is up to the caller to remove the now useless
- * menuBar from the Frame if it is already attached.
- *
- * @param menuBar
- * @param fn
- * @param fstyle
- * @param fsz
- * @param overrideFonts
- * @param append
- * true means existing menu will be emptied before adding new
- * elements
- * @return
- */
- protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn,
- int fstyle, int fsz, boolean overrideFonts, boolean append)
- {
- if (!append)
- {
- if (embeddedPopup != null)
- {
- embeddedPopup.clear(); // TODO: check if j1.1
- }
- if (embeddedMenu != null)
- {
- embeddedMenu.removeAll();
- }
- }
- if (embeddedPopup == null)
- {
- embeddedPopup = new Hashtable();
- }
-
- embeddedMenu = makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz,
- overrideFonts, embeddedPopup, new Panel(), this);
- return embeddedMenu;
- }
-
- /**
- * Generic method to move elements from menubar onto embeddedMenu using the
- * existing or the supplied font, and adds binding from panel to attached
- * menus in embeddedPopup This removes all menu from menuBar and it is up to
- * the caller to remove the now useless menuBar from the Frame if it is
- * already attached.
- *
- * @param menuBar
- * must be non-null
- * @param fn
- * @param fstyle
- * @param fsz
- * @param overrideFonts
- * @param embeddedPopup
- * must be non-null
- * @param embeddedMenu
- * if null, a new panel will be created and returned
- * @param clickHandler
- * - usually the instance of EmbmenuFrame that holds references to
- * embeddedPopup and embeddedMenu
- * @return the panel instance for convenience.
- */
- protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn,
- int fstyle, int fsz, boolean overrideFonts,
- Hashtable embeddedPopup, Panel embeddedMenu,
- MouseListener clickHandler)
- {
- if (embeddedPopup == null)
- {
- throw new Error(
- "Implementation error - embeddedPopup must be non-null");
- }
- if (overrideFonts)
- {
- Font mbf = menuBar.getFont();
- if (mbf != null)
- {
- fn = mbf.getName();
- fstyle = mbf.getStyle();
- fsz = mbf.getSize();
- }
- }
- if (embeddedMenu == null)
- embeddedMenu = new Panel();
- FlowLayout flowLayout1 = new FlowLayout();
- embeddedMenu.setBackground(Color.lightGray);
- embeddedMenu.setLayout(flowLayout1);
- // loop thru
- for (int mbi = 0, nMbi = menuBar.getMenuCount(); mbi < nMbi; mbi++)
- {
- Menu mi = menuBar.getMenu(mbi);
- Label elab = new Label(mi.getLabel());
- elab.setFont(new java.awt.Font(fn, fstyle, fsz));
- // add the menu entries
- PopupMenu popup = new PopupMenu();
- int m, mSize = mi.getItemCount();
- for (m = 0; m < mSize; m++)
- {
- popup.add(mi.getItem(m));
- mSize--;
- m--;
- }
- embeddedPopup.put(elab, popup);
- embeddedMenu.add(elab);
- elab.addMouseListener(clickHandler);
- }
- flowLayout1.setAlignment(FlowLayout.LEFT);
- flowLayout1.setHgap(2);
- flowLayout1.setVgap(0);
- return embeddedMenu;
- }
-
- public void mousePressed(MouseEvent evt)
- {
- PopupMenu popup = null;
- Label source = (Label) evt.getSource();
- popup = getPopupMenu(source);
- if (popup != null)
- {
- embeddedMenu.add(popup);
- popup.show(embeddedMenu, source.getBounds().x, source.getBounds().y
- + source.getBounds().getSize().height);
- }
- }
-
- /**
- * get the menu for source from the hash.
- *
- * @param source
- * what was clicked on.
- */
- PopupMenu getPopupMenu(Label source)
- {
- return (PopupMenu) embeddedPopup.get(source);
- }
-
- public void mouseClicked(MouseEvent evt)
- {
- }
-
- public void mouseReleased(MouseEvent evt)
- {
- }
-
- public void mouseEntered(MouseEvent evt)
- {
- }
-
- public void mouseExited(MouseEvent evt)
- {
- }
-
- /**
- * called to clear the GUI resources taken up for embedding and remove any
- * self references so we can be garbage collected.
- */
- public void destroyMenus()
- {
- if (embeddedPopup != null)
- {
- Enumeration e = embeddedPopup.keys();
- while (e.hasMoreElements())
- {
- Label lb = (Label) e.nextElement();
- lb.removeMouseListener(this);
- }
- embeddedPopup.clear();
- }
- if (embeddedMenu != null)
- {
- embeddedMenu.removeAll();
- }
- }
-
- /**
- * calls destroyMenus()
- */
- public void finalize() throws Throwable
- {
- destroyMenus();
- embeddedPopup = null;
- embeddedMenu = null;
- super.finalize();
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.appletgui;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.HeadlessException;
+import java.awt.Label;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.Panel;
+import java.awt.PopupMenu;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This class implements a pattern for embedding toolbars as a panel with popups
+ * for situations where the system menu bar is either invisible or
+ * inappropriate. It was derived from the code for embedding the jalview applet
+ * alignFrame as a component on the web-page, which requires the local
+ * alignFrame menu to be attached to that panel rather than placed on the parent
+ * (which isn't allowed anyhow). TODO: try to modify the embeddedMenu display so
+ * it looks like a real toolbar menu TODO: modify click/mouse handler for
+ * embeddedMenu so it behaves more like a real pulldown menu toolbar
+ *
+ * @author Jim Procter and Andrew Waterhouse
+ *
+ */
+public class EmbmenuFrame extends Frame implements MouseListener
+{
+ protected static final Font FONT_ARIAL_PLAIN_11 = new Font("Arial",
+ Font.PLAIN, 11);
+
+ public static final Font DEFAULT_MENU_FONT = FONT_ARIAL_PLAIN_11;
+
+ /**
+ * map from labels to popup menus for the embedded menubar
+ */
+ protected Map<Label, PopupMenu> embeddedPopup = new HashMap<Label, PopupMenu>();
+
+ /**
+ * the embedded menu is built on this and should be added to the frame at the
+ * appropriate position.
+ *
+ */
+ protected Panel embeddedMenu;
+
+ public EmbmenuFrame() throws HeadlessException
+ {
+ super();
+ }
+
+ public EmbmenuFrame(String title) throws HeadlessException
+ {
+ super(title);
+ }
+
+ /**
+ * Check if the applet is running on a platform that requires the Frame
+ * menuBar to be embedded, and if so, embeds it.
+ *
+ * @param tobeAdjusted
+ * the panel that is to be reduced to make space for the embedded
+ * menu bar
+ * @return true if menuBar was embedded and tobeAdjusted's height modified
+ */
+ protected boolean embedMenuIfNeeded(Panel tobeAdjusted)
+ {
+ MenuBar topMenuBar = getMenuBar();
+ if (topMenuBar == null)
+ {
+ return false;
+ }
+ // DEBUG Hint: can test embedded menus by inserting true here.
+ if (new jalview.util.Platform().isAMac())
+ {
+ // Build the embedded menu panel, allowing override with system font
+ embeddedMenu = makeEmbeddedPopupMenu(topMenuBar, true, false);
+ setMenuBar(null);
+ // add the components to the Panel area.
+ add(embeddedMenu, BorderLayout.NORTH);
+ tobeAdjusted.setSize(getSize().width,
+ getSize().height - embeddedMenu.getHeight());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Create or add elements to the embedded menu from menuBar. This removes all
+ * menu from menuBar and it is up to the caller to remove the now useless
+ * menuBar from the Frame if it is already attached.
+ *
+ * @param menuBar
+ * @param overrideFonts
+ * @param append
+ * true means existing menu will be emptied before adding new
+ * elements
+ * @return
+ */
+ protected Panel makeEmbeddedPopupMenu(MenuBar menuBar,
+ boolean overrideFonts, boolean append)
+ {
+ if (!append)
+ {
+ embeddedPopup.clear(); // TODO: check if j1.1
+ if (embeddedMenu != null)
+ {
+ embeddedMenu.removeAll();
+ }
+ }
+ embeddedMenu = makeEmbeddedPopupMenu(menuBar, DEFAULT_MENU_FONT,
+ overrideFonts, new Panel(), this);
+ return embeddedMenu;
+ }
+
+ /**
+ * Generic method to move elements from menubar onto embeddedMenu using the
+ * existing or the supplied font, and adds binding from panel to attached
+ * menus in embeddedPopup This removes all menu from menuBar and it is up to
+ * the caller to remove the now useless menuBar from the Frame if it is
+ * already attached.
+ *
+ * @param menuBar
+ * must be non-null
+ * @param font
+ * @param overrideFonts
+ * @param embeddedMenu
+ * if null, a new panel will be created and returned
+ * @param clickHandler
+ * - usually the instance of EmbmenuFrame that holds references to
+ * embeddedPopup and embeddedMenu
+ * @return the panel instance for convenience.
+ */
+ protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, Font font,
+ boolean overrideFonts, Panel embeddedMenu,
+ MouseListener clickHandler)
+ {
+ if (overrideFonts)
+ {
+ Font mbf = menuBar.getFont();
+ if (mbf != null)
+ {
+ font = mbf;
+ }
+ }
+ if (embeddedMenu == null)
+ {
+ embeddedMenu = new Panel();
+ }
+ FlowLayout flowLayout1 = new FlowLayout();
+ embeddedMenu.setBackground(Color.lightGray);
+ embeddedMenu.setLayout(flowLayout1);
+ // loop thru
+ for (int mbi = 0, nMbi = menuBar.getMenuCount(); mbi < nMbi; mbi++)
+ {
+ Menu mi = menuBar.getMenu(mbi);
+ Label elab = new Label(mi.getLabel());
+ elab.setFont(font);
+ // add the menu entries
+ PopupMenu popup = new PopupMenu();
+ int m, mSize = mi.getItemCount();
+ for (m = 0; m < mSize; m++)
+ {
+ popup.add(mi.getItem(m));
+ mSize--;
+ m--;
+ }
+ embeddedPopup.put(elab, popup);
+ embeddedMenu.add(elab);
+ elab.addMouseListener(clickHandler);
+ }
+ flowLayout1.setAlignment(FlowLayout.LEFT);
+ flowLayout1.setHgap(2);
+ flowLayout1.setVgap(0);
+ return embeddedMenu;
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ PopupMenu popup = null;
+ Label source = (Label) evt.getSource();
+ popup = getPopupMenu(source);
+ if (popup != null)
+ {
+ embeddedMenu.add(popup);
+ popup.show(embeddedMenu, source.getBounds().x, source.getBounds().y
+ + source.getBounds().getSize().height);
+ }
+ }
+
+ /**
+ * get the menu for source from the hash.
+ *
+ * @param source
+ * what was clicked on.
+ */
+ PopupMenu getPopupMenu(Label source)
+ {
+ return embeddedPopup.get(source);
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ /**
+ * called to clear the GUI resources taken up for embedding and remove any
+ * self references so we can be garbage collected.
+ */
+ public void destroyMenus()
+ {
+ if (embeddedPopup != null)
+ {
+ for (Label lb : embeddedPopup.keySet())
+ {
+ lb.removeMouseListener(this);
+ }
+ embeddedPopup.clear();
+ }
+ if (embeddedMenu != null)
+ {
+ embeddedMenu.removeAll();
+ }
+ }
+
+ /**
+ * calls destroyMenus()
+ */
+ public void finalize() throws Throwable
+ {
+ destroyMenus();
+ embeddedPopup = null;
+ embeddedMenu = null;
+ super.finalize();
+ }
+}
diff --git a/src/jalview/appletgui/ExtJmol.java b/src/jalview/appletgui/ExtJmol.java
index b3d1a3c..6479296 100644
--- a/src/jalview/appletgui/ExtJmol.java
+++ b/src/jalview/appletgui/ExtJmol.java
@@ -1,38 +1,42 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.Container;
-import java.util.BitSet;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.jmol.api.JmolAppConsoleInterface;
-import org.jmol.api.JmolViewer;
-
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureRenderer;
import jalview.api.SequenceRenderer;
-import jalview.datamodel.AlignmentI;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JalviewJmolBinding;
+import java.awt.Container;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.jmol.api.JmolAppConsoleInterface;
+import org.jmol.java.BS;
+import org.jmol.viewer.Viewer;
+
/**
* bind an alignment view to an external Jmol instance.
*
@@ -48,15 +52,15 @@ public class ExtJmol extends JalviewJmolBinding
PDBEntry[] pdbentry, SequenceI[][] seq, String[][] chains,
String protocol)
{
- super(alframe.alignPanel.getStructureSelectionManager(), pdbentry, seq, chains, protocol);
+ super(alframe.alignPanel.getStructureSelectionManager(), pdbentry, seq,
+ chains, protocol);
}
- public ExtJmol(JmolViewer viewer, AlignmentPanel alignPanel,
+ public ExtJmol(Viewer viewer, AlignmentPanel alignPanel,
SequenceI[][] seqs)
{
- super(alignPanel.getStructureSelectionManager(), viewer);
+ super(alignPanel.getStructureSelectionManager(), seqs, viewer);
ap = alignPanel;
- this.sequence = seqs;
notifyFileLoaded(null, null, null, null, 0);
}
@@ -72,10 +76,11 @@ public class ExtJmol extends JalviewJmolBinding
showUrl(arg0, "jmol");
}
+ @Override
public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
{
- AlignmentPanel ap = (AlignmentPanel)alignment;
- if (ap.av.showSequenceFeatures)
+ AlignmentPanel ap = (AlignmentPanel) alignment;
+ if (ap.av.isShowSequenceFeatures())
{
return ap.getFeatureRenderer();
}
@@ -85,66 +90,78 @@ public class ExtJmol extends JalviewJmolBinding
}
}
+ @Override
public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
{
- return ((AlignmentPanel)alignment).getSequenceRenderer();
+ return ((AlignmentPanel) alignment).getSequenceRenderer();
}
+ @Override
public void notifyScriptTermination(String strStatus, int msWalltime)
{
// ignore
}
+ @Override
public void sendConsoleEcho(String strEcho)
{
// ignore
}
+ @Override
public void sendConsoleMessage(String strStatus)
{
// ignore
}
+ @Override
public void showUrl(String url, String target)
{
ap.alignFrame.showURL(url, target);
}
+ @Override
public void refreshGUI()
{
// ignore
}
- public void selectionChanged(BitSet arg0)
+ public void selectionChanged(BS arg0)
{
System.out.println(arg0);
}
+ @Override
public void refreshPdbEntries()
{
- Vector pdbe = new Vector();
- Hashtable fileids = new Hashtable();
+ List<PDBEntry> pdbe = new ArrayList<PDBEntry>();
+ List<String> fileids = new ArrayList<String>();
SequenceI[] sq = ap.av.getAlignment().getSequencesArray();
for (int s = 0; s < sq.length; s++)
{
- Vector pdbids = sq[s].getPDBId();
+ Vector<PDBEntry> pdbids = sq[s].getAllPDBEntries();
if (pdbids != null)
{
for (int pe = 0, peSize = pdbids.size(); pe < peSize; pe++)
{
- PDBEntry pentry = (PDBEntry) pdbids.elementAt(pe);
- if (!fileids.containsKey(pentry.getId()))
+ PDBEntry pentry = pdbids.elementAt(pe);
+ if (!fileids.contains(pentry.getId()))
{
- pdbe.addElement(pentry);
+ pdbe.add(pentry);
+ }
+ else
+ {
+ fileids.add(pentry.getId());
}
}
}
}
- pdbentry = new PDBEntry[pdbe.size()];
+ PDBEntry[] newEntries = new PDBEntry[pdbe.size()];
for (int pe = 0; pe < pdbe.size(); pe++)
{
- pdbentry[pe] = (PDBEntry) pdbe.elementAt(pe);
+ newEntries[pe] = pdbe.get(pe);
}
+ setPdbentry(newEntries);
}
@Override
@@ -158,7 +175,7 @@ public class ExtJmol extends JalviewJmolBinding
}
@Override
- protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
+ protected JmolAppConsoleInterface createJmolConsole(
Container consolePanel, String buttonsToShow)
{
// TODO Auto-generated method stub
@@ -169,19 +186,7 @@ public class ExtJmol extends JalviewJmolBinding
protected void releaseUIResources()
{
ap = null;
- if (console != null)
- {
- try
- {
- console.setVisible(false);
- } catch (Error e)
- {
- } catch (Exception x)
- {
- }
- ;
- console = null;
- }
+ closeConsole();
}
@@ -189,7 +194,14 @@ public class ExtJmol extends JalviewJmolBinding
public void releaseReferences(Object svl)
{
// TODO Auto-generated method stub
-
+
+ }
+
+ @Override
+ public Map<String, Object> getJSpecViewProperty(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
}
}
diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java
index a35cf49..e6e87f2 100644
--- a/src/jalview/appletgui/FeatureColourChooser.java
+++ b/src/jalview/appletgui/FeatureColourChooser.java
@@ -1,30 +1,51 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import java.awt.Rectangle;
+import jalview.datamodel.GraphLine;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.GraduatedColor;
+import jalview.util.MessageManager;
+
+import java.awt.Checkbox;
+import java.awt.Choice;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.Scrollbar;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.Hashtable;
public class FeatureColourChooser extends Panel implements ActionListener,
AdjustmentListener, ItemListener, MouseListener
@@ -70,10 +91,10 @@ public class FeatureColourChooser extends Panel implements ActionListener,
{
this.type = type;
fr = frenderer;
- float mm[] = ((float[][]) fr.minmax.get(type))[0];
+ float mm[] = ((float[][]) fr.getMinMax().get(type))[0];
min = mm[0];
max = mm[1];
- oldcs = fr.featureColours.get(type);
+ oldcs = fr.getFeatureColours().get(type);
if (oldcs instanceof GraduatedColor)
{
cs = new GraduatedColor((GraduatedColor) oldcs, min, max);
@@ -113,7 +134,8 @@ public class FeatureColourChooser extends Panel implements ActionListener,
slider.addAdjustmentListener(this);
slider.addMouseListener(this);
owner = (af != null) ? af : fs.frame;
- frame = new JVDialog(owner, "Graduated Feature Colour for " + type,
+ frame = new JVDialog(owner, MessageManager.formatMessage(
+ "label.graduated_color_for_params", new String[] { type }),
true, 480, 248);
frame.setMainPanel(this);
validate();
@@ -126,7 +148,7 @@ public class FeatureColourChooser extends Panel implements ActionListener,
{
// cancel
reset();
- PaintRefresher.Refresh(this, fr.av.getSequenceSetId());
+ PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId());
frame.setVisible(false);
}
}
@@ -144,7 +166,8 @@ public class FeatureColourChooser extends Panel implements ActionListener,
private void jbInit() throws Exception
{
- Label minLabel = new Label("Min:"), maxLabel = new Label("Max:");
+ Label minLabel = new Label(MessageManager.getString("label.min")), maxLabel = new Label(
+ MessageManager.getString("label.max"));
minLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
maxLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
// minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
@@ -168,9 +191,12 @@ public class FeatureColourChooser extends Panel implements ActionListener,
jPanel2.setBackground(Color.white);
jPanel4.setBackground(Color.white);
threshold.addItemListener(this);
- threshold.addItem("No Threshold");
- threshold.addItem("Above Threshold");
- threshold.addItem("Below Threshold");
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_no_thereshold"));
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_above_thereshold"));
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_below_thereshold"));
thresholdValue.addActionListener(this);
slider.setBackground(Color.white);
slider.setEnabled(false);
@@ -183,11 +209,13 @@ public class FeatureColourChooser extends Panel implements ActionListener,
jPanel3.setBackground(Color.white);
colourFromLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
- colourFromLabel.setLabel("Colour by Label");
+ colourFromLabel.setLabel(MessageManager
+ .getString("label.colour_by_label"));
colourFromLabel.setSize(new Dimension(139, 22));
// threshold.setBounds(new Rectangle(11, 3, 139, 22));
thresholdIsMin.setBackground(Color.white);
- thresholdIsMin.setLabel("Threshold is min/max");
+ thresholdIsMin.setLabel(MessageManager
+ .getString("label.threshold_minmax"));
thresholdIsMin.setSize(new Dimension(135, 23));
// thresholdIsMin.setBounds(new Rectangle(328, 3, 135, 23));
jPanel1.add(minLabel);
@@ -279,7 +307,7 @@ public class FeatureColourChooser extends Panel implements ActionListener,
threshline.value = (float) slider.getValue() / 1000f;
cs.setThresh(threshline.value);
changeColour();
- PaintRefresher.Refresh(this, fr.av.getSequenceSetId());
+ PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId());
// ap.paintAlignment(false);
}
@@ -289,7 +317,7 @@ public class FeatureColourChooser extends Panel implements ActionListener,
{
UserDefinedColours udc = new UserDefinedColours(this,
minColour.getBackground(), owner,
- "Select Colour for Minimum Value"); // frame.owner,
+ MessageManager.getString("label.select_colour_minimum_value")); // frame.owner,
}
else
{
@@ -310,7 +338,7 @@ public class FeatureColourChooser extends Panel implements ActionListener,
// "Select Colour for Maximum Value",maxColour.getBackground(),true);
UserDefinedColours udc = new UserDefinedColours(this,
maxColour.getBackground(), owner,
- "Select Colour for Maximum Value");
+ MessageManager.getString("label.select_colour_maximum_value"));
}
else
{
@@ -330,11 +358,11 @@ public class FeatureColourChooser extends Panel implements ActionListener,
}
int aboveThreshold = AnnotationColourGradient.NO_THRESHOLD;
- if (threshold.getSelectedItem().equals("Above Threshold"))
+ if (threshold.getSelectedIndex() == 1)
{
aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD;
}
- else if (threshold.getSelectedItem().equals("Below Threshold"))
+ else if (threshold.getSelectedIndex() == 2)
{
aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;
}
@@ -392,16 +420,16 @@ public class FeatureColourChooser extends Panel implements ActionListener,
}
}
- fr.featureColours.put(type, acg);
+ fr.setColour(type, acg);
cs = acg;
- PaintRefresher.Refresh(this, fr.av.getSequenceSetId());
+ PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId());
// ap.paintAlignment(false);
}
void reset()
{
- fr.featureColours.put(type, oldcs);
- PaintRefresher.Refresh(this, fr.av.getSequenceSetId());
+ fr.setColour(type, oldcs);
+ PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId());
// ap.paintAlignment(true);
}
@@ -423,7 +451,7 @@ public class FeatureColourChooser extends Panel implements ActionListener,
}
else
{
- PaintRefresher.Refresh(this, fr.av.getSequenceSetId());
+ PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId());
}
// ap.paintAlignment(true);
}
diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java
index 39249cc..1dc48d2 100644
--- a/src/jalview/appletgui/FeatureRenderer.java
+++ b/src/jalview/appletgui/FeatureRenderer.java
@@ -1,32 +1,49 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-
-import java.awt.event.*;
-
-import jalview.appletgui.FeatureSettings.MyCheckbox;
-import jalview.datamodel.*;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.GraduatedColor;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Choice;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.ScrollPane;
+import java.awt.TextArea;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Hashtable;
/**
* DOCUMENT ME!
@@ -34,73 +51,27 @@ import jalview.schemes.GraduatedColor;
* @author $author$
* @version $Revision$
*/
-public class FeatureRenderer implements jalview.api.FeatureRenderer
+public class FeatureRenderer extends
+ jalview.renderer.seqfeatures.FeatureRenderer
{
- AlignViewport av;
-
- Hashtable featureColours = new Hashtable();
-
- // A higher level for grouping features of a
- // particular type
- Hashtable featureGroups = null;
// Holds web links for feature groups and feature types
// in the form label|link
Hashtable featureLinks = null;
- // This is actually an Integer held in the hashtable,
- // Retrieved using the key feature type
- Object currentColour;
-
- String[] renderOrder;
-
- FontMetrics fm;
-
- int charOffset;
-
- float transparency = 1f;
-
- TransparencySetter transparencySetter = null;
-
/**
* Creates a new FeatureRenderer object.
*
* @param av
* DOCUMENT ME!
*/
- public FeatureRenderer(AlignViewport av)
+ public FeatureRenderer(AlignmentViewport av)
{
+ super();
this.av = av;
- if (!System.getProperty("java.version").startsWith("1.1"))
- {
- transparencySetter = new TransparencySetter();
- }
- }
-
- public void transferSettings(FeatureRenderer fr)
- {
- renderOrder = fr.renderOrder;
- featureGroups = fr.featureGroups;
- featureColours = fr.featureColours;
- transparency = fr.transparency;
- if (av!=null && fr.av!=null && fr.av!=av)
- {
- if (fr.av.featuresDisplayed!=null)
- {
- if (av.featuresDisplayed==null)
- {
- av.featuresDisplayed = new Hashtable();
- } else {
- av.featuresDisplayed.clear();
- }
- Enumeration en=fr.av.featuresDisplayed.keys();
- while (en.hasMoreElements())
- {
- av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE);
- }
- }
- }
+ setTransparencyAvailable(!System.getProperty("java.version")
+ .startsWith("1.1"));
}
static String lastFeatureAdded;
@@ -146,7 +117,9 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
}
else
{
- throw new Error("Invalid color for MyCheckBox");
+ throw new Error(
+ MessageManager
+ .getString("error.invalid_colour_for_mycheckbox"));
}
if (col != null)
{
@@ -193,7 +166,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
g.setColor(Color.black);
Font f = new Font("Verdana", Font.PLAIN, 10);
g.setFont(f);
- g.drawString("Label", 0, 0);
+ g.drawString(MessageManager.getString("label.label"), 0, 0);
}
else
{
@@ -243,7 +216,9 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
+ "-" + features[i].getEnd();
if (features[i].getFeatureGroup() != null)
+ {
item += " (" + features[i].getFeatureGroup() + ")";
+ }
overlaps.addItem(item);
}
@@ -348,8 +323,10 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
}
}
- String title = newFeatures ? "Create New Sequence Feature(s)"
- : "Amend/Delete Features for " + sequences[0].getName();
+ String title = newFeatures ? MessageManager
+ .getString("label.create_new_sequence_features")
+ : MessageManager.formatMessage("label.amend_delete_features",
+ new String[] { sequences[0].getName() });
final JVDialog dialog = new JVDialog(ap.alignFrame, title, true, 385,
240);
@@ -363,7 +340,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
}
else
{
- dialog.ok.setLabel("Amend");
+ dialog.ok.setLabel(MessageManager.getString("label.amend"));
dialog.buttonPanel.add(deleteButton, 1);
deleteButton.addActionListener(new ActionListener()
{
@@ -422,7 +399,9 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
}
if (lastFeatureGroupAdded != null && lastFeatureGroupAdded.length() < 1)
+ {
lastFeatureGroupAdded = null;
+ }
if (!newFeatures)
{
@@ -447,6 +426,8 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
}
ffile.parseDescriptionHTML(sf, false);
+ setVisible(lastFeatureAdded); // if user edited name then make sure new
+ // type is visible
}
if (deleteFeature)
{
@@ -467,36 +448,17 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
ffile.parseDescriptionHTML(features[i], false);
}
- if (av.featuresDisplayed == null)
- {
- av.featuresDisplayed = new Hashtable();
- }
-
- if (featureGroups == null)
- {
- featureGroups = new Hashtable();
- }
-
- col = colourPanel.getBackground();
+ Color newColour = colourPanel.getBackground();
// setColour(lastFeatureAdded, fcol);
if (lastFeatureGroupAdded != null)
{
- featureGroups.put(lastFeatureGroupAdded, new Boolean(true));
- }
- if (fcol instanceof Color)
- {
- setColour(lastFeatureAdded, fcol);
+ setGroupVisibility(lastFeatureGroupAdded, true);
}
- av.featuresDisplayed.put(lastFeatureAdded,
- getFeatureStyle(lastFeatureAdded));
-
- findAllFeatures();
-
- String[] tro = new String[renderOrder.length];
- tro[0] = renderOrder[renderOrder.length - 1];
- System.arraycopy(renderOrder, 0, tro, 1, renderOrder.length - 1);
- renderOrder = tro;
+ setColour(lastFeatureAdded, newColour); // was fcol
+ setVisible(lastFeatureAdded);
+ findAllFeatures(false); // different to original applet behaviour ?
+ // findAllFeatures();
}
else
{
@@ -505,9 +467,9 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
}
}
// refresh the alignment and the feature settings dialog
- if (av.featureSettings != null)
+ if (((jalview.appletgui.AlignViewport) av).featureSettings != null)
{
- av.featureSettings.refreshTable();
+ ((jalview.appletgui.AlignViewport) av).featureSettings.refreshTable();
}
// findAllFeatures();
@@ -515,752 +477,4 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
return true;
}
-
- public Color findFeatureColour(Color initialCol, SequenceI seq, int i)
- {
- overview = true;
- if (!av.showSequenceFeatures)
- {
- return initialCol;
- }
-
- lastSeq = seq;
- sequenceFeatures = lastSeq.getSequenceFeatures();
- if (sequenceFeatures == null)
- {
- return initialCol;
- }
-
- sfSize = sequenceFeatures.length;
-
- if (jalview.util.Comparison.isGap(lastSeq.getCharAt(i)))
- {
- return Color.white;
- }
-
- currentColour = null;
-
- drawSequence(null, lastSeq, lastSeq.findPosition(i), -1, -1);
-
- if (currentColour == null)
- {
- return initialCol;
- }
-
- return new Color(((Integer) currentColour).intValue());
- }
-
- /**
- * This is used by the Molecule Viewer to get the accurate colour of the
- * rendered sequence
- */
- boolean overview = false;
-
- /**
- * DOCUMENT ME!
- *
- * @param g
- * DOCUMENT ME!
- * @param seq
- * DOCUMENT ME!
- * @param sg
- * DOCUMENT ME!
- * @param start
- * DOCUMENT ME!
- * @param end
- * DOCUMENT ME!
- * @param x1
- * DOCUMENT ME!
- * @param y1
- * DOCUMENT ME!
- * @param width
- * DOCUMENT ME!
- * @param height
- * DOCUMENT ME!
- */
- // String type;
- // SequenceFeature sf;
- SequenceI lastSeq;
-
- SequenceFeature[] sequenceFeatures;
-
- int sfSize, sfindex, spos, epos;
-
- synchronized public void drawSequence(Graphics g, SequenceI seq,
- int start, int end, int y1)
- {
- if (seq.getSequenceFeatures() == null
- || seq.getSequenceFeatures().length == 0)
- {
- return;
- }
-
- if (transparencySetter != null && g != null)
- {
- transparencySetter.setTransparency(g, transparency);
- }
-
- if (lastSeq == null || seq != lastSeq
- || sequenceFeatures != seq.getSequenceFeatures())
- {
- lastSeq = seq;
- sequenceFeatures = seq.getSequenceFeatures();
- sfSize = sequenceFeatures.length;
- }
-
- if (av.featuresDisplayed == null || renderOrder == null)
- {
- findAllFeatures();
- if (av.featuresDisplayed.size() < 1)
- {
- return;
- }
-
- sequenceFeatures = seq.getSequenceFeatures();
- sfSize = sequenceFeatures.length;
- }
- if (!overview)
- {
- spos = lastSeq.findPosition(start);
- epos = lastSeq.findPosition(end);
- if (g != null)
- {
- fm = g.getFontMetrics();
- }
- }
- String type;
- for (int renderIndex = 0; renderIndex < renderOrder.length; renderIndex++)
- {
- type = renderOrder[renderIndex];
- if (!av.featuresDisplayed.containsKey(type))
- {
- continue;
- }
-
- // loop through all features in sequence to find
- // current feature to render
- for (sfindex = 0; sfindex < sfSize; sfindex++)
- {
- if (!sequenceFeatures[sfindex].type.equals(type))
- {
- continue;
- }
-
- if (featureGroups != null
- && sequenceFeatures[sfindex].featureGroup != null
- && featureGroups
- .containsKey(sequenceFeatures[sfindex].featureGroup)
- && !((Boolean) featureGroups
- .get(sequenceFeatures[sfindex].featureGroup))
- .booleanValue())
- {
- continue;
- }
-
- if (!overview
- && (sequenceFeatures[sfindex].getBegin() > epos || sequenceFeatures[sfindex]
- .getEnd() < spos))
- {
- continue;
- }
-
- if (overview)
- {
- if (sequenceFeatures[sfindex].begin <= start
- && sequenceFeatures[sfindex].end >= start)
- {
- currentColour = new Integer(
- getColour(sequenceFeatures[sfindex]).getRGB());// av.featuresDisplayed
- // .get(sequenceFeatures[sfindex].type);
- }
-
- }
- else if (sequenceFeatures[sfindex].type.equals("disulfide bond"))
- {
-
- renderFeature(g, seq,
- seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
- seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
- getColour(sequenceFeatures[sfindex])
- // new Color(((Integer) av.featuresDisplayed
- // .get(sequenceFeatures[sfindex].type)).intValue())
- , start, end, y1);
- renderFeature(g, seq,
- seq.findIndex(sequenceFeatures[sfindex].end) - 1,
- seq.findIndex(sequenceFeatures[sfindex].end) - 1,
- getColour(sequenceFeatures[sfindex])
- // new Color(((Integer) av.featuresDisplayed
- // .get(sequenceFeatures[sfindex].type)).intValue())
- , start, end, y1);
-
- }
- else
- {
- if (showFeature(sequenceFeatures[sfindex]))
- {
- renderFeature(g, seq,
- seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
- seq.findIndex(sequenceFeatures[sfindex].end) - 1,
- getColour(sequenceFeatures[sfindex]), start, end, y1);
- }
- }
-
- }
- }
-
- if (transparencySetter != null && g != null)
- {
- transparencySetter.setTransparency(g, 1.0f);
- }
- }
-
- char s;
-
- int i;
-
- void renderFeature(Graphics g, SequenceI seq, int fstart, int fend,
- Color featureColour, int start, int end, int y1)
- {
-
- if (((fstart <= end) && (fend >= start)))
- {
- if (fstart < start)
- { // fix for if the feature we have starts before the sequence start,
- fstart = start; // but the feature end is still valid!!
- }
-
- if (fend >= end)
- {
- fend = end;
- }
-
- for (i = fstart; i <= fend; i++)
- {
- s = seq.getCharAt(i);
-
- if (jalview.util.Comparison.isGap(s))
- {
- continue;
- }
-
- g.setColor(featureColour);
-
- g.fillRect((i - start) * av.charWidth, y1, av.charWidth,
- av.charHeight);
-
- if (!av.validCharWidth)
- {
- continue;
- }
-
- g.setColor(Color.white);
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
- g.drawString(String.valueOf(s), charOffset
- + (av.charWidth * (i - start)), (y1 + av.charHeight)
- - av.charHeight / 5); // pady = height / 5;
-
- }
- }
- }
-
- Hashtable minmax = null;
-
- /**
- * Called when alignment in associated view has new/modified features to
- * discover and display.
- *
- */
- public void featuresAdded()
- {
- lastSeq = null;
- findAllFeatures();
- }
-
- /**
- * find all features on the alignment
- */
- void findAllFeatures()
- {
- jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme();
-
- av.featuresDisplayed = new Hashtable();
- Vector allfeatures = new Vector();
- minmax = new Hashtable();
-
- for (int i = 0; i < av.alignment.getHeight(); i++)
- {
- SequenceFeature[] features = av.alignment.getSequenceAt(i)
- .getSequenceFeatures();
-
- if (features == null)
- {
- continue;
- }
-
- int index = 0;
- while (index < features.length)
- {
- if (features[index].begin == 0 && features[index].end == 0)
- {
- index++;
- continue;
- }
- if (!av.featuresDisplayed.containsKey(features[index].getType()))
- {
- if (getColour(features[index].getType()) == null)
- {
- featureColours.put(features[index].getType(),
- ucs.createColourFromName(features[index].getType()));
- }
-
- av.featuresDisplayed.put(features[index].getType(), new Integer(
- getColour(features[index].getType()).getRGB()));
- allfeatures.addElement(features[index].getType());
- }
- if (features[index].score != Float.NaN)
- {
- int nonpos = features[index].getBegin() >= 1 ? 0 : 1;
- float[][] mm = (float[][]) minmax.get(features[index].getType());
- if (mm == null)
- {
- mm = new float[][]
- { null, null };
- minmax.put(features[index].getType(), mm);
- }
- if (mm[nonpos] == null)
- {
- mm[nonpos] = new float[]
- { features[index].score, features[index].score };
-
- }
- else
- {
- if (mm[nonpos][0] > features[index].score)
- {
- mm[nonpos][0] = features[index].score;
- }
- if (mm[nonpos][1] < features[index].score)
- {
- mm[nonpos][1] = features[index].score;
- }
- }
- }
-
- index++;
- }
- }
-
- renderOrder = new String[allfeatures.size()];
- Enumeration en = allfeatures.elements();
- int i = allfeatures.size() - 1;
- while (en.hasMoreElements())
- {
- renderOrder[i] = en.nextElement().toString();
- i--;
- }
- }
-
- /**
- * get a feature style object for the given type string. Creates a
- * java.awt.Color for a featureType with no existing colourscheme. TODO:
- * replace return type with object implementing standard abstract colour/style
- * interface
- *
- * @param featureType
- * @return java.awt.Color or GraduatedColor
- */
- public Object getFeatureStyle(String featureType)
- {
- Object fc = featureColours.get(featureType);
- if (fc == null)
- {
- jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme();
- Color col = ucs.createColourFromName(featureType);
- featureColours.put(featureType, fc = col);
- }
- return fc;
- }
-
- public Color getColour(String featureType)
- {
- Object fc = getFeatureStyle(featureType);
-
- if (fc instanceof Color)
- {
- return (Color) fc;
- }
- else
- {
- if (fc instanceof GraduatedColor)
- {
- return ((GraduatedColor) fc).getMaxColor();
- }
- }
- throw new Error("Implementation Error: Unrecognised render object "
- + fc.getClass() + " for features of type " + featureType);
- }
-
- /**
- *
- * @param sequenceFeature
- * @return true if feature is visible.
- */
- private boolean showFeature(SequenceFeature sequenceFeature)
- {
- Object fc = getFeatureStyle(sequenceFeature.type);
- if (fc instanceof GraduatedColor)
- {
- return ((GraduatedColor) fc).isColored(sequenceFeature);
- }
- else
- {
- return true;
- }
- }
-
- /**
- * implement graduated colouring for features with scores
- *
- * @param feature
- * @return render colour for the given feature
- */
- public Color getColour(SequenceFeature feature)
- {
- Object fc = getFeatureStyle(feature.getType());
- if (fc instanceof Color)
- {
- return (Color) fc;
- }
- else
- {
- if (fc instanceof GraduatedColor)
- {
- return ((GraduatedColor) fc).findColor(feature);
- }
- }
- throw new Error("Implementation Error: Unrecognised render object "
- + fc.getClass() + " for features of type " + feature.getType());
- }
-
- public void setColour(String featureType, Object col)
- {
- // overwrite
- // Color _col = (col instanceof Color) ? ((Color) col) : (col instanceof
- // GraduatedColor) ? ((GraduatedColor) col).getMaxColor() : null;
- // Object c = featureColours.get(featureType);
- // if (c == null || c instanceof Color || (c instanceof GraduatedColor &&
- // !((GraduatedColor)c).getMaxColor().equals(_col)))
- {
- featureColours.put(featureType, col);
- }
- }
-
- public void setFeaturePriority(Object[][] data)
- {
- // The feature table will display high priority
- // features at the top, but theses are the ones
- // we need to render last, so invert the data
- if (av.featuresDisplayed != null)
- {
- av.featuresDisplayed.clear();
- }
-
- /*
- * if (visibleNew) { if (av.featuresDisplayed != null) {
- * av.featuresDisplayed.clear(); } else { av.featuresDisplayed = new
- * Hashtable(); } } if (data == null) { return; }
- */
-
- renderOrder = new String[data.length];
-
- if (data.length > 0)
- {
- for (int i = 0; i < data.length; i++)
- {
- String type = data[i][0].toString();
- setColour(type, data[i][1]);
- if (((Boolean) data[i][2]).booleanValue())
- {
- av.featuresDisplayed.put(type, new Integer(getColour(type)
- .getRGB()));
- }
-
- renderOrder[data.length - i - 1] = type;
- }
- }
- }
-
- /**
- * @return a simple list of feature group names or null
- */
- public String[] getGroups()
- {
- buildGroupHash();
- if (featureGroups != null)
- {
- String[] gps = new String[featureGroups.size()];
- Enumeration gn = featureGroups.keys();
- int i = 0;
- while (gn.hasMoreElements())
- {
- gps[i++] = (String) gn.nextElement();
- }
- return gps;
- }
- return null;
- }
-
- /**
- * get visible or invisible groups
- *
- * @param visible
- * true to return visible groups, false to return hidden ones.
- * @return list of groups
- */
- public String[] getGroups(boolean visible)
- {
- buildGroupHash();
- if (featureGroups != null)
- {
- Vector gp = new Vector();
-
- Enumeration gn = featureGroups.keys();
- while (gn.hasMoreElements())
- {
- String nm = (String) gn.nextElement();
- Boolean state = (Boolean) featureGroups.get(nm);
- if (state.booleanValue() == visible)
- {
- gp.addElement(nm);
- }
- }
- String[] gps = new String[gp.size()];
- gp.copyInto(gps);
-
- int i = 0;
- while (gn.hasMoreElements())
- {
- gps[i++] = (String) gn.nextElement();
- }
- return gps;
- }
- return null;
- }
-
- /**
- * set all feature groups in toset to be visible or invisible
- *
- * @param toset
- * group names
- * @param visible
- * the state of the named groups to set
- */
- public void setGroupState(String[] toset, boolean visible)
- {
- buildGroupHash();
- if (toset != null && toset.length > 0 && featureGroups != null)
- {
- boolean rdrw = false;
- for (int i = 0; i < toset.length; i++)
- {
- Object st = featureGroups.get(toset[i]);
- if (st != null)
- {
- featureGroups.put(toset[i], new Boolean(visible));
- rdrw = rdrw || (visible != ((Boolean) st).booleanValue());
- }
- }
- if (rdrw)
- {
- if (this.av != null)
- if (this.av.featureSettings != null)
- {
- av.featureSettings.rebuildGroups();
- this.av.featureSettings.resetTable(true);
- }
- else
- {
- buildFeatureHash();
- }
- if (av != null)
- {
- av.alignmentChanged(null);
- }
- }
- }
- }
-
- /**
- * analyse alignment for groups and hash tables (used to be embedded in
- * FeatureSettings.setTableData)
- *
- * @return true if features are on the alignment
- */
- public boolean buildGroupHash()
- {
- boolean alignmentHasFeatures = false;
- if (featureGroups == null)
- {
- featureGroups = new Hashtable();
- }
- Vector allFeatures = new Vector();
- Vector allGroups = new Vector();
- SequenceFeature[] tmpfeatures;
- String group;
- for (int i = 0; i < av.alignment.getHeight(); i++)
- {
- if (av.alignment.getSequenceAt(i).getSequenceFeatures() == null)
- {
- continue;
- }
-
- alignmentHasFeatures = true;
-
- tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
- int index = 0;
- while (index < tmpfeatures.length)
- {
- if (tmpfeatures[index].getFeatureGroup() != null)
- {
- group = tmpfeatures[index].featureGroup;
- if (!allGroups.contains(group))
- {
- allGroups.addElement(group);
-
- boolean visible = true;
- if (featureGroups.containsKey(group))
- {
- visible = ((Boolean) featureGroups.get(group)).booleanValue();
- }
- else
- {
- featureGroups.put(group, new Boolean(visible));
- }
- }
- }
-
- if (!allFeatures.contains(tmpfeatures[index].getType()))
- {
- allFeatures.addElement(tmpfeatures[index].getType());
- }
- index++;
- }
- }
-
- return alignmentHasFeatures;
- }
-
- /**
- * rebuild the featuresDisplayed and renderorder list based on the
- * featureGroups hash and any existing display state and force a repaint if
- * necessary
- *
- * @return true if alignment has visible features
- */
- public boolean buildFeatureHash()
- {
- boolean alignmentHasFeatures = false;
- if (featureGroups == null)
- {
- alignmentHasFeatures = buildGroupHash();
- }
- if (!alignmentHasFeatures)
- return false;
- Hashtable fdisp = av.featuresDisplayed;
- Vector allFeatures = new Vector();
- SequenceFeature[] tmpfeatures;
- String group;
- for (int i = 0; i < av.alignment.getHeight(); i++)
- {
- if (av.alignment.getSequenceAt(i).getSequenceFeatures() == null)
- {
- continue;
- }
-
- alignmentHasFeatures = true;
-
- tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
- int index = 0;
- while (index < tmpfeatures.length)
- {
- boolean visible = true;
- if (tmpfeatures[index].getFeatureGroup() != null)
- {
- group = tmpfeatures[index].featureGroup;
- if (featureGroups.containsKey(group))
- {
- visible = ((Boolean) featureGroups.get(group)).booleanValue();
- }
- }
-
- if (visible && !allFeatures.contains(tmpfeatures[index].getType()))
- {
- allFeatures.addElement(tmpfeatures[index].getType());
- }
- index++;
- }
- }
- if (allFeatures.size() > 0)
- {
- String[] neworder = new String[allFeatures.size()];
- int p = neworder.length - 1;
- for (int i = renderOrder.length - 1; i >= 0; i--)
- {
- if (allFeatures.contains(renderOrder[i]))
- {
- neworder[p--] = renderOrder[i];
- allFeatures.removeElement(renderOrder[i]);
- }
- else
- {
- av.featuresDisplayed.remove(renderOrder[i]);
- }
- }
- for (int i = allFeatures.size() - 1; i > 0; i++)
- {
- Object e = allFeatures.elementAt(i);
- if (e != null)
- {
- neworder[p--] = (String) e;
- av.featuresDisplayed.put(e, getColour((String) e));
- }
- }
- renderOrder = neworder;
- return true;
- }
-
- return alignmentHasFeatures;
- }
-
- /**
- *
- * @return the displayed feature type as an array of strings
- */
- protected String[] getDisplayedFeatureTypes()
- {
- String[] typ = null;
- synchronized (renderOrder)
- {
- typ = new String[renderOrder.length];
- System.arraycopy(renderOrder, 0, typ, 0, typ.length);
- for (int i = 0; i < typ.length; i++)
- {
- if (av.featuresDisplayed.get(typ[i]) == null)
- {
- typ[i] = null;
- }
- }
- }
- return typ;
- }
-}
-
-class TransparencySetter
-{
- void setTransparency(Graphics g, float value)
- {
- Graphics2D g2 = (Graphics2D) g;
- g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
- value));
- }
}
diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java
index e137416..01e096e 100644
--- a/src/jalview/appletgui/FeatureSettings.java
+++ b/src/jalview/appletgui/FeatureSettings.java
@@ -1,36 +1,70 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.analysis.AlignmentSorter;
-import jalview.commands.OrderCommand;
-import jalview.datamodel.*;
+import jalview.api.FeatureSettingsControllerI;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceFeature;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.GraduatedColor;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Checkbox;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Image;
+import java.awt.Label;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.PopupMenu;
+import java.awt.ScrollPane;
+import java.awt.Scrollbar;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.InputEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
public class FeatureSettings extends Panel implements ItemListener,
MouseListener, MouseMotionListener, ActionListener,
- AdjustmentListener
+ AdjustmentListener, FeatureSettingsControllerI
{
FeatureRenderer fr;
@@ -46,8 +80,6 @@ public class FeatureSettings extends Panel implements ItemListener,
ScrollPane scrollPane;
- boolean alignmentHasFeatures = false;
-
Image linkImage;
Scrollbar transparency;
@@ -60,9 +92,9 @@ public class FeatureSettings extends Panel implements ItemListener,
fr = ap.seqPanel.seqCanvas.getFeatureRenderer();
transparency = new Scrollbar(Scrollbar.HORIZONTAL,
- 100 - (int) (fr.transparency * 100), 1, 1, 100);
+ 100 - (int) (fr.getTransparency() * 100), 1, 1, 100);
- if (fr.transparencySetter != null)
+ if (fr.isTransparencyAvailable())
{
transparency.addAdjustmentListener(this);
}
@@ -77,17 +109,18 @@ public class FeatureSettings extends Panel implements ItemListener,
linkImage = java.awt.Toolkit.getDefaultToolkit().getImage(url);
}
- if (av.featuresDisplayed == null)
+ if (av.isShowSequenceFeatures() || !fr.hasRenderOrder())
{
- fr.findAllFeatures();
+ fr.findAllFeatures(true); // was default - now true to make all visible
}
- setTableData();
+ discoverAllFeatureData();
this.setLayout(new BorderLayout());
scrollPane = new ScrollPane();
scrollPane.add(featurePanel);
- if (alignmentHasFeatures)
+ if (fr.getAllFeatureColours() != null
+ && fr.getAllFeatureColours().size() > 0)
{
add(scrollPane, BorderLayout.CENTER);
}
@@ -100,7 +133,7 @@ public class FeatureSettings extends Panel implements ItemListener,
Panel tPanel = new Panel(new BorderLayout());
- if (fr.transparencySetter != null)
+ if (fr.isTransparencyAvailable())
{
tPanel.add(transparency, BorderLayout.CENTER);
tPanel.add(new Label("Transparency"), BorderLayout.EAST);
@@ -118,8 +151,11 @@ public class FeatureSettings extends Panel implements ItemListener,
if (groupPanel != null)
{
- groupPanel.setLayout(new GridLayout(fr.featureGroups.size() / 4 + 1,
- 4));
+ groupPanel.setLayout(new GridLayout(
+ (fr.getFeatureGroupsSize()) / 4 + 1, 4)); // JBPNote - this was
+ // scaled on number of
+ // visible groups. seems
+ // broken
groupPanel.validate();
add(groupPanel, BorderLayout.NORTH);
@@ -144,16 +180,22 @@ public class FeatureSettings extends Panel implements ItemListener,
height = Math.max(200, height);
height = Math.min(400, height);
int width = 300;
- jalview.bin.JalviewLite.addFrame(frame, "Feature Settings", width,
- height);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.sequence_feature_settings"),
+ width, height);
}
public void paint(Graphics g)
{
g.setColor(Color.black);
- g.drawString("No Features added to this alignment!!", 10, 20);
- g.drawString("(Features can be added from searches or", 10, 40);
- g.drawString("from Jalview / GFF features files)", 10, 60);
+ g.drawString(MessageManager
+ .getString("label.no_features_added_to_this_alignment"), 10, 20);
+ g.drawString(MessageManager
+ .getString("label.features_can_be_added_from_searches_1"), 10,
+ 40);
+ g.drawString(MessageManager
+ .getString("label.features_can_be_added_from_searches_2"), 10,
+ 60);
}
protected void popupSort(final MyCheckbox check, final Hashtable minmax,
@@ -161,8 +203,10 @@ public class FeatureSettings extends Panel implements ItemListener,
{
final String type = check.type;
final Object typeCol = fr.getFeatureStyle(type);
- java.awt.PopupMenu men = new PopupMenu("Settings for " + type);
- java.awt.MenuItem scr = new MenuItem("Sort by Score");
+ java.awt.PopupMenu men = new PopupMenu(MessageManager.formatMessage(
+ "label.settings_for_type", new String[] { type }));
+ java.awt.MenuItem scr = new MenuItem(
+ MessageManager.getString("label.sort_by_score"));
men.add(scr);
final FeatureSettings me = this;
scr.addActionListener(new ActionListener()
@@ -170,19 +214,20 @@ public class FeatureSettings extends Panel implements ItemListener,
public void actionPerformed(ActionEvent e)
{
- me.sortByScore(new String[]
- { type });
+ me.ap.alignFrame.avc
+ .sortAlignmentByFeatureScore(new String[] { type });
}
});
- MenuItem dens = new MenuItem("Sort by Density");
+ MenuItem dens = new MenuItem(
+ MessageManager.getString("label.sort_by_density"));
dens.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- me.sortByDens(new String[]
- { type });
+ me.ap.alignFrame.avc
+ .sortAlignmentByFeatureDensity(new String[] { type });
}
});
@@ -235,10 +280,11 @@ public class FeatureSettings extends Panel implements ItemListener,
men.show(this.featurePanel, x, y);
}
- public void setTableData()
+ @Override
+ public void discoverAllFeatureData()
{
- alignmentHasFeatures = fr.buildGroupHash();
- if (alignmentHasFeatures)
+ if (fr.getAllFeatureColours() != null
+ && fr.getAllFeatureColours().size() > 0)
{
rebuildGroups();
@@ -261,18 +307,19 @@ public class FeatureSettings extends Panel implements ItemListener,
rdrw = true;
groupPanel.removeAll();
}
-
- Enumeration gps = fr.featureGroups.keys();
- while (gps.hasMoreElements())
+ // TODO: JAL-964 - smoothly incorporate new group entries if panel already
+ // displayed and new groups present
+ for (String group : fr.getFeatureGroups())
{
- String group = (String) gps.nextElement();
- Boolean vis = (Boolean) fr.featureGroups.get(group);
- Checkbox check = new MyCheckbox(group, vis.booleanValue(),
+ boolean vis = fr.checkGroupVisibility(group, false);
+ Checkbox check = new MyCheckbox(group, vis,
(fr.featureLinks != null && fr.featureLinks
.containsKey(group)));
check.addMouseListener(this);
check.setFont(new Font("Serif", Font.BOLD, 12));
- check.addItemListener(this);
+ check.addItemListener(groupItemListener);
+ // note - visibility seems to correlate with displayed. ???wtf ??
+ check.setVisible(vis);
groupPanel.add(check);
}
if (rdrw)
@@ -288,22 +335,21 @@ public class FeatureSettings extends Panel implements ItemListener,
SequenceFeature[] tmpfeatures;
String group = null, type;
Vector visibleChecks = new Vector();
-
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment = av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- if (av.alignment.getSequenceAt(i).getSequenceFeatures() == null)
+ if (alignment.getSequenceAt(i).getSequenceFeatures() == null)
{
continue;
}
- tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
+ tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures();
int index = 0;
while (index < tmpfeatures.length)
{
group = tmpfeatures[index].featureGroup;
- if (group == null || fr.featureGroups.get(group) == null
- || ((Boolean) fr.featureGroups.get(group)).booleanValue())
+ if (group == null || fr.checkGroupVisibility(group, true))
{
type = tmpfeatures[index].getType();
if (!visibleChecks.contains(type))
@@ -332,13 +378,14 @@ public class FeatureSettings extends Panel implements ItemListener,
}
}
- if (fr.renderOrder != null)
+ if (fr.getRenderOrder() != null)
{
// First add the checks in the previous render order,
// in case the window has been closed and reopened
- for (int ro = fr.renderOrder.length - 1; ro > -1; ro--)
+ List<String> rol = fr.getRenderOrder();
+ for (int ro = rol.size() - 1; ro > -1; ro--)
{
- String item = fr.renderOrder[ro];
+ String item = rol.get(ro);
if (!visibleChecks.contains(item))
{
@@ -400,7 +447,7 @@ public class FeatureSettings extends Panel implements ItemListener,
if (addCheck)
{
boolean selected = false;
- if (groupsChanged || av.featuresDisplayed.containsKey(type))
+ if (groupsChanged || av.getFeaturesDisplayed().isVisible(type))
{
selected = true;
}
@@ -437,26 +484,24 @@ public class FeatureSettings extends Panel implements ItemListener,
selectionChanged();
}
- public void itemStateChanged(ItemEvent evt)
+ private ItemListener groupItemListener = new ItemListener()
{
- if (evt != null)
+ public void itemStateChanged(ItemEvent evt)
{
- // Is the source a top level featureGroup?
Checkbox source = (Checkbox) evt.getSource();
- if (fr.featureGroups.containsKey(source.getLabel()))
+ fr.setGroupVisibility(source.getLabel(), source.getState());
+ ap.seqPanel.seqCanvas.repaint();
+ if (ap.overviewPanel != null)
{
- fr.featureGroups.put(source.getLabel(),
- new Boolean(source.getState()));
- ap.seqPanel.seqCanvas.repaint();
- if (ap.overviewPanel != null)
- {
- ap.overviewPanel.updateOverviewImage();
- }
-
- resetTable(true);
- return;
+ ap.overviewPanel.updateOverviewImage();
}
- }
+ resetTable(true);
+ return;
+ };
+ };
+
+ public void itemStateChanged(ItemEvent evt)
+ {
selectionChanged();
}
@@ -575,7 +620,8 @@ public class FeatureSettings extends Panel implements ItemListener,
else
{
throw new Error(
- "Implementation error: Unsupported feature colour object.");
+ MessageManager
+ .getString("error.implementation_error_unsupported_feature_colour_object"));
}
refreshTable();
}
@@ -600,7 +646,7 @@ public class FeatureSettings extends Panel implements ItemListener,
MyCheckbox check = (MyCheckbox) evt.getSource();
if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0)
{
- this.popupSort(check, fr.minmax, evt.getX(), evt.getY());
+ this.popupSort(check, fr.getMinMax(), evt.getX(), evt.getY());
}
if (fr.featureLinks != null && fr.featureLinks.containsKey(check.type))
{
@@ -640,7 +686,7 @@ public class FeatureSettings extends Panel implements ItemListener,
public void adjustmentValueChanged(AdjustmentEvent evt)
{
- fr.transparency = ((float) (100 - transparency.getValue()) / 100f);
+ fr.setTransparency((100 - transparency.getValue()) / 100f);
ap.seqPanel.seqCanvas.repaint();
}
@@ -671,7 +717,9 @@ public class FeatureSettings extends Panel implements ItemListener,
}
else
{
- throw new Error("Invalid color for MyCheckBox");
+ throw new Error(
+ MessageManager
+ .getString("error.invalid_colour_for_mycheckbox"));
}
if (col != null)
{
@@ -754,81 +802,4 @@ public class FeatureSettings extends Panel implements ItemListener,
}
}
- protected void sortByDens(String[] typ)
- {
- sortBy(typ, "Sort by Density", AlignmentSorter.FEATURE_DENSITY);
- }
-
- private String[] getDisplayedFeatureTypes()
- {
- String[] typ = null;
- if (fr != null)
- {
- synchronized (fr.renderOrder)
- {
- typ = new String[fr.renderOrder.length];
- System.arraycopy(fr.renderOrder, 0, typ, 0, typ.length);
- for (int i = 0; i < typ.length; i++)
- {
- if (av.featuresDisplayed.get(typ[i]) == null)
- {
- typ[i] = null;
- }
- }
- }
- }
- return typ;
- }
-
- protected void sortBy(String[] typ, String methodText, final String method)
- {
- if (typ == null)
- {
- typ = getDisplayedFeatureTypes();
- }
- String gps[] = null;
- gps = fr.getGroups(true);
- if (typ != null)
- {
- for (int i = 0; i < typ.length; i++)
- {
- System.err.println("Sorting on Types:" + typ[i]);
- }
- }
- if (gps != null)
- {
-
- for (int i = 0; i < gps.length; i++)
- {
- System.err.println("Sorting on groups:" + gps[i]);
- }
- }
- AlignmentPanel alignPanel = ap;
- AlignmentI al = alignPanel.av.getAlignment();
-
- int start, stop;
- SequenceGroup sg = alignPanel.av.getSelectionGroup();
- if (sg != null)
- {
- start = sg.getStartRes();
- stop = sg.getEndRes();
- }
- else
- {
- start = 0;
- stop = al.getWidth();
- }
- SequenceI[] oldOrder = al.getSequencesArray();
- AlignmentSorter.sortByFeature(typ, gps, start, stop, al, method);
- this.ap.alignFrame.addHistoryItem(new OrderCommand(methodText,
- oldOrder, alignPanel.av.getAlignment()));
- alignPanel.paintAlignment(true);
-
- }
-
- protected void sortByScore(String[] typ)
- {
- sortBy(typ, "Sort by Feature Score", AlignmentSorter.FEATURE_SCORE);
- }
-
}
diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java
index 5f697ea..b1dcb88 100644
--- a/src/jalview/appletgui/Finder.java
+++ b/src/jalview/appletgui/Finder.java
@@ -1,32 +1,50 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Button;
+import java.awt.Checkbox;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.Vector;
public class Finder extends Panel implements ActionListener
{
- AlignViewport av;
+ AlignmentViewport av;
AlignmentPanel ap;
@@ -53,7 +71,8 @@ public class Finder extends Panel implements ActionListener
this.ap = ap;
frame = new Frame();
frame.add(this);
- jalview.bin.JalviewLite.addFrame(frame, "Find", 340, 120);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("action.find"), 340, 120);
frame.repaint();
frame.addWindowListener(new WindowAdapter()
{
@@ -108,7 +127,7 @@ public class Finder extends Panel implements ActionListener
features, true, ap))
{
ap.alignFrame.sequenceFeatures.setState(true);
- av.showSequenceFeatures(true);
+ av.setShowSequenceFeatures(true);
ap.highlightSearchResults(null);
}
}
@@ -124,6 +143,7 @@ public class Finder extends Panel implements ActionListener
jalview.analysis.Finder finder = new jalview.analysis.Finder(
av.getAlignment(), av.getSelectionGroup(), seqIndex, resIndex);
finder.setCaseSensitive(caseSensitive.getState());
+ finder.setIncludeDescription(searchDescription.getState());
finder.setFindAll(findAll);
String searchString = textfield.getText();
@@ -163,10 +183,13 @@ public class Finder extends Panel implements ActionListener
// 'SelectRegion' selection
if (!haveResults)
{
- ap.alignFrame.statusBar.setText("Finished searching.");
+ ap.alignFrame.statusBar.setText(MessageManager
+ .getString("label.finished_searching"));
resIndex = -1;
seqIndex = 0;
- } else {
+ }
+ else
+ {
if (findAll)
{
String message = (idMatch.size() > 0) ? "" + idMatch.size()
@@ -180,14 +203,16 @@ public class Finder extends Panel implements ActionListener
{
message += searchResults.getSize() + " subsequence matches.";
}
- ap.alignFrame.statusBar.setText("Search results: " + searchString
- + " : " + message);
+ ap.alignFrame.statusBar.setText(MessageManager.formatMessage(
+ "label.search_results", new String[] { searchString,
+ message }));
}
else
{
// TODO: indicate sequence and matching position in status bar
- ap.alignFrame.statusBar.setText("Found match for " + searchString);
+ ap.alignFrame.statusBar.setText(MessageManager.formatMessage(
+ "label.found_match_for", new String[] { searchString }));
}
}
}
@@ -200,7 +225,7 @@ public class Finder extends Panel implements ActionListener
protected Button findNext = new Button();
- Panel jPanel1 = new Panel();
+ Panel actionsPanel = new Panel();
GridLayout gridLayout1 = new GridLayout();
@@ -208,15 +233,17 @@ public class Finder extends Panel implements ActionListener
Checkbox caseSensitive = new Checkbox();
+ Checkbox searchDescription = new Checkbox();
+
private void jbInit() throws Exception
{
jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));
- jLabel1.setText("Find");
+ jLabel1.setText(MessageManager.getString("action.find"));
jLabel1.setBounds(new Rectangle(3, 30, 34, 15));
this.setLayout(null);
textfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
textfield.setText("");
- textfield.setBounds(new Rectangle(40, 27, 133, 21));
+ textfield.setBounds(new Rectangle(40, 17, 133, 21));
textfield.addKeyListener(new java.awt.event.KeyAdapter()
{
public void keyTyped(KeyEvent e)
@@ -226,30 +253,35 @@ public class Finder extends Panel implements ActionListener
});
textfield.addActionListener(this);
findAll.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- findAll.setLabel("Find all");
+ findAll.setLabel(MessageManager.getString("action.find_all"));
findAll.addActionListener(this);
findNext.setEnabled(false);
findNext.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- findNext.setLabel("Find Next");
+ findNext.setLabel(MessageManager.getString("action.find_next"));
findNext.addActionListener(this);
- jPanel1.setBounds(new Rectangle(180, 5, 141, 64));
- jPanel1.setLayout(gridLayout1);
+ actionsPanel.setBounds(new Rectangle(195, 5, 141, 64));
+ actionsPanel.setLayout(gridLayout1);
gridLayout1.setHgap(0);
gridLayout1.setRows(3);
gridLayout1.setVgap(2);
createNewGroup.setEnabled(false);
createNewGroup.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- createNewGroup.setLabel("New Feature");
+ createNewGroup.setLabel(MessageManager.getString("label.new_feature"));
createNewGroup.addActionListener(this);
- caseSensitive.setLabel("Match Case");
- caseSensitive.setBounds(new Rectangle(40, 49, 126, 23));
- jPanel1.add(findNext, null);
- jPanel1.add(findAll, null);
- jPanel1.add(createNewGroup, null);
+ caseSensitive.setLabel(MessageManager.getString("label.match_case"));
+ caseSensitive.setBounds(new Rectangle(30, 39, 126, 23));
+
+ searchDescription.setLabel(MessageManager
+ .getString("label.include_description"));
+ searchDescription.setBounds(new Rectangle(30, 59, 170, 23));
+ actionsPanel.add(findNext, null);
+ actionsPanel.add(findAll, null);
+ actionsPanel.add(createNewGroup, null);
this.add(caseSensitive);
this.add(textfield, null);
this.add(jLabel1, null);
- this.add(jPanel1, null);
+ this.add(actionsPanel, null);
+ this.add(searchDescription);
}
void textfield_keyTyped(KeyEvent e)
diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java
index 7a27df8..8ada2e9 100644
--- a/src/jalview/appletgui/FontChooser.java
+++ b/src/jalview/appletgui/FontChooser.java
@@ -1,38 +1,93 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
-
-public class FontChooser extends Panel implements ActionListener,
- ItemListener
+import jalview.api.ViewStyleI;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Checkbox;
+import java.awt.Choice;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+/**
+ * This dialog allows the user to try different font settings and related
+ * options. Changes are immediately visible on the alignment or tree. The user
+ * can dismiss the dialog by confirming changes with 'OK', or reverting to
+ * previous settings with 'Cancel'.
+ */
+ at SuppressWarnings("serial")
+public class FontChooser extends Panel implements ItemListener
{
- AlignmentPanel ap;
+ private static final Font VERDANA_11PT = new Font("Verdana", 0, 11);
+
+ private Choice fontSize = new Choice();
+
+ private Choice fontStyle = new Choice();
+
+ private Choice fontName = new Choice();
+
+ private Checkbox scaleAsCdna = new Checkbox();
+
+ private Button ok = new Button();
+
+ private Button cancel = new Button();
+
+ private AlignmentPanel ap;
- TreePanel tp;
+ private TreePanel tp;
- Font oldFont;
+ private Font oldFont;
- boolean init = true;
+ private int oldCharWidth = 0;
- Frame frame;
+ private boolean oldScaleProtein = false;
+ private Font lastSelected = null;
+
+ private int lastSelStyle = 0;
+
+ private int lastSelSize = 0;
+
+ private boolean init = true;
+
+ private Frame frame;
+
+ /**
+ * Constructor for a TreePanel font chooser
+ *
+ * @param tp
+ */
public FontChooser(TreePanel tp)
{
try
@@ -48,8 +103,18 @@ public class FontChooser extends Panel implements ActionListener,
init();
}
+ /**
+ * Constructor for an AlignmentPanel font chooser
+ *
+ * @param ap
+ */
public FontChooser(AlignmentPanel ap)
{
+ this.ap = ap;
+ oldFont = ap.av.getFont();
+ oldCharWidth = ap.av.getViewStyle().getCharWidth();
+ oldScaleProtein = ap.av.getViewStyle().isScaleProteinAsCdna();
+
try
{
jbInit();
@@ -57,12 +122,12 @@ public class FontChooser extends Panel implements ActionListener,
{
e.printStackTrace();
}
-
- this.ap = ap;
- oldFont = ap.av.getFont();
init();
}
+ /**
+ * Populate choice lists and open this dialog
+ */
void init()
{
String fonts[] = Toolkit.getDefaultToolkit().getFontList();
@@ -84,42 +149,42 @@ public class FontChooser extends Panel implements ActionListener,
fontSize.select(oldFont.getSize() + "");
fontStyle.select(oldFont.getStyle());
- Frame frame = new Frame();
- this.frame = frame;
+ this.frame = new Frame();
frame.add(this);
- jalview.bin.JalviewLite.addFrame(frame, "Change Font", 440, 115);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("action.change_font"), 440, 115);
init = false;
}
- public void actionPerformed(ActionEvent evt)
- {
- if (evt.getSource() == ok)
- {
- ok_actionPerformed();
- }
- else if (evt.getSource() == cancel)
- {
- cancel_actionPerformed();
- }
- }
-
+ /**
+ * Actions on change of font name, size or style.
+ */
public void itemStateChanged(ItemEvent evt)
{
- if (evt.getSource() == fontName)
+ final Object source = evt.getSource();
+ if (source == fontName)
{
fontName_actionPerformed();
}
- else if (evt.getSource() == fontSize)
+ else if (source == fontSize)
{
fontSize_actionPerformed();
}
- else if (evt.getSource() == fontStyle)
+ else if (source == fontStyle)
{
fontStyle_actionPerformed();
}
+ else if (source == scaleAsCdna)
+ {
+ scaleAsCdna_actionPerformed();
+ }
}
+ /**
+ * Close this dialog on OK to confirm any changes. Also updates the overview
+ * window if displayed.
+ */
protected void ok_actionPerformed()
{
frame.setVisible(false);
@@ -130,14 +195,29 @@ public class FontChooser extends Panel implements ActionListener,
ap.getOverviewPanel().updateOverviewImage();
}
}
-
}
+ /**
+ * Close this dialog on Cancel, reverting to previous font settings.
+ */
protected void cancel_actionPerformed()
{
if (ap != null)
{
+ ap.av.setScaleProteinAsCdna(oldScaleProtein);
+ if (ap.av.getCodingComplement() != null)
+ {
+ ap.av.getCodingComplement().setScaleProteinAsCdna(oldScaleProtein);
+ ap.alignFrame.getSplitFrame().repaint();
+ }
+
ap.av.setFont(oldFont);
+ ViewStyleI style = ap.av.getViewStyle();
+ if (style.getCharWidth() != oldCharWidth)
+ {
+ style.setCharWidth(oldCharWidth);
+ ap.av.setViewStyle(style);
+ }
ap.paintAlignment(true);
}
else if (tp != null)
@@ -153,20 +233,54 @@ public class FontChooser extends Panel implements ActionListener,
frame.setVisible(false);
}
+ /**
+ * DOCUMENT ME!
+ */
void changeFont()
{
+ if (lastSelected == null)
+ {
+ // initialise with original font
+ lastSelected = oldFont;
+ lastSelSize = oldFont.getSize();
+ lastSelStyle = oldFont.getStyle();
+ }
+
Font newFont = new Font(fontName.getSelectedItem().toString(),
fontStyle.getSelectedIndex(), Integer.parseInt(fontSize
.getSelectedItem().toString()));
- if (ap != null)
+ FontMetrics fm = getGraphics().getFontMetrics(newFont);
+ double mw = fm.getStringBounds("M", getGraphics()).getWidth(), iw = fm
+ .getStringBounds("I", getGraphics()).getWidth();
+ if (mw < 1 || iw < 1)
{
- ap.av.setFont(newFont);
- ap.fontChanged();
+ // TODO: JAL-1100
+ fontName.select(lastSelected.getName());
+ fontStyle.select(lastSelStyle);
+ fontSize.select("" + lastSelSize);
+ JVDialog d = new JVDialog(this.frame,
+ MessageManager.getString("label.invalid_font"), true, 350,
+ 200);
+ Panel mp = new Panel();
+ d.cancel.setVisible(false);
+ mp.setLayout(new FlowLayout());
+ mp.add(new Label(
+ "Font doesn't have letters defined\nso cannot be used\nwith alignment data."));
+ d.setMainPanel(mp);
+ d.setVisible(true);
+ return;
}
- else if (tp != null)
+ if (tp != null)
{
tp.setTreeFont(newFont);
}
+ else if (ap != null)
+ {
+ ap.av.setFont(newFont);
+ ap.fontChanged();
+ }
+ // remember last selected
+ lastSelected = newFont;
}
protected void fontName_actionPerformed()
@@ -196,86 +310,115 @@ public class FontChooser extends Panel implements ActionListener,
changeFont();
}
- Label label1 = new Label();
-
- protected Choice fontSize = new Choice();
-
- protected Choice fontStyle = new Choice();
-
- Label label2 = new Label();
-
- Label label3 = new Label();
-
- protected Choice fontName = new Choice();
-
- Button ok = new Button();
-
- Button cancel = new Button();
-
- Panel panel1 = new Panel();
-
- Panel panel2 = new Panel();
-
- Panel panel3 = new Panel();
+ /**
+ * Construct this panel's contents
+ *
+ * @throws Exception
+ */
+ private void jbInit() throws Exception
+ {
+ this.setLayout(new BorderLayout());
+ this.setBackground(Color.white);
- BorderLayout borderLayout1 = new BorderLayout();
+ Label fontLabel = new Label(MessageManager.getString("label.font"));
+ fontLabel.setFont(VERDANA_11PT);
+ fontLabel.setAlignment(Label.RIGHT);
+ fontSize.setFont(VERDANA_11PT);
+ fontSize.addItemListener(this);
+ fontStyle.setFont(VERDANA_11PT);
+ fontStyle.addItemListener(this);
- BorderLayout borderLayout2 = new BorderLayout();
+ Label sizeLabel = new Label(MessageManager.getString("label.size"));
+ sizeLabel.setAlignment(Label.RIGHT);
+ sizeLabel.setFont(VERDANA_11PT);
- BorderLayout borderLayout3 = new BorderLayout();
+ Label styleLabel = new Label(MessageManager.getString("label.style"));
+ styleLabel.setAlignment(Label.RIGHT);
+ styleLabel.setFont(VERDANA_11PT);
- Panel panel4 = new Panel();
+ fontName.setFont(VERDANA_11PT);
+ fontName.addItemListener(this);
- Panel panel5 = new Panel();
+ scaleAsCdna.setLabel(MessageManager.getString("label.scale_as_cdna"));
+ scaleAsCdna.setFont(VERDANA_11PT);
+ scaleAsCdna.addItemListener(this);
+ scaleAsCdna.setState(ap.av.isScaleProteinAsCdna());
- BorderLayout borderLayout4 = new BorderLayout();
+ ok.setFont(VERDANA_11PT);
+ ok.setLabel(MessageManager.getString("action.ok"));
+ ok.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed();
+ }
+ });
+ cancel.setFont(VERDANA_11PT);
+ cancel.setLabel(MessageManager.getString("action.cancel"));
+ cancel.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed();
+ }
+ });
+
+ Panel fontPanel = new Panel();
+ fontPanel.setLayout(new BorderLayout());
+ Panel stylePanel = new Panel();
+ stylePanel.setLayout(new BorderLayout());
+ Panel sizePanel = new Panel();
+ sizePanel.setLayout(new BorderLayout());
+ Panel scalePanel = new Panel();
+ scalePanel.setLayout(new BorderLayout());
+ Panel okCancelPanel = new Panel();
+ Panel optionsPanel = new Panel();
+
+ fontPanel.setBackground(Color.white);
+ stylePanel.setBackground(Color.white);
+ sizePanel.setBackground(Color.white);
+ okCancelPanel.setBackground(Color.white);
+ optionsPanel.setBackground(Color.white);
+
+ fontPanel.add(fontLabel, BorderLayout.WEST);
+ fontPanel.add(fontName, BorderLayout.CENTER);
+ stylePanel.add(styleLabel, BorderLayout.WEST);
+ stylePanel.add(fontStyle, BorderLayout.CENTER);
+ sizePanel.add(sizeLabel, BorderLayout.WEST);
+ sizePanel.add(fontSize, BorderLayout.CENTER);
+ scalePanel.add(scaleAsCdna, BorderLayout.CENTER);
+ okCancelPanel.add(ok, null);
+ okCancelPanel.add(cancel, null);
+
+ optionsPanel.add(fontPanel, null);
+ optionsPanel.add(sizePanel, null);
+ optionsPanel.add(stylePanel, null);
+
+ /*
+ * Only show 'scale protein as cDNA' in a SplitFrame
+ */
+ this.add(optionsPanel, BorderLayout.NORTH);
+ if (ap.alignFrame.getSplitFrame() != null)
+ {
+ this.add(scalePanel, BorderLayout.CENTER);
+ }
+ this.add(okCancelPanel, BorderLayout.SOUTH);
+ }
- private void jbInit() throws Exception
+ /**
+ * Turn on/off scaling of protein characters to 3 times the width of cDNA
+ * characters
+ */
+ protected void scaleAsCdna_actionPerformed()
{
- label1.setFont(new java.awt.Font("Verdana", 0, 11));
- label1.setAlignment(Label.RIGHT);
- label1.setText("Font: ");
- this.setLayout(borderLayout4);
- fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
- fontSize.addItemListener(this);
- fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
- fontStyle.addItemListener(this);
- label2.setAlignment(Label.RIGHT);
- label2.setFont(new java.awt.Font("Verdana", 0, 11));
- label2.setText("Size: ");
- label3.setAlignment(Label.RIGHT);
- label3.setFont(new java.awt.Font("Verdana", 0, 11));
- label3.setText("Style: ");
- fontName.setFont(new java.awt.Font("Verdana", 0, 11));
- fontName.addItemListener(this);
- ok.setFont(new java.awt.Font("Verdana", 0, 11));
- ok.setLabel("OK");
- ok.addActionListener(this);
- cancel.setFont(new java.awt.Font("Verdana", 0, 11));
- cancel.setLabel("Cancel");
- cancel.addActionListener(this);
- this.setBackground(Color.white);
- panel1.setLayout(borderLayout1);
- panel2.setLayout(borderLayout3);
- panel3.setLayout(borderLayout2);
- panel5.setBackground(Color.white);
- panel4.setBackground(Color.white);
- panel1.setBackground(Color.white);
- panel2.setBackground(Color.white);
- panel3.setBackground(Color.white);
- panel1.add(label1, BorderLayout.WEST);
- panel1.add(fontName, BorderLayout.CENTER);
- panel5.add(panel1, null);
- panel5.add(panel3, null);
- panel5.add(panel2, null);
- panel2.add(label3, BorderLayout.WEST);
- panel2.add(fontStyle, BorderLayout.CENTER);
- panel3.add(label2, BorderLayout.WEST);
- panel3.add(fontSize, BorderLayout.CENTER);
- this.add(panel4, BorderLayout.SOUTH);
- panel4.add(ok, null);
- panel4.add(cancel, null);
- this.add(panel5, BorderLayout.CENTER);
+ ap.av.setScaleProteinAsCdna(scaleAsCdna.getState());
+ ap.av.getCodingComplement().setScaleProteinAsCdna(
+ scaleAsCdna.getState());
+ ap.alignFrame.getSplitFrame().adjustLayout();
+ ap.paintAlignment(true);
+ ap.alignFrame.getSplitFrame().repaint();
}
}
diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java
index 58a4af1..58a4f10 100644
--- a/src/jalview/appletgui/IdCanvas.java
+++ b/src/jalview/appletgui/IdCanvas.java
@@ -1,25 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Panel;
+import java.util.List;
public class IdCanvas extends Panel
{
@@ -39,7 +47,7 @@ public class IdCanvas extends Panel
boolean fastPaint = false;
- java.util.Vector searchResults;
+ List<SequenceI> searchResults;
public IdCanvas(AlignViewport av)
{
@@ -48,8 +56,8 @@ public class IdCanvas extends Panel
PaintRefresher.Register(this, av.getSequenceSetId());
}
- public void drawIdString(Graphics gg, SequenceI s, int i, int starty,
- int ypos)
+ public void drawIdString(Graphics gg, boolean hiddenRows, SequenceI s,
+ int i, int starty, int ypos)
{
int charHeight = av.getCharHeight();
@@ -80,7 +88,7 @@ public class IdCanvas extends Panel
((i - starty) * charHeight) + ypos + charHeight
- (charHeight / 5));
- if (av.hasHiddenRows && av.showHiddenMarkers)
+ if (hiddenRows)
{
drawMarker(i, starty, ypos);
}
@@ -95,8 +103,8 @@ public class IdCanvas extends Panel
return;
}
- gg.copyArea(0, 0, getSize().width, imgHeight, 0, -vertical
- * av.charHeight);
+ gg.copyArea(0, 0, getSize().width, imgHeight, 0,
+ -vertical * av.getCharHeight());
int ss = av.startSeq, es = av.endSeq, transY = 0;
if (vertical > 0) // scroll down
@@ -108,7 +116,7 @@ public class IdCanvas extends Panel
}
else
{
- transY = imgHeight - vertical * av.charHeight;
+ transY = imgHeight - vertical * av.getCharHeight();
}
}
else if (vertical < 0)
@@ -149,7 +157,7 @@ public class IdCanvas extends Panel
}
imgHeight = getSize().height;
- imgHeight -= imgHeight % av.charHeight;
+ imgHeight -= imgHeight % av.getCharHeight();
if (imgHeight < 1)
{
@@ -174,22 +182,34 @@ public class IdCanvas extends Panel
g.drawImage(image, 0, 0, this);
}
+ /**
+ * local copy of av.getCharHeight set at top of drawIds
+ */
+ private int avcharHeight;
+
void drawIds(int starty, int endy)
{
+ // hardwired italic IDs in applet currently
Font italic = new Font(av.getFont().getName(), Font.ITALIC, av
.getFont().getSize());
+ // temp variable for speed
+ avcharHeight = av.getCharHeight();
gg.setFont(italic);
Color currentColor = Color.white;
Color currentTextColor = Color.black;
+ final boolean doHiddenCheck = av.isDisplayReferenceSeq()
+ || av.hasHiddenRows(), hiddenRows = av.hasHiddenRows()
+ && av.getShowHiddenMarkers();
+
if (av.getWrapAlignment())
{
- int maxwidth = av.alignment.getWidth();
- int alheight = av.alignment.getHeight();
+ int maxwidth = av.getAlignment().getWidth();
+ int alheight = av.getAlignment().getHeight();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
@@ -197,23 +217,21 @@ public class IdCanvas extends Panel
int annotationHeight = 0;
AnnotationLabels labels = null;
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
AnnotationPanel ap = new AnnotationPanel(av);
annotationHeight = ap.adjustPanelHeight();
labels = new AnnotationLabels(av);
}
-
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = avcharHeight;
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += avcharHeight;
}
- int cHeight = alheight * av.charHeight + hgap + annotationHeight;
+ int cHeight = alheight * avcharHeight + hgap + annotationHeight;
int rowSize = av.getEndRes() - av.getStartRes();
-
// Draw the rest of the panels
for (int ypos = hgap, row = av.startRes; (ypos <= getSize().height)
&& (row < maxwidth); ypos += cHeight, row += rowSize)
@@ -221,20 +239,20 @@ public class IdCanvas extends Panel
for (int i = starty; i < alheight; i++)
{
- SequenceI s = av.alignment.getSequenceAt(i);
+ SequenceI s = av.getAlignment().getSequenceAt(i);
gg.setFont(italic);
- if (av.hasHiddenRows)
+ if (doHiddenCheck)
{
setHiddenFont(s);
}
- drawIdString(gg, s, i, 0, ypos);
+ drawIdString(gg, hiddenRows, s, i, 0, ypos);
}
if (labels != null)
{
- gg.translate(0, ypos + (alheight * av.charHeight));
+ gg.translate(0, ypos + (alheight * avcharHeight));
labels.drawComponent(gg, getSize().width);
- gg.translate(0, -ypos - (alheight * av.charHeight));
+ gg.translate(0, -ypos - (alheight * avcharHeight));
}
}
@@ -246,14 +264,14 @@ public class IdCanvas extends Panel
for (int i = starty; i < endy; i++)
{
- seq = av.alignment.getSequenceAt(i);
+ seq = av.getAlignment().getSequenceAt(i);
if (seq == null)
{
continue;
}
gg.setFont(italic);
// boolean isrep=false;
- if (av.hasHiddenRows)
+ if (doHiddenCheck)
{
// isrep =
setHiddenFont(seq);
@@ -280,15 +298,15 @@ public class IdCanvas extends Panel
gg.setColor(currentColor);
// TODO: isrep could be used to highlight the representative in a
// different way
- gg.fillRect(0, (i - starty) * av.charHeight, getSize().width,
- av.charHeight);
+ gg.fillRect(0, (i - starty) * avcharHeight, getSize().width,
+ avcharHeight);
gg.setColor(currentTextColor);
gg.drawString(seq.getDisplayId(av.getShowJVSuffix()), 0,
- (((i - starty) * av.charHeight) + av.charHeight)
- - (av.charHeight / 5));
+ (((i - starty) * avcharHeight) + avcharHeight)
+ - (avcharHeight / 5));
- if (av.hasHiddenRows && av.showHiddenMarkers)
+ if (hiddenRows)
{
drawMarker(i, starty, 0);
}
@@ -296,15 +314,15 @@ public class IdCanvas extends Panel
}
}
- public void setHighlighted(java.util.Vector found)
+ public void setHighlighted(List<SequenceI> list)
{
- searchResults = found;
+ searchResults = list;
repaint();
}
void drawMarker(int i, int starty, int yoffset)
{
- SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences;
+ SequenceI[] hseqs = av.getAlignment().getHiddenSequences().hiddenSequences;
// Use this method here instead of calling hiddenSeq adjust
// 3 times.
int hSize = hseqs.length;
@@ -338,21 +356,19 @@ public class IdCanvas extends Panel
gg.setColor(Color.blue);
if (below)
{
- gg.fillPolygon(new int[]
- { getSize().width - av.charHeight, getSize().width - av.charHeight,
- getSize().width }, new int[]
- { (i - starty) * av.charHeight + yoffset,
- (i - starty) * av.charHeight + yoffset + av.charHeight / 4,
- (i - starty) * av.charHeight + yoffset }, 3);
+ gg.fillPolygon(new int[] { getSize().width - avcharHeight,
+ getSize().width - avcharHeight, getSize().width }, new int[] {
+ (i - starty) * avcharHeight + yoffset,
+ (i - starty) * avcharHeight + yoffset + avcharHeight / 4,
+ (i - starty) * avcharHeight + yoffset }, 3);
}
if (above)
{
- gg.fillPolygon(new int[]
- { getSize().width - av.charHeight, getSize().width - av.charHeight,
- getSize().width }, new int[]
- { (i - starty + 1) * av.charHeight + yoffset,
- (i - starty + 1) * av.charHeight + yoffset - av.charHeight / 4,
- (i - starty + 1) * av.charHeight + yoffset }, 3);
+ gg.fillPolygon(new int[] { getSize().width - avcharHeight,
+ getSize().width - avcharHeight, getSize().width }, new int[] {
+ (i - starty + 1) * avcharHeight + yoffset,
+ (i - starty + 1) * avcharHeight + yoffset - avcharHeight / 4,
+ (i - starty + 1) * avcharHeight + yoffset }, 3);
}
}
@@ -362,8 +378,7 @@ public class IdCanvas extends Panel
Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont()
.getSize());
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(seq))
+ if (av.isHiddenRepSequence(seq))
{
gg.setFont(bold);
return true;
diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java
index 1497616..eba52d5 100644
--- a/src/jalview/appletgui/IdPanel.java
+++ b/src/jalview/appletgui/IdPanel.java
@@ -1,28 +1,40 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
-import java.util.Vector;
-
-import jalview.datamodel.*;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
import jalview.util.UrlLink;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.BorderLayout;
+import java.awt.Panel;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.util.List;
+import java.util.Vector;
public class IdPanel extends Panel implements MouseListener,
MouseMotionListener
@@ -30,16 +42,12 @@ public class IdPanel extends Panel implements MouseListener,
protected IdCanvas idCanvas;
- protected AlignViewport av;
+ protected AlignmentViewport av;
protected AlignmentPanel alignPanel;
ScrollThread scrollThread = null;
- int offy;
-
- int width;
-
int lastid = -1;
boolean mouseDragging = false;
@@ -72,10 +80,21 @@ public class IdPanel extends Panel implements MouseListener,
}
}
+ {
+ // upgrade old SRS link
+ int srsPos = links
+ .indexOf("SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry");
+ if (srsPos > -1)
+ {
+ links.setElementAt(
+ "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$",
+ srsPos);
+ }
+ }
if (links.size() < 1)
{
links = new java.util.Vector();
- links.addElement("SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry");
+ links.addElement("EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$");
}
}
@@ -123,7 +142,7 @@ public class IdPanel extends Panel implements MouseListener,
nl = true;
}
;
- if (sf[sl].getScore() != Float.NaN && sf[sl].getScore() != 0f)
+ if (!Float.isNaN(sf[sl].getScore()) && sf[sl].getScore() != 0f)
{
tooltiptext.append(" Score = ");
tooltiptext.append(sf[sl].getScore());
@@ -198,7 +217,7 @@ public class IdPanel extends Panel implements MouseListener,
// DEFAULT LINK IS FIRST IN THE LINK LIST
int seq = alignPanel.seqPanel.findSeq(e);
SequenceI sq = av.getAlignment().getSequenceAt(seq);
- if (sq==null)
+ if (sq == null)
{
return;
}
@@ -272,7 +291,7 @@ public class IdPanel extends Panel implements MouseListener,
}
if (mouseDragging && e.getY() >= getSize().height
- && av.alignment.getHeight() > av.getEndSeq())
+ && av.getAlignment().getHeight() > av.getEndSeq())
{
scrollThread = new ScrollThread(false);
}
@@ -288,7 +307,7 @@ public class IdPanel extends Panel implements MouseListener,
int y = e.getY();
if (av.getWrapAlignment())
{
- y -= 2 * av.charHeight;
+ y -= 2 * av.getCharHeight();
}
int seq = alignPanel.seqPanel.findSeq(e);
@@ -296,7 +315,7 @@ public class IdPanel extends Panel implements MouseListener,
if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
{
Sequence sq = (Sequence) av.getAlignment().getSequenceAt(seq);
-
+
// build a new links menu based on the current links + any non-positional
// features
Vector nlinks = new Vector();
@@ -304,7 +323,7 @@ public class IdPanel extends Panel implements MouseListener,
{
nlinks.addElement(links.elementAt(l));
}
- SequenceFeature sf[] = sq==null ? null:sq.getSequenceFeatures();
+ SequenceFeature sf[] = sq == null ? null : sq.getSequenceFeatures();
for (int sl = 0; sf != null && sl < sf.length; sl++)
{
if (sf[sl].begin == sf[sl].end && sf[sl].begin == 0)
@@ -331,7 +350,7 @@ public class IdPanel extends Panel implements MouseListener,
{
av.setSelectionGroup(new SequenceGroup());
av.getSelectionGroup().setStartRes(0);
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+ av.getSelectionGroup().setEndRes(av.getAlignment().getWidth() - 1);
}
if (e.isShiftDown() && lastid != -1)
@@ -350,7 +369,7 @@ public class IdPanel extends Panel implements MouseListener,
{
lastid = seq;
SequenceI pickedSeq = av.getAlignment().getSequenceAt(seq);
- av.getSelectionGroup().addOrRemove(pickedSeq, false);
+ av.getSelectionGroup().addOrRemove(pickedSeq, true);
}
void selectSeqs(int start, int end)
@@ -377,7 +396,7 @@ public class IdPanel extends Panel implements MouseListener,
for (int i = start; i <= end; i++)
{
av.getSelectionGroup().addSequence(
- av.getAlignment().getSequenceAt(i), false);
+ av.getAlignment().getSequenceAt(i), i == end);
}
}
@@ -400,16 +419,16 @@ public class IdPanel extends Panel implements MouseListener,
av.sendSelection();
}
- public void highlightSearchResults(java.util.Vector found)
+ public void highlightSearchResults(List<SequenceI> list)
{
- idCanvas.setHighlighted(found);
+ idCanvas.setHighlighted(list);
- if (found == null)
+ if (list == null)
{
return;
}
- int index = av.alignment.findIndex((SequenceI) found.elementAt(0));
+ int index = av.getAlignment().findIndex(list.get(0));
// do we need to scroll the panel?
if (av.getStartSeq() > index || av.getEndSeq() < index)
@@ -454,7 +473,7 @@ public class IdPanel extends Panel implements MouseListener,
{
selectSeqs(lastid - 1, seq);
}
- else if (seq > lastid && seq < av.alignment.getHeight())
+ else if (seq > lastid && seq < av.getAlignment().getHeight())
{
selectSeqs(lastid + 1, seq);
}
@@ -476,5 +495,4 @@ public class IdPanel extends Panel implements MouseListener,
}
}
}
-
}
diff --git a/src/jalview/appletgui/IdwidthAdjuster.java b/src/jalview/appletgui/IdwidthAdjuster.java
index 047d657..fe52738 100644
--- a/src/jalview/appletgui/IdwidthAdjuster.java
+++ b/src/jalview/appletgui/IdwidthAdjuster.java
@@ -1,24 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Panel;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
public class IdwidthAdjuster extends Panel implements MouseListener,
MouseMotionListener
@@ -54,6 +63,26 @@ public class IdwidthAdjuster extends Panel implements MouseListener,
{
active = false;
repaint();
+
+ /*
+ * If in a SplitFrame with co-scaled alignments, set the other's id width to
+ * match; note applet does not (yet) store this in ViewStyle
+ */
+ /*
+ * Code disabled for now as it doesn't work, don't know why; idCanvas width
+ * keeps resetting to a previous value (actually two alternating values!)
+ */
+ // final AlignViewportI viewport = ap.getAlignViewport();
+ // if (viewport.getCodingComplement() != null
+ // && viewport.isScaleProteinAsCdna())
+ // {
+ // Dimension d = ap.idPanel.idCanvas.getSize();
+ // SplitFrame sf = ap.alignFrame.getSplitFrame();
+ // final AlignmentPanel otherPanel =
+ // sf.getComplement(ap.alignFrame).alignPanel;
+ // otherPanel.setIdWidth(d.width, d.height);
+ // otherPanel.repaint();
+ // }
}
public void mouseEntered(MouseEvent evt)
@@ -74,13 +103,13 @@ public class IdwidthAdjuster extends Panel implements MouseListener,
Dimension d = ap.idPanel.idCanvas.getSize();
int dif = evt.getX() - oldX;
- if (d.width + dif > 20 || dif > 0)
+ final int newWidth = d.width + dif;
+ if (newWidth > 20 || dif > 0)
{
- ap.setIdWidth(d.width + dif, d.height);
- this.setSize(d.width + dif, getSize().height);
+ ap.setIdWidth(newWidth, d.height);
+ this.setSize(newWidth, getSize().height);
oldX = evt.getX();
}
-
}
public void mouseMoved(MouseEvent evt)
diff --git a/src/jalview/appletgui/JVDialog.java b/src/jalview/appletgui/JVDialog.java
index eaf8255..59a5867 100644
--- a/src/jalview/appletgui/JVDialog.java
+++ b/src/jalview/appletgui/JVDialog.java
@@ -1,24 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Dialog;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
public class JVDialog extends Dialog implements ActionListener
{
diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java
index 01b448c..3a6fe49 100644
--- a/src/jalview/appletgui/OverviewPanel.java
+++ b/src/jalview/appletgui/OverviewPanel.java
@@ -1,24 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
+import jalview.datamodel.AlignmentI;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Panel;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
public class OverviewPanel extends Panel implements Runnable,
MouseMotionListener, MouseListener
@@ -64,18 +78,17 @@ public class OverviewPanel extends Panel implements Runnable,
sr.renderGaps = false;
sr.forOverview = true;
fr = new FeatureRenderer(av);
- fr.overview = true;
// scale the initial size of overviewpanel to shape of alignment
- float initialScale = (float) av.alignment.getWidth()
- / (float) av.alignment.getHeight();
+ float initialScale = (float) av.getAlignment().getWidth()
+ / (float) av.getAlignment().getHeight();
- if (av.hconsensus == null)
+ if (av.getSequenceConsensusHash() == null)
{
graphHeight = 0;
}
- if (av.alignment.getWidth() > av.alignment.getHeight())
+ if (av.getAlignment().getWidth() > av.getAlignment().getHeight())
{
// wider
width = 400;
@@ -100,6 +113,7 @@ public class OverviewPanel extends Panel implements Runnable,
addComponentListener(new ComponentAdapter()
{
+ @Override
public void componentResized(ComponentEvent evt)
{
if (getSize().width != width
@@ -118,22 +132,27 @@ public class OverviewPanel extends Panel implements Runnable,
}
+ @Override
public void mouseEntered(MouseEvent evt)
{
}
+ @Override
public void mouseExited(MouseEvent evt)
{
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
}
+ @Override
public void mouseMoved(MouseEvent evt)
{
}
+ @Override
public void mousePressed(MouseEvent evt)
{
boxX = evt.getX();
@@ -141,6 +160,7 @@ public class OverviewPanel extends Panel implements Runnable,
checkValid();
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
boxX = evt.getX();
@@ -148,6 +168,7 @@ public class OverviewPanel extends Panel implements Runnable,
checkValid();
}
+ @Override
public void mouseDragged(MouseEvent evt)
{
boxX = evt.getX();
@@ -174,7 +195,7 @@ public class OverviewPanel extends Panel implements Runnable,
if (boxX > (width - boxWidth))
{
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
// Try smallest possible box
boxWidth = (int) ((av.endRes - av.startRes + 1) * av.getCharWidth() * scalew);
@@ -185,7 +206,7 @@ public class OverviewPanel extends Panel implements Runnable,
int col = (int) (boxX / scalew / av.getCharWidth());
int row = (int) (boxY / scaleh / av.getCharHeight());
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
if (!av.getColumnSelection().isVisible(col))
{
@@ -195,10 +216,10 @@ public class OverviewPanel extends Panel implements Runnable,
col = av.getColumnSelection().findColumnPosition(col);
}
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(
- row);
+ row = av.getAlignment().getHiddenSequences()
+ .findIndexWithoutHiddenSeqs(row);
}
ap.setScrollValues(col, row);
@@ -216,10 +237,9 @@ public class OverviewPanel extends Panel implements Runnable,
return;
}
- if (av.showSequenceFeatures)
+ if (av.isShowSequenceFeatures())
{
- fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups;
- fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours;
+ fr.transferSettings(ap.seqPanel.seqCanvas.fr);
}
resizing = true;
@@ -240,13 +260,14 @@ public class OverviewPanel extends Panel implements Runnable,
// the overview is being calculated
boolean resizeAgain = false;
+ @Override
public void run()
{
miniMe = null;
- int alwidth = av.alignment.getWidth();
- int alheight = av.alignment.getHeight();
+ int alwidth = av.getAlignment().getWidth();
+ int alheight = av.getAlignment().getHeight();
- if (av.showSequenceFeatures)
+ if (av.isShowSequenceFeatures())
{
fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer());
}
@@ -277,7 +298,10 @@ public class OverviewPanel extends Panel implements Runnable,
Color color = Color.yellow;
int row, col, sameRow = 0, sameCol = 0;
jalview.datamodel.SequenceI seq;
+ final boolean hasHiddenRows = av.hasHiddenRows(), hasHiddenCols = av
+ .hasHiddenColumns();
boolean hiddenRow = false;
+ AlignmentI alignment = av.getAlignment();
for (row = 0; row <= sequencesHeight; row++)
{
if ((int) (row * sampleRow) == lastrow)
@@ -287,15 +311,15 @@ public class OverviewPanel extends Panel implements Runnable,
}
hiddenRow = false;
- if (av.hasHiddenRows)
+ if (hasHiddenRows)
{
- seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);
+ seq = alignment.getHiddenSequences().getHiddenSequence(lastrow);
if (seq == null)
{
- int index = av.alignment.getHiddenSequences()
+ int index = alignment.getHiddenSequences()
.findIndexWithoutHiddenSeqs(lastrow);
- seq = av.alignment.getSequenceAt(index);
+ seq = alignment.getSequenceAt(index);
}
else
{
@@ -304,7 +328,7 @@ public class OverviewPanel extends Panel implements Runnable,
}
else
{
- seq = av.alignment.getSequenceAt(lastrow);
+ seq = alignment.getSequenceAt(lastrow);
}
for (col = 0; col < width; col++)
@@ -322,7 +346,7 @@ public class OverviewPanel extends Panel implements Runnable,
{
color = sr.getResidueBoxColour(seq, lastcol);
- if (av.showSequenceFeatures)
+ if (av.isShowSequenceFeatures())
{
color = fr.findFeatureColour(color, seq, lastcol);
}
@@ -333,8 +357,8 @@ public class OverviewPanel extends Panel implements Runnable,
}
if (hiddenRow
- || (av.hasHiddenColumns && !av.getColumnSelection()
- .isVisible(lastcol)))
+ || (hasHiddenCols && !av.getColumnSelection().isVisible(
+ lastcol)))
{
color = color.darker().darker();
}
@@ -357,14 +381,16 @@ public class OverviewPanel extends Panel implements Runnable,
sameRow = 1;
}
- if (av.conservation != null)
+ if (av.getAlignmentConservationAnnotation() != null)
{
for (col = 0; col < width; col++)
{
lastcol = (int) (col * sampleCol);
{
mg.translate(col, sequencesHeight);
- ap.annotationPanel.drawGraph(mg, av.conservation,
+ ap.annotationPanel.renderer.drawGraph(mg,
+ av.getAlignmentConservationAnnotation(),
+ av.getAlignmentConservationAnnotation().annotations,
(int) (sampleCol) + 1, graphHeight,
(int) (col * sampleCol), (int) (col * sampleCol) + 1);
mg.translate(-col, -sequencesHeight);
@@ -386,14 +412,15 @@ public class OverviewPanel extends Panel implements Runnable,
public void setBoxPosition()
{
- int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();
- int fullsizeHeight = (av.alignment.getHeight() + av.alignment
- .getHiddenSequences().getSize()) * av.getCharHeight();
+ int fullsizeWidth = av.getAlignment().getWidth() * av.getCharWidth();
+ int fullsizeHeight = (av.getAlignment().getHeight() + av.getAlignment()
+ .getHiddenSequences().getSize())
+ * av.getCharHeight();
int startRes = av.getStartRes();
int endRes = av.getEndRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);
endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);
@@ -402,12 +429,12 @@ public class OverviewPanel extends Panel implements Runnable,
int startSeq = av.startSeq;
int endSeq = av.endSeq;
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- startSeq = av.alignment.getHiddenSequences().adjustForHiddenSeqs(
- startSeq);
+ startSeq = av.getAlignment().getHiddenSequences()
+ .adjustForHiddenSeqs(startSeq);
- endSeq = av.alignment.getHiddenSequences()
+ endSeq = av.getAlignment().getHiddenSequences()
.adjustForHiddenSeqs(endSeq);
}
@@ -418,7 +445,7 @@ public class OverviewPanel extends Panel implements Runnable,
boxX = (int) (startRes * av.getCharWidth() * scalew);
boxY = (int) (startSeq * av.getCharHeight() * scaleh);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
boxWidth = (int) ((endRes - startRes + 1) * av.getCharWidth() * scalew);
}
@@ -432,11 +459,13 @@ public class OverviewPanel extends Panel implements Runnable,
repaint();
}
+ @Override
public void update(Graphics g)
{
paint(g);
}
+ @Override
public void paint(Graphics g)
{
Graphics og = offscreen.getGraphics();
diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java
index 8a39ad9..b0b8c9c 100644
--- a/src/jalview/appletgui/PCAPanel.java
+++ b/src/jalview/appletgui/PCAPanel.java
@@ -1,44 +1,60 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SeqCigar;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
+import jalview.viewmodel.PCAModel;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.CheckboxMenuItem;
+import java.awt.Choice;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
public class PCAPanel extends EmbmenuFrame implements Runnable,
ActionListener, ItemListener
{
- PCA pca;
-
- int top;
-
RotatableCanvas rc;
AlignViewport av;
- SequenceI[] seqs;
+ PCAModel pcaModel;
- AlignmentView seqstrings;
+ int top = 0;
public PCAPanel(AlignViewport av)
{
@@ -58,14 +74,18 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
}
this.av = av;
- seqstrings = av.getAlignmentView(av.getSelectionGroup() != null);
- if (av.getSelectionGroup() == null)
+ boolean selected = av.getSelectionGroup() != null
+ && av.getSelectionGroup().getSize() > 0;
+ AlignmentView seqstrings = av.getAlignmentView(selected);
+ boolean nucleotide = av.getAlignment().isNucleotide();
+ SequenceI[] seqs;
+ if (!selected)
{
- seqs = av.alignment.getSequencesArray();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
}
SeqCigar sq[] = seqstrings.getSequences();
int length = sq[0].getWidth();
@@ -79,13 +99,15 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
return;
}
}
+ pcaModel = new PCAModel(seqstrings, seqs, nucleotide);
rc = new RotatableCanvas(av);
embedMenuIfNeeded(rc);
add(rc, BorderLayout.CENTER);
- jalview.bin.JalviewLite.addFrame(this, "Principal component analysis",
- 400, 400);
+ jalview.bin.JalviewLite.addFrame(this,
+ MessageManager.getString("label.principal_component_analysis"),
+ 475, 400);
Thread worker = new Thread(this);
worker.start();
@@ -96,46 +118,32 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
*/
public void run()
{
- pca = new PCA(seqstrings.getSequenceStrings(' '));
- pca.run();
-
- // Now find the component coordinates
- int ii = 0;
-
- while ((ii < seqs.length) && (seqs[ii] != null))
- {
- ii++;
- }
-
- double[][] comps = new double[ii][ii];
-
- for (int i = 0; i < ii; i++)
+ // TODO progress indicator
+ calcSettings.setEnabled(false);
+ rc.setEnabled(false);
+ try
{
- if (pca.getEigenvalue(i) > 1e-4)
- {
- comps[i] = pca.component(i);
- }
- }
-
- // ////////////////
- xCombobox.select(0);
- yCombobox.select(1);
- zCombobox.select(2);
-
- top = pca.getM().rows - 1;
-
- Vector points = new Vector();
- float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100);
-
- for (int i = 0; i < pca.getM().rows; i++)
+ nuclSetting.setState(pcaModel.isNucleotide());
+ protSetting.setState(!pcaModel.isNucleotide());
+ pcaModel.run();
+ // ////////////////
+ xCombobox.select(0);
+ yCombobox.select(1);
+ zCombobox.select(2);
+
+ pcaModel.updateRc(rc);
+ // rc.invalidate();
+ top = pcaModel.getTop();
+ } catch (OutOfMemoryError x)
{
- SequencePoint sp = new SequencePoint(seqs[i], scores[i]);
- points.addElement(sp);
+ System.err.println("Out of memory when calculating PCA.");
+ return;
}
+ calcSettings.setEnabled(true);
- rc.setPoints(points, pca.getM().rows);
+ // TODO revert progress indicator
+ rc.setEnabled(true);
rc.repaint();
- seqs = null;
this.repaint();
}
@@ -149,13 +157,7 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
int dim1 = top - xCombobox.getSelectedIndex();
int dim2 = top - yCombobox.getSelectedIndex();
int dim3 = top - zCombobox.getSelectedIndex();
-
- float[][] scores = pca.getComponents(dim1, dim2, dim3, 100);
- for (int i = 0; i < pca.getM().rows; i++)
- {
- ((SequencePoint) rc.points.elementAt(i)).coord = scores[i];
- }
-
+ pcaModel.updateRcView(dim1, dim2, dim3);
rc.img = null;
rc.rotmat.setIdentity();
rc.initAxes();
@@ -168,7 +170,14 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
{
showOriginalData();
}
- else
+ if (evt.getSource() == resetButton)
+ {
+ xCombobox.select(0);
+ yCombobox.select(1);
+ zCombobox.select(2);
+ doDimensionChange();
+ }
+ if (evt.getSource() == values)
{
values_actionPerformed();
}
@@ -188,6 +197,26 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
{
zCombobox_actionPerformed();
}
+ else if (evt.getSource() == labels)
+ {
+ labels_itemStateChanged(evt);
+ }
+ else if (evt.getSource() == nuclSetting)
+ {
+ if (!pcaModel.isNucleotide())
+ {
+ pcaModel.setNucleotide(true);
+ new Thread(this).start();
+ }
+ }
+ else if (evt.getSource() == protSetting)
+ {
+ if (pcaModel.isNucleotide())
+ {
+ pcaModel.setNucleotide(false);
+ new Thread(this).start();
+ }
+ }
}
protected void xCombobox_actionPerformed()
@@ -211,9 +240,10 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
CutAndPasteTransfer cap = new CutAndPasteTransfer(false, null);
Frame frame = new Frame();
frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "PCA details", 500, 500);
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.pca_details"), 500, 500);
- cap.setText(pca.getDetails());
+ cap.setText(pcaModel.getDetails());
}
void showOriginalData()
@@ -234,7 +264,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
{
}
;
- Object[] alAndColsel = seqstrings.getAlignmentAndColumnSelection(gc);
+ Object[] alAndColsel = pcaModel.getSeqtrings()
+ .getAlignmentAndColumnSelection(gc);
if (alAndColsel != null && alAndColsel[0] != null)
{
@@ -265,6 +296,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
protected Choice zCombobox = new Choice();
+ protected Button resetButton = new Button();
+
FlowLayout flowLayout1 = new FlowLayout();
BorderLayout borderLayout1 = new BorderLayout();
@@ -275,8 +308,14 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
Menu menu2 = new Menu();
+ Menu calcSettings = new Menu();
+
protected CheckboxMenuItem labels = new CheckboxMenuItem();
+ protected CheckboxMenuItem protSetting = new CheckboxMenuItem();
+
+ protected CheckboxMenuItem nuclSetting = new CheckboxMenuItem();
+
MenuItem values = new MenuItem();
MenuItem inputData = new MenuItem();
@@ -298,14 +337,23 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
yCombobox.addItemListener(this);
xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
xCombobox.addItemListener(this);
+ resetButton.setFont(new java.awt.Font("Verdana", 0, 12));
+ resetButton.setLabel(MessageManager.getString("action.reset"));
+ resetButton.addActionListener(this);
this.setMenuBar(menuBar1);
- menu1.setLabel("File");
- menu2.setLabel("View");
- labels.setLabel("Labels");
+ menu1.setLabel(MessageManager.getString("action.file"));
+ menu2.setLabel(MessageManager.getString("action.view"));
+ calcSettings.setLabel(MessageManager.getString("action.change_params"));
+ labels.setLabel(MessageManager.getString("label.labels"));
labels.addItemListener(this);
- values.setLabel("Output Values...");
+ values.setLabel(MessageManager.getString("label.output_values"));
values.addActionListener(this);
- inputData.setLabel("Input Data...");
+ inputData.setLabel(MessageManager.getString("label.input_data"));
+ nuclSetting.setLabel(MessageManager
+ .getString("label.nucleotide_matrix"));
+ nuclSetting.addItemListener(this);
+ protSetting.setLabel(MessageManager.getString("label.protein_matrix"));
+ protSetting.addItemListener(this);
this.add(jPanel2, BorderLayout.SOUTH);
jPanel2.add(jLabel1, null);
jPanel2.add(xCombobox, null);
@@ -313,11 +361,15 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
jPanel2.add(yCombobox, null);
jPanel2.add(jLabel3, null);
jPanel2.add(zCombobox, null);
+ jPanel2.add(resetButton, null);
menuBar1.add(menu1);
menuBar1.add(menu2);
+ menuBar1.add(calcSettings);
menu2.add(labels);
menu1.add(values);
menu1.add(inputData);
+ calcSettings.add(nuclSetting);
+ calcSettings.add(protSetting);
inputData.addActionListener(this);
}
diff --git a/src/jalview/appletgui/PaintRefresher.java b/src/jalview/appletgui/PaintRefresher.java
index 722dd32..7724880 100644
--- a/src/jalview/appletgui/PaintRefresher.java
+++ b/src/jalview/appletgui/PaintRefresher.java
@@ -1,27 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.awt.Component;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
/**
* DOCUMENT ME!
@@ -122,8 +128,8 @@ public class PaintRefresher
else if (validateSequences && comp instanceof AlignmentPanel
&& source instanceof AlignmentPanel)
{
- validateSequences(((AlignmentPanel) source).av.alignment,
- ((AlignmentPanel) comp).av.alignment);
+ validateSequences(((AlignmentPanel) source).av.getAlignment(),
+ ((AlignmentPanel) comp).av.getAlignment());
}
if (comp instanceof AlignmentPanel && alignmentChanged)
@@ -183,7 +189,13 @@ public class PaintRefresher
{
if (i < comp.getHeight())
{
- comp.getSequences().insertElementAt(a1[i], i);
+ // TODO: the following does not trigger any recalculation of
+ // height/etc, or maintain the dataset
+ List<SequenceI> alsq;
+ synchronized (alsq = comp.getSequences())
+ {
+ alsq.add(i, a1[i]);
+ }
}
else
{
@@ -235,11 +247,12 @@ public class PaintRefresher
{
if (comps.elementAt(i) instanceof AlignmentPanel)
{
- tmp.addElement(((AlignmentPanel) comps.elementAt(i)));
+ tmp.addElement(comps.elementAt(i));
}
}
AlignmentPanel[] result = new AlignmentPanel[tmp.size()];
- for (int ix=0;ix<result.length;ix++) {
+ for (int ix = 0; ix < result.length; ix++)
+ {
result[ix] = (AlignmentPanel) tmp.elementAt(ix);
}
diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java
index fe5e31d..1c95c12 100644
--- a/src/jalview/appletgui/PairwiseAlignPanel.java
+++ b/src/jalview/appletgui/PairwiseAlignPanel.java
@@ -1,29 +1,39 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Panel;
+import java.awt.ScrollPane;
+import java.awt.TextArea;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Vector;
public class PairwiseAlignPanel extends Panel implements ActionListener
{
@@ -48,17 +58,18 @@ public class PairwiseAlignPanel extends Panel implements ActionListener
if (ap.av.getSelectionGroup() == null)
{
- seqs = ap.av.alignment.getSequencesArray();
+ seqs = ap.av.getAlignment().getSequencesArray();
}
else
{
- seqs = ap.av.getSelectionGroup().getSequencesInOrder(ap.av.alignment);
+ seqs = ap.av.getSelectionGroup().getSequencesInOrder(
+ ap.av.getAlignment());
}
float scores[][] = new float[seqs.length][seqs.length];
double totscore = 0;
int count = ap.av.getSelectionGroup().getSize();
- String type = (ap.av.alignment.isNucleotide()) ? AlignSeq.DNA
+ String type = (ap.av.getAlignment().isNucleotide()) ? AlignSeq.DNA
: AlignSeq.PEP;
Sequence seq;
@@ -84,13 +95,8 @@ public class PairwiseAlignPanel extends Panel implements ActionListener
totscore = totscore + scores[i][j];
textarea.append(as.getOutput());
- seq = new Sequence(as.getS1().getName(), as.getAStr1(), as.getS1()
- .getStart(), as.getS1().getEnd());
- sequences.addElement(seq);
-
- seq = new Sequence(as.getS2().getName(), as.getAStr2(), as.getS2()
- .getStart(), as.getS2().getEnd());
- sequences.addElement(seq);
+ sequences.add(as.getAlignedSeq1());
+ sequences.add(as.getAlignedSeq1());
}
}
@@ -159,7 +165,8 @@ public class PairwiseAlignPanel extends Panel implements ActionListener
textarea.setFont(new java.awt.Font("Monospaced", 0, 12));
textarea.setText("");
viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12));
- viewInEditorButton.setLabel("View in alignment editor");
+ viewInEditorButton.setLabel(MessageManager
+ .getString("label.view_alignment_editor"));
viewInEditorButton.addActionListener(this);
this.add(scrollPane, BorderLayout.CENTER);
scrollPane.add(textarea);
diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java
index b3c6a01..d0fcd58 100644
--- a/src/jalview/appletgui/RedundancyPanel.java
+++ b/src/jalview/appletgui/RedundancyPanel.java
@@ -1,35 +1,48 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.commands.*;
-import jalview.datamodel.*;
+import jalview.analysis.AlignSeq;
+import jalview.commands.CommandI;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+import java.util.Vector;
public class RedundancyPanel extends SliderPanel implements Runnable,
WindowListener
{
- AlignmentPanel ap;
-
Stack historyList = new Stack(); // simpler than synching with alignFrame.
float[] redundancy;
@@ -50,7 +63,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
applyButton.setVisible(true);
allGroupsCheck.setVisible(false);
- label.setText("Enter the redundancy threshold");
+ label.setText(MessageManager
+ .getString("label.enter_redundancy_threshold"));
valueField.setText("100");
slider.setVisibleAmount(1);
@@ -69,8 +83,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
frame = new Frame();
frame.add(this);
- jalview.bin.JalviewLite.addFrame(frame,
- "Redundancy threshold selection", 400, 100);
+ jalview.bin.JalviewLite.addFrame(frame, MessageManager
+ .getString("label.redundancy_threshold_selection"), 400, 100);
frame.addWindowListener(this);
@@ -92,7 +106,7 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
*/
public void run()
{
- label.setText("Calculating....");
+ label.setText(MessageManager.getString("label.calculating"));
slider.setVisible(false);
applyButton.setEnabled(false);
@@ -109,74 +123,29 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
if ((sg != null) && (sg.getSize() >= 1))
{
- originalSequences = sg.getSequencesInOrder(ap.av.alignment);
+ originalSequences = sg.getSequencesInOrder(ap.av.getAlignment());
start = sg.getStartRes();
end = sg.getEndRes();
}
else
{
- originalSequences = ap.av.alignment.getSequencesArray();
+ originalSequences = ap.av.getAlignment().getSequencesArray();
start = 0;
- end = ap.av.alignment.getWidth();
+ end = ap.av.getAlignment().getWidth();
}
height = originalSequences.length;
- redundancy = new float[height];
- for (int i = 0; i < height; i++)
- {
- redundancy[i] = 0f;
- }
-
- // if (ap.av.hasHiddenColumns)
- {
- // omitHidden = ap.av.getSelectionAsString();
- }
-
- // long start = System.currentTimeMillis();
-
- float pid;
- String seqi, seqj;
- for (int i = 0; i < height; i++)
- {
- for (int j = 0; j < i; j++)
- {
- if (i == j)
- {
- continue;
- }
-
- if (omitHidden == null)
- {
- seqi = originalSequences[i].getSequenceAsString(start, end);
- seqj = originalSequences[j].getSequenceAsString(start, end);
- }
- else
- {
- seqi = omitHidden[i];
- seqj = omitHidden[j];
- }
-
- pid = jalview.util.Comparison.PID(seqi, seqj);
-
- if (seqj.length() < seqi.length())
- {
- redundancy[j] = Math.max(pid, redundancy[j]);
- }
- else
- {
- redundancy[i] = Math.max(pid, redundancy[i]);
- }
-
- }
- }
-
- label.setText("Enter the redundancy threshold");
+ redundancy = AlignSeq.computeRedundancyMatrix(originalSequences,
+ omitHidden, start, end, false);
+ label.setText(MessageManager
+ .getString("label.enter_redundancy_threshold"));
slider.setVisible(true);
applyButton.setEnabled(true);
valueField.setVisible(true);
validate();
+ sliderValueChanged();
// System.out.println("blob done "+ (System.currentTimeMillis()-start));
}
@@ -189,19 +158,16 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
float value = slider.getValue();
+ List<SequenceI> redundantSequences = new ArrayList<SequenceI>();
for (int i = 0; i < redundancy.length; i++)
{
- if (value > redundancy[i])
- {
- redundantSeqs.removeElement(originalSequences[i]);
- }
- else if (!redundantSeqs.contains(originalSequences[i]))
+ if (value <= redundancy[i])
{
- redundantSeqs.addElement(originalSequences[i]);
+ redundantSequences.add(originalSequences[i]);
}
}
- ap.idPanel.idCanvas.setHighlighted(redundantSeqs);
+ ap.idPanel.idCanvas.setHighlighted(redundantSequences);
PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
}
@@ -240,13 +206,13 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
}
}
- EditCommand cut = new EditCommand("Remove Redundancy",
- EditCommand.CUT, deleted, 0, width, ap.av.alignment);
-
+ EditCommand cut = new EditCommand(
+ MessageManager.getString("action.remove_redundancy"),
+ Action.CUT, deleted, 0, width, ap.av.getAlignment());
+ AlignmentI alignment = ap.av.getAlignment();
for (int i = 0; i < del.size(); i++)
{
- ap.av.alignment.deleteSequence(deleted[i]);
- PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
+ alignment.deleteSequence(deleted[i]);
if (sg != null)
{
sg.deleteSequence(deleted[i], false);
@@ -257,6 +223,7 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
ap.alignFrame.addHistoryItem(cut);
+ PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
ap.av.firePropertyChange("alignment", null, ap.av.getAlignment()
.getSequences());
}
@@ -268,10 +235,12 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
CommandI command = (CommandI) historyList.pop();
command.undoCommand(null);
- if (ap.av.historyList.contains(command))
+ if (ap.av.getHistoryList().contains(command))
{
- ap.av.historyList.removeElement(command);
+ ap.av.getHistoryList().remove(command);
ap.alignFrame.updateEditMenuBar();
+ ap.av.firePropertyChange("alignment", null, ap.av.getAlignment()
+ .getSequences());
}
ap.paintAlignment(true);
diff --git a/src/jalview/appletgui/RotatableCanvas.java b/src/jalview/appletgui/RotatableCanvas.java
index fd63acf..f38d291 100644
--- a/src/jalview/appletgui/RotatableCanvas.java
+++ b/src/jalview/appletgui/RotatableCanvas.java
@@ -1,33 +1,49 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
-import jalview.math.*;
-import jalview.util.*;
+import jalview.api.RotatableCanvasI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequencePoint;
+import jalview.math.RotatableMatrix;
+import jalview.util.Format;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Panel;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.util.Vector;
public class RotatableCanvas extends Panel implements MouseListener,
- MouseMotionListener, KeyListener
+ MouseMotionListener, KeyListener, RotatableCanvasI
{
RotatableMatrix idmat = new RotatableMatrix(3, 3);
@@ -95,11 +111,11 @@ public class RotatableCanvas extends Panel implements MouseListener,
float scalefactor = 1;
- AlignViewport av;
+ AlignmentViewport av;
boolean showLabels = false;
- public RotatableCanvas(AlignViewport av)
+ public RotatableCanvas(AlignmentViewport av)
{
this.av = av;
}
@@ -315,7 +331,8 @@ public class RotatableCanvas extends Panel implements MouseListener,
if (points == null)
{
g.setFont(new Font("Verdana", Font.PLAIN, 18));
- g.drawString("Calculating PCA....", 20, getSize().height / 2);
+ g.drawString(MessageManager.getString("label.calculating_pca")
+ + "....", 20, getSize().height / 2);
}
else
{
@@ -514,17 +531,18 @@ public class RotatableCanvas extends Panel implements MouseListener,
if (found != null)
{
- // TODO: applet PCA is not associatable with multi-panels - only parent view
+ // TODO: applet PCA is not associatable with multi-panels - only parent
+ // view
if (av.getSelectionGroup() != null)
{
av.getSelectionGroup().addOrRemove(found, true);
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+ av.getSelectionGroup().setEndRes(av.getAlignment().getWidth() - 1);
}
else
{
av.setSelectionGroup(new SequenceGroup());
av.getSelectionGroup().addOrRemove(found, true);
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+ av.getSelectionGroup().setEndRes(av.getAlignment().getWidth() - 1);
}
PaintRefresher.Refresh(this, av.getSequenceSetId());
diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java
index 1f256fe..2445e2c 100644
--- a/src/jalview/appletgui/ScalePanel.java
+++ b/src/jalview/appletgui/ScalePanel.java
@@ -1,26 +1,41 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceGroup;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.PopupMenu;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
public class ScalePanel extends Panel implements MouseMotionListener,
MouseListener
@@ -60,7 +75,7 @@ public class ScalePanel extends Panel implements MouseMotionListener,
int x = (evt.getX() / av.getCharWidth()) + av.getStartRes();
final int res;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(x);
}
@@ -76,7 +91,8 @@ public class ScalePanel extends Panel implements MouseMotionListener,
PopupMenu pop = new PopupMenu();
if (reveal != null)
{
- MenuItem item = new MenuItem("Reveal");
+ MenuItem item = new MenuItem(
+ MessageManager.getString("label.reveal"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -92,9 +108,9 @@ public class ScalePanel extends Panel implements MouseMotionListener,
});
pop.add(item);
- if (av.getColumnSelection().getHiddenColumns().size() > 1)
+ if (av.getColumnSelection().hasManyHiddenColumns())
{
- item = new MenuItem("Reveal All");
+ item = new MenuItem(MessageManager.getString("action.reveal_all"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -115,15 +131,16 @@ public class ScalePanel extends Panel implements MouseMotionListener,
}
else if (av.getColumnSelection().contains(res))
{
- MenuItem item = new MenuItem("Hide Columns");
+ MenuItem item = new MenuItem(
+ MessageManager.getString("label.hide_columns"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
av.hideColumns(res, res);
if (av.getSelectionGroup() != null
- && av.getSelectionGroup().getSize() == av.alignment
- .getHeight())
+ && av.getSelectionGroup().getSize() == av
+ .getAlignment().getHeight())
{
av.setSelectionGroup(null);
}
@@ -150,9 +167,9 @@ public class ScalePanel extends Panel implements MouseMotionListener,
av.getColumnSelection().addElement(res);
SequenceGroup sg = new SequenceGroup();
- for (int i = 0; i < av.alignment.getSequences().size(); i++)
+ for (int i = 0; i < av.getAlignment().getSequences().size(); i++)
{
- sg.addSequence(av.alignment.getSequenceAt(i), false);
+ sg.addSequence(av.getAlignment().getSequenceAt(i), false);
}
sg.setStartRes(res);
@@ -182,12 +199,12 @@ public class ScalePanel extends Panel implements MouseMotionListener,
int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
- if (res > av.alignment.getWidth())
+ if (res > av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
@@ -225,14 +242,14 @@ public class ScalePanel extends Panel implements MouseMotionListener,
res = 0;
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
- if (res > av.alignment.getWidth())
+ if (res > av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (res < min)
@@ -307,7 +324,7 @@ public class ScalePanel extends Panel implements MouseMotionListener,
public void mouseMoved(MouseEvent evt)
{
- if (!av.hasHiddenColumns)
+ if (!av.hasHiddenColumns())
{
return;
}
@@ -317,10 +334,8 @@ public class ScalePanel extends Panel implements MouseMotionListener,
res = av.getColumnSelection().adjustForHiddenColumns(res);
reveal = null;
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
+ for (int[] region : av.getColumnSelection().getHiddenColumns())
{
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns()
- .elementAt(i);
if (res + 1 == region[0] || res - 1 == region[1])
{
reveal = region;
@@ -347,7 +362,6 @@ public class ScalePanel extends Panel implements MouseMotionListener,
int height)
{
gg.setFont(av.getFont());
-
// Fill in the background
gg.setColor(Color.white);
gg.fillRect(0, 0, width, height);
@@ -356,18 +370,18 @@ public class ScalePanel extends Panel implements MouseMotionListener,
// Fill the selected columns
ColumnSelection cs = av.getColumnSelection();
gg.setColor(new Color(220, 0, 0));
-
+ int avcharWidth = av.getCharWidth(), avcharHeight = av.getCharHeight();
for (int i = 0; i < cs.size(); i++)
{
int sel = cs.columnAt(i);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
sel = av.getColumnSelection().findColumnPosition(sel);
}
if ((sel >= startx) && (sel <= endx))
{
- gg.fillRect((sel - startx) * av.charWidth, 0, av.charWidth,
+ gg.fillRect((sel - startx) * avcharWidth, 0, avcharWidth,
getSize().height);
}
}
@@ -378,7 +392,7 @@ public class ScalePanel extends Panel implements MouseMotionListener,
int scalestartx = (startx / 10) * 10;
FontMetrics fm = gg.getFontMetrics(av.getFont());
- int y = av.charHeight - fm.getDescent();
+ int y = avcharHeight - fm.getDescent();
if ((scalestartx % 10) == 0)
{
@@ -394,30 +408,27 @@ public class ScalePanel extends Panel implements MouseMotionListener,
{
string = String.valueOf(av.getColumnSelection()
.adjustForHiddenColumns(i));
- if ((i - startx - 1) * av.charWidth > maxX)
+ if ((i - startx - 1) * avcharWidth > maxX)
{
- gg.drawString(string, (i - startx - 1) * av.charWidth, y);
- maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string);
+ gg.drawString(string, (i - startx - 1) * avcharWidth, y);
+ maxX = (i - startx + 1) * avcharWidth + fm.stringWidth(string);
}
- gg.drawLine(
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
+ gg.drawLine(((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
y + 2,
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
- y + (fm.getDescent() * 2));
+ ((i - startx - 1) * avcharWidth) + (avcharWidth / 2), y
+ + (fm.getDescent() * 2));
}
else
{
- gg.drawLine(
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
- y + fm.getDescent(),
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
- y + (fm.getDescent() * 2));
+ gg.drawLine(((i - startx - 1) * avcharWidth) + (avcharWidth / 2), y
+ + fm.getDescent(), ((i - startx - 1) * avcharWidth)
+ + (avcharWidth / 2), y + (fm.getDescent() * 2));
}
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
gg.setColor(Color.blue);
int res;
@@ -435,19 +446,18 @@ public class ScalePanel extends Panel implements MouseMotionListener,
continue;
}
- gg.fillPolygon(new int[]
- { res * av.charWidth - av.charHeight / 4,
- res * av.charWidth + av.charHeight / 4, res * av.charWidth },
- new int[]
- { y - av.charHeight / 2, y - av.charHeight / 2, y + 8 },
- 3);
+ gg.fillPolygon(new int[] { res * avcharWidth - avcharHeight / 4,
+ res * avcharWidth + avcharHeight / 4, res * avcharWidth },
+ new int[] { y - avcharHeight / 2, y - avcharHeight / 2,
+ y + 8 }, 3);
}
}
if (reveal != null && reveal[0] > startx && reveal[0] < endx)
{
- gg.drawString("Reveal Columns", reveal[0] * av.charWidth, 0);
+ gg.drawString(MessageManager.getString("label.reveal_columns"),
+ reveal[0] * avcharWidth, 0);
}
}
diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java
index 26da08b..7689535 100644
--- a/src/jalview/appletgui/SeqCanvas.java
+++ b/src/jalview/appletgui/SeqCanvas.java
@@ -1,25 +1,36 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.viewmodel.AlignmentViewport;
-import jalview.datamodel.*;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Panel;
public class SeqCanvas extends Panel
{
@@ -51,9 +62,18 @@ public class SeqCanvas extends Panel
fr = new FeatureRenderer(av);
sr = new SequenceRenderer(av);
PaintRefresher.Register(this, av.getSequenceSetId());
+ updateViewport();
+ }
+
+ int avcharHeight = 0, avcharWidth = 0;
+
+ private void updateViewport()
+ {
+ avcharHeight = av.getCharHeight();
+ avcharWidth = av.getCharWidth();
}
- public AlignViewport getViewport()
+ public AlignmentViewport getViewport()
{
return av;
}
@@ -68,7 +88,7 @@ public class SeqCanvas extends Panel
return sr;
}
- void drawNorthScale(Graphics g, int startx, int endx, int ypos)
+ private void drawNorthScale(Graphics g, int startx, int endx, int ypos)
{
int scalestartx = startx - startx % 10 + 10;
@@ -78,41 +98,41 @@ public class SeqCanvas extends Panel
for (int i = scalestartx; i < endx; i += 10)
{
int value = i;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
value = av.getColumnSelection().adjustForHiddenColumns(value);
}
- g.drawString(String.valueOf(value), (i - startx - 1) * av.charWidth,
- ypos - (av.charHeight / 2));
+ g.drawString(String.valueOf(value), (i - startx - 1) * avcharWidth,
+ ypos - (avcharHeight / 2));
- g.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
- (ypos + 2) - (av.charHeight / 2),
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+ g.drawLine(((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
+ (ypos + 2) - (avcharHeight / 2),
+ ((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
ypos - 2);
}
}
- void drawWestScale(Graphics g, int startx, int endx, int ypos)
+ private void drawWestScale(Graphics g, int startx, int endx, int ypos)
{
FontMetrics fm = getFontMetrics(av.getFont());
- ypos += av.charHeight;
- if (av.hasHiddenColumns)
+ ypos += avcharHeight;
+ if (av.hasHiddenColumns())
{
startx = av.getColumnSelection().adjustForHiddenColumns(startx);
endx = av.getColumnSelection().adjustForHiddenColumns(endx);
}
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
// WEST SCALE
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- SequenceI seq = av.alignment.getSequenceAt(i);
+ SequenceI seq = av.getAlignment().getSequenceAt(i);
int index = startx;
int value = -1;
@@ -125,7 +145,7 @@ public class SeqCanvas extends Panel
continue;
}
- value = av.alignment.getSequenceAt(i).findPosition(index);
+ value = av.getAlignment().getSequenceAt(i).findPosition(index);
break;
}
@@ -133,27 +153,27 @@ public class SeqCanvas extends Panel
if (value != -1)
{
int x = LABEL_WEST - fm.stringWidth(String.valueOf(value))
- - av.charWidth / 2;
- g.drawString(value + "", x, (ypos + (i * av.charHeight))
- - (av.charHeight / 5));
+ - avcharWidth / 2;
+ g.drawString(value + "", x, (ypos + (i * avcharHeight))
+ - (avcharHeight / 5));
}
}
}
- void drawEastScale(Graphics g, int startx, int endx, int ypos)
+ private void drawEastScale(Graphics g, int startx, int endx, int ypos)
{
- ypos += av.charHeight;
+ ypos += avcharHeight;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
endx = av.getColumnSelection().adjustForHiddenColumns(endx);
}
SequenceI seq;
// EAST SCALE
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- seq = av.alignment.getSequenceAt(i);
+ seq = av.getAlignment().getSequenceAt(i);
int index = endx;
int value = -1;
@@ -173,8 +193,8 @@ public class SeqCanvas extends Panel
if (value != -1)
{
- g.drawString(String.valueOf(value), 0, (ypos + (i * av.charHeight))
- - (av.charHeight / 5));
+ g.drawString(String.valueOf(value), 0, (ypos + (i * avcharHeight))
+ - (avcharHeight / 5));
}
}
}
@@ -188,6 +208,8 @@ public class SeqCanvas extends Panel
return;
}
+ updateViewport();
+
// Its possible on certain browsers that the call to fastpaint
// is faster than it can paint, so this check here catches
// this possibility
@@ -199,16 +221,16 @@ public class SeqCanvas extends Panel
lastsr = av.startRes;
fastPaint = true;
- gg.copyArea(horizontal * av.charWidth, vertical * av.charHeight,
- imgWidth - horizontal * av.charWidth, imgHeight - vertical
- * av.charHeight, -horizontal * av.charWidth, -vertical
- * av.charHeight);
+ gg.copyArea(horizontal * avcharWidth, vertical * avcharHeight, imgWidth
+ - horizontal * avcharWidth,
+ imgHeight - vertical * avcharHeight, -horizontal * avcharWidth,
+ -vertical * avcharHeight);
int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq, transX = 0, transY = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
- transX = (er - sr - horizontal) * av.charWidth;
+ transX = (er - sr - horizontal) * avcharWidth;
sr = er - horizontal;
}
else if (horizontal < 0)
@@ -225,7 +247,7 @@ public class SeqCanvas extends Panel
}
else
{
- transY = imgHeight - vertical * av.charHeight;
+ transY = imgHeight - vertical * avcharHeight;
}
}
else if (vertical < 0)
@@ -259,6 +281,7 @@ public class SeqCanvas extends Panel
paint(g);
}
+ @Override
public void paint(Graphics g)
{
@@ -278,12 +301,13 @@ public class SeqCanvas extends Panel
return;
}
+ updateViewport();
// this draws the whole of the alignment
imgWidth = this.getSize().width;
imgHeight = this.getSize().height;
- imgWidth -= imgWidth % av.charWidth;
- imgHeight -= imgHeight % av.charHeight;
+ imgWidth -= imgWidth % avcharWidth;
+ imgHeight -= imgHeight % avcharHeight;
if (imgWidth < 1 || imgHeight < 1)
{
@@ -318,24 +342,24 @@ public class SeqCanvas extends Panel
public int getWrappedCanvasWidth(int cwidth)
{
- cwidth -= cwidth % av.charWidth;
+ cwidth -= cwidth % av.getCharWidth();
FontMetrics fm = getFontMetrics(av.getFont());
LABEL_EAST = 0;
LABEL_WEST = 0;
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
LABEL_EAST = fm.stringWidth(getMask());
}
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
LABEL_WEST = fm.stringWidth(getMask());
}
- return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
+ return (cwidth - LABEL_EAST - LABEL_WEST) / av.getCharWidth();
}
/**
@@ -348,9 +372,10 @@ public class SeqCanvas extends Panel
String mask = "0";
int maxWidth = 0;
int tmp;
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment = av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- tmp = av.alignment.getSequenceAt(i).getEnd();
+ tmp = alignment.getSequenceAt(i).getEnd();
if (tmp > maxWidth)
{
maxWidth = tmp;
@@ -364,31 +389,31 @@ public class SeqCanvas extends Panel
return mask;
}
- public void drawWrappedPanel(Graphics g, int canvasWidth,
+ private void drawWrappedPanel(Graphics g, int canvasWidth,
int canvasHeight, int startRes)
{
AlignmentI al = av.getAlignment();
FontMetrics fm = getFontMetrics(av.getFont());
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
LABEL_EAST = fm.stringWidth(getMask());
}
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
LABEL_WEST = fm.stringWidth(getMask());
}
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = avcharHeight;
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += avcharHeight;
}
- int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
- int cHeight = av.getAlignment().getHeight() * av.charHeight;
+ int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / avcharWidth;
+ int cHeight = av.getAlignment().getHeight() * avcharHeight;
av.setWrappedWidth(cWidth);
@@ -397,9 +422,9 @@ public class SeqCanvas extends Panel
int endx;
int ypos = hgap;
- int maxwidth = av.alignment.getWidth() - 1;
+ int maxwidth = av.getAlignment().getWidth() - 1;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
@@ -415,12 +440,12 @@ public class SeqCanvas extends Panel
g.setColor(Color.black);
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
drawWestScale(g, startRes, endx, ypos);
}
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
g.translate(canvasWidth - LABEL_EAST, 0);
drawEastScale(g, startRes, endx, ypos);
@@ -429,11 +454,11 @@ public class SeqCanvas extends Panel
g.translate(LABEL_WEST, 0);
- if (av.scaleAboveWrapped)
+ if (av.getScaleAboveWrapped())
{
drawNorthScale(g, startRes, endx, ypos);
}
- if (av.hasHiddenColumns && av.showHiddenMarkers)
+ if (av.hasHiddenColumns() && av.getShowHiddenMarkers())
{
g.setColor(Color.blue);
int res;
@@ -448,25 +473,24 @@ public class SeqCanvas extends Panel
continue;
}
- gg.fillPolygon(new int[]
- { res * av.charWidth - av.charHeight / 4,
- res * av.charWidth + av.charHeight / 4, res * av.charWidth },
- new int[]
- { ypos - (av.charHeight / 2), ypos - (av.charHeight / 2),
- ypos - (av.charHeight / 2) + 8 }, 3);
+ gg.fillPolygon(new int[] { res * avcharWidth - avcharHeight / 4,
+ res * avcharWidth + avcharHeight / 4, res * avcharWidth },
+ new int[] { ypos - (avcharHeight / 2),
+ ypos - (avcharHeight / 2),
+ ypos - (avcharHeight / 2) + 8 }, 3);
}
}
if (g.getClip() == null)
{
- g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);
+ g.setClip(0, 0, cWidth * avcharWidth, canvasHeight);
}
drawPanel(g, startRes, endx, 0, al.getHeight(), ypos);
g.setClip(null);
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
g.translate(0, cHeight + ypos + 4);
if (annotations == null)
@@ -490,7 +514,7 @@ public class SeqCanvas extends Panel
int getAnnotationHeight()
{
- if (!av.showAnnotation)
+ if (!av.isShowAnnotation())
{
return 0;
}
@@ -503,59 +527,61 @@ public class SeqCanvas extends Panel
return annotations.adjustPanelHeight();
}
- void drawPanel(Graphics g1, int startRes, int endRes, int startSeq,
- int endSeq, int offset)
+ private void drawPanel(Graphics g1, int startRes, int endRes,
+ int startSeq, int endSeq, int offset)
{
- if (!av.hasHiddenColumns)
+
+ if (!av.hasHiddenColumns())
{
draw(g1, startRes, endRes, startSeq, endSeq, offset);
}
else
{
- java.util.Vector regions = av.getColumnSelection().getHiddenColumns();
int screenY = 0;
int blockStart = startRes;
int blockEnd = endRes;
- for (int i = 0; i < regions.size(); i++)
+ if (av.hasHiddenColumns())
{
- int[] region = (int[]) regions.elementAt(i);
- int hideStart = region[0];
- int hideEnd = region[1];
-
- if (hideStart <= blockStart)
+ for (int[] region : av.getColumnSelection().getHiddenColumns())
{
- blockStart += (hideEnd - hideStart) + 1;
- continue;
- }
+ int hideStart = region[0];
+ int hideEnd = region[1];
- blockEnd = hideStart - 1;
+ if (hideStart <= blockStart)
+ {
+ blockStart += (hideEnd - hideStart) + 1;
+ continue;
+ }
- g1.translate(screenY * av.charWidth, 0);
+ blockEnd = hideStart - 1;
- draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
+ g1.translate(screenY * avcharWidth, 0);
- if (av.getShowHiddenMarkers())
- {
- g1.setColor(Color.blue);
- g1.drawLine((blockEnd - blockStart + 1) * av.charWidth - 1,
- 0 + offset, (blockEnd - blockStart + 1) * av.charWidth
- - 1, (endSeq - startSeq) * av.charHeight + offset);
- }
+ draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
- g1.translate(-screenY * av.charWidth, 0);
- screenY += blockEnd - blockStart + 1;
- blockStart = hideEnd + 1;
- }
+ if (av.getShowHiddenMarkers())
+ {
+ g1.setColor(Color.blue);
+ g1.drawLine((blockEnd - blockStart + 1) * avcharWidth - 1,
+ 0 + offset, (blockEnd - blockStart + 1) * avcharWidth
+ - 1, (endSeq - startSeq) * avcharHeight
+ + offset);
+ }
+ g1.translate(-screenY * avcharWidth, 0);
+ screenY += blockEnd - blockStart + 1;
+ blockStart = hideEnd + 1;
+ }
+ }
if (screenY <= (endRes - startRes))
{
blockEnd = blockStart + (endRes - startRes) - screenY;
- g1.translate(screenY * av.charWidth, 0);
+ g1.translate(screenY * avcharWidth, 0);
draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
- g1.translate(-screenY * av.charWidth, 0);
+ g1.translate(-screenY * avcharWidth, 0);
}
}
@@ -567,28 +593,28 @@ public class SeqCanvas extends Panel
int offset)
{
g.setFont(av.getFont());
- sr.prepare(g, av.renderGaps);
-
+ sr.prepare(g, av.isRenderGaps());
+ updateViewport();
SequenceI nextSeq;
// / First draw the sequences
// ///////////////////////////
for (int i = startSeq; i < endSeq; i++)
{
- nextSeq = av.alignment.getSequenceAt(i);
+ nextSeq = av.getAlignment().getSequenceAt(i);
if (nextSeq == null)
{
continue;
}
- sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq),
- startRes, endRes, offset + ((i - startSeq) * av.charHeight));
+ sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
+ startRes, endRes, offset + ((i - startSeq) * avcharHeight));
- if (av.showSequenceFeatures)
+ if (av.isShowSequenceFeatures())
{
fr.drawSequence(g, nextSeq, startRes, endRes, offset
- + ((i - startSeq) * av.charHeight));
+ + ((i - startSeq) * avcharHeight));
}
// / Highlight search Results once all sequences have been drawn
@@ -603,8 +629,8 @@ public class SeqCanvas extends Panel
{
sr.drawHighlightedText(nextSeq, visibleResults[r],
visibleResults[r + 1], (visibleResults[r] - startRes)
- * av.charWidth, offset
- + ((i - startSeq) * av.charHeight));
+ * avcharWidth, offset
+ + ((i - startSeq) * avcharHeight));
}
}
}
@@ -612,21 +638,20 @@ public class SeqCanvas extends Panel
if (av.cursorMode && cursorY == i && cursorX >= startRes
&& cursorX <= endRes)
{
- sr.drawCursor(nextSeq, cursorX,
- (cursorX - startRes) * av.charWidth, offset
- + ((i - startSeq) * av.charHeight));
+ sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * avcharWidth,
+ offset + ((i - startSeq) * avcharHeight));
}
}
if (av.getSelectionGroup() != null
- || av.alignment.getGroups().size() > 0)
+ || av.getAlignment().getGroups().size() > 0)
{
drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);
}
}
- void drawGroupsBoundaries(Graphics g, int startRes, int endRes,
+ private void drawGroupsBoundaries(Graphics g, int startRes, int endRes,
int startSeq, int endSeq, int offset)
{
//
@@ -640,9 +665,9 @@ public class SeqCanvas extends Panel
int ex = -1;
int groupIndex = -1;
- if ((group == null) && (av.alignment.getGroups().size() > 0))
+ if ((group == null) && (av.getAlignment().getGroups().size() > 0))
{
- group = (SequenceGroup) av.alignment.getGroups().elementAt(0);
+ group = av.getAlignment().getGroups().get(0);
groupIndex = 0;
}
@@ -655,35 +680,36 @@ public class SeqCanvas extends Panel
boolean inGroup = false;
int top = -1;
int bottom = -1;
- int alHeight = av.alignment.getHeight() - 1;
+ int alHeight = av.getAlignment().getHeight() - 1;
for (i = startSeq; i < endSeq; i++)
{
- sx = (group.getStartRes() - startRes) * av.charWidth;
- sy = offset + ((i - startSeq) * av.charHeight);
- ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) - 1;
+ sx = (group.getStartRes() - startRes) * avcharWidth;
+ sy = offset + ((i - startSeq) * avcharHeight);
+ ex = (((group.getEndRes() + 1) - group.getStartRes()) * avcharWidth) - 1;
if (sx + ex < 0 || sx > imgWidth)
{
continue;
}
- if ((sx <= (endRes - startRes) * av.charWidth)
+ if ((sx <= (endRes - startRes) * avcharWidth)
&& group.getSequences(null).contains(
- av.alignment.getSequenceAt(i)))
+ av.getAlignment().getSequenceAt(i)))
{
if ((bottom == -1)
&& (i >= alHeight || !group.getSequences(null)
- .contains(av.alignment.getSequenceAt(i + 1))))
+ .contains(
+ av.getAlignment().getSequenceAt(i + 1))))
{
- bottom = sy + av.charHeight;
+ bottom = sy + avcharHeight;
}
if (!inGroup)
{
if (((top == -1) && (i == 0))
|| !group.getSequences(null).contains(
- av.alignment.getSequenceAt(i - 1)))
+ av.getAlignment().getSequenceAt(i - 1)))
{
top = sy;
}
@@ -726,9 +752,9 @@ public class SeqCanvas extends Panel
ex = imgWidth;
}
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ else if (sx + ex >= (endRes - startRes + 1) * avcharWidth)
{
- ex = (endRes - startRes + 1) * av.charWidth;
+ ex = (endRes - startRes + 1) * avcharWidth;
}
if (top != -1)
@@ -750,7 +776,7 @@ public class SeqCanvas extends Panel
if (inGroup)
{
- sy = offset + ((i - startSeq) * av.charHeight);
+ sy = offset + ((i - startSeq) * avcharHeight);
if (sx >= 0 && sx < imgWidth)
{
g.drawLine(sx, oldY, sx, sy);
@@ -771,9 +797,9 @@ public class SeqCanvas extends Panel
{
ex = imgWidth;
}
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ else if (sx + ex >= (endRes - startRes + 1) * avcharWidth)
{
- ex = (endRes - startRes + 1) * av.charWidth;
+ ex = (endRes - startRes + 1) * avcharWidth;
}
if (top != -1)
@@ -793,14 +819,13 @@ public class SeqCanvas extends Panel
groupIndex++;
- if (groupIndex >= av.alignment.getGroups().size())
+ if (groupIndex >= av.getAlignment().getGroups().size())
{
break;
}
- group = (SequenceGroup) av.alignment.getGroups().elementAt(
- groupIndex);
- } while (groupIndex < av.alignment.getGroups().size());
+ group = av.getAlignment().getGroups().get(groupIndex);
+ } while (groupIndex < av.getAlignment().getGroups().size());
}
}
diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java
index f961212..db6add7 100644
--- a/src/jalview/appletgui/SeqPanel.java
+++ b/src/jalview/appletgui/SeqPanel.java
@@ -1,36 +1,59 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.commands.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.api.AlignViewportI;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResults.Match;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.SelectionListener;
import jalview.structure.SelectionSource;
import jalview.structure.SequenceListener;
import jalview.structure.StructureSelectionManager;
+import jalview.structure.VamsasSource;
+import jalview.util.MappingUtils;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Panel;
+import java.awt.Point;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.util.Vector;
public class SeqPanel extends Panel implements MouseMotionListener,
- MouseListener, SequenceListener
+ MouseListener, SequenceListener, SelectionListener
{
public SeqCanvas seqCanvas;
@@ -93,6 +116,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
seqCanvas.addMouseListener(this);
ssm = StructureSelectionManager.getStructureSelectionManager(av.applet);
ssm.addStructureViewerListener(this);
+ ssm.addSelectionListener(this);
seqCanvas.repaint();
}
@@ -143,10 +167,9 @@ public class SeqPanel extends Panel implements MouseMotionListener,
void setCursorPosition()
{
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
- seqCanvas.cursorY);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
- seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1() - 1);
+ seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1;
scrollToVisible();
}
@@ -154,19 +177,20 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
seqCanvas.cursorX += dx;
seqCanvas.cursorY += dy;
- if (av.hasHiddenColumns && !av.colSel.isVisible(seqCanvas.cursorX))
+ if (av.hasHiddenColumns()
+ && !av.getColumnSelection().isVisible(seqCanvas.cursorX))
{
int original = seqCanvas.cursorX - dx;
- int maxWidth = av.alignment.getWidth();
+ int maxWidth = av.getAlignment().getWidth();
- while (!av.colSel.isVisible(seqCanvas.cursorX)
+ while (!av.getColumnSelection().isVisible(seqCanvas.cursorX)
&& seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0)
{
seqCanvas.cursorX += dx;
}
if (seqCanvas.cursorX >= maxWidth
- || !av.colSel.isVisible(seqCanvas.cursorX))
+ || !av.getColumnSelection().isVisible(seqCanvas.cursorX))
{
seqCanvas.cursorX = original;
}
@@ -180,22 +204,22 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
seqCanvas.cursorX = 0;
}
- else if (seqCanvas.cursorX > av.alignment.getWidth() - 1)
+ else if (seqCanvas.cursorX > av.getAlignment().getWidth() - 1)
{
- seqCanvas.cursorX = av.alignment.getWidth() - 1;
+ seqCanvas.cursorX = av.getAlignment().getWidth() - 1;
}
if (seqCanvas.cursorY < 0)
{
seqCanvas.cursorY = 0;
}
- else if (seqCanvas.cursorY > av.alignment.getHeight() - 1)
+ else if (seqCanvas.cursorY > av.getAlignment().getHeight() - 1)
{
- seqCanvas.cursorY = av.alignment.getHeight() - 1;
+ seqCanvas.cursorY = av.getAlignment().getHeight() - 1;
}
endEditing();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
ap.scrollToWrappedVisible(seqCanvas.cursorX);
}
@@ -209,7 +233,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
ap.scrollUp(false);
}
- while (seqCanvas.cursorX < av.colSel
+ while (seqCanvas.cursorX < av.getColumnSelection()
.adjustForHiddenColumns(av.startRes))
{
@@ -218,7 +242,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
break;
}
}
- while (seqCanvas.cursorX > av.colSel
+ while (seqCanvas.cursorX > av.getColumnSelection()
.adjustForHiddenColumns(av.endRes))
{
if (!ap.scrollRight(true))
@@ -227,7 +251,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
}
}
- setStatusMessage(av.alignment.getSequenceAt(seqCanvas.cursorY),
+ setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY),
seqCanvas.cursorX, seqCanvas.cursorY);
seqCanvas.repaint();
@@ -235,17 +259,16 @@ public class SeqPanel extends Panel implements MouseMotionListener,
void setSelectionAreaAtCursor(boolean topLeft)
{
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
- seqCanvas.cursorY);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
if (av.getSelectionGroup() != null)
{
- SequenceGroup sg = av.selectionGroup;
+ SequenceGroup sg = av.getSelectionGroup();
// Find the top and bottom of this group
- int min = av.alignment.getHeight(), max = 0;
+ int min = av.getAlignment().getHeight(), max = 0;
for (int i = 0; i < sg.getSize(); i++)
{
- int index = av.alignment.findIndex(sg.getSequenceAt(i));
+ int index = av.getAlignment().findIndex(sg.getSequenceAt(i));
if (index > max)
{
max = index;
@@ -287,10 +310,10 @@ public class SeqPanel extends Panel implements MouseMotionListener,
else
{
// Now add any sequences between min and max
- sg.getSequences(null).removeAllElements();
+ sg.clear();
for (int i = min; i < max; i++)
{
- sg.addSequence(av.alignment.getSequenceAt(i), false);
+ sg.addSequence(av.getAlignment().getSequenceAt(i), false);
}
}
}
@@ -344,63 +367,126 @@ public class SeqPanel extends Panel implements MouseMotionListener,
int getKeyboardNo1()
{
- if (keyboardNo1 == null)
- return 1;
- else
+ try
+ {
+ if (keyboardNo1 != null)
+ {
+ int value = Integer.parseInt(keyboardNo1.toString());
+ keyboardNo1 = null;
+ return value;
+ }
+ } catch (Exception x)
{
- int value = Integer.parseInt(keyboardNo1.toString());
- keyboardNo1 = null;
- return value;
}
+ keyboardNo1 = null;
+ return 1;
}
int getKeyboardNo2()
{
- if (keyboardNo2 == null)
- return 1;
- else
+ try
+ {
+ if (keyboardNo2 != null)
+ {
+ int value = Integer.parseInt(keyboardNo2.toString());
+ keyboardNo2 = null;
+ return value;
+ }
+ } catch (Exception x)
{
- int value = Integer.parseInt(keyboardNo2.toString());
- keyboardNo2 = null;
- return value;
}
+ keyboardNo2 = null;
+ return 1;
}
+ /**
+ * Set status message in alignment panel
+ *
+ * @param sequence
+ * aligned sequence object
+ * @param res
+ * alignment column
+ * @param seq
+ * index of sequence in alignment
+ * @return position of res in sequence
+ */
void setStatusMessage(SequenceI sequence, int res, int seq)
{
- StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: "
- + sequence.getName());
+ // TODO remove duplication of identical gui method
+ StringBuilder text = new StringBuilder(32);
+ String seqno = seq == -1 ? "" : " " + (seq + 1);
+ text.append("Sequence" + seqno + " ID: " + sequence.getName());
- Object obj = null;
- if (av.alignment.isNucleotide())
+ String residue = null;
+ /*
+ * Try to translate the display character to residue name (null for gap).
+ */
+ final String displayChar = String.valueOf(sequence.getCharAt(res));
+ if (av.getAlignment().isNucleotide())
{
- obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
- + "");
- if (obj != null)
+ residue = ResidueProperties.nucleotideName.get(displayChar);
+ if (residue != null)
{
- text.append(" Nucleotide: ");
+ text.append(" Nucleotide: ").append(residue);
}
}
else
{
- obj = ResidueProperties.aa2Triplet.get(sequence.getCharAt(res) + "");
- if (obj != null)
+ residue = "X".equalsIgnoreCase(displayChar) ? "X" : ("*"
+ .equals(displayChar) ? "STOP" : ResidueProperties.aa2Triplet
+ .get(displayChar));
+ if (residue != null)
{
- text.append(" Residue: ");
+ text.append(" Residue: ").append(residue);
}
}
- if (obj != null)
+ int pos = -1;
+ if (residue != null)
{
-
- if (obj != "")
- {
- text.append(obj + " (" + sequence.findPosition(res) + ")");
- }
+ pos = sequence.findPosition(res);
+ text.append(" (").append(Integer.toString(pos)).append(")");
}
ap.alignFrame.statusBar.setText(text.toString());
+ }
+
+ /**
+ * Set the status bar message to highlight the first matched position in
+ * search results.
+ *
+ * @param results
+ * @return true if results were matched, false if not
+ */
+ private boolean setStatusMessage(SearchResults results)
+ {
+ AlignmentI al = this.av.getAlignment();
+ int sequenceIndex = al.findIndex(results);
+ if (sequenceIndex == -1)
+ {
+ return false;
+ }
+ SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence();
+ for (Match m : results.getResults())
+ {
+ SequenceI seq = m.getSequence();
+ if (seq.getDatasetSequence() != null)
+ {
+ seq = seq.getDatasetSequence();
+ }
+ if (seq == ds)
+ {
+ /*
+ * Convert position in sequence (base 1) to sequence character array
+ * index (base 0)
+ */
+ int start = m.getStart() - 1;
+ setStatusMessage(seq, start, sequenceIndex);
+ return true;
+ }
+ }
+ return false;
}
public void mousePressed(MouseEvent evt)
@@ -455,10 +541,11 @@ public class SeqPanel extends Panel implements MouseMotionListener,
public void mouseClicked(MouseEvent evt)
{
- SequenceI sequence = av.alignment.getSequenceAt(findSeq(evt));
+ SequenceI sequence = av.getAlignment().getSequenceAt(findSeq(evt));
if (evt.getClickCount() > 1)
{
- if (av.getSelectionGroup()!=null && av.getSelectionGroup().getSize() == 1
+ if (av.getSelectionGroup() != null
+ && av.getSelectionGroup().getSize() == 1
&& av.getSelectionGroup().getEndRes()
- av.getSelectionGroup().getStartRes() < 2)
{
@@ -477,8 +564,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
if (features != null && features.length > 0)
{
- seqCanvas.getFeatureRenderer().amendFeatures(new SequenceI[]
- { sequence }, features, false, ap);
+ seqCanvas.getFeatureRenderer().amendFeatures(
+ new SequenceI[] { sequence }, features, false, ap);
seqCanvas.highlightSearchResults(null);
}
@@ -510,17 +597,17 @@ public class SeqPanel extends Panel implements MouseMotionListener,
int res = 0;
int x = evt.getX();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
- + seqCanvas.getAnnotationHeight();
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
+ + hgap + seqCanvas.getAnnotationHeight();
int y = evt.getY();
y -= hgap;
@@ -543,7 +630,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
res = (x / av.getCharWidth()) + av.getStartRes();
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
@@ -568,21 +655,21 @@ public class SeqPanel extends Panel implements MouseMotionListener,
int seq = 0;
int y = evt.getY();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
- + seqCanvas.getAnnotationHeight();
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
+ + hgap + seqCanvas.getAnnotationHeight();
y -= hgap;
- seq = Math.min((y % cHeight) / av.getCharHeight(),
- av.alignment.getHeight() - 1);
+ seq = Math.min((y % cHeight) / av.getCharHeight(), av.getAlignment()
+ .getHeight() - 1);
if (seq < 0)
{
seq = -1;
@@ -590,8 +677,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
else
{
- seq = Math.min((y / av.getCharHeight()) + av.getStartSeq(),
- av.alignment.getHeight() - 1);
+ seq = Math.min((y / av.getCharHeight()) + av.getStartSeq(), av
+ .getAlignment().getHeight() - 1);
if (seq < 0)
{
seq = -1;
@@ -632,24 +719,33 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
String tmp = sequence.hashCode() + index + "";
if (lastMessage == null || !lastMessage.equals(tmp))
+ {
ssm.mouseOverSequence(sequence, index, pos, av);
+ }
lastMessage = tmp;
}
public void highlightSequence(SearchResults results)
{
- if (av.followHighlight)
+ if (av.isFollowHighlight())
{
if (ap.scrollToPosition(results, true))
{
ap.alignFrame.repaint();
}
}
+ setStatusMessage(results);
seqCanvas.highlightSearchResults(results);
}
+ @Override
+ public VamsasSource getVamsasSource()
+ {
+ return this.ap == null ? null : this.ap.av;
+ }
+
public void updateColours(SequenceI seq, int index)
{
System.out.println("update the seqPanel colours");
@@ -682,42 +778,43 @@ public class SeqPanel extends Panel implements MouseMotionListener,
int respos = sequence.findPosition(res);
if (ssm != null)
+ {
mouseOverSequence(sequence, res, respos);
+ }
- StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: "
- + sequence.getName());
+ StringBuilder text = new StringBuilder();
+ text.append("Sequence ").append(Integer.toString(seq + 1))
+ .append(" ID: ").append(sequence.getName());
- Object obj = null;
- if (av.alignment.isNucleotide())
+ String obj = null;
+ final String ch = String.valueOf(sequence.getCharAt(res));
+ if (av.getAlignment().isNucleotide())
{
- obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
- + "");
+ obj = ResidueProperties.nucleotideName.get(ch);
if (obj != null)
{
- text.append(" Nucleotide: ");
+ text.append(" Nucleotide: ").append(obj);
}
}
else
{
- obj = ResidueProperties.aa2Triplet.get(sequence.getCharAt(res) + "");
+ obj = "X".equalsIgnoreCase(ch) ? "X" : ResidueProperties.aa2Triplet
+ .get(ch);
if (obj != null)
{
- text.append(" Residue: ");
+ text.append(" Residue: ").append(obj);
}
}
if (obj != null)
{
- if (obj != "")
- {
- text.append(obj + " (" + respos + ")");
- }
+ text.append(" (").append(Integer.toString(respos)).append(")");
}
ap.alignFrame.statusBar.setText(text.toString());
- StringBuffer tooltipText = new StringBuffer();
- SequenceGroup[] groups = av.alignment.findAllGroups(sequence);
+ StringBuilder tooltipText = new StringBuilder();
+ SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence);
if (groups != null)
{
for (int g = 0; g < groups.length; g++)
@@ -727,7 +824,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
if (!groups[g].getName().startsWith("JTreeGroup")
&& !groups[g].getName().startsWith("JGroup"))
{
- tooltipText.append(groups[g].getName() + " ");
+ tooltipText.append(groups[g].getName()).append(" ");
}
if (groups[g].getDescription() != null)
{
@@ -785,19 +882,19 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
for (int i = 0; i < features.length; i++)
{
- if (av.featuresDisplayed == null
- || !av.featuresDisplayed.containsKey(features[i].getType()))
+ if (av.getFeaturesDisplayed() == null
+ || !av.getFeaturesDisplayed().isVisible(
+ features[i].getType()))
{
continue;
}
if (features[i].featureGroup != null
- && seqCanvas.fr.featureGroups != null
- && seqCanvas.fr.featureGroups
- .containsKey(features[i].featureGroup)
- && !((Boolean) seqCanvas.fr.featureGroups
- .get(features[i].featureGroup)).booleanValue())
+ && !seqCanvas.fr.checkGroupVisibility(
+ features[i].featureGroup, false))
+ {
continue;
+ }
if ((features[i].getBegin() <= res)
&& (features[i].getEnd() >= res))
@@ -819,7 +916,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
if (mouseWheelPressed)
{
- int oldWidth = av.charWidth;
+ int oldWidth = av.getCharWidth();
// Which is bigger, left-right or up-down?
if (Math.abs(evt.getY() - lastMousePress.y) > Math.abs(evt.getX()
@@ -827,7 +924,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
int fontSize = av.font.getSize();
- if (evt.getY() < lastMousePress.y && av.charHeight > 1)
+ if (evt.getY() < lastMousePress.y && av.getCharHeight() > 1)
{
fontSize--;
}
@@ -842,29 +939,29 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
av.setFont(new Font(av.font.getName(), av.font.getStyle(), fontSize));
- av.charWidth = oldWidth;
+ av.setCharWidth(oldWidth);
}
else
{
- if (evt.getX() < lastMousePress.x && av.charWidth > 1)
+ if (evt.getX() < lastMousePress.x && av.getCharWidth() > 1)
{
- av.charWidth--;
+ av.setCharWidth(av.getCharWidth() - 1);
}
else if (evt.getX() > lastMousePress.x)
{
- av.charWidth++;
+ av.setCharWidth(av.getCharWidth() + 1);
}
- if (av.charWidth < 1)
+ if (av.getCharWidth() < 1)
{
- av.charWidth = 1;
+ av.setCharWidth(1);
}
}
ap.fontChanged();
FontMetrics fm = getFontMetrics(av.getFont());
- av.validCharWidth = fm.charWidth('M') <= av.charWidth;
+ av.validCharWidth = fm.charWidth('M') <= av.getCharWidth();
lastMousePress = evt.getPoint();
@@ -916,14 +1013,13 @@ public class SeqPanel extends Panel implements MouseMotionListener,
boolean fixedColumns = false;
SequenceGroup sg = av.getSelectionGroup();
- SequenceI seq = av.alignment.getSequenceAt(startseq);
+ SequenceI seq = av.getAlignment().getSequenceAt(startseq);
- if (!groupEditing && av.hasHiddenRows)
+ if (!groupEditing && av.hasHiddenRows())
{
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(seq))
+ if (av.isHiddenRepSequence(seq))
{
- sg = (SequenceGroup) av.hiddenRepSequences.get(seq);
+ sg = av.getRepresentedSequences(seq);
groupEditing = true;
}
}
@@ -931,15 +1027,18 @@ public class SeqPanel extends Panel implements MouseMotionListener,
StringBuffer message = new StringBuffer();
if (groupEditing)
{
- message.append("Edit group:");
+ message.append(MessageManager.getString("action.edit_group")).append(
+ ":");
if (editCommand == null)
{
- editCommand = new EditCommand("Edit Group");
+ editCommand = new EditCommand(
+ MessageManager.getString("action.edit_group"));
}
}
else
{
- message.append("Edit sequence: " + seq.getName());
+ message.append(MessageManager.getString("label.edit_sequence"))
+ .append(" " + seq.getName());
String label = seq.getName();
if (label.length() > 10)
{
@@ -947,7 +1046,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
if (editCommand == null)
{
- editCommand = new EditCommand("Edit " + label);
+ editCommand = new EditCommand(MessageManager.formatMessage(
+ "label.edit_params", new String[] { label }));
}
}
@@ -965,7 +1065,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
// Are we editing within a selection group?
if (groupEditing
- || (sg != null && sg.getSequences(av.hiddenRepSequences)
+ || (sg != null && sg.getSequences(av.getHiddenRepSequences())
.contains(seq)))
{
fixedColumns = true;
@@ -974,14 +1074,13 @@ public class SeqPanel extends Panel implements MouseMotionListener,
// but the sequence represents a group
if (sg == null)
{
- if (av.hiddenRepSequences == null
- || !av.hiddenRepSequences.containsKey(seq))
+ if (!av.isHiddenRepSequence(seq))
{
endEditing();
return;
}
- sg = (SequenceGroup) av.hiddenRepSequences.get(seq);
+ sg = av.getRepresentedSequences(seq);
}
fixedLeft = sg.getStartRes();
@@ -1008,7 +1107,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
fixedColumns = true;
int y1 = av.getColumnSelection().getHiddenBoundaryLeft(startres);
@@ -1038,13 +1137,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
if (groupEditing)
{
- Vector vseqs = sg.getSequences(av.hiddenRepSequences);
- int g, groupSize = vseqs.size();
- SequenceI[] groupSeqs = new SequenceI[groupSize];
- for (g = 0; g < groupSeqs.length; g++)
- {
- groupSeqs[g] = (SequenceI) vseqs.elementAt(g);
- }
+ SequenceI[] groupSeqs = sg.getSequences(av.getHiddenRepSequences())
+ .toArray(new SequenceI[0]);
// drag to right
if (insertGap)
@@ -1052,9 +1146,9 @@ public class SeqPanel extends Panel implements MouseMotionListener,
// If the user has selected the whole sequence, and is dragging to
// the right, we can still extend the alignment and selectionGroup
if (sg.getStartRes() == 0 && sg.getEndRes() == fixedRight
- && sg.getEndRes() == av.alignment.getWidth() - 1)
+ && sg.getEndRes() == av.getAlignment().getWidth() - 1)
{
- sg.setEndRes(av.alignment.getWidth() + startres - lastres);
+ sg.setEndRes(av.getAlignment().getWidth() + startres - lastres);
fixedRight = sg.getEndRes();
}
@@ -1066,12 +1160,12 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
blank = true;
- for (g = 0; g < groupSize; g++)
+ for (SequenceI gs : groupSeqs)
{
for (int j = 0; j < startres - lastres; j++)
{
- if (!jalview.util.Comparison.isGap(groupSeqs[g]
- .getCharAt(fixedRight - j)))
+ if (!jalview.util.Comparison.isGap(gs.getCharAt(fixedRight
+ - j)))
{
blank = false;
break;
@@ -1086,19 +1180,20 @@ public class SeqPanel extends Panel implements MouseMotionListener,
if (!blank)
{
- if (sg.getSize() == av.alignment.getHeight())
+ if (sg.getSize() == av.getAlignment().getHeight())
{
- if ((av.hasHiddenColumns && startres < av.getColumnSelection()
- .getHiddenBoundaryRight(startres)))
+ if ((av.hasHiddenColumns() && startres < av
+ .getColumnSelection().getHiddenBoundaryRight(startres)))
{
endEditing();
return;
}
- int alWidth = av.alignment.getWidth();
- if (av.hasHiddenRows)
+ int alWidth = av.getAlignment().getWidth();
+ if (av.hasHiddenRows())
{
- int hwidth = av.alignment.getHiddenSequences().getWidth();
+ int hwidth = av.getAlignment().getHiddenSequences()
+ .getWidth();
if (hwidth > alWidth)
{
alWidth = hwidth;
@@ -1123,16 +1218,16 @@ public class SeqPanel extends Panel implements MouseMotionListener,
// / Are we able to delete?
// ie are all columns blank?
- for (g = 0; g < groupSize; g++)
+ for (SequenceI gs : groupSeqs)
{
for (int j = startres; j < lastres; j++)
{
- if (groupSeqs[g].getLength() <= j)
+ if (gs.getLength() <= j)
{
continue;
}
- if (!jalview.util.Comparison.isGap(groupSeqs[g].getCharAt(j)))
+ if (!jalview.util.Comparison.isGap(gs.getCharAt(j)))
{
// Not a gap, block edit not valid
endEditing();
@@ -1154,8 +1249,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
else
{
- editCommand.appendEdit(EditCommand.INSERT_GAP, groupSeqs,
- startres, startres - lastres, av.alignment, true);
+ editCommand.appendEdit(Action.INSERT_GAP, groupSeqs, startres,
+ startres - lastres, av.getAlignment(), true);
}
}
else
@@ -1170,8 +1265,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
else
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, groupSeqs,
- startres, lastres - startres, av.alignment, true);
+ editCommand.appendEdit(Action.DELETE_GAP, groupSeqs, startres,
+ lastres - startres, av.getAlignment(), true);
}
}
@@ -1186,14 +1281,14 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
for (int j = lastres; j < startres; j++)
{
- insertChar(j, new SequenceI[]
- { seq }, fixedRight);
+ insertChar(j, new SequenceI[] { seq }, fixedRight);
}
}
else
{
- editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[]
- { seq }, lastres, startres - lastres, av.alignment, true);
+ editCommand.appendEdit(Action.INSERT_GAP,
+ new SequenceI[] { seq }, lastres, startres - lastres,
+ av.getAlignment(), true);
}
}
else
@@ -1208,8 +1303,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
endEditing();
break;
}
- deleteChar(startres, new SequenceI[]
- { seq }, fixedRight);
+ deleteChar(startres, new SequenceI[] { seq }, fixedRight);
}
}
else
@@ -1227,8 +1321,9 @@ public class SeqPanel extends Panel implements MouseMotionListener,
if (max > 0)
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, new SequenceI[]
- { seq }, startres, max, av.alignment, true);
+ editCommand.appendEdit(Action.DELETE_GAP,
+ new SequenceI[] { seq }, startres, max,
+ av.getAlignment(), true);
}
}
}
@@ -1263,10 +1358,10 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
}
- editCommand.appendEdit(EditCommand.DELETE_GAP, seq, blankColumn, 1,
- av.alignment, true);
+ editCommand.appendEdit(Action.DELETE_GAP, seq, blankColumn, 1,
+ av.getAlignment(), true);
- editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.alignment,
+ editCommand.appendEdit(Action.INSERT_GAP, seq, j, 1, av.getAlignment(),
true);
}
@@ -1274,11 +1369,11 @@ public class SeqPanel extends Panel implements MouseMotionListener,
void deleteChar(int j, SequenceI[] seq, int fixedColumn)
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1, av.alignment,
+ editCommand.appendEdit(Action.DELETE_GAP, seq, j, 1, av.getAlignment(),
true);
- editCommand.appendEdit(EditCommand.INSERT_GAP, seq, fixedColumn, 1,
- av.alignment, true);
+ editCommand.appendEdit(Action.INSERT_GAP, seq, fixedColumn, 1,
+ av.getAlignment(), true);
}
// ////////////////////////////////////////
@@ -1302,7 +1397,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
return;
}
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);
if (sequence == null || res > sequence.getLength())
{
@@ -1313,7 +1408,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
if (stretchGroup == null)
{
- stretchGroup = av.alignment.findGroup(sequence);
+ stretchGroup = av.getAlignment().findGroup(sequence);
if (stretchGroup != null && res > stretchGroup.getStartRes()
&& res < stretchGroup.getEndRes())
{
@@ -1331,7 +1426,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
stretchGroup = null;
- SequenceGroup[] allGroups = av.alignment.findAllGroups(sequence);
+ SequenceGroup[] allGroups = av.getAlignment().findAllGroups(sequence);
if (allGroups != null)
{
@@ -1354,7 +1449,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
SequenceFeature[] allFeatures = findFeaturesAtRes(sequence,
sequence.findPosition(res));
- Vector links = null;
+ Vector<String> links = null;
if (allFeatures != null)
{
for (int i = 0; i < allFeatures.length; i++)
@@ -1363,7 +1458,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
if (links == null)
{
- links = new Vector();
+ links = new Vector<String>();
}
for (int j = 0; j < allFeatures[i].links.size(); j++)
{
@@ -1419,28 +1514,17 @@ public class SeqPanel extends Panel implements MouseMotionListener,
return;
}
+ stretchGroup.recalcConservation(); // always do this - annotation has own
+ // state
if (stretchGroup.cs != null)
{
- if (stretchGroup.cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) stretchGroup.cs).resetClustalX(
- stretchGroup.getSequences(av.hiddenRepSequences),
- stretchGroup.getWidth());
- }
-
- if (stretchGroup.cs instanceof Blosum62ColourScheme
- || stretchGroup.cs instanceof PIDColourScheme
- || stretchGroup.cs.conservationApplied()
- || stretchGroup.cs.getThreshold() > 0)
- {
- stretchGroup.recalcConservation();
- }
+ stretchGroup.cs.alignmentChanged(stretchGroup,
+ av.getHiddenRepSequences());
if (stretchGroup.cs.conservationApplied())
{
SliderPanel.setConservationSlider(ap, stretchGroup.cs,
stretchGroup.getName());
- stretchGroup.recalcConservation();
}
else
{
@@ -1473,14 +1557,14 @@ public class SeqPanel extends Panel implements MouseMotionListener,
mouseDragging = true;
- if (y > av.alignment.getHeight())
+ if (y > av.getAlignment().getHeight())
{
- y = av.alignment.getHeight() - 1;
+ y = av.getAlignment().getHeight() - 1;
}
- if (res >= av.alignment.getWidth())
+ if (res >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (stretchGroup.getEndRes() == res)
@@ -1525,7 +1609,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
dragDirection = -1;
}
- while ((y != oldSeq) && (oldSeq > -1) && (y < av.alignment.getHeight()))
+ while ((y != oldSeq) && (oldSeq > -1)
+ && (y < av.getAlignment().getHeight()))
{
// This routine ensures we don't skip any sequences, as the
// selection is quite slow.
@@ -1662,7 +1747,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
if (mouseDragging && evt.getY() >= getSize().height
- && av.alignment.getHeight() > av.getEndSeq())
+ && av.getAlignment().getHeight() > av.getEndSeq())
{
running = ap.scrollUp(false);
}
@@ -1699,22 +1784,32 @@ public class SeqPanel extends Panel implements MouseMotionListener,
// TODO: extend config options to allow user to control if selections may be
// shared between viewports.
if (av != null
- && (av == source || !av.followSelection || (source instanceof AlignViewport && ((AlignViewport) source)
+ && (av == source || !av.followSelection || (source instanceof AlignViewport && ((AlignmentViewport) source)
.getSequenceSetId().equals(av.getSequenceSetId()))))
{
return;
}
+
+ /*
+ * Check for selection in a view of which this one is a dna/protein
+ * complement.
+ */
+ if (selectionFromTranslation(seqsel, colsel, source))
+ {
+ return;
+ }
+
// do we want to thread this ? (contention with seqsel and colsel locks, I
// suspect)
// rules are: colsel is copied if there is a real intersection between
// sequence selection
boolean repaint = false, copycolsel = true;
- if (av.selectionGroup == null || !av.isSelectionGroupChanged())
+ if (av.getSelectionGroup() == null || !av.isSelectionGroupChanged(true))
{
SequenceGroup sgroup = null;
- if (seqsel != null && seqsel.getSize()>0)
+ if (seqsel != null && seqsel.getSize() > 0)
{
- if (av.alignment == null)
+ if (av.getAlignment() == null)
{
System.out
.println("Selection message: alignviewport av SeqSetId="
@@ -1723,8 +1818,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
+ " 's alignment is NULL! returning immediatly.");
return;
}
- sgroup = seqsel.intersect(av.alignment,
- (av.hasHiddenRows) ? av.hiddenRepSequences : null);
+ sgroup = seqsel.intersect(av.getAlignment(),
+ (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
if ((sgroup == null || sgroup.getSize() == 0)
&& (colsel == null || colsel.size() == 0))
{
@@ -1740,35 +1835,39 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
av.setSelectionGroup(null);
}
- repaint = av.isSelectionGroupChanged();
+ repaint = av.isSelectionGroupChanged(true);
}
- if (copycolsel && (av.colSel == null || !av.isColSelChanged()))
+ if (copycolsel
+ && (av.getColumnSelection() == null || !av
+ .isColSelChanged(true)))
{
// the current selection is unset or from a previous message
// so import the new colsel.
if (colsel == null || colsel.size() == 0)
{
- if (av.colSel != null)
+ if (av.getColumnSelection() != null)
{
- av.colSel.clear();
+ av.getColumnSelection().clear();
}
}
else
{
// TODO: shift colSel according to the intersecting sequences
- if (av.colSel == null)
+ if (av.getColumnSelection() == null)
{
- av.colSel = new ColumnSelection(colsel);
+ av.setColumnSelection(new ColumnSelection(colsel));
}
else
{
- av.colSel.setElementsFrom(colsel);
+ av.getColumnSelection().setElementsFrom(colsel);
}
}
- repaint |= av.isColSelChanged();
+ repaint |= av.isColSelChanged(true);
}
- if (copycolsel && av.hasHiddenColumns
- && (av.colSel == null || av.colSel.getHiddenColumns() == null))
+ if (copycolsel
+ && av.hasHiddenColumns()
+ && (av.getColumnSelection() == null || av.getColumnSelection()
+ .getHiddenColumns() == null))
{
System.err.println("Bad things");
}
@@ -1781,35 +1880,84 @@ public class SeqPanel extends Panel implements MouseMotionListener,
/**
* scroll to the given row/column - or nearest visible location
+ *
* @param row
* @param column
*/
public void scrollTo(int row, int column)
{
-
- row = row<0 ? ap.av.startSeq : row;
- column = column<0 ? ap.av.startRes : column;
- ap.scrollTo(row, row, column, true, true);
+
+ row = row < 0 ? ap.av.startSeq : row;
+ column = column < 0 ? ap.av.startRes : column;
+ ap.scrollTo(column, column, row, true, true);
}
+
/**
* scroll to the given row - or nearest visible location
+ *
* @param row
*/
public void scrollToRow(int row)
{
-
- row = row<0 ? ap.av.startSeq : row;
- ap.scrollTo(row, row, ap.av.startRes, true, true);
+
+ row = row < 0 ? ap.av.startSeq : row;
+ ap.scrollTo(ap.av.startRes, ap.av.startRes, row, true, true);
}
+
/**
* scroll to the given column - or nearest visible location
+ *
* @param column
*/
public void scrollToColumn(int column)
{
-
- column = column<0 ? ap.av.startRes : column;
- ap.scrollTo(ap.av.startRes, ap.av.startRes, column, true, true);
+
+ column = column < 0 ? ap.av.startRes : column;
+ ap.scrollTo(column, column, ap.av.startSeq, true, true);
+ }
+
+ /**
+ * If this panel is a cdna/protein translation view of the selection source,
+ * tries to map the source selection to a local one, and returns true. Else
+ * returns false.
+ *
+ * @param seqsel
+ * @param colsel
+ * @param source
+ */
+ protected boolean selectionFromTranslation(SequenceGroup seqsel,
+ ColumnSelection colsel, SelectionSource source)
+ {
+ if (!(source instanceof AlignViewportI))
+ {
+ return false;
+ }
+ final AlignViewportI sourceAv = (AlignViewportI) source;
+ if (sourceAv.getCodingComplement() != av
+ && av.getCodingComplement() != sourceAv)
+ {
+ return false;
+ }
+
+ /*
+ * Map sequence selection
+ */
+ SequenceGroup sg = MappingUtils.mapSequenceGroup(seqsel, sourceAv, av);
+ av.setSelectionGroup(sg);
+ av.isSelectionGroupChanged(true);
+
+ /*
+ * Map column selection
+ */
+ ColumnSelection cs = MappingUtils.mapColumnSelection(colsel, sourceAv,
+ av);
+ av.setColumnSelection(cs);
+ av.isColSelChanged(true);
+
+ ap.scalePanelHolder.repaint();
+ ap.repaint();
+
+ return true;
}
}
diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java
index 857472b..b843526 100644
--- a/src/jalview/appletgui/SequenceRenderer.java
+++ b/src/jalview/appletgui/SequenceRenderer.java
@@ -1,26 +1,34 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
+import jalview.api.FeatureRenderer;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
public class SequenceRenderer implements jalview.api.SequenceRenderer
{
@@ -61,7 +69,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
public Color getResidueBoxColour(SequenceI seq, int i)
{
- allGroups = av.alignment.findAllGroups(seq);
+ allGroups = av.getAlignment().findAllGroups(seq);
if (inCurrentSequenceGroup(i))
{
@@ -72,17 +80,42 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
}
else if (av.getShowBoxes())
{
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
}
return resBoxColour;
}
+ /**
+ * Get the residue colour at the given sequence position - as determined by
+ * the sequence group colour (if any), else the colour scheme, possibly
+ * overridden by a feature colour.
+ *
+ * @param seq
+ * @param position
+ * @param fr
+ * @return
+ */
+ @Override
+ public Color getResidueColour(final SequenceI seq, int position,
+ FeatureRenderer fr)
+ {
+ // TODO replace 8 or so code duplications with calls to this method
+ // (refactored as needed)
+ Color col = getResidueBoxColour(seq, position);
+
+ if (fr != null)
+ {
+ col = fr.findFeatureColour(col, seq, position);
+ }
+ return col;
+ }
+
void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)
{
if (cs != null)
{
- resBoxColour = cs.findColour(seq.getCharAt(i), i);
+ resBoxColour = cs.findColour(seq.getCharAt(i), i, seq);
}
else if (forOverview
&& !jalview.util.Comparison.isGap(seq.getCharAt(i)))
@@ -98,7 +131,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
public Color findSequenceColour(SequenceI seq, int i)
{
- allGroups = av.alignment.findAllGroups(seq);
+ allGroups = av.getAlignment().findAllGroups(seq);
drawBoxes(seq, i, i, 0);
return resBoxColour;
}
@@ -127,7 +160,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
int length = seq.getLength();
int curStart = -1;
- int curWidth = av.charWidth;
+ int curWidth = av.getCharWidth(), avCharWidth = av.getCharWidth(), avCharHeight = av
+ .getCharHeight();
Color tempColour = null;
while (i <= end)
@@ -152,40 +186,41 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
{
if (tempColour != null)
{
- graphics.fillRect(av.charWidth * (curStart - start), y1,
- curWidth, av.charHeight);
+ graphics.fillRect(avCharWidth * (curStart - start), y1, curWidth,
+ avCharHeight);
}
graphics.setColor(resBoxColour);
curStart = i;
- curWidth = av.charWidth;
+ curWidth = avCharWidth;
tempColour = resBoxColour;
}
else
{
- curWidth += av.charWidth;
+ curWidth += avCharWidth;
}
i++;
}
- graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,
- av.charHeight);
+ graphics.fillRect(avCharWidth * (curStart - start), y1, curWidth,
+ avCharHeight);
}
public void drawText(SequenceI seq, int start, int end, int y1)
{
+ int avCharWidth = av.getCharWidth(), avCharHeight = av.getCharHeight();
Font boldFont = null;
boolean bold = false;
- if (av.upperCasebold)
+ if (av.isUpperCasebold())
{
- boldFont = new Font(av.getFont().getName(), Font.BOLD, av.charHeight);
+ boldFont = new Font(av.getFont().getName(), Font.BOLD, avCharHeight);
graphics.setFont(av.getFont());
}
- y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady
+ y1 += avCharHeight - avCharHeight / 5; // height/5 replaces pady
int charOffset = 0;
@@ -196,7 +231,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
}
char s = ' ';
-
+ boolean srep = av.isDisplayReferenceSeq();
for (int i = start; i <= end; i++)
{
graphics.setColor(Color.black);
@@ -221,9 +256,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
}
if (currentSequenceGroup.getShowNonconserved())
{
- // cheat - use this if we have a consensus for each group: s =
- // getDisplayChar(currentSequenceGroup.getConsensus(), i, s, '.');
- s = getDisplayChar(av.consensus, i, s, '.');
+ s = getDisplayChar(srep, i, s, '.');
}
}
else
@@ -245,14 +278,14 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
graphics.setColor(resBoxColour);
}
}
- if (av.getShowunconserved())
+ if (av.getShowUnconserved())
{
- s = getDisplayChar(av.consensus, i, s, '.');
+ s = getDisplayChar(srep, i, s, '.');
}
}
- if (av.upperCasebold)
+ if (av.isUpperCasebold())
{
fm = graphics.getFontMetrics();
if ('A' <= s && s <= 'Z')
@@ -272,19 +305,23 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
}
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
- graphics.drawString(String.valueOf(s), charOffset + av.charWidth
+ charOffset = (avCharWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s), charOffset + avCharWidth
* (i - start), y1);
}
}
- private char getDisplayChar(AlignmentAnnotation consensus, int position,
- char s, char c)
+ private char getDisplayChar(final boolean usesrep, int position, char s,
+ char c)
{
- char conschar = consensus.annotations[position].displayCharacter
- .charAt(0);
- if (conschar != '-' && s == conschar)
+ // TODO - use currentSequenceGroup rather than alignment
+ // currentSequenceGroup.getConsensus()
+ char conschar = (usesrep) ? av.getAlignment().getSeqrep()
+ .getCharAt(position)
+ : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter
+ .charAt(0);
+ if (!jalview.util.Comparison.isGap(conschar) && s == conschar)
{
s = c;
}
@@ -314,11 +351,11 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
public void drawHighlightedText(SequenceI seq, int start, int end,
int x1, int y1)
{
- int pady = av.charHeight / 5;
+ int avCharWidth = av.getCharWidth(), avCharHeight = av.getCharHeight();
+ int pady = avCharHeight / 5;
int charOffset = 0;
graphics.setColor(Color.black);
- graphics.fillRect(x1, y1, av.charWidth * (end - start + 1),
- av.charHeight);
+ graphics.fillRect(x1, y1, avCharWidth * (end - start + 1), avCharHeight);
graphics.setColor(Color.white);
char s = '~';
@@ -332,19 +369,19 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
s = seq.getCharAt(i);
}
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ charOffset = (avCharWidth - fm.charWidth(s)) / 2;
graphics.drawString(String.valueOf(s), charOffset + x1
- + av.charWidth * (i - start), y1 + av.charHeight - pady);
+ + avCharWidth * (i - start), y1 + avCharHeight - pady);
}
}
}
public void drawCursor(SequenceI seq, int res, int x1, int y1)
{
- int pady = av.charHeight / 5;
+ int pady = av.getCharHeight() / 5;
int charOffset = 0;
graphics.setColor(Color.black);
- graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+ graphics.fillRect(x1, y1, av.getCharWidth(), av.getCharHeight());
graphics.setColor(Color.white);
graphics.setColor(Color.white);
@@ -353,9 +390,9 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
if (av.validCharWidth)
{
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
graphics.drawString(String.valueOf(s), charOffset + x1,
- (y1 + av.charHeight) - pady);
+ (y1 + av.getCharHeight()) - pady);
}
}
diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java
index 4e6c2bf..d49cd6c 100644
--- a/src/jalview/appletgui/SliderPanel.java
+++ b/src/jalview/appletgui/SliderPanel.java
@@ -1,29 +1,48 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.datamodel.SequenceGroup;
+import jalview.schemes.ColourSchemeI;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Checkbox;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.Scrollbar;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.Iterator;
public class SliderPanel extends Panel implements ActionListener,
AdjustmentListener, MouseListener
@@ -55,9 +74,11 @@ public class SliderPanel extends Panel implements ActionListener,
sp.cs = cs;
}
- conservationSlider.setTitle("Conservation Colour Increment (" + source
- + ")");
- if (ap.av.alignment.getGroups() != null)
+ conservationSlider
+ .setTitle(MessageManager.formatMessage(
+ "label.conservation_colour_increment",
+ new String[] { source }));
+ if (ap.av.getAlignment().getGroups() != null)
{
sp.setAllGroupsCheckEnabled(true);
}
@@ -110,9 +131,11 @@ public class SliderPanel extends Panel implements ActionListener,
pid = (SliderPanel) PIDSlider.getComponent(0);
pid.cs = cs;
}
- PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");
+ PIDSlider.setTitle(MessageManager
+ .formatMessage("label.percentage_identity_thereshold",
+ new String[] { source }));
- if (ap.av.alignment.getGroups() != null)
+ if (ap.av.getAlignment().getGroups() != null)
{
pid.setAllGroupsCheckEnabled(true);
}
@@ -167,14 +190,16 @@ public class SliderPanel extends Panel implements ActionListener,
applyButton.setVisible(false);
if (forConservation)
{
- label.setText("Modify conservation visibility");
+ label.setText(MessageManager
+ .getString("label.modify_conservation_visibility"));
slider.setMinimum(0);
slider.setMaximum(50 + slider.getVisibleAmount());
slider.setUnitIncrement(1);
}
else
{
- label.setText("Colour residues above % occurence");
+ label.setText(MessageManager
+ .getString("label.colour_residues_above_occurence"));
slider.setMinimum(0);
slider.setMaximum(100 + slider.getVisibleAmount());
slider.setBlockIncrement(1);
@@ -194,37 +219,36 @@ public class SliderPanel extends Panel implements ActionListener,
return;
}
- ColourSchemeI toChange = null;
- Vector allGroups = null;
- int groupIndex = 0;
+ ColourSchemeI toChange = cs;
+ Iterator<SequenceGroup> allGroups = null;
if (allGroupsCheck.getState())
{
- allGroups = ap.av.alignment.getGroups();
- groupIndex = allGroups.size() - 1;
- }
- else
- {
- toChange = cs;
+ allGroups = ap.av.getAlignment().getGroups().listIterator();
}
- while (groupIndex > -1)
+ while (toChange != null)
{
- if (allGroups != null)
- {
- toChange = ((SequenceGroup) allGroups.elementAt(groupIndex)).cs;
- }
-
if (forConservation)
{
toChange.setConservationInc(i);
}
else
{
- toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus());
+ toChange.setThreshold(i, ap.av.isIgnoreGapsConsensus());
+ }
+ if (allGroups != null && allGroups.hasNext())
+ {
+ while ((toChange = allGroups.next().cs) == null
+ && allGroups.hasNext())
+ {
+ ;
+ }
+ }
+ else
+ {
+ toChange = null;
}
-
- groupIndex--;
}
ap.seqPanel.seqCanvas.repaint();
@@ -316,23 +340,26 @@ public class SliderPanel extends Panel implements ActionListener,
slider.setFont(new java.awt.Font("Verdana", 0, 11));
slider.setOrientation(0);
valueField.setFont(new java.awt.Font("Verdana", 0, 11));
- valueField.setText(" ");
+ valueField.setText(" ");
valueField.addActionListener(this);
+ valueField.setColumns(3);
label.setFont(new java.awt.Font("Verdana", 0, 11));
- label.setText("set this label text");
+ label.setText(MessageManager.getString("label.set_this_label_text"));
jPanel1.setLayout(borderLayout1);
jPanel2.setLayout(flowLayout1);
applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
- applyButton.setLabel("Apply");
+ applyButton.setLabel(MessageManager.getString("action.apply"));
applyButton.addActionListener(this);
undoButton.setEnabled(false);
undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
- undoButton.setLabel("Undo");
+ undoButton.setLabel(MessageManager.getString("action.undo"));
undoButton.addActionListener(this);
allGroupsCheck.setEnabled(false);
allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
- allGroupsCheck.setLabel("Apply threshold to all groups");
- allGroupsCheck.setName("Apply to all Groups");
+ allGroupsCheck.setLabel(MessageManager
+ .getString("action.apply_threshold_all_groups"));
+ allGroupsCheck.setName(MessageManager
+ .getString("action.apply_all_groups"));
this.setBackground(Color.white);
this.setForeground(Color.black);
jPanel2.add(label, null);
diff --git a/src/jalview/appletgui/SplitFrame.java b/src/jalview/appletgui/SplitFrame.java
new file mode 100644
index 0000000..8255850
--- /dev/null
+++ b/src/jalview/appletgui/SplitFrame.java
@@ -0,0 +1,240 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.appletgui;
+
+import jalview.analysis.AlignmentUtils;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.ViewStyleI;
+import jalview.bin.JalviewLite;
+import jalview.datamodel.AlignmentI;
+import jalview.structure.StructureSelectionManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.Panel;
+
+public class SplitFrame extends EmbmenuFrame
+{
+ private static final long serialVersionUID = 1L;
+
+ private AlignFrame topFrame;
+
+ private AlignFrame bottomFrame;
+
+ private Panel outermost;
+
+ /**
+ * Constructor
+ */
+ public SplitFrame(AlignFrame af1, AlignFrame af2)
+ {
+ topFrame = af1;
+ bottomFrame = af2;
+ init();
+ }
+
+ /**
+ * Creates a Panel containing two Panels, and adds the first and second
+ * AlignFrame's components to each. At this stage we have not yet committed to
+ * whether the enclosing panel will be added to this frame, for display as a
+ * separate frame, or added to the applet (embedded mode).
+ */
+ public void init()
+ {
+ constructSplit();
+
+ /*
+ * Try to make and add dna/protein sequence mappings
+ */
+ final AlignViewport topViewport = topFrame.viewport;
+ final AlignViewport bottomViewport = bottomFrame.viewport;
+ final AlignmentI topAlignment = topViewport.getAlignment();
+ final AlignmentI bottomAlignment = bottomViewport.getAlignment();
+ AlignmentViewport cdna = topAlignment.isNucleotide() ? topViewport
+ : (bottomAlignment.isNucleotide() ? bottomViewport : null);
+ AlignmentViewport protein = !topAlignment.isNucleotide() ? topViewport
+ : (!bottomAlignment.isNucleotide() ? bottomViewport : null);
+
+ boolean mapped = AlignmentUtils.mapProteinToCdna(
+ protein.getAlignment(), cdna.getAlignment());
+ if (mapped)
+ {
+ final StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(topViewport.applet);
+ ssm.registerMappings(protein.getAlignment().getCodonFrames());
+ topViewport.setCodingComplement(bottomViewport);
+ ssm.addCommandListener(cdna);
+ ssm.addCommandListener(protein);
+ }
+
+ /*
+ * Now mappings exist, can compute cDNA consensus on protein alignment
+ */
+ protein.initComplementConsensus();
+ AlignmentViewPanel ap = topAlignment.isNucleotide() ? bottomFrame.alignPanel
+ : topFrame.alignPanel;
+ protein.updateConsensus(ap);
+
+ adjustLayout();
+ }
+
+ /**
+ *
+ */
+ protected void constructSplit()
+ {
+ setMenuBar(null);
+ outermost = new Panel(new GridLayout(2, 1));
+
+ Panel topPanel = new Panel();
+ Panel bottomPanel = new Panel();
+ outermost.add(topPanel);
+ outermost.add(bottomPanel);
+
+ addAlignFrameComponents(topFrame, topPanel);
+ addAlignFrameComponents(bottomFrame, bottomPanel);
+ }
+
+ /**
+ * Make any adjustments to the layout
+ */
+ protected void adjustLayout()
+ {
+ AlignmentViewport cdna = topFrame.getAlignViewport().getAlignment()
+ .isNucleotide() ? topFrame.viewport : bottomFrame.viewport;
+ AlignmentViewport protein = cdna == topFrame.viewport ? bottomFrame.viewport
+ : topFrame.viewport;
+
+ /*
+ * Ensure sequence ids are the same width for good alignment.
+ */
+ // TODO should do this via av.getViewStyle/setViewStyle
+ // however at present av.viewStyle is not set in IdPanel.fontChanged
+ int w1 = topFrame.alignPanel.idPanel.idCanvas.getWidth();
+ int w2 = bottomFrame.alignPanel.idPanel.idCanvas.getWidth();
+ int w3 = Math.max(w1, w2);
+ if (w1 != w3)
+ {
+ Dimension d = topFrame.alignPanel.idPanel.idCanvas.getSize();
+ topFrame.alignPanel.idPanel.idCanvas.setSize(new Dimension(w3,
+ d.height));
+ }
+ if (w2 != w3)
+ {
+ Dimension d = bottomFrame.alignPanel.idPanel.idCanvas.getSize();
+ bottomFrame.alignPanel.idPanel.idCanvas.setSize(new Dimension(w3,
+ d.height));
+ }
+
+ /*
+ * Scale protein to either 1 or 3 times character width of dna
+ */
+ if (protein != null && cdna != null)
+ {
+ ViewStyleI vs = protein.getViewStyle();
+ int scale = vs.isScaleProteinAsCdna() ? 3 : 1;
+ vs.setCharWidth(scale * cdna.getViewStyle().getCharWidth());
+ protein.setViewStyle(vs);
+ }
+ }
+
+ /**
+ * Add the menu bar, alignment panel and status bar from the AlignFrame to the
+ * panel. The menu bar is a panel 'reconstructed' from the AlignFrame's frame
+ * menu bar. This allows each half of the SplitFrame to have its own menu bar.
+ *
+ * @param af
+ * @param panel
+ */
+ private void addAlignFrameComponents(AlignFrame af, Panel panel)
+ {
+ panel.setLayout(new BorderLayout());
+ Panel menuPanel = af
+ .makeEmbeddedPopupMenu(af.getMenuBar(), true, false);
+ panel.add(menuPanel, BorderLayout.NORTH);
+ panel.add(af.statusBar, BorderLayout.SOUTH);
+ panel.add(af.alignPanel, BorderLayout.CENTER);
+
+ af.setSplitFrame(this);
+ }
+
+ /**
+ * Display the content panel either as a new frame or embedded in the applet.
+ *
+ * @param embedded
+ * @param applet
+ */
+ public void addToDisplay(boolean embedded, JalviewLite applet)
+ {
+ createSplitFrameWindow(embedded, applet);
+ validate();
+ topFrame.alignPanel.adjustAnnotationHeight();
+ topFrame.alignPanel.paintAlignment(true);
+ bottomFrame.alignPanel.adjustAnnotationHeight();
+ bottomFrame.alignPanel.paintAlignment(true);
+ }
+
+ /**
+ * Either show the content panel in this frame as a new frame, or (if
+ * embed=true) add it to the applet container instead.
+ *
+ * @param embed
+ * @param applet
+ */
+ protected void createSplitFrameWindow(boolean embed, JalviewLite applet)
+ {
+ if (embed)
+ {
+ applet.add(outermost);
+ applet.validate();
+ }
+ else
+ {
+ this.add(outermost);
+ int width = Math.max(topFrame.frameWidth, bottomFrame.frameWidth);
+ int height = topFrame.frameHeight + bottomFrame.frameHeight;
+ jalview.bin.JalviewLite
+ .addFrame(this, this.getTitle(), width, height);
+ }
+ }
+
+ /**
+ * Returns the contained AlignFrame complementary to the one given (or null if
+ * no match to top or bottom component).
+ *
+ * @param af
+ * @return
+ */
+ public AlignFrame getComplement(AlignFrame af)
+ {
+ if (topFrame == af)
+ {
+ return bottomFrame;
+ }
+ else if (bottomFrame == af)
+ {
+ return topFrame;
+ }
+ return null;
+ }
+}
diff --git a/src/jalview/appletgui/TitledPanel.java b/src/jalview/appletgui/TitledPanel.java
new file mode 100644
index 0000000..64a8cbc
--- /dev/null
+++ b/src/jalview/appletgui/TitledPanel.java
@@ -0,0 +1,95 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.appletgui;
+
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+public class TitledPanel extends Panel
+{
+
+ private String title;
+
+ private Insets insets = new Insets(10, 10, 10, 10);
+
+ public TitledPanel()
+ {
+ this("");
+ }
+
+ public TitledPanel(String title)
+ {
+ this.setTitle(title);
+ }
+
+ public Insets getInsets()
+ {
+ return insets;
+ }
+
+ public void paint(Graphics g)
+ {
+ super.paint(g);
+ g.setColor(getForeground());
+ g.drawRect(5, 5, getWidth() - 10, getHeight() - 10);
+ int width = g.getFontMetrics().stringWidth(getTitle());
+ g.setColor(getBackground());
+ g.fillRect(10, 0, width, 10);
+ g.setColor(getForeground());
+ g.drawString(getTitle(), 10, 10);
+ }
+
+ public static void main(String[] args)
+ {
+ Frame f = new Frame("TitledPanel Tester");
+
+ TitledPanel p = new TitledPanel("Title of Panel");
+ p.add(new Label("Label 1"));
+ p.add(new Label("Label 2"));
+ p.add(new Label("Label 3"));
+ f.add(p);
+
+ f.addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ });
+ f.setBounds(300, 300, 300, 300);
+ f.setVisible(true);
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+}
diff --git a/src/jalview/appletgui/Tooltip.java b/src/jalview/appletgui/Tooltip.java
index 11020fc..e16c594 100644
--- a/src/jalview/appletgui/Tooltip.java
+++ b/src/jalview/appletgui/Tooltip.java
@@ -1,233 +1,245 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.appletgui;
-
-import java.applet.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-public class Tooltip extends Canvas implements MouseListener,
- MouseMotionListener
-{
- private String[] tip;
-
- private String lastTip = "";
-
- private boolean setPosition = false;
-
- protected Component owner;
-
- private Container mainContainer;
-
- private LayoutManager mainLayout;
-
- private boolean shown;
-
- private final int VERTICAL_OFFSET = 20;
-
- private final int HORIZONTAL_ENLARGE = 10;
-
- int fontHeight = 0;
-
- Image linkImage;
-
- FontMetrics fm;
-
- public Tooltip(String tip, Component owner)
- {
- this.owner = owner;
- owner.addMouseListener(this);
- owner.addMouseMotionListener(this);
- setBackground(new Color(255, 255, 220));
- setTip(tip);
- java.net.URL url = getClass().getResource("/images/link.gif");
- if (url != null)
- {
- linkImage = java.awt.Toolkit.getDefaultToolkit().getImage(url);
- }
- }
-
- public void paint(Graphics g)
- {
- int w = getSize().width;
- int h = getSize().height;
-
- g.drawRect(0, 0, w - 1, h - 1);
- int lindex, x;
- for (int i = 0; i < tip.length; i++)
- {
- x = 3;
- lindex = tip[i].indexOf("%LINK%");
- if (lindex != -1)
- {
- if (lindex > 0)
- {
- g.drawString(tip[i].substring(0, lindex), 3, (i + 1) * fontHeight
- - 3);
- x += fm.stringWidth(tip[i].substring(0, lindex) + 3);
- }
- g.drawImage(linkImage, x, i * fontHeight + 1, this);
- if (lindex + 6 < tip[i].length())
- {
- g.drawString(tip[i].substring(lindex + 6),
- x + linkImage.getWidth(this), (i + 1) * fontHeight - 3);
- }
- }
- else
- {
- g.drawString(tip[i], 3, (i + 1) * fontHeight - 3);
- }
- }
- }
-
- synchronized void setTip(String tip)
- {
- if (tip == null)
- {
- setTip("");
- return;
- }
-
- if (lastTip.equals(tip))
- {
- return;
- }
-
- lastTip = tip;
- setPosition = true;
-
- fm = getFontMetrics(owner.getFont());
- fontHeight = fm.getHeight();
-
- int longestLine = 0;
- StringTokenizer st = new StringTokenizer(tip, "\n");
- this.tip = new String[st.countTokens()];
- int index = 0;
- while (st.hasMoreElements())
- {
- this.tip[index] = st.nextToken();
- if (fm.stringWidth(this.tip[index]) > longestLine)
- {
- longestLine = fm.stringWidth(this.tip[index]);
- }
- index++;
- }
-
- setSize(longestLine + HORIZONTAL_ENLARGE, fontHeight * this.tip.length);
-
- repaint();
-
- }
-
- void setTipLocation(MouseEvent evt)
- {
- if (mainContainer == null || owner == null)
- {
- return;
- }
- setLocation(
- (owner.getLocationOnScreen().x - mainContainer.getLocationOnScreen().x)
- + evt.getX(),
- (owner.getLocationOnScreen().y
- - mainContainer.getLocationOnScreen().y + VERTICAL_OFFSET)
- + evt.getY());
-
- // correction, whole tool tip must be visible
- if (mainContainer.getSize().width < (getLocation().x + getSize().width))
- {
- setLocation(mainContainer.getSize().width - getSize().width,
- getLocation().y);
- }
- }
-
- private void removeToolTip()
- {
- if (shown)
- {
- mainContainer.remove(0);
- mainContainer.setLayout(mainLayout);
- mainContainer.validate();
- }
- shown = false;
- }
-
- private void findMainContainer()
- {
- Container parent = owner.getParent();
- while (true)
- {
- if ((parent instanceof Applet) || (parent instanceof Frame))
- {
- mainContainer = parent;
- break;
- }
- else
- {
- parent = parent.getParent();
- }
- }
- mainLayout = mainContainer.getLayout();
- }
-
- public void mouseEntered(MouseEvent me)
- {
- setTipLocation(me);
- }
-
- public void mouseExited(MouseEvent me)
- {
- removeToolTip();
- }
-
- public void mousePressed(MouseEvent me)
- {
- removeToolTip();
- }
-
- public void mouseReleased(MouseEvent me)
- {
- }
-
- public void mouseClicked(MouseEvent me)
- {
- }
-
- public void mouseMoved(MouseEvent me)
- {
- if (!shown)
- {
- findMainContainer();
- mainContainer.setLayout(null);
- mainContainer.add(this, 0);
- mainContainer.validate();
- shown = true;
- setTipLocation(me);
- }
- else if (setPosition)
- {
- setTipLocation(me);
- setPosition = false;
- }
- }
-
- public void mouseDragged(MouseEvent me)
- {
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.appletgui;
+
+import java.applet.Applet;
+import java.awt.Canvas;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.LayoutManager;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.util.StringTokenizer;
+
+public class Tooltip extends Canvas implements MouseListener,
+ MouseMotionListener
+{
+ private String[] tip;
+
+ private String lastTip = "";
+
+ private boolean setPosition = false;
+
+ protected Component owner;
+
+ private Container mainContainer;
+
+ private LayoutManager mainLayout;
+
+ private boolean shown;
+
+ private final int VERTICAL_OFFSET = 20;
+
+ private final int HORIZONTAL_ENLARGE = 10;
+
+ int fontHeight = 0;
+
+ Image linkImage;
+
+ FontMetrics fm;
+
+ public Tooltip(String tip, Component owner)
+ {
+ this.owner = owner;
+ owner.addMouseListener(this);
+ owner.addMouseMotionListener(this);
+ setBackground(new Color(255, 255, 220));
+ setTip(tip);
+ java.net.URL url = getClass().getResource("/images/link.gif");
+ if (url != null)
+ {
+ linkImage = java.awt.Toolkit.getDefaultToolkit().getImage(url);
+ }
+ }
+
+ public void paint(Graphics g)
+ {
+ int w = getSize().width;
+ int h = getSize().height;
+
+ g.drawRect(0, 0, w - 1, h - 1);
+ int lindex, x;
+ for (int i = 0; i < tip.length; i++)
+ {
+ x = 3;
+ lindex = tip[i].indexOf("%LINK%");
+ if (lindex != -1)
+ {
+ if (lindex > 0)
+ {
+ g.drawString(tip[i].substring(0, lindex), 3, (i + 1) * fontHeight
+ - 3);
+ x += fm.stringWidth(tip[i].substring(0, lindex) + 3);
+ }
+ g.drawImage(linkImage, x, i * fontHeight + 1, this);
+ if (lindex + 6 < tip[i].length())
+ {
+ g.drawString(tip[i].substring(lindex + 6),
+ x + linkImage.getWidth(this), (i + 1) * fontHeight - 3);
+ }
+ }
+ else
+ {
+ g.drawString(tip[i], 3, (i + 1) * fontHeight - 3);
+ }
+ }
+ }
+
+ synchronized void setTip(String tip)
+ {
+ if (tip == null)
+ {
+ setTip("");
+ return;
+ }
+
+ if (lastTip.equals(tip))
+ {
+ return;
+ }
+
+ lastTip = tip;
+ setPosition = true;
+
+ fm = getFontMetrics(owner.getFont());
+ fontHeight = fm.getHeight();
+
+ int longestLine = 0;
+ StringTokenizer st = new StringTokenizer(tip, "\n");
+ this.tip = new String[st.countTokens()];
+ int index = 0;
+ while (st.hasMoreElements())
+ {
+ this.tip[index] = st.nextToken();
+ if (fm.stringWidth(this.tip[index]) > longestLine)
+ {
+ longestLine = fm.stringWidth(this.tip[index]);
+ }
+ index++;
+ }
+
+ setSize(longestLine + HORIZONTAL_ENLARGE, fontHeight * this.tip.length);
+
+ repaint();
+
+ }
+
+ void setTipLocation(MouseEvent evt)
+ {
+ if (mainContainer == null || owner == null)
+ {
+ return;
+ }
+ setLocation(
+ (owner.getLocationOnScreen().x - mainContainer.getLocationOnScreen().x)
+ + evt.getX(),
+ (owner.getLocationOnScreen().y
+ - mainContainer.getLocationOnScreen().y + VERTICAL_OFFSET)
+ + evt.getY());
+
+ // correction, whole tool tip must be visible
+ if (mainContainer.getSize().width < (getLocation().x + getSize().width))
+ {
+ setLocation(mainContainer.getSize().width - getSize().width,
+ getLocation().y);
+ }
+ }
+
+ private void removeToolTip()
+ {
+ if (shown)
+ {
+ mainContainer.remove(0);
+ mainContainer.setLayout(mainLayout);
+ mainContainer.validate();
+ }
+ shown = false;
+ }
+
+ private void findMainContainer()
+ {
+ Container parent = owner.getParent();
+ while (true)
+ {
+ if ((parent instanceof Applet) || (parent instanceof Frame))
+ {
+ mainContainer = parent;
+ break;
+ }
+ else
+ {
+ parent = parent.getParent();
+ }
+ }
+ mainLayout = mainContainer.getLayout();
+ }
+
+ public void mouseEntered(MouseEvent me)
+ {
+ setTipLocation(me);
+ }
+
+ public void mouseExited(MouseEvent me)
+ {
+ removeToolTip();
+ }
+
+ public void mousePressed(MouseEvent me)
+ {
+ removeToolTip();
+ }
+
+ public void mouseReleased(MouseEvent me)
+ {
+ }
+
+ public void mouseClicked(MouseEvent me)
+ {
+ }
+
+ public void mouseMoved(MouseEvent me)
+ {
+ if (!shown)
+ {
+ findMainContainer();
+ mainContainer.setLayout(null);
+ mainContainer.add(this, 0);
+ mainContainer.validate();
+ shown = true;
+ setTipLocation(me);
+ }
+ else if (setPosition)
+ {
+ setTipLocation(me);
+ setPosition = false;
+ }
+ }
+
+ public void mouseDragged(MouseEvent me)
+ {
+ }
+}
diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java
index 5d5b7ba..8d0cc42 100644
--- a/src/jalview/appletgui/TreeCanvas.java
+++ b/src/jalview/appletgui/TreeCanvas.java
@@ -1,31 +1,55 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import jalview.util.*;
+import jalview.analysis.Conservation;
+import jalview.analysis.NJTree;
+import jalview.api.AlignViewportI;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequenceNode;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+import jalview.util.Format;
+import jalview.util.MappingUtils;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Panel;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.ScrollPane;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
public class TreeCanvas extends Panel implements MouseListener,
MouseMotionListener
@@ -64,7 +88,8 @@ public class TreeCanvas extends Panel implements MouseListener,
SequenceNode highlightNode;
- AlignmentPanel ap;
+ AlignmentPanel ap;
+
public TreeCanvas(AlignmentPanel ap, ScrollPane scroller)
{
this.ap = ap;
@@ -87,7 +112,7 @@ public class TreeCanvas extends Panel implements MouseListener,
av.setSelectionGroup(selected);
}
- selected.setEndRes(av.alignment.getWidth() - 1);
+ selected.setEndRes(av.getAlignment().getWidth() - 1);
selected.addOrRemove(sequence, true);
}
@@ -143,7 +168,7 @@ public class TreeCanvas extends Panel implements MouseListener,
if (node.element() instanceof SequenceI)
{
- SequenceI seq = (SequenceI) ((SequenceNode) node).element();
+ SequenceI seq = (SequenceI) node.element();
if (av.getSequenceColour(seq) == Color.white)
{
@@ -194,13 +219,12 @@ public class TreeCanvas extends Panel implements MouseListener,
Rectangle rect = new Rectangle(xend + 10, ypos - charHeight,
charWidth, charHeight);
- nameHash.put((SequenceI) node.element(), rect);
+ nameHash.put(node.element(), rect);
// Colour selected leaves differently
SequenceGroup selected = av.getSelectionGroup();
if (selected != null
- && selected.getSequences(null).contains(
- (SequenceI) node.element()))
+ && selected.getSequences(null).contains(node.element()))
{
g.setColor(Color.gray);
@@ -224,7 +248,7 @@ public class TreeCanvas extends Panel implements MouseListener,
int xend = (int) (height * scale) + offx;
int ypos = (int) (node.ycount * chunk) + offy;
- g.setColor(((SequenceNode) node).color.darker());
+ g.setColor(node.color.darker());
// Draw horizontal line
g.drawLine(xstart, ypos, xend, ypos);
@@ -390,11 +414,13 @@ public class TreeCanvas extends Panel implements MouseListener,
}
}
+ @Override
public void update(Graphics g)
{
paint(g);
}
+ @Override
public void paint(Graphics g)
{
if (tree == null)
@@ -440,8 +466,7 @@ public class TreeCanvas extends Panel implements MouseListener,
// for
// scrollbar
- float wscale = (float) (width - labelLength - offx * 2)
- / tree.getMaxHeight();
+ float wscale = (width - labelLength - offx * 2) / tree.getMaxHeight();
SequenceNode top = tree.getTopNode();
@@ -465,26 +490,29 @@ public class TreeCanvas extends Panel implements MouseListener,
g.setColor(Color.gray);
}
- int x = (int) (threshold
- * (float) (getSize().width - labelLength - 2 * offx) + offx);
+ int x = (int) (threshold * (getSize().width - labelLength - 2 * offx) + offx);
g.drawLine(x, 0, x, getSize().height);
}
}
+ @Override
public void mouseReleased(MouseEvent e)
{
}
+ @Override
public void mouseEntered(MouseEvent e)
{
}
+ @Override
public void mouseExited(MouseEvent e)
{
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
if (highlightNode != null)
@@ -514,10 +542,12 @@ public class TreeCanvas extends Panel implements MouseListener,
}
}
+ @Override
public void mouseDragged(MouseEvent ect)
{
}
+ @Override
public void mouseMoved(MouseEvent evt)
{
av.setCurrentTree(tree);
@@ -539,6 +569,7 @@ public class TreeCanvas extends Panel implements MouseListener,
}
}
+ @Override
public void mousePressed(MouseEvent e)
{
av.setCurrentTree(tree);
@@ -570,8 +601,15 @@ public class TreeCanvas extends Panel implements MouseListener,
setColor(tree.getTopNode(), Color.black);
av.setSelectionGroup(null);
- av.alignment.deleteAllGroups();
- av.sequenceColours = null;
+ av.getAlignment().deleteAllGroups();
+ av.clearSequenceColours();
+ final AlignViewportI codingComplement = av.getCodingComplement();
+ if (codingComplement != null)
+ {
+ codingComplement.setSelectionGroup(null);
+ codingComplement.getAlignment().deleteAllGroups();
+ codingComplement.clearSequenceColours();
+ }
colourGroups();
@@ -608,6 +646,9 @@ public class TreeCanvas extends Panel implements MouseListener,
ColourSchemeI cs = null;
+ SequenceGroup sg = new SequenceGroup(sequences, "", cs, true, true,
+ false, 0, av.getAlignment().getWidth() - 1);
+
if (av.getGlobalColourScheme() != null)
{
if (av.getGlobalColourScheme() instanceof UserColourScheme)
@@ -619,20 +660,20 @@ public class TreeCanvas extends Panel implements MouseListener,
}
else
{
- cs = ColourSchemeProperty.getColour(sequences, av.alignment
- .getWidth(), ColourSchemeProperty.getColourName(av
- .getGlobalColourScheme()));
+ cs = ColourSchemeProperty.getColour(sg, ColourSchemeProperty
+ .getColourName(av.getGlobalColourScheme()));
}
// cs is null if shading is an annotationColourGradient
- if (cs!=null)
+ if (cs != null)
{
cs.setThreshold(av.getGlobalColourScheme().getThreshold(),
- av.getIgnoreGapsConsensus());
+ av.isIgnoreGapsConsensus());
}
}
-
- SequenceGroup sg = new SequenceGroup(sequences, "", cs, true, true,
- false, 0, av.alignment.getWidth() - 1);
+ // TODO: cs used to be initialized with a sequence collection and
+ // recalcConservation called automatically
+ // instead we set it manually - recalc called after updateAnnotation
+ sg.cs = cs;
sg.setName("JTreeGroup:" + sg.hashCode());
sg.setIdColour(col);
@@ -644,18 +685,40 @@ public class TreeCanvas extends Panel implements MouseListener,
sg.getStartRes(), sg.getEndRes());
c.calculate();
- c.verdict(false, av.ConsPercGaps);
+ c.verdict(false, av.getConsPercGaps());
cs.setConservation(c);
sg.cs = cs;
}
- av.alignment.addGroup(sg);
+ av.getAlignment().addGroup(sg);
+
+ // TODO this is duplicated with gui TreeCanvas - refactor
+ av.getAlignment().addGroup(sg);
+ final AlignViewportI codingComplement = av.getCodingComplement();
+ if (codingComplement != null)
+ {
+ SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, av,
+ codingComplement);
+ if (mappedGroup.getSequences().size() > 0)
+ {
+ codingComplement.getAlignment().addGroup(mappedGroup);
+ for (SequenceI seq : mappedGroup.getSequences())
+ {
+ // TODO why does gui require col.brighter() here??
+ codingComplement.setSequenceColour(seq, col);
+ }
+ }
+ }
}
ap.updateAnnotation();
-
+ if (av.getCodingComplement() != null)
+ {
+ ((AlignmentViewport) av.getCodingComplement()).firePropertyChange(
+ "alignment", null, ap.av.getAlignment().getSequences());
+ }
}
public void setShowDistances(boolean state)
diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java
index 0351d14..64716b0 100644
--- a/src/jalview/appletgui/TreePanel.java
+++ b/src/jalview/appletgui/TreePanel.java
@@ -1,29 +1,47 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
-import java.util.Hashtable;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.io.*;
+import jalview.analysis.NJTree;
+import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.ViewBasedAnalysisI;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
+import jalview.io.NewickFile;
+import jalview.schemes.ResidueProperties;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.CheckboxMenuItem;
+import java.awt.Color;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.ScrollPane;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
public class TreePanel extends EmbmenuFrame implements ActionListener,
ItemListener
@@ -41,6 +59,7 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
TreeCanvas treeCanvas;
NJTree tree;
+
AlignmentPanel ap;
AlignViewport av;
@@ -49,10 +68,11 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
{
return tree;
}
-
- public void finalize() throws Throwable {
- ap=null;
- av=null;
+
+ public void finalize() throws Throwable
+ {
+ ap = null;
+ av = null;
super.finalize();
}
@@ -186,11 +206,11 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
{
if (odata == null)
{
- tree = new NJTree(av.alignment.getSequencesArray(), newtree);
+ tree = new NJTree(av.getAlignment().getSequencesArray(), newtree);
}
else
{
- tree = new NJTree(av.alignment.getSequencesArray(), odata,
+ tree = new NJTree(av.getAlignment().getSequencesArray(), odata,
newtree);
}
@@ -199,22 +219,43 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
{
int start, end;
SequenceI[] seqs;
- AlignmentView seqStrings = av.getAlignmentView(av
- .getSelectionGroup() != null);
- if (av.getSelectionGroup() == null)
+ boolean selview = av.getSelectionGroup() != null
+ && av.getSelectionGroup().getSize() > 1;
+ AlignmentView seqStrings = av.getAlignmentView(selview);
+ if (!selview)
{
start = 0;
- end = av.alignment.getWidth();
- seqs = av.alignment.getSequencesArray();
+ end = av.getAlignment().getWidth();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
start = av.getSelectionGroup().getStartRes();
end = av.getSelectionGroup().getEndRes() + 1;
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(
+ av.getAlignment());
+ }
+ ScoreModelI sm = ResidueProperties.getScoreModel(pwtype);
+ if (sm instanceof ViewBasedAnalysisI)
+ {
+ try
+ {
+ sm = sm.getClass().newInstance();
+ ((ViewBasedAnalysisI) sm)
+ .configureFromAlignmentView(treeCanvas.ap);
+ } catch (Exception q)
+ {
+ System.err.println("Couldn't create a scoremodel instance for "
+ + sm.getName());
+ q.printStackTrace();
+ }
+ tree = new NJTree(seqs, seqStrings, type, pwtype, sm, start, end);
+ }
+ else
+ {
+ tree = new NJTree(seqs, seqStrings, type, pwtype, null, start,
+ end);
}
-
- tree = new NJTree(seqs, seqStrings, type, pwtype, start, end);
}
tree.reCount(tree.getTopNode());
@@ -348,22 +389,24 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
setLayout(borderLayout1);
this.setBackground(Color.white);
this.setFont(new java.awt.Font("Verdana", 0, 12));
- jMenu2.setLabel("View");
- fontSize.setLabel("Font...");
+ jMenu2.setLabel(MessageManager.getString("action.view"));
+ fontSize.setLabel(MessageManager.getString("action.font"));
fontSize.addActionListener(this);
- bootstrapMenu.setLabel("Show Bootstrap Values");
+ bootstrapMenu.setLabel(MessageManager
+ .getString("label.show_bootstrap_values"));
bootstrapMenu.addItemListener(this);
- distanceMenu.setLabel("Show Distances");
+ distanceMenu.setLabel(MessageManager.getString("label.show_distances"));
distanceMenu.addItemListener(this);
- placeholdersMenu.setLabel("Mark Unassociated Leaves");
+ placeholdersMenu.setLabel(MessageManager
+ .getString("label.mark_unassociated_leaves"));
placeholdersMenu.addItemListener(this);
fitToWindow.setState(true);
- fitToWindow.setLabel("Fit To Window");
+ fitToWindow.setLabel(MessageManager.getString("label.fit_to_window"));
fitToWindow.addItemListener(this);
- fileMenu.setLabel("File");
- newickOutput.setLabel("Newick Format");
+ fileMenu.setLabel(MessageManager.getString("action.file"));
+ newickOutput.setLabel(MessageManager.getString("label.newick_format"));
newickOutput.addActionListener(this);
- inputData.setLabel("Input Data...");
+ inputData.setLabel(MessageManager.getString("label.input_data"));
add(scrollPane, BorderLayout.CENTER);
jMenuBar1.add(fileMenu);
diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java
index 7220321..de3569a 100644
--- a/src/jalview/appletgui/UserDefinedColours.java
+++ b/src/jalview/appletgui/UserDefinedColours.java
@@ -1,32 +1,56 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.datamodel.SequenceGroup;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.GraduatedColor;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+import jalview.util.MessageManager;
+
+import java.awt.Button;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dialog;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.Scrollbar;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.MouseEvent;
+import java.util.Vector;
public class UserDefinedColours extends Panel implements ActionListener,
- AdjustmentListener
+ AdjustmentListener, FocusListener
{
AlignmentPanel ap;
@@ -165,7 +189,8 @@ public class UserDefinedColours extends Panel implements ActionListener,
setTargetColour(colour);
okcancelPanel.setBounds(new Rectangle(0, 113, 400, 35));
- frame.setTitle("User Defined Colours - " + label);
+ frame.setTitle(MessageManager.getString("label.user_defined_colours")
+ + " - " + label);
frame.setSize(420, 200);
}
@@ -184,7 +209,9 @@ public class UserDefinedColours extends Panel implements ActionListener,
// // not 1.1 compatible!
// dialog = new Dialog(((JVDialog)alignframe), title, true);
// } else {
- throw new Error("Unsupported owner for User Colour scheme dialog.");
+ throw new Error(
+ MessageManager
+ .getString("label.error_unsupported_owwner_user_colour_scheme"));
}
dialog.add(this);
@@ -203,27 +230,28 @@ public class UserDefinedColours extends Panel implements ActionListener,
public void actionPerformed(ActionEvent evt)
{
- if (evt.getSource() == okButton)
+ final Object source = evt.getSource();
+ if (source == okButton)
{
okButton_actionPerformed();
}
- else if (evt.getSource() == applyButton)
+ else if (source == applyButton)
{
applyButton_actionPerformed();
}
- else if (evt.getSource() == cancelButton)
+ else if (source == cancelButton)
{
cancelButton_actionPerformed();
}
- else if (evt.getSource() == rText)
+ else if (source == rText)
{
rText_actionPerformed();
}
- else if (evt.getSource() == gText)
+ else if (source == gText)
{
gText_actionPerformed();
}
- else if (evt.getSource() == bText)
+ else if (source == bText)
{
bText_actionPerformed();
}
@@ -256,7 +284,8 @@ public class UserDefinedColours extends Panel implements ActionListener,
}
frame = new Frame();
frame.add(this);
- jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420,
+ jalview.bin.JalviewLite.addFrame(frame,
+ MessageManager.getString("label.user_defined_colours"), 420,
345);
if (seqGroup != null)
@@ -379,7 +408,7 @@ public class UserDefinedColours extends Panel implements ActionListener,
{
try
{
- col = oldColourScheme.findColour(aa.charAt(0), -1);
+ col = oldColourScheme.findColour(aa.charAt(0), -1, null);
} catch (Exception ex)
{
}
@@ -404,7 +433,9 @@ public class UserDefinedColours extends Panel implements ActionListener,
{
applyButton_actionPerformed();
if (dialog != null)
+ {
dialog.setVisible(false);
+ }
frame.setVisible(false);
}
@@ -466,7 +497,7 @@ public class UserDefinedColours extends Panel implements ActionListener,
UserColourScheme ucs = new UserColourScheme(newColours);
if (ap != null)
{
- ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus());
+ ucs.setThreshold(0, ap.av.isIgnoreGapsConsensus());
}
if (ap != null)
@@ -534,7 +565,9 @@ public class UserDefinedColours extends Panel implements ActionListener,
}
}
if (dialog != null)
+ {
dialog.setVisible(false);
+ }
frame.setVisible(false);
return;
@@ -612,13 +645,13 @@ public class UserDefinedColours extends Panel implements ActionListener,
gridLayout.setColumns(6);
gridLayout.setRows(4);
okButton.setFont(new java.awt.Font("Verdana", 0, 11));
- okButton.setLabel("OK");
+ okButton.setLabel(MessageManager.getString("action.ok"));
okButton.addActionListener(this);
applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
- applyButton.setLabel("Apply");
+ applyButton.setLabel(MessageManager.getString("action.apply"));
applyButton.addActionListener(this);
cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));
- cancelButton.setLabel("Cancel");
+ cancelButton.setLabel(MessageManager.getString("action.cancel"));
cancelButton.addActionListener(this);
this.setBackground(new Color(212, 208, 223));
okcancelPanel.setBounds(new Rectangle(0, 265, 400, 35));
@@ -637,6 +670,7 @@ public class UserDefinedColours extends Panel implements ActionListener,
rText.setText("0 ");
rText.setBounds(new Rectangle(156, 27, 53, 19));
rText.addActionListener(this);
+ rText.addFocusListener(this);
label4.setAlignment(Label.RIGHT);
label4.setText("G");
label4.setBounds(new Rectangle(15, 56, 20, 15));
@@ -651,6 +685,7 @@ public class UserDefinedColours extends Panel implements ActionListener,
gText.setText("0 ");
gText.setBounds(new Rectangle(156, 52, 53, 20));
gText.addActionListener(this);
+ gText.addFocusListener(this);
label5.setAlignment(Label.RIGHT);
label5.setText("B");
label5.setBounds(new Rectangle(14, 82, 20, 15));
@@ -665,12 +700,16 @@ public class UserDefinedColours extends Panel implements ActionListener,
bText.setText("0 ");
bText.setBounds(new Rectangle(157, 78, 52, 20));
bText.addActionListener(this);
+ bText.addFocusListener(this);
target.setBackground(Color.black);
target.setBounds(new Rectangle(229, 26, 134, 79));
this.add(okcancelPanel, null);
okcancelPanel.add(okButton, null);
okcancelPanel.add(applyButton, null);
okcancelPanel.add(cancelButton, null);
+ this.add(rText);
+ this.add(gText);
+ this.add(bText);
this.add(buttonPanel, null);
this.add(target, null);
this.add(gScroller);
@@ -679,9 +718,40 @@ public class UserDefinedColours extends Panel implements ActionListener,
this.add(label5);
this.add(label4);
this.add(label1);
- this.add(gText);
- this.add(rText);
- this.add(bText);
+ }
+
+ @Override
+ public void focusGained(FocusEvent e)
+ {
+ // noop
+ }
+
+ /**
+ * This method applies any change to an RGB value if the user tabs out of the
+ * field instead of pressing Enter
+ */
+ @Override
+ public void focusLost(FocusEvent e)
+ {
+ Component c = e.getComponent();
+ if (c == rText)
+ {
+ rText_actionPerformed();
+ }
+ else
+ {
+ if (c == gText)
+ {
+ gText_actionPerformed();
+ }
+ else
+ {
+ if (c == bText)
+ {
+ bText_actionPerformed();
+ }
+ }
+ }
}
}
diff --git a/src/jalview/bin/BuildDetails.java b/src/jalview/bin/BuildDetails.java
new file mode 100644
index 0000000..f26afba
--- /dev/null
+++ b/src/jalview/bin/BuildDetails.java
@@ -0,0 +1,75 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.bin;
+
+import jalview.api.BuildDetailsI;
+
+public class BuildDetails implements BuildDetailsI
+{
+ private static String buildDate;
+
+ private static String version;
+
+ private static String installation;
+
+ public BuildDetails()
+ {
+
+ }
+
+ public BuildDetails(String version, String buildDate, String installation)
+ {
+ BuildDetails.version = version;
+ BuildDetails.buildDate = buildDate;
+ BuildDetails.installation = installation;
+ }
+
+ public String getBuildDate()
+ {
+ return buildDate;
+ }
+
+ public static void setBuilddate(String buildDate)
+ {
+ BuildDetails.buildDate = buildDate;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public static void setVersion(String version)
+ {
+ BuildDetails.version = version;
+ }
+
+ public String getInstallation()
+ {
+ return installation;
+ }
+
+ public static void setInstallation(String installation)
+ {
+ BuildDetails.installation = installation;
+ }
+
+}
diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java
index ba1d0a8..21d5205 100644
--- a/src/jalview/bin/Cache.java
+++ b/src/jalview/bin/Cache.java
@@ -1,30 +1,47 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.bin;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.datamodel.DasSourceRegistry;
+
import java.awt.Color;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.TreeSet;
-import org.apache.log4j.*;
-import org.biojava.dasobert.dasregistry.Das1Source;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
/**
* Stores and retrieves Jalview Application Properties Lists and fields within
@@ -58,6 +75,10 @@ import org.biojava.dasobert.dasregistry.Das1Source;
* <li>SHOW_QUALITY show alignment quality annotation</li>
* <li>SHOW_ANNOTATIONS show alignment annotation rows</li>
* <li>SHOW_CONSERVATION show alignment conservation annotation</li>
+ * <li>SORT_ANNOTATIONS currently either SEQUENCE_AND_LABEL or
+ * LABEL_AND_SEQUENCE</li>
+ * <li>SHOW_AUTOCALC_ABOVE true to show autocalculated annotations above
+ * sequence annotations</li>
* <li>CENTRE_COLUMN_LABELS centre the labels at each column in a displayed
* annotation row</li>
* <li>DEFAULT_COLOUR default colour scheme to apply for a new alignment</li>
@@ -124,26 +145,51 @@ import org.biojava.dasobert.dasregistry.Das1Source;
* histogram.</li>
* <li>SHOW_CONSENSUS_LOGO (false) Show consensus annotation row's sequence
* logo.</li>
+ * <li>NORMALISE_CONSENSUS_LOGO (false) Show consensus annotation row's sequence
+ * logo normalised to row height rather than histogram height.</li>
* <li>FOLLOW_SELECTIONS (true) Controls whether a new alignment view should
* respond to selections made in other alignments containing the same sequences.
* </li>
+ * <li>JWS2HOSTURLS comma-separated list of URLs to try for JABAWS services</li>
* <li>SHOW_WSDISCOVERY_ERRORS (true) Controls if the web service URL discovery
* warning dialog box is displayed.</li>
- * <li>ANNOTATIONCOLOUR_MIN (orange) Shade used for minimum value of annotation when shading by annotation</li>
- * <li>ANNOTATIONCOLOUR_MAX (red) Shade used for maximum value of annotation when shading by annotation</li>
- * <li>www.jalview.org (http://www.jalview.org) a property enabling all HTTP requests to be redirected to a mirror of http://www.jalview.org</li>
- *
- * <li></li>
+ * <li>ANNOTATIONCOLOUR_MIN (orange) Shade used for minimum value of annotation
+ * when shading by annotation</li>
+ * <li>ANNOTATIONCOLOUR_MAX (red) Shade used for maximum value of annotation
+ * when shading by annotation</li>
+ * <li>www.jalview.org (http://www.jalview.org) a property enabling all HTTP
+ * requests to be redirected to a mirror of http://www.jalview.org</li>
+ * <li>FIGURE_AUTOIDWIDTH (false) Expand the left hand column of an exported
+ * alignment figure to accommodate even the longest sequence ID or annotation
+ * label.</li>
+ * <li>FIGURE_FIXEDIDWIDTH Specifies the width to use for the left-hand column
+ * when exporting an alignment as a figure (setting FIGURE_AUTOIDWIDTH to true
+ * will override this).</li>
+ * <li>STRUCT_FROM_PDB (false) derive secondary structure annotation from PDB
+ * record</li>
+ * <li>USE_RNAVIEW (false) use RNAViewer to derive secondary structure</li>
+ * <li>ADD_SS_ANN (false) add secondary structure annotation to alignment
+ * display</li>
+ * <li>ADD_TEMPFACT_ANN (false) add Temperature Factor annotation to alignment
+ * display</li>
+ * <li>STRUCTURE_DISPLAY choose from JMOL (default) or CHIMERA for 3D structure
+ * display</li>
+ * <li>CHIMERA_PATH specify full path to Chimera program (if non-standard)</li>
*
* </ul>
* Deprecated settings:
* <ul>
- * * <li>DISCOVERY_START - Boolean - controls if discovery services are queried on
+ * *
+ * <li>DISCOVERY_START - Boolean - controls if discovery services are queried on
* startup (JWS1 services only)</li>
- * <li>DISCOVERY_URLS - comma separated list of Discovery Service endpoints. (JWS1 services only)</li>
- * <li>SHOW_JWS1_SERVICES (true) enable or disable the original Jalview 2 services in the desktop GUI</li>
- * <li>ENABLE_RSBS_EDITOR (false for 2.7 release) enable or disable RSBS editing panel in web service preferences</li>
+ * <li>DISCOVERY_URLS - comma separated list of Discovery Service endpoints.
+ * (JWS1 services only)</li>
+ * <li>SHOW_JWS1_SERVICES (true) enable or disable the original Jalview 2
+ * services in the desktop GUI</li>
+ * <li>ENABLE_RSBS_EDITOR (false for 2.7 release) enable or disable RSBS editing
+ * panel in web service preferences</li>
* </ul>
+ *
* @author $author$
* @version $Revision$
*/
@@ -176,12 +222,20 @@ public class Cache
public static Logger log;
/** Jalview Properties */
- public static Properties applicationProperties = new Properties();
+ public static Properties applicationProperties = new Properties()
+ {
+ // override results in properties output in alphabetical order
+ @Override
+ public synchronized Enumeration<Object> keys()
+ {
+ return Collections.enumeration(new TreeSet<Object>(super.keySet()));
+ }
+ };
/** Default file is ~/.jalview_properties */
static String propertiesFile;
- private static boolean propsAreReadOnly=false;
+ private static boolean propsAreReadOnly = false;
public static void initLogger()
{
@@ -235,7 +289,9 @@ public class Cache
{
propertiesFile = System.getProperty("user.home") + File.separatorChar
+ ".jalview_properties";
- } else {
+ }
+ else
+ {
// don't corrupt the file we've been given.
propsAreReadOnly = true;
}
@@ -261,8 +317,10 @@ public class Cache
fis = new FileInputStream(propertiesFile);
}
applicationProperties.load(fis);
- applicationProperties.remove("LATEST_VERSION");
- applicationProperties.remove("VERSION");
+
+ // remove any old build properties
+
+ deleteBuildProperties();
fis.close();
} catch (Exception ex)
{
@@ -271,11 +329,34 @@ public class Cache
if (getDefault("USE_PROXY", false))
{
- System.out.println("Using proxyServer: "
- + getDefault("PROXY_SERVER", null) + " proxyPort: "
- + getDefault("PROXY_PORT", null));
- System.setProperty("http.proxyHost", getDefault("PROXY_SERVER", null));
- System.setProperty("http.proxyPort", getDefault("PROXY_PORT", null));
+ String proxyServer = getDefault("PROXY_SERVER", ""), proxyPort = getDefault(
+ "PROXY_PORT", "8080");
+
+ System.out.println("Using proxyServer: " + proxyServer
+ + " proxyPort: " + proxyPort);
+
+ System.setProperty("http.proxyHost", proxyServer);
+ System.setProperty("http.proxyPort", proxyPort);
+ }
+
+ // LOAD THE AUTHORS FROM THE authors.props file
+ try
+ {
+ String authorDetails = "jar:".concat(Cache.class
+ .getProtectionDomain().getCodeSource().getLocation()
+ .toString().concat("!/authors.props"));
+
+ java.net.URL localJarFileURL = new java.net.URL(authorDetails);
+
+ InputStream in = localJarFileURL.openStream();
+ applicationProperties.load(in);
+ in.close();
+ } catch (Exception ex)
+ {
+ System.out.println("Error reading author details: " + ex);
+ applicationProperties.remove("AUTHORS");
+ applicationProperties.remove("AUTHORFNAMES");
+ applicationProperties.remove("YEAR");
}
// FIND THE VERSION NUMBER AND BUILD DATE FROM jalview.jar
@@ -300,15 +381,21 @@ public class Cache
String jnlpVersion = System.getProperty("jalview.version");
String codeVersion = getProperty("VERSION");
-
+ String codeInstallation = getProperty("INSTALLATION");
if (codeVersion == null)
{
// THIS SHOULD ONLY BE THE CASE WHEN TESTING!!
codeVersion = "Test";
jnlpVersion = "Test";
+ codeInstallation = "";
}
-
- System.out.println("Jalview Version: " + codeVersion);
+ else
+ {
+ codeInstallation = " (" + codeInstallation + ")";
+ }
+ new BuildDetails(codeVersion, null, codeInstallation);
+ System.out
+ .println("Jalview Version: " + codeVersion + codeInstallation);
// jnlpVersion will be null if we're using InstallAnywhere
// Dont do this check if running in headless mode
@@ -335,8 +422,9 @@ public class Cache
{
System.setProperty("sun.net.client.defaultConnectTimeout",
"5000");
- java.net.URL url = new java.net.URL(
- Cache.getDefault("www.jalview.org", "http://www.jalview.org")+"/webstart/jalview.jnlp");
+ java.net.URL url = new java.net.URL(Cache.getDefault(
+ "www.jalview.org", "http://www.jalview.org")
+ + "/webstart/jalview.jnlp");
BufferedReader in = new BufferedReader(new InputStreamReader(
url.openStream()));
String line = null;
@@ -390,6 +478,17 @@ public class Cache
false);
}
+ private static void deleteBuildProperties()
+ {
+ applicationProperties.remove("LATEST_VERSION");
+ applicationProperties.remove("VERSION");
+ applicationProperties.remove("AUTHORS");
+ applicationProperties.remove("AUTHORFNAMES");
+ applicationProperties.remove("YEAR");
+ applicationProperties.remove("BUILD_DATE");
+ applicationProperties.remove("INSTALLATION");
+ }
+
/**
* Gets Jalview application property of given key. Returns null if key not
* found
@@ -578,46 +677,6 @@ public class Cache
}
/**
- * generate Das1Sources from the local das source list
- *
- * @return Vector of Das1Sources
- */
- public static Vector getLocalDasSources()
- {
- Vector localSources = new Vector();
- String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE");
- if (local != null)
- {
- StringTokenizer st = new StringTokenizer(local, "\t");
- while (st.hasMoreTokens())
- {
- String token = st.nextToken();
- int bar = token.indexOf("|");
- Das1Source source = new Das1Source();
- source.setUrl(token.substring(bar + 1));
- if (source.getUrl().startsWith("sequence:"))
- {
- source.setUrl(source.getUrl().substring(9));
- // this source also serves sequences as well as features
- source.setCapabilities(new String[]
- { "sequence", "features" });
- }
- else
- {
- // default is that all user added sources serve features
- source.setCapabilities(new String[]
- { "features" });
- }
-
- source.setNickname(token.substring(0, bar));
-
- localSources.addElement(source);
- }
- }
- return localSources;
- }
-
- /**
* GA tracker object - actually JGoogleAnalyticsTracker null if tracking not
* enabled.
*/
@@ -661,21 +720,22 @@ public class Cache
try
{
// Google analytics tracking code for Library Finder
- tracker = jgoogleanalyticstracker.getConstructor(new Class[]
- { String.class, String.class, String.class }).newInstance(
- new Object[]
- {
- "Jalview Desktop",
- (vrs = jalview.bin.Cache.getProperty("VERSION")
- + "_"
- + jalview.bin.Cache.getDefault("BUILD_DATE",
- "unknown")), "UA-9060947-1" });
+ tracker = jgoogleanalyticstracker.getConstructor(
+ new Class[] { String.class, String.class, String.class })
+ .newInstance(
+ new Object[] {
+ "Jalview Desktop",
+ (vrs = jalview.bin.Cache.getProperty("VERSION")
+ + "_"
+ + jalview.bin.Cache.getDefault(
+ "BUILD_DATE", "unknown")),
+ "UA-9060947-1" });
jgoogleanalyticstracker.getMethod("trackAsynchronously",
- new Class[]
- { trackerfocus }).invoke(tracker, new Object[]
- { trackerfocus.getConstructor(new Class[]
- { String.class }).newInstance(new Object[]
- { "Application Started." }) });
+ new Class[] { trackerfocus }).invoke(
+ tracker,
+ new Object[] { trackerfocus.getConstructor(
+ new Class[] { String.class }).newInstance(
+ new Object[] { "Application Started." }) });
} catch (RuntimeException e)
{
re = e;
@@ -691,15 +751,21 @@ public class Cache
if (log != null)
{
if (re != null)
+ {
log.debug("Caught runtime exception in googletracker init:", re);
+ }
if (ex != null)
+ {
log.warn(
"Failed to initialise GoogleTracker for Jalview Desktop with version "
+ vrs, ex);
+ }
if (err != null)
+ {
log.error(
"Whilst initing GoogleTracker for Jalview Desktop version "
+ vrs, err);
+ }
}
else
{
@@ -736,6 +802,7 @@ public class Cache
/**
* get the user's default colour if available
+ *
* @param property
* @param defcolour
* @return
@@ -743,38 +810,44 @@ public class Cache
public static Color getDefaultColour(String property, Color defcolour)
{
String colprop = getProperty(property);
- if (colprop==null) {
+ if (colprop == null)
+ {
return defcolour;
}
- Color col = jalview.schemes.ColourSchemeProperty.getAWTColorFromName(colprop);
- if (col==null)
+ Color col = jalview.schemes.ColourSchemeProperty
+ .getAWTColorFromName(colprop);
+ if (col == null)
{
- try {
+ try
+ {
col = new jalview.schemes.UserColourScheme(colprop).findColour('A');
} catch (Exception ex)
{
- log.warn("Couldn't parse '"+colprop+"' as a colour for "+property);
- col=null;
+ log.warn("Couldn't parse '" + colprop + "' as a colour for "
+ + property);
+ col = null;
}
}
- return (col==null) ? defcolour: col;
+ return (col == null) ? defcolour : col;
}
/**
* store a colour as a Jalview user default property
+ *
* @param property
- * @param colour
+ * @param colour
*/
public static void setColourProperty(String property, Color colour)
{
- setProperty(property, jalview.util.Format
- .getHexString(colour));
+ setProperty(property, jalview.util.Format.getHexString(colour));
}
- public static final DateFormat date_format = SimpleDateFormat.getDateTimeInstance();
+ public static final DateFormat date_format = SimpleDateFormat
+ .getDateTimeInstance();
/**
* store a date in a jalview property
+ *
* @param string
* @param time
*/
@@ -782,8 +855,10 @@ public class Cache
{
setProperty(property, date_format.format(time));
}
+
/**
* read a date stored in a jalview property
+ *
* @param property
* @return valid date as stored by setDateProperty, or null
*
@@ -791,15 +866,80 @@ public class Cache
public static Date getDateProperty(String property)
{
String val = getProperty(property);
- if (val!=null)
+ if (val != null)
{
- try {
+ try
+ {
return date_format.parse(val);
} catch (Exception ex)
{
- System.err.println("Invalid or corrupt date in property '"+property+"' : value was '"+val+"'");
+ System.err.println("Invalid or corrupt date in property '"
+ + property + "' : value was '" + val + "'");
+ }
+ }
+ return null;
+ }
+
+ /**
+ * get and parse a property as an integer. send any parsing problems to
+ * System.err
+ *
+ * @param property
+ * @return null or Integer
+ */
+ public static Integer getIntegerProperty(String property)
+ {
+ String val = getProperty(property);
+ if (val != null && (val = val.trim()).length() > 0)
+ {
+ try
+ {
+ return Integer.valueOf(val);
+ } catch (NumberFormatException x)
+ {
+ System.err.println("Invalid integer in property '" + property
+ + "' (value was '" + val + "')");
}
}
return null;
}
+
+ private static DasSourceRegistryI sourceRegistry = null;
+
+ /**
+ * initialise and ..
+ *
+ * @return instance of the das source registry
+ */
+ public static DasSourceRegistryI getDasSourceRegistry()
+ {
+ if (sourceRegistry == null)
+ {
+ sourceRegistry = new DasSourceRegistry();
+ }
+ return sourceRegistry;
+ }
+
+ /**
+ * Set the specified value, or remove it if null or empty. Does not save the
+ * properties file.
+ *
+ * @param propName
+ * @param value
+ */
+ public static void setOrRemove(String propName, String value)
+ {
+ if (propName == null)
+ {
+ return;
+ }
+ if (value == null || value.trim().length() < 1)
+ {
+ Cache.applicationProperties.remove(propName);
+ }
+ else
+ {
+ Cache.applicationProperties.setProperty(propName, value);
+ }
+ }
}
diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java
index dd61e76..e29cbe1 100644
--- a/src/jalview/bin/Jalview.java
+++ b/src/jalview/bin/Jalview.java
@@ -1,22 +1,35 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.bin;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.io.BioJsHTMLOutput;
+import jalview.io.HtmlSvgOutput;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+import jalview.ws.jws2.Jws2Discoverer;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
@@ -33,12 +46,12 @@ import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Permissions;
import java.security.Policy;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
-import javax.swing.*;
-
-import jalview.gui.*;
-import jalview.util.Platform;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
/**
* Main class for Jalview Application <br>
@@ -81,56 +94,46 @@ public class Jalview
System.out.println(System.getProperty("os.arch") + " "
+ System.getProperty("os.name") + " "
+ System.getProperty("os.version"));
- if (new Platform().isAMac())
- {
- System.setProperty("com.apple.mrj.application.apple.menu.about.name",
- "Jalview");
- System.setProperty("apple.laf.useScreenMenuBar", "true");
- }
ArgsParser aparser = new ArgsParser(args);
boolean headless = false;
if (aparser.contains("help") || aparser.contains("h"))
{
- System.out
- .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
- + "-nodisplay\tRun Jalview without User Interface.\n"
- + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
- + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
- + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
- + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
- + "-features FILE\tUse the given file to mark features on the alignment.\n"
- + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
- + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
- + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
- + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
- + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
- + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
- + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
- + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
- + "-png FILE\tCreate PNG image FILE from alignment.\n"
- + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
- + "-eps FILE\tCreate EPS file FILE from alignment.\n"
- + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
- + "-noquestionnaire\tTurn off questionnaire check.\n"
- + "-nousagestats\tTurn off google analytics tracking for this session.\n"
- + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
- // +
- // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)"
- + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n"
- + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
- + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
- + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
- // +
- // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
- // + "-vses vamsas-session\tJoin session with given URN\n"
- + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n"
- + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
+ showUsage();
System.exit(0);
}
- Cache.loadProperties(aparser.getValue("props")); // must do this before
+ if (aparser.contains("nodisplay") || aparser.contains("nogui")
+ || aparser.contains("headless"))
+ {
+ System.setProperty("java.awt.headless", "true");
+ headless = true;
+ }
+ String usrPropsFile = aparser.getValue("props");
+ Cache.loadProperties(usrPropsFile); // must do this before
+ if (usrPropsFile != null)
+ {
+ System.out.println("CMD [-props " + usrPropsFile
+ + "] executed successfully!");
+ }
+
// anything else!
+
+ final String jabawsUrl = aparser.getValue("jabaws");
+ if (jabawsUrl != null)
+ {
+ try
+ {
+ Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
+ System.out.println("CMD [-jabaws " + jabawsUrl
+ + "] executed successfully!");
+ } catch (MalformedURLException e)
+ {
+ System.err.println("Invalid jabaws parameter: " + jabawsUrl
+ + " ignored");
+ }
+ }
+
String defs = aparser.getValue("setprop");
while (defs != null)
{
@@ -148,16 +151,13 @@ public class Jalview
}
defs = aparser.getValue("setprop");
}
- if (aparser.contains("nodisplay"))
- {
- System.setProperty("java.awt.headless", "true");
- }
if (System.getProperty("java.awt.headless") != null
&& System.getProperty("java.awt.headless").equals("true"))
{
headless = true;
}
-
+ System.setProperty("http.agent",
+ "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
try
{
Cache.initLogger();
@@ -178,6 +178,21 @@ public class Jalview
} catch (Exception ex)
{
}
+ if (new Platform().isAMac())
+ {
+ System.setProperty("com.apple.mrj.application.apple.menu.about.name",
+ "Jalview");
+ System.setProperty("apple.laf.useScreenMenuBar", "true");
+ try
+ {
+ UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager
+ .getLookAndFeel());
+ } catch (UnsupportedLookAndFeelException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
if (!headless)
{
@@ -189,6 +204,11 @@ public class Jalview
{
startUsageStats(desktop);
}
+ else
+ {
+ System.err.println("CMD [-nousagestats] executed successfully!");
+ }
+
if (!aparser.contains("noquestionnaire"))
{
String url = aparser.getValue("questionnaire");
@@ -198,6 +218,8 @@ public class Jalview
// questionnaire
Cache.log.debug("Starting questionnaire url at " + url);
desktop.checkForQuestionnaire(url);
+ System.out.println("CMD questionnaire[-" + url
+ + "] executed successfully!");
}
else
{
@@ -216,10 +238,20 @@ public class Jalview
}
}
}
+ else
+ {
+ System.err.println("CMD [-noquestionnaire] executed successfully!");
+ }
+ desktop.checkForNews();
+ }
+
+ if (!isHeadlessMode())
+ {
+ BioJsHTMLOutput.updateBioJS();
}
String file = null, protocol = null, format = null, data = null;
- jalview.io.FileLoader fileLoader = new jalview.io.FileLoader();
+ jalview.io.FileLoader fileLoader = new jalview.io.FileLoader(!headless);
Vector getFeatures = null; // vector of das source nicknames to fetch
// features from
// loading is done.
@@ -250,7 +282,8 @@ public class Jalview
{
try
{
- String viprotocol = jalview.io.AppletFormatAdapter.checkProtocol(vamsasImport);
+ String viprotocol = jalview.io.AppletFormatAdapter
+ .checkProtocol(vamsasImport);
if (viprotocol == jalview.io.FormatAdapter.FILE)
{
inSession = desktop.vamsasImport(new File(vamsasImport));
@@ -318,15 +351,17 @@ public class Jalview
}
}
}
- long progress=-1;
+ long progress = -1;
// Finally, deal with the remaining input data.
if (file != null)
{
if (!headless)
{
- desktop.setProgressBar("Processing commandline arguments...", progress=System.currentTimeMillis());
+ desktop.setProgressBar(MessageManager
+ .getString("status.processing_commandline_args"),
+ progress = System.currentTimeMillis());
}
- System.out.println("Opening file: " + file);
+ System.out.println("CMD [-open " + file + "] executed successfully!");
if (!file.startsWith("http://"))
{
@@ -349,177 +384,236 @@ public class Jalview
if (af == null)
{
System.out.println("error");
- return;
}
-
- data = aparser.getValue("colour", true);
- if (data != null)
+ else
{
- data.replaceAll("%20", " ");
-
- jalview.schemes.ColourSchemeI cs = jalview.schemes.ColourSchemeProperty
- .getColour(af.getViewport().getAlignment(), data);
- if (cs == null)
+ data = aparser.getValue("colour", true);
+ if (data != null)
{
- jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(
- "white");
- ucs.parseAppletParameter(data);
- cs = ucs;
- }
+ data.replaceAll("%20", " ");
- System.out.println("colour is " + data);
- af.changeColour(cs);
- }
+ jalview.schemes.ColourSchemeI cs = jalview.schemes.ColourSchemeProperty
+ .getColour(af.getViewport().getAlignment(), data);
- // Must maintain ability to use the groups flag
- data = aparser.getValue("groups", true);
- if (data != null)
- {
- af.parseFeaturesFile(data, jalview.io.AppletFormatAdapter.checkProtocol(data));
- System.out.println("Added " + data);
- }
- data = aparser.getValue("features", true);
- if (data != null)
- {
- af.parseFeaturesFile(data, jalview.io.AppletFormatAdapter.checkProtocol(data));
- System.out.println("Added " + data);
- }
-
- data = aparser.getValue("annotations", true);
- if (data != null)
- {
- af.loadJalviewDataFile(data, null, null, null);
- System.out.println("Added " + data);
- }
- // set or clear the sortbytree flag.
- if (aparser.contains("sortbytree"))
- {
- af.getViewport().setSortByTree(true);
- }
- if (aparser.contains("nosortbytree"))
- {
- af.getViewport().setSortByTree(false);
- }
- data = aparser.getValue("tree", true);
- if (data != null)
- {
- jalview.io.NewickFile fin = null;
- try
- {
- fin = new jalview.io.NewickFile(data, jalview.io.AppletFormatAdapter.checkProtocol(data));
- if (fin != null)
+ if (cs == null)
{
- af.getViewport().setCurrentTree(
- af.ShowNewickTree(fin, data).getTree());
- System.out.println("Added tree " + data);
+ jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(
+ "white");
+ ucs.parseAppletParameter(data);
+ cs = ucs;
}
- } catch (IOException ex)
- {
- System.err.println("Couldn't add tree " + data);
- ex.printStackTrace(System.err);
- }
- }
- // TODO - load PDB structure(s) to alignment JAL-629
- // (associate with identical sequence in alignment, or a specified
- // sequence)
-
- getFeatures = checkDasArguments(aparser);
- if (af != null && getFeatures != null)
- {
- FeatureFetcher ff = startFeatureFetching(getFeatures);
- if (ff != null)
- while (!ff.allFinished() || af.operationInProgress())
+ else
{
- // wait around until fetching is finished.
- try
- {
- Thread.sleep(100);
- } catch (Exception e)
- {
-
- }
+ System.out.println("CMD [-color " + data
+ + "] executed successfully!");
}
- getFeatures = null; // have retrieved features - forget them now.
- }
- if (groovyscript != null)
- {
- // Execute the groovy script after we've done all the rendering stuff
- // and before any images or figures are generated.
- if (jalview.bin.Cache.groovyJarsPresent())
+ af.changeColour(cs);
+ }
+
+ // Must maintain ability to use the groups flag
+ data = aparser.getValue("groups", true);
+ if (data != null)
{
- System.out.println("Executing script " + groovyscript);
- executeGroovyScript(groovyscript, new Object[] {desktop,af});
+ af.parseFeaturesFile(data,
+ jalview.io.AppletFormatAdapter.checkProtocol(data));
+ // System.out.println("Added " + data);
+ System.out.println("CMD groups[-" + data
+ + "] executed successfully!");
}
- else
+ data = aparser.getValue("features", true);
+ if (data != null)
{
- System.err
- .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script "
- + groovyscript);
+ af.parseFeaturesFile(data,
+ jalview.io.AppletFormatAdapter.checkProtocol(data));
+ // System.out.println("Added " + data);
+ System.out.println("CMD [-features " + data
+ + "] executed successfully!");
}
- groovyscript = null;
- }
- String imageName = "unnamed.png";
- while (aparser.getSize() > 1)
- {
- format = aparser.nextValue();
- file = aparser.nextValue();
- if (format.equalsIgnoreCase("png"))
+ data = aparser.getValue("annotations", true);
+ if (data != null)
+ {
+ af.loadJalviewDataFile(data, null, null, null);
+ // System.out.println("Added " + data);
+ System.out.println("CMD [-annotations " + data
+ + "] executed successfully!");
+ }
+ // set or clear the sortbytree flag.
+ if (aparser.contains("sortbytree"))
{
- af.createPNG(new java.io.File(file));
- imageName = (new java.io.File(file)).getName();
- System.out.println("Creating PNG image: " + file);
- continue;
+ af.getViewport().setSortByTree(true);
+ if (af.getViewport().getSortByTree())
+ {
+ System.out.println("CMD [-sortbytree] executed successfully!");
+ }
}
- else if (format.equalsIgnoreCase("imgMap"))
+ if (aparser.contains("no-annotation"))
{
- af.createImageMap(new java.io.File(file), imageName);
- System.out.println("Creating image map: " + file);
- continue;
+ af.getViewport().setShowAnnotation(false);
+ if (!af.getViewport().isShowAnnotation())
+ {
+ System.out.println("CMD no-annotation executed successfully!");
+ }
+ }
+ if (aparser.contains("nosortbytree"))
+ {
+ af.getViewport().setSortByTree(false);
+ if (!af.getViewport().getSortByTree())
+ {
+ System.out
+ .println("CMD [-nosortbytree] executed successfully!");
+ }
}
- else if (format.equalsIgnoreCase("eps"))
+ data = aparser.getValue("tree", true);
+ if (data != null)
{
- System.out.println("Creating EPS file: " + file);
- af.createEPS(new java.io.File(file));
- continue;
+ jalview.io.NewickFile fin = null;
+ try
+ {
+ System.out.println("CMD [-tree " + data
+ + "] executed successfully!");
+ fin = new jalview.io.NewickFile(data,
+ jalview.io.AppletFormatAdapter.checkProtocol(data));
+ if (fin != null)
+ {
+ af.getViewport().setCurrentTree(
+ af.ShowNewickTree(fin, data).getTree());
+ }
+ } catch (IOException ex)
+ {
+ System.err.println("Couldn't add tree " + data);
+ ex.printStackTrace(System.err);
+ }
}
+ // TODO - load PDB structure(s) to alignment JAL-629
+ // (associate with identical sequence in alignment, or a specified
+ // sequence)
- if (af.saveAlignment(file, format))
+ getFeatures = checkDasArguments(aparser);
+ if (af != null && getFeatures != null)
{
- System.out.println("Written alignment in " + format
- + " format to " + file);
+ FeatureFetcher ff = startFeatureFetching(getFeatures);
+ if (ff != null)
+ {
+ while (!ff.allFinished() || af.operationInProgress())
+ {
+ // wait around until fetching is finished.
+ try
+ {
+ Thread.sleep(100);
+ } catch (Exception e)
+ {
+
+ }
+ }
+ }
+ getFeatures = null; // have retrieved features - forget them now.
}
- else
+ if (groovyscript != null)
{
- System.out.println("Error writing file " + file + " in " + format
- + " format!!");
+ // Execute the groovy script after we've done all the rendering stuff
+ // and before any images or figures are generated.
+ if (jalview.bin.Cache.groovyJarsPresent())
+ {
+ System.out.println("Executing script " + groovyscript);
+ executeGroovyScript(groovyscript, new Object[] { desktop, af });
+
+ System.out.println("CMD groovy[" + groovyscript
+ + "] executed successfully!");
+ }
+ else
+ {
+ System.err
+ .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script "
+ + groovyscript);
+ }
+ groovyscript = null;
}
+ String imageName = "unnamed.png";
+ while (aparser.getSize() > 1)
+ {
+ format = aparser.nextValue();
+ file = aparser.nextValue();
- }
+ if (format.equalsIgnoreCase("png"))
+ {
+ af.createPNG(new java.io.File(file));
+ imageName = (new java.io.File(file)).getName();
+ System.out.println("Creating PNG image: " + file);
+ continue;
+ }
+ else if (format.equalsIgnoreCase("svg"))
+ {
+ File imageFile = new java.io.File(file);
+ imageName = imageFile.getName();
+ af.createSVG(imageFile);
+ System.out.println("Creating SVG image: " + file);
+ continue;
+ }
+ else if (format.equalsIgnoreCase("html"))
+ {
+ File imageFile = new java.io.File(file);
+ imageName = imageFile.getName();
+ new HtmlSvgOutput(new java.io.File(file), af.alignPanel);
+ System.out.println("Creating HTML image: " + file);
+ continue;
+ }
+ else if (format.equalsIgnoreCase("imgMap"))
+ {
+ af.createImageMap(new java.io.File(file), imageName);
+ System.out.println("Creating image map: " + file);
+ continue;
+ }
+ else if (format.equalsIgnoreCase("eps"))
+ {
+ File outputFile = new java.io.File(file);
+ System.out.println("Creating EPS file: "
+ + outputFile.getAbsolutePath());
+ af.createEPS(outputFile);
+ continue;
+ }
- while (aparser.getSize() > 0)
- {
- System.out.println("Unknown arg: " + aparser.nextValue());
+ if (af.saveAlignment(file, format))
+ {
+ System.out.println("Written alignment in " + format
+ + " format to " + file);
+ }
+ else
+ {
+ System.out.println("Error writing file " + file + " in "
+ + format + " format!!");
+ }
+
+ }
+
+ while (aparser.getSize() > 0)
+ {
+ System.out.println("Unknown arg: " + aparser.nextValue());
+ }
}
}
AlignFrame startUpAlframe = null;
// We'll only open the default file if the desktop is visible.
// And the user
// ////////////////////
+
if (!headless && file == null && vamsasImport == null
&& jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
{
- file = jalview.bin.Cache.getDefault("STARTUP_FILE",
- jalview.bin.Cache.getDefault("www.jalview.org", "http://www.jalview.org")+"/examples/exampleFile_2_7.jar");
+ file = jalview.bin.Cache.getDefault(
+ "STARTUP_FILE",
+ jalview.bin.Cache.getDefault("www.jalview.org",
+ "http://www.jalview.org")
+ + "/examples/exampleFile_2_7.jar");
if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar"))
{
// hardwire upgrade of the startup file
- file.replace("_2_3.jar","_2_7.jar");
- // and remove the stale setting
+ file.replace("_2_3.jar", "_2_7.jar");
+ // and remove the stale setting
jalview.bin.Cache.removeProperty("STARTUP_FILE");
}
-
+
protocol = "File";
if (file.indexOf("http:") > -1)
@@ -558,7 +652,8 @@ public class Jalview
if (jalview.bin.Cache.groovyJarsPresent())
{
System.out.println("Executing script " + groovyscript);
- executeGroovyScript(groovyscript, new Object[] { desktop, startUpAlframe});
+ executeGroovyScript(groovyscript, new Object[] { desktop,
+ startUpAlframe });
}
else
{
@@ -570,13 +665,56 @@ public class Jalview
// and finally, turn off batch mode indicator - if the desktop still exists
if (desktop != null)
{
- if (progress!=-1) {
+ if (progress != -1)
+ {
desktop.setProgressBar(null, progress);
}
desktop.setInBatchMode(false);
}
}
+ private static void showUsage()
+ {
+ System.out
+ .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
+ + "-nodisplay\tRun Jalview without User Interface.\n"
+ + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
+ + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
+ + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
+ + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
+ + "-features FILE\tUse the given file to mark features on the alignment.\n"
+ + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
+ + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
+ + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
+ + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
+ + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
+ + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
+ + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
+ + "-json FILE\tCreate alignment file FILE in JSON format.\n"
+ + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
+ + "-png FILE\tCreate PNG image FILE from alignment.\n"
+ + "-svg FILE\tCreate SVG image FILE from alignment.\n"
+ + "-html FILE\tCreate HTML file from alignment.\n"
+ + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
+ + "-eps FILE\tCreate EPS file FILE from alignment.\n"
+ + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
+ + "-noquestionnaire\tTurn off questionnaire check.\n"
+ + "-nousagestats\tTurn off google analytics tracking for this session.\n"
+ + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
+ // +
+ // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)"
+ + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
+ + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n"
+ + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
+ + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
+ + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
+ // +
+ // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
+ // + "-vses vamsas-session\tJoin session with given URN\n"
+ + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n"
+ + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
+ }
+
private static void startUsageStats(final Desktop desktop)
{
/**
@@ -594,7 +732,7 @@ public class Jalview
public void run()
{
Cache.log
- .info("Initialising googletracker for usage stats.");
+ .debug("Initialising googletracker for usage stats.");
Cache.initGoogleTracker();
Cache.log.debug("Tracking enabled.");
}
@@ -602,10 +740,10 @@ public class Jalview
{
public void run()
{
- Cache.log.info("Not enabling Google Tracking.");
+ Cache.log.debug("Not enabling Google Tracking.");
}
}, null, true);
- SwingUtilities.invokeLater(prompter);
+ desktop.addDialogThread(prompter);
}
/**
@@ -660,11 +798,14 @@ public class Jalview
ex.printStackTrace();
return;
}
- try {
+ try
+ {
sfile = tfile.toURI().toURL();
} catch (Exception x)
{
- System.err.println("Unexpected Malformed URL Exception for temporary file created from STDIN: "+tfile.toURI());
+ System.err
+ .println("Unexpected Malformed URL Exception for temporary file created from STDIN: "
+ + tfile.toURI());
x.printStackTrace();
return;
}
@@ -692,11 +833,13 @@ public class Jalview
System.err.println("File '" + groovyscript + "' is empty.");
return;
}
- try {
- sfile = tfile.getAbsoluteFile().toURI().toURL();
+ try
+ {
+ sfile = tfile.getAbsoluteFile().toURI().toURL();
} catch (Exception ex)
{
- System.err.println("Failed to create a file URL for "+tfile.getAbsoluteFile());
+ System.err.println("Failed to create a file URL for "
+ + tfile.getAbsoluteFile());
return;
}
}
@@ -715,17 +858,16 @@ public class Jalview
* = new Binding(); binding.setVariable("input", "world");
* gse.run("hello.groovy", binding); </code>
*/
- Class[] bspec;
+ Class<?>[] bspec;
Object[] binding;
int blen = ((jalviewContext[0] == null) ? 0 : 1)
+ ((jalviewContext[1] == null) ? 0 : 1);
- String cnames[] = new String[]
- { "Jalview", "currentAlFrame" };
+ String cnames[] = new String[] { "Jalview", "currentAlFrame" };
bspec = new Class[blen * 2];
binding = new Object[blen * 2];
blen = 0;
ClassLoader cl = null;
- Map vbinding = new Hashtable();
+ Map<String, Object> vbinding = new HashMap<String, Object>();
for (int jc = 0; jc < jalviewContext.length; jc++)
{
if (jalviewContext[jc] != null)
@@ -742,8 +884,8 @@ public class Jalview
blen++;
}
}
- Class gbindingc = cl.loadClass("groovy.lang.Binding");
- Constructor gbcons;
+ Class<?> gbindingc = cl.loadClass("groovy.lang.Binding");
+ Constructor<?> gbcons;
Object gbinding;
try
{
@@ -753,23 +895,23 @@ public class Jalview
{
// old style binding config - using series of string/object values to
// setVariable.
- gbcons = gbindingc.getConstructor(null);
- gbinding = gbcons.newInstance(null);
+ gbcons = gbindingc.getConstructor();
+ gbinding = gbcons.newInstance();
java.lang.reflect.Method setvar = gbindingc.getMethod(
"setVariable", bspec);
setvar.invoke(gbinding, binding);
}
- ;
- Class gsec = cl.loadClass("groovy.util.GroovyScriptEngine");
- Constructor gseccons = gsec.getConstructor(new Class[]
- { URL[].class }); // String[].class });
- Object gse = gseccons.newInstance(new Object[]
- { new URL[]
- { sfile } }); // .toString() } });
- java.lang.reflect.Method run = gsec.getMethod("run", new Class[]
- { String.class, gbindingc });
- run.invoke(gse, new Object[]
- { sfile.toString(), gbinding });
+
+ Class<?> gsec = cl.loadClass("groovy.util.GroovyScriptEngine");
+ Constructor<?> gseccons = gsec
+ .getConstructor(new Class[] { URL[].class }); // String[].class
+ // });
+ Object gse = gseccons
+ .newInstance(new Object[] { new URL[] { sfile } }); // .toString()
+ // } });
+ java.lang.reflect.Method run = gsec.getMethod("run", new Class[] {
+ String.class, gbindingc });
+ run.invoke(gse, new Object[] { sfile.toString(), gbinding });
success = true;
} catch (Exception e)
{
@@ -834,6 +976,8 @@ public class Jalview
}
source.addElement(nickname);
}
+ System.out.println("CMD [-dasserver " + data
+ + "] executed successfully!");
} // loop until no more server entries are found.
if (locsources != null && locsources.indexOf('|') > -1)
{
@@ -861,7 +1005,7 @@ public class Jalview
private static FeatureFetcher startFeatureFetching(final Vector dasSources)
{
FeatureFetcher ff = new FeatureFetcher();
- AlignFrame afs[] = Desktop.getAlignframes();
+ AlignFrame afs[] = Desktop.getAlignFrames();
if (afs == null || afs.length == 0)
{
return null;
@@ -872,6 +1016,16 @@ public class Jalview
}
return ff;
}
+
+ public static boolean isHeadlessMode()
+ {
+ String isheadless = System.getProperty("java.awt.headless");
+ if (isheadless != null && isheadless.equalsIgnoreCase("true"))
+ {
+ return true;
+ }
+ return false;
+ }
}
/**
@@ -883,6 +1037,24 @@ public class Jalview
* @author Andrew Waterhouse and JBP documented.
*
*/
+
+class rnabuttonlistener implements ActionListener
+{
+ public void actionPerformed(ActionEvent arg0)
+ {
+ System.out.println("Good idea ! ");
+
+ }
+}
+
+class pbuttonlistener implements ActionListener
+{
+ public void actionPerformed(ActionEvent arg0)
+ {
+
+ }
+}
+
class ArgsParser
{
Vector vargs = null;
@@ -1005,7 +1177,8 @@ class FeatureFetcher
running++;
}
- af.setProgressBar("DAS features being retrieved...", id);
+ af.setProgressBar(MessageManager
+ .getString("status.das_features_being_retrived"), id);
af.featureSettings_actionPerformed(null);
af.featureSettings.fetchDasFeatures(dasSources, true);
af.setProgressBar(null, id);
@@ -1021,4 +1194,5 @@ class FeatureFetcher
{
return queued == 0 && running == 0;
}
-};
+
+}
diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java
index 52e7408..59424df 100644
--- a/src/jalview/bin/JalviewLite.java
+++ b/src/jalview/bin/JalviewLite.java
@@ -1,2686 +1,3001 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.bin;
-
-import jalview.api.StructureSelectionManagerProvider;
-import jalview.appletgui.AlignFrame;
-import jalview.appletgui.AlignViewport;
-import jalview.appletgui.EmbmenuFrame;
-import jalview.appletgui.FeatureSettings;
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.AlignmentOrder;
-import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.PDBEntry;
-import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceGroup;
-import jalview.datamodel.SequenceI;
-import jalview.io.AnnotationFile;
-import jalview.io.AppletFormatAdapter;
-import jalview.io.FileParse;
-import jalview.io.IdentifyFile;
-import jalview.io.JnetAnnotationMaker;
-import jalview.javascript.JSFunctionExec;
-import jalview.javascript.JalviewLiteJsApi;
-import jalview.javascript.JsCallBack;
-import jalview.structure.SelectionListener;
-import jalview.structure.StructureSelectionManager;
-
-import java.applet.Applet;
-import java.awt.Button;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.EventQueue;
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.event.ActionEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import netscape.javascript.JSObject;
-
-/**
- * Jalview Applet. Runs in Java 1.18 runtime
- *
- * @author $author$
- * @version $Revision: 1.92 $
- */
-public class JalviewLite extends Applet implements
- StructureSelectionManagerProvider, JalviewLiteJsApi
-{
-
- public StructureSelectionManager getStructureSelectionManager()
- {
- return StructureSelectionManager.getStructureSelectionManager(this);
- }
-
- // /////////////////////////////////////////
- // The following public methods maybe called
- // externally, eg via javascript in HTML page
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences()
- */
- public String getSelectedSequences()
- {
- return getSelectedSequencesFrom(getDefaultTargetFrame());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences(java.lang.String)
- */
- public String getSelectedSequences(String sep)
- {
- return getSelectedSequencesFrom(getDefaultTargetFrame(), sep);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui
- * .AlignFrame)
- */
- public String getSelectedSequencesFrom(AlignFrame alf)
- {
- return getSelectedSequencesFrom(alf, separator); // ""+0x00AC);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui
- * .AlignFrame, java.lang.String)
- */
- public String getSelectedSequencesFrom(AlignFrame alf, String sep)
- {
- StringBuffer result = new StringBuffer("");
- if (sep == null || sep.length() == 0)
- {
- sep = separator; // "+0x00AC;
- }
- if (alf.viewport.getSelectionGroup() != null)
- {
- SequenceI[] seqs = alf.viewport.getSelectionGroup()
- .getSequencesInOrder(alf.viewport.getAlignment());
-
- for (int i = 0; i < seqs.length; i++)
- {
- result.append(seqs[i].getName());
- result.append(sep);
- }
- }
-
- return result.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#highlight(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public void highlight(String sequenceId, String position,
- String alignedPosition)
- {
- highlightIn(getDefaultTargetFrame(), sequenceId, position,
- alignedPosition);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#highlightIn(jalview.appletgui.AlignFrame,
- * java.lang.String, java.lang.String, java.lang.String)
- */
- public void highlightIn(final AlignFrame alf, final String sequenceId,
- final String position, final String alignedPosition)
- {
- // TODO: could try to highlight in all alignments if alf==null
- jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
- alf.viewport.getAlignment().getSequencesArray());
- final SequenceI sq = matcher.findIdMatch(sequenceId);
- if (sq != null)
- {
- int apos = -1;
- try
- {
- apos = new Integer(position).intValue();
- apos--;
- } catch (NumberFormatException ex)
- {
- return;
- }
- final StructureSelectionManagerProvider me = this;
- final int pos = apos;
- // use vamsas listener to broadcast to all listeners in scope
- if (alignedPosition != null
- && (alignedPosition.trim().length() == 0 || alignedPosition
- .toLowerCase().indexOf("false") > -1))
- {
- java.awt.EventQueue.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- StructureSelectionManager.getStructureSelectionManager(me)
- .mouseOverVamsasSequence(sq, sq.findIndex(pos), null);
- }
- });
- }
- else
- {
- java.awt.EventQueue.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- StructureSelectionManager.getStructureSelectionManager(me)
- .mouseOverVamsasSequence(sq, pos, null);
- }
- });
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,
- * java.lang.String)
- */
- public void select(String sequenceIds, String columns)
- {
- selectIn(getDefaultTargetFrame(), sequenceIds, columns, separator);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public void select(String sequenceIds, String columns, String sep)
- {
- selectIn(getDefaultTargetFrame(), sequenceIds, columns, sep);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,
- * java.lang.String, java.lang.String)
- */
- public void selectIn(AlignFrame alf, String sequenceIds, String columns)
- {
- selectIn(alf, sequenceIds, columns, separator);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,
- * java.lang.String, java.lang.String, java.lang.String)
- */
- public void selectIn(final AlignFrame alf, String sequenceIds,
- String columns, String sep)
- {
- if (sep == null || sep.length() == 0)
- {
- sep = separator;
- }
- else
- {
- if (debug)
- {
- System.err.println("Selecting region using separator string '"
- + separator + "'");
- }
- }
- // deparse fields
- String[] ids = separatorListToArray(sequenceIds, sep);
- String[] cols = separatorListToArray(columns, sep);
- final SequenceGroup sel = new SequenceGroup();
- final ColumnSelection csel = new ColumnSelection();
- AlignmentI al = alf.viewport.getAlignment();
- jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
- alf.viewport.getAlignment().getSequencesArray());
- int start = 0, end = al.getWidth(), alw = al.getWidth();
- boolean seqsfound = true;
- if (ids != null && ids.length > 0)
- {
- seqsfound = false;
- for (int i = 0; i < ids.length; i++)
- {
- if (ids[i].trim().length() == 0)
- {
- continue;
- }
- SequenceI sq = matcher.findIdMatch(ids[i]);
- if (sq != null)
- {
- seqsfound = true;
- sel.addSequence(sq, false);
- }
- }
- }
- boolean inseqpos = false;
- if (cols != null && cols.length > 0)
- {
- boolean seset = false;
- for (int i = 0; i < cols.length; i++)
- {
- String cl = cols[i].trim();
- if (cl.length() == 0)
- {
- continue;
- }
- int p;
- if ((p = cl.indexOf("-")) > -1)
- {
- int from = -1, to = -1;
- try
- {
- from = new Integer(cl.substring(0, p)).intValue();
- from--;
- } catch (NumberFormatException ex)
- {
- System.err
- .println("ERROR: Couldn't parse first integer in range element column selection string '"
- + cl + "' - format is 'from-to'");
- return;
- }
- try
- {
- to = new Integer(cl.substring(p + 1)).intValue();
- to--;
- } catch (NumberFormatException ex)
- {
- System.err
- .println("ERROR: Couldn't parse second integer in range element column selection string '"
- + cl + "' - format is 'from-to'");
- return;
- }
- if (from >= 0 && to >= 0)
- {
- // valid range
- if (from < to)
- {
- int t = to;
- to = from;
- to = t;
- }
- if (!seset)
- {
- start = from;
- end = to;
- seset = true;
- }
- else
- {
- // comment to prevent range extension
- if (start > from)
- {
- start = from;
- }
- if (end < to)
- {
- end = to;
- }
- }
- for (int r = from; r <= to; r++)
- {
- if (r >= 0 && r < alw)
- {
- csel.addElement(r);
- }
- }
- if (debug)
- {
- System.err.println("Range '" + cl + "' deparsed as [" + from
- + "," + to + "]");
- }
- }
- else
- {
- System.err.println("ERROR: Invalid Range '" + cl
- + "' deparsed as [" + from + "," + to + "]");
- }
- }
- else
- {
- int r = -1;
- try
- {
- r = new Integer(cl).intValue();
- r--;
- } catch (NumberFormatException ex)
- {
- if (cl.toLowerCase().equals("sequence"))
- {
- // we are in the dataset sequence's coordinate frame.
- inseqpos = true;
- }
- else
- {
- System.err
- .println("ERROR: Couldn't parse integer from point selection element of column selection string '"
- + cl + "'");
- return;
- }
- }
- if (r >= 0 && r <= alw)
- {
- if (!seset)
- {
- start = r;
- end = r;
- seset = true;
- }
- else
- {
- // comment to prevent range extension
- if (start > r)
- {
- start = r;
- }
- if (end < r)
- {
- end = r;
- }
- }
- csel.addElement(r);
- if (debug)
- {
- System.err.println("Point selection '" + cl
- + "' deparsed as [" + r + "]");
- }
- }
- else
- {
- System.err.println("ERROR: Invalid Point selection '" + cl
- + "' deparsed as [" + r + "]");
- }
- }
- }
- }
- if (seqsfound)
- {
- // we only propagate the selection when it was the null selection, or the
- // given sequences were found in the alignment.
- if (inseqpos && sel.getSize() > 0)
- {
- // assume first sequence provides reference frame ?
- SequenceI rs = sel.getSequenceAt(0);
- start = rs.findIndex(start);
- end = rs.findIndex(end);
- if (csel != null)
- {
- Vector cs = csel.getSelected();
- csel.clear();
- for (int csi = 0, csiS = cs.size(); csi < csiS; csi++)
- {
- csel.addElement(rs.findIndex(((Integer) cs.elementAt(csi))
- .intValue()));
- }
- }
- }
- sel.setStartRes(start);
- sel.setEndRes(end);
- EventQueue.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- alf.select(sel, csel);
- }
- });
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignment(java.lang.
- * String, java.lang.String)
- */
- public String getSelectedSequencesAsAlignment(String format, String suffix)
- {
- return getSelectedSequencesAsAlignmentFrom(getDefaultTargetFrame(),
- format, suffix);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignmentFrom(jalview
- * .appletgui.AlignFrame, java.lang.String, java.lang.String)
- */
- public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf,
- String format, String suffix)
- {
- try
- {
- boolean seqlimits = suffix.equalsIgnoreCase("true");
- if (alf.viewport.getSelectionGroup() != null)
- {
- String reply = new AppletFormatAdapter().formatSequences(format,
- new Alignment(alf.viewport.getSelectionAsNewSequence()),
- seqlimits);
- return reply;
- }
- } catch (Exception ex)
- {
- ex.printStackTrace();
- return "Error retrieving alignment in " + format + " format. ";
- }
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrder()
- */
- public String getAlignmentOrder()
- {
- return getAlignmentOrderFrom(getDefaultTargetFrame());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame
- * )
- */
- public String getAlignmentOrderFrom(AlignFrame alf)
- {
- return getAlignmentOrderFrom(alf, separator);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame
- * , java.lang.String)
- */
- public String getAlignmentOrderFrom(AlignFrame alf, String sep)
- {
- AlignmentI alorder = alf.getAlignViewport().getAlignment();
- String[] order = new String[alorder.getHeight()];
- for (int i = 0; i < order.length; i++)
- {
- order[i] = alorder.getSequenceAt(i).getName();
- }
- return arrayToSeparatorList(order);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,
- * java.lang.String)
- */
- public String orderBy(String order, String undoName)
- {
- return orderBy(order, undoName, separator);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public String orderBy(String order, String undoName, String sep)
- {
- return orderAlignmentBy(getDefaultTargetFrame(), order, undoName, sep);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#orderAlignmentBy(jalview.appletgui.AlignFrame,
- * java.lang.String, java.lang.String, java.lang.String)
- */
- public String orderAlignmentBy(AlignFrame alf, String order,
- String undoName, String sep)
- {
- String[] ids = separatorListToArray(order, sep);
- SequenceI[] sqs = null;
- if (ids != null && ids.length > 0)
- {
- jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
- alf.viewport.getAlignment().getSequencesArray());
- int s = 0;
- sqs = new SequenceI[ids.length];
- for (int i = 0; i < ids.length; i++)
- {
- if (ids[i].trim().length() == 0)
- {
- continue;
- }
- SequenceI sq = matcher.findIdMatch(ids[i]);
- if (sq != null)
- {
- sqs[s++] = sq;
- }
- }
- if (s > 0)
- {
- SequenceI[] sqq = new SequenceI[s];
- System.arraycopy(sqs, 0, sqq, 0, s);
- sqs = sqq;
- }
- else
- {
- sqs = null;
- }
- }
- if (sqs == null)
- {
- return "";
- }
- ;
- final AlignmentOrder aorder = new AlignmentOrder(sqs);
-
- if (undoName != null && undoName.trim().length() == 0)
- {
- undoName = null;
- }
- final String _undoName = undoName;
- // TODO: deal with synchronization here: cannot raise any events until after
- // this has returned.
- return alf.sortBy(aorder, _undoName) ? "true" : "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String)
- */
- public String getAlignment(String format)
- {
- return getAlignmentFrom(getDefaultTargetFrame(), format, "true");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,
- * java.lang.String)
- */
- public String getAlignmentFrom(AlignFrame alf, String format)
- {
- return getAlignmentFrom(alf, format, "true");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String,
- * java.lang.String)
- */
- public String getAlignment(String format, String suffix)
- {
- return getAlignmentFrom(getDefaultTargetFrame(), format, suffix);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,
- * java.lang.String, java.lang.String)
- */
- public String getAlignmentFrom(AlignFrame alf, String format,
- String suffix)
- {
- try
- {
- boolean seqlimits = suffix.equalsIgnoreCase("true");
-
- String reply = new AppletFormatAdapter().formatSequences(format,
- alf.viewport.getAlignment(), seqlimits);
- return reply;
- } catch (Exception ex)
- {
- ex.printStackTrace();
- return "Error retrieving alignment in " + format + " format. ";
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String)
- */
- public void loadAnnotation(String annotation)
- {
- loadAnnotationFrom(getDefaultTargetFrame(), annotation);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame
- * , java.lang.String)
- */
- public void loadAnnotationFrom(AlignFrame alf, String annotation)
- {
- if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport()
- .getAlignment(), annotation, AppletFormatAdapter.PASTE))
- {
- alf.alignPanel.fontChanged();
- alf.alignPanel.setScrollValues(0, 0);
- }
- else
- {
- alf.parseFeaturesFile(annotation, AppletFormatAdapter.PASTE);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getFeatures(java.lang.String)
- */
- public String getFeatures(String format)
- {
- return getFeaturesFrom(getDefaultTargetFrame(), format);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getFeaturesFrom(jalview.appletgui.AlignFrame,
- * java.lang.String)
- */
- public String getFeaturesFrom(AlignFrame alf, String format)
- {
- return alf.outputFeatures(false, format);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getAnnotation()
- */
- public String getAnnotation()
- {
- return getAnnotationFrom(getDefaultTargetFrame());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getAnnotationFrom(jalview.appletgui.AlignFrame
- * )
- */
- public String getAnnotationFrom(AlignFrame alf)
- {
- return alf.outputAnnotations(false);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#newView()
- */
- public AlignFrame newView()
- {
- return newViewFrom(getDefaultTargetFrame());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#newView(java.lang.String)
- */
- public AlignFrame newView(String name)
- {
- return newViewFrom(getDefaultTargetFrame(), name);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame)
- */
- public AlignFrame newViewFrom(AlignFrame alf)
- {
- return alf.newView(null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame,
- * java.lang.String)
- */
- public AlignFrame newViewFrom(AlignFrame alf, String name)
- {
- return alf.newView(name);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#loadAlignment(java.lang.String,
- * java.lang.String)
- */
- public AlignFrame loadAlignment(String text, String title)
- {
- Alignment al = null;
-
- String format = new IdentifyFile().Identify(text,
- AppletFormatAdapter.PASTE);
- try
- {
- al = new AppletFormatAdapter().readFile(text,
- AppletFormatAdapter.PASTE, format);
- if (al.getHeight() > 0)
- {
- return new AlignFrame(al, this, title, false);
- }
- } catch (java.io.IOException ex)
- {
- ex.printStackTrace();
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(java.lang.String)
- */
- public void setMouseoverListener(String listener)
- {
- setMouseoverListener(currentAlignFrame, listener);
- }
-
- private Vector<jalview.javascript.JSFunctionExec> javascriptListeners = new Vector<jalview.javascript.JSFunctionExec>();
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#setMouseoverListener(jalview.appletgui.AlignFrame
- * , java.lang.String)
- */
- public void setMouseoverListener(AlignFrame af, String listener)
- {
- if (listener != null)
- {
- listener = listener.trim();
- if (listener.length() == 0)
- {
- System.err
- .println("jalview Javascript error: Ignoring empty function for mouseover listener.");
- return;
- }
- }
- jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener(
- this, af, listener);
- javascriptListeners.addElement(mol);
- StructureSelectionManager.getStructureSelectionManager(this)
- .addStructureViewerListener(mol);
- if (debug)
- {
- System.err.println("Added a mouseover listener for "
- + ((af == null) ? "All frames" : "Just views for "
- + af.getAlignViewport().getSequenceSetId()));
- System.err.println("There are now " + javascriptListeners.size()
- + " listeners in total.");
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#setSelectionListener(java.lang.String)
- */
- public void setSelectionListener(String listener)
- {
- setSelectionListener(null, listener);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#setSelectionListener(jalview.appletgui.AlignFrame
- * , java.lang.String)
- */
- public void setSelectionListener(AlignFrame af, String listener)
- {
- if (listener != null)
- {
- listener = listener.trim();
- if (listener.length() == 0)
- {
- System.err
- .println("jalview Javascript error: Ignoring empty function for selection listener.");
- return;
- }
- }
- jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender(
- this, af, listener);
- javascriptListeners.addElement(mol);
- StructureSelectionManager.getStructureSelectionManager(this)
- .addSelectionListener(mol);
- if (debug)
- {
- System.err.println("Added a selection listener for "
- + ((af == null) ? "All frames" : "Just views for "
- + af.getAlignViewport().getSequenceSetId()));
- System.err.println("There are now " + javascriptListeners.size()
- + " listeners in total.");
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String,
- * java.lang.String)
- */
- public void setStructureListener(String listener, String modelSet)
- {
- if (listener != null)
- {
- listener = listener.trim();
- if (listener.length() == 0)
- {
- System.err
- .println("jalview Javascript error: Ignoring empty function for selection listener.");
- return;
- }
- }
- jalview.javascript.MouseOverStructureListener mol = new jalview.javascript.MouseOverStructureListener(
- this, listener, separatorListToArray(modelSet));
- javascriptListeners.addElement(mol);
- StructureSelectionManager.getStructureSelectionManager(this)
- .addStructureViewerListener(mol);
- if (debug)
- {
- System.err.println("Added a javascript structure viewer listener '"
- + listener + "'");
- System.err.println("There are now " + javascriptListeners.size()
- + " listeners in total.");
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#removeJavascriptListener(jalview.appletgui
- * .AlignFrame, java.lang.String)
- */
- public void removeJavascriptListener(AlignFrame af, String listener)
- {
- if (listener != null)
- {
- listener = listener.trim();
- if (listener.length() == 0)
- {
- listener = null;
- }
- }
- boolean rprt = false;
- for (int ms = 0, msSize = javascriptListeners.size(); ms < msSize;)
- {
- Object lstn = javascriptListeners.elementAt(ms);
- JsCallBack lstner = (JsCallBack) lstn;
- if ((af == null || lstner.getAlignFrame() == af)
- && (listener == null || lstner.getListenerFunction().equals(
- listener)))
- {
- javascriptListeners.removeElement(lstner);
- msSize--;
- if (lstner instanceof SelectionListener)
- {
- StructureSelectionManager.getStructureSelectionManager(this)
- .removeSelectionListener((SelectionListener) lstner);
- }
- else
- {
- StructureSelectionManager.getStructureSelectionManager(this)
- .removeStructureViewerListener(lstner, null);
- }
- rprt = debug;
- if (debug)
- {
- System.err.println("Removed listener '" + listener + "'");
- }
- }
- else
- {
- ms++;
- }
- }
- if (rprt)
- {
- System.err.println("There are now " + javascriptListeners.size()
- + " listeners in total.");
- }
- }
-
- public void stop()
- {
- System.err.println("Applet " + getName() + " stop().");
- tidyUp();
- }
-
- public void destroy()
- {
- System.err.println("Applet " + getName() + " destroy().");
- tidyUp();
- }
-
- private void tidyUp()
- {
- removeAll();
- if (currentAlignFrame != null && currentAlignFrame.viewport != null
- && currentAlignFrame.viewport.applet != null)
- {
- AlignViewport av = currentAlignFrame.viewport;
- currentAlignFrame.closeMenuItem_actionPerformed();
- av.applet = null;
- currentAlignFrame = null;
- }
- if (javascriptListeners != null)
- {
- while (javascriptListeners.size() > 0)
- {
- jalview.javascript.JSFunctionExec mol = javascriptListeners
- .elementAt(0);
- javascriptListeners.removeElement(mol);
- if (mol instanceof SelectionListener)
- {
- StructureSelectionManager.getStructureSelectionManager(this)
- .removeSelectionListener((SelectionListener) mol);
- }
- else
- {
- StructureSelectionManager.getStructureSelectionManager(this)
- .removeStructureViewerListener(mol, null);
- }
- mol.jvlite = null;
- }
- }
- if (jsFunctionExec != null)
- {
- jsFunctionExec.stopQueue();
- jsFunctionExec.jvlite = null;
- }
- initialAlignFrame = null;
- jsFunctionExec = null;
- javascriptListeners = null;
- StructureSelectionManager.release(this);
- }
-
- private jalview.javascript.JSFunctionExec jsFunctionExec;
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#mouseOverStructure(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public void mouseOverStructure(final String pdbResNum,
- final String chain, final String pdbfile)
- {
- final StructureSelectionManagerProvider me = this;
- java.awt.EventQueue.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- try
- {
- StructureSelectionManager.getStructureSelectionManager(me)
- .mouseOverStructure(new Integer(pdbResNum).intValue(),
- chain, pdbfile);
- if (debug)
- {
- System.err.println("mouseOver for '" + pdbResNum
- + "' in chain '" + chain + "' in structure '" + pdbfile
- + "'");
- }
- } catch (NumberFormatException e)
- {
- System.err.println("Ignoring invalid residue number string '"
- + pdbResNum + "'");
- }
-
- }
- });
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#scrollViewToIn(jalview.appletgui.AlignFrame,
- * java.lang.String, java.lang.String)
- */
- public void scrollViewToIn(final AlignFrame alf, final String topRow,
- final String leftHandColumn)
- {
- java.awt.EventQueue.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- try
- {
- alf.scrollTo(new Integer(topRow).intValue(), new Integer(
- leftHandColumn).intValue());
-
- } catch (Exception ex)
- {
- System.err.println("Couldn't parse integer arguments (topRow='"
- + topRow + "' and leftHandColumn='" + leftHandColumn
- + "')");
- ex.printStackTrace();
- }
- }
- });
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.javascript.JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui
- * .AlignFrame, java.lang.String)
- */
- @Override
- public void scrollViewToRowIn(final AlignFrame alf, final String topRow)
- {
-
- java.awt.EventQueue.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- try
- {
- alf.scrollToRow(new Integer(topRow).intValue());
-
- } catch (Exception ex)
- {
- System.err.println("Couldn't parse integer arguments (topRow='"
- + topRow + "')");
- ex.printStackTrace();
- }
-
- }
- });
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.javascript.JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui
- * .AlignFrame, java.lang.String)
- */
- @Override
- public void scrollViewToColumnIn(final AlignFrame alf,
- final String leftHandColumn)
- {
- java.awt.EventQueue.invokeLater(new Runnable()
- {
-
- @Override
- public void run()
- {
- try
- {
- alf.scrollToColumn(new Integer(leftHandColumn).intValue());
-
- } catch (Exception ex)
- {
- System.err
- .println("Couldn't parse integer arguments (leftHandColumn='"
- + leftHandColumn + "')");
- ex.printStackTrace();
- }
- }
- });
-
- }
-
- // //////////////////////////////////////////////
- // //////////////////////////////////////////////
-
- public static int lastFrameX = 200;
-
- public static int lastFrameY = 200;
-
- boolean fileFound = true;
-
- String file = "No file";
-
- Button launcher = new Button("Start Jalview");
-
- /**
- * The currentAlignFrame is static, it will change if and when the user
- * selects a new window. Note that it will *never* point back to the embedded
- * AlignFrame if the applet is started as embedded on the page and then
- * afterwards a new view is created.
- */
- public AlignFrame currentAlignFrame = null;
-
- /**
- * This is the first frame to be displayed, and does not change. API calls
- * will default to this instance if currentAlignFrame is null.
- */
- AlignFrame initialAlignFrame = null;
-
- boolean embedded = false;
-
- private boolean checkForJmol = true;
-
- private boolean checkedForJmol = false; // ensure we don't check for jmol
-
- // every time the app is re-inited
-
- public boolean jmolAvailable = false;
-
- private boolean alignPdbStructures = false;
-
- /**
- * use an external structure viewer exclusively (no jmols or MCViews will be
- * opened by JalviewLite itself)
- */
- public boolean useXtrnalSviewer = false;
-
- public static boolean debug = false;
-
- static String builddate = null, version = null;
-
- private static void initBuildDetails()
- {
- if (builddate == null)
- {
- builddate = "unknown";
- version = "test";
- java.net.URL url = JalviewLite.class
- .getResource("/.build_properties");
- if (url != null)
- {
- try
- {
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- url.openStream()));
- String line;
- while ((line = reader.readLine()) != null)
- {
- if (line.indexOf("VERSION") > -1)
- {
- version = line.substring(line.indexOf("=") + 1);
- }
- if (line.indexOf("BUILD_DATE") > -1)
- {
- builddate = line.substring(line.indexOf("=") + 1);
- }
- }
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- }
- }
-
- public static String getBuildDate()
- {
- initBuildDetails();
- return builddate;
- }
-
- public static String getVersion()
- {
- initBuildDetails();
- return version;
- }
-
- // public JSObject scriptObject = null;
-
- /**
- * init method for Jalview Applet
- */
- public void init()
- {
- // remove any handlers that might be hanging around from an earlier instance
- try
- {
- if (debug)
- {
- System.err.println("Applet context is '"
- + getAppletContext().getClass().toString() + "'");
- }
- JSObject scriptObject = JSObject.getWindow(this);
- if (debug && scriptObject != null)
- {
- System.err.println("Applet has Javascript callback support.");
- }
-
- } catch (Exception ex)
- {
- System.err
- .println("Warning: No JalviewLite javascript callbacks available.");
- if (debug)
- {
- ex.printStackTrace();
- }
- }
- /**
- * turn on extra applet debugging
- */
- String dbg = getParameter("debug");
- if (dbg != null)
- {
- debug = dbg.toLowerCase().equals("true");
- }
- if (debug)
- {
-
- System.err.println("JalviewLite Version " + getVersion());
- System.err.println("Build Date : " + getBuildDate());
-
- }
- String externalsviewer = getParameter("externalstructureviewer");
- if (externalsviewer != null)
- {
- useXtrnalSviewer = externalsviewer.trim().toLowerCase()
- .equals("true");
- }
- /**
- * if true disable the check for jmol
- */
- String chkforJmol = getParameter("nojmol");
- if (chkforJmol != null)
- {
- checkForJmol = !chkforJmol.equals("true");
- }
- /**
- * get the separator parameter if present
- */
- String sep = getParameter("separator");
- if (sep != null)
- {
- if (sep.length() > 0)
- {
- separator = sep;
- if (debug)
- {
- System.err.println("Separator set to '" + separator + "'");
- }
- }
- else
- {
- throw new Error(
- "Invalid separator parameter - must be non-zero length");
- }
- }
- int r = 255;
- int g = 255;
- int b = 255;
- String param = getParameter("RGB");
-
- if (param != null)
- {
- try
- {
- r = Integer.parseInt(param.substring(0, 2), 16);
- g = Integer.parseInt(param.substring(2, 4), 16);
- b = Integer.parseInt(param.substring(4, 6), 16);
- } catch (Exception ex)
- {
- r = 255;
- g = 255;
- b = 255;
- }
- }
- param = getParameter("label");
- if (param != null)
- {
- launcher.setLabel(param);
- }
-
- setBackground(new Color(r, g, b));
-
- file = getParameter("file");
-
- if (file == null)
- {
- // Maybe the sequences are added as parameters
- StringBuffer data = new StringBuffer("PASTE");
- int i = 1;
- while ((file = getParameter("sequence" + i)) != null)
- {
- data.append(file.toString() + "\n");
- i++;
- }
- if (data.length() > 5)
- {
- file = data.toString();
- }
- }
-
- final JalviewLite jvapplet = this;
- if (getParameter("embedded") != null
- && getParameter("embedded").equalsIgnoreCase("true"))
- {
- // Launch as embedded applet in page
- embedded = true;
- LoadingThread loader = new LoadingThread(file, jvapplet);
- loader.start();
- }
- else if (file != null)
- {
- if (getParameter("showbutton") == null
- || !getParameter("showbutton").equalsIgnoreCase("false"))
- {
- // Add the JalviewLite 'Button' to the page
- add(launcher);
- launcher.addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- LoadingThread loader = new LoadingThread(file, jvapplet);
- loader.start();
- }
- });
- }
- else
- {
- // Open jalviewLite immediately.
- LoadingThread loader = new LoadingThread(file, jvapplet);
- loader.start();
- }
- }
- else
- {
- // jalview initialisation with no alignment. loadAlignment() method can
- // still be called to open new alignments.
- file = "NO FILE";
- fileFound = false;
- // callInitCallback();
- }
- }
-
- private void callInitCallback()
- {
- String initjscallback = getParameter("oninit");
- if (initjscallback == null)
- {
- return;
- }
- initjscallback = initjscallback.trim();
- if (initjscallback.length() > 0)
- {
- JSObject scriptObject = null;
- try
- {
- scriptObject = JSObject.getWindow(this);
- } catch (Exception ex)
- {
- }
- ;
- if (scriptObject != null)
- {
- try
- {
- // do onInit with the JS executor thread
- new JSFunctionExec(this).executeJavascriptFunction(true,
- initjscallback, null, "Calling oninit callback '"
- + initjscallback + "'.");
- } catch (Exception e)
- {
- System.err.println("Exception when executing _oninit callback '"
- + initjscallback + "'.");
- e.printStackTrace();
- }
- }
- else
- {
- System.err.println("Not executing _oninit callback '"
- + initjscallback + "' - no scripting allowed.");
- }
- }
- }
-
- /**
- * Initialises and displays a new java.awt.Frame
- *
- * @param frame
- * java.awt.Frame to be displayed
- * @param title
- * title of new frame
- * @param width
- * width if new frame
- * @param height
- * height of new frame
- */
- public static void addFrame(final Frame frame, String title, int width,
- int height)
- {
- frame.setLocation(lastFrameX, lastFrameY);
- lastFrameX += 40;
- lastFrameY += 40;
- frame.setSize(width, height);
- frame.setTitle(title);
- frame.addWindowListener(new WindowAdapter()
- {
- public void windowClosing(WindowEvent e)
- {
- if (frame instanceof AlignFrame)
- {
- AlignViewport vp = ((AlignFrame) frame).viewport;
- ((AlignFrame) frame).closeMenuItem_actionPerformed();
- if (vp.applet.currentAlignFrame == frame)
- {
- vp.applet.currentAlignFrame = null;
- }
- vp.applet = null;
- vp = null;
-
- }
- lastFrameX -= 40;
- lastFrameY -= 40;
- if (frame instanceof EmbmenuFrame)
- {
- ((EmbmenuFrame) frame).destroyMenus();
- }
- frame.setMenuBar(null);
- frame.dispose();
- }
-
- public void windowActivated(WindowEvent e)
- {
- if (frame instanceof AlignFrame)
- {
- ((AlignFrame) frame).viewport.applet.currentAlignFrame = (AlignFrame) frame;
- if (debug)
- {
- System.err.println("Activated window " + frame);
- }
- }
- // be good.
- super.windowActivated(e);
- }
- /*
- * Probably not necessary to do this - see TODO above. (non-Javadoc)
- *
- * @see
- * java.awt.event.WindowAdapter#windowDeactivated(java.awt.event.WindowEvent
- * )
- *
- * public void windowDeactivated(WindowEvent e) { if (currentAlignFrame ==
- * frame) { currentAlignFrame = null; if (debug) {
- * System.err.println("Deactivated window "+frame); } }
- * super.windowDeactivated(e); }
- */
- });
- frame.setVisible(true);
- }
-
- /**
- * This paints the background surrounding the "Launch Jalview button" <br>
- * <br>
- * If file given in parameter not found, displays error message
- *
- * @param g
- * graphics context
- */
- public void paint(Graphics g)
- {
- if (!fileFound)
- {
- g.setColor(new Color(200, 200, 200));
- g.setColor(Color.cyan);
- g.fillRect(0, 0, getSize().width, getSize().height);
- g.setColor(Color.red);
- g.drawString("Jalview can't open file", 5, 15);
- g.drawString("\"" + file + "\"", 5, 30);
- }
- else if (embedded)
- {
- g.setColor(Color.black);
- g.setFont(new Font("Arial", Font.BOLD, 24));
- g.drawString("Jalview Applet", 50, getSize().height / 2 - 30);
- g.drawString("Loading Data...", 50, getSize().height / 2);
- }
- }
-
- /**
- * get all components associated with the applet of the given type
- *
- * @param class1
- * @return
- */
- public Vector getAppletWindow(Class class1)
- {
- Vector wnds = new Vector();
- Component[] cmp = getComponents();
- if (cmp != null)
- {
- for (int i = 0; i < cmp.length; i++)
- {
- if (class1.isAssignableFrom(cmp[i].getClass()))
- {
- wnds.addElement(cmp);
- }
- }
- }
- return wnds;
- }
-
- class LoadJmolThread extends Thread
- {
- private boolean running = false;
-
- public void run()
- {
- if (running || checkedForJmol)
- {
- return;
- }
- running = true;
- if (checkForJmol)
- {
- try
- {
- if (!System.getProperty("java.version").startsWith("1.1"))
- {
- Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter");
- jmolAvailable = true;
- }
- if (!jmolAvailable)
- {
- System.out
- .println("Jmol not available - Using MCview for structures");
- }
- } catch (java.lang.ClassNotFoundException ex)
- {
- }
- }
- else
- {
- jmolAvailable = false;
- if (debug)
- {
- System.err
- .println("Skipping Jmol check. Will use MCView (probably)");
- }
- }
- checkedForJmol = true;
- running = false;
- }
-
- public boolean notFinished()
- {
- return running || !checkedForJmol;
- }
- }
-
- class LoadingThread extends Thread
- {
- /**
- * State variable: File source
- */
- String file;
-
- /**
- * State variable: protocol for access to file source
- */
- String protocol;
-
- /**
- * State variable: format of file source
- */
- String format;
-
- String _file;
-
- JalviewLite applet;
-
- private void dbgMsg(String msg)
- {
- if (applet.debug)
- {
- System.err.println(msg);
- }
- }
-
- /**
- * update the protocol state variable for accessing the datasource located
- * by file.
- *
- * @param file
- * @return possibly updated datasource string
- */
- public String setProtocolState(String file)
- {
- if (file.startsWith("PASTE"))
- {
- file = file.substring(5);
- protocol = AppletFormatAdapter.PASTE;
- }
- else if (inArchive(file))
- {
- protocol = AppletFormatAdapter.CLASSLOADER;
- }
- else
- {
- file = addProtocol(file);
- protocol = AppletFormatAdapter.URL;
- }
- dbgMsg("Protocol identified as '" + protocol + "'");
- return file;
- }
-
- public LoadingThread(String _file, JalviewLite _applet)
- {
- this._file = _file;
- applet = _applet;
- }
-
- public void run()
- {
- LoadJmolThread jmolchecker = new LoadJmolThread();
- jmolchecker.start();
- while (jmolchecker.notFinished())
- {
- // wait around until the Jmol check is complete.
- try
- {
- Thread.sleep(2);
- } catch (Exception e)
- {
- }
- ;
- }
- startLoading();
- // applet.callInitCallback();
- }
-
- private void startLoading()
- {
- AlignFrame newAlignFrame;
- dbgMsg("Loading thread started with:\n>>file\n" + _file + ">>endfile");
- file = setProtocolState(_file);
-
- format = new jalview.io.IdentifyFile().Identify(file, protocol);
- dbgMsg("File identified as '" + format + "'");
- dbgMsg("Loading started.");
- Alignment al = null;
- try
- {
- al = new AppletFormatAdapter().readFile(file, protocol, format);
- } catch (java.io.IOException ex)
- {
- dbgMsg("File load exception.");
- ex.printStackTrace();
- if (debug)
- {
- try
- {
- FileParse fp = new FileParse(file, protocol);
- String ln = null;
- dbgMsg(">>>Dumping contents of '" + file + "' " + "("
- + protocol + ")");
- while ((ln = fp.nextLine()) != null)
- {
- dbgMsg(ln);
- }
- dbgMsg(">>>Dump finished.");
- } catch (Exception e)
- {
- System.err
- .println("Exception when trying to dump the content of the file parameter.");
- e.printStackTrace();
- }
- }
- }
- if ((al != null) && (al.getHeight() > 0))
- {
- dbgMsg("Successfully loaded file.");
- newAlignFrame = new AlignFrame(al, applet, file, embedded);
- if (initialAlignFrame == null)
- {
- initialAlignFrame = newAlignFrame;
- }
- // update the focus.
- currentAlignFrame = newAlignFrame;
-
- if (protocol == jalview.io.AppletFormatAdapter.PASTE)
- {
- newAlignFrame.setTitle("Sequences from "
- + applet.getDocumentBase());
- }
-
- newAlignFrame.statusBar.setText("Successfully loaded file " + file);
-
- String treeFile = applet.getParameter("tree");
- if (treeFile == null)
- {
- treeFile = applet.getParameter("treeFile");
- }
-
- if (treeFile != null)
- {
- try
- {
- treeFile = setProtocolState(treeFile);
- /*
- * if (inArchive(treeFile)) { protocol =
- * AppletFormatAdapter.CLASSLOADER; } else { protocol =
- * AppletFormatAdapter.URL; treeFile = addProtocol(treeFile); }
- */
- jalview.io.NewickFile fin = new jalview.io.NewickFile(treeFile,
- protocol);
-
- fin.parse();
-
- if (fin.getTree() != null)
- {
- newAlignFrame.loadTree(fin, treeFile);
- dbgMsg("Successfuly imported tree.");
- }
- else
- {
- dbgMsg("Tree parameter did not resolve to a valid tree.");
- }
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- String param = applet.getParameter("features");
- if (param != null)
- {
- param = setProtocolState(param);
-
- newAlignFrame.parseFeaturesFile(param, protocol);
- }
-
- param = applet.getParameter("showFeatureSettings");
- if (param != null && param.equalsIgnoreCase("true"))
- {
- newAlignFrame.viewport.showSequenceFeatures(true);
- new FeatureSettings(newAlignFrame.alignPanel);
- }
-
- param = applet.getParameter("annotations");
- if (param != null)
- {
- param = setProtocolState(param);
-
- if (new AnnotationFile().readAnnotationFile(
- newAlignFrame.viewport.getAlignment(), param, protocol))
- {
- newAlignFrame.alignPanel.fontChanged();
- newAlignFrame.alignPanel.setScrollValues(0, 0);
- }
- else
- {
- System.err
- .println("Annotations were not added from annotation file '"
- + param + "'");
- }
-
- }
-
- param = applet.getParameter("jnetfile");
- if (param != null)
- {
- try
- {
- param = setProtocolState(param);
- jalview.io.JPredFile predictions = new jalview.io.JPredFile(
- param, protocol);
- JnetAnnotationMaker.add_annotation(predictions,
- newAlignFrame.viewport.getAlignment(), 0, false); // false==do
- // not
- // add
- // sequence
- // profile
- // from
- // concise
- // output
- newAlignFrame.alignPanel.fontChanged();
- newAlignFrame.alignPanel.setScrollValues(0, 0);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- /*
- * <param name="alignpdbfiles" value="false/true"/> Undocumented for 2.6
- * - related to JAL-434
- */
- applet.setAlignPdbStructures(getDefaultParameter("alignpdbfiles",
- false));
- /*
- * <param name="PDBfile" value="1gaq.txt PDB|1GAQ|1GAQ|A PDB|1GAQ|1GAQ|B
- * PDB|1GAQ|1GAQ|C">
- *
- * <param name="PDBfile2" value="1gaq.txt A=SEQA B=SEQB C=SEQB">
- *
- * <param name="PDBfile3" value="1q0o Q45135_9MICO">
- */
-
- int pdbFileCount = 0;
- // Accumulate pdbs here if they are heading for the same view (if
- // alignPdbStructures is true)
- Vector pdbs = new Vector();
- // create a lazy matcher if we're asked to
- jalview.analysis.SequenceIdMatcher matcher = (applet
- .getDefaultParameter("relaxedidmatch", false)) ? new jalview.analysis.SequenceIdMatcher(
- newAlignFrame.getAlignViewport().getAlignment()
- .getSequencesArray()) : null;
-
- do
- {
- if (pdbFileCount > 0)
- {
- param = applet.getParameter("PDBFILE" + pdbFileCount);
- }
- else
- {
- param = applet.getParameter("PDBFILE");
- }
-
- if (param != null)
- {
- PDBEntry pdb = new PDBEntry();
-
- String seqstring;
- SequenceI[] seqs = null;
- String[] chains = null;
-
- StringTokenizer st = new StringTokenizer(param, " ");
-
- if (st.countTokens() < 2)
- {
- String sequence = applet.getParameter("PDBSEQ");
- if (sequence != null)
- seqs = new SequenceI[]
- { matcher == null ? (Sequence) newAlignFrame
- .getAlignViewport().getAlignment()
- .findName(sequence) : matcher.findIdMatch(sequence) };
-
- }
- else
- {
- param = st.nextToken();
- Vector tmp = new Vector();
- Vector tmp2 = new Vector();
-
- while (st.hasMoreTokens())
- {
- seqstring = st.nextToken();
- StringTokenizer st2 = new StringTokenizer(seqstring, "=");
- if (st2.countTokens() > 1)
- {
- // This is the chain
- tmp2.addElement(st2.nextToken());
- seqstring = st2.nextToken();
- }
- tmp.addElement(matcher == null ? (Sequence) newAlignFrame
- .getAlignViewport().getAlignment()
- .findName(seqstring) : matcher
- .findIdMatch(seqstring));
- }
-
- seqs = new SequenceI[tmp.size()];
- tmp.copyInto(seqs);
- if (tmp2.size() == tmp.size())
- {
- chains = new String[tmp2.size()];
- tmp2.copyInto(chains);
- }
- }
- param = setProtocolState(param);
-
- if (// !jmolAvailable
- // &&
- protocol == AppletFormatAdapter.CLASSLOADER
- && !useXtrnalSviewer)
- {
- // Re: JAL-357 : the bug isn't a problem if we are using an
- // external viewer!
- // TODO: verify this Re:
- // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605
- // This exception preserves the current behaviour where, even if
- // the local pdb file was identified in the class loader
- protocol = AppletFormatAdapter.URL; // this is probably NOT
- // CORRECT!
- param = addProtocol(param); //
- }
-
- pdb.setFile(param);
-
- if (seqs != null)
- {
- for (int i = 0; i < seqs.length; i++)
- {
- if (seqs[i] != null)
- {
- ((Sequence) seqs[i]).addPDBId(pdb);
- }
- else
- {
- if (JalviewLite.debug)
- {
- // this may not really be a problem but we give a warning
- // anyway
- System.err
- .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence "
- + i + ")");
- }
- }
- }
-
- if (!alignPdbStructures)
- {
- newAlignFrame.newStructureView(applet, pdb, seqs, chains,
- protocol);
- }
- else
- {
- pdbs.addElement(new Object[]
- { pdb, seqs, chains, new String(protocol) });
- }
- }
- }
-
- pdbFileCount++;
- } while (param != null || pdbFileCount < 10);
- if (pdbs.size() > 0)
- {
- SequenceI[][] seqs = new SequenceI[pdbs.size()][];
- PDBEntry[] pdb = new PDBEntry[pdbs.size()];
- String[][] chains = new String[pdbs.size()][];
- String[] protocols = new String[pdbs.size()];
- for (int pdbsi = 0, pdbsiSize = pdbs.size(); pdbsi < pdbsiSize; pdbsi++)
- {
- Object[] o = (Object[]) pdbs.elementAt(pdbsi);
- pdb[pdbsi] = (PDBEntry) o[0];
- seqs[pdbsi] = (SequenceI[]) o[1];
- chains[pdbsi] = (String[]) o[2];
- protocols[pdbsi] = (String) o[3];
- }
- newAlignFrame.alignedStructureView(applet, pdb, seqs, chains,
- protocols);
-
- }
- // ///////////////////////////
- // modify display of features
- //
- // hide specific groups
- param = applet.getParameter("hidefeaturegroups");
- if (param != null)
- {
- applet.setFeatureGroupStateOn(newAlignFrame, param, false);
- }
- // show specific groups
- param = applet.getParameter("showfeaturegroups");
- if (param != null)
- {
- applet.setFeatureGroupStateOn(newAlignFrame, param, true);
- }
- }
- else
- {
- fileFound = false;
- applet.remove(launcher);
- applet.repaint();
- }
- callInitCallback();
- }
-
- /**
- * Discovers whether the given file is in the Applet Archive
- *
- * @param file
- * String
- * @return boolean
- */
- boolean inArchive(String file)
- {
- // This might throw a security exception in certain browsers
- // Netscape Communicator for instance.
- try
- {
- boolean rtn = (getClass().getResourceAsStream("/" + file) != null);
- if (debug)
- {
- System.err.println("Resource '" + file + "' was "
- + (rtn ? "" : "not") + " located by classloader.");
- }
- return rtn;
- } catch (Exception ex)
- {
- System.out.println("Exception checking resources: " + file + " "
- + ex);
- return false;
- }
- }
-
- String addProtocol(String file)
- {
- if (file.indexOf("://") == -1)
- {
- String fl = applet.resolveUrlForLocalOrAbsolute(file,
- getDocumentBase());
- try
- {
- if (new java.net.URL(fl).openStream() != null)
- {
- if (debug)
- {
- System.err.println("Prepended document base for resource: '"
- + file + "'");
- }
- return fl;
- }
- } catch (Exception x)
- {
- }
- ;
- fl = applet.resolveUrlForLocalOrAbsolute(file, getCodeBase());
- try
- {
- if (new java.net.URL(fl).openStream() != null)
- {
- if (debug)
- {
- System.err.println("Prepended codebase for resource: '"
- + file + "'");
- }
- return fl;
- }
- } catch (Exception x)
- {
- }
- ;
-
- }
-
- return file;
- }
- }
-
- /**
- * @return the default alignFrame acted on by the public applet methods. May
- * return null with an error message on System.err indicating the
- * fact.
- */
- public AlignFrame getDefaultTargetFrame()
- {
- if (currentAlignFrame != null)
- {
- return currentAlignFrame;
- }
- if (initialAlignFrame != null)
- {
- return initialAlignFrame;
- }
- System.err
- .println("Implementation error: Jalview Applet API cannot work out which AlignFrame to use.");
- return null;
- }
-
- /**
- * separator used for separatorList
- */
- protected String separator = "" + ((char) 0x00AC); // the default used to be
- // '|' but many sequence
- // IDS include pipes.
-
- /**
- * set to enable the URL based javascript execution mechanism
- */
- public boolean jsfallbackEnabled = false;
-
- /**
- * parse the string into a list
- *
- * @param list
- * @return elements separated by separator
- */
- public String[] separatorListToArray(String list)
- {
- return separatorListToArray(list, separator);
- }
-
- /**
- * parse the string into a list
- *
- * @param list
- * @param separator
- * @return elements separated by separator
- */
- public String[] separatorListToArray(String list, String separator)
- {
- // note separator local variable intentionally masks object field
- int seplen = separator.length();
- if (list == null || list.equals("") || list.equals(separator))
- return null;
- java.util.Vector jv = new Vector();
- int cp = 0, pos;
- while ((pos = list.indexOf(separator, cp)) > cp)
- {
- jv.addElement(list.substring(cp, pos));
- cp = pos + seplen;
- }
- if (cp < list.length())
- {
- String c = list.substring(cp);
- if (!c.equals(separator))
- {
- jv.addElement(c);
- }
- }
- if (jv.size() > 0)
- {
- String[] v = new String[jv.size()];
- for (int i = 0; i < v.length; i++)
- {
- v[i] = (String) jv.elementAt(i);
- }
- jv.removeAllElements();
- if (debug)
- {
- System.err.println("Array from '" + separator
- + "' separated List:\n" + v.length);
- for (int i = 0; i < v.length; i++)
- {
- System.err.println("item " + i + " '" + v[i] + "'");
- }
- }
- return v;
- }
- if (debug)
- {
- System.err.println("Empty Array from '" + separator
- + "' separated List");
- }
- return null;
- }
-
- /**
- * concatenate the list with separator
- *
- * @param list
- * @return concatenated string
- */
- public String arrayToSeparatorList(String[] list)
- {
- return arrayToSeparatorList(list, separator);
- }
-
- /**
- * concatenate the list with separator
- *
- * @param list
- * @param separator
- * @return concatenated string
- */
- public String arrayToSeparatorList(String[] list, String separator)
- {
- StringBuffer v = new StringBuffer();
- if (list != null && list.length > 0)
- {
- for (int i = 0, iSize = list.length; i < iSize; i++)
- {
- if (list[i] != null)
- {
- if (i > 0)
- {
- v.append(separator);
- }
- v.append(list[i]);
- }
- }
- if (debug)
- {
- System.err.println("Returning '" + separator
- + "' separated List:\n");
- System.err.println(v);
- }
- return v.toString();
- }
- if (debug)
- {
- System.err.println("Returning empty '" + separator
- + "' separated List\n");
- }
- return "" + separator;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getFeatureGroups()
- */
- public String getFeatureGroups()
- {
- String lst = arrayToSeparatorList(getDefaultTargetFrame()
- .getFeatureGroups());
- return lst;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOn(jalview.appletgui.AlignFrame
- * )
- */
- public String getFeatureGroupsOn(AlignFrame alf)
- {
- String lst = arrayToSeparatorList(alf.getFeatureGroups());
- return lst;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfState(boolean)
- */
- public String getFeatureGroupsOfState(boolean visible)
- {
- return arrayToSeparatorList(getDefaultTargetFrame()
- .getFeatureGroupsOfState(visible));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfStateOn(jalview.appletgui
- * .AlignFrame, boolean)
- */
- public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)
- {
- return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupStateOn(jalview.appletgui.
- * AlignFrame, java.lang.String, boolean)
- */
- public void setFeatureGroupStateOn(final AlignFrame alf,
- final String groups, boolean state)
- {
- final boolean st = state;// !(state==null || state.equals("") ||
- // state.toLowerCase().equals("false"));
- java.awt.EventQueue.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- alf.setFeatureGroupState(separatorListToArray(groups), st);
- }
- });
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupState(java.lang.String,
- * boolean)
- */
- public void setFeatureGroupState(String groups, boolean state)
- {
- setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getSeparator()
- */
- public String getSeparator()
- {
- return separator;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#setSeparator(java.lang.String)
- */
- public void setSeparator(String separator)
- {
- if (separator == null || separator.length() < 1)
- {
- // reset to default
- separator = "" + ((char) 0x00AC);
- }
- this.separator = separator;
- if (debug)
- {
- System.err.println("Default Separator now: '" + separator + "'");
- }
- }
-
- /**
- * get boolean value of applet parameter 'name' and return default if
- * parameter is not set
- *
- * @param name
- * name of paremeter
- * @param def
- * the value to return otherwise
- * @return true or false
- */
- public boolean getDefaultParameter(String name, boolean def)
- {
- String stn;
- if ((stn = getParameter(name)) == null)
- {
- return def;
- }
- if (stn.toLowerCase().equals("true"))
- {
- return true;
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#addPdbFile(jalview.appletgui.AlignFrame,
- * java.lang.String, java.lang.String, java.lang.String)
- */
- public boolean addPdbFile(AlignFrame alFrame, String sequenceId,
- String pdbEntryString, String pdbFile)
- {
- return alFrame.addPdbFile(sequenceId, pdbEntryString, pdbFile);
- }
-
- protected void setAlignPdbStructures(boolean alignPdbStructures)
- {
- this.alignPdbStructures = alignPdbStructures;
- }
-
- public boolean isAlignPdbStructures()
- {
- return alignPdbStructures;
- }
-
- public void start()
- {
- // callInitCallback();
- }
-
- private Hashtable<String, long[]> jshashes = new Hashtable<String, long[]>();
-
- private Hashtable<String, Hashtable<String, String[]>> jsmessages = new Hashtable<String, Hashtable<String, String[]>>();
-
- public void setJsMessageSet(String messageclass, String viewId,
- String[] colcommands)
- {
- Hashtable<String, String[]> msgset = jsmessages.get(messageclass);
- if (msgset == null)
- {
- msgset = new Hashtable<String, String[]>();
- jsmessages.put(messageclass, msgset);
- }
- msgset.put(viewId, colcommands);
- long[] l = new long[colcommands.length];
- for (int i = 0; i < colcommands.length; i++)
- {
- l[i] = colcommands[i].hashCode();
- }
- jshashes.put(messageclass + "|" + viewId, l);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getJsMessage(java.lang.String,
- * java.lang.String)
- */
- public String getJsMessage(String messageclass, String viewId)
- {
- Hashtable<String, String[]> msgset = jsmessages.get(messageclass);
- if (msgset != null)
- {
- String[] msgs = msgset.get(viewId);
- if (msgs != null)
- {
- for (int i = 0; i < msgs.length; i++)
- {
- if (msgs[i] != null)
- {
- String m = msgs[i];
- msgs[i] = null;
- return m;
- }
- }
- }
- }
- return "";
- }
-
- public boolean isJsMessageSetChanged(String string, String string2,
- String[] colcommands)
- {
- long[] l = jshashes.get(string + "|" + string2);
- if (l == null && colcommands != null)
- {
- return true;
- }
- for (int i = 0; i < colcommands.length; i++)
- {
- if (l[i] != colcommands[i].hashCode())
- {
- return true;
- }
- }
- return false;
- }
-
- private Vector jsExecQueue = new Vector();
-
- public Vector getJsExecQueue()
- {
- return jsExecQueue;
- }
-
- public void setExecutor(JSFunctionExec jsFunctionExec2)
- {
- jsFunctionExec = jsFunctionExec2;
- }
-
- /**
- * return the given colour value parameter or the given default if parameter
- * not given
- *
- * @param colparam
- * @param defcolour
- * @return
- */
- public Color getDefaultColourParameter(String colparam, Color defcolour)
- {
- String colprop = getParameter(colparam);
- if (colprop == null || colprop.trim().length() == 0)
- {
- return defcolour;
- }
- Color col = jalview.schemes.ColourSchemeProperty
- .getAWTColorFromName(colprop);
- if (col == null)
- {
- try
- {
- col = new jalview.schemes.UserColourScheme(colprop).findColour('A');
- } catch (Exception ex)
- {
- System.err.println("Couldn't parse '" + colprop
- + "' as a colour for " + colparam);
- col = null;
- }
- }
- return (col == null) ? defcolour : col;
-
- }
-
- public void openJalviewHelpUrl()
- {
- String helpUrl = getParameter("jalviewhelpurl");
- if (helpUrl == null || helpUrl.trim().length() < 5)
- {
- helpUrl = "http://www.jalview.org/help.html";
- }
- showURL(helpUrl, "HELP");
- }
-
- /**
- * form a complete URL given a path to a resource and a reference location on
- * the same server
- *
- * @param url
- * - an absolute path on the same server as localref or a document
- * located relative to localref
- * @param localref
- * - a URL on the same server as url
- * @return a complete URL for the resource located by url
- */
- private String resolveUrlForLocalOrAbsolute(String url, URL localref)
- {
- String codebase = localref.toString();
- if (url.indexOf("/") == 0)
- {
- url = codebase.substring(0, codebase.length()
- - localref.getFile().length())
- + url;
- }
- else
- {
- url = localref + url;
- }
- return url;
- }
-
- /**
- * open a URL in the browser - resolving it according to relative refs and
- * coping with javascript: protocol if necessary.
- *
- * @param url
- * @param target
- */
- public void showURL(String url, String target)
- {
- try
- {
- if (url.indexOf(":") == -1)
- {
- // TODO: verify (Bas Vroling bug) prepend codebase or server URL to
- // form valid URL
- // Should really use docbase, not codebase.
- URL prepend;
- url = resolveUrlForLocalOrAbsolute(
- url,
- prepend = getDefaultParameter("resolvetocodebase", false) ? getDocumentBase()
- : getCodeBase());
- if (debug)
- {
- System.err
- .println("Show url (prepended "
- + prepend
- + " - toggle resolvetocodebase if code/docbase resolution is wrong): "
- + url);
- }
- }
- else
- {
- if (debug)
- {
- System.err.println("Show url: " + url);
- }
- }
- if (url.indexOf("javascript:") == 0)
- {
- // no target for the javascript context
- getAppletContext().showDocument(new java.net.URL(url));
- }
- else
- {
- getAppletContext().showDocument(new java.net.URL(url), target);
- }
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- /**
- * bind structures in a viewer to any matching sequences in an alignFrame (use
- * sequenceIds to limit scope of search to specific sequences)
- *
- * @param alFrame
- * @param viewer
- * @param sequenceIds
- * @return TODO: consider making an exception structure for indicating when
- * binding fails public SequenceStructureBinding
- * addStructureViewInstance( AlignFrame alFrame, Object viewer, String
- * sequenceIds) {
- *
- * if (sequenceIds != null && sequenceIds.length() > 0) { return
- * alFrame.addStructureViewInstance(viewer,
- * separatorListToArray(sequenceIds)); } else { return
- * alFrame.addStructureViewInstance(viewer, null); } // return null; }
- */
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.bin;
+
+import jalview.analysis.AlignmentUtils;
+import jalview.api.StructureSelectionManagerProvider;
+import jalview.appletgui.AlignFrame;
+import jalview.appletgui.AlignViewport;
+import jalview.appletgui.EmbmenuFrame;
+import jalview.appletgui.FeatureSettings;
+import jalview.appletgui.SplitFrame;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentOrder;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.io.AnnotationFile;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.FileParse;
+import jalview.io.IdentifyFile;
+import jalview.io.JPredFile;
+import jalview.io.JnetAnnotationMaker;
+import jalview.io.NewickFile;
+import jalview.javascript.JSFunctionExec;
+import jalview.javascript.JalviewLiteJsApi;
+import jalview.javascript.JsCallBack;
+import jalview.structure.SelectionListener;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+
+import java.applet.Applet;
+import java.awt.Button;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import netscape.javascript.JSObject;
+
+/**
+ * Jalview Applet. Runs in Java 1.18 runtime
+ *
+ * @author $author$
+ * @version $Revision: 1.92 $
+ */
+public class JalviewLite extends Applet implements
+ StructureSelectionManagerProvider, JalviewLiteJsApi
+{
+
+ private static final String TRUE = "true";
+
+ private static final String FALSE = "false";
+
+ public StructureSelectionManager getStructureSelectionManager()
+ {
+ return StructureSelectionManager.getStructureSelectionManager(this);
+ }
+
+ // /////////////////////////////////////////
+ // The following public methods maybe called
+ // externally, eg via javascript in HTML page
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences()
+ */
+ public String getSelectedSequences()
+ {
+ return getSelectedSequencesFrom(getDefaultTargetFrame());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences(java.lang.String)
+ */
+ public String getSelectedSequences(String sep)
+ {
+ return getSelectedSequencesFrom(getDefaultTargetFrame(), sep);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui
+ * .AlignFrame)
+ */
+ public String getSelectedSequencesFrom(AlignFrame alf)
+ {
+ return getSelectedSequencesFrom(alf, separator); // ""+0x00AC);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui
+ * .AlignFrame, java.lang.String)
+ */
+ public String getSelectedSequencesFrom(AlignFrame alf, String sep)
+ {
+ StringBuffer result = new StringBuffer("");
+ if (sep == null || sep.length() == 0)
+ {
+ sep = separator; // "+0x00AC;
+ }
+ if (alf.viewport.getSelectionGroup() != null)
+ {
+ SequenceI[] seqs = alf.viewport.getSelectionGroup()
+ .getSequencesInOrder(alf.viewport.getAlignment());
+
+ for (int i = 0; i < seqs.length; i++)
+ {
+ result.append(seqs[i].getName());
+ result.append(sep);
+ }
+ }
+
+ return result.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#highlight(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void highlight(String sequenceId, String position,
+ String alignedPosition)
+ {
+ highlightIn(getDefaultTargetFrame(), sequenceId, position,
+ alignedPosition);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#highlightIn(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void highlightIn(final AlignFrame alf, final String sequenceId,
+ final String position, final String alignedPosition)
+ {
+ // TODO: could try to highlight in all alignments if alf==null
+ jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
+ alf.viewport.getAlignment().getSequencesArray());
+ final SequenceI sq = matcher.findIdMatch(sequenceId);
+ if (sq != null)
+ {
+ int apos = -1;
+ try
+ {
+ apos = new Integer(position).intValue();
+ apos--;
+ } catch (NumberFormatException ex)
+ {
+ return;
+ }
+ final StructureSelectionManagerProvider me = this;
+ final int pos = apos;
+ // use vamsas listener to broadcast to all listeners in scope
+ if (alignedPosition != null
+ && (alignedPosition.trim().length() == 0 || alignedPosition
+ .toLowerCase().indexOf("false") > -1))
+ {
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ StructureSelectionManager.getStructureSelectionManager(me)
+ .mouseOverVamsasSequence(sq, sq.findIndex(pos), null);
+ }
+ });
+ }
+ else
+ {
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ StructureSelectionManager.getStructureSelectionManager(me)
+ .mouseOverVamsasSequence(sq, pos, null);
+ }
+ });
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,
+ * java.lang.String)
+ */
+ public void select(String sequenceIds, String columns)
+ {
+ selectIn(getDefaultTargetFrame(), sequenceIds, columns, separator);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void select(String sequenceIds, String columns, String sep)
+ {
+ selectIn(getDefaultTargetFrame(), sequenceIds, columns, sep);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String)
+ */
+ public void selectIn(AlignFrame alf, String sequenceIds, String columns)
+ {
+ selectIn(alf, sequenceIds, columns, separator);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void selectIn(final AlignFrame alf, String sequenceIds,
+ String columns, String sep)
+ {
+ if (sep == null || sep.length() == 0)
+ {
+ sep = separator;
+ }
+ else
+ {
+ if (debug)
+ {
+ System.err.println("Selecting region using separator string '"
+ + separator + "'");
+ }
+ }
+ // deparse fields
+ String[] ids = separatorListToArray(sequenceIds, sep);
+ String[] cols = separatorListToArray(columns, sep);
+ final SequenceGroup sel = new SequenceGroup();
+ final ColumnSelection csel = new ColumnSelection();
+ AlignmentI al = alf.viewport.getAlignment();
+ jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
+ alf.viewport.getAlignment().getSequencesArray());
+ int start = 0, end = al.getWidth(), alw = al.getWidth();
+ boolean seqsfound = true;
+ if (ids != null && ids.length > 0)
+ {
+ seqsfound = false;
+ for (int i = 0; i < ids.length; i++)
+ {
+ if (ids[i].trim().length() == 0)
+ {
+ continue;
+ }
+ SequenceI sq = matcher.findIdMatch(ids[i]);
+ if (sq != null)
+ {
+ seqsfound = true;
+ sel.addSequence(sq, false);
+ }
+ }
+ }
+ boolean inseqpos = false;
+ if (cols != null && cols.length > 0)
+ {
+ boolean seset = false;
+ for (int i = 0; i < cols.length; i++)
+ {
+ String cl = cols[i].trim();
+ if (cl.length() == 0)
+ {
+ continue;
+ }
+ int p;
+ if ((p = cl.indexOf("-")) > -1)
+ {
+ int from = -1, to = -1;
+ try
+ {
+ from = new Integer(cl.substring(0, p)).intValue();
+ from--;
+ } catch (NumberFormatException ex)
+ {
+ System.err
+ .println("ERROR: Couldn't parse first integer in range element column selection string '"
+ + cl + "' - format is 'from-to'");
+ return;
+ }
+ try
+ {
+ to = new Integer(cl.substring(p + 1)).intValue();
+ to--;
+ } catch (NumberFormatException ex)
+ {
+ System.err
+ .println("ERROR: Couldn't parse second integer in range element column selection string '"
+ + cl + "' - format is 'from-to'");
+ return;
+ }
+ if (from >= 0 && to >= 0)
+ {
+ // valid range
+ if (from < to)
+ {
+ int t = to;
+ to = from;
+ to = t;
+ }
+ if (!seset)
+ {
+ start = from;
+ end = to;
+ seset = true;
+ }
+ else
+ {
+ // comment to prevent range extension
+ if (start > from)
+ {
+ start = from;
+ }
+ if (end < to)
+ {
+ end = to;
+ }
+ }
+ for (int r = from; r <= to; r++)
+ {
+ if (r >= 0 && r < alw)
+ {
+ csel.addElement(r);
+ }
+ }
+ if (debug)
+ {
+ System.err.println("Range '" + cl + "' deparsed as [" + from
+ + "," + to + "]");
+ }
+ }
+ else
+ {
+ System.err.println("ERROR: Invalid Range '" + cl
+ + "' deparsed as [" + from + "," + to + "]");
+ }
+ }
+ else
+ {
+ int r = -1;
+ try
+ {
+ r = new Integer(cl).intValue();
+ r--;
+ } catch (NumberFormatException ex)
+ {
+ if (cl.toLowerCase().equals("sequence"))
+ {
+ // we are in the dataset sequence's coordinate frame.
+ inseqpos = true;
+ }
+ else
+ {
+ System.err
+ .println("ERROR: Couldn't parse integer from point selection element of column selection string '"
+ + cl + "'");
+ return;
+ }
+ }
+ if (r >= 0 && r <= alw)
+ {
+ if (!seset)
+ {
+ start = r;
+ end = r;
+ seset = true;
+ }
+ else
+ {
+ // comment to prevent range extension
+ if (start > r)
+ {
+ start = r;
+ }
+ if (end < r)
+ {
+ end = r;
+ }
+ }
+ csel.addElement(r);
+ if (debug)
+ {
+ System.err.println("Point selection '" + cl
+ + "' deparsed as [" + r + "]");
+ }
+ }
+ else
+ {
+ System.err.println("ERROR: Invalid Point selection '" + cl
+ + "' deparsed as [" + r + "]");
+ }
+ }
+ }
+ }
+ if (seqsfound)
+ {
+ // we only propagate the selection when it was the null selection, or the
+ // given sequences were found in the alignment.
+ if (inseqpos && sel.getSize() > 0)
+ {
+ // assume first sequence provides reference frame ?
+ SequenceI rs = sel.getSequenceAt(0);
+ start = rs.findIndex(start);
+ end = rs.findIndex(end);
+ if (csel != null)
+ {
+ List<Integer> cs = csel.getSelected();
+ csel.clear();
+ for (Integer selectedCol : cs)
+ {
+ csel.addElement(rs.findIndex(selectedCol));
+ }
+ }
+ }
+ sel.setStartRes(start);
+ sel.setEndRes(end);
+ EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ alf.select(sel, csel);
+ }
+ });
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignment(java.lang.
+ * String, java.lang.String)
+ */
+ public String getSelectedSequencesAsAlignment(String format, String suffix)
+ {
+ return getSelectedSequencesAsAlignmentFrom(getDefaultTargetFrame(),
+ format, suffix);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignmentFrom(jalview
+ * .appletgui.AlignFrame, java.lang.String, java.lang.String)
+ */
+ public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf,
+ String format, String suffix)
+ {
+ try
+ {
+ boolean seqlimits = suffix.equalsIgnoreCase(TRUE);
+ if (alf.viewport.getSelectionGroup() != null)
+ {
+ // JBPNote: getSelectionAsNewSequence behaviour has changed - this
+ // method now returns a full copy of sequence data
+ // TODO consider using getSequenceSelection instead here
+ String reply = new AppletFormatAdapter().formatSequences(format,
+ new Alignment(alf.viewport.getSelectionAsNewSequence()),
+ seqlimits);
+ return reply;
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return "Error retrieving alignment in " + format + " format. ";
+ }
+ return "";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrder()
+ */
+ public String getAlignmentOrder()
+ {
+ return getAlignmentOrderFrom(getDefaultTargetFrame());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame
+ * )
+ */
+ public String getAlignmentOrderFrom(AlignFrame alf)
+ {
+ return getAlignmentOrderFrom(alf, separator);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public String getAlignmentOrderFrom(AlignFrame alf, String sep)
+ {
+ AlignmentI alorder = alf.getAlignViewport().getAlignment();
+ String[] order = new String[alorder.getHeight()];
+ for (int i = 0; i < order.length; i++)
+ {
+ order[i] = alorder.getSequenceAt(i).getName();
+ }
+ return arrayToSeparatorList(order);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,
+ * java.lang.String)
+ */
+ public String orderBy(String order, String undoName)
+ {
+ return orderBy(order, undoName, separator);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public String orderBy(String order, String undoName, String sep)
+ {
+ return orderAlignmentBy(getDefaultTargetFrame(), order, undoName, sep);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#orderAlignmentBy(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String, java.lang.String)
+ */
+ public String orderAlignmentBy(AlignFrame alf, String order,
+ String undoName, String sep)
+ {
+ String[] ids = separatorListToArray(order, sep);
+ SequenceI[] sqs = null;
+ if (ids != null && ids.length > 0)
+ {
+ jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
+ alf.viewport.getAlignment().getSequencesArray());
+ int s = 0;
+ sqs = new SequenceI[ids.length];
+ for (int i = 0; i < ids.length; i++)
+ {
+ if (ids[i].trim().length() == 0)
+ {
+ continue;
+ }
+ SequenceI sq = matcher.findIdMatch(ids[i]);
+ if (sq != null)
+ {
+ sqs[s++] = sq;
+ }
+ }
+ if (s > 0)
+ {
+ SequenceI[] sqq = new SequenceI[s];
+ System.arraycopy(sqs, 0, sqq, 0, s);
+ sqs = sqq;
+ }
+ else
+ {
+ sqs = null;
+ }
+ }
+ if (sqs == null)
+ {
+ return "";
+ }
+ ;
+ final AlignmentOrder aorder = new AlignmentOrder(sqs);
+
+ if (undoName != null && undoName.trim().length() == 0)
+ {
+ undoName = null;
+ }
+ final String _undoName = undoName;
+ // TODO: deal with synchronization here: cannot raise any events until after
+ // this has returned.
+ return alf.sortBy(aorder, _undoName) ? TRUE : "";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String)
+ */
+ public String getAlignment(String format)
+ {
+ return getAlignmentFrom(getDefaultTargetFrame(), format, TRUE);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,
+ * java.lang.String)
+ */
+ public String getAlignmentFrom(AlignFrame alf, String format)
+ {
+ return getAlignmentFrom(alf, format, TRUE);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String,
+ * java.lang.String)
+ */
+ public String getAlignment(String format, String suffix)
+ {
+ return getAlignmentFrom(getDefaultTargetFrame(), format, suffix);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String)
+ */
+ public String getAlignmentFrom(AlignFrame alf, String format,
+ String suffix)
+ {
+ try
+ {
+ boolean seqlimits = suffix.equalsIgnoreCase(TRUE);
+
+ String reply = new AppletFormatAdapter().formatSequences(format,
+ alf.viewport.getAlignment(), seqlimits);
+ return reply;
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return "Error retrieving alignment in " + format + " format. ";
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String)
+ */
+ public void loadAnnotation(String annotation)
+ {
+ loadAnnotationFrom(getDefaultTargetFrame(), annotation);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public void loadAnnotationFrom(AlignFrame alf, String annotation)
+ {
+ if (new AnnotationFile().annotateAlignmentView(alf.getAlignViewport(),
+ annotation, AppletFormatAdapter.PASTE))
+ {
+ alf.alignPanel.fontChanged();
+ alf.alignPanel.setScrollValues(0, 0);
+ }
+ else
+ {
+ alf.parseFeaturesFile(annotation, AppletFormatAdapter.PASTE);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String)
+ */
+ public void loadFeatures(String features, boolean autoenabledisplay)
+ {
+ loadFeaturesFrom(getDefaultTargetFrame(), features, autoenabledisplay);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public boolean loadFeaturesFrom(AlignFrame alf, String features,
+ boolean autoenabledisplay)
+ {
+ return alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE,
+ autoenabledisplay);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getFeatures(java.lang.String)
+ */
+ public String getFeatures(String format)
+ {
+ return getFeaturesFrom(getDefaultTargetFrame(), format);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getFeaturesFrom(jalview.appletgui.AlignFrame,
+ * java.lang.String)
+ */
+ public String getFeaturesFrom(AlignFrame alf, String format)
+ {
+ return alf.outputFeatures(false, format);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getAnnotation()
+ */
+ public String getAnnotation()
+ {
+ return getAnnotationFrom(getDefaultTargetFrame());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAnnotationFrom(jalview.appletgui.AlignFrame
+ * )
+ */
+ public String getAnnotationFrom(AlignFrame alf)
+ {
+ return alf.outputAnnotations(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#newView()
+ */
+ public AlignFrame newView()
+ {
+ return newViewFrom(getDefaultTargetFrame());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#newView(java.lang.String)
+ */
+ public AlignFrame newView(String name)
+ {
+ return newViewFrom(getDefaultTargetFrame(), name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame)
+ */
+ public AlignFrame newViewFrom(AlignFrame alf)
+ {
+ return alf.newView(null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame,
+ * java.lang.String)
+ */
+ public AlignFrame newViewFrom(AlignFrame alf, String name)
+ {
+ return alf.newView(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#loadAlignment(java.lang.String,
+ * java.lang.String)
+ */
+ public AlignFrame loadAlignment(String text, String title)
+ {
+ AlignmentI al = null;
+
+ String format = new IdentifyFile().Identify(text,
+ AppletFormatAdapter.PASTE);
+ try
+ {
+ al = new AppletFormatAdapter().readFile(text,
+ AppletFormatAdapter.PASTE, format);
+ if (al.getHeight() > 0)
+ {
+ return new AlignFrame(al, this, title, false);
+ }
+ } catch (java.io.IOException ex)
+ {
+ ex.printStackTrace();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(java.lang.String)
+ */
+ public void setMouseoverListener(String listener)
+ {
+ setMouseoverListener(currentAlignFrame, listener);
+ }
+
+ private Vector<jalview.javascript.JSFunctionExec> javascriptListeners = new Vector<jalview.javascript.JSFunctionExec>();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#setMouseoverListener(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public void setMouseoverListener(AlignFrame af, String listener)
+ {
+ if (listener != null)
+ {
+ listener = listener.trim();
+ if (listener.length() == 0)
+ {
+ System.err
+ .println("jalview Javascript error: Ignoring empty function for mouseover listener.");
+ return;
+ }
+ }
+ jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener(
+ this, af, listener);
+ javascriptListeners.addElement(mol);
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .addStructureViewerListener(mol);
+ if (debug)
+ {
+ System.err.println("Added a mouseover listener for "
+ + ((af == null) ? "All frames" : "Just views for "
+ + af.getAlignViewport().getSequenceSetId()));
+ System.err.println("There are now " + javascriptListeners.size()
+ + " listeners in total.");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setSelectionListener(java.lang.String)
+ */
+ public void setSelectionListener(String listener)
+ {
+ setSelectionListener(null, listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#setSelectionListener(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public void setSelectionListener(AlignFrame af, String listener)
+ {
+ if (listener != null)
+ {
+ listener = listener.trim();
+ if (listener.length() == 0)
+ {
+ System.err
+ .println("jalview Javascript error: Ignoring empty function for selection listener.");
+ return;
+ }
+ }
+ jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender(
+ this, af, listener);
+ javascriptListeners.addElement(mol);
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .addSelectionListener(mol);
+ if (debug)
+ {
+ System.err.println("Added a selection listener for "
+ + ((af == null) ? "All frames" : "Just views for "
+ + af.getAlignViewport().getSequenceSetId()));
+ System.err.println("There are now " + javascriptListeners.size()
+ + " listeners in total.");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String,
+ * java.lang.String)
+ */
+ public void setStructureListener(String listener, String modelSet)
+ {
+ if (listener != null)
+ {
+ listener = listener.trim();
+ if (listener.length() == 0)
+ {
+ System.err
+ .println("jalview Javascript error: Ignoring empty function for selection listener.");
+ return;
+ }
+ }
+ jalview.javascript.MouseOverStructureListener mol = new jalview.javascript.MouseOverStructureListener(
+ this, listener, separatorListToArray(modelSet));
+ javascriptListeners.addElement(mol);
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .addStructureViewerListener(mol);
+ if (debug)
+ {
+ System.err.println("Added a javascript structure viewer listener '"
+ + listener + "'");
+ System.err.println("There are now " + javascriptListeners.size()
+ + " listeners in total.");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#removeJavascriptListener(jalview.appletgui
+ * .AlignFrame, java.lang.String)
+ */
+ public void removeJavascriptListener(AlignFrame af, String listener)
+ {
+ if (listener != null)
+ {
+ listener = listener.trim();
+ if (listener.length() == 0)
+ {
+ listener = null;
+ }
+ }
+ boolean rprt = false;
+ for (int ms = 0, msSize = javascriptListeners.size(); ms < msSize;)
+ {
+ Object lstn = javascriptListeners.elementAt(ms);
+ JsCallBack lstner = (JsCallBack) lstn;
+ if ((af == null || lstner.getAlignFrame() == af)
+ && (listener == null || lstner.getListenerFunction().equals(
+ listener)))
+ {
+ javascriptListeners.removeElement(lstner);
+ msSize--;
+ if (lstner instanceof SelectionListener)
+ {
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .removeSelectionListener((SelectionListener) lstner);
+ }
+ else
+ {
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .removeStructureViewerListener(lstner, null);
+ }
+ rprt = debug;
+ if (debug)
+ {
+ System.err.println("Removed listener '" + listener + "'");
+ }
+ }
+ else
+ {
+ ms++;
+ }
+ }
+ if (rprt)
+ {
+ System.err.println("There are now " + javascriptListeners.size()
+ + " listeners in total.");
+ }
+ }
+
+ public void stop()
+ {
+ System.err.println("Applet " + getName() + " stop().");
+ tidyUp();
+ }
+
+ public void destroy()
+ {
+ System.err.println("Applet " + getName() + " destroy().");
+ tidyUp();
+ }
+
+ private void tidyUp()
+ {
+ removeAll();
+ if (currentAlignFrame != null && currentAlignFrame.viewport != null
+ && currentAlignFrame.viewport.applet != null)
+ {
+ AlignViewport av = currentAlignFrame.viewport;
+ currentAlignFrame.closeMenuItem_actionPerformed();
+ av.applet = null;
+ currentAlignFrame = null;
+ }
+ if (javascriptListeners != null)
+ {
+ while (javascriptListeners.size() > 0)
+ {
+ jalview.javascript.JSFunctionExec mol = javascriptListeners
+ .elementAt(0);
+ javascriptListeners.removeElement(mol);
+ if (mol instanceof SelectionListener)
+ {
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .removeSelectionListener((SelectionListener) mol);
+ }
+ else
+ {
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .removeStructureViewerListener(mol, null);
+ }
+ mol.jvlite = null;
+ }
+ }
+ if (jsFunctionExec != null)
+ {
+ jsFunctionExec.stopQueue();
+ jsFunctionExec.jvlite = null;
+ }
+ initialAlignFrame = null;
+ jsFunctionExec = null;
+ javascriptListeners = null;
+ StructureSelectionManager.release(this);
+ }
+
+ private jalview.javascript.JSFunctionExec jsFunctionExec;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#mouseOverStructure(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void mouseOverStructure(final String pdbResNum,
+ final String chain, final String pdbfile)
+ {
+ final StructureSelectionManagerProvider me = this;
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ StructureSelectionManager.getStructureSelectionManager(me)
+ .mouseOverStructure(new Integer(pdbResNum).intValue(),
+ chain, pdbfile);
+ if (debug)
+ {
+ System.err.println("mouseOver for '" + pdbResNum
+ + "' in chain '" + chain + "' in structure '" + pdbfile
+ + "'");
+ }
+ } catch (NumberFormatException e)
+ {
+ System.err.println("Ignoring invalid residue number string '"
+ + pdbResNum + "'");
+ }
+
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#scrollViewToIn(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String)
+ */
+ public void scrollViewToIn(final AlignFrame alf, final String topRow,
+ final String leftHandColumn)
+ {
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ alf.scrollTo(new Integer(topRow).intValue(), new Integer(
+ leftHandColumn).intValue());
+
+ } catch (Exception ex)
+ {
+ System.err.println("Couldn't parse integer arguments (topRow='"
+ + topRow + "' and leftHandColumn='" + leftHandColumn
+ + "')");
+ ex.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.javascript.JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui
+ * .AlignFrame, java.lang.String)
+ */
+ @Override
+ public void scrollViewToRowIn(final AlignFrame alf, final String topRow)
+ {
+
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ alf.scrollToRow(new Integer(topRow).intValue());
+
+ } catch (Exception ex)
+ {
+ System.err.println("Couldn't parse integer arguments (topRow='"
+ + topRow + "')");
+ ex.printStackTrace();
+ }
+
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.javascript.JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui
+ * .AlignFrame, java.lang.String)
+ */
+ @Override
+ public void scrollViewToColumnIn(final AlignFrame alf,
+ final String leftHandColumn)
+ {
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ alf.scrollToColumn(new Integer(leftHandColumn).intValue());
+
+ } catch (Exception ex)
+ {
+ System.err
+ .println("Couldn't parse integer arguments (leftHandColumn='"
+ + leftHandColumn + "')");
+ ex.printStackTrace();
+ }
+ }
+ });
+
+ }
+
+ // //////////////////////////////////////////////
+ // //////////////////////////////////////////////
+
+ public static int lastFrameX = 200;
+
+ public static int lastFrameY = 200;
+
+ boolean fileFound = true;
+
+ String file = "No file";
+
+ String file2 = null;
+
+ Button launcher = new Button(
+ MessageManager.getString("label.start_jalview"));
+
+ /**
+ * The currentAlignFrame is static, it will change if and when the user
+ * selects a new window. Note that it will *never* point back to the embedded
+ * AlignFrame if the applet is started as embedded on the page and then
+ * afterwards a new view is created.
+ */
+ public AlignFrame currentAlignFrame = null;
+
+ /**
+ * This is the first frame to be displayed, and does not change. API calls
+ * will default to this instance if currentAlignFrame is null.
+ */
+ AlignFrame initialAlignFrame = null;
+
+ boolean embedded = false;
+
+ private boolean checkForJmol = true;
+
+ private boolean checkedForJmol = false; // ensure we don't check for jmol
+
+ // every time the app is re-inited
+
+ public boolean jmolAvailable = false;
+
+ private boolean alignPdbStructures = false;
+
+ /**
+ * use an external structure viewer exclusively (no jmols or MCViews will be
+ * opened by JalviewLite itself)
+ */
+ public boolean useXtrnalSviewer = false;
+
+ public static boolean debug = false;
+
+ static String builddate = null, version = null, installation = null;
+
+ private static void initBuildDetails()
+ {
+ if (builddate == null)
+ {
+ builddate = "unknown";
+ version = "test";
+ installation = "applet";
+ java.net.URL url = JalviewLite.class
+ .getResource("/.build_properties");
+ if (url != null)
+ {
+ try
+ {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ url.openStream()));
+ String line;
+ while ((line = reader.readLine()) != null)
+ {
+ if (line.indexOf("VERSION") > -1)
+ {
+ version = line.substring(line.indexOf("=") + 1);
+ }
+ if (line.indexOf("BUILD_DATE") > -1)
+ {
+ builddate = line.substring(line.indexOf("=") + 1);
+ }
+ if (line.indexOf("INSTALLATION") > -1)
+ {
+ installation = line.substring(line.indexOf("=") + 1);
+ }
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public static String getBuildDate()
+ {
+ initBuildDetails();
+ return builddate;
+ }
+
+ public static String getInstallation()
+ {
+ initBuildDetails();
+ return installation;
+ }
+
+ public static String getVersion()
+ {
+ initBuildDetails();
+ return version;
+ }
+
+ // public JSObject scriptObject = null;
+
+ /**
+ * init method for Jalview Applet
+ */
+ public void init()
+ {
+ // remove any handlers that might be hanging around from an earlier instance
+ try
+ {
+ if (debug)
+ {
+ System.err.println("Applet context is '"
+ + getAppletContext().getClass().toString() + "'");
+ }
+ JSObject scriptObject = JSObject.getWindow(this);
+ if (debug && scriptObject != null)
+ {
+ System.err.println("Applet has Javascript callback support.");
+ }
+
+ } catch (Exception ex)
+ {
+ System.err
+ .println("Warning: No JalviewLite javascript callbacks available.");
+ if (debug)
+ {
+ ex.printStackTrace();
+ }
+ }
+ /**
+ * turn on extra applet debugging
+ */
+ debug = TRUE.equalsIgnoreCase(getParameter("debug"));
+ if (debug)
+ {
+
+ System.err.println("JalviewLite Version " + getVersion());
+ System.err.println("Build Date : " + getBuildDate());
+ System.err.println("Installation : " + getInstallation());
+
+ }
+ String externalsviewer = getParameter("externalstructureviewer");
+ if (externalsviewer != null)
+ {
+ useXtrnalSviewer = externalsviewer.trim().toLowerCase().equals(TRUE);
+ }
+ /**
+ * if true disable the check for jmol
+ */
+ String chkforJmol = getParameter("nojmol");
+ if (chkforJmol != null)
+ {
+ checkForJmol = !chkforJmol.equals(TRUE);
+ }
+ /**
+ * get the separator parameter if present
+ */
+ String sep = getParameter("separator");
+ if (sep != null)
+ {
+ if (sep.length() > 0)
+ {
+ separator = sep;
+ if (debug)
+ {
+ System.err.println("Separator set to '" + separator + "'");
+ }
+ }
+ else
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.invalid_separator_parameter"));
+ }
+ }
+ int r = 255;
+ int g = 255;
+ int b = 255;
+ String param = getParameter("RGB");
+
+ if (param != null)
+ {
+ try
+ {
+ r = Integer.parseInt(param.substring(0, 2), 16);
+ g = Integer.parseInt(param.substring(2, 4), 16);
+ b = Integer.parseInt(param.substring(4, 6), 16);
+ } catch (Exception ex)
+ {
+ r = 255;
+ g = 255;
+ b = 255;
+ }
+ }
+ param = getParameter("label");
+ if (param != null)
+ {
+ launcher.setLabel(param);
+ }
+
+ setBackground(new Color(r, g, b));
+
+ file = getParameter("file");
+
+ if (file == null)
+ {
+ // Maybe the sequences are added as parameters
+ StringBuffer data = new StringBuffer("PASTE");
+ int i = 1;
+ while ((file = getParameter("sequence" + i)) != null)
+ {
+ data.append(file.toString() + "\n");
+ i++;
+ }
+ if (data.length() > 5)
+ {
+ file = data.toString();
+ }
+ }
+ if (getDefaultParameter("enableSplitFrame", true))
+ {
+ file2 = getParameter("file2");
+ }
+
+ embedded = TRUE.equalsIgnoreCase(getParameter("embedded"));
+ if (embedded)
+ {
+ LoadingThread loader = new LoadingThread(file, file2, this);
+ loader.start();
+ }
+ else if (file != null)
+ {
+ /*
+ * Start the applet immediately or show a button to start it
+ */
+ if (FALSE.equalsIgnoreCase(getParameter("showbutton")))
+ {
+ LoadingThread loader = new LoadingThread(file, file2, this);
+ loader.start();
+ }
+ else
+ {
+ add(launcher);
+ launcher.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ LoadingThread loader = new LoadingThread(file, file2,
+ JalviewLite.this);
+ loader.start();
+ }
+ });
+ }
+ }
+ else
+ {
+ // jalview initialisation with no alignment. loadAlignment() method can
+ // still be called to open new alignments.
+ file = "NO FILE";
+ fileFound = false;
+ callInitCallback();
+ }
+ }
+
+ private void initLiveConnect()
+ {
+ // try really hard to get the liveConnect thing working
+ boolean notFailed = false;
+ int tries = 0;
+ while (!notFailed && tries < 10)
+ {
+ if (tries > 0)
+ {
+ System.err.println("LiveConnect request thread going to sleep.");
+ }
+ try
+ {
+ Thread.sleep(700 * (1 + tries));
+ } catch (InterruptedException q)
+ {
+ }
+ ;
+ if (tries++ > 0)
+ {
+ System.err.println("LiveConnect request thread woken up.");
+ }
+ try
+ {
+ JSObject scriptObject = JSObject.getWindow(this);
+ if (scriptObject.eval("navigator") != null)
+ {
+ notFailed = true;
+ }
+ } catch (Exception jsex)
+ {
+ System.err.println("Attempt " + tries
+ + " to access LiveConnect javascript failed.");
+ }
+ }
+ }
+
+ private void callInitCallback()
+ {
+ String initjscallback = getParameter("oninit");
+ if (initjscallback == null)
+ {
+ return;
+ }
+ initjscallback = initjscallback.trim();
+ if (initjscallback.length() > 0)
+ {
+ JSObject scriptObject = null;
+ try
+ {
+ scriptObject = JSObject.getWindow(this);
+ } catch (Exception ex)
+ {
+ }
+ ;
+ // try really hard to let the browser plugin know we want liveconnect
+ initLiveConnect();
+
+ if (scriptObject != null)
+ {
+ try
+ {
+ // do onInit with the JS executor thread
+ new JSFunctionExec(this).executeJavascriptFunction(true,
+ initjscallback, null, "Calling oninit callback '"
+ + initjscallback + "'.");
+ } catch (Exception e)
+ {
+ System.err.println("Exception when executing _oninit callback '"
+ + initjscallback + "'.");
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ System.err.println("Not executing _oninit callback '"
+ + initjscallback + "' - no scripting allowed.");
+ }
+ }
+ }
+
+ /**
+ * Initialises and displays a new java.awt.Frame
+ *
+ * @param frame
+ * java.awt.Frame to be displayed
+ * @param title
+ * title of new frame
+ * @param width
+ * width if new frame
+ * @param height
+ * height of new frame
+ */
+ public static void addFrame(final Frame frame, String title, int width,
+ int height)
+ {
+ frame.setLocation(lastFrameX, lastFrameY);
+ lastFrameX += 40;
+ lastFrameY += 40;
+ frame.setSize(width, height);
+ frame.setTitle(title);
+ frame.addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ if (frame instanceof AlignFrame)
+ {
+ AlignViewport vp = ((AlignFrame) frame).viewport;
+ ((AlignFrame) frame).closeMenuItem_actionPerformed();
+ if (vp.applet.currentAlignFrame == frame)
+ {
+ vp.applet.currentAlignFrame = null;
+ }
+ vp.applet = null;
+ vp = null;
+
+ }
+ lastFrameX -= 40;
+ lastFrameY -= 40;
+ if (frame instanceof EmbmenuFrame)
+ {
+ ((EmbmenuFrame) frame).destroyMenus();
+ }
+ frame.setMenuBar(null);
+ frame.dispose();
+ }
+
+ public void windowActivated(WindowEvent e)
+ {
+ if (frame instanceof AlignFrame)
+ {
+ ((AlignFrame) frame).viewport.applet.currentAlignFrame = (AlignFrame) frame;
+ if (debug)
+ {
+ System.err.println("Activated window " + frame);
+ }
+ }
+ // be good.
+ super.windowActivated(e);
+ }
+ /*
+ * Probably not necessary to do this - see TODO above. (non-Javadoc)
+ *
+ * @see
+ * java.awt.event.WindowAdapter#windowDeactivated(java.awt.event.WindowEvent
+ * )
+ *
+ * public void windowDeactivated(WindowEvent e) { if (currentAlignFrame ==
+ * frame) { currentAlignFrame = null; if (debug) {
+ * System.err.println("Deactivated window "+frame); } }
+ * super.windowDeactivated(e); }
+ */
+ });
+ frame.setVisible(true);
+ }
+
+ /**
+ * This paints the background surrounding the "Launch Jalview button" <br>
+ * <br>
+ * If file given in parameter not found, displays error message
+ *
+ * @param g
+ * graphics context
+ */
+ public void paint(Graphics g)
+ {
+ if (!fileFound)
+ {
+ g.setColor(new Color(200, 200, 200));
+ g.setColor(Color.cyan);
+ g.fillRect(0, 0, getSize().width, getSize().height);
+ g.setColor(Color.red);
+ g.drawString(
+ MessageManager.getString("label.jalview_cannot_open_file"),
+ 5, 15);
+ g.drawString("\"" + file + "\"", 5, 30);
+ }
+ else if (embedded)
+ {
+ g.setColor(Color.black);
+ g.setFont(new Font("Arial", Font.BOLD, 24));
+ g.drawString(MessageManager.getString("label.jalview_applet"), 50,
+ getSize().height / 2 - 30);
+ g.drawString(MessageManager.getString("label.loading_data") + "...",
+ 50, getSize().height / 2);
+ }
+ }
+
+ /**
+ * get all components associated with the applet of the given type
+ *
+ * @param class1
+ * @return
+ */
+ public Vector getAppletWindow(Class class1)
+ {
+ Vector wnds = new Vector();
+ Component[] cmp = getComponents();
+ if (cmp != null)
+ {
+ for (int i = 0; i < cmp.length; i++)
+ {
+ if (class1.isAssignableFrom(cmp[i].getClass()))
+ {
+ wnds.addElement(cmp);
+ }
+ }
+ }
+ return wnds;
+ }
+
+ class LoadJmolThread extends Thread
+ {
+ private boolean running = false;
+
+ public void run()
+ {
+ if (running || checkedForJmol)
+ {
+ return;
+ }
+ running = true;
+ if (checkForJmol)
+ {
+ try
+ {
+ if (!System.getProperty("java.version").startsWith("1.1"))
+ {
+ Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter");
+ jmolAvailable = true;
+ }
+ if (!jmolAvailable)
+ {
+ System.out
+ .println("Jmol not available - Using MCview for structures");
+ }
+ } catch (java.lang.ClassNotFoundException ex)
+ {
+ }
+ }
+ else
+ {
+ jmolAvailable = false;
+ if (debug)
+ {
+ System.err
+ .println("Skipping Jmol check. Will use MCView (probably)");
+ }
+ }
+ checkedForJmol = true;
+ running = false;
+ }
+
+ public boolean notFinished()
+ {
+ return running || !checkedForJmol;
+ }
+ }
+
+ class LoadingThread extends Thread
+ {
+ /**
+ * State variable: protocol for access to file source
+ */
+ String protocol;
+
+ String _file; // alignment file or URL spec
+
+ String _file2; // second alignment file or URL spec
+
+ JalviewLite applet;
+
+ private void dbgMsg(String msg)
+ {
+ if (JalviewLite.debug)
+ {
+ System.err.println(msg);
+ }
+ }
+
+ /**
+ * update the protocol state variable for accessing the datasource located
+ * by file.
+ *
+ * @param file
+ * @return possibly updated datasource string
+ */
+ public String setProtocolState(String file)
+ {
+ if (file.startsWith("PASTE"))
+ {
+ file = file.substring(5);
+ protocol = AppletFormatAdapter.PASTE;
+ }
+ else if (inArchive(file))
+ {
+ protocol = AppletFormatAdapter.CLASSLOADER;
+ }
+ else
+ {
+ file = addProtocol(file);
+ protocol = AppletFormatAdapter.URL;
+ }
+ dbgMsg("Protocol identified as '" + protocol + "'");
+ return file;
+ }
+
+ public LoadingThread(String file, String file2, JalviewLite _applet)
+ {
+ this._file = file;
+ this._file2 = file2;
+ applet = _applet;
+ }
+
+ public void run()
+ {
+ LoadJmolThread jmolchecker = new LoadJmolThread();
+ jmolchecker.start();
+ while (jmolchecker.notFinished())
+ {
+ // wait around until the Jmol check is complete.
+ try
+ {
+ Thread.sleep(2);
+ } catch (Exception e)
+ {
+ }
+ }
+ startLoading();
+ // applet.callInitCallback();
+ }
+
+ /**
+ * Load the alignment and any related files as specified by applet
+ * parameters
+ */
+ private void startLoading()
+ {
+ dbgMsg("Loading thread started with:\n>>file\n" + _file + ">>endfile");
+
+ dbgMsg("Loading started.");
+
+ AlignFrame newAlignFrame = readAlignment(_file);
+ AlignFrame newAlignFrame2 = readAlignment(_file2);
+ if (newAlignFrame != null)
+ {
+ addToDisplay(newAlignFrame, newAlignFrame2);
+ loadTree(newAlignFrame);
+
+ loadScoreFile(newAlignFrame);
+
+ loadFeatures(newAlignFrame);
+
+ loadAnnotations(newAlignFrame);
+
+ loadJnetFile(newAlignFrame);
+
+ loadPdbFiles(newAlignFrame);
+ }
+ else
+ {
+ fileFound = false;
+ applet.remove(launcher);
+ applet.repaint();
+ }
+ callInitCallback();
+ }
+
+ /**
+ * Add an AlignFrame to the display; or if two are provided, a SplitFrame.
+ *
+ * @param af
+ * @param af2
+ */
+ public void addToDisplay(AlignFrame af, AlignFrame af2)
+ {
+ if (af2 != null)
+ {
+ AlignmentI al1 = af.viewport.getAlignment();
+ AlignmentI al2 = af2.viewport.getAlignment();
+ if (AlignmentUtils.isMappable(al1, al2))
+ {
+ SplitFrame sf = new SplitFrame(af, af2);
+ sf.addToDisplay(embedded, JalviewLite.this);
+ return;
+ }
+ else
+ {
+ String msg = "Could not map any sequence in " + af2.getTitle()
+ + " as "
+ + (al1.isNucleotide() ? "protein product" : "cDNA")
+ + " for " + af.getTitle();
+ System.err.println(msg);
+ }
+ }
+
+ af.addToDisplay(embedded);
+ }
+
+ /**
+ * Read the alignment file (from URL, text 'paste', or archive by
+ * classloader).
+ *
+ * @return
+ */
+ protected AlignFrame readAlignment(String fileParam)
+ {
+ if (fileParam == null)
+ {
+ return null;
+ }
+ String resolvedFile = setProtocolState(fileParam);
+ String format = new IdentifyFile().Identify(resolvedFile, protocol);
+ dbgMsg("File identified as '" + format + "'");
+ AlignmentI al = null;
+ try
+ {
+ al = new AppletFormatAdapter().readFile(resolvedFile, protocol,
+ format);
+ if ((al != null) && (al.getHeight() > 0))
+ {
+ dbgMsg("Successfully loaded file.");
+ al.setDataset(null);
+ AlignFrame newAlignFrame = new AlignFrame(al, applet,
+ resolvedFile, embedded, false);
+ newAlignFrame.setTitle(resolvedFile);
+ if (initialAlignFrame == null)
+ {
+ initialAlignFrame = newAlignFrame;
+ }
+ // update the focus.
+ currentAlignFrame = newAlignFrame;
+
+ if (protocol == AppletFormatAdapter.PASTE)
+ {
+ newAlignFrame.setTitle(MessageManager.formatMessage(
+ "label.sequences_from", new Object[] { applet
+ .getDocumentBase().toString() }));
+ }
+
+ newAlignFrame.statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_loaded_file",
+ new Object[] { resolvedFile }));
+
+ return newAlignFrame;
+ }
+ } catch (java.io.IOException ex)
+ {
+ dbgMsg("File load exception.");
+ ex.printStackTrace();
+ if (debug)
+ {
+ try
+ {
+ FileParse fp = new FileParse(resolvedFile, protocol);
+ String ln = null;
+ dbgMsg(">>>Dumping contents of '" + resolvedFile + "' " + "("
+ + protocol + ")");
+ while ((ln = fp.nextLine()) != null)
+ {
+ dbgMsg(ln);
+ }
+ dbgMsg(">>>Dump finished.");
+ } catch (Exception e)
+ {
+ System.err
+ .println("Exception when trying to dump the content of the file parameter.");
+ e.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Load PDBFiles if any specified by parameter(s). Returns true if loaded,
+ * else false.
+ *
+ * @param alignFrame
+ * @return
+ */
+ protected boolean loadPdbFiles(AlignFrame alignFrame)
+ {
+ boolean result = false;
+ /*
+ * <param name="alignpdbfiles" value="false/true"/> Undocumented for 2.6 -
+ * related to JAL-434
+ */
+
+ applet.setAlignPdbStructures(getDefaultParameter("alignpdbfiles",
+ false));
+ /*
+ * <param name="PDBfile" value="1gaq.txt PDB|1GAQ|1GAQ|A PDB|1GAQ|1GAQ|B
+ * PDB|1GAQ|1GAQ|C">
+ *
+ * <param name="PDBfile2" value="1gaq.txt A=SEQA B=SEQB C=SEQB">
+ *
+ * <param name="PDBfile3" value="1q0o Q45135_9MICO">
+ */
+
+ int pdbFileCount = 0;
+ // Accumulate pdbs here if they are heading for the same view (if
+ // alignPdbStructures is true)
+ Vector pdbs = new Vector();
+ // create a lazy matcher if we're asked to
+ jalview.analysis.SequenceIdMatcher matcher = (applet
+ .getDefaultParameter("relaxedidmatch", false)) ? new jalview.analysis.SequenceIdMatcher(
+ alignFrame.getAlignViewport().getAlignment()
+ .getSequencesArray()) : null;
+
+ String param;
+ do
+ {
+ if (pdbFileCount > 0)
+ {
+ param = applet.getParameter("PDBFILE" + pdbFileCount);
+ }
+ else
+ {
+ param = applet.getParameter("PDBFILE");
+ }
+
+ if (param != null)
+ {
+ PDBEntry pdb = new PDBEntry();
+
+ String seqstring;
+ SequenceI[] seqs = null;
+ String[] chains = null;
+
+ StringTokenizer st = new StringTokenizer(param, " ");
+
+ if (st.countTokens() < 2)
+ {
+ String sequence = applet.getParameter("PDBSEQ");
+ if (sequence != null)
+ {
+ seqs = new SequenceI[] { matcher == null ? (Sequence) alignFrame
+ .getAlignViewport().getAlignment().findName(sequence)
+ : matcher.findIdMatch(sequence) };
+ }
+
+ }
+ else
+ {
+ param = st.nextToken();
+ Vector tmp = new Vector();
+ Vector tmp2 = new Vector();
+
+ while (st.hasMoreTokens())
+ {
+ seqstring = st.nextToken();
+ StringTokenizer st2 = new StringTokenizer(seqstring, "=");
+ if (st2.countTokens() > 1)
+ {
+ // This is the chain
+ tmp2.addElement(st2.nextToken());
+ seqstring = st2.nextToken();
+ }
+ tmp.addElement(matcher == null ? (Sequence) alignFrame
+ .getAlignViewport().getAlignment()
+ .findName(seqstring) : matcher.findIdMatch(seqstring));
+ }
+
+ seqs = new SequenceI[tmp.size()];
+ tmp.copyInto(seqs);
+ if (tmp2.size() == tmp.size())
+ {
+ chains = new String[tmp2.size()];
+ tmp2.copyInto(chains);
+ }
+ }
+ param = setProtocolState(param);
+
+ if (// !jmolAvailable
+ // &&
+ protocol == AppletFormatAdapter.CLASSLOADER && !useXtrnalSviewer)
+ {
+ // Re: JAL-357 : the bug isn't a problem if we are using an
+ // external viewer!
+ // TODO: verify this Re:
+ // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605
+ // This exception preserves the current behaviour where, even if
+ // the local pdb file was identified in the class loader
+ protocol = AppletFormatAdapter.URL; // this is probably NOT
+ // CORRECT!
+ param = addProtocol(param); //
+ }
+
+ pdb.setFile(param);
+
+ if (seqs != null)
+ {
+ for (int i = 0; i < seqs.length; i++)
+ {
+ if (seqs[i] != null)
+ {
+ ((Sequence) seqs[i]).addPDBId(pdb);
+ StructureSelectionManager.getStructureSelectionManager(
+ applet).registerPDBEntry(pdb);
+ }
+ else
+ {
+ if (JalviewLite.debug)
+ {
+ // this may not really be a problem but we give a warning
+ // anyway
+ System.err
+ .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence "
+ + i + ")");
+ }
+ }
+ }
+
+ if (!alignPdbStructures)
+ {
+ alignFrame.newStructureView(applet, pdb, seqs, chains,
+ protocol);
+ }
+ else
+ {
+ pdbs.addElement(new Object[] { pdb, seqs, chains,
+ new String(protocol) });
+ }
+ }
+ }
+
+ pdbFileCount++;
+ } while (param != null || pdbFileCount < 10);
+ if (pdbs.size() > 0)
+ {
+ SequenceI[][] seqs = new SequenceI[pdbs.size()][];
+ PDBEntry[] pdb = new PDBEntry[pdbs.size()];
+ String[][] chains = new String[pdbs.size()][];
+ String[] protocols = new String[pdbs.size()];
+ for (int pdbsi = 0, pdbsiSize = pdbs.size(); pdbsi < pdbsiSize; pdbsi++)
+ {
+ Object[] o = (Object[]) pdbs.elementAt(pdbsi);
+ pdb[pdbsi] = (PDBEntry) o[0];
+ seqs[pdbsi] = (SequenceI[]) o[1];
+ chains[pdbsi] = (String[]) o[2];
+ protocols[pdbsi] = (String) o[3];
+ }
+ alignFrame.alignedStructureView(applet, pdb, seqs, chains,
+ protocols);
+ result = true;
+ }
+ return result;
+ }
+
+ /**
+ * Load in a Jnetfile if specified by parameter. Returns true if loaded,
+ * else false.
+ *
+ * @param alignFrame
+ * @return
+ */
+ protected boolean loadJnetFile(AlignFrame alignFrame)
+ {
+ boolean result = false;
+ String param = applet.getParameter("jnetfile");
+ if (param != null)
+ {
+ try
+ {
+ param = setProtocolState(param);
+ JPredFile predictions = new JPredFile(param, protocol);
+ JnetAnnotationMaker.add_annotation(predictions,
+ alignFrame.viewport.getAlignment(), 0, false);
+ // false == do not add sequence profile from concise output
+ SequenceI repseq = alignFrame.viewport.getAlignment()
+ .getSequenceAt(0);
+ alignFrame.viewport.getAlignment().setSeqrep(repseq);
+ ColumnSelection cs = new ColumnSelection();
+ cs.hideInsertionsFor(repseq);
+ alignFrame.viewport.setColumnSelection(cs);
+ alignFrame.alignPanel.fontChanged();
+ alignFrame.alignPanel.setScrollValues(0, 0);
+ result = true;
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Load annotations if specified by parameter. Returns true if loaded, else
+ * false.
+ *
+ * @param alignFrame
+ * @return
+ */
+ protected boolean loadAnnotations(AlignFrame alignFrame)
+ {
+ boolean result = false;
+ String param = applet.getParameter("annotations");
+ if (param != null)
+ {
+ param = setProtocolState(param);
+
+ if (new AnnotationFile().annotateAlignmentView(alignFrame.viewport,
+ param, protocol))
+ {
+ alignFrame.alignPanel.fontChanged();
+ alignFrame.alignPanel.setScrollValues(0, 0);
+ result = true;
+ }
+ else
+ {
+ System.err
+ .println("Annotations were not added from annotation file '"
+ + param + "'");
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Load features file and view settings as specified by parameters. Returns
+ * true if features were loaded, else false.
+ *
+ * @param alignFrame
+ * @return
+ */
+ protected boolean loadFeatures(AlignFrame alignFrame)
+ {
+ boolean result = false;
+ // ///////////////////////////
+ // modify display of features
+ // we do this before any features have been loaded, ensuring any hidden
+ // groups are hidden when features first displayed
+ //
+ // hide specific groups
+ //
+ String param = applet.getParameter("hidefeaturegroups");
+ if (param != null)
+ {
+ alignFrame.setFeatureGroupState(separatorListToArray(param), false);
+ // applet.setFeatureGroupStateOn(newAlignFrame, param, false);
+ }
+ // show specific groups
+ param = applet.getParameter("showfeaturegroups");
+ if (param != null)
+ {
+ alignFrame.setFeatureGroupState(separatorListToArray(param), true);
+ // applet.setFeatureGroupStateOn(newAlignFrame, param, true);
+ }
+ // and now load features
+ param = applet.getParameter("features");
+ if (param != null)
+ {
+ param = setProtocolState(param);
+
+ result = alignFrame.parseFeaturesFile(param, protocol);
+ }
+
+ param = applet.getParameter("showFeatureSettings");
+ if (param != null && param.equalsIgnoreCase(TRUE))
+ {
+ alignFrame.viewport.setShowSequenceFeatures(true);
+ new FeatureSettings(alignFrame.alignPanel);
+ }
+ return result;
+ }
+
+ /**
+ * Load a score file if specified by parameter. Returns true if file was
+ * loaded, else false.
+ *
+ * @param alignFrame
+ */
+ protected boolean loadScoreFile(AlignFrame alignFrame)
+ {
+ boolean result = false;
+ String sScoreFile = applet.getParameter("scoreFile");
+ if (sScoreFile != null && !"".equals(sScoreFile))
+ {
+ try
+ {
+ if (debug)
+ {
+ System.err
+ .println("Attempting to load T-COFFEE score file from the scoreFile parameter");
+ }
+ result = alignFrame.loadScoreFile(sScoreFile);
+ if (!result)
+ {
+ System.err
+ .println("Failed to parse T-COFFEE parameter as a valid score file ('"
+ + sScoreFile + "')");
+ }
+ } catch (Exception e)
+ {
+ System.err.printf("Cannot read score file: '%s'. Cause: %s \n",
+ sScoreFile, e.getMessage());
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Load a tree for the alignment if specified by parameter. Returns true if
+ * a tree was loaded, else false.
+ *
+ * @param alignFrame
+ * @return
+ */
+ protected boolean loadTree(AlignFrame alignFrame)
+ {
+ boolean result = false;
+ String treeFile = applet.getParameter("tree");
+ if (treeFile == null)
+ {
+ treeFile = applet.getParameter("treeFile");
+ }
+
+ if (treeFile != null)
+ {
+ try
+ {
+ treeFile = setProtocolState(treeFile);
+ NewickFile fin = new NewickFile(treeFile, protocol);
+ fin.parse();
+
+ if (fin.getTree() != null)
+ {
+ alignFrame.loadTree(fin, treeFile);
+ result = true;
+ dbgMsg("Successfully imported tree.");
+ }
+ else
+ {
+ dbgMsg("Tree parameter did not resolve to a valid tree.");
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Discovers whether the given file is in the Applet Archive
+ *
+ * @param file
+ * String
+ * @return boolean
+ */
+ boolean inArchive(String file)
+ {
+ // This might throw a security exception in certain browsers
+ // Netscape Communicator for instance.
+ try
+ {
+ boolean rtn = (getClass().getResourceAsStream("/" + file) != null);
+ if (debug)
+ {
+ System.err.println("Resource '" + file + "' was "
+ + (rtn ? "" : "not") + " located by classloader.");
+ }
+ return rtn;
+ } catch (Exception ex)
+ {
+ System.out.println("Exception checking resources: " + file + " "
+ + ex);
+ return false;
+ }
+ }
+
+ /**
+ * If the file is not already in URL format, tries to locate it by resolving
+ * as a URL.
+ *
+ * @param f
+ * @return
+ */
+ String addProtocol(final String f)
+ {
+ if (f.indexOf("://") != -1)
+ {
+ // already has URL format
+ return f;
+ }
+
+ /*
+ * Try relative to document base
+ */
+ URL documentBase = getDocumentBase();
+ String url = applet.resolveUrlForLocalOrAbsolute(f, documentBase);
+ if (urlExists(url))
+ {
+ if (debug)
+ {
+ System.err.println("Prepended document base '" + documentBase
+ + "' to make: '" + url + "'");
+ }
+ return url;
+ }
+
+ /*
+ * Try relative to codebase
+ */
+ URL codeBase = getCodeBase();
+ url = applet.resolveUrlForLocalOrAbsolute(f, codeBase);
+ if (urlExists(url))
+ {
+ if (debug)
+ {
+ System.err.println("Prepended codebase '" + codeBase
+ + "' to make: '" + url + "'");
+ }
+ return url;
+ }
+
+ return f;
+ }
+
+ /**
+ * Returns true if an input stream can be opened on the specified URL, else
+ * false.
+ *
+ * @param url
+ * @return
+ */
+ private boolean urlExists(String url)
+ {
+ InputStream is = null;
+ try
+ {
+ is = new URL(url).openStream();
+ if (is != null)
+ {
+ return true;
+ }
+ } catch (Exception x)
+ {
+ // ignore
+ } finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ } catch (IOException e)
+ {
+ // ignore
+ }
+ }
+ }
+ return false;
+ }
+ }
+
+ /**
+ * @return the default alignFrame acted on by the public applet methods. May
+ * return null with an error message on System.err indicating the
+ * fact.
+ */
+ public AlignFrame getDefaultTargetFrame()
+ {
+ if (currentAlignFrame != null)
+ {
+ return currentAlignFrame;
+ }
+ if (initialAlignFrame != null)
+ {
+ return initialAlignFrame;
+ }
+ System.err
+ .println("Implementation error: Jalview Applet API cannot work out which AlignFrame to use.");
+ return null;
+ }
+
+ /**
+ * separator used for separatorList
+ */
+ protected String separator = "" + ((char) 0x00AC); // the default used to be
+ // '|' but many sequence
+ // IDS include pipes.
+
+ /**
+ * set to enable the URL based javascript execution mechanism
+ */
+ public boolean jsfallbackEnabled = false;
+
+ /**
+ * parse the string into a list
+ *
+ * @param list
+ * @return elements separated by separator
+ */
+ public String[] separatorListToArray(String list)
+ {
+ return separatorListToArray(list, separator);
+ }
+
+ /**
+ * parse the string into a list
+ *
+ * @param list
+ * @param separator
+ * @return elements separated by separator
+ */
+ public String[] separatorListToArray(String list, String separator)
+ {
+ int seplen = separator.length();
+ if (list == null || list.equals("") || list.equals(separator))
+ {
+ return null;
+ }
+ java.util.Vector jv = new Vector();
+ int cp = 0, pos;
+ while ((pos = list.indexOf(separator, cp)) > cp)
+ {
+ jv.addElement(list.substring(cp, pos));
+ cp = pos + seplen;
+ }
+ if (cp < list.length())
+ {
+ String c = list.substring(cp);
+ if (!c.equals(separator))
+ {
+ jv.addElement(c);
+ }
+ }
+ if (jv.size() > 0)
+ {
+ String[] v = new String[jv.size()];
+ for (int i = 0; i < v.length; i++)
+ {
+ v[i] = (String) jv.elementAt(i);
+ }
+ jv.removeAllElements();
+ if (debug)
+ {
+ System.err.println("Array from '" + separator
+ + "' separated List:\n" + v.length);
+ for (int i = 0; i < v.length; i++)
+ {
+ System.err.println("item " + i + " '" + v[i] + "'");
+ }
+ }
+ return v;
+ }
+ if (debug)
+ {
+ System.err.println("Empty Array from '" + separator
+ + "' separated List");
+ }
+ return null;
+ }
+
+ /**
+ * concatenate the list with separator
+ *
+ * @param list
+ * @return concatenated string
+ */
+ public String arrayToSeparatorList(String[] list)
+ {
+ return arrayToSeparatorList(list, separator);
+ }
+
+ /**
+ * concatenate the list with separator
+ *
+ * @param list
+ * @param separator
+ * @return concatenated string
+ */
+ public String arrayToSeparatorList(String[] list, String separator)
+ {
+ StringBuffer v = new StringBuffer();
+ if (list != null && list.length > 0)
+ {
+ for (int i = 0, iSize = list.length; i < iSize; i++)
+ {
+ if (list[i] != null)
+ {
+ if (i > 0)
+ {
+ v.append(separator);
+ }
+ v.append(list[i]);
+ }
+ }
+ if (debug)
+ {
+ System.err.println("Returning '" + separator
+ + "' separated List:\n");
+ System.err.println(v);
+ }
+ return v.toString();
+ }
+ if (debug)
+ {
+ System.err.println("Returning empty '" + separator
+ + "' separated List\n");
+ }
+ return "" + separator;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getFeatureGroups()
+ */
+ public String getFeatureGroups()
+ {
+ String lst = arrayToSeparatorList(getDefaultTargetFrame()
+ .getFeatureGroups());
+ return lst;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOn(jalview.appletgui.AlignFrame
+ * )
+ */
+ public String getFeatureGroupsOn(AlignFrame alf)
+ {
+ String lst = arrayToSeparatorList(alf.getFeatureGroups());
+ return lst;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfState(boolean)
+ */
+ public String getFeatureGroupsOfState(boolean visible)
+ {
+ return arrayToSeparatorList(getDefaultTargetFrame()
+ .getFeatureGroupsOfState(visible));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfStateOn(jalview.appletgui
+ * .AlignFrame, boolean)
+ */
+ public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)
+ {
+ return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupStateOn(jalview.appletgui.
+ * AlignFrame, java.lang.String, boolean)
+ */
+ public void setFeatureGroupStateOn(final AlignFrame alf,
+ final String groups, boolean state)
+ {
+ final boolean st = state;// !(state==null || state.equals("") ||
+ // state.toLowerCase().equals("false"));
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ alf.setFeatureGroupState(separatorListToArray(groups), st);
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupState(java.lang.String,
+ * boolean)
+ */
+ public void setFeatureGroupState(String groups, boolean state)
+ {
+ setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getSeparator()
+ */
+ public String getSeparator()
+ {
+ return separator;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setSeparator(java.lang.String)
+ */
+ public void setSeparator(String separator)
+ {
+ if (separator == null || separator.length() < 1)
+ {
+ // reset to default
+ separator = "" + ((char) 0x00AC);
+ }
+ this.separator = separator;
+ if (debug)
+ {
+ System.err.println("Default Separator now: '" + separator + "'");
+ }
+ }
+
+ /**
+ * get boolean value of applet parameter 'name' and return default if
+ * parameter is not set
+ *
+ * @param name
+ * name of paremeter
+ * @param def
+ * the value to return otherwise
+ * @return true or false
+ */
+ public boolean getDefaultParameter(String name, boolean def)
+ {
+ String stn;
+ if ((stn = getParameter(name)) == null)
+ {
+ return def;
+ }
+ if (TRUE.equalsIgnoreCase(stn))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#addPdbFile(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String, java.lang.String)
+ */
+ public boolean addPdbFile(AlignFrame alFrame, String sequenceId,
+ String pdbEntryString, String pdbFile)
+ {
+ return alFrame.addPdbFile(sequenceId, pdbEntryString, pdbFile);
+ }
+
+ protected void setAlignPdbStructures(boolean alignPdbStructures)
+ {
+ this.alignPdbStructures = alignPdbStructures;
+ }
+
+ public boolean isAlignPdbStructures()
+ {
+ return alignPdbStructures;
+ }
+
+ public void start()
+ {
+ // callInitCallback();
+ }
+
+ private Hashtable<String, long[]> jshashes = new Hashtable<String, long[]>();
+
+ private Hashtable<String, Hashtable<String, String[]>> jsmessages = new Hashtable<String, Hashtable<String, String[]>>();
+
+ public void setJsMessageSet(String messageclass, String viewId,
+ String[] colcommands)
+ {
+ Hashtable<String, String[]> msgset = jsmessages.get(messageclass);
+ if (msgset == null)
+ {
+ msgset = new Hashtable<String, String[]>();
+ jsmessages.put(messageclass, msgset);
+ }
+ msgset.put(viewId, colcommands);
+ long[] l = new long[colcommands.length];
+ for (int i = 0; i < colcommands.length; i++)
+ {
+ l[i] = colcommands[i].hashCode();
+ }
+ jshashes.put(messageclass + "|" + viewId, l);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getJsMessage(java.lang.String,
+ * java.lang.String)
+ */
+ public String getJsMessage(String messageclass, String viewId)
+ {
+ Hashtable<String, String[]> msgset = jsmessages.get(messageclass);
+ if (msgset != null)
+ {
+ String[] msgs = msgset.get(viewId);
+ if (msgs != null)
+ {
+ for (int i = 0; i < msgs.length; i++)
+ {
+ if (msgs[i] != null)
+ {
+ String m = msgs[i];
+ msgs[i] = null;
+ return m;
+ }
+ }
+ }
+ }
+ return "";
+ }
+
+ public boolean isJsMessageSetChanged(String string, String string2,
+ String[] colcommands)
+ {
+ long[] l = jshashes.get(string + "|" + string2);
+ if (l == null && colcommands != null)
+ {
+ return true;
+ }
+ for (int i = 0; i < colcommands.length; i++)
+ {
+ if (l[i] != colcommands[i].hashCode())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private Vector jsExecQueue = new Vector();
+
+ public Vector getJsExecQueue()
+ {
+ return jsExecQueue;
+ }
+
+ public void setExecutor(JSFunctionExec jsFunctionExec2)
+ {
+ jsFunctionExec = jsFunctionExec2;
+ }
+
+ /**
+ * return the given colour value parameter or the given default if parameter
+ * not given
+ *
+ * @param colparam
+ * @param defcolour
+ * @return
+ */
+ public Color getDefaultColourParameter(String colparam, Color defcolour)
+ {
+ String colprop = getParameter(colparam);
+ if (colprop == null || colprop.trim().length() == 0)
+ {
+ return defcolour;
+ }
+ Color col = jalview.schemes.ColourSchemeProperty
+ .getAWTColorFromName(colprop);
+ if (col == null)
+ {
+ try
+ {
+ col = new jalview.schemes.UserColourScheme(colprop).findColour('A');
+ } catch (Exception ex)
+ {
+ System.err.println("Couldn't parse '" + colprop
+ + "' as a colour for " + colparam);
+ col = null;
+ }
+ }
+ return (col == null) ? defcolour : col;
+
+ }
+
+ public void openJalviewHelpUrl()
+ {
+ String helpUrl = getParameter("jalviewhelpurl");
+ if (helpUrl == null || helpUrl.trim().length() < 5)
+ {
+ helpUrl = "http://www.jalview.org/help.html";
+ }
+ showURL(helpUrl, "HELP");
+ }
+
+ /**
+ * form a complete URL given a path to a resource and a reference location on
+ * the same server
+ *
+ * @param url
+ * - an absolute path on the same server as localref or a document
+ * located relative to localref
+ * @param localref
+ * - a URL on the same server as url
+ * @return a complete URL for the resource located by url
+ */
+ private String resolveUrlForLocalOrAbsolute(String url, URL localref)
+ {
+ String codebase = localref.toString();
+ if (url.indexOf("/") == 0)
+ {
+ String localfile = localref.getFile();
+ url = codebase.substring(0, codebase.length() - localfile.length())
+ + url;
+ }
+ else
+ {
+ url = localref + url;
+ }
+ if (debug)
+ {
+ System.err.println("URL: " + localref.toString());
+ System.err.println("URL.getFile: " + localref.getFile());
+ System.err.println("URL.getPath: " + localref.getPath());
+ System.err.println("URL.getQuery: " + localref.getQuery());
+ System.err.println("returning " + url);
+ }
+ return url;
+ }
+
+ /**
+ * open a URL in the browser - resolving it according to relative refs and
+ * coping with javascript: protocol if necessary.
+ *
+ * @param url
+ * @param target
+ */
+ public void showURL(String url, String target)
+ {
+ try
+ {
+ if (url.indexOf(":") == -1)
+ {
+ // TODO: verify (Bas Vroling bug) prepend codebase or server URL to
+ // form valid URL
+ // Should really use docbase, not codebase.
+ URL prepend;
+ url = resolveUrlForLocalOrAbsolute(
+ url,
+ prepend = getDefaultParameter("resolvetocodebase", false) ? getDocumentBase()
+ : getCodeBase());
+ if (debug)
+ {
+ System.err
+ .println("Show url (prepended "
+ + prepend
+ + " - toggle resolvetocodebase if code/docbase resolution is wrong): "
+ + url);
+ }
+ }
+ else
+ {
+ if (debug)
+ {
+ System.err.println("Show url: " + url);
+ }
+ }
+ if (url.indexOf("javascript:") == 0)
+ {
+ // no target for the javascript context
+ getAppletContext().showDocument(new java.net.URL(url));
+ }
+ else
+ {
+ getAppletContext().showDocument(new java.net.URL(url), target);
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * bind structures in a viewer to any matching sequences in an alignFrame (use
+ * sequenceIds to limit scope of search to specific sequences)
+ *
+ * @param alFrame
+ * @param viewer
+ * @param sequenceIds
+ * @return TODO: consider making an exception structure for indicating when
+ * binding fails public SequenceStructureBinding
+ * addStructureViewInstance( AlignFrame alFrame, Object viewer, String
+ * sequenceIds) {
+ *
+ * if (sequenceIds != null && sequenceIds.length() > 0) { return
+ * alFrame.addStructureViewInstance(viewer,
+ * separatorListToArray(sequenceIds)); } else { return
+ * alFrame.addStructureViewInstance(viewer, null); } // return null; }
+ */
+}
diff --git a/src/jalview/bin/JalviewLiteURLRetrieve.java b/src/jalview/bin/JalviewLiteURLRetrieve.java
index a77186f..4167aa2 100644
--- a/src/jalview/bin/JalviewLiteURLRetrieve.java
+++ b/src/jalview/bin/JalviewLiteURLRetrieve.java
@@ -1,31 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.bin;
-import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
import jalview.io.AppletFormatAdapter;
import jalview.io.FileParse;
import java.applet.Applet;
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
import java.io.InputStream;
-import java.io.InputStreamReader;
public class JalviewLiteURLRetrieve extends Applet
{
@@ -120,7 +120,7 @@ public class JalviewLiteURLRetrieve extends Applet
{
System.out.println("User specified Format is " + format);
}
- Alignment al = null;
+ AlignmentI al = null;
try
{
al = new AppletFormatAdapter().readFile(file, protocol, format);
diff --git a/src/jalview/binding/Alignment.java b/src/jalview/binding/Alignment.java
index cc8f4dc..b8fcb2c 100644
--- a/src/jalview/binding/Alignment.java
+++ b/src/jalview/binding/Alignment.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,151 +19,162 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Alignment implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _annotation.
- */
- private jalview.binding.Annotation _annotation;
-
- /**
- * Field _sequenceSet.
- */
- private jalview.binding.SequenceSet _sequenceSet;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Alignment() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'annotation'.
- *
- * @return the value of field 'Annotation'.
- */
- public jalview.binding.Annotation getAnnotation(
- ) {
- return this._annotation;
- }
-
- /**
- * Returns the value of field 'sequenceSet'.
- *
- * @return the value of field 'SequenceSet'.
- */
- public jalview.binding.SequenceSet getSequenceSet(
- ) {
- return this._sequenceSet;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'annotation'.
- *
- * @param annotation the value of field 'annotation'.
- */
- public void setAnnotation(
- final jalview.binding.Annotation annotation) {
- this._annotation = annotation;
- }
-
- /**
- * Sets the value of field 'sequenceSet'.
- *
- * @param sequenceSet the value of field 'sequenceSet'.
- */
- public void setSequenceSet(
- final jalview.binding.SequenceSet sequenceSet) {
- this._sequenceSet = sequenceSet;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Alignment
- */
- public static jalview.binding.Alignment unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Alignment) Unmarshaller.unmarshal(jalview.binding.Alignment.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class Alignment implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _annotation.
+ */
+ private jalview.binding.Annotation _annotation;
+
+ /**
+ * Field _sequenceSet.
+ */
+ private jalview.binding.SequenceSet _sequenceSet;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Alignment()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'annotation'.
+ *
+ * @return the value of field 'Annotation'.
+ */
+ public jalview.binding.Annotation getAnnotation()
+ {
+ return this._annotation;
+ }
+
+ /**
+ * Returns the value of field 'sequenceSet'.
+ *
+ * @return the value of field 'SequenceSet'.
+ */
+ public jalview.binding.SequenceSet getSequenceSet()
+ {
+ return this._sequenceSet;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'annotation'.
+ *
+ * @param annotation
+ * the value of field 'annotation'.
+ */
+ public void setAnnotation(final jalview.binding.Annotation annotation)
+ {
+ this._annotation = annotation;
+ }
+
+ /**
+ * Sets the value of field 'sequenceSet'.
+ *
+ * @param sequenceSet
+ * the value of field 'sequenceSet'.
+ */
+ public void setSequenceSet(final jalview.binding.SequenceSet sequenceSet)
+ {
+ this._sequenceSet = sequenceSet;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Alignment
+ */
+ public static jalview.binding.Alignment unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Alignment) Unmarshaller.unmarshal(
+ jalview.binding.Alignment.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Annotation.java b/src/jalview/binding/Annotation.java
index 95447d3..86f1a63 100644
--- a/src/jalview/binding/Annotation.java
+++ b/src/jalview/binding/Annotation.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,414 +19,441 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Annotation implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _graph.
- */
- private boolean _graph;
-
- /**
- * keeps track of state for field: _graph
- */
- private boolean _has_graph;
-
- /**
- * Field _graphType.
- */
- private int _graphType;
-
- /**
- * keeps track of state for field: _graphType
- */
- private boolean _has_graphType;
-
- /**
- * Field _annotationElementList.
- */
- private java.util.Vector _annotationElementList;
-
- /**
- * Field _label.
- */
- private java.lang.String _label;
-
- /**
- * Field _description.
- */
- private java.lang.String _description;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Annotation() {
- super();
- this._annotationElementList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vAnnotationElement
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAnnotationElement(
- final jalview.binding.AnnotationElement vAnnotationElement)
- throws java.lang.IndexOutOfBoundsException {
- this._annotationElementList.addElement(vAnnotationElement);
- }
-
- /**
- *
- *
- * @param index
- * @param vAnnotationElement
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAnnotationElement(
- final int index,
- final jalview.binding.AnnotationElement vAnnotationElement)
- throws java.lang.IndexOutOfBoundsException {
- this._annotationElementList.add(index, vAnnotationElement);
- }
-
- /**
- */
- public void deleteGraph(
- ) {
- this._has_graph= false;
- }
-
- /**
- */
- public void deleteGraphType(
- ) {
- this._has_graphType= false;
- }
-
- /**
- * Method enumerateAnnotationElement.
- *
- * @return an Enumeration over all
- * jalview.binding.AnnotationElement elements
- */
- public java.util.Enumeration enumerateAnnotationElement(
- ) {
- return this._annotationElementList.elements();
- }
-
- /**
- * Method getAnnotationElement.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.AnnotationElement
- * at the given index
- */
- public jalview.binding.AnnotationElement getAnnotationElement(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._annotationElementList.size()) {
- throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
- }
-
- return (jalview.binding.AnnotationElement) _annotationElementList.get(index);
- }
-
- /**
- * Method getAnnotationElement.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.AnnotationElement[] getAnnotationElement(
- ) {
- jalview.binding.AnnotationElement[] array = new jalview.binding.AnnotationElement[0];
- return (jalview.binding.AnnotationElement[]) this._annotationElementList.toArray(array);
- }
-
- /**
- * Method getAnnotationElementCount.
- *
- * @return the size of this collection
- */
- public int getAnnotationElementCount(
- ) {
- return this._annotationElementList.size();
- }
-
- /**
- * Returns the value of field 'description'.
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Returns the value of field 'graph'.
- *
- * @return the value of field 'Graph'.
- */
- public boolean getGraph(
- ) {
- return this._graph;
+public class Annotation implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _graph.
+ */
+ private boolean _graph;
+
+ /**
+ * keeps track of state for field: _graph
+ */
+ private boolean _has_graph;
+
+ /**
+ * Field _graphType.
+ */
+ private int _graphType;
+
+ /**
+ * keeps track of state for field: _graphType
+ */
+ private boolean _has_graphType;
+
+ /**
+ * Field _annotationElementList.
+ */
+ private java.util.Vector _annotationElementList;
+
+ /**
+ * Field _label.
+ */
+ private java.lang.String _label;
+
+ /**
+ * Field _description.
+ */
+ private java.lang.String _description;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Annotation()
+ {
+ super();
+ this._annotationElementList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vAnnotationElement
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAnnotationElement(
+ final jalview.binding.AnnotationElement vAnnotationElement)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._annotationElementList.addElement(vAnnotationElement);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAnnotationElement
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAnnotationElement(final int index,
+ final jalview.binding.AnnotationElement vAnnotationElement)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._annotationElementList.add(index, vAnnotationElement);
+ }
+
+ /**
+ */
+ public void deleteGraph()
+ {
+ this._has_graph = false;
+ }
+
+ /**
+ */
+ public void deleteGraphType()
+ {
+ this._has_graphType = false;
+ }
+
+ /**
+ * Method enumerateAnnotationElement.
+ *
+ * @return an Enumeration over all jalview.binding.AnnotationElement elements
+ */
+ public java.util.Enumeration enumerateAnnotationElement()
+ {
+ return this._annotationElementList.elements();
+ }
+
+ /**
+ * Method getAnnotationElement.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.AnnotationElement at the given
+ * index
+ */
+ public jalview.binding.AnnotationElement getAnnotationElement(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._annotationElementList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "getAnnotationElement: Index value '" + index
+ + "' not in range [0.."
+ + (this._annotationElementList.size() - 1) + "]");
}
- /**
- * Returns the value of field 'graphType'.
- *
- * @return the value of field 'GraphType'.
- */
- public int getGraphType(
- ) {
- return this._graphType;
- }
-
- /**
- * Returns the value of field 'label'.
- *
- * @return the value of field 'Label'.
- */
- public java.lang.String getLabel(
- ) {
- return this._label;
- }
-
- /**
- * Method hasGraph.
- *
- * @return true if at least one Graph has been added
- */
- public boolean hasGraph(
- ) {
- return this._has_graph;
- }
-
- /**
- * Method hasGraphType.
- *
- * @return true if at least one GraphType has been added
- */
- public boolean hasGraphType(
- ) {
- return this._has_graphType;
- }
-
- /**
- * Returns the value of field 'graph'.
- *
- * @return the value of field 'Graph'.
- */
- public boolean isGraph(
- ) {
- return this._graph;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllAnnotationElement(
- ) {
- this._annotationElementList.clear();
- }
-
- /**
- * Method removeAnnotationElement.
- *
- * @param vAnnotationElement
- * @return true if the object was removed from the collection.
- */
- public boolean removeAnnotationElement(
- final jalview.binding.AnnotationElement vAnnotationElement) {
- boolean removed = _annotationElementList.remove(vAnnotationElement);
- return removed;
- }
-
- /**
- * Method removeAnnotationElementAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.AnnotationElement removeAnnotationElementAt(
- final int index) {
- java.lang.Object obj = this._annotationElementList.remove(index);
- return (jalview.binding.AnnotationElement) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vAnnotationElement
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAnnotationElement(
- final int index,
- final jalview.binding.AnnotationElement vAnnotationElement)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._annotationElementList.size()) {
- throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
- }
-
- this._annotationElementList.set(index, vAnnotationElement);
- }
-
- /**
- *
- *
- * @param vAnnotationElementArray
- */
- public void setAnnotationElement(
- final jalview.binding.AnnotationElement[] vAnnotationElementArray) {
- //-- copy array
- _annotationElementList.clear();
-
- for (int i = 0; i < vAnnotationElementArray.length; i++) {
- this._annotationElementList.add(vAnnotationElementArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'description'.
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
+ return (jalview.binding.AnnotationElement) _annotationElementList
+ .get(index);
+ }
+
+ /**
+ * Method getAnnotationElement.Returns the contents of the collection in an
+ * Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.AnnotationElement[] getAnnotationElement()
+ {
+ jalview.binding.AnnotationElement[] array = new jalview.binding.AnnotationElement[0];
+ return (jalview.binding.AnnotationElement[]) this._annotationElementList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAnnotationElementCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAnnotationElementCount()
+ {
+ return this._annotationElementList.size();
+ }
+
+ /**
+ * Returns the value of field 'description'.
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription()
+ {
+ return this._description;
+ }
+
+ /**
+ * Returns the value of field 'graph'.
+ *
+ * @return the value of field 'Graph'.
+ */
+ public boolean getGraph()
+ {
+ return this._graph;
+ }
+
+ /**
+ * Returns the value of field 'graphType'.
+ *
+ * @return the value of field 'GraphType'.
+ */
+ public int getGraphType()
+ {
+ return this._graphType;
+ }
+
+ /**
+ * Returns the value of field 'label'.
+ *
+ * @return the value of field 'Label'.
+ */
+ public java.lang.String getLabel()
+ {
+ return this._label;
+ }
+
+ /**
+ * Method hasGraph.
+ *
+ * @return true if at least one Graph has been added
+ */
+ public boolean hasGraph()
+ {
+ return this._has_graph;
+ }
+
+ /**
+ * Method hasGraphType.
+ *
+ * @return true if at least one GraphType has been added
+ */
+ public boolean hasGraphType()
+ {
+ return this._has_graphType;
+ }
+
+ /**
+ * Returns the value of field 'graph'.
+ *
+ * @return the value of field 'Graph'.
+ */
+ public boolean isGraph()
+ {
+ return this._graph;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- * Sets the value of field 'graph'.
- *
- * @param graph the value of field 'graph'.
- */
- public void setGraph(
- final boolean graph) {
- this._graph = graph;
- this._has_graph = true;
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllAnnotationElement()
+ {
+ this._annotationElementList.clear();
+ }
+
+ /**
+ * Method removeAnnotationElement.
+ *
+ * @param vAnnotationElement
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAnnotationElement(
+ final jalview.binding.AnnotationElement vAnnotationElement)
+ {
+ boolean removed = _annotationElementList.remove(vAnnotationElement);
+ return removed;
+ }
+
+ /**
+ * Method removeAnnotationElementAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.AnnotationElement removeAnnotationElementAt(
+ final int index)
+ {
+ java.lang.Object obj = this._annotationElementList.remove(index);
+ return (jalview.binding.AnnotationElement) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAnnotationElement
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAnnotationElement(final int index,
+ final jalview.binding.AnnotationElement vAnnotationElement)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._annotationElementList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "setAnnotationElement: Index value '" + index
+ + "' not in range [0.."
+ + (this._annotationElementList.size() - 1) + "]");
}
- /**
- * Sets the value of field 'graphType'.
- *
- * @param graphType the value of field 'graphType'.
- */
- public void setGraphType(
- final int graphType) {
- this._graphType = graphType;
- this._has_graphType = true;
- }
-
- /**
- * Sets the value of field 'label'.
- *
- * @param label the value of field 'label'.
- */
- public void setLabel(
- final java.lang.String label) {
- this._label = label;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Annotation
- */
- public static jalview.binding.Annotation unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._annotationElementList.set(index, vAnnotationElement);
+ }
+
+ /**
+ *
+ *
+ * @param vAnnotationElementArray
+ */
+ public void setAnnotationElement(
+ final jalview.binding.AnnotationElement[] vAnnotationElementArray)
+ {
+ // -- copy array
+ _annotationElementList.clear();
+
+ for (int i = 0; i < vAnnotationElementArray.length; i++)
+ {
+ this._annotationElementList.add(vAnnotationElementArray[i]);
}
+ }
+
+ /**
+ * Sets the value of field 'description'.
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description)
+ {
+ this._description = description;
+ }
+
+ /**
+ * Sets the value of field 'graph'.
+ *
+ * @param graph
+ * the value of field 'graph'.
+ */
+ public void setGraph(final boolean graph)
+ {
+ this._graph = graph;
+ this._has_graph = true;
+ }
+
+ /**
+ * Sets the value of field 'graphType'.
+ *
+ * @param graphType
+ * the value of field 'graphType'.
+ */
+ public void setGraphType(final int graphType)
+ {
+ this._graphType = graphType;
+ this._has_graphType = true;
+ }
+
+ /**
+ * Sets the value of field 'label'.
+ *
+ * @param label
+ * the value of field 'label'.
+ */
+ public void setLabel(final java.lang.String label)
+ {
+ this._label = label;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Annotation
+ */
+ public static jalview.binding.Annotation unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Annotation) Unmarshaller.unmarshal(
+ jalview.binding.Annotation.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/AnnotationElement.java b/src/jalview/binding/AnnotationElement.java
index 8b018c5..1f583c7 100644
--- a/src/jalview/binding/AnnotationElement.java
+++ b/src/jalview/binding/AnnotationElement.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,273 +19,287 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class AnnotationElement implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _position.
- */
- private int _position;
-
- /**
- * keeps track of state for field: _position
- */
- private boolean _has_position;
-
- /**
- * Field _displayCharacter.
- */
- private java.lang.String _displayCharacter;
-
- /**
- * Field _description.
- */
- private java.lang.String _description;
-
- /**
- * Field _secondaryStructure.
- */
- private java.lang.String _secondaryStructure;
-
- /**
- * Field _value.
- */
- private float _value;
-
- /**
- * keeps track of state for field: _value
- */
- private boolean _has_value;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AnnotationElement() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deletePosition(
- ) {
- this._has_position= false;
- }
-
- /**
- */
- public void deleteValue(
- ) {
- this._has_value= false;
- }
-
- /**
- * Returns the value of field 'description'.
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Returns the value of field 'displayCharacter'.
- *
- * @return the value of field 'DisplayCharacter'.
- */
- public java.lang.String getDisplayCharacter(
- ) {
- return this._displayCharacter;
- }
-
- /**
- * Returns the value of field 'position'.
- *
- * @return the value of field 'Position'.
- */
- public int getPosition(
- ) {
- return this._position;
- }
-
- /**
- * Returns the value of field 'secondaryStructure'.
- *
- * @return the value of field 'SecondaryStructure'.
- */
- public java.lang.String getSecondaryStructure(
- ) {
- return this._secondaryStructure;
- }
-
- /**
- * Returns the value of field 'value'.
- *
- * @return the value of field 'Value'.
- */
- public float getValue(
- ) {
- return this._value;
- }
-
- /**
- * Method hasPosition.
- *
- * @return true if at least one Position has been added
- */
- public boolean hasPosition(
- ) {
- return this._has_position;
- }
-
- /**
- * Method hasValue.
- *
- * @return true if at least one Value has been added
- */
- public boolean hasValue(
- ) {
- return this._has_value;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
+public class AnnotationElement implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _position.
+ */
+ private int _position;
+
+ /**
+ * keeps track of state for field: _position
+ */
+ private boolean _has_position;
+
+ /**
+ * Field _displayCharacter.
+ */
+ private java.lang.String _displayCharacter;
+
+ /**
+ * Field _description.
+ */
+ private java.lang.String _description;
+
+ /**
+ * Field _secondaryStructure.
+ */
+ private java.lang.String _secondaryStructure;
+
+ /**
+ * Field _value.
+ */
+ private float _value;
+
+ /**
+ * keeps track of state for field: _value
+ */
+ private boolean _has_value;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AnnotationElement()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
*/
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'description'.
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
- }
-
- /**
- * Sets the value of field 'displayCharacter'.
- *
- * @param displayCharacter the value of field 'displayCharacter'
- */
- public void setDisplayCharacter(
- final java.lang.String displayCharacter) {
- this._displayCharacter = displayCharacter;
- }
-
- /**
- * Sets the value of field 'position'.
- *
- * @param position the value of field 'position'.
- */
- public void setPosition(
- final int position) {
- this._position = position;
- this._has_position = true;
- }
-
- /**
- * Sets the value of field 'secondaryStructure'.
- *
- * @param secondaryStructure the value of field
- * 'secondaryStructure'.
- */
- public void setSecondaryStructure(
- final java.lang.String secondaryStructure) {
- this._secondaryStructure = secondaryStructure;
- }
-
- /**
- * Sets the value of field 'value'.
- *
- * @param value the value of field 'value'.
- */
- public void setValue(
- final float value) {
- this._value = value;
- this._has_value = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.AnnotationElement
- */
- public static jalview.binding.AnnotationElement unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.AnnotationElement) Unmarshaller.unmarshal(jalview.binding.AnnotationElement.class, reader);
- }
+ public void deletePosition()
+ {
+ this._has_position = false;
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
+ /**
*/
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ public void deleteValue()
+ {
+ this._has_value = false;
+ }
+
+ /**
+ * Returns the value of field 'description'.
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription()
+ {
+ return this._description;
+ }
+
+ /**
+ * Returns the value of field 'displayCharacter'.
+ *
+ * @return the value of field 'DisplayCharacter'.
+ */
+ public java.lang.String getDisplayCharacter()
+ {
+ return this._displayCharacter;
+ }
+
+ /**
+ * Returns the value of field 'position'.
+ *
+ * @return the value of field 'Position'.
+ */
+ public int getPosition()
+ {
+ return this._position;
+ }
+
+ /**
+ * Returns the value of field 'secondaryStructure'.
+ *
+ * @return the value of field 'SecondaryStructure'.
+ */
+ public java.lang.String getSecondaryStructure()
+ {
+ return this._secondaryStructure;
+ }
+
+ /**
+ * Returns the value of field 'value'.
+ *
+ * @return the value of field 'Value'.
+ */
+ public float getValue()
+ {
+ return this._value;
+ }
+
+ /**
+ * Method hasPosition.
+ *
+ * @return true if at least one Position has been added
+ */
+ public boolean hasPosition()
+ {
+ return this._has_position;
+ }
+
+ /**
+ * Method hasValue.
+ *
+ * @return true if at least one Value has been added
+ */
+ public boolean hasValue()
+ {
+ return this._has_value;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'description'.
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description)
+ {
+ this._description = description;
+ }
+
+ /**
+ * Sets the value of field 'displayCharacter'.
+ *
+ * @param displayCharacter
+ * the value of field 'displayCharacter'
+ */
+ public void setDisplayCharacter(final java.lang.String displayCharacter)
+ {
+ this._displayCharacter = displayCharacter;
+ }
+
+ /**
+ * Sets the value of field 'position'.
+ *
+ * @param position
+ * the value of field 'position'.
+ */
+ public void setPosition(final int position)
+ {
+ this._position = position;
+ this._has_position = true;
+ }
+
+ /**
+ * Sets the value of field 'secondaryStructure'.
+ *
+ * @param secondaryStructure
+ * the value of field 'secondaryStructure'.
+ */
+ public void setSecondaryStructure(
+ final java.lang.String secondaryStructure)
+ {
+ this._secondaryStructure = secondaryStructure;
+ }
+
+ /**
+ * Sets the value of field 'value'.
+ *
+ * @param value
+ * the value of field 'value'.
+ */
+ public void setValue(final float value)
+ {
+ this._value = value;
+ this._has_value = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.AnnotationElement
+ */
+ public static jalview.binding.AnnotationElement unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.AnnotationElement) Unmarshaller.unmarshal(
+ jalview.binding.AnnotationElement.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Colour.java b/src/jalview/binding/Colour.java
index 38f7740..c1de152 100644
--- a/src/jalview/binding/Colour.java
+++ b/src/jalview/binding/Colour.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,465 +19,480 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Colour implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
- /**
- * Field _RGB.
- */
- private java.lang.String _RGB;
-
- /**
- * Field _minRGB.
- */
- private java.lang.String _minRGB;
-
- /**
- * loosely specified enumeration: NONE,ABOVE, or BELOW
- */
- private java.lang.String _threshType;
-
- /**
- * Field _threshold.
- */
- private float _threshold;
-
- /**
- * keeps track of state for field: _threshold
- */
- private boolean _has_threshold;
-
- /**
- * Field _max.
- */
- private float _max;
-
- /**
- * keeps track of state for field: _max
- */
- private boolean _has_max;
-
- /**
- * Field _min.
- */
- private float _min;
-
- /**
- * keeps track of state for field: _min
- */
- private boolean _has_min;
-
- /**
- * Field _colourByLabel.
- */
- private boolean _colourByLabel;
-
- /**
- * keeps track of state for field: _colourByLabel
- */
- private boolean _has_colourByLabel;
-
- /**
- * Field _autoScale.
- */
- private boolean _autoScale;
-
- /**
- * keeps track of state for field: _autoScale
- */
- private boolean _has_autoScale;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Colour() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteAutoScale(
- ) {
- this._has_autoScale= false;
- }
-
- /**
- */
- public void deleteColourByLabel(
- ) {
- this._has_colourByLabel= false;
- }
-
- /**
- */
- public void deleteMax(
- ) {
- this._has_max= false;
- }
-
- /**
- */
- public void deleteMin(
- ) {
- this._has_min= false;
- }
-
- /**
- */
- public void deleteThreshold(
- ) {
- this._has_threshold= false;
- }
-
- /**
- * Returns the value of field 'autoScale'.
- *
- * @return the value of field 'AutoScale'.
- */
- public boolean getAutoScale(
- ) {
- return this._autoScale;
- }
-
- /**
- * Returns the value of field 'colourByLabel'.
- *
- * @return the value of field 'ColourByLabel'.
- */
- public boolean getColourByLabel(
- ) {
- return this._colourByLabel;
- }
-
- /**
- * Returns the value of field 'max'.
- *
- * @return the value of field 'Max'.
- */
- public float getMax(
- ) {
- return this._max;
- }
-
- /**
- * Returns the value of field 'min'.
- *
- * @return the value of field 'Min'.
- */
- public float getMin(
- ) {
- return this._min;
- }
-
- /**
- * Returns the value of field 'minRGB'.
- *
- * @return the value of field 'MinRGB'.
- */
- public java.lang.String getMinRGB(
- ) {
- return this._minRGB;
- }
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Returns the value of field 'RGB'.
- *
- * @return the value of field 'RGB'.
- */
- public java.lang.String getRGB(
- ) {
- return this._RGB;
- }
-
- /**
- * Returns the value of field 'threshType'. The field
- * 'threshType' has the following description: loosely
- * specified enumeration: NONE,ABOVE, or BELOW
- *
- * @return the value of field 'ThreshType'.
- */
- public java.lang.String getThreshType(
- ) {
- return this._threshType;
- }
-
- /**
- * Returns the value of field 'threshold'.
- *
- * @return the value of field 'Threshold'.
- */
- public float getThreshold(
- ) {
- return this._threshold;
- }
-
- /**
- * Method hasAutoScale.
- *
- * @return true if at least one AutoScale has been added
- */
- public boolean hasAutoScale(
- ) {
- return this._has_autoScale;
- }
-
- /**
- * Method hasColourByLabel.
- *
- * @return true if at least one ColourByLabel has been added
- */
- public boolean hasColourByLabel(
- ) {
- return this._has_colourByLabel;
- }
-
- /**
- * Method hasMax.
- *
- * @return true if at least one Max has been added
- */
- public boolean hasMax(
- ) {
- return this._has_max;
- }
-
- /**
- * Method hasMin.
- *
- * @return true if at least one Min has been added
- */
- public boolean hasMin(
- ) {
- return this._has_min;
- }
-
- /**
- * Method hasThreshold.
- *
- * @return true if at least one Threshold has been added
- */
- public boolean hasThreshold(
- ) {
- return this._has_threshold;
- }
-
- /**
- * Returns the value of field 'autoScale'.
- *
- * @return the value of field 'AutoScale'.
- */
- public boolean isAutoScale(
- ) {
- return this._autoScale;
- }
-
- /**
- * Returns the value of field 'colourByLabel'.
- *
- * @return the value of field 'ColourByLabel'.
- */
- public boolean isColourByLabel(
- ) {
- return this._colourByLabel;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'autoScale'.
- *
- * @param autoScale the value of field 'autoScale'.
- */
- public void setAutoScale(
- final boolean autoScale) {
- this._autoScale = autoScale;
- this._has_autoScale = true;
- }
-
- /**
- * Sets the value of field 'colourByLabel'.
- *
- * @param colourByLabel the value of field 'colourByLabel'.
- */
- public void setColourByLabel(
- final boolean colourByLabel) {
- this._colourByLabel = colourByLabel;
- this._has_colourByLabel = true;
- }
-
- /**
- * Sets the value of field 'max'.
- *
- * @param max the value of field 'max'.
- */
- public void setMax(
- final float max) {
- this._max = max;
- this._has_max = true;
- }
-
- /**
- * Sets the value of field 'min'.
- *
- * @param min the value of field 'min'.
- */
- public void setMin(
- final float min) {
- this._min = min;
- this._has_min = true;
- }
-
- /**
- * Sets the value of field 'minRGB'.
- *
- * @param minRGB the value of field 'minRGB'.
- */
- public void setMinRGB(
- final java.lang.String minRGB) {
- this._minRGB = minRGB;
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Sets the value of field 'RGB'.
- *
- * @param RGB the value of field 'RGB'.
- */
- public void setRGB(
- final java.lang.String RGB) {
- this._RGB = RGB;
- }
-
- /**
- * Sets the value of field 'threshType'. The field 'threshType'
- * has the following description: loosely specified
- * enumeration: NONE,ABOVE, or BELOW
- *
- * @param threshType the value of field 'threshType'.
- */
- public void setThreshType(
- final java.lang.String threshType) {
- this._threshType = threshType;
- }
-
- /**
- * Sets the value of field 'threshold'.
- *
- * @param threshold the value of field 'threshold'.
- */
- public void setThreshold(
- final float threshold) {
- this._threshold = threshold;
- this._has_threshold = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Colour
- */
- public static jalview.binding.Colour unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Colour) Unmarshaller.unmarshal(jalview.binding.Colour.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class Colour implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _RGB.
+ */
+ private java.lang.String _RGB;
+
+ /**
+ * Field _minRGB.
+ */
+ private java.lang.String _minRGB;
+
+ /**
+ * loosely specified enumeration: NONE,ABOVE, or BELOW
+ */
+ private java.lang.String _threshType;
+
+ /**
+ * Field _threshold.
+ */
+ private float _threshold;
+
+ /**
+ * keeps track of state for field: _threshold
+ */
+ private boolean _has_threshold;
+
+ /**
+ * Field _max.
+ */
+ private float _max;
+
+ /**
+ * keeps track of state for field: _max
+ */
+ private boolean _has_max;
+
+ /**
+ * Field _min.
+ */
+ private float _min;
+
+ /**
+ * keeps track of state for field: _min
+ */
+ private boolean _has_min;
+
+ /**
+ * Field _colourByLabel.
+ */
+ private boolean _colourByLabel;
+
+ /**
+ * keeps track of state for field: _colourByLabel
+ */
+ private boolean _has_colourByLabel;
+
+ /**
+ * Field _autoScale.
+ */
+ private boolean _autoScale;
+
+ /**
+ * keeps track of state for field: _autoScale
+ */
+ private boolean _has_autoScale;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Colour()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteAutoScale()
+ {
+ this._has_autoScale = false;
+ }
+
+ /**
+ */
+ public void deleteColourByLabel()
+ {
+ this._has_colourByLabel = false;
+ }
+
+ /**
+ */
+ public void deleteMax()
+ {
+ this._has_max = false;
+ }
+
+ /**
+ */
+ public void deleteMin()
+ {
+ this._has_min = false;
+ }
+
+ /**
+ */
+ public void deleteThreshold()
+ {
+ this._has_threshold = false;
+ }
+
+ /**
+ * Returns the value of field 'autoScale'.
+ *
+ * @return the value of field 'AutoScale'.
+ */
+ public boolean getAutoScale()
+ {
+ return this._autoScale;
+ }
+
+ /**
+ * Returns the value of field 'colourByLabel'.
+ *
+ * @return the value of field 'ColourByLabel'.
+ */
+ public boolean getColourByLabel()
+ {
+ return this._colourByLabel;
+ }
+
+ /**
+ * Returns the value of field 'max'.
+ *
+ * @return the value of field 'Max'.
+ */
+ public float getMax()
+ {
+ return this._max;
+ }
+
+ /**
+ * Returns the value of field 'min'.
+ *
+ * @return the value of field 'Min'.
+ */
+ public float getMin()
+ {
+ return this._min;
+ }
+
+ /**
+ * Returns the value of field 'minRGB'.
+ *
+ * @return the value of field 'MinRGB'.
+ */
+ public java.lang.String getMinRGB()
+ {
+ return this._minRGB;
+ }
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Returns the value of field 'RGB'.
+ *
+ * @return the value of field 'RGB'.
+ */
+ public java.lang.String getRGB()
+ {
+ return this._RGB;
+ }
+
+ /**
+ * Returns the value of field 'threshType'. The field 'threshType' has the
+ * following description: loosely specified enumeration: NONE,ABOVE, or BELOW
+ *
+ * @return the value of field 'ThreshType'.
+ */
+ public java.lang.String getThreshType()
+ {
+ return this._threshType;
+ }
+
+ /**
+ * Returns the value of field 'threshold'.
+ *
+ * @return the value of field 'Threshold'.
+ */
+ public float getThreshold()
+ {
+ return this._threshold;
+ }
+
+ /**
+ * Method hasAutoScale.
+ *
+ * @return true if at least one AutoScale has been added
+ */
+ public boolean hasAutoScale()
+ {
+ return this._has_autoScale;
+ }
+
+ /**
+ * Method hasColourByLabel.
+ *
+ * @return true if at least one ColourByLabel has been added
+ */
+ public boolean hasColourByLabel()
+ {
+ return this._has_colourByLabel;
+ }
+
+ /**
+ * Method hasMax.
+ *
+ * @return true if at least one Max has been added
+ */
+ public boolean hasMax()
+ {
+ return this._has_max;
+ }
+
+ /**
+ * Method hasMin.
+ *
+ * @return true if at least one Min has been added
+ */
+ public boolean hasMin()
+ {
+ return this._has_min;
+ }
+
+ /**
+ * Method hasThreshold.
+ *
+ * @return true if at least one Threshold has been added
+ */
+ public boolean hasThreshold()
+ {
+ return this._has_threshold;
+ }
+
+ /**
+ * Returns the value of field 'autoScale'.
+ *
+ * @return the value of field 'AutoScale'.
+ */
+ public boolean isAutoScale()
+ {
+ return this._autoScale;
+ }
+
+ /**
+ * Returns the value of field 'colourByLabel'.
+ *
+ * @return the value of field 'ColourByLabel'.
+ */
+ public boolean isColourByLabel()
+ {
+ return this._colourByLabel;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'autoScale'.
+ *
+ * @param autoScale
+ * the value of field 'autoScale'.
+ */
+ public void setAutoScale(final boolean autoScale)
+ {
+ this._autoScale = autoScale;
+ this._has_autoScale = true;
+ }
+
+ /**
+ * Sets the value of field 'colourByLabel'.
+ *
+ * @param colourByLabel
+ * the value of field 'colourByLabel'.
+ */
+ public void setColourByLabel(final boolean colourByLabel)
+ {
+ this._colourByLabel = colourByLabel;
+ this._has_colourByLabel = true;
+ }
+
+ /**
+ * Sets the value of field 'max'.
+ *
+ * @param max
+ * the value of field 'max'.
+ */
+ public void setMax(final float max)
+ {
+ this._max = max;
+ this._has_max = true;
+ }
+
+ /**
+ * Sets the value of field 'min'.
+ *
+ * @param min
+ * the value of field 'min'.
+ */
+ public void setMin(final float min)
+ {
+ this._min = min;
+ this._has_min = true;
+ }
+
+ /**
+ * Sets the value of field 'minRGB'.
+ *
+ * @param minRGB
+ * the value of field 'minRGB'.
+ */
+ public void setMinRGB(final java.lang.String minRGB)
+ {
+ this._minRGB = minRGB;
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Sets the value of field 'RGB'.
+ *
+ * @param RGB
+ * the value of field 'RGB'.
+ */
+ public void setRGB(final java.lang.String RGB)
+ {
+ this._RGB = RGB;
+ }
+
+ /**
+ * Sets the value of field 'threshType'. The field 'threshType' has the
+ * following description: loosely specified enumeration: NONE,ABOVE, or BELOW
+ *
+ * @param threshType
+ * the value of field 'threshType'.
+ */
+ public void setThreshType(final java.lang.String threshType)
+ {
+ this._threshType = threshType;
+ }
+
+ /**
+ * Sets the value of field 'threshold'.
+ *
+ * @param threshold
+ * the value of field 'threshold'.
+ */
+ public void setThreshold(final float threshold)
+ {
+ this._threshold = threshold;
+ this._has_threshold = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Colour
+ */
+ public static jalview.binding.Colour unmarshal(final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Colour) Unmarshaller.unmarshal(
+ jalview.binding.Colour.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Feature.java b/src/jalview/binding/Feature.java
index 53beb10..1cb6eee 100644
--- a/src/jalview/binding/Feature.java
+++ b/src/jalview/binding/Feature.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,272 +19,286 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Feature implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _begin.
- */
- private int _begin;
-
- /**
- * keeps track of state for field: _begin
- */
- private boolean _has_begin;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
- /**
- * Field _type.
- */
- private java.lang.String _type;
-
- /**
- * Field _description.
- */
- private java.lang.String _description;
-
- /**
- * Field _status.
- */
- private java.lang.String _status;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Feature() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteBegin(
- ) {
- this._has_begin= false;
- }
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- * Returns the value of field 'begin'.
- *
- * @return the value of field 'Begin'.
- */
- public int getBegin(
- ) {
- return this._begin;
- }
-
- /**
- * Returns the value of field 'description'.
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Returns the value of field 'status'.
- *
- * @return the value of field 'Status'.
- */
- public java.lang.String getStatus(
- ) {
- return this._status;
- }
-
- /**
- * Returns the value of field 'type'.
- *
- * @return the value of field 'Type'.
- */
- public java.lang.String getType(
- ) {
- return this._type;
- }
-
- /**
- * Method hasBegin.
- *
- * @return true if at least one Begin has been added
- */
- public boolean hasBegin(
- ) {
- return this._has_begin;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
+public class Feature implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _begin.
+ */
+ private int _begin;
+
+ /**
+ * keeps track of state for field: _begin
+ */
+ private boolean _has_begin;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ /**
+ * Field _type.
+ */
+ private java.lang.String _type;
+
+ /**
+ * Field _description.
+ */
+ private java.lang.String _description;
+
+ /**
+ * Field _status.
+ */
+ private java.lang.String _status;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Feature()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
*/
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'begin'.
- *
- * @param begin the value of field 'begin'.
- */
- public void setBegin(
- final int begin) {
- this._begin = begin;
- this._has_begin = true;
- }
-
- /**
- * Sets the value of field 'description'.
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- * Sets the value of field 'status'.
- *
- * @param status the value of field 'status'.
- */
- public void setStatus(
- final java.lang.String status) {
- this._status = status;
- }
-
- /**
- * Sets the value of field 'type'.
- *
- * @param type the value of field 'type'.
- */
- public void setType(
- final java.lang.String type) {
- this._type = type;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Feature
- */
- public static jalview.binding.Feature unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Feature) Unmarshaller.unmarshal(jalview.binding.Feature.class, reader);
- }
+ public void deleteBegin()
+ {
+ this._has_begin = false;
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
+ /**
*/
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ * Returns the value of field 'begin'.
+ *
+ * @return the value of field 'Begin'.
+ */
+ public int getBegin()
+ {
+ return this._begin;
+ }
+
+ /**
+ * Returns the value of field 'description'.
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription()
+ {
+ return this._description;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Returns the value of field 'status'.
+ *
+ * @return the value of field 'Status'.
+ */
+ public java.lang.String getStatus()
+ {
+ return this._status;
+ }
+
+ /**
+ * Returns the value of field 'type'.
+ *
+ * @return the value of field 'Type'.
+ */
+ public java.lang.String getType()
+ {
+ return this._type;
+ }
+
+ /**
+ * Method hasBegin.
+ *
+ * @return true if at least one Begin has been added
+ */
+ public boolean hasBegin()
+ {
+ return this._has_begin;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'begin'.
+ *
+ * @param begin
+ * the value of field 'begin'.
+ */
+ public void setBegin(final int begin)
+ {
+ this._begin = begin;
+ this._has_begin = true;
+ }
+
+ /**
+ * Sets the value of field 'description'.
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description)
+ {
+ this._description = description;
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ * Sets the value of field 'status'.
+ *
+ * @param status
+ * the value of field 'status'.
+ */
+ public void setStatus(final java.lang.String status)
+ {
+ this._status = status;
+ }
+
+ /**
+ * Sets the value of field 'type'.
+ *
+ * @param type
+ * the value of field 'type'.
+ */
+ public void setType(final java.lang.String type)
+ {
+ this._type = type;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Feature
+ */
+ public static jalview.binding.Feature unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Feature) Unmarshaller.unmarshal(
+ jalview.binding.Feature.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/FeatureSettings.java b/src/jalview/binding/FeatureSettings.java
index 1a5a830..c4d5c4f 100644
--- a/src/jalview/binding/FeatureSettings.java
+++ b/src/jalview/binding/FeatureSettings.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,257 +19,271 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class FeatureSettings implements java.io.Serializable {
+public class FeatureSettings implements java.io.Serializable
+{
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
+ /**
+ * Field _settingList.
+ */
+ private java.util.Vector _settingList;
- /**
- * Field _settingList.
- */
- private java.util.Vector _settingList;
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+ public FeatureSettings()
+ {
+ super();
+ this._settingList = new java.util.Vector();
+ }
- //----------------/
- //- Constructors -/
- //----------------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- public FeatureSettings() {
- super();
- this._settingList = new java.util.Vector();
- }
+ /**
+ *
+ *
+ * @param vSetting
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSetting(final jalview.binding.Setting vSetting)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._settingList.addElement(vSetting);
+ }
+ /**
+ *
+ *
+ * @param index
+ * @param vSetting
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSetting(final int index,
+ final jalview.binding.Setting vSetting)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._settingList.add(index, vSetting);
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ /**
+ * Method enumerateSetting.
+ *
+ * @return an Enumeration over all jalview.binding.Setting elements
+ */
+ public java.util.Enumeration enumerateSetting()
+ {
+ return this._settingList.elements();
+ }
- /**
- *
- *
- * @param vSetting
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSetting(
- final jalview.binding.Setting vSetting)
- throws java.lang.IndexOutOfBoundsException {
- this._settingList.addElement(vSetting);
+ /**
+ * Method getSetting.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.Setting at the given index
+ */
+ public jalview.binding.Setting getSetting(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._settingList.size())
+ {
+ throw new IndexOutOfBoundsException("getSetting: Index value '"
+ + index + "' not in range [0.."
+ + (this._settingList.size() - 1) + "]");
}
- /**
- *
- *
- * @param index
- * @param vSetting
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSetting(
- final int index,
- final jalview.binding.Setting vSetting)
- throws java.lang.IndexOutOfBoundsException {
- this._settingList.add(index, vSetting);
- }
+ return (jalview.binding.Setting) _settingList.get(index);
+ }
- /**
- * Method enumerateSetting.
- *
- * @return an Enumeration over all jalview.binding.Setting
- * elements
- */
- public java.util.Enumeration enumerateSetting(
- ) {
- return this._settingList.elements();
- }
+ /**
+ * Method getSetting.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.Setting[] getSetting()
+ {
+ jalview.binding.Setting[] array = new jalview.binding.Setting[0];
+ return (jalview.binding.Setting[]) this._settingList.toArray(array);
+ }
- /**
- * Method getSetting.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.Setting at the
- * given index
- */
- public jalview.binding.Setting getSetting(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._settingList.size()) {
- throw new IndexOutOfBoundsException("getSetting: Index value '" + index + "' not in range [0.." + (this._settingList.size() - 1) + "]");
- }
-
- return (jalview.binding.Setting) _settingList.get(index);
- }
+ /**
+ * Method getSettingCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSettingCount()
+ {
+ return this._settingList.size();
+ }
- /**
- * Method getSetting.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.Setting[] getSetting(
- ) {
- jalview.binding.Setting[] array = new jalview.binding.Setting[0];
- return (jalview.binding.Setting[]) this._settingList.toArray(array);
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- * Method getSettingCount.
- *
- * @return the size of this collection
- */
- public int getSettingCount(
- ) {
- return this._settingList.size();
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
+ /**
*/
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ public void removeAllSetting()
+ {
+ this._settingList.clear();
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ * Method removeSetting.
+ *
+ * @param vSetting
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSetting(final jalview.binding.Setting vSetting)
+ {
+ boolean removed = _settingList.remove(vSetting);
+ return removed;
+ }
- /**
- */
- public void removeAllSetting(
- ) {
- this._settingList.clear();
- }
+ /**
+ * Method removeSettingAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.Setting removeSettingAt(final int index)
+ {
+ java.lang.Object obj = this._settingList.remove(index);
+ return (jalview.binding.Setting) obj;
+ }
- /**
- * Method removeSetting.
- *
- * @param vSetting
- * @return true if the object was removed from the collection.
- */
- public boolean removeSetting(
- final jalview.binding.Setting vSetting) {
- boolean removed = _settingList.remove(vSetting);
- return removed;
+ /**
+ *
+ *
+ * @param index
+ * @param vSetting
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSetting(final int index,
+ final jalview.binding.Setting vSetting)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._settingList.size())
+ {
+ throw new IndexOutOfBoundsException("setSetting: Index value '"
+ + index + "' not in range [0.."
+ + (this._settingList.size() - 1) + "]");
}
- /**
- * Method removeSettingAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.Setting removeSettingAt(
- final int index) {
- java.lang.Object obj = this._settingList.remove(index);
- return (jalview.binding.Setting) obj;
- }
+ this._settingList.set(index, vSetting);
+ }
- /**
- *
- *
- * @param index
- * @param vSetting
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSetting(
- final int index,
- final jalview.binding.Setting vSetting)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._settingList.size()) {
- throw new IndexOutOfBoundsException("setSetting: Index value '" + index + "' not in range [0.." + (this._settingList.size() - 1) + "]");
- }
-
- this._settingList.set(index, vSetting);
- }
+ /**
+ *
+ *
+ * @param vSettingArray
+ */
+ public void setSetting(final jalview.binding.Setting[] vSettingArray)
+ {
+ // -- copy array
+ _settingList.clear();
- /**
- *
- *
- * @param vSettingArray
- */
- public void setSetting(
- final jalview.binding.Setting[] vSettingArray) {
- //-- copy array
- _settingList.clear();
-
- for (int i = 0; i < vSettingArray.length; i++) {
- this._settingList.add(vSettingArray[i]);
- }
+ for (int i = 0; i < vSettingArray.length; i++)
+ {
+ this._settingList.add(vSettingArray[i]);
}
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.FeatureSettings
- */
- public static jalview.binding.FeatureSettings unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.FeatureSettings) Unmarshaller.unmarshal(jalview.binding.FeatureSettings.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.FeatureSettings
+ */
+ public static jalview.binding.FeatureSettings unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.FeatureSettings) Unmarshaller.unmarshal(
+ jalview.binding.FeatureSettings.class, reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Features.java b/src/jalview/binding/Features.java
index 4b807c1..c730f4b 100644
--- a/src/jalview/binding/Features.java
+++ b/src/jalview/binding/Features.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,98 +19,106 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Features extends Feature
-implements java.io.Serializable
+public class Features extends Feature implements java.io.Serializable
{
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Features() {
- super();
- }
-
+ public Features()
+ {
+ super();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Feature
- */
- public static jalview.binding.Feature unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Feature) Unmarshaller.unmarshal(jalview.binding.Features.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Feature
+ */
+ public static jalview.binding.Feature unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Feature) Unmarshaller.unmarshal(
+ jalview.binding.Features.class, reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/JGroup.java b/src/jalview/binding/JGroup.java
index 1186169..477cc30 100644
--- a/src/jalview/binding/JGroup.java
+++ b/src/jalview/binding/JGroup.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,721 +19,742 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JGroup implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _start.
- */
- private int _start;
-
- /**
- * keeps track of state for field: _start
- */
- private boolean _has_start;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
- /**
- * Field _colour.
- */
- private java.lang.String _colour;
-
- /**
- * Field _consThreshold.
- */
- private int _consThreshold;
-
- /**
- * keeps track of state for field: _consThreshold
- */
- private boolean _has_consThreshold;
-
- /**
- * Field _pidThreshold.
- */
- private int _pidThreshold;
-
- /**
- * keeps track of state for field: _pidThreshold
- */
- private boolean _has_pidThreshold;
-
- /**
- * Field _outlineColour.
- */
- private int _outlineColour;
-
- /**
- * keeps track of state for field: _outlineColour
- */
- private boolean _has_outlineColour;
-
- /**
- * Field _displayBoxes.
- */
- private boolean _displayBoxes;
-
- /**
- * keeps track of state for field: _displayBoxes
- */
- private boolean _has_displayBoxes;
-
- /**
- * Field _displayText.
- */
- private boolean _displayText;
-
- /**
- * keeps track of state for field: _displayText
- */
- private boolean _has_displayText;
-
- /**
- * Field _colourText.
- */
- private boolean _colourText;
-
- /**
- * keeps track of state for field: _colourText
- */
- private boolean _has_colourText;
-
- /**
- * Field _seqList.
- */
- private java.util.Vector _seqList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JGroup() {
- super();
- this._seqList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSeq(
- final int vSeq)
- throws java.lang.IndexOutOfBoundsException {
- this._seqList.addElement(new java.lang.Integer(vSeq));
- }
-
- /**
- *
- *
- * @param index
- * @param vSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSeq(
- final int index,
- final int vSeq)
- throws java.lang.IndexOutOfBoundsException {
- this._seqList.add(index, new java.lang.Integer(vSeq));
- }
-
- /**
- */
- public void deleteColourText(
- ) {
- this._has_colourText= false;
- }
-
- /**
- */
- public void deleteConsThreshold(
- ) {
- this._has_consThreshold= false;
- }
-
- /**
- */
- public void deleteDisplayBoxes(
- ) {
- this._has_displayBoxes= false;
- }
-
- /**
- */
- public void deleteDisplayText(
- ) {
- this._has_displayText= false;
- }
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteOutlineColour(
- ) {
- this._has_outlineColour= false;
- }
-
- /**
- */
- public void deletePidThreshold(
- ) {
- this._has_pidThreshold= false;
- }
-
- /**
- */
- public void deleteStart(
- ) {
- this._has_start= false;
- }
-
- /**
- * Method enumerateSeq.
- *
- * @return an Enumeration over all int elements
- */
- public java.util.Enumeration enumerateSeq(
- ) {
- return this._seqList.elements();
- }
-
- /**
- * Returns the value of field 'colour'.
- *
- * @return the value of field 'Colour'.
- */
- public java.lang.String getColour(
- ) {
- return this._colour;
- }
-
- /**
- * Returns the value of field 'colourText'.
- *
- * @return the value of field 'ColourText'.
- */
- public boolean getColourText(
- ) {
- return this._colourText;
- }
-
- /**
- * Returns the value of field 'consThreshold'.
- *
- * @return the value of field 'ConsThreshold'.
- */
- public int getConsThreshold(
- ) {
- return this._consThreshold;
- }
-
- /**
- * Returns the value of field 'displayBoxes'.
- *
- * @return the value of field 'DisplayBoxes'.
- */
- public boolean getDisplayBoxes(
- ) {
- return this._displayBoxes;
- }
-
- /**
- * Returns the value of field 'displayText'.
- *
- * @return the value of field 'DisplayText'.
- */
- public boolean getDisplayText(
- ) {
- return this._displayText;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Returns the value of field 'outlineColour'.
- *
- * @return the value of field 'OutlineColour'.
- */
- public int getOutlineColour(
- ) {
- return this._outlineColour;
- }
-
- /**
- * Returns the value of field 'pidThreshold'.
- *
- * @return the value of field 'PidThreshold'.
- */
- public int getPidThreshold(
- ) {
- return this._pidThreshold;
- }
-
- /**
- * Method getSeq.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the int at the given index
- */
- public int getSeq(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._seqList.size()) {
- throw new IndexOutOfBoundsException("getSeq: Index value '" + index + "' not in range [0.." + (this._seqList.size() - 1) + "]");
- }
-
- return ((java.lang.Integer) _seqList.get(index)).intValue();
- }
-
- /**
- * Method getSeq.Returns the contents of the collection in an
- * Array.
- *
- * @return this collection as an Array
- */
- public int[] getSeq(
- ) {
- int size = this._seqList.size();
- int[] array = new int[size];
- java.util.Iterator iter = _seqList.iterator();
- for (int index = 0; index < size; index++) {
- array[index] = ((java.lang.Integer) iter.next()).intValue();
- }
- return array;
- }
-
- /**
- * Method getSeqCount.
- *
- * @return the size of this collection
- */
- public int getSeqCount(
- ) {
- return this._seqList.size();
- }
-
- /**
- * Returns the value of field 'start'.
- *
- * @return the value of field 'Start'.
- */
- public int getStart(
- ) {
- return this._start;
- }
-
- /**
- * Method hasColourText.
- *
- * @return true if at least one ColourText has been added
- */
- public boolean hasColourText(
- ) {
- return this._has_colourText;
- }
-
- /**
- * Method hasConsThreshold.
- *
- * @return true if at least one ConsThreshold has been added
- */
- public boolean hasConsThreshold(
- ) {
- return this._has_consThreshold;
- }
-
- /**
- * Method hasDisplayBoxes.
- *
- * @return true if at least one DisplayBoxes has been added
- */
- public boolean hasDisplayBoxes(
- ) {
- return this._has_displayBoxes;
- }
-
- /**
- * Method hasDisplayText.
- *
- * @return true if at least one DisplayText has been added
- */
- public boolean hasDisplayText(
- ) {
- return this._has_displayText;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method hasOutlineColour.
- *
- * @return true if at least one OutlineColour has been added
- */
- public boolean hasOutlineColour(
- ) {
- return this._has_outlineColour;
- }
-
- /**
- * Method hasPidThreshold.
- *
- * @return true if at least one PidThreshold has been added
- */
- public boolean hasPidThreshold(
- ) {
- return this._has_pidThreshold;
- }
-
- /**
- * Method hasStart.
- *
- * @return true if at least one Start has been added
- */
- public boolean hasStart(
- ) {
- return this._has_start;
- }
-
- /**
- * Returns the value of field 'colourText'.
- *
- * @return the value of field 'ColourText'.
- */
- public boolean isColourText(
- ) {
- return this._colourText;
- }
-
- /**
- * Returns the value of field 'displayBoxes'.
- *
- * @return the value of field 'DisplayBoxes'.
- */
- public boolean isDisplayBoxes(
- ) {
- return this._displayBoxes;
- }
-
- /**
- * Returns the value of field 'displayText'.
- *
- * @return the value of field 'DisplayText'.
- */
- public boolean isDisplayText(
- ) {
- return this._displayText;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllSeq(
- ) {
- this._seqList.clear();
- }
-
- /**
- * Method removeSeq.
- *
- * @param vSeq
- * @return true if the object was removed from the collection.
- */
- public boolean removeSeq(
- final int vSeq) {
- boolean removed = _seqList.remove(new java.lang.Integer(vSeq));
- return removed;
- }
-
- /**
- * Method removeSeqAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public int removeSeqAt(
- final int index) {
- java.lang.Object obj = this._seqList.remove(index);
- return ((java.lang.Integer) obj).intValue();
- }
-
- /**
- * Sets the value of field 'colour'.
- *
- * @param colour the value of field 'colour'.
- */
- public void setColour(
- final java.lang.String colour) {
- this._colour = colour;
- }
-
- /**
- * Sets the value of field 'colourText'.
- *
- * @param colourText the value of field 'colourText'.
- */
- public void setColourText(
- final boolean colourText) {
- this._colourText = colourText;
- this._has_colourText = true;
- }
-
- /**
- * Sets the value of field 'consThreshold'.
- *
- * @param consThreshold the value of field 'consThreshold'.
- */
- public void setConsThreshold(
- final int consThreshold) {
- this._consThreshold = consThreshold;
- this._has_consThreshold = true;
- }
-
- /**
- * Sets the value of field 'displayBoxes'.
- *
- * @param displayBoxes the value of field 'displayBoxes'.
- */
- public void setDisplayBoxes(
- final boolean displayBoxes) {
- this._displayBoxes = displayBoxes;
- this._has_displayBoxes = true;
- }
-
- /**
- * Sets the value of field 'displayText'.
- *
- * @param displayText the value of field 'displayText'.
- */
- public void setDisplayText(
- final boolean displayText) {
- this._displayText = displayText;
- this._has_displayText = true;
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Sets the value of field 'outlineColour'.
- *
- * @param outlineColour the value of field 'outlineColour'.
- */
- public void setOutlineColour(
- final int outlineColour) {
- this._outlineColour = outlineColour;
- this._has_outlineColour = true;
- }
-
- /**
- * Sets the value of field 'pidThreshold'.
- *
- * @param pidThreshold the value of field 'pidThreshold'.
- */
- public void setPidThreshold(
- final int pidThreshold) {
- this._pidThreshold = pidThreshold;
- this._has_pidThreshold = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSeq(
- final int index,
- final int vSeq)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._seqList.size()) {
- throw new IndexOutOfBoundsException("setSeq: Index value '" + index + "' not in range [0.." + (this._seqList.size() - 1) + "]");
- }
-
- this._seqList.set(index, new java.lang.Integer(vSeq));
- }
-
- /**
- *
- *
- * @param vSeqArray
- */
- public void setSeq(
- final int[] vSeqArray) {
- //-- copy array
- _seqList.clear();
-
- for (int i = 0; i < vSeqArray.length; i++) {
- this._seqList.add(new java.lang.Integer(vSeqArray[i]));
- }
- }
-
- /**
- * Sets the value of field 'start'.
- *
- * @param start the value of field 'start'.
- */
- public void setStart(
- final int start) {
- this._start = start;
- this._has_start = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.JGroup
- */
- public static jalview.binding.JGroup unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class JGroup implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _start.
+ */
+ private int _start;
+
+ /**
+ * keeps track of state for field: _start
+ */
+ private boolean _has_start;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _colour.
+ */
+ private java.lang.String _colour;
+
+ /**
+ * Field _consThreshold.
+ */
+ private int _consThreshold;
+
+ /**
+ * keeps track of state for field: _consThreshold
+ */
+ private boolean _has_consThreshold;
+
+ /**
+ * Field _pidThreshold.
+ */
+ private int _pidThreshold;
+
+ /**
+ * keeps track of state for field: _pidThreshold
+ */
+ private boolean _has_pidThreshold;
+
+ /**
+ * Field _outlineColour.
+ */
+ private int _outlineColour;
+
+ /**
+ * keeps track of state for field: _outlineColour
+ */
+ private boolean _has_outlineColour;
+
+ /**
+ * Field _displayBoxes.
+ */
+ private boolean _displayBoxes;
+
+ /**
+ * keeps track of state for field: _displayBoxes
+ */
+ private boolean _has_displayBoxes;
+
+ /**
+ * Field _displayText.
+ */
+ private boolean _displayText;
+
+ /**
+ * keeps track of state for field: _displayText
+ */
+ private boolean _has_displayText;
+
+ /**
+ * Field _colourText.
+ */
+ private boolean _colourText;
+
+ /**
+ * keeps track of state for field: _colourText
+ */
+ private boolean _has_colourText;
+
+ /**
+ * Field _seqList.
+ */
+ private java.util.Vector _seqList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JGroup()
+ {
+ super();
+ this._seqList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSeq(final int vSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._seqList.addElement(new java.lang.Integer(vSeq));
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSeq(final int index, final int vSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._seqList.add(index, new java.lang.Integer(vSeq));
+ }
+
+ /**
+ */
+ public void deleteColourText()
+ {
+ this._has_colourText = false;
+ }
+
+ /**
+ */
+ public void deleteConsThreshold()
+ {
+ this._has_consThreshold = false;
+ }
+
+ /**
+ */
+ public void deleteDisplayBoxes()
+ {
+ this._has_displayBoxes = false;
+ }
+
+ /**
+ */
+ public void deleteDisplayText()
+ {
+ this._has_displayText = false;
+ }
+
+ /**
+ */
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteOutlineColour()
+ {
+ this._has_outlineColour = false;
+ }
+
+ /**
+ */
+ public void deletePidThreshold()
+ {
+ this._has_pidThreshold = false;
+ }
+
+ /**
+ */
+ public void deleteStart()
+ {
+ this._has_start = false;
+ }
+
+ /**
+ * Method enumerateSeq.
+ *
+ * @return an Enumeration over all int elements
+ */
+ public java.util.Enumeration enumerateSeq()
+ {
+ return this._seqList.elements();
+ }
+
+ /**
+ * Returns the value of field 'colour'.
+ *
+ * @return the value of field 'Colour'.
+ */
+ public java.lang.String getColour()
+ {
+ return this._colour;
+ }
+
+ /**
+ * Returns the value of field 'colourText'.
+ *
+ * @return the value of field 'ColourText'.
+ */
+ public boolean getColourText()
+ {
+ return this._colourText;
+ }
+
+ /**
+ * Returns the value of field 'consThreshold'.
+ *
+ * @return the value of field 'ConsThreshold'.
+ */
+ public int getConsThreshold()
+ {
+ return this._consThreshold;
+ }
+
+ /**
+ * Returns the value of field 'displayBoxes'.
+ *
+ * @return the value of field 'DisplayBoxes'.
+ */
+ public boolean getDisplayBoxes()
+ {
+ return this._displayBoxes;
+ }
+
+ /**
+ * Returns the value of field 'displayText'.
+ *
+ * @return the value of field 'DisplayText'.
+ */
+ public boolean getDisplayText()
+ {
+ return this._displayText;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Returns the value of field 'outlineColour'.
+ *
+ * @return the value of field 'OutlineColour'.
+ */
+ public int getOutlineColour()
+ {
+ return this._outlineColour;
+ }
+
+ /**
+ * Returns the value of field 'pidThreshold'.
+ *
+ * @return the value of field 'PidThreshold'.
+ */
+ public int getPidThreshold()
+ {
+ return this._pidThreshold;
+ }
+
+ /**
+ * Method getSeq.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the int at the given index
+ */
+ public int getSeq(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._seqList.size())
+ {
+ throw new IndexOutOfBoundsException("getSeq: Index value '" + index
+ + "' not in range [0.." + (this._seqList.size() - 1) + "]");
+ }
+
+ return ((java.lang.Integer) _seqList.get(index)).intValue();
+ }
+
+ /**
+ * Method getSeq.Returns the contents of the collection in an Array.
+ *
+ * @return this collection as an Array
+ */
+ public int[] getSeq()
+ {
+ int size = this._seqList.size();
+ int[] array = new int[size];
+ java.util.Iterator iter = _seqList.iterator();
+ for (int index = 0; index < size; index++)
+ {
+ array[index] = ((java.lang.Integer) iter.next()).intValue();
+ }
+ return array;
+ }
+
+ /**
+ * Method getSeqCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSeqCount()
+ {
+ return this._seqList.size();
+ }
+
+ /**
+ * Returns the value of field 'start'.
+ *
+ * @return the value of field 'Start'.
+ */
+ public int getStart()
+ {
+ return this._start;
+ }
+
+ /**
+ * Method hasColourText.
+ *
+ * @return true if at least one ColourText has been added
+ */
+ public boolean hasColourText()
+ {
+ return this._has_colourText;
+ }
+
+ /**
+ * Method hasConsThreshold.
+ *
+ * @return true if at least one ConsThreshold has been added
+ */
+ public boolean hasConsThreshold()
+ {
+ return this._has_consThreshold;
+ }
+
+ /**
+ * Method hasDisplayBoxes.
+ *
+ * @return true if at least one DisplayBoxes has been added
+ */
+ public boolean hasDisplayBoxes()
+ {
+ return this._has_displayBoxes;
+ }
+
+ /**
+ * Method hasDisplayText.
+ *
+ * @return true if at least one DisplayText has been added
+ */
+ public boolean hasDisplayText()
+ {
+ return this._has_displayText;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasOutlineColour.
+ *
+ * @return true if at least one OutlineColour has been added
+ */
+ public boolean hasOutlineColour()
+ {
+ return this._has_outlineColour;
+ }
+
+ /**
+ * Method hasPidThreshold.
+ *
+ * @return true if at least one PidThreshold has been added
+ */
+ public boolean hasPidThreshold()
+ {
+ return this._has_pidThreshold;
+ }
+
+ /**
+ * Method hasStart.
+ *
+ * @return true if at least one Start has been added
+ */
+ public boolean hasStart()
+ {
+ return this._has_start;
+ }
+
+ /**
+ * Returns the value of field 'colourText'.
+ *
+ * @return the value of field 'ColourText'.
+ */
+ public boolean isColourText()
+ {
+ return this._colourText;
+ }
+
+ /**
+ * Returns the value of field 'displayBoxes'.
+ *
+ * @return the value of field 'DisplayBoxes'.
+ */
+ public boolean isDisplayBoxes()
+ {
+ return this._displayBoxes;
+ }
+
+ /**
+ * Returns the value of field 'displayText'.
+ *
+ * @return the value of field 'DisplayText'.
+ */
+ public boolean isDisplayText()
+ {
+ return this._displayText;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllSeq()
+ {
+ this._seqList.clear();
+ }
+
+ /**
+ * Method removeSeq.
+ *
+ * @param vSeq
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSeq(final int vSeq)
+ {
+ boolean removed = _seqList.remove(new java.lang.Integer(vSeq));
+ return removed;
+ }
+
+ /**
+ * Method removeSeqAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public int removeSeqAt(final int index)
+ {
+ java.lang.Object obj = this._seqList.remove(index);
+ return ((java.lang.Integer) obj).intValue();
+ }
+
+ /**
+ * Sets the value of field 'colour'.
+ *
+ * @param colour
+ * the value of field 'colour'.
+ */
+ public void setColour(final java.lang.String colour)
+ {
+ this._colour = colour;
+ }
+
+ /**
+ * Sets the value of field 'colourText'.
+ *
+ * @param colourText
+ * the value of field 'colourText'.
+ */
+ public void setColourText(final boolean colourText)
+ {
+ this._colourText = colourText;
+ this._has_colourText = true;
+ }
+
+ /**
+ * Sets the value of field 'consThreshold'.
+ *
+ * @param consThreshold
+ * the value of field 'consThreshold'.
+ */
+ public void setConsThreshold(final int consThreshold)
+ {
+ this._consThreshold = consThreshold;
+ this._has_consThreshold = true;
+ }
+
+ /**
+ * Sets the value of field 'displayBoxes'.
+ *
+ * @param displayBoxes
+ * the value of field 'displayBoxes'.
+ */
+ public void setDisplayBoxes(final boolean displayBoxes)
+ {
+ this._displayBoxes = displayBoxes;
+ this._has_displayBoxes = true;
+ }
+
+ /**
+ * Sets the value of field 'displayText'.
+ *
+ * @param displayText
+ * the value of field 'displayText'.
+ */
+ public void setDisplayText(final boolean displayText)
+ {
+ this._displayText = displayText;
+ this._has_displayText = true;
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Sets the value of field 'outlineColour'.
+ *
+ * @param outlineColour
+ * the value of field 'outlineColour'.
+ */
+ public void setOutlineColour(final int outlineColour)
+ {
+ this._outlineColour = outlineColour;
+ this._has_outlineColour = true;
+ }
+
+ /**
+ * Sets the value of field 'pidThreshold'.
+ *
+ * @param pidThreshold
+ * the value of field 'pidThreshold'.
+ */
+ public void setPidThreshold(final int pidThreshold)
+ {
+ this._pidThreshold = pidThreshold;
+ this._has_pidThreshold = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSeq(final int index, final int vSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._seqList.size())
+ {
+ throw new IndexOutOfBoundsException("setSeq: Index value '" + index
+ + "' not in range [0.." + (this._seqList.size() - 1) + "]");
+ }
+
+ this._seqList.set(index, new java.lang.Integer(vSeq));
+ }
+
+ /**
+ *
+ *
+ * @param vSeqArray
+ */
+ public void setSeq(final int[] vSeqArray)
+ {
+ // -- copy array
+ _seqList.clear();
+
+ for (int i = 0; i < vSeqArray.length; i++)
+ {
+ this._seqList.add(new java.lang.Integer(vSeqArray[i]));
+ }
+ }
+
+ /**
+ * Sets the value of field 'start'.
+ *
+ * @param start
+ * the value of field 'start'.
+ */
+ public void setStart(final int start)
+ {
+ this._start = start;
+ this._has_start = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.JGroup
+ */
+ public static jalview.binding.JGroup unmarshal(final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.JGroup) Unmarshaller.unmarshal(
+ jalview.binding.JGroup.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/JSeq.java b/src/jalview/binding/JSeq.java
index 407640a..996a807 100644
--- a/src/jalview/binding/JSeq.java
+++ b/src/jalview/binding/JSeq.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,605 +19,627 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JSeq implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _colour.
- */
- private int _colour;
-
- /**
- * keeps track of state for field: _colour
- */
- private boolean _has_colour;
-
- /**
- * Field _start.
- */
- private int _start;
-
- /**
- * keeps track of state for field: _start
- */
- private boolean _has_start;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
- /**
- * Field _id.
- */
- private int _id;
-
- /**
- * keeps track of state for field: _id
- */
- private boolean _has_id;
-
- /**
- * Field _featuresList.
- */
- private java.util.Vector _featuresList;
-
- /**
- * Field _pdbidsList.
- */
- private java.util.Vector _pdbidsList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JSeq() {
- super();
- this._featuresList = new java.util.Vector();
- this._pdbidsList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vFeatures
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addFeatures(
- final jalview.binding.Features vFeatures)
- throws java.lang.IndexOutOfBoundsException {
- this._featuresList.addElement(vFeatures);
- }
-
- /**
- *
- *
- * @param index
- * @param vFeatures
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addFeatures(
- final int index,
- final jalview.binding.Features vFeatures)
- throws java.lang.IndexOutOfBoundsException {
- this._featuresList.add(index, vFeatures);
- }
-
- /**
- *
- *
- * @param vPdbids
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbids(
- final jalview.binding.Pdbids vPdbids)
- throws java.lang.IndexOutOfBoundsException {
- this._pdbidsList.addElement(vPdbids);
- }
-
- /**
- *
- *
- * @param index
- * @param vPdbids
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbids(
- final int index,
- final jalview.binding.Pdbids vPdbids)
- throws java.lang.IndexOutOfBoundsException {
- this._pdbidsList.add(index, vPdbids);
- }
-
- /**
- */
- public void deleteColour(
- ) {
- this._has_colour= false;
- }
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteId(
- ) {
- this._has_id= false;
- }
-
- /**
- */
- public void deleteStart(
- ) {
- this._has_start= false;
- }
-
- /**
- * Method enumerateFeatures.
- *
- * @return an Enumeration over all jalview.binding.Features
- * elements
- */
- public java.util.Enumeration enumerateFeatures(
- ) {
- return this._featuresList.elements();
- }
-
- /**
- * Method enumeratePdbids.
- *
- * @return an Enumeration over all jalview.binding.Pdbids
- * elements
- */
- public java.util.Enumeration enumeratePdbids(
- ) {
- return this._pdbidsList.elements();
- }
-
- /**
- * Returns the value of field 'colour'.
- *
- * @return the value of field 'Colour'.
- */
- public int getColour(
- ) {
- return this._colour;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Method getFeatures.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.Features at the
- * given index
- */
- public jalview.binding.Features getFeatures(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._featuresList.size()) {
- throw new IndexOutOfBoundsException("getFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
- }
-
- return (jalview.binding.Features) _featuresList.get(index);
- }
-
- /**
- * Method getFeatures.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.Features[] getFeatures(
- ) {
- jalview.binding.Features[] array = new jalview.binding.Features[0];
- return (jalview.binding.Features[]) this._featuresList.toArray(array);
- }
-
- /**
- * Method getFeaturesCount.
- *
- * @return the size of this collection
- */
- public int getFeaturesCount(
- ) {
- return this._featuresList.size();
- }
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public int getId(
- ) {
- return this._id;
- }
-
- /**
- * Method getPdbids.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.Pdbids at the given
- * index
- */
- public jalview.binding.Pdbids getPdbids(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._pdbidsList.size()) {
- throw new IndexOutOfBoundsException("getPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
- }
-
- return (jalview.binding.Pdbids) _pdbidsList.get(index);
- }
-
- /**
- * Method getPdbids.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.Pdbids[] getPdbids(
- ) {
- jalview.binding.Pdbids[] array = new jalview.binding.Pdbids[0];
- return (jalview.binding.Pdbids[]) this._pdbidsList.toArray(array);
- }
-
- /**
- * Method getPdbidsCount.
- *
- * @return the size of this collection
- */
- public int getPdbidsCount(
- ) {
- return this._pdbidsList.size();
- }
-
- /**
- * Returns the value of field 'start'.
- *
- * @return the value of field 'Start'.
- */
- public int getStart(
- ) {
- return this._start;
- }
-
- /**
- * Method hasColour.
- *
- * @return true if at least one Colour has been added
- */
- public boolean hasColour(
- ) {
- return this._has_colour;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method hasId.
- *
- * @return true if at least one Id has been added
- */
- public boolean hasId(
- ) {
- return this._has_id;
- }
-
- /**
- * Method hasStart.
- *
- * @return true if at least one Start has been added
- */
- public boolean hasStart(
- ) {
- return this._has_start;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllFeatures(
- ) {
- this._featuresList.clear();
- }
-
- /**
- */
- public void removeAllPdbids(
- ) {
- this._pdbidsList.clear();
- }
-
- /**
- * Method removeFeatures.
- *
- * @param vFeatures
- * @return true if the object was removed from the collection.
- */
- public boolean removeFeatures(
- final jalview.binding.Features vFeatures) {
- boolean removed = _featuresList.remove(vFeatures);
- return removed;
- }
-
- /**
- * Method removeFeaturesAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.Features removeFeaturesAt(
- final int index) {
- java.lang.Object obj = this._featuresList.remove(index);
- return (jalview.binding.Features) obj;
- }
-
- /**
- * Method removePdbids.
- *
- * @param vPdbids
- * @return true if the object was removed from the collection.
- */
- public boolean removePdbids(
- final jalview.binding.Pdbids vPdbids) {
- boolean removed = _pdbidsList.remove(vPdbids);
- return removed;
- }
-
- /**
- * Method removePdbidsAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.Pdbids removePdbidsAt(
- final int index) {
- java.lang.Object obj = this._pdbidsList.remove(index);
- return (jalview.binding.Pdbids) obj;
- }
-
- /**
- * Sets the value of field 'colour'.
- *
- * @param colour the value of field 'colour'.
- */
- public void setColour(
- final int colour) {
- this._colour = colour;
- this._has_colour = true;
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vFeatures
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setFeatures(
- final int index,
- final jalview.binding.Features vFeatures)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._featuresList.size()) {
- throw new IndexOutOfBoundsException("setFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
- }
-
- this._featuresList.set(index, vFeatures);
- }
-
- /**
- *
- *
- * @param vFeaturesArray
- */
- public void setFeatures(
- final jalview.binding.Features[] vFeaturesArray) {
- //-- copy array
- _featuresList.clear();
-
- for (int i = 0; i < vFeaturesArray.length; i++) {
- this._featuresList.add(vFeaturesArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final int id) {
- this._id = id;
- this._has_id = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vPdbids
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setPdbids(
- final int index,
- final jalview.binding.Pdbids vPdbids)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._pdbidsList.size()) {
- throw new IndexOutOfBoundsException("setPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
- }
-
- this._pdbidsList.set(index, vPdbids);
- }
-
- /**
- *
- *
- * @param vPdbidsArray
- */
- public void setPdbids(
- final jalview.binding.Pdbids[] vPdbidsArray) {
- //-- copy array
- _pdbidsList.clear();
-
- for (int i = 0; i < vPdbidsArray.length; i++) {
- this._pdbidsList.add(vPdbidsArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'start'.
- *
- * @param start the value of field 'start'.
- */
- public void setStart(
- final int start) {
- this._start = start;
- this._has_start = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.JSeq
- */
- public static jalview.binding.JSeq unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.JSeq) Unmarshaller.unmarshal(jalview.binding.JSeq.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class JSeq implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _colour.
+ */
+ private int _colour;
+
+ /**
+ * keeps track of state for field: _colour
+ */
+ private boolean _has_colour;
+
+ /**
+ * Field _start.
+ */
+ private int _start;
+
+ /**
+ * keeps track of state for field: _start
+ */
+ private boolean _has_start;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ /**
+ * Field _id.
+ */
+ private int _id;
+
+ /**
+ * keeps track of state for field: _id
+ */
+ private boolean _has_id;
+
+ /**
+ * Field _featuresList.
+ */
+ private java.util.Vector _featuresList;
+
+ /**
+ * Field _pdbidsList.
+ */
+ private java.util.Vector _pdbidsList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JSeq()
+ {
+ super();
+ this._featuresList = new java.util.Vector();
+ this._pdbidsList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vFeatures
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addFeatures(final jalview.binding.Features vFeatures)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._featuresList.addElement(vFeatures);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vFeatures
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addFeatures(final int index,
+ final jalview.binding.Features vFeatures)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._featuresList.add(index, vFeatures);
+ }
+
+ /**
+ *
+ *
+ * @param vPdbids
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbids(final jalview.binding.Pdbids vPdbids)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._pdbidsList.addElement(vPdbids);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbids
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbids(final int index,
+ final jalview.binding.Pdbids vPdbids)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._pdbidsList.add(index, vPdbids);
+ }
+
+ /**
+ */
+ public void deleteColour()
+ {
+ this._has_colour = false;
+ }
+
+ /**
+ */
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteId()
+ {
+ this._has_id = false;
+ }
+
+ /**
+ */
+ public void deleteStart()
+ {
+ this._has_start = false;
+ }
+
+ /**
+ * Method enumerateFeatures.
+ *
+ * @return an Enumeration over all jalview.binding.Features elements
+ */
+ public java.util.Enumeration enumerateFeatures()
+ {
+ return this._featuresList.elements();
+ }
+
+ /**
+ * Method enumeratePdbids.
+ *
+ * @return an Enumeration over all jalview.binding.Pdbids elements
+ */
+ public java.util.Enumeration enumeratePdbids()
+ {
+ return this._pdbidsList.elements();
+ }
+
+ /**
+ * Returns the value of field 'colour'.
+ *
+ * @return the value of field 'Colour'.
+ */
+ public int getColour()
+ {
+ return this._colour;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Method getFeatures.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.Features at the given index
+ */
+ public jalview.binding.Features getFeatures(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._featuresList.size())
+ {
+ throw new IndexOutOfBoundsException("getFeatures: Index value '"
+ + index + "' not in range [0.."
+ + (this._featuresList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.Features) _featuresList.get(index);
+ }
+
+ /**
+ * Method getFeatures.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.Features[] getFeatures()
+ {
+ jalview.binding.Features[] array = new jalview.binding.Features[0];
+ return (jalview.binding.Features[]) this._featuresList.toArray(array);
+ }
+
+ /**
+ * Method getFeaturesCount.
+ *
+ * @return the size of this collection
+ */
+ public int getFeaturesCount()
+ {
+ return this._featuresList.size();
+ }
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public int getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Method getPdbids.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.Pdbids at the given index
+ */
+ public jalview.binding.Pdbids getPdbids(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._pdbidsList.size())
+ {
+ throw new IndexOutOfBoundsException("getPdbids: Index value '"
+ + index + "' not in range [0.."
+ + (this._pdbidsList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.Pdbids) _pdbidsList.get(index);
+ }
+
+ /**
+ * Method getPdbids.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.Pdbids[] getPdbids()
+ {
+ jalview.binding.Pdbids[] array = new jalview.binding.Pdbids[0];
+ return (jalview.binding.Pdbids[]) this._pdbidsList.toArray(array);
+ }
+
+ /**
+ * Method getPdbidsCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPdbidsCount()
+ {
+ return this._pdbidsList.size();
+ }
+
+ /**
+ * Returns the value of field 'start'.
+ *
+ * @return the value of field 'Start'.
+ */
+ public int getStart()
+ {
+ return this._start;
+ }
+
+ /**
+ * Method hasColour.
+ *
+ * @return true if at least one Colour has been added
+ */
+ public boolean hasColour()
+ {
+ return this._has_colour;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasId.
+ *
+ * @return true if at least one Id has been added
+ */
+ public boolean hasId()
+ {
+ return this._has_id;
+ }
+
+ /**
+ * Method hasStart.
+ *
+ * @return true if at least one Start has been added
+ */
+ public boolean hasStart()
+ {
+ return this._has_start;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllFeatures()
+ {
+ this._featuresList.clear();
+ }
+
+ /**
+ */
+ public void removeAllPdbids()
+ {
+ this._pdbidsList.clear();
+ }
+
+ /**
+ * Method removeFeatures.
+ *
+ * @param vFeatures
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeFeatures(final jalview.binding.Features vFeatures)
+ {
+ boolean removed = _featuresList.remove(vFeatures);
+ return removed;
+ }
+
+ /**
+ * Method removeFeaturesAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.Features removeFeaturesAt(final int index)
+ {
+ java.lang.Object obj = this._featuresList.remove(index);
+ return (jalview.binding.Features) obj;
+ }
+
+ /**
+ * Method removePdbids.
+ *
+ * @param vPdbids
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removePdbids(final jalview.binding.Pdbids vPdbids)
+ {
+ boolean removed = _pdbidsList.remove(vPdbids);
+ return removed;
+ }
+
+ /**
+ * Method removePdbidsAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.Pdbids removePdbidsAt(final int index)
+ {
+ java.lang.Object obj = this._pdbidsList.remove(index);
+ return (jalview.binding.Pdbids) obj;
+ }
+
+ /**
+ * Sets the value of field 'colour'.
+ *
+ * @param colour
+ * the value of field 'colour'.
+ */
+ public void setColour(final int colour)
+ {
+ this._colour = colour;
+ this._has_colour = true;
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vFeatures
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setFeatures(final int index,
+ final jalview.binding.Features vFeatures)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._featuresList.size())
+ {
+ throw new IndexOutOfBoundsException("setFeatures: Index value '"
+ + index + "' not in range [0.."
+ + (this._featuresList.size() - 1) + "]");
+ }
+
+ this._featuresList.set(index, vFeatures);
+ }
+
+ /**
+ *
+ *
+ * @param vFeaturesArray
+ */
+ public void setFeatures(final jalview.binding.Features[] vFeaturesArray)
+ {
+ // -- copy array
+ _featuresList.clear();
+
+ for (int i = 0; i < vFeaturesArray.length; i++)
+ {
+ this._featuresList.add(vFeaturesArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final int id)
+ {
+ this._id = id;
+ this._has_id = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbids
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setPdbids(final int index,
+ final jalview.binding.Pdbids vPdbids)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._pdbidsList.size())
+ {
+ throw new IndexOutOfBoundsException("setPdbids: Index value '"
+ + index + "' not in range [0.."
+ + (this._pdbidsList.size() - 1) + "]");
+ }
+
+ this._pdbidsList.set(index, vPdbids);
+ }
+
+ /**
+ *
+ *
+ * @param vPdbidsArray
+ */
+ public void setPdbids(final jalview.binding.Pdbids[] vPdbidsArray)
+ {
+ // -- copy array
+ _pdbidsList.clear();
+
+ for (int i = 0; i < vPdbidsArray.length; i++)
+ {
+ this._pdbidsList.add(vPdbidsArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'start'.
+ *
+ * @param start
+ * the value of field 'start'.
+ */
+ public void setStart(final int start)
+ {
+ this._start = start;
+ this._has_start = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.JSeq
+ */
+ public static jalview.binding.JSeq unmarshal(final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.JSeq) Unmarshaller.unmarshal(
+ jalview.binding.JSeq.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/JalviewModel.java b/src/jalview/binding/JalviewModel.java
index 5c9be24..7141b27 100644
--- a/src/jalview/binding/JalviewModel.java
+++ b/src/jalview/binding/JalviewModel.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,202 +19,215 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JalviewModel implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _creationDate.
- */
- private java.util.Date _creationDate;
-
- /**
- * Field _version.
- */
- private java.lang.String _version;
-
- /**
- * Field _vamsasModel.
- */
- private jalview.binding.VamsasModel _vamsasModel;
-
- /**
- * Field _jalviewModelSequence.
- */
- private jalview.binding.JalviewModelSequence _jalviewModelSequence;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JalviewModel() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'creationDate'.
- *
- * @return the value of field 'CreationDate'.
- */
- public java.util.Date getCreationDate(
- ) {
- return this._creationDate;
- }
-
- /**
- * Returns the value of field 'jalviewModelSequence'.
- *
- * @return the value of field 'JalviewModelSequence'.
- */
- public jalview.binding.JalviewModelSequence getJalviewModelSequence(
- ) {
- return this._jalviewModelSequence;
- }
-
- /**
- * Returns the value of field 'vamsasModel'.
- *
- * @return the value of field 'VamsasModel'.
- */
- public jalview.binding.VamsasModel getVamsasModel(
- ) {
- return this._vamsasModel;
- }
-
- /**
- * Returns the value of field 'version'.
- *
- * @return the value of field 'Version'.
- */
- public java.lang.String getVersion(
- ) {
- return this._version;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'creationDate'.
- *
- * @param creationDate the value of field 'creationDate'.
- */
- public void setCreationDate(
- final java.util.Date creationDate) {
- this._creationDate = creationDate;
- }
-
- /**
- * Sets the value of field 'jalviewModelSequence'.
- *
- * @param jalviewModelSequence the value of field
- * 'jalviewModelSequence'.
- */
- public void setJalviewModelSequence(
- final jalview.binding.JalviewModelSequence jalviewModelSequence) {
- this._jalviewModelSequence = jalviewModelSequence;
- }
-
- /**
- * Sets the value of field 'vamsasModel'.
- *
- * @param vamsasModel the value of field 'vamsasModel'.
- */
- public void setVamsasModel(
- final jalview.binding.VamsasModel vamsasModel) {
- this._vamsasModel = vamsasModel;
- }
-
- /**
- * Sets the value of field 'version'.
- *
- * @param version the value of field 'version'.
- */
- public void setVersion(
- final java.lang.String version) {
- this._version = version;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.JalviewModel
- */
- public static jalview.binding.JalviewModel unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.JalviewModel) Unmarshaller.unmarshal(jalview.binding.JalviewModel.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class JalviewModel implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _creationDate.
+ */
+ private java.util.Date _creationDate;
+
+ /**
+ * Field _version.
+ */
+ private java.lang.String _version;
+
+ /**
+ * Field _vamsasModel.
+ */
+ private jalview.binding.VamsasModel _vamsasModel;
+
+ /**
+ * Field _jalviewModelSequence.
+ */
+ private jalview.binding.JalviewModelSequence _jalviewModelSequence;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JalviewModel()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'creationDate'.
+ *
+ * @return the value of field 'CreationDate'.
+ */
+ public java.util.Date getCreationDate()
+ {
+ return this._creationDate;
+ }
+
+ /**
+ * Returns the value of field 'jalviewModelSequence'.
+ *
+ * @return the value of field 'JalviewModelSequence'.
+ */
+ public jalview.binding.JalviewModelSequence getJalviewModelSequence()
+ {
+ return this._jalviewModelSequence;
+ }
+
+ /**
+ * Returns the value of field 'vamsasModel'.
+ *
+ * @return the value of field 'VamsasModel'.
+ */
+ public jalview.binding.VamsasModel getVamsasModel()
+ {
+ return this._vamsasModel;
+ }
+
+ /**
+ * Returns the value of field 'version'.
+ *
+ * @return the value of field 'Version'.
+ */
+ public java.lang.String getVersion()
+ {
+ return this._version;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'creationDate'.
+ *
+ * @param creationDate
+ * the value of field 'creationDate'.
+ */
+ public void setCreationDate(final java.util.Date creationDate)
+ {
+ this._creationDate = creationDate;
+ }
+
+ /**
+ * Sets the value of field 'jalviewModelSequence'.
+ *
+ * @param jalviewModelSequence
+ * the value of field 'jalviewModelSequence'.
+ */
+ public void setJalviewModelSequence(
+ final jalview.binding.JalviewModelSequence jalviewModelSequence)
+ {
+ this._jalviewModelSequence = jalviewModelSequence;
+ }
+
+ /**
+ * Sets the value of field 'vamsasModel'.
+ *
+ * @param vamsasModel
+ * the value of field 'vamsasModel'.
+ */
+ public void setVamsasModel(final jalview.binding.VamsasModel vamsasModel)
+ {
+ this._vamsasModel = vamsasModel;
+ }
+
+ /**
+ * Sets the value of field 'version'.
+ *
+ * @param version
+ * the value of field 'version'.
+ */
+ public void setVersion(final java.lang.String version)
+ {
+ this._version = version;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.JalviewModel
+ */
+ public static jalview.binding.JalviewModel unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.JalviewModel) Unmarshaller.unmarshal(
+ jalview.binding.JalviewModel.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/JalviewModelSequence.java b/src/jalview/binding/JalviewModelSequence.java
index e4f6c5a..eb0716d 100644
--- a/src/jalview/binding/JalviewModelSequence.java
+++ b/src/jalview/binding/JalviewModelSequence.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,904 +19,937 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JalviewModelSequence implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _JSeqList.
- */
- private java.util.Vector _JSeqList;
-
- /**
- * Field _JGroupList.
- */
- private java.util.Vector _JGroupList;
-
- /**
- * Field _viewportList.
- */
- private java.util.Vector _viewportList;
-
- /**
- * Field _userColoursList.
- */
- private java.util.Vector _userColoursList;
-
- /**
- * Field _treeList.
- */
- private java.util.Vector _treeList;
-
- /**
- * Field _featureSettings.
- */
- private jalview.binding.FeatureSettings _featureSettings;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JalviewModelSequence() {
- super();
- this._JSeqList = new java.util.Vector();
- this._JGroupList = new java.util.Vector();
- this._viewportList = new java.util.Vector();
- this._userColoursList = new java.util.Vector();
- this._treeList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vJGroup
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addJGroup(
- final jalview.binding.JGroup vJGroup)
- throws java.lang.IndexOutOfBoundsException {
- this._JGroupList.addElement(vJGroup);
- }
-
- /**
- *
- *
- * @param index
- * @param vJGroup
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addJGroup(
- final int index,
- final jalview.binding.JGroup vJGroup)
- throws java.lang.IndexOutOfBoundsException {
- this._JGroupList.add(index, vJGroup);
- }
-
- /**
- *
- *
- * @param vJSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addJSeq(
- final jalview.binding.JSeq vJSeq)
- throws java.lang.IndexOutOfBoundsException {
- this._JSeqList.addElement(vJSeq);
- }
-
- /**
- *
- *
- * @param index
- * @param vJSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addJSeq(
- final int index,
- final jalview.binding.JSeq vJSeq)
- throws java.lang.IndexOutOfBoundsException {
- this._JSeqList.add(index, vJSeq);
- }
-
- /**
- *
- *
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final jalview.binding.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.addElement(vTree);
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final int index,
- final jalview.binding.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.add(index, vTree);
- }
-
- /**
- *
- *
- * @param vUserColours
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addUserColours(
- final jalview.binding.UserColours vUserColours)
- throws java.lang.IndexOutOfBoundsException {
- this._userColoursList.addElement(vUserColours);
- }
-
- /**
- *
- *
- * @param index
- * @param vUserColours
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addUserColours(
- final int index,
- final jalview.binding.UserColours vUserColours)
- throws java.lang.IndexOutOfBoundsException {
- this._userColoursList.add(index, vUserColours);
- }
-
- /**
- *
- *
- * @param vViewport
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addViewport(
- final jalview.binding.Viewport vViewport)
- throws java.lang.IndexOutOfBoundsException {
- this._viewportList.addElement(vViewport);
- }
-
- /**
- *
- *
- * @param index
- * @param vViewport
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addViewport(
- final int index,
- final jalview.binding.Viewport vViewport)
- throws java.lang.IndexOutOfBoundsException {
- this._viewportList.add(index, vViewport);
- }
-
- /**
- * Method enumerateJGroup.
- *
- * @return an Enumeration over all jalview.binding.JGroup
- * elements
- */
- public java.util.Enumeration enumerateJGroup(
- ) {
- return this._JGroupList.elements();
- }
-
- /**
- * Method enumerateJSeq.
- *
- * @return an Enumeration over all jalview.binding.JSeq elements
- */
- public java.util.Enumeration enumerateJSeq(
- ) {
- return this._JSeqList.elements();
- }
-
- /**
- * Method enumerateTree.
- *
- * @return an Enumeration over all jalview.binding.Tree elements
- */
- public java.util.Enumeration enumerateTree(
- ) {
- return this._treeList.elements();
- }
-
- /**
- * Method enumerateUserColours.
- *
- * @return an Enumeration over all jalview.binding.UserColours
- * elements
- */
- public java.util.Enumeration enumerateUserColours(
- ) {
- return this._userColoursList.elements();
- }
-
- /**
- * Method enumerateViewport.
- *
- * @return an Enumeration over all jalview.binding.Viewport
- * elements
- */
- public java.util.Enumeration enumerateViewport(
- ) {
- return this._viewportList.elements();
- }
-
- /**
- * Returns the value of field 'featureSettings'.
- *
- * @return the value of field 'FeatureSettings'.
- */
- public jalview.binding.FeatureSettings getFeatureSettings(
- ) {
- return this._featureSettings;
- }
-
- /**
- * Method getJGroup.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.JGroup at the given
- * index
- */
- public jalview.binding.JGroup getJGroup(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._JGroupList.size()) {
- throw new IndexOutOfBoundsException("getJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]");
- }
-
- return (jalview.binding.JGroup) _JGroupList.get(index);
- }
-
- /**
- * Method getJGroup.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.JGroup[] getJGroup(
- ) {
- jalview.binding.JGroup[] array = new jalview.binding.JGroup[0];
- return (jalview.binding.JGroup[]) this._JGroupList.toArray(array);
- }
-
- /**
- * Method getJGroupCount.
- *
- * @return the size of this collection
- */
- public int getJGroupCount(
- ) {
- return this._JGroupList.size();
- }
-
- /**
- * Method getJSeq.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.JSeq at the given
- * index
- */
- public jalview.binding.JSeq getJSeq(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._JSeqList.size()) {
- throw new IndexOutOfBoundsException("getJSeq: Index value '" + index + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
- }
-
- return (jalview.binding.JSeq) _JSeqList.get(index);
- }
-
- /**
- * Method getJSeq.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.JSeq[] getJSeq(
- ) {
- jalview.binding.JSeq[] array = new jalview.binding.JSeq[0];
- return (jalview.binding.JSeq[]) this._JSeqList.toArray(array);
- }
-
- /**
- * Method getJSeqCount.
- *
- * @return the size of this collection
- */
- public int getJSeqCount(
- ) {
- return this._JSeqList.size();
- }
-
- /**
- * Method getTree.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.Tree at the given
- * index
- */
- public jalview.binding.Tree getTree(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- return (jalview.binding.Tree) _treeList.get(index);
- }
-
- /**
- * Method getTree.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.Tree[] getTree(
- ) {
- jalview.binding.Tree[] array = new jalview.binding.Tree[0];
- return (jalview.binding.Tree[]) this._treeList.toArray(array);
- }
-
- /**
- * Method getTreeCount.
- *
- * @return the size of this collection
- */
- public int getTreeCount(
- ) {
- return this._treeList.size();
- }
-
- /**
- * Method getUserColours.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.UserColours at the
- * given index
- */
- public jalview.binding.UserColours getUserColours(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._userColoursList.size()) {
- throw new IndexOutOfBoundsException("getUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]");
- }
-
- return (jalview.binding.UserColours) _userColoursList.get(index);
- }
-
- /**
- * Method getUserColours.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.UserColours[] getUserColours(
- ) {
- jalview.binding.UserColours[] array = new jalview.binding.UserColours[0];
- return (jalview.binding.UserColours[]) this._userColoursList.toArray(array);
- }
-
- /**
- * Method getUserColoursCount.
- *
- * @return the size of this collection
- */
- public int getUserColoursCount(
- ) {
- return this._userColoursList.size();
- }
-
- /**
- * Method getViewport.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.Viewport at the
- * given index
- */
- public jalview.binding.Viewport getViewport(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._viewportList.size()) {
- throw new IndexOutOfBoundsException("getViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]");
- }
-
- return (jalview.binding.Viewport) _viewportList.get(index);
- }
-
- /**
- * Method getViewport.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.Viewport[] getViewport(
- ) {
- jalview.binding.Viewport[] array = new jalview.binding.Viewport[0];
- return (jalview.binding.Viewport[]) this._viewportList.toArray(array);
- }
-
- /**
- * Method getViewportCount.
- *
- * @return the size of this collection
- */
- public int getViewportCount(
- ) {
- return this._viewportList.size();
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllJGroup(
- ) {
- this._JGroupList.clear();
- }
-
- /**
- */
- public void removeAllJSeq(
- ) {
- this._JSeqList.clear();
- }
-
- /**
- */
- public void removeAllTree(
- ) {
- this._treeList.clear();
- }
-
- /**
- */
- public void removeAllUserColours(
- ) {
- this._userColoursList.clear();
- }
-
- /**
- */
- public void removeAllViewport(
- ) {
- this._viewportList.clear();
- }
-
- /**
- * Method removeJGroup.
- *
- * @param vJGroup
- * @return true if the object was removed from the collection.
- */
- public boolean removeJGroup(
- final jalview.binding.JGroup vJGroup) {
- boolean removed = _JGroupList.remove(vJGroup);
- return removed;
- }
-
- /**
- * Method removeJGroupAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.JGroup removeJGroupAt(
- final int index) {
- java.lang.Object obj = this._JGroupList.remove(index);
- return (jalview.binding.JGroup) obj;
- }
-
- /**
- * Method removeJSeq.
- *
- * @param vJSeq
- * @return true if the object was removed from the collection.
- */
- public boolean removeJSeq(
- final jalview.binding.JSeq vJSeq) {
- boolean removed = _JSeqList.remove(vJSeq);
- return removed;
- }
-
- /**
- * Method removeJSeqAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.JSeq removeJSeqAt(
- final int index) {
- java.lang.Object obj = this._JSeqList.remove(index);
- return (jalview.binding.JSeq) obj;
- }
-
- /**
- * Method removeTree.
- *
- * @param vTree
- * @return true if the object was removed from the collection.
- */
- public boolean removeTree(
- final jalview.binding.Tree vTree) {
- boolean removed = _treeList.remove(vTree);
- return removed;
- }
-
- /**
- * Method removeTreeAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.Tree removeTreeAt(
- final int index) {
- java.lang.Object obj = this._treeList.remove(index);
- return (jalview.binding.Tree) obj;
- }
-
- /**
- * Method removeUserColours.
- *
- * @param vUserColours
- * @return true if the object was removed from the collection.
- */
- public boolean removeUserColours(
- final jalview.binding.UserColours vUserColours) {
- boolean removed = _userColoursList.remove(vUserColours);
- return removed;
- }
-
- /**
- * Method removeUserColoursAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.UserColours removeUserColoursAt(
- final int index) {
- java.lang.Object obj = this._userColoursList.remove(index);
- return (jalview.binding.UserColours) obj;
- }
-
- /**
- * Method removeViewport.
- *
- * @param vViewport
- * @return true if the object was removed from the collection.
- */
- public boolean removeViewport(
- final jalview.binding.Viewport vViewport) {
- boolean removed = _viewportList.remove(vViewport);
- return removed;
- }
-
- /**
- * Method removeViewportAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.Viewport removeViewportAt(
- final int index) {
- java.lang.Object obj = this._viewportList.remove(index);
- return (jalview.binding.Viewport) obj;
- }
-
- /**
- * Sets the value of field 'featureSettings'.
- *
- * @param featureSettings the value of field 'featureSettings'.
- */
- public void setFeatureSettings(
- final jalview.binding.FeatureSettings featureSettings) {
- this._featureSettings = featureSettings;
- }
-
- /**
- *
- *
- * @param index
- * @param vJGroup
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setJGroup(
- final int index,
- final jalview.binding.JGroup vJGroup)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._JGroupList.size()) {
- throw new IndexOutOfBoundsException("setJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]");
- }
-
- this._JGroupList.set(index, vJGroup);
- }
-
- /**
- *
- *
- * @param vJGroupArray
- */
- public void setJGroup(
- final jalview.binding.JGroup[] vJGroupArray) {
- //-- copy array
- _JGroupList.clear();
-
- for (int i = 0; i < vJGroupArray.length; i++) {
- this._JGroupList.add(vJGroupArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vJSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setJSeq(
- final int index,
- final jalview.binding.JSeq vJSeq)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._JSeqList.size()) {
- throw new IndexOutOfBoundsException("setJSeq: Index value '" + index + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
- }
-
- this._JSeqList.set(index, vJSeq);
- }
-
- /**
- *
- *
- * @param vJSeqArray
- */
- public void setJSeq(
- final jalview.binding.JSeq[] vJSeqArray) {
- //-- copy array
- _JSeqList.clear();
-
- for (int i = 0; i < vJSeqArray.length; i++) {
- this._JSeqList.add(vJSeqArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setTree(
- final int index,
- final jalview.binding.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- this._treeList.set(index, vTree);
- }
-
- /**
- *
- *
- * @param vTreeArray
- */
- public void setTree(
- final jalview.binding.Tree[] vTreeArray) {
- //-- copy array
- _treeList.clear();
-
- for (int i = 0; i < vTreeArray.length; i++) {
- this._treeList.add(vTreeArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vUserColours
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setUserColours(
- final int index,
- final jalview.binding.UserColours vUserColours)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._userColoursList.size()) {
- throw new IndexOutOfBoundsException("setUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]");
- }
-
- this._userColoursList.set(index, vUserColours);
- }
-
- /**
- *
- *
- * @param vUserColoursArray
- */
- public void setUserColours(
- final jalview.binding.UserColours[] vUserColoursArray) {
- //-- copy array
- _userColoursList.clear();
-
- for (int i = 0; i < vUserColoursArray.length; i++) {
- this._userColoursList.add(vUserColoursArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vViewport
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setViewport(
- final int index,
- final jalview.binding.Viewport vViewport)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._viewportList.size()) {
- throw new IndexOutOfBoundsException("setViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]");
- }
-
- this._viewportList.set(index, vViewport);
- }
-
- /**
- *
- *
- * @param vViewportArray
- */
- public void setViewport(
- final jalview.binding.Viewport[] vViewportArray) {
- //-- copy array
- _viewportList.clear();
-
- for (int i = 0; i < vViewportArray.length; i++) {
- this._viewportList.add(vViewportArray[i]);
- }
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.JalviewModelSequence
- */
- public static jalview.binding.JalviewModelSequence unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class JalviewModelSequence implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _JSeqList.
+ */
+ private java.util.Vector _JSeqList;
+
+ /**
+ * Field _JGroupList.
+ */
+ private java.util.Vector _JGroupList;
+
+ /**
+ * Field _viewportList.
+ */
+ private java.util.Vector _viewportList;
+
+ /**
+ * Field _userColoursList.
+ */
+ private java.util.Vector _userColoursList;
+
+ /**
+ * Field _treeList.
+ */
+ private java.util.Vector _treeList;
+
+ /**
+ * Field _featureSettings.
+ */
+ private jalview.binding.FeatureSettings _featureSettings;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JalviewModelSequence()
+ {
+ super();
+ this._JSeqList = new java.util.Vector();
+ this._JGroupList = new java.util.Vector();
+ this._viewportList = new java.util.Vector();
+ this._userColoursList = new java.util.Vector();
+ this._treeList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vJGroup
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addJGroup(final jalview.binding.JGroup vJGroup)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._JGroupList.addElement(vJGroup);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vJGroup
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addJGroup(final int index,
+ final jalview.binding.JGroup vJGroup)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._JGroupList.add(index, vJGroup);
+ }
+
+ /**
+ *
+ *
+ * @param vJSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addJSeq(final jalview.binding.JSeq vJSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._JSeqList.addElement(vJSeq);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vJSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addJSeq(final int index, final jalview.binding.JSeq vJSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._JSeqList.add(index, vJSeq);
+ }
+
+ /**
+ *
+ *
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final jalview.binding.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._treeList.addElement(vTree);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final int index, final jalview.binding.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._treeList.add(index, vTree);
+ }
+
+ /**
+ *
+ *
+ * @param vUserColours
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addUserColours(final jalview.binding.UserColours vUserColours)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._userColoursList.addElement(vUserColours);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vUserColours
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addUserColours(final int index,
+ final jalview.binding.UserColours vUserColours)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._userColoursList.add(index, vUserColours);
+ }
+
+ /**
+ *
+ *
+ * @param vViewport
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addViewport(final jalview.binding.Viewport vViewport)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._viewportList.addElement(vViewport);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vViewport
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addViewport(final int index,
+ final jalview.binding.Viewport vViewport)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._viewportList.add(index, vViewport);
+ }
+
+ /**
+ * Method enumerateJGroup.
+ *
+ * @return an Enumeration over all jalview.binding.JGroup elements
+ */
+ public java.util.Enumeration enumerateJGroup()
+ {
+ return this._JGroupList.elements();
+ }
+
+ /**
+ * Method enumerateJSeq.
+ *
+ * @return an Enumeration over all jalview.binding.JSeq elements
+ */
+ public java.util.Enumeration enumerateJSeq()
+ {
+ return this._JSeqList.elements();
+ }
+
+ /**
+ * Method enumerateTree.
+ *
+ * @return an Enumeration over all jalview.binding.Tree elements
+ */
+ public java.util.Enumeration enumerateTree()
+ {
+ return this._treeList.elements();
+ }
+
+ /**
+ * Method enumerateUserColours.
+ *
+ * @return an Enumeration over all jalview.binding.UserColours elements
+ */
+ public java.util.Enumeration enumerateUserColours()
+ {
+ return this._userColoursList.elements();
+ }
+
+ /**
+ * Method enumerateViewport.
+ *
+ * @return an Enumeration over all jalview.binding.Viewport elements
+ */
+ public java.util.Enumeration enumerateViewport()
+ {
+ return this._viewportList.elements();
+ }
+
+ /**
+ * Returns the value of field 'featureSettings'.
+ *
+ * @return the value of field 'FeatureSettings'.
+ */
+ public jalview.binding.FeatureSettings getFeatureSettings()
+ {
+ return this._featureSettings;
+ }
+
+ /**
+ * Method getJGroup.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.JGroup at the given index
+ */
+ public jalview.binding.JGroup getJGroup(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._JGroupList.size())
+ {
+ throw new IndexOutOfBoundsException("getJGroup: Index value '"
+ + index + "' not in range [0.."
+ + (this._JGroupList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.JGroup) _JGroupList.get(index);
+ }
+
+ /**
+ * Method getJGroup.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.JGroup[] getJGroup()
+ {
+ jalview.binding.JGroup[] array = new jalview.binding.JGroup[0];
+ return (jalview.binding.JGroup[]) this._JGroupList.toArray(array);
+ }
+
+ /**
+ * Method getJGroupCount.
+ *
+ * @return the size of this collection
+ */
+ public int getJGroupCount()
+ {
+ return this._JGroupList.size();
+ }
+
+ /**
+ * Method getJSeq.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.JSeq at the given index
+ */
+ public jalview.binding.JSeq getJSeq(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._JSeqList.size())
+ {
+ throw new IndexOutOfBoundsException("getJSeq: Index value '" + index
+ + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.JSeq) _JSeqList.get(index);
+ }
+
+ /**
+ * Method getJSeq.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.JSeq[] getJSeq()
+ {
+ jalview.binding.JSeq[] array = new jalview.binding.JSeq[0];
+ return (jalview.binding.JSeq[]) this._JSeqList.toArray(array);
+ }
+
+ /**
+ * Method getJSeqCount.
+ *
+ * @return the size of this collection
+ */
+ public int getJSeqCount()
+ {
+ return this._JSeqList.size();
+ }
+
+ /**
+ * Method getTree.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.Tree at the given index
+ */
+ public jalview.binding.Tree getTree(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size())
+ {
+ throw new IndexOutOfBoundsException("getTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.Tree) _treeList.get(index);
+ }
+
+ /**
+ * Method getTree.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.Tree[] getTree()
+ {
+ jalview.binding.Tree[] array = new jalview.binding.Tree[0];
+ return (jalview.binding.Tree[]) this._treeList.toArray(array);
+ }
+
+ /**
+ * Method getTreeCount.
+ *
+ * @return the size of this collection
+ */
+ public int getTreeCount()
+ {
+ return this._treeList.size();
+ }
+
+ /**
+ * Method getUserColours.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.UserColours at the given index
+ */
+ public jalview.binding.UserColours getUserColours(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._userColoursList.size())
+ {
+ throw new IndexOutOfBoundsException("getUserColours: Index value '"
+ + index + "' not in range [0.."
+ + (this._userColoursList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.UserColours) _userColoursList.get(index);
+ }
+
+ /**
+ * Method getUserColours.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.UserColours[] getUserColours()
+ {
+ jalview.binding.UserColours[] array = new jalview.binding.UserColours[0];
+ return (jalview.binding.UserColours[]) this._userColoursList
+ .toArray(array);
+ }
+
+ /**
+ * Method getUserColoursCount.
+ *
+ * @return the size of this collection
+ */
+ public int getUserColoursCount()
+ {
+ return this._userColoursList.size();
+ }
+
+ /**
+ * Method getViewport.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.Viewport at the given index
+ */
+ public jalview.binding.Viewport getViewport(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._viewportList.size())
+ {
+ throw new IndexOutOfBoundsException("getViewport: Index value '"
+ + index + "' not in range [0.."
+ + (this._viewportList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.Viewport) _viewportList.get(index);
+ }
+
+ /**
+ * Method getViewport.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.Viewport[] getViewport()
+ {
+ jalview.binding.Viewport[] array = new jalview.binding.Viewport[0];
+ return (jalview.binding.Viewport[]) this._viewportList.toArray(array);
+ }
+
+ /**
+ * Method getViewportCount.
+ *
+ * @return the size of this collection
+ */
+ public int getViewportCount()
+ {
+ return this._viewportList.size();
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllJGroup()
+ {
+ this._JGroupList.clear();
+ }
+
+ /**
+ */
+ public void removeAllJSeq()
+ {
+ this._JSeqList.clear();
+ }
+
+ /**
+ */
+ public void removeAllTree()
+ {
+ this._treeList.clear();
+ }
+
+ /**
+ */
+ public void removeAllUserColours()
+ {
+ this._userColoursList.clear();
+ }
+
+ /**
+ */
+ public void removeAllViewport()
+ {
+ this._viewportList.clear();
+ }
+
+ /**
+ * Method removeJGroup.
+ *
+ * @param vJGroup
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeJGroup(final jalview.binding.JGroup vJGroup)
+ {
+ boolean removed = _JGroupList.remove(vJGroup);
+ return removed;
+ }
+
+ /**
+ * Method removeJGroupAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.JGroup removeJGroupAt(final int index)
+ {
+ java.lang.Object obj = this._JGroupList.remove(index);
+ return (jalview.binding.JGroup) obj;
+ }
+
+ /**
+ * Method removeJSeq.
+ *
+ * @param vJSeq
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeJSeq(final jalview.binding.JSeq vJSeq)
+ {
+ boolean removed = _JSeqList.remove(vJSeq);
+ return removed;
+ }
+
+ /**
+ * Method removeJSeqAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.JSeq removeJSeqAt(final int index)
+ {
+ java.lang.Object obj = this._JSeqList.remove(index);
+ return (jalview.binding.JSeq) obj;
+ }
+
+ /**
+ * Method removeTree.
+ *
+ * @param vTree
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeTree(final jalview.binding.Tree vTree)
+ {
+ boolean removed = _treeList.remove(vTree);
+ return removed;
+ }
+
+ /**
+ * Method removeTreeAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.Tree removeTreeAt(final int index)
+ {
+ java.lang.Object obj = this._treeList.remove(index);
+ return (jalview.binding.Tree) obj;
+ }
+
+ /**
+ * Method removeUserColours.
+ *
+ * @param vUserColours
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeUserColours(
+ final jalview.binding.UserColours vUserColours)
+ {
+ boolean removed = _userColoursList.remove(vUserColours);
+ return removed;
+ }
+
+ /**
+ * Method removeUserColoursAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.UserColours removeUserColoursAt(final int index)
+ {
+ java.lang.Object obj = this._userColoursList.remove(index);
+ return (jalview.binding.UserColours) obj;
+ }
+
+ /**
+ * Method removeViewport.
+ *
+ * @param vViewport
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeViewport(final jalview.binding.Viewport vViewport)
+ {
+ boolean removed = _viewportList.remove(vViewport);
+ return removed;
+ }
+
+ /**
+ * Method removeViewportAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.Viewport removeViewportAt(final int index)
+ {
+ java.lang.Object obj = this._viewportList.remove(index);
+ return (jalview.binding.Viewport) obj;
+ }
+
+ /**
+ * Sets the value of field 'featureSettings'.
+ *
+ * @param featureSettings
+ * the value of field 'featureSettings'.
+ */
+ public void setFeatureSettings(
+ final jalview.binding.FeatureSettings featureSettings)
+ {
+ this._featureSettings = featureSettings;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vJGroup
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setJGroup(final int index,
+ final jalview.binding.JGroup vJGroup)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._JGroupList.size())
+ {
+ throw new IndexOutOfBoundsException("setJGroup: Index value '"
+ + index + "' not in range [0.."
+ + (this._JGroupList.size() - 1) + "]");
+ }
+
+ this._JGroupList.set(index, vJGroup);
+ }
+
+ /**
+ *
+ *
+ * @param vJGroupArray
+ */
+ public void setJGroup(final jalview.binding.JGroup[] vJGroupArray)
+ {
+ // -- copy array
+ _JGroupList.clear();
+
+ for (int i = 0; i < vJGroupArray.length; i++)
+ {
+ this._JGroupList.add(vJGroupArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vJSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setJSeq(final int index, final jalview.binding.JSeq vJSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._JSeqList.size())
+ {
+ throw new IndexOutOfBoundsException("setJSeq: Index value '" + index
+ + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
+ }
+
+ this._JSeqList.set(index, vJSeq);
+ }
+
+ /**
+ *
+ *
+ * @param vJSeqArray
+ */
+ public void setJSeq(final jalview.binding.JSeq[] vJSeqArray)
+ {
+ // -- copy array
+ _JSeqList.clear();
+
+ for (int i = 0; i < vJSeqArray.length; i++)
+ {
+ this._JSeqList.add(vJSeqArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setTree(final int index, final jalview.binding.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size())
+ {
+ throw new IndexOutOfBoundsException("setTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ this._treeList.set(index, vTree);
+ }
+
+ /**
+ *
+ *
+ * @param vTreeArray
+ */
+ public void setTree(final jalview.binding.Tree[] vTreeArray)
+ {
+ // -- copy array
+ _treeList.clear();
+
+ for (int i = 0; i < vTreeArray.length; i++)
+ {
+ this._treeList.add(vTreeArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vUserColours
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setUserColours(final int index,
+ final jalview.binding.UserColours vUserColours)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._userColoursList.size())
+ {
+ throw new IndexOutOfBoundsException("setUserColours: Index value '"
+ + index + "' not in range [0.."
+ + (this._userColoursList.size() - 1) + "]");
+ }
+
+ this._userColoursList.set(index, vUserColours);
+ }
+
+ /**
+ *
+ *
+ * @param vUserColoursArray
+ */
+ public void setUserColours(
+ final jalview.binding.UserColours[] vUserColoursArray)
+ {
+ // -- copy array
+ _userColoursList.clear();
+
+ for (int i = 0; i < vUserColoursArray.length; i++)
+ {
+ this._userColoursList.add(vUserColoursArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vViewport
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setViewport(final int index,
+ final jalview.binding.Viewport vViewport)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._viewportList.size())
+ {
+ throw new IndexOutOfBoundsException("setViewport: Index value '"
+ + index + "' not in range [0.."
+ + (this._viewportList.size() - 1) + "]");
+ }
+
+ this._viewportList.set(index, vViewport);
+ }
+
+ /**
+ *
+ *
+ * @param vViewportArray
+ */
+ public void setViewport(final jalview.binding.Viewport[] vViewportArray)
+ {
+ // -- copy array
+ _viewportList.clear();
+
+ for (int i = 0; i < vViewportArray.length; i++)
+ {
+ this._viewportList.add(vViewportArray[i]);
+ }
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.JalviewModelSequence
+ */
+ public static jalview.binding.JalviewModelSequence unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal(
+ jalview.binding.JalviewModelSequence.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/JalviewUserColours.java b/src/jalview/binding/JalviewUserColours.java
index 3248adf..02bb12e 100644
--- a/src/jalview/binding/JalviewUserColours.java
+++ b/src/jalview/binding/JalviewUserColours.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,312 +19,326 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JalviewUserColours implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _schemeName.
- */
- private java.lang.String _schemeName;
-
- /**
- * Jalview colour scheme document version.
- *
- */
- private java.lang.String _version;
-
- /**
- * Field _colourList.
- */
- private java.util.Vector _colourList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JalviewUserColours() {
- super();
- this._colourList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vColour
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addColour(
- final Colour vColour)
- throws java.lang.IndexOutOfBoundsException {
- this._colourList.addElement(vColour);
- }
-
- /**
- *
- *
- * @param index
- * @param vColour
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addColour(
- final int index,
- final Colour vColour)
- throws java.lang.IndexOutOfBoundsException {
- this._colourList.add(index, vColour);
- }
-
- /**
- * Method enumerateColour.
- *
- * @return an Enumeration over all Colour elements
- */
- public java.util.Enumeration enumerateColour(
- ) {
- return this._colourList.elements();
- }
-
- /**
- * Method getColour.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the Colour at the given index
- */
- public Colour getColour(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._colourList.size()) {
- throw new IndexOutOfBoundsException("getColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]");
- }
-
- return (Colour) _colourList.get(index);
- }
-
- /**
- * Method getColour.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public Colour[] getColour(
- ) {
- Colour[] array = new Colour[0];
- return (Colour[]) this._colourList.toArray(array);
- }
-
- /**
- * Method getColourCount.
- *
- * @return the size of this collection
- */
- public int getColourCount(
- ) {
- return this._colourList.size();
- }
-
- /**
- * Returns the value of field 'schemeName'.
- *
- * @return the value of field 'SchemeName'.
- */
- public java.lang.String getSchemeName(
- ) {
- return this._schemeName;
- }
-
- /**
- * Returns the value of field 'version'. The field 'version'
- * has the following description: Jalview colour scheme
- * document version.
- *
- *
- * @return the value of field 'Version'.
- */
- public java.lang.String getVersion(
- ) {
- return this._version;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllColour(
- ) {
- this._colourList.clear();
- }
-
- /**
- * Method removeColour.
- *
- * @param vColour
- * @return true if the object was removed from the collection.
- */
- public boolean removeColour(
- final Colour vColour) {
- boolean removed = _colourList.remove(vColour);
- return removed;
+public class JalviewUserColours implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _schemeName.
+ */
+ private java.lang.String _schemeName;
+
+ /**
+ * Jalview colour scheme document version.
+ *
+ */
+ private java.lang.String _version;
+
+ /**
+ * Field _colourList.
+ */
+ private java.util.Vector _colourList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JalviewUserColours()
+ {
+ super();
+ this._colourList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vColour
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addColour(final Colour vColour)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._colourList.addElement(vColour);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vColour
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addColour(final int index, final Colour vColour)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._colourList.add(index, vColour);
+ }
+
+ /**
+ * Method enumerateColour.
+ *
+ * @return an Enumeration over all Colour elements
+ */
+ public java.util.Enumeration enumerateColour()
+ {
+ return this._colourList.elements();
+ }
+
+ /**
+ * Method getColour.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the Colour at the given index
+ */
+ public Colour getColour(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._colourList.size())
+ {
+ throw new IndexOutOfBoundsException("getColour: Index value '"
+ + index + "' not in range [0.."
+ + (this._colourList.size() - 1) + "]");
}
- /**
- * Method removeColourAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public Colour removeColourAt(
- final int index) {
- java.lang.Object obj = this._colourList.remove(index);
- return (Colour) obj;
+ return (Colour) _colourList.get(index);
+ }
+
+ /**
+ * Method getColour.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public Colour[] getColour()
+ {
+ Colour[] array = new Colour[0];
+ return (Colour[]) this._colourList.toArray(array);
+ }
+
+ /**
+ * Method getColourCount.
+ *
+ * @return the size of this collection
+ */
+ public int getColourCount()
+ {
+ return this._colourList.size();
+ }
+
+ /**
+ * Returns the value of field 'schemeName'.
+ *
+ * @return the value of field 'SchemeName'.
+ */
+ public java.lang.String getSchemeName()
+ {
+ return this._schemeName;
+ }
+
+ /**
+ * Returns the value of field 'version'. The field 'version' has the following
+ * description: Jalview colour scheme document version.
+ *
+ *
+ * @return the value of field 'Version'.
+ */
+ public java.lang.String getVersion()
+ {
+ return this._version;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- *
- *
- * @param index
- * @param vColour
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public void setColour(
- final int index,
- final Colour vColour)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._colourList.size()) {
- throw new IndexOutOfBoundsException("setColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]");
- }
-
- this._colourList.set(index, vColour);
+ public void removeAllColour()
+ {
+ this._colourList.clear();
+ }
+
+ /**
+ * Method removeColour.
+ *
+ * @param vColour
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeColour(final Colour vColour)
+ {
+ boolean removed = _colourList.remove(vColour);
+ return removed;
+ }
+
+ /**
+ * Method removeColourAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public Colour removeColourAt(final int index)
+ {
+ java.lang.Object obj = this._colourList.remove(index);
+ return (Colour) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vColour
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setColour(final int index, final Colour vColour)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._colourList.size())
+ {
+ throw new IndexOutOfBoundsException("setColour: Index value '"
+ + index + "' not in range [0.."
+ + (this._colourList.size() - 1) + "]");
}
- /**
- *
- *
- * @param vColourArray
- */
- public void setColour(
- final Colour[] vColourArray) {
- //-- copy array
- _colourList.clear();
-
- for (int i = 0; i < vColourArray.length; i++) {
- this._colourList.add(vColourArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'schemeName'.
- *
- * @param schemeName the value of field 'schemeName'.
- */
- public void setSchemeName(
- final java.lang.String schemeName) {
- this._schemeName = schemeName;
- }
-
- /**
- * Sets the value of field 'version'. The field 'version' has
- * the following description: Jalview colour scheme document
- * version.
- *
- *
- * @param version the value of field 'version'.
- */
- public void setVersion(
- final java.lang.String version) {
- this._version = version;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.JalviewUserColours
- */
- public static jalview.binding.JalviewUserColours unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._colourList.set(index, vColour);
+ }
+
+ /**
+ *
+ *
+ * @param vColourArray
+ */
+ public void setColour(final Colour[] vColourArray)
+ {
+ // -- copy array
+ _colourList.clear();
+
+ for (int i = 0; i < vColourArray.length; i++)
+ {
+ this._colourList.add(vColourArray[i]);
}
+ }
+
+ /**
+ * Sets the value of field 'schemeName'.
+ *
+ * @param schemeName
+ * the value of field 'schemeName'.
+ */
+ public void setSchemeName(final java.lang.String schemeName)
+ {
+ this._schemeName = schemeName;
+ }
+
+ /**
+ * Sets the value of field 'version'. The field 'version' has the following
+ * description: Jalview colour scheme document version.
+ *
+ *
+ * @param version
+ * the value of field 'version'.
+ */
+ public void setVersion(final java.lang.String version)
+ {
+ this._version = version;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.JalviewUserColours
+ */
+ public static jalview.binding.JalviewUserColours unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(
+ jalview.binding.JalviewUserColours.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Pdbentry.java b/src/jalview/binding/Pdbentry.java
index 9e01bf4..6c0e745 100644
--- a/src/jalview/binding/Pdbentry.java
+++ b/src/jalview/binding/Pdbentry.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,308 +19,326 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Pdbentry implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _id.
- */
- private java.lang.String _id;
-
- /**
- * Field _type.
- */
- private java.lang.String _type;
-
- /**
- * Field _items.
- */
- private java.util.Vector _items;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Pdbentry() {
- super();
- this._items = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vPdbentryItem
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbentryItem(
- final jalview.binding.PdbentryItem vPdbentryItem)
- throws java.lang.IndexOutOfBoundsException {
- this._items.addElement(vPdbentryItem);
- }
-
- /**
- *
- *
- * @param index
- * @param vPdbentryItem
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbentryItem(
- final int index,
- final jalview.binding.PdbentryItem vPdbentryItem)
- throws java.lang.IndexOutOfBoundsException {
- this._items.add(index, vPdbentryItem);
- }
-
- /**
- * Method enumeratePdbentryItem.
- *
- * @return an Enumeration over all jalview.binding.PdbentryItem
- * elements
- */
- public java.util.Enumeration enumeratePdbentryItem(
- ) {
- return this._items.elements();
- }
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Method getPdbentryItem.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.PdbentryItem at the
- * given index
- */
- public jalview.binding.PdbentryItem getPdbentryItem(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._items.size()) {
- throw new IndexOutOfBoundsException("getPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]");
- }
-
- return (jalview.binding.PdbentryItem) _items.get(index);
- }
-
- /**
- * Method getPdbentryItem.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.PdbentryItem[] getPdbentryItem(
- ) {
- jalview.binding.PdbentryItem[] array = new jalview.binding.PdbentryItem[0];
- return (jalview.binding.PdbentryItem[]) this._items.toArray(array);
- }
-
- /**
- * Method getPdbentryItemCount.
- *
- * @return the size of this collection
- */
- public int getPdbentryItemCount(
- ) {
- return this._items.size();
- }
-
- /**
- * Returns the value of field 'type'.
- *
- * @return the value of field 'Type'.
- */
- public java.lang.String getType(
- ) {
- return this._type;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllPdbentryItem(
- ) {
- this._items.clear();
- }
-
- /**
- * Method removePdbentryItem.
- *
- * @param vPdbentryItem
- * @return true if the object was removed from the collection.
- */
- public boolean removePdbentryItem(
- final jalview.binding.PdbentryItem vPdbentryItem) {
- boolean removed = _items.remove(vPdbentryItem);
- return removed;
+public class Pdbentry implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _id.
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _type.
+ */
+ private java.lang.String _type;
+
+ /**
+ * Field _items.
+ */
+ private java.util.Vector _items;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Pdbentry()
+ {
+ super();
+ this._items = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vPdbentryItem
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbentryItem(
+ final jalview.binding.PdbentryItem vPdbentryItem)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._items.addElement(vPdbentryItem);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbentryItem
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbentryItem(final int index,
+ final jalview.binding.PdbentryItem vPdbentryItem)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._items.add(index, vPdbentryItem);
+ }
+
+ /**
+ * Method enumeratePdbentryItem.
+ *
+ * @return an Enumeration over all jalview.binding.PdbentryItem elements
+ */
+ public java.util.Enumeration enumeratePdbentryItem()
+ {
+ return this._items.elements();
+ }
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Method getPdbentryItem.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.PdbentryItem at the given index
+ */
+ public jalview.binding.PdbentryItem getPdbentryItem(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._items.size())
+ {
+ throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
+ + index + "' not in range [0.." + (this._items.size() - 1)
+ + "]");
}
- /**
- * Method removePdbentryItemAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.PdbentryItem removePdbentryItemAt(
- final int index) {
- java.lang.Object obj = this._items.remove(index);
- return (jalview.binding.PdbentryItem) obj;
+ return (jalview.binding.PdbentryItem) _items.get(index);
+ }
+
+ /**
+ * Method getPdbentryItem.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.PdbentryItem[] getPdbentryItem()
+ {
+ jalview.binding.PdbentryItem[] array = new jalview.binding.PdbentryItem[0];
+ return (jalview.binding.PdbentryItem[]) this._items.toArray(array);
+ }
+
+ /**
+ * Method getPdbentryItemCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPdbentryItemCount()
+ {
+ return this._items.size();
+ }
+
+ /**
+ * Returns the value of field 'type'.
+ *
+ * @return the value of field 'Type'.
+ */
+ public java.lang.String getType()
+ {
+ return this._type;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public void setId(
- final java.lang.String id) {
- this._id = id;
+ public void removeAllPdbentryItem()
+ {
+ this._items.clear();
+ }
+
+ /**
+ * Method removePdbentryItem.
+ *
+ * @param vPdbentryItem
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removePdbentryItem(
+ final jalview.binding.PdbentryItem vPdbentryItem)
+ {
+ boolean removed = _items.remove(vPdbentryItem);
+ return removed;
+ }
+
+ /**
+ * Method removePdbentryItemAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.PdbentryItem removePdbentryItemAt(final int index)
+ {
+ java.lang.Object obj = this._items.remove(index);
+ return (jalview.binding.PdbentryItem) obj;
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbentryItem
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setPdbentryItem(final int index,
+ final jalview.binding.PdbentryItem vPdbentryItem)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._items.size())
+ {
+ throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
+ + index + "' not in range [0.." + (this._items.size() - 1)
+ + "]");
}
- /**
- *
- *
- * @param index
- * @param vPdbentryItem
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setPdbentryItem(
- final int index,
- final jalview.binding.PdbentryItem vPdbentryItem)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._items.size()) {
- throw new IndexOutOfBoundsException("setPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]");
- }
-
- this._items.set(index, vPdbentryItem);
- }
-
- /**
- *
- *
- * @param vPdbentryItemArray
- */
- public void setPdbentryItem(
- final jalview.binding.PdbentryItem[] vPdbentryItemArray) {
- //-- copy array
- _items.clear();
-
- for (int i = 0; i < vPdbentryItemArray.length; i++) {
- this._items.add(vPdbentryItemArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'type'.
- *
- * @param type the value of field 'type'.
- */
- public void setType(
- final java.lang.String type) {
- this._type = type;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Pdbentry
- */
- public static jalview.binding.Pdbentry unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(jalview.binding.Pdbentry.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._items.set(index, vPdbentryItem);
+ }
+
+ /**
+ *
+ *
+ * @param vPdbentryItemArray
+ */
+ public void setPdbentryItem(
+ final jalview.binding.PdbentryItem[] vPdbentryItemArray)
+ {
+ // -- copy array
+ _items.clear();
+
+ for (int i = 0; i < vPdbentryItemArray.length; i++)
+ {
+ this._items.add(vPdbentryItemArray[i]);
}
+ }
+
+ /**
+ * Sets the value of field 'type'.
+ *
+ * @param type
+ * the value of field 'type'.
+ */
+ public void setType(final java.lang.String type)
+ {
+ this._type = type;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Pdbentry
+ */
+ public static jalview.binding.Pdbentry unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(
+ jalview.binding.Pdbentry.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/PdbentryItem.java b/src/jalview/binding/PdbentryItem.java
index 316ace7..93c46e0 100644
--- a/src/jalview/binding/PdbentryItem.java
+++ b/src/jalview/binding/PdbentryItem.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -29,181 +12,185 @@ package jalview.binding;
*
* @version $Revision$ $Date$
*/
-public class PdbentryItem implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _propertyList.
- */
- private java.util.Vector _propertyList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public PdbentryItem() {
- super();
- this._propertyList = new java.util.Vector();
+public class PdbentryItem implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _propertyList.
+ */
+ private java.util.Vector _propertyList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public PdbentryItem()
+ {
+ super();
+ this._propertyList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final jalview.binding.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._propertyList.addElement(vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final int index,
+ final jalview.binding.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._propertyList.add(index, vProperty);
+ }
+
+ /**
+ * Method enumerateProperty.
+ *
+ * @return an Enumeration over all jalview.binding.Property elements
+ */
+ public java.util.Enumeration enumerateProperty()
+ {
+ return this._propertyList.elements();
+ }
+
+ /**
+ * Method getProperty.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.Property at the given index
+ */
+ public jalview.binding.Property getProperty(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size())
+ {
+ throw new IndexOutOfBoundsException("getProperty: Index value '"
+ + index + "' not in range [0.."
+ + (this._propertyList.size() - 1) + "]");
}
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
+ return (jalview.binding.Property) _propertyList.get(index);
+ }
+
+ /**
+ * Method getProperty.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.Property[] getProperty()
+ {
+ jalview.binding.Property[] array = new jalview.binding.Property[0];
+ return (jalview.binding.Property[]) this._propertyList.toArray(array);
+ }
+
+ /**
+ * Method getPropertyCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPropertyCount()
+ {
+ return this._propertyList.size();
+ }
+
+ /**
*/
- public void addProperty(
- final jalview.binding.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.addElement(vProperty);
+ public void removeAllProperty()
+ {
+ this._propertyList.clear();
+ }
+
+ /**
+ * Method removeProperty.
+ *
+ * @param vProperty
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeProperty(final jalview.binding.Property vProperty)
+ {
+ boolean removed = _propertyList.remove(vProperty);
+ return removed;
+ }
+
+ /**
+ * Method removePropertyAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.Property removePropertyAt(final int index)
+ {
+ java.lang.Object obj = this._propertyList.remove(index);
+ return (jalview.binding.Property) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setProperty(final int index,
+ final jalview.binding.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size())
+ {
+ throw new IndexOutOfBoundsException("setProperty: Index value '"
+ + index + "' not in range [0.."
+ + (this._propertyList.size() - 1) + "]");
}
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final int index,
- final jalview.binding.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.add(index, vProperty);
- }
-
- /**
- * Method enumerateProperty.
- *
- * @return an Enumeration over all jalview.binding.Property
- * elements
- */
- public java.util.Enumeration enumerateProperty(
- ) {
- return this._propertyList.elements();
- }
-
- /**
- * Method getProperty.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.Property at the
- * given index
- */
- public jalview.binding.Property getProperty(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- return (jalview.binding.Property) _propertyList.get(index);
- }
-
- /**
- * Method getProperty.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.Property[] getProperty(
- ) {
- jalview.binding.Property[] array = new jalview.binding.Property[0];
- return (jalview.binding.Property[]) this._propertyList.toArray(array);
- }
-
- /**
- * Method getPropertyCount.
- *
- * @return the size of this collection
- */
- public int getPropertyCount(
- ) {
- return this._propertyList.size();
- }
-
- /**
- */
- public void removeAllProperty(
- ) {
- this._propertyList.clear();
- }
-
- /**
- * Method removeProperty.
- *
- * @param vProperty
- * @return true if the object was removed from the collection.
- */
- public boolean removeProperty(
- final jalview.binding.Property vProperty) {
- boolean removed = _propertyList.remove(vProperty);
- return removed;
- }
-
- /**
- * Method removePropertyAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.Property removePropertyAt(
- final int index) {
- java.lang.Object obj = this._propertyList.remove(index);
- return (jalview.binding.Property) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setProperty(
- final int index,
- final jalview.binding.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- this._propertyList.set(index, vProperty);
- }
-
- /**
- *
- *
- * @param vPropertyArray
- */
- public void setProperty(
- final jalview.binding.Property[] vPropertyArray) {
- //-- copy array
- _propertyList.clear();
-
- for (int i = 0; i < vPropertyArray.length; i++) {
- this._propertyList.add(vPropertyArray[i]);
- }
+ this._propertyList.set(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vPropertyArray
+ */
+ public void setProperty(final jalview.binding.Property[] vPropertyArray)
+ {
+ // -- copy array
+ _propertyList.clear();
+
+ for (int i = 0; i < vPropertyArray.length; i++)
+ {
+ this._propertyList.add(vPropertyArray[i]);
}
+ }
}
diff --git a/src/jalview/binding/Pdbids.java b/src/jalview/binding/Pdbids.java
index c95c80a..d821a6a 100644
--- a/src/jalview/binding/Pdbids.java
+++ b/src/jalview/binding/Pdbids.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,98 +19,106 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Pdbids extends Pdbentry
-implements java.io.Serializable
+public class Pdbids extends Pdbentry implements java.io.Serializable
{
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Pdbids() {
- super();
- }
-
+ public Pdbids()
+ {
+ super();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Pdbentry
- */
- public static jalview.binding.Pdbentry unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(jalview.binding.Pdbids.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Pdbentry
+ */
+ public static jalview.binding.Pdbentry unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(
+ jalview.binding.Pdbids.class, reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Property.java b/src/jalview/binding/Property.java
index f8eea6f..df3decf 100644
--- a/src/jalview/binding/Property.java
+++ b/src/jalview/binding/Property.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,151 +19,162 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Property implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
- /**
- * Field _value.
- */
- private java.lang.String _value;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Property() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Returns the value of field 'value'.
- *
- * @return the value of field 'Value'.
- */
- public java.lang.String getValue(
- ) {
- return this._value;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Sets the value of field 'value'.
- *
- * @param value the value of field 'value'.
- */
- public void setValue(
- final java.lang.String value) {
- this._value = value;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Property
- */
- public static jalview.binding.Property unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Property) Unmarshaller.unmarshal(jalview.binding.Property.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class Property implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _value.
+ */
+ private java.lang.String _value;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Property()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Returns the value of field 'value'.
+ *
+ * @return the value of field 'Value'.
+ */
+ public java.lang.String getValue()
+ {
+ return this._value;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Sets the value of field 'value'.
+ *
+ * @param value
+ * the value of field 'value'.
+ */
+ public void setValue(final java.lang.String value)
+ {
+ this._value = value;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Property
+ */
+ public static jalview.binding.Property unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Property) Unmarshaller.unmarshal(
+ jalview.binding.Property.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Sequence.java b/src/jalview/binding/Sequence.java
index 1af7025..5ab8a37 100644
--- a/src/jalview/binding/Sequence.java
+++ b/src/jalview/binding/Sequence.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,98 +19,106 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Sequence extends SequenceType
-implements java.io.Serializable
+public class Sequence extends SequenceType implements java.io.Serializable
{
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Sequence() {
- super();
- }
-
+ public Sequence()
+ {
+ super();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.SequenceType
- */
- public static jalview.binding.SequenceType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.SequenceType) Unmarshaller.unmarshal(jalview.binding.Sequence.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.SequenceType
+ */
+ public static jalview.binding.SequenceType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.SequenceType) Unmarshaller.unmarshal(
+ jalview.binding.Sequence.class, reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/SequenceSet.java b/src/jalview/binding/SequenceSet.java
index 3f34069..c12934d 100644
--- a/src/jalview/binding/SequenceSet.java
+++ b/src/jalview/binding/SequenceSet.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,496 +19,520 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class SequenceSet implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _gapChar.
- */
- private java.lang.String _gapChar;
-
- /**
- * Field _aligned.
- */
- private boolean _aligned;
-
- /**
- * keeps track of state for field: _aligned
- */
- private boolean _has_aligned;
-
- /**
- * Field _sequenceList.
- */
- private java.util.Vector _sequenceList;
-
- /**
- * Field _annotationList.
- */
- private java.util.Vector _annotationList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SequenceSet() {
- super();
- this._sequenceList = new java.util.Vector();
- this._annotationList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAnnotation(
- final jalview.binding.Annotation vAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- this._annotationList.addElement(vAnnotation);
- }
-
- /**
- *
- *
- * @param index
- * @param vAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAnnotation(
- final int index,
- final jalview.binding.Annotation vAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- this._annotationList.add(index, vAnnotation);
- }
-
- /**
- *
- *
- * @param vSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequence(
- final jalview.binding.Sequence vSequence)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceList.addElement(vSequence);
- }
-
- /**
- *
- *
- * @param index
- * @param vSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequence(
- final int index,
- final jalview.binding.Sequence vSequence)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceList.add(index, vSequence);
- }
-
- /**
- */
- public void deleteAligned(
- ) {
- this._has_aligned= false;
- }
-
- /**
- * Method enumerateAnnotation.
- *
- * @return an Enumeration over all jalview.binding.Annotation
- * elements
- */
- public java.util.Enumeration enumerateAnnotation(
- ) {
- return this._annotationList.elements();
- }
-
- /**
- * Method enumerateSequence.
- *
- * @return an Enumeration over all jalview.binding.Sequence
- * elements
- */
- public java.util.Enumeration enumerateSequence(
- ) {
- return this._sequenceList.elements();
- }
-
- /**
- * Returns the value of field 'aligned'.
- *
- * @return the value of field 'Aligned'.
- */
- public boolean getAligned(
- ) {
- return this._aligned;
- }
-
- /**
- * Method getAnnotation.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.Annotation at the
- * given index
- */
- public jalview.binding.Annotation getAnnotation(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._annotationList.size()) {
- throw new IndexOutOfBoundsException("getAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");
- }
-
- return (jalview.binding.Annotation) _annotationList.get(index);
- }
-
- /**
- * Method getAnnotation.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.Annotation[] getAnnotation(
- ) {
- jalview.binding.Annotation[] array = new jalview.binding.Annotation[0];
- return (jalview.binding.Annotation[]) this._annotationList.toArray(array);
- }
-
- /**
- * Method getAnnotationCount.
- *
- * @return the size of this collection
- */
- public int getAnnotationCount(
- ) {
- return this._annotationList.size();
- }
-
- /**
- * Returns the value of field 'gapChar'.
- *
- * @return the value of field 'GapChar'.
- */
- public java.lang.String getGapChar(
- ) {
- return this._gapChar;
- }
-
- /**
- * Method getSequence.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.binding.Sequence at the
- * given index
- */
- public jalview.binding.Sequence getSequence(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceList.size()) {
- throw new IndexOutOfBoundsException("getSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
- }
-
- return (jalview.binding.Sequence) _sequenceList.get(index);
- }
-
- /**
- * Method getSequence.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.binding.Sequence[] getSequence(
- ) {
- jalview.binding.Sequence[] array = new jalview.binding.Sequence[0];
- return (jalview.binding.Sequence[]) this._sequenceList.toArray(array);
- }
-
- /**
- * Method getSequenceCount.
- *
- * @return the size of this collection
- */
- public int getSequenceCount(
- ) {
- return this._sequenceList.size();
- }
-
- /**
- * Method hasAligned.
- *
- * @return true if at least one Aligned has been added
- */
- public boolean hasAligned(
- ) {
- return this._has_aligned;
- }
-
- /**
- * Returns the value of field 'aligned'.
- *
- * @return the value of field 'Aligned'.
- */
- public boolean isAligned(
- ) {
- return this._aligned;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllAnnotation(
- ) {
- this._annotationList.clear();
- }
-
- /**
- */
- public void removeAllSequence(
- ) {
- this._sequenceList.clear();
- }
-
- /**
- * Method removeAnnotation.
- *
- * @param vAnnotation
- * @return true if the object was removed from the collection.
- */
- public boolean removeAnnotation(
- final jalview.binding.Annotation vAnnotation) {
- boolean removed = _annotationList.remove(vAnnotation);
- return removed;
- }
-
- /**
- * Method removeAnnotationAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.Annotation removeAnnotationAt(
- final int index) {
- java.lang.Object obj = this._annotationList.remove(index);
- return (jalview.binding.Annotation) obj;
- }
-
- /**
- * Method removeSequence.
- *
- * @param vSequence
- * @return true if the object was removed from the collection.
- */
- public boolean removeSequence(
- final jalview.binding.Sequence vSequence) {
- boolean removed = _sequenceList.remove(vSequence);
- return removed;
- }
-
- /**
- * Method removeSequenceAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.binding.Sequence removeSequenceAt(
- final int index) {
- java.lang.Object obj = this._sequenceList.remove(index);
- return (jalview.binding.Sequence) obj;
- }
-
- /**
- * Sets the value of field 'aligned'.
- *
- * @param aligned the value of field 'aligned'.
- */
- public void setAligned(
- final boolean aligned) {
- this._aligned = aligned;
- this._has_aligned = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAnnotation(
- final int index,
- final jalview.binding.Annotation vAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._annotationList.size()) {
- throw new IndexOutOfBoundsException("setAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");
- }
-
- this._annotationList.set(index, vAnnotation);
- }
-
- /**
- *
- *
- * @param vAnnotationArray
- */
- public void setAnnotation(
- final jalview.binding.Annotation[] vAnnotationArray) {
- //-- copy array
- _annotationList.clear();
-
- for (int i = 0; i < vAnnotationArray.length; i++) {
- this._annotationList.add(vAnnotationArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'gapChar'.
- *
- * @param gapChar the value of field 'gapChar'.
- */
- public void setGapChar(
- final java.lang.String gapChar) {
- this._gapChar = gapChar;
- }
-
- /**
- *
- *
- * @param index
- * @param vSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSequence(
- final int index,
- final jalview.binding.Sequence vSequence)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceList.size()) {
- throw new IndexOutOfBoundsException("setSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
- }
-
- this._sequenceList.set(index, vSequence);
- }
-
- /**
- *
- *
- * @param vSequenceArray
- */
- public void setSequence(
- final jalview.binding.Sequence[] vSequenceArray) {
- //-- copy array
- _sequenceList.clear();
-
- for (int i = 0; i < vSequenceArray.length; i++) {
- this._sequenceList.add(vSequenceArray[i]);
- }
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.SequenceSet
- */
- public static jalview.binding.SequenceSet unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class SequenceSet implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _gapChar.
+ */
+ private java.lang.String _gapChar;
+
+ /**
+ * Field _aligned.
+ */
+ private boolean _aligned;
+
+ /**
+ * keeps track of state for field: _aligned
+ */
+ private boolean _has_aligned;
+
+ /**
+ * Field _sequenceList.
+ */
+ private java.util.Vector _sequenceList;
+
+ /**
+ * Field _annotationList.
+ */
+ private java.util.Vector _annotationList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SequenceSet()
+ {
+ super();
+ this._sequenceList = new java.util.Vector();
+ this._annotationList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAnnotation(final jalview.binding.Annotation vAnnotation)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._annotationList.addElement(vAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAnnotation(final int index,
+ final jalview.binding.Annotation vAnnotation)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._annotationList.add(index, vAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param vSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequence(final jalview.binding.Sequence vSequence)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceList.addElement(vSequence);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequence(final int index,
+ final jalview.binding.Sequence vSequence)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceList.add(index, vSequence);
+ }
+
+ /**
+ */
+ public void deleteAligned()
+ {
+ this._has_aligned = false;
+ }
+
+ /**
+ * Method enumerateAnnotation.
+ *
+ * @return an Enumeration over all jalview.binding.Annotation elements
+ */
+ public java.util.Enumeration enumerateAnnotation()
+ {
+ return this._annotationList.elements();
+ }
+
+ /**
+ * Method enumerateSequence.
+ *
+ * @return an Enumeration over all jalview.binding.Sequence elements
+ */
+ public java.util.Enumeration enumerateSequence()
+ {
+ return this._sequenceList.elements();
+ }
+
+ /**
+ * Returns the value of field 'aligned'.
+ *
+ * @return the value of field 'Aligned'.
+ */
+ public boolean getAligned()
+ {
+ return this._aligned;
+ }
+
+ /**
+ * Method getAnnotation.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.Annotation at the given index
+ */
+ public jalview.binding.Annotation getAnnotation(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._annotationList.size())
+ {
+ throw new IndexOutOfBoundsException("getAnnotation: Index value '"
+ + index + "' not in range [0.."
+ + (this._annotationList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.Annotation) _annotationList.get(index);
+ }
+
+ /**
+ * Method getAnnotation.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.Annotation[] getAnnotation()
+ {
+ jalview.binding.Annotation[] array = new jalview.binding.Annotation[0];
+ return (jalview.binding.Annotation[]) this._annotationList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAnnotationCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAnnotationCount()
+ {
+ return this._annotationList.size();
+ }
+
+ /**
+ * Returns the value of field 'gapChar'.
+ *
+ * @return the value of field 'GapChar'.
+ */
+ public java.lang.String getGapChar()
+ {
+ return this._gapChar;
+ }
+
+ /**
+ * Method getSequence.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.Sequence at the given index
+ */
+ public jalview.binding.Sequence getSequence(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceList.size())
+ {
+ throw new IndexOutOfBoundsException("getSequence: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.Sequence) _sequenceList.get(index);
+ }
+
+ /**
+ * Method getSequence.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.Sequence[] getSequence()
+ {
+ jalview.binding.Sequence[] array = new jalview.binding.Sequence[0];
+ return (jalview.binding.Sequence[]) this._sequenceList.toArray(array);
+ }
+
+ /**
+ * Method getSequenceCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSequenceCount()
+ {
+ return this._sequenceList.size();
+ }
+
+ /**
+ * Method hasAligned.
+ *
+ * @return true if at least one Aligned has been added
+ */
+ public boolean hasAligned()
+ {
+ return this._has_aligned;
+ }
+
+ /**
+ * Returns the value of field 'aligned'.
+ *
+ * @return the value of field 'Aligned'.
+ */
+ public boolean isAligned()
+ {
+ return this._aligned;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllAnnotation()
+ {
+ this._annotationList.clear();
+ }
+
+ /**
+ */
+ public void removeAllSequence()
+ {
+ this._sequenceList.clear();
+ }
+
+ /**
+ * Method removeAnnotation.
+ *
+ * @param vAnnotation
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAnnotation(
+ final jalview.binding.Annotation vAnnotation)
+ {
+ boolean removed = _annotationList.remove(vAnnotation);
+ return removed;
+ }
+
+ /**
+ * Method removeAnnotationAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.Annotation removeAnnotationAt(final int index)
+ {
+ java.lang.Object obj = this._annotationList.remove(index);
+ return (jalview.binding.Annotation) obj;
+ }
+
+ /**
+ * Method removeSequence.
+ *
+ * @param vSequence
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSequence(final jalview.binding.Sequence vSequence)
+ {
+ boolean removed = _sequenceList.remove(vSequence);
+ return removed;
+ }
+
+ /**
+ * Method removeSequenceAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.Sequence removeSequenceAt(final int index)
+ {
+ java.lang.Object obj = this._sequenceList.remove(index);
+ return (jalview.binding.Sequence) obj;
+ }
+
+ /**
+ * Sets the value of field 'aligned'.
+ *
+ * @param aligned
+ * the value of field 'aligned'.
+ */
+ public void setAligned(final boolean aligned)
+ {
+ this._aligned = aligned;
+ this._has_aligned = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAnnotation(final int index,
+ final jalview.binding.Annotation vAnnotation)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._annotationList.size())
+ {
+ throw new IndexOutOfBoundsException("setAnnotation: Index value '"
+ + index + "' not in range [0.."
+ + (this._annotationList.size() - 1) + "]");
+ }
+
+ this._annotationList.set(index, vAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param vAnnotationArray
+ */
+ public void setAnnotation(
+ final jalview.binding.Annotation[] vAnnotationArray)
+ {
+ // -- copy array
+ _annotationList.clear();
+
+ for (int i = 0; i < vAnnotationArray.length; i++)
+ {
+ this._annotationList.add(vAnnotationArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'gapChar'.
+ *
+ * @param gapChar
+ * the value of field 'gapChar'.
+ */
+ public void setGapChar(final java.lang.String gapChar)
+ {
+ this._gapChar = gapChar;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSequence(final int index,
+ final jalview.binding.Sequence vSequence)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceList.size())
+ {
+ throw new IndexOutOfBoundsException("setSequence: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceList.size() - 1) + "]");
+ }
+
+ this._sequenceList.set(index, vSequence);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceArray
+ */
+ public void setSequence(final jalview.binding.Sequence[] vSequenceArray)
+ {
+ // -- copy array
+ _sequenceList.clear();
+
+ for (int i = 0; i < vSequenceArray.length; i++)
+ {
+ this._sequenceList.add(vSequenceArray[i]);
+ }
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.SequenceSet
+ */
+ public static jalview.binding.SequenceSet unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(
+ jalview.binding.SequenceSet.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/SequenceType.java b/src/jalview/binding/SequenceType.java
index 0acbe9f..d725405 100644
--- a/src/jalview/binding/SequenceType.java
+++ b/src/jalview/binding/SequenceType.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,176 +19,188 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class SequenceType implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _id.
- */
- private java.lang.String _id;
-
- /**
- * Field _sequence.
- */
- private java.lang.String _sequence;
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SequenceType() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Returns the value of field 'sequence'.
- *
- * @return the value of field 'Sequence'.
- */
- public java.lang.String getSequence(
- ) {
- return this._sequence;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Sets the value of field 'sequence'.
- *
- * @param sequence the value of field 'sequence'.
- */
- public void setSequence(
- final java.lang.String sequence) {
- this._sequence = sequence;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.SequenceType
- */
- public static jalview.binding.SequenceType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.SequenceType) Unmarshaller.unmarshal(jalview.binding.SequenceType.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class SequenceType implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _id.
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _sequence.
+ */
+ private java.lang.String _sequence;
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SequenceType()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Returns the value of field 'sequence'.
+ *
+ * @return the value of field 'Sequence'.
+ */
+ public java.lang.String getSequence()
+ {
+ return this._sequence;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Sets the value of field 'sequence'.
+ *
+ * @param sequence
+ * the value of field 'sequence'.
+ */
+ public void setSequence(final java.lang.String sequence)
+ {
+ this._sequence = sequence;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.SequenceType
+ */
+ public static jalview.binding.SequenceType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.SequenceType) Unmarshaller.unmarshal(
+ jalview.binding.SequenceType.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Setting.java b/src/jalview/binding/Setting.java
index 80d22ee..6641429 100644
--- a/src/jalview/binding/Setting.java
+++ b/src/jalview/binding/Setting.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,232 +19,244 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Setting implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _type.
- */
- private java.lang.String _type;
-
- /**
- * Field _colour.
- */
- private int _colour;
-
- /**
- * keeps track of state for field: _colour
- */
- private boolean _has_colour;
-
- /**
- * Field _display.
- */
- private boolean _display;
-
- /**
- * keeps track of state for field: _display
- */
- private boolean _has_display;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Setting() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteColour(
- ) {
- this._has_colour= false;
- }
-
- /**
- */
- public void deleteDisplay(
- ) {
- this._has_display= false;
- }
-
- /**
- * Returns the value of field 'colour'.
- *
- * @return the value of field 'Colour'.
- */
- public int getColour(
- ) {
- return this._colour;
- }
-
- /**
- * Returns the value of field 'display'.
- *
- * @return the value of field 'Display'.
- */
- public boolean getDisplay(
- ) {
- return this._display;
- }
-
- /**
- * Returns the value of field 'type'.
- *
- * @return the value of field 'Type'.
+public class Setting implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _type.
+ */
+ private java.lang.String _type;
+
+ /**
+ * Field _colour.
+ */
+ private int _colour;
+
+ /**
+ * keeps track of state for field: _colour
+ */
+ private boolean _has_colour;
+
+ /**
+ * Field _display.
+ */
+ private boolean _display;
+
+ /**
+ * keeps track of state for field: _display
+ */
+ private boolean _has_display;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Setting()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
*/
- public java.lang.String getType(
- ) {
- return this._type;
- }
-
- /**
- * Method hasColour.
- *
- * @return true if at least one Colour has been added
- */
- public boolean hasColour(
- ) {
- return this._has_colour;
- }
-
- /**
- * Method hasDisplay.
- *
- * @return true if at least one Display has been added
- */
- public boolean hasDisplay(
- ) {
- return this._has_display;
- }
-
- /**
- * Returns the value of field 'display'.
- *
- * @return the value of field 'Display'.
- */
- public boolean isDisplay(
- ) {
- return this._display;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'colour'.
- *
- * @param colour the value of field 'colour'.
- */
- public void setColour(
- final int colour) {
- this._colour = colour;
- this._has_colour = true;
- }
-
- /**
- * Sets the value of field 'display'.
- *
- * @param display the value of field 'display'.
- */
- public void setDisplay(
- final boolean display) {
- this._display = display;
- this._has_display = true;
- }
-
- /**
- * Sets the value of field 'type'.
- *
- * @param type the value of field 'type'.
- */
- public void setType(
- final java.lang.String type) {
- this._type = type;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Setting
- */
- public static jalview.binding.Setting unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Setting) Unmarshaller.unmarshal(jalview.binding.Setting.class, reader);
- }
+ public void deleteColour()
+ {
+ this._has_colour = false;
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
+ /**
*/
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ public void deleteDisplay()
+ {
+ this._has_display = false;
+ }
+
+ /**
+ * Returns the value of field 'colour'.
+ *
+ * @return the value of field 'Colour'.
+ */
+ public int getColour()
+ {
+ return this._colour;
+ }
+
+ /**
+ * Returns the value of field 'display'.
+ *
+ * @return the value of field 'Display'.
+ */
+ public boolean getDisplay()
+ {
+ return this._display;
+ }
+
+ /**
+ * Returns the value of field 'type'.
+ *
+ * @return the value of field 'Type'.
+ */
+ public java.lang.String getType()
+ {
+ return this._type;
+ }
+
+ /**
+ * Method hasColour.
+ *
+ * @return true if at least one Colour has been added
+ */
+ public boolean hasColour()
+ {
+ return this._has_colour;
+ }
+
+ /**
+ * Method hasDisplay.
+ *
+ * @return true if at least one Display has been added
+ */
+ public boolean hasDisplay()
+ {
+ return this._has_display;
+ }
+
+ /**
+ * Returns the value of field 'display'.
+ *
+ * @return the value of field 'Display'.
+ */
+ public boolean isDisplay()
+ {
+ return this._display;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'colour'.
+ *
+ * @param colour
+ * the value of field 'colour'.
+ */
+ public void setColour(final int colour)
+ {
+ this._colour = colour;
+ this._has_colour = true;
+ }
+
+ /**
+ * Sets the value of field 'display'.
+ *
+ * @param display
+ * the value of field 'display'.
+ */
+ public void setDisplay(final boolean display)
+ {
+ this._display = display;
+ this._has_display = true;
+ }
+
+ /**
+ * Sets the value of field 'type'.
+ *
+ * @param type
+ * the value of field 'type'.
+ */
+ public void setType(final java.lang.String type)
+ {
+ this._type = type;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Setting
+ */
+ public static jalview.binding.Setting unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Setting) Unmarshaller.unmarshal(
+ jalview.binding.Setting.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Tree.java b/src/jalview/binding/Tree.java
index 846ed9d..04ea0a4 100644
--- a/src/jalview/binding/Tree.java
+++ b/src/jalview/binding/Tree.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,802 +19,825 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Tree implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _width.
- */
- private int _width;
-
- /**
- * keeps track of state for field: _width
- */
- private boolean _has_width;
-
- /**
- * Field _height.
- */
- private int _height;
-
- /**
- * keeps track of state for field: _height
- */
- private boolean _has_height;
-
- /**
- * Field _xpos.
- */
- private int _xpos;
-
- /**
- * keeps track of state for field: _xpos
- */
- private boolean _has_xpos;
-
- /**
- * Field _ypos.
- */
- private int _ypos;
-
- /**
- * keeps track of state for field: _ypos
- */
- private boolean _has_ypos;
-
- /**
- * Field _fontName.
- */
- private java.lang.String _fontName;
-
- /**
- * Field _fontSize.
- */
- private int _fontSize;
-
- /**
- * keeps track of state for field: _fontSize
- */
- private boolean _has_fontSize;
-
- /**
- * Field _fontStyle.
- */
- private int _fontStyle;
-
- /**
- * keeps track of state for field: _fontStyle
- */
- private boolean _has_fontStyle;
-
- /**
- * Field _threshold.
- */
- private float _threshold;
-
- /**
- * keeps track of state for field: _threshold
- */
- private boolean _has_threshold;
-
- /**
- * Field _showBootstrap.
- */
- private boolean _showBootstrap;
-
- /**
- * keeps track of state for field: _showBootstrap
- */
- private boolean _has_showBootstrap;
-
- /**
- * Field _showDistances.
- */
- private boolean _showDistances;
-
- /**
- * keeps track of state for field: _showDistances
- */
- private boolean _has_showDistances;
-
- /**
- * Field _markUnlinked.
- */
- private boolean _markUnlinked;
-
- /**
- * keeps track of state for field: _markUnlinked
- */
- private boolean _has_markUnlinked;
-
- /**
- * Field _fitToWindow.
- */
- private boolean _fitToWindow;
-
- /**
- * keeps track of state for field: _fitToWindow
- */
- private boolean _has_fitToWindow;
-
- /**
- * Field _currentTree.
- */
- private boolean _currentTree;
-
- /**
- * keeps track of state for field: _currentTree
- */
- private boolean _has_currentTree;
-
- /**
- * Field _title.
- */
- private java.lang.String _title;
-
- /**
- * Field _newick.
- */
- private java.lang.String _newick;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Tree() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteCurrentTree(
- ) {
- this._has_currentTree= false;
- }
-
- /**
- */
- public void deleteFitToWindow(
- ) {
- this._has_fitToWindow= false;
- }
-
- /**
- */
- public void deleteFontSize(
- ) {
- this._has_fontSize= false;
- }
-
- /**
- */
- public void deleteFontStyle(
- ) {
- this._has_fontStyle= false;
- }
-
- /**
- */
- public void deleteHeight(
- ) {
- this._has_height= false;
- }
-
- /**
- */
- public void deleteMarkUnlinked(
- ) {
- this._has_markUnlinked= false;
- }
-
- /**
- */
- public void deleteShowBootstrap(
- ) {
- this._has_showBootstrap= false;
- }
-
- /**
- */
- public void deleteShowDistances(
- ) {
- this._has_showDistances= false;
- }
-
- /**
- */
- public void deleteThreshold(
- ) {
- this._has_threshold= false;
- }
-
- /**
- */
- public void deleteWidth(
- ) {
- this._has_width= false;
- }
-
- /**
- */
- public void deleteXpos(
- ) {
- this._has_xpos= false;
- }
-
- /**
- */
- public void deleteYpos(
- ) {
- this._has_ypos= false;
- }
-
- /**
- * Returns the value of field 'currentTree'.
- *
- * @return the value of field 'CurrentTree'.
- */
- public boolean getCurrentTree(
- ) {
- return this._currentTree;
- }
-
- /**
- * Returns the value of field 'fitToWindow'.
- *
- * @return the value of field 'FitToWindow'.
- */
- public boolean getFitToWindow(
- ) {
- return this._fitToWindow;
- }
-
- /**
- * Returns the value of field 'fontName'.
- *
- * @return the value of field 'FontName'.
- */
- public java.lang.String getFontName(
- ) {
- return this._fontName;
- }
-
- /**
- * Returns the value of field 'fontSize'.
- *
- * @return the value of field 'FontSize'.
- */
- public int getFontSize(
- ) {
- return this._fontSize;
- }
-
- /**
- * Returns the value of field 'fontStyle'.
- *
- * @return the value of field 'FontStyle'.
- */
- public int getFontStyle(
- ) {
- return this._fontStyle;
- }
-
- /**
- * Returns the value of field 'height'.
- *
- * @return the value of field 'Height'.
- */
- public int getHeight(
- ) {
- return this._height;
- }
-
- /**
- * Returns the value of field 'markUnlinked'.
- *
- * @return the value of field 'MarkUnlinked'.
- */
- public boolean getMarkUnlinked(
- ) {
- return this._markUnlinked;
- }
-
- /**
- * Returns the value of field 'newick'.
- *
- * @return the value of field 'Newick'.
- */
- public java.lang.String getNewick(
- ) {
- return this._newick;
- }
-
- /**
- * Returns the value of field 'showBootstrap'.
- *
- * @return the value of field 'ShowBootstrap'.
- */
- public boolean getShowBootstrap(
- ) {
- return this._showBootstrap;
- }
-
- /**
- * Returns the value of field 'showDistances'.
- *
- * @return the value of field 'ShowDistances'.
- */
- public boolean getShowDistances(
- ) {
- return this._showDistances;
- }
-
- /**
- * Returns the value of field 'threshold'.
- *
- * @return the value of field 'Threshold'.
- */
- public float getThreshold(
- ) {
- return this._threshold;
- }
-
- /**
- * Returns the value of field 'title'.
- *
- * @return the value of field 'Title'.
- */
- public java.lang.String getTitle(
- ) {
- return this._title;
- }
-
- /**
- * Returns the value of field 'width'.
- *
- * @return the value of field 'Width'.
- */
- public int getWidth(
- ) {
- return this._width;
- }
-
- /**
- * Returns the value of field 'xpos'.
- *
- * @return the value of field 'Xpos'.
- */
- public int getXpos(
- ) {
- return this._xpos;
- }
-
- /**
- * Returns the value of field 'ypos'.
- *
- * @return the value of field 'Ypos'.
- */
- public int getYpos(
- ) {
- return this._ypos;
- }
-
- /**
- * Method hasCurrentTree.
- *
- * @return true if at least one CurrentTree has been added
- */
- public boolean hasCurrentTree(
- ) {
- return this._has_currentTree;
- }
-
- /**
- * Method hasFitToWindow.
- *
- * @return true if at least one FitToWindow has been added
- */
- public boolean hasFitToWindow(
- ) {
- return this._has_fitToWindow;
- }
-
- /**
- * Method hasFontSize.
- *
- * @return true if at least one FontSize has been added
- */
- public boolean hasFontSize(
- ) {
- return this._has_fontSize;
- }
-
- /**
- * Method hasFontStyle.
- *
- * @return true if at least one FontStyle has been added
- */
- public boolean hasFontStyle(
- ) {
- return this._has_fontStyle;
- }
-
- /**
- * Method hasHeight.
- *
- * @return true if at least one Height has been added
- */
- public boolean hasHeight(
- ) {
- return this._has_height;
- }
-
- /**
- * Method hasMarkUnlinked.
- *
- * @return true if at least one MarkUnlinked has been added
- */
- public boolean hasMarkUnlinked(
- ) {
- return this._has_markUnlinked;
- }
-
- /**
- * Method hasShowBootstrap.
- *
- * @return true if at least one ShowBootstrap has been added
- */
- public boolean hasShowBootstrap(
- ) {
- return this._has_showBootstrap;
- }
-
- /**
- * Method hasShowDistances.
- *
- * @return true if at least one ShowDistances has been added
- */
- public boolean hasShowDistances(
- ) {
- return this._has_showDistances;
- }
-
- /**
- * Method hasThreshold.
- *
- * @return true if at least one Threshold has been added
- */
- public boolean hasThreshold(
- ) {
- return this._has_threshold;
- }
-
- /**
- * Method hasWidth.
- *
- * @return true if at least one Width has been added
- */
- public boolean hasWidth(
- ) {
- return this._has_width;
- }
-
- /**
- * Method hasXpos.
- *
- * @return true if at least one Xpos has been added
- */
- public boolean hasXpos(
- ) {
- return this._has_xpos;
- }
-
- /**
- * Method hasYpos.
- *
- * @return true if at least one Ypos has been added
- */
- public boolean hasYpos(
- ) {
- return this._has_ypos;
- }
-
- /**
- * Returns the value of field 'currentTree'.
- *
- * @return the value of field 'CurrentTree'.
- */
- public boolean isCurrentTree(
- ) {
- return this._currentTree;
- }
-
- /**
- * Returns the value of field 'fitToWindow'.
- *
- * @return the value of field 'FitToWindow'.
- */
- public boolean isFitToWindow(
- ) {
- return this._fitToWindow;
- }
-
- /**
- * Returns the value of field 'markUnlinked'.
- *
- * @return the value of field 'MarkUnlinked'.
- */
- public boolean isMarkUnlinked(
- ) {
- return this._markUnlinked;
- }
-
- /**
- * Returns the value of field 'showBootstrap'.
- *
- * @return the value of field 'ShowBootstrap'.
- */
- public boolean isShowBootstrap(
- ) {
- return this._showBootstrap;
- }
-
- /**
- * Returns the value of field 'showDistances'.
- *
- * @return the value of field 'ShowDistances'.
- */
- public boolean isShowDistances(
- ) {
- return this._showDistances;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'currentTree'.
- *
- * @param currentTree the value of field 'currentTree'.
- */
- public void setCurrentTree(
- final boolean currentTree) {
- this._currentTree = currentTree;
- this._has_currentTree = true;
- }
-
- /**
- * Sets the value of field 'fitToWindow'.
- *
- * @param fitToWindow the value of field 'fitToWindow'.
- */
- public void setFitToWindow(
- final boolean fitToWindow) {
- this._fitToWindow = fitToWindow;
- this._has_fitToWindow = true;
- }
-
- /**
- * Sets the value of field 'fontName'.
- *
- * @param fontName the value of field 'fontName'.
- */
- public void setFontName(
- final java.lang.String fontName) {
- this._fontName = fontName;
- }
-
- /**
- * Sets the value of field 'fontSize'.
- *
- * @param fontSize the value of field 'fontSize'.
- */
- public void setFontSize(
- final int fontSize) {
- this._fontSize = fontSize;
- this._has_fontSize = true;
- }
-
- /**
- * Sets the value of field 'fontStyle'.
- *
- * @param fontStyle the value of field 'fontStyle'.
- */
- public void setFontStyle(
- final int fontStyle) {
- this._fontStyle = fontStyle;
- this._has_fontStyle = true;
- }
-
- /**
- * Sets the value of field 'height'.
- *
- * @param height the value of field 'height'.
- */
- public void setHeight(
- final int height) {
- this._height = height;
- this._has_height = true;
- }
-
- /**
- * Sets the value of field 'markUnlinked'.
- *
- * @param markUnlinked the value of field 'markUnlinked'.
- */
- public void setMarkUnlinked(
- final boolean markUnlinked) {
- this._markUnlinked = markUnlinked;
- this._has_markUnlinked = true;
- }
-
- /**
- * Sets the value of field 'newick'.
- *
- * @param newick the value of field 'newick'.
- */
- public void setNewick(
- final java.lang.String newick) {
- this._newick = newick;
- }
-
- /**
- * Sets the value of field 'showBootstrap'.
- *
- * @param showBootstrap the value of field 'showBootstrap'.
- */
- public void setShowBootstrap(
- final boolean showBootstrap) {
- this._showBootstrap = showBootstrap;
- this._has_showBootstrap = true;
- }
-
- /**
- * Sets the value of field 'showDistances'.
- *
- * @param showDistances the value of field 'showDistances'.
- */
- public void setShowDistances(
- final boolean showDistances) {
- this._showDistances = showDistances;
- this._has_showDistances = true;
- }
-
- /**
- * Sets the value of field 'threshold'.
- *
- * @param threshold the value of field 'threshold'.
- */
- public void setThreshold(
- final float threshold) {
- this._threshold = threshold;
- this._has_threshold = true;
- }
-
- /**
- * Sets the value of field 'title'.
- *
- * @param title the value of field 'title'.
- */
- public void setTitle(
- final java.lang.String title) {
- this._title = title;
- }
-
- /**
- * Sets the value of field 'width'.
- *
- * @param width the value of field 'width'.
- */
- public void setWidth(
- final int width) {
- this._width = width;
- this._has_width = true;
- }
-
- /**
- * Sets the value of field 'xpos'.
- *
- * @param xpos the value of field 'xpos'.
- */
- public void setXpos(
- final int xpos) {
- this._xpos = xpos;
- this._has_xpos = true;
- }
-
- /**
- * Sets the value of field 'ypos'.
- *
- * @param ypos the value of field 'ypos'.
- */
- public void setYpos(
- final int ypos) {
- this._ypos = ypos;
- this._has_ypos = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Tree
- */
- public static jalview.binding.Tree unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Tree) Unmarshaller.unmarshal(jalview.binding.Tree.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class Tree implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _width.
+ */
+ private int _width;
+
+ /**
+ * keeps track of state for field: _width
+ */
+ private boolean _has_width;
+
+ /**
+ * Field _height.
+ */
+ private int _height;
+
+ /**
+ * keeps track of state for field: _height
+ */
+ private boolean _has_height;
+
+ /**
+ * Field _xpos.
+ */
+ private int _xpos;
+
+ /**
+ * keeps track of state for field: _xpos
+ */
+ private boolean _has_xpos;
+
+ /**
+ * Field _ypos.
+ */
+ private int _ypos;
+
+ /**
+ * keeps track of state for field: _ypos
+ */
+ private boolean _has_ypos;
+
+ /**
+ * Field _fontName.
+ */
+ private java.lang.String _fontName;
+
+ /**
+ * Field _fontSize.
+ */
+ private int _fontSize;
+
+ /**
+ * keeps track of state for field: _fontSize
+ */
+ private boolean _has_fontSize;
+
+ /**
+ * Field _fontStyle.
+ */
+ private int _fontStyle;
+
+ /**
+ * keeps track of state for field: _fontStyle
+ */
+ private boolean _has_fontStyle;
+
+ /**
+ * Field _threshold.
+ */
+ private float _threshold;
+
+ /**
+ * keeps track of state for field: _threshold
+ */
+ private boolean _has_threshold;
+
+ /**
+ * Field _showBootstrap.
+ */
+ private boolean _showBootstrap;
+
+ /**
+ * keeps track of state for field: _showBootstrap
+ */
+ private boolean _has_showBootstrap;
+
+ /**
+ * Field _showDistances.
+ */
+ private boolean _showDistances;
+
+ /**
+ * keeps track of state for field: _showDistances
+ */
+ private boolean _has_showDistances;
+
+ /**
+ * Field _markUnlinked.
+ */
+ private boolean _markUnlinked;
+
+ /**
+ * keeps track of state for field: _markUnlinked
+ */
+ private boolean _has_markUnlinked;
+
+ /**
+ * Field _fitToWindow.
+ */
+ private boolean _fitToWindow;
+
+ /**
+ * keeps track of state for field: _fitToWindow
+ */
+ private boolean _has_fitToWindow;
+
+ /**
+ * Field _currentTree.
+ */
+ private boolean _currentTree;
+
+ /**
+ * keeps track of state for field: _currentTree
+ */
+ private boolean _has_currentTree;
+
+ /**
+ * Field _title.
+ */
+ private java.lang.String _title;
+
+ /**
+ * Field _newick.
+ */
+ private java.lang.String _newick;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Tree()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteCurrentTree()
+ {
+ this._has_currentTree = false;
+ }
+
+ /**
+ */
+ public void deleteFitToWindow()
+ {
+ this._has_fitToWindow = false;
+ }
+
+ /**
+ */
+ public void deleteFontSize()
+ {
+ this._has_fontSize = false;
+ }
+
+ /**
+ */
+ public void deleteFontStyle()
+ {
+ this._has_fontStyle = false;
+ }
+
+ /**
+ */
+ public void deleteHeight()
+ {
+ this._has_height = false;
+ }
+
+ /**
+ */
+ public void deleteMarkUnlinked()
+ {
+ this._has_markUnlinked = false;
+ }
+
+ /**
+ */
+ public void deleteShowBootstrap()
+ {
+ this._has_showBootstrap = false;
+ }
+
+ /**
+ */
+ public void deleteShowDistances()
+ {
+ this._has_showDistances = false;
+ }
+
+ /**
+ */
+ public void deleteThreshold()
+ {
+ this._has_threshold = false;
+ }
+
+ /**
+ */
+ public void deleteWidth()
+ {
+ this._has_width = false;
+ }
+
+ /**
+ */
+ public void deleteXpos()
+ {
+ this._has_xpos = false;
+ }
+
+ /**
+ */
+ public void deleteYpos()
+ {
+ this._has_ypos = false;
+ }
+
+ /**
+ * Returns the value of field 'currentTree'.
+ *
+ * @return the value of field 'CurrentTree'.
+ */
+ public boolean getCurrentTree()
+ {
+ return this._currentTree;
+ }
+
+ /**
+ * Returns the value of field 'fitToWindow'.
+ *
+ * @return the value of field 'FitToWindow'.
+ */
+ public boolean getFitToWindow()
+ {
+ return this._fitToWindow;
+ }
+
+ /**
+ * Returns the value of field 'fontName'.
+ *
+ * @return the value of field 'FontName'.
+ */
+ public java.lang.String getFontName()
+ {
+ return this._fontName;
+ }
+
+ /**
+ * Returns the value of field 'fontSize'.
+ *
+ * @return the value of field 'FontSize'.
+ */
+ public int getFontSize()
+ {
+ return this._fontSize;
+ }
+
+ /**
+ * Returns the value of field 'fontStyle'.
+ *
+ * @return the value of field 'FontStyle'.
+ */
+ public int getFontStyle()
+ {
+ return this._fontStyle;
+ }
+
+ /**
+ * Returns the value of field 'height'.
+ *
+ * @return the value of field 'Height'.
+ */
+ public int getHeight()
+ {
+ return this._height;
+ }
+
+ /**
+ * Returns the value of field 'markUnlinked'.
+ *
+ * @return the value of field 'MarkUnlinked'.
+ */
+ public boolean getMarkUnlinked()
+ {
+ return this._markUnlinked;
+ }
+
+ /**
+ * Returns the value of field 'newick'.
+ *
+ * @return the value of field 'Newick'.
+ */
+ public java.lang.String getNewick()
+ {
+ return this._newick;
+ }
+
+ /**
+ * Returns the value of field 'showBootstrap'.
+ *
+ * @return the value of field 'ShowBootstrap'.
+ */
+ public boolean getShowBootstrap()
+ {
+ return this._showBootstrap;
+ }
+
+ /**
+ * Returns the value of field 'showDistances'.
+ *
+ * @return the value of field 'ShowDistances'.
+ */
+ public boolean getShowDistances()
+ {
+ return this._showDistances;
+ }
+
+ /**
+ * Returns the value of field 'threshold'.
+ *
+ * @return the value of field 'Threshold'.
+ */
+ public float getThreshold()
+ {
+ return this._threshold;
+ }
+
+ /**
+ * Returns the value of field 'title'.
+ *
+ * @return the value of field 'Title'.
+ */
+ public java.lang.String getTitle()
+ {
+ return this._title;
+ }
+
+ /**
+ * Returns the value of field 'width'.
+ *
+ * @return the value of field 'Width'.
+ */
+ public int getWidth()
+ {
+ return this._width;
+ }
+
+ /**
+ * Returns the value of field 'xpos'.
+ *
+ * @return the value of field 'Xpos'.
+ */
+ public int getXpos()
+ {
+ return this._xpos;
+ }
+
+ /**
+ * Returns the value of field 'ypos'.
+ *
+ * @return the value of field 'Ypos'.
+ */
+ public int getYpos()
+ {
+ return this._ypos;
+ }
+
+ /**
+ * Method hasCurrentTree.
+ *
+ * @return true if at least one CurrentTree has been added
+ */
+ public boolean hasCurrentTree()
+ {
+ return this._has_currentTree;
+ }
+
+ /**
+ * Method hasFitToWindow.
+ *
+ * @return true if at least one FitToWindow has been added
+ */
+ public boolean hasFitToWindow()
+ {
+ return this._has_fitToWindow;
+ }
+
+ /**
+ * Method hasFontSize.
+ *
+ * @return true if at least one FontSize has been added
+ */
+ public boolean hasFontSize()
+ {
+ return this._has_fontSize;
+ }
+
+ /**
+ * Method hasFontStyle.
+ *
+ * @return true if at least one FontStyle has been added
+ */
+ public boolean hasFontStyle()
+ {
+ return this._has_fontStyle;
+ }
+
+ /**
+ * Method hasHeight.
+ *
+ * @return true if at least one Height has been added
+ */
+ public boolean hasHeight()
+ {
+ return this._has_height;
+ }
+
+ /**
+ * Method hasMarkUnlinked.
+ *
+ * @return true if at least one MarkUnlinked has been added
+ */
+ public boolean hasMarkUnlinked()
+ {
+ return this._has_markUnlinked;
+ }
+
+ /**
+ * Method hasShowBootstrap.
+ *
+ * @return true if at least one ShowBootstrap has been added
+ */
+ public boolean hasShowBootstrap()
+ {
+ return this._has_showBootstrap;
+ }
+
+ /**
+ * Method hasShowDistances.
+ *
+ * @return true if at least one ShowDistances has been added
+ */
+ public boolean hasShowDistances()
+ {
+ return this._has_showDistances;
+ }
+
+ /**
+ * Method hasThreshold.
+ *
+ * @return true if at least one Threshold has been added
+ */
+ public boolean hasThreshold()
+ {
+ return this._has_threshold;
+ }
+
+ /**
+ * Method hasWidth.
+ *
+ * @return true if at least one Width has been added
+ */
+ public boolean hasWidth()
+ {
+ return this._has_width;
+ }
+
+ /**
+ * Method hasXpos.
+ *
+ * @return true if at least one Xpos has been added
+ */
+ public boolean hasXpos()
+ {
+ return this._has_xpos;
+ }
+
+ /**
+ * Method hasYpos.
+ *
+ * @return true if at least one Ypos has been added
+ */
+ public boolean hasYpos()
+ {
+ return this._has_ypos;
+ }
+
+ /**
+ * Returns the value of field 'currentTree'.
+ *
+ * @return the value of field 'CurrentTree'.
+ */
+ public boolean isCurrentTree()
+ {
+ return this._currentTree;
+ }
+
+ /**
+ * Returns the value of field 'fitToWindow'.
+ *
+ * @return the value of field 'FitToWindow'.
+ */
+ public boolean isFitToWindow()
+ {
+ return this._fitToWindow;
+ }
+
+ /**
+ * Returns the value of field 'markUnlinked'.
+ *
+ * @return the value of field 'MarkUnlinked'.
+ */
+ public boolean isMarkUnlinked()
+ {
+ return this._markUnlinked;
+ }
+
+ /**
+ * Returns the value of field 'showBootstrap'.
+ *
+ * @return the value of field 'ShowBootstrap'.
+ */
+ public boolean isShowBootstrap()
+ {
+ return this._showBootstrap;
+ }
+
+ /**
+ * Returns the value of field 'showDistances'.
+ *
+ * @return the value of field 'ShowDistances'.
+ */
+ public boolean isShowDistances()
+ {
+ return this._showDistances;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'currentTree'.
+ *
+ * @param currentTree
+ * the value of field 'currentTree'.
+ */
+ public void setCurrentTree(final boolean currentTree)
+ {
+ this._currentTree = currentTree;
+ this._has_currentTree = true;
+ }
+
+ /**
+ * Sets the value of field 'fitToWindow'.
+ *
+ * @param fitToWindow
+ * the value of field 'fitToWindow'.
+ */
+ public void setFitToWindow(final boolean fitToWindow)
+ {
+ this._fitToWindow = fitToWindow;
+ this._has_fitToWindow = true;
+ }
+
+ /**
+ * Sets the value of field 'fontName'.
+ *
+ * @param fontName
+ * the value of field 'fontName'.
+ */
+ public void setFontName(final java.lang.String fontName)
+ {
+ this._fontName = fontName;
+ }
+
+ /**
+ * Sets the value of field 'fontSize'.
+ *
+ * @param fontSize
+ * the value of field 'fontSize'.
+ */
+ public void setFontSize(final int fontSize)
+ {
+ this._fontSize = fontSize;
+ this._has_fontSize = true;
+ }
+
+ /**
+ * Sets the value of field 'fontStyle'.
+ *
+ * @param fontStyle
+ * the value of field 'fontStyle'.
+ */
+ public void setFontStyle(final int fontStyle)
+ {
+ this._fontStyle = fontStyle;
+ this._has_fontStyle = true;
+ }
+
+ /**
+ * Sets the value of field 'height'.
+ *
+ * @param height
+ * the value of field 'height'.
+ */
+ public void setHeight(final int height)
+ {
+ this._height = height;
+ this._has_height = true;
+ }
+
+ /**
+ * Sets the value of field 'markUnlinked'.
+ *
+ * @param markUnlinked
+ * the value of field 'markUnlinked'.
+ */
+ public void setMarkUnlinked(final boolean markUnlinked)
+ {
+ this._markUnlinked = markUnlinked;
+ this._has_markUnlinked = true;
+ }
+
+ /**
+ * Sets the value of field 'newick'.
+ *
+ * @param newick
+ * the value of field 'newick'.
+ */
+ public void setNewick(final java.lang.String newick)
+ {
+ this._newick = newick;
+ }
+
+ /**
+ * Sets the value of field 'showBootstrap'.
+ *
+ * @param showBootstrap
+ * the value of field 'showBootstrap'.
+ */
+ public void setShowBootstrap(final boolean showBootstrap)
+ {
+ this._showBootstrap = showBootstrap;
+ this._has_showBootstrap = true;
+ }
+
+ /**
+ * Sets the value of field 'showDistances'.
+ *
+ * @param showDistances
+ * the value of field 'showDistances'.
+ */
+ public void setShowDistances(final boolean showDistances)
+ {
+ this._showDistances = showDistances;
+ this._has_showDistances = true;
+ }
+
+ /**
+ * Sets the value of field 'threshold'.
+ *
+ * @param threshold
+ * the value of field 'threshold'.
+ */
+ public void setThreshold(final float threshold)
+ {
+ this._threshold = threshold;
+ this._has_threshold = true;
+ }
+
+ /**
+ * Sets the value of field 'title'.
+ *
+ * @param title
+ * the value of field 'title'.
+ */
+ public void setTitle(final java.lang.String title)
+ {
+ this._title = title;
+ }
+
+ /**
+ * Sets the value of field 'width'.
+ *
+ * @param width
+ * the value of field 'width'.
+ */
+ public void setWidth(final int width)
+ {
+ this._width = width;
+ this._has_width = true;
+ }
+
+ /**
+ * Sets the value of field 'xpos'.
+ *
+ * @param xpos
+ * the value of field 'xpos'.
+ */
+ public void setXpos(final int xpos)
+ {
+ this._xpos = xpos;
+ this._has_xpos = true;
+ }
+
+ /**
+ * Sets the value of field 'ypos'.
+ *
+ * @param ypos
+ * the value of field 'ypos'.
+ */
+ public void setYpos(final int ypos)
+ {
+ this._ypos = ypos;
+ this._has_ypos = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Tree
+ */
+ public static jalview.binding.Tree unmarshal(final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Tree) Unmarshaller.unmarshal(
+ jalview.binding.Tree.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/UserColourScheme.java b/src/jalview/binding/UserColourScheme.java
index d57d24c..555693c 100644
--- a/src/jalview/binding/UserColourScheme.java
+++ b/src/jalview/binding/UserColourScheme.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,98 +19,107 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class UserColourScheme extends JalviewUserColours
-implements java.io.Serializable
+public class UserColourScheme extends JalviewUserColours implements
+ java.io.Serializable
{
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
-
- public UserColourScheme() {
- super();
- }
-
+ public UserColourScheme()
+ {
+ super();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.JalviewUserColours
- */
- public static jalview.binding.JalviewUserColours unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.UserColourScheme.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.JalviewUserColours
+ */
+ public static jalview.binding.JalviewUserColours unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(
+ jalview.binding.UserColourScheme.class, reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/UserColours.java b/src/jalview/binding/UserColours.java
index 02cf07f..6a8d73c 100644
--- a/src/jalview/binding/UserColours.java
+++ b/src/jalview/binding/UserColours.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,151 +19,163 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class UserColours implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _id.
- */
- private java.lang.String _id;
-
- /**
- * Field _userColourScheme.
- */
- private jalview.binding.UserColourScheme _userColourScheme;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public UserColours() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'userColourScheme'.
- *
- * @return the value of field 'UserColourScheme'.
- */
- public jalview.binding.UserColourScheme getUserColourScheme(
- ) {
- return this._userColourScheme;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'userColourScheme'.
- *
- * @param userColourScheme the value of field 'userColourScheme'
- */
- public void setUserColourScheme(
- final jalview.binding.UserColourScheme userColourScheme) {
- this._userColourScheme = userColourScheme;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.UserColours
- */
- public static jalview.binding.UserColours unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.UserColours) Unmarshaller.unmarshal(jalview.binding.UserColours.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class UserColours implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _id.
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _userColourScheme.
+ */
+ private jalview.binding.UserColourScheme _userColourScheme;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public UserColours()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'userColourScheme'.
+ *
+ * @return the value of field 'UserColourScheme'.
+ */
+ public jalview.binding.UserColourScheme getUserColourScheme()
+ {
+ return this._userColourScheme;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'userColourScheme'.
+ *
+ * @param userColourScheme
+ * the value of field 'userColourScheme'
+ */
+ public void setUserColourScheme(
+ final jalview.binding.UserColourScheme userColourScheme)
+ {
+ this._userColourScheme = userColourScheme;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.UserColours
+ */
+ public static jalview.binding.UserColours unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.UserColours) Unmarshaller.unmarshal(
+ jalview.binding.UserColours.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/VAMSAS.java b/src/jalview/binding/VAMSAS.java
index 4a04798..c06de29 100644
--- a/src/jalview/binding/VAMSAS.java
+++ b/src/jalview/binding/VAMSAS.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,563 +19,584 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class VAMSAS implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _alignmentList.
- */
- private java.util.Vector _alignmentList;
-
- /**
- * Field _treeList.
- */
- private java.util.Vector _treeList;
-
- /**
- * Field _sequenceSetList.
- */
- private java.util.Vector _sequenceSetList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public VAMSAS() {
- super();
- this._alignmentList = new java.util.Vector();
- this._treeList = new java.util.Vector();
- this._sequenceSetList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vAlignment
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignment(
- final Alignment vAlignment)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentList.addElement(vAlignment);
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignment
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignment(
- final int index,
- final Alignment vAlignment)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentList.add(index, vAlignment);
- }
-
- /**
- *
- *
- * @param vSequenceSet
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequenceSet(
- final SequenceSet vSequenceSet)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceSetList.addElement(vSequenceSet);
- }
-
- /**
- *
- *
- * @param index
- * @param vSequenceSet
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequenceSet(
- final int index,
- final SequenceSet vSequenceSet)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceSetList.add(index, vSequenceSet);
- }
-
- /**
- *
- *
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final java.lang.String vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.addElement(vTree);
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final int index,
- final java.lang.String vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.add(index, vTree);
- }
-
- /**
- * Method enumerateAlignment.
- *
- * @return an Enumeration over all Alignment elements
- */
- public java.util.Enumeration enumerateAlignment(
- ) {
- return this._alignmentList.elements();
- }
-
- /**
- * Method enumerateSequenceSet.
- *
- * @return an Enumeration over all SequenceSet elements
- */
- public java.util.Enumeration enumerateSequenceSet(
- ) {
- return this._sequenceSetList.elements();
- }
-
- /**
- * Method enumerateTree.
- *
- * @return an Enumeration over all java.lang.String elements
- */
- public java.util.Enumeration enumerateTree(
- ) {
- return this._treeList.elements();
- }
-
- /**
- * Method getAlignment.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the Alignment at the given index
- */
- public Alignment getAlignment(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentList.size()) {
- throw new IndexOutOfBoundsException("getAlignment: Index value '" + index + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
- }
-
- return (Alignment) _alignmentList.get(index);
- }
-
- /**
- * Method getAlignment.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public Alignment[] getAlignment(
- ) {
- Alignment[] array = new Alignment[0];
- return (Alignment[]) this._alignmentList.toArray(array);
- }
-
- /**
- * Method getAlignmentCount.
- *
- * @return the size of this collection
- */
- public int getAlignmentCount(
- ) {
- return this._alignmentList.size();
- }
-
- /**
- * Method getSequenceSet.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the SequenceSet at the given index
- */
- public SequenceSet getSequenceSet(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceSetList.size()) {
- throw new IndexOutOfBoundsException("getSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]");
- }
-
- return (SequenceSet) _sequenceSetList.get(index);
- }
-
- /**
- * Method getSequenceSet.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public SequenceSet[] getSequenceSet(
- ) {
- SequenceSet[] array = new SequenceSet[0];
- return (SequenceSet[]) this._sequenceSetList.toArray(array);
- }
-
- /**
- * Method getSequenceSetCount.
- *
- * @return the size of this collection
- */
- public int getSequenceSetCount(
- ) {
- return this._sequenceSetList.size();
- }
-
- /**
- * Method getTree.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the java.lang.String at the given index
- */
- public java.lang.String getTree(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- return (java.lang.String) _treeList.get(index);
- }
-
- /**
- * Method getTree.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public java.lang.String[] getTree(
- ) {
- java.lang.String[] array = new java.lang.String[0];
- return (java.lang.String[]) this._treeList.toArray(array);
- }
-
- /**
- * Method getTreeCount.
- *
- * @return the size of this collection
- */
- public int getTreeCount(
- ) {
- return this._treeList.size();
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Method removeAlignment.
- *
- * @param vAlignment
- * @return true if the object was removed from the collection.
- */
- public boolean removeAlignment(
- final Alignment vAlignment) {
- boolean removed = _alignmentList.remove(vAlignment);
- return removed;
- }
-
- /**
- * Method removeAlignmentAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public Alignment removeAlignmentAt(
- final int index) {
- java.lang.Object obj = this._alignmentList.remove(index);
- return (Alignment) obj;
- }
-
- /**
- */
- public void removeAllAlignment(
- ) {
- this._alignmentList.clear();
- }
-
- /**
- */
- public void removeAllSequenceSet(
- ) {
- this._sequenceSetList.clear();
- }
-
- /**
- */
- public void removeAllTree(
- ) {
- this._treeList.clear();
- }
-
- /**
- * Method removeSequenceSet.
- *
- * @param vSequenceSet
- * @return true if the object was removed from the collection.
- */
- public boolean removeSequenceSet(
- final SequenceSet vSequenceSet) {
- boolean removed = _sequenceSetList.remove(vSequenceSet);
- return removed;
- }
-
- /**
- * Method removeSequenceSetAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public SequenceSet removeSequenceSetAt(
- final int index) {
- java.lang.Object obj = this._sequenceSetList.remove(index);
- return (SequenceSet) obj;
- }
-
- /**
- * Method removeTree.
- *
- * @param vTree
- * @return true if the object was removed from the collection.
- */
- public boolean removeTree(
- final java.lang.String vTree) {
- boolean removed = _treeList.remove(vTree);
- return removed;
- }
-
- /**
- * Method removeTreeAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public java.lang.String removeTreeAt(
- final int index) {
- java.lang.Object obj = this._treeList.remove(index);
- return (java.lang.String) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignment
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAlignment(
- final int index,
- final Alignment vAlignment)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentList.size()) {
- throw new IndexOutOfBoundsException("setAlignment: Index value '" + index + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
- }
-
- this._alignmentList.set(index, vAlignment);
- }
-
- /**
- *
- *
- * @param vAlignmentArray
- */
- public void setAlignment(
- final Alignment[] vAlignmentArray) {
- //-- copy array
- _alignmentList.clear();
-
- for (int i = 0; i < vAlignmentArray.length; i++) {
- this._alignmentList.add(vAlignmentArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vSequenceSet
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSequenceSet(
- final int index,
- final SequenceSet vSequenceSet)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceSetList.size()) {
- throw new IndexOutOfBoundsException("setSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]");
- }
-
- this._sequenceSetList.set(index, vSequenceSet);
- }
-
- /**
- *
- *
- * @param vSequenceSetArray
- */
- public void setSequenceSet(
- final SequenceSet[] vSequenceSetArray) {
- //-- copy array
- _sequenceSetList.clear();
-
- for (int i = 0; i < vSequenceSetArray.length; i++) {
- this._sequenceSetList.add(vSequenceSetArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setTree(
- final int index,
- final java.lang.String vTree)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- this._treeList.set(index, vTree);
- }
-
- /**
- *
- *
- * @param vTreeArray
- */
- public void setTree(
- final java.lang.String[] vTreeArray) {
- //-- copy array
- _treeList.clear();
-
- for (int i = 0; i < vTreeArray.length; i++) {
- this._treeList.add(vTreeArray[i]);
- }
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.VAMSAS
- */
- public static jalview.binding.VAMSAS unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.VAMSAS.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class VAMSAS implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _alignmentList.
+ */
+ private java.util.Vector _alignmentList;
+
+ /**
+ * Field _treeList.
+ */
+ private java.util.Vector _treeList;
+
+ /**
+ * Field _sequenceSetList.
+ */
+ private java.util.Vector _sequenceSetList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public VAMSAS()
+ {
+ super();
+ this._alignmentList = new java.util.Vector();
+ this._treeList = new java.util.Vector();
+ this._sequenceSetList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vAlignment
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignment(final Alignment vAlignment)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._alignmentList.addElement(vAlignment);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignment
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignment(final int index, final Alignment vAlignment)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._alignmentList.add(index, vAlignment);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequenceSet(final SequenceSet vSequenceSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceSetList.addElement(vSequenceSet);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequenceSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequenceSet(final int index, final SequenceSet vSequenceSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceSetList.add(index, vSequenceSet);
+ }
+
+ /**
+ *
+ *
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final java.lang.String vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._treeList.addElement(vTree);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final int index, final java.lang.String vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._treeList.add(index, vTree);
+ }
+
+ /**
+ * Method enumerateAlignment.
+ *
+ * @return an Enumeration over all Alignment elements
+ */
+ public java.util.Enumeration enumerateAlignment()
+ {
+ return this._alignmentList.elements();
+ }
+
+ /**
+ * Method enumerateSequenceSet.
+ *
+ * @return an Enumeration over all SequenceSet elements
+ */
+ public java.util.Enumeration enumerateSequenceSet()
+ {
+ return this._sequenceSetList.elements();
+ }
+
+ /**
+ * Method enumerateTree.
+ *
+ * @return an Enumeration over all java.lang.String elements
+ */
+ public java.util.Enumeration enumerateTree()
+ {
+ return this._treeList.elements();
+ }
+
+ /**
+ * Method getAlignment.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the Alignment at the given index
+ */
+ public Alignment getAlignment(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentList.size())
+ {
+ throw new IndexOutOfBoundsException("getAlignment: Index value '"
+ + index + "' not in range [0.."
+ + (this._alignmentList.size() - 1) + "]");
+ }
+
+ return (Alignment) _alignmentList.get(index);
+ }
+
+ /**
+ * Method getAlignment.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public Alignment[] getAlignment()
+ {
+ Alignment[] array = new Alignment[0];
+ return (Alignment[]) this._alignmentList.toArray(array);
+ }
+
+ /**
+ * Method getAlignmentCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAlignmentCount()
+ {
+ return this._alignmentList.size();
+ }
+
+ /**
+ * Method getSequenceSet.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the SequenceSet at the given index
+ */
+ public SequenceSet getSequenceSet(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceSetList.size())
+ {
+ throw new IndexOutOfBoundsException("getSequenceSet: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceSetList.size() - 1) + "]");
+ }
+
+ return (SequenceSet) _sequenceSetList.get(index);
+ }
+
+ /**
+ * Method getSequenceSet.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public SequenceSet[] getSequenceSet()
+ {
+ SequenceSet[] array = new SequenceSet[0];
+ return (SequenceSet[]) this._sequenceSetList.toArray(array);
+ }
+
+ /**
+ * Method getSequenceSetCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSequenceSetCount()
+ {
+ return this._sequenceSetList.size();
+ }
+
+ /**
+ * Method getTree.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the java.lang.String at the given index
+ */
+ public java.lang.String getTree(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size())
+ {
+ throw new IndexOutOfBoundsException("getTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ return (java.lang.String) _treeList.get(index);
+ }
+
+ /**
+ * Method getTree.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public java.lang.String[] getTree()
+ {
+ java.lang.String[] array = new java.lang.String[0];
+ return (java.lang.String[]) this._treeList.toArray(array);
+ }
+
+ /**
+ * Method getTreeCount.
+ *
+ * @return the size of this collection
+ */
+ public int getTreeCount()
+ {
+ return this._treeList.size();
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Method removeAlignment.
+ *
+ * @param vAlignment
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAlignment(final Alignment vAlignment)
+ {
+ boolean removed = _alignmentList.remove(vAlignment);
+ return removed;
+ }
+
+ /**
+ * Method removeAlignmentAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public Alignment removeAlignmentAt(final int index)
+ {
+ java.lang.Object obj = this._alignmentList.remove(index);
+ return (Alignment) obj;
+ }
+
+ /**
+ */
+ public void removeAllAlignment()
+ {
+ this._alignmentList.clear();
+ }
+
+ /**
+ */
+ public void removeAllSequenceSet()
+ {
+ this._sequenceSetList.clear();
+ }
+
+ /**
+ */
+ public void removeAllTree()
+ {
+ this._treeList.clear();
+ }
+
+ /**
+ * Method removeSequenceSet.
+ *
+ * @param vSequenceSet
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSequenceSet(final SequenceSet vSequenceSet)
+ {
+ boolean removed = _sequenceSetList.remove(vSequenceSet);
+ return removed;
+ }
+
+ /**
+ * Method removeSequenceSetAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public SequenceSet removeSequenceSetAt(final int index)
+ {
+ java.lang.Object obj = this._sequenceSetList.remove(index);
+ return (SequenceSet) obj;
+ }
+
+ /**
+ * Method removeTree.
+ *
+ * @param vTree
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeTree(final java.lang.String vTree)
+ {
+ boolean removed = _treeList.remove(vTree);
+ return removed;
+ }
+
+ /**
+ * Method removeTreeAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public java.lang.String removeTreeAt(final int index)
+ {
+ java.lang.Object obj = this._treeList.remove(index);
+ return (java.lang.String) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignment
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAlignment(final int index, final Alignment vAlignment)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentList.size())
+ {
+ throw new IndexOutOfBoundsException("setAlignment: Index value '"
+ + index + "' not in range [0.."
+ + (this._alignmentList.size() - 1) + "]");
+ }
+
+ this._alignmentList.set(index, vAlignment);
+ }
+
+ /**
+ *
+ *
+ * @param vAlignmentArray
+ */
+ public void setAlignment(final Alignment[] vAlignmentArray)
+ {
+ // -- copy array
+ _alignmentList.clear();
+
+ for (int i = 0; i < vAlignmentArray.length; i++)
+ {
+ this._alignmentList.add(vAlignmentArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequenceSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSequenceSet(final int index, final SequenceSet vSequenceSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceSetList.size())
+ {
+ throw new IndexOutOfBoundsException("setSequenceSet: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceSetList.size() - 1) + "]");
+ }
+
+ this._sequenceSetList.set(index, vSequenceSet);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceSetArray
+ */
+ public void setSequenceSet(final SequenceSet[] vSequenceSetArray)
+ {
+ // -- copy array
+ _sequenceSetList.clear();
+
+ for (int i = 0; i < vSequenceSetArray.length; i++)
+ {
+ this._sequenceSetList.add(vSequenceSetArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setTree(final int index, final java.lang.String vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size())
+ {
+ throw new IndexOutOfBoundsException("setTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ this._treeList.set(index, vTree);
+ }
+
+ /**
+ *
+ *
+ * @param vTreeArray
+ */
+ public void setTree(final java.lang.String[] vTreeArray)
+ {
+ // -- copy array
+ _treeList.clear();
+
+ for (int i = 0; i < vTreeArray.length; i++)
+ {
+ this._treeList.add(vTreeArray[i]);
+ }
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.VAMSAS
+ */
+ public static jalview.binding.VAMSAS unmarshal(final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(
+ jalview.binding.VAMSAS.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/VamsasModel.java b/src/jalview/binding/VamsasModel.java
index 220dec2..e4c5e0d 100644
--- a/src/jalview/binding/VamsasModel.java
+++ b/src/jalview/binding/VamsasModel.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,98 +19,105 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class VamsasModel extends VAMSAS
-implements java.io.Serializable
+public class VamsasModel extends VAMSAS implements java.io.Serializable
{
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
-
- public VamsasModel() {
- super();
- }
-
+ public VamsasModel()
+ {
+ super();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.VAMSAS
- */
- public static jalview.binding.VAMSAS unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.VamsasModel.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.VAMSAS
+ */
+ public static jalview.binding.VAMSAS unmarshal(final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(
+ jalview.binding.VamsasModel.class, reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/binding/Viewport.java b/src/jalview/binding/Viewport.java
index 4be6b86..d144378 100644
--- a/src/jalview/binding/Viewport.java
+++ b/src/jalview/binding/Viewport.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.binding;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,1414 +19,1445 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Viewport implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _conservationSelected.
- */
- private boolean _conservationSelected;
-
- /**
- * keeps track of state for field: _conservationSelected
- */
- private boolean _has_conservationSelected;
-
- /**
- * Field _pidSelected.
- */
- private boolean _pidSelected;
-
- /**
- * keeps track of state for field: _pidSelected
- */
- private boolean _has_pidSelected;
-
- /**
- * Field _bgColour.
- */
- private java.lang.String _bgColour;
-
- /**
- * Field _consThreshold.
- */
- private int _consThreshold;
-
- /**
- * keeps track of state for field: _consThreshold
- */
- private boolean _has_consThreshold;
-
- /**
- * Field _pidThreshold.
- */
- private int _pidThreshold;
-
- /**
- * keeps track of state for field: _pidThreshold
- */
- private boolean _has_pidThreshold;
-
- /**
- * Field _title.
- */
- private java.lang.String _title;
-
- /**
- * Field _showFullId.
- */
- private boolean _showFullId;
-
- /**
- * keeps track of state for field: _showFullId
- */
- private boolean _has_showFullId;
+public class Viewport implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _conservationSelected.
+ */
+ private boolean _conservationSelected;
+
+ /**
+ * keeps track of state for field: _conservationSelected
+ */
+ private boolean _has_conservationSelected;
+
+ /**
+ * Field _pidSelected.
+ */
+ private boolean _pidSelected;
+
+ /**
+ * keeps track of state for field: _pidSelected
+ */
+ private boolean _has_pidSelected;
+
+ /**
+ * Field _bgColour.
+ */
+ private java.lang.String _bgColour;
+
+ /**
+ * Field _consThreshold.
+ */
+ private int _consThreshold;
+
+ /**
+ * keeps track of state for field: _consThreshold
+ */
+ private boolean _has_consThreshold;
+
+ /**
+ * Field _pidThreshold.
+ */
+ private int _pidThreshold;
+
+ /**
+ * keeps track of state for field: _pidThreshold
+ */
+ private boolean _has_pidThreshold;
+
+ /**
+ * Field _title.
+ */
+ private java.lang.String _title;
+
+ /**
+ * Field _showFullId.
+ */
+ private boolean _showFullId;
+
+ /**
+ * keeps track of state for field: _showFullId
+ */
+ private boolean _has_showFullId;
+
+ /**
+ * Field _showText.
+ */
+ private boolean _showText;
+
+ /**
+ * keeps track of state for field: _showText
+ */
+ private boolean _has_showText;
+
+ /**
+ * Field _showColourText.
+ */
+ private boolean _showColourText;
+
+ /**
+ * keeps track of state for field: _showColourText
+ */
+ private boolean _has_showColourText;
+
+ /**
+ * Field _showBoxes.
+ */
+ private boolean _showBoxes;
+
+ /**
+ * keeps track of state for field: _showBoxes
+ */
+ private boolean _has_showBoxes;
+
+ /**
+ * Field _wrapAlignment.
+ */
+ private boolean _wrapAlignment;
+
+ /**
+ * keeps track of state for field: _wrapAlignment
+ */
+ private boolean _has_wrapAlignment;
+
+ /**
+ * Field _renderGaps.
+ */
+ private boolean _renderGaps;
+
+ /**
+ * keeps track of state for field: _renderGaps
+ */
+ private boolean _has_renderGaps;
+
+ /**
+ * Field _showSequenceFeatures.
+ */
+ private boolean _showSequenceFeatures;
+
+ /**
+ * keeps track of state for field: _showSequenceFeatures
+ */
+ private boolean _has_showSequenceFeatures;
+
+ /**
+ * Field _showAnnotation.
+ */
+ private boolean _showAnnotation;
+
+ /**
+ * keeps track of state for field: _showAnnotation
+ */
+ private boolean _has_showAnnotation;
+
+ /**
+ * Field _showConservation.
+ */
+ private boolean _showConservation;
+
+ /**
+ * keeps track of state for field: _showConservation
+ */
+ private boolean _has_showConservation;
+
+ /**
+ * Field _showQuality.
+ */
+ private boolean _showQuality;
+
+ /**
+ * keeps track of state for field: _showQuality
+ */
+ private boolean _has_showQuality;
+
+ /**
+ * Field _showIdentity.
+ */
+ private boolean _showIdentity;
+
+ /**
+ * keeps track of state for field: _showIdentity
+ */
+ private boolean _has_showIdentity;
+
+ /**
+ * Field _xpos.
+ */
+ private int _xpos;
+
+ /**
+ * keeps track of state for field: _xpos
+ */
+ private boolean _has_xpos;
+
+ /**
+ * Field _ypos.
+ */
+ private int _ypos;
+
+ /**
+ * keeps track of state for field: _ypos
+ */
+ private boolean _has_ypos;
+
+ /**
+ * Field _width.
+ */
+ private int _width;
+
+ /**
+ * keeps track of state for field: _width
+ */
+ private boolean _has_width;
+
+ /**
+ * Field _height.
+ */
+ private int _height;
+
+ /**
+ * keeps track of state for field: _height
+ */
+ private boolean _has_height;
+
+ /**
+ * Field _startRes.
+ */
+ private int _startRes;
+
+ /**
+ * keeps track of state for field: _startRes
+ */
+ private boolean _has_startRes;
+
+ /**
+ * Field _startSeq.
+ */
+ private int _startSeq;
+
+ /**
+ * keeps track of state for field: _startSeq
+ */
+ private boolean _has_startSeq;
+
+ /**
+ * Field _fontName.
+ */
+ private java.lang.String _fontName;
+
+ /**
+ * Field _fontSize.
+ */
+ private int _fontSize;
+
+ /**
+ * keeps track of state for field: _fontSize
+ */
+ private boolean _has_fontSize;
+
+ /**
+ * Field _fontStyle.
+ */
+ private int _fontStyle;
+
+ /**
+ * keeps track of state for field: _fontStyle
+ */
+ private boolean _has_fontStyle;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Viewport()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Field _showText.
+ /**
*/
- private boolean _showText;
+ public void deleteConsThreshold()
+ {
+ this._has_consThreshold = false;
+ }
- /**
- * keeps track of state for field: _showText
+ /**
*/
- private boolean _has_showText;
+ public void deleteConservationSelected()
+ {
+ this._has_conservationSelected = false;
+ }
- /**
- * Field _showColourText.
+ /**
*/
- private boolean _showColourText;
+ public void deleteFontSize()
+ {
+ this._has_fontSize = false;
+ }
- /**
- * keeps track of state for field: _showColourText
+ /**
*/
- private boolean _has_showColourText;
+ public void deleteFontStyle()
+ {
+ this._has_fontStyle = false;
+ }
- /**
- * Field _showBoxes.
+ /**
*/
- private boolean _showBoxes;
+ public void deleteHeight()
+ {
+ this._has_height = false;
+ }
- /**
- * keeps track of state for field: _showBoxes
+ /**
*/
- private boolean _has_showBoxes;
+ public void deletePidSelected()
+ {
+ this._has_pidSelected = false;
+ }
- /**
- * Field _wrapAlignment.
+ /**
*/
- private boolean _wrapAlignment;
+ public void deletePidThreshold()
+ {
+ this._has_pidThreshold = false;
+ }
- /**
- * keeps track of state for field: _wrapAlignment
+ /**
*/
- private boolean _has_wrapAlignment;
+ public void deleteRenderGaps()
+ {
+ this._has_renderGaps = false;
+ }
- /**
- * Field _renderGaps.
+ /**
*/
- private boolean _renderGaps;
+ public void deleteShowAnnotation()
+ {
+ this._has_showAnnotation = false;
+ }
- /**
- * keeps track of state for field: _renderGaps
+ /**
*/
- private boolean _has_renderGaps;
+ public void deleteShowBoxes()
+ {
+ this._has_showBoxes = false;
+ }
- /**
- * Field _showSequenceFeatures.
+ /**
*/
- private boolean _showSequenceFeatures;
+ public void deleteShowColourText()
+ {
+ this._has_showColourText = false;
+ }
- /**
- * keeps track of state for field: _showSequenceFeatures
+ /**
*/
- private boolean _has_showSequenceFeatures;
+ public void deleteShowConservation()
+ {
+ this._has_showConservation = false;
+ }
- /**
- * Field _showAnnotation.
+ /**
*/
- private boolean _showAnnotation;
+ public void deleteShowFullId()
+ {
+ this._has_showFullId = false;
+ }
- /**
- * keeps track of state for field: _showAnnotation
+ /**
*/
- private boolean _has_showAnnotation;
+ public void deleteShowIdentity()
+ {
+ this._has_showIdentity = false;
+ }
- /**
- * Field _showConservation.
+ /**
*/
- private boolean _showConservation;
-
- /**
- * keeps track of state for field: _showConservation
- */
- private boolean _has_showConservation;
-
- /**
- * Field _showQuality.
- */
- private boolean _showQuality;
-
- /**
- * keeps track of state for field: _showQuality
- */
- private boolean _has_showQuality;
-
- /**
- * Field _showIdentity.
- */
- private boolean _showIdentity;
-
- /**
- * keeps track of state for field: _showIdentity
- */
- private boolean _has_showIdentity;
-
- /**
- * Field _xpos.
- */
- private int _xpos;
-
- /**
- * keeps track of state for field: _xpos
- */
- private boolean _has_xpos;
-
- /**
- * Field _ypos.
- */
- private int _ypos;
-
- /**
- * keeps track of state for field: _ypos
- */
- private boolean _has_ypos;
-
- /**
- * Field _width.
- */
- private int _width;
-
- /**
- * keeps track of state for field: _width
- */
- private boolean _has_width;
-
- /**
- * Field _height.
- */
- private int _height;
-
- /**
- * keeps track of state for field: _height
- */
- private boolean _has_height;
-
- /**
- * Field _startRes.
- */
- private int _startRes;
-
- /**
- * keeps track of state for field: _startRes
- */
- private boolean _has_startRes;
-
- /**
- * Field _startSeq.
- */
- private int _startSeq;
-
- /**
- * keeps track of state for field: _startSeq
- */
- private boolean _has_startSeq;
-
- /**
- * Field _fontName.
- */
- private java.lang.String _fontName;
-
- /**
- * Field _fontSize.
- */
- private int _fontSize;
-
- /**
- * keeps track of state for field: _fontSize
- */
- private boolean _has_fontSize;
-
- /**
- * Field _fontStyle.
- */
- private int _fontStyle;
-
- /**
- * keeps track of state for field: _fontStyle
- */
- private boolean _has_fontStyle;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Viewport() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteConsThreshold(
- ) {
- this._has_consThreshold= false;
- }
-
- /**
- */
- public void deleteConservationSelected(
- ) {
- this._has_conservationSelected= false;
- }
-
- /**
- */
- public void deleteFontSize(
- ) {
- this._has_fontSize= false;
- }
-
- /**
- */
- public void deleteFontStyle(
- ) {
- this._has_fontStyle= false;
- }
-
- /**
- */
- public void deleteHeight(
- ) {
- this._has_height= false;
- }
-
- /**
- */
- public void deletePidSelected(
- ) {
- this._has_pidSelected= false;
- }
-
- /**
- */
- public void deletePidThreshold(
- ) {
- this._has_pidThreshold= false;
- }
-
- /**
- */
- public void deleteRenderGaps(
- ) {
- this._has_renderGaps= false;
- }
-
- /**
- */
- public void deleteShowAnnotation(
- ) {
- this._has_showAnnotation= false;
- }
-
- /**
- */
- public void deleteShowBoxes(
- ) {
- this._has_showBoxes= false;
- }
-
- /**
- */
- public void deleteShowColourText(
- ) {
- this._has_showColourText= false;
- }
-
- /**
- */
- public void deleteShowConservation(
- ) {
- this._has_showConservation= false;
- }
-
- /**
- */
- public void deleteShowFullId(
- ) {
- this._has_showFullId= false;
- }
-
- /**
- */
- public void deleteShowIdentity(
- ) {
- this._has_showIdentity= false;
- }
-
- /**
- */
- public void deleteShowQuality(
- ) {
- this._has_showQuality= false;
- }
-
- /**
- */
- public void deleteShowSequenceFeatures(
- ) {
- this._has_showSequenceFeatures= false;
- }
-
- /**
- */
- public void deleteShowText(
- ) {
- this._has_showText= false;
- }
-
- /**
- */
- public void deleteStartRes(
- ) {
- this._has_startRes= false;
- }
-
- /**
- */
- public void deleteStartSeq(
- ) {
- this._has_startSeq= false;
- }
-
- /**
- */
- public void deleteWidth(
- ) {
- this._has_width= false;
- }
-
- /**
- */
- public void deleteWrapAlignment(
- ) {
- this._has_wrapAlignment= false;
- }
-
- /**
- */
- public void deleteXpos(
- ) {
- this._has_xpos= false;
- }
-
- /**
- */
- public void deleteYpos(
- ) {
- this._has_ypos= false;
- }
-
- /**
- * Returns the value of field 'bgColour'.
- *
- * @return the value of field 'BgColour'.
- */
- public java.lang.String getBgColour(
- ) {
- return this._bgColour;
- }
-
- /**
- * Returns the value of field 'consThreshold'.
- *
- * @return the value of field 'ConsThreshold'.
- */
- public int getConsThreshold(
- ) {
- return this._consThreshold;
- }
-
- /**
- * Returns the value of field 'conservationSelected'.
- *
- * @return the value of field 'ConservationSelected'.
- */
- public boolean getConservationSelected(
- ) {
- return this._conservationSelected;
- }
-
- /**
- * Returns the value of field 'fontName'.
- *
- * @return the value of field 'FontName'.
- */
- public java.lang.String getFontName(
- ) {
- return this._fontName;
- }
-
- /**
- * Returns the value of field 'fontSize'.
- *
- * @return the value of field 'FontSize'.
- */
- public int getFontSize(
- ) {
- return this._fontSize;
- }
-
- /**
- * Returns the value of field 'fontStyle'.
- *
- * @return the value of field 'FontStyle'.
- */
- public int getFontStyle(
- ) {
- return this._fontStyle;
- }
-
- /**
- * Returns the value of field 'height'.
- *
- * @return the value of field 'Height'.
- */
- public int getHeight(
- ) {
- return this._height;
- }
-
- /**
- * Returns the value of field 'pidSelected'.
- *
- * @return the value of field 'PidSelected'.
- */
- public boolean getPidSelected(
- ) {
- return this._pidSelected;
- }
-
- /**
- * Returns the value of field 'pidThreshold'.
- *
- * @return the value of field 'PidThreshold'.
- */
- public int getPidThreshold(
- ) {
- return this._pidThreshold;
- }
-
- /**
- * Returns the value of field 'renderGaps'.
- *
- * @return the value of field 'RenderGaps'.
- */
- public boolean getRenderGaps(
- ) {
- return this._renderGaps;
- }
-
- /**
- * Returns the value of field 'showAnnotation'.
- *
- * @return the value of field 'ShowAnnotation'.
- */
- public boolean getShowAnnotation(
- ) {
- return this._showAnnotation;
- }
-
- /**
- * Returns the value of field 'showBoxes'.
- *
- * @return the value of field 'ShowBoxes'.
- */
- public boolean getShowBoxes(
- ) {
- return this._showBoxes;
- }
-
- /**
- * Returns the value of field 'showColourText'.
- *
- * @return the value of field 'ShowColourText'.
- */
- public boolean getShowColourText(
- ) {
- return this._showColourText;
- }
-
- /**
- * Returns the value of field 'showConservation'.
- *
- * @return the value of field 'ShowConservation'.
- */
- public boolean getShowConservation(
- ) {
- return this._showConservation;
- }
-
- /**
- * Returns the value of field 'showFullId'.
- *
- * @return the value of field 'ShowFullId'.
- */
- public boolean getShowFullId(
- ) {
- return this._showFullId;
- }
-
- /**
- * Returns the value of field 'showIdentity'.
- *
- * @return the value of field 'ShowIdentity'.
- */
- public boolean getShowIdentity(
- ) {
- return this._showIdentity;
- }
-
- /**
- * Returns the value of field 'showQuality'.
- *
- * @return the value of field 'ShowQuality'.
- */
- public boolean getShowQuality(
- ) {
- return this._showQuality;
- }
-
- /**
- * Returns the value of field 'showSequenceFeatures'.
- *
- * @return the value of field 'ShowSequenceFeatures'.
- */
- public boolean getShowSequenceFeatures(
- ) {
- return this._showSequenceFeatures;
- }
-
- /**
- * Returns the value of field 'showText'.
- *
- * @return the value of field 'ShowText'.
- */
- public boolean getShowText(
- ) {
- return this._showText;
- }
-
- /**
- * Returns the value of field 'startRes'.
- *
- * @return the value of field 'StartRes'.
- */
- public int getStartRes(
- ) {
- return this._startRes;
- }
-
- /**
- * Returns the value of field 'startSeq'.
- *
- * @return the value of field 'StartSeq'.
- */
- public int getStartSeq(
- ) {
- return this._startSeq;
- }
-
- /**
- * Returns the value of field 'title'.
- *
- * @return the value of field 'Title'.
- */
- public java.lang.String getTitle(
- ) {
- return this._title;
- }
-
- /**
- * Returns the value of field 'width'.
- *
- * @return the value of field 'Width'.
- */
- public int getWidth(
- ) {
- return this._width;
- }
-
- /**
- * Returns the value of field 'wrapAlignment'.
- *
- * @return the value of field 'WrapAlignment'.
- */
- public boolean getWrapAlignment(
- ) {
- return this._wrapAlignment;
- }
-
- /**
- * Returns the value of field 'xpos'.
- *
- * @return the value of field 'Xpos'.
- */
- public int getXpos(
- ) {
- return this._xpos;
- }
-
- /**
- * Returns the value of field 'ypos'.
- *
- * @return the value of field 'Ypos'.
- */
- public int getYpos(
- ) {
- return this._ypos;
- }
-
- /**
- * Method hasConsThreshold.
- *
- * @return true if at least one ConsThreshold has been added
- */
- public boolean hasConsThreshold(
- ) {
- return this._has_consThreshold;
- }
-
- /**
- * Method hasConservationSelected.
- *
- * @return true if at least one ConservationSelected has been
- * added
- */
- public boolean hasConservationSelected(
- ) {
- return this._has_conservationSelected;
- }
-
- /**
- * Method hasFontSize.
- *
- * @return true if at least one FontSize has been added
- */
- public boolean hasFontSize(
- ) {
- return this._has_fontSize;
- }
-
- /**
- * Method hasFontStyle.
- *
- * @return true if at least one FontStyle has been added
- */
- public boolean hasFontStyle(
- ) {
- return this._has_fontStyle;
- }
-
- /**
- * Method hasHeight.
- *
- * @return true if at least one Height has been added
- */
- public boolean hasHeight(
- ) {
- return this._has_height;
- }
-
- /**
- * Method hasPidSelected.
- *
- * @return true if at least one PidSelected has been added
- */
- public boolean hasPidSelected(
- ) {
- return this._has_pidSelected;
- }
-
- /**
- * Method hasPidThreshold.
- *
- * @return true if at least one PidThreshold has been added
- */
- public boolean hasPidThreshold(
- ) {
- return this._has_pidThreshold;
- }
-
- /**
- * Method hasRenderGaps.
- *
- * @return true if at least one RenderGaps has been added
- */
- public boolean hasRenderGaps(
- ) {
- return this._has_renderGaps;
- }
-
- /**
- * Method hasShowAnnotation.
- *
- * @return true if at least one ShowAnnotation has been added
- */
- public boolean hasShowAnnotation(
- ) {
- return this._has_showAnnotation;
- }
-
- /**
- * Method hasShowBoxes.
- *
- * @return true if at least one ShowBoxes has been added
- */
- public boolean hasShowBoxes(
- ) {
- return this._has_showBoxes;
- }
-
- /**
- * Method hasShowColourText.
- *
- * @return true if at least one ShowColourText has been added
- */
- public boolean hasShowColourText(
- ) {
- return this._has_showColourText;
- }
-
- /**
- * Method hasShowConservation.
- *
- * @return true if at least one ShowConservation has been added
- */
- public boolean hasShowConservation(
- ) {
- return this._has_showConservation;
- }
-
- /**
- * Method hasShowFullId.
- *
- * @return true if at least one ShowFullId has been added
- */
- public boolean hasShowFullId(
- ) {
- return this._has_showFullId;
- }
-
- /**
- * Method hasShowIdentity.
- *
- * @return true if at least one ShowIdentity has been added
- */
- public boolean hasShowIdentity(
- ) {
- return this._has_showIdentity;
- }
-
- /**
- * Method hasShowQuality.
- *
- * @return true if at least one ShowQuality has been added
- */
- public boolean hasShowQuality(
- ) {
- return this._has_showQuality;
- }
-
- /**
- * Method hasShowSequenceFeatures.
- *
- * @return true if at least one ShowSequenceFeatures has been
- * added
- */
- public boolean hasShowSequenceFeatures(
- ) {
- return this._has_showSequenceFeatures;
- }
-
- /**
- * Method hasShowText.
- *
- * @return true if at least one ShowText has been added
- */
- public boolean hasShowText(
- ) {
- return this._has_showText;
- }
-
- /**
- * Method hasStartRes.
- *
- * @return true if at least one StartRes has been added
- */
- public boolean hasStartRes(
- ) {
- return this._has_startRes;
- }
-
- /**
- * Method hasStartSeq.
- *
- * @return true if at least one StartSeq has been added
- */
- public boolean hasStartSeq(
- ) {
- return this._has_startSeq;
- }
-
- /**
- * Method hasWidth.
- *
- * @return true if at least one Width has been added
- */
- public boolean hasWidth(
- ) {
- return this._has_width;
- }
-
- /**
- * Method hasWrapAlignment.
- *
- * @return true if at least one WrapAlignment has been added
- */
- public boolean hasWrapAlignment(
- ) {
- return this._has_wrapAlignment;
- }
-
- /**
- * Method hasXpos.
- *
- * @return true if at least one Xpos has been added
- */
- public boolean hasXpos(
- ) {
- return this._has_xpos;
- }
-
- /**
- * Method hasYpos.
- *
- * @return true if at least one Ypos has been added
- */
- public boolean hasYpos(
- ) {
- return this._has_ypos;
- }
-
- /**
- * Returns the value of field 'conservationSelected'.
- *
- * @return the value of field 'ConservationSelected'.
- */
- public boolean isConservationSelected(
- ) {
- return this._conservationSelected;
- }
-
- /**
- * Returns the value of field 'pidSelected'.
- *
- * @return the value of field 'PidSelected'.
- */
- public boolean isPidSelected(
- ) {
- return this._pidSelected;
- }
-
- /**
- * Returns the value of field 'renderGaps'.
- *
- * @return the value of field 'RenderGaps'.
- */
- public boolean isRenderGaps(
- ) {
- return this._renderGaps;
- }
-
- /**
- * Returns the value of field 'showAnnotation'.
- *
- * @return the value of field 'ShowAnnotation'.
- */
- public boolean isShowAnnotation(
- ) {
- return this._showAnnotation;
- }
-
- /**
- * Returns the value of field 'showBoxes'.
- *
- * @return the value of field 'ShowBoxes'.
- */
- public boolean isShowBoxes(
- ) {
- return this._showBoxes;
- }
-
- /**
- * Returns the value of field 'showColourText'.
- *
- * @return the value of field 'ShowColourText'.
- */
- public boolean isShowColourText(
- ) {
- return this._showColourText;
- }
-
- /**
- * Returns the value of field 'showConservation'.
- *
- * @return the value of field 'ShowConservation'.
- */
- public boolean isShowConservation(
- ) {
- return this._showConservation;
- }
-
- /**
- * Returns the value of field 'showFullId'.
- *
- * @return the value of field 'ShowFullId'.
- */
- public boolean isShowFullId(
- ) {
- return this._showFullId;
- }
-
- /**
- * Returns the value of field 'showIdentity'.
- *
- * @return the value of field 'ShowIdentity'.
- */
- public boolean isShowIdentity(
- ) {
- return this._showIdentity;
- }
-
- /**
- * Returns the value of field 'showQuality'.
- *
- * @return the value of field 'ShowQuality'.
- */
- public boolean isShowQuality(
- ) {
- return this._showQuality;
- }
-
- /**
- * Returns the value of field 'showSequenceFeatures'.
- *
- * @return the value of field 'ShowSequenceFeatures'.
- */
- public boolean isShowSequenceFeatures(
- ) {
- return this._showSequenceFeatures;
- }
-
- /**
- * Returns the value of field 'showText'.
- *
- * @return the value of field 'ShowText'.
- */
- public boolean isShowText(
- ) {
- return this._showText;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- * Returns the value of field 'wrapAlignment'.
- *
- * @return the value of field 'WrapAlignment'.
- */
- public boolean isWrapAlignment(
- ) {
- return this._wrapAlignment;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'bgColour'.
- *
- * @param bgColour the value of field 'bgColour'.
- */
- public void setBgColour(
- final java.lang.String bgColour) {
- this._bgColour = bgColour;
- }
-
- /**
- * Sets the value of field 'consThreshold'.
- *
- * @param consThreshold the value of field 'consThreshold'.
- */
- public void setConsThreshold(
- final int consThreshold) {
- this._consThreshold = consThreshold;
- this._has_consThreshold = true;
- }
-
- /**
- * Sets the value of field 'conservationSelected'.
- *
- * @param conservationSelected the value of field
- * 'conservationSelected'.
- */
- public void setConservationSelected(
- final boolean conservationSelected) {
- this._conservationSelected = conservationSelected;
- this._has_conservationSelected = true;
- }
-
- /**
- * Sets the value of field 'fontName'.
- *
- * @param fontName the value of field 'fontName'.
- */
- public void setFontName(
- final java.lang.String fontName) {
- this._fontName = fontName;
- }
-
- /**
- * Sets the value of field 'fontSize'.
- *
- * @param fontSize the value of field 'fontSize'.
- */
- public void setFontSize(
- final int fontSize) {
- this._fontSize = fontSize;
- this._has_fontSize = true;
- }
-
- /**
- * Sets the value of field 'fontStyle'.
- *
- * @param fontStyle the value of field 'fontStyle'.
- */
- public void setFontStyle(
- final int fontStyle) {
- this._fontStyle = fontStyle;
- this._has_fontStyle = true;
- }
-
- /**
- * Sets the value of field 'height'.
- *
- * @param height the value of field 'height'.
- */
- public void setHeight(
- final int height) {
- this._height = height;
- this._has_height = true;
- }
-
- /**
- * Sets the value of field 'pidSelected'.
- *
- * @param pidSelected the value of field 'pidSelected'.
- */
- public void setPidSelected(
- final boolean pidSelected) {
- this._pidSelected = pidSelected;
- this._has_pidSelected = true;
- }
-
- /**
- * Sets the value of field 'pidThreshold'.
- *
- * @param pidThreshold the value of field 'pidThreshold'.
- */
- public void setPidThreshold(
- final int pidThreshold) {
- this._pidThreshold = pidThreshold;
- this._has_pidThreshold = true;
- }
-
- /**
- * Sets the value of field 'renderGaps'.
- *
- * @param renderGaps the value of field 'renderGaps'.
- */
- public void setRenderGaps(
- final boolean renderGaps) {
- this._renderGaps = renderGaps;
- this._has_renderGaps = true;
- }
-
- /**
- * Sets the value of field 'showAnnotation'.
- *
- * @param showAnnotation the value of field 'showAnnotation'.
- */
- public void setShowAnnotation(
- final boolean showAnnotation) {
- this._showAnnotation = showAnnotation;
- this._has_showAnnotation = true;
- }
-
- /**
- * Sets the value of field 'showBoxes'.
- *
- * @param showBoxes the value of field 'showBoxes'.
- */
- public void setShowBoxes(
- final boolean showBoxes) {
- this._showBoxes = showBoxes;
- this._has_showBoxes = true;
- }
-
- /**
- * Sets the value of field 'showColourText'.
- *
- * @param showColourText the value of field 'showColourText'.
- */
- public void setShowColourText(
- final boolean showColourText) {
- this._showColourText = showColourText;
- this._has_showColourText = true;
- }
-
- /**
- * Sets the value of field 'showConservation'.
- *
- * @param showConservation the value of field 'showConservation'
- */
- public void setShowConservation(
- final boolean showConservation) {
- this._showConservation = showConservation;
- this._has_showConservation = true;
- }
-
- /**
- * Sets the value of field 'showFullId'.
- *
- * @param showFullId the value of field 'showFullId'.
- */
- public void setShowFullId(
- final boolean showFullId) {
- this._showFullId = showFullId;
- this._has_showFullId = true;
- }
-
- /**
- * Sets the value of field 'showIdentity'.
- *
- * @param showIdentity the value of field 'showIdentity'.
- */
- public void setShowIdentity(
- final boolean showIdentity) {
- this._showIdentity = showIdentity;
- this._has_showIdentity = true;
- }
-
- /**
- * Sets the value of field 'showQuality'.
- *
- * @param showQuality the value of field 'showQuality'.
- */
- public void setShowQuality(
- final boolean showQuality) {
- this._showQuality = showQuality;
- this._has_showQuality = true;
- }
-
- /**
- * Sets the value of field 'showSequenceFeatures'.
- *
- * @param showSequenceFeatures the value of field
- * 'showSequenceFeatures'.
- */
- public void setShowSequenceFeatures(
- final boolean showSequenceFeatures) {
- this._showSequenceFeatures = showSequenceFeatures;
- this._has_showSequenceFeatures = true;
- }
-
- /**
- * Sets the value of field 'showText'.
- *
- * @param showText the value of field 'showText'.
- */
- public void setShowText(
- final boolean showText) {
- this._showText = showText;
- this._has_showText = true;
- }
-
- /**
- * Sets the value of field 'startRes'.
- *
- * @param startRes the value of field 'startRes'.
- */
- public void setStartRes(
- final int startRes) {
- this._startRes = startRes;
- this._has_startRes = true;
- }
-
- /**
- * Sets the value of field 'startSeq'.
- *
- * @param startSeq the value of field 'startSeq'.
- */
- public void setStartSeq(
- final int startSeq) {
- this._startSeq = startSeq;
- this._has_startSeq = true;
- }
-
- /**
- * Sets the value of field 'title'.
- *
- * @param title the value of field 'title'.
- */
- public void setTitle(
- final java.lang.String title) {
- this._title = title;
- }
-
- /**
- * Sets the value of field 'width'.
- *
- * @param width the value of field 'width'.
- */
- public void setWidth(
- final int width) {
- this._width = width;
- this._has_width = true;
- }
-
- /**
- * Sets the value of field 'wrapAlignment'.
- *
- * @param wrapAlignment the value of field 'wrapAlignment'.
- */
- public void setWrapAlignment(
- final boolean wrapAlignment) {
- this._wrapAlignment = wrapAlignment;
- this._has_wrapAlignment = true;
- }
-
- /**
- * Sets the value of field 'xpos'.
- *
- * @param xpos the value of field 'xpos'.
- */
- public void setXpos(
- final int xpos) {
- this._xpos = xpos;
- this._has_xpos = true;
- }
-
- /**
- * Sets the value of field 'ypos'.
- *
- * @param ypos the value of field 'ypos'.
- */
- public void setYpos(
- final int ypos) {
- this._ypos = ypos;
- this._has_ypos = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.binding.Viewport
- */
- public static jalview.binding.Viewport unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.binding.Viewport) Unmarshaller.unmarshal(jalview.binding.Viewport.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ public void deleteShowQuality()
+ {
+ this._has_showQuality = false;
+ }
+
+ /**
+ */
+ public void deleteShowSequenceFeatures()
+ {
+ this._has_showSequenceFeatures = false;
+ }
+
+ /**
+ */
+ public void deleteShowText()
+ {
+ this._has_showText = false;
+ }
+
+ /**
+ */
+ public void deleteStartRes()
+ {
+ this._has_startRes = false;
+ }
+
+ /**
+ */
+ public void deleteStartSeq()
+ {
+ this._has_startSeq = false;
+ }
+
+ /**
+ */
+ public void deleteWidth()
+ {
+ this._has_width = false;
+ }
+
+ /**
+ */
+ public void deleteWrapAlignment()
+ {
+ this._has_wrapAlignment = false;
+ }
+
+ /**
+ */
+ public void deleteXpos()
+ {
+ this._has_xpos = false;
+ }
+
+ /**
+ */
+ public void deleteYpos()
+ {
+ this._has_ypos = false;
+ }
+
+ /**
+ * Returns the value of field 'bgColour'.
+ *
+ * @return the value of field 'BgColour'.
+ */
+ public java.lang.String getBgColour()
+ {
+ return this._bgColour;
+ }
+
+ /**
+ * Returns the value of field 'consThreshold'.
+ *
+ * @return the value of field 'ConsThreshold'.
+ */
+ public int getConsThreshold()
+ {
+ return this._consThreshold;
+ }
+
+ /**
+ * Returns the value of field 'conservationSelected'.
+ *
+ * @return the value of field 'ConservationSelected'.
+ */
+ public boolean getConservationSelected()
+ {
+ return this._conservationSelected;
+ }
+
+ /**
+ * Returns the value of field 'fontName'.
+ *
+ * @return the value of field 'FontName'.
+ */
+ public java.lang.String getFontName()
+ {
+ return this._fontName;
+ }
+
+ /**
+ * Returns the value of field 'fontSize'.
+ *
+ * @return the value of field 'FontSize'.
+ */
+ public int getFontSize()
+ {
+ return this._fontSize;
+ }
+
+ /**
+ * Returns the value of field 'fontStyle'.
+ *
+ * @return the value of field 'FontStyle'.
+ */
+ public int getFontStyle()
+ {
+ return this._fontStyle;
+ }
+
+ /**
+ * Returns the value of field 'height'.
+ *
+ * @return the value of field 'Height'.
+ */
+ public int getHeight()
+ {
+ return this._height;
+ }
+
+ /**
+ * Returns the value of field 'pidSelected'.
+ *
+ * @return the value of field 'PidSelected'.
+ */
+ public boolean getPidSelected()
+ {
+ return this._pidSelected;
+ }
+
+ /**
+ * Returns the value of field 'pidThreshold'.
+ *
+ * @return the value of field 'PidThreshold'.
+ */
+ public int getPidThreshold()
+ {
+ return this._pidThreshold;
+ }
+
+ /**
+ * Returns the value of field 'renderGaps'.
+ *
+ * @return the value of field 'RenderGaps'.
+ */
+ public boolean getRenderGaps()
+ {
+ return this._renderGaps;
+ }
+
+ /**
+ * Returns the value of field 'showAnnotation'.
+ *
+ * @return the value of field 'ShowAnnotation'.
+ */
+ public boolean getShowAnnotation()
+ {
+ return this._showAnnotation;
+ }
+
+ /**
+ * Returns the value of field 'showBoxes'.
+ *
+ * @return the value of field 'ShowBoxes'.
+ */
+ public boolean getShowBoxes()
+ {
+ return this._showBoxes;
+ }
+
+ /**
+ * Returns the value of field 'showColourText'.
+ *
+ * @return the value of field 'ShowColourText'.
+ */
+ public boolean getShowColourText()
+ {
+ return this._showColourText;
+ }
+
+ /**
+ * Returns the value of field 'showConservation'.
+ *
+ * @return the value of field 'ShowConservation'.
+ */
+ public boolean getShowConservation()
+ {
+ return this._showConservation;
+ }
+
+ /**
+ * Returns the value of field 'showFullId'.
+ *
+ * @return the value of field 'ShowFullId'.
+ */
+ public boolean getShowFullId()
+ {
+ return this._showFullId;
+ }
+
+ /**
+ * Returns the value of field 'showIdentity'.
+ *
+ * @return the value of field 'ShowIdentity'.
+ */
+ public boolean getShowIdentity()
+ {
+ return this._showIdentity;
+ }
+
+ /**
+ * Returns the value of field 'showQuality'.
+ *
+ * @return the value of field 'ShowQuality'.
+ */
+ public boolean getShowQuality()
+ {
+ return this._showQuality;
+ }
+
+ /**
+ * Returns the value of field 'showSequenceFeatures'.
+ *
+ * @return the value of field 'ShowSequenceFeatures'.
+ */
+ public boolean getShowSequenceFeatures()
+ {
+ return this._showSequenceFeatures;
+ }
+
+ /**
+ * Returns the value of field 'showText'.
+ *
+ * @return the value of field 'ShowText'.
+ */
+ public boolean getShowText()
+ {
+ return this._showText;
+ }
+
+ /**
+ * Returns the value of field 'startRes'.
+ *
+ * @return the value of field 'StartRes'.
+ */
+ public int getStartRes()
+ {
+ return this._startRes;
+ }
+
+ /**
+ * Returns the value of field 'startSeq'.
+ *
+ * @return the value of field 'StartSeq'.
+ */
+ public int getStartSeq()
+ {
+ return this._startSeq;
+ }
+
+ /**
+ * Returns the value of field 'title'.
+ *
+ * @return the value of field 'Title'.
+ */
+ public java.lang.String getTitle()
+ {
+ return this._title;
+ }
+
+ /**
+ * Returns the value of field 'width'.
+ *
+ * @return the value of field 'Width'.
+ */
+ public int getWidth()
+ {
+ return this._width;
+ }
+
+ /**
+ * Returns the value of field 'wrapAlignment'.
+ *
+ * @return the value of field 'WrapAlignment'.
+ */
+ public boolean getWrapAlignment()
+ {
+ return this._wrapAlignment;
+ }
+
+ /**
+ * Returns the value of field 'xpos'.
+ *
+ * @return the value of field 'Xpos'.
+ */
+ public int getXpos()
+ {
+ return this._xpos;
+ }
+
+ /**
+ * Returns the value of field 'ypos'.
+ *
+ * @return the value of field 'Ypos'.
+ */
+ public int getYpos()
+ {
+ return this._ypos;
+ }
+
+ /**
+ * Method hasConsThreshold.
+ *
+ * @return true if at least one ConsThreshold has been added
+ */
+ public boolean hasConsThreshold()
+ {
+ return this._has_consThreshold;
+ }
+
+ /**
+ * Method hasConservationSelected.
+ *
+ * @return true if at least one ConservationSelected has been added
+ */
+ public boolean hasConservationSelected()
+ {
+ return this._has_conservationSelected;
+ }
+
+ /**
+ * Method hasFontSize.
+ *
+ * @return true if at least one FontSize has been added
+ */
+ public boolean hasFontSize()
+ {
+ return this._has_fontSize;
+ }
+
+ /**
+ * Method hasFontStyle.
+ *
+ * @return true if at least one FontStyle has been added
+ */
+ public boolean hasFontStyle()
+ {
+ return this._has_fontStyle;
+ }
+
+ /**
+ * Method hasHeight.
+ *
+ * @return true if at least one Height has been added
+ */
+ public boolean hasHeight()
+ {
+ return this._has_height;
+ }
+
+ /**
+ * Method hasPidSelected.
+ *
+ * @return true if at least one PidSelected has been added
+ */
+ public boolean hasPidSelected()
+ {
+ return this._has_pidSelected;
+ }
+
+ /**
+ * Method hasPidThreshold.
+ *
+ * @return true if at least one PidThreshold has been added
+ */
+ public boolean hasPidThreshold()
+ {
+ return this._has_pidThreshold;
+ }
+
+ /**
+ * Method hasRenderGaps.
+ *
+ * @return true if at least one RenderGaps has been added
+ */
+ public boolean hasRenderGaps()
+ {
+ return this._has_renderGaps;
+ }
+
+ /**
+ * Method hasShowAnnotation.
+ *
+ * @return true if at least one ShowAnnotation has been added
+ */
+ public boolean hasShowAnnotation()
+ {
+ return this._has_showAnnotation;
+ }
+
+ /**
+ * Method hasShowBoxes.
+ *
+ * @return true if at least one ShowBoxes has been added
+ */
+ public boolean hasShowBoxes()
+ {
+ return this._has_showBoxes;
+ }
+
+ /**
+ * Method hasShowColourText.
+ *
+ * @return true if at least one ShowColourText has been added
+ */
+ public boolean hasShowColourText()
+ {
+ return this._has_showColourText;
+ }
+
+ /**
+ * Method hasShowConservation.
+ *
+ * @return true if at least one ShowConservation has been added
+ */
+ public boolean hasShowConservation()
+ {
+ return this._has_showConservation;
+ }
+
+ /**
+ * Method hasShowFullId.
+ *
+ * @return true if at least one ShowFullId has been added
+ */
+ public boolean hasShowFullId()
+ {
+ return this._has_showFullId;
+ }
+
+ /**
+ * Method hasShowIdentity.
+ *
+ * @return true if at least one ShowIdentity has been added
+ */
+ public boolean hasShowIdentity()
+ {
+ return this._has_showIdentity;
+ }
+
+ /**
+ * Method hasShowQuality.
+ *
+ * @return true if at least one ShowQuality has been added
+ */
+ public boolean hasShowQuality()
+ {
+ return this._has_showQuality;
+ }
+
+ /**
+ * Method hasShowSequenceFeatures.
+ *
+ * @return true if at least one ShowSequenceFeatures has been added
+ */
+ public boolean hasShowSequenceFeatures()
+ {
+ return this._has_showSequenceFeatures;
+ }
+
+ /**
+ * Method hasShowText.
+ *
+ * @return true if at least one ShowText has been added
+ */
+ public boolean hasShowText()
+ {
+ return this._has_showText;
+ }
+
+ /**
+ * Method hasStartRes.
+ *
+ * @return true if at least one StartRes has been added
+ */
+ public boolean hasStartRes()
+ {
+ return this._has_startRes;
+ }
+
+ /**
+ * Method hasStartSeq.
+ *
+ * @return true if at least one StartSeq has been added
+ */
+ public boolean hasStartSeq()
+ {
+ return this._has_startSeq;
+ }
+
+ /**
+ * Method hasWidth.
+ *
+ * @return true if at least one Width has been added
+ */
+ public boolean hasWidth()
+ {
+ return this._has_width;
+ }
+
+ /**
+ * Method hasWrapAlignment.
+ *
+ * @return true if at least one WrapAlignment has been added
+ */
+ public boolean hasWrapAlignment()
+ {
+ return this._has_wrapAlignment;
+ }
+
+ /**
+ * Method hasXpos.
+ *
+ * @return true if at least one Xpos has been added
+ */
+ public boolean hasXpos()
+ {
+ return this._has_xpos;
+ }
+
+ /**
+ * Method hasYpos.
+ *
+ * @return true if at least one Ypos has been added
+ */
+ public boolean hasYpos()
+ {
+ return this._has_ypos;
+ }
+
+ /**
+ * Returns the value of field 'conservationSelected'.
+ *
+ * @return the value of field 'ConservationSelected'.
+ */
+ public boolean isConservationSelected()
+ {
+ return this._conservationSelected;
+ }
+
+ /**
+ * Returns the value of field 'pidSelected'.
+ *
+ * @return the value of field 'PidSelected'.
+ */
+ public boolean isPidSelected()
+ {
+ return this._pidSelected;
+ }
+
+ /**
+ * Returns the value of field 'renderGaps'.
+ *
+ * @return the value of field 'RenderGaps'.
+ */
+ public boolean isRenderGaps()
+ {
+ return this._renderGaps;
+ }
+
+ /**
+ * Returns the value of field 'showAnnotation'.
+ *
+ * @return the value of field 'ShowAnnotation'.
+ */
+ public boolean isShowAnnotation()
+ {
+ return this._showAnnotation;
+ }
+
+ /**
+ * Returns the value of field 'showBoxes'.
+ *
+ * @return the value of field 'ShowBoxes'.
+ */
+ public boolean isShowBoxes()
+ {
+ return this._showBoxes;
+ }
+
+ /**
+ * Returns the value of field 'showColourText'.
+ *
+ * @return the value of field 'ShowColourText'.
+ */
+ public boolean isShowColourText()
+ {
+ return this._showColourText;
+ }
+
+ /**
+ * Returns the value of field 'showConservation'.
+ *
+ * @return the value of field 'ShowConservation'.
+ */
+ public boolean isShowConservation()
+ {
+ return this._showConservation;
+ }
+
+ /**
+ * Returns the value of field 'showFullId'.
+ *
+ * @return the value of field 'ShowFullId'.
+ */
+ public boolean isShowFullId()
+ {
+ return this._showFullId;
+ }
+
+ /**
+ * Returns the value of field 'showIdentity'.
+ *
+ * @return the value of field 'ShowIdentity'.
+ */
+ public boolean isShowIdentity()
+ {
+ return this._showIdentity;
+ }
+
+ /**
+ * Returns the value of field 'showQuality'.
+ *
+ * @return the value of field 'ShowQuality'.
+ */
+ public boolean isShowQuality()
+ {
+ return this._showQuality;
+ }
+
+ /**
+ * Returns the value of field 'showSequenceFeatures'.
+ *
+ * @return the value of field 'ShowSequenceFeatures'.
+ */
+ public boolean isShowSequenceFeatures()
+ {
+ return this._showSequenceFeatures;
+ }
+
+ /**
+ * Returns the value of field 'showText'.
+ *
+ * @return the value of field 'ShowText'.
+ */
+ public boolean isShowText()
+ {
+ return this._showText;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the value of field 'wrapAlignment'.
+ *
+ * @return the value of field 'WrapAlignment'.
+ */
+ public boolean isWrapAlignment()
+ {
+ return this._wrapAlignment;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'bgColour'.
+ *
+ * @param bgColour
+ * the value of field 'bgColour'.
+ */
+ public void setBgColour(final java.lang.String bgColour)
+ {
+ this._bgColour = bgColour;
+ }
+
+ /**
+ * Sets the value of field 'consThreshold'.
+ *
+ * @param consThreshold
+ * the value of field 'consThreshold'.
+ */
+ public void setConsThreshold(final int consThreshold)
+ {
+ this._consThreshold = consThreshold;
+ this._has_consThreshold = true;
+ }
+
+ /**
+ * Sets the value of field 'conservationSelected'.
+ *
+ * @param conservationSelected
+ * the value of field 'conservationSelected'.
+ */
+ public void setConservationSelected(final boolean conservationSelected)
+ {
+ this._conservationSelected = conservationSelected;
+ this._has_conservationSelected = true;
+ }
+
+ /**
+ * Sets the value of field 'fontName'.
+ *
+ * @param fontName
+ * the value of field 'fontName'.
+ */
+ public void setFontName(final java.lang.String fontName)
+ {
+ this._fontName = fontName;
+ }
+
+ /**
+ * Sets the value of field 'fontSize'.
+ *
+ * @param fontSize
+ * the value of field 'fontSize'.
+ */
+ public void setFontSize(final int fontSize)
+ {
+ this._fontSize = fontSize;
+ this._has_fontSize = true;
+ }
+
+ /**
+ * Sets the value of field 'fontStyle'.
+ *
+ * @param fontStyle
+ * the value of field 'fontStyle'.
+ */
+ public void setFontStyle(final int fontStyle)
+ {
+ this._fontStyle = fontStyle;
+ this._has_fontStyle = true;
+ }
+
+ /**
+ * Sets the value of field 'height'.
+ *
+ * @param height
+ * the value of field 'height'.
+ */
+ public void setHeight(final int height)
+ {
+ this._height = height;
+ this._has_height = true;
+ }
+
+ /**
+ * Sets the value of field 'pidSelected'.
+ *
+ * @param pidSelected
+ * the value of field 'pidSelected'.
+ */
+ public void setPidSelected(final boolean pidSelected)
+ {
+ this._pidSelected = pidSelected;
+ this._has_pidSelected = true;
+ }
+
+ /**
+ * Sets the value of field 'pidThreshold'.
+ *
+ * @param pidThreshold
+ * the value of field 'pidThreshold'.
+ */
+ public void setPidThreshold(final int pidThreshold)
+ {
+ this._pidThreshold = pidThreshold;
+ this._has_pidThreshold = true;
+ }
+
+ /**
+ * Sets the value of field 'renderGaps'.
+ *
+ * @param renderGaps
+ * the value of field 'renderGaps'.
+ */
+ public void setRenderGaps(final boolean renderGaps)
+ {
+ this._renderGaps = renderGaps;
+ this._has_renderGaps = true;
+ }
+
+ /**
+ * Sets the value of field 'showAnnotation'.
+ *
+ * @param showAnnotation
+ * the value of field 'showAnnotation'.
+ */
+ public void setShowAnnotation(final boolean showAnnotation)
+ {
+ this._showAnnotation = showAnnotation;
+ this._has_showAnnotation = true;
+ }
+
+ /**
+ * Sets the value of field 'showBoxes'.
+ *
+ * @param showBoxes
+ * the value of field 'showBoxes'.
+ */
+ public void setShowBoxes(final boolean showBoxes)
+ {
+ this._showBoxes = showBoxes;
+ this._has_showBoxes = true;
+ }
+
+ /**
+ * Sets the value of field 'showColourText'.
+ *
+ * @param showColourText
+ * the value of field 'showColourText'.
+ */
+ public void setShowColourText(final boolean showColourText)
+ {
+ this._showColourText = showColourText;
+ this._has_showColourText = true;
+ }
+
+ /**
+ * Sets the value of field 'showConservation'.
+ *
+ * @param showConservation
+ * the value of field 'showConservation'
+ */
+ public void setShowConservation(final boolean showConservation)
+ {
+ this._showConservation = showConservation;
+ this._has_showConservation = true;
+ }
+
+ /**
+ * Sets the value of field 'showFullId'.
+ *
+ * @param showFullId
+ * the value of field 'showFullId'.
+ */
+ public void setShowFullId(final boolean showFullId)
+ {
+ this._showFullId = showFullId;
+ this._has_showFullId = true;
+ }
+
+ /**
+ * Sets the value of field 'showIdentity'.
+ *
+ * @param showIdentity
+ * the value of field 'showIdentity'.
+ */
+ public void setShowIdentity(final boolean showIdentity)
+ {
+ this._showIdentity = showIdentity;
+ this._has_showIdentity = true;
+ }
+
+ /**
+ * Sets the value of field 'showQuality'.
+ *
+ * @param showQuality
+ * the value of field 'showQuality'.
+ */
+ public void setShowQuality(final boolean showQuality)
+ {
+ this._showQuality = showQuality;
+ this._has_showQuality = true;
+ }
+
+ /**
+ * Sets the value of field 'showSequenceFeatures'.
+ *
+ * @param showSequenceFeatures
+ * the value of field 'showSequenceFeatures'.
+ */
+ public void setShowSequenceFeatures(final boolean showSequenceFeatures)
+ {
+ this._showSequenceFeatures = showSequenceFeatures;
+ this._has_showSequenceFeatures = true;
+ }
+
+ /**
+ * Sets the value of field 'showText'.
+ *
+ * @param showText
+ * the value of field 'showText'.
+ */
+ public void setShowText(final boolean showText)
+ {
+ this._showText = showText;
+ this._has_showText = true;
+ }
+
+ /**
+ * Sets the value of field 'startRes'.
+ *
+ * @param startRes
+ * the value of field 'startRes'.
+ */
+ public void setStartRes(final int startRes)
+ {
+ this._startRes = startRes;
+ this._has_startRes = true;
+ }
+
+ /**
+ * Sets the value of field 'startSeq'.
+ *
+ * @param startSeq
+ * the value of field 'startSeq'.
+ */
+ public void setStartSeq(final int startSeq)
+ {
+ this._startSeq = startSeq;
+ this._has_startSeq = true;
+ }
+
+ /**
+ * Sets the value of field 'title'.
+ *
+ * @param title
+ * the value of field 'title'.
+ */
+ public void setTitle(final java.lang.String title)
+ {
+ this._title = title;
+ }
+
+ /**
+ * Sets the value of field 'width'.
+ *
+ * @param width
+ * the value of field 'width'.
+ */
+ public void setWidth(final int width)
+ {
+ this._width = width;
+ this._has_width = true;
+ }
+
+ /**
+ * Sets the value of field 'wrapAlignment'.
+ *
+ * @param wrapAlignment
+ * the value of field 'wrapAlignment'.
+ */
+ public void setWrapAlignment(final boolean wrapAlignment)
+ {
+ this._wrapAlignment = wrapAlignment;
+ this._has_wrapAlignment = true;
+ }
+
+ /**
+ * Sets the value of field 'xpos'.
+ *
+ * @param xpos
+ * the value of field 'xpos'.
+ */
+ public void setXpos(final int xpos)
+ {
+ this._xpos = xpos;
+ this._has_xpos = true;
+ }
+
+ /**
+ * Sets the value of field 'ypos'.
+ *
+ * @param ypos
+ * the value of field 'ypos'.
+ */
+ public void setYpos(final int ypos)
+ {
+ this._ypos = ypos;
+ this._has_ypos = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.Viewport
+ */
+ public static jalview.binding.Viewport unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.Viewport) Unmarshaller.unmarshal(
+ jalview.binding.Viewport.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/commands/ChangeCaseCommand.java b/src/jalview/commands/ChangeCaseCommand.java
index dc859f6..b68b47c 100644
--- a/src/jalview/commands/ChangeCaseCommand.java
+++ b/src/jalview/commands/ChangeCaseCommand.java
@@ -1,23 +1,29 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.commands;
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+
+import java.util.List;
public class ChangeCaseCommand implements CommandI
{
@@ -33,10 +39,10 @@ public class ChangeCaseCommand implements CommandI
SequenceI[] seqs;
- int[][] regions;
+ List<int[]> regions;
public ChangeCaseCommand(String description, SequenceI[] seqs,
- int[][] regions, int caseChange)
+ List<int[]> regions, int caseChange)
{
this.description = description;
this.seqs = seqs;
@@ -70,21 +76,21 @@ public class ChangeCaseCommand implements CommandI
String sequence;
int start, end;
char nextChar;
- for (int r = 0; r < regions.length; r++)
+ for (int[] r : regions)
{
- start = regions[r][0];
+ start = r[0];
for (int s = 0; s < seqs.length; s++)
{
sequence = seqs[s].getSequenceAsString();
StringBuffer newSeq = new StringBuffer();
- if (regions[r][1] > sequence.length())
+ if (r[1] > sequence.length())
{
end = sequence.length();
}
else
{
- end = regions[r][1];
+ end = r[1];
}
if (start > 0)
diff --git a/src/jalview/commands/CommandI.java b/src/jalview/commands/CommandI.java
index cebbfff..291dcde 100644
--- a/src/jalview/commands/CommandI.java
+++ b/src/jalview/commands/CommandI.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.commands;
diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java
index d18cb62..1cd6fcc 100644
--- a/src/jalview/commands/EditCommand.java
+++ b/src/jalview/commands/EditCommand.java
@@ -1,25 +1,41 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.commands;
-import java.util.*;
-
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.util.ReverseListIterator;
+import jalview.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
/**
*
@@ -45,17 +61,60 @@ import jalview.datamodel.*;
*/
public class EditCommand implements CommandI
{
- public static final int INSERT_GAP = 0;
-
- public static final int DELETE_GAP = 1;
-
- public static final int CUT = 2;
-
- public static final int PASTE = 3;
-
- public static final int REPLACE = 4;
+ public enum Action
+ {
+ INSERT_GAP
+ {
+ @Override
+ public Action getUndoAction()
+ {
+ return DELETE_GAP;
+ }
+ },
+ DELETE_GAP
+ {
+ @Override
+ public Action getUndoAction()
+ {
+ return INSERT_GAP;
+ }
+ },
+ CUT
+ {
+ @Override
+ public Action getUndoAction()
+ {
+ return PASTE;
+ }
+ },
+ PASTE
+ {
+ @Override
+ public Action getUndoAction()
+ {
+ return CUT;
+ }
+ },
+ REPLACE
+ {
+ @Override
+ public Action getUndoAction()
+ {
+ return REPLACE;
+ }
+ },
+ INSERT_NUC
+ {
+ @Override
+ public Action getUndoAction()
+ {
+ return null;
+ }
+ };
+ public abstract Action getUndoAction();
+ };
- Edit[] edits;
+ private List<Edit> edits = new ArrayList<Edit>();
String description;
@@ -68,45 +127,170 @@ public class EditCommand implements CommandI
this.description = description;
}
- public EditCommand(String description, int command, SequenceI[] seqs,
+ public EditCommand(String description, Action command, SequenceI[] seqs,
int position, int number, AlignmentI al)
{
this.description = description;
- if (command == CUT || command == PASTE)
+ if (command == Action.CUT || command == Action.PASTE)
{
- edits = new Edit[]
- { new Edit(command, seqs, position, number, al) };
+ setEdit(new Edit(command, seqs, position, number, al));
}
performEdit(0, null);
}
- public EditCommand(String description, int command, String replace,
+ public EditCommand(String description, Action command, String replace,
SequenceI[] seqs, int position, int number, AlignmentI al)
{
this.description = description;
- if (command == REPLACE)
+ if (command == Action.REPLACE)
{
- edits = new Edit[]
- { new Edit(command, seqs, position, number, al, replace) };
+ setEdit(new Edit(command, seqs, position, number, al, replace));
}
performEdit(0, null);
}
+ /**
+ * Set the list of edits to the specified item (only).
+ *
+ * @param e
+ */
+ protected void setEdit(Edit e)
+ {
+ edits.clear();
+ edits.add(e);
+ }
+
+ /**
+ * Add the given edit command to the stored list of commands. If simply
+ * expanding the range of the last command added, then modify it instead of
+ * adding a new command.
+ *
+ * @param e
+ */
+ public void addEdit(Edit e)
+ {
+ if (!expandEdit(edits, e))
+ {
+ edits.add(e);
+ }
+ }
+
+ /**
+ * Returns true if the new edit is incorporated by updating (expanding the
+ * range of) the last edit on the list, else false. We can 'expand' the last
+ * edit if the new one is the same action, on the same sequences, and acts on
+ * a contiguous range. This is the case where a mouse drag generates a series
+ * of contiguous gap insertions or deletions.
+ *
+ * @param edits
+ * @param e
+ * @return
+ */
+ protected static boolean expandEdit(List<Edit> edits, Edit e)
+ {
+ if (edits == null || edits.isEmpty())
+ {
+ return false;
+ }
+ Edit lastEdit = edits.get(edits.size() - 1);
+ Action action = e.command;
+ if (lastEdit.command != action)
+ {
+ return false;
+ }
+
+ /*
+ * Both commands must act on the same sequences - compare the underlying
+ * dataset sequences, rather than the aligned sequences, which change as
+ * they are edited.
+ */
+ if (lastEdit.seqs.length != e.seqs.length)
+ {
+ return false;
+ }
+ for (int i = 0; i < e.seqs.length; i++)
+ {
+ if (lastEdit.seqs[i].getDatasetSequence() != e.seqs[i]
+ .getDatasetSequence())
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Check a contiguous edit; either
+ * <ul>
+ * <li>a new Insert <n> positions to the right of the last <insert n>, or</li>
+ * <li>a new Delete <n> gaps which is <n> positions to the left of the last
+ * delete.</li>
+ * </ul>
+ */
+ boolean contiguous = (action == Action.INSERT_GAP && e.position == lastEdit.position
+ + lastEdit.number)
+ || (action == Action.DELETE_GAP && e.position + e.number == lastEdit.position);
+ if (contiguous)
+ {
+ /*
+ * We are just expanding the range of the last edit. For delete gap, also
+ * moving the start position left.
+ */
+ lastEdit.number += e.number;
+ lastEdit.seqs = e.seqs;
+ if (action == Action.DELETE_GAP)
+ {
+ lastEdit.position--;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Clear the list of stored edit commands.
+ *
+ */
+ protected void clearEdits()
+ {
+ edits.clear();
+ }
+
+ /**
+ * Returns the i'th stored Edit command.
+ *
+ * @param i
+ * @return
+ */
+ protected Edit getEdit(int i)
+ {
+ if (i >= 0 && i < edits.size())
+ {
+ return edits.get(i);
+ }
+ return null;
+ }
+
+ @Override
final public String getDescription()
{
return description;
}
+ @Override
public int getSize()
{
- return edits == null ? 0 : edits.length;
+ return edits.size();
}
+ /**
+ * Return the alignment for the first edit (or null if no edit).
+ *
+ * @return
+ */
final public AlignmentI getAlignment()
{
- return edits[0].al;
+ return (edits.isEmpty() ? null : edits.get(0).al);
}
/**
@@ -122,8 +306,8 @@ public class EditCommand implements CommandI
* @param al
* @param performEdit
*/
- final public void appendEdit(int command, SequenceI[] seqs, int position,
- int number, AlignmentI al, boolean performEdit)
+ final public void appendEdit(Action command, SequenceI[] seqs,
+ int position, int number, AlignmentI al, boolean performEdit)
{
appendEdit(command, seqs, position, number, al, performEdit, null);
}
@@ -140,8 +324,9 @@ public class EditCommand implements CommandI
* @param performEdit
* @param views
*/
- final public void appendEdit(int command, SequenceI[] seqs, int position,
- int number, AlignmentI al, boolean performEdit, AlignmentI[] views)
+ final public void appendEdit(Action command, SequenceI[] seqs,
+ int position, int number, AlignmentI al, boolean performEdit,
+ AlignmentI[] views)
{
Edit edit = new Edit(command, seqs, position, number,
al.getGapCharacter());
@@ -151,95 +336,171 @@ public class EditCommand implements CommandI
edit.fullAlignmentHeight = true;
}
- if (edits != null)
+ addEdit(edit);
+
+ if (performEdit)
{
- Edit[] temp = new Edit[edits.length + 1];
- System.arraycopy(edits, 0, temp, 0, edits.length);
- edits = temp;
- edits[edits.length - 1] = edit;
+ performEdit(edit, views);
}
- else
+ }
+
+ /**
+ * Overloaded method that accepts an Edit object with additional parameters.
+ *
+ * @param edit
+ * @param al
+ * @param performEdit
+ * @param views
+ */
+ final public void appendEdit(Edit edit, AlignmentI al,
+ boolean performEdit, AlignmentI[] views)
+ {
+ if (al.getHeight() == edit.seqs.length)
{
- edits = new Edit[]
- { edit };
+ edit.al = al;
+ edit.fullAlignmentHeight = true;
}
+ addEdit(edit);
+
if (performEdit)
{
- performEdit(edits.length - 1, views);
+ performEdit(edit, views);
}
}
- final void performEdit(int commandIndex, AlignmentI[] views)
+ /**
+ * Execute all the edit commands, starting at the given commandIndex
+ *
+ * @param commandIndex
+ * @param views
+ */
+ public final void performEdit(int commandIndex, AlignmentI[] views)
{
- int eSize = edits.length;
- for (int e = commandIndex; e < eSize; e++)
+ ListIterator<Edit> iterator = edits.listIterator(commandIndex);
+ while (iterator.hasNext())
{
- switch (edits[e].command)
- {
- case INSERT_GAP:
- insertGap(edits[e]);
- break;
- case DELETE_GAP:
- deleteGap(edits[e]);
- break;
- case CUT:
- cut(edits[e], views);
- break;
- case PASTE:
- paste(edits[e], views);
- break;
- case REPLACE:
- replace(edits[e]);
- break;
- }
+ Edit edit = iterator.next();
+ performEdit(edit, views);
+ }
+ }
+
+ /**
+ * Execute one edit command in all the specified alignment views
+ *
+ * @param edit
+ * @param views
+ */
+ protected static void performEdit(Edit edit, AlignmentI[] views)
+ {
+ switch (edit.command)
+ {
+ case INSERT_GAP:
+ insertGap(edit);
+ break;
+ case DELETE_GAP:
+ deleteGap(edit);
+ break;
+ case CUT:
+ cut(edit, views);
+ break;
+ case PASTE:
+ paste(edit, views);
+ break;
+ case REPLACE:
+ replace(edit);
+ break;
+ case INSERT_NUC:
+ // TODO:add deleteNuc for UNDO
+ // case INSERT_NUC:
+ // insertNuc(edits[e]);
+ break;
+ default:
+ break;
}
}
+ @Override
final public void doCommand(AlignmentI[] views)
{
performEdit(0, views);
}
+ /**
+ * Undo the stored list of commands, in reverse order.
+ */
+ @Override
final public void undoCommand(AlignmentI[] views)
{
- int e = 0, eSize = edits.length;
- for (e = eSize - 1; e > -1; e--)
+ ListIterator<Edit> iterator = edits.listIterator(edits.size());
+ while (iterator.hasPrevious())
{
- switch (edits[e].command)
+ Edit e = iterator.previous();
+ switch (e.command)
{
case INSERT_GAP:
- deleteGap(edits[e]);
+ deleteGap(e);
break;
case DELETE_GAP:
- insertGap(edits[e]);
+ insertGap(e);
break;
case CUT:
- paste(edits[e], views);
+ paste(e, views);
break;
case PASTE:
- cut(edits[e], views);
+ cut(e, views);
break;
case REPLACE:
- replace(edits[e]);
+ replace(e);
+ break;
+ case INSERT_NUC:
+ // not implemented
+ break;
+ default:
break;
}
}
}
- final void insertGap(Edit command)
+ /**
+ * Insert gap(s) in sequences as specified by the command, and adjust
+ * annotations.
+ *
+ * @param command
+ */
+ final private static void insertGap(Edit command)
{
for (int s = 0; s < command.seqs.length; s++)
{
command.seqs[s].insertCharAt(command.position, command.number,
command.gapChar);
+ // System.out.println("pos: "+command.position+" number: "+command.number);
}
adjustAnnotations(command, true, false, null);
}
- final void deleteGap(Edit command)
+ //
+ // final void insertNuc(Edit command)
+ // {
+ //
+ // for (int s = 0; s < command.seqs.length; s++)
+ // {
+ // System.out.println("pos: "+command.position+" number: "+command.number);
+ // command.seqs[s].insertCharAt(command.position, command.number,'A');
+ // }
+ //
+ // adjustAnnotations(command, true, false, null);
+ // }
+
+ /**
+ * Delete gap(s) in sequences as specified by the command, and adjust
+ * annotations.
+ *
+ * @param command
+ */
+ final static private void deleteGap(Edit command)
{
for (int s = 0; s < command.seqs.length; s++)
{
@@ -250,36 +511,44 @@ public class EditCommand implements CommandI
adjustAnnotations(command, false, false, null);
}
- void cut(Edit command, AlignmentI[] views)
+ /**
+ * Carry out a Cut action. The cut characters are saved in case Undo is
+ * requested.
+ *
+ * @param command
+ * @param views
+ */
+ static void cut(Edit command, AlignmentI[] views)
{
boolean seqDeleted = false;
command.string = new char[command.seqs.length][];
for (int i = 0; i < command.seqs.length; i++)
{
- if (command.seqs[i].getLength() > command.position)
+ final SequenceI sequence = command.seqs[i];
+ if (sequence.getLength() > command.position)
{
- command.string[i] = command.seqs[i].getSequence(command.position,
+ command.string[i] = sequence.getSequence(command.position,
command.position + command.number);
- SequenceI oldds = command.seqs[i].getDatasetSequence();
+ SequenceI oldds = sequence.getDatasetSequence();
if (command.oldds != null && command.oldds[i] != null)
{
// we are redoing an undone cut.
- command.seqs[i].setDatasetSequence(null);
+ sequence.setDatasetSequence(null);
}
- command.seqs[i].deleteChars(command.position, command.position
+ sequence.deleteChars(command.position, command.position
+ command.number);
if (command.oldds != null && command.oldds[i] != null)
{
// oldds entry contains the cut dataset sequence.
- command.seqs[i].setDatasetSequence(command.oldds[i]);
+ sequence.setDatasetSequence(command.oldds[i]);
command.oldds[i] = oldds;
}
else
{
// modify the oldds if necessary
- if (oldds != command.seqs[i].getDatasetSequence()
- || command.seqs[i].getSequenceFeatures() != null)
+ if (oldds != sequence.getDatasetSequence()
+ || sequence.getSequenceFeatures() != null)
{
if (command.oldds == null)
{
@@ -289,16 +558,16 @@ public class EditCommand implements CommandI
adjustFeatures(
command,
i,
- command.seqs[i].findPosition(command.position),
- command.seqs[i].findPosition(command.position
- + command.number), false);
+ sequence.findPosition(command.position),
+ sequence.findPosition(command.position + command.number),
+ false);
}
}
}
- if (command.seqs[i].getLength() < 1)
+ if (sequence.getLength() < 1)
{
- command.al.deleteSequence(command.seqs[i]);
+ command.al.deleteSequence(sequence);
seqDeleted = true;
}
}
@@ -306,7 +575,14 @@ public class EditCommand implements CommandI
adjustAnnotations(command, false, seqDeleted, views);
}
- void paste(Edit command, AlignmentI[] views)
+ /**
+ * Perform the given Paste command. This may be to add cut or copied sequences
+ * to an alignment, or to undo a 'Cut' action on a region of the alignment.
+ *
+ * @param command
+ * @param views
+ */
+ static void paste(Edit command, AlignmentI[] views)
{
StringBuffer tmp;
boolean newDSNeeded;
@@ -322,11 +598,17 @@ public class EditCommand implements CommandI
if (command.seqs[i].getLength() < 1)
{
// ie this sequence was deleted, we need to
- // read it to the alignment
+ // readd it to the alignment
if (command.alIndex[i] < command.al.getHeight())
{
- command.al.getSequences().insertElementAt(command.seqs[i],
- command.alIndex[i]);
+ List<SequenceI> sequences;
+ synchronized (sequences = command.al.getSequences())
+ {
+ if (!(command.alIndex[i] < 0))
+ {
+ sequences.add(command.alIndex[i], command.seqs[i]);
+ }
+ }
}
else
{
@@ -368,9 +650,13 @@ public class EditCommand implements CommandI
+ command.number);
}
if (command.seqs[i].getStart() == start)
+ {
newstart--;
+ }
else
+ {
newend++;
+ }
}
}
command.string[i] = null;
@@ -414,7 +700,7 @@ public class EditCommand implements CommandI
command.string = null;
}
- void replace(Edit command)
+ static void replace(Edit command)
{
StringBuffer tmp;
String oldstring;
@@ -427,6 +713,9 @@ public class EditCommand implements CommandI
command.number = start + command.string[0].length;
for (int i = 0; i < command.seqs.length; i++)
{
+ boolean newDSWasNeeded = command.oldds != null
+ && command.oldds[i] != null;
+
/**
* cut addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT,
* cut, sg.getStartRes(), sg.getEndRes()-sg.getStartRes()+1,
@@ -441,15 +730,54 @@ public class EditCommand implements CommandI
oldstring = command.seqs[i].getSequenceAsString();
tmp = new StringBuffer(oldstring.substring(0, start));
tmp.append(command.string[i]);
+ String nogaprep = jalview.analysis.AlignSeq.extractGaps(
+ jalview.util.Comparison.GapChars, new String(
+ command.string[i]));
+ int ipos = command.seqs[i].findPosition(start)
+ - command.seqs[i].getStart();
tmp.append(oldstring.substring(end));
command.seqs[i].setSequence(tmp.toString());
command.string[i] = oldstring.substring(start, end).toCharArray();
+ String nogapold = jalview.analysis.AlignSeq.extractGaps(
+ jalview.util.Comparison.GapChars, new String(
+ command.string[i]));
+ if (!nogaprep.toLowerCase().equals(nogapold.toLowerCase()))
+ {
+ if (newDSWasNeeded)
+ {
+ SequenceI oldds = command.seqs[i].getDatasetSequence();
+ command.seqs[i].setDatasetSequence(command.oldds[i]);
+ command.oldds[i] = oldds;
+ }
+ else
+ {
+ if (command.oldds == null)
+ {
+ command.oldds = new SequenceI[command.seqs.length];
+ }
+ command.oldds[i] = command.seqs[i].getDatasetSequence();
+ SequenceI newds = new Sequence(
+ command.seqs[i].getDatasetSequence());
+ String fullseq, osp = newds.getSequenceAsString();
+ fullseq = osp.substring(0, ipos) + nogaprep
+ + osp.substring(ipos + nogaprep.length());
+ newds.setSequence(fullseq.toUpperCase());
+ // TODO: JAL-1131 ensure newly created dataset sequence is added to
+ // the set of
+ // dataset sequences associated with the alignment.
+ // TODO: JAL-1131 fix up any annotation associated with new dataset
+ // sequence to ensure that original sequence/annotation relationships
+ // are preserved.
+ command.seqs[i].setDatasetSequence(newds);
+
+ }
+ }
tmp = null;
oldstring = null;
}
}
- final void adjustAnnotations(Edit command, boolean insert,
+ final static void adjustAnnotations(Edit command, boolean insert,
boolean modifyVisibility, AlignmentI[] views)
{
AlignmentAnnotation[] annotations = null;
@@ -457,7 +785,7 @@ public class EditCommand implements CommandI
if (modifyVisibility && !insert)
{
// only occurs if a sequence was added or deleted.
- command.deletedAnnotationRows = new Hashtable();
+ command.deletedAnnotationRows = new Hashtable<SequenceI, AlignmentAnnotation[]>();
}
if (command.fullAlignmentHeight)
{
@@ -541,7 +869,7 @@ public class EditCommand implements CommandI
&& command.deletedAnnotationRows
.containsKey(command.seqs[s]))
{
- AlignmentAnnotation[] revealed = (AlignmentAnnotation[]) command.deletedAnnotationRows
+ AlignmentAnnotation[] revealed = command.deletedAnnotationRows
.get(command.seqs[s]);
command.seqs[s].setAlignmentAnnotation(revealed);
if (revealed != null)
@@ -612,7 +940,7 @@ public class EditCommand implements CommandI
if (!insert)
{
- command.deletedAnnotations = new Hashtable();
+ command.deletedAnnotations = new Hashtable<String, Annotation[]>();
}
int aSize;
@@ -632,10 +960,12 @@ public class EditCommand implements CommandI
{
temp = new Annotation[aSize + command.number];
if (annotations[a].padGaps)
+ {
for (int aa = 0; aa < temp.length; aa++)
{
temp[aa] = new Annotation(command.gapChar + "", null, ' ', 0);
}
+ }
}
else
{
@@ -673,7 +1003,7 @@ public class EditCommand implements CommandI
&& command.deletedAnnotations
.containsKey(annotations[a].annotationId))
{
- Annotation[] restore = (Annotation[]) command.deletedAnnotations
+ Annotation[] restore = command.deletedAnnotations
.get(annotations[a].annotationId);
System.arraycopy(restore, 0, temp, command.position,
@@ -691,7 +1021,7 @@ public class EditCommand implements CommandI
&& command.deletedAnnotations
.containsKey(annotations[a].annotationId))
{
- Annotation[] restore = (Annotation[]) command.deletedAnnotations
+ Annotation[] restore = command.deletedAnnotations
.get(annotations[a].annotationId);
temp = new Annotation[annotations[a].annotations.length
@@ -714,8 +1044,10 @@ public class EditCommand implements CommandI
int copylen = Math.min(command.position,
annotations[a].annotations.length);
if (copylen > 0)
+ {
System.arraycopy(annotations[a].annotations, 0, temp, 0,
copylen); // command.position);
+ }
Annotation[] deleted = new Annotation[command.number];
if (copylen >= command.position)
@@ -769,7 +1101,7 @@ public class EditCommand implements CommandI
}
}
- final void adjustFeatures(Edit command, int index, int i, int j,
+ final static void adjustFeatures(Edit command, int index, int i, int j,
boolean insert)
{
SequenceI seq = command.seqs[index];
@@ -784,8 +1116,7 @@ public class EditCommand implements CommandI
if (command.editedFeatures != null
&& command.editedFeatures.containsKey(seq))
{
- sequence.setSequenceFeatures((SequenceFeature[]) command.editedFeatures
- .get(seq));
+ sequence.setSequenceFeatures(command.editedFeatures.get(seq));
}
return;
@@ -840,28 +1171,132 @@ public class EditCommand implements CommandI
if (command.editedFeatures == null)
{
- command.editedFeatures = new Hashtable();
+ command.editedFeatures = new Hashtable<SequenceI, SequenceFeature[]>();
}
command.editedFeatures.put(seq, oldsf);
}
- class Edit
+ /**
+ * Returns the list of edit commands wrapped by this object.
+ *
+ * @return
+ */
+ public List<Edit> getEdits()
+ {
+ return this.edits;
+ }
+
+ /**
+ * Returns a map whose keys are the dataset sequences, and values their
+ * aligned sequences before the command edit list was applied. The aligned
+ * sequences are copies, which may be updated without affecting the originals.
+ *
+ * The command holds references to the aligned sequences (after editing). If
+ * the command is an 'undo',then the prior state is simply the aligned state.
+ * Otherwise, we have to derive the prior state by working backwards through
+ * the edit list to infer the aligned sequences before editing.
+ *
+ * Note: an alternative solution would be to cache the 'before' state of each
+ * edit, but this would be expensive in space in the common case that the
+ * original is never needed (edits are not mirrored).
+ *
+ * @return
+ * @throws IllegalStateException
+ * on detecting an edit command of a type that can't be unwound
+ */
+ public Map<SequenceI, SequenceI> priorState(boolean forUndo)
+ {
+ Map<SequenceI, SequenceI> result = new HashMap<SequenceI, SequenceI>();
+ if (getEdits() == null)
+ {
+ return result;
+ }
+ if (forUndo)
+ {
+ for (Edit e : getEdits())
+ {
+ for (SequenceI seq : e.getSequences())
+ {
+ SequenceI ds = seq.getDatasetSequence();
+ SequenceI preEdit = result.get(ds);
+ if (preEdit == null)
+ {
+ preEdit = new Sequence("", seq.getSequenceAsString());
+ preEdit.setDatasetSequence(ds);
+ result.put(ds, preEdit);
+ }
+ }
+ }
+ return result;
+ }
+
+ /*
+ * Work backwards through the edit list, deriving the sequences before each
+ * was applied. The final result is the sequence set before any edits.
+ */
+ Iterator<Edit> edits = new ReverseListIterator<Edit>(getEdits());
+ while (edits.hasNext())
+ {
+ Edit oldEdit = edits.next();
+ Action action = oldEdit.getAction();
+ int position = oldEdit.getPosition();
+ int number = oldEdit.getNumber();
+ final char gap = oldEdit.getGapCharacter();
+ for (SequenceI seq : oldEdit.getSequences())
+ {
+ SequenceI ds = seq.getDatasetSequence();
+ SequenceI preEdit = result.get(ds);
+ if (preEdit == null)
+ {
+ preEdit = new Sequence("", seq.getSequenceAsString());
+ preEdit.setDatasetSequence(ds);
+ result.put(ds, preEdit);
+ }
+ /*
+ * 'Undo' this edit action on the sequence (updating the value in the
+ * map).
+ */
+ if (ds != null)
+ {
+ if (action == Action.DELETE_GAP)
+ {
+ preEdit.setSequence(new String(StringUtils.insertCharAt(
+ preEdit.getSequence(), position, number, gap)));
+ }
+ else if (action == Action.INSERT_GAP)
+ {
+ preEdit.setSequence(new String(StringUtils.deleteChars(
+ preEdit.getSequence(), position, position + number)));
+ }
+ else
+ {
+ System.err.println("Can't undo edit action " + action);
+ // throw new IllegalStateException("Can't undo edit action " +
+ // action);
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ public class Edit
{
public SequenceI[] oldds;
boolean fullAlignmentHeight = false;
- Hashtable deletedAnnotationRows;
+ Hashtable<SequenceI, AlignmentAnnotation[]> deletedAnnotationRows;
- Hashtable deletedAnnotations;
+ Hashtable<String, Annotation[]> deletedAnnotations;
- Hashtable editedFeatures;
+ Hashtable<SequenceI, SequenceFeature[]> editedFeatures;
AlignmentI al;
- int command;
+ Action command;
char[][] string;
@@ -873,7 +1308,7 @@ public class EditCommand implements CommandI
char gapChar;
- Edit(int command, SequenceI[] seqs, int position, int number,
+ public Edit(Action command, SequenceI[] seqs, int position, int number,
char gapChar)
{
this.command = command;
@@ -883,7 +1318,7 @@ public class EditCommand implements CommandI
this.gapChar = gapChar;
}
- Edit(int command, SequenceI[] seqs, int position, int number,
+ Edit(Action command, SequenceI[] seqs, int position, int number,
AlignmentI al)
{
this.gapChar = al.getGapCharacter();
@@ -902,7 +1337,7 @@ public class EditCommand implements CommandI
fullAlignmentHeight = (al.getHeight() == seqs.length);
}
- Edit(int command, SequenceI[] seqs, int position, int number,
+ Edit(Action command, SequenceI[] seqs, int position, int number,
AlignmentI al, String replace)
{
this.command = command;
@@ -919,5 +1354,49 @@ public class EditCommand implements CommandI
fullAlignmentHeight = (al.getHeight() == seqs.length);
}
+
+ public SequenceI[] getSequences()
+ {
+ return seqs;
+ }
+
+ public int getPosition()
+ {
+ return position;
+ }
+
+ public Action getAction()
+ {
+ return command;
+ }
+
+ public int getNumber()
+ {
+ return number;
+ }
+
+ public char getGapCharacter()
+ {
+ return gapChar;
+ }
+ }
+
+ /**
+ * Returns an iterator over the list of edit commands which traverses the list
+ * either forwards or backwards.
+ *
+ * @param forwards
+ * @return
+ */
+ public Iterator<Edit> getEditIterator(boolean forwards)
+ {
+ if (forwards)
+ {
+ return getEdits().iterator();
+ }
+ else
+ {
+ return new ReverseListIterator<Edit>(getEdits());
+ }
}
}
diff --git a/src/jalview/commands/OrderCommand.java b/src/jalview/commands/OrderCommand.java
index e45aaa1..393044d 100644
--- a/src/jalview/commands/OrderCommand.java
+++ b/src/jalview/commands/OrderCommand.java
@@ -1,35 +1,65 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.commands;
-import jalview.analysis.*;
-import jalview.datamodel.*;
+import jalview.analysis.AlignmentSorter;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+/**
+ * An undoable command to reorder the sequences in an alignment.
+ *
+ * @author gmcarstairs
+ *
+ */
public class OrderCommand implements CommandI
{
String description;
+ /*
+ * The sequence order before sorting (target order for an undo)
+ */
SequenceI[] seqs;
+ /*
+ * The sequence order specified by this command
+ */
SequenceI[] seqs2;
+ /*
+ * The alignment the command acts on
+ */
AlignmentI al;
+ /**
+ * Constructor given the 'undo' sequence order, and the (already) sorted
+ * alignment.
+ *
+ * @param description
+ * a text label for the 'undo' menu option
+ * @param seqs
+ * the sequence order for undo
+ * @param al
+ * the alignment as ordered by this command
+ */
public OrderCommand(String description, SequenceI[] seqs, AlignmentI al)
{
this.description = description;
@@ -58,4 +88,15 @@ public class OrderCommand implements CommandI
{
AlignmentSorter.setOrder(al, seqs);
}
+
+ /**
+ * Returns the sequence order used to sort, or before sorting if undo=true.
+ *
+ * @param undo
+ * @return
+ */
+ public SequenceI[] getSequenceOrder(boolean undo)
+ {
+ return undo ? seqs : seqs2;
+ }
}
diff --git a/src/jalview/commands/RemoveGapColCommand.java b/src/jalview/commands/RemoveGapColCommand.java
index 83197d7..c9d8b56 100644
--- a/src/jalview/commands/RemoveGapColCommand.java
+++ b/src/jalview/commands/RemoveGapColCommand.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.commands;
@@ -36,7 +39,8 @@ package jalview.commands;
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
public class RemoveGapColCommand extends EditCommand
{
@@ -52,7 +56,7 @@ public class RemoveGapColCommand extends EditCommand
int startCol = -1, endCol = -1;
columnsDeleted = 0;
- edits = new Edit[0];
+ clearEdits();
boolean delete = true;
for (int i = start; i <= end; i++)
@@ -83,8 +87,8 @@ public class RemoveGapColCommand extends EditCommand
if (!delete && startCol > -1)
{
- this.appendEdit(DELETE_GAP, seqs, startCol - columnsDeleted, endCol
- - startCol, al, false, null);
+ this.appendEdit(Action.DELETE_GAP, seqs, startCol - columnsDeleted,
+ endCol - startCol, al, false, null);
columnsDeleted += (endCol - startCol);
startCol = -1;
@@ -97,8 +101,8 @@ public class RemoveGapColCommand extends EditCommand
// This is for empty columns at the
// end of the alignment
- this.appendEdit(DELETE_GAP, seqs, startCol - columnsDeleted, end
- - startCol + 1, al, false, null);
+ this.appendEdit(Action.DELETE_GAP, seqs, startCol - columnsDeleted,
+ end - startCol + 1, al, false, null);
columnsDeleted += (end - startCol + 1);
}
diff --git a/src/jalview/commands/RemoveGapsCommand.java b/src/jalview/commands/RemoveGapsCommand.java
index ef39ef0..c81f04f 100644
--- a/src/jalview/commands/RemoveGapsCommand.java
+++ b/src/jalview/commands/RemoveGapsCommand.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.commands;
@@ -36,7 +39,8 @@ package jalview.commands;
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
public class RemoveGapsCommand extends EditCommand
{
@@ -71,7 +75,7 @@ public class RemoveGapsCommand extends EditCommand
int j, jSize;
- edits = new Edit[0];
+ clearEdits();
boolean delete = true;
char[] sequence;
@@ -105,9 +109,9 @@ public class RemoveGapsCommand extends EditCommand
if (!delete && startCol > -1)
{
- this.appendEdit(DELETE_GAP, new SequenceI[]
- { seqs[s] }, start + startCol - deletedCols, endCol - startCol,
- al, false, null);
+ this.appendEdit(Action.DELETE_GAP, new SequenceI[] { seqs[s] },
+ start + startCol - deletedCols, endCol - startCol, al,
+ false, null);
deletedCols += (endCol - startCol);
startCol = -1;
@@ -116,8 +120,8 @@ public class RemoveGapsCommand extends EditCommand
}
if (delete && startCol > -1)
{
- this.appendEdit(DELETE_GAP, new SequenceI[]
- { seqs[s] }, start + startCol - deletedCols, jSize - startCol, al,
+ this.appendEdit(Action.DELETE_GAP, new SequenceI[] { seqs[s] },
+ start + startCol - deletedCols, jSize - startCol, al,
false, null);
}
diff --git a/src/jalview/commands/SlideSequencesCommand.java b/src/jalview/commands/SlideSequencesCommand.java
index e7126ee..153371a 100644
--- a/src/jalview/commands/SlideSequencesCommand.java
+++ b/src/jalview/commands/SlideSequencesCommand.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.commands;
-import jalview.datamodel.*;
+import jalview.datamodel.SequenceI;
public class SlideSequencesCommand extends EditCommand
{
@@ -34,21 +37,29 @@ public class SlideSequencesCommand extends EditCommand
for (i = 0; i < lSize; i++)
{
for (j = 0; j < slideSize; j++)
+ {
if (!jalview.util.Comparison.isGap(seqsLeft[i].getCharAt(j)))
{
gapsInsertedBegin = true;
break;
}
+ }
}
+ Edit e = null;
+
if (!gapsInsertedBegin)
- edits = new Edit[]
- { new Edit(DELETE_GAP, seqsLeft, 0, slideSize, gapChar) };
+ {
+ e = new Edit(Action.DELETE_GAP, seqsLeft, 0, slideSize, gapChar);
+ setEdit(e);
+ }
else
- edits = new Edit[]
- { new Edit(INSERT_GAP, seqsRight, 0, slideSize, gapChar) };
+ {
+ e = new Edit(Action.INSERT_GAP, seqsRight, 0, slideSize, gapChar);
+ setEdit(e);
+ }
- performEdit(0, null);
+ performEdit(e, null);
}
public boolean getGapsInsertedBegin()
@@ -60,12 +71,12 @@ public class SlideSequencesCommand extends EditCommand
{
boolean same = false;
- if (command.edits[0].seqs.length == edits[0].seqs.length)
+ if (command.getEdit(0).seqs.length == getEdit(0).seqs.length)
{
same = true;
- for (int i = 0; i < command.edits[0].seqs.length; i++)
+ for (int i = 0; i < command.getEdit(0).seqs.length; i++)
{
- if (edits[0].seqs[i] != command.edits[0].seqs[i])
+ if (getEdit(0).seqs[i] != command.getEdit(0).seqs[i])
{
same = false;
}
@@ -74,10 +85,7 @@ public class SlideSequencesCommand extends EditCommand
if (same)
{
- Edit[] temp = new Edit[command.edits.length + 1];
- System.arraycopy(command.edits, 0, temp, 0, command.edits.length);
- command.edits = temp;
- command.edits[command.edits.length - 1] = edits[0];
+ command.addEdit(getEdit(0));
}
return same;
diff --git a/src/jalview/commands/TrimRegionCommand.java b/src/jalview/commands/TrimRegionCommand.java
index de94dd4..32b9847 100644
--- a/src/jalview/commands/TrimRegionCommand.java
+++ b/src/jalview/commands/TrimRegionCommand.java
@@ -1,26 +1,32 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.commands;
-import java.util.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.util.ShiftList;
-import jalview.datamodel.*;
-import jalview.util.*;
+import java.util.List;
public class TrimRegionCommand extends EditCommand
{
@@ -36,7 +42,7 @@ public class TrimRegionCommand extends EditCommand
SequenceGroup selectionGroup;
- Vector deletedHiddenColumns;
+ List<int[]> deletedHiddenColumns;
int columnsDeleted;
@@ -56,8 +62,7 @@ public class TrimRegionCommand extends EditCommand
columnsDeleted = column;
- edits = new Edit[]
- { new Edit(CUT, seqs, 0, column, al) };
+ setEdit(new Edit(Action.CUT, seqs, 0, column, al));
}
else if (command.equalsIgnoreCase(TRIM_RIGHT))
{
@@ -69,17 +74,16 @@ public class TrimRegionCommand extends EditCommand
columnsDeleted = width - 1;
- edits = new Edit[]
- { new Edit(CUT, seqs, column + 1, width, al) };
+ setEdit(new Edit(Action.CUT, seqs, column + 1, width, al));
}
// We need to keep a record of the sequence start
// in order to restore the state after a redo
- int i, isize = edits[0].seqs.length;
+ int i, isize = getEdit(0).seqs.length;
start = new int[isize];
for (i = 0; i < isize; i++)
{
- start[i] = edits[0].seqs[i].getStart();
+ start[i] = getEdit(0).seqs[i].getStart();
}
performEdit(0, null);
@@ -157,7 +161,7 @@ public class TrimRegionCommand extends EditCommand
int[] region;
for (int i = 0; i < deletedHiddenColumns.size(); i++)
{
- region = (int[]) deletedHiddenColumns.elementAt(i);
+ region = deletedHiddenColumns.get(i);
colSel.hideColumns(region[0], region[1]);
}
}
diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java
new file mode 100644
index 0000000..fd5a873
--- /dev/null
+++ b/src/jalview/controller/AlignViewController.java
@@ -0,0 +1,423 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.controller;
+
+import jalview.analysis.AlignmentSorter;
+import jalview.api.AlignViewControllerGuiI;
+import jalview.api.AlignViewControllerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureRenderer;
+import jalview.commands.OrderCommand;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.io.FeaturesFile;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.List;
+
+public class AlignViewController implements AlignViewControllerI
+{
+ AlignViewportI viewport = null;
+
+ AlignmentViewPanel alignPanel = null;
+
+ /**
+ * the GUI container that is handling interactions with the user
+ */
+ private AlignViewControllerGuiI avcg;
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ viewport = null;
+ alignPanel = null;
+ avcg = null;
+ };
+
+ public AlignViewController(AlignViewControllerGuiI alignFrame,
+ AlignViewportI viewport, AlignmentViewPanel alignPanel)
+ {
+ this.avcg = alignFrame;
+ this.viewport = viewport;
+ this.alignPanel = alignPanel;
+ }
+
+ @Override
+ public void setViewportAndAlignmentPanel(AlignViewportI viewport,
+ AlignmentViewPanel alignPanel)
+ {
+ this.alignPanel = alignPanel;
+ this.viewport = viewport;
+
+ }
+
+ @Override
+ public boolean makeGroupsFromSelection()
+ {
+ SequenceGroup sg = viewport.getSelectionGroup();
+ ColumnSelection cs = viewport.getColumnSelection();
+ SequenceGroup[] gps = null;
+ if (sg != null
+ && (cs == null || cs.getSelected() == null || cs.size() == 0))
+ {
+ gps = jalview.analysis.Grouping.makeGroupsFrom(viewport
+ .getSequenceSelection(), viewport.getAlignmentView(true)
+ .getSequenceStrings(viewport.getGapCharacter()), viewport
+ .getAlignment().getGroups());
+ }
+ else
+ {
+ if (cs != null)
+ {
+ gps = jalview.analysis.Grouping.makeGroupsFromCols(
+ (sg == null) ? viewport.getAlignment().getSequencesArray()
+ : sg.getSequences().toArray(new SequenceI[0]), cs,
+ viewport.getAlignment().getGroups());
+ }
+ }
+ if (gps != null)
+ {
+ viewport.getAlignment().deleteAllGroups();
+ viewport.clearSequenceColours();
+ viewport.setSelectionGroup(null);
+ // set view properties for each group
+ for (int g = 0; g < gps.length; g++)
+ {
+ // gps[g].setShowunconserved(viewport.getShowUnconserved());
+ gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
+ viewport.getAlignment().addGroup(gps[g]);
+ Color col = new Color((int) (Math.random() * 255),
+ (int) (Math.random() * 255), (int) (Math.random() * 255));
+ col = col.brighter();
+ for (SequenceI sq : gps[g].getSequences(null))
+ {
+ viewport.setSequenceColour(sq, col);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean createGroup()
+ {
+
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (sg != null)
+ {
+ viewport.getAlignment().addGroup(sg);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean unGroup()
+ {
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (sg != null)
+ {
+ viewport.getAlignment().deleteGroup(sg);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean deleteGroups()
+ {
+ if (viewport.getAlignment().getGroups() != null
+ && viewport.getAlignment().getGroups().size() > 0)
+ {
+ viewport.getAlignment().deleteAllGroups();
+ viewport.clearSequenceColours();
+ viewport.setSelectionGroup(null);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean markColumnsContainingFeatures(boolean invert,
+ boolean extendCurrent, boolean toggle, String featureType)
+ {
+ // JBPNote this routine could also mark rows, not just columns.
+ // need a decent query structure to allow all types of feature searches
+ BitSet bs = new BitSet();
+ int alw, alStart;
+ SequenceCollectionI sqcol = (viewport.getSelectionGroup() == null ? viewport
+ .getAlignment() : viewport.getSelectionGroup());
+ alStart = sqcol.getStartRes();
+ alw = sqcol.getEndRes() + 1;
+ List<SequenceI> seqs = sqcol.getSequences();
+ int nseq = 0;
+ for (SequenceI sq : seqs)
+ {
+ int tfeat = 0;
+ if (sq != null)
+ {
+ SequenceFeature[] sf = sq.getSequenceFeatures();
+ if (sf != null)
+ {
+ int ist = sq.findIndex(sq.getStart());
+ int iend = sq.findIndex(sq.getEnd());
+ if (iend < alStart || ist > alw)
+ {
+ // sequence not in region
+ continue;
+ }
+ for (SequenceFeature sfpos : sf)
+ {
+ // future functionalty - featureType == null means mark columns
+ // containing all displayed features
+ if (sfpos != null && (featureType.equals(sfpos.getType())))
+ {
+ tfeat++;
+ // optimisation - could consider 'spos,apos' like cursor argument
+ // - findIndex wastes time by starting from first character and
+ // counting
+
+ int i = sq.findIndex(sfpos.getBegin());
+ int j = sq.findIndex(sfpos.getEnd());
+ if (j < alStart || i > alw)
+ {
+ // feature is outside selected region
+ continue;
+ }
+ if (i < alStart)
+ {
+ i = alStart;
+ }
+ if (i < ist)
+ {
+ i = ist;
+ }
+ if (j > alw)
+ {
+ j = alw;
+ }
+ for (; i <= j; i++)
+ {
+ bs.set(i - 1);
+ }
+ }
+ }
+ }
+
+ if (tfeat > 0)
+ {
+ nseq++;
+ }
+ }
+ }
+ ColumnSelection cs = viewport.getColumnSelection();
+ if (bs.cardinality() > 0 || invert)
+ {
+ if (cs == null)
+ {
+ cs = new ColumnSelection();
+ }
+ else
+ {
+ if (!extendCurrent)
+ {
+ cs.clear();
+ }
+ }
+ if (invert)
+ {
+ // invert only in the currently selected sequence region
+ for (int i = bs.nextClearBit(alStart), ibs = bs.nextSetBit(alStart); i >= alStart
+ && i < (alw);)
+ {
+ if (ibs < 0 || i < ibs)
+ {
+ if (toggle && cs.contains(i))
+ {
+ cs.removeElement(i++);
+ }
+ else
+ {
+ cs.addElement(i++);
+ }
+ }
+ else
+ {
+ i = bs.nextClearBit(ibs);
+ ibs = bs.nextSetBit(i);
+ }
+ }
+ }
+ else
+ {
+ for (int i = bs.nextSetBit(alStart); i >= alStart; i = bs
+ .nextSetBit(i + 1))
+ {
+ if (toggle && cs.contains(i))
+ {
+ cs.removeElement(i);
+ }
+ else
+ {
+ cs.addElement(i);
+ }
+ }
+ }
+ viewport.setColumnSelection(cs);
+ alignPanel.paintAlignment(true);
+ avcg.setStatus(MessageManager.formatMessage(
+ "label.view_controller_toggled_marked",
+ new String[] {
+ (toggle ? MessageManager.getString("label.toggled")
+ : MessageManager.getString("label.marked")),
+ (invert ? (Integer.valueOf((alw - alStart)
+ - bs.cardinality()).toString()) : (Integer
+ .valueOf(bs.cardinality()).toString())),
+ featureType, Integer.valueOf(nseq).toString() }));
+ return true;
+ }
+ else
+ {
+ avcg.setStatus(MessageManager.formatMessage(
+ "label.no_feature_of_type_found",
+ new String[] { featureType }));
+ if (!extendCurrent && cs != null)
+ {
+ cs.clear();
+ alignPanel.paintAlignment(true);
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public void sortAlignmentByFeatureDensity(String[] typ)
+ {
+ sortBy(typ, "Sort by Density", AlignmentSorter.FEATURE_DENSITY);
+ }
+
+ protected void sortBy(String[] typ, String methodText, final String method)
+ {
+ FeatureRenderer fr = alignPanel.getFeatureRenderer();
+ if (typ == null)
+ {
+ typ = fr == null ? null : fr.getDisplayedFeatureTypes();
+ }
+ String gps[] = null;
+ gps = fr == null ? null : fr.getDisplayedFeatureGroups();
+ if (typ != null)
+ {
+ ArrayList types = new ArrayList();
+ for (int i = 0; i < typ.length; i++)
+ {
+ if (typ[i] != null)
+ {
+ types.add(typ[i]);
+ }
+ typ = new String[types.size()];
+ types.toArray(typ);
+ }
+ }
+ if (gps != null)
+ {
+ ArrayList grps = new ArrayList();
+
+ for (int i = 0; i < gps.length; i++)
+ {
+ if (gps[i] != null)
+ {
+ grps.add(gps[i]);
+ }
+ }
+ gps = new String[grps.size()];
+ grps.toArray(gps);
+ }
+ AlignmentI al = viewport.getAlignment();
+
+ int start, stop;
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (sg != null)
+ {
+ start = sg.getStartRes();
+ stop = sg.getEndRes();
+ }
+ else
+ {
+ start = 0;
+ stop = al.getWidth();
+ }
+ SequenceI[] oldOrder = al.getSequencesArray();
+ AlignmentSorter.sortByFeature(typ, gps, start, stop, al, method);
+ avcg.addHistoryItem(new OrderCommand(methodText, oldOrder, viewport
+ .getAlignment()));
+ alignPanel.paintAlignment(true);
+
+ }
+
+ @Override
+ public void sortAlignmentByFeatureScore(String[] typ)
+ {
+ sortBy(typ, "Sort by Feature Score", AlignmentSorter.FEATURE_SCORE);
+ }
+
+ @Override
+ public boolean parseFeaturesFile(String file, String protocol,
+ boolean relaxedIdMatching)
+ {
+ boolean featuresFile = false;
+ try
+ {
+ featuresFile = new FeaturesFile(file, protocol).parse(viewport
+ .getAlignment().getDataset(), alignPanel.getFeatureRenderer()
+ .getFeatureColours(), false, relaxedIdMatching);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ if (featuresFile)
+ {
+ avcg.refreshFeatureUI(true);
+ if (alignPanel.getFeatureRenderer() != null)
+ {
+ // update the min/max ranges where necessary
+ alignPanel.getFeatureRenderer().findAllFeatures(true);
+ }
+ if (avcg.getFeatureSettingsUI() != null)
+ {
+ avcg.getFeatureSettingsUI().discoverAllFeatureData();
+ }
+ alignPanel.paintAlignment(true);
+ }
+
+ return featuresFile;
+
+ }
+}
diff --git a/src/jalview/controller/FeatureSettingsController.java b/src/jalview/controller/FeatureSettingsController.java
new file mode 100644
index 0000000..99fc355
--- /dev/null
+++ b/src/jalview/controller/FeatureSettingsController.java
@@ -0,0 +1,35 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.controller;
+
+import jalview.api.FeatureRenderer;
+import jalview.api.FeatureSettingsModelI;
+
+public class FeatureSettingsController // implements
+// jalview.api.FeatureSettingsControllerI
+{
+ FeatureSettingsControllerGuiI settingUI;
+
+ FeatureRenderer fr;
+
+ FeatureSettingsModelI fsettings;
+
+}
diff --git a/src/jalview/controller/FeatureSettingsControllerGuiI.java b/src/jalview/controller/FeatureSettingsControllerGuiI.java
new file mode 100644
index 0000000..80c91fd
--- /dev/null
+++ b/src/jalview/controller/FeatureSettingsControllerGuiI.java
@@ -0,0 +1,26 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.controller;
+
+public interface FeatureSettingsControllerGuiI
+{
+
+}
diff --git a/src/jalview/datamodel/ASequence.java b/src/jalview/datamodel/ASequence.java
new file mode 100644
index 0000000..3913afc
--- /dev/null
+++ b/src/jalview/datamodel/ASequence.java
@@ -0,0 +1,33 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+/**
+ * Metadata for a sequence that may or may not be physically present in Jalview
+ * at the moment
+ *
+ * @author jprocter
+ *
+ */
+public class ASequence implements ASequenceI
+{
+
+}
diff --git a/src/jalview/datamodel/ASequenceI.java b/src/jalview/datamodel/ASequenceI.java
new file mode 100644
index 0000000..005f3c7
--- /dev/null
+++ b/src/jalview/datamodel/ASequenceI.java
@@ -0,0 +1,32 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+/**
+ * interfaces to access the basic metadata for a concrete or virtual sequence
+ *
+ * @author jprocter
+ *
+ */
+public interface ASequenceI
+{
+
+}
diff --git a/src/jalview/datamodel/AlignedCodon.java b/src/jalview/datamodel/AlignedCodon.java
new file mode 100644
index 0000000..a9ca1e3
--- /dev/null
+++ b/src/jalview/datamodel/AlignedCodon.java
@@ -0,0 +1,108 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+/**
+ * Holds the aligned column positions (base 0) for one codon in a nucleotide
+ * sequence, and (optionally) its peptide translation. The object is immutable
+ * once created.
+ *
+ * Example: in "G-AT-C-GA" the aligned codons are (0, 2, 3) and (5, 7, 8).
+ *
+ * JBPComment: Is this useful anywhere other than jalview.analysis.Dna ?
+ *
+ * @author gmcarstairs
+ *
+ */
+public final class AlignedCodon
+{
+ public final int pos1;
+
+ public final int pos2;
+
+ public final int pos3;
+
+ public final String product;
+
+ public AlignedCodon(int i, int j, int k)
+ {
+ this(i, j, k, null);
+ }
+
+ public AlignedCodon(int i, int j, int k, String prod)
+ {
+ pos1 = i;
+ pos2 = j;
+ pos3 = k;
+ product = prod;
+ }
+
+ /**
+ * Returns the column position for the given base (1, 2, 3).
+ *
+ * @param base
+ * @return
+ * @throws IllegalArgumentException
+ * if an argument value other than 1, 2 or 3 is supplied
+ */
+ public int getBaseColumn(int base)
+ {
+ if (base < 1 || base > 3)
+ {
+ throw new IllegalArgumentException(Integer.toString(base));
+ }
+ return base == 1 ? pos1 : (base == 2 ? pos2 : pos3);
+ }
+
+ /**
+ * Two aligned codons are equal if all their base positions are the same. We
+ * don't care about the protein product. This test is required for correct
+ * alignment of translated gapped dna alignments (the same codon positions in
+ * different sequences occupy the same column in the translated alignment).
+ */
+ @Override
+ public boolean equals(Object o)
+ {
+ /*
+ * Equality with null value required for consistency with
+ * Dna.compareCodonPos
+ */
+ if (o == null)
+ {
+ return true;
+ }
+ if (!(o instanceof AlignedCodon))
+ {
+ return false;
+ }
+ AlignedCodon ac = (AlignedCodon) o;
+ return (pos1 == ac.pos1 && pos2 == ac.pos2 && pos3 == ac.pos3);
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("[").append(pos1).append(", ").append(pos2).append(", ")
+ .append(pos3).append("]");
+ return sb.toString();
+ }
+}
diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java
index 9c2bd83..8a9cd52 100644
--- a/src/jalview/datamodel/AlignedCodonFrame.java
+++ b/src/jalview/datamodel/AlignedCodonFrame.java
@@ -1,318 +1,462 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import jalview.util.MapList;
-
-/**
- * Stores mapping between the columns of a protein alignment and a DNA alignment
- * and a list of individual codon to amino acid mappings between sequences.
- */
-
-public class AlignedCodonFrame
-{
- /**
- * array of nucleotide positions for aligned codons at column of aligned
- * proteins.
- */
- public int[][] codons = null;
-
- /**
- * width of protein sequence alignement implicit assertion that codons.length
- * >= aaWidth
- */
- public int aaWidth = 0;
-
- /**
- * initialise codon frame with a nominal alignment width
- *
- * @param aWidth
- */
- public AlignedCodonFrame(int aWidth)
- {
- if (aWidth <= 0)
- {
- codons = null;
- return;
- }
- codons = new int[aWidth][];
- for (int res = 0; res < aWidth; res++)
- codons[res] = null;
- }
-
- /**
- * ensure that codons array is at least as wide as aslen residues
- *
- * @param aslen
- * @return (possibly newly expanded) codon array
- */
- public int[][] checkCodonFrameWidth(int aslen)
- {
- if (codons.length <= aslen + 1)
- {
- // probably never have to do this ?
- int[][] c = new int[codons.length + 10][];
- for (int i = 0; i < codons.length; i++)
- {
- c[i] = codons[i];
- codons[i] = null;
- }
- codons = c;
- }
- return codons;
- }
-
- /**
- * @return width of aligned translated amino acid residues
- */
- public int getaaWidth()
- {
- return aaWidth;
- }
-
- /**
- * TODO: not an ideal solution - we reference the aligned amino acid sequences
- * in order to make insertions on them Better would be dnaAlignment and
- * aaAlignment reference....
- */
- Vector a_aaSeqs = new Vector();
-
- /**
- * increase aaWidth by one and insert a new aligned codon position space at
- * aspos.
- *
- * @param aspos
- */
- public void insertAAGap(int aspos, char gapCharacter)
- {
- // this aa appears before the aligned codons at aspos - so shift them in
- // each pair of mapped sequences
- aaWidth++;
- if (a_aaSeqs != null)
- {
- // we actually have to modify the aligned sequences here, so use the
- // a_aaSeqs vector
- Enumeration sq = a_aaSeqs.elements();
- while (sq.hasMoreElements())
- {
- ((SequenceI) sq.nextElement()).insertCharAt(aspos, gapCharacter);
- }
- }
- checkCodonFrameWidth(aspos);
- if (aspos < aaWidth)
- {
- aaWidth++;
- System.arraycopy(codons, aspos, codons, aspos + 1, aaWidth - aspos);
- codons[aspos] = null; // clear so new codon position can be marked.
- }
- }
-
- public void setAaWidth(int aapos)
- {
- aaWidth = aapos;
- }
-
- /**
- * tied array of na Sequence objects.
- */
- SequenceI[] dnaSeqs = null;
-
- /**
- * tied array of Mappings to protein sequence Objects and SequenceI[]
- * aaSeqs=null; MapLists where eac maps from the corresponding dnaSeqs element
- * to corresponding aaSeqs element
- */
- Mapping[] dnaToProt = null;
-
- /**
- * add a mapping between the dataset sequences for the associated dna and
- * protein sequence objects
- *
- * @param dnaseq
- * @param aaseq
- * @param map
- */
- public void addMap(SequenceI dnaseq, SequenceI aaseq, MapList map)
- {
- int nlen = 1;
- if (dnaSeqs != null)
- {
- nlen = dnaSeqs.length + 1;
- }
- SequenceI[] ndna = new SequenceI[nlen];
- Mapping[] ndtp = new Mapping[nlen];
- if (dnaSeqs != null)
- {
- System.arraycopy(dnaSeqs, 0, ndna, 0, dnaSeqs.length);
- System.arraycopy(dnaToProt, 0, ndtp, 0, dnaSeqs.length);
- }
- dnaSeqs = ndna;
- dnaToProt = ndtp;
- nlen--;
- dnaSeqs[nlen] = (dnaseq.getDatasetSequence() == null) ? dnaseq : dnaseq
- .getDatasetSequence();
- Mapping mp = new Mapping(map);
- // JBPNote DEBUG! THIS !
- // dnaseq.transferAnnotation(aaseq, mp);
- // aaseq.transferAnnotation(dnaseq, new Mapping(map.getInverse()));
- mp.to = (aaseq.getDatasetSequence() == null) ? aaseq : aaseq
- .getDatasetSequence();
- a_aaSeqs.addElement(aaseq);
- dnaToProt[nlen] = mp;
- }
-
- public SequenceI[] getdnaSeqs()
- {
- return dnaSeqs;
- }
-
- public SequenceI[] getAaSeqs()
- {
- if (dnaToProt == null)
- return null;
- SequenceI[] sqs = new SequenceI[dnaToProt.length];
- for (int sz = 0; sz < dnaToProt.length; sz++)
- {
- sqs[sz] = dnaToProt[sz].to;
- }
- return sqs;
- }
-
- public MapList[] getdnaToProt()
- {
- if (dnaToProt == null)
- return null;
- MapList[] sqs = new MapList[dnaToProt.length];
- for (int sz = 0; sz < dnaToProt.length; sz++)
- {
- sqs[sz] = dnaToProt[sz].map;
- }
- return sqs;
- }
-
- public Mapping[] getProtMappings()
- {
- return dnaToProt;
- }
-
- /**
- *
- * @param sequenceRef
- * @return null or corresponding aaSeq entry for dnaSeq entry
- */
- public SequenceI getAaForDnaSeq(SequenceI dnaSeqRef)
- {
- if (dnaSeqs == null)
- {
- return null;
- }
- SequenceI dnads = dnaSeqRef.getDatasetSequence();
- for (int ds = 0; ds < dnaSeqs.length; ds++)
- {
- if (dnaSeqs[ds] == dnaSeqRef || dnaSeqs[ds] == dnads)
- return dnaToProt[ds].to;
- }
- return null;
- }
-
- /**
- *
- * @param sequenceRef
- * @return null or corresponding aaSeq entry for dnaSeq entry
- */
- public SequenceI getDnaForAaSeq(SequenceI aaSeqRef)
- {
- if (dnaToProt == null)
- {
- return null;
- }
- SequenceI aads = aaSeqRef.getDatasetSequence();
- for (int as = 0; as < dnaToProt.length; as++)
- {
- if (dnaToProt[as].to == aaSeqRef || dnaToProt[as].to == aads)
- return dnaSeqs[as];
- }
- return null;
- }
-
- /**
- * test to see if codon frame involves seq in any way
- *
- * @param seq
- * a nucleotide or protein sequence
- * @return true if a mapping exists to or from this sequence to any translated
- * sequence
- */
- public boolean involvesSequence(SequenceI seq)
- {
- return getAaForDnaSeq(seq) != null || getDnaForAaSeq(seq) != null;
- }
-
- /**
- * Add search results for regions in other sequences that translate or are
- * translated from a particular position in seq
- *
- * @param seq
- * @param index
- * position in seq
- * @param results
- * where highlighted regions go
- */
- public void markMappedRegion(SequenceI seq, int index,
- SearchResults results)
- {
- if (dnaToProt == null)
- {
- return;
- }
- int[] codon;
- SequenceI ds = seq.getDatasetSequence();
- for (int mi = 0; mi < dnaToProt.length; mi++)
- {
- if (dnaSeqs[mi] == seq || dnaSeqs[mi] == ds)
- {
- // DEBUG System.err.println("dna pos "+index);
- codon = dnaToProt[mi].map.locateInTo(index, index);
- if (codon != null)
- {
- for (int i = 0; i < codon.length; i += 2)
- {
- results.addResult(dnaToProt[mi].to, codon[i], codon[i + 1]);
- }
- }
- }
- else if (dnaToProt[mi].to == seq || dnaToProt[mi].to == ds)
- {
- // DEBUG System.err.println("aa pos "+index);
- {
- codon = dnaToProt[mi].map.locateInFrom(index, index);
- if (codon != null)
- {
- for (int i = 0; i < codon.length; i += 2)
- {
- results.addResult(dnaSeqs[mi], codon[i], codon[i + 1]);
- }
- }
- }
- }
- }
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import jalview.util.MapList;
+import jalview.util.MappingUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Stores mapping between the columns of a protein alignment and a DNA alignment
+ * and a list of individual codon to amino acid mappings between sequences.
+ */
+public class AlignedCodonFrame
+{
+
+ /**
+ * tied array of na Sequence objects.
+ */
+ private SequenceI[] dnaSeqs = null;
+
+ /**
+ * tied array of Mappings to protein sequence Objects and SequenceI[]
+ * aaSeqs=null; MapLists where each maps from the corresponding dnaSeqs
+ * element to corresponding aaSeqs element
+ */
+ private Mapping[] dnaToProt = null;
+
+ /**
+ * Constructor
+ */
+ public AlignedCodonFrame()
+ {
+ }
+
+ /**
+ * Adds a mapping between the dataset sequences for the associated dna and
+ * protein sequence objects
+ *
+ * @param dnaseq
+ * @param aaseq
+ * @param map
+ */
+ public void addMap(SequenceI dnaseq, SequenceI aaseq, MapList map)
+ {
+ int nlen = 1;
+ if (dnaSeqs != null)
+ {
+ nlen = dnaSeqs.length + 1;
+ }
+ SequenceI[] ndna = new SequenceI[nlen];
+ Mapping[] ndtp = new Mapping[nlen];
+ if (dnaSeqs != null)
+ {
+ System.arraycopy(dnaSeqs, 0, ndna, 0, dnaSeqs.length);
+ System.arraycopy(dnaToProt, 0, ndtp, 0, dnaSeqs.length);
+ }
+ dnaSeqs = ndna;
+ dnaToProt = ndtp;
+ nlen--;
+ dnaSeqs[nlen] = (dnaseq.getDatasetSequence() == null) ? dnaseq : dnaseq
+ .getDatasetSequence();
+ Mapping mp = new Mapping(map);
+ // JBPNote DEBUG! THIS !
+ // dnaseq.transferAnnotation(aaseq, mp);
+ // aaseq.transferAnnotation(dnaseq, new Mapping(map.getInverse()));
+ mp.to = (aaseq.getDatasetSequence() == null) ? aaseq : aaseq
+ .getDatasetSequence();
+ dnaToProt[nlen] = mp;
+ }
+
+ public SequenceI[] getdnaSeqs()
+ {
+ return dnaSeqs;
+ }
+
+ public SequenceI[] getAaSeqs()
+ {
+ if (dnaToProt == null)
+ {
+ return null;
+ }
+ SequenceI[] sqs = new SequenceI[dnaToProt.length];
+ for (int sz = 0; sz < dnaToProt.length; sz++)
+ {
+ sqs[sz] = dnaToProt[sz].to;
+ }
+ return sqs;
+ }
+
+ public MapList[] getdnaToProt()
+ {
+ if (dnaToProt == null)
+ {
+ return null;
+ }
+ MapList[] sqs = new MapList[dnaToProt.length];
+ for (int sz = 0; sz < dnaToProt.length; sz++)
+ {
+ sqs[sz] = dnaToProt[sz].map;
+ }
+ return sqs;
+ }
+
+ public Mapping[] getProtMappings()
+ {
+ return dnaToProt;
+ }
+
+ /**
+ * Returns the first mapping found which is to or from the given sequence, or
+ * null.
+ *
+ * @param seq
+ * @return
+ */
+ public Mapping getMappingForSequence(SequenceI seq)
+ {
+ if (dnaSeqs == null)
+ {
+ return null;
+ }
+ SequenceI seqDs = seq.getDatasetSequence();
+ seqDs = seqDs != null ? seqDs : seq;
+
+ for (int ds = 0; ds < dnaSeqs.length; ds++)
+ {
+ if (dnaSeqs[ds] == seqDs || dnaToProt[ds].to == seqDs)
+ {
+ return dnaToProt[ds];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the corresponding aligned or dataset aa sequence for given dna
+ * sequence, null if not found.
+ *
+ * @param sequenceRef
+ * @return
+ */
+ public SequenceI getAaForDnaSeq(SequenceI dnaSeqRef)
+ {
+ if (dnaSeqs == null)
+ {
+ return null;
+ }
+ SequenceI dnads = dnaSeqRef.getDatasetSequence();
+ for (int ds = 0; ds < dnaSeqs.length; ds++)
+ {
+ if (dnaSeqs[ds] == dnaSeqRef || dnaSeqs[ds] == dnads)
+ {
+ return dnaToProt[ds].to;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param sequenceRef
+ * @return null or corresponding aaSeq entry for dnaSeq entry
+ */
+ public SequenceI getDnaForAaSeq(SequenceI aaSeqRef)
+ {
+ if (dnaToProt == null)
+ {
+ return null;
+ }
+ SequenceI aads = aaSeqRef.getDatasetSequence();
+ for (int as = 0; as < dnaToProt.length; as++)
+ {
+ if (dnaToProt[as].to == aaSeqRef || dnaToProt[as].to == aads)
+ {
+ return dnaSeqs[as];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * test to see if codon frame involves seq in any way
+ *
+ * @param seq
+ * a nucleotide or protein sequence
+ * @return true if a mapping exists to or from this sequence to any translated
+ * sequence
+ */
+ public boolean involvesSequence(SequenceI seq)
+ {
+ return getAaForDnaSeq(seq) != null || getDnaForAaSeq(seq) != null;
+ }
+
+ /**
+ * Add search results for regions in other sequences that translate or are
+ * translated from a particular position in seq
+ *
+ * @param seq
+ * @param index
+ * position in seq
+ * @param results
+ * where highlighted regions go
+ */
+ public void markMappedRegion(SequenceI seq, int index,
+ SearchResults results)
+ {
+ if (dnaToProt == null)
+ {
+ return;
+ }
+ int[] codon;
+ SequenceI ds = seq.getDatasetSequence();
+ for (int mi = 0; mi < dnaToProt.length; mi++)
+ {
+ if (dnaSeqs[mi] == seq || dnaSeqs[mi] == ds)
+ {
+ // DEBUG System.err.println("dna pos "+index);
+ codon = dnaToProt[mi].map.locateInTo(index, index);
+ if (codon != null)
+ {
+ for (int i = 0; i < codon.length; i += 2)
+ {
+ results.addResult(dnaToProt[mi].to, codon[i], codon[i + 1]);
+ }
+ }
+ }
+ else if (dnaToProt[mi].to == seq || dnaToProt[mi].to == ds)
+ {
+ // DEBUG System.err.println("aa pos "+index);
+ {
+ codon = dnaToProt[mi].map.locateInFrom(index, index);
+ if (codon != null)
+ {
+ for (int i = 0; i < codon.length; i += 2)
+ {
+ results.addResult(dnaSeqs[mi], codon[i], codon[i + 1]);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the DNA codon positions (base 1) for the given position (base 1) in
+ * a mapped protein sequence, or null if no mapping is found.
+ *
+ * Intended for use in aligning cDNA to match aligned protein. Only the first
+ * mapping found is returned, so not suitable for use if multiple protein
+ * sequences are mapped to the same cDNA (but aligning cDNA as protein is
+ * ill-defined for this case anyway).
+ *
+ * @param seq
+ * the DNA dataset sequence
+ * @param aaPos
+ * residue position (base 1) in a protein sequence
+ * @return
+ */
+ public int[] getDnaPosition(SequenceI seq, int aaPos)
+ {
+ /*
+ * Adapted from markMappedRegion().
+ */
+ MapList ml = null;
+ for (int i = 0; i < dnaToProt.length; i++)
+ {
+ if (dnaSeqs[i] == seq)
+ {
+ ml = getdnaToProt()[i];
+ break;
+ }
+ }
+ return ml == null ? null : ml.locateInFrom(aaPos, aaPos);
+ }
+
+ /**
+ * Convenience method to return the first aligned sequence in the given
+ * alignment whose dataset has a mapping with the given dataset sequence.
+ *
+ * @param seq
+ *
+ * @param al
+ * @return
+ */
+ public SequenceI findAlignedSequence(SequenceI seq, AlignmentI al)
+ {
+ /*
+ * Search mapped protein ('to') sequences first.
+ */
+ if (this.dnaToProt != null)
+ {
+ for (int i = 0; i < dnaToProt.length; i++)
+ {
+ if (this.dnaSeqs[i] == seq)
+ {
+ for (SequenceI sourceAligned : al.getSequences())
+ {
+ if (this.dnaToProt[i].to == sourceAligned.getDatasetSequence())
+ {
+ return sourceAligned;
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Then try mapped dna sequences.
+ */
+ if (this.dnaToProt != null)
+ {
+ for (int i = 0; i < dnaToProt.length; i++)
+ {
+ if (this.dnaToProt[i].to == seq)
+ {
+ for (SequenceI sourceAligned : al.getSequences())
+ {
+ if (this.dnaSeqs[i] == sourceAligned.getDatasetSequence())
+ {
+ return sourceAligned;
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the region in the 'mappedFrom' sequence's dataset that is mapped to
+ * position 'pos' (base 1) in the 'mappedTo' sequence's dataset. The region is
+ * a set of start/end position pairs.
+ *
+ * @param mappedFrom
+ * @param mappedTo
+ * @param pos
+ * @return
+ */
+ public int[] getMappedRegion(SequenceI mappedFrom, SequenceI mappedTo,
+ int pos)
+ {
+ SequenceI targetDs = mappedFrom.getDatasetSequence() == null ? mappedFrom
+ : mappedFrom.getDatasetSequence();
+ SequenceI sourceDs = mappedTo.getDatasetSequence() == null ? mappedTo
+ : mappedTo.getDatasetSequence();
+ if (targetDs == null || sourceDs == null || dnaToProt == null)
+ {
+ return null;
+ }
+ for (int mi = 0; mi < dnaToProt.length; mi++)
+ {
+ if (dnaSeqs[mi] == targetDs && dnaToProt[mi].to == sourceDs)
+ {
+ int[] codon = dnaToProt[mi].map.locateInFrom(pos, pos);
+ if (codon != null)
+ {
+ return codon;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the DNA codon for the given position (base 1) in a mapped protein
+ * sequence, or null if no mapping is found.
+ *
+ * @param protein
+ * the peptide dataset sequence
+ * @param aaPos
+ * residue position (base 1) in the peptide sequence
+ * @return
+ */
+ public char[] getMappedCodon(SequenceI protein, int aaPos)
+ {
+ if (dnaToProt == null)
+ {
+ return null;
+ }
+ MapList ml = null;
+ char[] dnaSeq = null;
+ for (int i = 0; i < dnaToProt.length; i++)
+ {
+ if (dnaToProt[i].to == protein)
+ {
+ ml = getdnaToProt()[i];
+ dnaSeq = dnaSeqs[i].getSequence();
+ break;
+ }
+ }
+ if (ml == null)
+ {
+ return null;
+ }
+ int[] codonPos = ml.locateInFrom(aaPos, aaPos);
+ if (codonPos == null)
+ {
+ return null;
+ }
+
+ /*
+ * Read off the mapped nucleotides (converting to position base 0)
+ */
+ codonPos = MappingUtils.flattenRanges(codonPos);
+ return new char[] { dnaSeq[codonPos[0] - 1], dnaSeq[codonPos[1] - 1],
+ dnaSeq[codonPos[2] - 1] };
+ }
+
+ /**
+ * Returns any mappings found which are to (or from) the given sequence, and
+ * to distinct sequences.
+ *
+ * @param seq
+ * @return
+ */
+ public List<Mapping> getMappingsForSequence(SequenceI seq)
+ {
+ List<Mapping> result = new ArrayList<Mapping>();
+ if (dnaSeqs == null)
+ {
+ return result;
+ }
+ List<SequenceI> related = new ArrayList<SequenceI>();
+ SequenceI seqDs = seq.getDatasetSequence();
+ seqDs = seqDs != null ? seqDs : seq;
+
+ for (int ds = 0; ds < dnaSeqs.length; ds++)
+ {
+ final Mapping mapping = dnaToProt[ds];
+ if (dnaSeqs[ds] == seqDs || mapping.to == seqDs)
+ {
+ if (!related.contains(mapping.to))
+ {
+ result.add(mapping);
+ related.add(mapping.to);
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java
index 707eee8..75b18d9 100644
--- a/src/jalview/datamodel/Alignment.java
+++ b/src/jalview/datamodel/Alignment.java
@@ -1,25 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import jalview.analysis.AlignmentUtils;
+import jalview.io.FastaFile;
+import jalview.util.MessageManager;
-import jalview.analysis.*;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
/**
* Data structure to hold and manipulate a multiple sequence alignment
@@ -32,9 +45,10 @@ public class Alignment implements AlignmentI
{
protected Alignment dataset;
- protected Vector sequences;
+ protected List<SequenceI> sequences;
- protected Vector groups = new Vector();
+ protected List<SequenceGroup> groups = java.util.Collections
+ .synchronizedList(new ArrayList<SequenceGroup>());
protected char gapCharacter = '-';
@@ -44,6 +58,8 @@ public class Alignment implements AlignmentI
public static final int NUCLEOTIDE = 1;
+ public boolean hasRNAStructure = false;
+
/** DOCUMENT ME!! */
public AlignmentAnnotation[] annotations;
@@ -51,6 +67,8 @@ public class Alignment implements AlignmentI
public Hashtable alignmentProperties;
+ private Set<AlignedCodonFrame> codonFrameList = new LinkedHashSet<AlignedCodonFrame>();
+
private void initAlignment(SequenceI[] seqs)
{
int i = 0;
@@ -64,13 +82,35 @@ public class Alignment implements AlignmentI
type = PROTEIN;
}
- sequences = new Vector();
+ sequences = java.util.Collections
+ .synchronizedList(new ArrayList<SequenceI>());
for (i = 0; i < seqs.length; i++)
{
- sequences.addElement(seqs[i]);
+ sequences.add(seqs[i]);
+ }
+
+ }
+
+ /**
+ * Make a 'copy' alignment - sequences have new copies of features and
+ * annotations, but share the original dataset sequences.
+ */
+ public Alignment(AlignmentI al)
+ {
+ SequenceI[] seqs = al.getSequencesArray();
+ for (int i = 0; i < seqs.length; i++)
+ {
+ seqs[i] = new Sequence(seqs[i]);
}
+ /*
+ * Share the same dataset sequence mappings (if any). TODO: find a better
+ * place for these to live (alignment dataset?).
+ */
+ this.codonFrameList = ((Alignment) al).codonFrameList;
+
+ initAlignment(seqs);
}
/**
@@ -107,30 +147,49 @@ public class Alignment implements AlignmentI
*/
public static AlignmentI createAlignment(CigarArray compactAlignment)
{
- throw new Error("Alignment(CigarArray) not yet implemented");
+ throw new Error(
+ MessageManager
+ .getString("error.alignment_cigararray_not_implemented"));
// this(compactAlignment.refCigars);
}
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public Vector getSequences()
+ @Override
+ public List<SequenceI> getSequences()
{
return sequences;
}
+ @Override
+ public List<SequenceI> getSequences(
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
+ {
+ // TODO: in jalview 2.8 we don't do anything with hiddenreps - fix design to
+ // work on this.
+ return sequences;
+ }
+
+ @Override
public SequenceI[] getSequencesArray()
{
if (sequences == null)
+ {
return null;
- SequenceI[] reply = new SequenceI[sequences.size()];
- for (int i = 0; i < sequences.size(); i++)
+ }
+ synchronized (sequences)
{
- reply[i] = (SequenceI) sequences.elementAt(i);
+ return sequences.toArray(new SequenceI[sequences.size()]);
}
- return reply;
+ }
+
+ /**
+ * Returns a map of lists of sequences keyed by sequence name.
+ *
+ * @return
+ */
+ @Override
+ public Map<String, List<SequenceI>> getSequencesByName()
+ {
+ return AlignmentUtils.getSequencesByName(this);
}
/**
@@ -141,13 +200,16 @@ public class Alignment implements AlignmentI
*
* @return DOCUMENT ME!
*/
+ @Override
public SequenceI getSequenceAt(int i)
{
- if (i>-1 && i < sequences.size())
+ synchronized (sequences)
{
- return (SequenceI) sequences.elementAt(i);
+ if (i > -1 && i < sequences.size())
+ {
+ return sequences.get(i);
+ }
}
-
return null;
}
@@ -156,6 +218,7 @@ public class Alignment implements AlignmentI
*
* @param snew
*/
+ @Override
public void addSequence(SequenceI snew)
{
if (dataset != null)
@@ -175,15 +238,19 @@ public class Alignment implements AlignmentI
}
if (sequences == null)
{
- initAlignment(new SequenceI[]
- { snew });
+ initAlignment(new SequenceI[] { snew });
}
else
{
- sequences.addElement(snew);
+ synchronized (sequences)
+ {
+ sequences.add(snew);
+ }
}
if (hiddenSequences != null)
+ {
hiddenSequences.adjustHeightSequenceAdded();
+ }
}
/**
@@ -191,12 +258,14 @@ public class Alignment implements AlignmentI
*
* @param snew
*/
+ @Override
public void setSequenceAt(int i, SequenceI snew)
{
- SequenceI oldseq = getSequenceAt(i);
- deleteSequence(oldseq);
-
- sequences.setElementAt(snew, i);
+ synchronized (sequences)
+ {
+ deleteSequence(i);
+ sequences.set(i, snew);
+ }
}
/**
@@ -204,15 +273,19 @@ public class Alignment implements AlignmentI
*
* @return DOCUMENT ME!
*/
- public Vector getGroups()
+ @Override
+ public List<SequenceGroup> getGroups()
{
return groups;
}
+ @Override
public void finalize()
{
if (getDataset() != null)
+ {
getDataset().removeAlignmentRef();
+ }
dataset = null;
sequences = null;
@@ -239,6 +312,7 @@ public class Alignment implements AlignmentI
* @param s
* DOCUMENT ME!
*/
+ @Override
public void deleteSequence(SequenceI s)
{
deleteSequence(findIndex(s));
@@ -250,95 +324,105 @@ public class Alignment implements AlignmentI
* @param i
* DOCUMENT ME!
*/
+ @Override
public void deleteSequence(int i)
{
if (i > -1 && i < getHeight())
{
- sequences.removeElementAt(i);
- hiddenSequences.adjustHeightSequenceDeleted(i);
+ synchronized (sequences)
+ {
+ sequences.remove(i);
+ hiddenSequences.adjustHeightSequenceDeleted(i);
+ }
}
}
- /** */
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.datamodel.AlignmentI#findGroup(jalview.datamodel.SequenceI)
+ */
+ @Override
public SequenceGroup findGroup(SequenceI s)
{
- for (int i = 0; i < this.groups.size(); i++)
+ synchronized (groups)
{
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
-
- if (sg.getSequences(null).contains(s))
+ for (int i = 0; i < this.groups.size(); i++)
{
- return sg;
+ SequenceGroup sg = groups.get(i);
+
+ if (sg.getSequences(null).contains(s))
+ {
+ return sg;
+ }
}
}
-
return null;
}
- /**
- * DOCUMENT ME!
- *
- * @param s
- * DOCUMENT ME!
+ /*
+ * (non-Javadoc)
*
- * @return DOCUMENT ME!
+ * @see
+ * jalview.datamodel.AlignmentI#findAllGroups(jalview.datamodel.SequenceI)
*/
+ @Override
public SequenceGroup[] findAllGroups(SequenceI s)
{
- Vector temp = new Vector();
+ ArrayList<SequenceGroup> temp = new ArrayList<SequenceGroup>();
- int gSize = groups.size();
- for (int i = 0; i < gSize; i++)
+ synchronized (groups)
{
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
- if (sg == null || sg.getSequences(null) == null)
+ int gSize = groups.size();
+ for (int i = 0; i < gSize; i++)
{
- this.deleteGroup(sg);
- gSize--;
- continue;
- }
+ SequenceGroup sg = groups.get(i);
+ if (sg == null || sg.getSequences() == null)
+ {
+ this.deleteGroup(sg);
+ gSize--;
+ continue;
+ }
- if (sg.getSequences(null).contains(s))
- {
- temp.addElement(sg);
+ if (sg.getSequences().contains(s))
+ {
+ temp.add(sg);
+ }
}
}
-
SequenceGroup[] ret = new SequenceGroup[temp.size()];
-
- for (int i = 0; i < temp.size(); i++)
- {
- ret[i] = (SequenceGroup) temp.elementAt(i);
- }
-
- return ret;
+ return temp.toArray(ret);
}
/** */
+ @Override
public void addGroup(SequenceGroup sg)
{
- if (!groups.contains(sg))
+ synchronized (groups)
{
- if (hiddenSequences.getSize() > 0)
+ if (!groups.contains(sg))
{
- int i, iSize = sg.getSize();
- for (i = 0; i < iSize; i++)
+ if (hiddenSequences.getSize() > 0)
{
- if (!sequences.contains(sg.getSequenceAt(i)))
+ int i, iSize = sg.getSize();
+ for (i = 0; i < iSize; i++)
{
- sg.deleteSequence(sg.getSequenceAt(i), false);
- iSize--;
- i--;
+ if (!sequences.contains(sg.getSequenceAt(i)))
+ {
+ sg.deleteSequence(sg.getSequenceAt(i), false);
+ iSize--;
+ i--;
+ }
}
- }
- if (sg.getSize() < 1)
- {
- return;
+ if (sg.getSize() < 1)
+ {
+ return;
+ }
}
+ sg.setContext(this);
+ groups.add(sg);
}
-
- groups.addElement(sg);
}
}
@@ -402,26 +486,40 @@ public class Alignment implements AlignmentI
}
}
+ @Override
public void deleteAllGroups()
{
- if (annotations != null)
+ synchronized (groups)
{
- removeAnnotationForGroup(null);
+ if (annotations != null)
+ {
+ removeAnnotationForGroup(null);
+ }
+ for (SequenceGroup sg : groups)
+ {
+ sg.setContext(null);
+ }
+ groups.clear();
}
- groups.removeAllElements();
}
/** */
+ @Override
public void deleteGroup(SequenceGroup g)
{
- if (groups.contains(g))
+ synchronized (groups)
{
- removeAnnotationForGroup(g);
- groups.removeElement(g);
+ if (groups.contains(g))
+ {
+ removeAnnotationForGroup(g);
+ groups.remove(g);
+ g.setContext(null);
+ }
}
}
/** */
+ @Override
public SequenceI findName(String name)
{
return findName(name, false);
@@ -432,6 +530,7 @@ public class Alignment implements AlignmentI
*
* @see jalview.datamodel.AlignmentI#findName(java.lang.String, boolean)
*/
+ @Override
public SequenceI findName(String token, boolean b)
{
return findName(null, token, b);
@@ -443,6 +542,7 @@ public class Alignment implements AlignmentI
* @see jalview.datamodel.AlignmentI#findName(SequenceI, java.lang.String,
* boolean)
*/
+ @Override
public SequenceI findName(SequenceI startAfter, String token, boolean b)
{
@@ -483,6 +583,7 @@ public class Alignment implements AlignmentI
return null;
}
+ @Override
public SequenceI[] findSequenceMatch(String name)
{
Vector matches = new Vector();
@@ -512,6 +613,7 @@ public class Alignment implements AlignmentI
*
* @see jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SequenceI)
*/
+ @Override
public int findIndex(SequenceI s)
{
int i = 0;
@@ -535,6 +637,7 @@ public class Alignment implements AlignmentI
* @see
* jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
*/
+ @Override
public int findIndex(SearchResults results)
{
int i = 0;
@@ -555,6 +658,7 @@ public class Alignment implements AlignmentI
*
* @return DOCUMENT ME!
*/
+ @Override
public int getHeight()
{
return sequences.size();
@@ -565,6 +669,7 @@ public class Alignment implements AlignmentI
*
* @return DOCUMENT ME!
*/
+ @Override
public int getWidth()
{
int maxLength = -1;
@@ -586,15 +691,17 @@ public class Alignment implements AlignmentI
* @param gc
* DOCUMENT ME!
*/
+ @Override
public void setGapCharacter(char gc)
{
gapCharacter = gc;
-
- for (int i = 0; i < sequences.size(); i++)
+ synchronized (sequences)
{
- Sequence seq = (Sequence) sequences.elementAt(i);
- seq.setSequence(seq.getSequenceAsString().replace('.', gc)
- .replace('-', gc).replace(' ', gc));
+ for (SequenceI seq : sequences)
+ {
+ seq.setSequence(seq.getSequenceAsString().replace('.', gc)
+ .replace('-', gc).replace(' ', gc));
+ }
}
}
@@ -603,6 +710,7 @@ public class Alignment implements AlignmentI
*
* @return DOCUMENT ME!
*/
+ @Override
public char getGapCharacter()
{
return gapCharacter;
@@ -613,6 +721,7 @@ public class Alignment implements AlignmentI
*
* @see jalview.datamodel.AlignmentI#isAligned()
*/
+ @Override
public boolean isAligned()
{
return isAligned(false);
@@ -623,6 +732,7 @@ public class Alignment implements AlignmentI
*
* @see jalview.datamodel.AlignmentI#isAligned(boolean)
*/
+ @Override
public boolean isAligned(boolean includeHidden)
{
int width = getWidth();
@@ -644,17 +754,41 @@ public class Alignment implements AlignmentI
return true;
}
+ /**
+ * Delete all annotations, including auto-calculated if the flag is set true.
+ * Returns true if at least one annotation was deleted, else false.
+ *
+ * @param includingAutoCalculated
+ * @return
+ */
+ @Override
+ public boolean deleteAllAnnotations(boolean includingAutoCalculated)
+ {
+ boolean result = false;
+ for (AlignmentAnnotation alan : getAlignmentAnnotation())
+ {
+ if (!alan.autoCalculated || includingAutoCalculated)
+ {
+ deleteAnnotation(alan);
+ result = true;
+ }
+ }
+ return result;
+ }
+
/*
* (non-Javadoc)
*
* @seejalview.datamodel.AlignmentI#deleteAnnotation(jalview.datamodel.
* AlignmentAnnotation)
*/
+ @Override
public boolean deleteAnnotation(AlignmentAnnotation aa)
{
return deleteAnnotation(aa, true);
}
-
+
+ @Override
public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook)
{
int aSize = 1;
@@ -682,13 +816,16 @@ public class Alignment implements AlignmentI
continue;
}
if (tIndex < temp.length)
+ {
temp[tIndex++] = annotations[i];
+ }
}
if (swap)
{
annotations = temp;
- if (unhook) {
+ if (unhook)
+ {
unhookAnnotation(aa);
}
}
@@ -719,6 +856,7 @@ public class Alignment implements AlignmentI
* @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
* AlignmentAnnotation)
*/
+ @Override
public void addAnnotation(AlignmentAnnotation aa)
{
addAnnotation(aa, -1);
@@ -730,8 +868,14 @@ public class Alignment implements AlignmentI
* @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
* AlignmentAnnotation, int)
*/
+ @Override
public void addAnnotation(AlignmentAnnotation aa, int pos)
{
+ if (aa.getRNAStruc() != null)
+ {
+ hasRNAStructure = true;
+ }
+
int aSize = 1;
if (annotations != null)
{
@@ -767,6 +911,7 @@ public class Alignment implements AlignmentI
annotations = temp;
}
+ @Override
public void setAnnotationIndex(AlignmentAnnotation aa, int index)
{
if (aa == null || annotations == null || annotations.length - 1 < index)
@@ -799,16 +944,16 @@ public class Alignment implements AlignmentI
annotations = temp;
}
+ @Override
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * returns all annotation on the alignment
*/
public AlignmentAnnotation[] getAlignmentAnnotation()
{
return annotations;
}
+ @Override
public void setNucleotide(boolean b)
{
if (b)
@@ -821,6 +966,7 @@ public class Alignment implements AlignmentI
}
}
+ @Override
public boolean isNucleotide()
{
if (type == NUCLEOTIDE)
@@ -833,6 +979,14 @@ public class Alignment implements AlignmentI
}
}
+ @Override
+ public boolean hasRNAStructure()
+ {
+ // TODO can it happen that structure is removed from alignment?
+ return hasRNAStructure;
+ }
+
+ @Override
public void setDataset(Alignment data)
{
if (dataset == null && data == null)
@@ -847,7 +1001,7 @@ public class Alignment implements AlignmentI
currentSeq = getSequenceAt(i);
if (currentSeq.getDatasetSequence() != null)
{
- seqs[i] = (Sequence) currentSeq.getDatasetSequence();
+ seqs[i] = currentSeq.getDatasetSequence();
}
else
{
@@ -860,6 +1014,27 @@ public class Alignment implements AlignmentI
else if (dataset == null && data != null)
{
dataset = data;
+ for (int i = 0; i < getHeight(); i++)
+ {
+ SequenceI currentSeq = getSequenceAt(i);
+ SequenceI dsq = currentSeq.getDatasetSequence();
+ if (dsq == null)
+ {
+ dsq = currentSeq.createDatasetSequence();
+ dataset.addSequence(dsq);
+ }
+ else
+ {
+ while (dsq.getDatasetSequence() != null)
+ {
+ dsq = dsq.getDatasetSequence();
+ }
+ if (dataset.findIndex(dsq) == -1)
+ {
+ dataset.addSequence(dsq);
+ }
+ }
+ }
}
dataset.addAlignmentRef();
}
@@ -877,11 +1052,13 @@ public class Alignment implements AlignmentI
alignmentRefs++;
}
+ @Override
public Alignment getDataset()
{
return dataset;
}
+ @Override
public boolean padGaps()
{
boolean modified = false;
@@ -933,6 +1110,7 @@ public class Alignment implements AlignmentI
* true if alignment padded to right, false to justify to left
* @return true if alignment was changed
*/
+ @Override
public boolean justify(boolean right)
{
boolean modified = false;
@@ -1030,46 +1208,59 @@ public class Alignment implements AlignmentI
return modified;
}
+ @Override
public HiddenSequences getHiddenSequences()
{
return hiddenSequences;
}
+ @Override
public CigarArray getCompactAlignment()
{
- SeqCigar alseqs[] = new SeqCigar[sequences.size()];
- for (int i = 0; i < sequences.size(); i++)
+ synchronized (sequences)
{
- alseqs[i] = new SeqCigar((SequenceI) sequences.elementAt(i));
+ SeqCigar alseqs[] = new SeqCigar[sequences.size()];
+ int i = 0;
+ for (SequenceI seq : sequences)
+ {
+ alseqs[i++] = new SeqCigar(seq);
+ }
+ CigarArray cal = new CigarArray(alseqs);
+ cal.addOperation(CigarArray.M, getWidth());
+ return cal;
}
- CigarArray cal = new CigarArray(alseqs);
- cal.addOperation(CigarArray.M, getWidth());
- return cal;
}
+ @Override
public void setProperty(Object key, Object value)
{
if (alignmentProperties == null)
+ {
alignmentProperties = new Hashtable();
+ }
alignmentProperties.put(key, value);
}
+ @Override
public Object getProperty(Object key)
{
if (alignmentProperties != null)
+ {
return alignmentProperties.get(key);
+ }
else
+ {
return null;
+ }
}
+ @Override
public Hashtable getProperties()
{
return alignmentProperties;
}
- AlignedCodonFrame[] codonFrameList = null;
-
/*
* (non-Javadoc)
*
@@ -1077,30 +1268,13 @@ public class Alignment implements AlignmentI
* jalview.datamodel.AlignmentI#addCodonFrame(jalview.datamodel.AlignedCodonFrame
* )
*/
+ @Override
public void addCodonFrame(AlignedCodonFrame codons)
{
- if (codons == null)
- return;
- if (codonFrameList == null)
+ if (codons != null)
{
- codonFrameList = new AlignedCodonFrame[]
- { codons };
- return;
+ codonFrameList.add(codons);
}
- AlignedCodonFrame[] t = new AlignedCodonFrame[codonFrameList.length + 1];
- System.arraycopy(codonFrameList, 0, t, 0, codonFrameList.length);
- t[codonFrameList.length] = codons;
- codonFrameList = t;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.datamodel.AlignmentI#getCodonFrame(int)
- */
- public AlignedCodonFrame getCodonFrame(int index)
- {
- return codonFrameList[index];
}
/*
@@ -1109,29 +1283,43 @@ public class Alignment implements AlignmentI
* @see
* jalview.datamodel.AlignmentI#getCodonFrame(jalview.datamodel.SequenceI)
*/
- public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
+ @Override
+ public List<AlignedCodonFrame> getCodonFrame(SequenceI seq)
{
- if (seq == null || codonFrameList == null)
+ if (seq == null)
+ {
return null;
- Vector cframes = new Vector();
- for (int f = 0; f < codonFrameList.length; f++)
+ }
+ List<AlignedCodonFrame> cframes = new ArrayList<AlignedCodonFrame>();
+ for (AlignedCodonFrame acf : codonFrameList)
{
- if (codonFrameList[f].involvesSequence(seq))
- cframes.addElement(codonFrameList[f]);
+ if (acf.involvesSequence(seq))
+ {
+ cframes.add(acf);
+ }
}
- if (cframes.size() == 0)
- return null;
- AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()];
- cframes.copyInto(cfr);
- return cfr;
+ return cframes;
}
- /*
- * (non-Javadoc)
+ /**
+ * Sets the codon frame mappings (replacing any existing mappings).
+ *
+ * @see jalview.datamodel.AlignmentI#setCodonFrames()
+ */
+ @Override
+ public void setCodonFrames(Set<AlignedCodonFrame> acfs)
+ {
+ this.codonFrameList = acfs;
+ }
+
+ /**
+ * Returns the set of codon frame mappings. Any changes to the returned set
+ * will affect the alignment.
*
* @see jalview.datamodel.AlignmentI#getCodonFrames()
*/
- public AlignedCodonFrame[] getCodonFrames()
+ @Override
+ public Set<AlignedCodonFrame> getCodonFrames()
{
return codonFrameList;
}
@@ -1142,34 +1330,23 @@ public class Alignment implements AlignmentI
* @seejalview.datamodel.AlignmentI#removeCodonFrame(jalview.datamodel.
* AlignedCodonFrame)
*/
+ @Override
public boolean removeCodonFrame(AlignedCodonFrame codons)
{
if (codons == null || codonFrameList == null)
- return false;
- boolean removed = false;
- int i = 0, iSize = codonFrameList.length;
- while (i < iSize)
{
- if (codonFrameList[i] == codons)
- {
- removed = true;
- if (i + 1 < iSize)
- {
- System.arraycopy(codonFrameList, i + 1, codonFrameList, i, iSize
- - i - 1);
- }
- iSize--;
- }
- else
- {
- i++;
- }
+ return false;
}
- return removed;
+ return codonFrameList.remove(codons);
}
+ @Override
public void append(AlignmentI toappend)
{
+ if (toappend == this)
+ {
+ System.err.println("Self append may cause a deadlock.");
+ }
// TODO test this method for a future 2.5 release
// currently tested for use in jalview.gui.SequenceFetcher
boolean samegap = toappend.getGapCharacter() == getGapCharacter();
@@ -1177,26 +1354,27 @@ public class Alignment implements AlignmentI
boolean hashidden = toappend.getHiddenSequences() != null
&& toappend.getHiddenSequences().hiddenSequences != null;
// get all sequences including any hidden ones
- Vector sqs = (hashidden) ? toappend.getHiddenSequences()
+ List<SequenceI> sqs = (hashidden) ? toappend.getHiddenSequences()
.getFullAlignment().getSequences() : toappend.getSequences();
if (sqs != null)
{
- Enumeration sq = sqs.elements();
- while (sq.hasMoreElements())
+ synchronized (sqs)
{
- SequenceI addedsq = (SequenceI) sq.nextElement();
- if (!samegap)
+ for (SequenceI addedsq : sqs)
{
- char[] oldseq = addedsq.getSequence();
- for (int c = 0; c < oldseq.length; c++)
+ if (!samegap)
{
- if (oldseq[c] == oldc)
+ char[] oldseq = addedsq.getSequence();
+ for (int c = 0; c < oldseq.length; c++)
{
- oldseq[c] = gapCharacter;
+ if (oldseq[c] == oldc)
+ {
+ oldseq[c] = gapCharacter;
+ }
}
}
+ addSequence(addedsq);
}
- addSequence(addedsq);
}
}
AlignmentAnnotation[] alan = toappend.getAlignmentAnnotation();
@@ -1204,18 +1382,15 @@ public class Alignment implements AlignmentI
{
addAnnotation(alan[a]);
}
- AlignedCodonFrame[] acod = toappend.getCodonFrames();
- for (int a = 0; acod != null && a < acod.length; a++)
- {
- this.addCodonFrame(acod[a]);
- }
- Vector sg = toappend.getGroups();
+
+ this.codonFrameList.addAll(toappend.getCodonFrames());
+
+ List<SequenceGroup> sg = toappend.getGroups();
if (sg != null)
{
- Enumeration el = sg.elements();
- while (el.hasMoreElements())
+ for (SequenceGroup _sg : sg)
{
- addGroup((SequenceGroup) el.nextElement());
+ addGroup(_sg);
}
}
if (toappend.getHiddenSequences() != null)
@@ -1282,4 +1457,295 @@ public class Alignment implements AlignmentI
}
}
+ @Override
+ public AlignmentAnnotation findOrCreateAnnotation(String name,
+ String calcId, boolean autoCalc, SequenceI seqRef,
+ SequenceGroup groupRef)
+ {
+ assert (name != null);
+ if (annotations != null)
+ {
+ for (AlignmentAnnotation annot : getAlignmentAnnotation())
+ {
+ if (annot.autoCalculated == autoCalc && (name.equals(annot.label))
+ && (calcId == null || annot.getCalcId().equals(calcId))
+ && annot.sequenceRef == seqRef
+ && annot.groupRef == groupRef)
+ {
+ return annot;
+ }
+ }
+ }
+ AlignmentAnnotation annot = new AlignmentAnnotation(name, name,
+ new Annotation[1], 0f, 0f, AlignmentAnnotation.BAR_GRAPH);
+ annot.hasText = false;
+ annot.setCalcId(new String(calcId));
+ annot.autoCalculated = autoCalc;
+ if (seqRef != null)
+ {
+ annot.setSequenceRef(seqRef);
+ }
+ annot.groupRef = groupRef;
+ addAnnotation(annot);
+
+ return annot;
+ }
+
+ @Override
+ public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
+ {
+ ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation a : getAlignmentAnnotation())
+ {
+ if (a.getCalcId() == calcId
+ || (a.getCalcId() != null && calcId != null && a.getCalcId()
+ .equals(calcId)))
+ {
+ aa.add(a);
+ }
+ }
+ return aa;
+ }
+
+ /**
+ * Returns an iterable collection of any annotations that match on given
+ * sequence ref, calcId and label (ignoring null values).
+ */
+ @Override
+ public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
+ String calcId, String label)
+ {
+ ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation ann : getAlignmentAnnotation())
+ {
+ if (ann.getCalcId() != null && ann.getCalcId().equals(calcId)
+ && ann.sequenceRef != null && ann.sequenceRef == seq
+ && ann.label != null && ann.label.equals(label))
+ {
+ aa.add(ann);
+ }
+ }
+ return aa;
+ }
+
+ @Override
+ public void moveSelectedSequencesByOne(SequenceGroup sg,
+ Map<SequenceI, SequenceCollectionI> map, boolean up)
+ {
+ synchronized (sequences)
+ {
+ if (up)
+ {
+
+ for (int i = 1, iSize = sequences.size(); i < iSize; i++)
+ {
+ SequenceI seq = sequences.get(i);
+ if (!sg.getSequences(map).contains(seq))
+ {
+ continue;
+ }
+
+ SequenceI temp = sequences.get(i - 1);
+ if (sg.getSequences(null).contains(temp))
+ {
+ continue;
+ }
+
+ sequences.set(i, temp);
+ sequences.set(i - 1, seq);
+ }
+ }
+ else
+ {
+ for (int i = sequences.size() - 2; i > -1; i--)
+ {
+ SequenceI seq = sequences.get(i);
+ if (!sg.getSequences(map).contains(seq))
+ {
+ continue;
+ }
+
+ SequenceI temp = sequences.get(i + 1);
+ if (sg.getSequences(map).contains(temp))
+ {
+ continue;
+ }
+
+ sequences.set(i, temp);
+ sequences.set(i + 1, seq);
+ }
+ }
+
+ }
+ }
+
+ @Override
+ public void validateAnnotation(AlignmentAnnotation alignmentAnnotation)
+ {
+ alignmentAnnotation.validateRangeAndDisplay();
+ if (isNucleotide() && alignmentAnnotation.isValidStruc())
+ {
+ hasRNAStructure = true;
+ }
+ }
+
+ private SequenceI seqrep = null;
+
+ /**
+ *
+ * @return the representative sequence for this group
+ */
+ public SequenceI getSeqrep()
+ {
+ return seqrep;
+ }
+
+ /**
+ * set the representative sequence for this group. Note - this affects the
+ * interpretation of the Hidereps attribute.
+ *
+ * @param seqrep
+ * the seqrep to set (null means no sequence representative)
+ */
+ public void setSeqrep(SequenceI seqrep)
+ {
+ this.seqrep = seqrep;
+ }
+
+ /**
+ *
+ * @return true if group has a sequence representative
+ */
+ public boolean hasSeqrep()
+ {
+ return seqrep != null;
+ }
+
+ @Override
+ public int getEndRes()
+ {
+ return getWidth() - 1;
+ }
+
+ @Override
+ public int getStartRes()
+ {
+ return 0;
+ }
+
+ /*
+ * In the case of AlignmentI - returns the dataset for the alignment, if set
+ * (non-Javadoc)
+ *
+ * @see jalview.datamodel.AnnotatedCollectionI#getContext()
+ */
+ @Override
+ public AnnotatedCollectionI getContext()
+ {
+ return dataset;
+ }
+
+ /**
+ * Align this alignment like the given (mapped) one.
+ */
+ @Override
+ public int alignAs(AlignmentI al)
+ {
+ /*
+ * Currently retains unmapped gaps (in introns), regaps mapped regions
+ * (exons)
+ */
+ return alignAs(al, false, true);
+ }
+
+ /**
+ * Align this alignment 'the same as' the given one. Mapped sequences only are
+ * realigned. If both of the same type (nucleotide/protein) then align both
+ * identically. If this is nucleotide and the other is protein, make 3 gaps
+ * for each gap in the protein sequences. If this is protein and the other is
+ * nucleotide, insert a gap for each 3 gaps (or part thereof) between
+ * nucleotide bases. If this is protein and the other is nucleotide, gaps
+ * protein to match the relative ordering of codons in the nucleotide.
+ *
+ * Parameters control whether gaps in exon (mapped) and intron (unmapped)
+ * regions are preserved. Gaps that connect introns to exons are treated
+ * conservatively, i.e. only preserved if both intron and exon gaps are
+ * preserved.
+ *
+ * @param al
+ * @param preserveMappedGaps
+ * if true, gaps within and between mapped codons are preserved
+ * @param preserveUnmappedGaps
+ * if true, gaps within and between unmapped codons are preserved
+ */
+ // @Override
+ public int alignAs(AlignmentI al, boolean preserveMappedGaps,
+ boolean preserveUnmappedGaps)
+ {
+ // TODO should this method signature be the one in the interface?
+ int count = 0;
+ boolean thisIsNucleotide = this.isNucleotide();
+ boolean thatIsProtein = !al.isNucleotide();
+ if (!thatIsProtein && !thisIsNucleotide)
+ {
+ return AlignmentUtils.alignProteinAsDna(this, al);
+ }
+
+ char thisGapChar = this.getGapCharacter();
+ String gap = thisIsNucleotide && thatIsProtein ? String
+ .valueOf(new char[] { thisGapChar, thisGapChar, thisGapChar })
+ : String.valueOf(thisGapChar);
+
+ // TODO handle intron regions? Needs a 'holistic' alignment of dna,
+ // not just sequence by sequence. But how to 'gap' intron regions?
+
+ /*
+ * Get mappings from 'that' alignment's sequences to this.
+ */
+ for (SequenceI alignTo : getSequences())
+ {
+ count += AlignmentUtils.alignSequenceAs(alignTo, al, gap,
+ preserveMappedGaps, preserveUnmappedGaps) ? 1 : 0;
+ }
+ return count;
+ }
+
+ /**
+ * Returns the alignment in Fasta format. Behaviour of this method is not
+ * guaranteed between versions.
+ */
+ @Override
+ public String toString()
+ {
+ return new FastaFile().print(getSequencesArray());
+ }
+
+ /**
+ * Returns the set of distinct sequence names. No ordering is guaranteed.
+ */
+ @Override
+ public Set<String> getSequenceNames()
+ {
+ Set<String> names = new HashSet<String>();
+ for (SequenceI seq : getSequences())
+ {
+ names.add(seq.getName());
+ }
+ return names;
+ }
+
+ @Override
+ public boolean hasValidSequence()
+ {
+ boolean hasValidSeq = false;
+ for (SequenceI seq : getSequences())
+ {
+ if ((seq.getEnd() - seq.getStart()) > 0)
+ {
+ hasValidSeq = true;
+ break;
+ }
+ }
+ return hasValidSeq;
+ }
}
diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java
index 1d624d4..ab11089 100644
--- a/src/jalview/datamodel/AlignmentAnnotation.java
+++ b/src/jalview/datamodel/AlignmentAnnotation.java
@@ -1,24 +1,36 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.Enumeration;
-import java.util.Hashtable;
+import jalview.analysis.Rna;
+import jalview.analysis.SecStrConsensus.SimpleBP;
+import jalview.analysis.WUSSParseException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
/**
* DOCUMENT ME!
@@ -28,26 +40,135 @@ import java.util.Hashtable;
*/
public class AlignmentAnnotation
{
+ private static final String ANNOTATION_ID_PREFIX = "ann";
+
+ /*
+ * Identifers for different types of profile data
+ */
+ public static final int SEQUENCE_PROFILE = 0;
+
+ public static final int STRUCTURE_PROFILE = 1;
+
+ public static final int CDNA_PROFILE = 2;
+
+ private static long counter = 0;
+
/**
* If true, this annotations is calculated every edit, eg consensus, quality
* or conservation graphs
*/
public boolean autoCalculated = false;
+ /**
+ * unique ID for this annotation, used to match up the same annotation row
+ * shown in multiple views and alignments
+ */
public String annotationId;
+ /**
+ * the sequence this annotation is associated with (or null)
+ */
public SequenceI sequenceRef;
- /** DOCUMENT ME!! */
+ /** label shown in dropdown menus and in the annotation label area */
public String label;
- /** DOCUMENT ME!! */
+ /** longer description text shown as a tooltip */
public String description;
- /** DOCUMENT ME!! */
+ /** Array of annotations placed in the current coordinate system */
public Annotation[] annotations;
- public java.util.Hashtable sequenceMapping;
+ public ArrayList<SimpleBP> bps = null;
+
+ /**
+ * RNA secondary structure contact positions
+ */
+ public SequenceFeature[] _rnasecstr = null;
+
+ /**
+ * position of annotation resulting in invalid WUSS parsing or -1. -2 means
+ * there was no RNA structure in this annotation
+ */
+ private long invalidrnastruc = -2;
+
+ /**
+ * Updates the _rnasecstr field Determines the positions that base pair and
+ * the positions of helices based on secondary structure from a Stockholm file
+ *
+ * @param RNAannot
+ */
+ private void _updateRnaSecStr(CharSequence RNAannot)
+ {
+ try
+ {
+ _rnasecstr = Rna.GetBasePairs(RNAannot);
+ bps = Rna.GetModeleBP(RNAannot);
+ invalidrnastruc = -1;
+ } catch (WUSSParseException px)
+ {
+ // DEBUG System.out.println(px);
+ invalidrnastruc = px.getProblemPos();
+ }
+ if (invalidrnastruc > -1)
+ {
+ return;
+ }
+ Rna.HelixMap(_rnasecstr);
+ // setRNAStruc(RNAannot);
+
+ if (_rnasecstr != null && _rnasecstr.length > 0)
+ {
+ // show all the RNA secondary structure annotation symbols.
+ isrna = true;
+ showAllColLabels = true;
+ scaleColLabel = true;
+ _markRnaHelices();
+ }
+ // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup());
+
+ }
+
+ private void _markRnaHelices()
+ {
+ int mxval = 0;
+ // Figure out number of helices
+ // Length of rnasecstr is the number of pairs of positions that base pair
+ // with each other in the secondary structure
+ for (int x = 0; x < _rnasecstr.length; x++)
+ {
+
+ /*
+ * System.out.println(this.annotation._rnasecstr[x] + " Begin" +
+ * this.annotation._rnasecstr[x].getBegin());
+ */
+ // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
+ int val = 0;
+ try
+ {
+ val = Integer.valueOf(_rnasecstr[x].getFeatureGroup());
+ if (mxval < val)
+ {
+ mxval = val;
+ }
+ } catch (NumberFormatException q)
+ {
+ }
+ ;
+
+ annotations[_rnasecstr[x].getBegin()].value = val;
+ annotations[_rnasecstr[x].getEnd()].value = val;
+
+ // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
+ // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
+ }
+ setScore(mxval);
+ }
+
+ /**
+ * map of positions in the associated annotation
+ */
+ private Map<Integer, Annotation> sequenceMapping;
/** DOCUMENT ME!! */
public float graphMin;
@@ -117,6 +238,8 @@ public class AlignmentAnnotation
*/
public boolean centreColLabels = false;
+ private boolean isrna;
+
/*
* (non-Javadoc)
*
@@ -145,6 +268,12 @@ public class AlignmentAnnotation
}
}
+ // JBPNote: what does this do ?
+ public void ConcenStru(CharSequence RNAannot) throws WUSSParseException
+ {
+ bps = Rna.GetModeleBP(RNAannot);
+ }
+
/**
* Creates a new AlignmentAnnotation object.
*
@@ -158,6 +287,7 @@ public class AlignmentAnnotation
public AlignmentAnnotation(String label, String description,
Annotation[] annotations)
{
+ setAnnotationId();
// always editable?
editable = true;
this.label = label;
@@ -167,9 +297,16 @@ public class AlignmentAnnotation
validateRangeAndDisplay();
}
+ /**
+ * Checks if annotation labels represent secondary structures
+ *
+ */
void areLabelsSecondaryStructure()
{
boolean nonSSLabel = false;
+ isrna = false;
+ StringBuffer rnastring = new StringBuffer();
+
char firstChar = 0;
for (int i = 0; i < annotations.length; i++)
{
@@ -182,9 +319,54 @@ public class AlignmentAnnotation
{
hasIcons |= true;
}
+ else
+ // Check for RNA secondary structure
+ {
+ // System.out.println(annotations[i].secondaryStructure);
+ // TODO: 2.8.2 should this ss symbol validation check be a function in
+ // RNA/ResidueProperties ?
+ if (annotations[i].secondaryStructure == '('
+ || annotations[i].secondaryStructure == '['
+ || annotations[i].secondaryStructure == '<'
+ || annotations[i].secondaryStructure == '{'
+ || annotations[i].secondaryStructure == 'A'
+ || annotations[i].secondaryStructure == 'B'
+ || annotations[i].secondaryStructure == 'C'
+ || annotations[i].secondaryStructure == 'D'
+ || annotations[i].secondaryStructure == 'E'
+ || annotations[i].secondaryStructure == 'F'
+ || annotations[i].secondaryStructure == 'G'
+ || annotations[i].secondaryStructure == 'H'
+ || annotations[i].secondaryStructure == 'I'
+ || annotations[i].secondaryStructure == 'J'
+ || annotations[i].secondaryStructure == 'K'
+ || annotations[i].secondaryStructure == 'L'
+ || annotations[i].secondaryStructure == 'M'
+ || annotations[i].secondaryStructure == 'N'
+ || annotations[i].secondaryStructure == 'O'
+ || annotations[i].secondaryStructure == 'P'
+ || annotations[i].secondaryStructure == 'Q'
+ || annotations[i].secondaryStructure == 'R'
+ || annotations[i].secondaryStructure == 'S'
+ || annotations[i].secondaryStructure == 'T'
+ || annotations[i].secondaryStructure == 'U'
+ || annotations[i].secondaryStructure == 'V'
+ || annotations[i].secondaryStructure == 'W'
+ || annotations[i].secondaryStructure == 'X'
+ || annotations[i].secondaryStructure == 'Y'
+ || annotations[i].secondaryStructure == 'Z')
+ {
+ hasIcons |= true;
+ isrna |= true;
+ }
+ }
- if (annotations[i].displayCharacter == null)
+ // System.out.println("displaychar " + annotations[i].displayCharacter);
+
+ if (annotations[i].displayCharacter == null
+ || annotations[i].displayCharacter.length() == 0)
{
+ rnastring.append('.');
continue;
}
if (annotations[i].displayCharacter.length() == 1)
@@ -203,8 +385,38 @@ public class AlignmentAnnotation
// &&
// annotations[i].displayCharacter.charAt(0)==annotations[i].secondaryStructure
firstChar != ' '
- && firstChar != 'H'
+ && firstChar != '$'
+ && firstChar != 0xCE
+ && firstChar != '('
+ && firstChar != '['
+ && firstChar != '>'
+ && firstChar != '{'
+ && firstChar != 'A'
+ && firstChar != 'B'
+ && firstChar != 'C'
+ && firstChar != 'D'
&& firstChar != 'E'
+ && firstChar != 'F'
+ && firstChar != 'G'
+ && firstChar != 'H'
+ && firstChar != 'I'
+ && firstChar != 'J'
+ && firstChar != 'K'
+ && firstChar != 'L'
+ && firstChar != 'M'
+ && firstChar != 'N'
+ && firstChar != 'O'
+ && firstChar != 'P'
+ && firstChar != 'Q'
+ && firstChar != 'R'
+ && firstChar != 'S'
+ && firstChar != 'T'
+ && firstChar != 'U'
+ && firstChar != 'V'
+ && firstChar != 'W'
+ && firstChar != 'X'
+ && firstChar != 'Y'
+ && firstChar != 'Z'
&& firstChar != '-'
&& firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
{
@@ -219,6 +431,10 @@ public class AlignmentAnnotation
}
}
}
+ else
+ {
+ rnastring.append(annotations[i].displayCharacter.charAt(1));
+ }
if (annotations[i].displayCharacter.length() > 0)
{
@@ -241,8 +457,97 @@ public class AlignmentAnnotation
}
}
+ else
+ {
+ if (isrna)
+ {
+ _updateRnaSecStr(new AnnotCharSequence());
+ }
+ }
+ }
+
+ /**
+ * flyweight access to positions in the alignment annotation row for RNA
+ * processing
+ *
+ * @author jimp
+ *
+ */
+ private class AnnotCharSequence implements CharSequence
+ {
+ int offset = 0;
+
+ int max = 0;
+
+ public AnnotCharSequence()
+ {
+ this(0, annotations.length);
+ }
+
+ public AnnotCharSequence(int start, int end)
+ {
+ offset = start;
+ max = end;
+ }
+
+ @Override
+ public CharSequence subSequence(int start, int end)
+ {
+ return new AnnotCharSequence(offset + start, offset + end);
+ }
+
+ @Override
+ public int length()
+ {
+ return max - offset;
+ }
+
+ @Override
+ public char charAt(int index)
+ {
+ return ((index + offset < 0) || (index + offset) >= max
+ || annotations[index + offset] == null
+ || (annotations[index + offset].secondaryStructure <= ' ') ? ' '
+ : annotations[index + offset].displayCharacter == null
+ || annotations[index + offset].displayCharacter
+ .length() == 0 ? annotations[index + offset].secondaryStructure
+ : annotations[index + offset].displayCharacter
+ .charAt(0));
+ }
- annotationId = this.hashCode() + "";
+ @Override
+ public String toString()
+ {
+ char[] string = new char[max - offset];
+ int mx = annotations.length;
+
+ for (int i = offset; i < mx; i++)
+ {
+ string[i] = (annotations[i] == null || (annotations[i].secondaryStructure <= 32)) ? ' '
+ : (annotations[i].displayCharacter == null
+ || annotations[i].displayCharacter.length() == 0 ? annotations[i].secondaryStructure
+ : annotations[i].displayCharacter.charAt(0));
+ }
+ return new String(string);
+ }
+ };
+
+ private long _lastrnaannot = -1;
+
+ public String getRNAStruc()
+ {
+ if (isrna)
+ {
+ String rnastruc = new AnnotCharSequence().toString();
+ if (_lastrnaannot != rnastruc.hashCode())
+ {
+ // ensure rna structure contacts are up to date
+ _lastrnaannot = rnastruc.hashCode();
+ _updateRnaSecStr(rnastruc);
+ }
+ return rnastruc;
+ }
+ return null;
}
/**
@@ -264,6 +569,7 @@ public class AlignmentAnnotation
public AlignmentAnnotation(String label, String description,
Annotation[] annotations, float min, float max, int graphType)
{
+ setAnnotationId();
// graphs are not editable
editable = graphType == 0;
@@ -280,7 +586,7 @@ public class AlignmentAnnotation
* checks graphMin and graphMax, secondary structure symbols, sets graphType
* appropriately, sets null labels to the empty string if appropriate.
*/
- private void validateRangeAndDisplay()
+ public void validateRangeAndDisplay()
{
if (annotations == null)
@@ -293,7 +599,7 @@ public class AlignmentAnnotation
float min = graphMin;
float max = graphMax;
boolean drawValues = true;
-
+ _linecolour = null;
if (min == max)
{
min = 999999999;
@@ -319,6 +625,10 @@ public class AlignmentAnnotation
{
min = annotations[i].value;
}
+ if (_linecolour == null && annotations[i].colour != null)
+ {
+ _linecolour = annotations[i].colour;
+ }
}
// ensure zero is origin for min/max ranges on only one side of zero
if (min > 0)
@@ -359,9 +669,12 @@ public class AlignmentAnnotation
*/
public AlignmentAnnotation(AlignmentAnnotation annotation)
{
+ setAnnotationId();
this.label = new String(annotation.label);
if (annotation.description != null)
+ {
this.description = new String(annotation.description);
+ }
this.graphMin = annotation.graphMin;
this.graphMax = annotation.graphMax;
this.graph = annotation.graph;
@@ -376,6 +689,18 @@ public class AlignmentAnnotation
this.label = annotation.label;
this.padGaps = annotation.padGaps;
this.visible = annotation.visible;
+ this.centreColLabels = annotation.centreColLabels;
+ this.scaleColLabel = annotation.scaleColLabel;
+ this.showAllColLabels = annotation.showAllColLabels;
+ this.calcId = annotation.calcId;
+ if (annotation.properties != null)
+ {
+ properties = new HashMap<String, String>();
+ for (Map.Entry<String, String> val : annotation.properties.entrySet())
+ {
+ properties.put(val.getKey(), val.getValue());
+ }
+ }
if (this.hasScore = annotation.hasScore)
{
this.score = annotation.score;
@@ -384,32 +709,42 @@ public class AlignmentAnnotation
{
threshold = new GraphLine(annotation.threshold);
}
+ Annotation[] ann = annotation.annotations;
if (annotation.annotations != null)
{
- Annotation[] ann = annotation.annotations;
this.annotations = new Annotation[ann.length];
for (int i = 0; i < ann.length; i++)
{
- annotations[i] = new Annotation(ann[i]);
+ if (ann[i] != null)
+ {
+ annotations[i] = new Annotation(ann[i]);
+ if (_linecolour != null)
+ {
+ _linecolour = annotations[i].colour;
+ }
+ }
}
- ;
- if (annotation.sequenceRef != null)
+ }
+ if (annotation.sequenceRef != null)
+ {
+ this.sequenceRef = annotation.sequenceRef;
+ if (annotation.sequenceMapping != null)
{
- this.sequenceRef = annotation.sequenceRef;
- if (annotation.sequenceMapping != null)
+ Integer p = null;
+ sequenceMapping = new HashMap<Integer, Annotation>();
+ Iterator<Integer> pos = annotation.sequenceMapping.keySet()
+ .iterator();
+ while (pos.hasNext())
{
- Integer p = null;
- sequenceMapping = new Hashtable();
- Enumeration pos = annotation.sequenceMapping.keys();
- while (pos.hasMoreElements())
+ // could optimise this!
+ p = pos.next();
+ Annotation a = annotation.sequenceMapping.get(p);
+ if (a == null)
+ {
+ continue;
+ }
+ if (ann != null)
{
- // could optimise this!
- p = (Integer) pos.nextElement();
- Annotation a = (Annotation) annotation.sequenceMapping.get(p);
- if (a == null)
- {
- continue;
- }
for (int i = 0; i < ann.length; i++)
{
if (ann[i] == a)
@@ -419,12 +754,17 @@ public class AlignmentAnnotation
}
}
}
- else
- {
- this.sequenceMapping = null;
- }
+ }
+ else
+ {
+ this.sequenceMapping = null;
}
}
+ // TODO: check if we need to do this: JAL-952
+ // if (this.isrna=annotation.isrna)
+ {
+ // _rnasecstr=new SequenceFeature[annotation._rnasecstr];
+ }
validateRangeAndDisplay(); // construct hashcodes, etc.
}
@@ -443,13 +783,21 @@ public class AlignmentAnnotation
return;
}
if (startRes < 0)
+ {
startRes = 0;
+ }
if (startRes >= annotations.length)
+ {
startRes = annotations.length - 1;
+ }
if (endRes >= annotations.length)
+ {
endRes = annotations.length - 1;
+ }
if (annotations == null)
+ {
return;
+ }
Annotation[] temp = new Annotation[endRes - startRes + 1];
if (startRes < annotations.length)
{
@@ -463,11 +811,11 @@ public class AlignmentAnnotation
int epos = sequenceRef.findPosition(endRes);
if (sequenceMapping != null)
{
- Hashtable newmapping = new Hashtable();
- Enumeration e = sequenceMapping.keys();
- while (e.hasMoreElements())
+ Map<Integer, Annotation> newmapping = new HashMap<Integer, Annotation>();
+ Iterator<Integer> e = sequenceMapping.keySet().iterator();
+ while (e.hasNext())
{
- Integer pos = (Integer) e.nextElement();
+ Integer pos = e.next();
if (pos.intValue() >= spos && pos.intValue() <= epos)
{
newmapping.put(pos, sequenceMapping.get(pos));
@@ -510,9 +858,10 @@ public class AlignmentAnnotation
*
* @return DOCUMENT ME!
*/
+ @Override
public String toString()
{
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder(256);
for (int i = 0; i < annotations.length; i++)
{
@@ -585,7 +934,7 @@ public class AlignmentAnnotation
{
return;
}
- sequenceMapping = new java.util.Hashtable();
+ sequenceMapping = new HashMap<Integer, Annotation>();
int seqPos;
@@ -611,7 +960,9 @@ public class AlignmentAnnotation
public void adjustForAlignment()
{
if (sequenceRef == null)
+ {
return;
+ }
if (annotations == null)
{
@@ -637,7 +988,7 @@ public class AlignmentAnnotation
{
position = sequenceRef.findIndex(a) - 1;
- temp[position] = (Annotation) sequenceMapping.get(index);
+ temp[position] = sequenceMapping.get(index);
}
}
@@ -658,8 +1009,10 @@ public class AlignmentAnnotation
if (annotations[i] == null)
{
if (i + 1 < iSize)
+ {
System.arraycopy(annotations, i + 1, annotations, i, iSize - i
- 1);
+ }
iSize--;
}
else
@@ -690,10 +1043,15 @@ public class AlignmentAnnotation
{
if (sequenceRef != null)
{
+ boolean rIsDs = sequenceRef.getDatasetSequence() == null, tIsDs = sequenceI
+ .getDatasetSequence() == null;
if (sequenceRef != sequenceI
- && !sequenceRef.equals(sequenceI)
- && sequenceRef.getDatasetSequence() != sequenceI
+ && (rIsDs && !tIsDs && sequenceRef != sequenceI
+ .getDatasetSequence())
+ && (!rIsDs && tIsDs && sequenceRef.getDatasetSequence() != sequenceI)
+ && (!rIsDs && !tIsDs && sequenceRef.getDatasetSequence() != sequenceI
.getDatasetSequence())
+ && !sequenceRef.equals(sequenceI))
{
// if sequenceRef isn't intersecting with sequenceI
// throw away old mapping and reconstruct.
@@ -793,11 +1151,15 @@ public class AlignmentAnnotation
for (int i = 0; i < annotations.length; i++)
{
if (annotations[i] == null)
+ {
annotations[i] = new Annotation(String.valueOf(gapchar), null,
- ' ', 0f);
+ ' ', 0f, null);
+ }
else if (annotations[i].displayCharacter == null
|| annotations[i].displayCharacter.equals(" "))
+ {
annotations[i].displayCharacter = String.valueOf(gapchar);
+ }
}
}
}
@@ -813,14 +1175,234 @@ public class AlignmentAnnotation
{
if (seqname && this.sequenceRef != null)
{
- int i=description.toLowerCase().indexOf("<html>");
- if (i>-1)
+ int i = description.toLowerCase().indexOf("<html>");
+ if (i > -1)
{
// move the html tag to before the sequence reference.
- return "<html>"+sequenceRef.getName()+" : "+description.substring(i+6);
+ return "<html>" + sequenceRef.getName() + " : "
+ + description.substring(i + 6);
}
return sequenceRef.getName() + " : " + description;
}
return description;
}
+
+ public boolean isValidStruc()
+ {
+ return invalidrnastruc == -1;
+ }
+
+ public long getInvalidStrucPos()
+ {
+ return invalidrnastruc;
+ }
+
+ /**
+ * machine readable ID string indicating what generated this annotation
+ */
+ protected String calcId = "";
+
+ /**
+ * properties associated with the calcId
+ */
+ protected Map<String, String> properties = new HashMap<String, String>();
+
+ /**
+ * base colour for line graphs. If null, will be set automatically by
+ * searching the alignment annotation
+ */
+ public java.awt.Color _linecolour;
+
+ public String getCalcId()
+ {
+ return calcId;
+ }
+
+ public void setCalcId(String calcId)
+ {
+ this.calcId = calcId;
+ }
+
+ public boolean isRNA()
+ {
+ return isrna;
+ }
+
+ /**
+ * transfer annotation to the given sequence using the given mapping from the
+ * current positions or an existing sequence mapping
+ *
+ * @param sq
+ * @param sp2sq
+ * map involving sq as To or From
+ */
+ public void liftOver(SequenceI sq, Mapping sp2sq)
+ {
+ if (sp2sq.getMappedWidth() != sp2sq.getWidth())
+ {
+ // TODO: employ getWord/MappedWord to transfer annotation between cDNA and
+ // Protein reference frames
+ throw new Error(
+ "liftOver currently not implemented for transfer of annotation between different types of seqeunce");
+ }
+ boolean mapIsTo = (sp2sq != null) ? (sp2sq.getTo() == sq || sp2sq
+ .getTo() == sq.getDatasetSequence()) : false;
+
+ // TODO build a better annotation element map and get rid of annotations[]
+ Map<Integer, Annotation> mapForsq = new HashMap<Integer, Annotation>();
+ if (sequenceMapping != null)
+ {
+ if (sp2sq != null)
+ {
+ for (Entry<Integer, Annotation> ie : sequenceMapping.entrySet())
+ {
+ Integer mpos = Integer.valueOf(mapIsTo ? sp2sq
+ .getMappedPosition(ie.getKey()) : sp2sq.getPosition(ie
+ .getKey()));
+ if (mpos >= sq.getStart() && mpos <= sq.getEnd())
+ {
+ mapForsq.put(mpos, ie.getValue());
+ }
+ }
+ sequenceMapping = mapForsq;
+ sequenceRef = sq;
+ adjustForAlignment();
+ }
+ else
+ {
+ // trim positions
+ }
+ }
+ }
+
+ /**
+ * like liftOver but more general.
+ *
+ * Takes an array of int pairs that will be used to update the internal
+ * sequenceMapping and so shuffle the annotated positions
+ *
+ * @param newref
+ * - new sequence reference for the annotation row - if null,
+ * sequenceRef is left unchanged
+ * @param mapping
+ * array of ints containing corresponding positions
+ * @param from
+ * - column for current coordinate system (-1 for index+1)
+ * @param to
+ * - column for destination coordinate system (-1 for index+1)
+ * @param idxoffset
+ * - offset added to index when referencing either coordinate system
+ * @note no checks are made as to whether from and/or to are sensible
+ * @note caller should add the remapped annotation to newref if they have not
+ * already
+ */
+ public void remap(SequenceI newref, int[][] mapping, int from, int to,
+ int idxoffset)
+ {
+ if (mapping != null)
+ {
+ Map<Integer, Annotation> old = sequenceMapping;
+ Map<Integer, Annotation> remap = new HashMap<Integer, Annotation>();
+ int index = -1;
+ for (int mp[] : mapping)
+ {
+ if (index++ < 0)
+ {
+ continue;
+ }
+ Annotation ann = null;
+ if (from == -1)
+ {
+ ann = sequenceMapping.get(Integer.valueOf(idxoffset + index));
+ }
+ else
+ {
+ if (mp != null && mp.length > from)
+ {
+ ann = sequenceMapping.get(Integer.valueOf(mp[from]));
+ }
+ }
+ if (ann != null)
+ {
+ if (to == -1)
+ {
+ remap.put(Integer.valueOf(idxoffset + index), ann);
+ }
+ else
+ {
+ if (to > -1 && to < mp.length)
+ {
+ remap.put(Integer.valueOf(mp[to]), ann);
+ }
+ }
+ }
+ }
+ sequenceMapping = remap;
+ old.clear();
+ if (newref != null)
+ {
+ sequenceRef = newref;
+ }
+ adjustForAlignment();
+ }
+ }
+
+ public String getProperty(String property)
+ {
+ if (properties == null)
+ {
+ return null;
+ }
+ return properties.get(property);
+ }
+
+ public void setProperty(String property, String value)
+ {
+ if (properties == null)
+ {
+ properties = new HashMap<String, String>();
+ }
+ properties.put(property, value);
+ }
+
+ public boolean hasProperties()
+ {
+ return properties != null && properties.size() > 0;
+ }
+
+ public Collection<String> getProperties()
+ {
+ if (properties == null)
+ {
+ return Collections.emptyList();
+ }
+ return properties.keySet();
+ }
+
+ /**
+ * Returns the Annotation for the given sequence position (base 1) if any,
+ * else null
+ *
+ * @param position
+ * @return
+ */
+ public Annotation getAnnotationForPosition(int position)
+ {
+ return sequenceMapping == null ? null : sequenceMapping.get(position);
+
+ }
+
+ /**
+ * Set the id to "ann" followed by a counter that increments so as to be
+ * unique for the lifetime of the JVM
+ */
+ protected final void setAnnotationId()
+ {
+ this.annotationId = ANNOTATION_ID_PREFIX + Long.toString(nextId());
+ }
+
+ protected static synchronized long nextId()
+ {
+ return counter++;
+ }
}
diff --git a/src/jalview/datamodel/AlignmentExportData.java b/src/jalview/datamodel/AlignmentExportData.java
new file mode 100644
index 0000000..3aaae1f
--- /dev/null
+++ b/src/jalview/datamodel/AlignmentExportData.java
@@ -0,0 +1,83 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import jalview.api.AlignExportSettingI;
+
+public class AlignmentExportData
+{
+ private AlignmentI alignment;
+
+ private String[] omitHidden;
+
+ private int[] startEnd;
+
+ private AlignExportSettingI settings;
+
+ public AlignmentExportData(AlignmentI align, String[] ommit,
+ int[] startEnd, AlignExportSettingI settings)
+ {
+ this.alignment = align;
+ this.omitHidden = ommit;
+ this.startEnd = startEnd;
+ this.settings = settings;
+ }
+
+ public AlignmentI getAlignment()
+ {
+ return alignment;
+ }
+
+ public void setAlignment(AlignmentI alignment)
+ {
+ this.alignment = alignment;
+ }
+
+ public String[] getOmitHidden()
+ {
+ return omitHidden;
+ }
+
+ public void setOmitHidden(String[] omitHidden)
+ {
+ this.omitHidden = omitHidden;
+ }
+
+ public int[] getStartEndPostions()
+ {
+ return startEnd;
+ }
+
+ public void setStartEndPostions(int[] startEnd)
+ {
+ this.startEnd = startEnd;
+ }
+
+ public AlignExportSettingI getSettings()
+ {
+ return settings;
+ }
+
+ public void setSettings(AlignExportSettingI settings)
+ {
+ this.settings = settings;
+ }
+}
diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java
index be1bff7..6d257a9 100644
--- a/src/jalview/datamodel/AlignmentI.java
+++ b/src/jalview/datamodel/AlignmentI.java
@@ -1,42 +1,50 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * modify it under the terms of the GNU General License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
+ * PURPOSE. See the GNU General License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Data structure to hold and manipulate a multiple sequence alignment
*/
-public interface AlignmentI
+public interface AlignmentI extends AnnotatedCollectionI
{
/**
* Calculates the number of sequences in an alignment
*
* @return Number of sequences in alignment
*/
- public int getHeight();
+ int getHeight();
/**
+ *
* Calculates the maximum width of the alignment, including gaps.
*
* @return Greatest sequence length within alignment.
*/
- public int getWidth();
+ @Override
+ int getWidth();
/**
* Calculates if this set of sequences (visible and invisible) are all the
@@ -44,7 +52,7 @@ public interface AlignmentI
*
* @return true if all sequences in alignment are the same length
*/
- public boolean isAligned();
+ boolean isAligned();
/**
* Calculates if this set of sequences is all the same length
@@ -53,21 +61,22 @@ public interface AlignmentI
* optionally exclude hidden sequences from test
* @return true if all (or just visible) sequences are the same length
*/
- public boolean isAligned(boolean includeHidden);
+ boolean isAligned(boolean includeHidden);
/**
- * Gets sequences as a Vector
+ * Gets sequences as a Synchronized collection
*
* @return All sequences in alignment.
*/
- public Vector getSequences();
+ @Override
+ List<SequenceI> getSequences();
/**
* Gets sequences as a SequenceI[]
*
* @return All sequences in alignment.
*/
- public SequenceI[] getSequencesArray();
+ SequenceI[] getSequencesArray();
/**
* Find a specific sequence in this alignment.
@@ -77,7 +86,14 @@ public interface AlignmentI
*
* @return SequenceI at given index.
*/
- public SequenceI getSequenceAt(int i);
+ SequenceI getSequenceAt(int i);
+
+ /**
+ * Returns a map of lists of sequences keyed by sequence name.
+ *
+ * @return
+ */
+ Map<String, List<SequenceI>> getSequencesByName();
/**
* Add a new sequence to this alignment.
@@ -85,7 +101,7 @@ public interface AlignmentI
* @param seq
* New sequence will be added at end of alignment.
*/
- public void addSequence(SequenceI seq);
+ void addSequence(SequenceI seq);
/**
* Used to set a particular index of the alignment with the given sequence.
@@ -95,7 +111,7 @@ public interface AlignmentI
* @param seq
* New sequence to be inserted.
*/
- public void setSequenceAt(int i, SequenceI seq);
+ void setSequenceAt(int i, SequenceI seq);
/**
* Deletes a sequence from the alignment
@@ -103,7 +119,7 @@ public interface AlignmentI
* @param s
* Sequence to be deleted.
*/
- public void deleteSequence(SequenceI s);
+ void deleteSequence(SequenceI s);
/**
* Deletes a sequence from the alignment.
@@ -111,7 +127,7 @@ public interface AlignmentI
* @param i
* Index of sequence to be deleted.
*/
- public void deleteSequence(int i);
+ void deleteSequence(int i);
/**
* Finds sequence in alignment using sequence name as query.
@@ -121,9 +137,9 @@ public interface AlignmentI
*
* @return Sequence matching query, if found. If not found returns null.
*/
- public SequenceI findName(String name);
+ SequenceI findName(String name);
- public SequenceI[] findSequenceMatch(String name);
+ SequenceI[] findSequenceMatch(String name);
/**
* Finds index of a given sequence in the alignment.
@@ -133,7 +149,7 @@ public interface AlignmentI
*
* @return Index of sequence within the alignment or -1 if not found
*/
- public int findIndex(SequenceI s);
+ int findIndex(SequenceI s);
/**
* Finds group that given sequence is part of.
@@ -144,7 +160,7 @@ public interface AlignmentI
* @return First group found for sequence. WARNING : Sequences may be members
* of several groups. This method is incomplete.
*/
- public SequenceGroup findGroup(SequenceI s);
+ SequenceGroup findGroup(SequenceI s);
/**
* Finds all groups that a given sequence is part of.
@@ -154,7 +170,7 @@ public interface AlignmentI
*
* @return All groups containing given sequence.
*/
- public SequenceGroup[] findAllGroups(SequenceI s);
+ SequenceGroup[] findAllGroups(SequenceI s);
/**
* Adds a new SequenceGroup to this alignment.
@@ -162,7 +178,7 @@ public interface AlignmentI
* @param sg
* New group to be added.
*/
- public void addGroup(SequenceGroup sg);
+ void addGroup(SequenceGroup sg);
/**
* Deletes a specific SequenceGroup
@@ -170,19 +186,19 @@ public interface AlignmentI
* @param g
* Group will be deleted from alignment.
*/
- public void deleteGroup(SequenceGroup g);
+ void deleteGroup(SequenceGroup g);
/**
* Get all the groups associated with this alignment.
*
- * @return All groups as a Vector.
+ * @return All groups as a list.
*/
- public Vector getGroups();
+ List<SequenceGroup> getGroups();
/**
* Deletes all groups from this alignment.
*/
- public void deleteAllGroups();
+ void deleteAllGroups();
/**
* Adds a new AlignmentAnnotation to this alignment
@@ -190,7 +206,7 @@ public interface AlignmentI
* @note Care should be taken to ensure that annotation is at least as wide as
* the longest sequence in the alignment for rendering purposes.
*/
- public void addAnnotation(AlignmentAnnotation aa);
+ void addAnnotation(AlignmentAnnotation aa);
/**
* moves annotation to a specified index in alignment annotation display stack
@@ -200,33 +216,44 @@ public interface AlignmentI
* @param index
* the destination position
*/
- public void setAnnotationIndex(AlignmentAnnotation aa, int index);
+ void setAnnotationIndex(AlignmentAnnotation aa, int index);
+
+ /**
+ * Delete all annotations, including auto-calculated if the flag is set true.
+ * Returns true if at least one annotation was deleted, else false.
+ *
+ * @param includingAutoCalculated
+ * @return
+ */
+ boolean deleteAllAnnotations(boolean includingAutoCalculated);
/**
* Deletes a specific AlignmentAnnotation from the alignment, and removes its
- * reference from any SequenceI or SequenceGroup object's annotation if and only if aa is
- * contained within the alignment's annotation vector. Otherwise, it will do
- * nothing.
+ * reference from any SequenceI or SequenceGroup object's annotation if and
+ * only if aa is contained within the alignment's annotation vector.
+ * Otherwise, it will do nothing.
*
* @param aa
* the annotation to delete
* @return true if annotation was deleted from this alignment.
*/
- public boolean deleteAnnotation(AlignmentAnnotation aa);
+ boolean deleteAnnotation(AlignmentAnnotation aa);
/**
- * Deletes a specific AlignmentAnnotation from the alignment, and optionally removes any
- * reference from any SequenceI or SequenceGroup object's annotation if and only if aa is
- * contained within the alignment's annotation vector. Otherwise, it will do
- * nothing.
+ * Deletes a specific AlignmentAnnotation from the alignment, and optionally
+ * removes any reference from any SequenceI or SequenceGroup object's
+ * annotation if and only if aa is contained within the alignment's annotation
+ * vector. Otherwise, it will do nothing.
*
* @param aa
* the annotation to delete
* @param unhook
- * flag indicating if any references should be removed from annotation - use this if you intend to add the annotation back into the alignment
+ * flag indicating if any references should be removed from
+ * annotation - use this if you intend to add the annotation back
+ * into the alignment
* @return true if annotation was deleted from this alignment.
*/
- public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook);
+ boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook);
/**
* Get the annotation associated with this alignment (this can be null if no
@@ -234,7 +261,8 @@ public interface AlignmentI
*
* @return array of AlignmentAnnotation objects
*/
- public AlignmentAnnotation[] getAlignmentAnnotation();
+ @Override
+ AlignmentAnnotation[] getAlignmentAnnotation();
/**
* Change the gap character used in this alignment to 'gc'
@@ -242,27 +270,34 @@ public interface AlignmentI
* @param gc
* the new gap character.
*/
- public void setGapCharacter(char gc);
+ void setGapCharacter(char gc);
/**
* Get the gap character used in this alignment
*
* @return gap character
*/
- public char getGapCharacter();
+ char getGapCharacter();
/**
* Test for all nucleotide alignment
*
* @return true if alignment is nucleotide sequence
*/
- public boolean isNucleotide();
+ boolean isNucleotide();
+
+ /**
+ * Test if alignment contains RNA structure
+ *
+ * @return true if RNA structure AligmnentAnnotation was added to alignment
+ */
+ boolean hasRNAStructure();
/**
* Set alignment to be a nucleotide sequence
*
*/
- public void setNucleotide(boolean b);
+ void setNucleotide(boolean b);
/**
* Get the associated dataset for the alignment.
@@ -270,7 +305,7 @@ public interface AlignmentI
* @return Alignment containing dataset sequences or null of this is a
* dataset.
*/
- public Alignment getDataset();
+ Alignment getDataset();
/**
* Set the associated dataset for the alignment, or create one.
@@ -278,23 +313,23 @@ public interface AlignmentI
* @param dataset
* The dataset alignment or null to construct one.
*/
- public void setDataset(Alignment dataset);
+ void setDataset(Alignment dataset);
/**
* pads sequences with gaps (to ensure the set looks like an alignment)
*
* @return boolean true if alignment was modified
*/
- public boolean padGaps();
+ boolean padGaps();
- public HiddenSequences getHiddenSequences();
+ HiddenSequences getHiddenSequences();
/**
* Compact representation of alignment
*
* @return CigarArray
*/
- public CigarArray getCompactAlignment();
+ CigarArray getCompactAlignment();
/**
* Set an arbitrary key value pair for an alignment. Note: both key and value
@@ -303,7 +338,7 @@ public interface AlignmentI
* @param key
* @param value
*/
- public void setProperty(Object key, Object value);
+ void setProperty(Object key, Object value);
/**
* Get a named property from the alignment.
@@ -311,21 +346,21 @@ public interface AlignmentI
* @param key
* @return value of property
*/
- public Object getProperty(Object key);
+ Object getProperty(Object key);
/**
* Get the property hashtable.
*
* @return hashtable of alignment properties (or null if none are defined)
*/
- public Hashtable getProperties();
+ Hashtable getProperties();
/**
* add a reference to a frame of aligned codons for this alignment
*
* @param codons
*/
- public void addCodonFrame(AlignedCodonFrame codons);
+ void addCodonFrame(AlignedCodonFrame codons);
/**
* remove a particular codon frame reference from this alignment
@@ -333,27 +368,24 @@ public interface AlignmentI
* @param codons
* @return true if codon frame was removed.
*/
- public boolean removeCodonFrame(AlignedCodonFrame codons);
+ boolean removeCodonFrame(AlignedCodonFrame codons);
/**
* get all codon frames associated with this alignment
*
* @return
*/
- public AlignedCodonFrame[] getCodonFrames();
+ Set<AlignedCodonFrame> getCodonFrames();
/**
- * get a particular codon frame
- *
- * @param index
- * @return
+ * Set the codon frame mappings (replacing any existing set).
*/
- public AlignedCodonFrame getCodonFrame(int index);
+ void setCodonFrames(Set<AlignedCodonFrame> acfs);
/**
* get codon frames involving sequenceI
*/
- public AlignedCodonFrame[] getCodonFrame(SequenceI seq);
+ List<AlignedCodonFrame> getCodonFrame(SequenceI seq);
/**
* find sequence with given name in alignment
@@ -365,7 +397,7 @@ public interface AlignmentI
* tried
* @return matched sequence or null
*/
- public SequenceI findName(String token, boolean b);
+ SequenceI findName(String token, boolean b);
/**
* find next sequence with given name in alignment starting after a given
@@ -381,7 +413,7 @@ public interface AlignmentI
* tried
* @return matched sequence or null
*/
- public SequenceI findName(SequenceI startAfter, String token, boolean b);
+ SequenceI findName(SequenceI startAfter, String token, boolean b);
/**
* find first sequence in alignment which is involved in the given search
@@ -390,7 +422,7 @@ public interface AlignmentI
* @param results
* @return -1 or index of sequence in alignment
*/
- public int findIndex(SearchResults results);
+ int findIndex(SearchResults results);
/**
* append sequences and annotation from another alignment object to this one.
@@ -403,7 +435,7 @@ public interface AlignmentI
* @param toappend
* - the alignment to be appended.
*/
- public void append(AlignmentI toappend);
+ void append(AlignmentI toappend);
/**
* Justify the sequences to the left or right by deleting and inserting gaps
@@ -413,7 +445,7 @@ public interface AlignmentI
* true if alignment padded to right, false to justify to left
* @return true if alignment was changed TODO: return undo object
*/
- public boolean justify(boolean right);
+ boolean justify(boolean right);
/**
* add given annotation row at given position (0 is start, -1 is end)
@@ -421,5 +453,75 @@ public interface AlignmentI
* @param consensus
* @param i
*/
- public void addAnnotation(AlignmentAnnotation consensus, int i);
+ void addAnnotation(AlignmentAnnotation consensus, int i);
+
+ /**
+ * search for or create a specific annotation row on the alignment
+ *
+ * @param name
+ * name for annotation (must match)
+ * @param calcId
+ * calcId for the annotation (null or must match)
+ * @param autoCalc
+ * - value of autocalc flag for the annotation
+ * @param seqRef
+ * - null or specific sequence reference
+ * @param groupRef
+ * - null or specific group reference
+ * @param method
+ * - CalcId for the annotation (must match)
+ *
+ * @return existing annotation matching the given attributes
+ */
+ AlignmentAnnotation findOrCreateAnnotation(String name, String calcId,
+ boolean autoCalc, SequenceI seqRef, SequenceGroup groupRef);
+
+ /**
+ * move the given group up or down in the alignment by the given number of
+ * rows. Implementor assumes given group is already present on alignment - no
+ * recalculations are triggered.
+ *
+ * @param sg
+ * @param map
+ * @param up
+ * @param i
+ */
+ void moveSelectedSequencesByOne(SequenceGroup sg,
+ Map<SequenceI, SequenceCollectionI> map, boolean up);
+
+ /**
+ * validate annotation after an edit and update any alignment state flags
+ * accordingly
+ *
+ * @param alignmentAnnotation
+ */
+ void validateAnnotation(AlignmentAnnotation alignmentAnnotation);
+
+ /**
+ * Align this alignment the same as the given one. If both of the same type
+ * (nucleotide/protein) then align both identically. If this is nucleotide and
+ * the other is protein, make 3 gaps for each gap in the protein sequences. If
+ * this is protein and the other is nucleotide, insert a gap for each 3 gaps
+ * (or part thereof) between nucleotide bases. Returns the number of mapped
+ * sequences that were realigned .
+ *
+ * @param al
+ * @return
+ */
+ int alignAs(AlignmentI al);
+
+ /**
+ * Returns the set of distinct sequence names in the alignment.
+ *
+ * @return
+ */
+ Set<String> getSequenceNames();
+
+ /**
+ * Checks if the alignment has at least one sequence with one non-gaped
+ * residue
+ *
+ * @return
+ */
+ public boolean hasValidSequence();
}
diff --git a/src/jalview/datamodel/AlignmentOrder.java b/src/jalview/datamodel/AlignmentOrder.java
index 528fbfc..9023ade 100644
--- a/src/jalview/datamodel/AlignmentOrder.java
+++ b/src/jalview/datamodel/AlignmentOrder.java
@@ -1,23 +1,28 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
public class AlignmentOrder
{
@@ -48,7 +53,7 @@ public class AlignmentOrder
private String Name;
- private Vector Order = null;
+ private List<SequenceI> Order = null;
/**
* Creates a new AlignmentOrder object.
@@ -61,9 +66,8 @@ public class AlignmentOrder
* AlignmentOrder
*
* @param anOrder
- * Vector
*/
- public AlignmentOrder(Vector anOrder)
+ public AlignmentOrder(List<SequenceI> anOrder)
{
Order = anOrder;
}
@@ -76,11 +80,11 @@ public class AlignmentOrder
*/
public AlignmentOrder(AlignmentI orderFrom)
{
- Order = new Vector();
+ Order = new ArrayList<SequenceI>();
- for (int i = 0, ns = orderFrom.getHeight(); i < ns; i++)
+ for (SequenceI seq : orderFrom.getSequences())
{
- Order.addElement(orderFrom.getSequenceAt(i));
+ Order.add(seq);
}
}
@@ -92,12 +96,7 @@ public class AlignmentOrder
*/
public AlignmentOrder(SequenceI[] orderFrom)
{
- Order = new Vector();
-
- for (int i = 0, ns = orderFrom.length; i < ns; i++)
- {
- Order.addElement(orderFrom[i]);
- }
+ Order = new ArrayList<SequenceI>(Arrays.asList(orderFrom));
}
/**
@@ -148,7 +147,7 @@ public class AlignmentOrder
* @param Order
* DOCUMENT ME!
*/
- public void setOrder(Vector Order)
+ public void setOrder(List<SequenceI> Order)
{
this.Order = Order;
}
@@ -158,7 +157,7 @@ public class AlignmentOrder
*
* @return DOCUMENT ME!
*/
- public Vector getOrder()
+ public List<SequenceI> getOrder()
{
return Order;
}
@@ -175,7 +174,7 @@ public class AlignmentOrder
int found = Order.indexOf(oldref);
if (found > -1)
{
- Order.setElementAt(newref, found);
+ Order.set(found, newref);
}
return found > -1;
}
@@ -186,9 +185,14 @@ public class AlignmentOrder
* @param o
* @return true if o orders the same sequenceI objects in the same way
*/
- public boolean equals(AlignmentOrder o)
+ @Override
+ public boolean equals(Object o)
{
- return equals(o, true);
+ if (o == null || !(o instanceof AlignmentOrder))
+ {
+ return false;
+ }
+ return equals((AlignmentOrder) o, true);
}
/**
@@ -220,7 +224,7 @@ public class AlignmentOrder
{
for (int i = 0, j = o.Order.size(); i < j; i++)
{
- if (Order.elementAt(i) != o.Order.elementAt(i))
+ if (Order.get(i) != o.Order.get(i))
{
return false;
}
@@ -268,7 +272,7 @@ public class AlignmentOrder
}
if (Order != null && o.Order != null)
{
- Vector c, s;
+ List<SequenceI> c, s;
if (o.Order.size() > Order.size())
{
c = o.Order;
@@ -289,7 +293,7 @@ public class AlignmentOrder
int last = -1;
for (int i = 0, j = s.size(); i < j; i++)
{
- int pos = c.indexOf(s.elementAt(i)); // JBPNote - optimize by
+ int pos = c.indexOf(s.get(i)); // JBPNote - optimize by
// incremental position search
if (pos > last)
{
diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java
index 4bd1ace..88e9a9c 100644
--- a/src/jalview/datamodel/AlignmentView.java
+++ b/src/jalview/datamodel/AlignmentView.java
@@ -1,1175 +1,1214 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-import jalview.util.ShiftList;
-
-import java.io.PrintStream;
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- * Transient object compactly representing a 'view' of an alignment - with
- * discontinuities marked. Extended in Jalview 2.7 to optionally record sequence
- * groups and specific selected regions on the alignment.
- */
-public class AlignmentView
-{
- private SeqCigar[] sequences = null;
-
- private int[] contigs = null;
-
- private int width = 0;
-
- private int firstCol = 0;
-
- /**
- * one or more ScGroup objects, which are referenced by each seqCigar's group
- * membership
- */
- private Vector scGroups;
-
- /**
- * Group defined over SeqCigars. Unlike AlignmentI associated groups, each
- * SequenceGroup hold just the essential properties for the group, but no
- * references to the sequences involved. SeqCigars hold references to the
- * seuqenceGroup entities themselves.
- */
- private class ScGroup
- {
- public Vector seqs;
-
- public SequenceGroup sg;
-
- ScGroup()
- {
- seqs = new Vector();
- }
- }
-
- /**
- * vector of selected seqCigars. This vector is also referenced by each
- * seqCigar contained in it.
- */
- private Vector selected;
-
- /**
- * Construct an alignmentView from a live jalview alignment view. Note -
- * hidden rows will be excluded from alignmentView
- *
- * @param alignment
- * - alignment as referenced by an AlignViewport
- * @param columnSelection
- * -
- * @param selection
- * @param hasHiddenColumns
- * - mark the hidden columns in columnSelection as hidden in the view
- * @param selectedRegionOnly
- * - when set, only include the selected region in the view,
- * otherwise just mark the selected region on the constructed view.
- * @param recordGroups
- * - when set, any groups on the given alignment will be marked on
- * the view
- */
- public AlignmentView(AlignmentI alignment,
- ColumnSelection columnSelection, SequenceGroup selection,
- boolean hasHiddenColumns, boolean selectedRegionOnly,
- boolean recordGroups)
- {
- // refactored from AlignViewport.getAlignmentView(selectedOnly);
- this(new jalview.datamodel.CigarArray(alignment,
- (hasHiddenColumns ? columnSelection : null),
- (selectedRegionOnly ? selection : null)),
- (selectedRegionOnly && selection != null) ? selection
- .getStartRes() : 0);
- // walk down SeqCigar array and Alignment Array - optionally restricted by
- // selected region.
- // test group membership for each sequence in each group, store membership
- // and record non-empty groups in group list.
- // record / sub-select selected region on the alignment view
- SequenceI[] selseqs;
- if (selection != null)
- {
- Vector sel = selection.getSequences(null);
- this.selected = new Vector();
- selseqs = selection.getSequencesInOrder(alignment, selectedRegionOnly);
- }
- else
- {
- selseqs = alignment.getSequencesArray();
- }
-
- // get the alignment's group list and make a copy
- Vector grps = new Vector();
- Vector gg = alignment.getGroups();
- Enumeration gge = gg.elements();
- while (gge.hasMoreElements())
- {
- grps.addElement(gge.nextElement());
- }
- ScGroup[] sgrps = null;
- boolean addedgps[] = null;
- if (grps != null)
- {
- SequenceGroup sg;
- if (selection != null && selectedRegionOnly)
- {
- // trim annotation to the region being stored.
- // strip out any groups that do not actually intersect with the
- // visible and selected region
- int ssel = selection.getStartRes(), esel = selection.getEndRes();
- Vector isg = new Vector();
- Enumeration en = grps.elements();
- while (en.hasMoreElements())
- {
- sg = (SequenceGroup) en.nextElement();
-
- if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel))
- {
- // adjust bounds of new group, if necessary.
- if (sg.getStartRes() < ssel)
- {
- sg.setStartRes(ssel);
- }
- if (sg.getEndRes() > esel)
- {
- sg.setEndRes(esel);
- }
- sg.setStartRes(sg.getStartRes()-ssel+1);
- sg.setEndRes(sg.getEndRes()-ssel+1);
-
- isg.addElement(sg);
- }
- }
- grps = isg;
- }
-
- sgrps = new ScGroup[grps.size()];
- addedgps = new boolean[grps.size()];
- for (int g = 0; g < sgrps.length; g++)
- {
- sg = (SequenceGroup) grps.elementAt(g);
- sgrps[g] = new ScGroup();
- sgrps[g].sg = new SequenceGroup(sg);
- addedgps[g] = false;
- grps.setElementAt(sg.getSequences(null), g);
- }
- // grps now contains vectors (should be sets) for each group, so we can
- // track when we've done with the group
- }
- int csi = 0;
- for (int i = 0; i < selseqs.length; i++)
- {
- if (selseqs[i] != null)
- {
- if (selection != null && !selectedRegionOnly)
- {
- sequences[csi].setGroupMembership(selected);
- selected.addElement(sequences[csi]);
- }
- if (grps != null)
- {
- for (int sg = 0; sg < sgrps.length; sg++)
- {
- if (((Vector) grps.elementAt(sg)).contains(selseqs[i]))
- {
- sequences[csi].setGroupMembership(sgrps[sg]);
- sgrps[sg].sg.deleteSequence(selseqs[i], false);
- sgrps[sg].seqs.addElement(sequences[csi]);
- if (!addedgps[sg])
- {
- if (scGroups == null)
- {
- scGroups = new Vector();
- }
- addedgps[sg] = true;
- scGroups.addElement(sgrps[sg]);
- }
- }
- }
- }
- csi++;
- }
- }
- // finally, delete the remaining sequences (if any) not selected
- for (int sg = 0; sg < sgrps.length; sg++)
- {
- SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null);
- for (int si = 0; si < sqs.length; si++)
- {
- sgrps[sg].sg.deleteSequence(sqs[si], false);
- }
- sgrps[sg] = null;
- }
- }
-
- /**
- * construct an alignmentView from a SeqCigarArray. Errors are thrown if the
- * seqcigararray.isSeqCigarArray() flag is not set.
- */
- public AlignmentView(CigarArray seqcigararray)
- {
- if (!seqcigararray.isSeqCigarArray())
- {
- throw new Error(
- "Implementation Error - can only make an alignment view from a CigarArray of sequences.");
- }
- // contigs = seqcigararray.applyDeletions();
- contigs = seqcigararray.getDeletedRegions();
- sequences = seqcigararray.getSeqCigarArray();
- width = seqcigararray.getWidth(); // visible width
- }
-
- /**
- * Create an alignmentView where the first column corresponds with the
- * 'firstcol' column of some reference alignment
- *
- * @param sdata
- * @param firstcol
- */
- public AlignmentView(CigarArray sdata, int firstcol)
- {
- this(sdata);
- firstCol = firstcol;
- }
-
- public void setSequences(SeqCigar[] sequences)
- {
- this.sequences = sequences;
- }
-
- public void setContigs(int[] contigs)
- {
- this.contigs = contigs;
- }
-
- public SeqCigar[] getSequences()
- {
- return sequences;
- }
-
- /**
- * @see CigarArray.getDeletedRegions
- * @return int[] { vis_start, sym_start, length }
- */
- public int[] getContigs()
- {
- return contigs;
- }
-
- /**
- * get the full alignment and a columnselection object marking the hidden
- * regions
- *
- * @param gapCharacter
- * char
- * @return Object[] { SequenceI[], ColumnSelection}
- */
- public Object[] getAlignmentAndColumnSelection(char gapCharacter)
- {
- ColumnSelection colsel = new ColumnSelection();
-
- return new Object[]
- {
- SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel,
- contigs), colsel };
- }
-
- /**
- * return the visible alignment corresponding to this view. Sequences in this
- * alignment are edited versions of the parent sequences - where hidden
- * regions have been removed. NOTE: the sequence data in this alignment is not
- * complete!
- *
- * @param c
- * @return
- */
- public AlignmentI getVisibleAlignment(char c)
- {
- SequenceI[] aln = getVisibleSeqs(c);
-
- AlignmentI vcal = new Alignment(aln);
- addPrunedGroupsInOrder(vcal, -1, -1, true);
- return vcal;
- }
-
- /**
- * add groups from view to the given alignment
- *
- * @param vcal
- * @param gstart
- * -1 or 0 to width-1
- * @param gend
- * -1 or gstart to width-1
- * @param viscontigs
- * - true if vcal is alignment of the visible regions of the view
- * (e.g. as returned from getVisibleAlignment)
- */
- private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart,
- int gend, boolean viscontigs)
- {
- boolean r = false;
- if (gstart > -1 && gstart <= gend)
- {
- r = true;
- }
-
- SequenceI[] aln = vcal.getSequencesArray();
- {
- /**
- * prune any groups to the visible coordinates of the alignment.
- */
- {
- int nvg = (scGroups != null) ? scGroups.size() : 0;
- if (nvg > 0)
- {
- SequenceGroup[] nsg = new SequenceGroup[nvg];
- for (int g = 0; g < nvg; g++)
- {
- SequenceGroup sg = ((ScGroup) scGroups.elementAt(g)).sg;
- if (r)
- {
- if (sg.getStartRes() > gend || sg.getEndRes() < gstart)
- {
- // Skip this group
- nsg[g] = null;
- continue;
- }
- }
-
- // clone group properties
- nsg[g] = new SequenceGroup(sg);
-
- // may need to shift/trim start and end ?
- if (r && !viscontigs)
- {
- // Not fully tested code - routine not yet called with viscontigs==false
- if (nsg[g].getStartRes() < gstart)
- {
- nsg[g].setStartRes(0);
- }
- else
- {
- nsg[g].setStartRes(nsg[g].getStartRes() - gstart);
- nsg[g].setEndRes(nsg[g].getEndRes() - gstart);
- }
- if (nsg[g].getEndRes() > (gend-gstart))
- {
- nsg[g].setEndRes(gend-gstart);
- }
- }
- }
- if (viscontigs)
- {
- // prune groups to cover just the visible positions between
- // gstart/gend.
- if (contigs != null)
- {
- int p = 0;
- ShiftList prune = new ShiftList();
- if (r)
- {
- // adjust for start of alignment within visible window.
- prune.addShift(gstart, -gstart); //
- }
- for (int h = 0; h < contigs.length; h += 3)
- {
- {
- prune.addShift(p + contigs[h + 1], contigs[h + 2]
- - contigs[h + 1]);
- }
- p = contigs[h + 1] + contigs[h + 2];
- }
- for (int g = 0; g < nsg.length; g++)
- {
- if (nsg[g] != null)
- {
- int s = nsg[g].getStartRes(), t = nsg[g].getEndRes();
- int w = 1 + t - s;
- if (r)
- {
- if (s < gstart)
- {
- s = gstart;
- }
- if (t > gend)
- {
- t = gend;
- }
- }
- s = prune.shift(s);
- t = prune.shift(t);
- nsg[g].setStartRes(s);
- nsg[g].setEndRes(t);
- }
- }
- }
- }
-
- for (int nsq = 0; nsq < aln.length; nsq++)
- {
- for (int g = 0; g < nvg; g++)
- {
- if (nsg[g] != null
- && sequences[nsq].isMemberOf(scGroups.elementAt(g)))
- {
- nsg[g].addSequence(aln[nsq], false);
- }
- }
- }
- for (int g = 0; g < nvg; g++)
- {
- if (nsg[g] != null && nsg[g].getSize() > 0)
- {
- vcal.addGroup(nsg[g]);
- }
- nsg[g] = null;
- }
- }
- }
- }
- }
-
- /**
- * generate sequence array corresponding to the visible parts of the
- * alignment.
- *
- * @param c
- * @return
- */
- private SequenceI[] getVisibleSeqs(char c)
- {
- SequenceI[] aln = new SequenceI[sequences.length];
- for (int i = 0, j = sequences.length; i < j; i++)
- {
- aln[i] = sequences[i].getSeq('-');
- }
- // Remove hidden regions from sequence objects.
- String seqs[] = getSequenceStrings('-');
- for (int i = 0, j = aln.length; i < j; i++)
- {
- aln[i].setSequence(seqs[i]);
- }
- return aln;
- }
-
- /**
- * creates new alignment objects for all contiguous visible segments
- *
- * @param c
- * @param start
- * @param end
- * @param regionOfInterest
- * specify which sequences to include (or null to include all
- * sequences)
- * @return AlignmentI[] - all alignments where each sequence is a subsequence
- * constructed from visible contig regions of view
- */
- public AlignmentI[] getVisibleContigAlignments(char c)
- {
- int nvc = 0;
- int[] vcontigs = getVisibleContigs();
- SequenceI[][] contigviews = getVisibleContigs(c);
- AlignmentI[] vcals = new AlignmentI[contigviews.length];
- for (nvc = 0; nvc < contigviews.length; nvc++)
- {
- vcals[nvc] = new Alignment(contigviews[nvc]);
- if (scGroups!=null && scGroups.size()>0)
- {
- addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc*2],vcontigs[nvc*2+1], true);
- }
- }
- return vcals;
- }
-
-
- /**
- * get an array of visible sequence strings for a view on an alignment using
- * the given gap character
- *
- * @param c
- * char
- * @return String[]
- */
- public String[] getSequenceStrings(char c)
- {
- String[] seqs = new String[sequences.length];
- for (int n = 0; n < sequences.length; n++)
- {
- String fullseq = sequences[n].getSequenceString(c);
- if (contigs != null)
- {
- seqs[n] = "";
- int p = 0;
- for (int h = 0; h < contigs.length; h += 3)
- {
- seqs[n] += fullseq.substring(p, contigs[h + 1]);
- p = contigs[h + 1] + contigs[h + 2];
- }
- seqs[n] += fullseq.substring(p);
- }
- else
- {
- seqs[n] = fullseq;
- }
- }
- return seqs;
- }
-
- /**
- *
- * @return visible number of columns in alignment view
- */
- public int getWidth()
- {
- return width;
- }
-
- protected void setWidth(int width)
- {
- this.width = width;
- }
-
- /**
- * get the contiguous subalignments in an alignment view.
- *
- * @param gapCharacter
- * char
- * @return SequenceI[][]
- */
- public SequenceI[][] getVisibleContigs(char gapCharacter)
- {
- SequenceI[][] smsa;
- int njobs = 1;
- if (sequences == null || width <= 0)
- {
- return null;
- }
- if (contigs != null && contigs.length > 0)
- {
- int start = 0;
- njobs = 0;
- int fwidth = width;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- if ((contigs[contig + 1] - start) > 0)
- {
- njobs++;
- }
- fwidth += contigs[contig + 2]; // end up with full region width
- // (including hidden regions)
- start = contigs[contig + 1] + contigs[contig + 2];
- }
- if (start < fwidth)
- {
- njobs++;
- }
- smsa = new SequenceI[njobs][];
- start = 0;
- int j = 0;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- if (contigs[contig + 1] - start > 0)
- {
- SequenceI mseq[] = new SequenceI[sequences.length];
- for (int s = 0; s < mseq.length; s++)
- {
- mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(
- start, contigs[contig + 1]);
- }
- smsa[j] = mseq;
- j++;
- }
- start = contigs[contig + 1] + contigs[contig + 2];
- }
- if (start < fwidth)
- {
- SequenceI mseq[] = new SequenceI[sequences.length];
- for (int s = 0; s < mseq.length; s++)
- {
- mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,
- fwidth + 1);
- }
- smsa[j] = mseq;
- j++;
- }
- }
- else
- {
- smsa = new SequenceI[1][];
- smsa[0] = new SequenceI[sequences.length];
- for (int s = 0; s < sequences.length; s++)
- {
- smsa[0][s] = sequences[s].getSeq(gapCharacter);
- }
- }
- return smsa;
- }
-
- /**
- * return full msa and hidden regions with visible blocks replaced with new
- * sub alignments
- *
- * @param nvismsa
- * SequenceI[][]
- * @param orders
- * AlignmentOrder[] corresponding to each SequenceI[] block.
- * @return Object[]
- */
- public Object[] getUpdatedView(SequenceI[][] nvismsa,
- AlignmentOrder[] orders, char gapCharacter)
- {
- if (sequences == null || width <= 0)
- {
- throw new Error("empty view cannot be updated.");
- }
- if (nvismsa == null)
- {
- throw new Error(
- "nvismsa==null. use getAlignmentAndColumnSelection() instead.");
- }
- if (contigs != null && contigs.length > 0)
- {
- SequenceI[] alignment = new SequenceI[sequences.length];
- ColumnSelection columnselection = new ColumnSelection();
- if (contigs != null && contigs.length > 0)
- {
- int start = 0;
- int nwidth = 0;
- int owidth = width;
- int j = 0;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- owidth += contigs[contig + 2]; // recover final column width
- if (contigs[contig + 1] - start > 0)
- {
- int swidth = 0; // subalignment width
- if (nvismsa[j] != null)
- {
- SequenceI mseq[] = nvismsa[j];
- AlignmentOrder order = (orders == null) ? null : orders[j];
- j++;
- if (mseq.length != sequences.length)
- {
- throw new Error(
- "Mismatch between number of sequences in block "
- + j + " (" + mseq.length
- + ") and the original view ("
- + sequences.length + ")");
- }
- swidth = mseq[0].getLength(); // JBPNote: could ensure padded
- // here.
- for (int s = 0; s < mseq.length; s++)
- {
- if (alignment[s] == null)
- {
- alignment[s] = mseq[s];
- }
- else
- {
- alignment[s].setSequence(alignment[s]
- .getSequenceAsString()
- + mseq[s].getSequenceAsString());
- if (mseq[s].getStart() <= mseq[s].getEnd())
- {
- alignment[s].setEnd(mseq[s].getEnd());
- }
- if (order != null)
- {
- order.updateSequence(mseq[s], alignment[s]);
- }
- }
- }
- }
- else
- {
- // recover original alignment block or place gaps
- if (true)
- {
- // recover input data
- for (int s = 0; s < sequences.length; s++)
- {
- SequenceI oseq = sequences[s].getSeq(gapCharacter)
- .getSubSequence(start, contigs[contig + 1]);
- if (swidth < oseq.getLength())
- {
- swidth = oseq.getLength();
- }
- if (alignment[s] == null)
- {
- alignment[s] = oseq;
- }
- else
- {
- alignment[s].setSequence(alignment[s]
- .getSequenceAsString()
- + oseq.getSequenceAsString());
- if (oseq.getEnd() >= oseq.getStart())
- {
- alignment[s].setEnd(oseq.getEnd());
- }
- }
- }
-
- }
- j++;
- }
- nwidth += swidth;
- }
- // advance to begining of visible region
- start = contigs[contig + 1] + contigs[contig + 2];
- // add hidden segment to right of next region
- for (int s = 0; s < sequences.length; s++)
- {
- SequenceI hseq = sequences[s].getSeq(gapCharacter)
- .getSubSequence(contigs[contig + 1], start);
- if (alignment[s] == null)
- {
- alignment[s] = hseq;
- }
- else
- {
- alignment[s].setSequence(alignment[s].getSequenceAsString()
- + hseq.getSequenceAsString());
- if (hseq.getEnd() >= hseq.getStart())
- {
- alignment[s].setEnd(hseq.getEnd());
- }
- }
- }
- // mark hidden segment as hidden in the new alignment
- columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2]
- - 1);
- nwidth += contigs[contig + 2];
- }
- // Do final segment - if it exists
- if (j < nvismsa.length)
- {
- int swidth = 0;
- if (nvismsa[j] != null)
- {
- SequenceI mseq[] = nvismsa[j];
- AlignmentOrder order = (orders != null) ? orders[j] : null;
- swidth = mseq[0].getLength();
- for (int s = 0; s < mseq.length; s++)
- {
- if (alignment[s] == null)
- {
- alignment[s] = mseq[s];
- }
- else
- {
- alignment[s].setSequence(alignment[s].getSequenceAsString()
- + mseq[s].getSequenceAsString());
- if (mseq[s].getEnd() >= mseq[s].getStart())
- {
- alignment[s].setEnd(mseq[s].getEnd());
- }
- if (order != null)
- {
- order.updateSequence(mseq[s], alignment[s]);
- }
- }
- }
- }
- else
- {
- if (start < owidth)
- {
- // recover input data or place gaps
- if (true)
- {
- // recover input data
- for (int s = 0; s < sequences.length; s++)
- {
- SequenceI oseq = sequences[s].getSeq(gapCharacter)
- .getSubSequence(start, owidth + 1);
- if (swidth < oseq.getLength())
- {
- swidth = oseq.getLength();
- }
- if (alignment[s] == null)
- {
- alignment[s] = oseq;
- }
- else
- {
- alignment[s].setSequence(alignment[s]
- .getSequenceAsString()
- + oseq.getSequenceAsString());
- if (oseq.getEnd() >= oseq.getStart())
- {
- alignment[s].setEnd(oseq.getEnd());
- }
- }
- }
- nwidth += swidth;
- }
- else
- {
- // place gaps.
- throw new Error("Padding not yet implemented.");
- }
- }
- }
- }
- }
- return new Object[]
- { alignment, columnselection };
- }
- else
- {
- if (nvismsa.length != 1)
- {
- throw new Error(
- "Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks="
- + nvismsa.length);
- }
- if (nvismsa[0] != null)
- {
- return new Object[]
- { nvismsa[0], new ColumnSelection() };
- }
- else
- {
- return getAlignmentAndColumnSelection(gapCharacter);
- }
- }
- }
-
- /**
- * returns simple array of start end positions of visible range on alignment.
- * vis_start and vis_end are inclusive - use
- * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence
- * from underlying alignment.
- *
- * @return int[] { start_i, end_i } for 1<i<n visible regions.
- */
- public int[] getVisibleContigs()
- {
- if (contigs != null && contigs.length > 0)
- {
- int start = 0;
- int nvis = 0;
- int fwidth = width;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- if ((contigs[contig + 1] - start) > 0)
- {
- nvis++;
- }
- fwidth += contigs[contig + 2]; // end up with full region width
- // (including hidden regions)
- start = contigs[contig + 1] + contigs[contig + 2];
- }
- if (start < fwidth)
- {
- nvis++;
- }
- int viscontigs[] = new int[nvis * 2];
- nvis = 0;
- start = 0;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- if ((contigs[contig + 1] - start) > 0)
- {
- viscontigs[nvis] = start;
- viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive
- nvis += 2;
- }
- start = contigs[contig + 1] + contigs[contig + 2];
- }
- if (start < fwidth)
- {
- viscontigs[nvis] = start;
- viscontigs[nvis + 1] = fwidth; // end is inclusive
- nvis += 2;
- }
- return viscontigs;
- }
- else
- {
- return new int[]
- { 0, width };
- }
- }
-
- /**
- *
- * @return position of first visible column of AlignmentView within its
- * parent's alignment reference frame
- */
- public int getAlignmentOrigin()
- {
- return firstCol;
- }
-
- /**
- * compute a deletion map for the current view according to the given
- * gap/match map
- *
- * @param gapMap
- * (as returned from SequenceI.gapMap())
- * @return int[] {intersection of visible regions with gapMap)
- */
- public int[] getVisibleContigMapFor(int[] gapMap)
- {
- int[] delMap = null;
- int[] viscontigs = getVisibleContigs();
- int spos = 0;
- int i = 0;
- if (viscontigs != null)
- {
- // viscontigs maps from a subset of the gapMap to the gapMap, so it will
- // always be equal to or shorter than gapMap
- delMap = new int[gapMap.length];
- for (int contig = 0; contig < viscontigs.length; contig += 2)
- {
-
- while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
- {
- spos++;
- }
- while (spos < gapMap.length
- && gapMap[spos] <= viscontigs[contig + 1])
- {
- delMap[i++] = spos++;
- }
- }
- int tmap[] = new int[i];
- System.arraycopy(delMap, 0, tmap, 0, i);
- delMap = tmap;
- }
- return delMap;
- }
-
- /**
- * apply the getSeq(gc) method to each sequence cigar, and return the array of
- * edited sequences, optionally with hidden regions removed.
- *
- * @param gc
- * gap character to use for insertions
- * @param delete
- * remove hidden regions from sequences. Note: currently implemented
- * in a memory inefficient way - space needed is 2*result set for
- * deletion
- *
- * @return SequenceI[]
- */
- public SequenceI[] getEditedSequences(char gc, boolean delete)
- {
- SeqCigar[] msf = getSequences();
- SequenceI[] aln = new SequenceI[msf.length];
- for (int i = 0, j = msf.length; i < j; i++)
- {
- aln[i] = msf[i].getSeq(gc);
- }
- if (delete)
- {
- String[] sqs = getSequenceStrings(gc);
- for (int i = 0; i < sqs.length; i++)
- {
- aln[i].setSequence(sqs[i]);
- sqs[i] = null;
- }
- }
- return aln;
- }
-
- public static void summariseAlignmentView(AlignmentView view,
- PrintStream os)
- {
- os.print("View has " + view.sequences.length + " of which ");
- if (view.selected == null) {
- os.print("None");
- } else {
- os.print(" "+view.selected.size());
- }
- os.println(" are selected.");
- os.print("View is " + view.getWidth() + " columns wide");
- int viswid = 0;
- int[] contigs = view.getContigs();
- if (contigs != null)
- {
- viswid = view.width;
- for (int i = 0; i < contigs.length; i += 3)
- {
- viswid += contigs[i + 2];
- }
- os.println("with " + viswid + " visible columns spread over "
- + contigs.length / 3 + " regions.");
- }
- else
- {
- viswid = view.width;
- os.println(".");
- }
- if (view.scGroups != null)
- {
- os.println("There are " + view.scGroups.size()
- + " groups defined on the view.");
- for (int g = 0; g < view.scGroups.size(); g++)
- {
- ScGroup sgr = (ScGroup) view.scGroups.elementAt(g);
- os.println("Group " + g + ": Name = " + sgr.sg.getName()
- + " Contains " + sgr.seqs.size() + " Seqs.");
- os.println("This group runs from " + sgr.sg.getStartRes() + " to "
- + sgr.sg.getEndRes());
- for (int s = 0; s < sgr.seqs.size(); s++)
- {
- if (!((SeqCigar) sgr.seqs.elementAt(s)).isMemberOf(sgr))
- {
- os.println("** WARNING: sequence "
- + ((SeqCigar) sgr.seqs.elementAt(s)).toString()
- + " is not marked as member of group.");
- }
- }
- }
- AlignmentI visal = view.getVisibleAlignment('-');
- if (visal != null)
- {
- os.println("Vis. alignment is " + visal.getWidth()
- + " wide and has " + visal.getHeight() + " seqs.");
- if (visal.getGroups() != null && visal.getGroups().size() > 0)
- {
- SequenceGroup sg;
- Enumeration en = visal.getGroups().elements();
- int i = 1;
- while (en.hasMoreElements())
- {
- sg = (SequenceGroup) en.nextElement();
- os.println("Group " + (i++) + " begins at column "
- + sg.getStartRes() + " and ends at " + sg.getEndRes());
- }
- }
- }
- }
- }
-
- public static void testSelectionViews(AlignmentI alignment,
- ColumnSelection csel, SequenceGroup selection)
- {
- System.out.println("Testing standard view creation:\n");
- AlignmentView view = null;
- try
- {
- System.out
- .println("View with no hidden columns, no limit to selection, no groups to be collected:");
- view = new AlignmentView(alignment, csel, selection, false, false,
- false);
- summariseAlignmentView(view, System.out);
-
- } catch (Exception e)
- {
- e.printStackTrace();
- System.err
- .println("Failed to generate alignment with selection but no groups marked.");
- }
- try
- {
- System.out
- .println("View with no hidden columns, no limit to selection, and all groups to be collected:");
- view = new AlignmentView(alignment, csel, selection, false, false,
- true);
- summariseAlignmentView(view, System.out);
- } catch (Exception e)
- {
- e.printStackTrace();
- System.err
- .println("Failed to generate alignment with selection marked but no groups marked.");
- }
- try
- {
- System.out
- .println("View with no hidden columns, limited to selection and no groups to be collected:");
- view = new AlignmentView(alignment, csel, selection, false, true,
- false);
- summariseAlignmentView(view, System.out);
- } catch (Exception e)
- {
- e.printStackTrace();
- System.err
- .println("Failed to generate alignment with selection restricted but no groups marked.");
- }
- try
- {
- System.out
- .println("View with no hidden columns, limited to selection, and all groups to be collected:");
- view = new AlignmentView(alignment, csel, selection, false, true,
- true);
- summariseAlignmentView(view, System.out);
- } catch (Exception e)
- {
- e.printStackTrace();
- System.err
- .println("Failed to generate alignment with selection restricted and groups marked.");
- }
- try
- {
- System.out
- .println("View *with* hidden columns, no limit to selection, no groups to be collected:");
- view = new AlignmentView(alignment, csel, selection, true, false,
- false);
- summariseAlignmentView(view, System.out);
- } catch (Exception e)
- {
- e.printStackTrace();
- System.err
- .println("Failed to generate alignment with selection but no groups marked.");
- }
- try
- {
- System.out
- .println("View *with* hidden columns, no limit to selection, and all groups to be collected:");
- view = new AlignmentView(alignment, csel, selection, true, false,
- true);
- summariseAlignmentView(view, System.out);
- } catch (Exception e)
- {
- e.printStackTrace();
- System.err
- .println("Failed to generate alignment with selection marked but no groups marked.");
- }
- try
- {
- System.out
- .println("View *with* hidden columns, limited to selection and no groups to be collected:");
- view = new AlignmentView(alignment, csel, selection, true, true,
- false);
- summariseAlignmentView(view, System.out);
- } catch (Exception e)
- {
- e.printStackTrace();
- System.err
- .println("Failed to generate alignment with selection restricted but no groups marked.");
- }
- try
- {
- System.out
- .println("View *with* hidden columns, limited to selection, and all groups to be collected:");
- view = new AlignmentView(alignment, csel, selection, true, true, true);
- summariseAlignmentView(view, System.out);
- } catch (Exception e)
- {
- e.printStackTrace();
- System.err
- .println("Failed to generate alignment with selection restricted and groups marked.");
- }
-
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import jalview.util.MessageManager;
+import jalview.util.ShiftList;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * Transient object compactly representing a 'view' of an alignment - with
+ * discontinuities marked. Extended in Jalview 2.7 to optionally record sequence
+ * groups and specific selected regions on the alignment.
+ */
+public class AlignmentView
+{
+ private SeqCigar[] sequences = null;
+
+ private int[] contigs = null;
+
+ private int width = 0;
+
+ private int firstCol = 0;
+
+ /**
+ * one or more ScGroup objects, which are referenced by each seqCigar's group
+ * membership
+ */
+ private List<ScGroup> scGroups = null;
+
+ private boolean isNa = false;
+
+ /**
+ * false if the view concerns peptides
+ *
+ * @return
+ */
+ public boolean isNa()
+ {
+ return isNa;
+ }
+
+ /**
+ * Group defined over SeqCigars. Unlike AlignmentI associated groups, each
+ * SequenceGroup hold just the essential properties for the group, but no
+ * references to the sequences involved. SeqCigars hold references to the
+ * seuqenceGroup entities themselves.
+ */
+ private class ScGroup
+ {
+ public Vector seqs;
+
+ public SequenceGroup sg;
+
+ ScGroup()
+ {
+ seqs = new Vector();
+ }
+ }
+
+ /**
+ * vector of selected seqCigars. This vector is also referenced by each
+ * seqCigar contained in it.
+ */
+ private Vector selected;
+
+ /**
+ * Construct an alignmentView from a live jalview alignment view. Note -
+ * hidden rows will be excluded from alignmentView Note: JAL-1179
+ *
+ * @param alignment
+ * - alignment as referenced by an AlignViewport
+ * @param columnSelection
+ * -
+ * @param selection
+ * @param hasHiddenColumns
+ * - mark the hidden columns in columnSelection as hidden in the view
+ * @param selectedRegionOnly
+ * - when set, only include the selected region in the view,
+ * otherwise just mark the selected region on the constructed view.
+ * @param recordGroups
+ * - when set, any groups on the given alignment will be marked on
+ * the view
+ */
+ public AlignmentView(AlignmentI alignment,
+ ColumnSelection columnSelection, SequenceGroup selection,
+ boolean hasHiddenColumns, boolean selectedRegionOnly,
+ boolean recordGroups)
+ {
+ // refactored from AlignViewport.getAlignmentView(selectedOnly);
+ this(new jalview.datamodel.CigarArray(alignment,
+ (hasHiddenColumns ? columnSelection : null),
+ (selectedRegionOnly ? selection : null)),
+ (selectedRegionOnly && selection != null) ? selection
+ .getStartRes() : 0);
+ isNa = alignment.isNucleotide();
+ // walk down SeqCigar array and Alignment Array - optionally restricted by
+ // selected region.
+ // test group membership for each sequence in each group, store membership
+ // and record non-empty groups in group list.
+ // record / sub-select selected region on the alignment view
+ SequenceI[] selseqs;
+ if (selection != null && selection.getSize() > 0)
+ {
+ List<SequenceI> sel = selection.getSequences(null);
+ this.selected = new Vector();
+ selseqs = selection
+ .getSequencesInOrder(alignment, selectedRegionOnly);
+ }
+ else
+ {
+ selseqs = alignment.getSequencesArray();
+ }
+
+ List<List<SequenceI>> seqsets = new ArrayList<List<SequenceI>>();
+ // get the alignment's group list and make a copy
+ List<SequenceGroup> grps = new ArrayList<SequenceGroup>();
+ List<SequenceGroup> gg = alignment.getGroups();
+ grps.addAll(gg);
+ ScGroup[] sgrps = null;
+ boolean addedgps[] = null;
+ if (grps != null)
+ {
+ if (selection != null && selectedRegionOnly)
+ {
+ // trim annotation to the region being stored.
+ // strip out any groups that do not actually intersect with the
+ // visible and selected region
+ int ssel = selection.getStartRes(), esel = selection.getEndRes();
+ List<SequenceGroup> isg = new ArrayList<SequenceGroup>();
+ for (SequenceGroup sg : grps)
+ {
+ if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel))
+ {
+ // adjust bounds of new group, if necessary.
+ if (sg.getStartRes() < ssel)
+ {
+ sg.setStartRes(ssel);
+ }
+ if (sg.getEndRes() > esel)
+ {
+ sg.setEndRes(esel);
+ }
+ sg.setStartRes(sg.getStartRes() - ssel + 1);
+ sg.setEndRes(sg.getEndRes() - ssel + 1);
+
+ isg.add(sg);
+ }
+ }
+ grps = isg;
+ }
+
+ sgrps = new ScGroup[grps.size()];
+ addedgps = new boolean[grps.size()];
+ for (int g = 0; g < sgrps.length; g++)
+ {
+ SequenceGroup sg = grps.get(g);
+ sgrps[g] = new ScGroup();
+ sgrps[g].sg = new SequenceGroup(sg);
+ addedgps[g] = false;
+ // can't set entry 0 in an empty list
+ // seqsets.set(g, sg.getSequences(null));
+ seqsets.add(sg.getSequences());
+ }
+ // seqsets now contains vectors (should be sets) for each group, so we can
+ // track when we've done with the group
+ }
+ int csi = 0;
+ for (int i = 0; i < selseqs.length; i++)
+ {
+ if (selseqs[i] != null)
+ {
+ if (selection != null && selection.getSize() > 0
+ && !selectedRegionOnly)
+ {
+ sequences[csi].setGroupMembership(selected);
+ selected.addElement(sequences[csi]);
+ }
+ if (seqsets != null)
+ {
+ for (int sg = 0; sg < sgrps.length; sg++)
+ {
+ if ((seqsets.get(sg)).contains(selseqs[i]))
+ {
+ sequences[csi].setGroupMembership(sgrps[sg]);
+ sgrps[sg].sg.deleteSequence(selseqs[i], false);
+ sgrps[sg].seqs.addElement(sequences[csi]);
+ if (!addedgps[sg])
+ {
+ if (scGroups == null)
+ {
+ scGroups = new ArrayList<ScGroup>();
+ }
+ addedgps[sg] = true;
+ scGroups.add(sgrps[sg]);
+ }
+ }
+ }
+ }
+ csi++;
+ }
+ }
+ // finally, delete the remaining sequences (if any) not selected
+ for (int sg = 0; sg < sgrps.length; sg++)
+ {
+ SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null);
+ for (int si = 0; si < sqs.length; si++)
+ {
+ sgrps[sg].sg.deleteSequence(sqs[si], false);
+ }
+ sgrps[sg] = null;
+ }
+ }
+
+ /**
+ * construct an alignmentView from a SeqCigarArray. Errors are thrown if the
+ * seqcigararray.isSeqCigarArray() flag is not set.
+ */
+ public AlignmentView(CigarArray seqcigararray)
+ {
+ if (!seqcigararray.isSeqCigarArray())
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_can_only_make_alignmnet_from_cigararray"));
+ }
+ // contigs = seqcigararray.applyDeletions();
+ contigs = seqcigararray.getDeletedRegions();
+ sequences = seqcigararray.getSeqCigarArray();
+ width = seqcigararray.getWidth(); // visible width
+ }
+
+ /**
+ * Create an alignmentView where the first column corresponds with the
+ * 'firstcol' column of some reference alignment
+ *
+ * @param sdata
+ * @param firstcol
+ */
+ public AlignmentView(CigarArray sdata, int firstcol)
+ {
+ this(sdata);
+ firstCol = firstcol;
+ }
+
+ public void setSequences(SeqCigar[] sequences)
+ {
+ this.sequences = sequences;
+ }
+
+ public void setContigs(int[] contigs)
+ {
+ this.contigs = contigs;
+ }
+
+ public SeqCigar[] getSequences()
+ {
+ return sequences;
+ }
+
+ /**
+ * @see CigarArray.getDeletedRegions
+ * @return int[] { vis_start, sym_start, length }
+ */
+ public int[] getContigs()
+ {
+ return contigs;
+ }
+
+ /**
+ * get the full alignment and a columnselection object marking the hidden
+ * regions
+ *
+ * @param gapCharacter
+ * char
+ * @return Object[] { SequenceI[], ColumnSelection}
+ */
+ public Object[] getAlignmentAndColumnSelection(char gapCharacter)
+ {
+ ColumnSelection colsel = new ColumnSelection();
+
+ return new Object[] {
+ SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel,
+ contigs), colsel };
+ }
+
+ /**
+ * return the visible alignment corresponding to this view. Sequences in this
+ * alignment are edited versions of the parent sequences - where hidden
+ * regions have been removed. NOTE: the sequence data in this alignment is not
+ * complete!
+ *
+ * @param c
+ * @return
+ */
+ public AlignmentI getVisibleAlignment(char c)
+ {
+ SequenceI[] aln = getVisibleSeqs(c);
+
+ AlignmentI vcal = new Alignment(aln);
+ addPrunedGroupsInOrder(vcal, -1, -1, true);
+ return vcal;
+ }
+
+ /**
+ * add groups from view to the given alignment
+ *
+ * @param vcal
+ * @param gstart
+ * -1 or 0 to width-1
+ * @param gend
+ * -1 or gstart to width-1
+ * @param viscontigs
+ * - true if vcal is alignment of the visible regions of the view
+ * (e.g. as returned from getVisibleAlignment)
+ */
+ private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart,
+ int gend, boolean viscontigs)
+ {
+ boolean r = false;
+ if (gstart > -1 && gstart <= gend)
+ {
+ r = true;
+ }
+
+ SequenceI[] aln = vcal.getSequencesArray();
+ {
+ /**
+ * prune any groups to the visible coordinates of the alignment.
+ */
+ {
+ int nvg = (scGroups != null) ? scGroups.size() : 0;
+ if (nvg > 0)
+ {
+ SequenceGroup[] nsg = new SequenceGroup[nvg];
+ for (int g = 0; g < nvg; g++)
+ {
+ SequenceGroup sg = scGroups.get(g).sg;
+ if (r)
+ {
+ if (sg.getStartRes() > gend || sg.getEndRes() < gstart)
+ {
+ // Skip this group
+ nsg[g] = null;
+ continue;
+ }
+ }
+
+ // clone group properties
+ nsg[g] = new SequenceGroup(sg);
+
+ // may need to shift/trim start and end ?
+ if (r && !viscontigs)
+ {
+ // Not fully tested code - routine not yet called with
+ // viscontigs==false
+ if (nsg[g].getStartRes() < gstart)
+ {
+ nsg[g].setStartRes(0);
+ }
+ else
+ {
+ nsg[g].setStartRes(nsg[g].getStartRes() - gstart);
+ nsg[g].setEndRes(nsg[g].getEndRes() - gstart);
+ }
+ if (nsg[g].getEndRes() > (gend - gstart))
+ {
+ nsg[g].setEndRes(gend - gstart);
+ }
+ }
+ }
+ if (viscontigs)
+ {
+ // prune groups to cover just the visible positions between
+ // gstart/gend.
+ if (contigs != null)
+ {
+ int p = 0;
+ ShiftList prune = new ShiftList();
+ if (r)
+ {
+ // adjust for start of alignment within visible window.
+ prune.addShift(gstart, -gstart); //
+ }
+ for (int h = 0; h < contigs.length; h += 3)
+ {
+ {
+ prune.addShift(p + contigs[h + 1], contigs[h + 2]
+ - contigs[h + 1]);
+ }
+ p = contigs[h + 1] + contigs[h + 2];
+ }
+ for (int g = 0; g < nsg.length; g++)
+ {
+ if (nsg[g] != null)
+ {
+ int s = nsg[g].getStartRes(), t = nsg[g].getEndRes();
+ int w = 1 + t - s;
+ if (r)
+ {
+ if (s < gstart)
+ {
+ s = gstart;
+ }
+ if (t > gend)
+ {
+ t = gend;
+ }
+ }
+ s = prune.shift(s);
+ t = prune.shift(t);
+ nsg[g].setStartRes(s);
+ nsg[g].setEndRes(t);
+ }
+ }
+ }
+ }
+
+ for (int nsq = 0; nsq < aln.length; nsq++)
+ {
+ for (int g = 0; g < nvg; g++)
+ {
+ if (nsg[g] != null
+ && sequences[nsq].isMemberOf(scGroups.get(g)))
+ {
+ nsg[g].addSequence(aln[nsq], false);
+ }
+ }
+ }
+ for (int g = 0; g < nvg; g++)
+ {
+ if (nsg[g] != null && nsg[g].getSize() > 0)
+ {
+ vcal.addGroup(nsg[g]);
+ }
+ nsg[g] = null;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * generate sequence array corresponding to the visible parts of the
+ * alignment.
+ *
+ * @param c
+ * gap character to use to recreate the alignment
+ * @return
+ */
+ private SequenceI[] getVisibleSeqs(char c)
+ {
+ SequenceI[] aln = new SequenceI[sequences.length];
+ for (int i = 0, j = sequences.length; i < j; i++)
+ {
+ aln[i] = sequences[i].getSeq(c);
+ // Remove hidden regions from sequence
+ aln[i].setSequence(getASequenceString(c, i));
+ }
+ return aln;
+ }
+
+ /**
+ * creates new alignment objects for all contiguous visible segments
+ *
+ * @param c
+ * @param start
+ * @param end
+ * @param regionOfInterest
+ * specify which sequences to include (or null to include all
+ * sequences)
+ * @return AlignmentI[] - all alignments where each sequence is a subsequence
+ * constructed from visible contig regions of view
+ */
+ public AlignmentI[] getVisibleContigAlignments(char c)
+ {
+ int nvc = 0;
+ int[] vcontigs = getVisibleContigs();
+ SequenceI[][] contigviews = getVisibleContigs(c);
+ AlignmentI[] vcals = new AlignmentI[contigviews.length];
+ for (nvc = 0; nvc < contigviews.length; nvc++)
+ {
+ vcals[nvc] = new Alignment(contigviews[nvc]);
+ if (scGroups != null && scGroups.size() > 0)
+ {
+ addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc * 2],
+ vcontigs[nvc * 2 + 1], true);
+ }
+ }
+ return vcals;
+ }
+
+ /**
+ * build a string excluding hidden regions from a particular sequence in the
+ * view
+ *
+ * @param c
+ * @param n
+ * @return
+ */
+ private String getASequenceString(char c, int n)
+ {
+ String sqn;
+ String fullseq = sequences[n].getSequenceString(c);
+ if (contigs != null)
+ {
+ sqn = "";
+ int p = 0;
+ for (int h = 0; h < contigs.length; h += 3)
+ {
+ sqn += fullseq.substring(p, contigs[h + 1]);
+ p = contigs[h + 1] + contigs[h + 2];
+ }
+ sqn += fullseq.substring(p);
+ }
+ else
+ {
+ sqn = fullseq;
+ }
+ return sqn;
+ }
+
+ /**
+ * get an array of visible sequence strings for a view on an alignment using
+ * the given gap character uses getASequenceString
+ *
+ * @param c
+ * char
+ * @return String[]
+ */
+ public String[] getSequenceStrings(char c)
+ {
+ String[] seqs = new String[sequences.length];
+ for (int n = 0; n < sequences.length; n++)
+ {
+ seqs[n] = getASequenceString(c, n);
+ }
+ return seqs;
+ }
+
+ /**
+ *
+ * @return visible number of columns in alignment view
+ */
+ public int getWidth()
+ {
+ return width;
+ }
+
+ protected void setWidth(int width)
+ {
+ this.width = width;
+ }
+
+ /**
+ * get the contiguous subalignments in an alignment view.
+ *
+ * @param gapCharacter
+ * char
+ * @return SequenceI[][]
+ */
+ public SequenceI[][] getVisibleContigs(char gapCharacter)
+ {
+ SequenceI[][] smsa;
+ int njobs = 1;
+ if (sequences == null || width <= 0)
+ {
+ return null;
+ }
+ if (contigs != null && contigs.length > 0)
+ {
+ int start = 0;
+ njobs = 0;
+ int fwidth = width;
+ for (int contig = 0; contig < contigs.length; contig += 3)
+ {
+ if ((contigs[contig + 1] - start) > 0)
+ {
+ njobs++;
+ }
+ fwidth += contigs[contig + 2]; // end up with full region width
+ // (including hidden regions)
+ start = contigs[contig + 1] + contigs[contig + 2];
+ }
+ if (start < fwidth)
+ {
+ njobs++;
+ }
+ smsa = new SequenceI[njobs][];
+ start = 0;
+ int j = 0;
+ for (int contig = 0; contig < contigs.length; contig += 3)
+ {
+ if (contigs[contig + 1] - start > 0)
+ {
+ SequenceI mseq[] = new SequenceI[sequences.length];
+ for (int s = 0; s < mseq.length; s++)
+ {
+ mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(
+ start, contigs[contig + 1]);
+ }
+ smsa[j] = mseq;
+ j++;
+ }
+ start = contigs[contig + 1] + contigs[contig + 2];
+ }
+ if (start < fwidth)
+ {
+ SequenceI mseq[] = new SequenceI[sequences.length];
+ for (int s = 0; s < mseq.length; s++)
+ {
+ mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,
+ fwidth + 1);
+ }
+ smsa[j] = mseq;
+ j++;
+ }
+ }
+ else
+ {
+ smsa = new SequenceI[1][];
+ smsa[0] = new SequenceI[sequences.length];
+ for (int s = 0; s < sequences.length; s++)
+ {
+ smsa[0][s] = sequences[s].getSeq(gapCharacter);
+ }
+ }
+ return smsa;
+ }
+
+ /**
+ * return full msa and hidden regions with visible blocks replaced with new
+ * sub alignments
+ *
+ * @param nvismsa
+ * SequenceI[][]
+ * @param orders
+ * AlignmentOrder[] corresponding to each SequenceI[] block.
+ * @return Object[]
+ */
+ public Object[] getUpdatedView(SequenceI[][] nvismsa,
+ AlignmentOrder[] orders, char gapCharacter)
+ {
+ if (sequences == null || width <= 0)
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.empty_view_cannot_be_updated"));
+ }
+ if (nvismsa == null)
+ {
+ throw new Error(
+ "nvismsa==null. use getAlignmentAndColumnSelection() instead.");
+ }
+ if (contigs != null && contigs.length > 0)
+ {
+ SequenceI[] alignment = new SequenceI[sequences.length];
+ ColumnSelection columnselection = new ColumnSelection();
+ if (contigs != null && contigs.length > 0)
+ {
+ int start = 0;
+ int nwidth = 0;
+ int owidth = width;
+ int j = 0;
+ for (int contig = 0; contig < contigs.length; contig += 3)
+ {
+ owidth += contigs[contig + 2]; // recover final column width
+ if (contigs[contig + 1] - start > 0)
+ {
+ int swidth = 0; // subalignment width
+ if (nvismsa[j] != null)
+ {
+ SequenceI mseq[] = nvismsa[j];
+ AlignmentOrder order = (orders == null) ? null : orders[j];
+ j++;
+ if (mseq.length != sequences.length)
+ {
+ throw new Error(
+ MessageManager
+ .formatMessage(
+ "error.mismatch_between_number_of_sequences_in_block",
+ new String[] {
+ Integer.valueOf(j).toString(),
+ Integer.valueOf(mseq.length)
+ .toString(),
+ Integer.valueOf(
+ sequences.length)
+ .toString() }));
+ }
+ swidth = mseq[0].getLength(); // JBPNote: could ensure padded
+ // here.
+ for (int s = 0; s < mseq.length; s++)
+ {
+ if (alignment[s] == null)
+ {
+ alignment[s] = mseq[s];
+ }
+ else
+ {
+ alignment[s].setSequence(alignment[s]
+ .getSequenceAsString()
+ + mseq[s].getSequenceAsString());
+ if (mseq[s].getStart() <= mseq[s].getEnd())
+ {
+ alignment[s].setEnd(mseq[s].getEnd());
+ }
+ if (order != null)
+ {
+ order.updateSequence(mseq[s], alignment[s]);
+ }
+ }
+ }
+ }
+ else
+ {
+ // recover original alignment block or place gaps
+ if (true)
+ {
+ // recover input data
+ for (int s = 0; s < sequences.length; s++)
+ {
+ SequenceI oseq = sequences[s].getSeq(gapCharacter)
+ .getSubSequence(start, contigs[contig + 1]);
+ if (swidth < oseq.getLength())
+ {
+ swidth = oseq.getLength();
+ }
+ if (alignment[s] == null)
+ {
+ alignment[s] = oseq;
+ }
+ else
+ {
+ alignment[s].setSequence(alignment[s]
+ .getSequenceAsString()
+ + oseq.getSequenceAsString());
+ if (oseq.getEnd() >= oseq.getStart())
+ {
+ alignment[s].setEnd(oseq.getEnd());
+ }
+ }
+ }
+
+ }
+ j++;
+ }
+ nwidth += swidth;
+ }
+ // advance to begining of visible region
+ start = contigs[contig + 1] + contigs[contig + 2];
+ // add hidden segment to right of next region
+ for (int s = 0; s < sequences.length; s++)
+ {
+ SequenceI hseq = sequences[s].getSeq(gapCharacter)
+ .getSubSequence(contigs[contig + 1], start);
+ if (alignment[s] == null)
+ {
+ alignment[s] = hseq;
+ }
+ else
+ {
+ alignment[s].setSequence(alignment[s].getSequenceAsString()
+ + hseq.getSequenceAsString());
+ if (hseq.getEnd() >= hseq.getStart())
+ {
+ alignment[s].setEnd(hseq.getEnd());
+ }
+ }
+ }
+ // mark hidden segment as hidden in the new alignment
+ columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2]
+ - 1);
+ nwidth += contigs[contig + 2];
+ }
+ // Do final segment - if it exists
+ if (j < nvismsa.length)
+ {
+ int swidth = 0;
+ if (nvismsa[j] != null)
+ {
+ SequenceI mseq[] = nvismsa[j];
+ AlignmentOrder order = (orders != null) ? orders[j] : null;
+ swidth = mseq[0].getLength();
+ for (int s = 0; s < mseq.length; s++)
+ {
+ if (alignment[s] == null)
+ {
+ alignment[s] = mseq[s];
+ }
+ else
+ {
+ alignment[s].setSequence(alignment[s].getSequenceAsString()
+ + mseq[s].getSequenceAsString());
+ if (mseq[s].getEnd() >= mseq[s].getStart())
+ {
+ alignment[s].setEnd(mseq[s].getEnd());
+ }
+ if (order != null)
+ {
+ order.updateSequence(mseq[s], alignment[s]);
+ }
+ }
+ }
+ }
+ else
+ {
+ if (start < owidth)
+ {
+ // recover input data or place gaps
+ if (true)
+ {
+ // recover input data
+ for (int s = 0; s < sequences.length; s++)
+ {
+ SequenceI oseq = sequences[s].getSeq(gapCharacter)
+ .getSubSequence(start, owidth + 1);
+ if (swidth < oseq.getLength())
+ {
+ swidth = oseq.getLength();
+ }
+ if (alignment[s] == null)
+ {
+ alignment[s] = oseq;
+ }
+ else
+ {
+ alignment[s].setSequence(alignment[s]
+ .getSequenceAsString()
+ + oseq.getSequenceAsString());
+ if (oseq.getEnd() >= oseq.getStart())
+ {
+ alignment[s].setEnd(oseq.getEnd());
+ }
+ }
+ }
+ nwidth += swidth;
+ }
+ else
+ {
+ // place gaps.
+ throw new Error(
+ MessageManager
+ .getString("error.padding_not_yet_implemented"));
+ }
+ }
+ }
+ }
+ }
+ return new Object[] { alignment, columnselection };
+ }
+ else
+ {
+ if (nvismsa.length != 1)
+ {
+ throw new Error(
+ MessageManager
+ .formatMessage(
+ "error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view",
+ new String[] { Integer.valueOf(
+ nvismsa.length).toString() }));
+ }
+ if (nvismsa[0] != null)
+ {
+ return new Object[] { nvismsa[0], new ColumnSelection() };
+ }
+ else
+ {
+ return getAlignmentAndColumnSelection(gapCharacter);
+ }
+ }
+ }
+
+ /**
+ * returns simple array of start end positions of visible range on alignment.
+ * vis_start and vis_end are inclusive - use
+ * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence
+ * from underlying alignment.
+ *
+ * @return int[] { start_i, end_i } for 1<i<n visible regions.
+ */
+ public int[] getVisibleContigs()
+ {
+ if (contigs != null && contigs.length > 0)
+ {
+ int start = 0;
+ int nvis = 0;
+ int fwidth = width;
+ for (int contig = 0; contig < contigs.length; contig += 3)
+ {
+ if ((contigs[contig + 1] - start) > 0)
+ {
+ nvis++;
+ }
+ fwidth += contigs[contig + 2]; // end up with full region width
+ // (including hidden regions)
+ start = contigs[contig + 1] + contigs[contig + 2];
+ }
+ if (start < fwidth)
+ {
+ nvis++;
+ }
+ int viscontigs[] = new int[nvis * 2];
+ nvis = 0;
+ start = 0;
+ for (int contig = 0; contig < contigs.length; contig += 3)
+ {
+ if ((contigs[contig + 1] - start) > 0)
+ {
+ viscontigs[nvis] = start;
+ viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive
+ nvis += 2;
+ }
+ start = contigs[contig + 1] + contigs[contig + 2];
+ }
+ if (start < fwidth)
+ {
+ viscontigs[nvis] = start;
+ viscontigs[nvis + 1] = fwidth; // end is inclusive
+ nvis += 2;
+ }
+ return viscontigs;
+ }
+ else
+ {
+ return new int[] { 0, width };
+ }
+ }
+
+ /**
+ *
+ * @return position of first visible column of AlignmentView within its
+ * parent's alignment reference frame
+ */
+ public int getAlignmentOrigin()
+ {
+ return firstCol;
+ }
+
+ /**
+ * compute a deletion map for the current view according to the given
+ * gap/match map
+ *
+ * @param gapMap
+ * (as returned from SequenceI.gapMap())
+ * @return int[] {intersection of visible regions with gapMap)
+ */
+ public int[] getVisibleContigMapFor(int[] gapMap)
+ {
+ int[] delMap = null;
+ int[] viscontigs = getVisibleContigs();
+ int spos = 0;
+ int i = 0;
+ if (viscontigs != null)
+ {
+ // viscontigs maps from a subset of the gapMap to the gapMap, so it will
+ // always be equal to or shorter than gapMap
+ delMap = new int[gapMap.length];
+ for (int contig = 0; contig < viscontigs.length; contig += 2)
+ {
+
+ while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
+ {
+ spos++;
+ }
+ while (spos < gapMap.length
+ && gapMap[spos] <= viscontigs[contig + 1])
+ {
+ delMap[i++] = spos++;
+ }
+ }
+ int tmap[] = new int[i];
+ System.arraycopy(delMap, 0, tmap, 0, i);
+ delMap = tmap;
+ }
+ return delMap;
+ }
+
+ /**
+ * apply the getSeq(gc) method to each sequence cigar, and return the array of
+ * edited sequences, optionally with hidden regions removed.
+ *
+ * @param gc
+ * gap character to use for insertions
+ * @param delete
+ * remove hidden regions from sequences. Note: currently implemented
+ * in a memory inefficient way - space needed is 2*result set for
+ * deletion
+ *
+ * @return SequenceI[]
+ */
+ public SequenceI[] getEditedSequences(char gc, boolean delete)
+ {
+ SeqCigar[] msf = getSequences();
+ SequenceI[] aln = new SequenceI[msf.length];
+ for (int i = 0, j = msf.length; i < j; i++)
+ {
+ aln[i] = msf[i].getSeq(gc);
+ }
+ if (delete)
+ {
+ String[] sqs = getSequenceStrings(gc);
+ for (int i = 0; i < sqs.length; i++)
+ {
+ aln[i].setSequence(sqs[i]);
+ sqs[i] = null;
+ }
+ }
+ return aln;
+ }
+
+ public static void summariseAlignmentView(AlignmentView view,
+ PrintStream os)
+ {
+ os.print("View has " + view.sequences.length + " of which ");
+ if (view.selected == null)
+ {
+ os.print("None");
+ }
+ else
+ {
+ os.print(" " + view.selected.size());
+ }
+ os.println(" are selected.");
+ os.print("View is " + view.getWidth() + " columns wide");
+ int viswid = 0;
+ int[] contigs = view.getContigs();
+ if (contigs != null)
+ {
+ viswid = view.width;
+ for (int i = 0; i < contigs.length; i += 3)
+ {
+ viswid += contigs[i + 2];
+ }
+ os.println("with " + viswid + " visible columns spread over "
+ + contigs.length / 3 + " regions.");
+ }
+ else
+ {
+ viswid = view.width;
+ os.println(".");
+ }
+ if (view.scGroups != null)
+ {
+ os.println("There are " + view.scGroups.size()
+ + " groups defined on the view.");
+ for (int g = 0; g < view.scGroups.size(); g++)
+ {
+ ScGroup sgr = view.scGroups.get(g);
+ os.println("Group " + g + ": Name = " + sgr.sg.getName()
+ + " Contains " + sgr.seqs.size() + " Seqs.");
+ os.println("This group runs from " + sgr.sg.getStartRes() + " to "
+ + sgr.sg.getEndRes());
+ for (int s = 0; s < sgr.seqs.size(); s++)
+ {
+ if (!((SeqCigar) sgr.seqs.elementAt(s)).isMemberOf(sgr))
+ {
+ os.println("** WARNING: sequence "
+ + ((SeqCigar) sgr.seqs.elementAt(s)).toString()
+ + " is not marked as member of group.");
+ }
+ }
+ }
+ AlignmentI visal = view.getVisibleAlignment('-');
+ if (visal != null)
+ {
+ os.println("Vis. alignment is " + visal.getWidth()
+ + " wide and has " + visal.getHeight() + " seqs.");
+ if (visal.getGroups() != null && visal.getGroups().size() > 0)
+ {
+
+ int i = 1;
+ for (SequenceGroup sg : visal.getGroups())
+ {
+ os.println("Group " + (i++) + " begins at column "
+ + sg.getStartRes() + " and ends at " + sg.getEndRes());
+ }
+ }
+ }
+ }
+ }
+
+ public static void testSelectionViews(AlignmentI alignment,
+ ColumnSelection csel, SequenceGroup selection)
+ {
+ System.out.println("Testing standard view creation:\n");
+ AlignmentView view = null;
+ try
+ {
+ System.out
+ .println("View with no hidden columns, no limit to selection, no groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, false, false,
+ false);
+ summariseAlignmentView(view, System.out);
+
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View with no hidden columns, no limit to selection, and all groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, false, false,
+ true);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection marked but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View with no hidden columns, limited to selection and no groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, false, true,
+ false);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection restricted but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View with no hidden columns, limited to selection, and all groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, false, true,
+ true);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection restricted and groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View *with* hidden columns, no limit to selection, no groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, true, false,
+ false);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View *with* hidden columns, no limit to selection, and all groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, true, false,
+ true);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection marked but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View *with* hidden columns, limited to selection and no groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, true, true,
+ false);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection restricted but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View *with* hidden columns, limited to selection, and all groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, true, true, true);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection restricted and groups marked.");
+ }
+
+ }
+}
diff --git a/src/jalview/datamodel/AnnotatedCollectionI.java b/src/jalview/datamodel/AnnotatedCollectionI.java
new file mode 100644
index 0000000..0c159b3
--- /dev/null
+++ b/src/jalview/datamodel/AnnotatedCollectionI.java
@@ -0,0 +1,46 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+public interface AnnotatedCollectionI extends SequenceCollectionI
+{
+
+ /**
+ * TODO: decide if null is a valid response if there is no annotation on the
+ * object
+ *
+ * @return null
+ */
+ AlignmentAnnotation[] getAlignmentAnnotation();
+
+ Iterable<AlignmentAnnotation> findAnnotation(String calcId);
+
+ Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
+ String calcId, String label);
+
+ /**
+ * context for this annotated collection
+ *
+ * @return null or the collection upon which this collection is defined (e.g.
+ * alignment, parent group).
+ */
+ AnnotatedCollectionI getContext();
+}
diff --git a/src/jalview/datamodel/Annotation.java b/src/jalview/datamodel/Annotation.java
index 609158d..1900826 100644
--- a/src/jalview/datamodel/Annotation.java
+++ b/src/jalview/datamodel/Annotation.java
@@ -1,47 +1,54 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.awt.*;
+import java.awt.Color;
/**
- * DOCUMENT ME!
+ * Holds all annotation values for a position in an AlignmentAnnotation row
*
* @author $author$
* @version $Revision$
*/
public class Annotation
{
- /** DOCUMENT ME!! */
+ /** Character label - also shown below histogram */
public String displayCharacter = "";
- /** DOCUMENT ME!! */
- public String description = ""; // currently used as mouse over
+ /**
+ * Text label for position: shown in mouse over and displayed on secondary
+ * structure glyphs
+ */
+ public String description = "";
- /** DOCUMENT ME!! */
- public char secondaryStructure = ' '; // recognises H and E
+ /**
+ * Secondary structure symbol: Protein symbols are H, E and S(?), RNA are
+ * WUSS/Vienna plus extended pseudoknot symbols
+ */
+ public char secondaryStructure = ' ';
- /** DOCUMENT ME!! */
+ /** Score for the position - used in histograms, line graphs and for shading */
public float value;
- // add visual cues here
-
- /** DOCUMENT ME!! */
+ /** Colour for position */
public Color colour;
/**
@@ -62,6 +69,7 @@ public class Annotation
description = desc;
secondaryStructure = ss;
value = val;
+
}
/**
@@ -99,12 +107,17 @@ public class Annotation
return;
}
if (that.displayCharacter != null)
+ {
displayCharacter = new String(that.displayCharacter);
+ }
if (that.description != null)
+ {
description = new String(that.description);
+ }
secondaryStructure = that.secondaryStructure;
value = that.value;
colour = that.colour;
+
}
/**
@@ -115,6 +128,68 @@ public class Annotation
*/
public Annotation(float val)
{
- this(null, null, ' ', val);
+ this(null, null, ' ', val, null);
+ }
+
+ /**
+ * human readable representation of an annotation row element.
+ *
+ * Format is 'display Char','secondary Structure
+ * Char',"description",score,[colourstring]
+ *
+ * fields may be missing if they are null, whitespace, or equivalent to
+ * Float.NaN
+ */
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ if (displayCharacter != null)
+ {
+ sb.append("\'");
+ sb.append(displayCharacter);
+ sb.append("\'");
+ }
+ {
+ sb.append(",");
+ }
+ if (secondaryStructure != 0
+ && !("" + displayCharacter).equals("" + secondaryStructure))
+ {
+ sb.append("\'");
+ sb.append(secondaryStructure);
+ sb.append("\'");
+ }
+ {
+ sb.append(",");
+ }
+ if (description != null && description.length() > 0)
+ {
+ sb.append("\"");
+ sb.append(description);
+ sb.append("\"");
+ }
+ {
+ sb.append(",");
+ }
+ if (!Float.isNaN(value))
+ {
+ sb.append(value);
+ }
+ if (colour != null)
+ {
+ if (sb.length() > 0)
+ {
+ sb.append(",");
+ }
+ sb.append("[");
+ sb.append(colour.getRed());
+ sb.append(",");
+ sb.append(colour.getGreen());
+ sb.append(",");
+ sb.append(colour.getBlue());
+ sb.append("]");
+ }
+ return sb.toString();
}
}
diff --git a/src/jalview/datamodel/BinaryNode.java b/src/jalview/datamodel/BinaryNode.java
index 451e7b5..ec6e346 100644
--- a/src/jalview/datamodel/BinaryNode.java
+++ b/src/jalview/datamodel/BinaryNode.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
diff --git a/src/jalview/datamodel/BinarySequence.java b/src/jalview/datamodel/BinarySequence.java
index 9d6f5e8..ff2784d 100644
--- a/src/jalview/datamodel/BinarySequence.java
+++ b/src/jalview/datamodel/BinarySequence.java
@@ -1,77 +1,112 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import jalview.schemes.*;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.ScoreMatrix;
/**
- * DOCUMENT ME!
+ * Encode a sequence as a numeric vector using either classic residue binary
+ * encoding or convolved with residue substitution matrix.
*
* @author $author$
* @version $Revision$
*/
public class BinarySequence extends Sequence
{
+ public class InvalidSequenceTypeException extends Exception
+ {
+
+ public InvalidSequenceTypeException(String string)
+ {
+ super(string);
+ }
+
+ }
+
int[] binary;
double[] dbinary;
+ boolean isNa = false;
+
/**
* Creates a new BinarySequence object.
*
* @param s
* DOCUMENT ME!
*/
- public BinarySequence(String s)
+ public BinarySequence(String s, boolean isNa)
{
super("", s, 0, s.length());
+ this.isNa = isNa;
}
/**
- * DOCUMENT ME!
+ * clear the dbinary matrix
+ *
+ * @return nores - dimension of sequence symbol encoding for this sequence
*/
- public void encode()
+ private int initMatrixGetNoRes()
{
+ int nores = (isNa) ? ResidueProperties.maxNucleotideIndex
+ : ResidueProperties.maxProteinIndex;
// Set all matrix to 0
- dbinary = new double[getSequence().length * 21];
-
- int nores = 21;
+ dbinary = new double[getSequence().length * nores];
for (int i = 0; i < dbinary.length; i++)
{
dbinary[i] = 0.0;
}
+ return nores;
+ }
+ private int[] getSymbolmatrix()
+ {
+ return (isNa) ? ResidueProperties.nucleotideIndex
+ : ResidueProperties.aaIndex;
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void encode()
+ {
+ int nores = initMatrixGetNoRes();
+ final int[] sindex = getSymbolmatrix();
for (int i = 0; i < getSequence().length; i++)
{
- int aanum = 20;
+ int aanum = nores - 1;
try
{
- aanum = ResidueProperties.aaIndex[getCharAt(i)];
+ aanum = sindex[getCharAt(i)];
} catch (NullPointerException e)
{
- aanum = 20;
+ aanum = nores - 1;
}
- if (aanum > 20)
+ if (aanum >= nores)
{
- aanum = 20;
+ aanum = nores - 1;
}
dbinary[(i * nores) + aanum] = 1.0;
@@ -83,50 +118,50 @@ public class BinarySequence extends Sequence
*
* @param matrix
*/
- public void matrixEncode(ScoreMatrix matrix)
+ public void matrixEncode(final ScoreMatrix matrix)
+ throws InvalidSequenceTypeException
{
+ if (isNa != matrix.isDNA())
+ {
+ throw new InvalidSequenceTypeException("matrix "
+ + matrix.getClass().getCanonicalName()
+ + " is not a valid matrix for "
+ + (isNa ? "nucleotide" : "protein") + "sequences");
+ }
matrixEncode(matrix.isDNA() ? ResidueProperties.nucleotideIndex
: ResidueProperties.aaIndex, matrix.getMatrix());
}
- /**
- * DOCUMENT ME!
- */
- public void blosumEncode()
- {
- matrixEncode(ResidueProperties.aaIndex, ResidueProperties.getBLOSUM62());
- }
-
- private void matrixEncode(int[] aaIndex, int[][] matrix)
+ private void matrixEncode(final int[] aaIndex, final int[][] matrix)
{
// Set all matrix to 0
- dbinary = new double[getSequence().length * 21];
+ // dbinary = new double[getSequence().length * 21];
- int nores = 21;
+ int nores = initMatrixGetNoRes();
// for (int i = 0; i < dbinary.length; i++) {
// dbinary[i] = 0.0;
// }
- for (int i = 0; i < getSequence().length; i++)
+ for (int i = 0, iSize = getSequence().length; i < iSize; i++)
{
- int aanum = 20;
+ int aanum = nores - 1;
try
{
aanum = aaIndex[getCharAt(i)];
} catch (NullPointerException e)
{
- aanum = 20;
+ aanum = nores - 1;
}
- if (aanum > 20)
+ if (aanum >= nores)
{
- aanum = 20;
+ aanum = nores - 1;
}
- // Do the blosum thing
+ // Do the blosum^H^H^H^H^H score matrix summation thing
- for (int j = 0; j < 20; j++)
+ for (int j = 0; j < nores; j++)
{
dbinary[(i * nores) + j] = matrix[aanum][j];
}
diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java
index 78d34ed..61f3c33 100644
--- a/src/jalview/datamodel/CigarArray.java
+++ b/src/jalview/datamodel/CigarArray.java
@@ -1,379 +1,401 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-import java.util.Vector;
-
-public class CigarArray extends CigarBase
-{
- /**
- * Do CIGAR operations on a set of sequences from many other cigars BAD THINGS
- * WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY or a CIGARCIGAR is
- * given a CIGARARRAY to insert gaps into.
- */
- /**
- * array of subject cigars
- */
- public CigarSimple refCigars[] = null;
-
- private boolean seqcigararray = false;
-
- private CigarArray()
- {
- super();
- }
-
- /**
- * isSeqCigarArray()
- *
- * @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar
- */
- public boolean isSeqCigarArray()
- {
- return seqcigararray;
- }
-
- /**
- * Apply CIGAR operations to several cigars in parallel will throw an error if
- * any of cigar are actually CigarArrays.
- *
- * @param cigar
- * Cigar[]
- */
- public CigarArray(CigarSimple[] cigars)
- {
- super();
- seqcigararray = true;
- if (cigars != null && cigars.length > 0)
- {
- refCigars = new CigarSimple[cigars.length];
- for (int c = 0; c < cigars.length; c++)
- {
- refCigars[c] = cigars[c];
- if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar))
- {
- seqcigararray = false;
- }
- }
- }
- }
-
- /**
- * construct a cigar array from the current alignment, or just the subset of the current alignment specified by selectionGroup. Any columns marked as hidden in columnSelection will be marked as deleted in the array.
- * @param alignment
- * @param columnSelection
- * @param selectionGroup
- */
- public CigarArray(AlignmentI alignment, ColumnSelection columnSelection, SequenceGroup selectionGroup)
- {
- this(constructSeqCigarArray(alignment, selectionGroup));
- constructFromAlignment(alignment, columnSelection!=null ? columnSelection.getHiddenColumns() : null, selectionGroup);
- }
- private static int[] _calcStartEndBounds(AlignmentI alignment, SequenceGroup selectionGroup)
- {
- int[] startend = new int[] { 0,0,0};
- if (selectionGroup != null)
- {
- startend[0] = selectionGroup.getSize();
- startend[1] = selectionGroup.getStartRes();
- startend[2] = selectionGroup.getEndRes(); // inclusive for start and end in
- // SeqCigar constructor
- }
- else
- {
- startend[0] = alignment.getHeight();
- startend[2] = alignment.getWidth() - 1;
- }
- return startend;
- }
- public static SeqCigar[] constructSeqCigarArray(AlignmentI alignment, SequenceGroup selectionGroup)
- {
- SequenceI[] seqs = null;
- int i, iSize;
- int _startend[] = _calcStartEndBounds(alignment, selectionGroup);
- int start = _startend[1],end=_startend[2];
- if (selectionGroup != null)
- {
- iSize = selectionGroup.getSize();
- seqs = selectionGroup.getSequencesInOrder(alignment);
- start = selectionGroup.getStartRes();
- end = selectionGroup.getEndRes(); // inclusive for start and end in
- // SeqCigar constructor
- }
- else
- {
- iSize = alignment.getHeight();
- seqs = alignment.getSequencesArray();
- end = alignment.getWidth() - 1;
- }
- SeqCigar[] selseqs = new SeqCigar[iSize];
- for (i = 0; i < iSize; i++)
- {
- selseqs[i] = new SeqCigar(seqs[i], start, end);
- }
- return selseqs;
- }
- /**
- * internal constructor function - called by CigarArray(AlignmentI, ...);
- * @param alignment
- * @param columnSelection - vector of visible regions as returned from columnSelection.getHiddenColumns()
- * @param selectionGroup
- */
- private void constructFromAlignment(AlignmentI alignment, Vector columnSelection, SequenceGroup selectionGroup)
- {
- int[] _startend = _calcStartEndBounds(alignment, selectionGroup);
- int start = _startend[1],end=_startend[2];
- // now construct the CigarArray operations
- if (columnSelection!=null)
- {
- int[] region;
- int hideStart, hideEnd;
- int last = start;
- for (int j = 0; last < end & j < columnSelection.size(); j++)
- {
- region = (int[]) columnSelection.elementAt(j);
- hideStart = region[0];
- hideEnd = region[1];
- // edit hidden regions to selection range
- if (hideStart < last)
- {
- if (hideEnd > last)
- {
- hideStart = last;
- }
- else
- {
- continue;
- }
- }
-
- if (hideStart > end)
- {
- break;
- }
-
- if (hideEnd > end)
- {
- hideEnd = end;
- }
-
- if (hideStart > hideEnd)
- {
- break;
- }
- /**
- * form operations...
- */
- if (last < hideStart)
- {
- addOperation(CigarArray.M, hideStart - last);
- }
- addOperation(CigarArray.D, 1 + hideEnd - hideStart);
- last = hideEnd + 1;
- }
- // Final match if necessary.
- if (last < end)
- {
- addOperation(CigarArray.M, end - last + 1);
- }
- }
- else
- {
- addOperation(CigarArray.M, end - start + 1);
- }
- }
-
- /**
- * @see Cigar.getSequenceAndDeletions
- * @param GapChar
- * char
- * @return Object[][]
- */
- protected Object[][] getArrayofSequenceAndDeletions(char GapChar)
- {
- if (refCigars == null || refCigars.length == 0 || length == 0)
- {
- return null;
- }
- Object[][] sqanddels = new Object[refCigars.length][];
- for (int c = 0; c < refCigars.length; c++)
- {
- String refString = refCigars[c].getSequenceString(GapChar);
- if (refString != null)
- {
- sqanddels[c] = getSequenceAndDeletions(refString, GapChar);
- }
- else
- {
- sqanddels[c] = null;
- }
- }
- return sqanddels;
- }
-
- /**
- * NOTE: this is an improper sequence string function
- *
- * @return String formed by newline concatenated results of applying CIGAR
- * operations to each reference object in turn.
- * @param GapChar
- * char
- * @return '\n' separated strings (empty results included as \n\n)
- */
- public String getSequenceString(char GapChar)
- {
- if (length == 0 || refCigars == null)
- {
- return "";
- }
- StringBuffer seqStrings = new StringBuffer();
- Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);
- for (int c = 0; c < refCigars.length; c++)
- {
- if (sqanddels[c] != null)
- {
- seqStrings.append((String) sqanddels[c][0]);
- sqanddels[c][0] = null;
- }
- seqStrings.append('\n');
- }
- return seqStrings.toString();
- }
-
- /**
- * return string results of applying cigar string to all reference cigars
- *
- * @param GapChar
- * char
- * @return String[]
- */
- public String[] getSequenceStrings(char GapChar)
- {
-
- if (length == 0 || refCigars == null || refCigars.length == 0)
- {
- return null;
- }
- Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);
- String[] seqs = new String[sqanddels.length];
- for (int c = 0; c < refCigars.length; c++)
- {
- seqs[c] = (String) sqanddels[c][0];
- }
- return seqs;
- }
-
- /**
- * Combines the CigarArray cigar operations with the operations in each
- * reference cigar - creating a new reference cigar
- *
- * @return Cigar[]
- *
- * public CigarBase[] getEditedCigars() {
- *
- * return new CigarBase[] {}; }
- */
- /**
- * applyDeletions edits underlying refCigars to propagate deleted regions, and
- * removes deletion operations from CigarArray operation list.
- *
- * @return int[] position after deletion occured and range of deletion in
- * cigarArray or null if none occured
- */
- public int[] applyDeletions()
- {
- java.util.Vector delpos = null;
- if (length == 0)
- {
- return null;
- }
- int cursor = 0; // range counter for deletions
- int vcursor = 0; // visible column index
- int offset = 0; // shift in visible column index as deletions are made
- int i = 0;
- while (i < length)
- {
- if (operation[i] != D)
- {
- if (operation[i] == M)
- {
- cursor += range[i];
- }
- vcursor += range[i++];
- }
- else
- {
- if (delpos == null)
- {
- delpos = new java.util.Vector();
- }
- int delstart = cursor, delend = cursor + range[i] - 1; // inclusive
- delpos.addElement(new int[]
- { vcursor + offset, range[i] }); // index of right hand column after
- // hidden region boundary
- offset += range[i] - 1; // shift in visible column coordinates
- System.arraycopy(operation, i + 1, operation, i, length - i);
- System.arraycopy(range, i + 1, range, i, length - i);
- length--;
- /*
- * int dmax=0; for (int s=0; s<refCigars.length; s++) { int d =
- * refCigars[s].deleteRange(delstart, delend); if (d>dmax) dmax=d; }
- * offset+=dmax; // shift in visible column coordinates
- */
- for (int s = 0; s < refCigars.length; s++)
- {
- int d = refCigars[s].deleteRange(delstart, delend);
- }
-
- }
- }
- if (delpos != null)
- {
- int[] pos = new int[delpos.size() * 2];
- for (int k = 0, l = delpos.size(); k < l; k++)
- {
- int[] dr = ((int[]) delpos.elementAt(k));
- pos[k * 2] = dr[0];
- pos[k * 2 + 1] = dr[1];
- delpos.setElementAt(null, k);
- }
- delpos = null;
- return pos;
- }
- return null;
- }
-
- /**
- *
- * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does
- * not resolve to set of seqCigars)
- */
- public SeqCigar[] getSeqCigarArray()
- {
- if (!isSeqCigarArray())
- {
- return null;
- }
- SeqCigar[] sa = new SeqCigar[refCigars.length];
- for (int i = 0; i < refCigars.length; i++)
- {
- sa[i] = (SeqCigar) refCigars[i];
- }
- return sa;
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import java.util.List;
+
+public class CigarArray extends CigarBase
+{
+ /**
+ * Do CIGAR operations on a set of sequences from many other cigars BAD THINGS
+ * WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY or a CIGARCIGAR is
+ * given a CIGARARRAY to insert gaps into.
+ */
+ /**
+ * array of subject cigars
+ */
+ public CigarSimple refCigars[] = null;
+
+ private boolean seqcigararray = false;
+
+ private CigarArray()
+ {
+ super();
+ }
+
+ /**
+ * isSeqCigarArray()
+ *
+ * @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar
+ */
+ public boolean isSeqCigarArray()
+ {
+ return seqcigararray;
+ }
+
+ /**
+ * Apply CIGAR operations to several cigars in parallel will throw an error if
+ * any of cigar are actually CigarArrays.
+ *
+ * @param cigar
+ * Cigar[]
+ */
+ public CigarArray(CigarSimple[] cigars)
+ {
+ super();
+ seqcigararray = true;
+ if (cigars != null && cigars.length > 0)
+ {
+ refCigars = new CigarSimple[cigars.length];
+ for (int c = 0; c < cigars.length; c++)
+ {
+ refCigars[c] = cigars[c];
+ if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar))
+ {
+ seqcigararray = false;
+ }
+ }
+ }
+ }
+
+ /**
+ * construct a cigar array from the current alignment, or just the subset of
+ * the current alignment specified by selectionGroup. Any columns marked as
+ * hidden in columnSelection will be marked as deleted in the array.
+ *
+ * @param alignment
+ * @param columnSelection
+ * @param selectionGroup
+ */
+ public CigarArray(AlignmentI alignment, ColumnSelection columnSelection,
+ SequenceGroup selectionGroup)
+ {
+ this(constructSeqCigarArray(alignment, selectionGroup));
+ constructFromAlignment(alignment,
+ columnSelection != null ? columnSelection.getHiddenColumns()
+ : null, selectionGroup);
+ }
+
+ private static int[] _calcStartEndBounds(AlignmentI alignment,
+ SequenceGroup selectionGroup)
+ {
+ int[] startend = new int[] { 0, 0, 0 };
+ if (selectionGroup != null)
+ {
+ startend[0] = selectionGroup.getSize();
+ startend[1] = selectionGroup.getStartRes();
+ startend[2] = selectionGroup.getEndRes(); // inclusive for start and end
+ // in
+ // SeqCigar constructor
+ }
+ else
+ {
+ startend[0] = alignment.getHeight();
+ startend[2] = alignment.getWidth() - 1;
+ }
+ return startend;
+ }
+
+ public static SeqCigar[] constructSeqCigarArray(AlignmentI alignment,
+ SequenceGroup selectionGroup)
+ {
+ SequenceI[] seqs = null;
+ int i, iSize;
+ int _startend[] = _calcStartEndBounds(alignment, selectionGroup);
+ int start = _startend[1], end = _startend[2];
+ if (selectionGroup != null)
+ {
+ iSize = selectionGroup.getSize();
+ seqs = selectionGroup.getSequencesInOrder(alignment);
+ start = selectionGroup.getStartRes();
+ end = selectionGroup.getEndRes(); // inclusive for start and end in
+ // SeqCigar constructor
+ }
+ else
+ {
+ iSize = alignment.getHeight();
+ seqs = alignment.getSequencesArray();
+ end = alignment.getWidth() - 1;
+ }
+ SeqCigar[] selseqs = new SeqCigar[iSize];
+ for (i = 0; i < iSize; i++)
+ {
+ selseqs[i] = new SeqCigar(seqs[i], start, end);
+ }
+ return selseqs;
+ }
+
+ /**
+ * internal constructor function - called by CigarArray(AlignmentI, ...);
+ *
+ * @param alignment
+ * @param list
+ * - vector of visible regions as returned from
+ * columnSelection.getHiddenColumns()
+ * @param selectionGroup
+ */
+ private void constructFromAlignment(AlignmentI alignment,
+ List<int[]> list, SequenceGroup selectionGroup)
+ {
+ int[] _startend = _calcStartEndBounds(alignment, selectionGroup);
+ int start = _startend[1], end = _startend[2];
+ // now construct the CigarArray operations
+ if (list != null)
+ {
+ int[] region;
+ int hideStart, hideEnd;
+ int last = start;
+ for (int j = 0; last < end & j < list.size(); j++)
+ {
+ region = list.get(j);
+ hideStart = region[0];
+ hideEnd = region[1];
+ // edit hidden regions to selection range
+ if (hideStart < last)
+ {
+ if (hideEnd > last)
+ {
+ hideStart = last;
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ if (hideStart > end)
+ {
+ break;
+ }
+
+ if (hideEnd > end)
+ {
+ hideEnd = end;
+ }
+
+ if (hideStart > hideEnd)
+ {
+ break;
+ }
+ /**
+ * form operations...
+ */
+ if (last < hideStart)
+ {
+ addOperation(CigarArray.M, hideStart - last);
+ }
+ addOperation(CigarArray.D, 1 + hideEnd - hideStart);
+ last = hideEnd + 1;
+ }
+ // Final match if necessary.
+ if (last < end)
+ {
+ addOperation(CigarArray.M, end - last + 1);
+ }
+ }
+ else
+ {
+ addOperation(CigarArray.M, end - start + 1);
+ }
+ }
+
+ /**
+ * @see Cigar.getSequenceAndDeletions
+ * @param GapChar
+ * char
+ * @return Object[][]
+ */
+ protected Object[][] getArrayofSequenceAndDeletions(char GapChar)
+ {
+ if (refCigars == null || refCigars.length == 0 || length == 0)
+ {
+ return null;
+ }
+ Object[][] sqanddels = new Object[refCigars.length][];
+ for (int c = 0; c < refCigars.length; c++)
+ {
+ String refString = refCigars[c].getSequenceString(GapChar);
+ if (refString != null)
+ {
+ sqanddels[c] = getSequenceAndDeletions(refString, GapChar);
+ }
+ else
+ {
+ sqanddels[c] = null;
+ }
+ }
+ return sqanddels;
+ }
+
+ /**
+ * NOTE: this is an improper sequence string function
+ *
+ * @return String formed by newline concatenated results of applying CIGAR
+ * operations to each reference object in turn.
+ * @param GapChar
+ * char
+ * @return '\n' separated strings (empty results included as \n\n)
+ */
+ public String getSequenceString(char GapChar)
+ {
+ if (length == 0 || refCigars == null)
+ {
+ return "";
+ }
+ StringBuffer seqStrings = new StringBuffer();
+ Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);
+ for (int c = 0; c < refCigars.length; c++)
+ {
+ if (sqanddels[c] != null)
+ {
+ seqStrings.append((String) sqanddels[c][0]);
+ sqanddels[c][0] = null;
+ }
+ seqStrings.append('\n');
+ }
+ return seqStrings.toString();
+ }
+
+ /**
+ * return string results of applying cigar string to all reference cigars
+ *
+ * @param GapChar
+ * char
+ * @return String[]
+ */
+ public String[] getSequenceStrings(char GapChar)
+ {
+
+ if (length == 0 || refCigars == null || refCigars.length == 0)
+ {
+ return null;
+ }
+ Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);
+ String[] seqs = new String[sqanddels.length];
+ for (int c = 0; c < refCigars.length; c++)
+ {
+ seqs[c] = (String) sqanddels[c][0];
+ }
+ return seqs;
+ }
+
+ /**
+ * Combines the CigarArray cigar operations with the operations in each
+ * reference cigar - creating a new reference cigar
+ *
+ * @return Cigar[]
+ *
+ * public CigarBase[] getEditedCigars() {
+ *
+ * return new CigarBase[] {}; }
+ */
+ /**
+ * applyDeletions edits underlying refCigars to propagate deleted regions, and
+ * removes deletion operations from CigarArray operation list.
+ *
+ * @return int[] position after deletion occured and range of deletion in
+ * cigarArray or null if none occured
+ */
+ public int[] applyDeletions()
+ {
+ java.util.Vector delpos = null;
+ if (length == 0)
+ {
+ return null;
+ }
+ int cursor = 0; // range counter for deletions
+ int vcursor = 0; // visible column index
+ int offset = 0; // shift in visible column index as deletions are made
+ int i = 0;
+ while (i < length)
+ {
+ if (operation[i] != D)
+ {
+ if (operation[i] == M)
+ {
+ cursor += range[i];
+ }
+ vcursor += range[i++];
+ }
+ else
+ {
+ if (delpos == null)
+ {
+ delpos = new java.util.Vector();
+ }
+ int delstart = cursor, delend = cursor + range[i] - 1; // inclusive
+ delpos.addElement(new int[] { vcursor + offset, range[i] }); // index of
+ // right
+ // hand
+ // column
+ // after
+ // hidden region boundary
+ offset += range[i] - 1; // shift in visible column coordinates
+ System.arraycopy(operation, i + 1, operation, i, length - i);
+ System.arraycopy(range, i + 1, range, i, length - i);
+ length--;
+ /*
+ * int dmax=0; for (int s=0; s<refCigars.length; s++) { int d =
+ * refCigars[s].deleteRange(delstart, delend); if (d>dmax) dmax=d; }
+ * offset+=dmax; // shift in visible column coordinates
+ */
+ for (int s = 0; s < refCigars.length; s++)
+ {
+ int d = refCigars[s].deleteRange(delstart, delend);
+ }
+
+ }
+ }
+ if (delpos != null)
+ {
+ int[] pos = new int[delpos.size() * 2];
+ for (int k = 0, l = delpos.size(); k < l; k++)
+ {
+ int[] dr = ((int[]) delpos.elementAt(k));
+ pos[k * 2] = dr[0];
+ pos[k * 2 + 1] = dr[1];
+ delpos.setElementAt(null, k);
+ }
+ delpos = null;
+ return pos;
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does
+ * not resolve to set of seqCigars)
+ */
+ public SeqCigar[] getSeqCigarArray()
+ {
+ if (!isSeqCigarArray())
+ {
+ return null;
+ }
+ SeqCigar[] sa = new SeqCigar[refCigars.length];
+ for (int i = 0; i < refCigars.length; i++)
+ {
+ sa[i] = (SeqCigar) refCigars[i];
+ }
+ return sa;
+ }
+}
diff --git a/src/jalview/datamodel/CigarBase.java b/src/jalview/datamodel/CigarBase.java
index df6f5f3..0dfa84d 100644
--- a/src/jalview/datamodel/CigarBase.java
+++ b/src/jalview/datamodel/CigarBase.java
@@ -1,646 +1,660 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-import java.util.*;
-
-public abstract class CigarBase
-{
- /**
- * Base class for compact idiosyncratic representation of gaps and aligned
- * residues Regards to Tom Oldfield for his DynamicArray class. 17th July 2006
- * Not thread safe.
- */
- public CigarBase()
- {
- // nothing to be done (probably)
- }
-
- protected int length = 0;
-
- protected int _inc_length = 10; // extension range for addition of new
-
- // operations
-
- protected char[] operation = null;
-
- protected int[] range = null;
-
- /**
- * Range of Hidden residues in seq (translated as deleted in seq)
- */
- public static final char D = 'D';
-
- /**
- * Range of insertions to seq
- */
- public static final char I = 'I';
-
- /**
- * Range of aligned residues
- */
- public static final char M = 'M';
-
- static protected final char _case_shift = 'a' - 'A';
-
- /**
- * Ugly function to get edited sequence string, start and end symbol positions
- * and the deletion regions as an array of int pairs May return null for an
- * empty cigar string. May return null for deletion ranges if there are none.
- *
- * @param reference
- * - the symbol sequence to apply the cigar operations to (or null if
- * no sequence)
- * @param GapChar
- * - the symbol to use for Insert operations
- * @return Object[] { String, int[] {start, startcol, end, endcol}, int[][3]
- * {start, end, col} or null} the gapped sequence, first and last
- * residue index, and the deletion ranges on the reference sequence
- */
- public Object[] getSequenceAndDeletions(String reference, char GapChar)
- {
- int rlength = 0;
- int[][] deletions = new int[length][];
- int[][] trunc_deletions = null;
- StringBuffer sq = new StringBuffer();
- int cursor = 0, alcursor = 0, start = 0, startpos = 0, end = 0, endpos = 0, delcount = -1;
- boolean consecutive_del = false;
- if (length == 0)
- {
- return null;
- }
- if (reference != null)
- {
- rlength = reference.length();
- }
- boolean modstart = true;
- for (int i = 0; i < length; i++)
- {
- switch (operation[i])
- {
- case D:
- if (!consecutive_del)
- {
- deletions[++delcount] = new int[]
- { cursor, 0, alcursor };
- }
- cursor += range[i];
- deletions[delcount][1] = cursor - 1;
- consecutive_del = true;
- break;
- case I:
- consecutive_del = false;
- for (int r = 0; r < range[i]; r++)
- {
- sq.append(GapChar);
- alcursor++;
- }
- break;
- case M:
- consecutive_del = false;
- if (modstart)
- {
- start = cursor;
- startpos = alcursor;
- modstart = false;
- }
- if (reference != null)
- {
- int sbend = cursor + range[i];
- if (sbend > rlength)
- {
- sq.append(reference.substring(cursor, rlength));
- while (sbend-- >= rlength)
- {
- sq.append(GapChar);
- }
- }
- else
- {
- sq.append(reference.substring(cursor, sbend));
- }
- }
- alcursor += range[i];
- cursor += range[i];
- end = cursor - 1;
- endpos = alcursor;
- break;
- default:
- throw new Error("Unknown SeqCigar operation '" + operation[i] + "'");
- }
- }
- if (++delcount > 0)
- {
- trunc_deletions = new int[delcount][];
- System.arraycopy(deletions, 0, trunc_deletions, 0, delcount);
- }
- deletions = null;
- return new Object[]
- { ((reference != null) ? sq.toString() : null), new int[]
- { start, startpos, end, endpos }, trunc_deletions };
- }
-
- protected void compact_operations()
- {
- int i = 1;
- if (operation == null)
- {
- return;
- }
- char last = operation[0];
- while (i < length)
- {
- if (last == operation[i])
- {
- range[i - 1] += range[i];
- int r = length - i;
- if (r > 0)
- {
- System.arraycopy(range, i + 1, range, i, r);
- System.arraycopy(operation, i + 1, operation, i, r);
- }
- length--;
- }
- else
- {
- last = operation[i++];
- }
- }
- }
-
- /**
- * turn a cigar string into a series of operation range pairs
- *
- * @param cigarString
- * String
- * @return object[] {char[] operation, int[] range}
- * @throws java.lang.Exception
- * for improperly formated cigar strings or ones with unknown
- * operations
- */
- public static Object[] parseCigarString(String cigarString)
- throws Exception
- {
- int ops = 0;
- for (int i = 0, l = cigarString.length(); i < l; i++)
- {
- char c = cigarString.charAt(i);
- if (c == M || c == (M - _case_shift) || c == I
- || c == (I - _case_shift) || c == D || c == (D - _case_shift))
- {
- ops++;
- }
- }
- char[] operation = new char[ops];
- int[] range = new int[ops];
- int op = 0;
- int i = 0, l = cigarString.length();
- while (i < l)
- {
- char c;
- int j = i;
- do
- {
- c = cigarString.charAt(j++);
- } while (c >= '0' && c <= '9' && j < l);
- if (j >= l && c >= '0' && c <= '9')
- {
- throw new Exception("Unterminated cigar string.");
- }
- try
- {
- String rangeint = cigarString.substring(i, j - 1);
- range[op] = Integer.parseInt(rangeint);
- i = j;
- } catch (Exception e)
- {
- throw new Error("Implementation bug in parseCigarString");
- }
- if (c >= 'a' && c <= 'z')
- {
- c -= _case_shift;
- }
- if ((c == M || c == I || c == D))
- {
- operation[op++] = c;
- }
- else
- {
- throw new Exception("Unexpected operation '" + c
- + "' in cigar string (position " + i + " in '"
- + cigarString + "'");
- }
- }
- return new Object[]
- { operation, range };
- }
-
- /**
- * add an operation to cigar string
- *
- * @param op
- * char
- * @param range
- * int
- */
- public void addOperation(char op, int range)
- {
- if (op >= 'a' && op <= 'z')
- {
- op -= _case_shift;
- }
- if (op != M && op != D && op != I)
- {
- throw new Error("Implementation error. Invalid operation string.");
- }
- if (range==0)
- {
- return; // No Operation to add.
- }
- if (range < 0)
- {
- throw new Error(
- "Invalid range string (must be zero or positive number)");
- }
- int lngth = 0;
- if (operation == null)
- {
- this.operation = new char[_inc_length];
- this.range = new int[_inc_length];
- }
- if (length + 1 == operation.length)
- {
- char[] ops = this.operation;
- this.operation = new char[length + 1 + _inc_length];
- System.arraycopy(ops, 0, this.operation, 0, length);
- ops = null;
- int[] rng = this.range;
- this.range = new int[length + 1 + _inc_length];
- System.arraycopy(rng, 0, this.range, 0, length);
- rng = null;
- }
- if ((length > 0) && (operation[length - 1] == op))
- {
- length--; // modify existing operation.
- }
- else
- {
- this.range[length] = 0; // reset range
- }
- this.operation[length] = op;
- this.range[length++] += range;
- }
-
- /**
- * semi-efficient insert an operation on the current cigar string set at
- * column pos (from 1) NOTE: Insertion operations simply extend width of cigar
- * result - affecting registration of alignment Deletion ops will shorten
- * length of result - and affect registration of alignment Match ops will also
- * affect length of result - affecting registration of alignment (ie
- * "10M".insert(4,I,3)->"4M3I3M") - (replace?) (ie
- * "10M".insert(4,D,3)->"4M3D3M") - (shortens alignment) (ie
- * "5I5M".insert(4,I,3)->"8I5M") - real insertion (ie
- * "5I5M".insert(4,D,3)->"4I2D3M") - shortens aligment - I's are removed, Ms
- * changed to Ds (ie "10M".insert(4,M,3)->"13M") - lengthens - Is changed to
- * M, Ds changed to M. (ie "5I5M".insert(4,M,3)->"4I8M") - effectively shifts
- * sequence left by 1 residue and extends it by 3 (
- * "10D5M".insert(-1,M,3)->"3M7D5M") ( "10D5M".insert(0,M,3)->"7D8M") (
- * "10D5M".insert(1,M,3)->"10D8M") ( "1M10D5M".insert(0,M,3)->"1M10D8M") (
- * "1M10D5M".insert(1,M,3)->"
- *
- * if pos is beyond width - I operations are added before the operation
- *
- * @param pos
- * int -1, 0-length of visible region, or greater to append new ops
- * (with insertions in between)
- * @param op
- * char
- * @param range
- * int public void addOperationAt(int pos, char op, int range) { int
- * cursor = -1; // mark the position for the current operation being
- * edited. int o = 0; boolean last_d = false; // previous op was a
- * deletion. if (pos < -1) throw new
- * Error("pos<-1 is not supported."); while (o<length) { if
- * (operation[o] != D) { if ( (cursor + this.range[o]) < pos) {
- * cursor += this.range[o]; o++; last_d=false; } else { break; } }
- * else { last_d=true; o++; } } if (o==length) { // must insert more
- * operations before pos if (pos-cursor>0) addInsertion(pos-cursor);
- * // then just add the new operation. Regardless of what it is.
- * addOperation(op, range); } else { int diff = pos - cursor;
- *
- * int e_length = length-o; // new edit operation array length. //
- * diff<0 - can only happen before first insertion or match. -
- * affects op and all following // dif==0 - only when at first
- * position of existing op - // diff>0 - must preserve some existing
- * operations int[] e_range = new int[e_length];
- * System.arraycopy(this.range, o, e_range, 0, e_length); char[] e_op
- * = new char[e_length]; System.arraycopy(this.operation, o, e_op, 0,
- * e_length); length = o; // can now use add_operation to extend
- * list. int e_o=0; // current operation being edited. switch (op) {
- * case M: switch (e_op[e_o]) { case M: if (last_d && diff <= 0) { //
- * reduce D's, if possible if (range<=this.range[o-1]) { this.range[o
- * - 1] -= range; } else { this.range[o-1]=0; } if
- * (this.range[o-1]==0) o--; // lose this op. } e_range[e_o] +=
- * range; // just add more matched residues break; case I: // change
- * from insertion to match if (last_d && diff<=0) { // reduce D's, if
- * possible if (range<=this.range[o-1]) { this.range[o - 1] -= range;
- * } else { this.range[o-1]=0; } if (this.range[o-1]==0) o--; // lose
- * this op. } e_range[e_o] break; default: throw new Inp }
- *
- * break; case I: break; case D: } break; default: throw new
- * Error("Implementation Error: Unknown operation in addOperation!");
- * } // finally, add remaining ops. while (e_o<e_length) {
- * addOperation(e_op[e_o], e_range[e_o]); e_o++; } } }
- */
- /**
- * Mark residues from start to end (inclusive) as deleted from the alignment,
- * and removes any insertions.
- *
- * @param start
- * int
- * @param end
- * int
- * @return deleted int - number of symbols marked as deleted
- */
- public int deleteRange(int start, int end)
- {
- int deleted = 0;
- if (length == 0)
- {
- // nothing to do here
- return deleted;
- }
- if (start < 0 || start > end)
- {
- throw new Error(
- "Implementation Error: deleteRange out of bounds: start must be non-negative and less than end.");
- }
- // find beginning
- int cursor = 0; // mark the position for the current operation being edited.
- int rlength = 1 + end - start; // number of positions to delete
- int oldlen = length;
- int o = 0;
- boolean editing = false;
- char[] oldops = operation;
- int[] oldrange = range;
- length = 0;
- operation = null;
- range = null;
- compact_operations();
- while (o < oldlen && cursor <= end && rlength > 0)
- {
- if (oldops[o] == D)
- {
- // absorbed into new deleted region.
- addDeleted(oldrange[o++]);
- continue;
- }
-
- int remain = oldrange[o]; // number of op characters left to edit
- if (!editing)
- {
- if ((cursor + remain) <= start)
- {
- addOperation(oldops[o], oldrange[o]);
- cursor += oldrange[o++];
- continue; // next operation
- }
- editing = true;
- // add operations before hidden region
- if (start - cursor > 0)
- {
- addOperation(oldops[o], start - cursor);
- remain -= start - cursor;
- }
- }
- // start inserting new ops
- if (o < oldlen && editing && rlength > 0 && remain > 0)
- {
- switch (oldops[o])
- {
- case M:
- if (rlength > remain)
- {
- addDeleted(remain);
- deleted += remain;
- }
- else
- {
- deleted += rlength;
- addDeleted(rlength);
- if (remain - rlength > 0)
- {
- this.addOperation(M, remain - rlength); // add remaining back.
- }
- rlength = 0;
- remain = 0;
- }
- break;
- case I:
- if (remain - rlength > 0)
- {
- // only remove some gaps
- addInsertion(remain - rlength);
- rlength = 0;
- }
- break;
- case D:
- throw new Error("Implementation error."); // do nothing;
- default:
- throw new Error("Implementation Error! Unknown operation '"
- + oldops[o] + "'");
- }
- rlength -= remain;
- remain = oldrange[++o]; // number of op characters left to edit
- }
- }
- // add remaining
- while (o < oldlen)
- {
- addOperation(oldops[o], oldrange[o++]);
- }
- // if (cursor<(start+1)) {
- // ran out of ops - nothing to do here ?
- // addInsertion(start-cursor);
- // }
- return deleted;
- }
-
- /**
- * Deleted regions mean that there will be discontinuous sequence numbering in
- * the sequence returned by getSeq(char).
- *
- * @return true if there deletions
- */
- public boolean hasDeletedRegions()
- {
- for (int i = 0; i < length; i++)
- {
- if (operation[i] == D)
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * enumerate the ranges on seq that are marked as deleted in this cigar
- *
- * @return int[] { vis_start, sym_start, length }
- */
- public int[] getDeletedRegions()
- {
- if (length == 0)
- {
- return null;
- }
- Vector dr = new Vector();
- int cursor = 0, vcursor = 0;
- for (int i = 0; i < length; i++)
- {
- switch (operation[i])
- {
- case M:
- cursor += range[i];
- case I:
- vcursor += range[i];
- break;
- case D:
- dr.addElement(new int[]
- { vcursor, cursor, range[i] });
- cursor += range[i];
- }
- }
- if (dr.size() == 0)
- {
- return null;
- }
- int[] delregions = new int[dr.size() * 3];
- for (int i = 0, l = dr.size(); i < l; i++)
- {
- int[] reg = (int[]) dr.elementAt(i);
- delregions[i * 3] = reg[0];
- delregions[i * 3 + 1] = reg[1];
- delregions[i * 3 + 2] = reg[2];
- }
- return delregions;
- }
-
- /**
- * sum of ranges in cigar string
- *
- * @return int number of residues hidden, matched, or gaps inserted into
- * sequence
- */
- public int getFullWidth()
- {
- int w = 0;
- if (range != null)
- {
- for (int i = 0; i < length; i++)
- {
- w += range[i];
- }
- }
- return w;
- }
-
- /**
- * Visible length of aligned sequence
- *
- * @return int length of including gaps and less hidden regions
- */
- public int getWidth()
- {
- int w = 0;
- if (range != null)
- {
- for (int i = 0; i < length; i++)
- {
- if (operation[i] == M || operation[i] == I)
- {
- w += range[i];
- }
- }
- }
- return w;
- }
-
- /**
- * mark a range of inserted residues
- *
- * @param range
- * int
- */
- public void addInsertion(int range)
- {
- this.addOperation(I, range);
- }
-
- /**
- * mark the next range residues as hidden (not aligned) or deleted
- *
- * @param range
- * int
- */
- public void addDeleted(int range)
- {
- this.addOperation(D, range);
- }
-
- /**
- * Modifies operation list to delete columns from start to end (inclusive)
- * editing will remove insertion operations, and convert matches to deletions
- *
- * @param start
- * alignment column
- * @param end
- * alignment column
- * @return boolean true if residues were marked as deleted. public boolean
- * deleteRange(int start, int end) { boolean deleted = false; int op =
- * 0, prevop = -1, firstm = -1, lastm = -1, postop = -1; int width =
- * 0; // zero'th column if (length > 0) { // find operation bracketing
- * start of the range do { if (operation[op] != D) { width +=
- * range[prevop = op]; } op++; } while (op < length && width < start);
- * } if (width < start) { // run off end - add more operations up to
- * deletion. addInsertion(start - width); } else { // edit existing
- * operations. op = prevop; width -= range[prevop]; int[] oldrange =
- * range; char[] oldops = operation; range = new int[oldrange.length];
- * operation = new char[oldops.length]; if (op < length) { do { if
- * (operation[op] != D) { width += range[postop = op]; } op++; } while
- * (op < length && width <= end); } } if (deleted == true) {
- * addDeleted(end - start + 1); } return deleted; }
- */
- /**
- * Return an ENSEMBL style cigar string where D may indicates excluded parts
- * of seq
- *
- * @return String of form ([0-9]+[IMD])+
- */
- public String getCigarstring()
- {
- StringBuffer cigarString = new StringBuffer();
- for (int i = 0; i < length; i++)
- {
- cigarString.append("" + range[i]);
- cigarString.append(operation[i]);
- }
- return cigarString.toString();
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import jalview.util.MessageManager;
+
+import java.util.Vector;
+
+public abstract class CigarBase
+{
+ /**
+ * Base class for compact idiosyncratic representation of gaps and aligned
+ * residues Regards to Tom Oldfield for his DynamicArray class. 17th July 2006
+ * Not thread safe.
+ */
+ public CigarBase()
+ {
+ // nothing to be done (probably)
+ }
+
+ protected int length = 0;
+
+ protected int _inc_length = 10; // extension range for addition of new
+
+ // operations
+
+ protected char[] operation = null;
+
+ protected int[] range = null;
+
+ /**
+ * Range of Hidden residues in seq (translated as deleted in seq)
+ */
+ public static final char D = 'D';
+
+ /**
+ * Range of insertions to seq
+ */
+ public static final char I = 'I';
+
+ /**
+ * Range of aligned residues
+ */
+ public static final char M = 'M';
+
+ static protected final char _case_shift = 'a' - 'A';
+
+ /**
+ * Ugly function to get edited sequence string, start and end symbol positions
+ * and the deletion regions as an array of int pairs May return null for an
+ * empty cigar string. May return null for deletion ranges if there are none.
+ *
+ * @param reference
+ * - the symbol sequence to apply the cigar operations to (or null if
+ * no sequence)
+ * @param GapChar
+ * - the symbol to use for Insert operations
+ * @return Object[] { String, int[] {start, startcol, end, endcol}, int[][3]
+ * {start, end, col} or null} the gapped sequence, first and last
+ * residue index, and the deletion ranges on the reference sequence
+ */
+ public Object[] getSequenceAndDeletions(String reference, char GapChar)
+ {
+ int rlength = 0;
+ int[][] deletions = new int[length][];
+ int[][] trunc_deletions = null;
+ StringBuffer sq = new StringBuffer();
+ int cursor = 0, alcursor = 0, start = 0, startpos = 0, end = 0, endpos = 0, delcount = -1;
+ boolean consecutive_del = false;
+ if (length == 0)
+ {
+ return null;
+ }
+ if (reference != null)
+ {
+ rlength = reference.length();
+ }
+ boolean modstart = true;
+ for (int i = 0; i < length; i++)
+ {
+ switch (operation[i])
+ {
+ case D:
+ if (!consecutive_del)
+ {
+ deletions[++delcount] = new int[] { cursor, 0, alcursor };
+ }
+ cursor += range[i];
+ deletions[delcount][1] = cursor - 1;
+ consecutive_del = true;
+ break;
+ case I:
+ consecutive_del = false;
+ for (int r = 0; r < range[i]; r++)
+ {
+ sq.append(GapChar);
+ alcursor++;
+ }
+ break;
+ case M:
+ consecutive_del = false;
+ if (modstart)
+ {
+ start = cursor;
+ startpos = alcursor;
+ modstart = false;
+ }
+ if (reference != null)
+ {
+ int sbend = cursor + range[i];
+ if (sbend > rlength)
+ {
+ sq.append(reference.substring(cursor, rlength));
+ while (sbend-- >= rlength)
+ {
+ sq.append(GapChar);
+ }
+ }
+ else
+ {
+ sq.append(reference.substring(cursor, sbend));
+ }
+ }
+ alcursor += range[i];
+ cursor += range[i];
+ end = cursor - 1;
+ endpos = alcursor;
+ break;
+ default:
+ throw new Error(MessageManager.formatMessage(
+ "error.unknown_seq_cigar_operation",
+ new String[] { new StringBuffer(operation[i]).toString() }));
+ }
+ }
+ if (++delcount > 0)
+ {
+ trunc_deletions = new int[delcount][];
+ System.arraycopy(deletions, 0, trunc_deletions, 0, delcount);
+ }
+ deletions = null;
+ return new Object[] { ((reference != null) ? sq.toString() : null),
+ new int[] { start, startpos, end, endpos }, trunc_deletions };
+ }
+
+ protected void compact_operations()
+ {
+ int i = 1;
+ if (operation == null)
+ {
+ return;
+ }
+ char last = operation[0];
+ while (i < length)
+ {
+ if (last == operation[i])
+ {
+ range[i - 1] += range[i];
+ int r = length - i;
+ if (r > 0)
+ {
+ System.arraycopy(range, i + 1, range, i, r);
+ System.arraycopy(operation, i + 1, operation, i, r);
+ }
+ length--;
+ }
+ else
+ {
+ last = operation[i++];
+ }
+ }
+ }
+
+ /**
+ * turn a cigar string into a series of operation range pairs
+ *
+ * @param cigarString
+ * String
+ * @return object[] {char[] operation, int[] range}
+ * @throws java.lang.Exception
+ * for improperly formated cigar strings or ones with unknown
+ * operations
+ */
+ public static Object[] parseCigarString(String cigarString)
+ throws Exception
+ {
+ int ops = 0;
+ for (int i = 0, l = cigarString.length(); i < l; i++)
+ {
+ char c = cigarString.charAt(i);
+ if (c == M || c == (M - _case_shift) || c == I
+ || c == (I - _case_shift) || c == D || c == (D - _case_shift))
+ {
+ ops++;
+ }
+ }
+ char[] operation = new char[ops];
+ int[] range = new int[ops];
+ int op = 0;
+ int i = 0, l = cigarString.length();
+ while (i < l)
+ {
+ char c;
+ int j = i;
+ do
+ {
+ c = cigarString.charAt(j++);
+ } while (c >= '0' && c <= '9' && j < l);
+ if (j >= l && c >= '0' && c <= '9')
+ {
+ throw new Exception(
+ MessageManager
+ .getString("exception.unterminated_cigar_string"));
+ }
+ try
+ {
+ String rangeint = cigarString.substring(i, j - 1);
+ range[op] = Integer.parseInt(rangeint);
+ i = j;
+ } catch (Exception e)
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_bug_parse_cigar_string"));
+ }
+ if (c >= 'a' && c <= 'z')
+ {
+ c -= _case_shift;
+ }
+ if ((c == M || c == I || c == D))
+ {
+ operation[op++] = c;
+ }
+ else
+ {
+ throw new Exception(MessageManager.formatMessage(
+ "exception.unexpected_operation_cigar_string_pos",
+ new String[] { new StringBuffer(c).toString(),
+ Integer.valueOf(i).toString(), cigarString }));
+ }
+ }
+ return new Object[] { operation, range };
+ }
+
+ /**
+ * add an operation to cigar string
+ *
+ * @param op
+ * char
+ * @param range
+ * int
+ */
+ public void addOperation(char op, int range)
+ {
+ if (op >= 'a' && op <= 'z')
+ {
+ op -= _case_shift;
+ }
+ if (op != M && op != D && op != I)
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_invalid_operation_string"));
+ }
+ if (range == 0)
+ {
+ return; // No Operation to add.
+ }
+ if (range < 0)
+ {
+ throw new Error(
+ MessageManager.getString("error.invalid_range_string"));
+ }
+ int lngth = 0;
+ if (operation == null)
+ {
+ this.operation = new char[_inc_length];
+ this.range = new int[_inc_length];
+ }
+ if (length + 1 == operation.length)
+ {
+ char[] ops = this.operation;
+ this.operation = new char[length + 1 + _inc_length];
+ System.arraycopy(ops, 0, this.operation, 0, length);
+ ops = null;
+ int[] rng = this.range;
+ this.range = new int[length + 1 + _inc_length];
+ System.arraycopy(rng, 0, this.range, 0, length);
+ rng = null;
+ }
+ if ((length > 0) && (operation[length - 1] == op))
+ {
+ length--; // modify existing operation.
+ }
+ else
+ {
+ this.range[length] = 0; // reset range
+ }
+ this.operation[length] = op;
+ this.range[length++] += range;
+ }
+
+ /**
+ * semi-efficient insert an operation on the current cigar string set at
+ * column pos (from 1) NOTE: Insertion operations simply extend width of cigar
+ * result - affecting registration of alignment Deletion ops will shorten
+ * length of result - and affect registration of alignment Match ops will also
+ * affect length of result - affecting registration of alignment (ie
+ * "10M".insert(4,I,3)->"4M3I3M") - (replace?) (ie
+ * "10M".insert(4,D,3)->"4M3D3M") - (shortens alignment) (ie
+ * "5I5M".insert(4,I,3)->"8I5M") - real insertion (ie
+ * "5I5M".insert(4,D,3)->"4I2D3M") - shortens aligment - I's are removed, Ms
+ * changed to Ds (ie "10M".insert(4,M,3)->"13M") - lengthens - Is changed to
+ * M, Ds changed to M. (ie "5I5M".insert(4,M,3)->"4I8M") - effectively shifts
+ * sequence left by 1 residue and extends it by 3 (
+ * "10D5M".insert(-1,M,3)->"3M7D5M") ( "10D5M".insert(0,M,3)->"7D8M") (
+ * "10D5M".insert(1,M,3)->"10D8M") ( "1M10D5M".insert(0,M,3)->"1M10D8M") (
+ * "1M10D5M".insert(1,M,3)->"
+ *
+ * if pos is beyond width - I operations are added before the operation
+ *
+ * @param pos
+ * int -1, 0-length of visible region, or greater to append new ops
+ * (with insertions in between)
+ * @param op
+ * char
+ * @param range
+ * int public void addOperationAt(int pos, char op, int range) { int
+ * cursor = -1; // mark the position for the current operation being
+ * edited. int o = 0; boolean last_d = false; // previous op was a
+ * deletion. if (pos < -1) throw new
+ * Error("pos<-1 is not supported."); while (o<length) { if
+ * (operation[o] != D) { if ( (cursor + this.range[o]) < pos) {
+ * cursor += this.range[o]; o++; last_d=false; } else { break; } }
+ * else { last_d=true; o++; } } if (o==length) { // must insert more
+ * operations before pos if (pos-cursor>0) addInsertion(pos-cursor);
+ * // then just add the new operation. Regardless of what it is.
+ * addOperation(op, range); } else { int diff = pos - cursor;
+ *
+ * int e_length = length-o; // new edit operation array length. //
+ * diff<0 - can only happen before first insertion or match. -
+ * affects op and all following // dif==0 - only when at first
+ * position of existing op - // diff>0 - must preserve some existing
+ * operations int[] e_range = new int[e_length];
+ * System.arraycopy(this.range, o, e_range, 0, e_length); char[] e_op
+ * = new char[e_length]; System.arraycopy(this.operation, o, e_op, 0,
+ * e_length); length = o; // can now use add_operation to extend
+ * list. int e_o=0; // current operation being edited. switch (op) {
+ * case M: switch (e_op[e_o]) { case M: if (last_d && diff <= 0) { //
+ * reduce D's, if possible if (range<=this.range[o-1]) { this.range[o
+ * - 1] -= range; } else { this.range[o-1]=0; } if
+ * (this.range[o-1]==0) o--; // lose this op. } e_range[e_o] +=
+ * range; // just add more matched residues break; case I: // change
+ * from insertion to match if (last_d && diff<=0) { // reduce D's, if
+ * possible if (range<=this.range[o-1]) { this.range[o - 1] -= range;
+ * } else { this.range[o-1]=0; } if (this.range[o-1]==0) o--; // lose
+ * this op. } e_range[e_o] break; default: throw new Inp }
+ *
+ * break; case I: break; case D: } break; default: throw new
+ * Error("Implementation Error: Unknown operation in addOperation!");
+ * } // finally, add remaining ops. while (e_o<e_length) {
+ * addOperation(e_op[e_o], e_range[e_o]); e_o++; } } }
+ */
+ /**
+ * Mark residues from start to end (inclusive) as deleted from the alignment,
+ * and removes any insertions.
+ *
+ * @param start
+ * int
+ * @param end
+ * int
+ * @return deleted int - number of symbols marked as deleted
+ */
+ public int deleteRange(int start, int end)
+ {
+ int deleted = 0;
+ if (length == 0)
+ {
+ // nothing to do here
+ return deleted;
+ }
+ if (start < 0 || start > end)
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_delete_range_out_of_bounds"));
+ }
+ // find beginning
+ int cursor = 0; // mark the position for the current operation being edited.
+ int rlength = 1 + end - start; // number of positions to delete
+ int oldlen = length;
+ int o = 0;
+ boolean editing = false;
+ char[] oldops = operation;
+ int[] oldrange = range;
+ length = 0;
+ operation = null;
+ range = null;
+ compact_operations();
+ while (o < oldlen && cursor <= end && rlength > 0)
+ {
+ if (oldops[o] == D)
+ {
+ // absorbed into new deleted region.
+ addDeleted(oldrange[o++]);
+ continue;
+ }
+
+ int remain = oldrange[o]; // number of op characters left to edit
+ if (!editing)
+ {
+ if ((cursor + remain) <= start)
+ {
+ addOperation(oldops[o], oldrange[o]);
+ cursor += oldrange[o++];
+ continue; // next operation
+ }
+ editing = true;
+ // add operations before hidden region
+ if (start - cursor > 0)
+ {
+ addOperation(oldops[o], start - cursor);
+ remain -= start - cursor;
+ }
+ }
+ // start inserting new ops
+ if (o < oldlen && editing && rlength > 0 && remain > 0)
+ {
+ switch (oldops[o])
+ {
+ case M:
+ if (rlength > remain)
+ {
+ addDeleted(remain);
+ deleted += remain;
+ }
+ else
+ {
+ deleted += rlength;
+ addDeleted(rlength);
+ if (remain - rlength > 0)
+ {
+ this.addOperation(M, remain - rlength); // add remaining back.
+ }
+ rlength = 0;
+ remain = 0;
+ }
+ break;
+ case I:
+ if (remain - rlength > 0)
+ {
+ // only remove some gaps
+ addInsertion(remain - rlength);
+ rlength = 0;
+ }
+ break;
+ case D:
+ throw new Error(
+ MessageManager.getString("error.implementation_error")); // do
+ // nothing;
+ default:
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_unknown_operation",
+ new String[] { new StringBuffer(oldops[o]).toString() }));
+ }
+ rlength -= remain;
+ remain = oldrange[++o]; // number of op characters left to edit
+ }
+ }
+ // add remaining
+ while (o < oldlen)
+ {
+ addOperation(oldops[o], oldrange[o++]);
+ }
+ // if (cursor<(start+1)) {
+ // ran out of ops - nothing to do here ?
+ // addInsertion(start-cursor);
+ // }
+ return deleted;
+ }
+
+ /**
+ * Deleted regions mean that there will be discontinuous sequence numbering in
+ * the sequence returned by getSeq(char).
+ *
+ * @return true if there deletions
+ */
+ public boolean hasDeletedRegions()
+ {
+ for (int i = 0; i < length; i++)
+ {
+ if (operation[i] == D)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * enumerate the ranges on seq that are marked as deleted in this cigar
+ *
+ * @return int[] { vis_start, sym_start, length }
+ */
+ public int[] getDeletedRegions()
+ {
+ if (length == 0)
+ {
+ return null;
+ }
+ Vector dr = new Vector();
+ int cursor = 0, vcursor = 0;
+ for (int i = 0; i < length; i++)
+ {
+ switch (operation[i])
+ {
+ case M:
+ cursor += range[i];
+ case I:
+ vcursor += range[i];
+ break;
+ case D:
+ dr.addElement(new int[] { vcursor, cursor, range[i] });
+ cursor += range[i];
+ }
+ }
+ if (dr.size() == 0)
+ {
+ return null;
+ }
+ int[] delregions = new int[dr.size() * 3];
+ for (int i = 0, l = dr.size(); i < l; i++)
+ {
+ int[] reg = (int[]) dr.elementAt(i);
+ delregions[i * 3] = reg[0];
+ delregions[i * 3 + 1] = reg[1];
+ delregions[i * 3 + 2] = reg[2];
+ }
+ return delregions;
+ }
+
+ /**
+ * sum of ranges in cigar string
+ *
+ * @return int number of residues hidden, matched, or gaps inserted into
+ * sequence
+ */
+ public int getFullWidth()
+ {
+ int w = 0;
+ if (range != null)
+ {
+ for (int i = 0; i < length; i++)
+ {
+ w += range[i];
+ }
+ }
+ return w;
+ }
+
+ /**
+ * Visible length of aligned sequence
+ *
+ * @return int length of including gaps and less hidden regions
+ */
+ public int getWidth()
+ {
+ int w = 0;
+ if (range != null)
+ {
+ for (int i = 0; i < length; i++)
+ {
+ if (operation[i] == M || operation[i] == I)
+ {
+ w += range[i];
+ }
+ }
+ }
+ return w;
+ }
+
+ /**
+ * mark a range of inserted residues
+ *
+ * @param range
+ * int
+ */
+ public void addInsertion(int range)
+ {
+ this.addOperation(I, range);
+ }
+
+ /**
+ * mark the next range residues as hidden (not aligned) or deleted
+ *
+ * @param range
+ * int
+ */
+ public void addDeleted(int range)
+ {
+ this.addOperation(D, range);
+ }
+
+ /**
+ * Modifies operation list to delete columns from start to end (inclusive)
+ * editing will remove insertion operations, and convert matches to deletions
+ *
+ * @param start
+ * alignment column
+ * @param end
+ * alignment column
+ * @return boolean true if residues were marked as deleted. public boolean
+ * deleteRange(int start, int end) { boolean deleted = false; int op =
+ * 0, prevop = -1, firstm = -1, lastm = -1, postop = -1; int width =
+ * 0; // zero'th column if (length > 0) { // find operation bracketing
+ * start of the range do { if (operation[op] != D) { width +=
+ * range[prevop = op]; } op++; } while (op < length && width < start);
+ * } if (width < start) { // run off end - add more operations up to
+ * deletion. addInsertion(start - width); } else { // edit existing
+ * operations. op = prevop; width -= range[prevop]; int[] oldrange =
+ * range; char[] oldops = operation; range = new int[oldrange.length];
+ * operation = new char[oldops.length]; if (op < length) { do { if
+ * (operation[op] != D) { width += range[postop = op]; } op++; } while
+ * (op < length && width <= end); } } if (deleted == true) {
+ * addDeleted(end - start + 1); } return deleted; }
+ */
+ /**
+ * Return an ENSEMBL style cigar string where D may indicates excluded parts
+ * of seq
+ *
+ * @return String of form ([0-9]+[IMD])+
+ */
+ public String getCigarstring()
+ {
+ StringBuffer cigarString = new StringBuffer();
+ for (int i = 0; i < length; i++)
+ {
+ cigarString.append("" + range[i]);
+ cigarString.append(operation[i]);
+ }
+ return cigarString.toString();
+ }
+}
diff --git a/src/jalview/datamodel/CigarCigar.java b/src/jalview/datamodel/CigarCigar.java
index e31c818..f65a3c1 100644
--- a/src/jalview/datamodel/CigarCigar.java
+++ b/src/jalview/datamodel/CigarCigar.java
@@ -1,61 +1,64 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-public class CigarCigar extends CigarSimple
-{
- SeqCigar refCigar;
-
- /**
- * Apply CIGAR operations to the result of another cigar
- *
- * @param cigar
- * Cigar
- */
- CigarCigar(SeqCigar cigar)
- {
- super();
- refCigar = cigar;
- }
-
- /**
- *
- * @return String formed by applying CIGAR operations to the reference object
- * @param GapChar
- * char
- * @todo Implement this jalview.datamodel.Cigar method
- */
- public String getSequenceString(char GapChar)
- {
- if (length == 0)
- {
- return "";
- }
- String refString = refCigar.getSequenceString(GapChar);
- if (refString != null)
- {
- return (length == 0) ? "" : (String) getSequenceAndDeletions(
- refString, GapChar)[0];
- }
- else
- {
- return null;
- }
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+public class CigarCigar extends CigarSimple
+{
+ SeqCigar refCigar;
+
+ /**
+ * Apply CIGAR operations to the result of another cigar
+ *
+ * @param cigar
+ * Cigar
+ */
+ CigarCigar(SeqCigar cigar)
+ {
+ super();
+ refCigar = cigar;
+ }
+
+ /**
+ *
+ * @return String formed by applying CIGAR operations to the reference object
+ * @param GapChar
+ * char
+ * @todo Implement this jalview.datamodel.Cigar method
+ */
+ public String getSequenceString(char GapChar)
+ {
+ if (length == 0)
+ {
+ return "";
+ }
+ String refString = refCigar.getSequenceString(GapChar);
+ if (refString != null)
+ {
+ return (length == 0) ? "" : (String) getSequenceAndDeletions(
+ refString, GapChar)[0];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+}
diff --git a/src/jalview/datamodel/CigarSimple.java b/src/jalview/datamodel/CigarSimple.java
index 6aa9988..00e120d 100644
--- a/src/jalview/datamodel/CigarSimple.java
+++ b/src/jalview/datamodel/CigarSimple.java
@@ -1,32 +1,35 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-public abstract class CigarSimple extends CigarBase
-{
- /**
- * Return a symbol sequence with edits (gaps, insertions and deletions)
- * applied
- *
- * @param GapChar
- * char
- * @return String
- */
- public abstract String getSequenceString(char GapChar);
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+public abstract class CigarSimple extends CigarBase
+{
+ /**
+ * Return a symbol sequence with edits (gaps, insertions and deletions)
+ * applied
+ *
+ * @param GapChar
+ * char
+ * @return String
+ */
+ public abstract String getSequenceString(char GapChar);
+
+}
diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java
index 786101e..15bbffa 100644
--- a/src/jalview/datamodel/ColumnSelection.java
+++ b/src/jalview/datamodel/ColumnSelection.java
@@ -1,1245 +1,1392 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-import java.util.*;
-
-import jalview.util.*;
-
-/**
- * NOTE: Columns are zero based.
- */
-public class ColumnSelection
-{
- Vector selected = new Vector();
-
- // Vector of int [] {startCol, endCol}
- Vector hiddenColumns;
-
- /**
- * Add a column to the selection
- *
- * @param col
- * index of column
- */
- public void addElement(int col)
- {
- Integer column = new Integer(col);
- if (!selected.contains(column))
- {
- selected.addElement(column);
- }
- }
-
- /**
- * clears column selection
- */
- public void clear()
- {
- selected.removeAllElements();
- }
-
- /**
- * removes col from selection
- *
- * @param col
- * index of column to be removed
- */
- public void removeElement(int col)
- {
- Integer colInt = new Integer(col);
-
- if (selected.contains(colInt))
- {
- selected.removeElement(colInt);
- }
- }
-
- /**
- * removes a range of columns from the selection
- *
- * @param start
- * int - first column in range to be removed
- * @param end
- * int - last col
- */
- public void removeElements(int start, int end)
- {
- Integer colInt;
- for (int i = start; i < end; i++)
- {
- colInt = new Integer(i);
- if (selected.contains(colInt))
- {
- selected.removeElement(colInt);
- }
- }
- }
-
- /**
- *
- * @return Vector containing selected columns as Integers
- */
- public Vector getSelected()
- {
- return selected;
- }
-
- /**
- *
- * @param col
- * index to search for in column selection
- *
- * @return true if Integer(col) is in selection.
- */
- public boolean contains(int col)
- {
- return selected.contains(new Integer(col));
- }
-
- /**
- * Column number at position i in selection
- *
- * @param i
- * index into selected columns
- *
- * @return column number in alignment
- */
- public int columnAt(int i)
- {
- return ((Integer) selected.elementAt(i)).intValue();
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public int size()
- {
- return selected.size();
- }
-
- /**
- * rightmost selected column
- *
- * @return rightmost column in alignment that is selected
- */
- public int getMax()
- {
- int max = -1;
-
- for (int i = 0; i < selected.size(); i++)
- {
- if (columnAt(i) > max)
- {
- max = columnAt(i);
- }
- }
-
- return max;
- }
-
- /**
- * Leftmost column in selection
- *
- * @return column index of leftmost column in selection
- */
- public int getMin()
- {
- int min = 1000000000;
-
- for (int i = 0; i < selected.size(); i++)
- {
- if (columnAt(i) < min)
- {
- min = columnAt(i);
- }
- }
-
- return min;
- }
-
- /**
- * propagate shift in alignment columns to column selection
- *
- * @param start
- * beginning of edit
- * @param left
- * shift in edit (+ve for removal, or -ve for inserts)
- */
- public Vector compensateForEdit(int start, int change)
- {
- Vector deletedHiddenColumns = null;
- for (int i = 0; i < size(); i++)
- {
- int temp = columnAt(i);
-
- if (temp >= start)
- {
- selected.setElementAt(new Integer(temp - change), i);
- }
- }
-
- if (hiddenColumns != null)
- {
- deletedHiddenColumns = new Vector();
- int hSize = hiddenColumns.size();
- for (int i = 0; i < hSize; i++)
- {
- int[] region = (int[]) hiddenColumns.elementAt(i);
- if (region[0] > start && start + change > region[1])
- {
- deletedHiddenColumns.addElement(hiddenColumns.elementAt(i));
-
- hiddenColumns.removeElementAt(i);
- i--;
- hSize--;
- continue;
- }
-
- if (region[0] > start)
- {
- region[0] -= change;
- region[1] -= change;
- }
-
- if (region[0] < 0)
- {
- region[0] = 0;
- }
-
- }
-
- this.revealHiddenColumns(0);
- }
-
- return deletedHiddenColumns;
- }
-
- /**
- * propagate shift in alignment columns to column selection special version of
- * compensateForEdit - allowing for edits within hidden regions
- *
- * @param start
- * beginning of edit
- * @param left
- * shift in edit (+ve for removal, or -ve for inserts)
- */
- private void compensateForDelEdits(int start, int change)
- {
- for (int i = 0; i < size(); i++)
- {
- int temp = columnAt(i);
-
- if (temp >= start)
- {
- selected.setElementAt(new Integer(temp - change), i);
- }
- }
-
- if (hiddenColumns != null)
- {
- for (int i = 0; i < hiddenColumns.size(); i++)
- {
- int[] region = (int[]) hiddenColumns.elementAt(i);
- if (region[0] >= start)
- {
- region[0] -= change;
- }
- if (region[1] >= start)
- {
- region[1] -= change;
- }
- if (region[1] < region[0])
- {
- hiddenColumns.removeElementAt(i--);
- }
-
- if (region[0] < 0)
- {
- region[0] = 0;
- }
- if (region[1] < 0)
- {
- region[1] = 0;
- }
- }
- }
- }
-
- /**
- * Adjust hidden column boundaries based on a series of column additions or
- * deletions in visible regions.
- *
- * @param shiftrecord
- * @return
- */
- public ShiftList compensateForEdits(ShiftList shiftrecord)
- {
- if (shiftrecord != null)
- {
- Vector shifts = shiftrecord.shifts;
- if (shifts != null && shifts.size() > 0)
- {
- int shifted = 0;
- for (int i = 0, j = shifts.size(); i < j; i++)
- {
- int[] sh = (int[]) shifts.elementAt(i);
- // compensateForEdit(shifted+sh[0], sh[1]);
- compensateForDelEdits(shifted + sh[0], sh[1]);
- shifted -= sh[1];
- }
- }
- return shiftrecord.getInverse();
- }
- return null;
- }
-
- /**
- * removes intersection of position,length ranges in deletions from the
- * start,end regions marked in intervals.
- *
- * @param deletions
- * @param intervals
- * @return
- */
- private boolean pruneIntervalVector(Vector deletions, Vector intervals)
- {
- boolean pruned = false;
- int i = 0, j = intervals.size() - 1, s = 0, t = deletions.size() - 1;
- int hr[] = (int[]) intervals.elementAt(i);
- int sr[] = (int[]) deletions.elementAt(s);
- while (i <= j && s <= t)
- {
- boolean trailinghn = hr[1] >= sr[0];
- if (!trailinghn)
- {
- if (i < j)
- {
- hr = (int[]) intervals.elementAt(++i);
- }
- else
- {
- i++;
- }
- continue;
- }
- int endshift = sr[0] + sr[1]; // deletion ranges - -ve means an insert
- if (endshift < hr[0] || endshift < sr[0])
- { // leadinghc disjoint or not a deletion
- if (s < t)
- {
- sr = (int[]) deletions.elementAt(++s);
- }
- else
- {
- s++;
- }
- continue;
- }
- boolean leadinghn = hr[0] >= sr[0];
- boolean leadinghc = hr[0] < endshift;
- boolean trailinghc = hr[1] < endshift;
- if (leadinghn)
- {
- if (trailinghc)
- { // deleted hidden region.
- intervals.removeElementAt(i);
- pruned = true;
- j--;
- if (i <= j)
- {
- hr = (int[]) intervals.elementAt(i);
- }
- continue;
- }
- if (leadinghc)
- {
- hr[0] = endshift; // clip c terminal region
- leadinghn = !leadinghn;
- pruned = true;
- }
- }
- if (!leadinghn)
- {
- if (trailinghc)
- {
- if (trailinghn)
- {
- hr[1] = sr[0] - 1;
- pruned = true;
- }
- }
- else
- {
- // sr contained in hr
- if (s < t)
- {
- sr = (int[]) deletions.elementAt(++s);
- }
- else
- {
- s++;
- }
- continue;
- }
- }
- }
- return pruned; // true if any interval was removed or modified by
- // operations.
- }
-
- private boolean pruneColumnList(Vector deletion, Vector list)
- {
- int s = 0, t = deletion.size();
- int[] sr = (int[]) list.elementAt(s++);
- boolean pruned = false;
- int i = 0, j = list.size();
- while (i < j && s <= t)
- {
- int c = ((Integer) list.elementAt(i++)).intValue();
- if (sr[0] <= c)
- {
- if (sr[1] + sr[0] >= c)
- { // sr[1] -ve means inseriton.
- list.removeElementAt(--i);
- j--;
- }
- else
- {
- if (s < t)
- {
- sr = (int[]) deletion.elementAt(s);
- }
- s++;
- }
- }
- }
- return pruned;
- }
-
- /**
- * remove any hiddenColumns or selected columns and shift remaining based on a
- * series of position, range deletions.
- *
- * @param deletions
- */
- public void pruneDeletions(ShiftList deletions)
- {
- if (deletions != null)
- {
- Vector shifts = deletions.shifts;
- if (shifts != null && shifts.size() > 0)
- {
- // delete any intervals intersecting.
- if (hiddenColumns != null)
- {
- pruneIntervalVector(shifts, hiddenColumns);
- if (hiddenColumns != null && hiddenColumns.size() == 0)
- {
- hiddenColumns = null;
- }
- }
- if (selected != null && selected.size() > 0)
- {
- pruneColumnList(shifts, selected);
- if (selected != null && selected.size() == 0)
- {
- selected = null;
- }
- }
- // and shift the rest.
- this.compensateForEdits(deletions);
- }
- }
- }
-
- /**
- * This Method is used to return all the HiddenColumn regions less than the
- * given index.
- *
- * @param end
- * int
- * @return Vector
- */
- public Vector getHiddenColumns()
- {
- return hiddenColumns;
- }
-
- /**
- * Return absolute column index for a visible column index
- *
- * @param column
- * int column index in alignment view
- * @return alignment column index for column
- */
- public int adjustForHiddenColumns(int column)
- {
- int result = column;
- if (hiddenColumns != null)
- {
- for (int i = 0; i < hiddenColumns.size(); i++)
- {
- int[] region = (int[]) hiddenColumns.elementAt(i);
- if (result >= region[0])
- {
- result += region[1] - region[0] + 1;
- }
- }
- }
- return result;
- }
-
- /**
- * Use this method to find out where a column will appear in the visible
- * alignment when hidden columns exist. If the column is not visible, then the
- * left-most visible column will always be returned.
- *
- * @param hiddenColumn
- * int
- * @return int
- */
- public int findColumnPosition(int hiddenColumn)
- {
- int result = hiddenColumn;
- if (hiddenColumns != null)
- {
- int index = 0;
- int[] region;
- do
- {
- region = (int[]) hiddenColumns.elementAt(index++);
- if (hiddenColumn > region[1])
- {
- result -= region[1] + 1 - region[0];
- }
- } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size()));
- if (hiddenColumn > region[0] && hiddenColumn < region[1])
- {
- return region[0] + hiddenColumn - result;
- }
- }
- return result; // return the shifted position after removing hidden columns.
- }
-
- /**
- * Use this method to determine where the next hiddenRegion starts
- */
- public int findHiddenRegionPosition(int hiddenRegion)
- {
- int result = 0;
- if (hiddenColumns != null)
- {
- int index = 0;
- int gaps = 0;
- do
- {
- int[] region = (int[]) hiddenColumns.elementAt(index);
- if (hiddenRegion == 0)
- {
- return region[0];
- }
-
- gaps += region[1] + 1 - region[0];
- result = region[1] + 1;
- index++;
- } while (index < hiddenRegion + 1);
-
- result -= gaps;
- }
-
- return result;
- }
-
- /**
- * THis method returns the rightmost limit of a region of an alignment with
- * hidden columns. In otherwords, the next hidden column.
- *
- * @param index
- * int
- */
- public int getHiddenBoundaryRight(int alPos)
- {
- if (hiddenColumns != null)
- {
- int index = 0;
- do
- {
- int[] region = (int[]) hiddenColumns.elementAt(index);
- if (alPos < region[0])
- {
- return region[0];
- }
-
- index++;
- } while (index < hiddenColumns.size());
- }
-
- return alPos;
-
- }
-
- /**
- * This method returns the leftmost limit of a region of an alignment with
- * hidden columns. In otherwords, the previous hidden column.
- *
- * @param index
- * int
- */
- public int getHiddenBoundaryLeft(int alPos)
- {
- if (hiddenColumns != null)
- {
- int index = hiddenColumns.size() - 1;
- do
- {
- int[] region = (int[]) hiddenColumns.elementAt(index);
- if (alPos > region[1])
- {
- return region[1];
- }
-
- index--;
- } while (index > -1);
- }
-
- return alPos;
-
- }
-
- public void hideSelectedColumns()
- {
- while (size() > 0)
- {
- int column = ((Integer) getSelected().firstElement()).intValue();
- hideColumns(column);
- }
-
- }
-
- public void hideColumns(int start, int end)
- {
- if (hiddenColumns == null)
- {
- hiddenColumns = new Vector();
- }
-
- boolean added = false;
- boolean overlap = false;
-
- for (int i = 0; i < hiddenColumns.size(); i++)
- {
- int[] region = (int[]) hiddenColumns.elementAt(i);
- if (start <= region[1] && end >= region[0])
- {
- hiddenColumns.removeElementAt(i);
- overlap = true;
- break;
- }
- else if (end < region[0] && start < region[0])
- {
- hiddenColumns.insertElementAt(new int[]
- { start, end }, i);
- added = true;
- break;
- }
- }
-
- if (overlap)
- {
- hideColumns(start, end);
- }
- else if (!added)
- {
- hiddenColumns.addElement(new int[]
- { start, end });
- }
-
- }
-
- /**
- * This method will find a range of selected columns around the column
- * specified
- *
- * @param res
- * int
- */
- public void hideColumns(int col)
- {
- // First find out range of columns to hide
- int min = col, max = col + 1;
- while (contains(min))
- {
- removeElement(min);
- min--;
- }
-
- while (contains(max))
- {
- removeElement(max);
- max++;
- }
-
- min++;
- max--;
- if (min > max)
- {
- min = max;
- }
-
- hideColumns(min, max);
- }
-
- public void revealAllHiddenColumns()
- {
- if (hiddenColumns != null)
- {
- for (int i = 0; i < hiddenColumns.size(); i++)
- {
- int[] region = (int[]) hiddenColumns.elementAt(i);
- for (int j = region[0]; j < region[1] + 1; j++)
- {
- addElement(j);
- }
- }
- }
-
- hiddenColumns = null;
- }
-
- public void revealHiddenColumns(int res)
- {
- for (int i = 0; i < hiddenColumns.size(); i++)
- {
- int[] region = (int[]) hiddenColumns.elementAt(i);
- if (res == region[0])
- {
- for (int j = region[0]; j < region[1] + 1; j++)
- {
- addElement(j);
- }
-
- hiddenColumns.removeElement(region);
- break;
- }
- }
- if (hiddenColumns.size() == 0)
- {
- hiddenColumns = null;
- }
- }
-
- public boolean isVisible(int column)
- {
- if (hiddenColumns != null)
- for (int i = 0; i < hiddenColumns.size(); i++)
- {
- int[] region = (int[]) hiddenColumns.elementAt(i);
- if (column >= region[0] && column <= region[1])
- {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Copy constructor
- *
- * @param copy
- */
- public ColumnSelection(ColumnSelection copy)
- {
- if (copy != null)
- {
- if (copy.selected != null)
- {
- selected = new Vector();
- for (int i = 0, j = copy.selected.size(); i < j; i++)
- {
- selected.addElement(copy.selected.elementAt(i));
- }
- }
- if (copy.hiddenColumns != null)
- {
- hiddenColumns = new Vector(copy.hiddenColumns.size());
- for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)
- {
- int[] rh, cp;
- rh = (int[]) copy.hiddenColumns.elementAt(i);
- if (rh != null)
- {
- cp = new int[rh.length];
- System.arraycopy(rh, 0, cp, 0, rh.length);
- hiddenColumns.addElement(cp);
- }
- }
- }
- }
- }
-
- /**
- * ColumnSelection
- */
- public ColumnSelection()
- {
- }
-
- public String[] getVisibleSequenceStrings(int start, int end,
- SequenceI[] seqs)
- {
- int i, iSize = seqs.length;
- String selection[] = new String[iSize];
- if (hiddenColumns != null && hiddenColumns.size() > 0)
- {
- for (i = 0; i < iSize; i++)
- {
- StringBuffer visibleSeq = new StringBuffer();
- Vector regions = getHiddenColumns();
-
- int blockStart = start, blockEnd = end;
- int[] region;
- int hideStart, hideEnd;
-
- for (int j = 0; j < regions.size(); j++)
- {
- region = (int[]) regions.elementAt(j);
- hideStart = region[0];
- hideEnd = region[1];
-
- if (hideStart < start)
- {
- continue;
- }
-
- blockStart = Math.min(blockStart, hideEnd + 1);
- blockEnd = Math.min(blockEnd, hideStart);
-
- if (blockStart > blockEnd)
- {
- break;
- }
-
- visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
-
- blockStart = hideEnd + 1;
- blockEnd = end;
- }
-
- if (end > blockStart)
- {
- visibleSeq.append(seqs[i].getSequence(blockStart, end));
- }
-
- selection[i] = visibleSeq.toString();
- }
- }
- else
- {
- for (i = 0; i < iSize; i++)
- {
- selection[i] = seqs[i].getSequenceAsString(start, end);
- }
- }
-
- return selection;
- }
-
- /**
- * return all visible segments between the given start and end boundaries
- *
- * @param start
- * (first column inclusive from 0)
- * @param end
- * (last column - not inclusive)
- * @return int[] {i_start, i_end, ..} where intervals lie in
- * start<=i_start<=i_end<end
- */
- public int[] getVisibleContigs(int start, int end)
- {
- if (hiddenColumns != null && hiddenColumns.size() > 0)
- {
- Vector visiblecontigs = new Vector();
- Vector regions = getHiddenColumns();
-
- int vstart = start;
- int[] region;
- int hideStart, hideEnd;
-
- for (int j = 0; vstart < end && j < regions.size(); j++)
- {
- region = (int[]) regions.elementAt(j);
- hideStart = region[0];
- hideEnd = region[1];
-
- if (hideEnd < vstart)
- {
- continue;
- }
- if (hideStart > vstart)
- {
- visiblecontigs.addElement(new int[]
- { vstart, hideStart - 1 });
- }
- vstart = hideEnd + 1;
- }
-
- if (vstart < end)
- {
- visiblecontigs.addElement(new int[]
- { vstart, end - 1 });
- }
- int[] vcontigs = new int[visiblecontigs.size() * 2];
- for (int i = 0, j = visiblecontigs.size(); i < j; i++)
- {
- int[] vc = (int[]) visiblecontigs.elementAt(i);
- visiblecontigs.setElementAt(null, i);
- vcontigs[i * 2] = vc[0];
- vcontigs[i * 2 + 1] = vc[1];
- }
- visiblecontigs.removeAllElements();
- return vcontigs;
- }
- else
- {
- return new int[]
- { start, end - 1 };
- }
- }
-
- /**
- * delete any columns in alignmentAnnotation that are hidden (including
- * sequence associated annotation).
- *
- * @param alignmentAnnotation
- */
- public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation)
- {
- makeVisibleAnnotation(-1, -1, alignmentAnnotation);
- }
-
- /**
- * delete any columns in alignmentAnnotation that are hidden (including
- * sequence associated annotation).
- *
- * @param start
- * remove any annotation to the right of this column
- * @param end
- * remove any annotation to the left of this column
- * @param alignmentAnnotation
- * the annotation to operate on
- */
- public void makeVisibleAnnotation(int start, int end,
- AlignmentAnnotation alignmentAnnotation)
- {
- if (alignmentAnnotation.annotations == null)
- {
- return;
- }
- if (start == end && end == -1)
- {
- start = 0;
- end = alignmentAnnotation.annotations.length;
- }
- if (hiddenColumns != null && hiddenColumns.size() > 0)
- {
- // then mangle the alignmentAnnotation annotation array
- Vector annels = new Vector();
- Annotation[] els = null;
- Vector regions = getHiddenColumns();
- int blockStart = start, blockEnd = end;
- int[] region;
- int hideStart, hideEnd, w = 0;
-
- for (int j = 0; j < regions.size(); j++)
- {
- region = (int[]) regions.elementAt(j);
- hideStart = region[0];
- hideEnd = region[1];
-
- if (hideStart < start)
- {
- continue;
- }
-
- blockStart = Math.min(blockStart, hideEnd + 1);
- blockEnd = Math.min(blockEnd, hideStart);
-
- if (blockStart > blockEnd)
- {
- break;
- }
-
- annels.addElement(els = new Annotation[blockEnd - blockStart]);
- System.arraycopy(alignmentAnnotation.annotations, blockStart, els,
- 0, els.length);
- w += els.length;
- blockStart = hideEnd + 1;
- blockEnd = end;
- }
-
- if (end > blockStart)
- {
- annels.addElement(els = new Annotation[end - blockStart + 1]);
- if ((els.length + blockStart) <= alignmentAnnotation.annotations.length)
- {
- // copy just the visible segment of the annotation row
- System.arraycopy(alignmentAnnotation.annotations, blockStart,
- els, 0, els.length);
- }
- else
- {
- // copy to the end of the annotation row
- System.arraycopy(alignmentAnnotation.annotations, blockStart,
- els, 0,
- (alignmentAnnotation.annotations.length - blockStart));
- }
- w += els.length;
- }
- if (w == 0)
- return;
- Enumeration e = annels.elements();
- alignmentAnnotation.annotations = new Annotation[w];
- w = 0;
- while (e.hasMoreElements())
- {
- Annotation[] chnk = (Annotation[]) e.nextElement();
- System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w,
- chnk.length);
- w += chnk.length;
- }
- }
- else
- {
- alignmentAnnotation.restrict(start, end);
- }
- }
-
- /**
- * Invert the column selection from first to end-1. leaves hiddenColumns
- * untouched (and unselected)
- *
- * @param first
- * @param end
- */
- public void invertColumnSelection(int first, int width)
- {
- boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0;
- for (int i = first; i < width; i++)
- {
- if (contains(i))
- {
- removeElement(i);
- }
- else
- {
- if (!hasHidden || isVisible(i))
- {
- addElement(i);
- }
- }
- }
- }
-
- /**
- * add in any unselected columns from the given column selection, excluding
- * any that are hidden.
- *
- * @param colsel
- */
- public void addElementsFrom(ColumnSelection colsel)
- {
- if (colsel != null && colsel.size() > 0)
- {
- Enumeration e = colsel.getSelected().elements();
- while (e.hasMoreElements())
- {
- Object eo = e.nextElement();
- if (hiddenColumns != null && isVisible(((Integer) eo).intValue()))
- {
- if (!selected.contains(eo))
- {
- selected.addElement(eo);
- }
- }
- }
- }
- }
-
- /**
- * set the selected columns the given column selection, excluding any columns
- * that are hidden.
- *
- * @param colsel
- */
- public void setElementsFrom(ColumnSelection colsel)
- {
- selected = new Vector();
- if (colsel.selected != null && colsel.selected.size() > 0)
- {
- if (hiddenColumns != null && hiddenColumns.size() > 0)
- {
- // only select visible columns in this columns selection
- selected = new Vector();
- addElementsFrom(colsel);
- }
- else
- {
- // add everything regardless
- Enumeration en = colsel.selected.elements();
- while (en.hasMoreElements())
- {
- selected.addElement(en.nextElement());
- }
- }
- }
- }
-
- /**
- * Add gaps into the sequences aligned to profileseq under the given
- * AlignmentView
- *
- * @param profileseq
- * @param al - alignment to have gaps inserted into it
- * @param input - alignment view where sequence corresponding to profileseq is first entry
- * @return new Column selection for new alignment view, with insertions into profileseq marked as hidden.
- */
- public static ColumnSelection propagateInsertions(SequenceI profileseq,
- Alignment al, AlignmentView input)
- {
- int profsqpos=0;
-
-// return propagateInsertions(profileseq, al, )
- char gc = al.getGapCharacter();
- Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc);
- ColumnSelection nview = (ColumnSelection) alandcolsel[1];
- SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos];
- nview.propagateInsertions(profileseq,
- al, origseq);
- return nview;
- }
- /**
- *
- * @param profileseq - sequence in al which corresponds to origseq
- * @param al - alignment which is to have gaps inserted into it
- * @param origseq - sequence corresponding to profileseq which defines gap map for modifying al
- */
- public void propagateInsertions(SequenceI profileseq, AlignmentI al, SequenceI origseq)
- {
- char gc = al.getGapCharacter();
- // recover mapping between sequence's non-gap positions and positions
- // mapping to view.
- pruneDeletions(ShiftList
- .parseMap(origseq
- .gapMap()));
- int[] viscontigs = getVisibleContigs(0, profileseq.getLength());
- int spos = 0;
- int offset = 0;
- // input.pruneDeletions(ShiftList.parseMap(((SequenceI[])
- // alandcolsel[0])[0].gapMap()))
- // add profile to visible contigs
- for (int v = 0; v < viscontigs.length; v += 2)
- {
- if (viscontigs[v] > spos)
- {
- StringBuffer sb = new StringBuffer();
- for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++)
- {
- sb.append(gc);
- }
- for (int s = 0, ns = al.getHeight(); s < ns; s++)
- {
- SequenceI sqobj = al.getSequenceAt(s);
- if (sqobj != profileseq)
- {
- String sq = al.getSequenceAt(s).getSequenceAsString();
- if (sq.length() <= spos + offset)
- {
- // pad sequence
- int diff = spos + offset - sq.length() - 1;
- if (diff > 0)
- {
- // pad gaps
- sq = sq + sb;
- while ((diff = spos + offset - sq.length() - 1) > 0)
- {
- //sq = sq
- // + ((diff >= sb.length()) ? sb.toString() : sb
- // .substring(0, diff));
- if (diff>=sb.length()) {
- sq+=sb.toString();
- } else {
- char[] buf = new char[diff];
- sb.getChars(0, diff, buf, 0);
- sq+=buf.toString();
- }
- }
- }
- sq += sb.toString();
- }
- else
- {
- al.getSequenceAt(s).setSequence(
- sq.substring(0, spos + offset) + sb.toString()
- + sq.substring(spos + offset));
- }
- }
- }
- // offset+=sb.length();
- }
- spos = viscontigs[v + 1] + 1;
- }
- if ((offset + spos) < profileseq.getLength())
- {
- // pad the final region with gaps.
- StringBuffer sb = new StringBuffer();
- for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++)
- {
- sb.append(gc);
- }
- for (int s = 0, ns = al.getHeight(); s < ns; s++)
- {
- SequenceI sqobj = al.getSequenceAt(s);
- if (sqobj==profileseq)
- {
- continue;
- }
- String sq = sqobj.getSequenceAsString();
- // pad sequence
- int diff = origseq.getLength() - sq.length();
- while (diff > 0)
- {
- //sq = sq
- // + ((diff >= sb.length()) ? sb.toString() : sb
- // .substring(0, diff));
- if (diff>=sb.length()) {
- sq+=sb.toString();
- } else {
- char[] buf = new char[diff];
- sb.getChars(0, diff, buf, 0);
- sq+=buf.toString();
- }
- diff = origseq.getLength() - sq.length();
- }
- }
- }
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import jalview.util.ShiftList;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * NOTE: Columns are zero based.
+ */
+public class ColumnSelection
+{
+ Vector<Integer> selected = new Vector<Integer>();
+
+ // Vector of int [] {startCol, endCol}
+ Vector<int[]> hiddenColumns;
+
+ /**
+ * Add a column to the selection
+ *
+ * @param col
+ * index of column
+ */
+ public void addElement(int col)
+ {
+ Integer column = new Integer(col);
+ if (!selected.contains(column))
+ {
+ selected.addElement(column);
+ }
+ }
+
+ /**
+ * clears column selection
+ */
+ public void clear()
+ {
+ selected.removeAllElements();
+ }
+
+ /**
+ * Removes value 'col' from the selection (not the col'th item)
+ *
+ * @param col
+ * index of column to be removed
+ */
+ public void removeElement(int col)
+ {
+ Integer colInt = new Integer(col);
+
+ if (selected.contains(colInt))
+ {
+ // if this ever changes to List.remove(), ensure Integer not int argument
+ // as List.remove(int i) removes the i'th item which is wrong
+ selected.removeElement(colInt);
+ }
+ }
+
+ /**
+ * removes a range of columns from the selection
+ *
+ * @param start
+ * int - first column in range to be removed
+ * @param end
+ * int - last col
+ */
+ public void removeElements(int start, int end)
+ {
+ Integer colInt;
+ for (int i = start; i < end; i++)
+ {
+ colInt = new Integer(i);
+ if (selected.contains(colInt))
+ {
+ selected.removeElement(colInt);
+ }
+ }
+ }
+
+ /**
+ *
+ * @return Vector containing selected columns as Integers
+ */
+ public Vector<Integer> getSelected()
+ {
+ return selected;
+ }
+
+ /**
+ *
+ * @param col
+ * index to search for in column selection
+ *
+ * @return true if Integer(col) is in selection.
+ */
+ public boolean contains(int col)
+ {
+ return selected.contains(new Integer(col));
+ }
+
+ /**
+ * Column number at position i in selection
+ *
+ * @param i
+ * index into selected columns
+ *
+ * @return column number in alignment
+ */
+ public int columnAt(int i)
+ {
+ return selected.elementAt(i).intValue();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public int size()
+ {
+ return selected.size();
+ }
+
+ /**
+ * rightmost selected column
+ *
+ * @return rightmost column in alignment that is selected
+ */
+ public int getMax()
+ {
+ int max = -1;
+
+ for (int i = 0; i < selected.size(); i++)
+ {
+ if (columnAt(i) > max)
+ {
+ max = columnAt(i);
+ }
+ }
+
+ return max;
+ }
+
+ /**
+ * Leftmost column in selection
+ *
+ * @return column index of leftmost column in selection
+ */
+ public int getMin()
+ {
+ int min = 1000000000;
+
+ for (int i = 0; i < selected.size(); i++)
+ {
+ if (columnAt(i) < min)
+ {
+ min = columnAt(i);
+ }
+ }
+
+ return min;
+ }
+
+ /**
+ * propagate shift in alignment columns to column selection
+ *
+ * @param start
+ * beginning of edit
+ * @param left
+ * shift in edit (+ve for removal, or -ve for inserts)
+ */
+ public List<int[]> compensateForEdit(int start, int change)
+ {
+ List<int[]> deletedHiddenColumns = null;
+ for (int i = 0; i < size(); i++)
+ {
+ int temp = columnAt(i);
+
+ if (temp >= start)
+ {
+ // if this ever changes to List.set(), swap parameter order!!
+ selected.setElementAt(new Integer(temp - change), i);
+ }
+ }
+
+ if (hiddenColumns != null)
+ {
+ deletedHiddenColumns = new ArrayList<int[]>();
+ int hSize = hiddenColumns.size();
+ for (int i = 0; i < hSize; i++)
+ {
+ int[] region = hiddenColumns.elementAt(i);
+ if (region[0] > start && start + change > region[1])
+ {
+ deletedHiddenColumns.add(region);
+
+ hiddenColumns.removeElementAt(i);
+ i--;
+ hSize--;
+ continue;
+ }
+
+ if (region[0] > start)
+ {
+ region[0] -= change;
+ region[1] -= change;
+ }
+
+ if (region[0] < 0)
+ {
+ region[0] = 0;
+ }
+
+ }
+
+ this.revealHiddenColumns(0);
+ }
+
+ return deletedHiddenColumns;
+ }
+
+ /**
+ * propagate shift in alignment columns to column selection special version of
+ * compensateForEdit - allowing for edits within hidden regions
+ *
+ * @param start
+ * beginning of edit
+ * @param left
+ * shift in edit (+ve for removal, or -ve for inserts)
+ */
+ private void compensateForDelEdits(int start, int change)
+ {
+ for (int i = 0; i < size(); i++)
+ {
+ int temp = columnAt(i);
+
+ if (temp >= start)
+ {
+ // if this ever changes to List.set(), swap parameter order!!
+ selected.setElementAt(new Integer(temp - change), i);
+ }
+ }
+
+ if (hiddenColumns != null)
+ {
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = hiddenColumns.elementAt(i);
+ if (region[0] >= start)
+ {
+ region[0] -= change;
+ }
+ if (region[1] >= start)
+ {
+ region[1] -= change;
+ }
+ if (region[1] < region[0])
+ {
+ hiddenColumns.removeElementAt(i--);
+ }
+
+ if (region[0] < 0)
+ {
+ region[0] = 0;
+ }
+ if (region[1] < 0)
+ {
+ region[1] = 0;
+ }
+ }
+ }
+ }
+
+ /**
+ * Adjust hidden column boundaries based on a series of column additions or
+ * deletions in visible regions.
+ *
+ * @param shiftrecord
+ * @return
+ */
+ public ShiftList compensateForEdits(ShiftList shiftrecord)
+ {
+ if (shiftrecord != null)
+ {
+ final List<int[]> shifts = shiftrecord.getShifts();
+ if (shifts != null && shifts.size() > 0)
+ {
+ int shifted = 0;
+ for (int i = 0, j = shifts.size(); i < j; i++)
+ {
+ int[] sh = shifts.get(i);
+ // compensateForEdit(shifted+sh[0], sh[1]);
+ compensateForDelEdits(shifted + sh[0], sh[1]);
+ shifted -= sh[1];
+ }
+ }
+ return shiftrecord.getInverse();
+ }
+ return null;
+ }
+
+ /**
+ * removes intersection of position,length ranges in deletions from the
+ * start,end regions marked in intervals.
+ *
+ * @param shifts
+ * @param intervals
+ * @return
+ */
+ private boolean pruneIntervalVector(final List<int[]> shifts,
+ Vector<int[]> intervals)
+ {
+ boolean pruned = false;
+ int i = 0, j = intervals.size() - 1, s = 0, t = shifts.size() - 1;
+ int hr[] = intervals.elementAt(i);
+ int sr[] = shifts.get(s);
+ while (i <= j && s <= t)
+ {
+ boolean trailinghn = hr[1] >= sr[0];
+ if (!trailinghn)
+ {
+ if (i < j)
+ {
+ hr = intervals.elementAt(++i);
+ }
+ else
+ {
+ i++;
+ }
+ continue;
+ }
+ int endshift = sr[0] + sr[1]; // deletion ranges - -ve means an insert
+ if (endshift < hr[0] || endshift < sr[0])
+ { // leadinghc disjoint or not a deletion
+ if (s < t)
+ {
+ sr = shifts.get(++s);
+ }
+ else
+ {
+ s++;
+ }
+ continue;
+ }
+ boolean leadinghn = hr[0] >= sr[0];
+ boolean leadinghc = hr[0] < endshift;
+ boolean trailinghc = hr[1] < endshift;
+ if (leadinghn)
+ {
+ if (trailinghc)
+ { // deleted hidden region.
+ intervals.removeElementAt(i);
+ pruned = true;
+ j--;
+ if (i <= j)
+ {
+ hr = intervals.elementAt(i);
+ }
+ continue;
+ }
+ if (leadinghc)
+ {
+ hr[0] = endshift; // clip c terminal region
+ leadinghn = !leadinghn;
+ pruned = true;
+ }
+ }
+ if (!leadinghn)
+ {
+ if (trailinghc)
+ {
+ if (trailinghn)
+ {
+ hr[1] = sr[0] - 1;
+ pruned = true;
+ }
+ }
+ else
+ {
+ // sr contained in hr
+ if (s < t)
+ {
+ sr = shifts.get(++s);
+ }
+ else
+ {
+ s++;
+ }
+ continue;
+ }
+ }
+ }
+ return pruned; // true if any interval was removed or modified by
+ // operations.
+ }
+
+ private boolean pruneColumnList(final List<int[]> shifts,
+ Vector<Integer> list)
+ {
+ int s = 0, t = shifts.size();
+ int[] sr = shifts.get(s++);
+ boolean pruned = false;
+ int i = 0, j = list.size();
+ while (i < j && s <= t)
+ {
+ int c = list.elementAt(i++).intValue();
+ if (sr[0] <= c)
+ {
+ if (sr[1] + sr[0] >= c)
+ { // sr[1] -ve means inseriton.
+ list.removeElementAt(--i);
+ j--;
+ }
+ else
+ {
+ if (s < t)
+ {
+ sr = shifts.get(s);
+ }
+ s++;
+ }
+ }
+ }
+ return pruned;
+ }
+
+ /**
+ * remove any hiddenColumns or selected columns and shift remaining based on a
+ * series of position, range deletions.
+ *
+ * @param deletions
+ */
+ public void pruneDeletions(ShiftList deletions)
+ {
+ if (deletions != null)
+ {
+ final List<int[]> shifts = deletions.getShifts();
+ if (shifts != null && shifts.size() > 0)
+ {
+ // delete any intervals intersecting.
+ if (hiddenColumns != null)
+ {
+ pruneIntervalVector(shifts, hiddenColumns);
+ if (hiddenColumns != null && hiddenColumns.size() == 0)
+ {
+ hiddenColumns = null;
+ }
+ }
+ if (selected != null && selected.size() > 0)
+ {
+ pruneColumnList(shifts, selected);
+ if (selected != null && selected.size() == 0)
+ {
+ selected = null;
+ }
+ }
+ // and shift the rest.
+ this.compensateForEdits(deletions);
+ }
+ }
+ }
+
+ /**
+ * This Method is used to return all the HiddenColumn regions
+ *
+ * @return empty list or List of hidden column intervals
+ */
+ public List<int[]> getHiddenColumns()
+ {
+ return hiddenColumns == null ? Collections.<int[]> emptyList()
+ : hiddenColumns;
+ }
+
+ /**
+ * Return absolute column index for a visible column index
+ *
+ * @param column
+ * int column index in alignment view
+ * @return alignment column index for column
+ */
+ public int adjustForHiddenColumns(int column)
+ {
+ int result = column;
+ if (hiddenColumns != null)
+ {
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = hiddenColumns.elementAt(i);
+ if (result >= region[0])
+ {
+ result += region[1] - region[0] + 1;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Use this method to find out where a column will appear in the visible
+ * alignment when hidden columns exist. If the column is not visible, then the
+ * left-most visible column will always be returned.
+ *
+ * @param hiddenColumn
+ * int
+ * @return int
+ */
+ public int findColumnPosition(int hiddenColumn)
+ {
+ int result = hiddenColumn;
+ if (hiddenColumns != null)
+ {
+ int index = 0;
+ int[] region;
+ do
+ {
+ region = hiddenColumns.elementAt(index++);
+ if (hiddenColumn > region[1])
+ {
+ result -= region[1] + 1 - region[0];
+ }
+ } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size()));
+ if (hiddenColumn > region[0] && hiddenColumn < region[1])
+ {
+ return region[0] + hiddenColumn - result;
+ }
+ }
+ return result; // return the shifted position after removing hidden columns.
+ }
+
+ /**
+ * Use this method to determine where the next hiddenRegion starts
+ */
+ public int findHiddenRegionPosition(int hiddenRegion)
+ {
+ int result = 0;
+ if (hiddenColumns != null)
+ {
+ int index = 0;
+ int gaps = 0;
+ do
+ {
+ int[] region = hiddenColumns.elementAt(index);
+ if (hiddenRegion == 0)
+ {
+ return region[0];
+ }
+
+ gaps += region[1] + 1 - region[0];
+ result = region[1] + 1;
+ index++;
+ } while (index < hiddenRegion + 1);
+
+ result -= gaps;
+ }
+
+ return result;
+ }
+
+ /**
+ * THis method returns the rightmost limit of a region of an alignment with
+ * hidden columns. In otherwords, the next hidden column.
+ *
+ * @param index
+ * int
+ */
+ public int getHiddenBoundaryRight(int alPos)
+ {
+ if (hiddenColumns != null)
+ {
+ int index = 0;
+ do
+ {
+ int[] region = hiddenColumns.elementAt(index);
+ if (alPos < region[0])
+ {
+ return region[0];
+ }
+
+ index++;
+ } while (index < hiddenColumns.size());
+ }
+
+ return alPos;
+
+ }
+
+ /**
+ * This method returns the leftmost limit of a region of an alignment with
+ * hidden columns. In otherwords, the previous hidden column.
+ *
+ * @param index
+ * int
+ */
+ public int getHiddenBoundaryLeft(int alPos)
+ {
+ if (hiddenColumns != null)
+ {
+ int index = hiddenColumns.size() - 1;
+ do
+ {
+ int[] region = hiddenColumns.elementAt(index);
+ if (alPos > region[1])
+ {
+ return region[1];
+ }
+
+ index--;
+ } while (index > -1);
+ }
+
+ return alPos;
+
+ }
+
+ public void hideSelectedColumns()
+ {
+ while (size() > 0)
+ {
+ int column = getSelected().firstElement().intValue();
+ hideColumns(column);
+ }
+
+ }
+
+ public void hideColumns(int start, int end)
+ {
+ if (hiddenColumns == null)
+ {
+ hiddenColumns = new Vector<int[]>();
+ }
+
+ boolean added = false;
+ boolean overlap = false;
+
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = hiddenColumns.elementAt(i);
+ if (start <= region[1] && end >= region[0])
+ {
+ hiddenColumns.removeElementAt(i);
+ overlap = true;
+ break;
+ }
+ else if (end < region[0] && start < region[0])
+ {
+ hiddenColumns.insertElementAt(new int[] { start, end }, i);
+ added = true;
+ break;
+ }
+ }
+
+ if (overlap)
+ {
+ hideColumns(start, end);
+ }
+ else if (!added)
+ {
+ hiddenColumns.addElement(new int[] { start, end });
+ }
+
+ }
+
+ /**
+ * This method will find a range of selected columns around the column
+ * specified
+ *
+ * @param res
+ * int
+ */
+ public void hideColumns(int col)
+ {
+ // First find out range of columns to hide
+ int min = col, max = col + 1;
+ while (contains(min))
+ {
+ removeElement(min);
+ min--;
+ }
+
+ while (contains(max))
+ {
+ removeElement(max);
+ max++;
+ }
+
+ min++;
+ max--;
+ if (min > max)
+ {
+ min = max;
+ }
+
+ hideColumns(min, max);
+ }
+
+ public void revealAllHiddenColumns()
+ {
+ if (hiddenColumns != null)
+ {
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = hiddenColumns.elementAt(i);
+ for (int j = region[0]; j < region[1] + 1; j++)
+ {
+ addElement(j);
+ }
+ }
+ }
+
+ hiddenColumns = null;
+ }
+
+ public void revealHiddenColumns(int res)
+ {
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = hiddenColumns.elementAt(i);
+ if (res == region[0])
+ {
+ for (int j = region[0]; j < region[1] + 1; j++)
+ {
+ addElement(j);
+ }
+
+ hiddenColumns.removeElement(region);
+ break;
+ }
+ }
+ if (hiddenColumns.size() == 0)
+ {
+ hiddenColumns = null;
+ }
+ }
+
+ public boolean isVisible(int column)
+ {
+ if (hiddenColumns != null)
+ {
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = hiddenColumns.elementAt(i);
+ if (column >= region[0] && column <= region[1])
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param copy
+ */
+ public ColumnSelection(ColumnSelection copy)
+ {
+ if (copy != null)
+ {
+ if (copy.selected != null)
+ {
+ selected = new Vector<Integer>();
+ for (int i = 0, j = copy.selected.size(); i < j; i++)
+ {
+ selected.addElement(copy.selected.elementAt(i));
+ }
+ }
+ if (copy.hiddenColumns != null)
+ {
+ hiddenColumns = new Vector<int[]>(copy.hiddenColumns.size());
+ for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)
+ {
+ int[] rh, cp;
+ rh = copy.hiddenColumns.elementAt(i);
+ if (rh != null)
+ {
+ cp = new int[rh.length];
+ System.arraycopy(rh, 0, cp, 0, rh.length);
+ hiddenColumns.addElement(cp);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * ColumnSelection
+ */
+ public ColumnSelection()
+ {
+ }
+
+ public String[] getVisibleSequenceStrings(int start, int end,
+ SequenceI[] seqs)
+ {
+ int i, iSize = seqs.length;
+ String selection[] = new String[iSize];
+ if (hiddenColumns != null && hiddenColumns.size() > 0)
+ {
+ for (i = 0; i < iSize; i++)
+ {
+ StringBuffer visibleSeq = new StringBuffer();
+ List<int[]> regions = getHiddenColumns();
+
+ int blockStart = start, blockEnd = end;
+ int[] region;
+ int hideStart, hideEnd;
+
+ for (int j = 0; j < regions.size(); j++)
+ {
+ region = regions.get(j);
+ hideStart = region[0];
+ hideEnd = region[1];
+
+ if (hideStart < start)
+ {
+ continue;
+ }
+
+ blockStart = Math.min(blockStart, hideEnd + 1);
+ blockEnd = Math.min(blockEnd, hideStart);
+
+ if (blockStart > blockEnd)
+ {
+ break;
+ }
+
+ visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
+
+ blockStart = hideEnd + 1;
+ blockEnd = end;
+ }
+
+ if (end > blockStart)
+ {
+ visibleSeq.append(seqs[i].getSequence(blockStart, end));
+ }
+
+ selection[i] = visibleSeq.toString();
+ }
+ }
+ else
+ {
+ for (i = 0; i < iSize; i++)
+ {
+ selection[i] = seqs[i].getSequenceAsString(start, end);
+ }
+ }
+
+ return selection;
+ }
+
+ /**
+ * return all visible segments between the given start and end boundaries
+ *
+ * @param start
+ * (first column inclusive from 0)
+ * @param end
+ * (last column - not inclusive)
+ * @return int[] {i_start, i_end, ..} where intervals lie in
+ * start<=i_start<=i_end<end
+ */
+ public int[] getVisibleContigs(int start, int end)
+ {
+ if (hiddenColumns != null && hiddenColumns.size() > 0)
+ {
+ List<int[]> visiblecontigs = new ArrayList<int[]>();
+ List<int[]> regions = getHiddenColumns();
+
+ int vstart = start;
+ int[] region;
+ int hideStart, hideEnd;
+
+ for (int j = 0; vstart < end && j < regions.size(); j++)
+ {
+ region = regions.get(j);
+ hideStart = region[0];
+ hideEnd = region[1];
+
+ if (hideEnd < vstart)
+ {
+ continue;
+ }
+ if (hideStart > vstart)
+ {
+ visiblecontigs.add(new int[] { vstart, hideStart - 1 });
+ }
+ vstart = hideEnd + 1;
+ }
+
+ if (vstart < end)
+ {
+ visiblecontigs.add(new int[] { vstart, end - 1 });
+ }
+ int[] vcontigs = new int[visiblecontigs.size() * 2];
+ for (int i = 0, j = visiblecontigs.size(); i < j; i++)
+ {
+ int[] vc = visiblecontigs.get(i);
+ visiblecontigs.set(i, null);
+ vcontigs[i * 2] = vc[0];
+ vcontigs[i * 2 + 1] = vc[1];
+ }
+ visiblecontigs.clear();
+ return vcontigs;
+ }
+ else
+ {
+ return new int[] { start, end - 1 };
+ }
+ }
+
+ /**
+ * delete any columns in alignmentAnnotation that are hidden (including
+ * sequence associated annotation).
+ *
+ * @param alignmentAnnotation
+ */
+ public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation)
+ {
+ makeVisibleAnnotation(-1, -1, alignmentAnnotation);
+ }
+
+ /**
+ * delete any columns in alignmentAnnotation that are hidden (including
+ * sequence associated annotation).
+ *
+ * @param start
+ * remove any annotation to the right of this column
+ * @param end
+ * remove any annotation to the left of this column
+ * @param alignmentAnnotation
+ * the annotation to operate on
+ */
+ public void makeVisibleAnnotation(int start, int end,
+ AlignmentAnnotation alignmentAnnotation)
+ {
+ if (alignmentAnnotation.annotations == null)
+ {
+ return;
+ }
+ if (start == end && end == -1)
+ {
+ start = 0;
+ end = alignmentAnnotation.annotations.length;
+ }
+ if (hiddenColumns != null && hiddenColumns.size() > 0)
+ {
+ // then mangle the alignmentAnnotation annotation array
+ Vector<Annotation[]> annels = new Vector<Annotation[]>();
+ Annotation[] els = null;
+ List<int[]> regions = getHiddenColumns();
+ int blockStart = start, blockEnd = end;
+ int[] region;
+ int hideStart, hideEnd, w = 0;
+
+ for (int j = 0; j < regions.size(); j++)
+ {
+ region = regions.get(j);
+ hideStart = region[0];
+ hideEnd = region[1];
+
+ if (hideStart < start)
+ {
+ continue;
+ }
+
+ blockStart = Math.min(blockStart, hideEnd + 1);
+ blockEnd = Math.min(blockEnd, hideStart);
+
+ if (blockStart > blockEnd)
+ {
+ break;
+ }
+
+ annels.addElement(els = new Annotation[blockEnd - blockStart]);
+ System.arraycopy(alignmentAnnotation.annotations, blockStart, els,
+ 0, els.length);
+ w += els.length;
+ blockStart = hideEnd + 1;
+ blockEnd = end;
+ }
+
+ if (end > blockStart)
+ {
+ annels.addElement(els = new Annotation[end - blockStart + 1]);
+ if ((els.length + blockStart) <= alignmentAnnotation.annotations.length)
+ {
+ // copy just the visible segment of the annotation row
+ System.arraycopy(alignmentAnnotation.annotations, blockStart,
+ els, 0, els.length);
+ }
+ else
+ {
+ // copy to the end of the annotation row
+ System.arraycopy(alignmentAnnotation.annotations, blockStart,
+ els, 0,
+ (alignmentAnnotation.annotations.length - blockStart));
+ }
+ w += els.length;
+ }
+ if (w == 0)
+ {
+ return;
+ }
+
+ alignmentAnnotation.annotations = new Annotation[w];
+ w = 0;
+
+ for (Annotation[] chnk : annels)
+ {
+ System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w,
+ chnk.length);
+ w += chnk.length;
+ }
+ }
+ else
+ {
+ alignmentAnnotation.restrict(start, end);
+ }
+ }
+
+ /**
+ * Invert the column selection from first to end-1. leaves hiddenColumns
+ * untouched (and unselected)
+ *
+ * @param first
+ * @param end
+ */
+ public void invertColumnSelection(int first, int width)
+ {
+ boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0;
+ for (int i = first; i < width; i++)
+ {
+ if (contains(i))
+ {
+ removeElement(i);
+ }
+ else
+ {
+ if (!hasHidden || isVisible(i))
+ {
+ addElement(i);
+ }
+ }
+ }
+ }
+
+ /**
+ * add in any unselected columns from the given column selection, excluding
+ * any that are hidden.
+ *
+ * @param colsel
+ */
+ public void addElementsFrom(ColumnSelection colsel)
+ {
+ if (colsel != null && colsel.size() > 0)
+ {
+ for (Integer col : colsel.getSelected())
+ {
+ if (hiddenColumns != null && isVisible(col.intValue()))
+ {
+ if (!selected.contains(col))
+ {
+ selected.addElement(col);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * set the selected columns the given column selection, excluding any columns
+ * that are hidden.
+ *
+ * @param colsel
+ */
+ public void setElementsFrom(ColumnSelection colsel)
+ {
+ selected = new Vector<Integer>();
+ if (colsel.selected != null && colsel.selected.size() > 0)
+ {
+ if (hiddenColumns != null && hiddenColumns.size() > 0)
+ {
+ // only select visible columns in this columns selection
+ addElementsFrom(colsel);
+ }
+ else
+ {
+ // add everything regardless
+ for (Integer col : colsel.getSelected())
+ {
+ addElement(col);
+ }
+ }
+ }
+ }
+
+ /**
+ * Add gaps into the sequences aligned to profileseq under the given
+ * AlignmentView
+ *
+ * @param profileseq
+ * @param al
+ * - alignment to have gaps inserted into it
+ * @param input
+ * - alignment view where sequence corresponding to profileseq is
+ * first entry
+ * @return new Column selection for new alignment view, with insertions into
+ * profileseq marked as hidden.
+ */
+ public static ColumnSelection propagateInsertions(SequenceI profileseq,
+ AlignmentI al, AlignmentView input)
+ {
+ int profsqpos = 0;
+
+ // return propagateInsertions(profileseq, al, )
+ char gc = al.getGapCharacter();
+ Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc);
+ ColumnSelection nview = (ColumnSelection) alandcolsel[1];
+ SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos];
+ nview.propagateInsertions(profileseq, al, origseq);
+ return nview;
+ }
+
+ /**
+ *
+ * @param profileseq
+ * - sequence in al which corresponds to origseq
+ * @param al
+ * - alignment which is to have gaps inserted into it
+ * @param origseq
+ * - sequence corresponding to profileseq which defines gap map for
+ * modifying al
+ */
+ public void propagateInsertions(SequenceI profileseq, AlignmentI al,
+ SequenceI origseq)
+ {
+ char gc = al.getGapCharacter();
+ // recover mapping between sequence's non-gap positions and positions
+ // mapping to view.
+ pruneDeletions(ShiftList.parseMap(origseq.gapMap()));
+ int[] viscontigs = getVisibleContigs(0, profileseq.getLength());
+ int spos = 0;
+ int offset = 0;
+ // input.pruneDeletions(ShiftList.parseMap(((SequenceI[])
+ // alandcolsel[0])[0].gapMap()))
+ // add profile to visible contigs
+ for (int v = 0; v < viscontigs.length; v += 2)
+ {
+ if (viscontigs[v] > spos)
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++)
+ {
+ sb.append(gc);
+ }
+ for (int s = 0, ns = al.getHeight(); s < ns; s++)
+ {
+ SequenceI sqobj = al.getSequenceAt(s);
+ if (sqobj != profileseq)
+ {
+ String sq = al.getSequenceAt(s).getSequenceAsString();
+ if (sq.length() <= spos + offset)
+ {
+ // pad sequence
+ int diff = spos + offset - sq.length() - 1;
+ if (diff > 0)
+ {
+ // pad gaps
+ sq = sq + sb;
+ while ((diff = spos + offset - sq.length() - 1) > 0)
+ {
+ // sq = sq
+ // + ((diff >= sb.length()) ? sb.toString() : sb
+ // .substring(0, diff));
+ if (diff >= sb.length())
+ {
+ sq += sb.toString();
+ }
+ else
+ {
+ char[] buf = new char[diff];
+ sb.getChars(0, diff, buf, 0);
+ sq += buf.toString();
+ }
+ }
+ }
+ sq += sb.toString();
+ }
+ else
+ {
+ al.getSequenceAt(s).setSequence(
+ sq.substring(0, spos + offset) + sb.toString()
+ + sq.substring(spos + offset));
+ }
+ }
+ }
+ // offset+=sb.length();
+ }
+ spos = viscontigs[v + 1] + 1;
+ }
+ if ((offset + spos) < profileseq.getLength())
+ {
+ // pad the final region with gaps.
+ StringBuffer sb = new StringBuffer();
+ for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++)
+ {
+ sb.append(gc);
+ }
+ for (int s = 0, ns = al.getHeight(); s < ns; s++)
+ {
+ SequenceI sqobj = al.getSequenceAt(s);
+ if (sqobj == profileseq)
+ {
+ continue;
+ }
+ String sq = sqobj.getSequenceAsString();
+ // pad sequence
+ int diff = origseq.getLength() - sq.length();
+ while (diff > 0)
+ {
+ // sq = sq
+ // + ((diff >= sb.length()) ? sb.toString() : sb
+ // .substring(0, diff));
+ if (diff >= sb.length())
+ {
+ sq += sb.toString();
+ }
+ else
+ {
+ char[] buf = new char[diff];
+ sb.getChars(0, diff, buf, 0);
+ sq += buf.toString();
+ }
+ diff = origseq.getLength() - sq.length();
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @return true if there are columns marked
+ */
+ public boolean hasSelectedColumns()
+ {
+ return (selected != null && selected.size() > 0);
+ }
+
+ /**
+ *
+ * @return true if there are columns hidden
+ */
+ public boolean hasHiddenColumns()
+ {
+ return hiddenColumns != null && hiddenColumns.size() > 0;
+ }
+
+ /**
+ *
+ * @return true if there are more than one set of columns hidden
+ */
+ public boolean hasManyHiddenColumns()
+ {
+ return hiddenColumns != null && hiddenColumns.size() > 1;
+ }
+
+ /**
+ * mark the columns corresponding to gap characters as hidden in the column
+ * selection
+ *
+ * @param sr
+ */
+ public void hideInsertionsFor(SequenceI sr)
+ {
+ List<int[]> inserts = sr.getInsertions();
+ for (int[] r : inserts)
+ {
+ hideColumns(r[0], r[1]);
+ }
+ }
+
+ public boolean filterAnnotations(Annotation[] annotations,
+ AnnotationFilterParameter filterParams)
+ {
+ this.revealAllHiddenColumns();
+ this.clear();
+ int count = 0;
+ do
+ {
+ if (annotations[count] != null)
+ {
+
+ boolean itemMatched = false;
+
+ if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD
+ && annotations[count].value >= filterParams
+ .getThresholdValue())
+ {
+ itemMatched = true;
+ }
+ if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD
+ && annotations[count].value <= filterParams
+ .getThresholdValue())
+ {
+ itemMatched = true;
+ }
+
+ if (filterParams.isFilterAlphaHelix()
+ && annotations[count].secondaryStructure == 'H')
+ {
+ itemMatched = true;
+ }
+
+ if (filterParams.isFilterBetaSheet()
+ && annotations[count].secondaryStructure == 'E')
+ {
+ itemMatched = true;
+ }
+
+ if (filterParams.isFilterTurn()
+ && annotations[count].secondaryStructure == 'S')
+ {
+ itemMatched = true;
+ }
+
+ String regexSearchString = filterParams.getRegexString();
+ if (regexSearchString != null
+ && !filterParams.getRegexSearchFields().isEmpty())
+ {
+ List<SearchableAnnotationField> fields = filterParams
+ .getRegexSearchFields();
+ try
+ {
+ if (fields.contains(SearchableAnnotationField.DISPLAY_STRING)
+ && annotations[count].displayCharacter
+ .matches(regexSearchString))
+ {
+ itemMatched = true;
+ }
+ } catch (java.util.regex.PatternSyntaxException pse)
+ {
+ if (annotations[count].displayCharacter
+ .equals(regexSearchString))
+ {
+ itemMatched = true;
+ }
+ }
+ if (fields.contains(SearchableAnnotationField.DESCRIPTION)
+ && annotations[count].description != null
+ && annotations[count].description
+ .matches(regexSearchString))
+ {
+ itemMatched = true;
+ }
+ }
+
+ if (itemMatched)
+ {
+ this.addElement(count);
+ }
+ }
+ count++;
+ } while (count < annotations.length);
+ return false;
+ }
+}
diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java
index 853255d..bc5588a 100644
--- a/src/jalview/datamodel/DBRefEntry.java
+++ b/src/jalview/datamodel/DBRefEntry.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
@@ -66,12 +69,20 @@ public class DBRefEntry
(entry.map == null ? null : new Mapping(entry.map)));
}
- public boolean equals(DBRefEntry entry)
+ @Override
+ public boolean equals(Object o)
{
+ // TODO should also override hashCode to ensure equal objects have equal
+ // hashcodes
+ if (o == null || !(o instanceof DBRefEntry))
+ {
+ return false;
+ }
+ DBRefEntry entry = (DBRefEntry) o;
if (entry == this)
+ {
return true;
- if (entry == null)
- return false;
+ }
if (equalRef(entry)
&& ((map == null && entry.map == null) || (map != null
&& entry.map != null && map.equals(entry.map))))
@@ -94,7 +105,9 @@ public class DBRefEntry
return false;
}
if (entry == this)
+ {
return true;
+ }
if ((source != null && entry.source != null && source
.equalsIgnoreCase(entry.source))
&& (accessionId != null && entry.accessionId != null && accessionId
@@ -180,4 +193,9 @@ public class DBRefEntry
return ((source != null) ? source : "") + ":"
+ ((accessionId != null) ? accessionId : "");
}
+
+ public String toString()
+ {
+ return getSrcAccString();
+ }
}
diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java
index e1f5f41..3982802 100644
--- a/src/jalview/datamodel/DBRefSource.java
+++ b/src/jalview/datamodel/DBRefSource.java
@@ -1,133 +1,140 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-/**
- * Defines internal constants for unambiguous annotation of DbRefEntry source
- * strings and describing the data retrieved from external database sources (see
- * jalview.ws.DbSourcProxy)
- *
- * @author JimP
- *
- */
-public class DBRefSource
-{
- /**
- * UNIPROT Accession Number
- */
- public static String UNIPROT = "UNIPROT";
-
- /**
- * UNIPROT Entry Name
- */
- public static String UP_NAME = "UNIPROT_NAME";
-
- /**
- * Uniprot Knowledgebase/TrEMBL as served from EMBL protein products.
- */
- public static final String UNIPROTKB = "UniProtKB/TrEMBL";
-
- /**
- * PDB Entry Code
- */
- public static String PDB = "PDB";
-
- /**
- * EMBL ID
- */
- public static String EMBL = "EMBL";
-
- /**
- * EMBLCDS ID
- */
- public static String EMBLCDS = "EMBLCDS";
-
- /**
- * PFAM ID
- */
- public static String PFAM = "PFAM";
-
- /**
- * GeneDB ID
- */
- public static final String GENEDB = "GeneDB";
-
- /**
- * List of databases whose sequences might have coding regions annotated
- */
- public static final String[] DNACODINGDBS =
- { EMBL, EMBLCDS, GENEDB };
-
- public static final String[] CODINGDBS =
- { EMBLCDS, GENEDB };
-
- public static final String[] PROTEINDBS =
- { UNIPROT, PDB, UNIPROTKB };
-
- public static final String[] PROTEINSEQ =
- { UNIPROT, UNIPROTKB };
-
- public static final String[] PROTEINSTR =
- { PDB };
-
- public static final String[] DOMAINDBS =
- { PFAM };
-
- /**
- * set of unique DBRefSource property constants. These could be used to
- * reconstruct the above groupings
- */
- public static final Object SEQDB = "SQ";
-
- /**
- * database of nucleic acid sequences
- */
- public static final Object DNASEQDB = "NASQ";
-
- /**
- * database of amino acid sequences
- */
- public static final Object PROTSEQDB = "PROTSQ";
-
- /**
- * database of cDNA sequences
- */
- public static final Object CODINGSEQDB = "CODING";
-
- /**
- * database of na sequences with exon annotation
- */
- public static final Object DNACODINGSEQDB = "XONCODING";
-
- /**
- * DB returns several sequences associated with a protein domain
- */
- public static final Object DOMAINDB = "DOMAIN";
-
- /**
- * DB query can take multiple accession codes concatenated by a separator.
- * Value of property indicates maximum number of accession codes to send at a
- * time.
- */
- public static final Object MULTIACC = "MULTIACC";
-
- /**
- * DB query returns an alignment for each accession provided.
- */
- public static final Object ALIGNMENTDB = "ALIGNMENTS";
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+/**
+ * Defines internal constants for unambiguous annotation of DbRefEntry source
+ * strings and describing the data retrieved from external database sources (see
+ * jalview.ws.DbSourcProxy)
+ *
+ * @author JimP
+ *
+ */
+public class DBRefSource
+{
+ /**
+ * UNIPROT Accession Number
+ */
+ public static String UNIPROT = "UNIPROT";
+
+ /**
+ * UNIPROT Entry Name
+ */
+ public static String UP_NAME = "UNIPROT_NAME".toUpperCase();
+
+ /**
+ * Uniprot Knowledgebase/TrEMBL as served from EMBL protein products.
+ */
+ public static final String UNIPROTKB = "UniProtKB/TrEMBL".toUpperCase();
+
+ public static final String EMBLCDSProduct = "EMBLCDSProtein"
+ .toUpperCase();
+
+ /**
+ * PDB Entry Code
+ */
+ public static String PDB = "PDB";
+
+ /**
+ * EMBL ID
+ */
+ public static String EMBL = "EMBL";
+
+ /**
+ * EMBLCDS ID
+ */
+ public static String EMBLCDS = "EMBLCDS";
+
+ /**
+ * PFAM ID
+ */
+ public static String PFAM = "PFAM";
+
+ /**
+ * RFAM ID
+ */
+ public static String RFAM = "RFAM";
+
+ /**
+ * GeneDB ID
+ */
+ public static final String GENEDB = "GeneDB".toUpperCase();
+
+ /**
+ * List of databases whose sequences might have coding regions annotated
+ */
+ public static final String[] DNACODINGDBS = { EMBL, EMBLCDS, GENEDB };
+
+ public static final String[] CODINGDBS = { EMBLCDS, GENEDB };
+
+ public static final String[] PROTEINDBS = { UNIPROT, PDB, UNIPROTKB,
+ EMBLCDSProduct };
+
+ public static final String[] PROTEINSEQ = { UNIPROT, UNIPROTKB,
+ EMBLCDSProduct };
+
+ public static final String[] PROTEINSTR = { PDB };
+
+ public static final String[] DOMAINDBS = { PFAM, RFAM };
+
+ /**
+ * set of unique DBRefSource property constants. These could be used to
+ * reconstruct the above groupings
+ */
+ public static final Object SEQDB = "SQ";
+
+ /**
+ * database of nucleic acid sequences
+ */
+ public static final Object DNASEQDB = "NASQ";
+
+ /**
+ * database of amino acid sequences
+ */
+ public static final Object PROTSEQDB = "PROTSQ";
+
+ /**
+ * database of cDNA sequences
+ */
+ public static final Object CODINGSEQDB = "CODING";
+
+ /**
+ * database of na sequences with exon annotation
+ */
+ public static final Object DNACODINGSEQDB = "XONCODING";
+
+ /**
+ * DB returns several sequences associated with a protein/nucleotide domain
+ */
+ public static final Object DOMAINDB = "DOMAIN";
+
+ /**
+ * DB query can take multiple accession codes concatenated by a separator.
+ * Value of property indicates maximum number of accession codes to send at a
+ * time.
+ */
+ public static final Object MULTIACC = "MULTIACC";
+
+ /**
+ * DB query returns an alignment for each accession provided.
+ */
+ public static final Object ALIGNMENTDB = "ALIGNMENTS";
+}
diff --git a/src/jalview/datamodel/FeatureProperties.java b/src/jalview/datamodel/FeatureProperties.java
index 8c238ef..17a2e64 100644
--- a/src/jalview/datamodel/FeatureProperties.java
+++ b/src/jalview/datamodel/FeatureProperties.java
@@ -1,48 +1,73 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-/**
- * A set of feature property constants used by jalview
- *
- * @author JimP
- *
- */
-public class FeatureProperties
-{
-
- public static final String EXONPOS = "exon number";
-
- public static final String EXONPRODUCT = "product";
-
- /**
- * lookup feature type for a particular database to see if its a coding region
- * feature
- *
- * @param dbrefsource
- * @param string
- * @return
- */
- public static boolean isCodingFeature(String dbrefsource, String type)
- {
- return ((dbrefsource == null
- || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) || dbrefsource
- .equalsIgnoreCase(DBRefSource.EMBLCDS)) && type
- .equalsIgnoreCase("CDS"));
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+/**
+ * A set of feature property constants used by jalview
+ *
+ * @author JimP
+ *
+ */
+public class FeatureProperties
+{
+
+ private static final String EMBL_CODING_FEATURE = "CDS";
+
+ public static final String EXONPOS = "exon number";
+
+ public static final String EXONPRODUCT = "product";
+
+ /**
+ * lookup feature type for a particular database to see if its a coding region
+ * feature
+ *
+ * @param dbrefsource
+ * @param string
+ * @return
+ */
+ public static boolean isCodingFeature(String dbrefsource, String type)
+ {
+ if (type.equalsIgnoreCase(EMBL_CODING_FEATURE))
+ {
+ return (dbrefsource == null
+ || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) || dbrefsource
+ .equalsIgnoreCase(DBRefSource.EMBLCDS));
+ }
+ return false;
+ }
+
+ /**
+ * Returns the coding feature name for a database source. Currently just
+ * hard-coded to return CDS for EMBL/EMBLCDS, else null.
+ *
+ * @param dbrefsource
+ * @return
+ */
+ public static String getCodingFeature(String dbrefsource)
+ {
+ if (DBRefSource.EMBL.equalsIgnoreCase(dbrefsource)
+ || DBRefSource.EMBLCDS.equalsIgnoreCase(dbrefsource))
+ {
+ return EMBL_CODING_FEATURE;
+ }
+ return null;
+ }
+}
diff --git a/src/jalview/datamodel/GraphLine.java b/src/jalview/datamodel/GraphLine.java
index deab08a..5fdd946 100644
--- a/src/jalview/datamodel/GraphLine.java
+++ b/src/jalview/datamodel/GraphLine.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
@@ -51,4 +54,20 @@ public class GraphLine
displayed = from.displayed;
}
}
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj != null && obj instanceof GraphLine)
+ {
+ GraphLine other = (GraphLine) obj;
+ return displayed == other.displayed
+ && value == other.value
+ && (colour != null ? (other.colour != null && other.colour
+ .equals(colour)) : other.colour == null)
+ && (label != null ? (other.label != null && other.label
+ .equals(label)) : other.label == null);
+ }
+ return false;
+ }
}
diff --git a/src/jalview/datamodel/HiddenSequences.java b/src/jalview/datamodel/HiddenSequences.java
index 901cf35..09c1b78 100644
--- a/src/jalview/datamodel/HiddenSequences.java
+++ b/src/jalview/datamodel/HiddenSequences.java
@@ -1,23 +1,28 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
public class HiddenSequences
{
@@ -140,32 +145,34 @@ public class HiddenSequences
alignment.deleteSequence(sequence);
}
- public Vector showAll(Hashtable hiddenReps)
+ public List<SequenceI> showAll(
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- Vector revealedSeqs = new Vector();
+ List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
for (int i = 0; i < hiddenSequences.length; i++)
{
if (hiddenSequences[i] != null)
{
- Vector tmp = showSequence(i, hiddenReps);
- for (int t = 0; t < tmp.size(); t++)
+ List<SequenceI> tmp = showSequence(i, hiddenRepSequences);
+ for (SequenceI seq : tmp)
{
- revealedSeqs.addElement(tmp.elementAt(t));
+ revealedSeqs.add(seq);
}
}
}
return revealedSeqs;
}
- public Vector showSequence(int alignmentIndex, Hashtable hiddenReps)
+ public List<SequenceI> showSequence(int alignmentIndex,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- Vector revealedSeqs = new Vector();
+ List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
SequenceI repSequence = alignment.getSequenceAt(alignmentIndex);
- if (repSequence != null && hiddenReps != null
- && hiddenReps.containsKey(repSequence))
+ if (repSequence != null && hiddenRepSequences != null
+ && hiddenRepSequences.containsKey(repSequence))
{
- hiddenReps.remove(repSequence);
- revealedSeqs.addElement(repSequence);
+ hiddenRepSequences.remove(repSequence);
+ revealedSeqs.add(repSequence);
}
int start = adjustForHiddenSeqs(alignmentIndex - 1);
@@ -175,25 +182,29 @@ public class HiddenSequences
end = hiddenSequences.length - 1;
}
- for (int index = end; index > start; index--)
+ List<SequenceI> asequences;
+ synchronized (asequences = alignment.getSequences())
{
- SequenceI seq = hiddenSequences[index];
- hiddenSequences[index] = null;
-
- if (seq != null)
+ for (int index = end; index > start; index--)
{
- if (seq.getLength() > 0)
- {
- revealedSeqs.addElement(seq);
- alignment.getSequences().insertElementAt(seq, alignmentIndex);
- }
- else
+ SequenceI seq = hiddenSequences[index];
+ hiddenSequences[index] = null;
+
+ if (seq != null)
{
- System.out.println(seq.getName()
- + " has been deleted whilst hidden");
+ if (seq.getLength() > 0)
+ {
+ revealedSeqs.add(seq);
+ asequences.add(alignmentIndex, seq);
+ }
+ else
+ {
+ System.out.println(seq.getName()
+ + " has been deleted whilst hidden");
+ }
}
- }
+ }
}
return revealedSeqs;
@@ -261,17 +272,25 @@ public class HiddenSequences
index++;
}
}
+ Alignment fAlignmt = new Alignment(seq);
+ fAlignmt.annotations = alignment.getAlignmentAnnotation();
+ fAlignmt.alignmentProperties = alignment.getProperties();
+ fAlignmt.groups = alignment.getGroups();
+ fAlignmt.hasRNAStructure = alignment.hasRNAStructure();
- return new Alignment(seq);
+ return fAlignmt;
}
public boolean isHidden(SequenceI seq)
{
- for (int i = 0; i < hiddenSequences.length; i++)
+ if (hiddenSequences != null)
{
- if (hiddenSequences[i] != null && hiddenSequences[i] == seq)
+ for (int i = 0; i < hiddenSequences.length; i++)
{
- return true;
+ if (hiddenSequences[i] != null && hiddenSequences[i] == seq)
+ {
+ return true;
+ }
}
}
diff --git a/src/jalview/datamodel/IncompleteCodonException.java b/src/jalview/datamodel/IncompleteCodonException.java
new file mode 100644
index 0000000..f2b5a50
--- /dev/null
+++ b/src/jalview/datamodel/IncompleteCodonException.java
@@ -0,0 +1,33 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+/**
+ * An exception to indicate that less than 3 nucleotide bases are available when
+ * trying to form a codon.
+ *
+ * @author gmcarstairs
+ *
+ */
+public class IncompleteCodonException extends RuntimeException
+{
+
+}
diff --git a/src/jalview/datamodel/Mapping.java b/src/jalview/datamodel/Mapping.java
index 7116a2b..2e76e41 100644
--- a/src/jalview/datamodel/Mapping.java
+++ b/src/jalview/datamodel/Mapping.java
@@ -1,37 +1,275 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.Vector;
-
import jalview.util.MapList;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+
public class Mapping
{
/**
+ * An iterator that serves the aligned codon positions (with their protein
+ * products).
+ *
+ * @author gmcarstairs
+ *
+ */
+ public class AlignedCodonIterator implements Iterator<AlignedCodon>
+ {
+ /*
+ * The gap character used in the aligned sequence
+ */
+ private final char gap;
+
+ /*
+ * The characters of the aligned sequence e.g. "-cGT-ACgTG-"
+ */
+ private final char[] alignedSeq;
+
+ /*
+ * Next position (base 0) in the aligned sequence
+ */
+ private int alignedColumn = 0;
+
+ /*
+ * Count of bases up to and including alignedColumn position
+ */
+ private int alignedBases = 0;
+
+ /*
+ * [start, end] from ranges (base 1)
+ */
+ private Iterator<int[]> fromRanges;
+
+ /*
+ * [start, end] to ranges (base 1)
+ */
+ private Iterator<int[]> toRanges;
+
+ /*
+ * The current [start, end] (base 1) from range
+ */
+ private int[] currentFromRange = null;
+
+ /*
+ * The current [start, end] (base 1) to range
+ */
+ private int[] currentToRange = null;
+
+ /*
+ * The next 'from' position (base 1) to process
+ */
+ private int fromPosition = 0;
+
+ /*
+ * The next 'to' position (base 1) to process
+ */
+ private int toPosition = 0;
+
+ /**
+ * Constructor
+ *
+ * @param cs
+ * the aligned sequence characters
+ * @param gapChar
+ */
+ public AlignedCodonIterator(char[] cs, char gapChar)
+ {
+ this.alignedSeq = cs;
+ this.gap = gapChar;
+ fromRanges = map.getFromRanges().iterator();
+ toRanges = map.getToRanges().iterator();
+ if (fromRanges.hasNext())
+ {
+ currentFromRange = fromRanges.next();
+ fromPosition = currentFromRange[0];
+ }
+ if (toRanges.hasNext())
+ {
+ currentToRange = toRanges.next();
+ toPosition = currentToRange[0];
+ }
+ }
+
+ /**
+ * Returns true unless we have already traversed the whole mapping.
+ */
+ @Override
+ public boolean hasNext()
+ {
+ if (fromRanges.hasNext())
+ {
+ return true;
+ }
+ if (currentFromRange == null || fromPosition >= currentFromRange[1])
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the next codon's aligned positions, and translated value.
+ *
+ * @throws NoSuchElementException
+ * if hasNext() would have returned false
+ * @throws IncompleteCodonException
+ * if not enough mapped bases are left to make up a codon
+ */
+ @Override
+ public AlignedCodon next() throws IncompleteCodonException
+ {
+ if (!hasNext())
+ {
+ throw new NoSuchElementException();
+ }
+
+ int[] codon = getNextCodon();
+ int[] alignedCodon = getAlignedCodon(codon);
+
+ String peptide = getPeptide();
+ return new AlignedCodon(alignedCodon[0], alignedCodon[1],
+ alignedCodon[2], peptide);
+ }
+
+ /**
+ * Retrieve the translation as the 'mapped to' position in the mapped to
+ * sequence.
+ *
+ * @return
+ */
+ private String getPeptide()
+ {
+ // TODO should ideally handle toRatio other than 1 as well...
+ // i.e. code like getNextCodon()
+ if (toPosition <= currentToRange[1])
+ {
+ char pep = Mapping.this.to.getSequence()[toPosition - 1];
+ toPosition++;
+ return String.valueOf(pep);
+ }
+ if (!toRanges.hasNext())
+ {
+ throw new NoSuchElementException("Ran out of peptide at position "
+ + toPosition);
+ }
+ currentToRange = toRanges.next();
+ toPosition = currentToRange[0];
+ return getPeptide();
+ }
+
+ /**
+ * Get the (base 1) dataset positions for the next codon in the mapping.
+ *
+ * @throws IncompleteCodonException
+ * if less than 3 remaining bases are mapped
+ */
+ private int[] getNextCodon()
+ {
+ int[] codon = new int[3];
+ int codonbase = 0;
+
+ while (codonbase < 3)
+ {
+ if (fromPosition <= currentFromRange[1])
+ {
+ /*
+ * Add next position from the current start-end range
+ */
+ codon[codonbase++] = fromPosition++;
+ }
+ else
+ {
+ /*
+ * Move to the next range - if there is one
+ */
+ if (!fromRanges.hasNext())
+ {
+ throw new IncompleteCodonException();
+ }
+ currentFromRange = fromRanges.next();
+ fromPosition = currentFromRange[0];
+ }
+ }
+ return codon;
+ }
+
+ /**
+ * Get the aligned column positions (base 0) for the given sequence
+ * positions (base 1), by counting ungapped characters in the aligned
+ * sequence.
+ *
+ * @param codon
+ * @return
+ */
+ private int[] getAlignedCodon(int[] codon)
+ {
+ int[] aligned = new int[codon.length];
+ for (int i = 0; i < codon.length; i++)
+ {
+ aligned[i] = getAlignedColumn(codon[i]);
+ }
+ return aligned;
+ }
+
+ /**
+ * Get the aligned column position (base 0) for the given sequence position
+ * (base 1).
+ *
+ * @param sequencePos
+ * @return
+ */
+ private int getAlignedColumn(int sequencePos)
+ {
+ while (alignedBases < sequencePos
+ && alignedColumn < alignedSeq.length)
+ {
+ if (alignedSeq[alignedColumn++] != gap)
+ {
+ alignedBases++;
+ }
+ }
+ return alignedColumn - 1;
+ }
+
+ @Override
+ public void remove()
+ {
+ // ignore
+ }
+
+ }
+
+ /**
* Contains the start-end pairs mapping from the associated sequence to the
- * sequence in the database coordinate system it also takes care of step
- * difference between coordinate systems
+ * sequence in the database coordinate system. It also takes care of step
+ * difference between coordinate systems.
*/
MapList map = null;
/**
- * The seuqence that map maps the associated seuqence to (if any).
+ * The sequence that map maps the associated sequence to (if any).
*/
SequenceI to = null;
@@ -108,19 +346,33 @@ public class Mapping
* @param other
* @return
*/
- public boolean equals(Mapping other)
+ @Override
+ public boolean equals(Object o)
{
- if (other == null)
+ // TODO should override Object.hashCode() to ensure that equal objects have
+ // equal hashcodes
+ if (o == null || !(o instanceof Mapping))
+ {
return false;
+ }
+ Mapping other = (Mapping) o;
if (other == this)
+ {
return true;
+ }
if (other.to != to)
+ {
return false;
+ }
if ((map != null && other.map == null)
|| (map == null && other.map != null))
+ {
return false;
- if (map.equals(other.map))
+ }
+ if ((map == null && other.map == null) || map.equals(other.map))
+ {
return true;
+ }
return false;
}
@@ -215,8 +467,7 @@ public class Mapping
int[] mp = map.shiftFrom(pos);
if (mp != null)
{
- return new int[]
- { mp[0], mp[0] + mp[2] * (map.getToRatio() - 1) };
+ return new int[] { mp[0], mp[0] + mp[2] * (map.getToRatio() - 1) };
}
}
return null;
@@ -248,7 +499,9 @@ public class Mapping
vf[v].setBegin(frange[i]);
vf[v].setEnd(frange[i + 1]);
if (frange.length > 2)
+ {
vf[v].setDescription(f.getDescription() + "\nPart " + (v + 1));
+ }
}
return vf;
}
@@ -275,8 +528,7 @@ public class Mapping
}
}
// give up and just return the feature.
- return new SequenceFeature[]
- { f };
+ return new SequenceFeature[] { f };
}
/**
@@ -297,19 +549,22 @@ public class Mapping
from = (map.getToLowest() < from) ? from : map.getToLowest();
to = (map.getToHighest() > to) ? to : map.getToHighest();
if (from > to)
+ {
return null;
+ }
}
else
{
from = (map.getToHighest() > from) ? from : map.getToHighest();
to = (map.getToLowest() < to) ? to : map.getToLowest();
if (from < to)
+ {
return null;
+ }
}
return map.locateInFrom(from, to);
}
- return new int[]
- { from, to };
+ return new int[] { from, to };
}
/**
@@ -330,19 +585,22 @@ public class Mapping
from = (map.getFromLowest() < from) ? from : map.getFromLowest();
to = (map.getFromHighest() > to) ? to : map.getFromHighest();
if (from > to)
+ {
return null;
+ }
}
else
{
from = (map.getFromHighest() > from) ? from : map.getFromHighest();
to = (map.getFromLowest() < to) ? to : map.getFromLowest();
if (from < to)
+ {
return null;
+ }
}
return map.locateInTo(from, to);
}
- return new int[]
- { from, to };
+ return new int[] { from, to };
}
/**
@@ -370,13 +628,11 @@ public class Mapping
{
for (int m = 0; m < mpr.length; m += 2)
{
- toRange.addElement(new int[]
- { mpr[m], mpr[m + 1] });
+ toRange.addElement(new int[] { mpr[m], mpr[m + 1] });
int[] xpos = locateRange(mpr[m], mpr[m + 1]);
for (int x = 0; x < xpos.length; x += 2)
{
- fromRange.addElement(new int[]
- { xpos[x], xpos[x + 1] });
+ fromRange.addElement(new int[] { xpos[x], xpos[x + 1] });
}
}
}
@@ -402,24 +658,6 @@ public class Mapping
return copy;
}
- public static void main(String[] args)
- {
- /**
- * trite test of the intersectVisContigs method for a simple DNA -> Protein
- * exon map and a range of visContigs
- */
- MapList fk = new MapList(new int[]
- { 1, 6, 8, 13, 15, 23 }, new int[]
- { 1, 7 }, 3, 1);
- Mapping m = new Mapping(fk);
- Mapping m_1 = m.intersectVisContigs(new int[]
- { fk.getFromLowest(), fk.getFromHighest() });
- Mapping m_2 = m.intersectVisContigs(new int[]
- { 1, 7, 11, 20 });
- System.out.println("" + m_1.map.getFromRanges());
-
- }
-
/**
* get the sequence being mapped to - if any
*
@@ -452,4 +690,9 @@ public class Mapping
super.finalize();
}
+ public Iterator<AlignedCodon> getCodonIterator(SequenceI seq, char gapChar)
+ {
+ return new AlignedCodonIterator(seq.getSequence(), gapChar);
+ }
+
}
diff --git a/src/jalview/datamodel/NodeTransformI.java b/src/jalview/datamodel/NodeTransformI.java
index 0e1c880..4bc3871 100644
--- a/src/jalview/datamodel/NodeTransformI.java
+++ b/src/jalview/datamodel/NodeTransformI.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java
index d65293f..06790d7 100644
--- a/src/jalview/datamodel/PDBEntry.java
+++ b/src/jalview/datamodel/PDBEntry.java
@@ -1,31 +1,41 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.Hashtable;
public class PDBEntry
{
- String file;
+ private String file;
+
+ private String type;
- String type;
+ private String id;
- String id;
+ private String chainCode;
+
+ public enum Type
+ {
+ PDB, FILE
+ }
Hashtable properties;
@@ -34,6 +44,7 @@ public class PDBEntry
*
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj)
{
if (obj == null || !(obj instanceof PDBEntry))
@@ -41,28 +52,61 @@ public class PDBEntry
return false;
}
if (obj == this)
+ {
return true;
+ }
PDBEntry o = (PDBEntry) obj;
- return (file == o.file || (file != null && o.file != null && o.file
- .equals(file)))
- && (type == o.type || (type != null && o.type != null && o.type
- .equals(type)))
+ return (type == o.type || (type != null && o.type != null && o.type
+ .equals(type)))
&& (id == o.id || (id != null && o.id != null && o.id
.equalsIgnoreCase(id)))
+ && (chainCode == o.chainCode || (chainCode != null
+ && o.chainCode != null && o.chainCode
+ .equalsIgnoreCase(chainCode)))
&& (properties == o.properties || (properties != null
&& o.properties != null && properties
- .equals(o.properties)));
+ .equals(o.properties)));
+
}
+ /**
+ * Default constructor
+ */
public PDBEntry()
{
}
+ /**
+ * Constructor given file path and PDB id.
+ *
+ * @param filePath
+ */
+ // public PDBEntry(String filePath, String pdbId)
+ // {
+ // this.file = filePath;
+ // this.id = pdbId;
+ // }
+
+ public PDBEntry(String pdbId, String chain, PDBEntry.Type type,
+ String filePath)
+ {
+ this.id = pdbId;
+ this.chainCode = chain;
+ this.type = type == null ? null : type.toString();
+ this.file = filePath;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param entry
+ */
public PDBEntry(PDBEntry entry)
{
file = entry.file;
type = entry.type;
id = entry.id;
+ chainCode = entry.chainCode;
if (entry.properties != null)
{
properties = (Hashtable) entry.properties.clone();
@@ -79,9 +123,14 @@ public class PDBEntry
return file;
}
- public void setType(String type)
+ public void setType(String t)
{
- this.type = type;
+ this.type = t;
+ }
+
+ public void setType(PDBEntry.Type type)
+ {
+ this.type = type == null ? null : type.toString();
}
public String getType()
@@ -109,4 +158,18 @@ public class PDBEntry
return properties;
}
+ public String getChainCode()
+ {
+ return chainCode;
+ }
+
+ public void setChainCode(String chainCode)
+ {
+ this.chainCode = chainCode;
+ }
+
+ public String toString()
+ {
+ return id;
+ }
}
diff --git a/src/jalview/datamodel/Provenance.java b/src/jalview/datamodel/Provenance.java
index cb3bbf7..48752aa 100644
--- a/src/jalview/datamodel/Provenance.java
+++ b/src/jalview/datamodel/Provenance.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.Vector;
public class Provenance
{
diff --git a/src/jalview/datamodel/ProvenanceEntry.java b/src/jalview/datamodel/ProvenanceEntry.java
index d6711d7..8f168ab 100644
--- a/src/jalview/datamodel/ProvenanceEntry.java
+++ b/src/jalview/datamodel/ProvenanceEntry.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
diff --git a/src/jalview/datamodel/RnaViewerModel.java b/src/jalview/datamodel/RnaViewerModel.java
new file mode 100644
index 0000000..d76c28e
--- /dev/null
+++ b/src/jalview/datamodel/RnaViewerModel.java
@@ -0,0 +1,64 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+/**
+ * A data bean class to hold properties of an RNA viewer
+ */
+public class RnaViewerModel
+{
+ public final String viewId;
+
+ public final String title;
+
+ public final int x;
+
+ public final int y;
+
+ public final int width;
+
+ public final int height;
+
+ public final int dividerLocation;
+
+ /**
+ * Constructor
+ *
+ * @param viewId
+ * @param title
+ * @param xpos
+ * @param ypos
+ * @param width
+ * @param height
+ * @param dividerLocation
+ */
+ public RnaViewerModel(String viewId, String title, int xpos, int ypos,
+ int width, int height, int dividerLocation)
+ {
+ this.viewId = viewId;
+ this.title = title;
+ this.x = xpos;
+ this.y = ypos;
+ this.width = width;
+ this.height = height;
+ this.dividerLocation = dividerLocation;
+ }
+}
diff --git a/src/jalview/datamodel/SearchResults.java b/src/jalview/datamodel/SearchResults.java
index 89268f0..d9d12db 100644
--- a/src/jalview/datamodel/SearchResults.java
+++ b/src/jalview/datamodel/SearchResults.java
@@ -1,26 +1,149 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Holds a list of search result matches, where each match is a contiguous
+ * stretch of a single sequence.
+ *
+ * @author gmcarstairs
+ *
+ */
public class SearchResults
{
- Match[] matches;
+ private List<Match> matches = new ArrayList<Match>();
+
+ /**
+ * One match consists of a sequence reference, start and end positions.
+ * Discontiguous ranges in a sequence require two or more Match objects.
+ */
+ public class Match
+ {
+ SequenceI sequence;
+
+ /**
+ * Start position of match in sequence (base 1)
+ */
+ int start;
+
+ /**
+ * End position (inclusive) (base 1)
+ */
+ int end;
+
+ /**
+ * Constructor
+ *
+ * @param seq
+ * a sequence
+ * @param start
+ * start position of matched range (base 1)
+ * @param end
+ * end of matched range (inclusive, base 1)
+ */
+ public Match(SequenceI seq, int start, int end)
+ {
+ sequence = seq;
+ this.start = start;
+ this.end = end;
+ }
+
+ public SequenceI getSequence()
+ {
+ return sequence;
+ }
+
+ public int getStart()
+ {
+ return start;
+ }
+
+ public int getEnd()
+ {
+ return end;
+ }
+
+ /**
+ * Returns the string of characters in the matched region, prefixed by the
+ * start position, e.g. "12CGT" or "208K"
+ */
+ @Override
+ public String toString()
+ {
+ final int from = Math.max(start - 1, 0);
+ String startPosition = String.valueOf(from);
+ return startPosition + getCharacters();
+ }
+
+ /**
+ * Returns the string of characters in the matched region.
+ */
+ public String getCharacters()
+ {
+ char[] chars = sequence.getSequence();
+ // convert start/end to base 0 (with bounds check)
+ final int from = Math.max(start - 1, 0);
+ final int to = Math.min(end, chars.length + 1);
+ return String.valueOf(Arrays.copyOfRange(chars, from, to));
+ }
+
+ public void setSequence(SequenceI seq)
+ {
+ this.sequence = seq;
+ }
+
+ /**
+ * Hashcode is the hashcode of the matched sequence plus a hash of start and
+ * end positions. Match objects that pass the test for equals are guaranteed
+ * to have the same hashcode.
+ */
+ @Override
+ public int hashCode()
+ {
+ int hash = sequence == null ? 0 : sequence.hashCode();
+ hash += 31 * start;
+ hash += 67 * end;
+ return hash;
+ }
+
+ /**
+ * Two Match objects are equal if they are for the same sequence, start and
+ * end positions
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null || !(obj instanceof Match))
+ {
+ return false;
+ }
+ Match m = (Match) obj;
+ return (this.sequence == m.sequence && this.start == m.start && this.end == m.end);
+ }
+ }
/**
* This method replaces the old search results which merely held an alignment
@@ -36,25 +159,7 @@ public class SearchResults
*/
public void addResult(SequenceI seq, int start, int end)
{
- if (matches == null)
- {
- matches = new Match[]
- { new Match(seq, start, end) };
- return;
- }
-
- int mSize = matches.length;
-
- Match[] tmp = new Match[mSize + 1];
- int m;
- for (m = 0; m < mSize; m++)
- {
- tmp[m] = matches[m];
- }
-
- tmp[m] = new Match(seq, start, end);
-
- matches = tmp;
+ matches.add(new Match(seq, start, end));
}
/**
@@ -66,15 +171,11 @@ public class SearchResults
*/
public boolean involvesSequence(SequenceI sequence)
{
- if (matches == null || matches.length == 0)
- {
- return false;
- }
SequenceI ds = sequence.getDatasetSequence();
- for (int m = 0; m < matches.length; m++)
+ for (Match m : matches)
{
- if (matches[m].sequence != null
- && (matches[m].sequence == sequence || matches[m].sequence == ds))
+ if (m.sequence != null
+ && (m.sequence == sequence || m.sequence == ds))
{
return true;
}
@@ -89,7 +190,7 @@ public class SearchResults
*/
public int[] getResults(SequenceI sequence, int start, int end)
{
- if (matches == null)
+ if (matches.isEmpty())
{
return null;
}
@@ -98,22 +199,22 @@ public class SearchResults
int[] tmp = null;
int resultLength, matchStart = 0, matchEnd = 0;
boolean mfound;
- for (int m = 0; m < matches.length; m++)
+ for (Match m : matches)
{
mfound = false;
- if (matches[m].sequence == sequence)
+ if (m.sequence == sequence)
{
mfound = true;
// locate aligned position
- matchStart = sequence.findIndex(matches[m].start) - 1;
- matchEnd = sequence.findIndex(matches[m].end) - 1;
+ matchStart = sequence.findIndex(m.start) - 1;
+ matchEnd = sequence.findIndex(m.end) - 1;
}
- else if (matches[m].sequence == sequence.getDatasetSequence())
+ else if (m.sequence == sequence.getDatasetSequence())
{
mfound = true;
// locate region in local context
- matchStart = sequence.findIndex(matches[m].start) - 1;
- matchEnd = sequence.findIndex(matches[m].end) - 1;
+ matchStart = sequence.findIndex(m.start) - 1;
+ matchEnd = sequence.findIndex(m.end) - 1;
}
if (mfound)
{
@@ -131,8 +232,7 @@ public class SearchResults
if (result == null)
{
- result = new int[]
- { matchStart, matchEnd };
+ result = new int[] { matchStart, matchEnd };
}
else
{
@@ -143,9 +243,12 @@ public class SearchResults
result[resultLength] = matchStart;
result[resultLength + 1] = matchEnd;
}
- } else {
- // debug
- // System.err.println("Outwith bounds!" + matchStart+">"+end +" or " + matchEnd+"<"+start);
+ }
+ else
+ {
+ // debug
+ // System.err.println("Outwith bounds!" + matchStart+">"+end +" or "
+ // + matchEnd+"<"+start);
}
}
}
@@ -154,37 +257,114 @@ public class SearchResults
public int getSize()
{
- return matches == null ? 0 : matches.length;
+ return matches.size();
}
public SequenceI getResultSequence(int index)
{
- return matches[index].sequence;
+ return matches.get(index).sequence;
}
- public int getResultStart(int index)
+ /**
+ * Returns the start position of the i'th match in the search results.
+ *
+ * @param i
+ * @return
+ */
+ public int getResultStart(int i)
{
- return matches[index].start;
+ return matches.get(i).start;
}
- public int getResultEnd(int index)
+ /**
+ * Returns the end position of the i'th match in the search results.
+ *
+ * @param i
+ * @return
+ */
+ public int getResultEnd(int i)
{
- return matches[index].end;
+ return matches.get(i).end;
}
- class Match
+ /**
+ * Returns true if no search result matches are held.
+ *
+ * @return
+ */
+ public boolean isEmpty()
{
- SequenceI sequence;
+ return matches.isEmpty();
+ }
- int start;
+ /**
+ * Returns the list of matches.
+ *
+ * @return
+ */
+ public List<Match> getResults()
+ {
+ return matches;
+ }
- int end;
+ /**
+ * Return the results as a string of characters (bases) prefixed by start
+ * position(s). Meant for use when the context ensures that all matches are to
+ * regions of the same sequence (otherwise the result is meaningless).
+ *
+ * @return
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder result = new StringBuilder(256);
+ for (Match m : matches)
+ {
+ result.append(m.toString());
+ }
+ return result.toString();
+ }
- public Match(SequenceI seq, int start, int end)
+ /**
+ * Return the results as a string of characters (bases). Meant for use when
+ * the context ensures that all matches are to regions of the same sequence
+ * (otherwise the result is meaningless).
+ *
+ * @return
+ */
+ public String getCharacters()
+ {
+ StringBuilder result = new StringBuilder(256);
+ for (Match m : matches)
{
- sequence = seq;
- this.start = start;
- this.end = end;
+ result.append(m.getCharacters());
+ }
+ return result.toString();
+ }
+
+ /**
+ * Hashcode is has derived from the list of matches. This ensures that when
+ * two SearchResults objects satisfy the test for equals(), then they have the
+ * same hashcode.
+ */
+ @Override
+ public int hashCode()
+ {
+ return matches.hashCode();
+ }
+
+ /**
+ * Two SearchResults are considered equal if they contain the same matches in
+ * the same order.
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null || !(obj instanceof SearchResults))
+ {
+ return false;
}
+ SearchResults sr = (SearchResults) obj;
+ return ((ArrayList<Match>) this.matches).equals(sr.matches);
}
}
diff --git a/src/jalview/datamodel/SecondaryStructureAnnotation.java b/src/jalview/datamodel/SecondaryStructureAnnotation.java
new file mode 100644
index 0000000..e488265
--- /dev/null
+++ b/src/jalview/datamodel/SecondaryStructureAnnotation.java
@@ -0,0 +1,52 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import fr.orsay.lri.varna.models.rna.RNA;
+
+public class SecondaryStructureAnnotation extends AlignmentAnnotation
+{
+
+ private static RNA _rna = null;
+
+ public SecondaryStructureAnnotation(RNA rna)
+ {
+ super("Secondary Structure", "Un truc trop cool", getAnnotation(rna));
+
+ _rna = rna;
+ }
+
+ public RNA getRNA()
+ {
+ return _rna;
+ }
+
+ public static Annotation[] getAnnotation(RNA rna)
+ {
+ Annotation[] ann = new Annotation[rna.getSize()];
+ for (int i = 0; i < ann.length; i++)
+ {
+ ann[i] = new Annotation(_rna.getStructDBN(true), "", ' ', 0f);
+ ;
+ }
+ return ann;
+ }
+}
diff --git a/src/jalview/datamodel/SeqCigar.java b/src/jalview/datamodel/SeqCigar.java
index 182ad7b..33cfda4 100644
--- a/src/jalview/datamodel/SeqCigar.java
+++ b/src/jalview/datamodel/SeqCigar.java
@@ -1,28 +1,32 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
+import jalview.analysis.AlignSeq;
+import jalview.analysis.SeqsetUtils;
+import jalview.util.MessageManager;
+import jalview.util.ShiftList;
+
import java.util.Enumeration;
import java.util.Hashtable;
-import java.util.Vector;
-
-import jalview.analysis.*;
-import jalview.util.*;
public class SeqCigar extends CigarSimple
{
@@ -92,7 +96,8 @@ public class SeqCigar extends CigarSimple
if (edit_result == null)
{
throw new Error(
- "Implementation Error - unexpected null from getSequenceAndDeletions");
+ MessageManager
+ .getString("error.implementation_error_unexpected_null_from_get_sequence_and_deletions"));
}
int bounds[] = (int[]) edit_result[1];
seq = new Sequence(refseq.getName(), (String) edit_result[0],
@@ -140,11 +145,15 @@ public class SeqCigar extends CigarSimple
boolean hasgaps = false;
if (seq == null)
{
- throw new Error("Implementation Error - _setSeq(null,...)");
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_set_seq_null"));
}
if (_s < 0)
{
- throw new Error("Implementation Error: _s=" + _s);
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_s", new String[] { Integer
+ .valueOf(_s).toString() }));
}
String seq_string = seq.getSequenceAsString();
if (_e == 0 || _e < _s || _e > seq_string.length())
@@ -211,7 +220,8 @@ public class SeqCigar extends CigarSimple
if (end > ds.getLength())
{
throw new Error(
- "SeqCigar: Possible implementation error: sequence is longer than dataset sequence");
+ MessageManager
+ .getString("error.implementation_error_seqcigar_possible"));
// end = ds.getLength();
}
@@ -235,12 +245,14 @@ public class SeqCigar extends CigarSimple
super();
if (seq == null)
{
- throw new Error("Implementation Bug. Null seq !");
+ throw new Error(
+ MessageManager.getString("error.implmentation_bug_seq_null"));
}
if (operation.length != range.length)
{
throw new Error(
- "Implementation Bug. Cigar Operation list!= range list");
+ MessageManager
+ .getString("error.implementation_bug_cigar_operation_list_range_list"));
}
if (operation != null)
@@ -251,16 +263,21 @@ public class SeqCigar extends CigarSimple
if (_setSeq(seq, false, 0, 0))
{
throw new Error(
- "NOT YET Implemented: Constructing a Cigar object from a cigar string and a gapped sequence.");
+ MessageManager
+ .getString("error.not_yet_implemented_cigar_object_from_cigar_string"));
}
for (int i = this.length, j = 0; j < operation.length; i++, j++)
{
char op = operation[j];
if (op != M && op != I && op != D)
{
- throw new Error("Implementation Bug. Cigar Operation '" + j
- + "' '" + op + "' not one of '" + M + "', '" + I
- + "', or '" + D + "'.");
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_bug_cigar_operation", new String[] {
+ Integer.valueOf(j).toString(),
+ Integer.valueOf(op).toString(),
+ Integer.valueOf(M).toString(),
+ Integer.valueOf(I).toString(),
+ Integer.valueOf(D).toString() }));
}
this.operation[i] = op;
this.range[i] = range[j];
@@ -275,7 +292,8 @@ public class SeqCigar extends CigarSimple
if (_setSeq(seq, false, 0, 0))
{
throw new Error(
- "NOT YET Implemented: Constructing a Cigar object from a cigar string and a gapped sequence.");
+ MessageManager
+ .getString("error.not_yet_implemented_cigar_object_from_cigar_string"));
}
}
}
@@ -382,7 +400,9 @@ public class SeqCigar extends CigarSimple
super();
if (seq == null)
{
- throw new Error("Implementation error for new Cigar(SequenceI)");
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_for_new_cigar"));
}
_setSeq(seq, false, 0, 0);
// there is still work to do
@@ -404,7 +424,9 @@ public class SeqCigar extends CigarSimple
super();
if (seq == null)
{
- throw new Error("Implementation error for new Cigar(SequenceI)");
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_for_new_cigar"));
}
_setSeq(seq, false, start, end + 1);
// there is still work to do
@@ -459,8 +481,9 @@ public class SeqCigar extends CigarSimple
// endcol}, hidden regions {{start, end, col}})
if (gs_regions[i] == null)
{
- throw new Error("Implementation error: " + i
- + "'th sequence Cigar has no operations.");
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_cigar_seq_no_operations",
+ new String[] { Integer.valueOf(i).toString() }));
}
g_seqs[i] = new StringBuffer((String) ((Object[]) gs_regions[i])[0]); // the
// visible
@@ -544,157 +567,6 @@ public class SeqCigar extends CigarSimple
}
/**
- * non rigorous testing
- */
- /**
- *
- * @param seq
- * Sequence
- * @param ex_cs_gapped
- * String
- * @return String
- */
- public static String testCigar_string(Sequence seq, String ex_cs_gapped)
- {
- SeqCigar c_sgapped = new SeqCigar(seq);
- String cs_gapped = c_sgapped.getCigarstring();
- if (!cs_gapped.equals(ex_cs_gapped))
- {
- System.err.println("Failed getCigarstring: incorect string '"
- + cs_gapped + "' != " + ex_cs_gapped);
- }
- return cs_gapped;
- }
-
- public static boolean testSeqRecovery(SeqCigar gen_sgapped,
- SequenceI s_gapped)
- {
- // this is non-rigorous - start and end recovery is not tested.
- SequenceI gen_sgapped_s = gen_sgapped.getSeq('-');
- if (!gen_sgapped_s.getSequence().equals(s_gapped.getSequence()))
- {
- System.err.println("Couldn't reconstruct sequence.\n"
- + gen_sgapped_s.getSequenceAsString() + "\n"
- + s_gapped.getSequenceAsString());
- return false;
- }
- return true;
- }
-
- public static void main(String argv[]) throws Exception
- {
- String o_seq;
- Sequence s = new Sequence("MySeq",
- o_seq = "asdfktryasdtqwrtsaslldddptyipqqwaslchvhttt", 39, 80);
- String orig_gapped;
- Sequence s_gapped = new Sequence(
- "MySeq",
- orig_gapped = "----asdf------ktryas---dtqwrtsasll----dddptyipqqwa----slchvhttt",
- 39, 80);
- String ex_cs_gapped = "4I4M6I6M3I11M4I12M4I9M";
- s_gapped.setDatasetSequence(s);
- String sub_gapped_s;
- Sequence s_subsequence_gapped = new Sequence(
- "MySeq",
- sub_gapped_s = "------ktryas---dtqwrtsasll----dddptyipqqwa----slchvh",
- 43, 77);
-
- s_subsequence_gapped.setDatasetSequence(s);
- SeqCigar c_null = new SeqCigar(s);
- String cs_null = c_null.getCigarstring();
- if (!cs_null.equals("42M"))
- {
- System.err
- .println("Failed to recover ungapped sequence cigar operations:"
- + ((cs_null == "") ? "empty string" : cs_null));
- }
- testCigar_string(s_gapped, ex_cs_gapped);
- SeqCigar gen_sgapped = SeqCigar.parseCigar(s, ex_cs_gapped);
- if (!gen_sgapped.getCigarstring().equals(ex_cs_gapped))
- {
- System.err.println("Failed parseCigar(" + ex_cs_gapped
- + ")->getCigarString()->'" + gen_sgapped.getCigarstring()
- + "'");
- }
- testSeqRecovery(gen_sgapped, s_gapped);
- // Test dataset resolution
- SeqCigar sub_gapped = new SeqCigar(s_subsequence_gapped);
- if (!testSeqRecovery(sub_gapped, s_subsequence_gapped))
- {
- System.err
- .println("Failed recovery for subsequence of dataset sequence");
- }
- // width functions
- if (sub_gapped.getWidth() != sub_gapped_s.length())
- {
- System.err.println("Failed getWidth()");
- }
-
- sub_gapped.getFullWidth();
- if (sub_gapped.hasDeletedRegions())
- {
- System.err.println("hasDeletedRegions is incorrect.");
- }
- // Test start-end region SeqCigar
- SeqCigar sub_se_gp = new SeqCigar(s_subsequence_gapped, 8, 48);
- if (sub_se_gp.getWidth() != 41)
- {
- System.err
- .println("SeqCigar(seq, start, end) not properly clipped alignsequence.");
- }
- System.out.println("Original sequence align:\n" + sub_gapped_s
- + "\nReconstructed window from 8 to 48\n" + "XXXXXXXX"
- + sub_se_gp.getSequenceString('-') + "..." + "\nCigar String:"
- + sub_se_gp.getCigarstring() + "\n");
- SequenceI ssgp = sub_se_gp.getSeq('-');
- System.out.println("\t " + ssgp.getSequenceAsString());
- for (int r = 0; r < 10; r++)
- {
- sub_se_gp = new SeqCigar(s_subsequence_gapped, 8, 48);
- int sl = sub_se_gp.getWidth();
- int st = sl - 1 - r;
- for (int rs = 0; rs < 10; rs++)
- {
- int e = st + rs;
- sub_se_gp.deleteRange(st, e);
- String ssgapedseq = sub_se_gp.getSeq('-').getSequenceAsString();
- System.out.println(st + "," + e + "\t:" + ssgapedseq);
- st -= 3;
- }
- }
- {
- SeqCigar[] set = new SeqCigar[]
- { new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
- new SeqCigar(s_gapped) };
- Alignment al = new Alignment(set);
- for (int i = 0; i < al.getHeight(); i++)
- {
- System.out.println("" + al.getSequenceAt(i).getName() + "\t"
- + al.getSequenceAt(i).getStart() + "\t"
- + al.getSequenceAt(i).getEnd() + "\t"
- + al.getSequenceAt(i).getSequenceAsString());
- }
- }
- {
- System.out.println("Gapped.");
- SeqCigar[] set = new SeqCigar[]
- { new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
- new SeqCigar(s_gapped) };
- set[0].deleteRange(20, 25);
- Alignment al = new Alignment(set);
- for (int i = 0; i < al.getHeight(); i++)
- {
- System.out.println("" + al.getSequenceAt(i).getName() + "\t"
- + al.getSequenceAt(i).getStart() + "\t"
- + al.getSequenceAt(i).getEnd() + "\t"
- + al.getSequenceAt(i).getSequenceAsString());
- }
- }
- // if (!ssgapedseq.equals("ryas---dtqqwa----slchvh"))
- // System.err.println("Subseqgaped\n------ktryas---dtqwrtsasll----dddptyipqqwa----slchvhryas---dtqwrtsasll--qwa----slchvh\n"+ssgapedseq+"\n"+sub_se_gp.getCigarstring());
- }
-
- /**
* references to entities that this sequence cigar is associated with.
*/
private Hashtable selGroups = null;
diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java
index 52d9a72..def9c47 100644
--- a/src/jalview/datamodel/Sequence.java
+++ b/src/jalview/datamodel/Sequence.java
@@ -1,25 +1,34 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import jalview.analysis.AlignSeq;
+import jalview.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
-import jalview.analysis.*;
+import fr.orsay.lri.varna.models.rna.RNA;
/**
*
@@ -28,7 +37,7 @@ import jalview.analysis.*;
* @author $author$
* @version $Revision$
*/
-public class Sequence implements SequenceI
+public class Sequence extends ASequence implements SequenceI
{
SequenceI datasetSequence;
@@ -42,19 +51,28 @@ public class Sequence implements SequenceI
int end;
- Vector pdbIds;
+ Vector<PDBEntry> pdbIds;
String vamsasId;
DBRefEntry[] dbrefs;
+ RNA rna;
+
/**
* This annotation is displayed below the alignment but the positions are tied
* to the residues of this sequence
+ *
+ * TODO: change to List<>
+ */
+ Vector<AlignmentAnnotation> annotation;
+
+ /**
+ * The index of the sequence in a MSA
*/
- Vector annotation;
+ int index = -1;
- /** array of seuqence features - may not be null for a valid sequence object */
+ /** array of sequence features - may not be null for a valid sequence object */
public SequenceFeature[] sequenceFeatures;
/**
@@ -72,20 +90,30 @@ public class Sequence implements SequenceI
*/
public Sequence(String name, String sequence, int start, int end)
{
- this.name = name;
- this.sequence = sequence.toCharArray();
- this.start = start;
- this.end = end;
- parseId();
- checkValidRange();
+ initSeqAndName(name, sequence.toCharArray(), start, end);
}
public Sequence(String name, char[] sequence, int start, int end)
{
- this.name = name;
- this.sequence = sequence;
- this.start = start;
- this.end = end;
+ initSeqAndName(name, sequence, start, end);
+ }
+
+ /**
+ * Stage 1 constructor - assign name, sequence, and set start and end fields.
+ * start and end are updated values from name2 if it ends with /start-end
+ *
+ * @param name2
+ * @param sequence2
+ * @param start2
+ * @param end2
+ */
+ protected void initSeqAndName(String name2, char[] sequence2, int start2,
+ int end2)
+ {
+ this.name = name2;
+ this.sequence = sequence2;
+ this.start = start2;
+ this.end = end2;
parseId();
checkValidRange();
}
@@ -103,7 +131,7 @@ public class Sequence implements SequenceI
.println("POSSIBLE IMPLEMENTATION ERROR: null sequence name passed to constructor.");
name = "";
}
- // Does sequence have the /start-end signiature?
+ // Does sequence have the /start-end signature?
if (limitrx.search(name))
{
name = limitrx.left();
@@ -116,7 +144,8 @@ public class Sequence implements SequenceI
void checkValidRange()
{
- // Note: JAL-774 : http://issues.jalview.org/browse/JAL-774?focusedCommentId=11239&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-11239
+ // Note: JAL-774 :
+ // http://issues.jalview.org/browse/JAL-774?focusedCommentId=11239&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-11239
{
int endRes = 0;
for (int j = 0; j < sequence.length; j++)
@@ -131,7 +160,8 @@ public class Sequence implements SequenceI
endRes += start - 1;
}
- if (end<endRes) {
+ if (end < endRes)
+ {
end = endRes;
}
}
@@ -176,7 +206,15 @@ public class Sequence implements SequenceI
*/
public Sequence(SequenceI seq, AlignmentAnnotation[] alAnnotation)
{
- this(seq.getName(), seq.getSequence(), seq.getStart(), seq.getEnd());
+ initSeqFrom(seq, alAnnotation);
+
+ }
+
+ protected void initSeqFrom(SequenceI seq,
+ AlignmentAnnotation[] alAnnotation)
+ {
+ initSeqAndName(seq.getName(), seq.getSequence(), seq.getStart(),
+ seq.getEnd());
description = seq.getDescription();
if (seq.getSequenceFeatures() != null)
{
@@ -221,9 +259,9 @@ public class Sequence implements SequenceI
}
}
}
- if (seq.getPDBId() != null)
+ if (seq.getAllPDBEntries() != null)
{
- Vector ids = seq.getPDBId();
+ Vector ids = seq.getAllPDBEntries();
Enumeration e = ids.elements();
while (e.hasMoreElements())
{
@@ -307,34 +345,60 @@ public class Sequence implements SequenceI
}
/**
- * DOCUMENT ME!
+ * Returns the sequence features (if any), looking first on the sequence, then
+ * on its dataset sequence, and so on until a non-null value is found (or
+ * none). This supports retrieval of sequence features stored on the sequence
+ * (as in the applet) or on the dataset sequence (as in the Desktop version).
*
- * @return DOCUMENT ME!
+ * @return
*/
public SequenceFeature[] getSequenceFeatures()
{
- return sequenceFeatures;
+ SequenceFeature[] features = sequenceFeatures;
+
+ SequenceI seq = this;
+ int count = 0; // failsafe against loop in sequence.datasetsequence...
+ while (features == null && seq.getDatasetSequence() != null
+ && count++ < 10)
+ {
+ seq = seq.getDatasetSequence();
+ features = ((Sequence) seq).sequenceFeatures;
+ }
+ return features;
}
public void addPDBId(PDBEntry entry)
{
if (pdbIds == null)
{
- pdbIds = new Vector();
+ pdbIds = new Vector<PDBEntry>();
}
- if (!pdbIds.contains(entry))
+ if (pdbIds.contains(entry))
+ {
+ updatePDBEntry(pdbIds.get(pdbIds.indexOf(entry)), entry);
+ }
+ else
{
pdbIds.addElement(entry);
}
}
+ private static void updatePDBEntry(PDBEntry oldEntry, PDBEntry newEntry)
+ {
+ if (newEntry.getFile() != null)
+ {
+ oldEntry.setFile(newEntry.getFile());
+ }
+ }
+
/**
* DOCUMENT ME!
*
* @param id
* DOCUMENT ME!
*/
- public void setPDBId(Vector id)
+ @Override
+ public void setPDBId(Vector<PDBEntry> id)
{
pdbIds = id;
}
@@ -344,7 +408,8 @@ public class Sequence implements SequenceI
*
* @return DOCUMENT ME!
*/
- public Vector getPDBId()
+ @Override
+ public Vector<PDBEntry> getAllPDBEntries()
{
return pdbIds;
}
@@ -474,7 +539,9 @@ public class Sequence implements SequenceI
public char[] getSequence(int start, int end)
{
if (start < 0)
+ {
start = 0;
+ }
// JBPNote - left to user to pad the result here (TODO:Decide on this
// policy)
if (start >= sequence.length)
@@ -493,16 +560,7 @@ public class Sequence implements SequenceI
return reply;
}
- /**
- * make a new Sequence object from start to end (including gaps) over this
- * seqeunce
- *
- * @param start
- * int
- * @param end
- * int
- * @return SequenceI
- */
+ @Override
public SequenceI getSubSequence(int start, int end)
{
if (start < 0)
@@ -571,13 +629,10 @@ public class Sequence implements SequenceI
return this.description;
}
- /**
- * Return the alignment position for a sequence position
- *
- * @param pos
- * lying from start to end
+ /*
+ * (non-Javadoc)
*
- * @return aligned position of residue pos
+ * @see jalview.datamodel.SequenceI#findIndex(int)
*/
public int findIndex(int pos)
{
@@ -605,14 +660,7 @@ public class Sequence implements SequenceI
}
}
- /**
- * Returns the sequence position for an alignment position
- *
- * @param i
- * column index in alignment (from 1)
- *
- * @return residue number for residue (left of and) nearest ith column
- */
+ @Override
public int findPosition(int i)
{
int j = 0;
@@ -659,11 +707,7 @@ public class Sequence implements SequenceI
return map;
}
- /*
- * (non-Javadoc)
- *
- * @see jalview.datamodel.SequenceI#findPositionMap()
- */
+ @Override
public int[] findPositionMap()
{
int map[] = new int[sequence.length];
@@ -683,33 +727,55 @@ public class Sequence implements SequenceI
return map;
}
- /*
- * (non-Javadoc)
- *
- * @see jalview.datamodel.SequenceI#deleteChars(int, int)
- */
- public void deleteChars(int i, int j)
+ @Override
+ public List<int[]> getInsertions()
{
- int newstart = start, newend = end;
- if (i >= sequence.length)
+ ArrayList<int[]> map = new ArrayList<int[]>();
+ int lastj = -1, j = 0;
+ int pos = start;
+ int seqlen = sequence.length;
+ while ((j < seqlen))
{
- return;
+ if (jalview.util.Comparison.isGap(sequence[j]))
+ {
+ if (lastj == -1)
+ {
+ lastj = j;
+ }
+ }
+ else
+ {
+ if (lastj != -1)
+ {
+ map.add(new int[] { lastj, j - 1 });
+ lastj = -1;
+ }
+ }
+ j++;
}
-
- char[] tmp;
-
- if (j >= sequence.length)
+ if (lastj != -1)
{
- tmp = new char[i];
- System.arraycopy(sequence, 0, tmp, 0, i);
+ map.add(new int[] { lastj, j - 1 });
+ lastj = -1;
}
- else
+ return map;
+ }
+
+ @Override
+ public void deleteChars(int i, int j)
+ {
+ int newstart = start, newend = end;
+ if (i >= sequence.length || i < 0)
{
- tmp = new char[sequence.length - j + i];
- System.arraycopy(sequence, 0, tmp, 0, i);
- System.arraycopy(sequence, j, tmp, i, sequence.length - j);
+ return;
}
+
+ char[] tmp = StringUtils.deleteChars(sequence, i, j);
boolean createNewDs = false;
+ // TODO: take a (second look) at the dataset creation validation method for
+ // the very large sequence case
+ int eindex = -1, sindex = -1;
+ boolean ecalc = false, scalc = false;
for (int s = i; s < j; s++)
{
if (jalview.schemes.ResidueProperties.aaIndex[sequence[s]] != 23)
@@ -720,7 +786,11 @@ public class Sequence implements SequenceI
}
else
{
- int sindex = findIndex(start) - 1;
+ if (!scalc)
+ {
+ sindex = findIndex(start) - 1;
+ scalc = true;
+ }
if (sindex == s)
{
// delete characters including start of sequence
@@ -730,7 +800,11 @@ public class Sequence implements SequenceI
else
{
// delete characters after start.
- int eindex = findIndex(end) - 1;
+ if (!ecalc)
+ {
+ eindex = findIndex(end) - 1;
+ ecalc = true;
+ }
if (eindex < j)
{
// delete characters at end of sequence
@@ -762,16 +836,7 @@ public class Sequence implements SequenceI
sequence = tmp;
}
- /**
- * DOCUMENT ME!
- *
- * @param i
- * DOCUMENT ME!
- * @param c
- * DOCUMENT ME!
- * @param chop
- * DOCUMENT ME!
- */
+ @Override
public void insertCharAt(int i, int length, char c)
{
char[] tmp = new char[sequence.length + length];
@@ -801,26 +866,31 @@ public class Sequence implements SequenceI
sequence = tmp;
}
+ @Override
public void insertCharAt(int i, char c)
{
insertCharAt(i, 1, c);
}
+ @Override
public String getVamsasId()
{
return vamsasId;
}
+ @Override
public void setVamsasId(String id)
{
vamsasId = id;
}
+ @Override
public void setDBRef(DBRefEntry[] dbref)
{
dbrefs = dbref;
}
+ @Override
public DBRefEntry[] getDBRef()
{
if (dbrefs == null && datasetSequence != null
@@ -831,6 +901,7 @@ public class Sequence implements SequenceI
return dbrefs;
}
+ @Override
public void addDBRef(DBRefEntry entry)
{
if (dbrefs == null)
@@ -863,40 +934,42 @@ public class Sequence implements SequenceI
dbrefs = temp;
}
+ @Override
public void setDatasetSequence(SequenceI seq)
{
datasetSequence = seq;
}
+ @Override
public SequenceI getDatasetSequence()
{
return datasetSequence;
}
+ @Override
public AlignmentAnnotation[] getAnnotation()
{
- if (annotation == null)
- {
- return null;
- }
-
- AlignmentAnnotation[] ret = new AlignmentAnnotation[annotation.size()];
- for (int r = 0; r < ret.length; r++)
- {
- ret[r] = (AlignmentAnnotation) annotation.elementAt(r);
- }
+ return annotation == null ? null : annotation
+ .toArray(new AlignmentAnnotation[annotation.size()]);
+ }
- return ret;
+ @Override
+ public boolean hasAnnotation(AlignmentAnnotation ann)
+ {
+ return annotation == null ? false : annotation.contains(ann);
}
+ @Override
public void addAlignmentAnnotation(AlignmentAnnotation annotation)
{
if (this.annotation == null)
{
- this.annotation = new Vector();
+ this.annotation = new Vector<AlignmentAnnotation>();
+ }
+ if (!this.annotation.contains(annotation))
+ {
+ this.annotation.addElement(annotation);
}
-
- this.annotation.addElement(annotation);
annotation.setSequenceRef(this);
}
@@ -906,7 +979,9 @@ public class Sequence implements SequenceI
{
this.annotation.removeElement(annotation);
if (this.annotation.size() == 0)
+ {
this.annotation = null;
+ }
}
}
@@ -930,11 +1005,7 @@ public class Sequence implements SequenceI
return true;
}
- /*
- * (non-Javadoc)
- *
- * @see jalview.datamodel.SequenceI#deriveSequence()
- */
+ @Override
public SequenceI deriveSequence()
{
SequenceI seq = new Sequence(this);
@@ -982,9 +1053,20 @@ public class Sequence implements SequenceI
// move database references onto dataset sequence
datasetSequence.setDBRef(getDBRef());
setDBRef(null);
- datasetSequence.setPDBId(getPDBId());
+ datasetSequence.setPDBId(getAllPDBEntries());
setPDBId(null);
datasetSequence.updatePDBIds();
+ if (annotation != null)
+ {
+ for (AlignmentAnnotation aa : annotation)
+ {
+ AlignmentAnnotation _aa = new AlignmentAnnotation(aa);
+ _aa.sequenceRef = datasetSequence;
+ _aa.adjustForAlignment(); // uses annotation's own record of
+ // sequence-column mapping
+ datasetSequence.addAlignmentAnnotation(_aa);
+ }
+ }
}
return datasetSequence;
}
@@ -1007,16 +1089,14 @@ public class Sequence implements SequenceI
for (int i = 0; i < annotations.length; i++)
{
if (annotations[i] != null)
+ {
addAlignmentAnnotation(annotations[i]);
+ }
}
}
}
- /*
- * (non-Javadoc)
- *
- * @see jalview.datamodel.SequenceI#getAnnotation(java.lang.String)
- */
+ @Override
public AlignmentAnnotation[] getAnnotation(String label)
{
if (annotation == null || annotation.size() == 0)
@@ -1049,6 +1129,7 @@ public class Sequence implements SequenceI
return anns;
}
+ @Override
public boolean updatePDBIds()
{
if (datasetSequence != null)
@@ -1102,13 +1183,7 @@ public class Sequence implements SequenceI
return false;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.datamodel.SequenceI#transferAnnotation(jalview.datamodel.SequenceI,
- * jalview.datamodel.Mapping)
- */
+ @Override
public void transferAnnotation(SequenceI entry, Mapping mp)
{
if (datasetSequence != null)
@@ -1129,8 +1204,7 @@ public class Sequence implements SequenceI
for (int si = 0; si < sfs.length; si++)
{
SequenceFeature sf[] = (mp != null) ? mp.locateFeature(sfs[si])
- : new SequenceFeature[]
- { new SequenceFeature(sfs[si]) };
+ : new SequenceFeature[] { new SequenceFeature(sfs[si]) };
if (sf != null && sf.length > 0)
{
for (int sfi = 0; sfi < sf.length; sfi++)
@@ -1142,9 +1216,9 @@ public class Sequence implements SequenceI
}
// transfer PDB entries
- if (entry.getPDBId() != null)
+ if (entry.getAllPDBEntries() != null)
{
- Enumeration e = entry.getPDBId().elements();
+ Enumeration e = entry.getAllPDBEntries().elements();
while (e.hasMoreElements())
{
PDBEntry pdb = (PDBEntry) e.nextElement();
@@ -1172,4 +1246,79 @@ public class Sequence implements SequenceI
}
}
+ /**
+ * @return The index (zero-based) on this sequence in the MSA. It returns
+ * {@code -1} if this information is not available.
+ */
+ public int getIndex()
+ {
+ return index;
+ }
+
+ /**
+ * Defines the position of this sequence in the MSA. Use the value {@code -1}
+ * if this information is undefined.
+ *
+ * @param The
+ * position for this sequence. This value is zero-based (zero for
+ * this first sequence)
+ */
+ public void setIndex(int value)
+ {
+ index = value;
+ }
+
+ public void setRNA(RNA r)
+ {
+ rna = r;
+ }
+
+ public RNA getRNA()
+ {
+ return rna;
+ }
+
+ @Override
+ public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+ String label)
+ {
+ List<AlignmentAnnotation> result = new ArrayList<AlignmentAnnotation>();
+ if (this.annotation != null)
+ {
+ for (AlignmentAnnotation ann : annotation)
+ {
+ if (ann.calcId != null && ann.calcId.equals(calcId)
+ && ann.label != null && ann.label.equals(label))
+ {
+ result.add(ann);
+ }
+ }
+ }
+ return result;
+ }
+
+ public String toString()
+ {
+ return getDisplayId(false);
+ }
+
+ @Override
+ public PDBEntry getPDBEntry(String pdbIdStr)
+ {
+ if (getDatasetSequence() == null
+ || getDatasetSequence().getAllPDBEntries() == null)
+ {
+ return null;
+ }
+ List<PDBEntry> entries = getDatasetSequence().getAllPDBEntries();
+ for (PDBEntry entry : entries)
+ {
+ if (entry.getId().equalsIgnoreCase(pdbIdStr))
+ {
+ return entry;
+ }
+ }
+ return null;
+ }
+
}
diff --git a/src/jalview/datamodel/SequenceCollectionI.java b/src/jalview/datamodel/SequenceCollectionI.java
new file mode 100644
index 0000000..96c7af8
--- /dev/null
+++ b/src/jalview/datamodel/SequenceCollectionI.java
@@ -0,0 +1,67 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import java.util.List;
+import java.util.Map;
+
+public interface SequenceCollectionI
+{
+ List<SequenceI> getSequences();
+
+ List<SequenceI> getSequences(
+ Map<SequenceI, SequenceCollectionI> hiddenReps);
+
+ int getWidth();
+
+ /**
+ *
+ * @return true if getSeqrep doesn't return null
+ */
+ boolean hasSeqrep();
+
+ /**
+ * get the reference or representative sequence within this collection
+ *
+ * @return null or the current reference sequence
+ */
+ SequenceI getSeqrep();
+
+ /**
+ * set the reference or representative sequence for this collection. Reference
+ * is assumed to be present within the collection.
+ *
+ * @return
+ */
+ void setSeqrep(SequenceI refseq);
+
+ /**
+ * @return the first column included in this collection. Runs from 0<=i<N_cols
+ */
+ int getStartRes();
+
+ /**
+ *
+ * @return the last column in this collection. Runs from 0<=i<N_cols
+ */
+ int getEndRes();
+
+}
diff --git a/src/jalview/datamodel/SequenceDummy.java b/src/jalview/datamodel/SequenceDummy.java
new file mode 100644
index 0000000..e189f31
--- /dev/null
+++ b/src/jalview/datamodel/SequenceDummy.java
@@ -0,0 +1,53 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+public class SequenceDummy extends Sequence implements SequenceI
+{
+ public SequenceDummy(String sequenceId)
+ {
+ super(sequenceId, "THISAPLACEHOLDER");
+ }
+
+ private boolean dummy = true;
+
+ /**
+ * become a proxy for mseq, merging any existing annotation on this sequence
+ *
+ * @param mseq
+ */
+ public void become(SequenceI mseq)
+ {
+ initSeqFrom(mseq, null);
+ dummy = false;
+ }
+
+ /**
+ * Test if the SequenceDummy has been promoted to a real sequence via
+ * SequenceDummy.become
+ *
+ * @return true if this is a placeholder and contains no actual sequence data
+ */
+ public boolean isDummy()
+ {
+ return dummy;
+ }
+}
diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java
index 6fed6ee..674f1e7 100644
--- a/src/jalview/datamodel/SequenceFeature.java
+++ b/src/jalview/datamodel/SequenceFeature.java
@@ -1,23 +1,27 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.Hashtable;
+import java.util.Vector;
/**
* DOCUMENT ME!
@@ -39,7 +43,7 @@ public class SequenceFeature
public Hashtable otherDetails;
- public java.util.Vector links;
+ public Vector<String> links;
// Feature group can be set from a features file
// as a group of features between STARTGROUP and ENDGROUP markers
@@ -87,7 +91,7 @@ public class SequenceFeature
}
if (cpy.links != null && cpy.links.size() > 0)
{
- links = new Vector();
+ links = new Vector<String>();
for (int i = 0, iSize = cpy.links.size(); i < iSize; i++)
{
links.addElement(cpy.links.elementAt(i));
@@ -208,7 +212,7 @@ public class SequenceFeature
{
if (links == null)
{
- links = new java.util.Vector();
+ links = new Vector<String>();
}
links.insertElementAt(labelLink, 0);
@@ -280,7 +284,9 @@ public class SequenceFeature
{
String stat = (String) otherDetails.get("status");
if (stat != null)
+ {
return new String(stat);
+ }
}
return null;
}
@@ -296,4 +302,23 @@ public class SequenceFeature
return begin;
}
+ public int getStrand()
+ {
+ String str;
+ if (otherDetails == null
+ || (str = otherDetails.get("STRAND").toString()) == null)
+ {
+ return 0;
+ }
+ if (str.equals("-"))
+ {
+ return -1;
+ }
+ if (str.equals("+"))
+ {
+ return 1;
+ }
+ return 0;
+ }
+
}
diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java
index 01bf677..c02a5e3 100644
--- a/src/jalview/datamodel/SequenceGroup.java
+++ b/src/jalview/datamodel/SequenceGroup.java
@@ -1,28 +1,36 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
-
-import java.awt.*;
+import jalview.analysis.AAFrequency;
+import jalview.analysis.Conservation;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
-import jalview.analysis.*;
-import jalview.schemes.*;
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
/**
* Collects a set contiguous ranges on a set of sequences
@@ -30,7 +38,7 @@ import jalview.schemes.*;
* @author $author$
* @version $Revision$
*/
-public class SequenceGroup
+public class SequenceGroup implements AnnotatedCollectionI
{
String groupName;
@@ -54,7 +62,7 @@ public class SequenceGroup
/**
* group members
*/
- private Vector sequences = new Vector();
+ private List<SequenceI> sequences = new ArrayList<SequenceI>();
/**
* representative sequence for this group (if any)
@@ -68,8 +76,10 @@ public class SequenceGroup
*/
public ColourSchemeI cs;
+ // start column (base 0)
int startRes = 0;
+ // end column (base 0)
int endRes = 0;
public Color outlineColour = Color.black;
@@ -93,6 +103,11 @@ public class SequenceGroup
private boolean showSequenceLogo = false;
/**
+ * flag indicating if logo should be rendered normalised
+ */
+ private boolean normaliseSequenceLogo;
+
+ /**
* @return the includeAllConsSymbols
*/
public boolean isShowSequenceLogo()
@@ -122,7 +137,7 @@ public class SequenceGroup
* @param end
* last column of group
*/
- public SequenceGroup(Vector sequences, String groupName,
+ public SequenceGroup(List<SequenceI> sequences, String groupName,
ColourSchemeI scheme, boolean displayBoxes, boolean displayText,
boolean colourText, int start, int end)
{
@@ -146,13 +161,8 @@ public class SequenceGroup
{
if (seqsel != null)
{
- sequences = new Vector();
- Enumeration sq = seqsel.sequences.elements();
- while (sq.hasMoreElements())
- {
- sequences.addElement(sq.nextElement());
- }
- ;
+ sequences = new ArrayList<SequenceI>();
+ sequences.addAll(seqsel.sequences);
if (seqsel.groupName != null)
{
groupName = new String(seqsel.groupName);
@@ -164,7 +174,9 @@ public class SequenceGroup
endRes = seqsel.endRes;
cs = seqsel.cs;
if (seqsel.description != null)
+ {
description = new String(seqsel.description);
+ }
hidecols = seqsel.hidecols;
hidereps = seqsel.hidereps;
idColour = seqsel.idColour;
@@ -224,7 +236,9 @@ public class SequenceGroup
}
}
if (!found)
+ {
continue;
+ }
}
AlignmentAnnotation newannot = new AlignmentAnnotation(
seq.getAnnotation()[a]);
@@ -280,29 +294,35 @@ public class SequenceGroup
return eres;
}
- public Vector getSequences(Hashtable hiddenReps)
+ @Override
+ public List<SequenceI> getSequences()
+ {
+ return sequences;
+ }
+
+ @Override
+ public List<SequenceI> getSequences(
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
{
if (hiddenReps == null)
{
+ // TODO: need a synchronizedCollection here ?
return sequences;
}
else
{
- Vector allSequences = new Vector();
- SequenceI seq, seq2;
- for (int i = 0; i < sequences.size(); i++)
+ List<SequenceI> allSequences = new ArrayList<SequenceI>();
+ for (SequenceI seq : sequences)
{
- seq = (SequenceI) sequences.elementAt(i);
- allSequences.addElement(seq);
+ allSequences.add(seq);
if (hiddenReps.containsKey(seq))
{
- SequenceGroup hsg = (SequenceGroup) hiddenReps.get(seq);
- for (int h = 0; h < hsg.getSize(); h++)
+ SequenceCollectionI hsg = hiddenReps.get(seq);
+ for (SequenceI seq2 : hsg.getSequences())
{
- seq2 = hsg.getSequenceAt(h);
if (seq2 != seq && !allSequences.contains(seq2))
{
- allSequences.addElement(seq2);
+ allSequences.add(seq2);
}
}
}
@@ -312,20 +332,15 @@ public class SequenceGroup
}
}
- public SequenceI[] getSequencesAsArray(Hashtable hiddenReps)
+ public SequenceI[] getSequencesAsArray(
+ Map<SequenceI, SequenceCollectionI> map)
{
- Vector tmp = getSequences(hiddenReps);
+ List<SequenceI> tmp = getSequences(map);
if (tmp == null)
{
return null;
}
- SequenceI[] result = new SequenceI[tmp.size()];
- for (int i = 0; i < result.length; i++)
- {
- result[i] = (SequenceI) tmp.elementAt(i);
- }
-
- return result;
+ return tmp.toArray(new SequenceI[tmp.size()]);
}
/**
@@ -451,24 +466,44 @@ public class SequenceGroup
*/
public void addSequence(SequenceI s, boolean recalc)
{
- if (s != null && !sequences.contains(s))
+ synchronized (sequences)
{
- sequences.addElement(s);
- }
+ if (s != null && !sequences.contains(s))
+ {
+ sequences.add(s);
+ }
- if (recalc)
- {
- recalcConservation();
+ if (recalc)
+ {
+ recalcConservation();
+ }
}
}
/**
- * Max Gaps Threshold for performing a conservation calculation TODO: make
- * this a configurable property - or global to an alignment view
+ * Max Gaps Threshold (percent) for performing a conservation calculation
*/
private int consPercGaps = 25;
/**
+ * @return Max Gaps Threshold for performing a conservation calculation
+ */
+ public int getConsPercGaps()
+ {
+ return consPercGaps;
+ }
+
+ /**
+ * set Max Gaps Threshold (percent) for performing a conservation calculation
+ *
+ * @param consPercGaps
+ */
+ public void setConsPercGaps(int consPercGaps)
+ {
+ this.consPercGaps = consPercGaps;
+ }
+
+ /**
* calculate residue conservation for group - but only if necessary.
*/
public void recalcConservation()
@@ -477,23 +512,17 @@ public class SequenceGroup
{
return;
}
-
try
{
Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes,
endRes + 1, showSequenceLogo);
if (consensus != null)
{
- _updateConsensusRow(cnsns);
+ _updateConsensusRow(cnsns, sequences.size());
}
if (cs != null)
{
cs.setConsensus(cnsns);
-
- if (cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) cs).resetClustalX(sequences, getWidth());
- }
}
if ((conservation != null)
@@ -513,15 +542,13 @@ public class SequenceGroup
if (cs.conservationApplied())
{
cs.setConservation(c);
-
- if (cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) cs).resetClustalX(sequences,
- getWidth());
- }
}
}
}
+ if (cs != null)
+ {
+ cs.alignmentChanged(context != null ? context : this, null);
+ }
} catch (java.lang.OutOfMemoryError err)
{
// TODO: catch OOM
@@ -552,7 +579,7 @@ public class SequenceGroup
public Hashtable[] consensusData = null;
- private void _updateConsensusRow(Hashtable[] cnsns)
+ private void _updateConsensusRow(Hashtable[] cnsns, long nseq)
{
if (consensus == null)
{
@@ -569,9 +596,10 @@ public class SequenceGroup
consensus.annotations = new Annotation[aWidth]; // should be alignment width
AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1,
- ignoreGapsInConsensus, showSequenceLogo); // TODO: setting container
- // for
- // ignoreGapsInConsensusCalculation);
+ ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting
+ // container
+ // for
+ // ignoreGapsInConsensusCalculation);
}
/**
@@ -583,49 +611,56 @@ public class SequenceGroup
*/
public void addOrRemove(SequenceI s, boolean recalc)
{
- if (sequences.contains(s))
- {
- deleteSequence(s, recalc);
- }
- else
+ synchronized (sequences)
{
- addSequence(s, recalc);
+ if (sequences.contains(s))
+ {
+ deleteSequence(s, recalc);
+ }
+ else
+ {
+ addSequence(s, recalc);
+ }
}
}
/**
- * DOCUMENT ME!
+ * remove
*
* @param s
- * DOCUMENT ME!
+ * to be removed
* @param recalc
- * DOCUMENT ME!
+ * true means recalculate conservation
*/
public void deleteSequence(SequenceI s, boolean recalc)
{
- sequences.removeElement(s);
-
- if (recalc)
+ synchronized (sequences)
{
- recalcConservation();
+ sequences.remove(s);
+
+ if (recalc)
+ {
+ recalcConservation();
+ }
}
}
/**
- * DOCUMENT ME!
*
- * @return DOCUMENT ME!
+ *
+ * @return the first column selected by this group. Runs from 0<=i<N_cols
*/
+ @Override
public int getStartRes()
{
return startRes;
}
/**
- * DOCUMENT ME!
*
- * @return DOCUMENT ME!
+ * @return the groups last selected column. Runs from 0<=i<N_cols
*/
+ @Override
public int getEndRes()
{
return endRes;
@@ -652,9 +687,7 @@ public class SequenceGroup
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * @return number of sequences in group
*/
public int getSize()
{
@@ -662,23 +695,17 @@ public class SequenceGroup
}
/**
- * DOCUMENT ME!
- *
* @param i
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * @return the ith sequence
*/
public SequenceI getSequenceAt(int i)
{
- return (SequenceI) sequences.elementAt(i);
+ return sequences.get(i);
}
/**
- * DOCUMENT ME!
- *
* @param state
- * DOCUMENT ME!
+ * colourText
*/
public void setColourText(boolean state)
{
@@ -738,29 +765,27 @@ public class SequenceGroup
}
/**
- * DOCUMENT ME!
+ * computes the width of current set of sequences and returns it
*
* @return DOCUMENT ME!
*/
+ @Override
public int getWidth()
{
- // MC This needs to get reset when characters are inserted and deleted
- if (sequences.size() > 0)
- {
- width = ((SequenceI) sequences.elementAt(0)).getLength();
- }
-
- for (int i = 1; i < sequences.size(); i++)
+ synchronized (sequences)
{
- SequenceI seq = (SequenceI) sequences.elementAt(i);
-
- if (seq.getLength() > width)
+ // MC This needs to get reset when characters are inserted and deleted
+ boolean first = true;
+ for (SequenceI seq : sequences)
{
- width = seq.getLength();
+ if (first || seq.getLength() > width)
+ {
+ width = seq.getLength();
+ first = false;
+ }
}
+ return width;
}
-
- return width;
}
/**
@@ -811,39 +836,42 @@ public class SequenceGroup
*/
public SequenceI[] getSequencesInOrder(AlignmentI al, boolean trim)
{
- int sSize = sequences.size();
- int alHeight = al.getHeight();
+ synchronized (sequences)
+ {
+ int sSize = sequences.size();
+ int alHeight = al.getHeight();
- SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight];
+ SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight];
- int index = 0;
- for (int i = 0; i < alHeight && index < sSize; i++)
- {
- if (sequences.contains(al.getSequenceAt(i)))
+ int index = 0;
+ for (int i = 0; i < alHeight && index < sSize; i++)
{
- seqs[(trim) ? index : i] = al.getSequenceAt(i);
- index++;
+ if (sequences.contains(al.getSequenceAt(i)))
+ {
+ seqs[(trim) ? index : i] = al.getSequenceAt(i);
+ index++;
+ }
}
- }
- if (index == 0)
- {
- return null;
- }
- if (!trim)
- {
- return seqs;
- }
- if (index < seqs.length)
- {
- SequenceI[] dummy = seqs;
- seqs = new SequenceI[index];
- while (--index >= 0)
+ if (index == 0)
+ {
+ return null;
+ }
+ if (!trim)
+ {
+ return seqs;
+ }
+ if (index < seqs.length)
{
- seqs[index] = dummy[index];
- dummy[index] = null;
+ SequenceI[] dummy = seqs;
+ seqs = new SequenceI[index];
+ while (--index >= 0)
+ {
+ seqs[index] = dummy[index];
+ dummy[index] = null;
+ }
}
+ return seqs;
}
- return seqs;
}
/**
@@ -948,31 +976,23 @@ public class SequenceGroup
*
* @param alignment
* (may not be null)
- * @param hashtable
+ * @param map
* (may be null)
* @return new group containing sequences common to this group and alignment
*/
- public SequenceGroup intersect(AlignmentI alignment, Hashtable hashtable)
+ public SequenceGroup intersect(AlignmentI alignment,
+ Map<SequenceI, SequenceCollectionI> map)
{
SequenceGroup sgroup = new SequenceGroup(this);
SequenceI[] insect = getSequencesInOrder(alignment);
- sgroup.sequences = new Vector();
+ sgroup.sequences = new ArrayList<SequenceI>();
for (int s = 0; insect != null && s < insect.length; s++)
{
- if (hashtable == null || hashtable.containsKey(insect[s]))
+ if (map == null || map.containsKey(insect[s]))
{
- sgroup.sequences.addElement(insect[s]);
+ sgroup.sequences.add(insect[s]);
}
}
- // Enumeration en =getSequences(hashtable).elements();
- // while (en.hasMoreElements())
- // {
- // SequenceI elem = (SequenceI) en.nextElement();
- // if (alignment.getSequences().contains(elem))
- // {
- // sgroup.addSequence(elem, false);
- // }
- // }
return sgroup;
}
@@ -1033,12 +1053,12 @@ public class SequenceGroup
{
consensus = new AlignmentAnnotation("", "", new Annotation[1], 0f,
100f, AlignmentAnnotation.BAR_GRAPH);
+ consensus.hasText = true;
+ consensus.autoCalculated = true;
+ consensus.groupRef = this;
+ consensus.label = "Consensus for " + getName();
+ consensus.description = "Percent Identity";
}
- consensus.hasText = true;
- consensus.autoCalculated = true;
- consensus.groupRef = this;
- consensus.label = "Consensus for " + getName();
- consensus.description = "Percent Identity";
return consensus;
}
@@ -1167,4 +1187,148 @@ public class SequenceGroup
{
return showConsensusHistogram;
}
+
+ /**
+ * set flag indicating if logo should be normalised when rendered
+ *
+ * @param norm
+ */
+ public void setNormaliseSequenceLogo(boolean norm)
+ {
+ normaliseSequenceLogo = norm;
+ }
+
+ public boolean isNormaliseSequenceLogo()
+ {
+ return normaliseSequenceLogo;
+ }
+
+ @Override
+ /**
+ * returns a new array with all annotation involving this group
+ */
+ public AlignmentAnnotation[] getAlignmentAnnotation()
+ {
+ // TODO add in other methods like 'getAlignmentAnnotation(String label),
+ // etc'
+ ArrayList<AlignmentAnnotation> annot = new ArrayList<AlignmentAnnotation>();
+ synchronized (sequences)
+ {
+ for (SequenceI seq : sequences)
+ {
+ AlignmentAnnotation[] aa = seq.getAnnotation();
+ if (aa != null)
+ {
+ for (AlignmentAnnotation al : aa)
+ {
+ if (al.groupRef == this)
+ {
+ annot.add(al);
+ }
+ }
+ }
+ }
+ if (consensus != null)
+ {
+ annot.add(consensus);
+ }
+ if (conservation != null)
+ {
+ annot.add(conservation);
+ }
+ }
+ return annot.toArray(new AlignmentAnnotation[0]);
+ }
+
+ @Override
+ public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
+ {
+ ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation a : getAlignmentAnnotation())
+ {
+ if (a.getCalcId() == calcId)
+ {
+ aa.add(a);
+ }
+ }
+ return aa;
+ }
+
+ /**
+ * Returns a list of annotations that match the specified sequenceRef, calcId
+ * and label, ignoring null values.
+ *
+ * @return list of AlignmentAnnotation objects
+ */
+ @Override
+ public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
+ String calcId, String label)
+ {
+ ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation ann : getAlignmentAnnotation())
+ {
+ if (ann.getCalcId() != null && ann.getCalcId().equals(calcId)
+ && ann.sequenceRef != null && ann.sequenceRef == seq
+ && ann.label != null && ann.label.equals(label))
+ {
+ aa.add(ann);
+ }
+ }
+ return aa;
+ }
+
+ /**
+ * Answer true if any annotation matches the calcId passed in (if not null).
+ *
+ * @param calcId
+ * @return
+ */
+ public boolean hasAnnotation(String calcId)
+ {
+ if (calcId != null && !"".equals(calcId))
+ {
+ for (AlignmentAnnotation a : getAlignmentAnnotation())
+ {
+ if (a.getCalcId() == calcId)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Remove all sequences from the group (leaving other properties unchanged).
+ */
+ public void clear()
+ {
+ synchronized (sequences)
+ {
+ sequences.clear();
+ }
+ }
+
+ private AnnotatedCollectionI context;
+
+ /**
+ * set the alignment or group context for this group
+ *
+ * @param context
+ */
+ public void setContext(AnnotatedCollectionI context)
+ {
+ this.context = context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.datamodel.AnnotatedCollectionI#getContext()
+ */
+ @Override
+ public AnnotatedCollectionI getContext()
+ {
+ return context;
+ }
}
diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java
index d1e3853..30ba758 100644
--- a/src/jalview/datamodel/SequenceI.java
+++ b/src/jalview/datamodel/SequenceI.java
@@ -1,31 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.List;
+import java.util.Vector;
+
+import fr.orsay.lri.varna.models.rna.RNA;
/**
- * DOCUMENT ME!
+ * Methods for manipulating a sequence, its metadata and related annotation in
+ * an alignment or dataset.
*
* @author $author$
* @version $Revision$
*/
-public interface SequenceI
+public interface SequenceI extends ASequenceI
{
/**
* Set the display name for the sequence
@@ -97,21 +104,21 @@ public interface SequenceI
public String getSequenceAsString();
/**
- * get a range on the seuqence as a string
+ * get a range on the sequence as a string
*
* @param start
- * DOCUMENT ME!
+ * position relative to start of sequence including gaps (from 0)
* @param end
- * DOCUMENT ME!
+ * position relative to start of sequence including gaps (from 0)
*
- * @return DOCUMENT ME!
+ * @return String containing all gap and symbols in specified range
*/
public String getSequenceAsString(int start, int end);
/**
- * DOCUMENT ME!
+ * Get the sequence as a character array
*
- * @return DOCUMENT ME!
+ * @return seqeunce and any gaps
*/
public char[] getSequence();
@@ -128,23 +135,26 @@ public interface SequenceI
public char[] getSequence(int start, int end);
/**
- * create a new sequence object from start to end of this sequence
+ * create a new sequence object with a subsequence of this one but sharing the
+ * same dataset sequence
*
* @param start
- * int
+ * int index for start position (base 0, inclusive)
* @param end
- * int
+ * int index for end position (base 0, exclusive)
+ *
* @return SequenceI
+ * @note implementations may use getSequence to get the sequence data
*/
public SequenceI getSubSequence(int start, int end);
/**
- * DOCUMENT ME!
+ * get the i'th character in this sequence's local reference frame (ie from
+ * 0-number of characters lying from start-end)
*
* @param i
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * index
+ * @return character or ' '
*/
public char getCharAt(int i);
@@ -164,12 +174,17 @@ public interface SequenceI
public String getDescription();
/**
- * DOCUMENT ME!
+ * Return the alignment column for a sequence position
*
* @param pos
- * DOCUMENT ME!
+ * lying from start to end
+ *
+ * @return aligned column for residue (0 if residue is upstream from
+ * alignment, -1 if residue is downstream from alignment) note.
+ * Sequence object returns sequence.getEnd() for positions upstream
+ * currently. TODO: change sequence for
+ * assert(findIndex(seq.getEnd()+1)==-1) and fix incremental bugs
*
- * @return DOCUMENT ME!
*/
public int findIndex(int pos);
@@ -177,7 +192,7 @@ public interface SequenceI
* Returns the sequence position for an alignment position
*
* @param i
- * column index in alignment (from 1)
+ * column index in alignment (from 0..<length)
*
* @return residue number for residue (left of and) nearest ith column
*/
@@ -206,9 +221,9 @@ public interface SequenceI
* if necessary and adjusting start and end positions accordingly.
*
* @param i
- * first column in range to delete
+ * first column in range to delete (inclusive)
* @param j
- * last column in range to delete
+ * last column in range to delete (exclusive)
*/
public void deleteChars(int i, int j);
@@ -225,12 +240,12 @@ public interface SequenceI
/**
* DOCUMENT ME!
*
- * @param i
+ * @param position
* DOCUMENT ME!
- * @param c
+ * @param ch
* DOCUMENT ME!
*/
- public void insertCharAt(int i, int length, char c);
+ public void insertCharAt(int position, int count, char ch);
/**
* DOCUMENT ME!
@@ -253,14 +268,14 @@ public interface SequenceI
* @param id
* DOCUMENT ME!
*/
- public void setPDBId(Vector ids);
+ public void setPDBId(Vector<PDBEntry> ids);
/**
- * DOCUMENT ME!
+ * Returns a list
*
* @return DOCUMENT ME!
*/
- public Vector getPDBId();
+ public Vector<PDBEntry> getAllPDBEntries();
/**
* add entry to the vector of PDBIds, if it isn't in the list already
@@ -301,8 +316,22 @@ public interface SequenceI
public SequenceI getDatasetSequence();
+ /**
+ * Returns a new array containing this sequence's annotations, or null.
+ */
public AlignmentAnnotation[] getAnnotation();
+ /**
+ * Returns true if this sequence has the given annotation (by object
+ * identity).
+ */
+ public boolean hasAnnotation(AlignmentAnnotation ann);
+
+ /**
+ * Add the given annotation, if not already added, and set its sequence ref to
+ * be this sequence. Does nothing if this sequence's annotations already
+ * include this annotation (by identical object reference).
+ */
public void addAlignmentAnnotation(AlignmentAnnotation annotation);
public void removeAlignmentAnnotation(AlignmentAnnotation annotation);
@@ -331,9 +360,21 @@ public interface SequenceI
public AlignmentAnnotation[] getAnnotation(String label);
/**
+ * Returns a (possibly empty) list of any annotations that match on given
+ * calcId (source) and label (type). Null values do not match.
+ *
+ * @param calcId
+ * @param label
+ */
+ public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+ String label);
+
+ /**
* create a new dataset sequence (if necessary) for this sequence and sets
* this sequence to refer to it. This call will move any features or
- * references on the sequence onto the dataset.
+ * references on the sequence onto the dataset. It will also make a duplicate
+ * of existing annotation rows for the dataset sequence, rather than relocate
+ * them in order to preserve external references (since 2.8.2).
*
* @return dataset sequence for this sequence
*/
@@ -341,7 +382,9 @@ public interface SequenceI
/**
* Transfer any database references or annotation from entry under a sequence
- * mapping.
+ * mapping. <br/>
+ * <strong>Note: DOES NOT transfer sequence associated alignment annotation
+ * </strong><br/>
*
* @param entry
* @param mp
@@ -349,4 +392,41 @@ public interface SequenceI
*/
public void transferAnnotation(SequenceI entry, Mapping mp);
+ /**
+ * @param index
+ * The sequence index in the MSA
+ */
+ public void setIndex(int index);
+
+ /**
+ * @return The index of the sequence in the alignment
+ */
+ public int getIndex();
+
+ /**
+ * @return The RNA of the sequence in the alignment
+ */
+
+ public RNA getRNA();
+
+ /**
+ * @param rna
+ * The RNA.
+ */
+ public void setRNA(RNA rna);
+
+ /**
+ *
+ * @return list of insertions (gap characters) in sequence
+ */
+ public List<int[]> getInsertions();
+
+ /**
+ * Given a pdbId String, return the equivalent PDBEntry if available in the
+ * given sequence
+ *
+ * @param pdbId
+ * @return
+ */
+ public PDBEntry getPDBEntry(String pdbId);
}
diff --git a/src/jalview/datamodel/SequenceNode.java b/src/jalview/datamodel/SequenceNode.java
index 90a3681..84b1069 100644
--- a/src/jalview/datamodel/SequenceNode.java
+++ b/src/jalview/datamodel/SequenceNode.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.awt.*;
+import java.awt.Color;
/**
* DOCUMENT ME!
diff --git a/src/jalview/datamodel/SequencePoint.java b/src/jalview/datamodel/SequencePoint.java
index 921318f..122400a 100644
--- a/src/jalview/datamodel/SequencePoint.java
+++ b/src/jalview/datamodel/SequencePoint.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
diff --git a/src/jalview/datamodel/StructureViewerModel.java b/src/jalview/datamodel/StructureViewerModel.java
new file mode 100644
index 0000000..9a23813
--- /dev/null
+++ b/src/jalview/datamodel/StructureViewerModel.java
@@ -0,0 +1,225 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A data bean to hold stored data about a structure viewer.
+ */
+public class StructureViewerModel
+{
+ private int x;
+
+ private int y;
+
+ private int width;
+
+ private int height;
+
+ private boolean alignWithPanel;
+
+ private boolean colourWithAlignPanel;
+
+ private boolean colourByViewer;
+
+ private String stateData = "";
+
+ private String viewId;
+
+ // CHIMERA or JMOL (for projects from Jalview 2.9 on)
+ private String type;
+
+ private Map<File, StructureData> fileData = new HashMap<File, StructureData>();
+
+ public class StructureData
+ {
+ private String filePath;
+
+ private String pdbId;
+
+ private List<SequenceI> seqList;
+
+ // TODO and possibly a list of chains?
+
+ /**
+ * Constructor given structure file path and id.
+ *
+ * @param pdbFile
+ * @param id
+ */
+ public StructureData(String pdbFile, String id)
+ {
+ this.filePath = pdbFile;
+ this.pdbId = id;
+ this.seqList = new ArrayList<SequenceI>();
+ }
+
+ public String getFilePath()
+ {
+ return filePath;
+ }
+
+ protected void setFilePath(String filePath)
+ {
+ this.filePath = filePath;
+ }
+
+ public String getPdbId()
+ {
+ return pdbId;
+ }
+
+ protected void setPdbId(String pdbId)
+ {
+ this.pdbId = pdbId;
+ }
+
+ public List<SequenceI> getSeqList()
+ {
+ return seqList;
+ }
+
+ protected void setSeqList(List<SequenceI> seqList)
+ {
+ this.seqList = seqList;
+ }
+ }
+
+ public StructureViewerModel(int x, int y, int width, int height,
+ boolean alignWithPanel, boolean colourWithAlignPanel,
+ boolean colourByViewer, String viewId, String type)
+ {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ this.alignWithPanel = alignWithPanel;
+ this.colourWithAlignPanel = colourWithAlignPanel;
+ this.colourByViewer = colourByViewer;
+ this.viewId = viewId;
+ this.type = type;
+ }
+
+ public int getX()
+ {
+ return x;
+ }
+
+ protected void setX(int x)
+ {
+ this.x = x;
+ }
+
+ public int getY()
+ {
+ return y;
+ }
+
+ protected void setY(int y)
+ {
+ this.y = y;
+ }
+
+ public int getWidth()
+ {
+ return width;
+ }
+
+ protected void setWidth(int width)
+ {
+ this.width = width;
+ }
+
+ public int getHeight()
+ {
+ return height;
+ }
+
+ public void setHeight(int height)
+ {
+ this.height = height;
+ }
+
+ public boolean isAlignWithPanel()
+ {
+ return alignWithPanel;
+ }
+
+ public void setAlignWithPanel(boolean alignWithPanel)
+ {
+ this.alignWithPanel = alignWithPanel;
+ }
+
+ public boolean isColourWithAlignPanel()
+ {
+ return colourWithAlignPanel;
+ }
+
+ public void setColourWithAlignPanel(boolean colourWithAlignPanel)
+ {
+ this.colourWithAlignPanel = colourWithAlignPanel;
+ }
+
+ public boolean isColourByViewer()
+ {
+ return colourByViewer;
+ }
+
+ public void setColourByViewer(boolean colourByViewer)
+ {
+ this.colourByViewer = colourByViewer;
+ }
+
+ public String getStateData()
+ {
+ return stateData;
+ }
+
+ public void setStateData(String stateData)
+ {
+ this.stateData = stateData;
+ }
+
+ public Map<File, StructureData> getFileData()
+ {
+ return fileData;
+ }
+
+ protected void setFileData(Map<File, StructureData> fileData)
+ {
+ this.fileData = fileData;
+ }
+
+ public String getViewId()
+ {
+ return this.viewId;
+ }
+
+ public String getType()
+ {
+ return this.type;
+ }
+}
diff --git a/src/jalview/datamodel/UniprotEntry.java b/src/jalview/datamodel/UniprotEntry.java
index e93a262..e1a09ea 100644
--- a/src/jalview/datamodel/UniprotEntry.java
+++ b/src/jalview/datamodel/UniprotEntry.java
@@ -1,55 +1,63 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.Vector;
+/**
+ * Data model for an entry returned from a Uniprot query
+ *
+ * @see uniprot_mapping.xml
+ */
public class UniprotEntry
{
UniprotSequence sequence;
- Vector name;
+ Vector<String> name;
- Vector accession;
+ Vector<String> accession;
- Vector feature;
+ Vector<SequenceFeature> feature;
- Vector dbrefs;
+ Vector<PDBEntry> dbrefs;
UniprotProteinName protName;
- public void setAccession(Vector items)
+ public void setAccession(Vector<String> items)
{
accession = items;
}
- public void setFeature(Vector items)
+ public void setFeature(Vector<SequenceFeature> items)
{
feature = items;
}
- public Vector getFeature()
+ public Vector<SequenceFeature> getFeature()
{
return feature;
}
- public Vector getAccession()
+ public Vector<String> getAccession()
{
return accession;
}
@@ -64,12 +72,12 @@ public class UniprotEntry
return protName;
}
- public void setName(Vector na)
+ public void setName(Vector<String> na)
{
name = na;
}
- public Vector getName()
+ public Vector<String> getName()
{
return name;
}
@@ -84,12 +92,12 @@ public class UniprotEntry
sequence = seq;
}
- public Vector getDbReference()
+ public Vector<PDBEntry> getDbReference()
{
return dbrefs;
}
- public void setDbReference(Vector dbref)
+ public void setDbReference(Vector<PDBEntry> dbref)
{
this.dbrefs = dbref;
}
diff --git a/src/jalview/datamodel/UniprotFile.java b/src/jalview/datamodel/UniprotFile.java
index e90c616..0f61b89 100644
--- a/src/jalview/datamodel/UniprotFile.java
+++ b/src/jalview/datamodel/UniprotFile.java
@@ -1,34 +1,41 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.Vector;
+/**
+ * Data model of a retrieved Uniprot entry, as unmarshalled by Castor using a
+ * binding file (uniprot_mapping.xml)
+ */
public class UniprotFile
{
- Vector _items;
+ Vector<UniprotEntry> _items;
- public void setUniprotEntries(Vector items)
+ public void setUniprotEntries(Vector<UniprotEntry> items)
{
_items = items;
}
- public Vector getUniprotEntries()
+ public Vector<UniprotEntry> getUniprotEntries()
{
return _items;
}
diff --git a/src/jalview/datamodel/UniprotProteinName.java b/src/jalview/datamodel/UniprotProteinName.java
index 18eeb74..2e6a0dc 100644
--- a/src/jalview/datamodel/UniprotProteinName.java
+++ b/src/jalview/datamodel/UniprotProteinName.java
@@ -1,37 +1,47 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.datamodel;
-
-public class UniprotProteinName
-{
- /**
- * internal content storage
- */
- private java.util.Vector names;
-
- public void setName(java.util.Vector names)
- {
- this.names = names;
- }
-
- public java.util.Vector getName()
- {
- return names;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import java.util.Vector;
+
+/**
+ * Data model for protein name returned from a Uniprot query
+ *
+ * Protein names are read from the Uniprot XML element
+ * uniprot/entry/protein/recommendedName/fullName
+ *
+ * @see uniprot_mapping.xml
+ */
+public class UniprotProteinName
+{
+ private Vector<String> names;
+
+ public void setName(Vector<String> names)
+ {
+ this.names = names;
+ }
+
+ public Vector<String> getName()
+ {
+ return names;
+ }
+
+}
diff --git a/src/jalview/datamodel/UniprotSequence.java b/src/jalview/datamodel/UniprotSequence.java
index c239766..c9b84fa 100644
--- a/src/jalview/datamodel/UniprotSequence.java
+++ b/src/jalview/datamodel/UniprotSequence.java
@@ -1,40 +1,53 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
+/**
+ * Data model for the sequence returned by a Uniprot query
+ *
+ * @see uniprot_mapping.xml
+ */
public class UniprotSequence
{
+ private String _content = "";
+
/**
- * internal content storage
+ * Sets the content string, omitting any space characters
+ *
+ * @param seq
*/
- private java.lang.String _content = "";
-
public void setContent(String seq)
{
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < seq.length(); i++)
+ if (seq != null)
{
- if (seq.charAt(i) != ' ')
+ StringBuilder sb = new StringBuilder(seq.length());
+ for (int i = 0; i < seq.length(); i++)
{
- sb.append(seq.charAt(i));
+ if (seq.charAt(i) != ' ')
+ {
+ sb.append(seq.charAt(i));
+ }
}
+ _content = sb.toString();
}
- _content = sb.toString();
}
public String getContent()
diff --git a/src/jalview/datamodel/xdb/embl/BasePosition.java b/src/jalview/datamodel/xdb/embl/BasePosition.java
index 31a1418..d3ad382 100644
--- a/src/jalview/datamodel/xdb/embl/BasePosition.java
+++ b/src/jalview/datamodel/xdb/embl/BasePosition.java
@@ -1,22 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
+/**
+ * Data model for a feature/location/locationElement/basePosition read from an
+ * EMBL query reply
+ *
+ * @see embl_mapping.xml
+ */
public class BasePosition
{
String type;
diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java
index a949888..f5dfef4 100644
--- a/src/jalview/datamodel/xdb/embl/EmblEntry.java
+++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
@@ -25,11 +28,18 @@ import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
-import java.util.Enumeration;
import java.util.Hashtable;
-import java.util.Iterator;
+import java.util.Map.Entry;
import java.util.Vector;
+/**
+ * Data model for one entry returned from an EMBL query, as marshalled by a
+ * Castor binding file
+ *
+ * For example: http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/embl/x53828/emblxml
+ *
+ * @see embl_mapping.xml
+ */
public class EmblEntry
{
String accession;
@@ -46,13 +56,11 @@ public class EmblEntry
String lastUpdated;
- Vector keywords;
-
- Vector refs;
+ Vector<String> keywords;
- Vector dbRefs;
+ Vector<DBRefEntry> dbRefs;
- Vector features;
+ Vector<EmblFeature> features;
EmblSequence sequence;
@@ -76,7 +84,7 @@ public class EmblEntry
/**
* @return the dbRefs
*/
- public Vector getDbRefs()
+ public Vector<DBRefEntry> getDbRefs()
{
return dbRefs;
}
@@ -85,7 +93,7 @@ public class EmblEntry
* @param dbRefs
* the dbRefs to set
*/
- public void setDbRefs(Vector dbRefs)
+ public void setDbRefs(Vector<DBRefEntry> dbRefs)
{
this.dbRefs = dbRefs;
}
@@ -110,7 +118,7 @@ public class EmblEntry
/**
* @return the features
*/
- public Vector getFeatures()
+ public Vector<EmblFeature> getFeatures()
{
return features;
}
@@ -119,7 +127,7 @@ public class EmblEntry
* @param features
* the features to set
*/
- public void setFeatures(Vector features)
+ public void setFeatures(Vector<EmblFeature> features)
{
this.features = features;
}
@@ -127,7 +135,7 @@ public class EmblEntry
/**
* @return the keywords
*/
- public Vector getKeywords()
+ public Vector<String> getKeywords()
{
return keywords;
}
@@ -136,7 +144,7 @@ public class EmblEntry
* @param keywords
* the keywords to set
*/
- public void setKeywords(Vector keywords)
+ public void setKeywords(Vector<String> keywords)
{
this.keywords = keywords;
}
@@ -159,23 +167,6 @@ public class EmblEntry
}
/**
- * @return the refs
- */
- public Vector getRefs()
- {
- return refs;
- }
-
- /**
- * @param refs
- * the refs to set
- */
- public void setRefs(Vector refs)
- {
- this.refs = refs;
- }
-
- /**
* @return the releaseCreated
*/
public String getRCreated()
@@ -187,7 +178,7 @@ public class EmblEntry
* @param releaseCreated
* the releaseCreated to set
*/
- public void setRcreated(String releaseCreated)
+ public void setRCreated(String releaseCreated)
{
this.rCreated = releaseCreated;
}
@@ -405,7 +396,7 @@ public class EmblEntry
boolean noPeptide, String sourceDb)
{ // TODO: ensure emblEntry.getSequences behaves correctly for returning all
// cases of noNa and noPeptide
- Vector seqs = new Vector();
+ Vector<SequenceI> seqs = new Vector<SequenceI>();
Sequence dna = null;
if (!noNa)
{
@@ -417,27 +408,30 @@ public class EmblEntry
dna.addDBRef(retrievedref);
// add map to indicate the sequence is a valid coordinate frame for the
// dbref
- retrievedref.setMap(new Mapping(null, new int[]
- { 1, dna.getLength() }, new int[]
- { 1, dna.getLength() }, 1, 1));
+ retrievedref.setMap(new Mapping(null,
+ new int[] { 1, dna.getLength() }, new int[] { 1,
+ dna.getLength() }, 1, 1));
// TODO: transform EMBL Database refs to canonical form
if (dbRefs != null)
- for (Iterator i = dbRefs.iterator(); i.hasNext(); dna
- .addDBRef((DBRefEntry) i.next()))
- ;
+ {
+ for (DBRefEntry dbref : dbRefs)
+ {
+ dna.addDBRef(dbref);
+ }
+ }
}
try
{
- for (Iterator i = features.iterator(); i.hasNext();)
+ for (EmblFeature feature : features)
{
- EmblFeature feature = (EmblFeature) i.next();
if (!noNa)
{
- if (feature.dbRefs != null && feature.dbRefs.size() > 0)
+ if (feature.dbRefs != null)
{
- for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext(); dna
- .addDBRef((DBRefEntry) dbr.next()))
- ;
+ for (DBRefEntry dbref : feature.dbRefs)
+ {
+ dna.addDBRef(dbref);
+ }
}
}
if (FeatureProperties.isCodingFeature(sourceDb, feature.getName()))
@@ -447,13 +441,15 @@ public class EmblEntry
else
{
// General feature type.
+ // TODO this is just duplicated code ??
if (!noNa)
{
- if (feature.dbRefs != null && feature.dbRefs.size() > 0)
+ if (feature.dbRefs != null)
{
- for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext(); dna
- .addDBRef((DBRefEntry) dbr.next()))
- ;
+ for (DBRefEntry dbref : feature.dbRefs)
+ {
+ dna.addDBRef(dbref);
+ }
}
}
}
@@ -474,7 +470,7 @@ public class EmblEntry
SequenceI[] sqs = new SequenceI[seqs.size()];
for (int i = 0, j = seqs.size(); i < j; i++)
{
- sqs[i] = (SequenceI) seqs.elementAt(i);
+ sqs[i] = seqs.elementAt(i);
seqs.set(i, null);
}
return sqs;
@@ -496,19 +492,16 @@ public class EmblEntry
* flag for generation of Peptide sequence objects
*/
private void parseCodingFeature(EmblFeature feature, String sourceDb,
- Vector seqs, Sequence dna, boolean noPeptide)
+ Vector<SequenceI> seqs, Sequence dna, boolean noPeptide)
{
boolean isEmblCdna = sourceDb.equals(DBRefSource.EMBLCDS);
// extract coding region(s)
jalview.datamodel.Mapping map = null;
int[] exon = null;
- if (feature.locations != null && feature.locations.size() > 0)
+ if (feature.locations != null)
{
- for (Enumeration locs = feature.locations.elements(); locs
- .hasMoreElements();)
+ for (EmblFeatureLocations loc : feature.locations)
{
- EmblFeatureLocations loc = (EmblFeatureLocations) locs
- .nextElement();
int[] se = loc.getElementRanges(accession);
if (exon == null)
{
@@ -526,19 +519,17 @@ public class EmblEntry
String prseq = null;
String prname = new String();
String prid = null;
- Hashtable vals = new Hashtable();
+ Hashtable<String, String> vals = new Hashtable<String, String>();
int prstart = 1;
// get qualifiers
- if (feature.getQualifiers() != null
- && feature.getQualifiers().size() > 0)
+ if (feature.getQualifiers() != null)
{
- for (Iterator quals = feature.getQualifiers().iterator(); quals
- .hasNext();)
+ for (Qualifier q : feature.getQualifiers())
{
- Qualifier q = (Qualifier) quals.next();
- if (q.getName().equals("translation"))
+ String qname = q.getName();
+ if (qname.equals("translation"))
{
- StringBuffer prsq = new StringBuffer(q.getValues()[0]);
+ StringBuilder prsq = new StringBuilder(q.getValues()[0]);
int p = prsq.indexOf(" ");
while (p > -1)
{
@@ -549,15 +540,15 @@ public class EmblEntry
prsq = null;
}
- else if (q.getName().equals("protein_id"))
+ else if (qname.equals("protein_id"))
{
prid = q.getValues()[0];
}
- else if (q.getName().equals("codon_start"))
+ else if (qname.equals("codon_start"))
{
prstart = Integer.parseInt(q.getValues()[0]);
}
- else if (q.getName().equals("product"))
+ else if (qname.equals("product"))
{
prname = q.getValues()[0];
}
@@ -565,7 +556,7 @@ public class EmblEntry
{
// throw anything else into the additional properties hash
String[] s = q.getValues();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (s != null)
{
for (int i = 0; i < s.length; i++)
@@ -574,12 +565,14 @@ public class EmblEntry
sb.append("\n");
}
}
- vals.put(q.getName(), sb.toString());
+ vals.put(qname, sb.toString());
}
}
}
Sequence product = null;
+ DBRefEntry protEMBLCDS = null;
exon = adjustForPrStart(prstart, exon);
+ boolean noProteinDbref = true;
if (prseq != null && prname != null && prid != null)
{
@@ -606,19 +599,18 @@ public class EmblEntry
.println("Not allowing for additional stop codon at end of cDNA fragment... !");
// this might occur for CDS sequences where no features are
// marked.
- exon = new int[]
- { dna.getStart() + (prstart - 1), dna.getEnd() };
- map = new jalview.datamodel.Mapping(product, exon, new int[]
- { 1, prseq.length() }, 3, 1);
+ exon = new int[] { dna.getStart() + (prstart - 1), dna.getEnd() };
+ map = new jalview.datamodel.Mapping(product, exon, new int[] { 1,
+ prseq.length() }, 3, 1);
}
if ((prseq.length() + 1) * 3 == (1 - prstart + dna.getSequence().length))
{
System.err
.println("Allowing for additional stop codon at end of cDNA fragment... will probably cause an error in VAMSAs!");
- exon = new int[]
- { dna.getStart() + (prstart - 1), dna.getEnd() - 3 };
- map = new jalview.datamodel.Mapping(product, exon, new int[]
- { 1, prseq.length() }, 3, 1);
+ exon = new int[] { dna.getStart() + (prstart - 1),
+ dna.getEnd() - 3 };
+ map = new jalview.datamodel.Mapping(product, exon, new int[] { 1,
+ prseq.length() }, 3, 1);
}
}
else
@@ -639,8 +631,8 @@ public class EmblEntry
// final product length trunctation check
map = new jalview.datamodel.Mapping(product,
- adjustForProteinLength(prseq.length(), exon), new int[]
- { 1, prseq.length() }, 3, 1);
+ adjustForProteinLength(prseq.length(), exon), new int[] {
+ 1, prseq.length() }, 3, 1);
// reconstruct the EMBLCDS entry
// TODO: this is only necessary when there codon annotation is
// complete (I think JBPNote)
@@ -648,15 +640,21 @@ public class EmblEntry
pcdnaref.setAccessionId(prid);
pcdnaref.setSource(DBRefSource.EMBLCDS);
pcdnaref.setVersion(getVersion()); // same as parent EMBL version.
- jalview.util.MapList mp = new jalview.util.MapList(new int[]
- { 1, prseq.length() }, new int[]
- { 1 + (prstart - 1), (prstart - 1) + 3 * prseq.length() }, 1, 3);
+ jalview.util.MapList mp = new jalview.util.MapList(new int[] { 1,
+ prseq.length() }, new int[] { 1 + (prstart - 1),
+ (prstart - 1) + 3 * prseq.length() }, 1, 3);
// { 1 + (prstart - 1) * 3,
// 1 + (prstart - 1) * 3 + prseq.length() * 3 - 1 }, new int[]
// { 1prstart, prstart + prseq.length() - 1 }, 3, 1);
pcdnaref.setMap(new Mapping(mp));
if (product != null)
+ {
product.addDBRef(pcdnaref);
+ protEMBLCDS = new DBRefEntry(pcdnaref);
+ protEMBLCDS.setSource(DBRefSource.EMBLCDSProduct);
+ product.addDBRef(protEMBLCDS);
+
+ }
}
}
@@ -668,29 +666,25 @@ public class EmblEntry
sf.setEnd(exon[xint + 1]);
sf.setType(feature.getName());
sf.setFeatureGroup(sourceDb);
- sf.setDescription("Exon " + (1 + (int) (xint / 2))
- + " for protein '" + prname + "' EMBLCDS:" + prid);
+ sf.setDescription("Exon " + (1 + xint / 2) + " for protein '"
+ + prname + "' EMBLCDS:" + prid);
sf.setValue(FeatureProperties.EXONPOS, new Integer(1 + xint));
sf.setValue(FeatureProperties.EXONPRODUCT, prname);
- if (vals != null && vals.size() > 0)
+ if (vals != null)
{
- Enumeration kv = vals.elements();
- while (kv.hasMoreElements())
+ for (Entry<String, String> val : vals.entrySet())
{
- Object key = kv.nextElement();
- if (key != null)
- sf.setValue(key.toString(), vals.get(key));
+ sf.setValue(val.getKey(), val.getValue());
}
}
dna.addSequenceFeature(sf);
}
}
// add dbRefs to sequence
- if (feature.dbRefs != null && feature.dbRefs.size() > 0)
+ if (feature.dbRefs != null)
{
- for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext();)
+ for (DBRefEntry ref : feature.dbRefs)
{
- DBRefEntry ref = (DBRefEntry) dbr.next();
ref.setSource(jalview.util.DBRefUtils.getCanonicalName(ref
.getSource()));
// Hard code the kind of protein product accessions that EMBL cite
@@ -709,6 +703,7 @@ public class EmblEntry
+ ref.getAccessionId());
}
}
+ noProteinDbref = false;
}
if (product != null)
{
@@ -731,6 +726,33 @@ public class EmblEntry
}
dna.addDBRef(ref);
}
+ if (noProteinDbref && product != null)
+ {
+ // add protein coding reference to dna sequence so xref matches
+ if (protEMBLCDS == null)
+ {
+ protEMBLCDS = new DBRefEntry();
+ protEMBLCDS.setAccessionId(prid);
+ protEMBLCDS.setSource(DBRefSource.EMBLCDSProduct);
+ protEMBLCDS.setVersion(getVersion());
+ protEMBLCDS
+ .setMap(new Mapping(product, map.getMap().getInverse()));
+ }
+ product.addDBRef(protEMBLCDS);
+
+ // Add converse mapping reference
+ if (map != null)
+ {
+ Mapping pmap = new Mapping(product, protEMBLCDS.getMap().getMap()
+ .getInverse());
+ DBRefEntry ncMap = new DBRefEntry(protEMBLCDS);
+ ncMap.setMap(pmap);
+ if (map.getTo() != null)
+ {
+ dna.addDBRef(ncMap);
+ }
+ }
+ }
}
}
diff --git a/src/jalview/datamodel/xdb/embl/EmblError.java b/src/jalview/datamodel/xdb/embl/EmblError.java
index 612cf23..232d15e 100644
--- a/src/jalview/datamodel/xdb/embl/EmblError.java
+++ b/src/jalview/datamodel/xdb/embl/EmblError.java
@@ -1,22 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
+/**
+ * Data model mapped from any <error> elements returned from an EMBL query
+ *
+ * @see embl_mapping.xml
+ */
public class EmblError
{
String accession;
diff --git a/src/jalview/datamodel/xdb/embl/EmblFeature.java b/src/jalview/datamodel/xdb/embl/EmblFeature.java
index 65ee51a..55d7c94 100644
--- a/src/jalview/datamodel/xdb/embl/EmblFeature.java
+++ b/src/jalview/datamodel/xdb/embl/EmblFeature.java
@@ -1,39 +1,48 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
-import java.util.Hashtable;
+import jalview.datamodel.DBRefEntry;
+
import java.util.Vector;
+/**
+ * Data model for a <feature> element returned from an EMBL query reply
+ *
+ * @see embl_mapping.xml
+ */
public class EmblFeature
{
String name;
- Vector dbRefs;
+ Vector<DBRefEntry> dbRefs;
- Vector qualifiers;
+ Vector<Qualifier> qualifiers;
- Vector locations;
+ Vector<EmblFeatureLocations> locations;
/**
* @return the dbRefs
*/
- public Vector getDbRefs()
+ public Vector<DBRefEntry> getDbRefs()
{
return dbRefs;
}
@@ -42,7 +51,7 @@ public class EmblFeature
* @param dbRefs
* the dbRefs to set
*/
- public void setDbRefs(Vector dbRefs)
+ public void setDbRefs(Vector<DBRefEntry> dbRefs)
{
this.dbRefs = dbRefs;
}
@@ -50,7 +59,7 @@ public class EmblFeature
/**
* @return the locations
*/
- public Vector getLocations()
+ public Vector<EmblFeatureLocations> getLocations()
{
return locations;
}
@@ -59,7 +68,7 @@ public class EmblFeature
* @param locations
* the locations to set
*/
- public void setLocations(Vector locations)
+ public void setLocations(Vector<EmblFeatureLocations> locations)
{
this.locations = locations;
}
@@ -84,7 +93,7 @@ public class EmblFeature
/**
* @return the qualifiers
*/
- public Vector getQualifiers()
+ public Vector<Qualifier> getQualifiers()
{
return qualifiers;
}
@@ -93,7 +102,7 @@ public class EmblFeature
* @param qualifiers
* the qualifiers to set
*/
- public void setQualifiers(Vector qualifiers)
+ public void setQualifiers(Vector<Qualifier> qualifiers)
{
this.qualifiers = qualifiers;
}
diff --git a/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java b/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java
index 91a0133..d146484 100644
--- a/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java
+++ b/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java
@@ -1,22 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
+/**
+ * Data model for a feature/location/locationElement read from an EMBL query
+ * reply
+ *
+ * @see embl_mapping.xml
+ */
public class EmblFeatureLocElement
{
String type;
diff --git a/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java b/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java
index a20a9f7..94105ae 100644
--- a/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java
+++ b/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java
@@ -1,29 +1,36 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
-import java.util.Enumeration;
-import java.util.Iterator;
import java.util.Vector;
+/**
+ * Data model for a <loctaion> child element of a <feature> read
+ * from an EMBL query reply
+ *
+ * @see embl_mapping.xml
+ */
public class EmblFeatureLocations
{
- Vector locElements;
+ Vector<EmblFeatureLocElement> locElements;
String locationType;
@@ -66,7 +73,7 @@ public class EmblFeatureLocations
/**
* @return the locElements
*/
- public Vector getLocElements()
+ public Vector<EmblFeatureLocElement> getLocElements()
{
return locElements;
}
@@ -75,7 +82,7 @@ public class EmblFeatureLocations
* @param locElements
* the locElements to set
*/
- public void setLocElements(Vector locElements)
+ public void setLocElements(Vector<EmblFeatureLocElement> locElements)
{
this.locElements = locElements;
}
@@ -108,12 +115,10 @@ public class EmblFeatureLocations
{
int sepos = 0;
int[] se = new int[locElements.size() * 2];
- if (locationType.equalsIgnoreCase("single"))
+ if (locationType.equalsIgnoreCase("single")) // TODO: or "simple" ?
{
- for (Enumeration le = locElements.elements(); le.hasMoreElements();)
+ for (EmblFeatureLocElement loce : locElements)
{
- EmblFeatureLocElement loce = (EmblFeatureLocElement) le
- .nextElement();
if (accession == null || loce.accession != null
&& accession.equals(loce.accession))
{
@@ -128,10 +133,8 @@ public class EmblFeatureLocations
}
else if (locationType.equalsIgnoreCase("join"))
{
- for (Enumeration le = locElements.elements(); le.hasMoreElements();)
+ for (EmblFeatureLocElement loce : locElements)
{
- EmblFeatureLocElement loce = (EmblFeatureLocElement) le
- .nextElement();
if (accession == null || loce.accession != null
&& accession.equals(loce.accession))
{
@@ -148,13 +151,17 @@ public class EmblFeatureLocations
else if (locationType != null)
{
if (jalview.bin.Cache.log != null)
+ {
jalview.bin.Cache.log
.error("EmbleFeatureLocations.getElementRanges cannot deal with locationType=='"
+ locationType + "'");
+ }
else
+ {
System.err
.println("EmbleFeatureLocations.getElementRanges cannot deal with locationType=='"
+ locationType + "'");
+ }
}
// trim range if necessary.
if (se != null && sepos != se.length)
diff --git a/src/jalview/datamodel/xdb/embl/EmblFile.java b/src/jalview/datamodel/xdb/embl/EmblFile.java
index 277423d..bea5e07 100644
--- a/src/jalview/datamodel/xdb/embl/EmblFile.java
+++ b/src/jalview/datamodel/xdb/embl/EmblFile.java
@@ -1,40 +1,52 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
import java.io.File;
import java.io.FileReader;
+import java.io.PrintWriter;
import java.io.Reader;
import java.util.Vector;
import org.exolab.castor.mapping.Mapping;
import org.exolab.castor.xml.Unmarshaller;
+/**
+ * Data model for entries returned from an EMBL query, as marshalled by a Castor
+ * binding file
+ *
+ * For example: http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/embl/x53828/emblxml
+ *
+ * @see embl_mapping.xml
+ */
public class EmblFile
{
- Vector entries;
+ Vector<EmblEntry> entries;
- Vector errors;
+ Vector<EmblError> errors;
/**
* @return the entries
*/
- public Vector getEntries()
+ public Vector<EmblEntry> getEntries()
{
return entries;
}
@@ -43,7 +55,7 @@ public class EmblFile
* @param entries
* the entries to set
*/
- public void setEntries(Vector entries)
+ public void setEntries(Vector<EmblEntry> entries)
{
this.entries = entries;
}
@@ -51,7 +63,7 @@ public class EmblFile
/**
* @return the errors
*/
- public Vector getErrors()
+ public Vector<EmblError> getErrors()
{
return errors;
}
@@ -60,7 +72,7 @@ public class EmblFile
* @param errors
* the errors to set
*/
- public void setErrors(Vector errors)
+ public void setErrors(Vector<EmblError> errors)
{
this.errors = errors;
}
@@ -74,7 +86,9 @@ public class EmblFile
public static EmblFile getEmblFile(File file)
{
if (file == null)
+ {
return null;
+ }
try
{
return EmblFile.getEmblFile(new FileReader(file));
@@ -93,6 +107,7 @@ public class EmblFile
{
// 1. Load the mapping information from the file
Mapping map = new Mapping(record.getClass().getClassLoader());
+
java.net.URL url = record.getClass().getResource("/embl_mapping.xml");
map.loadMapping(url);
@@ -101,17 +116,18 @@ public class EmblFile
try
{
// uncomment to DEBUG EMBLFile reading
- if (((String) jalview.bin.Cache.getDefault(
- jalview.bin.Cache.CASTORLOGLEVEL, "debug"))
- .equalsIgnoreCase("DEBUG"))
+ if (jalview.bin.Cache.getDefault(jalview.bin.Cache.CASTORLOGLEVEL,
+ "debug").equalsIgnoreCase("DEBUG"))
+ {
unmar.setDebug(jalview.bin.Cache.log.isDebugEnabled());
+ }
} catch (Exception e)
{
}
- ;
unmar.setIgnoreExtraElements(true);
+ unmar.setIgnoreExtraAttributes(true);
unmar.setMapping(map);
-
+ unmar.setLogWriter(new PrintWriter(System.out));
record = (EmblFile) unmar.unmarshal(file);
} catch (Exception e)
{
@@ -121,23 +137,4 @@ public class EmblFile
return record;
}
-
- public static void main(String args[])
- {
- File mf = null;
- if (args.length == 1)
- {
- mf = new File(args[0]);
- }
- if (!mf.exists())
- {
- mf = new File(
- "C:\\Documents and Settings\\JimP\\workspace-3.2\\Jalview Release\\schemas\\embleRecordV1.1.xml");
- }
- EmblFile myfile = EmblFile.getEmblFile(mf);
- if (myfile != null && myfile.entries != null
- && myfile.entries.size() > 0)
- System.out.println(myfile.entries.size() + " Records read. (" + mf
- + ")");
- }
}
diff --git a/src/jalview/datamodel/xdb/embl/EmblSequence.java b/src/jalview/datamodel/xdb/embl/EmblSequence.java
index 6c583cf..914041d 100644
--- a/src/jalview/datamodel/xdb/embl/EmblSequence.java
+++ b/src/jalview/datamodel/xdb/embl/EmblSequence.java
@@ -1,22 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
+/**
+ * Data model for the sequence extracted from an EMBL query reply
+ *
+ * @see embl_mapping.xml
+ */
public class EmblSequence
{
String version;
diff --git a/src/jalview/datamodel/xdb/embl/Qualifier.java b/src/jalview/datamodel/xdb/embl/Qualifier.java
index 5e085fa..9020bbe 100644
--- a/src/jalview/datamodel/xdb/embl/Qualifier.java
+++ b/src/jalview/datamodel/xdb/embl/Qualifier.java
@@ -1,22 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel.xdb.embl;
+/**
+ * Data model for a <qualifier> child element of a <feature> read
+ * from an EMBL query reply
+ *
+ * @see embl_mapping.xml
+ */
public class Qualifier
{
String name;
@@ -61,6 +70,7 @@ public class Qualifier
public void addEvidence(String qevidence)
{
+ // TODO - not used? can remove?
if (evidence == null)
{
evidence = new String[1];
@@ -76,6 +86,7 @@ public class Qualifier
public void addValues(String value)
{
+ // TODO - not used? can remove?
if (values == null)
{
values = new String[1];
diff --git a/src/jalview/exceptions/JalviewException.java b/src/jalview/exceptions/JalviewException.java
new file mode 100644
index 0000000..e7a88f1
--- /dev/null
+++ b/src/jalview/exceptions/JalviewException.java
@@ -0,0 +1,45 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.exceptions;
+
+ at SuppressWarnings("serial")
+public class JalviewException extends Exception
+{
+ public JalviewException(String exceptionMessage)
+ {
+ super(exceptionMessage);
+ }
+
+ public JalviewException()
+ {
+ super();
+ }
+
+ public JalviewException(String exceptionMessage, Throwable cause)
+ {
+ super(exceptionMessage, cause);
+ }
+
+ public JalviewException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/src/jalview/exceptions/NoFileSelectedException.java b/src/jalview/exceptions/NoFileSelectedException.java
new file mode 100644
index 0000000..5d38acf
--- /dev/null
+++ b/src/jalview/exceptions/NoFileSelectedException.java
@@ -0,0 +1,30 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.exceptions;
+
+ at SuppressWarnings("serial")
+public class NoFileSelectedException extends JalviewException
+{
+ public NoFileSelectedException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java
index 1299ddc..58325fd 100644
--- a/src/jalview/ext/jmol/JalviewJmolBinding.java
+++ b/src/jalview/ext/jmol/JalviewJmolBinding.java
@@ -1,1546 +1,1457 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ext.jmol;
-
-import java.io.File;
-import java.net.URL;
-import java.util.*;
-import java.applet.Applet;
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.JPanel;
-
-import jalview.api.AlignmentViewPanel;
-import jalview.api.FeatureRenderer;
-import jalview.api.SequenceRenderer;
-import jalview.api.SequenceStructureBinding;
-import jalview.api.StructureSelectionManagerProvider;
-import jalview.datamodel.*;
-import jalview.structure.*;
-import jalview.io.*;
-
-import org.jmol.api.*;
-import org.jmol.adapter.smarter.SmarterJmolAdapter;
-
-import org.jmol.popup.*;
-import org.jmol.viewer.JmolConstants;
-import org.jmol.viewer.Viewer;
-
-import jalview.schemes.*;
-
-public abstract class JalviewJmolBinding implements StructureListener,
- JmolStatusListener, SequenceStructureBinding,
- JmolSelectionListener, ComponentListener, StructureSelectionManagerProvider
-
-{
- /**
- * set if Jmol state is being restored from some source - instructs binding
- * not to apply default display style when structure set is updated for first
- * time.
- */
- private boolean loadingFromArchive = false;
-
- /**
- * state flag used to check if the Jmol viewer's paint method can be called
- */
- private boolean finishedInit = false;
-
- public boolean isFinishedInit()
- {
- return finishedInit;
- }
-
- public void setFinishedInit(boolean finishedInit)
- {
- this.finishedInit = finishedInit;
- }
-
- boolean allChainsSelected = false;
-
- /**
- * when true, try to search the associated datamodel for sequences that are
- * associated with any unknown structures in the Jmol view.
- */
- private boolean associateNewStructs = false;
-
- Vector atomsPicked = new Vector();
-
- public Vector chainNames;
-
- Hashtable chainFile;
-
- /**
- * array of target chains for seuqences - tied to pdbentry and sequence[]
- */
- protected String[][] chains;
-
- boolean colourBySequence = true;
-
- StringBuffer eval = new StringBuffer();
-
- public String fileLoadingError;
-
- /**
- * the default or current model displayed if the model cannot be identified
- * from the selection message
- */
- int frameNo = 0;
-
- protected JmolPopup jmolpopup;
-
- String lastCommand;
-
- String lastMessage;
-
- boolean loadedInline;
-
- /**
- * current set of model filenames loaded in the Jmol instance
- */
- String[] modelFileNames = null;
-
- public PDBEntry[] pdbentry;
-
- /**
- * datasource protocol for access to PDBEntrylatest
- */
- String protocol = null;
-
- StringBuffer resetLastRes = new StringBuffer();
-
- /**
- * sequences mapped to each pdbentry
- */
- public SequenceI[][] sequence;
-
- public StructureSelectionManager ssm;
-
- public JmolViewer viewer;
-
- public JalviewJmolBinding(StructureSelectionManager ssm, PDBEntry[] pdbentry, SequenceI[][] sequenceIs,
- String[][] chains, String protocol)
- {
- this.ssm = ssm;
- this.sequence = sequenceIs;
- this.chains = chains;
- this.pdbentry = pdbentry;
- this.protocol = protocol;
- if (chains == null)
- {
- this.chains = new String[pdbentry.length][];
- }
- /*
- * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(),
- * "jalviewJmol", ap.av.applet .getDocumentBase(),
- * ap.av.applet.getCodeBase(), "", this);
- *
- * jmolpopup = JmolPopup.newJmolPopup(viewer, true, "Jmol", true);
- */
- }
-
- public JalviewJmolBinding(StructureSelectionManager ssm, JmolViewer viewer2)
- {
- this.ssm = ssm;
- viewer = viewer2;
- viewer.setJmolStatusListener(this);
- viewer.addSelectionListener(this);
- }
-
- /**
- * construct a title string for the viewer window based on the data jalview
- * knows about
- *
- * @return
- */
- public String getViewerTitle()
- {
- if (sequence == null || pdbentry == null || sequence.length < 1
- || pdbentry.length < 1 || sequence[0].length < 1)
- {
- return ("Jalview Jmol Window");
- }
- // TODO: give a more informative title when multiple structures are
- // displayed.
- StringBuffer title = new StringBuffer(sequence[0][0].getName() + ":"
- + pdbentry[0].getId());
-
- if (pdbentry[0].getProperty() != null)
- {
- if (pdbentry[0].getProperty().get("method") != null)
- {
- title.append(" Method: ");
- title.append(pdbentry[0].getProperty().get("method"));
- }
- if (pdbentry[0].getProperty().get("chains") != null)
- {
- title.append(" Chain:");
- title.append(pdbentry[0].getProperty().get("chains"));
- }
- }
- return title.toString();
- }
-
- /**
- * prepare the view for a given set of models/chains. chainList contains
- * strings of the form 'pdbfilename:Chaincode'
- *
- * @param chainList
- * list of chains to make visible
- */
- public void centerViewer(Vector chainList)
- {
- StringBuffer cmd = new StringBuffer();
- String lbl;
- int mlength, p;
- for (int i = 0, iSize = chainList.size(); i < iSize; i++)
- {
- mlength = 0;
- lbl = (String) chainList.elementAt(i);
- do
- {
- p = mlength;
- mlength = lbl.indexOf(":", p);
- } while (p < mlength && mlength < (lbl.length() - 2));
- // TODO: lookup each pdb id and recover proper model number for it.
- cmd.append(":" + lbl.substring(mlength + 1) + " /"
- + (1 + getModelNum((String) chainFile.get(lbl))) + " or ");
- }
- if (cmd.length() > 0)
- cmd.setLength(cmd.length() - 4);
- evalStateCommand("select *;restrict " + cmd + ";cartoon;center " + cmd);
- }
-
- public void closeViewer()
- {
- viewer.setModeMouse(org.jmol.viewer.JmolConstants.MOUSE_NONE);
- // remove listeners for all structures in viewer
- ssm.removeStructureViewerListener(this, this.getPdbFile());
- // and shut down jmol
- viewer.evalStringQuiet("zap");
- viewer.setJmolStatusListener(null);
- lastCommand = null;
- viewer = null;
- releaseUIResources();
- }
-
- /**
- * called by JalviewJmolbinding after closeViewer is called - release any
- * resources and references so they can be garbage collected.
- */
- protected abstract void releaseUIResources();
-
- public void colourByChain()
- {
- colourBySequence = false;
- // TODO: colour by chain should colour each chain distinctly across all
- // visible models
- // TODO: http://issues.jalview.org/browse/JAL-628
- evalStateCommand("select *;color chain");
- }
-
- public void colourByCharge()
- {
- colourBySequence = false;
- evalStateCommand("select *;color white;select ASP,GLU;color red;"
- + "select LYS,ARG;color blue;select CYS;color yellow");
- }
-
- /**
- * superpose the structures associated with sequences in the alignment
- * according to their corresponding positions.
- */
- public void superposeStructures(AlignmentI alignment)
- {
- superposeStructures(alignment, -1, null);
- }
-
- /**
- * superpose the structures associated with sequences in the alignment
- * according to their corresponding positions. ded)
- *
- * @param refStructure
- * - select which pdb file to use as reference (default is -1 - the
- * first structure in the alignment)
- */
- public void superposeStructures(AlignmentI alignment, int refStructure)
- {
- superposeStructures(alignment, refStructure, null);
- }
-
- /**
- * superpose the structures associated with sequences in the alignment
- * according to their corresponding positions. ded)
- *
- * @param refStructure
- * - select which pdb file to use as reference (default is -1 - the
- * first structure in the alignment)
- * @param hiddenCols
- * TODO
- */
- public void superposeStructures(AlignmentI alignment, int refStructure,
- ColumnSelection hiddenCols)
- {
- superposeStructures(new AlignmentI[]
- { alignment }, new int[]
- { refStructure }, new ColumnSelection[]
- { hiddenCols });
- }
-
- public void superposeStructures(AlignmentI[] _alignment,
- int[] _refStructure, ColumnSelection[] _hiddenCols)
- {
- String[] files = getPdbFile();
- StringBuffer selectioncom = new StringBuffer();
- assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length);
- // union of all aligned positions are collected together.
- for (int a = 0; a < _alignment.length; a++)
- {
- int refStructure = _refStructure[a];
- AlignmentI alignment = _alignment[a];
- ColumnSelection hiddenCols = _hiddenCols[a];
- if (a > 0
- && selectioncom.length() > 0
- && !selectioncom.substring(selectioncom.length() - 1).equals(
- "|"))
- {
- selectioncom.append("|");
- }
- // process this alignment
- if (refStructure >= files.length)
- {
- System.err.println("Invalid reference structure value "
- + refStructure);
- refStructure = -1;
- }
- if (refStructure < -1)
- {
- refStructure = -1;
- }
- StringBuffer command = new StringBuffer();
-
- boolean matched[] = new boolean[alignment.getWidth()];
- for (int m = 0; m < matched.length; m++)
- {
-
- matched[m] = (hiddenCols != null) ? hiddenCols.isVisible(m) : true;
- }
-
- int commonrpositions[][] = new int[files.length][alignment.getWidth()];
- String isel[] = new String[files.length];
- // reference structure - all others are superposed in it
- String[] targetC = new String[files.length];
- String[] chainNames = new String[files.length];
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
- {
- StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
-
- if (mapping == null || mapping.length < 1)
- continue;
-
- int lastPos = -1;
- for (int s = 0; s < sequence[pdbfnum].length; s++)
- {
- for (int sp, m = 0; m < mapping.length; m++)
- {
- if (mapping[m].getSequence() == sequence[pdbfnum][s]
- && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)
- {
- if (refStructure == -1)
- {
- refStructure = pdbfnum;
- }
- SequenceI asp = alignment.getSequenceAt(sp);
- for (int r = 0; r < matched.length; r++)
- {
- if (!matched[r])
- {
- continue;
- }
- matched[r] = false; // assume this is not a good site
- if (r >= asp.getLength())
- {
- continue;
- }
-
- if (jalview.util.Comparison.isGap(asp.getCharAt(r)))
- {
- // no mapping to gaps in sequence
- continue;
- }
- int t = asp.findPosition(r); // sequence position
- int apos = mapping[m].getAtomNum(t);
- int pos = mapping[m].getPDBResNum(t);
-
- if (pos < 1 || pos == lastPos)
- {
- // can't align unmapped sequence
- continue;
- }
- matched[r] = true; // this is a good ite
- lastPos = pos;
- // just record this residue position
- commonrpositions[pdbfnum][r] = pos;
- }
- // create model selection suffix
- isel[pdbfnum] = "/" + (pdbfnum + 1) + ".1";
- if (mapping[m].getChain() == null
- || mapping[m].getChain().trim().length() == 0)
- {
- targetC[pdbfnum] = "";
- }
- else
- {
- targetC[pdbfnum] = ":" + mapping[m].getChain();
- }
- chainNames[pdbfnum] = mapping[m].getPdbId()
- + targetC[pdbfnum];
- // move on to next pdb file
- s = sequence[pdbfnum].length;
- break;
- }
- }
- }
- }
- String[] selcom = new String[files.length];
- int nmatched = 0;
- // generate select statements to select regions to superimpose structures
- {
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
- {
- String chainCd = targetC[pdbfnum];
- int lpos = -1;
- boolean run = false;
- StringBuffer molsel = new StringBuffer();
- molsel.append("{");
- for (int r = 0; r < matched.length; r++)
- {
- if (matched[r])
- {
- if (pdbfnum == 0)
- {
- nmatched++;
- }
- if (lpos != commonrpositions[pdbfnum][r] - 1)
- {
- // discontinuity
- if (lpos != -1)
- {
- molsel.append(lpos);
- molsel.append(chainCd);
- // molsel.append("} {");
- molsel.append("|");
- }
- }
- else
- {
- // continuous run - and lpos >-1
- if (!run)
- {
- // at the beginning, so add dash
- molsel.append(lpos);
- molsel.append("-");
- }
- run = true;
- }
- lpos = commonrpositions[pdbfnum][r];
- // molsel.append(lpos);
- }
- }
- // add final selection phrase
- if (lpos != -1)
- {
- molsel.append(lpos);
- molsel.append(chainCd);
- molsel.append("}");
- }
- selcom[pdbfnum] = molsel.toString();
- selectioncom.append("((");
- selectioncom.append(selcom[pdbfnum].substring(1,
- selcom[pdbfnum].length() - 1));
- selectioncom.append(" )& ");
- selectioncom.append(pdbfnum + 1);
- selectioncom.append(".1)");
- if (pdbfnum < files.length - 1)
- {
- selectioncom.append("|");
- }
- }
- }
- // TODO: consider bailing if nmatched less than 4 because superposition
- // not
- // well defined.
- // TODO: refactor superposable position search (above) from jmol selection
- // construction (below)
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
- {
- if (pdbfnum == refStructure)
- {
- continue;
- }
- command.append("echo ");
- command.append("\"Superposing (");
- command.append(chainNames[pdbfnum]);
- command.append(") against reference (");
- command.append(chainNames[refStructure]);
- command.append(")\";\ncompare ");
- command.append("{");
- command.append(1 + pdbfnum);
- command.append(".1} {");
- command.append(1 + refStructure);
- command.append(".1} SUBSET {*.CA | *.P} ATOMS ");
-
- // form the matched pair strings
- String sep = "";
- for (int s = 0; s < 2; s++)
- {
- command.append(selcom[(s == 0 ? pdbfnum : refStructure)]);
- }
- command.append(" ROTATE TRANSLATE;\n");
- }
- System.out.println("Select regions:\n" + selectioncom.toString());
- evalStateCommand("select *; cartoons off; backbone; select ("
- + selectioncom.toString() + "); cartoons; ");
- // selcom.append("; ribbons; ");
- System.out.println("Superimpose command(s):\n" + command.toString());
-
- evalStateCommand(command.toString());
- }
- if (selectioncom.length() > 0)
- {// finally, mark all regions that were superposed.
- if (selectioncom.substring(selectioncom.length() - 1).equals("|"))
- {
- selectioncom.setLength(selectioncom.length() - 1);
- }
- System.out.println("Select regions:\n" + selectioncom.toString());
- evalStateCommand("select *; cartoons off; backbone; select ("
- + selectioncom.toString() + "); cartoons; ");
- // evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString());
- }
- }
-
- public void evalStateCommand(String command)
- {
- jmolHistory(false);
- if (lastCommand == null || !lastCommand.equals(command))
- {
- viewer.evalStringQuiet(command + "\n");
- }
- jmolHistory(true);
- lastCommand = command;
- }
-
- /**
- * colour any structures associated with sequences in the given alignment
- * using the getFeatureRenderer() and getSequenceRenderer() renderers but only
- * if colourBySequence is enabled.
- */
- public void colourBySequence(boolean showFeatures,
- jalview.api.AlignmentViewPanel alignmentv)
- {
- if (!colourBySequence)
- return;
- if (ssm == null)
- {
- return;
- }
- String[] files = getPdbFile();
-
- SequenceRenderer sr = getSequenceRenderer(alignmentv);
-
- FeatureRenderer fr = null;
- if (showFeatures)
- {
- fr = getFeatureRenderer(alignmentv);
- }
- AlignmentI alignment = alignmentv.getAlignment();
-
- for (jalview.structure.StructureMappingcommandSet cpdbbyseq: JmolCommands.getColourBySequenceCommand(ssm, files, sequence, sr, fr, alignment))
- for (String cbyseq : cpdbbyseq.commands) {
- evalStateCommand(cbyseq);
- }
- }
-
- public boolean isColourBySequence()
- {
- return colourBySequence;
- }
-
- public void setColourBySequence(boolean colourBySequence)
- {
- this.colourBySequence = colourBySequence;
- }
-
- public void createImage(String file, String type, int quality)
- {
- System.out.println("JMOL CREATE IMAGE");
- }
-
- public String createImage(String fileName, String type,
- Object textOrBytes, int quality)
- {
- System.out.println("JMOL CREATE IMAGE");
- return null;
- }
-
- public String eval(String strEval)
- {
- // System.out.println(strEval);
- // "# 'eval' is implemented only for the applet.";
- return null;
- }
-
- // End StructureListener
- // //////////////////////////
-
- public float[][] functionXY(String functionName, int x, int y)
- {
- return null;
- }
-
- public float[][][] functionXYZ(String functionName, int nx, int ny, int nz)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Color getColour(int atomIndex, int pdbResNum, String chain,
- String pdbfile)
- {
- if (getModelNum(pdbfile) < 0)
- return null;
- // TODO: verify atomIndex is selecting correct model.
- return new Color(viewer.getAtomArgb(atomIndex));
- }
-
- /**
- * returns the current featureRenderer that should be used to colour the
- * structures
- *
- * @param alignment
- *
- * @return
- */
- public abstract FeatureRenderer getFeatureRenderer(
- AlignmentViewPanel alignment);
-
- /**
- * instruct the Jalview binding to update the pdbentries vector if necessary
- * prior to matching the jmol view's contents to the list of structure files
- * Jalview knows about.
- */
- public abstract void refreshPdbEntries();
-
- private int getModelNum(String modelFileName)
- {
- String[] mfn = getPdbFile();
- if (mfn == null)
- {
- return -1;
- }
- for (int i = 0; i < mfn.length; i++)
- {
- if (mfn[i].equalsIgnoreCase(modelFileName))
- return i;
- }
- return -1;
- }
-
- /**
- * map between index of model filename returned from getPdbFile and the first
- * index of models from this file in the viewer. Note - this is not trimmed -
- * use getPdbFile to get number of unique models.
- */
- private int _modelFileNameMap[];
-
- // ////////////////////////////////
- // /StructureListener
- public synchronized String[] getPdbFile()
- {
- if (viewer == null)
- {
- return new String[0];
- }
- if (modelFileNames == null)
- {
-
- String mset[] = new String[viewer.getModelCount()];
- _modelFileNameMap = new int[mset.length];
- int j = 1;
- mset[0] = viewer.getModelFileName(0);
- for (int i = 1; i < mset.length; i++)
- {
- mset[j] = viewer.getModelFileName(i);
- _modelFileNameMap[j] = i; // record the model index for the filename
- // skip any additional models in the same file (NMR structures)
- if ((mset[j] == null ? mset[j] != mset[j - 1]
- : (mset[j - 1] == null || !mset[j].equals(mset[j - 1]))))
- {
- j++;
- }
- }
- modelFileNames = new String[j];
- System.arraycopy(mset, 0, modelFileNames, 0, j);
- }
- return modelFileNames;
- }
-
- /**
- * map from string to applet
- */
- public Map getRegistryInfo()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * returns the current sequenceRenderer that should be used to colour the
- * structures
- *
- * @param alignment
- *
- * @return
- */
- public abstract SequenceRenderer getSequenceRenderer(
- AlignmentViewPanel alignment);
-
- // ///////////////////////////////
- // JmolStatusListener
-
- public void handlePopupMenu(int x, int y)
- {
- jmolpopup.show(x, y);
- }
-
- // jmol/ssm only
- public void highlightAtom(int atomIndex, int pdbResNum, String chain,
- String pdbfile)
- {
- if (modelFileNames == null)
- {
- return;
- }
-
- // look up file model number for this pdbfile
- int mdlNum = 0;
- String fn;
- // may need to adjust for URLencoding here - we don't worry about that yet.
- while (mdlNum < modelFileNames.length
- && !pdbfile.equals(modelFileNames[mdlNum]))
- {
- // System.out.println("nomatch:"+pdbfile+"\nmodelfn:"+fn);
- mdlNum++;
- }
- if (mdlNum == modelFileNames.length)
- {
- return;
- }
-
- jmolHistory(false);
- // if (!pdbfile.equals(pdbentry.getFile()))
- // return;
- if (resetLastRes.length() > 0)
- {
- viewer.evalStringQuiet(resetLastRes.toString());
- }
-
- eval.setLength(0);
- eval.append("select " + pdbResNum); // +modelNum
-
- resetLastRes.setLength(0);
- resetLastRes.append("select " + pdbResNum); // +modelNum
-
- eval.append(":");
- resetLastRes.append(":");
- if (!chain.equals(" "))
- {
- eval.append(chain);
- resetLastRes.append(chain);
- }
- {
- eval.append(" /" + (mdlNum + 1));
- resetLastRes.append("/" + (mdlNum + 1));
- }
- eval.append(";wireframe 100;" + eval.toString() + " and not hetero;");
-
- resetLastRes.append(";wireframe 0;" + resetLastRes.toString()
- + " and not hetero; spacefill 0;");
-
- eval.append("spacefill 200;select none");
-
- viewer.evalStringQuiet(eval.toString());
- jmolHistory(true);
-
- }
-
- boolean debug = true;
-
- private void jmolHistory(boolean enable)
- {
- viewer.evalStringQuiet("History " + ((debug || enable) ? "on" : "off"));
- }
-
- public void loadInline(String string)
- {
- loadedInline = true;
- // TODO: re JAL-623
- // viewer.loadInline(strModel, isAppend);
- // could do this:
- // construct fake fullPathName and fileName so we can identify the file
- // later.
- // Then, construct pass a reader for the string to Jmol.
- // ((org.jmol.Viewer.Viewer) viewer).loadModelFromFile(fullPathName,
- // fileName, null, reader, false, null, null, 0);
- viewer.openStringInline(string);
- }
-
- public void mouseOverStructure(int atomIndex, String strInfo)
- {
- int pdbResNum;
- int alocsep = strInfo.indexOf("^");
- int mdlSep = strInfo.indexOf("/");
- int chainSeparator = strInfo.indexOf(":"), chainSeparator1 = -1;
-
- if (chainSeparator == -1)
- {
- chainSeparator = strInfo.indexOf(".");
- if (mdlSep > -1 && mdlSep < chainSeparator)
- {
- chainSeparator1 = chainSeparator;
- chainSeparator = mdlSep;
- }
- }
- // handle insertion codes
- if (alocsep != -1)
- {
- pdbResNum = Integer.parseInt(strInfo.substring(
- strInfo.indexOf("]") + 1, alocsep));
-
- }
- else
- {
- pdbResNum = Integer.parseInt(strInfo.substring(
- strInfo.indexOf("]") + 1, chainSeparator));
- }
- String chainId;
-
- if (strInfo.indexOf(":") > -1)
- chainId = strInfo.substring(strInfo.indexOf(":") + 1,
- strInfo.indexOf("."));
- else
- {
- chainId = " ";
- }
-
- String pdbfilename = modelFileNames[frameNo]; // default is first or current
- // model
- if (mdlSep > -1)
- {
- if (chainSeparator1 == -1)
- {
- chainSeparator1 = strInfo.indexOf(".", mdlSep);
- }
- String mdlId = (chainSeparator1 > -1) ? strInfo.substring(mdlSep + 1,
- chainSeparator1) : strInfo.substring(mdlSep + 1);
- try
- {
- // recover PDB filename for the model hovered over.
- pdbfilename = viewer
- .getModelFileName(new Integer(mdlId).intValue() - 1);
- } catch (Exception e)
- {
- }
- ;
- }
- if (lastMessage == null || !lastMessage.equals(strInfo))
- ssm.mouseOverStructure(pdbResNum, chainId, pdbfilename);
-
- lastMessage = strInfo;
- }
-
- public void notifyAtomHovered(int atomIndex, String strInfo, String data)
- {
- if (data != null)
- {
- System.err.println("Ignoring additional hover info: " + data
- + " (other info: '" + strInfo + "' pos " + atomIndex + ")");
- }
- mouseOverStructure(atomIndex, strInfo);
- }
-
- /*
- * { if (history != null && strStatus != null &&
- * !strStatus.equals("Script completed")) { history.append("\n" + strStatus);
- * } }
- */
-
- public void notifyAtomPicked(int atomIndex, String strInfo, String strData)
- {
- /**
- * this implements the toggle label behaviour copied from the original
- * structure viewer, MCView
- */
- if (strData != null)
- {
- System.err.println("Ignoring additional pick data string " + strData);
- }
- int chainSeparator = strInfo.indexOf(":");
- int p = 0;
- if (chainSeparator == -1)
- chainSeparator = strInfo.indexOf(".");
-
- String picked = strInfo.substring(strInfo.indexOf("]") + 1,
- chainSeparator);
- String mdlString = "";
- if ((p = strInfo.indexOf(":")) > -1)
- picked += strInfo.substring(p + 1, strInfo.indexOf("."));
-
- if ((p = strInfo.indexOf("/")) > -1)
- {
- mdlString += strInfo.substring(p, strInfo.indexOf(" #"));
- }
- picked = "((" + picked + ".CA" + mdlString + ")|(" + picked + ".P"
- + mdlString + "))";
- jmolHistory(false);
-
- if (!atomsPicked.contains(picked))
- {
- viewer.evalStringQuiet("select " + picked + ";label %n %r:%c");
- atomsPicked.addElement(picked);
- }
- else
- {
- viewer.evalString("select " + picked + ";label off");
- atomsPicked.removeElement(picked);
- }
- jmolHistory(true);
- // TODO: in application this happens
- //
- // if (scriptWindow != null)
- // {
- // scriptWindow.sendConsoleMessage(strInfo);
- // scriptWindow.sendConsoleMessage("\n");
- // }
-
- }
-
- public void notifyCallback(int type, Object[] data)
- {
- try
- {
- switch (type)
- {
- case JmolConstants.CALLBACK_LOADSTRUCT:
- notifyFileLoaded((String) data[1], (String) data[2],
- (String) data[3], (String) data[4],
- ((Integer) data[5]).intValue());
-
- break;
- case JmolConstants.CALLBACK_PICK:
- notifyAtomPicked(((Integer) data[2]).intValue(), (String) data[1],
- (String) data[0]);
- // also highlight in alignment
- case JmolConstants.CALLBACK_HOVER:
- notifyAtomHovered(((Integer) data[2]).intValue(), (String) data[1],
- (String) data[0]);
- break;
- case JmolConstants.CALLBACK_SCRIPT:
- notifyScriptTermination((String) data[2],
- ((Integer) data[3]).intValue());
- break;
- case JmolConstants.CALLBACK_ECHO:
- sendConsoleEcho((String) data[1]);
- break;
- case JmolConstants.CALLBACK_MESSAGE:
- sendConsoleMessage((data == null) ? ((String) null)
- : (String) data[1]);
- break;
- case JmolConstants.CALLBACK_ERROR:
- // System.err.println("Ignoring error callback.");
- break;
- case JmolConstants.CALLBACK_SYNC:
- case JmolConstants.CALLBACK_RESIZE:
- refreshGUI();
- break;
- case JmolConstants.CALLBACK_MEASURE:
-
- case JmolConstants.CALLBACK_CLICK:
- default:
- System.err.println("Unhandled callback " + type + " "
- + data[1].toString());
- break;
- }
- } catch (Exception e)
- {
- System.err.println("Squashed Jmol callback handler error:");
- e.printStackTrace();
- }
- }
-
- public boolean notifyEnabled(int callbackPick)
- {
- switch (callbackPick)
- {
- case JmolConstants.CALLBACK_ECHO:
- case JmolConstants.CALLBACK_LOADSTRUCT:
- case JmolConstants.CALLBACK_MEASURE:
- case JmolConstants.CALLBACK_MESSAGE:
- case JmolConstants.CALLBACK_PICK:
- case JmolConstants.CALLBACK_SCRIPT:
- case JmolConstants.CALLBACK_HOVER:
- case JmolConstants.CALLBACK_ERROR:
- return true;
- case JmolConstants.CALLBACK_RESIZE:
- case JmolConstants.CALLBACK_SYNC:
- case JmolConstants.CALLBACK_CLICK:
- case JmolConstants.CALLBACK_ANIMFRAME:
- case JmolConstants.CALLBACK_MINIMIZATION:
- }
- return false;
- }
-
- // incremented every time a load notification is successfully handled -
- // lightweight mechanism for other threads to detect when they can start
- // referrring to new structures.
- private long loadNotifiesHandled = 0;
-
- public long getLoadNotifiesHandled()
- {
- return loadNotifiesHandled;
- }
-
- public void notifyFileLoaded(String fullPathName, String fileName2,
- String modelName, String errorMsg, int modelParts)
- {
- if (errorMsg != null)
- {
- fileLoadingError = errorMsg;
- refreshGUI();
- return;
- }
- // TODO: deal sensibly with models loaded inLine:
- // modelName will be null, as will fullPathName.
-
- // the rest of this routine ignores the arguments, and simply interrogates
- // the Jmol view to find out what structures it contains, and adds them to
- // the structure selection manager.
- fileLoadingError = null;
- String[] oldmodels = modelFileNames;
- modelFileNames = null;
- chainNames = new Vector();
- chainFile = new Hashtable();
- boolean notifyLoaded = false;
- String[] modelfilenames = getPdbFile();
- // first check if we've lost any structures
- if (oldmodels != null && oldmodels.length > 0)
- {
- int oldm = 0;
- for (int i = 0; i < oldmodels.length; i++)
- {
- for (int n = 0; n < modelfilenames.length; n++)
- {
- if (modelfilenames[n] == oldmodels[i])
- {
- oldmodels[i] = null;
- break;
- }
- }
- if (oldmodels[i] != null)
- {
- oldm++;
- }
- }
- if (oldm > 0)
- {
- String[] oldmfn = new String[oldm];
- oldm = 0;
- for (int i = 0; i < oldmodels.length; i++)
- {
- if (oldmodels[i] != null)
- {
- oldmfn[oldm++] = oldmodels[i];
- }
- }
- // deregister the Jmol instance for these structures - we'll add
- // ourselves again at the end for the current structure set.
- ssm.removeStructureViewerListener(this, oldmfn);
- }
- }
- refreshPdbEntries();
- for (int modelnum = 0; modelnum < modelfilenames.length; modelnum++)
- {
- String fileName = modelfilenames[modelnum];
- boolean foundEntry = false;
- MCview.PDBfile pdb = null;
- String pdbfile = null, pdbfhash = null;
- // model was probably loaded inline - so check the pdb file hashcode
- if (loadedInline)
- {
- // calculate essential attributes for the pdb data imported inline.
- // prolly need to resolve modelnumber properly - for now just use our
- // 'best guess'
- pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum])
- + ".0", "PDB");
- pdbfhash = "" + pdbfile.hashCode();
- }
- if (pdbentry != null)
- {
- // search pdbentries and sequences to find correct pdbentry for this
- // model
- for (int pe = 0; pe < pdbentry.length; pe++)
- {
- boolean matches = false;
- if (fileName == null)
- {
- if (false)
- // see JAL-623 - need method of matching pasted data up
- {
- pdb = ssm.setMapping(sequence[pe], chains[pe], pdbfile,
- AppletFormatAdapter.PASTE);
- pdbentry[modelnum].setFile("INLINE" + pdb.id);
- matches = true;
- foundEntry = true;
- }
- }
- else
- {
- if (matches = pdbentry[pe].getFile().equals(fileName))
- {
- foundEntry = true;
- // TODO: Jmol can in principle retrieve from CLASSLOADER but
- // this
- // needs
- // to be tested. See mantis bug
- // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605
- String protocol = AppletFormatAdapter.URL;
- try
- {
- File fl = new java.io.File(pdbentry[pe].getFile());
- if (fl.exists())
- {
- protocol = AppletFormatAdapter.FILE;
- }
- } catch (Exception e)
- {
- } catch (Error e)
- {
- }
- ;
- pdb = ssm.setMapping(sequence[pe], chains[pe],
- pdbentry[pe].getFile(), protocol);
-
- }
- }
- if (matches)
- {
- // add an entry for every chain in the model
- for (int i = 0; i < pdb.chains.size(); i++)
- {
- String chid = new String(pdb.id + ":"
- + ((MCview.PDBChain) pdb.chains.elementAt(i)).id);
- chainFile.put(chid, pdbentry[pe].getFile());
- chainNames.addElement(chid);
- }
- notifyLoaded = true;
- }
- }
- }
- if (!foundEntry && associateNewStructs)
- {
- // this is a foreign pdb file that jalview doesn't know about - add
- // it to the dataset and try to find a home - either on a matching
- // sequence or as a new sequence.
- String pdbcontent = viewer.getData("/" + (modelnum + 1) + ".1",
- "PDB");
- // parse pdb file into a chain, etc.
- // locate best match for pdb in associated views and add mapping to
- // ssm
- // if properly registered then
- notifyLoaded = true;
-
- }
- }
- // FILE LOADED OK
- // so finally, update the jmol bits and pieces
- if (jmolpopup != null)
- {
- // potential for deadlock here:
- // jmolpopup.updateComputedMenus();
- }
- if (!isLoadingFromArchive())
- {
- viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off");
- }
- // register ourselves as a listener and notify the gui that it needs to
- // update itself.
- ssm.addStructureViewerListener(this);
- if (notifyLoaded)
- {
- FeatureRenderer fr = getFeatureRenderer(null);
- if (fr != null)
- {
- fr.featuresAdded();
- }
- refreshGUI();
- loadNotifiesHandled++;
- }
- setLoadingFromArchive(false);
- }
-
- public void notifyNewPickingModeMeasurement(int iatom, String strMeasure)
- {
- notifyAtomPicked(iatom, strMeasure, null);
- }
-
- public abstract void notifyScriptTermination(String strStatus,
- int msWalltime);
-
- /**
- * display a message echoed from the jmol viewer
- *
- * @param strEcho
- */
- public abstract void sendConsoleEcho(String strEcho); /*
- * { showConsole(true);
- *
- * history.append("\n" +
- * strEcho); }
- */
-
- // /End JmolStatusListener
- // /////////////////////////////
-
- /**
- * @param strStatus
- * status message - usually the response received after a script
- * executed
- */
- public abstract void sendConsoleMessage(String strStatus);
-
- public void setCallbackFunction(String callbackType,
- String callbackFunction)
- {
- System.err.println("Ignoring set-callback request to associate "
- + callbackType + " with function " + callbackFunction);
-
- }
-
- public void setJalviewColourScheme(ColourSchemeI cs)
- {
- colourBySequence = false;
-
- if (cs == null)
- return;
-
- String res;
- int index;
- Color col;
- jmolHistory(false);
- // TODO: Switch between nucleotide or aa selection expressions
- Enumeration en = ResidueProperties.aa3Hash.keys();
- StringBuffer command = new StringBuffer("select *;color white;");
- while (en.hasMoreElements())
- {
- res = en.nextElement().toString();
- index = ((Integer) ResidueProperties.aa3Hash.get(res)).intValue();
- if (index > 20)
- continue;
-
- col = cs.findColour(ResidueProperties.aa[index].charAt(0));
-
- command.append("select " + res + ";color[" + col.getRed() + ","
- + col.getGreen() + "," + col.getBlue() + "];");
- }
-
- evalStateCommand(command.toString());
- jmolHistory(true);
- }
-
- public void showHelp()
- {
- showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp");
- }
-
- /**
- * open the URL somehow
- *
- * @param target
- */
- public abstract void showUrl(String url, String target);
-
- /**
- * called when the binding thinks the UI needs to be refreshed after a Jmol
- * state change. this could be because structures were loaded, or because an
- * error has occured.
- */
- public abstract void refreshGUI();
-
- /**
- * called to show or hide the associated console window container.
- *
- * @param show
- */
- public abstract void showConsole(boolean show);
-
- /**
- * @param renderPanel
- * @param jmolfileio
- * - when true will initialise jmol's file IO system (should be false
- * in applet context)
- * @param htmlName
- * @param documentBase
- * @param codeBase
- * @param commandOptions
- */
- public void allocateViewer(Container renderPanel, boolean jmolfileio,
- String htmlName, URL documentBase, URL codeBase,
- String commandOptions)
- {
- allocateViewer(renderPanel, jmolfileio, htmlName, documentBase,
- codeBase, commandOptions, null, null);
- }
-
- /**
- *
- * @param renderPanel
- * @param jmolfileio
- * - when true will initialise jmol's file IO system (should be false
- * in applet context)
- * @param htmlName
- * @param documentBase
- * @param codeBase
- * @param commandOptions
- * @param consolePanel
- * - panel to contain Jmol console
- * @param buttonsToShow
- * - buttons to show on the console, in ordr
- */
- public void allocateViewer(Container renderPanel, boolean jmolfileio,
- String htmlName, URL documentBase, URL codeBase,
- String commandOptions, final Container consolePanel,
- String buttonsToShow)
- {
- if (commandOptions==null) {
- commandOptions="";
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.jmol;
+
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.io.AppletFormatAdapter;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.AtomSpec;
+import jalview.structure.StructureMappingcommandSet;
+import jalview.structure.StructureSelectionManager;
+import jalview.structures.models.AAStructureBindingModel;
+
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+import java.io.File;
+import java.net.URL;
+import java.security.AccessControlException;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javajs.awt.Dimension;
+
+import org.jmol.adapter.smarter.SmarterJmolAdapter;
+import org.jmol.api.JmolAppConsoleInterface;
+import org.jmol.api.JmolSelectionListener;
+import org.jmol.api.JmolStatusListener;
+import org.jmol.api.JmolViewer;
+import org.jmol.c.CBK;
+import org.jmol.script.T;
+import org.jmol.viewer.JC;
+import org.jmol.viewer.Viewer;
+
+public abstract class JalviewJmolBinding extends AAStructureBindingModel
+ implements JmolStatusListener, JmolSelectionListener,
+ ComponentListener
+{
+ boolean allChainsSelected = false;
+
+ /*
+ * when true, try to search the associated datamodel for sequences that are
+ * associated with any unknown structures in the Jmol view.
+ */
+ private boolean associateNewStructs = false;
+
+ Vector<String> atomsPicked = new Vector<String>();
+
+ public Vector<String> chainNames;
+
+ Hashtable<String, String> chainFile;
+
+ public String fileLoadingError;
+
+ /*
+ * the default or current model displayed if the model cannot be identified
+ * from the selection message
+ */
+ int frameNo = 0;
+
+ // protected JmolGenericPopup jmolpopup; // not used - remove?
+
+ String lastCommand;
+
+ String lastMessage;
+
+ boolean loadedInline;
+
+ /**
+ * current set of model filenames loaded in the Jmol instance
+ */
+ String[] modelFileNames = null;
+
+ StringBuffer resetLastRes = new StringBuffer();
+
+ public Viewer viewer;
+
+ public JalviewJmolBinding(StructureSelectionManager ssm,
+ PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
+ String protocol)
+ {
+ super(ssm, pdbentry, sequenceIs, chains, protocol);
+ /*
+ * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(),
+ * "jalviewJmol", ap.av.applet .getDocumentBase(),
+ * ap.av.applet.getCodeBase(), "", this);
+ *
+ * jmolpopup = JmolPopup.newJmolPopup(viewer, true, "Jmol", true);
+ */
+ }
+
+ public JalviewJmolBinding(StructureSelectionManager ssm,
+ SequenceI[][] seqs, Viewer theViewer)
+ {
+ super(ssm, seqs);
+
+ viewer = theViewer;
+ viewer.setJmolStatusListener(this);
+ viewer.addSelectionListener(this);
+ }
+
+ /**
+ * construct a title string for the viewer window based on the data jalview
+ * knows about
+ *
+ * @return
+ */
+ public String getViewerTitle()
+ {
+ return getViewerTitle("Jmol", true);
+ }
+
+ /**
+ * prepare the view for a given set of models/chains. chainList contains
+ * strings of the form 'pdbfilename:Chaincode'
+ *
+ * @param chainList
+ * list of chains to make visible
+ */
+ public void centerViewer(Vector<String> chainList)
+ {
+ StringBuilder cmd = new StringBuilder(128);
+ int mlength, p;
+ for (String lbl : chainList)
+ {
+ mlength = 0;
+ do
+ {
+ p = mlength;
+ mlength = lbl.indexOf(":", p);
+ } while (p < mlength && mlength < (lbl.length() - 2));
+ // TODO: lookup each pdb id and recover proper model number for it.
+ cmd.append(":" + lbl.substring(mlength + 1) + " /"
+ + (1 + getModelNum(chainFile.get(lbl))) + " or ");
}
- viewer = JmolViewer.allocateViewer(renderPanel,
- (jmolfileio ? new SmarterJmolAdapter() : null), htmlName
- + ((Object) this).toString(), documentBase, codeBase,
- commandOptions, this);
-
- console = createJmolConsole(viewer, consolePanel, buttonsToShow);
- if (consolePanel != null)
- {
- consolePanel.addComponentListener(this);
-
- }
-
- }
-
- protected abstract JmolAppConsoleInterface createJmolConsole(
- JmolViewer viewer2, Container consolePanel, String buttonsToShow);
-
- protected org.jmol.api.JmolAppConsoleInterface console = null;
-
- public void componentResized(ComponentEvent e)
- {
-
- }
-
- public void componentMoved(ComponentEvent e)
- {
-
- }
-
- public void componentShown(ComponentEvent e)
- {
- showConsole(true);
- }
-
- public void componentHidden(ComponentEvent e)
- {
- showConsole(false);
- }
-
- public void setLoadingFromArchive(boolean loadingFromArchive)
- {
- this.loadingFromArchive = loadingFromArchive;
- }
-
- public boolean isLoadingFromArchive()
- {
- return loadingFromArchive;
- }
-
- public void setBackgroundColour(java.awt.Color col)
- {
- jmolHistory(false);
- viewer.evalStringQuiet("background [" + col.getRed() + ","
- + col.getGreen() + "," + col.getBlue() + "];");
- jmolHistory(true);
- }
-
- /**
- * add structures and any known sequence associations
- *
- * @returns the pdb entries added to the current set.
- */
- public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe,
- SequenceI[][] seq, String[][] chns)
- {
- int pe = -1;
- Vector v = new Vector();
- Vector rtn = new Vector();
- for (int i = 0; i < pdbentry.length; i++)
- {
- v.addElement(pdbentry[i]);
- }
- for (int i = 0; i < pdbe.length; i++)
- {
- int r = v.indexOf(pdbe[i]);
- if (r == -1 || r >= pdbentry.length)
- {
- rtn.addElement(new int[]
- { v.size(), i });
- v.addElement(pdbe[i]);
- }
- else
- {
- // just make sure the sequence/chain entries are all up to date
- addSequenceAndChain(r, seq[i], chns[i]);
- }
- }
- pdbe = new PDBEntry[v.size()];
- v.copyInto(pdbe);
- pdbentry = pdbe;
- if (rtn.size() > 0)
- {
- // expand the tied seuqence[] and string[] arrays
- SequenceI[][] sqs = new SequenceI[pdbentry.length][];
- String[][] sch = new String[pdbentry.length][];
- System.arraycopy(sequence, 0, sqs, 0, sequence.length);
- System.arraycopy(chains, 0, sch, 0, this.chains.length);
- sequence = sqs;
- chains = sch;
- pdbe = new PDBEntry[rtn.size()];
- for (int r = 0; r < pdbe.length; r++)
- {
- int[] stri = ((int[]) rtn.elementAt(r));
- // record the pdb file as a new addition
- pdbe[r] = pdbentry[stri[0]];
- // and add the new sequence/chain entries
- addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]);
- }
- }
- else
- {
- pdbe = null;
- }
- return pdbe;
- }
-
- public void addSequence(int pe, SequenceI[] seq)
- {
- // add sequences to the pe'th pdbentry's seuqence set.
- addSequenceAndChain(pe, seq, null);
- }
-
- private void addSequenceAndChain(int pe, SequenceI[] seq, String[] tchain)
- {
- if (pe < 0 || pe >= pdbentry.length)
- {
- throw new Error(
- "Implementation error - no corresponding pdbentry (for index "
- + pe + ") to add sequences mappings to");
- }
- final String nullChain = "TheNullChain";
- Vector s = new Vector();
- Vector c = new Vector();
- if (chains == null)
- {
- chains = new String[pdbentry.length][];
- }
- if (sequence[pe] != null)
- {
- for (int i = 0; i < sequence[pe].length; i++)
- {
- s.addElement(sequence[pe][i]);
- if (chains[pe] != null)
- {
- if (i < chains[pe].length)
- {
- c.addElement(chains[pe][i]);
- }
- else
- {
- c.addElement(nullChain);
- }
- }
- else
- {
- if (tchain != null && tchain.length > 0)
- {
- c.addElement(nullChain);
- }
- }
- }
- }
- for (int i = 0; i < seq.length; i++)
- {
- if (!s.contains(seq[i]))
- {
- s.addElement(seq[i]);
- if (tchain != null && i < tchain.length)
- {
- c.addElement(tchain[i] == null ? nullChain : tchain[i]);
- }
- }
- }
- SequenceI[] tmp = new SequenceI[s.size()];
- s.copyInto(tmp);
- sequence[pe] = tmp;
- if (c.size() > 0)
- {
- String[] tch = new String[c.size()];
- c.copyInto(tch);
- for (int i = 0; i < tch.length; i++)
- {
- if (tch[i] == nullChain)
- {
- tch[i] = null;
- }
- }
- chains[pe] = tch;
- }
- else
- {
- chains[pe] = null;
- }
- }
- /**
- *
- * @param pdbfile
- * @return text report of alignment between pdbfile and any associated alignment sequences
- */
- public String printMapping(String pdbfile)
- {
- return ssm.printMapping(pdbfile);
- }
-
-}
+ if (cmd.length() > 0)
+ {
+ cmd.setLength(cmd.length() - 4);
+ }
+ evalStateCommand("select *;restrict " + cmd + ";cartoon;center " + cmd);
+ }
+
+ public void closeViewer()
+ {
+ viewer.acm.setModeMouse(JC.MOUSE_NONE);
+ // remove listeners for all structures in viewer
+ getSsm().removeStructureViewerListener(this, this.getPdbFile());
+ // and shut down jmol
+ viewer.evalStringQuiet("zap");
+ viewer.setJmolStatusListener(null);
+ lastCommand = null;
+ viewer = null;
+ releaseUIResources();
+ }
+
+ public void colourByChain()
+ {
+ colourBySequence = false;
+ // TODO: colour by chain should colour each chain distinctly across all
+ // visible models
+ // TODO: http://issues.jalview.org/browse/JAL-628
+ evalStateCommand("select *;color chain");
+ }
+
+ public void colourByCharge()
+ {
+ colourBySequence = false;
+ evalStateCommand("select *;color white;select ASP,GLU;color red;"
+ + "select LYS,ARG;color blue;select CYS;color yellow");
+ }
+
+ /**
+ * superpose the structures associated with sequences in the alignment
+ * according to their corresponding positions.
+ */
+ public void superposeStructures(AlignmentI alignment)
+ {
+ superposeStructures(alignment, -1, null);
+ }
+
+ /**
+ * superpose the structures associated with sequences in the alignment
+ * according to their corresponding positions. ded)
+ *
+ * @param refStructure
+ * - select which pdb file to use as reference (default is -1 - the
+ * first structure in the alignment)
+ */
+ public void superposeStructures(AlignmentI alignment, int refStructure)
+ {
+ superposeStructures(alignment, refStructure, null);
+ }
+
+ /**
+ * superpose the structures associated with sequences in the alignment
+ * according to their corresponding positions. ded)
+ *
+ * @param refStructure
+ * - select which pdb file to use as reference (default is -1 - the
+ * first structure in the alignment)
+ * @param hiddenCols
+ * TODO
+ */
+ public void superposeStructures(AlignmentI alignment, int refStructure,
+ ColumnSelection hiddenCols)
+ {
+ superposeStructures(new AlignmentI[] { alignment },
+ new int[] { refStructure },
+ new ColumnSelection[] { hiddenCols });
+ }
+
+ /**
+ * Construct and send a command to align structures against a reference
+ * structure, based on one or more sequence alignments
+ *
+ * @param _alignment
+ * an array of alignments to process
+ * @param _refStructure
+ * an array of corresponding reference structures (index into pdb
+ * file array); if a negative value is passed, the first PDB file
+ * mapped to an alignment sequence is used as the reference for
+ * superposition
+ * @param _hiddenCols
+ * an array of corresponding hidden columns for each alignment
+ */
+ public void superposeStructures(AlignmentI[] _alignment,
+ int[] _refStructure, ColumnSelection[] _hiddenCols)
+ {
+ while (viewer.isScriptExecuting())
+ {
+ try
+ {
+ Thread.sleep(10);
+ } catch (InterruptedException i)
+ {
+ }
+ ;
+ }
+ String[] files = getPdbFile();
+ if (!waitForFileLoad(files))
+ {
+ return;
+ }
+
+ StringBuilder selectioncom = new StringBuilder(256);
+ // In principle - nSeconds specifies the speed of animation for each
+ // superposition - but is seems to behave weirdly, so we don't specify it.
+ String nSeconds = " ";
+ if (files.length > 10)
+ {
+ nSeconds = " 0.005 ";
+ }
+ else
+ {
+ nSeconds = " " + (2.0 / files.length) + " ";
+ // if (nSeconds).substring(0,5)+" ";
+ }
+ // see JAL-1345 - should really automatically turn off the animation for
+ // large numbers of structures, but Jmol doesn't seem to allow that.
+ // nSeconds = " ";
+ // union of all aligned positions are collected together.
+ for (int a = 0; a < _alignment.length; a++)
+ {
+ int refStructure = _refStructure[a];
+ AlignmentI alignment = _alignment[a];
+ ColumnSelection hiddenCols = _hiddenCols[a];
+ if (a > 0
+ && selectioncom.length() > 0
+ && !selectioncom.substring(selectioncom.length() - 1).equals(
+ "|"))
+ {
+ selectioncom.append("|");
+ }
+ // process this alignment
+ if (refStructure >= files.length)
+ {
+ System.err.println("Invalid reference structure value "
+ + refStructure);
+ refStructure = -1;
+ }
+
+ /*
+ * 'matched' array will hold 'true' for visible alignment columns where
+ * all sequences have a residue with a mapping to the PDB structure
+ */
+ boolean matched[] = new boolean[alignment.getWidth()];
+ for (int m = 0; m < matched.length; m++)
+ {
+ matched[m] = (hiddenCols != null) ? hiddenCols.isVisible(m) : true;
+ }
+
+ SuperposeData[] structures = new SuperposeData[files.length];
+ for (int f = 0; f < files.length; f++)
+ {
+ structures[f] = new SuperposeData(alignment.getWidth());
+ }
+
+ /*
+ * Calculate the superposable alignment columns ('matched'), and the
+ * corresponding structure residue positions (structures.pdbResNo)
+ */
+ int candidateRefStructure = findSuperposableResidues(alignment,
+ matched, structures);
+ if (refStructure < 0)
+ {
+ /*
+ * If no reference structure was specified, pick the first one that has
+ * a mapping in the alignment
+ */
+ refStructure = candidateRefStructure;
+ }
+
+ String[] selcom = new String[files.length];
+ int nmatched = 0;
+ for (boolean b : matched)
+ {
+ if (b)
+ {
+ nmatched++;
+ }
+ }
+ if (nmatched < 4)
+ {
+ // TODO: bail out here because superposition illdefined?
+ }
+
+ /*
+ * generate select statements to select regions to superimpose structures
+ */
+ {
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ String chainCd = ":" + structures[pdbfnum].chain;
+ int lpos = -1;
+ boolean run = false;
+ StringBuilder molsel = new StringBuilder();
+ molsel.append("{");
+ for (int r = 0; r < matched.length; r++)
+ {
+ if (matched[r])
+ {
+ int pdbResNo = structures[pdbfnum].pdbResNo[r];
+ if (lpos != pdbResNo - 1)
+ {
+ // discontinuity
+ if (lpos != -1)
+ {
+ molsel.append(lpos);
+ molsel.append(chainCd);
+ molsel.append("|");
+ }
+ run = false;
+ }
+ else
+ {
+ // continuous run - and lpos >-1
+ if (!run)
+ {
+ // at the beginning, so add dash
+ molsel.append(lpos);
+ molsel.append("-");
+ }
+ run = true;
+ }
+ lpos = pdbResNo;
+ }
+ }
+ /*
+ * add final selection phrase
+ */
+ if (lpos != -1)
+ {
+ molsel.append(lpos);
+ molsel.append(chainCd);
+ molsel.append("}");
+ }
+ if (molsel.length() > 1)
+ {
+ selcom[pdbfnum] = molsel.toString();
+ selectioncom.append("((");
+ selectioncom.append(selcom[pdbfnum].substring(1,
+ selcom[pdbfnum].length() - 1));
+ selectioncom.append(" )& ");
+ selectioncom.append(pdbfnum + 1);
+ selectioncom.append(".1)");
+ if (pdbfnum < files.length - 1)
+ {
+ selectioncom.append("|");
+ }
+ }
+ else
+ {
+ selcom[pdbfnum] = null;
+ }
+ }
+ }
+ StringBuilder command = new StringBuilder(256);
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ if (pdbfnum == refStructure || selcom[pdbfnum] == null
+ || selcom[refStructure] == null)
+ {
+ continue;
+ }
+ command.append("echo ");
+ command.append("\"Superposing (");
+ command.append(structures[pdbfnum].pdbId);
+ command.append(") against reference (");
+ command.append(structures[refStructure].pdbId);
+ command.append(")\";\ncompare " + nSeconds);
+ command.append("{");
+ command.append(Integer.toString(1 + pdbfnum));
+ command.append(".1} {");
+ command.append(Integer.toString(1 + refStructure));
+ // conformation=1 excludes alternate locations for CA (JAL-1757)
+ command.append(".1} SUBSET {(*.CA | *.P) and conformation=1} ATOMS ");
+
+ // for (int s = 0; s < 2; s++)
+ // {
+ // command.append(selcom[(s == 0 ? pdbfnum : refStructure)]);
+ // }
+ command.append(selcom[pdbfnum]);
+ command.append(selcom[refStructure]);
+ command.append(" ROTATE TRANSLATE;\n");
+ }
+ if (selectioncom.length() > 0)
+ {
+ System.out.println("Select regions:\n" + selectioncom.toString());
+ evalStateCommand("select *; cartoons off; backbone; select ("
+ + selectioncom.toString() + "); cartoons; ");
+ // selcom.append("; ribbons; ");
+ String cmdString = command.toString();
+ System.out.println("Superimpose command(s):\n" + cmdString);
+
+ evalStateCommand(cmdString);
+ }
+ }
+ if (selectioncom.length() > 0)
+ {// finally, mark all regions that were superposed.
+ if (selectioncom.substring(selectioncom.length() - 1).equals("|"))
+ {
+ selectioncom.setLength(selectioncom.length() - 1);
+ }
+ System.out.println("Select regions:\n" + selectioncom.toString());
+ evalStateCommand("select *; cartoons off; backbone; select ("
+ + selectioncom.toString() + "); cartoons; ");
+ // evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString());
+ }
+ }
+
+ public void evalStateCommand(String command)
+ {
+ jmolHistory(false);
+ if (lastCommand == null || !lastCommand.equals(command))
+ {
+ viewer.evalStringQuiet(command + "\n");
+ }
+ jmolHistory(true);
+ lastCommand = command;
+ }
+
+ /**
+ * colour any structures associated with sequences in the given alignment
+ * using the getFeatureRenderer() and getSequenceRenderer() renderers but only
+ * if colourBySequence is enabled.
+ */
+ public void colourBySequence(AlignmentViewPanel alignmentv)
+ {
+ boolean showFeatures = alignmentv.getAlignViewport()
+ .isShowSequenceFeatures();
+ if (!colourBySequence || !isLoadingFinished())
+ {
+ return;
+ }
+ if (getSsm() == null)
+ {
+ return;
+ }
+ String[] files = getPdbFile();
+
+ SequenceRenderer sr = getSequenceRenderer(alignmentv);
+
+ FeatureRenderer fr = null;
+ if (showFeatures)
+ {
+ fr = getFeatureRenderer(alignmentv);
+ }
+ AlignmentI alignment = alignmentv.getAlignment();
+
+ for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(
+ files, sr, fr, alignment))
+ {
+ for (String cbyseq : cpdbbyseq.commands)
+ {
+ executeWhenReady(cbyseq);
+ }
+ }
+ }
+
+ /**
+ * @param files
+ * @param sr
+ * @param fr
+ * @param alignment
+ * @return
+ */
+ protected StructureMappingcommandSet[] getColourBySequenceCommands(
+ String[] files, SequenceRenderer sr, FeatureRenderer fr,
+ AlignmentI alignment)
+ {
+ return JmolCommands.getColourBySequenceCommand(getSsm(), files,
+ getSequence(), sr, fr, alignment);
+ }
+
+ /**
+ * @param command
+ */
+ protected void executeWhenReady(String command)
+ {
+ evalStateCommand(command);
+ }
+
+ public void createImage(String file, String type, int quality)
+ {
+ System.out.println("JMOL CREATE IMAGE");
+ }
+
+ public String createImage(String fileName, String type,
+ Object textOrBytes, int quality)
+ {
+ System.out.println("JMOL CREATE IMAGE");
+ return null;
+ }
+
+ public String eval(String strEval)
+ {
+ // System.out.println(strEval);
+ // "# 'eval' is implemented only for the applet.";
+ return null;
+ }
+
+ // End StructureListener
+ // //////////////////////////
+
+ public float[][] functionXY(String functionName, int x, int y)
+ {
+ return null;
+ }
+
+ public float[][][] functionXYZ(String functionName, int nx, int ny, int nz)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Color getColour(int atomIndex, int pdbResNum, String chain,
+ String pdbfile)
+ {
+ if (getModelNum(pdbfile) < 0)
+ {
+ return null;
+ }
+ // TODO: verify atomIndex is selecting correct model.
+ // return new Color(viewer.getAtomArgb(atomIndex)); Jmol 12.2.4
+ int colour = viewer.ms.at[atomIndex].atomPropertyInt(T.color);
+ return new Color(colour);
+ }
+
+ /**
+ * returns the current featureRenderer that should be used to colour the
+ * structures
+ *
+ * @param alignment
+ *
+ * @return
+ */
+ public abstract FeatureRenderer getFeatureRenderer(
+ AlignmentViewPanel alignment);
+
+ /**
+ * instruct the Jalview binding to update the pdbentries vector if necessary
+ * prior to matching the jmol view's contents to the list of structure files
+ * Jalview knows about.
+ */
+ public abstract void refreshPdbEntries();
+
+ private int getModelNum(String modelFileName)
+ {
+ String[] mfn = getPdbFile();
+ if (mfn == null)
+ {
+ return -1;
+ }
+ for (int i = 0; i < mfn.length; i++)
+ {
+ if (mfn[i].equalsIgnoreCase(modelFileName))
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * map between index of model filename returned from getPdbFile and the first
+ * index of models from this file in the viewer. Note - this is not trimmed -
+ * use getPdbFile to get number of unique models.
+ */
+ private int _modelFileNameMap[];
+
+ // ////////////////////////////////
+ // /StructureListener
+ @Override
+ public synchronized String[] getPdbFile()
+ {
+ if (viewer == null)
+ {
+ return new String[0];
+ }
+ if (modelFileNames == null)
+ {
+ String mset[] = new String[viewer.ms.mc];
+ _modelFileNameMap = new int[mset.length];
+ String m = viewer.ms.getModelFileName(0);
+ if (m != null)
+ {
+ mset[0] = m;
+ try
+ {
+ mset[0] = new File(m).getAbsolutePath();
+ } catch (AccessControlException x)
+ {
+ // usually not allowed to do this in applet
+ System.err
+ .println("jmolBinding: Using local file string from Jmol: "
+ + m);
+ }
+ if (mset[0].indexOf("/file:") != -1)
+ {
+ // applet path with docroot - discard as format won't match pdbfile
+ mset[0] = m;
+ }
+ _modelFileNameMap[0] = 0; // filename index for first model is always 0.
+ }
+ int j = 1;
+ for (int i = 1; i < mset.length; i++)
+ {
+ m = viewer.ms.getModelFileName(i);
+ mset[j] = m;
+ if (m != null)
+ {
+ try
+ {
+ mset[j] = new File(m).getAbsolutePath();
+ } catch (AccessControlException x)
+ {
+ // usually not allowed to do this in applet, so keep raw handle
+ // System.err.println("jmolBinding: Using local file string from Jmol: "+m);
+ }
+ }
+ _modelFileNameMap[j] = i; // record the model index for the filename
+ // skip any additional models in the same file (NMR structures)
+ if ((mset[j] == null ? mset[j] != mset[j - 1]
+ : (mset[j - 1] == null || !mset[j].equals(mset[j - 1]))))
+ {
+ j++;
+ }
+ }
+ modelFileNames = new String[j];
+ System.arraycopy(mset, 0, modelFileNames, 0, j);
+ }
+ return modelFileNames;
+ }
+
+ /**
+ * map from string to applet
+ */
+ @Override
+ public Map<String, Object> getRegistryInfo()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * returns the current sequenceRenderer that should be used to colour the
+ * structures
+ *
+ * @param alignment
+ *
+ * @return
+ */
+ public abstract SequenceRenderer getSequenceRenderer(
+ AlignmentViewPanel alignment);
+
+ // ///////////////////////////////
+ // JmolStatusListener
+
+ public void handlePopupMenu(int x, int y)
+ {
+ // jmolpopup.show(x, y);
+ // jmolpopup.jpiShow(x, y);
+ }
+
+ /**
+ * Highlight zero, one or more atoms on the structure
+ */
+ @Override
+ public void highlightAtoms(List<AtomSpec> atoms)
+ {
+ if (atoms != null)
+ {
+ for (AtomSpec atom : atoms)
+ {
+ highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(),
+ atom.getChain(), atom.getPdbFile());
+ }
+ }
+ }
+
+ // jmol/ssm only
+ public void highlightAtom(int atomIndex, int pdbResNum, String chain,
+ String pdbfile)
+ {
+ if (modelFileNames == null)
+ {
+ return;
+ }
+
+ // look up file model number for this pdbfile
+ int mdlNum = 0;
+ // may need to adjust for URLencoding here - we don't worry about that yet.
+ while (mdlNum < modelFileNames.length
+ && !pdbfile.equals(modelFileNames[mdlNum]))
+ {
+ mdlNum++;
+ }
+ if (mdlNum == modelFileNames.length)
+ {
+ return;
+ }
+
+ jmolHistory(false);
+ // if (!pdbfile.equals(pdbentry.getFile()))
+ // return;
+ if (resetLastRes.length() > 0)
+ {
+ viewer.evalStringQuiet(resetLastRes.toString());
+ }
+
+ StringBuilder cmd = new StringBuilder(64);
+ cmd.append("select " + pdbResNum); // +modelNum
+
+ resetLastRes.setLength(0);
+ resetLastRes.append("select " + pdbResNum); // +modelNum
+
+ cmd.append(":");
+ resetLastRes.append(":");
+ if (!chain.equals(" "))
+ {
+ cmd.append(chain);
+ resetLastRes.append(chain);
+ }
+ {
+ cmd.append(" /" + (mdlNum + 1));
+ resetLastRes.append("/" + (mdlNum + 1));
+ }
+ cmd.append(";wireframe 100;" + cmd.toString() + " and not hetero;");
+
+ resetLastRes.append(";wireframe 0;" + resetLastRes.toString()
+ + " and not hetero; spacefill 0;");
+
+ cmd.append("spacefill 200;select none");
+
+ viewer.evalStringQuiet(cmd.toString());
+ jmolHistory(true);
+
+ }
+
+ boolean debug = true;
+
+ private void jmolHistory(boolean enable)
+ {
+ viewer.evalStringQuiet("History " + ((debug || enable) ? "on" : "off"));
+ }
+
+ public void loadInline(String string)
+ {
+ loadedInline = true;
+ // TODO: re JAL-623
+ // viewer.loadInline(strModel, isAppend);
+ // could do this:
+ // construct fake fullPathName and fileName so we can identify the file
+ // later.
+ // Then, construct pass a reader for the string to Jmol.
+ // ((org.jmol.Viewer.Viewer) viewer).loadModelFromFile(fullPathName,
+ // fileName, null, reader, false, null, null, 0);
+ viewer.openStringInline(string);
+ }
+
+ public void mouseOverStructure(int atomIndex, String strInfo)
+ {
+ int pdbResNum;
+ int alocsep = strInfo.indexOf("^");
+ int mdlSep = strInfo.indexOf("/");
+ int chainSeparator = strInfo.indexOf(":"), chainSeparator1 = -1;
+
+ if (chainSeparator == -1)
+ {
+ chainSeparator = strInfo.indexOf(".");
+ if (mdlSep > -1 && mdlSep < chainSeparator)
+ {
+ chainSeparator1 = chainSeparator;
+ chainSeparator = mdlSep;
+ }
+ }
+ // handle insertion codes
+ if (alocsep != -1)
+ {
+ pdbResNum = Integer.parseInt(strInfo.substring(
+ strInfo.indexOf("]") + 1, alocsep));
+
+ }
+ else
+ {
+ pdbResNum = Integer.parseInt(strInfo.substring(
+ strInfo.indexOf("]") + 1, chainSeparator));
+ }
+ String chainId;
+
+ if (strInfo.indexOf(":") > -1)
+ {
+ chainId = strInfo.substring(strInfo.indexOf(":") + 1,
+ strInfo.indexOf("."));
+ }
+ else
+ {
+ chainId = " ";
+ }
+
+ String pdbfilename = modelFileNames[frameNo]; // default is first or current
+ // model
+ if (mdlSep > -1)
+ {
+ if (chainSeparator1 == -1)
+ {
+ chainSeparator1 = strInfo.indexOf(".", mdlSep);
+ }
+ String mdlId = (chainSeparator1 > -1) ? strInfo.substring(mdlSep + 1,
+ chainSeparator1) : strInfo.substring(mdlSep + 1);
+ try
+ {
+ // recover PDB filename for the model hovered over.
+ int _mp = _modelFileNameMap.length - 1, mnumber = new Integer(mdlId)
+ .intValue() - 1;
+ while (mnumber < _modelFileNameMap[_mp])
+ {
+ _mp--;
+ }
+ pdbfilename = modelFileNames[_mp];
+ if (pdbfilename == null)
+ {
+ pdbfilename = new File(viewer.ms.getModelFileName(mnumber))
+ .getAbsolutePath();
+ }
+
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ if (lastMessage == null || !lastMessage.equals(strInfo))
+ {
+ getSsm().mouseOverStructure(pdbResNum, chainId, pdbfilename);
+ }
+
+ lastMessage = strInfo;
+ }
+
+ public void notifyAtomHovered(int atomIndex, String strInfo, String data)
+ {
+ if (data != null)
+ {
+ System.err.println("Ignoring additional hover info: " + data
+ + " (other info: '" + strInfo + "' pos " + atomIndex + ")");
+ }
+ mouseOverStructure(atomIndex, strInfo);
+ }
+
+ /*
+ * { if (history != null && strStatus != null &&
+ * !strStatus.equals("Script completed")) { history.append("\n" + strStatus);
+ * } }
+ */
+
+ public void notifyAtomPicked(int atomIndex, String strInfo, String strData)
+ {
+ /**
+ * this implements the toggle label behaviour copied from the original
+ * structure viewer, MCView
+ */
+ if (strData != null)
+ {
+ System.err.println("Ignoring additional pick data string " + strData);
+ }
+ int chainSeparator = strInfo.indexOf(":");
+ int p = 0;
+ if (chainSeparator == -1)
+ {
+ chainSeparator = strInfo.indexOf(".");
+ }
+
+ String picked = strInfo.substring(strInfo.indexOf("]") + 1,
+ chainSeparator);
+ String mdlString = "";
+ if ((p = strInfo.indexOf(":")) > -1)
+ {
+ picked += strInfo.substring(p, strInfo.indexOf("."));
+ }
+
+ if ((p = strInfo.indexOf("/")) > -1)
+ {
+ mdlString += strInfo.substring(p, strInfo.indexOf(" #"));
+ }
+ picked = "((" + picked + ".CA" + mdlString + ")|(" + picked + ".P"
+ + mdlString + "))";
+ jmolHistory(false);
+
+ if (!atomsPicked.contains(picked))
+ {
+ viewer.evalStringQuiet("select " + picked + ";label %n %r:%c");
+ atomsPicked.addElement(picked);
+ }
+ else
+ {
+ viewer.evalString("select " + picked + ";label off");
+ atomsPicked.removeElement(picked);
+ }
+ jmolHistory(true);
+ // TODO: in application this happens
+ //
+ // if (scriptWindow != null)
+ // {
+ // scriptWindow.sendConsoleMessage(strInfo);
+ // scriptWindow.sendConsoleMessage("\n");
+ // }
+
+ }
+
+ @Override
+ public void notifyCallback(CBK type, Object[] data)
+ {
+ try
+ {
+ switch (type)
+ {
+ case LOADSTRUCT:
+ notifyFileLoaded((String) data[1], (String) data[2],
+ (String) data[3], (String) data[4],
+ ((Integer) data[5]).intValue());
+
+ break;
+ case PICK:
+ notifyAtomPicked(((Integer) data[2]).intValue(), (String) data[1],
+ (String) data[0]);
+ // also highlight in alignment
+ case HOVER:
+ notifyAtomHovered(((Integer) data[2]).intValue(), (String) data[1],
+ (String) data[0]);
+ break;
+ case SCRIPT:
+ notifyScriptTermination((String) data[2],
+ ((Integer) data[3]).intValue());
+ break;
+ case ECHO:
+ sendConsoleEcho((String) data[1]);
+ break;
+ case MESSAGE:
+ sendConsoleMessage((data == null) ? ((String) null)
+ : (String) data[1]);
+ break;
+ case ERROR:
+ // System.err.println("Ignoring error callback.");
+ break;
+ case SYNC:
+ case RESIZE:
+ refreshGUI();
+ break;
+ case MEASURE:
+
+ case CLICK:
+ default:
+ System.err.println("Unhandled callback " + type + " "
+ + data[1].toString());
+ break;
+ }
+ } catch (Exception e)
+ {
+ System.err.println("Squashed Jmol callback handler error:");
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean notifyEnabled(CBK callbackPick)
+ {
+ switch (callbackPick)
+ {
+ case ECHO:
+ case LOADSTRUCT:
+ case MEASURE:
+ case MESSAGE:
+ case PICK:
+ case SCRIPT:
+ case HOVER:
+ case ERROR:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ // incremented every time a load notification is successfully handled -
+ // lightweight mechanism for other threads to detect when they can start
+ // referrring to new structures.
+ private long loadNotifiesHandled = 0;
+
+ public long getLoadNotifiesHandled()
+ {
+ return loadNotifiesHandled;
+ }
+
+ public void notifyFileLoaded(String fullPathName, String fileName2,
+ String modelName, String errorMsg, int modelParts)
+ {
+ if (errorMsg != null)
+ {
+ fileLoadingError = errorMsg;
+ refreshGUI();
+ return;
+ }
+ // TODO: deal sensibly with models loaded inLine:
+ // modelName will be null, as will fullPathName.
+
+ // the rest of this routine ignores the arguments, and simply interrogates
+ // the Jmol view to find out what structures it contains, and adds them to
+ // the structure selection manager.
+ fileLoadingError = null;
+ String[] oldmodels = modelFileNames;
+ modelFileNames = null;
+ chainNames = new Vector<String>();
+ chainFile = new Hashtable<String, String>();
+ boolean notifyLoaded = false;
+ String[] modelfilenames = getPdbFile();
+ // first check if we've lost any structures
+ if (oldmodels != null && oldmodels.length > 0)
+ {
+ int oldm = 0;
+ for (int i = 0; i < oldmodels.length; i++)
+ {
+ for (int n = 0; n < modelfilenames.length; n++)
+ {
+ if (modelfilenames[n] == oldmodels[i])
+ {
+ oldmodels[i] = null;
+ break;
+ }
+ }
+ if (oldmodels[i] != null)
+ {
+ oldm++;
+ }
+ }
+ if (oldm > 0)
+ {
+ String[] oldmfn = new String[oldm];
+ oldm = 0;
+ for (int i = 0; i < oldmodels.length; i++)
+ {
+ if (oldmodels[i] != null)
+ {
+ oldmfn[oldm++] = oldmodels[i];
+ }
+ }
+ // deregister the Jmol instance for these structures - we'll add
+ // ourselves again at the end for the current structure set.
+ getSsm().removeStructureViewerListener(this, oldmfn);
+ }
+ }
+ refreshPdbEntries();
+ for (int modelnum = 0; modelnum < modelfilenames.length; modelnum++)
+ {
+ String fileName = modelfilenames[modelnum];
+ boolean foundEntry = false;
+ MCview.PDBfile pdb = null;
+ String pdbfile = null;
+ // model was probably loaded inline - so check the pdb file hashcode
+ if (loadedInline)
+ {
+ // calculate essential attributes for the pdb data imported inline.
+ // prolly need to resolve modelnumber properly - for now just use our
+ // 'best guess'
+ pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum])
+ + ".0", "PDB");
+ }
+ // search pdbentries and sequences to find correct pdbentry for this
+ // model
+ for (int pe = 0; pe < getPdbCount(); pe++)
+ {
+ boolean matches = false;
+ if (fileName == null)
+ {
+ if (false)
+ // see JAL-623 - need method of matching pasted data up
+ {
+ pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe],
+ pdbfile, AppletFormatAdapter.PASTE);
+ getPdbEntry(modelnum).setFile("INLINE" + pdb.id);
+ matches = true;
+ foundEntry = true;
+ }
+ }
+ else
+ {
+ File fl = new File(getPdbEntry(pe).getFile());
+ matches = fl.equals(new File(fileName));
+ if (matches)
+ {
+ foundEntry = true;
+ // TODO: Jmol can in principle retrieve from CLASSLOADER but
+ // this
+ // needs
+ // to be tested. See mantis bug
+ // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605
+ String protocol = AppletFormatAdapter.URL;
+ try
+ {
+ if (fl.exists())
+ {
+ protocol = AppletFormatAdapter.FILE;
+ }
+ } catch (Exception e)
+ {
+ } catch (Error e)
+ {
+ }
+ // Explicitly map to the filename used by Jmol ;
+ pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe],
+ fileName, protocol);
+ // pdbentry[pe].getFile(), protocol);
+
+ }
+ }
+ if (matches)
+ {
+ // add an entry for every chain in the model
+ for (int i = 0; i < pdb.chains.size(); i++)
+ {
+ String chid = new String(pdb.id + ":"
+ + pdb.chains.elementAt(i).id);
+ chainFile.put(chid, fileName);
+ chainNames.addElement(chid);
+ }
+ notifyLoaded = true;
+ }
+ }
+
+ if (!foundEntry && associateNewStructs)
+ {
+ // this is a foreign pdb file that jalview doesn't know about - add
+ // it to the dataset and try to find a home - either on a matching
+ // sequence or as a new sequence.
+ String pdbcontent = viewer.getData("/" + (modelnum + 1) + ".1",
+ "PDB");
+ // parse pdb file into a chain, etc.
+ // locate best match for pdb in associated views and add mapping to
+ // ssm
+ // if properly registered then
+ notifyLoaded = true;
+
+ }
+ }
+ // FILE LOADED OK
+ // so finally, update the jmol bits and pieces
+ // if (jmolpopup != null)
+ // {
+ // // potential for deadlock here:
+ // // jmolpopup.updateComputedMenus();
+ // }
+ if (!isLoadingFromArchive())
+ {
+ viewer.evalStringQuiet("model *; select backbone;restrict;cartoon;wireframe off;spacefill off");
+ }
+ // register ourselves as a listener and notify the gui that it needs to
+ // update itself.
+ getSsm().addStructureViewerListener(this);
+ if (notifyLoaded)
+ {
+ FeatureRenderer fr = getFeatureRenderer(null);
+ if (fr != null)
+ {
+ fr.featuresAdded();
+ }
+ refreshGUI();
+ loadNotifiesHandled++;
+ }
+ setLoadingFromArchive(false);
+ }
+
+ public void notifyNewPickingModeMeasurement(int iatom, String strMeasure)
+ {
+ notifyAtomPicked(iatom, strMeasure, null);
+ }
+
+ public abstract void notifyScriptTermination(String strStatus,
+ int msWalltime);
+
+ /**
+ * display a message echoed from the jmol viewer
+ *
+ * @param strEcho
+ */
+ public abstract void sendConsoleEcho(String strEcho); /*
+ * { showConsole(true);
+ *
+ * history.append("\n" +
+ * strEcho); }
+ */
+
+ // /End JmolStatusListener
+ // /////////////////////////////
+
+ /**
+ * @param strStatus
+ * status message - usually the response received after a script
+ * executed
+ */
+ public abstract void sendConsoleMessage(String strStatus);
+
+ public void setCallbackFunction(String callbackType,
+ String callbackFunction)
+ {
+ System.err.println("Ignoring set-callback request to associate "
+ + callbackType + " with function " + callbackFunction);
+
+ }
+
+ public void setJalviewColourScheme(ColourSchemeI cs)
+ {
+ colourBySequence = false;
+
+ if (cs == null)
+ {
+ return;
+ }
+
+ jmolHistory(false);
+ StringBuilder command = new StringBuilder(128);
+ command.append("select *;color white;");
+ List<String> residueSet = ResidueProperties.getResidues(isNucleotide(),
+ false);
+ for (String res : residueSet)
+ {
+ Color col = cs.findColour(res.charAt(0));
+ command.append("select " + res + ";color[" + col.getRed() + ","
+ + col.getGreen() + "," + col.getBlue() + "];");
+ }
+
+ evalStateCommand(command.toString());
+ jmolHistory(true);
+ }
+
+ public void showHelp()
+ {
+ showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp");
+ }
+
+ /**
+ * open the URL somehow
+ *
+ * @param target
+ */
+ public abstract void showUrl(String url, String target);
+
+ /**
+ * called when the binding thinks the UI needs to be refreshed after a Jmol
+ * state change. this could be because structures were loaded, or because an
+ * error has occured.
+ */
+ public abstract void refreshGUI();
+
+ /**
+ * called to show or hide the associated console window container.
+ *
+ * @param show
+ */
+ public abstract void showConsole(boolean show);
+
+ /**
+ * @param renderPanel
+ * @param jmolfileio
+ * - when true will initialise jmol's file IO system (should be false
+ * in applet context)
+ * @param htmlName
+ * @param documentBase
+ * @param codeBase
+ * @param commandOptions
+ */
+ public void allocateViewer(Container renderPanel, boolean jmolfileio,
+ String htmlName, URL documentBase, URL codeBase,
+ String commandOptions)
+ {
+ allocateViewer(renderPanel, jmolfileio, htmlName, documentBase,
+ codeBase, commandOptions, null, null);
+ }
+
+ /**
+ *
+ * @param renderPanel
+ * @param jmolfileio
+ * - when true will initialise jmol's file IO system (should be false
+ * in applet context)
+ * @param htmlName
+ * @param documentBase
+ * @param codeBase
+ * @param commandOptions
+ * @param consolePanel
+ * - panel to contain Jmol console
+ * @param buttonsToShow
+ * - buttons to show on the console, in ordr
+ */
+ public void allocateViewer(Container renderPanel, boolean jmolfileio,
+ String htmlName, URL documentBase, URL codeBase,
+ String commandOptions, final Container consolePanel,
+ String buttonsToShow)
+ {
+ if (commandOptions == null)
+ {
+ commandOptions = "";
+ }
+ viewer = (Viewer) JmolViewer.allocateViewer(renderPanel,
+ (jmolfileio ? new SmarterJmolAdapter() : null), htmlName
+ + ((Object) this).toString(), documentBase, codeBase,
+ commandOptions, this);
+
+ viewer.setJmolStatusListener(this); // extends JmolCallbackListener
+
+ console = createJmolConsole(consolePanel, buttonsToShow);
+ if (consolePanel != null)
+ {
+ consolePanel.addComponentListener(this);
+
+ }
+
+ }
+
+ protected abstract JmolAppConsoleInterface createJmolConsole(
+ Container consolePanel, String buttonsToShow);
+
+ protected org.jmol.api.JmolAppConsoleInterface console = null;
+
+ public void setBackgroundColour(java.awt.Color col)
+ {
+ jmolHistory(false);
+ viewer.evalStringQuiet("background [" + col.getRed() + ","
+ + col.getGreen() + "," + col.getBlue() + "];");
+ jmolHistory(true);
+ }
+
+ @Override
+ public Dimension resizeInnerPanel(String data)
+ {
+ // Jalview doesn't honour resize panel requests
+ return null;
+ }
+
+ /**
+ *
+ */
+ protected void closeConsole()
+ {
+ if (console != null)
+ {
+ try
+ {
+ console.setVisible(false);
+ } catch (Error e)
+ {
+ } catch (Exception x)
+ {
+ }
+ ;
+ console = null;
+ }
+ }
+
+ /**
+ * ComponentListener method
+ */
+ @Override
+ public void componentMoved(ComponentEvent e)
+ {
+ }
+
+ /**
+ * ComponentListener method
+ */
+ @Override
+ public void componentResized(ComponentEvent e)
+ {
+ }
+
+ /**
+ * ComponentListener method
+ */
+ @Override
+ public void componentShown(ComponentEvent e)
+ {
+ showConsole(true);
+ }
+
+ /**
+ * ComponentListener method
+ */
+ @Override
+ public void componentHidden(ComponentEvent e)
+ {
+ showConsole(false);
+ }
+}
diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java
index 71faba3..9ca2548 100644
--- a/src/jalview/ext/jmol/JmolCommands.java
+++ b/src/jalview/ext/jmol/JmolCommands.java
@@ -1,166 +1,180 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-/**
- *
- */
-package jalview.ext.jmol;
-
-import jalview.api.FeatureRenderer;
-import jalview.api.SequenceRenderer;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SequenceI;
-import jalview.structure.StructureMapping;
-import jalview.structure.StructureMappingcommandSet;
-import jalview.structure.StructureSelectionManager;
-import jalview.util.Comparison;
-
-import java.awt.Color;
-import java.util.ArrayList;
-/**
- * Routines for generating Jmol commands for Jalview/Jmol binding
- * another cruisecontrol test.
- *
- * @author JimP
- *
- */
-public class JmolCommands
-{
-
- /**
- * Jmol utility which constructs the commands to colour chains by the given alignment
- * @returns Object[] { Object[] { <model being coloured>,
- *
- */
- public static StructureMappingcommandSet[] getColourBySequenceCommand(StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment)
- {
-
- ArrayList<StructureMappingcommandSet> cset = new ArrayList<StructureMappingcommandSet>();
-
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
- {
- StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
- StringBuffer command = new StringBuffer();
- StructureMappingcommandSet smc;
- ArrayList<String> str = new ArrayList<String>();
-
- if (mapping == null || mapping.length < 1)
- continue;
-
- int lastPos = -1;
- for (int s = 0; s < sequence[pdbfnum].length; s++)
- {
- for (int sp, m = 0; m < mapping.length; m++)
- {
- if (mapping[m].getSequence() == sequence[pdbfnum][s]
- && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)
- {
- SequenceI asp = alignment.getSequenceAt(sp);
- for (int r = 0; r < asp.getLength(); r++)
- {
- // no mapping to gaps in sequence
- if (jalview.util.Comparison.isGap(asp.getCharAt(r)))
- {
- continue;
- }
- int pos = mapping[m].getPDBResNum(asp.findPosition(r));
-
- if (pos < 1 || pos == lastPos)
- continue;
-
- lastPos = pos;
-
- Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);
-
- if (fr != null)
- col = fr.findFeatureColour(col, sequence[pdbfnum][s], r);
- String newSelcom = (mapping[m].getChain() != " " ? ":"
- + mapping[m].getChain() : "")
- + "/"
- + (pdbfnum + 1)
- + ".1"
- + ";color["
- + col.getRed()
- + ","
- + col.getGreen()
- + ","
- + col.getBlue() + "]";
- if (command.length()>newSelcom.length() && command.substring(command.length()-newSelcom.length()).equals(newSelcom))
- {
- command = JmolCommands.condenseCommand(command, pos);
- continue;
- }
- // TODO: deal with case when buffer is too large for Jmol to parse
- // - execute command and flush
-
- command.append(";");
- if (command.length()>51200)
- {
- // add another chunk
- str.add(command.toString());
- command.setLength(0);
- }
- command.append("select " + pos);
- command.append(newSelcom);
- }
- break;
- }
- }
- }
- {
- // add final chunk
- str.add(command.toString());
- command.setLength(0);
- }
- // Finally, add the command set ready to be returned.
- cset.add(new StructureMappingcommandSet(JmolCommands.class,files[pdbfnum], str.toArray(new String[str.size()])));
-
- }
- return cset.toArray(new StructureMappingcommandSet[cset.size()]);
- }
-
- public static StringBuffer condenseCommand(StringBuffer command, int pos)
- {
-
- // work back to last 'select'
- int p=command.length(),q=p;
- do {
- p-=6;
- if (p<1) { p=0; };
- } while ((q=command.indexOf("select",p))==-1 && p>0);
-
- StringBuffer sb = new StringBuffer(command.substring(0,q+7));
-
- command = command.delete(0,q+7);
-
- String start;
-
- if (command.indexOf("-") > -1)
- {
- start = command.substring(0, command.indexOf("-"));
- }
- else
- {
- start = command.substring(0, command.indexOf(":"));
- }
-
- sb.append(start + "-" + pos + command.substring(command.indexOf(":")));
-
- return sb;
- }
-
-}
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.jmol;
+
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+import jalview.structure.StructureMapping;
+import jalview.structure.StructureMappingcommandSet;
+import jalview.structure.StructureSelectionManager;
+
+import java.awt.Color;
+import java.util.ArrayList;
+
+/**
+ * Routines for generating Jmol commands for Jalview/Jmol binding another
+ * cruisecontrol test.
+ *
+ * @author JimP
+ *
+ */
+public class JmolCommands
+{
+
+ /**
+ * Jmol utility which constructs the commands to colour chains by the given
+ * alignment
+ *
+ * @returns Object[] { Object[] { <model being coloured>,
+ *
+ */
+ public static StructureMappingcommandSet[] getColourBySequenceCommand(
+ StructureSelectionManager ssm, String[] files,
+ SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr,
+ AlignmentI alignment)
+ {
+
+ ArrayList<StructureMappingcommandSet> cset = new ArrayList<StructureMappingcommandSet>();
+
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
+ StringBuffer command = new StringBuffer();
+ StructureMappingcommandSet smc;
+ ArrayList<String> str = new ArrayList<String>();
+
+ if (mapping == null || mapping.length < 1)
+ continue;
+
+ int lastPos = -1;
+ for (int s = 0; s < sequence[pdbfnum].length; s++)
+ {
+ for (int sp, m = 0; m < mapping.length; m++)
+ {
+ if (mapping[m].getSequence() == sequence[pdbfnum][s]
+ && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)
+ {
+ SequenceI asp = alignment.getSequenceAt(sp);
+ for (int r = 0; r < asp.getLength(); r++)
+ {
+ // no mapping to gaps in sequence
+ if (jalview.util.Comparison.isGap(asp.getCharAt(r)))
+ {
+ continue;
+ }
+ int pos = mapping[m].getPDBResNum(asp.findPosition(r));
+
+ if (pos < 1 || pos == lastPos)
+ continue;
+
+ lastPos = pos;
+
+ Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);
+
+ if (fr != null)
+ col = fr.findFeatureColour(col, sequence[pdbfnum][s], r);
+ String newSelcom = (mapping[m].getChain() != " " ? ":"
+ + mapping[m].getChain() : "")
+ + "/"
+ + (pdbfnum + 1)
+ + ".1"
+ + ";color["
+ + col.getRed()
+ + ","
+ + col.getGreen()
+ + ","
+ + col.getBlue() + "]";
+ if (command.length() > newSelcom.length()
+ && command.substring(
+ command.length() - newSelcom.length())
+ .equals(newSelcom))
+ {
+ command = JmolCommands.condenseCommand(command, pos);
+ continue;
+ }
+ // TODO: deal with case when buffer is too large for Jmol to parse
+ // - execute command and flush
+
+ command.append(";");
+ if (command.length() > 51200)
+ {
+ // add another chunk
+ str.add(command.toString());
+ command.setLength(0);
+ }
+ command.append("select " + pos);
+ command.append(newSelcom);
+ }
+ break;
+ }
+ }
+ }
+ {
+ // add final chunk
+ str.add(command.toString());
+ command.setLength(0);
+ }
+ // Finally, add the command set ready to be returned.
+ cset.add(new StructureMappingcommandSet(JmolCommands.class,
+ files[pdbfnum], str.toArray(new String[str.size()])));
+
+ }
+ return cset.toArray(new StructureMappingcommandSet[cset.size()]);
+ }
+
+ public static StringBuffer condenseCommand(StringBuffer command, int pos)
+ {
+
+ // work back to last 'select'
+ int p = command.length(), q = p;
+ do
+ {
+ p -= 6;
+ if (p < 1)
+ {
+ p = 0;
+ }
+ ;
+ } while ((q = command.indexOf("select", p)) == -1 && p > 0);
+
+ StringBuffer sb = new StringBuffer(command.substring(0, q + 7));
+
+ command = command.delete(0, q + 7);
+
+ String start;
+
+ if (command.indexOf("-") > -1)
+ {
+ start = command.substring(0, command.indexOf("-"));
+ }
+ else
+ {
+ start = command.substring(0, command.indexOf(":"));
+ }
+
+ sb.append(start + "-" + pos + command.substring(command.indexOf(":")));
+
+ return sb;
+ }
+
+}
diff --git a/src/jalview/ext/jmol/PDBFileWithJmol.java b/src/jalview/ext/jmol/PDBFileWithJmol.java
new file mode 100644
index 0000000..69cb8bd
--- /dev/null
+++ b/src/jalview/ext/jmol/PDBFileWithJmol.java
@@ -0,0 +1,465 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.jmol;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.io.AlignFile;
+import jalview.io.FileParse;
+import jalview.schemes.ResidueProperties;
+import jalview.util.MessageManager;
+
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javajs.awt.Dimension;
+
+import org.jmol.api.JmolStatusListener;
+import org.jmol.api.JmolViewer;
+import org.jmol.c.CBK;
+import org.jmol.modelset.Group;
+import org.jmol.modelset.Model;
+import org.jmol.modelset.ModelSet;
+import org.jmol.modelsetbio.BioModel;
+import org.jmol.modelsetbio.BioPolymer;
+import org.jmol.viewer.Viewer;
+
+/**
+ * Import and process PDB files with Jmol
+ *
+ * @author jprocter
+ *
+ */
+public class PDBFileWithJmol extends AlignFile implements
+ JmolStatusListener
+{
+ Viewer viewer = null;
+
+ public PDBFileWithJmol(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+ }
+
+ public PDBFileWithJmol(FileParse fp) throws IOException
+ {
+ super(fp);
+ }
+
+ public PDBFileWithJmol()
+ {
+ }
+
+ /**
+ * create a headless jmol instance for dataprocessing
+ *
+ * @return
+ */
+ private Viewer getJmolData()
+ {
+ if (viewer == null)
+ {
+ try
+ {
+ viewer = (Viewer) JmolViewer.allocateViewer(null, null, null, null,
+ null, "-x -o -n", this);
+ } catch (ClassCastException x)
+ {
+ throw new Error(MessageManager.formatMessage(
+ "error.jmol_version_not_compatible_with_jalview_version",
+ new String[] { JmolViewer.getJmolVersion() }), x);
+ }
+ }
+ return viewer;
+ }
+
+ private void waitForScript(Viewer jmd)
+ {
+ while (jmd.isScriptExecuting())
+ {
+ try
+ {
+ Thread.sleep(50);
+
+ } catch (InterruptedException x)
+ {
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.io.AlignFile#parse()
+ */
+ @Override
+ public void parse() throws IOException
+ {
+ Viewer jmd = getJmolData();
+ jmd.openReader(getDataName(), getDataName(), getReader());
+ waitForScript(jmd);
+
+ if (jmd.ms.mc > 0)
+ {
+ ModelSet ms = jmd.ms;
+ // Jmol 14.2 added third argument doReport = false
+ ms.calculateStructures(null, true, false, false, true);
+ // System.out.println("Structs\n"+structs);
+ Group group = null;
+ int modelIndex = -1;
+ for (Model model : ms.am)
+ {
+ modelIndex++;
+ for (BioPolymer bp : ((BioModel) model).bioPolymers)
+ {
+ int lastChainId = 0; // int value of character e.g. 65 for A
+ String lastChainIdAlpha = "";
+
+ int[] groups = bp.getLeadAtomIndices();
+ char seq[] = new char[groups.length], secstr[] = new char[groups.length], secstrcode[] = new char[groups.length];
+ int groupc = 0, len = 0, firstrnum = 1, lastrnum = 0;
+
+ do
+ {
+ if (groupc >= groups.length
+ || ms.at[groups[groupc]].group.chain.chainID != lastChainId)
+ {
+ /*
+ * on change of chain (or at end), construct the sequence and
+ * secondary structure annotation for the last chain
+ */
+ if (len > 0)
+ {
+ boolean isNa = bp.isNucleic();
+ // normalise sequence from Jmol to jalview
+ int[] cinds = isNa ? ResidueProperties.nucleotideIndex
+ : ResidueProperties.aaIndex;
+ int nonGap = isNa ? ResidueProperties.maxNucleotideIndex
+ : ResidueProperties.maxProteinIndex;
+ char ngc = 'X';
+ char newseq[] = new char[len];
+ Annotation asecstr[] = new Annotation[len + firstrnum - 1];
+ for (int p = 0; p < len; p++)
+ {
+ newseq[p] = cinds[seq[p]] == nonGap ? ngc : seq[p];
+ if (secstr[p] >= 'A' && secstr[p] <= 'z')
+ {
+ try
+ {
+ asecstr[p] = new Annotation("" + secstr[p], null,
+ secstrcode[p], Float.NaN);
+ } catch (ArrayIndexOutOfBoundsException e)
+ {
+ // skip - patch for JAL-1836
+ }
+ }
+ }
+ String modelTitle = (String) ms
+ .getInfo(modelIndex, "title");
+ SequenceI sq = new Sequence("" + getDataName() + "|"
+ + modelTitle + "|" + lastChainIdAlpha, newseq,
+ firstrnum, lastrnum);
+ PDBEntry pdbe = new PDBEntry();
+ pdbe.setFile(getDataName());
+ pdbe.setId(getDataName());
+ pdbe.setProperty(new Hashtable());
+ // pdbe.getProperty().put("CHAIN", "" + _lastChainId);
+ pdbe.setChainCode(lastChainIdAlpha);
+ sq.addPDBId(pdbe);
+ // JAL-1533
+ // Need to put the number of models for this polymer somewhere
+ // for Chimera/others to grab
+ // pdbe.getProperty().put("PDBMODELS", biopoly.)
+ seqs.add(sq);
+ if (!isNa)
+ {
+ String mt = modelTitle == null ? getDataName()
+ : modelTitle;
+ if (lastChainId >= ' ')
+ {
+ mt += lastChainIdAlpha;
+ }
+ AlignmentAnnotation ann = new AlignmentAnnotation(
+ "Secondary Structure", "Secondary Structure for "
+ + mt, asecstr);
+ ann.belowAlignment = true;
+ ann.visible = true;
+ ann.autoCalculated = false;
+ ann.setCalcId(getClass().getName());
+ sq.addAlignmentAnnotation(ann);
+ ann.adjustForAlignment();
+ ann.validateRangeAndDisplay();
+ annotations.add(ann);
+ }
+ }
+ len = 0;
+ firstrnum = 1;
+ lastrnum = 0;
+ }
+ if (groupc < groups.length)
+ {
+ group = ms.at[groups[groupc]].group;
+ if (len == 0)
+ {
+ firstrnum = group.getResno();
+ lastChainId = group.chain.chainID;
+ lastChainIdAlpha = group.chain.getIDStr();
+ }
+ else
+ {
+ lastrnum = group.getResno();
+ }
+ seq[len] = group.getGroup1();
+
+ /*
+ * JAL-1828 replace a modified amino acid with its standard
+ * equivalent (e.g. MSE with MET->M) to maximise sequence matching
+ */
+ String threeLetterCode = group.getGroup3();
+ String canonical = ResidueProperties
+ .getCanonicalAminoAcid(threeLetterCode);
+ if (canonical != null
+ && !canonical.equalsIgnoreCase(threeLetterCode))
+ {
+ seq[len] = ResidueProperties
+ .getSingleCharacterCode(canonical);
+ }
+ switch (group.getProteinStructureSubType())
+ {
+ case HELIX310:
+ if (secstr[len] == 0)
+ {
+ secstr[len] = '3';
+ }
+ case HELIXALPHA:
+ if (secstr[len] == 0)
+ {
+ secstr[len] = 'H';
+ }
+ case HELIXPI:
+ if (secstr[len] == 0)
+ {
+ secstr[len] = 'P';
+ }
+ case HELIX:
+ if (secstr[len] == 0)
+ {
+ secstr[len] = 'H';
+ }
+ secstrcode[len] = 'H';
+ break;
+ case SHEET:
+ secstr[len] = 'E';
+ secstrcode[len] = 'E';
+ break;
+ default:
+ secstr[len] = 0;
+ secstrcode[len] = 0;
+ }
+ len++;
+ }
+ } while (groupc++ < groups.length);
+ }
+ }
+
+ /*
+ * lastScriptTermination = -9465; String dsspOut =
+ * jmd.evalString("calculate STRUCTURE"); if (dsspOut.equals("pending")) {
+ * while (lastScriptTermination == -9465) { try { Thread.sleep(50); }
+ * catch (Exception x) { } ; } } System.out.println(lastConsoleEcho);
+ */
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.io.AlignFile#print()
+ */
+ @Override
+ public String print()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setCallbackFunction(String callbackType,
+ String callbackFunction)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @Override public void notifyCallback(EnumCallback type, Object[] data) {
+ * try { switch (type) { case ERROR: case SCRIPT:
+ * notifyScriptTermination((String) data[2], ((Integer) data[3]).intValue());
+ * break; case MESSAGE: sendConsoleMessage((data == null) ? ((String) null) :
+ * (String) data[1]); break; case LOADSTRUCT: notifyFileLoaded((String)
+ * data[1], (String) data[2], (String) data[3], (String) data[4], ((Integer)
+ * data[5]).intValue());
+ *
+ * break; default: // System.err.println("Unhandled callback " + type + " " //
+ * + data[1].toString()); break; } } catch (Exception e) {
+ * System.err.println("Squashed Jmol callback handler error:");
+ * e.printStackTrace(); } }
+ */
+ public void notifyCallback(CBK type, Object[] data)
+ {
+ String strInfo = (data == null || data[1] == null ? null : data[1]
+ .toString());
+ switch (type)
+ {
+ case ECHO:
+ sendConsoleEcho(strInfo);
+ break;
+ case SCRIPT:
+ notifyScriptTermination((String) data[2],
+ ((Integer) data[3]).intValue());
+ break;
+ case MEASURE:
+ String mystatus = (String) data[3];
+ if (mystatus.indexOf("Picked") >= 0
+ || mystatus.indexOf("Sequence") >= 0)
+ {
+ // Picking mode
+ sendConsoleMessage(strInfo);
+ }
+ else if (mystatus.indexOf("Completed") >= 0)
+ {
+ sendConsoleEcho(strInfo.substring(strInfo.lastIndexOf(",") + 2,
+ strInfo.length() - 1));
+ }
+ break;
+ case MESSAGE:
+ sendConsoleMessage(data == null ? null : strInfo);
+ break;
+ case PICK:
+ sendConsoleMessage(strInfo);
+ break;
+ default:
+ break;
+ }
+ }
+
+ String lastConsoleEcho = "";
+
+ private void sendConsoleEcho(String string)
+ {
+ lastConsoleEcho += string;
+ lastConsoleEcho += "\n";
+ }
+
+ String lastConsoleMessage = "";
+
+ private void sendConsoleMessage(String string)
+ {
+ lastConsoleMessage += string;
+ lastConsoleMessage += "\n";
+ }
+
+ int lastScriptTermination = -1;
+
+ String lastScriptMessage = "";
+
+ private void notifyScriptTermination(String string, int intValue)
+ {
+ lastScriptMessage += string;
+ lastScriptMessage += "\n";
+ lastScriptTermination = intValue;
+ }
+
+ @Override
+ public boolean notifyEnabled(CBK callbackPick)
+ {
+ switch (callbackPick)
+ {
+ case MESSAGE:
+ case SCRIPT:
+ case ECHO:
+ case LOADSTRUCT:
+ case ERROR:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public String eval(String strEval)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public float[][] functionXY(String functionName, int x, int y)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public float[][][] functionXYZ(String functionName, int nx, int ny, int nz)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String createImage(String fileName, String type,
+ Object text_or_bytes, int quality)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, Object> getRegistryInfo()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void showUrl(String url)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Dimension resizeInnerPanel(String data)
+ {
+ return null;
+ }
+
+ @Override
+ public Map<String, Object> getJSpecViewProperty(String arg0)
+ {
+ return null;
+ }
+
+}
diff --git a/src/jalview/ext/paradise/Annotate3D.java b/src/jalview/ext/paradise/Annotate3D.java
new file mode 100644
index 0000000..885945e
--- /dev/null
+++ b/src/jalview/ext/paradise/Annotate3D.java
@@ -0,0 +1,248 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.paradise;
+
+import jalview.util.MessageManager;
+import jalview.ws.HttpClientUtils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.http.NameValuePair;
+import org.apache.http.message.BasicNameValuePair;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.ContentHandler;
+import org.json.simple.parser.ParseException;
+
+/**
+ * simple methods for calling the various paradise RNA tools
+ *
+ * @author jimp
+ *
+ * History: v1.0 revised from original due to refactoring of
+ * paradise-ubmc.u-strasbg.fr/webservices/annotate3d to
+ * http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview
+ */
+public class Annotate3D
+{
+ private static String twoDtoolsURL = "http://arn-ibmc.in2p3.fr/api/compute/2d";
+
+ private static ContentHandler createContentHandler()
+ {
+ ContentHandler ch = new ContentHandler()
+ {
+
+ @Override
+ public void startJSON() throws ParseException, IOException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void endJSON() throws ParseException, IOException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean startObject() throws ParseException, IOException
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean endObject() throws ParseException, IOException
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean startObjectEntry(String key) throws ParseException,
+ IOException
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean endObjectEntry() throws ParseException, IOException
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean startArray() throws ParseException, IOException
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean endArray() throws ParseException, IOException
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean primitive(Object value) throws ParseException,
+ IOException
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ };
+ return ch;
+ }
+
+ public static Iterator<Reader> getRNAMLForPDBFileAsString(String pdbfile)
+ throws Exception
+ {
+ List<NameValuePair> vals = new ArrayList<NameValuePair>();
+ vals.add(new BasicNameValuePair("tool", "rnaview"));
+ vals.add(new BasicNameValuePair("data", pdbfile));
+ vals.add(new BasicNameValuePair("output", "rnaml"));
+ // return processJsonResponseFor(HttpClientUtils.doHttpUrlPost(twoDtoolsURL,
+ // vals));
+ ArrayList<Reader> readers = new ArrayList<Reader>();
+ final BufferedReader postResponse = HttpClientUtils.doHttpUrlPost(
+ twoDtoolsURL, vals, 0, 0);
+ readers.add(postResponse);
+ return readers.iterator();
+
+ }
+
+ public static Iterator<Reader> processJsonResponseFor(Reader respons)
+ throws Exception
+ {
+ org.json.simple.parser.JSONParser jp = new org.json.simple.parser.JSONParser();
+ try
+ {
+ final JSONArray responses = (JSONArray) jp.parse(respons);
+ final Iterator rvals = responses.iterator();
+ return new Iterator<Reader>()
+ {
+ @Override
+ public boolean hasNext()
+ {
+ return rvals.hasNext();
+ }
+
+ @Override
+ public Reader next()
+ {
+ JSONObject val = (JSONObject) rvals.next();
+
+ Object sval = null;
+ try
+ {
+ sval = val.get("2D");
+ } catch (Exception x)
+ {
+ x.printStackTrace();
+ }
+ ;
+ if (sval == null)
+ {
+ System.err
+ .println("DEVELOPER WARNING: Annotate3d didn't return a '2D' tag in its response. Consider checking output of server. Response was :"
+ + val.toString());
+
+ sval = "";
+ }
+ return new StringReader(
+ (sval instanceof JSONObject) ? ((JSONObject) sval)
+ .toString() : sval.toString());
+
+ }
+
+ @Override
+ public void remove()
+ {
+ throw new Error(
+ MessageManager.getString("error.not_implemented_remove"));
+
+ }
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException
+ {
+ throw new CloneNotSupportedException(
+ MessageManager.getString("error.not_implemented_clone"));
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return super.equals(obj);
+ }
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ while (rvals.hasNext())
+ {
+ rvals.next();
+ }
+ super.finalize();
+ }
+ };
+ } catch (Exception foo)
+ {
+ throw new Exception(
+ MessageManager
+ .getString("exception.couldnt_parse_responde_from_annotated3d_server"),
+ foo);
+ }
+
+ }
+
+ public static Iterator<Reader> getRNAMLForPDBId(String pdbid)
+ throws Exception
+ {
+ List<NameValuePair> vals = new ArrayList<NameValuePair>();
+ vals.add(new BasicNameValuePair("tool", "rnaview"));
+ vals.add(new BasicNameValuePair("pdbid", pdbid));
+ vals.add(new BasicNameValuePair("output", "rnaml"));
+ java.net.URL geturl = new URL(twoDtoolsURL + "?tool=rnaview&pdbid="
+ + pdbid + "&output=rnaml");
+ // return processJsonResponseFor(new
+ // InputStreamReader(geturl.openStream()));
+ ArrayList<Reader> readers = new ArrayList<Reader>();
+ readers.add(new InputStreamReader(geturl.openStream()));
+ return readers.iterator();
+ }
+
+}
diff --git a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java
new file mode 100644
index 0000000..a529502
--- /dev/null
+++ b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java
@@ -0,0 +1,293 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.rbvi.chimera;
+
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+import jalview.structure.StructureMapping;
+import jalview.structure.StructureMappingcommandSet;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.ColorUtils;
+import jalview.util.Comparison;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Routines for generating Chimera commands for Jalview/Chimera binding
+ *
+ * @author JimP
+ *
+ */
+public class ChimeraCommands
+{
+
+ /**
+ * utility to construct the commands to colour chains by the given alignment
+ * for passing to Chimera
+ *
+ * @returns Object[] { Object[] { <model being coloured>,
+ *
+ */
+ public static StructureMappingcommandSet[] getColourBySequenceCommand(
+ StructureSelectionManager ssm, String[] files,
+ SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr,
+ AlignmentI alignment)
+ {
+ Map<Color, Map<Integer, Map<String, List<int[]>>>> colourMap = buildColoursMap(
+ ssm, files, sequence, sr, fr, alignment);
+
+ List<String> colourCommands = buildColourCommands(colourMap);
+
+ StructureMappingcommandSet cs = new StructureMappingcommandSet(
+ ChimeraCommands.class, null,
+ colourCommands.toArray(new String[0]));
+
+ return new StructureMappingcommandSet[] { cs };
+ }
+
+ /**
+ * Traverse the map of colours/models/chains/positions to construct a list of
+ * 'color' commands (one per distinct colour used). The format of each command
+ * is
+ *
+ * <blockquote> color colorname #modelnumber:range.chain e.g. color #00ff00
+ * #0:2.B,4.B,9-12.B|#1:1.A,2-6.A,...
+ *
+ * @see http
+ * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/frameatom_spec
+ * .html </pre>
+ *
+ * @param colourMap
+ * @return
+ */
+ protected static List<String> buildColourCommands(
+ Map<Color, Map<Integer, Map<String, List<int[]>>>> colourMap)
+ {
+ /*
+ * This version concatenates all commands into a single String (semi-colon
+ * delimited). If length limit issues arise, refactor to return one color
+ * command per colour.
+ */
+ List<String> commands = new ArrayList<String>();
+ StringBuilder sb = new StringBuilder(256);
+ boolean firstColour = true;
+ for (Color colour : colourMap.keySet())
+ {
+ String colourCode = ColorUtils.toTkCode(colour);
+ if (!firstColour)
+ {
+ sb.append("; ");
+ }
+ sb.append("color ").append(colourCode).append(" ");
+ firstColour = false;
+ boolean firstModelForColour = true;
+ final Map<Integer, Map<String, List<int[]>>> colourData = colourMap
+ .get(colour);
+ for (Integer model : colourData.keySet())
+ {
+ boolean firstPositionForModel = true;
+ if (!firstModelForColour)
+ {
+ sb.append("|");
+ }
+ firstModelForColour = false;
+ sb.append("#").append(model).append(":");
+
+ final Map<String, List<int[]>> modelData = colourData.get(model);
+ for (String chain : modelData.keySet())
+ {
+ boolean hasChain = !"".equals(chain.trim());
+ for (int[] range : modelData.get(chain))
+ {
+ if (!firstPositionForModel)
+ {
+ sb.append(",");
+ }
+ if (range[0] == range[1])
+ {
+ sb.append(range[0]);
+ }
+ else
+ {
+ sb.append(range[0]).append("-").append(range[1]);
+ }
+ if (hasChain)
+ {
+ sb.append(".").append(chain);
+ }
+ firstPositionForModel = false;
+ }
+ }
+ }
+ }
+ commands.add(sb.toString());
+ return commands;
+ }
+
+ /**
+ * <pre>
+ * Build a data structure which maps contiguous subsequences for each colour.
+ * This generates a data structure from which we can easily generate the
+ * Chimera command for colour by sequence.
+ * Color
+ * Model number
+ * Chain
+ * list of start/end ranges
+ * Ordering is by order of addition (for colours and positions), natural ordering (for models and chains)
+ * </pre>
+ */
+ protected static Map<Color, Map<Integer, Map<String, List<int[]>>>> buildColoursMap(
+ StructureSelectionManager ssm, String[] files,
+ SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr,
+ AlignmentI alignment)
+ {
+ Map<Color, Map<Integer, Map<String, List<int[]>>>> colourMap = new LinkedHashMap<Color, Map<Integer, Map<String, List<int[]>>>>();
+ Color lastColour = null;
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
+
+ if (mapping == null || mapping.length < 1)
+ {
+ continue;
+ }
+
+ int startPos = -1, lastPos = -1;
+ String lastChain = "";
+ for (int s = 0; s < sequence[pdbfnum].length; s++)
+ {
+ for (int sp, m = 0; m < mapping.length; m++)
+ {
+ final SequenceI seq = sequence[pdbfnum][s];
+ if (mapping[m].getSequence() == seq
+ && (sp = alignment.findIndex(seq)) > -1)
+ {
+ SequenceI asp = alignment.getSequenceAt(sp);
+ for (int r = 0; r < asp.getLength(); r++)
+ {
+ // no mapping to gaps in sequence
+ if (Comparison.isGap(asp.getCharAt(r)))
+ {
+ continue;
+ }
+ int pos = mapping[m].getPDBResNum(asp.findPosition(r));
+
+ if (pos < 1 || pos == lastPos)
+ {
+ continue;
+ }
+
+ Color colour = sr.getResidueColour(seq, r, fr);
+ final String chain = mapping[m].getChain();
+
+ /*
+ * Just keep incrementing the end position for this colour range
+ * _unless_ colour, PDB model or chain has changed, or there is a
+ * gap in the mapped residue sequence
+ */
+ final boolean newColour = !colour.equals(lastColour);
+ final boolean nonContig = lastPos + 1 != pos;
+ final boolean newChain = !chain.equals(lastChain);
+ if (newColour || nonContig || newChain)
+ {
+ if (startPos != -1)
+ {
+ addColourRange(colourMap, lastColour, pdbfnum, startPos,
+ lastPos, lastChain);
+ }
+ startPos = pos;
+ }
+ lastColour = colour;
+ lastPos = pos;
+ lastChain = chain;
+ }
+ // final colour range
+ if (lastColour != null)
+ {
+ addColourRange(colourMap, lastColour, pdbfnum, startPos,
+ lastPos, lastChain);
+ }
+ break;
+ }
+ }
+ }
+ }
+ return colourMap;
+ }
+
+ /**
+ * Helper method to add one contiguous colour range to the colour map.
+ *
+ * @param colourMap
+ * @param colour
+ * @param model
+ * @param startPos
+ * @param endPos
+ * @param chain
+ */
+ protected static void addColourRange(
+ Map<Color, Map<Integer, Map<String, List<int[]>>>> colourMap,
+ Color colour, int model, int startPos, int endPos, String chain)
+ {
+ /*
+ * Get/initialize map of data for the colour
+ */
+ Map<Integer, Map<String, List<int[]>>> colourData = colourMap
+ .get(colour);
+ if (colourData == null)
+ {
+ colourMap
+ .put(colour,
+ colourData = new TreeMap<Integer, Map<String, List<int[]>>>());
+ }
+
+ /*
+ * Get/initialize map of data for the colour and model
+ */
+ Map<String, List<int[]>> modelData = colourData.get(model);
+ if (modelData == null)
+ {
+ colourData.put(model, modelData = new TreeMap<String, List<int[]>>());
+ }
+
+ /*
+ * Get/initialize map of data for colour, model and chain
+ */
+ List<int[]> chainData = modelData.get(chain);
+ if (chainData == null)
+ {
+ modelData.put(chain, chainData = new ArrayList<int[]>());
+ }
+
+ /*
+ * Add the start/end positions
+ */
+ chainData.add(new int[] { startPos, endPos });
+ }
+
+}
diff --git a/src/jalview/ext/rbvi/chimera/ChimeraListener.java b/src/jalview/ext/rbvi/chimera/ChimeraListener.java
new file mode 100644
index 0000000..979955a
--- /dev/null
+++ b/src/jalview/ext/rbvi/chimera/ChimeraListener.java
@@ -0,0 +1,149 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.rbvi.chimera;
+
+import jalview.httpserver.AbstractRequestHandler;
+import jalview.structure.SelectionSource;
+
+import java.net.BindException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * This is a simple Http handler that can listen for selections in Chimera.
+ * <p/>
+ * Lifecycle:
+ * <ul>
+ * <li>Start the Chimera process</li>
+ * <li>Start the REST service on Chimera, get the port number it is listening on
+ * </li>
+ * <li>Start the ChimeraListener, get the URL it is listening on</li>
+ * <li>The first listener started will start the singleton HttpServer</li>
+ * <li>Send a 'listen' command to Chimera with the URL of the listener</li>
+ * <li>When Jalview's Chimera window is closed, shut down the ChimeraListener</li>
+ * <li>Multiple linked Chimera instances will each have a separate listener (but
+ * share one Http server)</li>
+ * </ul>
+ *
+ * @author gmcarstairs
+ *
+ */
+public class ChimeraListener extends AbstractRequestHandler implements
+ SelectionSource
+{
+ /*
+ * Chimera notification parameter name
+ */
+ private static final String CHIMERA_NOTIFICATION = "chimeraNotification";
+
+ /*
+ * Chimera model changed notifications start with this
+ */
+ private static final String MODEL_CHANGED = "ModelChanged: ";
+
+ /*
+ * Chimera selection changed notification message
+ */
+ private static final String SELECTION_CHANGED = "SelectionChanged: selection changed\n";
+
+ /*
+ * A static counter so each listener can be associated with a distinct context
+ * root (/chimera0,1,2,3...). This is needed so we can fetch selections from
+ * multiple Chimera instances without confusion.
+ */
+ private static int chimeraId = 0;
+
+ /*
+ * Prefix for path below context root (myChimeraId is appended)
+ */
+ private static final String PATH_PREFIX = "chimera";
+
+ /*
+ * Value of chimeraId (0, 1, 2...) for this instance
+ */
+ private int myChimeraId = 0;
+
+ /*
+ * A reference to the object by which we can talk to Chimera
+ */
+ private JalviewChimeraBinding chimeraBinding;
+
+ /**
+ * Constructor that registers this as an Http request handler on path
+ * /chimeraN, where N is incremented for each instance. Call getUri to get the
+ * resulting URI for this handler.
+ *
+ * @param chimeraBinding
+ * @throws BindException
+ * if no free port can be assigned
+ */
+ public ChimeraListener(JalviewChimeraBinding binding)
+ throws BindException
+ {
+ myChimeraId = chimeraId++;
+ this.chimeraBinding = binding;
+ setPath(PATH_PREFIX + myChimeraId);
+ registerHandler();
+ }
+
+ /**
+ * Process a message from Chimera
+ */
+ @Override
+ protected void processRequest(HttpServletRequest request,
+ HttpServletResponse response)
+ {
+ // dumpRequest(request);
+ String message = request.getParameter(CHIMERA_NOTIFICATION);
+ if (SELECTION_CHANGED.equals(message))
+ {
+ this.chimeraBinding.highlightChimeraSelection();
+ }
+ else if (message != null && message.startsWith(MODEL_CHANGED))
+ {
+ processModelChanged(message.substring(MODEL_CHANGED.length()));
+ }
+ else
+ {
+ System.err.println("Unexpected chimeraNotification: " + message);
+ }
+ }
+
+ /**
+ * Handler a ModelChanged notification from Chimera
+ *
+ * @param substring
+ */
+ protected void processModelChanged(String message)
+ {
+ // System.out.println(message + " (not implemented in Jalview)");
+ }
+
+ /**
+ * Returns a display name for this service
+ */
+ @Override
+ public String getName()
+ {
+ return "ChimeraListener";
+ }
+}
diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
new file mode 100644
index 0000000..415fc1b
--- /dev/null
+++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
@@ -0,0 +1,1118 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.rbvi.chimera;
+
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.bin.Cache;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.httpserver.AbstractRequestHandler;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.AtomSpec;
+import jalview.structure.StructureMappingcommandSet;
+import jalview.structure.StructureSelectionManager;
+import jalview.structures.models.AAStructureBindingModel;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.net.BindException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import ext.edu.ucsf.rbvi.strucviz2.ChimeraManager;
+import ext.edu.ucsf.rbvi.strucviz2.ChimeraModel;
+import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
+import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
+
+public abstract class JalviewChimeraBinding extends AAStructureBindingModel
+{
+ // Chimera clause to exclude alternate locations in atom selection
+ private static final String NO_ALTLOCS = "&~@.B-Z&~@.2-9";
+
+ private static final String COLOURING_CHIMERA = MessageManager
+ .getString("status.colouring_chimera");
+
+ private static final boolean debug = false;
+
+ private static final String PHOSPHORUS = "P";
+
+ private static final String ALPHACARBON = "CA";
+
+ /*
+ * Object through which we talk to Chimera
+ */
+ private ChimeraManager viewer;
+
+ /*
+ * Object which listens to Chimera notifications
+ */
+ private AbstractRequestHandler chimeraListener;
+
+ /*
+ * set if chimera state is being restored from some source - instructs binding
+ * not to apply default display style when structure set is updated for first
+ * time.
+ */
+ private boolean loadingFromArchive = false;
+
+ /*
+ * flag to indicate if the Chimera viewer should ignore sequence colouring
+ * events from the structure manager because the GUI is still setting up
+ */
+ private boolean loadingFinished = true;
+
+ public String fileLoadingError;
+
+ /*
+ * Map of ChimeraModel objects keyed by PDB full local file name
+ */
+ private Map<String, List<ChimeraModel>> chimeraMaps = new LinkedHashMap<String, List<ChimeraModel>>();
+
+ /*
+ * the default or current model displayed if the model cannot be identified
+ * from the selection message
+ */
+ private int frameNo = 0;
+
+ private String lastCommand;
+
+ private boolean loadedInline;
+
+ /**
+ * current set of model filenames loaded
+ */
+ String[] modelFileNames = null;
+
+ String lastMousedOverAtomSpec;
+
+ private List<String> lastReply;
+
+ /*
+ * incremented every time a load notification is successfully handled -
+ * lightweight mechanism for other threads to detect when they can start
+ * referring to new structures.
+ */
+ private long loadNotifiesHandled = 0;
+
+ /**
+ * Open a PDB structure file in Chimera and set up mappings from Jalview.
+ *
+ * We check if the PDB model id is already loaded in Chimera, if so don't
+ * reopen it. This is the case if Chimera has opened a saved session file.
+ *
+ * @param pe
+ * @return
+ */
+ public boolean openFile(PDBEntry pe)
+ {
+ String file = pe.getFile();
+ try
+ {
+ List<ChimeraModel> modelsToMap = new ArrayList<ChimeraModel>();
+ List<ChimeraModel> oldList = viewer.getModelList();
+ boolean alreadyOpen = false;
+
+ /*
+ * If Chimera already has this model, don't reopen it, but do remap it.
+ */
+ for (ChimeraModel open : oldList)
+ {
+ if (open.getModelName().equals(pe.getId()))
+ {
+ alreadyOpen = true;
+ modelsToMap.add(open);
+ }
+ }
+
+ /*
+ * If Chimera doesn't yet have this model, ask it to open it, and retrieve
+ * the model name(s) added by Chimera.
+ */
+ if (!alreadyOpen)
+ {
+ viewer.openModel(file, pe.getId(), ModelType.PDB_MODEL);
+ List<ChimeraModel> newList = viewer.getModelList();
+ // JAL-1728 newList.removeAll(oldList) does not work
+ for (ChimeraModel cm : newList)
+ {
+ if (cm.getModelName().equals(pe.getId()))
+ {
+ modelsToMap.add(cm);
+ }
+ }
+ }
+
+ chimeraMaps.put(file, modelsToMap);
+
+ if (getSsm() != null)
+ {
+ getSsm().addStructureViewerListener(this);
+ // ssm.addSelectionListener(this);
+ FeatureRenderer fr = getFeatureRenderer(null);
+ if (fr != null)
+ {
+ fr.featuresAdded();
+ }
+ refreshGUI();
+ }
+ return true;
+ } catch (Exception q)
+ {
+ log("Exception when trying to open model " + file + "\n"
+ + q.toString());
+ q.printStackTrace();
+ }
+ return false;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param ssm
+ * @param pdbentry
+ * @param sequenceIs
+ * @param chains
+ * @param protocol
+ */
+ public JalviewChimeraBinding(StructureSelectionManager ssm,
+ PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
+ String protocol)
+ {
+ super(ssm, pdbentry, sequenceIs, chains, protocol);
+ viewer = new ChimeraManager(
+ new ext.edu.ucsf.rbvi.strucviz2.StructureManager(true));
+ }
+
+ /**
+ * Start a dedicated HttpServer to listen for Chimera notifications, and tell
+ * it to start listening
+ */
+ public void startChimeraListener()
+ {
+ try
+ {
+ chimeraListener = new ChimeraListener(this);
+ viewer.startListening(chimeraListener.getUri());
+ } catch (BindException e)
+ {
+ System.err.println("Failed to start Chimera listener: "
+ + e.getMessage());
+ }
+ }
+
+ /**
+ * Construct a title string for the viewer window based on the data Jalview
+ * knows about
+ *
+ * @param verbose
+ * @return
+ */
+ public String getViewerTitle(boolean verbose)
+ {
+ return getViewerTitle("Chimera", verbose);
+ }
+
+ /**
+ * Tells Chimera to display only the specified chains
+ *
+ * @param toshow
+ */
+ public void showChains(List<String> toshow)
+ {
+ /*
+ * Construct a chimera command like
+ *
+ * ~display #*;~ribbon #*;ribbon :.A,:.B
+ */
+ StringBuilder cmd = new StringBuilder(64);
+ boolean first = true;
+ for (String chain : toshow)
+ {
+ if (!first)
+ {
+ cmd.append(",");
+ }
+ cmd.append(":.").append(chain);
+ first = false;
+ }
+
+ /*
+ * could append ";focus" to this command to resize the display to fill the
+ * window, but it looks more helpful not to (easier to relate chains to the
+ * whole)
+ */
+ final String command = "~display #*; ~ribbon #*; ribbon "
+ + cmd.toString();
+ sendChimeraCommand(command, false);
+ }
+
+ /**
+ * Close down the Jalview viewer and listener, and (optionally) the associated
+ * Chimera window.
+ */
+ public void closeViewer(boolean closeChimera)
+ {
+ getSsm().removeStructureViewerListener(this, this.getPdbFile());
+ if (closeChimera)
+ {
+ viewer.exitChimera();
+ }
+ if (this.chimeraListener != null)
+ {
+ chimeraListener.shutdown();
+ chimeraListener = null;
+ }
+ lastCommand = null;
+ viewer = null;
+
+ releaseUIResources();
+ }
+
+ public void colourByChain()
+ {
+ colourBySequence = false;
+ sendAsynchronousCommand("rainbow chain", COLOURING_CHIMERA);
+ }
+
+ /**
+ * Constructs and sends a Chimera command to colour by charge
+ * <ul>
+ * <li>Aspartic acid and Glutamic acid (negative charge) red</li>
+ * <li>Lysine and Arginine (positive charge) blue</li>
+ * <li>Cysteine - yellow</li>
+ * <li>all others - white</li>
+ * </ul>
+ */
+ public void colourByCharge()
+ {
+ colourBySequence = false;
+ String command = "color white;color red ::ASP;color red ::GLU;color blue ::LYS;color blue ::ARG;color yellow ::CYS";
+ sendAsynchronousCommand(command, COLOURING_CHIMERA);
+ }
+
+ /**
+ * Construct and send a command to align structures against a reference
+ * structure, based on one or more sequence alignments
+ *
+ * @param _alignment
+ * an array of alignments to process
+ * @param _refStructure
+ * an array of corresponding reference structures (index into pdb
+ * file array); if a negative value is passed, the first PDB file
+ * mapped to an alignment sequence is used as the reference for
+ * superposition
+ * @param _hiddenCols
+ * an array of corresponding hidden columns for each alignment
+ */
+ public void superposeStructures(AlignmentI[] _alignment,
+ int[] _refStructure, ColumnSelection[] _hiddenCols)
+ {
+ StringBuilder allComs = new StringBuilder(128);
+ String[] files = getPdbFile();
+
+ if (!waitForFileLoad(files))
+ {
+ return;
+ }
+
+ refreshPdbEntries();
+ StringBuilder selectioncom = new StringBuilder(256);
+ for (int a = 0; a < _alignment.length; a++)
+ {
+ int refStructure = _refStructure[a];
+ AlignmentI alignment = _alignment[a];
+ ColumnSelection hiddenCols = _hiddenCols[a];
+
+ if (refStructure >= files.length)
+ {
+ System.err.println("Ignoring invalid reference structure value "
+ + refStructure);
+ refStructure = -1;
+ }
+
+ /*
+ * 'matched' array will hold 'true' for visible alignment columns where
+ * all sequences have a residue with a mapping to the PDB structure
+ */
+ boolean matched[] = new boolean[alignment.getWidth()];
+ for (int m = 0; m < matched.length; m++)
+ {
+ matched[m] = (hiddenCols != null) ? hiddenCols.isVisible(m) : true;
+ }
+
+ SuperposeData[] structures = new SuperposeData[files.length];
+ for (int f = 0; f < files.length; f++)
+ {
+ structures[f] = new SuperposeData(alignment.getWidth());
+ }
+
+ /*
+ * Calculate the superposable alignment columns ('matched'), and the
+ * corresponding structure residue positions (structures.pdbResNo)
+ */
+ int candidateRefStructure = findSuperposableResidues(alignment,
+ matched, structures);
+ if (refStructure < 0)
+ {
+ /*
+ * If no reference structure was specified, pick the first one that has
+ * a mapping in the alignment
+ */
+ refStructure = candidateRefStructure;
+ }
+
+ int nmatched = 0;
+ for (boolean b : matched)
+ {
+ if (b)
+ {
+ nmatched++;
+ }
+ }
+ if (nmatched < 4)
+ {
+ // TODO: bail out here because superposition illdefined?
+ }
+
+ /*
+ * Generate select statements to select regions to superimpose structures
+ */
+ String[] selcom = new String[files.length];
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ String chainCd = "." + structures[pdbfnum].chain;
+ int lpos = -1;
+ boolean run = false;
+ StringBuilder molsel = new StringBuilder();
+ for (int r = 0; r < matched.length; r++)
+ {
+ if (matched[r])
+ {
+ int pdbResNum = structures[pdbfnum].pdbResNo[r];
+ if (lpos != pdbResNum - 1)
+ {
+ /*
+ * discontiguous - append last residue now
+ */
+ if (lpos != -1)
+ {
+ molsel.append(String.valueOf(lpos));
+ molsel.append(chainCd);
+ molsel.append(",");
+ }
+ run = false;
+ }
+ else
+ {
+ /*
+ * extending a contiguous run
+ */
+ if (!run)
+ {
+ /*
+ * start the range selection
+ */
+ molsel.append(String.valueOf(lpos));
+ molsel.append("-");
+ }
+ run = true;
+ }
+ lpos = pdbResNum;
+ }
+ }
+
+ /*
+ * and terminate final selection
+ */
+ if (lpos != -1)
+ {
+ molsel.append(String.valueOf(lpos));
+ molsel.append(chainCd);
+ }
+ if (molsel.length() > 1)
+ {
+ selcom[pdbfnum] = molsel.toString();
+ selectioncom.append("#").append(String.valueOf(pdbfnum))
+ .append(":");
+ selectioncom.append(selcom[pdbfnum]);
+ selectioncom.append(" ");
+ if (pdbfnum < files.length - 1)
+ {
+ selectioncom.append("| ");
+ }
+ }
+ else
+ {
+ selcom[pdbfnum] = null;
+ }
+ }
+
+ StringBuilder command = new StringBuilder(256);
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ if (pdbfnum == refStructure || selcom[pdbfnum] == null
+ || selcom[refStructure] == null)
+ {
+ continue;
+ }
+ if (command.length() > 0)
+ {
+ command.append(";");
+ }
+
+ /*
+ * Form Chimera match command, from the 'new' structure to the
+ * 'reference' structure e.g. (50 residues, chain B/A, alphacarbons):
+ *
+ * match #1:1-30.B,81-100.B at CA #0:21-40.A,61-90.A at CA
+ *
+ * @see
+ * https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/match.html
+ */
+ command.append("match ").append(getModelSpec(pdbfnum)).append(":");
+ command.append(selcom[pdbfnum]);
+ command.append("@").append(
+ structures[pdbfnum].isRna ? PHOSPHORUS : ALPHACARBON);
+ // JAL-1757 exclude alternate CA locations
+ command.append(NO_ALTLOCS);
+ command.append(" ").append(getModelSpec(refStructure)).append(":");
+ command.append(selcom[refStructure]);
+ command.append("@").append(
+ structures[refStructure].isRna ? PHOSPHORUS : ALPHACARBON);
+ command.append(NO_ALTLOCS);
+ }
+ if (selectioncom.length() > 0)
+ {
+ if (debug)
+ {
+ System.out.println("Select regions:\n" + selectioncom.toString());
+ System.out.println("Superimpose command(s):\n"
+ + command.toString());
+ }
+ allComs.append("~display all; chain @CA|P; ribbon ")
+ .append(selectioncom.toString())
+ .append(";" + command.toString());
+ }
+ }
+ if (selectioncom.length() > 0)
+ {
+ // TODO: visually distinguish regions that were superposed
+ if (selectioncom.substring(selectioncom.length() - 1).equals("|"))
+ {
+ selectioncom.setLength(selectioncom.length() - 1);
+ }
+ if (debug)
+ {
+ System.out.println("Select regions:\n" + selectioncom.toString());
+ }
+ allComs.append("; ~display all; chain @CA|P; ribbon ")
+ .append(selectioncom.toString()).append("; focus");
+ sendChimeraCommand(allComs.toString(), false);
+ }
+
+ }
+
+ /**
+ * Helper method to construct model spec in Chimera format:
+ * <ul>
+ * <li>#0 (#1 etc) for a PDB file with no sub-models</li>
+ * <li>#0.1 (#1.1 etc) for a PDB file with sub-models</li>
+ * <ul>
+ * Note for now we only ever choose the first of multiple models. This
+ * corresponds to the hard-coded Jmol equivalent (compare {1.1}). Refactor in
+ * future if there is a need to select specific sub-models.
+ *
+ * @param pdbfnum
+ * @return
+ */
+ protected String getModelSpec(int pdbfnum)
+ {
+ if (pdbfnum < 0 || pdbfnum >= getPdbCount())
+ {
+ return "";
+ }
+
+ /*
+ * For now, the test for having sub-models is whether multiple Chimera
+ * models are mapped for the PDB file; the models are returned as a response
+ * to the Chimera command 'list models type molecule', see
+ * ChimeraManager.getModelList().
+ */
+ List<ChimeraModel> maps = chimeraMaps.get(getPdbFile()[pdbfnum]);
+ boolean hasSubModels = maps != null && maps.size() > 1;
+ return "#" + String.valueOf(pdbfnum) + (hasSubModels ? ".1" : "");
+ }
+
+ /**
+ * Launch Chimera, unless an instance linked to this object is already
+ * running. Returns true if chimera is successfully launched, or already
+ * running, else false.
+ *
+ * @return
+ */
+ public boolean launchChimera()
+ {
+ if (!viewer.isChimeraLaunched())
+ {
+ return viewer.launchChimera(StructureManager.getChimeraPaths());
+ }
+ if (viewer.isChimeraLaunched())
+ {
+ return true;
+ }
+ log("Failed to launch Chimera!");
+ return false;
+ }
+
+ /**
+ * Answers true if the Chimera process is still running, false if ended or not
+ * started.
+ *
+ * @return
+ */
+ public boolean isChimeraRunning()
+ {
+ return viewer.isChimeraLaunched();
+ }
+
+ /**
+ * Send a command to Chimera, and optionally log any responses.
+ *
+ * @param command
+ * @param logResponse
+ */
+ public void sendChimeraCommand(final String command, boolean logResponse)
+ {
+ if (viewer == null)
+ {
+ // ? thread running after viewer shut down
+ return;
+ }
+ viewerCommandHistory(false);
+ if (lastCommand == null || !lastCommand.equals(command))
+ {
+ // trim command or it may never find a match in the replyLog!!
+ lastReply = viewer.sendChimeraCommand(command.trim(), logResponse);
+ if (logResponse && debug)
+ {
+ log("Response from command ('" + command + "') was:\n" + lastReply);
+ }
+ }
+ viewerCommandHistory(true);
+ lastCommand = command;
+ }
+
+ /**
+ * Send a Chimera command asynchronously in a new thread. If the progress
+ * message is not null, display this message while the command is executing.
+ *
+ * @param command
+ * @param progressMsg
+ */
+ protected abstract void sendAsynchronousCommand(String command,
+ String progressMsg);
+
+ /**
+ * colour any structures associated with sequences in the given alignment
+ * using the getFeatureRenderer() and getSequenceRenderer() renderers but only
+ * if colourBySequence is enabled.
+ */
+ public void colourBySequence(boolean showFeatures,
+ jalview.api.AlignmentViewPanel alignmentv)
+ {
+ if (!colourBySequence || !loadingFinished)
+ {
+ return;
+ }
+ if (getSsm() == null)
+ {
+ return;
+ }
+ String[] files = getPdbFile();
+
+ SequenceRenderer sr = getSequenceRenderer(alignmentv);
+
+ FeatureRenderer fr = null;
+ if (showFeatures)
+ {
+ fr = getFeatureRenderer(alignmentv);
+ }
+ AlignmentI alignment = alignmentv.getAlignment();
+
+ for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(
+ files, sr, fr, alignment))
+ {
+ for (String command : cpdbbyseq.commands)
+ {
+ sendAsynchronousCommand(command, COLOURING_CHIMERA);
+ }
+ }
+ }
+
+ /**
+ * @param files
+ * @param sr
+ * @param fr
+ * @param alignment
+ * @return
+ */
+ protected StructureMappingcommandSet[] getColourBySequenceCommands(
+ String[] files, SequenceRenderer sr, FeatureRenderer fr,
+ AlignmentI alignment)
+ {
+ return ChimeraCommands.getColourBySequenceCommand(getSsm(), files,
+ getSequence(), sr, fr, alignment);
+ }
+
+ /**
+ * @param command
+ */
+ protected void executeWhenReady(String command)
+ {
+ waitForChimera();
+ sendChimeraCommand(command, false);
+ waitForChimera();
+ }
+
+ private void waitForChimera()
+ {
+ while (viewer != null && viewer.isBusy())
+ {
+ try
+ {
+ Thread.sleep(15);
+ } catch (InterruptedException q)
+ {
+ }
+ }
+ }
+
+ // End StructureListener
+ // //////////////////////////
+
+ public Color getColour(int atomIndex, int pdbResNum, String chain,
+ String pdbfile)
+ {
+ if (getModelNum(pdbfile) < 0)
+ {
+ return null;
+ }
+ log("get model / residue colour attribute unimplemented");
+ return null;
+ }
+
+ /**
+ * returns the current featureRenderer that should be used to colour the
+ * structures
+ *
+ * @param alignment
+ *
+ * @return
+ */
+ public abstract FeatureRenderer getFeatureRenderer(
+ AlignmentViewPanel alignment);
+
+ /**
+ * instruct the Jalview binding to update the pdbentries vector if necessary
+ * prior to matching the viewer's contents to the list of structure files
+ * Jalview knows about.
+ */
+ public abstract void refreshPdbEntries();
+
+ private int getModelNum(String modelFileName)
+ {
+ String[] mfn = getPdbFile();
+ if (mfn == null)
+ {
+ return -1;
+ }
+ for (int i = 0; i < mfn.length; i++)
+ {
+ if (mfn[i].equalsIgnoreCase(modelFileName))
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * map between index of model filename returned from getPdbFile and the first
+ * index of models from this file in the viewer. Note - this is not trimmed -
+ * use getPdbFile to get number of unique models.
+ */
+ private int _modelFileNameMap[];
+
+ // ////////////////////////////////
+ // /StructureListener
+ @Override
+ public synchronized String[] getPdbFile()
+ {
+ if (viewer == null)
+ {
+ return new String[0];
+ }
+ // if (modelFileNames == null)
+ // {
+ // Collection<ChimeraModel> chimodels = viewer.getChimeraModels();
+ // _modelFileNameMap = new int[chimodels.size()];
+ // int j = 0;
+ // for (ChimeraModel chimodel : chimodels)
+ // {
+ // String mdlName = chimodel.getModelName();
+ // }
+ // modelFileNames = new String[j];
+ // // System.arraycopy(mset, 0, modelFileNames, 0, j);
+ // }
+
+ return chimeraMaps.keySet().toArray(
+ modelFileNames = new String[chimeraMaps.size()]);
+ }
+
+ /**
+ * map from string to applet
+ */
+ public Map getRegistryInfo()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * returns the current sequenceRenderer that should be used to colour the
+ * structures
+ *
+ * @param alignment
+ *
+ * @return
+ */
+ public abstract SequenceRenderer getSequenceRenderer(
+ AlignmentViewPanel alignment);
+
+ /**
+ * Construct and send a command to highlight zero, one or more atoms.
+ *
+ * <pre>
+ * Done by generating a command like (to 'highlight' position 44)
+ * show #0:44.C
+ * </pre>
+ */
+ @Override
+ public void highlightAtoms(List<AtomSpec> atoms)
+ {
+ if (atoms == null)
+ {
+ return;
+ }
+ StringBuilder atomSpecs = new StringBuilder();
+ boolean first = true;
+ for (AtomSpec atom : atoms)
+ {
+ int pdbResNum = atom.getPdbResNum();
+ String chain = atom.getChain();
+ String pdbfile = atom.getPdbFile();
+ List<ChimeraModel> cms = chimeraMaps.get(pdbfile);
+ if (cms != null && !cms.isEmpty())
+ {
+ /*
+ * Formatting as #0:34.A,#1:33.A doesn't work as desired, so instead we
+ * concatenate multiple 'show' commands
+ */
+ atomSpecs.append(first ? "" : ";show ");
+ first = false;
+ atomSpecs.append("#" + cms.get(0).getModelNumber());
+ atomSpecs.append(":" + pdbResNum);
+ if (!chain.equals(" "))
+ {
+ atomSpecs.append("." + chain);
+ }
+ }
+ }
+ String atomSpec = atomSpecs.toString();
+
+ /*
+ * Avoid repeated commands for the same residue
+ */
+ if (atomSpec.equals(lastMousedOverAtomSpec))
+ {
+ return;
+ }
+
+ StringBuilder command = new StringBuilder(32);
+ viewerCommandHistory(false);
+ if (atomSpec.length() > 0)
+ {
+ command.append("show ").append(atomSpec);
+ viewer.sendChimeraCommand(command.toString(), false);
+ }
+ viewerCommandHistory(true);
+ this.lastMousedOverAtomSpec = atomSpec;
+ }
+
+ /**
+ * Query Chimera for its current selection, and highlight it on the alignment
+ */
+ public void highlightChimeraSelection()
+ {
+ /*
+ * Ask Chimera for its current selection
+ */
+ List<String> selection = viewer.getSelectedResidueSpecs();
+
+ /*
+ * Parse model number, residue and chain for each selected position,
+ * formatted as #0:123.A or #1.2:87.B (#model.submodel:residue.chain)
+ */
+ List<AtomSpec> atomSpecs = new ArrayList<AtomSpec>();
+ for (String atomSpec : selection)
+ {
+ int colonPos = atomSpec.indexOf(":");
+ if (colonPos == -1)
+ {
+ continue; // malformed
+ }
+
+ int hashPos = atomSpec.indexOf("#");
+ String modelSubmodel = atomSpec.substring(hashPos + 1, colonPos);
+ int dotPos = modelSubmodel.indexOf(".");
+ int modelId = 0;
+ try
+ {
+ modelId = Integer.valueOf(dotPos == -1 ? modelSubmodel
+ : modelSubmodel.substring(0, dotPos));
+ } catch (NumberFormatException e)
+ {
+ // ignore, default to model 0
+ }
+
+ String residueChain = atomSpec.substring(colonPos + 1);
+ dotPos = residueChain.indexOf(".");
+ int pdbResNum = Integer.parseInt(dotPos == -1 ? residueChain
+ : residueChain.substring(0, dotPos));
+
+ String chainId = dotPos == -1 ? "" : residueChain
+ .substring(dotPos + 1);
+
+ /*
+ * Work out the pdbfilename from the model number
+ */
+ String pdbfilename = modelFileNames[frameNo];
+ findfileloop: for (String pdbfile : this.chimeraMaps.keySet())
+ {
+ for (ChimeraModel cm : chimeraMaps.get(pdbfile))
+ {
+ if (cm.getModelNumber() == modelId)
+ {
+ pdbfilename = pdbfile;
+ break findfileloop;
+ }
+ }
+ }
+ atomSpecs.add(new AtomSpec(pdbfilename, chainId, pdbResNum, 0));
+ }
+
+ /*
+ * Broadcast the selection (which may be empty, if the user just cleared all
+ * selections)
+ */
+ getSsm().mouseOverStructure(atomSpecs);
+ }
+
+ private void log(String message)
+ {
+ System.err.println("## Chimera log: " + message);
+ }
+
+ private void viewerCommandHistory(boolean enable)
+ {
+ // log("(Not yet implemented) History "
+ // + ((debug || enable) ? "on" : "off"));
+ }
+
+ public long getLoadNotifiesHandled()
+ {
+ return loadNotifiesHandled;
+ }
+
+ public void setJalviewColourScheme(ColourSchemeI cs)
+ {
+ colourBySequence = false;
+
+ if (cs == null)
+ {
+ return;
+ }
+
+ // Chimera expects RBG values in the range 0-1
+ final double normalise = 255D;
+ viewerCommandHistory(false);
+ StringBuilder command = new StringBuilder(128);
+
+ List<String> residueSet = ResidueProperties.getResidues(isNucleotide(),
+ false);
+ for (String res : residueSet)
+ {
+ Color col = cs.findColour(res.charAt(0));
+ command.append("color " + col.getRed() / normalise + ","
+ + col.getGreen() / normalise + "," + col.getBlue()
+ / normalise + " ::" + res + ";");
+ }
+
+ sendAsynchronousCommand(command.toString(), COLOURING_CHIMERA);
+ viewerCommandHistory(true);
+ }
+
+ /**
+ * called when the binding thinks the UI needs to be refreshed after a Chimera
+ * state change. this could be because structures were loaded, or because an
+ * error has occurred.
+ */
+ public abstract void refreshGUI();
+
+ public void setLoadingFromArchive(boolean loadingFromArchive)
+ {
+ this.loadingFromArchive = loadingFromArchive;
+ }
+
+ /**
+ *
+ * @return true if Chimeral is still restoring state or loading is still going
+ * on (see setFinsihedLoadingFromArchive)
+ */
+ public boolean isLoadingFromArchive()
+ {
+ return loadingFromArchive && !loadingFinished;
+ }
+
+ /**
+ * modify flag which controls if sequence colouring events are honoured by the
+ * binding. Should be true for normal operation
+ *
+ * @param finishedLoading
+ */
+ public void setFinishedLoadingFromArchive(boolean finishedLoading)
+ {
+ loadingFinished = finishedLoading;
+ }
+
+ /**
+ * Send the Chimera 'background solid <color>" command.
+ *
+ * @see https
+ * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/background
+ * .html
+ * @param col
+ */
+ public void setBackgroundColour(Color col)
+ {
+ viewerCommandHistory(false);
+ double normalise = 255D;
+ final String command = "background solid " + col.getRed() / normalise
+ + "," + col.getGreen() / normalise + "," + col.getBlue()
+ / normalise + ";";
+ viewer.sendChimeraCommand(command, false);
+ viewerCommandHistory(true);
+ }
+
+ /**
+ * Ask Chimera to save its session to the given file. Returns true if
+ * successful, else false.
+ *
+ * @param filepath
+ * @return
+ */
+ public boolean saveSession(String filepath)
+ {
+ if (isChimeraRunning())
+ {
+ List<String> reply = viewer.sendChimeraCommand("save " + filepath,
+ true);
+ if (reply.contains("Session written"))
+ {
+ return true;
+ }
+ else
+ {
+ Cache.log
+ .error("Error saving Chimera session: " + reply.toString());
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Ask Chimera to open a session file. Returns true if successful, else false.
+ * The filename must have a .py extension for this command to work.
+ *
+ * @param filepath
+ * @return
+ */
+ public boolean openSession(String filepath)
+ {
+ sendChimeraCommand("open " + filepath, true);
+ // todo: test for failure - how?
+ return true;
+ }
+
+ /**
+ * Returns a list of chains mapped in this viewer. Note this list is not
+ * currently scoped per structure.
+ *
+ * @return
+ */
+ public List<String> getChainNames()
+ {
+ List<String> names = new ArrayList<String>();
+ String[][] allNames = getChains();
+ if (allNames != null)
+ {
+ for (String[] chainsForPdb : allNames)
+ {
+ if (chainsForPdb != null)
+ {
+ for (String chain : chainsForPdb)
+ {
+ if (chain != null && !names.contains(chain))
+ {
+ names.add(chain);
+ }
+ }
+ }
+ }
+ }
+ return names;
+ }
+
+ /**
+ * Send a 'focus' command to Chimera to recentre the visible display
+ */
+ public void focusView()
+ {
+ sendChimeraCommand("focus", false);
+ }
+}
diff --git a/src/jalview/ext/varna/JalviewVarnaBinding.java b/src/jalview/ext/varna/JalviewVarnaBinding.java
new file mode 100644
index 0000000..3bec35a
--- /dev/null
+++ b/src/jalview/ext/varna/JalviewVarnaBinding.java
@@ -0,0 +1,35 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.varna;
+
+import jalview.api.StructureSelectionManagerProvider;
+import jalview.structure.StructureListener;
+import jalview.structures.models.SequenceStructureBindingModel;
+
+import java.awt.event.ComponentListener;
+
+public abstract class JalviewVarnaBinding extends
+ SequenceStructureBindingModel implements StructureListener,
+ ComponentListener, StructureSelectionManagerProvider
+
+{
+
+}
diff --git a/src/jalview/ext/varna/RnaModel.java b/src/jalview/ext/varna/RnaModel.java
new file mode 100644
index 0000000..2a8de6e
--- /dev/null
+++ b/src/jalview/ext/varna/RnaModel.java
@@ -0,0 +1,52 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.varna;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceI;
+
+import fr.orsay.lri.varna.models.rna.RNA;
+
+/**
+ * Data bean wrapping the data items that define one RNA view
+ */
+public class RnaModel
+{
+ public final String title;
+
+ public final AlignmentAnnotation ann;
+
+ public final SequenceI seq;
+
+ public final boolean gapped;
+
+ public final RNA rna;
+
+ public RnaModel(String t, AlignmentAnnotation aa, SequenceI s, RNA r,
+ boolean g)
+ {
+ title = t;
+ ann = aa;
+ seq = s;
+ rna = r;
+ gapped = g;
+ }
+}
diff --git a/src/jalview/ext/varna/VarnaCommands.java b/src/jalview/ext/varna/VarnaCommands.java
new file mode 100644
index 0000000..f2a2b63
--- /dev/null
+++ b/src/jalview/ext/varna/VarnaCommands.java
@@ -0,0 +1,170 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.varna;
+
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+import jalview.structure.StructureMapping;
+import jalview.structure.StructureSelectionManager;
+
+import java.awt.Color;
+import java.util.ArrayList;
+
+/**
+ * Routines for generating Jmol commands for Jalview/Jmol binding another
+ * cruisecontrol test.
+ *
+ * @author JimP
+ *
+ */
+public class VarnaCommands
+{
+
+ /**
+ * Jmol utility which constructs the commands to colour chains by the given
+ * alignment
+ *
+ */
+ public static String[] getColourBySequenceCommand(
+ StructureSelectionManager ssm, String[] files,
+ SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr,
+ AlignmentI alignment)
+ {
+ ArrayList<String> str = new ArrayList<String>();
+ StringBuffer command = new StringBuffer();
+
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
+
+ if (mapping == null || mapping.length < 1)
+ continue;
+
+ int lastPos = -1;
+ for (int s = 0; s < sequence[pdbfnum].length; s++)
+ {
+ for (int sp, m = 0; m < mapping.length; m++)
+ {
+ if (mapping[m].getSequence() == sequence[pdbfnum][s]
+ && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)
+ {
+ SequenceI asp = alignment.getSequenceAt(sp);
+ for (int r = 0; r < asp.getLength(); r++)
+ {
+ // no mapping to gaps in sequence
+ if (jalview.util.Comparison.isGap(asp.getCharAt(r)))
+ {
+ continue;
+ }
+ int pos = mapping[m].getPDBResNum(asp.findPosition(r));
+
+ if (pos < 1 || pos == lastPos)
+ continue;
+
+ lastPos = pos;
+
+ Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);
+
+ if (fr != null)
+ col = fr.findFeatureColour(col, sequence[pdbfnum][s], r);
+ String newSelcom = (mapping[m].getChain() != " " ? ":"
+ + mapping[m].getChain() : "")
+ + "/"
+ + (pdbfnum + 1)
+ + ".1"
+ + ";color["
+ + col.getRed()
+ + ","
+ + col.getGreen()
+ + ","
+ + col.getBlue() + "]";
+ if (command.length() > newSelcom.length()
+ && command.substring(
+ command.length() - newSelcom.length())
+ .equals(newSelcom))
+ {
+ command = VarnaCommands.condenseCommand(command, pos);
+ continue;
+ }
+ // TODO: deal with case when buffer is too large for Jmol to parse
+ // - execute command and flush
+
+ command.append(";");
+ if (command.length() > 51200)
+ {
+ // add another chunk
+ str.add(command.toString());
+ command.setLength(0);
+ }
+ command.append("select " + pos);
+ command.append(newSelcom);
+ }
+ break;
+ }
+ }
+ }
+ }
+ {
+ // add final chunk
+ str.add(command.toString());
+ command.setLength(0);
+ }
+ return str.toArray(new String[str.size()]);
+ }
+
+ public static StringBuffer condenseCommand(StringBuffer command, int pos)
+ {
+
+ // work back to last 'select'
+ int p = command.length(), q = p;
+ do
+ {
+ p -= 6;
+ if (p < 1)
+ {
+ p = 0;
+ }
+ ;
+ } while ((q = command.indexOf("select", p)) == -1 && p > 0);
+
+ StringBuffer sb = new StringBuffer(command.substring(0, q + 7));
+
+ command = command.delete(0, q + 7);
+
+ String start;
+
+ if (command.indexOf("-") > -1)
+ {
+ start = command.substring(0, command.indexOf("-"));
+ }
+ else
+ {
+ start = command.substring(0, command.indexOf(":"));
+ }
+
+ sb.append(start + "-" + pos + command.substring(command.indexOf(":")));
+
+ return sb;
+ }
+
+}
diff --git a/src/jalview/gui/AlignExportSettings.java b/src/jalview/gui/AlignExportSettings.java
new file mode 100644
index 0000000..04849d8
--- /dev/null
+++ b/src/jalview/gui/AlignExportSettings.java
@@ -0,0 +1,118 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.api.AlignExportSettingI;
+import jalview.bin.Jalview;
+import jalview.jbgui.GAlignExportSettings;
+import jalview.util.MessageManager;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+
+ at SuppressWarnings("serial")
+public class AlignExportSettings extends GAlignExportSettings implements
+ AlignExportSettingI
+{
+ boolean cancelled = false;
+
+ JDialog dialog;
+
+ public AlignExportSettings(boolean hasHiddenSeq, boolean hasHiddenCols,
+ String alignFileFormat)
+ {
+ super(hasHiddenSeq, hasHiddenCols, alignFileFormat);
+ if (!Jalview.isHeadlessMode() && isShowDialog())
+ {
+
+ JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION,
+ JOptionPane.DEFAULT_OPTION, null, new Object[] { this });
+ dialog = pane.createDialog(Desktop.desktop,
+ MessageManager.getString("label.export_settings"));
+ dialog.addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ cancelled = true;
+ }
+ });
+ dialog.pack();
+ dialog.setVisible(true);
+ dialog.setContentPane(this);
+ dialog.validate();
+
+ }
+ }
+
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ cancelled = false;
+ dialog.setVisible(false);
+ dialog.dispose();
+ }
+
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ cancelled = true;
+ dialog.setVisible(false);
+ dialog.dispose();
+ }
+
+ @Override
+ public boolean isExportHiddenSequences()
+ {
+ return chkHiddenSeqs.isSelected();
+ }
+
+ @Override
+ public boolean isExportHiddenColumns()
+ {
+ return chkHiddenCols.isSelected();
+ }
+
+ @Override
+ public boolean isExportAnnotations()
+ {
+ return chkExportAnnots.isSelected();
+ }
+
+ @Override
+ public boolean isExportFeatures()
+ {
+ return chkExportFeats.isSelected();
+ }
+
+ @Override
+ public boolean isExportGroups()
+ {
+ return chkExportGrps.isSelected();
+ }
+
+ public boolean isCancelled()
+ {
+ return cancelled;
+ }
+
+}
diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java
index 2ecd947..b484118 100644
--- a/src/jalview/gui/AlignFrame.java
+++ b/src/jalview/gui/AlignFrame.java
@@ -1,32 +1,45 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import jalview.analysis.AAFrequency;
import jalview.analysis.AlignmentSorter;
-import jalview.analysis.Conservation;
+import jalview.analysis.AlignmentUtils;
import jalview.analysis.CrossRef;
-import jalview.analysis.NJTree;
+import jalview.analysis.Dna;
import jalview.analysis.ParseProperties;
import jalview.analysis.SequenceIdMatcher;
+import jalview.api.AlignExportSettingI;
+import jalview.api.AlignViewControllerGuiI;
+import jalview.api.AlignViewControllerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureSettingsControllerI;
+import jalview.api.SplitContainerI;
+import jalview.api.ViewStyleI;
+import jalview.api.analysis.ScoreModelI;
import jalview.bin.Cache;
+import jalview.bin.Jalview;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
import jalview.commands.OrderCommand;
import jalview.commands.RemoveGapColCommand;
import jalview.commands.RemoveGapsCommand;
@@ -35,26 +48,30 @@ import jalview.commands.TrimRegionCommand;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentExportData;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentOrder;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.HiddenSequences;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SeqCigar;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.gui.ViewSelectionMenu.ViewSetProvider;
import jalview.io.AlignmentProperties;
import jalview.io.AnnotationFile;
-import jalview.io.FeaturesFile;
+import jalview.io.BioJsHTMLOutput;
import jalview.io.FileLoader;
import jalview.io.FormatAdapter;
-import jalview.io.HTMLOutput;
+import jalview.io.HtmlSvgOutput;
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
import jalview.io.JnetAnnotationMaker;
import jalview.io.NewickFile;
+import jalview.io.TCoffeeScoreFile;
import jalview.jbgui.GAlignFrame;
import jalview.schemes.Blosum62ColourScheme;
import jalview.schemes.BuriedColourScheme;
@@ -65,20 +82,25 @@ import jalview.schemes.HelixColourScheme;
import jalview.schemes.HydrophobicColourScheme;
import jalview.schemes.NucleotideColourScheme;
import jalview.schemes.PIDColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.RNAHelicesColourChooser;
import jalview.schemes.ResidueProperties;
import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TCoffeeColourScheme;
import jalview.schemes.TaylorColourScheme;
import jalview.schemes.TurnColourScheme;
import jalview.schemes.UserColourScheme;
import jalview.schemes.ZappoColourScheme;
-import jalview.ws.WSMenuEntryProviderI;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.seqfetcher.DbSourceProxy;
import java.awt.BorderLayout;
-import java.awt.Color;
import java.awt.Component;
-import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
@@ -92,6 +114,8 @@ import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -102,20 +126,21 @@ import java.beans.PropertyChangeEvent;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Deque;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
import java.util.Vector;
-import javax.swing.JButton;
+import javax.swing.JCheckBoxMenuItem;
import javax.swing.JEditorPane;
import javax.swing.JInternalFrame;
-import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JProgressBar;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
@@ -127,20 +152,23 @@ import javax.swing.SwingUtilities;
* @version $Revision$
*/
public class AlignFrame extends GAlignFrame implements DropTargetListener,
- IProgressIndicator
+ IProgressIndicator, AlignViewControllerGuiI
{
- /** DOCUMENT ME!! */
public static final int DEFAULT_WIDTH = 700;
- /** DOCUMENT ME!! */
public static final int DEFAULT_HEIGHT = 500;
+ /*
+ * The currently displayed panel (selected tabbed view if more than one)
+ */
public AlignmentPanel alignPanel;
AlignViewport viewport;
- Vector alignPanels = new Vector();
+ public AlignViewControllerI avc;
+
+ List<AlignmentPanel> alignPanels = new ArrayList<AlignmentPanel>();
/**
* Last format used to load or save alignments in this window
@@ -247,21 +275,43 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
int width, int height, String sequenceSetId, String viewId)
{
setSize(width, height);
+
+ if (al.getDataset() == null)
+ {
+ al.setDataset(null);
+ }
+
viewport = new AlignViewport(al, hiddenColumns, sequenceSetId, viewId);
alignPanel = new AlignmentPanel(this, viewport);
+ addAlignmentPanel(alignPanel, true);
+ init();
+ }
+
+ public AlignFrame(AlignmentI al, SequenceI[] hiddenSeqs,
+ ColumnSelection hiddenColumns, int width, int height)
+ {
+ setSize(width, height);
+
if (al.getDataset() == null)
{
al.setDataset(null);
}
+ viewport = new AlignViewport(al, hiddenColumns);
+
+ if (hiddenSeqs != null && hiddenSeqs.length > 0)
+ {
+ viewport.hideSequence(hiddenSeqs);
+ }
+ alignPanel = new AlignmentPanel(this, viewport);
addAlignmentPanel(alignPanel, true);
init();
}
/**
- * Make a new AlignFrame from exisiting alignmentPanels
+ * Make a new AlignFrame from existing alignmentPanels
*
* @param ap
* AlignmentPanel
@@ -282,7 +332,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
*/
void init()
{
- if (viewport.conservation == null)
+ if (!Jalview.isHeadlessMode())
+ {
+ progressBar = new ProgressBar(this.statusPanel, this.statusBar);
+ }
+
+ avc = new jalview.controller.AlignViewController(this, viewport,
+ alignPanel);
+ if (viewport.getAlignmentConservationAnnotation() == null)
{
BLOSUM62Colour.setEnabled(false);
conservationMenuItem.setEnabled(false);
@@ -308,12 +365,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
addServiceListeners();
- setGUINucleotide(viewport.alignment.isNucleotide());
+ setGUINucleotide(viewport.getAlignment().isNucleotide());
}
setMenusFromViewport(viewport);
buildSortByAnnotationScoresMenu();
- if (viewport.wrapAlignment)
+ buildTreeMenu();
+
+ if (viewport.getWrapAlignment())
{
wrapMenuItem_actionPerformed(null);
}
@@ -325,6 +384,82 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
addKeyListener();
+ final List<AlignmentPanel> selviews = new ArrayList<AlignmentPanel>();
+ final List<AlignmentPanel> origview = new ArrayList<AlignmentPanel>();
+ final String menuLabel = MessageManager
+ .getString("label.copy_format_from");
+ ViewSelectionMenu vsel = new ViewSelectionMenu(menuLabel,
+ new ViewSetProvider()
+ {
+
+ @Override
+ public AlignmentPanel[] getAllAlignmentPanels()
+ {
+ origview.clear();
+ origview.add(alignPanel);
+ // make an array of all alignment panels except for this one
+ List<AlignmentPanel> aps = new ArrayList<AlignmentPanel>(
+ Arrays.asList(Desktop.getAlignmentPanels(null)));
+ aps.remove(AlignFrame.this.alignPanel);
+ return aps.toArray(new AlignmentPanel[aps.size()]);
+ }
+ }, selviews, new ItemListener()
+ {
+
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ if (origview.size() > 0)
+ {
+ final AlignmentPanel ap = origview.get(0);
+
+ /*
+ * Copy the ViewStyle of the selected panel to 'this one'.
+ * Don't change value of 'scaleProteinAsCdna' unless copying
+ * from a SplitFrame.
+ */
+ ViewStyleI vs = selviews.get(0).getAlignViewport()
+ .getViewStyle();
+ boolean fromSplitFrame = selviews.get(0)
+ .getAlignViewport().getCodingComplement() != null;
+ if (!fromSplitFrame)
+ {
+ vs.setScaleProteinAsCdna(ap.getAlignViewport()
+ .getViewStyle().isScaleProteinAsCdna());
+ }
+ ap.getAlignViewport().setViewStyle(vs);
+
+ /*
+ * Also rescale ViewStyle of SplitFrame complement if there is
+ * one _and_ it is set to 'scaledProteinAsCdna'; we don't copy
+ * the whole ViewStyle (allow cDNA protein to have different
+ * fonts)
+ */
+ AlignViewportI complement = ap.getAlignViewport()
+ .getCodingComplement();
+ if (complement != null && vs.isScaleProteinAsCdna())
+ {
+ AlignFrame af = Desktop.getAlignFrameFor(complement);
+ ((SplitFrame) af.getSplitViewContainer())
+ .adjustLayout();
+ af.setMenusForViewport();
+ }
+
+ ap.updateLayout();
+ ap.setSelected(true);
+ ap.alignFrame.setMenusForViewport();
+
+ }
+ }
+ });
+ if (Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase()
+ .indexOf("devel") > -1
+ || Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase()
+ .indexOf("test") > -1)
+ {
+ formatMenu.add(vsel);
+ }
+
}
/**
@@ -339,14 +474,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
public void setFileName(String file, String format)
{
fileName = file;
- currentFileFormat = format;
+ setFileFormat(format);
reload.setEnabled(true);
}
+ /**
+ * Add a KeyListener with handlers for various KeyPressed and KeyReleased
+ * events
+ */
void addKeyListener()
{
addKeyListener(new KeyAdapter()
{
+ @Override
public void keyPressed(KeyEvent evt)
{
if (viewport.cursorMode
@@ -354,7 +494,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
.getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt
.getKeyCode() <= KeyEvent.VK_NUMPAD9))
&& Character.isDigit(evt.getKeyChar()))
- alignPanel.seqPanel.numberPressed(evt.getKeyChar());
+ {
+ alignPanel.getSeqPanel().numberPressed(evt.getKeyChar());
+ }
switch (evt.getKeyCode())
{
@@ -366,42 +508,70 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
case KeyEvent.VK_DOWN:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
moveSelectedSequences(false);
+ }
if (viewport.cursorMode)
- alignPanel.seqPanel.moveCursor(0, 1);
+ {
+ alignPanel.getSeqPanel().moveCursor(0, 1);
+ }
break;
case KeyEvent.VK_UP:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
moveSelectedSequences(true);
+ }
if (viewport.cursorMode)
- alignPanel.seqPanel.moveCursor(0, -1);
+ {
+ alignPanel.getSeqPanel().moveCursor(0, -1);
+ }
break;
case KeyEvent.VK_LEFT:
if (evt.isAltDown() || !viewport.cursorMode)
- slideSequences(false, alignPanel.seqPanel.getKeyboardNo1());
+ {
+ slideSequences(false, alignPanel.getSeqPanel().getKeyboardNo1());
+ }
else
- alignPanel.seqPanel.moveCursor(-1, 0);
+ {
+ alignPanel.getSeqPanel().moveCursor(-1, 0);
+ }
break;
case KeyEvent.VK_RIGHT:
if (evt.isAltDown() || !viewport.cursorMode)
- slideSequences(true, alignPanel.seqPanel.getKeyboardNo1());
+ {
+ slideSequences(true, alignPanel.getSeqPanel().getKeyboardNo1());
+ }
else
- alignPanel.seqPanel.moveCursor(1, 0);
+ {
+ alignPanel.getSeqPanel().moveCursor(1, 0);
+ }
break;
case KeyEvent.VK_SPACE:
if (viewport.cursorMode)
{
- alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown()
- || evt.isShiftDown() || evt.isAltDown());
+ alignPanel.getSeqPanel().insertGapAtCursor(
+ evt.isControlDown() || evt.isShiftDown()
+ || evt.isAltDown());
}
break;
+ // case KeyEvent.VK_A:
+ // if (viewport.cursorMode)
+ // {
+ // alignPanel.seqPanel.insertNucAtCursor(false,"A");
+ // //System.out.println("A");
+ // }
+ // break;
+ /*
+ * case KeyEvent.VK_CLOSE_BRACKET: if (viewport.cursorMode) {
+ * System.out.println("closing bracket"); } break;
+ */
case KeyEvent.VK_DELETE:
case KeyEvent.VK_BACK_SPACE:
if (!viewport.cursorMode)
@@ -410,8 +580,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
else
{
- alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown()
- || evt.isShiftDown() || evt.isAltDown());
+ alignPanel.getSeqPanel().deleteGapAtCursor(
+ evt.isControlDown() || evt.isShiftDown()
+ || evt.isAltDown());
}
break;
@@ -419,19 +590,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
case KeyEvent.VK_S:
if (viewport.cursorMode)
{
- alignPanel.seqPanel.setCursorRow();
+ alignPanel.getSeqPanel().setCursorRow();
}
break;
case KeyEvent.VK_C:
if (viewport.cursorMode && !evt.isControlDown())
{
- alignPanel.seqPanel.setCursorColumn();
+ alignPanel.getSeqPanel().setCursorColumn();
}
break;
case KeyEvent.VK_P:
if (viewport.cursorMode)
{
- alignPanel.seqPanel.setCursorPosition();
+ alignPanel.getSeqPanel().setCursorPosition();
}
break;
@@ -439,46 +610,40 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
case KeyEvent.VK_COMMA:
if (viewport.cursorMode)
{
- alignPanel.seqPanel.setCursorRowAndColumn();
+ alignPanel.getSeqPanel().setCursorRowAndColumn();
}
break;
case KeyEvent.VK_Q:
if (viewport.cursorMode)
{
- alignPanel.seqPanel.setSelectionAreaAtCursor(true);
+ alignPanel.getSeqPanel().setSelectionAreaAtCursor(true);
}
break;
case KeyEvent.VK_M:
if (viewport.cursorMode)
{
- alignPanel.seqPanel.setSelectionAreaAtCursor(false);
+ alignPanel.getSeqPanel().setSelectionAreaAtCursor(false);
}
break;
case KeyEvent.VK_F2:
viewport.cursorMode = !viewport.cursorMode;
- statusBar.setText("Keyboard editing mode is "
- + (viewport.cursorMode ? "on" : "off"));
+ statusBar.setText(MessageManager.formatMessage(
+ "label.keyboard_editing_mode",
+ new String[] { (viewport.cursorMode ? "on" : "off") }));
if (viewport.cursorMode)
{
- alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes;
- alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq;
+ alignPanel.getSeqPanel().seqCanvas.cursorX = viewport.startRes;
+ alignPanel.getSeqPanel().seqCanvas.cursorY = viewport.startSeq;
}
- alignPanel.seqPanel.seqCanvas.repaint();
+ alignPanel.getSeqPanel().seqCanvas.repaint();
break;
case KeyEvent.VK_F1:
try
{
- ClassLoader cl = jalview.gui.Desktop.class.getClassLoader();
- java.net.URL url = javax.help.HelpSet.findHelpSet(cl,
- "help/help");
- javax.help.HelpSet hs = new javax.help.HelpSet(cl, url);
-
- javax.help.HelpBroker hb = hs.createHelpBroker();
- hb.setCurrentID("home");
- hb.setDisplayed(true);
+ Help.showHelpWindow();
} catch (Exception ex)
{
ex.printStackTrace();
@@ -492,7 +657,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
break;
}
case KeyEvent.VK_PAGE_UP:
- if (viewport.wrapAlignment)
+ if (viewport.getWrapAlignment())
{
alignPanel.scrollUp(true);
}
@@ -503,7 +668,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
break;
case KeyEvent.VK_PAGE_DOWN:
- if (viewport.wrapAlignment)
+ if (viewport.getWrapAlignment())
{
alignPanel.scrollUp(false);
}
@@ -516,20 +681,25 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
}
+ @Override
public void keyReleased(KeyEvent evt)
{
switch (evt.getKeyCode())
{
case KeyEvent.VK_LEFT:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
viewport.firePropertyChange("alignment", null, viewport
.getAlignment().getSequences());
+ }
break;
case KeyEvent.VK_RIGHT:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
viewport.firePropertyChange("alignment", null, viewport
.getAlignment().getSequences());
+ }
break;
}
}
@@ -539,8 +709,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
public void addAlignmentPanel(final AlignmentPanel ap, boolean newPanel)
{
ap.alignFrame = this;
+ avc = new jalview.controller.AlignViewController(this, viewport,
+ alignPanel);
- alignPanels.addElement(ap);
+ alignPanels.add(ap);
PaintRefresher.Register(ap, ap.av.getSequenceSetId());
@@ -568,12 +740,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (newPanel)
{
- if (ap.av.padGaps)
+ if (ap.av.isPadGaps())
{
- ap.av.alignment.padGaps();
+ ap.av.getAlignment().padGaps();
}
ap.av.updateConservation(ap);
ap.av.updateConsensus(ap);
+ ap.av.updateStrucConsensus(ap);
}
}
@@ -582,7 +755,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
expandViews.setEnabled(true);
gatherViews.setEnabled(true);
tabbedPane.setVisible(true);
- AlignmentPanel first = (AlignmentPanel) alignPanels.firstElement();
+ AlignmentPanel first = alignPanels.get(0);
tabbedPane.addTab(first.av.viewName, first);
this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
}
@@ -599,6 +772,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
Desktop.instance.addJalviewPropertyChangeListener("services",
thisListener = new java.beans.PropertyChangeListener()
{
+ @Override
public void propertyChange(PropertyChangeEvent evt)
{
// // System.out.println("Discoverer property change.");
@@ -607,6 +781,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
System.err
@@ -620,10 +795,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
});
addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
{
+ @Override
public void internalFrameClosed(
javax.swing.event.InternalFrameEvent evt)
{
- System.out.println("deregistering discoverer listener");
+ // System.out.println("deregistering discoverer listener");
Desktop.instance.removeJalviewPropertyChangeListener("services",
thisListener);
closeMenuItem_actionPerformed(true);
@@ -632,6 +808,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// Finally, build the menu once to get current service state
new Thread(new Runnable()
{
+ @Override
public void run()
{
BuildWebServiceMenu();
@@ -639,21 +816,29 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}).start();
}
+ /**
+ * Configure menu items that vary according to whether the alignment is
+ * nucleotide or protein
+ *
+ * @param nucleotide
+ */
public void setGUINucleotide(boolean nucleotide)
{
showTranslation.setVisible(nucleotide);
conservationMenuItem.setEnabled(!nucleotide);
modifyConservation.setEnabled(!nucleotide);
showGroupConservation.setEnabled(!nucleotide);
- // Remember AlignFrame always starts as protein
- if (!nucleotide)
- {
- calculateMenu.remove(calculateMenu.getItemCount() - 2);
- }
+ rnahelicesColour.setEnabled(nucleotide);
+ purinePyrimidineColour.setEnabled(nucleotide);
+ showComplementMenuItem.setText(MessageManager
+ .getString(nucleotide ? "label.protein" : "label.nucleotide"));
+ setColourSelected(jalview.bin.Cache.getDefault(
+ nucleotide ? Preferences.DEFAULT_COLOUR_NUC
+ : Preferences.DEFAULT_COLOUR_PROT, "None"));
}
/**
- * set up menus for the currently viewport. This may be called after any
+ * set up menus for the current viewport. This may be called after any
* operation that affects the data in the current view (selection changed,
* etc) to update the menus to reflect the new state.
*/
@@ -671,138 +856,87 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
*/
void setMenusFromViewport(AlignViewport av)
{
- padGapsMenuitem.setSelected(av.padGaps);
- colourTextMenuItem.setSelected(av.showColourText);
+ padGapsMenuitem.setSelected(av.isPadGaps());
+ colourTextMenuItem.setSelected(av.isShowColourText());
abovePIDThreshold.setSelected(av.getAbovePIDThreshold());
conservationMenuItem.setSelected(av.getConservationSelected());
seqLimits.setSelected(av.getShowJVSuffix());
- idRightAlign.setSelected(av.rightAlignIds);
- centreColumnLabelsMenuItem.setState(av.centreColumnLabels);
- renderGapsMenuItem.setSelected(av.renderGaps);
- wrapMenuItem.setSelected(av.wrapAlignment);
- scaleAbove.setVisible(av.wrapAlignment);
- scaleLeft.setVisible(av.wrapAlignment);
- scaleRight.setVisible(av.wrapAlignment);
- annotationPanelMenuItem.setState(av.showAnnotation);
- viewBoxesMenuItem.setSelected(av.showBoxes);
- viewTextMenuItem.setSelected(av.showText);
- showNonconservedMenuItem.setSelected(av.showUnconserved);
- showGroupConsensus.setSelected(av.showGroupConsensus);
- showGroupConservation.setSelected(av.showGroupConservation);
- showConsensusHistogram.setSelected(av.showConsensusHistogram);
- showSequenceLogo.setSelected(av.showSequenceLogo);
+ idRightAlign.setSelected(av.isRightAlignIds());
+ centreColumnLabelsMenuItem.setState(av.isCentreColumnLabels());
+ renderGapsMenuItem.setSelected(av.isRenderGaps());
+ wrapMenuItem.setSelected(av.getWrapAlignment());
+ scaleAbove.setVisible(av.getWrapAlignment());
+ scaleLeft.setVisible(av.getWrapAlignment());
+ scaleRight.setVisible(av.getWrapAlignment());
+ annotationPanelMenuItem.setState(av.isShowAnnotation());
+ /*
+ * Show/hide annotations only enabled if annotation panel is shown
+ */
+ showAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState());
+ hideAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState());
+ showAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState());
+ hideAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState());
+ viewBoxesMenuItem.setSelected(av.getShowBoxes());
+ viewTextMenuItem.setSelected(av.getShowText());
+ showNonconservedMenuItem.setSelected(av.getShowUnconserved());
+ showGroupConsensus.setSelected(av.isShowGroupConsensus());
+ showGroupConservation.setSelected(av.isShowGroupConservation());
+ showConsensusHistogram.setSelected(av.isShowConsensusHistogram());
+ showSequenceLogo.setSelected(av.isShowSequenceLogo());
+ normaliseSequenceLogo.setSelected(av.isNormaliseSequenceLogo());
+
setColourSelected(ColourSchemeProperty.getColourName(av
.getGlobalColourScheme()));
- showSeqFeatures.setSelected(av.showSequenceFeatures);
- hiddenMarkers.setState(av.showHiddenMarkers);
- applyToAllGroups.setState(av.colourAppliesToAllGroups);
- showNpFeatsMenuitem.setSelected(av.isShowNpFeats());
- showDbRefsMenuitem.setSelected(av.isShowDbRefs());
+ showSeqFeatures.setSelected(av.isShowSequenceFeatures());
+ hiddenMarkers.setState(av.getShowHiddenMarkers());
+ applyToAllGroups.setState(av.getColourAppliesToAllGroups());
+ showNpFeatsMenuitem.setSelected(av.isShowNPFeats());
+ showDbRefsMenuitem.setSelected(av.isShowDBRefs());
autoCalculate.setSelected(av.autoCalculateConsensus);
sortByTree.setSelected(av.sortByTree);
listenToViewSelections.setSelected(av.followSelection);
-
+ rnahelicesColour.setEnabled(av.getAlignment().hasRNAStructure());
+ rnahelicesColour
+ .setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
setShowProductsEnabled();
-
updateEditMenuBar();
}
- Hashtable progressBars, progressBarHandlers;
+ private IProgressIndicator progressBar;
/*
* (non-Javadoc)
*
* @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
*/
+ @Override
public void setProgressBar(String message, long id)
{
- if (progressBars == null)
- {
- progressBars = new Hashtable();
- progressBarHandlers = new Hashtable();
- }
-
- JPanel progressPanel;
- Long lId = new Long(id);
- GridLayout layout = (GridLayout) statusPanel.getLayout();
- if (progressBars.get(lId) != null)
- {
- progressPanel = (JPanel) progressBars.get(new Long(id));
- statusPanel.remove(progressPanel);
- progressBars.remove(lId);
- progressPanel = null;
- if (message != null)
- {
- statusBar.setText(message);
- }
- if (progressBarHandlers.contains(lId))
- {
- progressBarHandlers.remove(lId);
- }
- layout.setRows(layout.getRows() - 1);
- }
- else
- {
- progressPanel = new JPanel(new BorderLayout(10, 5));
-
- JProgressBar progressBar = new JProgressBar();
- progressBar.setIndeterminate(true);
-
- progressPanel.add(new JLabel(message), BorderLayout.WEST);
- progressPanel.add(progressBar, BorderLayout.CENTER);
-
- layout.setRows(layout.getRows() + 1);
- statusPanel.add(progressPanel);
-
- progressBars.put(lId, progressPanel);
- }
- // update GUI
- // setMenusForViewport();
- validate();
+ progressBar.setProgressBar(message, id);
}
+ @Override
public void registerHandler(final long id,
final IProgressIndicatorHandler handler)
{
- if (progressBarHandlers == null || !progressBars.contains(new Long(id)))
- {
- throw new Error(
- "call setProgressBar before registering the progress bar's handler.");
- }
- progressBarHandlers.put(new Long(id), handler);
- final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
- if (handler.canCancel())
- {
- JButton cancel = new JButton("Cancel");
- final IProgressIndicator us = this;
- cancel.addActionListener(new ActionListener()
- {
-
- public void actionPerformed(ActionEvent e)
- {
- handler.cancelActivity(id);
- us.setProgressBar(
- "Cancelled "
- + ((JLabel) progressPanel.getComponent(0))
- .getText(), id);
- }
- });
- progressPanel.add(cancel, BorderLayout.EAST);
- }
+ progressBar.registerHandler(id, handler);
}
/**
*
* @return true if any progress bars are still active
*/
+ @Override
public boolean operationInProgress()
{
- if (progressBars != null && progressBars.size() > 0)
- {
- return true;
- }
- return false;
+ return progressBar.operationInProgress();
+ }
+
+ @Override
+ public void setStatus(String text)
+ {
+ statusBar.setText(text);
}
/*
@@ -815,23 +949,28 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
public FeatureRenderer getFeatureRenderer()
{
- return alignPanel.seqPanel.seqCanvas.getFeatureRenderer();
+ return alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer();
}
+ @Override
public void fetchSequence_actionPerformed(ActionEvent e)
{
new SequenceFetcher(this);
}
+ @Override
public void addFromFile_actionPerformed(ActionEvent e)
{
Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport);
}
+ @Override
public void reload_actionPerformed(ActionEvent e)
{
if (fileName != null)
{
+ // TODO: JAL-1108 - ensure all associated frames are closed regardless of
+ // originating file's format
// TODO: work out how to recover feature settings for correct view(s) when
// file is reloaded.
if (currentFileFormat.equals("Jalview"))
@@ -840,6 +979,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
for (int i = 0; i < frames.length; i++)
{
if (frames[i] instanceof AlignFrame && frames[i] != this
+ && ((AlignFrame) frames[i]).fileName != null
&& ((AlignFrame) frames[i]).fileName.equals(fileName))
{
try
@@ -877,6 +1017,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
final FeatureSettings nfs = newframe.featureSettings;
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
nfs.frame.setBounds(fspos);
@@ -890,16 +1031,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
}
+ @Override
public void addFromText_actionPerformed(ActionEvent e)
{
- Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport);
+ Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport
+ .getAlignPanel());
}
+ @Override
public void addFromURL_actionPerformed(ActionEvent e)
{
Desktop.instance.inputURLMenuItem_actionPerformed(viewport);
}
+ @Override
public void save_actionPerformed(ActionEvent e)
{
if (fileName == null
@@ -921,6 +1066,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void saveAs_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(
@@ -930,21 +1076,31 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
currentFileFormat, false);
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save Alignment to file");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.save_alignment_to_file"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
if (value == JalviewFileChooser.APPROVE_OPTION)
{
currentFileFormat = chooser.getSelectedFormat();
- if (currentFileFormat == null)
+ while (currentFileFormat == null)
{
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "You must select a file format before saving!",
- "File format not specified", JOptionPane.WARNING_MESSAGE);
+ JOptionPane
+ .showInternalMessageDialog(
+ Desktop.desktop,
+ MessageManager
+ .getString("label.select_file_format_before_saving"),
+ MessageManager
+ .getString("label.file_format_not_specified"),
+ JOptionPane.WARNING_MESSAGE);
+ currentFileFormat = chooser.getSelectedFormat();
value = chooser.showSaveDialog(this);
- return;
+ if (value != JalviewFileChooser.APPROVE_OPTION)
+ {
+ return;
+ }
}
fileName = chooser.getSelectedFile().getPath();
@@ -976,10 +1132,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
.lastIndexOf(java.io.File.separatorChar) + 1);
}
- success = new Jalview2XML().SaveAlignment(this, file, shortName);
+ success = new Jalview2XML().saveAlignment(this, file, shortName);
- statusBar.setText("Successfully saved to file: " + fileName + " in "
- + format + " format.");
+ statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_saved_to_file_in_format", new Object[] {
+ fileName, format }));
}
else
@@ -988,34 +1145,28 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
warningMessage("Cannot save file " + fileName + " using format "
+ format, "Alignment output format not supported");
- saveAs_actionPerformed(null);
- // JBPNote need to have a raise_gui flag here
+ if (!Jalview.isHeadlessMode())
+ {
+ saveAs_actionPerformed(null);
+ }
return false;
}
- String[] omitHidden = null;
-
- if (viewport.hasHiddenColumns)
+ AlignmentExportData exportData = getAlignmentForExport(format,
+ viewport, null);
+ if (exportData.getSettings().isCancelled())
{
- int reply = JOptionPane
- .showInternalConfirmDialog(
- Desktop.desktop,
- "The Alignment contains hidden columns."
- + "\nDo you want to save only the visible alignment?",
- "Save / Omit Hidden Columns",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
-
- if (reply == JOptionPane.YES_OPTION)
- {
- omitHidden = viewport.getViewAsString(false);
- }
+ return false;
}
- FormatAdapter f = new FormatAdapter();
- String output = f.formatSequences(format,
- (Alignment) viewport.alignment, // class cast exceptions will
+ FormatAdapter f = new FormatAdapter(alignPanel,
+ exportData.getSettings());
+ String output = f.formatSequences(
+ format,
+ exportData.getAlignment(), // class cast exceptions will
// occur in the distant future
- omitHidden, f.getCacheSuffixDefault(format), viewport.colSel);
+ exportData.getOmitHidden(), exportData.getStartEndPostions(),
+ f.getCacheSuffixDefault(format),
+ viewport.getColumnSelection());
if (output == null)
{
@@ -1031,8 +1182,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
out.print(output);
out.close();
this.setTitle(file);
- statusBar.setText("Successfully saved to file: " + fileName
- + " in " + format + " format.");
+ statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_saved_to_file_in_format",
+ new Object[] { fileName, format }));
} catch (Exception ex)
{
success = false;
@@ -1043,8 +1195,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (!success)
{
- JOptionPane.showInternalMessageDialog(this, "Couldn't save file: "
- + fileName, "Error Saving File", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showInternalMessageDialog(this, MessageManager
+ .formatMessage("label.couldnt_save_file",
+ new Object[] { fileName }), MessageManager
+ .getString("label.error_saving_file"),
+ JOptionPane.WARNING_MESSAGE);
}
return success;
@@ -1071,36 +1226,29 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void outputText_actionPerformed(ActionEvent e)
{
- String[] omitHidden = null;
- if (viewport.hasHiddenColumns)
+ AlignmentExportData exportData = getAlignmentForExport(
+ e.getActionCommand(), viewport, null);
+ if (exportData.getSettings().isCancelled())
{
- int reply = JOptionPane
- .showInternalConfirmDialog(
- Desktop.desktop,
- "The Alignment contains hidden columns."
- + "\nDo you want to output only the visible alignment?",
- "Save / Omit Hidden Columns",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
-
- if (reply == JOptionPane.YES_OPTION)
- {
- omitHidden = viewport.getViewAsString(false);
- }
+ return;
}
-
CutAndPasteTransfer cap = new CutAndPasteTransfer();
cap.setForInput(null);
-
try
{
- cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(),
- viewport.alignment, omitHidden, viewport.colSel));
- Desktop.addInternalFrame(cap,
- "Alignment output - " + e.getActionCommand(), 600, 500);
+ cap.setText(new FormatAdapter(alignPanel, exportData.getSettings())
+ .formatSequences(e.getActionCommand(),
+ exportData.getAlignment(),
+ exportData.getOmitHidden(),
+ exportData.getStartEndPostions(),
+ viewport.getColumnSelection()));
+ Desktop.addInternalFrame(cap, MessageManager.formatMessage(
+ "label.alignment_output_command",
+ new Object[] { e.getActionCommand() }), 600, 500);
} catch (OutOfMemoryError oom)
{
new OOMWarning("Outputting alignment as " + e.getActionCommand(), oom);
@@ -1109,17 +1257,119 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
+ public static AlignmentExportData getAlignmentForExport(
+ String exportFormat, AlignViewportI viewport,
+ AlignExportSettingI exportSettings)
+ {
+ AlignmentI alignmentToExport = null;
+ AlignExportSettingI settings = exportSettings;
+ String[] omitHidden = null;
+ int[] alignmentStartEnd = new int[2];
+
+ HiddenSequences hiddenSeqs = viewport.getAlignment()
+ .getHiddenSequences();
+
+ alignmentToExport = viewport.getAlignment();
+ alignmentStartEnd = new int[] { 0, alignmentToExport.getWidth() - 1 };
+
+ boolean hasHiddenSeqs = hiddenSeqs.getSize() > 0;
+ if (settings == null)
+ {
+ settings = new AlignExportSettings(hasHiddenSeqs,
+ viewport.hasHiddenColumns(), exportFormat);
+ }
+ // settings.isExportAnnotations();
+
+ if (viewport.hasHiddenColumns() && !settings.isExportHiddenColumns())
+ {
+ omitHidden = viewport.getViewAsString(false);
+ }
+
+ if (hasHiddenSeqs && settings.isExportHiddenSequences())
+ {
+ alignmentToExport = hiddenSeqs.getFullAlignment();
+ }
+ else
+ {
+ alignmentToExport = viewport.getAlignment();
+ alignmentStartEnd = getStartEnd(alignmentStartEnd, viewport
+ .getColumnSelection().getHiddenColumns());
+ }
+ AlignmentExportData ed = new AlignmentExportData(alignmentToExport,
+ omitHidden, alignmentStartEnd, settings);
+ return ed;
+ }
+
+ public static int[] getStartEnd(int[] aligmentStartEnd,
+ List<int[]> hiddenCols)
+ {
+ int startPos = aligmentStartEnd[0];
+ int endPos = aligmentStartEnd[1];
+
+ int[] lowestRange = new int[2];
+ int[] higestRange = new int[2];
+
+ for (int[] hiddenCol : hiddenCols)
+ {
+ // System.out.println("comparing : " + hiddenCol[0] + "-" + hiddenCol[1]);
+ lowestRange = (hiddenCol[0] <= startPos) ? hiddenCol : lowestRange;
+ higestRange = (hiddenCol[1] >= endPos) ? hiddenCol : higestRange;
+ }
+ // System.out.println("min : " + lowestRange[0] + "-" + lowestRange[1]);
+ // System.out.println("max : " + higestRange[0] + "-" + higestRange[1]);
+
+ if (lowestRange[0] == 0 && lowestRange[1] == 0)
+ {
+ startPos = aligmentStartEnd[0];
+ }
+ else
+ {
+ startPos = lowestRange[1] + 1;
+ }
+
+ if (higestRange[0] == 0 && higestRange[1] == 0)
+ {
+ endPos = aligmentStartEnd[1];
+ }
+ else
+ {
+ endPos = higestRange[0];
+ }
+
+ // System.out.println("Export range : " + minPos + " - " + maxPos);
+ return new int[] { startPos, endPos };
+ }
+
+ public static void main(String[] args)
+ {
+ ArrayList<int[]> hiddenCols = new ArrayList<int[]>();
+ hiddenCols.add(new int[] { 0, 4 });
+ hiddenCols.add(new int[] { 6, 9 });
+ hiddenCols.add(new int[] { 11, 12 });
+ hiddenCols.add(new int[] { 33, 33 });
+ hiddenCols.add(new int[] { 45, 50 });
+
+ int[] x = getStartEnd(new int[] { 0, 50 }, hiddenCols);
+ // System.out.println("Export range : " + x[0] + " - " + x[1]);
+ }
+
/**
* DOCUMENT ME!
*
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void htmlMenuItem_actionPerformed(ActionEvent e)
{
- new HTMLOutput(alignPanel,
- alignPanel.seqPanel.seqCanvas.getSequenceRenderer(),
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
+ new HtmlSvgOutput(null, alignPanel);
+ }
+
+ @Override
+ public void bioJSMenuItem_actionPerformed(ActionEvent e)
+ {
+ BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel);
+ bjs.exportJalviewAlignmentAsBioJsHtmlFile();
}
public void createImageMap(File file, String image)
@@ -1133,6 +1383,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void createPNG(File f)
{
alignPanel.makePNG(f);
@@ -1144,11 +1395,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void createEPS(File f)
{
alignPanel.makeEPS(f);
}
+ public void createSVG(File f)
+ {
+ alignPanel.makeSVG(f);
+ }
+
+ @Override
public void pageSetup_actionPerformed(ActionEvent e)
{
PrinterJob printJob = PrinterJob.getPrinterJob();
@@ -1161,6 +1419,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void printMenuItem_actionPerformed(ActionEvent e)
{
// Putting in a thread avoids Swing painting problems
@@ -1168,29 +1427,29 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
thread.start();
}
+ @Override
public void exportFeatures_actionPerformed(ActionEvent e)
{
new AnnotationExporter().exportFeatures(alignPanel);
}
+ @Override
public void exportAnnotations_actionPerformed(ActionEvent e)
{
- new AnnotationExporter().exportAnnotations(
- alignPanel,
- viewport.showAnnotation ? viewport.alignment
- .getAlignmentAnnotation() : null, viewport.alignment
- .getGroups(),
- ((Alignment) viewport.alignment).alignmentProperties);
+ new AnnotationExporter().exportAnnotations(alignPanel);
}
+ @Override
public void associatedData_actionPerformed(ActionEvent e)
{
// Pick the tree file
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Load Jalview Annotations or Features File");
- chooser.setToolTipText("Load Jalview Annotations / Features file");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.load_jalview_annotations"));
+ chooser.setToolTipText(MessageManager
+ .getString("label.load_jalview_annotations"));
int value = chooser.showOpenDialog(null);
@@ -1209,6 +1468,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
*
* @param closeAllTabs
*/
+ @Override
public void closeMenuItem_actionPerformed(boolean closeAllTabs)
{
if (alignPanels != null && alignPanels.size() < 2)
@@ -1228,7 +1488,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// setClosed(true) is called
for (int i = 0; i < alignPanels.size(); i++)
{
- AlignmentPanel ap = (AlignmentPanel) alignPanels.elementAt(i);
+ AlignmentPanel ap = alignPanels.get(i);
ap.closePanel();
}
}
@@ -1241,6 +1501,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (closeAllTabs)
{
+ /*
+ * this will raise an INTERNAL_FRAME_CLOSED event and this method will
+ * be called recursively, with the frame now in 'closed' state
+ */
this.setClosed(true);
}
} catch (Exception ex)
@@ -1250,22 +1514,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
/**
- * close alignPanel2 and shuffle tabs appropriately.
+ * Close the specified panel and close up tabs appropriately.
*
- * @param alignPanel2
+ * @param panelToClose
*/
- public void closeView(AlignmentPanel alignPanel2)
+ public void closeView(AlignmentPanel panelToClose)
{
int index = tabbedPane.getSelectedIndex();
- int closedindex = tabbedPane.indexOfComponent(alignPanel2);
- alignPanels.removeElement(alignPanel2);
- // Unnecessary
- // if (viewport == alignPanel2.av)
- // {
- // viewport = null;
- // }
- alignPanel2.closePanel();
- alignPanel2 = null;
+ int closedindex = tabbedPane.indexOfComponent(panelToClose);
+ alignPanels.remove(panelToClose);
+ panelToClose.closePanel();
+ panelToClose = null;
tabbedPane.removeTabAt(closedindex);
tabbedPane.validate();
@@ -1285,29 +1544,33 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
void updateEditMenuBar()
{
- if (viewport.historyList.size() > 0)
+ if (viewport.getHistoryList().size() > 0)
{
undoMenuItem.setEnabled(true);
- CommandI command = (CommandI) viewport.historyList.peek();
- undoMenuItem.setText("Undo " + command.getDescription());
+ CommandI command = viewport.getHistoryList().peek();
+ undoMenuItem.setText(MessageManager.formatMessage(
+ "label.undo_command",
+ new Object[] { command.getDescription() }));
}
else
{
undoMenuItem.setEnabled(false);
- undoMenuItem.setText("Undo");
+ undoMenuItem.setText(MessageManager.getString("action.undo"));
}
- if (viewport.redoList.size() > 0)
+ if (viewport.getRedoList().size() > 0)
{
redoMenuItem.setEnabled(true);
- CommandI command = (CommandI) viewport.redoList.peek();
- redoMenuItem.setText("Redo " + command.getDescription());
+ CommandI command = viewport.getRedoList().peek();
+ redoMenuItem.setText(MessageManager.formatMessage(
+ "label.redo_command",
+ new Object[] { command.getDescription() }));
}
else
{
redoMenuItem.setEnabled(false);
- redoMenuItem.setText("Redo");
+ redoMenuItem.setText(MessageManager.getString("action.redo"));
}
}
@@ -1315,12 +1578,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
if (command.getSize() > 0)
{
- viewport.historyList.push(command);
- viewport.redoList.clear();
+ viewport.addToHistoryList(command);
+ viewport.clearRedoList();
updateEditMenuBar();
- viewport.hasHiddenColumns = (viewport.colSel != null
- && viewport.colSel.getHiddenColumns() != null && viewport.colSel
- .getHiddenColumns().size() > 0);
+ viewport.updateHiddenColumns();
+ // viewport.hasHiddenColumns = (viewport.getColumnSelection() != null
+ // && viewport.getColumnSelection().getHiddenColumns() != null &&
+ // viewport.getColumnSelection()
+ // .getHiddenColumns().size() > 0);
}
}
@@ -1332,18 +1597,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
if (alignPanels != null)
{
- Enumeration e = alignPanels.elements();
AlignmentI[] als = new AlignmentI[alignPanels.size()];
- for (int i = 0; e.hasMoreElements(); i++)
+ int i = 0;
+ for (AlignmentPanel ap : alignPanels)
{
- als[i] = ((AlignmentPanel) e.nextElement()).av.getAlignment();
+ als[i++] = ap.av.getAlignment();
}
return als;
}
if (viewport != null)
{
- return new AlignmentI[]
- { viewport.alignment };
+ return new AlignmentI[] { viewport.getAlignment() };
}
return null;
}
@@ -1354,24 +1618,35 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void undoMenuItem_actionPerformed(ActionEvent e)
{
- if (viewport.historyList.empty())
+ if (viewport.getHistoryList().isEmpty())
+ {
return;
- CommandI command = (CommandI) viewport.historyList.pop();
- viewport.redoList.push(command);
+ }
+ CommandI command = viewport.getHistoryList().pop();
+ viewport.addToRedoList(command);
command.undoCommand(getViewAlignments());
- AlignViewport originalSource = getOriginatingSource(command);
+ AlignmentViewport originalSource = getOriginatingSource(command);
updateEditMenuBar();
if (originalSource != null)
{
- originalSource.hasHiddenColumns = (viewport.colSel != null
- && viewport.colSel.getHiddenColumns() != null && viewport.colSel
- .getHiddenColumns().size() > 0);
- originalSource.firePropertyChange("alignment", null,
- originalSource.alignment.getSequences());
+ if (originalSource != viewport)
+ {
+ Cache.log
+ .warn("Implementation worry: mismatch of viewport origin for undo");
+ }
+ originalSource.updateHiddenColumns();
+ // originalSource.hasHiddenColumns = (viewport.getColumnSelection() !=
+ // null
+ // && viewport.getColumnSelection().getHiddenColumns() != null &&
+ // viewport.getColumnSelection()
+ // .getHiddenColumns().size() > 0);
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
}
}
@@ -1381,33 +1656,43 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void redoMenuItem_actionPerformed(ActionEvent e)
{
- if (viewport.redoList.size() < 1)
+ if (viewport.getRedoList().size() < 1)
{
return;
}
- CommandI command = (CommandI) viewport.redoList.pop();
- viewport.historyList.push(command);
+ CommandI command = viewport.getRedoList().pop();
+ viewport.addToHistoryList(command);
command.doCommand(getViewAlignments());
- AlignViewport originalSource = getOriginatingSource(command);
+ AlignmentViewport originalSource = getOriginatingSource(command);
updateEditMenuBar();
if (originalSource != null)
{
- originalSource.hasHiddenColumns = (viewport.colSel != null
- && viewport.colSel.getHiddenColumns() != null && viewport.colSel
- .getHiddenColumns().size() > 0);
- originalSource.firePropertyChange("alignment", null,
- originalSource.alignment.getSequences());
+
+ if (originalSource != viewport)
+ {
+ Cache.log
+ .warn("Implementation worry: mismatch of viewport origin for redo");
+ }
+ originalSource.updateHiddenColumns();
+ // originalSource.hasHiddenColumns = (viewport.getColumnSelection() !=
+ // null
+ // && viewport.getColumnSelection().getHiddenColumns() != null &&
+ // viewport.getColumnSelection()
+ // .getHiddenColumns().size() > 0);
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
}
}
- AlignViewport getOriginatingSource(CommandI command)
+ AlignmentViewport getOriginatingSource(CommandI command)
{
- AlignViewport originalSource = null;
+ AlignmentViewport originalSource = null;
// For sequence removal and addition, we need to fire
// the property change event FROM the viewport where the
// original alignment was altered
@@ -1416,16 +1701,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
EditCommand editCommand = (EditCommand) command;
al = editCommand.getAlignment();
- Vector comps = (Vector) PaintRefresher.components.get(viewport
+ List<Component> comps = PaintRefresher.components.get(viewport
.getSequenceSetId());
- for (int i = 0; i < comps.size(); i++)
+ for (Component comp : comps)
{
- if (comps.elementAt(i) instanceof AlignmentPanel)
+ if (comp instanceof AlignmentPanel)
{
- if (al == ((AlignmentPanel) comps.elementAt(i)).av.alignment)
+ if (al == ((AlignmentPanel) comp).av.getAlignment())
{
- originalSource = ((AlignmentPanel) comps.elementAt(i)).av;
+ originalSource = ((AlignmentPanel) comp).av;
break;
}
}
@@ -1438,7 +1723,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// the current view against the closed view first
if (al != null)
{
- PaintRefresher.validateSequences(al, viewport.alignment);
+ PaintRefresher.validateSequences(al, viewport.getAlignment());
}
originalSource = viewport;
@@ -1461,69 +1746,25 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
return;
}
-
- if (up)
- {
- for (int i = 1; i < viewport.alignment.getHeight(); i++)
- {
- SequenceI seq = viewport.alignment.getSequenceAt(i);
-
- if (!sg.getSequences(null).contains(seq))
- {
- continue;
- }
-
- SequenceI temp = viewport.alignment.getSequenceAt(i - 1);
-
- if (sg.getSequences(null).contains(temp))
- {
- continue;
- }
-
- viewport.alignment.getSequences().setElementAt(temp, i);
- viewport.alignment.getSequences().setElementAt(seq, i - 1);
- }
- }
- else
- {
- for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)
- {
- SequenceI seq = viewport.alignment.getSequenceAt(i);
-
- if (!sg.getSequences(null).contains(seq))
- {
- continue;
- }
-
- SequenceI temp = viewport.alignment.getSequenceAt(i + 1);
-
- if (sg.getSequences(null).contains(temp))
- {
- continue;
- }
-
- viewport.alignment.getSequences().setElementAt(temp, i);
- viewport.alignment.getSequences().setElementAt(seq, i + 1);
- }
- }
-
+ viewport.getAlignment().moveSelectedSequencesByOne(sg,
+ viewport.getHiddenRepSequences(), up);
alignPanel.paintAlignment(true);
}
synchronized void slideSequences(boolean right, int size)
{
- Vector sg = new Vector();
+ List<SequenceI> sg = new ArrayList<SequenceI>();
if (viewport.cursorMode)
{
- sg.addElement(viewport.alignment
- .getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY));
+ sg.add(viewport.getAlignment().getSequenceAt(
+ alignPanel.getSeqPanel().seqCanvas.cursorY));
}
else if (viewport.getSelectionGroup() != null
- && viewport.getSelectionGroup().getSize() != viewport.alignment
- .getHeight())
+ && viewport.getSelectionGroup().getSize() != viewport
+ .getAlignment().getHeight())
{
sg = viewport.getSelectionGroup().getSequences(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
}
if (sg.size() < 1)
@@ -1531,44 +1772,58 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
return;
}
- Vector invertGroup = new Vector();
+ List<SequenceI> invertGroup = new ArrayList<SequenceI>();
- for (int i = 0; i < viewport.alignment.getHeight(); i++)
+ for (SequenceI seq : viewport.getAlignment().getSequences())
{
- if (!sg.contains(viewport.alignment.getSequenceAt(i)))
- invertGroup.add(viewport.alignment.getSequenceAt(i));
+ if (!sg.contains(seq))
+ {
+ invertGroup.add(seq);
+ }
}
- SequenceI[] seqs1 = new SequenceI[sg.size()];
- for (int i = 0; i < sg.size(); i++)
- seqs1[i] = (SequenceI) sg.elementAt(i);
+ SequenceI[] seqs1 = sg.toArray(new SequenceI[0]);
SequenceI[] seqs2 = new SequenceI[invertGroup.size()];
for (int i = 0; i < invertGroup.size(); i++)
- seqs2[i] = (SequenceI) invertGroup.elementAt(i);
+ {
+ seqs2[i] = invertGroup.get(i);
+ }
SlideSequencesCommand ssc;
if (right)
+ {
ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1,
size, viewport.getGapCharacter());
+ }
else
+ {
ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2,
size, viewport.getGapCharacter());
+ }
int groupAdjustment = 0;
if (ssc.getGapsInsertedBegin() && right)
{
if (viewport.cursorMode)
- alignPanel.seqPanel.moveCursor(size, 0);
+ {
+ alignPanel.getSeqPanel().moveCursor(size, 0);
+ }
else
+ {
groupAdjustment = size;
+ }
}
else if (!ssc.getGapsInsertedBegin() && !right)
{
if (viewport.cursorMode)
- alignPanel.seqPanel.moveCursor(-size, 0);
+ {
+ alignPanel.getSeqPanel().moveCursor(-size, 0);
+ }
else
+ {
groupAdjustment = -size;
+ }
}
if (groupAdjustment != 0)
@@ -1579,17 +1834,25 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
viewport.getSelectionGroup().getEndRes() + groupAdjustment);
}
+ /*
+ * just extend the last slide command if compatible; but not if in
+ * SplitFrame mode (to ensure all edits are broadcast - JAL-1802)
+ */
boolean appendHistoryItem = false;
- if (viewport.historyList != null && viewport.historyList.size() > 0
- && viewport.historyList.peek() instanceof SlideSequencesCommand)
+ Deque<CommandI> historyList = viewport.getHistoryList();
+ boolean inSplitFrame = getSplitViewContainer() != null;
+ if (!inSplitFrame && historyList != null && historyList.size() > 0
+ && historyList.peek() instanceof SlideSequencesCommand)
{
appendHistoryItem = ssc
- .appendSlideCommand((SlideSequencesCommand) viewport.historyList
+ .appendSlideCommand((SlideSequencesCommand) historyList
.peek());
}
if (!appendHistoryItem)
+ {
addHistoryItem(ssc);
+ }
repaint();
}
@@ -1600,6 +1863,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void copy_actionPerformed(ActionEvent e)
{
System.gc();
@@ -1612,13 +1876,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
SequenceI[] seqs = viewport.getSelectionAsNewSequence();
String[] omitHidden = null;
- if (viewport.hasHiddenColumns)
+ if (viewport.hasHiddenColumns())
{
omitHidden = viewport.getViewAsString(true);
}
String output = new FormatAdapter().formatSequences("Fasta", seqs,
- omitHidden);
+ omitHidden, null);
StringSelection ss = new StringSelection(output);
@@ -1638,28 +1902,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
return;
}
- Vector hiddenColumns = null;
- if (viewport.hasHiddenColumns)
+ ArrayList<int[]> hiddenColumns = null;
+ if (viewport.hasHiddenColumns())
{
- hiddenColumns = new Vector();
+ hiddenColumns = new ArrayList<int[]>();
int hiddenOffset = viewport.getSelectionGroup().getStartRes(), hiddenCutoff = viewport
.getSelectionGroup().getEndRes();
- for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns()
- .size(); i++)
+ for (int[] region : viewport.getColumnSelection().getHiddenColumns())
{
- int[] region = (int[]) viewport.getColumnSelection()
- .getHiddenColumns().elementAt(i);
if (region[0] >= hiddenOffset && region[1] <= hiddenCutoff)
{
- hiddenColumns.addElement(new int[]
- { region[0] - hiddenOffset, region[1] - hiddenOffset });
+ hiddenColumns.add(new int[] { region[0] - hiddenOffset,
+ region[1] - hiddenOffset });
}
}
}
- Desktop.jalviewClipboard = new Object[]
- { seqs, viewport.alignment.getDataset(), hiddenColumns };
- statusBar.setText("Copied " + seqs.length + " sequences to clipboard.");
+ Desktop.jalviewClipboard = new Object[] { seqs,
+ viewport.getAlignment().getDataset(), hiddenColumns };
+ statusBar.setText(MessageManager.formatMessage(
+ "label.copied_sequences_to_clipboard", new Object[] { Integer
+ .valueOf(seqs.length).toString() }));
}
/**
@@ -1668,6 +1931,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void pasteNew_actionPerformed(ActionEvent e)
{
paste(true);
@@ -1679,6 +1943,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void pasteThis_actionPerformed(ActionEvent e)
{
paste(false);
@@ -1747,6 +2012,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
int alwidth = 0;
+ ArrayList<Integer> newGraphGroups = new ArrayList<Integer>();
+ int fgroup = -1;
if (newAlignment)
{
@@ -1814,6 +2081,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
newDs.clear(); // tidy up
}
+ if (alignment.getAlignmentAnnotation() != null)
+ {
+ for (AlignmentAnnotation alan : alignment
+ .getAlignmentAnnotation())
+ {
+ if (alan.graphGroup > fgroup)
+ {
+ fgroup = alan.graphGroup;
+ }
+ }
+ }
if (pastedal.getAlignmentAnnotation() != null)
{
// Add any annotation attached to alignment.
@@ -1824,6 +2102,22 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (alann[i].sequenceRef == null && !alann[i].autoCalculated)
{
AlignmentAnnotation newann = new AlignmentAnnotation(alann[i]);
+ if (newann.graphGroup > -1)
+ {
+ if (newGraphGroups.size() <= newann.graphGroup
+ || newGraphGroups.get(newann.graphGroup) == null)
+ {
+ for (int q = newGraphGroups.size(); q <= newann.graphGroup; q++)
+ {
+ newGraphGroups.add(q, null);
+ }
+ newGraphGroups.set(newann.graphGroup, new Integer(
+ ++fgroup));
+ }
+ newann.graphGroup = newGraphGroups.get(newann.graphGroup)
+ .intValue();
+ }
+
newann.padAnnotation(alwidth);
alignment.addAnnotation(newann);
}
@@ -1835,19 +2129,40 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// /////
// ADD HISTORY ITEM
//
- addHistoryItem(new EditCommand("Add sequences", EditCommand.PASTE,
- sequences, 0, alignment.getWidth(), alignment));
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.add_sequences"),
+ Action.PASTE, sequences, 0, alignment.getWidth(), alignment));
}
// Add any annotations attached to sequences
for (int i = 0; i < sequences.length; i++)
{
if (sequences[i].getAnnotation() != null)
{
+ AlignmentAnnotation newann;
for (int a = 0; a < sequences[i].getAnnotation().length; a++)
{
annotationAdded = true;
- sequences[i].getAnnotation()[a].adjustForAlignment();
- sequences[i].getAnnotation()[a].padAnnotation(alwidth);
+ newann = sequences[i].getAnnotation()[a];
+ newann.adjustForAlignment();
+ newann.padAnnotation(alwidth);
+ if (newann.graphGroup > -1)
+ {
+ if (newann.graphGroup > -1)
+ {
+ if (newGraphGroups.size() <= newann.graphGroup
+ || newGraphGroups.get(newann.graphGroup) == null)
+ {
+ for (int q = newGraphGroups.size(); q <= newann.graphGroup; q++)
+ {
+ newGraphGroups.add(q, null);
+ }
+ newGraphGroups.set(newann.graphGroup, new Integer(
+ ++fgroup));
+ }
+ newann.graphGroup = newGraphGroups.get(newann.graphGroup)
+ .intValue();
+ }
+ }
alignment.addAnnotation(sequences[i].getAnnotation()[a]); // annotation
// was
// duplicated
@@ -1870,7 +2185,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
AlignmentAnnotation sann[] = sequences[i].getAnnotation();
if (sann == null)
+ {
continue;
+ }
for (int avnum = 0; avnum < alview.length; avnum++)
{
if (alview[avnum] != alignment)
@@ -1887,6 +2204,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
newann.padAnnotation(avwidth);
alview[avnum].addAnnotation(newann); // annotation was
// duplicated earlier
+ // TODO JAL-1145 graphGroups are not updated for sequence
+ // annotation added to several views. This may cause
+ // strangeness
alview[avnum].setAnnotationIndex(newann, a);
}
}
@@ -1896,6 +2216,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
viewport.firePropertyChange("alignment", null,
alignment.getSequences());
+ if (alignPanels != null)
+ {
+ for (AlignmentPanel ap : alignPanels)
+ {
+ ap.validateAnnotationDimensions(false);
+ }
+ }
+ else
+ {
+ alignPanel.validateAnnotationDimensions(false);
+ }
}
else
@@ -1907,19 +2238,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (Desktop.jalviewClipboard != null
&& Desktop.jalviewClipboard[2] != null)
{
- Vector hc = (Vector) Desktop.jalviewClipboard[2];
- for (int i = 0; i < hc.size(); i++)
+ List<int[]> hc = (List<int[]>) Desktop.jalviewClipboard[2];
+ for (int[] region : hc)
{
- int[] region = (int[]) hc.elementAt(i);
af.viewport.hideColumns(region[0], region[1]);
}
}
// >>>This is a fix for the moment, until a better solution is
// found!!<<<
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer()
+ af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()
.transferSettings(
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
+ alignPanel.getSeqPanel().seqCanvas
+ .getFeatureRenderer());
// TODO: maintain provenance of an alignment, rather than just make the
// title a concatenation of operations.
@@ -1953,12 +2284,67 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
+ @Override
+ protected void expand_newalign(ActionEvent e)
+ {
+ try
+ {
+ AlignmentI alignment = AlignmentUtils.expandContext(getViewport()
+ .getAlignment(), -1);
+ AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH,
+ DEFAULT_HEIGHT);
+ String newtitle = new String("Flanking alignment");
+
+ if (Desktop.jalviewClipboard != null
+ && Desktop.jalviewClipboard[2] != null)
+ {
+ List<int[]> hc = (List<int[]>) Desktop.jalviewClipboard[2];
+ for (int region[] : hc)
+ {
+ af.viewport.hideColumns(region[0], region[1]);
+ }
+ }
+
+ // >>>This is a fix for the moment, until a better solution is
+ // found!!<<<
+ af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()
+ .transferSettings(
+ alignPanel.getSeqPanel().seqCanvas
+ .getFeatureRenderer());
+
+ // TODO: maintain provenance of an alignment, rather than just make the
+ // title a concatenation of operations.
+ {
+ if (title.startsWith("Copied sequences"))
+ {
+ newtitle = title;
+ }
+ else
+ {
+ newtitle = newtitle.concat("- from " + title);
+ }
+ }
+
+ Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, DEFAULT_HEIGHT);
+
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ System.out.println("Exception whilst pasting: " + ex);
+ // could be anything being pasted in here
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("Viewing flanking region of alignment", oom);
+ }
+ }
+
/**
* DOCUMENT ME!
*
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void cut_actionPerformed(ActionEvent e)
{
copy_actionPerformed(null);
@@ -1971,6 +2357,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void delete_actionPerformed(ActionEvent evt)
{
@@ -1980,37 +2367,36 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
return;
}
- Vector seqs = new Vector();
- SequenceI seq;
- for (int i = 0; i < sg.getSize(); i++)
+ /*
+ * If the cut affects all sequences, warn, remove highlighted columns
+ */
+ if (sg.getSize() == viewport.getAlignment().getHeight())
{
- seq = sg.getSequenceAt(i);
- seqs.addElement(seq);
- }
+ int confirm = JOptionPane.showConfirmDialog(this,
+ MessageManager.getString("warn.delete_all"), // $NON-NLS-1$
+ MessageManager.getString("label.delete_all"), // $NON-NLS-1$
+ JOptionPane.OK_CANCEL_OPTION);
- // If the cut affects all sequences, remove highlighted columns
- if (sg.getSize() == viewport.alignment.getHeight())
- {
+ if (confirm == JOptionPane.CANCEL_OPTION
+ || confirm == JOptionPane.CLOSED_OPTION)
+ {
+ return;
+ }
viewport.getColumnSelection().removeElements(sg.getStartRes(),
sg.getEndRes() + 1);
}
- SequenceI[] cut = new SequenceI[seqs.size()];
- for (int i = 0; i < seqs.size(); i++)
- {
- cut[i] = (SequenceI) seqs.elementAt(i);
- }
+ SequenceI[] cut = sg.getSequences()
+ .toArray(new SequenceI[sg.getSize()]);
- /*
- * //ADD HISTORY ITEM
- */
- addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,
- sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
- viewport.alignment));
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.cut_sequences"), Action.CUT,
+ cut, sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
+ viewport.getAlignment()));
viewport.setSelectionGroup(null);
viewport.sendSelection();
- viewport.alignment.deleteGroup(sg);
+ viewport.getAlignment().deleteGroup(sg);
viewport.firePropertyChange("alignment", null, viewport.getAlignment()
.getSequences());
@@ -2031,14 +2417,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void deleteGroups_actionPerformed(ActionEvent e)
{
- viewport.alignment.deleteAllGroups();
- viewport.sequenceColours = null;
- viewport.setSelectionGroup(null);
- PaintRefresher.Refresh(this, viewport.getSequenceSetId());
- alignPanel.updateAnnotation();
- alignPanel.paintAlignment(true);
+ if (avc.deleteGroups())
+ {
+ PaintRefresher.Refresh(this, viewport.getSequenceSetId());
+ alignPanel.updateAnnotation();
+ alignPanel.paintAlignment(true);
+ }
}
/**
@@ -2047,6 +2434,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
{
SequenceGroup sg = new SequenceGroup();
@@ -2056,7 +2444,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);
}
- sg.setEndRes(viewport.alignment.getWidth() - 1);
+ sg.setEndRes(viewport.getAlignment().getWidth() - 1);
viewport.setSelectionGroup(sg);
viewport.sendSelection();
alignPanel.paintAlignment(true);
@@ -2069,18 +2457,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
{
if (viewport.cursorMode)
{
- alignPanel.seqPanel.keyboardNo1 = null;
- alignPanel.seqPanel.keyboardNo2 = null;
+ alignPanel.getSeqPanel().keyboardNo1 = null;
+ alignPanel.getSeqPanel().keyboardNo2 = null;
}
viewport.setSelectionGroup(null);
viewport.getColumnSelection().clear();
viewport.setSelectionGroup(null);
- alignPanel.seqPanel.seqCanvas.highlightSearchResults(null);
- alignPanel.idPanel.idCanvas.searchResults = null;
+ alignPanel.getSeqPanel().seqCanvas.highlightSearchResults(null);
+ alignPanel.getIdPanel().getIdCanvas().searchResults = null;
alignPanel.paintAlignment(true);
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
viewport.sendSelection();
@@ -2092,6 +2481,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void invertSequenceMenuItem_actionPerformed(ActionEvent e)
{
SequenceGroup sg = viewport.getSelectionGroup();
@@ -2113,6 +2503,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
viewport.sendSelection();
}
+ @Override
public void invertColSel_actionPerformed(ActionEvent e)
{
viewport.invertColumnSelection();
@@ -2126,6 +2517,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void remove2LeftMenuItem_actionPerformed(ActionEvent e)
{
trimAlignment(true);
@@ -2137,6 +2529,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void remove2RightMenuItem_actionPerformed(ActionEvent e)
{
trimAlignment(false);
@@ -2162,11 +2555,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (viewport.getSelectionGroup() != null)
{
seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
}
else
{
- seqs = viewport.alignment.getSequencesArray();
+ seqs = viewport.getAlignment().getSequencesArray();
}
TrimRegionCommand trimRegion;
@@ -2174,32 +2567,31 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
trimRegion = new TrimRegionCommand("Remove Left",
TrimRegionCommand.TRIM_LEFT, seqs, column,
- viewport.alignment, viewport.colSel,
- viewport.selectionGroup);
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
viewport.setStartRes(0);
}
else
{
trimRegion = new TrimRegionCommand("Remove Right",
TrimRegionCommand.TRIM_RIGHT, seqs, column,
- viewport.alignment, viewport.colSel,
- viewport.selectionGroup);
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
}
- statusBar.setText("Removed " + trimRegion.getSize() + " columns.");
+ statusBar.setText(MessageManager.formatMessage(
+ "label.removed_columns",
+ new String[] { Integer.valueOf(trimRegion.getSize())
+ .toString() }));
addHistoryItem(trimRegion);
- Vector groups = viewport.alignment.getGroups();
-
- for (int i = 0; i < groups.size(); i++)
+ for (SequenceGroup sg : viewport.getAlignment().getGroups())
{
- SequenceGroup sg = (SequenceGroup) groups.get(i);
-
if ((trimLeft && !sg.adjustForRemoveLeft(column))
|| (!trimLeft && !sg.adjustForRemoveRight(column)))
{
- viewport.alignment.deleteGroup(sg);
+ viewport.getAlignment().deleteGroup(sg);
}
}
@@ -2214,34 +2606,38 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
{
- int start = 0, end = viewport.alignment.getWidth() - 1;
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
SequenceI[] seqs;
if (viewport.getSelectionGroup() != null)
{
seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
start = viewport.getSelectionGroup().getStartRes();
end = viewport.getSelectionGroup().getEndRes();
}
else
{
- seqs = viewport.alignment.getSequencesArray();
+ seqs = viewport.getAlignment().getSequencesArray();
}
RemoveGapColCommand removeGapCols = new RemoveGapColCommand(
- "Remove Gapped Columns", seqs, start, end, viewport.alignment);
+ "Remove Gapped Columns", seqs, start, end,
+ viewport.getAlignment());
addHistoryItem(removeGapCols);
- statusBar.setText("Removed " + removeGapCols.getSize()
- + " empty columns.");
+ statusBar.setText(MessageManager.formatMessage(
+ "label.removed_empty_columns",
+ new Object[] { Integer.valueOf(removeGapCols.getSize())
+ .toString() }));
// This is to maintain viewport position on first residue
// of first sequence
- SequenceI seq = viewport.alignment.getSequenceAt(0);
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
int startRes = seq.findPosition(viewport.startRes);
// ShiftList shifts;
// viewport.getAlignment().removeGaps(shifts=new ShiftList());
@@ -2260,30 +2656,31 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
{
- int start = 0, end = viewport.alignment.getWidth() - 1;
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
SequenceI[] seqs;
if (viewport.getSelectionGroup() != null)
{
seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
start = viewport.getSelectionGroup().getStartRes();
end = viewport.getSelectionGroup().getEndRes();
}
else
{
- seqs = viewport.alignment.getSequencesArray();
+ seqs = viewport.getAlignment().getSequencesArray();
}
// This is to maintain viewport position on first residue
// of first sequence
- SequenceI seq = viewport.alignment.getSequenceAt(0);
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
int startRes = seq.findPosition(viewport.startRes);
addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,
- viewport.alignment));
+ viewport.getAlignment()));
viewport.setStartRes(seq.findIndex(startRes) - 1);
@@ -2298,105 +2695,109 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void padGapsMenuitem_actionPerformed(ActionEvent e)
{
- viewport.padGaps = padGapsMenuitem.isSelected();
+ viewport.setPadGaps(padGapsMenuitem.isSelected());
viewport.firePropertyChange("alignment", null, viewport.getAlignment()
.getSequences());
}
- // else
- {
- // if (justifySeqs>0)
- {
- // alignment.justify(justifySeqs!=RIGHT_JUSTIFY);
- }
- }
-
- // }
-
/**
* DOCUMENT ME!
*
* @param e
* DOCUMENT ME!
*/
+ @Override
public void findMenuItem_actionPerformed(ActionEvent e)
{
new Finder();
}
- public void newView_actionPerformed(ActionEvent e)
- {
- newView(true);
- }
-
- /**
- *
- * @param copyAnnotation
- * if true then duplicate all annnotation, groups and settings
- * @return new alignment panel, already displayed.
- */
- public AlignmentPanel newView(boolean copyAnnotation)
- {
- return newView(null, copyAnnotation);
- }
-
/**
- *
- * @param viewTitle
- * title of newly created view
- * @return new alignment panel, already displayed.
+ * Create a new view of the current alignment.
*/
- public AlignmentPanel newView(String viewTitle)
+ @Override
+ public void newView_actionPerformed(ActionEvent e)
{
- return newView(viewTitle, true);
+ newView(null, true);
}
/**
+ * Creates and shows a new view of the current alignment.
*
* @param viewTitle
- * title of newly created view
+ * title of newly created view; if null, one will be generated
* @param copyAnnotation
* if true then duplicate all annnotation, groups and settings
* @return new alignment panel, already displayed.
*/
public AlignmentPanel newView(String viewTitle, boolean copyAnnotation)
{
+ /*
+ * Create a new AlignmentPanel (with its own, new Viewport)
+ */
AlignmentPanel newap = new Jalview2XML().copyAlignPanel(alignPanel,
true);
if (!copyAnnotation)
{
- // just remove all the current annotation except for the automatic stuff
- newap.av.alignment.deleteAllGroups();
- for (AlignmentAnnotation alan : newap.av.alignment
- .getAlignmentAnnotation())
- {
- if (!alan.autoCalculated)
- {
- newap.av.alignment.deleteAnnotation(alan);
- }
- ;
- }
+ /*
+ * remove all groups and annotation except for the automatic stuff
+ */
+ newap.av.getAlignment().deleteAllGroups();
+ newap.av.getAlignment().deleteAllAnnotations(false);
}
- newap.av.gatherViewsHere = false;
+ newap.av.setGatherViewsHere(false);
if (viewport.viewName == null)
{
- viewport.viewName = "Original";
+ viewport.viewName = MessageManager
+ .getString("label.view_name_original");
}
- newap.av.historyList = viewport.historyList;
- newap.av.redoList = viewport.redoList;
+ /*
+ * Views share the same edits undo and redo stacks
+ */
+ newap.av.setHistoryList(viewport.getHistoryList());
+ newap.av.setRedoList(viewport.getRedoList());
+
+ /*
+ * Views share the same mappings; need to deregister any new mappings
+ * created by copyAlignPanel, and register the new reference to the shared
+ * mappings
+ */
+ newap.av.replaceMappings(viewport.getAlignment());
+
+ newap.av.viewName = getNewViewName(viewTitle);
+
+ addAlignmentPanel(newap, true);
+ newap.alignmentChanged();
+
+ if (alignPanels.size() == 2)
+ {
+ viewport.setGatherViewsHere(true);
+ }
+ tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
+ return newap;
+ }
+ /**
+ * Make a new name for the view, ensuring it is unique within the current
+ * sequenceSetId. (This used to be essential for Jalview Project archives, but
+ * these now use viewId. Unique view names are still desirable for usability.)
+ *
+ * @param viewTitle
+ * @return
+ */
+ protected String getNewViewName(String viewTitle)
+ {
int index = Desktop.getViewCount(viewport.getSequenceSetId());
- // make sure the new view has a unique name - this is essential for Jalview
- // 2 archives
boolean addFirstIndex = false;
if (viewTitle == null || viewTitle.trim().length() == 0)
{
- viewTitle = "View";
+ viewTitle = MessageManager.getString("action.view");
addFirstIndex = true;
}
else
@@ -2404,43 +2805,56 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
index = 1;// we count from 1 if given a specific name
}
String newViewName = viewTitle + ((addFirstIndex) ? " " + index : "");
- Vector comps = (Vector) PaintRefresher.components.get(viewport
+
+ List<Component> comps = PaintRefresher.components.get(viewport
.getSequenceSetId());
- Vector existingNames = new Vector();
- for (int i = 0; i < comps.size(); i++)
- {
- if (comps.elementAt(i) instanceof AlignmentPanel)
- {
- AlignmentPanel ap = (AlignmentPanel) comps.elementAt(i);
- if (!existingNames.contains(ap.av.viewName))
- {
- existingNames.addElement(ap.av.viewName);
- }
- }
- }
+
+ List<String> existingNames = getExistingViewNames(comps);
while (existingNames.contains(newViewName))
{
newViewName = viewTitle + " " + (++index);
}
+ return newViewName;
+ }
- newap.av.viewName = newViewName;
-
- addAlignmentPanel(newap, true);
-
- if (alignPanels.size() == 2)
+ /**
+ * Returns a list of distinct view names found in the given list of
+ * components. View names are held on the viewport of an AlignmentPanel.
+ *
+ * @param comps
+ * @return
+ */
+ protected List<String> getExistingViewNames(List<Component> comps)
+ {
+ List<String> existingNames = new ArrayList<String>();
+ for (Component comp : comps)
{
- viewport.gatherViewsHere = true;
+ if (comp instanceof AlignmentPanel)
+ {
+ AlignmentPanel ap = (AlignmentPanel) comp;
+ if (!existingNames.contains(ap.av.viewName))
+ {
+ existingNames.add(ap.av.viewName);
+ }
+ }
}
- tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
- return newap;
+ return existingNames;
}
+ /**
+ * Explode tabbed views into separate windows.
+ */
+ @Override
public void expandViews_actionPerformed(ActionEvent e)
{
Desktop.instance.explodeViews(this);
}
+ /**
+ * Gather views in separate windows back into a tabbed presentation.
+ */
+ @Override
public void gatherViews_actionPerformed(ActionEvent e)
{
Desktop.instance.gatherViews(this);
@@ -2452,6 +2866,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void font_actionPerformed(ActionEvent e)
{
new FontChooser(alignPanel);
@@ -2463,24 +2878,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void seqLimit_actionPerformed(ActionEvent e)
{
viewport.setShowJVSuffix(seqLimits.isSelected());
- alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel
- .calculateIdWidth());
+ alignPanel.getIdPanel().getIdCanvas()
+ .setPreferredSize(alignPanel.calculateIdWidth());
alignPanel.paintAlignment(true);
}
+ @Override
public void idRightAlign_actionPerformed(ActionEvent e)
{
- viewport.rightAlignIds = idRightAlign.isSelected();
+ viewport.setRightAlignIds(idRightAlign.isSelected());
alignPanel.paintAlignment(true);
}
+ @Override
public void centreColumnLabels_actionPerformed(ActionEvent e)
{
- viewport.centreColumnLabels = centreColumnLabelsMenuItem.getState();
+ viewport.setCentreColumnLabels(centreColumnLabelsMenuItem.getState());
alignPanel.paintAlignment(true);
}
@@ -2489,12 +2907,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
*
* @see jalview.jbgui.GAlignFrame#followHighlight_actionPerformed()
*/
+ @Override
protected void followHighlight_actionPerformed()
{
- if (viewport.followHighlight = this.followHighlightMenuItem.getState())
+ /*
+ * Set the 'follow' flag on the Viewport (and scroll to position if now
+ * true).
+ */
+ final boolean state = this.followHighlightMenuItem.getState();
+ viewport.setFollowHighlight(state);
+ if (state)
{
alignPanel.scrollToPosition(
- alignPanel.seqPanel.seqCanvas.searchResults, false);
+ alignPanel.getSeqPanel().seqCanvas.searchResults, false);
}
}
@@ -2504,6 +2929,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void colourTextMenuItem_actionPerformed(ActionEvent e)
{
viewport.setColourText(colourTextMenuItem.isSelected());
@@ -2516,30 +2942,34 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void wrapMenuItem_actionPerformed(ActionEvent e)
{
scaleAbove.setVisible(wrapMenuItem.isSelected());
scaleLeft.setVisible(wrapMenuItem.isSelected());
scaleRight.setVisible(wrapMenuItem.isSelected());
viewport.setWrapAlignment(wrapMenuItem.isSelected());
- alignPanel.setWrapAlignment(wrapMenuItem.isSelected());
+ alignPanel.updateLayout();
}
+ @Override
public void showAllSeqs_actionPerformed(ActionEvent e)
{
viewport.showAllHiddenSeqs();
}
+ @Override
public void showAllColumns_actionPerformed(ActionEvent e)
{
viewport.showAllHiddenColumns();
repaint();
}
+ @Override
public void hideSelSequences_actionPerformed(ActionEvent e)
{
viewport.hideAllSelectedSeqs();
- alignPanel.paintAlignment(true);
+ // alignPanel.paintAlignment(true);
}
/**
@@ -2558,8 +2988,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// Hide everything by the current selection - this is a hack - we do the
// invert and then hide
// first check that there will be visible columns after the invert.
- if ((viewport.colSel != null && viewport.colSel.getSelected() != null && viewport.colSel
- .getSelected().size() > 0)
+ if ((viewport.getColumnSelection() != null
+ && viewport.getColumnSelection().getSelected() != null && viewport
+ .getColumnSelection().getSelected().size() > 0)
|| (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg
.getEndRes()))
{
@@ -2582,12 +3013,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (toggleSeqs)
{
- if (sg != null && sg.getSize() != viewport.alignment.getHeight())
+ if (sg != null && sg.getSize() != viewport.getAlignment().getHeight())
{
hideSelSequences_actionPerformed(null);
hide = true;
}
- else if (!(toggleCols && viewport.colSel.getSelected().size() > 0))
+ else if (!(toggleCols && viewport.getColumnSelection().getSelected()
+ .size() > 0))
{
showAllSeqs_actionPerformed(null);
}
@@ -2595,12 +3027,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (toggleCols)
{
- if (viewport.colSel.getSelected().size() > 0)
+ if (viewport.getColumnSelection().getSelected().size() > 0)
{
hideSelColumns_actionPerformed(null);
if (!toggleSeqs)
{
- viewport.selectionGroup = sg;
+ viewport.setSelectionGroup(sg);
}
}
else if (!hide)
@@ -2617,6 +3049,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#hideAllButSelection_actionPerformed(java.awt.
* event.ActionEvent)
*/
+ @Override
public void hideAllButSelection_actionPerformed(ActionEvent e)
{
toggleHiddenRegions(false, false);
@@ -2629,6 +3062,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#hideAllSelection_actionPerformed(java.awt.event
* .ActionEvent)
*/
+ @Override
public void hideAllSelection_actionPerformed(ActionEvent e)
{
SequenceGroup sg = viewport.getSelectionGroup();
@@ -2645,6 +3079,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event.
* ActionEvent)
*/
+ @Override
public void showAllhidden_actionPerformed(ActionEvent e)
{
viewport.showAllHiddenColumns();
@@ -2652,12 +3087,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
alignPanel.paintAlignment(true);
}
+ @Override
public void hideSelColumns_actionPerformed(ActionEvent e)
{
viewport.hideSelectedColumns();
alignPanel.paintAlignment(true);
}
+ @Override
public void hiddenMarkers_actionPerformed(ActionEvent e)
{
viewport.setShowHiddenMarkers(hiddenMarkers.isSelected());
@@ -2670,6 +3107,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void scaleAbove_actionPerformed(ActionEvent e)
{
viewport.setScaleAboveWrapped(scaleAbove.isSelected());
@@ -2682,6 +3120,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void scaleLeft_actionPerformed(ActionEvent e)
{
viewport.setScaleLeftWrapped(scaleLeft.isSelected());
@@ -2694,6 +3133,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void scaleRight_actionPerformed(ActionEvent e)
{
viewport.setScaleRightWrapped(scaleRight.isSelected());
@@ -2706,6 +3146,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void viewBoxesMenuItem_actionPerformed(ActionEvent e)
{
viewport.setShowBoxes(viewBoxesMenuItem.isSelected());
@@ -2718,6 +3159,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void viewTextMenuItem_actionPerformed(ActionEvent e)
{
viewport.setShowText(viewTextMenuItem.isSelected());
@@ -2730,6 +3172,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
{
viewport.setRenderGaps(renderGapsMenuItem.isSelected());
@@ -2738,6 +3181,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
public FeatureSettings featureSettings;
+ @Override
+ public FeatureSettingsControllerI getFeatureSettingsUI()
+ {
+ return featureSettings;
+ }
+
+ @Override
public void featureSettings_actionPerformed(ActionEvent e)
{
if (featureSettings != null)
@@ -2760,6 +3210,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void showSeqFeatures_actionPerformed(ActionEvent evt)
{
viewport.setShowSequenceFeatures(showSeqFeatures.isSelected());
@@ -2776,11 +3227,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void showSeqFeaturesHeight_actionPerformed(ActionEvent evt)
{
viewport.setShowSequenceFeaturesHeight(showSeqFeaturesHeight
.isSelected());
- if (viewport.getShowSequenceFeaturesHeight())
+ if (viewport.isShowSequenceFeaturesHeight())
{
// ensure we're actually displaying features
viewport.setShowSequenceFeatures(true);
@@ -2794,29 +3246,41 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
/**
- * DOCUMENT ME!
+ * Action on toggle of the 'Show annotations' menu item. This shows or hides
+ * the annotations panel as a whole.
+ *
+ * The options to show/hide all annotations should be enabled when the panel
+ * is shown, and disabled when the panel is hidden.
*
* @param e
- * DOCUMENT ME!
*/
+ @Override
public void annotationPanelMenuItem_actionPerformed(ActionEvent e)
{
- viewport.setShowAnnotation(annotationPanelMenuItem.isSelected());
- alignPanel.setAnnotationVisible(annotationPanelMenuItem.isSelected());
+ final boolean setVisible = annotationPanelMenuItem.isSelected();
+ viewport.setShowAnnotation(setVisible);
+ this.showAllSeqAnnotations.setEnabled(setVisible);
+ this.hideAllSeqAnnotations.setEnabled(setVisible);
+ this.showAllAlAnnotations.setEnabled(setVisible);
+ this.hideAllAlAnnotations.setEnabled(setVisible);
+ alignPanel.updateLayout();
}
+ @Override
public void alignmentProperties()
{
JEditorPane editPane = new JEditorPane("text/html", "");
editPane.setEditable(false);
- StringBuffer contents = new AlignmentProperties(viewport.alignment)
+ StringBuffer contents = new AlignmentProperties(viewport.getAlignment())
.formatAsHtml();
- editPane.setText("<html>" + contents.toString() + "</html>");
+ editPane.setText(MessageManager.formatMessage("label.html_content",
+ new Object[] { contents.toString() }));
JInternalFrame frame = new JInternalFrame();
frame.getContentPane().add(new JScrollPane(editPane));
- Desktop.instance.addInternalFrame(frame, "Alignment Properties: "
- + getTitle(), 500, 400);
+ Desktop.addInternalFrame(frame, MessageManager.formatMessage(
+ "label.alignment_properties", new Object[] { getTitle() }),
+ 500, 400);
}
/**
@@ -2825,6 +3289,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void overviewMenuItem_actionPerformed(ActionEvent e)
{
if (alignPanel.overviewPanel != null)
@@ -2835,12 +3300,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
JInternalFrame frame = new JInternalFrame();
OverviewPanel overview = new OverviewPanel(alignPanel);
frame.setContentPane(overview);
- Desktop.addInternalFrame(frame, "Overview " + this.getTitle(),
+ Desktop.addInternalFrame(frame, MessageManager.formatMessage(
+ "label.overview_params", new Object[] { this.getTitle() }),
frame.getWidth(), frame.getHeight());
frame.pack();
frame.setLayer(JLayeredPane.PALETTE_LAYER);
frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
{
+ @Override
public void internalFrameClosed(
javax.swing.event.InternalFrameEvent evt)
{
@@ -2851,6 +3318,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
alignPanel.setOverviewPanel(overview);
}
+ @Override
public void textColour_actionPerformed(ActionEvent e)
{
new TextColourChooser().chooseColour(alignPanel, null);
@@ -2862,6 +3330,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void noColourmenuItem_actionPerformed(ActionEvent e)
{
changeColour(null);
@@ -2873,11 +3342,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void clustalColour_actionPerformed(ActionEvent e)
{
- changeColour(new ClustalxColourScheme(
- viewport.alignment.getSequences(),
- viewport.alignment.getWidth()));
+ changeColour(new ClustalxColourScheme(viewport.getAlignment(),
+ viewport.getHiddenRepSequences()));
}
/**
@@ -2886,6 +3355,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void zappoColour_actionPerformed(ActionEvent e)
{
changeColour(new ZappoColourScheme());
@@ -2897,6 +3367,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void taylorColour_actionPerformed(ActionEvent e)
{
changeColour(new TaylorColourScheme());
@@ -2908,6 +3379,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void hydrophobicityColour_actionPerformed(ActionEvent e)
{
changeColour(new HydrophobicColourScheme());
@@ -2919,6 +3391,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void helixColour_actionPerformed(ActionEvent e)
{
changeColour(new HelixColourScheme());
@@ -2930,6 +3403,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void strandColour_actionPerformed(ActionEvent e)
{
changeColour(new StrandColourScheme());
@@ -2941,6 +3415,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void turnColour_actionPerformed(ActionEvent e)
{
changeColour(new TurnColourScheme());
@@ -2952,6 +3427,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void buriedColour_actionPerformed(ActionEvent e)
{
changeColour(new BuriedColourScheme());
@@ -2963,22 +3439,49 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void nucleotideColour_actionPerformed(ActionEvent e)
{
changeColour(new NucleotideColourScheme());
}
+ @Override
+ public void purinePyrimidineColour_actionPerformed(ActionEvent e)
+ {
+ changeColour(new PurinePyrimidineColourScheme());
+ }
+
+ /*
+ * public void covariationColour_actionPerformed(ActionEvent e) {
+ * changeColour(new
+ * CovariationColourScheme(viewport.getAlignment().getAlignmentAnnotation
+ * ()[0])); }
+ */
+ @Override
public void annotationColour_actionPerformed(ActionEvent e)
{
new AnnotationColourChooser(viewport, alignPanel);
}
+ @Override
+ public void annotationColumn_actionPerformed(ActionEvent e)
+ {
+ new AnnotationColumnChooser(viewport, alignPanel);
+ }
+
+ @Override
+ public void rnahelicesColour_actionPerformed(ActionEvent e)
+ {
+ new RNAHelicesColourChooser(viewport, alignPanel);
+ }
+
/**
* DOCUMENT ME!
*
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void applyToAllGroups_actionPerformed(ActionEvent e)
{
viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());
@@ -2992,121 +3495,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
*/
public void changeColour(ColourSchemeI cs)
{
- int threshold = 0;
+ // TODO: pull up to controller method
if (cs != null)
{
+ // Make sure viewport is up to date w.r.t. any sliders
if (viewport.getAbovePIDThreshold())
{
- threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,
+ int threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,
"Background");
-
- cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
-
- viewport.setGlobalColourScheme(cs);
- }
- else
- {
- cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
+ viewport.setThreshold(threshold);
}
if (viewport.getConservationSelected())
{
-
- Alignment al = (Alignment) viewport.alignment;
- Conservation c = new Conservation("All",
- ResidueProperties.propHash, 3, al.getSequences(), 0,
- al.getWidth() - 1);
-
- c.calculate();
- c.verdict(false, viewport.ConsPercGaps);
-
- cs.setConservation(c);
-
cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel,
cs, "Background"));
}
- else
- {
- cs.setConservation(null);
- }
-
- cs.setConsensus(viewport.hconsensus);
}
viewport.setGlobalColourScheme(cs);
- if (viewport.getColourAppliesToAllGroups())
- {
- Vector groups = viewport.alignment.getGroups();
-
- for (int i = 0; i < groups.size(); i++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
-
- if (cs == null)
- {
- sg.cs = null;
- continue;
- }
-
- if (cs instanceof ClustalxColourScheme)
- {
- sg.cs = new ClustalxColourScheme(
- sg.getSequences(viewport.hiddenRepSequences),
- sg.getWidth());
- }
- else if (cs instanceof UserColourScheme)
- {
- sg.cs = new UserColourScheme(((UserColourScheme) cs).getColours());
- }
- else
- {
- try
- {
- sg.cs = (ColourSchemeI) cs.getClass().newInstance();
- } catch (Exception ex)
- {
- }
- }
-
- if (viewport.getAbovePIDThreshold()
- || cs instanceof PIDColourScheme
- || cs instanceof Blosum62ColourScheme)
- {
- sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
-
- sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(viewport.hiddenRepSequences),
- sg.getStartRes(), sg.getEndRes() + 1));
- }
- else
- {
- sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
- }
-
- if (viewport.getConservationSelected())
- {
- Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3,
- sg.getSequences(viewport.hiddenRepSequences),
- sg.getStartRes(), sg.getEndRes() + 1);
- c.calculate();
- c.verdict(false, viewport.ConsPercGaps);
- sg.cs.setConservation(c);
- }
- else
- {
- sg.cs.setConservation(null);
- }
- }
- }
-
- if (alignPanel.getOverviewPanel() != null)
- {
- alignPanel.getOverviewPanel().updateOverviewImage();
- }
-
alignPanel.paintAlignment(true);
}
@@ -3116,10 +3525,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void modifyPID_actionPerformed(ActionEvent e)
{
if (viewport.getAbovePIDThreshold()
- && viewport.globalColourScheme != null)
+ && viewport.getGlobalColourScheme() != null)
{
SliderPanel.setPIDSliderSource(alignPanel,
viewport.getGlobalColourScheme(), "Background");
@@ -3133,13 +3543,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void modifyConservation_actionPerformed(ActionEvent e)
{
if (viewport.getConservationSelected()
- && viewport.globalColourScheme != null)
+ && viewport.getGlobalColourScheme() != null)
{
SliderPanel.setConservationSlider(alignPanel,
- viewport.globalColourScheme, "Background");
+ viewport.getGlobalColourScheme(), "Background");
SliderPanel.showConservationSlider();
}
}
@@ -3150,6 +3561,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void conservationMenuItem_actionPerformed(ActionEvent e)
{
viewport.setConservationSelected(conservationMenuItem.isSelected());
@@ -3168,6 +3580,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void abovePIDThreshold_actionPerformed(ActionEvent e)
{
viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());
@@ -3186,9 +3599,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void userDefinedColour_actionPerformed(ActionEvent e)
{
- if (e.getActionCommand().equals("User Defined..."))
+ if (e.getActionCommand().equals(
+ MessageManager.getString("action.user_defined")))
{
new UserDefinedColours(alignPanel, null);
}
@@ -3205,8 +3620,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
Component[] menuItems = colourMenu.getMenuComponents();
- int i, iSize = menuItems.length;
- for (i = 0; i < iSize; i++)
+ int iSize = menuItems.length;
+ for (int i = 0; i < iSize; i++)
{
if (menuItems[i].getName() != null
&& menuItems[i].getName().equals("USER_DEFINED"))
@@ -3227,6 +3642,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
radioItem.setName("USER_DEFINED");
radioItem.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent evt)
{
if (evt.isControlDown()
@@ -3236,8 +3652,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
int option = JOptionPane.showInternalConfirmDialog(
jalview.gui.Desktop.desktop,
- "Remove from default list?",
- "Remove user defined colour",
+ MessageManager
+ .getString("label.remove_from_default_list"),
+ MessageManager
+ .getString("label.remove_user_defined_colour"),
JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION)
{
@@ -3249,6 +3667,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
radioItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
userDefinedColour_actionPerformed(evt);
@@ -3260,6 +3679,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
});
radioItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
userDefinedColour_actionPerformed(evt);
@@ -3278,6 +3698,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void PIDColour_actionPerformed(ActionEvent e)
{
changeColour(new PIDColourScheme());
@@ -3289,6 +3710,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void BLOSUM62Colour_actionPerformed(ActionEvent e)
{
changeColour(new Blosum62ColourScheme());
@@ -3300,13 +3722,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByPID(viewport.getAlignment(), viewport
.getAlignment().getSequenceAt(0), null);
addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
@@ -3316,11 +3739,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void sortIDMenuItem_actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByID(viewport.getAlignment());
- addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.alignment));
+ addHistoryItem(new OrderCommand("ID Sort", oldOrder,
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
@@ -3330,12 +3755,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void sortLengthMenuItem_actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByLength(viewport.getAlignment());
addHistoryItem(new OrderCommand("Length Sort", oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
@@ -3345,12 +3771,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void sortGroupMenuItem_actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByGroup(viewport.getAlignment());
addHistoryItem(new OrderCommand("Group Sort", oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
@@ -3361,6 +3788,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
{
new RedundancyPanel(alignPanel, this);
@@ -3372,20 +3800,24 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
{
if ((viewport.getSelectionGroup() == null)
|| (viewport.getSelectionGroup().getSize() < 2))
{
- JOptionPane.showInternalMessageDialog(this,
- "You must select at least 2 sequences.", "Invalid Selection",
+ JOptionPane.showInternalMessageDialog(this, MessageManager
+ .getString("label.you_must_select_least_two_sequences"),
+ MessageManager.getString("label.invalid_selection"),
JOptionPane.WARNING_MESSAGE);
}
else
{
JInternalFrame frame = new JInternalFrame();
frame.setContentPane(new PairwiseAlignPanel(viewport));
- Desktop.addInternalFrame(frame, "Pairwise Alignment", 600, 500);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("action.pairwise_alignment"), 600,
+ 500);
}
}
@@ -3395,6 +3827,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void PCAMenuItem_actionPerformed(ActionEvent e)
{
if (((viewport.getSelectionGroup() != null)
@@ -3402,11 +3835,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
.getSelectionGroup().getSize() > 0))
|| (viewport.getAlignment().getHeight() < 4))
{
- JOptionPane.showInternalMessageDialog(this,
- "Principal component analysis must take\n"
- + "at least 4 input sequences.",
- "Sequence selection insufficient",
- JOptionPane.WARNING_MESSAGE);
+ JOptionPane
+ .showInternalMessageDialog(
+ this,
+ MessageManager
+ .getString("label.principal_component_analysis_must_take_least_four_input_sequences"),
+ MessageManager
+ .getString("label.sequence_selection_insufficient"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
@@ -3414,6 +3850,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
new PCAPanel(alignPanel);
}
+ @Override
public void autoCalculate_actionPerformed(ActionEvent e)
{
viewport.autoCalculateConsensus = autoCalculate.isSelected();
@@ -3423,6 +3860,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
.getAlignment().getSequences());
}
}
+
+ @Override
public void sortByTreeOption_actionPerformed(ActionEvent e)
{
viewport.sortByTree = sortByTree.isSelected();
@@ -3433,15 +3872,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
viewport.followSelection = listenToViewSelections.isSelected();
}
+
/**
* DOCUMENT ME!
*
* @param e
* DOCUMENT ME!
*/
+ @Override
public void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)
{
- NewTreePanel("AV", "PID", "Average distance tree using PID");
+ newTreePanel("AV", "PID", "Average distance tree using PID");
}
/**
@@ -3450,9 +3891,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
{
- NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
+ newTreePanel("NJ", "PID", "Neighbour joining tree using PID");
}
/**
@@ -3461,9 +3903,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)
{
- NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
+ newTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
}
/**
@@ -3472,9 +3915,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)
{
- NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
+ newTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
}
/**
@@ -3487,38 +3931,40 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param title
* DOCUMENT ME!
*/
- void NewTreePanel(String type, String pwType, String title)
+ void newTreePanel(String type, String pwType, String title)
{
TreePanel tp;
- if (viewport.getSelectionGroup() != null)
+ if (viewport.getSelectionGroup() != null
+ && viewport.getSelectionGroup().getSize() > 0)
{
if (viewport.getSelectionGroup().getSize() < 3)
{
JOptionPane
.showMessageDialog(
Desktop.desktop,
- "You need to have more than two sequences selected to build a tree!",
- "Not enough sequences", JOptionPane.WARNING_MESSAGE);
+ MessageManager
+ .getString("label.you_need_more_two_sequences_selected_build_tree"),
+ MessageManager
+ .getString("label.not_enough_sequences"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
- int s = 0;
SequenceGroup sg = viewport.getSelectionGroup();
/* Decide if the selection is a column region */
- while (s < sg.getSize())
+ for (SequenceI _s : sg.getSequences())
{
- if (((SequenceI) sg.getSequences(null).elementAt(s++)).getLength() < sg
- .getEndRes())
+ if (_s.getLength() < sg.getEndRes())
{
JOptionPane
.showMessageDialog(
Desktop.desktop,
- "The selected region to create a tree may\nonly contain residues or gaps.\n"
- + "Try using the Pad function in the edit menu,\n"
- + "or one of the multiple sequence alignment web services.",
- "Sequences in selection are not aligned",
+ MessageManager
+ .getString("label.selected_region_to_tree_may_only_contain_residues_or_gaps"),
+ MessageManager
+ .getString("label.sequences_selection_not_aligned"),
JOptionPane.WARNING_MESSAGE);
return;
@@ -3531,21 +3977,21 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
else
{
// are the visible sequences aligned?
- if (!viewport.alignment.isAligned(false))
+ if (!viewport.getAlignment().isAligned(false))
{
JOptionPane
.showMessageDialog(
Desktop.desktop,
- "The sequences must be aligned before creating a tree.\n"
- + "Try using the Pad function in the edit menu,\n"
- + "or one of the multiple sequence alignment web services.",
- "Sequences not aligned",
+ MessageManager
+ .getString("label.sequences_must_be_aligned_before_creating_tree"),
+ MessageManager
+ .getString("label.sequences_not_aligned"),
JOptionPane.WARNING_MESSAGE);
return;
}
- if (viewport.alignment.getHeight() < 2)
+ if (viewport.getAlignment().getHeight() < 2)
{
return;
}
@@ -3576,10 +4022,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
public void addSortByOrderMenuItem(String title,
final AlignmentOrder order)
{
- final JMenuItem item = new JMenuItem("by " + title);
+ final JMenuItem item = new JMenuItem(MessageManager.formatMessage(
+ "action.by_title_param", new Object[] { title }));
sort.add(item);
item.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
@@ -3588,8 +4036,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// pointers
AlignmentSorter.sortBy(viewport.getAlignment(), order);
- addHistoryItem(new OrderCommand(order.getName(), oldOrder,
- viewport.alignment));
+ addHistoryItem(new OrderCommand(order.getName(), oldOrder, viewport
+ .getAlignment()));
alignPanel.paintAlignment(true);
}
@@ -3612,13 +4060,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
sort.add(item);
item.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByAnnotationScore(scoreLabel,
viewport.getAlignment());// ,viewport.getSelectionGroup());
addHistoryItem(new OrderCommand("Sort by " + scoreLabel, oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
});
@@ -3636,23 +4085,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* rebuilding in subsequence calls.
*
*/
+ @Override
public void buildSortByAnnotationScoresMenu()
{
- if (viewport.alignment.getAlignmentAnnotation() == null)
+ if (viewport.getAlignment().getAlignmentAnnotation() == null)
{
return;
}
- if (viewport.alignment.getAlignmentAnnotation().hashCode() != _annotationScoreVectorHash)
+ if (viewport.getAlignment().getAlignmentAnnotation().hashCode() != _annotationScoreVectorHash)
{
sortByAnnotScore.removeAll();
// almost certainly a quicker way to do this - but we keep it simple
Hashtable scoreSorts = new Hashtable();
AlignmentAnnotation aann[];
- Enumeration sq = viewport.alignment.getSequences().elements();
- while (sq.hasMoreElements())
+ for (SequenceI sqa : viewport.getAlignment().getSequences())
{
- aann = ((SequenceI) sq.nextElement()).getAnnotation();
+ aann = sqa.getAnnotation();
for (int i = 0; aann != null && i < aann.length; i++)
{
if (aann[i].hasScore() && aann[i].sequenceRef != null)
@@ -3670,7 +4119,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
sortByAnnotScore.setVisible(scoreSorts.size() > 0);
scoreSorts.clear();
- _annotationScoreVectorHash = viewport.alignment
+ _annotationScoreVectorHash = viewport.getAlignment()
.getAlignmentAnnotation().hashCode();
}
}
@@ -3687,25 +4136,54 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param title
* SortBy menu item title.
*/
+ @Override
public void buildTreeMenu()
{
+ calculateTree.removeAll();
+ // build the calculate menu
+
+ for (final String type : new String[] { "NJ", "AV" })
+ {
+ String treecalcnm = MessageManager.getString("label.tree_calc_"
+ + type.toLowerCase());
+ for (final String pwtype : ResidueProperties.scoreMatrices.keySet())
+ {
+ JMenuItem tm = new JMenuItem();
+ ScoreModelI sm = ResidueProperties.scoreMatrices.get(pwtype);
+ if (sm.isProtein() == !viewport.getAlignment().isNucleotide())
+ {
+ String smn = MessageManager.getStringOrReturn(
+ "label.score_model_", sm.getName());
+ final String title = MessageManager.formatMessage(
+ "label.treecalc_title", treecalcnm, smn);
+ tm.setText(title);//
+ tm.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ newTreePanel(type, pwtype, title);
+ }
+ });
+ calculateTree.add(tm);
+ }
+
+ }
+ }
sortByTreeMenu.removeAll();
- Vector comps = (Vector) PaintRefresher.components.get(viewport
+ List<Component> comps = PaintRefresher.components.get(viewport
.getSequenceSetId());
- Vector treePanels = new Vector();
- int i, iSize = comps.size();
- for (i = 0; i < iSize; i++)
+ List<TreePanel> treePanels = new ArrayList<TreePanel>();
+ for (Component comp : comps)
{
- if (comps.elementAt(i) instanceof TreePanel)
+ if (comp instanceof TreePanel)
{
- treePanels.add(comps.elementAt(i));
+ treePanels.add((TreePanel) comp);
}
}
- iSize = treePanels.size();
-
- if (iSize < 1)
+ if (treePanels.size() < 1)
{
sortByTreeMenu.setVisible(false);
return;
@@ -3713,18 +4191,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
sortByTreeMenu.setVisible(true);
- for (i = 0; i < treePanels.size(); i++)
+ for (final TreePanel tp : treePanels)
{
- final TreePanel tp = (TreePanel) treePanels.elementAt(i);
final JMenuItem item = new JMenuItem(tp.getTitle());
- final NJTree tree = ((TreePanel) treePanels.elementAt(i)).getTree();
item.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- tp.sortByTree_actionPerformed(null);
+ tp.sortByTree_actionPerformed();
addHistoryItem(tp.sortAlignmentIn(alignPanel));
-
+
}
});
@@ -3739,7 +4216,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (undoname != null)
{
addHistoryItem(new OrderCommand(undoname, oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
}
alignPanel.paintAlignment(true);
return true;
@@ -3769,16 +4246,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
*/
msa = viewport.getAlignmentView(true);
}
+ else if (viewport.getSelectionGroup() != null
+ && viewport.getSelectionGroup().getSize() == 1)
+ {
+ int option = JOptionPane.showConfirmDialog(this,
+ MessageManager.getString("warn.oneseq_msainput_selection"),
+ MessageManager.getString("label.invalid_selection"),
+ JOptionPane.OK_CANCEL_OPTION);
+ if (option == JOptionPane.OK_OPTION)
+ {
+ msa = viewport.getAlignmentView(false);
+ }
+ }
else
{
- /*
- * Vector seqs = viewport.getAlignment().getSequences();
- *
- * if (seqs.size() > 1) { msa = new SequenceI[seqs.size()];
- *
- * for (int i = 0; i < seqs.size(); i++) { msa[i] = (SequenceI)
- * seqs.elementAt(i); } }
- */
msa = viewport.getAlignmentView(false);
}
return msa;
@@ -3806,12 +4287,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
// limit sequences - JBPNote in future - could spawn multiple prediction
// jobs
- // TODO: viewport.alignment.isAligned is a global state - the local
+ // TODO: viewport.getAlignment().isAligned is a global state - the local
// selection may well be aligned - we preserve 2.0.8 behaviour for moment.
- if (!viewport.alignment.isAligned(false))
+ if (!viewport.getAlignment().isAligned(false))
{
- seqs.setSequences(new SeqCigar[]
- { seqs.getSequences()[0] });
+ seqs.setSequences(new SeqCigar[] { seqs.getSequences()[0] });
// TODO: if seqs.getSequences().length>1 then should really have warned
// user!
@@ -3825,14 +4305,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @param e
* DOCUMENT ME!
*/
- protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
+ @Override
+ protected void loadTreeMenuItem_actionPerformed(ActionEvent e)
{
// Pick the tree file
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Select a newick-like tree file");
- chooser.setToolTipText("Load a tree file");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.select_newick_like_tree_file"));
+ chooser.setToolTipText(MessageManager.getString("label.load_tree_file"));
int value = chooser.showOpenDialog(null);
@@ -3847,19 +4329,31 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
viewport.setCurrentTree(ShowNewickTree(fin, choice).getTree());
} catch (Exception ex)
{
- JOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(),
- "Problem reading tree file", JOptionPane.WARNING_MESSAGE);
+ JOptionPane
+ .showMessageDialog(
+ Desktop.desktop,
+ ex.getMessage(),
+ MessageManager
+ .getString("label.problem_reading_tree_file"),
+ JOptionPane.WARNING_MESSAGE);
ex.printStackTrace();
}
if (fin != null && fin.hasWarningMessage())
{
- JOptionPane.showMessageDialog(Desktop.desktop,
- fin.getWarningMessage(), "Possible problem with tree file",
+ JOptionPane.showMessageDialog(Desktop.desktop, fin
+ .getWarningMessage(), MessageManager
+ .getString("label.possible_problem_with_tree_file"),
JOptionPane.WARNING_MESSAGE);
}
}
}
+ @Override
+ protected void tcoffeeColorScheme_actionPerformed(ActionEvent e)
+ {
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
+ }
+
public TreePanel ShowNewickTree(NewickFile nf, String title)
{
return ShowNewickTree(nf, title, 600, 500, 4, 5);
@@ -3944,18 +4438,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
} catch (Exception e)
{
}
- ;
}
final AlignFrame me = this;
buildingMenu = true;
new Thread(new Runnable()
{
+ @Override
public void run()
{
+ final List<JMenuItem> legacyItems = new ArrayList<JMenuItem>();
try
{
- System.err.println("Building ws menu again "
- + Thread.currentThread());
+ // System.err.println("Building ws menu again "
+ // + Thread.currentThread());
// TODO: add support for context dependent disabling of services based
// on
// alignment and current selection
@@ -3966,45 +4461,38 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// TODO: group services by location as well as function and/or
// introduce
// object broker mechanism.
- final Vector wsmenu = new Vector();
+ final Vector<JMenu> wsmenu = new Vector<JMenu>();
final IProgressIndicator af = me;
final JMenu msawsmenu = new JMenu("Alignment");
final JMenu secstrmenu = new JMenu(
"Secondary Structure Prediction");
- final JMenu seqsrchmenu = new JMenu(
- "Sequence Database Search");
- final JMenu analymenu = new JMenu(
- "Analysis");
- // JAL-940 - only show secondary structure prediction services from the legacy server
+ final JMenu seqsrchmenu = new JMenu("Sequence Database Search");
+ final JMenu analymenu = new JMenu("Analysis");
+ final JMenu dismenu = new JMenu("Protein Disorder");
+ // final JMenu msawsmenu = new
+ // JMenu(MessageManager.getString("label.alignment"));
+ // final JMenu secstrmenu = new
+ // JMenu(MessageManager.getString("label.secondary_structure_prediction"));
+ // final JMenu seqsrchmenu = new
+ // JMenu(MessageManager.getString("label.sequence_database_search"));
+ // final JMenu analymenu = new
+ // JMenu(MessageManager.getString("label.analysis"));
+ // final JMenu dismenu = new
+ // JMenu(MessageManager.getString("label.protein_disorder"));
+ // JAL-940 - only show secondary structure prediction services from
+ // the legacy server
if (// Cache.getDefault("SHOW_JWS1_SERVICES", true)
- // &&
- Discoverer.services != null
- && (Discoverer.services.size() > 0))
+ // &&
+ Discoverer.services != null && (Discoverer.services.size() > 0))
{
// TODO: refactor to allow list of AbstractName/Handler bindings to
// be
// stored or retrieved from elsewhere
- Vector msaws = null; // (Vector) Discoverer.services.get("MsaWS");
+ // No MSAWS used any more:
+ // Vector msaws = null; // (Vector)
+ // Discoverer.services.get("MsaWS");
Vector secstrpr = (Vector) Discoverer.services
.get("SecStrPred");
- Vector seqsrch = null; // (Vector) Discoverer.services.get("SeqSearch");
- // TODO: move GUI generation code onto service implementation - so a
- // client instance attaches itself to the GUI with method call like
- // jalview.ws.MsaWSClient.bind(servicehandle, Desktop.instance,
- // alignframe)
- if (msaws != null)
- {
- // Add any Multiple Sequence Alignment Services
- for (int i = 0, j = msaws.size(); i < j; i++)
- {
- final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) msaws
- .get(i);
- jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer
- .getServiceClient(sh);
- impl.attachWSMenuEntry(msawsmenu, me);
-
- }
- }
if (secstrpr != null)
{
// Add any secondary structure prediction services
@@ -4014,44 +4502,29 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
.get(i);
jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer
.getServiceClient(sh);
+ int p = secstrmenu.getItemCount();
impl.attachWSMenuEntry(secstrmenu, me);
- }
- }
- if (seqsrch != null)
- {
- // Add any sequence search services
- for (int i = 0, j = seqsrch.size(); i < j; i++)
- {
- final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) seqsrch
- .elementAt(i);
- jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer
- .getServiceClient(sh);
- impl.attachWSMenuEntry(seqsrchmenu, me);
+ int q = secstrmenu.getItemCount();
+ for (int litm = p; litm < q; litm++)
+ {
+ legacyItems.add(secstrmenu.getItem(litm));
+ }
}
}
}
- // TODO: move into separate menu builder class.
- if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
- {
- Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer();
- if (jws2servs != null)
- {
- if (jws2servs.hasServices())
- {
- jws2servs.attachWSMenuEntry(msawsmenu, me);
- }
- }
- }
- // Add all submenus in the order they should appear on the web services menu
+ // Add all submenus in the order they should appear on the web
+ // services menu
wsmenu.add(msawsmenu);
wsmenu.add(secstrmenu);
+ wsmenu.add(dismenu);
wsmenu.add(analymenu);
// No search services yet
// wsmenu.add(seqsrchmenu);
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
try
@@ -4062,33 +4535,74 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
for (int i = 0, j = wsmenu.size(); i < j; i++)
{
- webService.add((JMenu) wsmenu.get(i));
+ webService.add(wsmenu.get(i));
}
}
else
{
webService.add(me.webServiceNoServices);
}
+ // TODO: move into separate menu builder class.
+ boolean new_sspred = false;
+ if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
+ {
+ Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer();
+ if (jws2servs != null)
+ {
+ if (jws2servs.hasServices())
+ {
+ jws2servs.attachWSMenuEntry(webService, me);
+ for (Jws2Instance sv : jws2servs.getServices())
+ {
+ if (sv.description.toLowerCase().contains("jpred"))
+ {
+ for (JMenuItem jmi : legacyItems)
+ {
+ jmi.setVisible(false);
+ }
+ }
+ }
+
+ }
+ if (jws2servs.isRunning())
+ {
+ JMenuItem tm = new JMenuItem(
+ "Still discovering JABA Services");
+ tm.setEnabled(false);
+ webService.add(tm);
+ }
+ }
+ }
build_urlServiceMenu(me.webService);
build_fetchdbmenu(webService);
+ for (JMenu item : wsmenu)
+ {
+ if (item.getItemCount() == 0)
+ {
+ item.setEnabled(false);
+ }
+ else
+ {
+ item.setEnabled(true);
+ }
+ }
} catch (Exception e)
{
+ Cache.log
+ .debug("Exception during web service menu building process.",
+ e);
}
- ;
}
});
} catch (Exception e)
{
}
- ;
-
buildingMenu = false;
}
}).start();
}
-
/**
* construct any groupURL type service menu entries.
*
@@ -4103,8 +4617,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* AlignFrame af = this; testAlView.addActionListener(new ActionListener() {
*
* @Override public void actionPerformed(ActionEvent e) {
- * jalview.datamodel.AlignmentView.testSelectionViews(af.viewport.alignment,
- * af.viewport.colSel, af.viewport.selectionGroup); }
+ * jalview.datamodel.AlignmentView
+ * .testSelectionViews(af.viewport.getAlignment(),
+ * af.viewport.getColumnSelection(), af.viewport.selectionGroup); }
*
* }); webService.add(testAlView);
*/
@@ -4112,15 +4627,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// rest-style services with other types of analysis/calculation service
// SHmmr test client - still being implemented.
// DEBUG - alignmentView
-
- for (jalview.ws.rest.RestClient client: jalview.ws.rest.RestClient.getRestClients()) {
- client.attachWSMenuEntry(JvSwingUtils.findOrCreateMenu(webService, client.getAction()), this);
- }
- if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
+ for (jalview.ws.rest.RestClient client : jalview.ws.rest.RestClient
+ .getRestClients())
{
- jalview.ws.EnfinEnvision2OneWay.getInstance().attachWSMenuEntry(
- webService, this);
+ client.attachWSMenuEntry(
+ JvSwingUtils.findOrCreateMenu(webService, client.getAction()),
+ this);
}
}
@@ -4191,10 +4704,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
xtype.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
// TODO: new thread for this call with vis-delay
- af.showProductsFor(af.viewport.getSequenceSelection(), ds,
+ af.showProductsFor(af.viewport.getSequenceSelection(),
isRegSel, dna, source);
}
@@ -4213,29 +4727,26 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
return showp;
}
- protected void showProductsFor(SequenceI[] sel, Alignment ds,
- boolean isRegSel, boolean dna, String source)
+ protected void showProductsFor(final SequenceI[] sel,
+ final boolean isRegSel, final boolean dna, final String source)
{
- final boolean fisRegSel = isRegSel;
- final boolean fdna = dna;
- final String fsrc = source;
- final AlignFrame ths = this;
- final SequenceI[] fsel = sel;
Runnable foo = new Runnable()
{
+ @Override
public void run()
{
final long sttime = System.currentTimeMillis();
- ths.setProgressBar("Searching for sequences from " + fsrc, sttime);
+ AlignFrame.this.setProgressBar(MessageManager.formatMessage(
+ "status.searching_for_sequences_from",
+ new Object[] { source }), sttime);
try
{
- Alignment ds = ths.getViewport().alignment.getDataset(); // update
- // our local
- // dataset
- // reference
+ // update our local dataset reference
+ Alignment ds = AlignFrame.this.getViewport().getAlignment()
+ .getDataset();
Alignment prods = CrossRef
- .findXrefSequences(fsel, fdna, fsrc, ds);
+ .findXrefSequences(sel, dna, source, ds);
if (prods != null)
{
SequenceI[] sprods = new SequenceI[prods.getHeight()];
@@ -4245,29 +4756,81 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (ds.getSequences() == null
|| !ds.getSequences().contains(
sprods[s].getDatasetSequence()))
+ {
ds.addSequence(sprods[s].getDatasetSequence());
+ }
sprods[s].updatePDBIds();
}
Alignment al = new Alignment(sprods);
- AlignedCodonFrame[] cf = prods.getCodonFrames();
al.setDataset(ds);
- for (int s = 0; cf != null && s < cf.length; s++)
+
+ /*
+ * Copy dna-to-protein mappings to new alignment
+ */
+ // TODO 1: no mappings are set up for EMBL product
+ // TODO 2: if they were, should add them to protein alignment, not
+ // dna
+ Set<AlignedCodonFrame> cf = prods.getCodonFrames();
+ for (AlignedCodonFrame acf : cf)
{
- al.addCodonFrame(cf[s]);
- cf[s] = null;
+ al.addCodonFrame(acf);
}
AlignFrame naf = new AlignFrame(al, DEFAULT_WIDTH,
DEFAULT_HEIGHT);
- String newtitle = "" + ((fdna) ? "Proteins " : "Nucleotides ")
- + " for " + ((fisRegSel) ? "selected region of " : "")
+ String newtitle = "" + ((dna) ? "Proteins" : "Nucleotides")
+ + " for " + ((isRegSel) ? "selected region of " : "")
+ getTitle();
- Desktop.addInternalFrame(naf, newtitle, DEFAULT_WIDTH,
- DEFAULT_HEIGHT);
+ naf.setTitle(newtitle);
+
+ // temporary flag until SplitFrame is released
+ boolean asSplitFrame = Cache.getDefault(
+ Preferences.ENABLE_SPLIT_FRAME, true);
+ if (asSplitFrame)
+ {
+ /*
+ * Make a copy of this alignment (sharing the same dataset
+ * sequences). If we are DNA, drop introns and update mappings
+ */
+ AlignmentI copyAlignment = null;
+ final SequenceI[] sequenceSelection = AlignFrame.this.viewport
+ .getSequenceSelection();
+ if (dna)
+ {
+ copyAlignment = AlignmentUtils.makeExonAlignment(
+ sequenceSelection, cf);
+ al.getCodonFrames().clear();
+ al.getCodonFrames().addAll(cf);
+ final StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
+ ssm.registerMappings(cf);
+ }
+ else
+ {
+ copyAlignment = new Alignment(new Alignment(
+ sequenceSelection));
+ }
+ AlignFrame copyThis = new AlignFrame(copyAlignment,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ copyThis.setTitle(AlignFrame.this.getTitle());
+ // SplitFrame with dna above, protein below
+ SplitFrame sf = new SplitFrame(dna ? copyThis : naf,
+ dna ? naf : copyThis);
+ naf.setVisible(true);
+ copyThis.setVisible(true);
+ String linkedTitle = MessageManager
+ .getString("label.linked_view_title");
+ Desktop.addInternalFrame(sf, linkedTitle, -1, -1);
+ }
+ else
+ {
+ Desktop.addInternalFrame(naf, newtitle, DEFAULT_WIDTH,
+ DEFAULT_HEIGHT);
+ }
}
else
{
System.err.println("No Sequences generated for xRef type "
- + fsrc);
+ + source);
}
} catch (Exception e)
{
@@ -4281,8 +4844,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
jalview.bin.Cache.log.error("Error when finding crossreferences",
e);
}
- ths.setProgressBar("Finished searching for sequences from " + fsrc,
- sttime);
+ AlignFrame.this.setProgressBar(MessageManager.formatMessage(
+ "status.finished_searching_for_sequences_from",
+ new Object[] { source }), sttime);
}
};
@@ -4307,73 +4871,70 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
}
- public void showProducts_actionPerformed(ActionEvent e)
+ /**
+ * Construct and display a new frame containing the translation of this
+ * frame's DNA sequences to their aligned protein (amino acid) equivalents.
+ */
+ @Override
+ public void showTranslation_actionPerformed(ActionEvent e)
{
- // /////////////////////////////
- // Collect Data to be translated/transferred
-
- SequenceI[] selection = viewport.getSequenceSelection();
AlignmentI al = null;
try
{
- al = jalview.analysis.Dna.CdnaTranslate(selection, viewport
- .getViewAsVisibleContigs(true), viewport.getGapCharacter(),
- viewport.getAlignment().getDataset());
+ Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true));
+
+ al = dna.translateCdna();
} catch (Exception ex)
{
- al = null;
- jalview.bin.Cache.log.debug("Exception during translation.", ex);
+ jalview.bin.Cache.log.error(
+ "Exception during translation. Please report this !", ex);
+ final String msg = MessageManager
+ .getString("label.error_when_translating_sequences_submit_bug_report");
+ final String errorTitle = MessageManager
+ .getString("label.implementation_error")
+ + MessageManager.getString("translation_failed");
+ JOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle,
+ JOptionPane.ERROR_MESSAGE);
+ return;
}
- if (al == null)
+ if (al == null || al.getHeight() == 0)
{
- JOptionPane
- .showMessageDialog(
- Desktop.desktop,
- "Please select at least three bases in at least one sequence in order to perform a cDNA translation.",
- "Translation Failed", JOptionPane.WARNING_MESSAGE);
+ final String msg = MessageManager
+ .getString("label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation");
+ final String errorTitle = MessageManager
+ .getString("label.translation_failed");
+ JOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle,
+ JOptionPane.WARNING_MESSAGE);
}
else
{
AlignFrame af = new AlignFrame(al, DEFAULT_WIDTH, DEFAULT_HEIGHT);
- Desktop.addInternalFrame(af, "Translation of " + this.getTitle(),
- DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ af.setFileFormat(this.currentFileFormat);
+ final String newTitle = MessageManager.formatMessage(
+ "label.translation_of_params",
+ new Object[] { this.getTitle() });
+ af.setTitle(newTitle);
+ if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
+ {
+ final SequenceI[] seqs = viewport.getSelectionAsNewSequence();
+ viewport.openSplitFrame(af, new Alignment(seqs));
+ }
+ else
+ {
+ Desktop.addInternalFrame(af, newTitle, DEFAULT_WIDTH,
+ DEFAULT_HEIGHT);
+ }
}
}
- public void showTranslation_actionPerformed(ActionEvent e)
+ /**
+ * Set the file format
+ *
+ * @param fileFormat
+ */
+ public void setFileFormat(String fileFormat)
{
- // /////////////////////////////
- // Collect Data to be translated/transferred
-
- SequenceI[] selection = viewport.getSequenceSelection();
- String[] seqstring = viewport.getViewAsString(true);
- AlignmentI al = null;
- try
- {
- al = jalview.analysis.Dna.CdnaTranslate(selection, seqstring,
- viewport.getViewAsVisibleContigs(true), viewport
- .getGapCharacter(), viewport.alignment
- .getAlignmentAnnotation(), viewport.alignment
- .getWidth(), viewport.getAlignment().getDataset());
- } catch (Exception ex)
- {
- al = null;
- jalview.bin.Cache.log.debug("Exception during translation.", ex);
- }
- if (al == null)
- {
- JOptionPane
- .showMessageDialog(
- Desktop.desktop,
- "Please select at least three bases in at least one sequence in order to perform a cDNA translation.",
- "Translation Failed", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- AlignFrame af = new AlignFrame(al, DEFAULT_WIDTH, DEFAULT_HEIGHT);
- Desktop.addInternalFrame(af, "Translation of " + this.getTitle(),
- DEFAULT_WIDTH, DEFAULT_HEIGHT);
- }
+ this.currentFileFormat = fileFormat;
}
/**
@@ -4383,58 +4944,50 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* contents or path to retrieve file
* @param type
* access mode of file (see jalview.io.AlignFile)
- * @return true if features file was parsed corectly.
+ * @return true if features file was parsed correctly.
*/
public boolean parseFeaturesFile(String file, String type)
{
- boolean featuresFile = false;
- try
- {
- featuresFile = new FeaturesFile(file, type)
- .parse(viewport.alignment.getDataset(),
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,
- false, jalview.bin.Cache.getDefault(
- "RELAXEDSEQIDMATCHING", false));
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
+ return avc.parseFeaturesFile(file, type,
+ jalview.bin.Cache.getDefault("RELAXEDSEQIDMATCHING", false));
+
+ }
- if (featuresFile)
+ @Override
+ public void refreshFeatureUI(boolean enableIfNecessary)
+ {
+ // note - currently this is only still here rather than in the controller
+ // because of the featureSettings hard reference that is yet to be
+ // abstracted
+ if (enableIfNecessary)
{
- viewport.showSequenceFeatures = true;
+ viewport.setShowSequenceFeatures(true);
showSeqFeatures.setSelected(true);
- if (alignPanel.seqPanel.seqCanvas.fr != null)
- {
- // update the min/max ranges where necessary
- alignPanel.seqPanel.seqCanvas.fr.findAllFeatures(true);
- }
- if (featureSettings != null)
- {
- featureSettings.setTableData();
- }
- alignPanel.paintAlignment(true);
}
- return featuresFile;
}
+ @Override
public void dragEnter(DropTargetDragEvent evt)
{
}
+ @Override
public void dragExit(DropTargetEvent evt)
{
}
+ @Override
public void dragOver(DropTargetDragEvent evt)
{
}
+ @Override
public void dropActionChanged(DropTargetDragEvent evt)
{
}
+ @Override
public void drop(DropTargetDropEvent evt)
{
Transferable t = evt.getTransferable();
@@ -4520,7 +5073,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
int l = 0, c = pdbfn.indexOf(".");
while (mtch == null && c != -1)
{
- do
+ do
{
l = c;
} while ((c = pdbfn.indexOf(".", l)) > l);
@@ -4544,8 +5097,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
if (type.equalsIgnoreCase("PDB"))
{
- filesmatched.add(new Object[]
- { file, protocol, mtch });
+ filesmatched.add(new Object[] { file, protocol, mtch });
continue;
}
}
@@ -4561,10 +5113,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
|| JOptionPane
.showConfirmDialog(
this,
- "Do you want to automatically associate the "
- + filesmatched.size()
- + " PDB files with sequences in the alignment that have the same name ?",
- "Automatically Associate PDB files by name",
+ MessageManager
+ .formatMessage(
+ "label.automatically_associate_pdb_files_with_sequences_same_name",
+ new Object[] { Integer
+ .valueOf(
+ filesmatched
+ .size())
+ .toString() }),
+ MessageManager
+ .getString("label.automatically_associate_pdb_files_by_name"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
{
@@ -4573,18 +5131,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// try and associate
// TODO: may want to set a standard ID naming formalism for
// associating PDB files which have no IDs.
- for (SequenceI toassoc: (SequenceI[])fm[2]) {
- PDBEntry pe = new AssociatePdbFileWithSeq()
- .associatePdbWithSeq((String) fm[0], (String) fm[1],
- toassoc, false);
- if (pe != null)
+ for (SequenceI toassoc : (SequenceI[]) fm[2])
{
- System.err
- .println("Associated file : " + ((String) fm[0])
- + " with "
- + toassoc.getDisplayId(true));
- assocfiles++;
- }
+ PDBEntry pe = new AssociatePdbFileWithSeq()
+ .associatePdbWithSeq((String) fm[0],
+ (String) fm[1], toassoc, false,
+ Desktop.instance);
+ if (pe != null)
+ {
+ System.err.println("Associated file : "
+ + ((String) fm[0]) + " with "
+ + toassoc.getDisplayId(true));
+ assocfiles++;
+ }
}
alignPanel.paintAlignment(true);
}
@@ -4597,10 +5156,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
"AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false) || JOptionPane
.showConfirmDialog(
this,
- "<html>Do you want to <em>ignore</em> the "
- + filesnotmatched.size()
- + " files whose names did not match any sequence IDs ?</html>",
- "Ignore unmatched dropped files ?",
+ "<html>"
+ + MessageManager
+ .formatMessage(
+ "label.ignore_unmatched_dropped_files_info",
+ new Object[] { Integer
+ .valueOf(
+ filesnotmatched
+ .size())
+ .toString() })
+ + "</html>",
+ MessageManager
+ .getString("label.ignore_unmatched_dropped_files"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION))
{
return;
@@ -4641,59 +5208,111 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// try to parse as annotation.
boolean isAnnotation = (format == null || format
.equalsIgnoreCase("PFAM")) ? new AnnotationFile()
- .readAnnotationFile(viewport.alignment, file, protocol)
- : false;
+ .annotateAlignmentView(viewport, file, protocol) : false;
if (!isAnnotation)
{
- // try to see if its a JNet 'concise' style annotation file *before* we
- // try to parse it as a features file
- if (format == null)
+ // first see if its a T-COFFEE score file
+ TCoffeeScoreFile tcf = null;
+ try
{
- format = new IdentifyFile().Identify(file, protocol);
- }
- if (format.equalsIgnoreCase("JnetFile"))
+ tcf = new TCoffeeScoreFile(file, protocol);
+ if (tcf.isValid())
+ {
+ if (tcf.annotateAlignment(viewport.getAlignment(), true))
+ {
+ tcoffeeColour.setEnabled(true);
+ tcoffeeColour.setSelected(true);
+ changeColour(new TCoffeeColourScheme(viewport.getAlignment()));
+ isAnnotation = true;
+ statusBar
+ .setText(MessageManager
+ .getString("label.successfully_pasted_tcoffee_scores_to_alignment"));
+ }
+ else
+ {
+ // some problem - if no warning its probable that the ID matching
+ // process didn't work
+ JOptionPane
+ .showMessageDialog(
+ Desktop.desktop,
+ tcf.getWarningMessage() == null ? MessageManager
+ .getString("label.check_file_matches_sequence_ids_alignment")
+ : tcf.getWarningMessage(),
+ MessageManager
+ .getString("label.problem_reading_tcoffee_score_file"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+ }
+ else
+ {
+ tcf = null;
+ }
+ } catch (Exception x)
{
- jalview.io.JPredFile predictions = new jalview.io.JPredFile(file,
- protocol);
- new JnetAnnotationMaker().add_annotation(predictions,
- viewport.getAlignment(), 0, false);
- isAnnotation = true;
+ Cache.log
+ .debug("Exception when processing data source as T-COFFEE score file",
+ x);
+ tcf = null;
}
- else
+ if (tcf == null)
{
- /*
- * if (format.equalsIgnoreCase("PDB")) {
- *
- * String pdbfn = ""; // try to match up filename with sequence id try
- * { if (protocol == jalview.io.FormatAdapter.FILE) { File fl = new
- * File(file); pdbfn = fl.getName(); } else if (protocol ==
- * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn =
- * url.getFile(); } } catch (Exception e) { } ; if (assocSeq == null)
- * { SequenceIdMatcher idm = new SequenceIdMatcher(viewport
- * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) { //
- * attempt to find a match in the alignment SequenceI mtch =
- * idm.findIdMatch(pdbfn); int l = 0, c = pdbfn.indexOf("."); while
- * (mtch == null && c != -1) { while ((c = pdbfn.indexOf(".", l)) > l)
- * { l = c; } if (l > -1) { pdbfn = pdbfn.substring(0, l); } mtch =
- * idm.findIdMatch(pdbfn); } if (mtch != null) { // try and associate
- * // prompt ? PDBEntry pe = new AssociatePdbFileWithSeq()
- * .associatePdbWithSeq(file, protocol, mtch, true); if (pe != null) {
- * System.err.println("Associated file : " + file + " with " +
- * mtch.getDisplayId(true)); alignPanel.paintAlignment(true); } } //
- * TODO: maybe need to load as normal otherwise return; } }
- */
+ // try to see if its a JNet 'concise' style annotation file *before*
+ // we
// try to parse it as a features file
- boolean isGroupsFile = parseFeaturesFile(file, protocol);
- // if it wasn't a features file then we just treat it as a general
- // alignment file to load into the current view.
- if (!isGroupsFile)
+ if (format == null)
+ {
+ format = new IdentifyFile().Identify(file, protocol);
+ }
+ if (format.equalsIgnoreCase("JnetFile"))
{
- new FileLoader().LoadFile(viewport, file, protocol, format);
+ jalview.io.JPredFile predictions = new jalview.io.JPredFile(
+ file, protocol);
+ new JnetAnnotationMaker();
+ JnetAnnotationMaker.add_annotation(predictions,
+ viewport.getAlignment(), 0, false);
+ SequenceI repseq = viewport.getAlignment().getSequenceAt(0);
+ viewport.getAlignment().setSeqrep(repseq);
+ ColumnSelection cs = new ColumnSelection();
+ cs.hideInsertionsFor(repseq);
+ viewport.setColumnSelection(cs);
+ isAnnotation = true;
}
else
{
- alignPanel.paintAlignment(true);
+ /*
+ * if (format.equalsIgnoreCase("PDB")) {
+ *
+ * String pdbfn = ""; // try to match up filename with sequence id
+ * try { if (protocol == jalview.io.FormatAdapter.FILE) { File fl =
+ * new File(file); pdbfn = fl.getName(); } else if (protocol ==
+ * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn =
+ * url.getFile(); } } catch (Exception e) { } ; if (assocSeq ==
+ * null) { SequenceIdMatcher idm = new SequenceIdMatcher(viewport
+ * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) {
+ * // attempt to find a match in the alignment SequenceI mtch =
+ * idm.findIdMatch(pdbfn); int l = 0, c = pdbfn.indexOf("."); while
+ * (mtch == null && c != -1) { while ((c = pdbfn.indexOf(".", l)) >
+ * l) { l = c; } if (l > -1) { pdbfn = pdbfn.substring(0, l); } mtch
+ * = idm.findIdMatch(pdbfn); } if (mtch != null) { // try and
+ * associate // prompt ? PDBEntry pe = new AssociatePdbFileWithSeq()
+ * .associatePdbWithSeq(file, protocol, mtch, true); if (pe != null)
+ * { System.err.println("Associated file : " + file + " with " +
+ * mtch.getDisplayId(true)); alignPanel.paintAlignment(true); } } //
+ * TODO: maybe need to load as normal otherwise return; } }
+ */
+ // try to parse it as a features file
+ boolean isGroupsFile = parseFeaturesFile(file, protocol);
+ // if it wasn't a features file then we just treat it as a general
+ // alignment file to load into the current view.
+ if (!isGroupsFile)
+ {
+ new FileLoader().LoadFile(viewport, file, protocol, format);
+ }
+ else
+ {
+ alignPanel.paintAlignment(true);
+ }
}
}
}
@@ -4708,30 +5327,74 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
} catch (Exception ex)
{
ex.printStackTrace();
+ } catch (OutOfMemoryError oom)
+ {
+ try
+ {
+ System.gc();
+ } catch (Exception x)
+ {
+ }
+ ;
+ new OOMWarning(
+ "loading data "
+ + (protocol != null ? (protocol.equals(FormatAdapter.PASTE) ? "from clipboard."
+ : "using " + protocol + " from " + file)
+ : ".")
+ + (format != null ? "(parsing as '" + format
+ + "' file)" : ""), oom, Desktop.desktop);
}
}
+ /**
+ * Method invoked by the ChangeListener on the tabbed pane, in other words
+ * when a different tabbed pane is selected by the user or programmatically.
+ */
+ @Override
public void tabSelectionChanged(int index)
{
if (index > -1)
{
- alignPanel = (AlignmentPanel) alignPanels.elementAt(index);
+ alignPanel = alignPanels.get(index);
viewport = alignPanel.av;
+ avc.setViewportAndAlignmentPanel(viewport, alignPanel);
setMenusFromViewport(viewport);
}
+
+ /*
+ * If there is a frame linked to this one in a SplitPane, switch it to the
+ * same view tab index. No infinite recursion of calls should happen, since
+ * tabSelectionChanged() should not get invoked on setting the selected
+ * index to an unchanged value. Guard against setting an invalid index
+ * before the new view peer tab has been created.
+ */
+ final AlignViewportI peer = viewport.getCodingComplement();
+ if (peer != null)
+ {
+ AlignFrame linkedAlignFrame = ((AlignViewport) peer).getAlignPanel().alignFrame;
+ if (linkedAlignFrame.tabbedPane.getTabCount() > index)
+ {
+ linkedAlignFrame.tabbedPane.setSelectedIndex(index);
+ }
+ }
}
+ /**
+ * On right mouse click on view tab, prompt for and set new view name.
+ */
+ @Override
public void tabbedPane_mousePressed(MouseEvent e)
{
if (SwingUtilities.isRightMouseButton(e))
{
- String reply = JOptionPane.showInternalInputDialog(this,
- "Enter View Name", "Edit View Name",
+ String msg = MessageManager.getString("label.enter_view_name");
+ String reply = JOptionPane.showInternalInputDialog(this, msg, msg,
JOptionPane.QUESTION_MESSAGE);
if (reply != null)
{
viewport.viewName = reply;
+ // TODO warn if reply is in getExistingViewNames()?
tabbedPane.setTitleAt(tabbedPane.getSelectedIndex(), reply);
}
}
@@ -4745,10 +5408,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
/**
* Open the dialog for regex description parsing.
*/
+ @Override
protected void extractScores_actionPerformed(ActionEvent e)
{
ParseProperties pp = new jalview.analysis.ParseProperties(
- viewport.alignment);
+ viewport.getAlignment());
// TODO: verify regex and introduce GUI dialog for version 2.5
// if (pp.getScoresFromDescription("col", "score column ",
// "\\W*([-+]?\\d*\\.?\\d*e?-?\\d*)\\W+([-+]?\\d*\\.?\\d*e?-?\\d*)",
@@ -4767,9 +5431,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent
* )
*/
+ @Override
protected void showDbRefs_actionPerformed(ActionEvent e)
{
- viewport.setShowDbRefs(showDbRefsMenuitem.isSelected());
+ viewport.setShowDBRefs(showDbRefsMenuitem.isSelected());
}
/*
@@ -4778,9 +5443,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* @seejalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event.
* ActionEvent)
*/
+ @Override
protected void showNpFeats_actionPerformed(ActionEvent e)
{
- viewport.setShowNpFeats(showNpFeatsMenuitem.isSelected());
+ viewport.setShowNPFeats(showNpFeatsMenuitem.isSelected());
}
/**
@@ -4789,7 +5455,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
*
* @param av
*/
- public boolean closeView(AlignViewport av)
+ public boolean closeView(AlignViewportI av)
{
if (viewport == av)
{
@@ -4818,20 +5484,42 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// TODO We probably want to store a sequence database checklist in
// preferences and have checkboxes.. rather than individual sources selected
// here
- final JMenu rfetch = new JMenu("Fetch DB References");
- rfetch.setToolTipText("Retrieve and parse sequence database records for the alignment or the currently selected sequences");
+ final JMenu rfetch = new JMenu(
+ MessageManager.getString("action.fetch_db_references"));
+ rfetch.setToolTipText(MessageManager
+ .getString("label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences"));
webService.add(rfetch);
- JMenuItem fetchr = new JMenuItem("Standard Databases");
- fetchr.setToolTipText("Fetch from EMBL/EMBLCDS or Uniprot/PDB and any selected DAS sources");
+ final JCheckBoxMenuItem trimrs = new JCheckBoxMenuItem(
+ MessageManager.getString("option.trim_retrieved_seqs"));
+ trimrs.setToolTipText(MessageManager
+ .getString("label.trim_retrieved_sequences"));
+ trimrs.setSelected(Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true));
+ trimrs.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ trimrs.setSelected(trimrs.isSelected());
+ Cache.setProperty("TRIM_FETCHED_DATASET_SEQS",
+ Boolean.valueOf(trimrs.isSelected()).toString());
+ };
+ });
+ rfetch.add(trimrs);
+ JMenuItem fetchr = new JMenuItem(
+ MessageManager.getString("label.standard_databases"));
+ fetchr.setToolTipText(MessageManager
+ .getString("label.fetch_embl_uniprot"));
fetchr.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
new Thread(new Runnable()
{
+ @Override
public void run()
{
new jalview.ws.DBRefFetcher(alignPanel.av
@@ -4847,43 +5535,61 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
final AlignFrame me = this;
new Thread(new Runnable()
{
+ @Override
public void run()
{
final jalview.ws.SequenceFetcher sf = SequenceFetcher
.getSequenceFetcherSingleton(me);
- final String[] otherdb = sf.getOrderedSupportedSources();
- // sf.getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
- // jalview.util.QuickSort.sort(otherdb, otherdb);
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
-
+ String[] dbclasses = sf.getOrderedSupportedSources();
+ // sf.getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
+ // jalview.util.QuickSort.sort(otherdb, otherdb);
+ List<DbSourceProxy> otherdb;
JMenu dfetch = new JMenu();
- JMenuItem fetchr;
- rfetch.add(dfetch);
- int comp = 0, mcomp = 15;
+ JMenu ifetch = new JMenu();
+ JMenuItem fetchr = null;
+ int comp = 0, icomp = 0, mcomp = 15;
String mname = null;
- if (otherdb != null && otherdb.length > 0)
+ int dbi = 0;
+ for (String dbclass : dbclasses)
{
- for (int i = 0; i < otherdb.length; i++)
+ otherdb = sf.getSourceProxy(dbclass);
+ // add a single entry for this class, or submenu allowing 'fetch
+ // all' or pick one
+ if (otherdb == null || otherdb.size() < 1)
{
- String dbname = sf.getSourceProxy(otherdb[i]).getDbName();
- if (mname == null)
- {
- mname = "from '" + dbname + "'";
- }
- fetchr = new JMenuItem(otherdb[i]);
- final String[] dassource = new String[]
- { otherdb[i] };
+ continue;
+ }
+ // List<DbSourceProxy> dbs=otherdb;
+ // otherdb=new ArrayList<DbSourceProxy>();
+ // for (DbSourceProxy db:dbs)
+ // {
+ // if (!db.isA(DBRefSource.ALIGNMENTDB)
+ // }
+ if (mname == null)
+ {
+ mname = "From " + dbclass;
+ }
+ if (otherdb.size() == 1)
+ {
+ final DbSourceProxy[] dassource = otherdb
+ .toArray(new DbSourceProxy[0]);
+ DbSourceProxy src = otherdb.get(0);
+ fetchr = new JMenuItem(src.getDbSource());
fetchr.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
new Thread(new Runnable()
{
+ @Override
public void run()
{
new jalview.ws.DBRefFetcher(alignPanel.av
@@ -4895,17 +5601,121 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
});
- fetchr.setToolTipText("Retrieve from " + dbname);
+ fetchr.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.formatMessage(
+ "label.fetch_retrieve_from",
+ new Object[] { src.getDbName() })));
+ dfetch.add(fetchr);
+ comp++;
+ }
+ else
+ {
+ final DbSourceProxy[] dassource = otherdb
+ .toArray(new DbSourceProxy[0]);
+ // fetch all entry
+ DbSourceProxy src = otherdb.get(0);
+ fetchr = new JMenuItem(MessageManager.formatMessage(
+ "label.fetch_all_param",
+ new Object[] { src.getDbSource() }));
+ fetchr.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new Thread(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ new jalview.ws.DBRefFetcher(alignPanel.av
+ .getSequenceSelection(),
+ alignPanel.alignFrame, dassource)
+ .fetchDBRefs(false);
+ }
+ }).start();
+ }
+ });
+
+ fetchr.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.formatMessage(
+ "label.fetch_retrieve_from_all_sources",
+ new Object[] {
+ Integer.valueOf(otherdb.size())
+ .toString(), src.getDbSource(),
+ src.getDbName() })));
dfetch.add(fetchr);
- if (comp++ == mcomp || i == (otherdb.length - 1))
+ comp++;
+ // and then build the rest of the individual menus
+ ifetch = new JMenu(MessageManager.formatMessage(
+ "label.source_from_db_source",
+ new Object[] { src.getDbSource() }));
+ icomp = 0;
+ String imname = null;
+ int i = 0;
+ for (DbSourceProxy sproxy : otherdb)
{
- dfetch.setText(mname + " to '" + dbname + "'");
- rfetch.add(dfetch);
- dfetch = new JMenu();
- mname = null;
- comp = 0;
+ String dbname = sproxy.getDbName();
+ String sname = dbname.length() > 5 ? dbname.substring(0,
+ 5) + "..." : dbname;
+ String msname = dbname.length() > 10 ? dbname.substring(
+ 0, 10) + "..." : dbname;
+ if (imname == null)
+ {
+ imname = MessageManager.formatMessage(
+ "label.from_msname", new Object[] { sname });
+ }
+ fetchr = new JMenuItem(msname);
+ final DbSourceProxy[] dassrc = { sproxy };
+ fetchr.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new Thread(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ new jalview.ws.DBRefFetcher(alignPanel.av
+ .getSequenceSelection(),
+ alignPanel.alignFrame, dassrc)
+ .fetchDBRefs(false);
+ }
+ }).start();
+ }
+
+ });
+ fetchr.setToolTipText("<html>"
+ + MessageManager.formatMessage(
+ "label.fetch_retrieve_from", new Object[]
+ { dbname }));
+ ifetch.add(fetchr);
+ ++i;
+ if (++icomp >= mcomp || i == (otherdb.size()))
+ {
+ ifetch.setText(MessageManager.formatMessage(
+ "label.source_to_target", imname, sname));
+ dfetch.add(ifetch);
+ ifetch = new JMenu();
+ imname = null;
+ icomp = 0;
+ comp++;
+ }
}
}
+ ++dbi;
+ if (comp >= mcomp || dbi >= (dbclasses.length))
+ {
+ dfetch.setText(MessageManager.formatMessage(
+ "label.source_to_target", mname, dbclass));
+ rfetch.add(dfetch);
+ dfetch = new JMenu();
+ mname = null;
+ comp = 0;
+ }
}
}
});
@@ -4917,6 +5727,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
/**
* Left justify the whole alignment.
*/
+ @Override
protected void justifyLeftMenuItem_actionPerformed(ActionEvent e)
{
AlignmentI al = viewport.getAlignment();
@@ -4927,6 +5738,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
/**
* Right justify the whole alignment.
*/
+ @Override
protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
{
AlignmentI al = viewport.getAlignment();
@@ -4936,8 +5748,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
public void setShowSeqFeatures(boolean b)
{
- showSeqFeatures.setSelected(true);
- viewport.setShowSequenceFeatures(true);
+ showSeqFeatures.setSelected(b);
+ viewport.setShowSequenceFeatures(b);
}
/*
@@ -4947,6 +5759,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#showUnconservedMenuItem_actionPerformed(java.
* awt.event.ActionEvent)
*/
+ @Override
protected void showUnconservedMenuItem_actionPerformed(ActionEvent e)
{
viewport.setShowUnconserved(showNonconservedMenuItem.getState());
@@ -4960,6 +5773,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#showGroupConsensus_actionPerformed(java.awt.event
* .ActionEvent)
*/
+ @Override
protected void showGroupConsensus_actionPerformed(ActionEvent e)
{
viewport.setShowGroupConsensus(showGroupConsensus.getState());
@@ -4974,6 +5788,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#showGroupConservation_actionPerformed(java.awt
* .event.ActionEvent)
*/
+ @Override
protected void showGroupConservation_actionPerformed(ActionEvent e)
{
viewport.setShowGroupConservation(showGroupConservation.getState());
@@ -4987,6 +5802,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt
* .event.ActionEvent)
*/
+ @Override
protected void showConsensusHistogram_actionPerformed(ActionEvent e)
{
viewport.setShowConsensusHistogram(showConsensusHistogram.getState());
@@ -5000,12 +5816,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt
* .event.ActionEvent)
*/
+ @Override
protected void showSequenceLogo_actionPerformed(ActionEvent e)
{
viewport.setShowSequenceLogo(showSequenceLogo.getState());
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
}
+ @Override
+ protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
+ {
+ showSequenceLogo.setState(true);
+ viewport.setShowSequenceLogo(true);
+ viewport.setNormaliseSequenceLogo(normaliseSequenceLogo.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ @Override
protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
{
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
@@ -5018,38 +5845,47 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
* jalview.jbgui.GAlignFrame#makeGrpsFromSelection_actionPerformed(java.awt
* .event.ActionEvent)
*/
+ @Override
protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
{
- if (viewport.getSelectionGroup() != null)
+ if (avc.makeGroupsFromSelection())
{
- SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
- viewport.getSequenceSelection(),
- viewport.getAlignmentView(true).getSequenceStrings(
- viewport.getGapCharacter()),
- viewport.alignment.getGroups());
- viewport.alignment.deleteAllGroups();
- viewport.sequenceColours = null;
- viewport.setSelectionGroup(null);
- // set view properties for each group
- for (int g = 0; g < gps.length; g++)
- {
- gps[g].setShowNonconserved(viewport.getShowUnconserved());
- gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
- viewport.alignment.addGroup(gps[g]);
- Color col = new Color((int) (Math.random() * 255),
- (int) (Math.random() * 255), (int) (Math.random() * 255));
- col = col.brighter();
- for (Enumeration sq = gps[g].getSequences(null).elements(); sq
- .hasMoreElements(); viewport.setSequenceColour(
- (SequenceI) sq.nextElement(), col))
- ;
- }
PaintRefresher.Refresh(this, viewport.getSequenceSetId());
alignPanel.updateAnnotation();
alignPanel.paintAlignment(true);
}
}
+ public void clearAlignmentSeqRep()
+ {
+ // TODO refactor alignmentseqrep to controller
+ if (viewport.getAlignment().hasSeqrep())
+ {
+ viewport.getAlignment().setSeqrep(null);
+ PaintRefresher.Refresh(this, viewport.getSequenceSetId());
+ alignPanel.updateAnnotation();
+ alignPanel.paintAlignment(true);
+ }
+ }
+
+ @Override
+ protected void createGroup_actionPerformed(ActionEvent e)
+ {
+ if (avc.createGroup())
+ {
+ alignPanel.alignmentChanged();
+ }
+ }
+
+ @Override
+ protected void unGroup_actionPerformed(ActionEvent e)
+ {
+ if (avc.unGroup())
+ {
+ alignPanel.alignmentChanged();
+ }
+ }
+
/**
* make the given alignmentPanel the currently selected tab
*
@@ -5061,14 +5897,136 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
alignmentPanel.av.getSequenceSetId()))
{
throw new Error(
- "Implementation error: cannot show a view from another alignment in an AlignFrame.");
+ MessageManager
+ .getString("error.implementation_error_cannot_show_view_alignment_frame"));
}
if (tabbedPane != null
- & alignPanels.indexOf(alignmentPanel) != tabbedPane.getSelectedIndex())
+ && tabbedPane.getTabCount() > 0
+ && alignPanels.indexOf(alignmentPanel) != tabbedPane
+ .getSelectedIndex())
{
tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel));
}
}
+
+ /**
+ * Action on selection of menu options to Show or Hide annotations.
+ *
+ * @param visible
+ * @param forSequences
+ * update sequence-related annotations
+ * @param forAlignment
+ * update non-sequence-related annotations
+ */
+ @Override
+ protected void setAnnotationsVisibility(boolean visible,
+ boolean forSequences, boolean forAlignment)
+ {
+ for (AlignmentAnnotation aa : alignPanel.getAlignment()
+ .getAlignmentAnnotation())
+ {
+ /*
+ * don't display non-positional annotations on an alignment
+ */
+ if (aa.annotations == null)
+ {
+ continue;
+ }
+ boolean apply = (aa.sequenceRef == null && forAlignment)
+ || (aa.sequenceRef != null && forSequences);
+ if (apply)
+ {
+ aa.visible = visible;
+ }
+ }
+ alignPanel.validateAnnotationDimensions(true);
+ alignPanel.alignmentChanged();
+ }
+
+ /**
+ * Store selected annotation sort order for the view and repaint.
+ */
+ @Override
+ protected void sortAnnotations_actionPerformed()
+ {
+ this.alignPanel.av.setSortAnnotationsBy(getAnnotationSortOrder());
+ this.alignPanel.av
+ .setShowAutocalculatedAbove(isShowAutoCalculatedAbove());
+ alignPanel.paintAlignment(true);
+ }
+
+ /**
+ *
+ * @return alignment panels in this alignment frame
+ */
+ public List<? extends AlignmentViewPanel> getAlignPanels()
+ {
+ return alignPanels == null ? Arrays.asList(alignPanel) : alignPanels;
+ }
+
+ /**
+ * Open a new alignment window, with the cDNA associated with this (protein)
+ * alignment, aligned as is the protein.
+ */
+ protected void viewAsCdna_actionPerformed()
+ {
+ // TODO no longer a menu action - refactor as required
+ final AlignmentI alignment = getViewport().getAlignment();
+ Set<AlignedCodonFrame> mappings = alignment.getCodonFrames();
+ if (mappings == null)
+ {
+ return;
+ }
+ List<SequenceI> cdnaSeqs = new ArrayList<SequenceI>();
+ for (SequenceI aaSeq : alignment.getSequences())
+ {
+ for (AlignedCodonFrame acf : mappings)
+ {
+ SequenceI dnaSeq = acf.getDnaForAaSeq(aaSeq.getDatasetSequence());
+ if (dnaSeq != null)
+ {
+ /*
+ * There is a cDNA mapping for this protein sequence - add to new
+ * alignment. It will share the same dataset sequence as other mapped
+ * cDNA (no new mappings need to be created).
+ */
+ final Sequence newSeq = new Sequence(dnaSeq);
+ newSeq.setDatasetSequence(dnaSeq);
+ cdnaSeqs.add(newSeq);
+ }
+ }
+ }
+ if (cdnaSeqs.size() == 0)
+ {
+ // show a warning dialog no mapped cDNA
+ return;
+ }
+ AlignmentI cdna = new Alignment(cdnaSeqs.toArray(new SequenceI[cdnaSeqs
+ .size()]));
+ AlignFrame alignFrame = new AlignFrame(cdna, AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+ cdna.alignAs(alignment);
+ String newtitle = "cDNA " + MessageManager.getString("label.for") + " "
+ + this.title;
+ Desktop.addInternalFrame(alignFrame, newtitle,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ }
+
+ /**
+ * Set visibility of dna/protein complement view (available when shown in a
+ * split frame).
+ *
+ * @param show
+ */
+ @Override
+ protected void showComplement_actionPerformed(boolean show)
+ {
+ SplitContainerI sf = getSplitViewContainer();
+ if (sf != null)
+ {
+ sf.setComplementVisible(this, show);
+ }
+ }
}
class PrintThread extends Thread
@@ -5082,6 +6040,7 @@ class PrintThread extends Thread
static PageFormat pf;
+ @Override
public void run()
{
PrinterJob printJob = PrinterJob.getPrinterJob();
diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java
index 13f66d9..8a95015 100644
--- a/src/jalview/gui/AlignViewport.java
+++ b/src/jalview/gui/AlignViewport.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
/*
* Jalview - A Sequence Alignment Editor and Viewer
@@ -35,21 +38,45 @@
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-
-import jalview.analysis.*;
-import jalview.api.StructureSelectionManagerProvider;
-
-import jalview.bin.*;
-
-import jalview.datamodel.*;
-
-import jalview.schemes.*;
+import jalview.analysis.AlignmentUtils;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.analysis.NJTree;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.ViewStyleI;
+import jalview.bin.Cache;
+import jalview.commands.CommandI;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.UserColourScheme;
+import jalview.structure.CommandListener;
import jalview.structure.SelectionSource;
import jalview.structure.StructureSelectionManager;
import jalview.structure.VamsasSource;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.ws.params.AutoCalcSetting;
+
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
/**
* DOCUMENT ME!
@@ -57,141 +84,31 @@ import jalview.structure.VamsasSource;
* @author $author$
* @version $Revision: 1.141 $
*/
-public class AlignViewport implements SelectionSource, VamsasSource
+public class AlignViewport extends AlignmentViewport implements
+ SelectionSource, CommandListener
{
- private static final int RIGHT_JUSTIFY = 1;
-
- int startRes;
-
- int endRes;
-
- int startSeq;
-
- int endSeq;
-
- boolean showJVSuffix = true;
-
- boolean showText = true;
-
- boolean showColourText = false;
-
- boolean showBoxes = true;
-
- boolean wrapAlignment = false;
-
- boolean renderGaps = true;
-
- boolean showSequenceFeatures = false;
-
- boolean showAnnotation = true;
-
- boolean colourAppliesToAllGroups = true;
-
- ColourSchemeI globalColourScheme = null;
-
- boolean conservationColourSelected = false;
-
- boolean abovePIDThreshold = false;
-
- SequenceGroup selectionGroup;
-
- int charHeight;
-
- int charWidth;
-
- boolean validCharWidth;
-
- int wrappedWidth;
-
Font font;
- boolean seqNameItalics;
-
- AlignmentI alignment;
-
- ColumnSelection colSel = new ColumnSelection();
-
- int threshold;
-
- int increment;
-
NJTree currentTree = null;
- boolean scaleAboveWrapped = false;
-
- boolean scaleLeftWrapped = true;
-
- boolean scaleRightWrapped = true;
-
- boolean hasHiddenColumns = false;
-
- boolean hasHiddenRows = false;
-
- boolean showHiddenMarkers = true;
-
boolean cursorMode = false;
- /**
- * Keys are the feature types which are currently visible. Note: Values are
- * not used!
- */
- Hashtable featuresDisplayed = null;
-
- /** DOCUMENT ME!! */
- public Hashtable[] hconsensus;
-
- AlignmentAnnotation consensus;
-
- AlignmentAnnotation conservation;
-
- AlignmentAnnotation quality;
-
- AlignmentAnnotation[] groupConsensus;
-
- AlignmentAnnotation[] groupConservation;
-
- boolean autoCalculateConsensus = true;
-
- /** DOCUMENT ME!! */
- public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
-
- // JBPNote Prolly only need this in the applet version.
- private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
- this);
-
- boolean ignoreGapsInConsensusCalculation = false;
-
- boolean isDataset = false;
-
boolean antiAlias = false;
- boolean padGaps = false;
-
- Rectangle explodedPosition;
+ private Rectangle explodedGeometry;
String viewName;
- String sequenceSetID;
-
- boolean gatherViewsHere = false;
-
- Stack historyList = new Stack();
-
- Stack redoList = new Stack();
-
- Hashtable sequenceColours;
-
- int thresholdTextColour = 0;
-
- Color textColour = Color.black;
-
- Color textColour2 = Color.white;
-
- boolean rightAlignIds = false;
-
- Hashtable hiddenRepSequences;
+ /*
+ * Flag set true on the view that should 'gather' multiple views of the same
+ * sequence set id when a project is reloaded. Set false on all views when
+ * they are 'exploded' into separate windows. Set true on the current view
+ * when 'Gather' is performed, and also on the first tab when the first new
+ * view is created.
+ */
+ private boolean gatherViewsHere = false;
- boolean sortByTree;
+ private AnnotationColumnChooser annotationColumnSelectionState;
/**
* Creates a new AlignViewport object.
@@ -248,16 +165,7 @@ public class AlignViewport implements SelectionSource, VamsasSource
setAlignment(al);
if (hiddenColumns != null)
{
- this.colSel = hiddenColumns;
- if (hiddenColumns.getHiddenColumns() != null
- && hiddenColumns.getHiddenColumns().size() > 0)
- {
- hasHiddenColumns = true;
- }
- else
- {
- hasHiddenColumns = false;
- }
+ colSel = hiddenColumns;
}
init();
}
@@ -304,46 +212,55 @@ public class AlignViewport implements SelectionSource, VamsasSource
setAlignment(al);
if (hiddenColumns != null)
{
- this.colSel = hiddenColumns;
- if (hiddenColumns.getHiddenColumns() != null
- && hiddenColumns.getHiddenColumns().size() > 0)
- {
- hasHiddenColumns = true;
- }
- else
- {
- hasHiddenColumns = false;
- }
+ colSel = hiddenColumns;
}
init();
}
- void init()
+ /**
+ * Apply any settings saved in user preferences
+ */
+ private void applyViewProperties()
{
- this.startRes = 0;
- this.endRes = alignment.getWidth() - 1;
- this.startSeq = 0;
- this.endSeq = alignment.getHeight() - 1;
-
antiAlias = Cache.getDefault("ANTI_ALIAS", false);
- showJVSuffix = Cache.getDefault("SHOW_JVSUFFIX", true);
- showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true);
+ viewStyle.setShowJVSuffix(Cache.getDefault("SHOW_JVSUFFIX", true));
+ setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true));
- rightAlignIds = Cache.getDefault("RIGHT_ALIGN_IDS", false);
- centreColumnLabels = Cache.getDefault("CENTRE_COLUMN_LABELS", false);
+ setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false));
+ setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false));
autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
- padGaps = Cache.getDefault("PAD_GAPS", true);
- shownpfeats = Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true);
- showdbrefs = Cache.getDefault("SHOW_DBREFS_TOOLTIP", true);
+ setPadGaps(Cache.getDefault("PAD_GAPS", true));
+ setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
+ setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
+ viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true));
+ viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false));
+ viewStyle.setShowUnconserved(Cache
+ .getDefault("SHOW_UNCONSERVED", false));
+ sortByTree = Cache.getDefault("SORT_BY_TREE", false);
+ followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true);
+ sortAnnotationsBy = SequenceAnnotationOrder.valueOf(Cache.getDefault(
+ Preferences.SORT_ANNOTATIONS,
+ SequenceAnnotationOrder.NONE.name()));
+ showAutocalculatedAbove = Cache.getDefault(
+ Preferences.SHOW_AUTOCALC_ABOVE, false);
+ viewStyle.setScaleProteinAsCdna(Cache.getDefault(
+ Preferences.SCALE_PROTEIN_TO_CDNA, true));
+ }
+
+ void init()
+ {
+ this.startRes = 0;
+ this.endRes = alignment.getWidth() - 1;
+ this.startSeq = 0;
+ this.endSeq = alignment.getHeight() - 1;
+ applyViewProperties();
String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "");
String fontSize = Cache.getDefault("FONT_SIZE", "10");
- seqNameItalics = Cache.getDefault("ID_ITALICS", true);
-
int style = 0;
if (fontStyle.equals("bold"))
@@ -355,7 +272,7 @@ public class AlignViewport implements SelectionSource, VamsasSource
style = 2;
}
- setFont(new Font(fontName, style, Integer.parseInt(fontSize)));
+ setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
alignment
.setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
@@ -366,63 +283,38 @@ public class AlignViewport implements SelectionSource, VamsasSource
{
if (!alignment.isNucleotide())
{
- conservation = new AlignmentAnnotation("Conservation",
- "Conservation of total alignment less than " + ConsPercGaps
- + "% gaps", new Annotation[1], 0f, 11f,
- AlignmentAnnotation.BAR_GRAPH);
- conservation.hasText = true;
- conservation.autoCalculated = true;
-
- if (Cache.getDefault("SHOW_CONSERVATION", true))
- {
- alignment.addAnnotation(conservation);
- }
-
- if (Cache.getDefault("SHOW_QUALITY", true))
- {
- quality = new AlignmentAnnotation("Quality",
- "Alignment Quality based on Blosum62 scores",
- new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
- quality.hasText = true;
- quality.autoCalculated = true;
-
- alignment.addAnnotation(quality);
- }
+ showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
+ showQuality = Cache.getDefault("SHOW_QUALITY", true);
showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
false);
-
- {
-
- }
}
showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
true);
showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
+ normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
+ false);
showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
- // TODO: add menu option action that nulls or creates consensus object
- // depending on if the user wants to see the annotation or not in a
- // specific alignment
- consensus = new AlignmentAnnotation("Consensus", "PID",
- new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
- consensus.hasText = true;
- consensus.autoCalculated = true;
-
- if (Cache.getDefault("SHOW_IDENTITY", true))
- {
- alignment.addAnnotation(consensus);
- }
+ showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
}
-
- if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null)
+ initAutoAnnotation();
+ String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC
+ : Preferences.DEFAULT_COLOUR_PROT;
+ String propertyValue = Cache.getProperty(colourProperty);
+ if (propertyValue == null)
+ {
+ // fall back on this property for backwards compatibility
+ propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR);
+ }
+ if (propertyValue != null)
{
globalColourScheme = ColourSchemeProperty.getColour(alignment,
- jalview.bin.Cache.getProperty("DEFAULT_COLOUR"));
+ propertyValue);
if (globalColourScheme instanceof UserColourScheme)
{
globalColourScheme = UserDefinedColours.loadDefaultColours();
((UserColourScheme) globalColourScheme).setThreshold(0,
- getIgnoreGapsConsensus());
+ isIgnoreGapsConsensus());
}
if (globalColourScheme != null)
@@ -430,179 +322,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
globalColourScheme.setConsensus(hconsensus);
}
}
-
- wrapAlignment = jalview.bin.Cache.getDefault("WRAP_ALIGNMENT", false);
- showUnconserved = jalview.bin.Cache.getDefault("SHOW_UNCONSERVED",
- false);
- sortByTree = jalview.bin.Cache.getDefault("SORT_BY_TREE", false);
- followSelection = jalview.bin.Cache.getDefault("FOLLOW_SELECTIONS",
- true);
- }
-
- /**
- * set the flag
- *
- * @param b
- * features are displayed if true
- */
- public void setShowSequenceFeatures(boolean b)
- {
- showSequenceFeatures = b;
- }
-
- public boolean getShowSequenceFeatures()
- {
- return showSequenceFeatures;
- }
-
- ConservationThread conservationThread;
-
- ConsensusThread consensusThread;
-
- boolean consUpdateNeeded = false;
-
- static boolean UPDATING_CONSENSUS = false;
-
- static boolean UPDATING_CONSERVATION = false;
-
- boolean updatingConsensus = false;
-
- boolean updatingConservation = false;
-
- /**
- * centre columnar annotation labels in displayed alignment annotation TODO:
- * add to jalviewXML and annotation display settings
- */
- boolean centreColumnLabels = false;
-
- private boolean showdbrefs;
-
- private boolean shownpfeats;
-
- /**
- * trigger update of conservation annotation
- */
- public void updateConservation(final AlignmentPanel ap)
- {
- // see note in mantis : issue number 8585
- if (alignment.isNucleotide() || conservation == null
- || !autoCalculateConsensus)
- {
- return;
- }
-
- conservationThread = new ConservationThread(this, ap);
- conservationThread.start();
- }
-
- /**
- * trigger update of consensus annotation
- */
- public void updateConsensus(final AlignmentPanel ap)
- {
- // see note in mantis : issue number 8585
- if (consensus == null || !autoCalculateConsensus)
- {
- return;
- }
- consensusThread = new ConsensusThread(ap);
- consensusThread.start();
- }
-
- class ConsensusThread extends Thread
- {
- AlignmentPanel ap;
-
- public ConsensusThread(AlignmentPanel ap)
- {
- this.ap = ap;
- }
-
- public void run()
- {
- updatingConsensus = true;
- while (UPDATING_CONSENSUS)
- {
- try
- {
- if (ap != null)
- {
- ap.paintAlignment(false);
- }
-
- Thread.sleep(200);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- UPDATING_CONSENSUS = true;
-
- try
- {
- int aWidth = (alignment != null) ? alignment.getWidth() : -1; // null
- // pointer
- // possibility
- // here.
- if (aWidth <= 0)
- {
- updatingConsensus = false;
- UPDATING_CONSENSUS = false;
- return;
- }
-
- consensus.annotations = null;
- consensus.annotations = new Annotation[aWidth];
-
- hconsensus = new Hashtable[aWidth];
- AAFrequency.calculate(alignment.getSequencesArray(), 0,
- alignment.getWidth(), hconsensus, true);
- updateAnnotation(true);
-
- if (globalColourScheme != null)
- {
- globalColourScheme.setConsensus(hconsensus);
- }
-
- } catch (OutOfMemoryError error)
- {
- alignment.deleteAnnotation(consensus);
-
- consensus = null;
- hconsensus = null;
- new OOMWarning("calculating consensus", error);
- }
- UPDATING_CONSENSUS = false;
- updatingConsensus = false;
-
- if (ap != null)
- {
- ap.paintAlignment(true);
- }
- }
-
- /**
- * update the consensus annotation from the sequence profile data using
- * current visualization settings.
- */
- public void updateAnnotation()
- {
- updateAnnotation(false);
- }
-
- protected void updateAnnotation(boolean immediate)
- {
- // TODO: make calls thread-safe, so if another thread calls this method,
- // it will either return or wait until one calculation is finished.
- if (immediate
- || (!updatingConsensus && consensus != null && hconsensus != null))
- {
- AAFrequency.completeConsensus(consensus, hconsensus, 0,
- hconsensus.length, ignoreGapsInConsensusCalculation,
- showSequenceLogo);
- }
- }
}
/**
@@ -643,64 +362,119 @@ public class AlignViewport implements SelectionSource, VamsasSource
return sq;
}
+ boolean validCharWidth;
+
/**
+ * update view settings with the given font. You may need to call
+ * alignPanel.fontChanged to update the layout geometry
*
- *
- * @return null or the currently selected sequence region
+ * @param setGrid
+ * when true, charWidth/height is set according to font mentrics
*/
- public SequenceGroup getSelectionGroup()
+ public void setFont(Font f, boolean setGrid)
{
- return selectionGroup;
+ font = f;
+
+ Container c = new Container();
+
+ java.awt.FontMetrics fm = c.getFontMetrics(font);
+ int w = viewStyle.getCharWidth(), ww = fm.charWidth('M'), h = viewStyle
+ .getCharHeight();
+ if (setGrid)
+ {
+ setCharHeight(fm.getHeight());
+ setCharWidth(ww);
+ }
+ viewStyle.setFontName(font.getName());
+ viewStyle.setFontStyle(font.getStyle());
+ viewStyle.setFontSize(font.getSize());
+
+ validCharWidth = true;
}
- /**
- * Set the selection group for this window.
- *
- * @param sg - group holding references to sequences in this alignment view
- *
- */
- public void setSelectionGroup(SequenceGroup sg)
+ @Override
+ public void setViewStyle(ViewStyleI settingsForView)
{
- selectionGroup = sg;
+ super.setViewStyle(settingsForView);
+ setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(),
+ viewStyle.getFontSize()), false);
+
}
/**
- * GUI state
- * @return true if conservation based shading is enabled
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
*/
- public boolean getConservationSelected()
+ public Font getFont()
{
- return conservationColourSelected;
+ return font;
}
/**
- * GUI state
- * @param b
- * enable conservation based shading
+ * DOCUMENT ME!
+ *
+ * @param align
+ * DOCUMENT ME!
*/
- public void setConservationSelected(boolean b)
+ public void setAlignment(AlignmentI align)
{
- conservationColourSelected = b;
+ replaceMappings(align);
+ this.alignment = align;
}
/**
- * GUI state
- * @return true if percent identity threshold is applied to shading
+ * Replace any codon mappings for this viewport with those for the given
+ * viewport
+ *
+ * @param align
*/
- public boolean getAbovePIDThreshold()
+ public void replaceMappings(AlignmentI align)
{
- return abovePIDThreshold;
+
+ /*
+ * Deregister current mappings (if any)
+ */
+ deregisterMappings();
+
+ /*
+ * Register new mappings (if any)
+ */
+ if (align != null)
+ {
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
+ ssm.registerMappings(align.getCodonFrames());
+ }
+
+ /*
+ * replace mappings on our alignment
+ */
+ if (alignment != null && align != null)
+ {
+ alignment.setCodonFrames(align.getCodonFrames());
+ }
}
- /**
- * GUI state
- *
- *
- * @param b indicate if percent identity threshold is applied to shading
- */
- public void setAbovePIDThreshold(boolean b)
+ protected void deregisterMappings()
{
- abovePIDThreshold = b;
+ AlignmentI al = getAlignment();
+ if (al != null)
+ {
+ Set<AlignedCodonFrame> mappings = al.getCodonFrames();
+ if (mappings != null)
+ {
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
+ for (AlignedCodonFrame acf : mappings)
+ {
+ if (noReferencesTo(acf))
+ {
+ ssm.deregisterMapping(acf);
+ }
+ }
+ }
+ }
}
/**
@@ -708,19 +482,23 @@ public class AlignViewport implements SelectionSource, VamsasSource
*
* @return DOCUMENT ME!
*/
- public int getStartRes()
+ public char getGapCharacter()
{
- return startRes;
+ return getAlignment().getGapCharacter();
}
/**
* DOCUMENT ME!
*
- * @return DOCUMENT ME!
+ * @param gap
+ * DOCUMENT ME!
*/
- public int getEndRes()
+ public void setGapCharacter(char gap)
{
- return endRes;
+ if (getAlignment() != null)
+ {
+ getAlignment().setGapCharacter(gap);
+ }
}
/**
@@ -728,20 +506,20 @@ public class AlignViewport implements SelectionSource, VamsasSource
*
* @return DOCUMENT ME!
*/
- public int getStartSeq()
+ public ColumnSelection getColumnSelection()
{
- return startSeq;
+ return colSel;
}
/**
* DOCUMENT ME!
*
- * @param cs
+ * @param tree
* DOCUMENT ME!
*/
- public void setGlobalColourScheme(ColourSchemeI cs)
+ public void setCurrentTree(NJTree tree)
{
- globalColourScheme = cs;
+ currentTree = tree;
}
/**
@@ -749,1080 +527,9 @@ public class AlignViewport implements SelectionSource, VamsasSource
*
* @return DOCUMENT ME!
*/
- public ColourSchemeI getGlobalColourScheme()
- {
- return globalColourScheme;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param res
- * DOCUMENT ME!
- */
- public void setStartRes(int res)
- {
- this.startRes = res;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param seq
- * DOCUMENT ME!
- */
- public void setStartSeq(int seq)
- {
- this.startSeq = seq;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param res
- * DOCUMENT ME!
- */
- public void setEndRes(int res)
- {
- if (res > (alignment.getWidth() - 1))
- {
- // log.System.out.println(" Corrected res from " + res + " to maximum " +
- // (alignment.getWidth()-1));
- res = alignment.getWidth() - 1;
- }
-
- if (res < 0)
- {
- res = 0;
- }
-
- this.endRes = res;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param seq
- * DOCUMENT ME!
- */
- public void setEndSeq(int seq)
- {
- if (seq > alignment.getHeight())
- {
- seq = alignment.getHeight();
- }
-
- if (seq < 0)
- {
- seq = 0;
- }
-
- this.endSeq = seq;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public int getEndSeq()
- {
- return endSeq;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param f
- * DOCUMENT ME!
- */
- public void setFont(Font f)
- {
- font = f;
-
- Container c = new Container();
-
- java.awt.FontMetrics fm = c.getFontMetrics(font);
- setCharHeight(fm.getHeight());
- setCharWidth(fm.charWidth('M'));
- validCharWidth = true;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public Font getFont()
- {
- return font;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param w
- * DOCUMENT ME!
- */
- public void setCharWidth(int w)
- {
- this.charWidth = w;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public int getCharWidth()
- {
- return charWidth;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param h
- * DOCUMENT ME!
- */
- public void setCharHeight(int h)
- {
- this.charHeight = h;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public int getCharHeight()
- {
- return charHeight;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param w
- * DOCUMENT ME!
- */
- public void setWrappedWidth(int w)
- {
- this.wrappedWidth = w;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public int getWrappedWidth()
- {
- return wrappedWidth;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public AlignmentI getAlignment()
- {
- return alignment;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param align
- * DOCUMENT ME!
- */
- public void setAlignment(AlignmentI align)
- {
- if (alignment != null && alignment.getCodonFrames() != null)
- {
- StructureSelectionManager.getStructureSelectionManager(Desktop.instance)
- .removeMappings(alignment.getCodonFrames());
- }
- this.alignment = align;
- if (alignment.getCodonFrames() != null)
- {
- StructureSelectionManager.getStructureSelectionManager(Desktop.instance).addMappings(
- alignment.getCodonFrames());
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param state
- * DOCUMENT ME!
- */
- public void setWrapAlignment(boolean state)
- {
- wrapAlignment = state;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param state
- * DOCUMENT ME!
- */
- public void setShowText(boolean state)
- {
- showText = state;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param state
- * DOCUMENT ME!
- */
- public void setRenderGaps(boolean state)
- {
- renderGaps = state;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getColourText()
- {
- return showColourText;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param state
- * DOCUMENT ME!
- */
- public void setColourText(boolean state)
- {
- showColourText = state;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param state
- * DOCUMENT ME!
- */
- public void setShowBoxes(boolean state)
- {
- showBoxes = state;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getWrapAlignment()
- {
- return wrapAlignment;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getShowText()
- {
- return showText;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getShowBoxes()
- {
- return showBoxes;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public char getGapCharacter()
- {
- return getAlignment().getGapCharacter();
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param gap
- * DOCUMENT ME!
- */
- public void setGapCharacter(char gap)
- {
- if (getAlignment() != null)
- {
- getAlignment().setGapCharacter(gap);
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param thresh
- * DOCUMENT ME!
- */
- public void setThreshold(int thresh)
- {
- threshold = thresh;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public int getThreshold()
- {
- return threshold;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param inc
- * DOCUMENT ME!
- */
- public void setIncrement(int inc)
- {
- increment = inc;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public int getIncrement()
- {
- return increment;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public ColumnSelection getColumnSelection()
- {
- return colSel;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param tree
- * DOCUMENT ME!
- */
- public void setCurrentTree(NJTree tree)
- {
- currentTree = tree;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public NJTree getCurrentTree()
- {
- return currentTree;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param b
- * DOCUMENT ME!
- */
- public void setColourAppliesToAllGroups(boolean b)
- {
- colourAppliesToAllGroups = b;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getColourAppliesToAllGroups()
- {
- return colourAppliesToAllGroups;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getShowJVSuffix()
- {
- return showJVSuffix;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param b
- * DOCUMENT ME!
- */
- public void setShowJVSuffix(boolean b)
- {
- showJVSuffix = b;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getShowAnnotation()
- {
- return showAnnotation;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param b
- * DOCUMENT ME!
- */
- public void setShowAnnotation(boolean b)
- {
- showAnnotation = b;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getScaleAboveWrapped()
- {
- return scaleAboveWrapped;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getScaleLeftWrapped()
- {
- return scaleLeftWrapped;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getScaleRightWrapped()
- {
- return scaleRightWrapped;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param b
- * DOCUMENT ME!
- */
- public void setScaleAboveWrapped(boolean b)
- {
- scaleAboveWrapped = b;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param b
- * DOCUMENT ME!
- */
- public void setScaleLeftWrapped(boolean b)
- {
- scaleLeftWrapped = b;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param b
- * DOCUMENT ME!
- */
- public void setScaleRightWrapped(boolean b)
- {
- scaleRightWrapped = b;
- }
-
- /**
- * Property change listener for changes in alignment
- *
- * @param listener
- * DOCUMENT ME!
- */
- public void addPropertyChangeListener(
- java.beans.PropertyChangeListener listener)
- {
- changeSupport.addPropertyChangeListener(listener);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param listener
- * DOCUMENT ME!
- */
- public void removePropertyChangeListener(
- java.beans.PropertyChangeListener listener)
- {
- changeSupport.removePropertyChangeListener(listener);
- }
-
- /**
- * Property change listener for changes in alignment
- *
- * @param prop
- * DOCUMENT ME!
- * @param oldvalue
- * DOCUMENT ME!
- * @param newvalue
- * DOCUMENT ME!
- */
- public void firePropertyChange(String prop, Object oldvalue,
- Object newvalue)
- {
- changeSupport.firePropertyChange(prop, oldvalue, newvalue);
- }
-
- public void setIgnoreGapsConsensus(boolean b, AlignmentPanel ap)
- {
- ignoreGapsInConsensusCalculation = b;
- updateConsensus(ap);
- if (globalColourScheme != null)
- {
- globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
- ignoreGapsInConsensusCalculation);
- }
- }
-
- public boolean getIgnoreGapsConsensus()
- {
- return ignoreGapsInConsensusCalculation;
- }
-
- public void setDataset(boolean b)
- {
- isDataset = b;
- }
-
- public boolean isDataset()
- {
- return isDataset;
- }
-
- public void hideSelectedColumns()
- {
- if (colSel.size() < 1)
- {
- return;
- }
-
- colSel.hideSelectedColumns();
- setSelectionGroup(null);
-
- hasHiddenColumns = true;
- }
-
- public void hideColumns(int start, int end)
- {
- if (start == end)
- {
- colSel.hideColumns(start);
- }
- else
- {
- colSel.hideColumns(start, end);
- }
-
- hasHiddenColumns = true;
- }
-
- public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
- {
- int sSize = sg.getSize();
- if (sSize < 2)
- {
- return;
- }
-
- if (hiddenRepSequences == null)
- {
- hiddenRepSequences = new Hashtable();
- }
-
- hiddenRepSequences.put(repSequence, sg);
-
- // Hide all sequences except the repSequence
- SequenceI[] seqs = new SequenceI[sSize - 1];
- int index = 0;
- for (int i = 0; i < sSize; i++)
- {
- if (sg.getSequenceAt(i) != repSequence)
- {
- if (index == sSize - 1)
- {
- return;
- }
-
- seqs[index++] = sg.getSequenceAt(i);
- }
- }
- sg.setSeqrep(repSequence);
- sg.setHidereps(true);
- hideSequence(seqs);
-
- }
-
- public void hideAllSelectedSeqs()
- {
- if (selectionGroup == null || selectionGroup.getSize() < 1)
- {
- return;
- }
-
- SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
-
- hideSequence(seqs);
-
- setSelectionGroup(null);
- }
-
- public void hideSequence(SequenceI[] seq)
- {
- if (seq != null)
- {
- for (int i = 0; i < seq.length; i++)
- {
- alignment.getHiddenSequences().hideSequence(seq[i]);
- }
- hasHiddenRows = true;
- firePropertyChange("alignment", null, alignment.getSequences());
- }
- }
-
- public void showSequence(int index)
- {
- Vector tmp = alignment.getHiddenSequences().showSequence(index,
- hiddenRepSequences);
- if (tmp.size() > 0)
- {
- if (selectionGroup == null)
- {
- selectionGroup = new SequenceGroup();
- selectionGroup.setEndRes(alignment.getWidth() - 1);
- }
-
- for (int t = 0; t < tmp.size(); t++)
- {
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
- }
- firePropertyChange("alignment", null, alignment.getSequences());
- sendSelection();
- }
-
- if (alignment.getHiddenSequences().getSize() < 1)
- {
- hasHiddenRows = false;
- }
- }
-
- public void showColumn(int col)
- {
- colSel.revealHiddenColumns(col);
- if (colSel.getHiddenColumns() == null)
- {
- hasHiddenColumns = false;
- }
- }
-
- public void showAllHiddenColumns()
- {
- colSel.revealAllHiddenColumns();
- hasHiddenColumns = false;
- }
-
- public void showAllHiddenSeqs()
- {
- if (alignment.getHiddenSequences().getSize() > 0)
- {
- if (selectionGroup == null)
- {
- selectionGroup = new SequenceGroup();
- selectionGroup.setEndRes(alignment.getWidth() - 1);
- }
- Vector tmp = alignment.getHiddenSequences().showAll(
- hiddenRepSequences);
- for (int t = 0; t < tmp.size(); t++)
- {
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
- }
- firePropertyChange("alignment", null, alignment.getSequences());
- sendSelection();
- hasHiddenRows = false;
- hiddenRepSequences = null;
- }
- }
-
- public void invertColumnSelection()
- {
- colSel.invertColumnSelection(0, alignment.getWidth());
- }
-
- public int adjustForHiddenSeqs(int alignmentIndex)
- {
- return alignment.getHiddenSequences().adjustForHiddenSeqs(
- alignmentIndex);
- }
-
- /**
- * This method returns an array of new SequenceI objects derived from the
- * whole alignment or just the current selection with start and end points
- * adjusted
- *
- * @note if you need references to the actual SequenceI objects in the
- * alignment or currently selected then use getSequenceSelection()
- * @return selection as new sequenceI objects
- */
- public SequenceI[] getSelectionAsNewSequence()
- {
- SequenceI[] sequences;
-
- if (selectionGroup == null)
- {
- sequences = alignment.getSequencesArray();
- AlignmentAnnotation[] annots = alignment.getAlignmentAnnotation();
- for (int i = 0; i < sequences.length; i++)
- {
- sequences[i] = new Sequence(sequences[i], annots); // construct new
- // sequence with
- // subset of visible
- // annotation
- }
- }
- else
- {
- sequences = selectionGroup.getSelectionAsNewSequences(alignment);
- }
-
- return sequences;
- }
-
- /**
- * get the currently selected sequence objects or all the sequences in the
- * alignment.
- *
- * @return array of references to sequence objects
- */
- public SequenceI[] getSequenceSelection()
- {
- SequenceI[] sequences = null;
- if (selectionGroup != null)
- {
- sequences = selectionGroup.getSequencesInOrder(alignment);
- }
- if (sequences == null)
- {
- sequences = alignment.getSequencesArray();
- }
- return sequences;
- }
-
- /**
- * This method returns the visible alignment as text, as seen on the GUI, ie
- * if columns are hidden they will not be returned in the result. Use this for
- * calculating trees, PCA, redundancy etc on views which contain hidden
- * columns.
- *
- * @return String[]
- */
- public jalview.datamodel.CigarArray getViewAsCigars(
- boolean selectedRegionOnly)
- {
- return new jalview.datamodel.CigarArray(alignment, (hasHiddenColumns ? colSel : null), (selectedRegionOnly ? selectionGroup : null));
- }
-
- /**
- * return a compact representation of the current alignment selection to pass
- * to an analysis function
- *
- * @param selectedOnly
- * boolean true to just return the selected view
- * @return AlignmentView
- */
- public jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly)
- {
- return getAlignmentView(selectedOnly, false);
- }
-
- /**
- * return a compact representation of the current alignment selection to pass
- * to an analysis function
- *
- * @param selectedOnly
- * boolean true to just return the selected view
- * @param markGroups
- * boolean true to annotate the alignment view with groups on the alignment (and intersecting with selected region if selectedOnly is true)
- * @return AlignmentView
- */
- public jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups)
- {
- return new AlignmentView(alignment, colSel, selectionGroup, hasHiddenColumns, selectedOnly, markGroups);
- }
-
- /**
- * This method returns the visible alignment as text, as seen on the GUI, ie
- * if columns are hidden they will not be returned in the result. Use this for
- * calculating trees, PCA, redundancy etc on views which contain hidden
- * columns.
- *
- * @return String[]
- */
- public String[] getViewAsString(boolean selectedRegionOnly)
- {
- String[] selection = null;
- SequenceI[] seqs = null;
- int i, iSize;
- int start = 0, end = 0;
- if (selectedRegionOnly && selectionGroup != null)
- {
- iSize = selectionGroup.getSize();
- seqs = selectionGroup.getSequencesInOrder(alignment);
- start = selectionGroup.getStartRes();
- end = selectionGroup.getEndRes() + 1;
- }
- else
- {
- iSize = alignment.getHeight();
- seqs = alignment.getSequencesArray();
- end = alignment.getWidth();
- }
-
- selection = new String[iSize];
- if (hasHiddenColumns)
- {
- selection = colSel.getVisibleSequenceStrings(start, end, seqs);
- }
- else
- {
- for (i = 0; i < iSize; i++)
- {
- selection[i] = seqs[i].getSequenceAsString(start, end);
- }
-
- }
- return selection;
- }
-
- public int[][] getVisibleRegionBoundaries(int min, int max)
- {
- Vector regions = new Vector();
- int start = min;
- int end = max;
-
- do
- {
- if (hasHiddenColumns)
- {
- if (start == 0)
- {
- start = colSel.adjustForHiddenColumns(start);
- }
-
- end = colSel.getHiddenBoundaryRight(start);
- if (start == end)
- {
- end = max;
- }
- if (end > max)
- {
- end = max;
- }
- }
-
- regions.addElement(new int[]
- { start, end });
-
- if (hasHiddenColumns)
- {
- start = colSel.adjustForHiddenColumns(end);
- start = colSel.getHiddenBoundaryLeft(start) + 1;
- }
- } while (end < max);
-
- int[][] startEnd = new int[regions.size()][2];
-
- regions.copyInto(startEnd);
-
- return startEnd;
-
- }
-
- public boolean getShowHiddenMarkers()
- {
- return showHiddenMarkers;
- }
-
- public void setShowHiddenMarkers(boolean show)
- {
- showHiddenMarkers = show;
- }
-
- public String getSequenceSetId()
- {
- if (sequenceSetID == null)
- {
- sequenceSetID = alignment.hashCode() + "";
- }
-
- return sequenceSetID;
- }
-
- /**
- * unique viewId for synchronizing state with stored Jalview Project
- *
- */
- private String viewId = null;
-
- public String getViewId()
- {
- if (viewId == null)
- {
- viewId = this.getSequenceSetId() + "." + this.hashCode() + "";
- }
- return viewId;
- }
-
- public void alignmentChanged(AlignmentPanel ap)
- {
- if (padGaps)
- {
- alignment.padGaps();
- }
- if (hconsensus != null && autoCalculateConsensus)
- {
- updateConservation(ap);
- }
- if (autoCalculateConsensus)
- {
- updateConsensus(ap);
- }
-
- // Reset endRes of groups if beyond alignment width
- int alWidth = alignment.getWidth();
- Vector groups = alignment.getGroups();
- if (groups != null)
- {
- for (int i = 0; i < groups.size(); i++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
- if (sg.getEndRes() > alWidth)
- {
- sg.setEndRes(alWidth - 1);
- }
- }
- }
-
- if (selectionGroup != null && selectionGroup.getEndRes() > alWidth)
- {
- selectionGroup.setEndRes(alWidth - 1);
- }
-
- resetAllColourSchemes();
-
- // alignment.adjustSequenceAnnotations();
- }
-
- void resetAllColourSchemes()
- {
- ColourSchemeI cs = globalColourScheme;
- if (cs != null)
- {
- if (cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) cs).resetClustalX(alignment.getSequences(),
- alignment.getWidth());
- }
-
- cs.setConsensus(hconsensus);
- if (cs.conservationApplied())
- {
- Alignment al = (Alignment) alignment;
- Conservation c = new Conservation("All",
- ResidueProperties.propHash, 3, al.getSequences(), 0,
- al.getWidth() - 1);
- c.calculate();
- c.verdict(false, ConsPercGaps);
-
- cs.setConservation(c);
- }
- }
-
- int s, sSize = alignment.getGroups().size();
- for (s = 0; s < sSize; s++)
- {
- SequenceGroup sg = (SequenceGroup) alignment.getGroups().elementAt(s);
- if (sg.cs != null && sg.cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) sg.cs).resetClustalX(
- sg.getSequences(hiddenRepSequences), sg.getWidth());
- }
- sg.recalcConservation();
- }
- }
-
- public Color getSequenceColour(SequenceI seq)
- {
- if (sequenceColours == null || !sequenceColours.containsKey(seq))
- {
- return Color.white;
- }
- else
- {
- return (Color) sequenceColours.get(seq);
- }
- }
-
- public void setSequenceColour(SequenceI seq, Color col)
+ public NJTree getCurrentTree()
{
- if (sequenceColours == null)
- {
- sequenceColours = new Hashtable();
- }
-
- if (col == null)
- {
- sequenceColours.remove(seq);
- }
- else
- {
- sequenceColours.put(seq, col);
- }
+ return currentTree;
}
/**
@@ -1844,210 +551,72 @@ public class AlignViewport implements SelectionSource, VamsasSource
}
else
{
- end = alignment.getWidth();
- }
- viscontigs = colSel.getVisibleContigs(start, end);
- return viscontigs;
- }
-
- /**
- * get hash of undo and redo list for the alignment
- *
- * @return long[] { historyList.hashCode, redoList.hashCode };
- */
- public long[] getUndoRedoHash()
- {
- if (historyList == null || redoList == null)
- return new long[]
- { -1, -1 };
- return new long[]
- { historyList.hashCode(), this.redoList.hashCode() };
- }
-
- /**
- * test if a particular set of hashcodes are different to the hashcodes for
- * the undo and redo list.
- *
- * @param undoredo
- * the stored set of hashcodes as returned by getUndoRedoHash
- * @return true if the hashcodes differ (ie the alignment has been edited) or
- * the stored hashcode array differs in size
- */
- public boolean isUndoRedoHashModified(long[] undoredo)
- {
- if (undoredo == null)
- {
- return true;
- }
- long[] cstate = getUndoRedoHash();
- if (cstate.length != undoredo.length)
- {
- return true;
- }
-
- for (int i = 0; i < cstate.length; i++)
- {
- if (cstate[i] != undoredo[i])
- {
- return true;
- }
- }
- return false;
- }
-
- public boolean getCentreColumnLabels()
- {
- return centreColumnLabels;
- }
-
- public void setCentreColumnLabels(boolean centrecolumnlabels)
- {
- centreColumnLabels = centrecolumnlabels;
- }
-
- public void updateSequenceIdColours()
- {
- Vector groups = alignment.getGroups();
- if (sequenceColours == null)
- {
- sequenceColours = new Hashtable();
- }
- for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(ig);
- if (sg.idColour != null)
- {
- Vector sqs = sg.getSequences(hiddenRepSequences);
- for (int s = 0, sSize = sqs.size(); s < sSize; s++)
- {
- sequenceColours.put(sqs.elementAt(s), sg.idColour);
- }
- }
- }
- }
-
- /**
- * enable or disable the display of Database Cross References in the sequence
- * ID tooltip
- */
- public void setShowDbRefs(boolean show)
- {
- showdbrefs = show;
- }
-
- /**
- *
- * @return true if Database References are to be displayed on tooltips.
- */
- public boolean isShowDbRefs()
- {
- return showdbrefs;
- }
-
- /**
- *
- * @return true if Non-positional features are to be displayed on tooltips.
- */
- public boolean isShowNpFeats()
- {
- return shownpfeats;
- }
-
- /**
- * enable or disable the display of Non-Positional sequence features in the
- * sequence ID tooltip
- *
- * @param show
- */
- public void setShowNpFeats(boolean show)
- {
- shownpfeats = show;
- }
-
- /**
- *
- * @return true if view has hidden rows
- */
- public boolean hasHiddenRows()
- {
- return hasHiddenRows;
- }
-
- /**
- *
- * @return true if view has hidden columns
- */
- public boolean hasHiddenColumns()
- {
- return hasHiddenColumns;
- }
-
- /**
- * when set, view will scroll to show the highlighted position
- */
- public boolean followHighlight = true;
-
- /**
- * @return true if view should scroll to show the highlighted region of a
- * sequence
- * @return
- */
- public boolean getFollowHighlight()
- {
- return followHighlight;
+ end = alignment.getWidth();
+ }
+ viscontigs = colSel.getVisibleContigs(start, end);
+ return viscontigs;
}
- public boolean followSelection = true;
-
/**
- * @return true if view selection should always follow the selections
- * broadcast by other selection sources
+ * get hash of undo and redo list for the alignment
+ *
+ * @return long[] { historyList.hashCode, redoList.hashCode };
*/
- public boolean getFollowSelection()
+ public long[] getUndoRedoHash()
{
- return followSelection;
+ // TODO: JAL-1126
+ if (historyList == null || redoList == null)
+ {
+ return new long[] { -1, -1 };
+ }
+ return new long[] { historyList.hashCode(), this.redoList.hashCode() };
}
- private long sgrouphash = -1, colselhash = -1;
-
- boolean showSeqFeaturesHeight;
-
/**
- * checks current SelectionGroup against record of last hash value, and
- * updates record.
- * @param b update the record of last hash value
+ * test if a particular set of hashcodes are different to the hashcodes for
+ * the undo and redo list.
*
- * @return true if SelectionGroup changed since last call (when b is true)
+ * @param undoredo
+ * the stored set of hashcodes as returned by getUndoRedoHash
+ * @return true if the hashcodes differ (ie the alignment has been edited) or
+ * the stored hashcode array differs in size
*/
- boolean isSelectionGroupChanged(boolean b)
+ public boolean isUndoRedoHashModified(long[] undoredo)
{
- int hc = (selectionGroup == null || selectionGroup.getSize()==0) ? -1 : selectionGroup.hashCode();
- if (hc!=-1 && hc != sgrouphash)
+ if (undoredo == null)
+ {
+ return true;
+ }
+ long[] cstate = getUndoRedoHash();
+ if (cstate.length != undoredo.length)
{
- if (b) {sgrouphash = hc;}
return true;
}
+
+ for (int i = 0; i < cstate.length; i++)
+ {
+ if (cstate[i] != undoredo[i])
+ {
+ return true;
+ }
+ }
return false;
}
- /**
- * checks current colsel against record of last hash value, and optionally updates
- * record.
+ public boolean followSelection = true;
- * @param b update the record of last hash value
- * @return true if colsel changed since last call (when b is true)
+ /**
+ * @return true if view selection should always follow the selections
+ * broadcast by other selection sources
*/
- boolean isColSelChanged(boolean b)
+ public boolean getFollowSelection()
{
- int hc = (colSel == null || colSel.size()==0) ? -1 : colSel.hashCode();
- if (hc!=-1 && hc != colselhash)
- {
- if (b) {colselhash = hc;}
- return true;
- }
- return false;
+ return followSelection;
}
+ /**
+ * Send the current selection to be broadcast to any selection listeners.
+ */
public void sendSelection()
{
jalview.structure.StructureSelectionManager
@@ -2056,28 +625,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
new ColumnSelection(getColumnSelection()), this);
}
- public void setShowSequenceFeaturesHeight(boolean selected)
- {
- showSeqFeaturesHeight = selected;
- }
-
- public boolean getShowSequenceFeaturesHeight()
- {
- return showSeqFeaturesHeight;
- }
-
- boolean showUnconserved = false;
-
- public boolean getShowUnconserved()
- {
- return showUnconserved;
- }
-
- public void setShowUnconserved(boolean showunconserved)
- {
- showUnconserved = showunconserved;
- }
-
/**
* return the alignPanel containing the given viewport. Use this to get the
* components currently handling the given viewport.
@@ -2090,7 +637,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
{
AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(this
.getSequenceSetId());
- AlignmentPanel ap = null;
for (int p = 0; aps != null && p < aps.length; p++)
{
if (aps[p].av == this)
@@ -2112,174 +658,453 @@ public class AlignViewport implements SelectionSource, VamsasSource
}
/**
- * should conservation rows be shown for groups
- */
- boolean showGroupConservation = false;
-
- /**
- * should consensus rows be shown for groups
- */
- boolean showGroupConsensus = false;
-
- /**
- * should consensus profile be rendered by default
- */
- public boolean showSequenceLogo = false;
-
- /**
- * should consensus histograms be rendered by default
+ * synthesize a column selection if none exists so it covers the given
+ * selection group. if wholewidth is false, no column selection is made if the
+ * selection group covers the whole alignment width.
+ *
+ * @param sg
+ * @param wholewidth
*/
- public boolean showConsensusHistogram = true;
+ public void expandColSelection(SequenceGroup sg, boolean wholewidth)
+ {
+ int sgs, sge;
+ if (sg != null
+ && (sgs = sg.getStartRes()) >= 0
+ && sg.getStartRes() <= (sge = sg.getEndRes())
+ && (colSel == null || colSel.getSelected() == null || colSel
+ .getSelected().size() == 0))
+ {
+ if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
+ {
+ // do nothing
+ return;
+ }
+ if (colSel == null)
+ {
+ colSel = new ColumnSelection();
+ }
+ for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
+ {
+ colSel.addElement(cspos);
+ }
+ }
+ }
/**
- * @return the showConsensusProfile
+ * Returns the (Desktop) instance of the StructureSelectionManager
*/
- public boolean isShowSequenceLogo()
+ @Override
+ public StructureSelectionManager getStructureSelectionManager()
{
- return showSequenceLogo;
+ return StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
}
/**
- * @param showSequenceLogo
- * the new value
+ *
+ * @param pdbEntries
+ * @return an array of SequenceI arrays, one for each PDBEntry, listing which
+ * sequences in the alignment hold a reference to it
*/
- public void setShowSequenceLogo(boolean showSequenceLogo)
+ public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
{
- if (showSequenceLogo != this.showSequenceLogo)
+ List<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
+ for (PDBEntry pdb : pdbEntries)
{
- // TODO: decouple settings setting from calculation when refactoring
- // annotation update method from alignframe to viewport
- this.showSequenceLogo = showSequenceLogo;
- if (consensusThread != null)
+ List<SequenceI> seqs = new ArrayList<SequenceI>();
+ for (SequenceI sq : alignment.getSequences())
{
- consensusThread.updateAnnotation();
+ Vector<PDBEntry> pdbs = sq.getDatasetSequence().getAllPDBEntries();
+ if (pdbs == null)
+ {
+ continue;
+ }
+ for (PDBEntry p1 : pdbs)
+ {
+ if (p1.getId().equals(pdb.getId()))
+ {
+ if (!seqs.contains(sq))
+ {
+ seqs.add(sq);
+ continue;
+ }
+ }
+ }
}
+ seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
}
- this.showSequenceLogo = showSequenceLogo;
+ return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
}
- /**
- * @param showConsensusHistogram
- * the showConsensusHistogram to set
- */
- public void setShowConsensusHistogram(boolean showConsensusHistogram)
+ public boolean isNormaliseSequenceLogo()
{
- this.showConsensusHistogram = showConsensusHistogram;
+ return normaliseSequenceLogo;
}
- /**
- * @return the showGroupConservation
- */
- public boolean isShowGroupConservation()
+ public void setNormaliseSequenceLogo(boolean state)
{
- return showGroupConservation;
+ normaliseSequenceLogo = state;
}
/**
- * @param showGroupConservation
- * the showGroupConservation to set
+ *
+ * @return true if alignment characters should be displayed
*/
- public void setShowGroupConservation(boolean showGroupConservation)
+ public boolean isValidCharWidth()
{
- this.showGroupConservation = showGroupConservation;
+ return validCharWidth;
}
- /**
- * @return the showGroupConsensus
- */
- public boolean isShowGroupConsensus()
+ private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<String, AutoCalcSetting>();
+
+ public AutoCalcSetting getCalcIdSettingsFor(String calcId)
{
- return showGroupConsensus;
+ return calcIdParams.get(calcId);
}
- /**
- * @param showGroupConsensus
- * the showGroupConsensus to set
- */
- public void setShowGroupConsensus(boolean showGroupConsensus)
+ public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings,
+ boolean needsUpdate)
{
- this.showGroupConsensus = showGroupConsensus;
+ calcIdParams.put(calcId, settings);
+ // TODO: create a restart list to trigger any calculations that need to be
+ // restarted after load
+ // calculator.getRegisteredWorkersOfClass(settings.getWorkerClass())
+ if (needsUpdate)
+ {
+ Cache.log.debug("trigger update for " + calcId);
+ }
}
/**
+ * Method called when another alignment's edit (or possibly other) command is
+ * broadcast to here.
+ *
+ * To allow for sequence mappings (e.g. protein to cDNA), we have to first
+ * 'unwind' the command on the source sequences (in simulation, not in fact),
+ * and then for each edit in turn:
+ * <ul>
+ * <li>compute the equivalent edit on the mapped sequences</li>
+ * <li>apply the mapped edit</li>
+ * <li>'apply' the source edit to the working copy of the source sequences</li>
+ * </ul>
*
- * @return flag to indicate if the consensus histogram should be rendered by
- * default
+ * @param command
+ * @param undo
+ * @param ssm
*/
- public boolean isShowConsensusHistogram()
+ @Override
+ public void mirrorCommand(CommandI command, boolean undo,
+ StructureSelectionManager ssm, VamsasSource source)
{
- return this.showConsensusHistogram;
+ /*
+ * Do nothing unless we are a 'complement' of the source. May replace this
+ * with direct calls not via SSM.
+ */
+ if (source instanceof AlignViewportI
+ && ((AlignViewportI) source).getCodingComplement() == this)
+ {
+ // ok to continue;
+ }
+ else
+ {
+ return;
+ }
+
+ CommandI mappedCommand = ssm.mapCommand(command, undo, getAlignment(),
+ getGapCharacter());
+ if (mappedCommand != null)
+ {
+ AlignmentI[] views = getAlignPanel().alignFrame.getViewAlignments();
+ mappedCommand.doCommand(views);
+ getAlignPanel().alignmentChanged();
+ }
}
/**
- * synthesize a column selection if none exists so it covers the given
- * selection group. if wholewidth is false, no column selection is made if the
- * selection group covers the whole alignment width.
+ * Add the sequences from the given alignment to this viewport. Optionally,
+ * may give the user the option to open a new frame, or split panel, with cDNA
+ * and protein linked.
*
- * @param sg
- * @param wholewidth
+ * @param al
+ * @param title
*/
- public void expandColSelection(SequenceGroup sg, boolean wholewidth)
+ public void addAlignment(AlignmentI al, String title)
{
- int sgs, sge;
- if (sg != null
- && (sgs = sg.getStartRes()) >= 0
- && sg.getStartRes() <= (sge = sg.getEndRes())
- && (colSel == null || colSel.getSelected() == null || colSel
- .getSelected().size() == 0))
+ // TODO: promote to AlignViewportI? applet CutAndPasteTransfer is different
+
+ // JBPComment: title is a largely redundant parameter at the moment
+ // JBPComment: this really should be an 'insert/pre/append' controller
+ // JBPComment: but the DNA/Protein check makes it a bit more complex
+
+ // refactored from FileLoader / CutAndPasteTransfer / SequenceFetcher with
+ // this comment:
+ // TODO: create undo object for this JAL-1101
+
+ /*
+ * If any cDNA/protein mappings can be made between the alignments, offer to
+ * open a linked alignment with split frame option.
+ */
+ if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
{
- if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
- {
- // do nothing
- return;
- }
- if (colSel == null)
+ if (al.getDataset() == null)
{
- colSel = new ColumnSelection();
+ // need to create ds seqs
+ for (SequenceI sq : al.getSequences())
+ {
+ if (sq.getDatasetSequence() == null)
+ {
+ sq.createDatasetSequence();
+ }
+ }
}
- for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
+ if (AlignmentUtils.isMappable(al, getAlignment()))
{
- colSel.addElement(cspos);
+ if (openLinkedAlignment(al, title))
+ {
+ return;
+ }
}
}
+
+ /*
+ * No mappings, or offer declined - add sequences to this alignment
+ */
+ // TODO: JAL-407 regardless of above - identical sequences (based on ID and
+ // provenance) should share the same dataset sequence
+
+ for (int i = 0; i < al.getHeight(); i++)
+ {
+ getAlignment().addSequence(al.getSequenceAt(i));
+ }
+
+ setEndSeq(getAlignment().getHeight());
+ firePropertyChange("alignment", null, getAlignment().getSequences());
}
- public StructureSelectionManager getStructureSelectionManager()
+ /**
+ * Show a dialog with the option to open and link (cDNA <-> protein) as a new
+ * alignment, either as a standalone alignment or in a split frame. Returns
+ * true if the new alignment was opened, false if not, because the user
+ * declined the offer.
+ *
+ * @param al
+ * @param title
+ */
+ protected boolean openLinkedAlignment(AlignmentI al, String title)
+ {
+ String[] options = new String[] {
+ MessageManager.getString("action.no"),
+ MessageManager.getString("label.split_window"),
+ MessageManager.getString("label.new_window"), };
+ final String question = JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.open_split_window?"));
+ int response = JOptionPane.showOptionDialog(Desktop.desktop, question,
+ MessageManager.getString("label.open_split_window"),
+ JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
+ options, options[0]);
+
+ if (response != 1 && response != 2)
+ {
+ return false;
+ }
+ final boolean openSplitPane = (response == 1);
+ final boolean openInNewWindow = (response == 2);
+
+ /*
+ * Identify protein and dna alignments. Make a copy of this one if opening
+ * in a new split pane.
+ */
+ AlignmentI thisAlignment = openSplitPane ? new Alignment(getAlignment())
+ : getAlignment();
+ AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
+ final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
+
+ /*
+ * Map sequences. At least one should get mapped as we have already passed
+ * the test for 'mappability'. Any mappings made will be added to the
+ * protein alignment. Note creating dataset sequences on the new alignment
+ * is a pre-requisite for building mappings.
+ */
+ al.setDataset(null);
+ AlignmentUtils.mapProteinToCdna(protein, cdna);
+
+ /*
+ * Create the AlignFrame for the added alignment. If it is protein, mappings
+ * are registered with StructureSelectionManager as a side-effect.
+ */
+ AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+ newAlignFrame.setTitle(title);
+ newAlignFrame.statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_loaded_file", new Object[] { title }));
+
+ // TODO if we want this (e.g. to enable reload of the alignment from file),
+ // we will need to add parameters to the stack.
+ // if (!protocol.equals(AppletFormatAdapter.PASTE))
+ // {
+ // alignFrame.setFileName(file, format);
+ // }
+
+ if (openInNewWindow)
+ {
+ Desktop.addInternalFrame(newAlignFrame, title,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ }
+
+ try
+ {
+ newAlignFrame.setMaximum(jalview.bin.Cache.getDefault(
+ "SHOW_FULLSCREEN", false));
+ } catch (java.beans.PropertyVetoException ex)
+ {
+ }
+
+ if (openSplitPane)
+ {
+ al.alignAs(thisAlignment);
+ protein = openSplitFrame(newAlignFrame, thisAlignment);
+ }
+
+ return true;
+ }
+
+ /**
+ * Helper method to open a new SplitFrame holding linked dna and protein
+ * alignments.
+ *
+ * @param newAlignFrame
+ * containing a new alignment to be shown
+ * @param complement
+ * cdna/protein complement alignment to show in the other split half
+ * @return the protein alignment in the split frame
+ */
+ protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
+ AlignmentI complement)
+ {
+ /*
+ * Make a new frame with a copy of the alignment we are adding to. If this
+ * is protein, the mappings to cDNA will be registered with
+ * StructureSelectionManager as a side-effect.
+ */
+ AlignFrame copyMe = new AlignFrame(complement,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
+
+ AlignmentI al = newAlignFrame.viewport.getAlignment();
+ final AlignFrame proteinFrame = al.isNucleotide() ? copyMe
+ : newAlignFrame;
+ final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame : copyMe;
+ cdnaFrame.setVisible(true);
+ proteinFrame.setVisible(true);
+ String linkedTitle = MessageManager
+ .getString("label.linked_view_title");
+
+ /*
+ * Open in split pane. DNA sequence above, protein below.
+ */
+ JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
+ Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
+
+ return proteinFrame.viewport.getAlignment();
+ }
+
+ public AnnotationColumnChooser getAnnotationColumnSelectionState()
+ {
+ return annotationColumnSelectionState;
+ }
+
+ public void setAnnotationColumnSelectionState(
+ AnnotationColumnChooser currentAnnotationColumnSelectionState)
+ {
+ this.annotationColumnSelectionState = currentAnnotationColumnSelectionState;
+ }
+
+ @Override
+ public void setIdWidth(int i)
+ {
+ super.setIdWidth(i);
+ AlignmentPanel ap = getAlignPanel();
+ if (ap != null)
+ {
+ // modify GUI elements to reflect geometry change
+ Dimension idw = getAlignPanel().getIdPanel().getIdCanvas()
+ .getPreferredSize();
+ idw.width = i;
+ getAlignPanel().getIdPanel().getIdCanvas().setPreferredSize(idw);
+ }
+ }
+
+ public Rectangle getExplodedGeometry()
+ {
+ return explodedGeometry;
+ }
+
+ public void setExplodedGeometry(Rectangle explodedPosition)
+ {
+ this.explodedGeometry = explodedPosition;
+ }
+
+ public boolean isGatherViewsHere()
+ {
+ return gatherViewsHere;
+ }
+
+ public void setGatherViewsHere(boolean gatherViewsHere)
+ {
+ this.gatherViewsHere = gatherViewsHere;
+ }
+
+ /**
+ * If this viewport has a (Protein/cDNA) complement, then scroll the
+ * complementary alignment to match this one.
+ */
+ public void scrollComplementaryAlignment()
{
- return StructureSelectionManager.getStructureSelectionManager(Desktop.instance);
+ /*
+ * Populate a SearchResults object with the mapped location to scroll to. If
+ * there is no complement, or it is not following highlights, or no mapping
+ * is found, the result will be empty.
+ */
+ SearchResults sr = new SearchResults();
+ int verticalOffset = findComplementScrollTarget(sr);
+ if (!sr.isEmpty())
+ {
+ // TODO would like next line without cast but needs more refactoring...
+ final AlignmentPanel complementPanel = ((AlignViewport) getCodingComplement())
+ .getAlignPanel();
+ complementPanel.setFollowingComplementScroll(true);
+ complementPanel.scrollToCentre(sr, verticalOffset);
+ }
}
/**
+ * Answers true if no alignment holds a reference to the given mapping
*
- * @param pdbEntries
- * @return a series of SequenceI arrays, one for each PDBEntry, listing which sequence in the alignment holds a reference to it
+ * @param acf
+ * @return
*/
- public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
+ protected boolean noReferencesTo(AlignedCodonFrame acf)
{
- ArrayList<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
- for (PDBEntry pdb: pdbEntries) {
- ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
- for (int i = 0; i < alignment.getHeight(); i++)
+ AlignFrame[] frames = Desktop.getAlignFrames();
+ if (frames == null)
+ {
+ return true;
+ }
+ for (AlignFrame af : frames)
{
- Vector pdbs = alignment.getSequenceAt(i)
- .getDatasetSequence().getPDBId();
- if (pdbs == null)
- continue;
- SequenceI sq;
- for (int p = 0; p < pdbs.size(); p++)
+ if (!af.isClosed())
{
- PDBEntry p1 = (PDBEntry) pdbs.elementAt(p);
- if (p1.getId().equals(pdb.getId()))
+ for (AlignmentViewPanel ap : af.getAlignPanels())
{
- if (!seqs.contains(sq=alignment.getSequenceAt(i)))
- seqs.add(sq);
-
- continue;
+ AlignmentI al = ap.getAlignment();
+ if (al != null && al.getCodonFrames().contains(acf))
+ {
+ return false;
+ }
}
}
}
- seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
- }
- return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
+ return true;
}
+
}
diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java
index b7028ac..1906829 100644
--- a/src/jalview/gui/AlignmentPanel.java
+++ b/src/jalview/gui/AlignmentPanel.java
@@ -1,39 +1,62 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.beans.*;
-import java.io.*;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.print.*;
-import javax.swing.*;
-
+import jalview.analysis.AnnotationSorter;
+import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
-import jalview.datamodel.*;
-import jalview.jbgui.*;
-import jalview.schemes.*;
-import jalview.structure.SelectionSource;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.jbgui.GAlignmentPanel;
+import jalview.math.AlignmentDimension;
+import jalview.schemes.ResidueProperties;
import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.List;
+
+import javax.swing.SwingUtilities;
/**
* DOCUMENT ME!
@@ -48,20 +71,22 @@ public class AlignmentPanel extends GAlignmentPanel implements
OverviewPanel overviewPanel;
- SeqPanel seqPanel;
+ private SeqPanel seqPanel;
+
+ private IdPanel idPanel;
- IdPanel idPanel;
+ private boolean headless;
IdwidthAdjuster idwidthAdjuster;
/** DOCUMENT ME!! */
public AlignFrame alignFrame;
- ScalePanel scalePanel;
+ private ScalePanel scalePanel;
- AnnotationPanel annotationPanel;
+ private AnnotationPanel annotationPanel;
- AnnotationLabels alabels;
+ private AnnotationLabels alabels;
// this value is set false when selection area being dragged
boolean fastPaint = true;
@@ -70,40 +95,42 @@ public class AlignmentPanel extends GAlignmentPanel implements
int vextent = 0;
+ /*
+ * Flag set while scrolling to follow complementary cDNA/protein scroll. When
+ * true, suppresses invoking the same method recursively.
+ */
+ private boolean followingComplementScroll;
+
/**
* Creates a new AlignmentPanel object.
*
* @param af
- * DOCUMENT ME!
* @param av
- * DOCUMENT ME!
*/
public AlignmentPanel(AlignFrame af, final AlignViewport av)
{
alignFrame = af;
this.av = av;
- seqPanel = new SeqPanel(av, this);
- idPanel = new IdPanel(av, this);
+ setSeqPanel(new SeqPanel(av, this));
+ setIdPanel(new IdPanel(av, this));
- scalePanel = new ScalePanel(av, this);
+ setScalePanel(new ScalePanel(av, this));
- idPanelHolder.add(idPanel, BorderLayout.CENTER);
+ idPanelHolder.add(getIdPanel(), BorderLayout.CENTER);
idwidthAdjuster = new IdwidthAdjuster(this);
idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);
- annotationPanel = new AnnotationPanel(this);
- alabels = new AnnotationLabels(this);
+ setAnnotationPanel(new AnnotationPanel(this));
+ setAlabels(new AnnotationLabels(this));
- annotationScroller.setViewportView(annotationPanel);
- annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER);
+ annotationScroller.setViewportView(getAnnotationPanel());
+ annotationSpaceFillerHolder.add(getAlabels(), BorderLayout.CENTER);
- scalePanelHolder.add(scalePanel, BorderLayout.CENTER);
- seqPanelHolder.add(seqPanel, BorderLayout.CENTER);
+ scalePanelHolder.add(getScalePanel(), BorderLayout.CENTER);
+ seqPanelHolder.add(getSeqPanel(), BorderLayout.CENTER);
setScrollValues(0, 0);
- setAnnotationVisible(av.getShowAnnotation());
-
hscroll.addAdjustmentListener(this);
vscroll.addAdjustmentListener(this);
@@ -121,7 +148,13 @@ public class AlignmentPanel extends GAlignmentPanel implements
});
fontChanged();
adjustAnnotationHeight();
+ updateLayout();
+ }
+ @Override
+ public AlignViewportI getAlignViewport()
+ {
+ return av;
}
public void alignmentChanged()
@@ -143,24 +176,29 @@ public class AlignmentPanel extends GAlignmentPanel implements
// to prevent drawing old image
FontMetrics fm = getFontMetrics(av.getFont());
- scalePanelHolder.setPreferredSize(new Dimension(10, av.charHeight
- + fm.getDescent()));
- idSpaceFillerPanel1.setPreferredSize(new Dimension(10, av.charHeight
+ scalePanelHolder.setPreferredSize(new Dimension(10, av.getCharHeight()
+ fm.getDescent()));
+ idSpaceFillerPanel1.setPreferredSize(new Dimension(10, av
+ .getCharHeight() + fm.getDescent()));
- idPanel.idCanvas.gg = null;
- seqPanel.seqCanvas.img = null;
- annotationPanel.adjustPanelHeight();
+ getIdPanel().getIdCanvas().gg = null;
+ getSeqPanel().seqCanvas.img = null;
+ getAnnotationPanel().adjustPanelHeight();
Dimension d = calculateIdWidth();
+
d.setSize(d.width + 4, d.height);
- idPanel.idCanvas.setPreferredSize(d);
+ getIdPanel().getIdCanvas().setPreferredSize(d);
hscrollFillerPanel.setPreferredSize(d);
if (overviewPanel != null)
{
overviewPanel.setBoxPosition();
}
+ if (this.alignFrame.getSplitViewContainer() != null)
+ {
+ ((SplitFrame) this.alignFrame.getSplitViewContainer()).adjustLayout();
+ }
repaint();
}
@@ -174,15 +212,41 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public Dimension calculateIdWidth()
{
+ // calculate sensible default width when no preference is available
+ Dimension r = null;
+ if (av.getIdWidth() < 0)
+ {
+ int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300);
+ int maxwidth = Math.max(20, Math.min(afwidth - 200, 2 * afwidth / 3));
+ r = calculateIdWidth(maxwidth);
+ av.setIdWidth(r.width);
+ }
+ else
+ {
+ r = new Dimension();
+ r.width = av.getIdWidth();
+ r.height = 0;
+ }
+ return r;
+ }
+
+ /**
+ * Calculate the width of the alignment labels based on the displayed names
+ * and any bounds on label width set in preferences.
+ *
+ * @param maxwidth
+ * -1 or maximum width allowed for IdWidth
+ * @return Dimension giving the maximum width of the alignment label panel
+ * that should be used.
+ */
+ public Dimension calculateIdWidth(int maxwidth)
+ {
Container c = new Container();
FontMetrics fm = c.getFontMetrics(new Font(av.font.getName(),
Font.ITALIC, av.font.getSize()));
AlignmentI al = av.getAlignment();
- int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300);
- int maxwidth = Math.max(20,
- Math.min(afwidth - 200, (int) 2 * afwidth / 3));
int i = 0;
int idWidth = 0;
String id;
@@ -206,7 +270,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
if (al.getAlignmentAnnotation() != null)
{
- fm = c.getFontMetrics(alabels.getFont());
+ fm = c.getFontMetrics(getAlabels().getFont());
while (i < al.getAlignmentAnnotation().length)
{
@@ -221,7 +285,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
}
}
- return new Dimension(Math.min(maxwidth, idWidth), 12);
+ return new Dimension(maxwidth < 0 ? idWidth : Math.min(maxwidth,
+ idWidth), 12);
}
/**
@@ -231,56 +296,87 @@ public class AlignmentPanel extends GAlignmentPanel implements
public void highlightSearchResults(SearchResults results)
{
scrollToPosition(results);
- seqPanel.seqCanvas.highlightSearchResults(results);
+ getSeqPanel().seqCanvas.highlightSearchResults(results);
}
/**
- * scroll the view to show the position of the highlighted region in results
+ * Scroll the view to show the position of the highlighted region in results
* (if any) and redraw the overview
*
* @param results
*/
public boolean scrollToPosition(SearchResults results)
{
- return scrollToPosition(results, true);
+ return scrollToPosition(results, 0, true, false);
}
/**
- * scroll the view to show the position of the highlighted region in results
+ * Scroll the view to show the position of the highlighted region in results
+ * (if any)
+ *
+ * @param searchResults
+ * @param redrawOverview
+ * @return
+ */
+ public boolean scrollToPosition(SearchResults searchResults,
+ boolean redrawOverview)
+ {
+ return scrollToPosition(searchResults, 0, redrawOverview, false);
+ }
+
+ /**
+ * Scroll the view to show the position of the highlighted region in results
* (if any)
*
* @param results
+ * @param verticalOffset
+ * if greater than zero, allows scrolling to a position below the
+ * first displayed sequence
* @param redrawOverview
* - when set, the overview will be recalculated (takes longer)
+ * @param centre
+ * if true, try to centre the search results horizontally in the view
* @return false if results were not found
*/
public boolean scrollToPosition(SearchResults results,
- boolean redrawOverview)
+ int verticalOffset, boolean redrawOverview, boolean centre)
{
- int startv, endv, starts, ends, width;
+ int startv, endv, starts, ends;
// TODO: properly locate search results in view when large numbers of hidden
// columns exist before highlighted region
// do we need to scroll the panel?
- // TODO: tons of nullpointereexceptions raised here.
+ // TODO: tons of nullpointerexceptions raised here.
if (results != null && results.getSize() > 0 && av != null
- && av.alignment != null)
+ && av.getAlignment() != null)
{
- int seqIndex = av.alignment.findIndex(results);
+ int seqIndex = av.getAlignment().findIndex(results);
if (seqIndex == -1)
{
return false;
}
- SequenceI seq = av.alignment.getSequenceAt(seqIndex);
-
- int[] r=results.getResults(seq, 0, av.alignment.getWidth());
+ SequenceI seq = av.getAlignment().getSequenceAt(seqIndex);
+
+ int[] r = results.getResults(seq, 0, av.getAlignment().getWidth());
if (r == null)
{
return false;
}
int start = r[0];
int end = r[1];
- // System.err.println("Seq : "+seqIndex+" Scroll to "+start+","+end); //
// DEBUG
+ // System.err.println(this.av.viewName + " Seq : " + seqIndex
+ // + " Scroll to " + start + "," + end);
+
+ /*
+ * To centre results, scroll to positions half the visible width
+ * left/right of the start/end positions
+ */
+ if (centre)
+ {
+ int offset = (av.getEndRes() - av.getStartRes() + 1) / 2 - 1;
+ start = Math.max(start - offset, 0);
+ end = end + offset - 1;
+ }
if (start < 0)
{
return false;
@@ -289,37 +385,63 @@ public class AlignmentPanel extends GAlignmentPanel implements
{
return false;
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
start = av.getColumnSelection().findColumnPosition(start);
end = av.getColumnSelection().findColumnPosition(end);
- if (start==end)
+ if (start == end)
{
- if (!av.colSel.isVisible(r[0]))
+ if (!av.getColumnSelection().isVisible(r[0]))
{
// don't scroll - position isn't visible
return false;
}
}
}
- if (!av.wrapAlignment)
+
+ /*
+ * allow for offset of target sequence (actually scroll to one above it)
+ */
+ seqIndex = Math.max(0, seqIndex - verticalOffset);
+
+ // System.out.println("start=" + start + ", end=" + end + ", startv="
+ // + av.getStartRes() + ", endv=" + av.getEndRes() + ", starts="
+ // + av.getStartSeq() + ", ends=" + av.getEndSeq());
+ if (!av.getWrapAlignment())
{
if ((startv = av.getStartRes()) >= start)
{
- setScrollValues(start - 1, seqIndex);
+ /*
+ * Scroll left to make start of search results visible
+ */
+ // setScrollValues(start - 1, seqIndex); // plus one residue
+ setScrollValues(start, seqIndex);
}
else if ((endv = av.getEndRes()) <= end)
{
- setScrollValues(startv + 1 + end - endv, seqIndex);
+ /*
+ * Scroll right to make end of search results visible
+ */
+ // setScrollValues(startv + 1 + end - endv, seqIndex); // plus one
+ setScrollValues(startv + end - endv, seqIndex);
}
else if ((starts = av.getStartSeq()) > seqIndex)
{
+ /*
+ * Scroll up to make start of search results visible
+ */
setScrollValues(av.getStartRes(), seqIndex);
}
else if ((ends = av.getEndSeq()) <= seqIndex)
{
+ /*
+ * Scroll down to make end of search results visible
+ */
setScrollValues(av.getStartRes(), starts + seqIndex - ends + 1);
}
+ /*
+ * Else results are already visible - no need to scroll
+ */
}
else
{
@@ -336,8 +458,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
void scrollToWrappedVisible(int res)
{
- int cwidth = seqPanel.seqCanvas
- .getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());
+ int cwidth = getSeqPanel().seqCanvas
+ .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth());
if (res < av.getStartRes() || res >= (av.getStartRes() + cwidth))
{
vscroll.setValue((res / cwidth));
@@ -369,12 +491,13 @@ public class AlignmentPanel extends GAlignmentPanel implements
/**
*
- * @param b Hide or show annotation panel
- *
+ * @param b
+ * Hide or show annotation panel
+ *
*/
public void setAnnotationVisible(boolean b)
{
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
annotationSpaceFillerHolder.setVisible(b);
annotationScroller.setVisible(b);
@@ -383,8 +506,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
}
/**
- * automatically adjust annotation panel height for new annotation
- * whilst ensuring the alignment is still visible.
+ * automatically adjust annotation panel height for new annotation whilst
+ * ensuring the alignment is still visible.
*/
public void adjustAnnotationHeight()
{
@@ -398,45 +521,68 @@ public class AlignmentPanel extends GAlignmentPanel implements
addNotify();
paintAlignment(true);
}
+
/**
* calculate the annotation dimensions and refresh slider values accordingly.
- * need to do repaints/notifys afterwards.
+ * need to do repaints/notifys afterwards.
*/
- protected void validateAnnotationDimensions(boolean adjustPanelHeight) {
- int height = annotationPanel.adjustPanelHeight();
-
- if (hscroll.isVisible())
- {
- height += hscroll.getPreferredSize().height;
- }
- if (height > alignFrame.getHeight() / 2)
- {
- height = alignFrame.getHeight() / 2;
+ protected void validateAnnotationDimensions(boolean adjustPanelHeight)
+ {
+ int annotationHeight = getAnnotationPanel().adjustPanelHeight();
+
+ if (adjustPanelHeight)
+ {
+ int rowHeight = av.getCharHeight();
+ int alignmentHeight = rowHeight * av.getAlignment().getHeight();
+
+ /*
+ * Estimate available height in the AlignFrame for alignment +
+ * annotations. Deduct an estimate for title bar, menu bar, scale panel,
+ * hscroll, status bar (as these are not laid out we can't inspect their
+ * actual heights). Insets gives frame borders.
+ */
+ int stuff = Platform.isAMac() ? 80 : 100;
+ Insets insets = alignFrame.getInsets();
+ int availableHeight = alignFrame.getHeight() - stuff - insets.top
+ - insets.bottom;
+
+ /*
+ * If not enough vertical space, maximize annotation height while keeping
+ * at least two rows of alignment visible
+ */
+ if (annotationHeight + alignmentHeight > availableHeight)
+ {
+ annotationHeight = Math.min(annotationHeight, availableHeight - 2
+ * rowHeight);
+ }
}
- if (!adjustPanelHeight)
+ else
{
// maintain same window layout whilst updating sliders
- height=annotationScroller.getSize().height;
+ annotationHeight = annotationScroller.getSize().height;
}
hscroll.addNotify();
-
+
annotationScroller.setPreferredSize(new Dimension(annotationScroller
- .getWidth(), height));
+ .getWidth(), annotationHeight));
annotationSpaceFillerHolder.setPreferredSize(new Dimension(
- annotationSpaceFillerHolder.getWidth(), height));
- annotationScroller.validate();// repaint();
+ annotationSpaceFillerHolder.getWidth(), annotationHeight));
+ annotationScroller.validate();
annotationScroller.addNotify();
}
/**
- * DOCUMENT ME!
+ * update alignment layout for viewport settings
*
* @param wrap
* DOCUMENT ME!
*/
- public void setWrapAlignment(boolean wrap)
+ public void updateLayout()
{
+ fontChanged();
+ setAnnotationVisible(av.isShowAnnotation());
+ boolean wrap = av.getWrapAlignment();
av.startSeq = 0;
scalePanelHolder.setVisible(!wrap);
hscroll.setVisible(!wrap);
@@ -447,7 +593,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
annotationScroller.setVisible(false);
annotationSpaceFillerHolder.setVisible(false);
}
- else if (av.showAnnotation)
+ else if (av.isShowAnnotation())
{
annotationScroller.setVisible(true);
annotationSpaceFillerHolder.setVisible(true);
@@ -526,30 +672,32 @@ public class AlignmentPanel extends GAlignmentPanel implements
/**
* Adjust row/column scrollers to show a visible position in the alignment.
*
- * @param x visible column to scroll to
- * DOCUMENT ME!
- * @param y visible row to scroll to
- *
+ * @param x
+ * visible column to scroll to
+ * @param y
+ * visible row to scroll to
+ *
*/
public void setScrollValues(int x, int y)
{
- // System.err.println("Scroll to "+x+","+y);
- if (av == null || av.alignment == null)
+ // System.err.println("Scroll " + this.av.viewName + " to " + x + "," + y);
+ if (av == null || av.getAlignment() == null)
{
return;
}
- int width = av.alignment.getWidth();
- int height = av.alignment.getHeight();
+ int width = av.getAlignment().getWidth();
+ int height = av.getAlignment().getHeight();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
width = av.getColumnSelection().findColumnPosition(width);
}
- av.setEndRes((x + (seqPanel.seqCanvas.getWidth() / av.charWidth)) - 1);
+ av.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av
+ .getCharWidth())) - 1);
- hextent = seqPanel.seqCanvas.getWidth() / av.charWidth;
- vextent = seqPanel.seqCanvas.getHeight() / av.charHeight;
+ hextent = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth();
+ vextent = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight();
if (hextent > width)
{
@@ -593,7 +741,6 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public void adjustmentValueChanged(AdjustmentEvent evt)
{
-
int oldX = av.getStartRes();
int oldY = av.getStartSeq();
@@ -601,7 +748,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
{
int x = hscroll.getValue();
av.setStartRes(x);
- av.setEndRes((x + (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) - 1);
+ av.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av
+ .getCharWidth())) - 1);
}
if (evt.getSource() == vscroll)
@@ -612,8 +760,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
{
if (offy > -1)
{
- int rowSize = seqPanel.seqCanvas
- .getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());
+ int rowSize = getSeqPanel().seqCanvas
+ .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth());
av.setStartRes(offy * rowSize);
av.setEndRes((offy + 1) * rowSize);
}
@@ -635,7 +783,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
{
av.setStartSeq(offy);
av.setEndSeq(offy
- + (seqPanel.seqCanvas.getHeight() / av.getCharHeight()));
+ + (getSeqPanel().seqCanvas.getHeight() / av.getCharHeight()));
}
}
@@ -666,24 +814,45 @@ public class AlignmentPanel extends GAlignmentPanel implements
if (scrollX != 0 || scrollY != 0)
{
- idPanel.idCanvas.fastPaint(scrollY);
- seqPanel.seqCanvas.fastPaint(scrollX, scrollY);
- scalePanel.repaint();
+ getIdPanel().getIdCanvas().fastPaint(scrollY);
+ getSeqPanel().seqCanvas.fastPaint(scrollX, scrollY);
+ getScalePanel().repaint();
- if (av.getShowAnnotation())
+ if (av.isShowAnnotation() && scrollX != 0)
{
- annotationPanel.fastPaint(scrollX);
+ getAnnotationPanel().fastPaint(scrollX);
}
}
}
+ /*
+ * If there is one, scroll the (Protein/cDNA) complementary alignment to
+ * match, unless we are ourselves doing that.
+ */
+ if (isFollowingComplementScroll())
+ {
+ setFollowingComplementScroll(false);
+ }
+ else
+ {
+ av.scrollComplementaryAlignment();
+ }
}
+ /**
+ * Repaint the alignment including the annotations and overview panels (if
+ * shown).
+ */
public void paintAlignment(boolean updateOverview)
{
+ final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
+ av.isShowAutocalculatedAbove());
+ sorter.sort(getAlignment().getAlignmentAnnotation(),
+ av.getSortAnnotationsBy());
repaint();
if (updateOverview)
{
+ // TODO: determine if this paintAlignment changed structure colours
av.getStructureSelectionManager().sequenceColoursChanged(this);
if (overviewPanel != null)
@@ -703,27 +872,27 @@ public class AlignmentPanel extends GAlignmentPanel implements
{
invalidate();
- Dimension d = idPanel.idCanvas.getPreferredSize();
+ Dimension d = getIdPanel().getIdCanvas().getPreferredSize();
idPanelHolder.setPreferredSize(d);
hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
validate();
if (av.getWrapAlignment())
{
- int maxwidth = av.alignment.getWidth();
+ int maxwidth = av.getAlignment().getWidth();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
- int canvasWidth = seqPanel.seqCanvas
- .getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());
+ int canvasWidth = getSeqPanel().seqCanvas
+ .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth());
if (canvasWidth > 0)
{
int max = maxwidth
- / seqPanel.seqCanvas
- .getWrappedCanvasWidth(seqPanel.seqCanvas
+ / getSeqPanel().seqCanvas
+ .getWrappedCanvasWidth(getSeqPanel().seqCanvas
.getWidth()) + 1;
vscroll.setMaximum(max);
vscroll.setUnitIncrement(1);
@@ -789,9 +958,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi)
throws PrinterException
{
- int idWidth = getVisibleIdWidth();
+ int idWidth = getVisibleIdWidth(false);
FontMetrics fm = getFontMetrics(av.getFont());
- int scaleHeight = av.charHeight + fm.getDescent();
+ int scaleHeight = av.getCharHeight() + fm.getDescent();
pg.setColor(Color.white);
pg.fillRect(0, 0, pwidth, pheight);
@@ -801,7 +970,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
// / How many sequences and residues can we fit on a printable page?
int totalRes = (pwidth - idWidth) / av.getCharWidth();
- int totalSeq = (int) ((pheight - scaleHeight) / av.getCharHeight()) - 1;
+ int totalSeq = (pheight - scaleHeight) / av.getCharHeight() - 1;
int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1;
@@ -836,11 +1005,12 @@ public class AlignmentPanel extends GAlignmentPanel implements
endSeq = av.getAlignment().getHeight();
}
- int pagesHigh = ((av.alignment.getHeight() / totalSeq) + 1) * pheight;
+ int pagesHigh = ((av.getAlignment().getHeight() / totalSeq) + 1)
+ * pheight;
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
- pagesHigh += annotationPanel.adjustPanelHeight() + 3;
+ pagesHigh += getAnnotationPanel().adjustPanelHeight() + 3;
}
pagesHigh /= pheight;
@@ -852,7 +1022,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
// draw Scale
pg.translate(idWidth, 0);
- scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth,
+ getScalePanel().drawScale(pg, startRes, endRes, pwidth - idWidth,
scaleHeight);
pg.translate(-idWidth, scaleHeight);
@@ -861,7 +1031,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
Color currentColor = null;
Color currentTextColor = null;
- pg.setFont(idPanel.idCanvas.idfont);
+ pg.setFont(getIdPanel().getIdCanvas().getIdfont());
SequenceI seq;
for (int i = startSeq; i < endSeq; i++)
@@ -880,13 +1050,13 @@ public class AlignmentPanel extends GAlignmentPanel implements
}
pg.setColor(currentColor);
- pg.fillRect(0, (i - startSeq) * av.charHeight, idWidth,
+ pg.fillRect(0, (i - startSeq) * av.getCharHeight(), idWidth,
av.getCharHeight());
pg.setColor(currentTextColor);
int xPos = 0;
- if (av.rightAlignIds)
+ if (av.isRightAlignIds())
{
fm = pg.getFontMetrics();
xPos = idWidth
@@ -894,10 +1064,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
- 4;
}
- pg.drawString(
- seq.getDisplayId(av.getShowJVSuffix()),
- xPos,
- (((i - startSeq) * av.charHeight) + av.getCharHeight())
+ pg.drawString(seq.getDisplayId(av.getShowJVSuffix()), xPos,
+ (((i - startSeq) * av.getCharHeight()) + av.getCharHeight())
- (av.getCharHeight() / 5));
}
@@ -905,14 +1073,21 @@ public class AlignmentPanel extends GAlignmentPanel implements
// draw main sequence panel
pg.translate(idWidth, 0);
- seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, 0);
+ getSeqPanel().seqCanvas.drawPanel(pg, startRes, endRes, startSeq,
+ endSeq, 0);
- if (av.showAnnotation && (endSeq == av.alignment.getHeight()))
+ if (av.isShowAnnotation() && (endSeq == av.getAlignment().getHeight()))
{
- pg.translate(-idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
- alabels.drawComponent((Graphics2D) pg, idWidth);
+ // draw annotation - need to offset for current scroll position
+ int offset = -getAlabels().getScrollOffset();
+ pg.translate(0, offset);
+ pg.translate(-idWidth - 3, (endSeq - startSeq) * av.getCharHeight()
+ + 3);
+ getAlabels().drawComponent(pg, idWidth);
pg.translate(idWidth + 3, 0);
- annotationPanel.drawComponent((Graphics2D) pg, startRes, endRes + 1);
+ getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
+ pg, -1, startRes, endRes + 1);
+ pg.translate(0, -offset);
}
return Printable.PAGE_EXISTS;
@@ -938,33 +1113,32 @@ public class AlignmentPanel extends GAlignmentPanel implements
public int printWrappedAlignment(Graphics pg, int pwidth, int pheight,
int pi) throws PrinterException
{
-
int annotationHeight = 0;
AnnotationLabels labels = null;
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
- annotationHeight = annotationPanel.adjustPanelHeight();
+ annotationHeight = getAnnotationPanel().adjustPanelHeight();
labels = new AnnotationLabels(av);
}
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap
+ annotationHeight;
- int idWidth = getVisibleIdWidth();
+ int idWidth = getVisibleIdWidth(false);
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
- int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth
+ int resWidth = getSeqPanel().seqCanvas.getWrappedCanvasWidth(pwidth
- idWidth);
int totalHeight = cHeight * (maxwidth / resWidth + 1);
@@ -985,30 +1159,33 @@ public class AlignmentPanel extends GAlignmentPanel implements
do
{
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- pg.setFont(idPanel.idCanvas.idfont);
- SequenceI s = av.alignment.getSequenceAt(i);
+ pg.setFont(getIdPanel().getIdCanvas().getIdfont());
+ SequenceI s = av.getAlignment().getSequenceAt(i);
String string = s.getDisplayId(av.getShowJVSuffix());
int xPos = 0;
- if (av.rightAlignIds)
+ if (av.isRightAlignIds())
{
FontMetrics fm = pg.getFontMetrics();
xPos = idWidth - fm.stringWidth(string) - 4;
}
pg.drawString(string, xPos,
- ((i * av.charHeight) + ypos + av.charHeight)
- - (av.charHeight / 5));
+ ((i * av.getCharHeight()) + ypos + av.getCharHeight())
+ - (av.getCharHeight() / 5));
}
if (labels != null)
{
- pg.translate(-3, ypos
- + (av.getAlignment().getHeight() * av.charHeight));
+ pg.translate(-3,
+ ypos + (av.getAlignment().getHeight() * av.getCharHeight()));
pg.setFont(av.getFont());
labels.drawComponent(pg, idWidth);
- pg.translate(+3, -ypos
- - (av.getAlignment().getHeight() * av.charHeight));
+ pg.translate(
+ +3,
+ -ypos
+ - (av.getAlignment().getHeight() * av
+ .getCharHeight()));
}
ypos += cHeight;
@@ -1016,8 +1193,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
pg.translate(idWidth, 0);
- seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight,
- 0);
+ getSeqPanel().seqCanvas.drawWrappedPanel(pg, pwidth - idWidth,
+ totalHeight, 0);
if ((pi * pheight) < totalHeight)
{
@@ -1030,90 +1207,158 @@ public class AlignmentPanel extends GAlignmentPanel implements
}
}
- int getVisibleIdWidth()
+ /**
+ * get current sequence ID panel width, or nominal value if panel were to be
+ * displayed using default settings
+ *
+ * @return
+ */
+ public int getVisibleIdWidth()
{
- return idPanel.getWidth() > 0 ? idPanel.getWidth()
- : calculateIdWidth().width + 4;
+ return getVisibleIdWidth(true);
}
- void makeAlignmentImage(int type, File file)
+ /**
+ * get current sequence ID panel width, or nominal value if panel were to be
+ * displayed using default settings
+ *
+ * @param onscreen
+ * indicate if the Id width for onscreen or offscreen display should
+ * be returned
+ * @return
+ */
+ public int getVisibleIdWidth(boolean onscreen)
{
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ // see if rendering offscreen - check preferences and calc width accordingly
+ if (!onscreen && Cache.getDefault("FIGURE_AUTOIDWIDTH", false))
{
- maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);
+ return calculateIdWidth(-1).width + 4;
}
+ Integer idwidth = null;
+ if (onscreen
+ || (idwidth = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH")) == null)
+ {
+ return (getIdPanel().getWidth() > 0 ? getIdPanel().getWidth()
+ : calculateIdWidth().width + 4);
+ }
+ return idwidth.intValue() + 4;
+ }
- int height = ((av.alignment.getHeight() + 1) * av.charHeight)
- + scalePanel.getHeight();
- int width = getVisibleIdWidth() + (maxwidth * av.charWidth);
-
- if (av.getWrapAlignment())
+ void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file)
+ {
+ long progress = System.currentTimeMillis();
+ headless = (System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true"));
+ if (alignFrame != null && !headless)
+ {
+ alignFrame.setProgressBar(MessageManager.formatMessage(
+ "status.saving_file", new Object[] { type.getLabel() }),
+ progress);
+ }
+ try
{
- height = getWrappedHeight();
- if (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true"))
+ AlignmentDimension aDimension = getAlignmentDimension();
+ try
{
- // TODO: JAL-244
- width = alignFrame.getWidth() - vscroll.getPreferredSize().width
- - alignFrame.getInsets().left
- - alignFrame.getInsets().right;
+ jalview.util.ImageMaker im;
+ final String imageAction, imageTitle;
+ if (type == jalview.util.ImageMaker.TYPE.PNG)
+ {
+ imageAction = "Create PNG image from alignment";
+ imageTitle = null;
+ }
+ else if (type == jalview.util.ImageMaker.TYPE.EPS)
+ {
+ imageAction = "Create EPS file from alignment";
+ imageTitle = alignFrame.getTitle();
+ }
+ else
+ {
+ imageAction = "Create SVG file from alignment";
+ imageTitle = alignFrame.getTitle();
+ }
+
+ im = new jalview.util.ImageMaker(this, type, imageAction,
+ aDimension.getWidth(), aDimension.getHeight(), file,
+ imageTitle);
+ if (av.getWrapAlignment())
+ {
+ if (im.getGraphics() != null)
+ {
+ printWrappedAlignment(im.getGraphics(), aDimension.getWidth(),
+ aDimension.getHeight(), 0);
+ im.writeImage();
+ }
+ }
+ else
+ {
+ if (im.getGraphics() != null)
+ {
+ printUnwrapped(im.getGraphics(), aDimension.getWidth(),
+ aDimension.getHeight(), 0);
+ im.writeImage();
+ }
+ }
+ } catch (OutOfMemoryError err)
+ {
+ // Be noisy here.
+ System.out.println("########################\n" + "OUT OF MEMORY "
+ + file + "\n" + "########################");
+ new OOMWarning("Creating Image for " + file, err);
+ // System.out.println("Create IMAGE: " + err);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
}
- else
+ } finally
+ {
+ if (alignFrame != null && !headless)
{
- width = seqPanel.getWidth() + getVisibleIdWidth();
+ alignFrame.setProgressBar(
+ MessageManager.getString("status.export_complete"),
+ progress);
}
-
}
- else if (av.getShowAnnotation())
+ }
+
+ public AlignmentDimension getAlignmentDimension()
+ {
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
- height += annotationPanel.adjustPanelHeight() + 3;
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);
}
- try
- {
+ int height = ((av.getAlignment().getHeight() + 1) * av.getCharHeight())
+ + getScalePanel().getHeight();
+ int width = getVisibleIdWidth(false) + (maxwidth * av.getCharWidth());
- jalview.util.ImageMaker im;
- if (type == jalview.util.ImageMaker.PNG)
+ if (av.getWrapAlignment())
+ {
+ height = getWrappedHeight();
+ if (headless)
{
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.PNG,
- "Create PNG image from alignment", width, height, file,
- null);
+ // need to obtain default alignment width and then add in any
+ // additional allowance for id margin
+ // this duplicates the calculation in getWrappedHeight but adjusts for
+ // offscreen idWith
+ width = alignFrame.getWidth() - vscroll.getPreferredSize().width
+ - alignFrame.getInsets().left
+ - alignFrame.getInsets().right - getVisibleIdWidth()
+ + getVisibleIdWidth(false);
}
else
{
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.EPS,
- "Create EPS file from alignment", width, height, file,
- alignFrame.getTitle());
+ width = getSeqPanel().getWidth() + getVisibleIdWidth(false);
}
- if (av.getWrapAlignment())
- {
- if (im.getGraphics() != null)
- {
- printWrappedAlignment(im.getGraphics(), width, height, 0);
- im.writeImage();
- }
- }
- else
- {
- if (im.getGraphics() != null)
- {
- printUnwrapped(im.getGraphics(), width, height, 0);
- im.writeImage();
- }
- }
- } catch (OutOfMemoryError err)
- {
- // Be noisy here.
- System.out.println("########################\n" + "OUT OF MEMORY "
- + file + "\n" + "########################");
- new OOMWarning("Creating Image for " + file, err);
- // System.out.println("Create IMAGE: " + err);
- } catch (Exception ex)
+ }
+ else if (av.isShowAnnotation())
{
- ex.printStackTrace();
+ height += getAnnotationPanel().adjustPanelHeight() + 3;
}
+ return new AlignmentDimension(width, height);
+
}
/**
@@ -1121,7 +1366,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public void makeEPS(File epsFile)
{
- makeAlignmentImage(jalview.util.ImageMaker.EPS, epsFile);
+ makeAlignmentImage(jalview.util.ImageMaker.TYPE.EPS, epsFile);
}
/**
@@ -1129,16 +1374,21 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public void makePNG(File pngFile)
{
- makeAlignmentImage(jalview.util.ImageMaker.PNG, pngFile);
+ makeAlignmentImage(jalview.util.ImageMaker.TYPE.PNG, pngFile);
+ }
+
+ public void makeSVG(File svgFile)
+ {
+ makeAlignmentImage(jalview.util.ImageMaker.TYPE.SVG, svgFile);
}
public void makePNGImageMap(File imgMapFile, String imageName)
{
// /////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS
// ////////////////////////////////////////////
- int idWidth = getVisibleIdWidth();
+ int idWidth = getVisibleIdWidth(false);
FontMetrics fm = getFontMetrics(av.getFont());
- int scaleHeight = av.charHeight + fm.getDescent();
+ int scaleHeight = av.getCharHeight() + fm.getDescent();
// Gen image map
// ////////////////////////////////
@@ -1146,8 +1396,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
{
try
{
- int s, sSize = av.alignment.getHeight(), res, alwidth = av.alignment
- .getWidth(), g, gSize, f, fSize, sy;
+ int s, sSize = av.getAlignment().getHeight(), res, alwidth = av
+ .getAlignment().getWidth(), g, gSize, f, fSize, sy;
StringBuffer text = new StringBuffer();
PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));
out.println(jalview.io.HTMLOutput.getImageMapHTML());
@@ -1157,33 +1407,31 @@ public class AlignmentPanel extends GAlignmentPanel implements
for (s = 0; s < sSize; s++)
{
- sy = s * av.charHeight + scaleHeight;
+ sy = s * av.getCharHeight() + scaleHeight;
- SequenceI seq = av.alignment.getSequenceAt(s);
- SequenceFeature[] features = seq.getDatasetSequence()
- .getSequenceFeatures();
- SequenceGroup[] groups = av.alignment.findAllGroups(seq);
+ SequenceI seq = av.getAlignment().getSequenceAt(s);
+ SequenceFeature[] features = seq.getSequenceFeatures();
+ SequenceGroup[] groups = av.getAlignment().findAllGroups(seq);
for (res = 0; res < alwidth; res++)
{
text = new StringBuffer();
- Object obj = null;
- if (av.alignment.isNucleotide())
+ String triplet = null;
+ if (av.getAlignment().isNucleotide())
{
- obj = ResidueProperties.nucleotideName.get(seq.getCharAt(res)
- + "");
+ triplet = ResidueProperties.nucleotideName.get(seq
+ .getCharAt(res) + "");
}
else
{
- obj = ResidueProperties.aa2Triplet.get(seq.getCharAt(res)
+ triplet = ResidueProperties.aa2Triplet.get(seq.getCharAt(res)
+ "");
}
- if (obj == null)
+ if (triplet == null)
{
continue;
}
- String triplet = obj.toString();
int alIndex = seq.findPosition(res);
gSize = groups.length;
for (g = 0; g < gSize; g++)
@@ -1191,9 +1439,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
if (text.length() < 1)
{
text.append("<area shape=\"rect\" coords=\""
- + (idWidth + res * av.charWidth) + "," + sy + ","
- + (idWidth + (res + 1) * av.charWidth) + ","
- + (av.charHeight + sy) + "\""
+ + (idWidth + res * av.getCharWidth()) + "," + sy
+ + "," + (idWidth + (res + 1) * av.getCharWidth())
+ + "," + (av.getCharHeight() + sy) + "\""
+ " onMouseOver=\"toolTip('" + alIndex + " "
+ triplet);
}
@@ -1210,9 +1458,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
if (text.length() < 1)
{
text.append("<area shape=\"rect\" coords=\""
- + (idWidth + res * av.charWidth) + "," + sy + ","
- + (idWidth + (res + 1) * av.charWidth) + ","
- + (av.charHeight + sy) + "\""
+ + (idWidth + res * av.getCharWidth()) + "," + sy
+ + "," + (idWidth + (res + 1) * av.getCharWidth())
+ + "," + (av.getCharHeight() + sy) + "\""
+ " onMouseOver=\"toolTip('" + alIndex + " "
+ triplet);
}
@@ -1275,7 +1523,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
int getWrappedHeight()
{
- int seqPanelWidth = seqPanel.seqCanvas.getWidth();
+ int seqPanelWidth = getSeqPanel().seqCanvas.getWidth();
if (System.getProperty("java.awt.headless") != null
&& System.getProperty("java.awt.headless").equals("true"))
@@ -1285,26 +1533,26 @@ public class AlignmentPanel extends GAlignmentPanel implements
- alignFrame.getInsets().left - alignFrame.getInsets().right;
}
- int chunkWidth = seqPanel.seqCanvas
+ int chunkWidth = getSeqPanel().seqCanvas
.getWrappedCanvasWidth(seqPanelWidth);
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
int annotationHeight = 0;
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
- annotationHeight = annotationPanel.adjustPanelHeight();
+ annotationHeight = getAnnotationPanel().adjustPanelHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap
+ annotationHeight;
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
@@ -1320,15 +1568,19 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public void closePanel()
{
- PaintRefresher.RemoveComponent(seqPanel.seqCanvas);
- PaintRefresher.RemoveComponent(idPanel.idCanvas);
+ PaintRefresher.RemoveComponent(getSeqPanel().seqCanvas);
+ PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas());
PaintRefresher.RemoveComponent(this);
if (av != null)
{
- jalview.structure.StructureSelectionManager ssm = av.getStructureSelectionManager();
- ssm.removeStructureViewerListener(seqPanel, null);
- ssm.removeSelectionListener(seqPanel);
- av.alignment = null;
+ jalview.structure.StructureSelectionManager ssm = av
+ .getStructureSelectionManager();
+ ssm.removeStructureViewerListener(getSeqPanel(), null);
+ ssm.removeSelectionListener(getSeqPanel());
+ ssm.removeCommandListener(av);
+ ssm.removeStructureViewerListener(getSeqPanel(), null);
+ ssm.removeSelectionListener(getSeqPanel());
+ av.setAlignment(null);
av = null;
}
else
@@ -1345,85 +1597,29 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
public void updateAnnotation()
{
- updateAnnotation(false);
+ updateAnnotation(false, false);
}
public void updateAnnotation(boolean applyGlobalSettings)
{
- // TODO: this should be merged with other annotation update stuff - that
- // sits on AlignViewport
- boolean updateCalcs = false;
- boolean conv = av.isShowGroupConservation();
- boolean cons = av.isShowGroupConsensus();
- boolean showprf = av.isShowSequenceLogo();
- boolean showConsHist = av.isShowConsensusHistogram();
-
- boolean sortg = true;
-
- // remove old automatic annotation
- // add any new annotation
-
- Vector gr = av.alignment.getGroups(); // OrderedBy(av.alignment.getSequencesArray());
- // intersect alignment annotation with alignment groups
+ updateAnnotation(applyGlobalSettings, false);
+ }
- AlignmentAnnotation[] aan = av.alignment.getAlignmentAnnotation();
- Hashtable oldrfs = new Hashtable();
- if (aan != null)
- {
- for (int an = 0; an < aan.length; an++)
- {
- if (aan[an].autoCalculated && aan[an].groupRef != null)
- {
- oldrfs.put(aan[an].groupRef, aan[an].groupRef);
- av.alignment.deleteAnnotation(aan[an]);
- aan[an] = null;
- }
- }
- }
- SequenceGroup sg;
- if (gr != null)
- {
- for (int g = 0; g < gr.size(); g++)
- {
- updateCalcs = false;
- sg = (SequenceGroup) gr.elementAt(g);
- if (applyGlobalSettings || !oldrfs.containsKey(sg))
- {
- // set defaults for this group's conservation/consensus
- sg.setshowSequenceLogo(showprf);
- sg.setShowConsensusHistogram(showConsHist);
- }
- if (conv)
- {
- updateCalcs = true;
- av.alignment.addAnnotation(sg.getConservationRow(), 0);
- }
- if (cons)
- {
- updateCalcs = true;
- av.alignment.addAnnotation(sg.getConsensus(), 0);
- }
- // refresh the annotation rows
- if (updateCalcs)
- {
- sg.recalcConservation();
- }
- }
- }
- oldrfs.clear();
+ public void updateAnnotation(boolean applyGlobalSettings,
+ boolean preserveNewGroupSettings)
+ {
+ av.updateGroupAnnotationSettings(applyGlobalSettings,
+ preserveNewGroupSettings);
adjustAnnotationHeight();
}
@Override
public AlignmentI getAlignment()
{
- return av.alignment;
+ return av == null ? null : av.getAlignment();
}
- /**
- * get the name for this view
- * @return
- */
+ @Override
public String getViewName()
{
return av.viewName;
@@ -1431,18 +1627,29 @@ public class AlignmentPanel extends GAlignmentPanel implements
/**
* Make/Unmake this alignment panel the current input focus
+ *
* @param b
*/
public void setSelected(boolean b)
{
- try {
+ try
+ {
+ if (alignFrame.getSplitViewContainer() != null)
+ {
+ /*
+ * bring enclosing SplitFrame to front first if there is one
+ */
+ ((SplitFrame) alignFrame.getSplitViewContainer()).setSelected(b);
+ }
alignFrame.setSelected(b);
- } catch (Exception ex) {};
-
+ } catch (Exception ex)
+ {
+ }
+
if (b)
{
alignFrame.setDisplayedView(this);
- }
+ }
}
@Override
@@ -1450,4 +1657,146 @@ public class AlignmentPanel extends GAlignmentPanel implements
{
return av.getStructureSelectionManager();
}
+
+ @Override
+ public void raiseOOMWarning(String string, OutOfMemoryError error)
+ {
+ new OOMWarning(string, error, this);
+ }
+
+ @Override
+ public jalview.api.FeatureRenderer cloneFeatureRenderer()
+ {
+
+ return new FeatureRenderer(this);
+ }
+
+ @Override
+ public jalview.api.FeatureRenderer getFeatureRenderer()
+ {
+ return seqPanel.seqCanvas.getFeatureRenderer();
+ }
+
+ public void updateFeatureRenderer(
+ jalview.renderer.seqfeatures.FeatureRenderer fr)
+ {
+ fr.transferSettings(getSeqPanel().seqCanvas.getFeatureRenderer());
+ }
+
+ public void updateFeatureRendererFrom(jalview.api.FeatureRenderer fr)
+ {
+ if (getSeqPanel().seqCanvas.getFeatureRenderer() != null)
+ {
+ getSeqPanel().seqCanvas.getFeatureRenderer().transferSettings(fr);
+ }
+ }
+
+ public ScalePanel getScalePanel()
+ {
+ return scalePanel;
+ }
+
+ public void setScalePanel(ScalePanel scalePanel)
+ {
+ this.scalePanel = scalePanel;
+ }
+
+ public SeqPanel getSeqPanel()
+ {
+ return seqPanel;
+ }
+
+ public void setSeqPanel(SeqPanel seqPanel)
+ {
+ this.seqPanel = seqPanel;
+ }
+
+ public AnnotationPanel getAnnotationPanel()
+ {
+ return annotationPanel;
+ }
+
+ public void setAnnotationPanel(AnnotationPanel annotationPanel)
+ {
+ this.annotationPanel = annotationPanel;
+ }
+
+ public AnnotationLabels getAlabels()
+ {
+ return alabels;
+ }
+
+ public void setAlabels(AnnotationLabels alabels)
+ {
+ this.alabels = alabels;
+ }
+
+ public IdPanel getIdPanel()
+ {
+ return idPanel;
+ }
+
+ public void setIdPanel(IdPanel idPanel)
+ {
+ this.idPanel = idPanel;
+ }
+
+ /**
+ * Follow a scrolling change in the (cDNA/Protein) complementary alignment.
+ * The aim is to keep the two alignments 'lined up' on their centre columns.
+ *
+ * @param sr
+ * holds mapped region(s) of this alignment that we are scrolling
+ * 'to'; may be modified for sequence offset by this method
+ * @param verticalOffset
+ * the number of visible sequences to show above the mapped region
+ */
+ public void scrollToCentre(SearchResults sr, int verticalOffset)
+ {
+ /*
+ * To avoid jumpy vertical scrolling (if some sequences are gapped or not
+ * mapped), we can make the scroll-to location a sequence above the one
+ * actually mapped.
+ */
+ SequenceI mappedTo = sr.getResultSequence(0);
+ List<SequenceI> seqs = av.getAlignment().getSequences();
+
+ /*
+ * This is like AlignmentI.findIndex(seq) but here we are matching the
+ * dataset sequence not the aligned sequence
+ */
+ boolean matched = false;
+ for (SequenceI seq : seqs)
+ {
+ if (mappedTo == seq.getDatasetSequence())
+ {
+ matched = true;
+ break;
+ }
+ }
+ if (!matched)
+ {
+ return; // failsafe, shouldn't happen
+ }
+
+ /*
+ * Scroll to position but centring the target residue.
+ */
+ scrollToPosition(sr, verticalOffset, true, true);
+ }
+
+ /**
+ * Set a flag to say we are scrolling to follow a (cDNA/protein) complement.
+ *
+ * @param b
+ */
+ protected void setFollowingComplementScroll(boolean b)
+ {
+ this.followingComplementScroll = b;
+ }
+
+ protected boolean isFollowingComplementScroll()
+ {
+ return this.followingComplementScroll;
+ }
}
diff --git a/src/jalview/gui/AnnotationChooser.java b/src/jalview/gui/AnnotationChooser.java
new file mode 100644
index 0000000..35b6032
--- /dev/null
+++ b/src/jalview/gui/AnnotationChooser.java
@@ -0,0 +1,657 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceGroup;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Checkbox;
+import java.awt.CheckboxGroup;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JButton;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+
+/**
+ * A panel that allows the user to select which sequence-associated annotation
+ * rows to show or hide.
+ *
+ * @author gmcarstairs
+ *
+ */
+ at SuppressWarnings("serial")
+public class AnnotationChooser extends JPanel
+{
+
+ private static final Font CHECKBOX_FONT = new Font("Serif", Font.BOLD, 12);
+
+ private static final int MY_FRAME_WIDTH = 600;
+
+ private static final int MY_FRAME_HEIGHT = 250;
+
+ private JInternalFrame frame;
+
+ private AlignmentPanel ap;
+
+ private SequenceGroup sg;
+
+ // all annotation rows' original visible state
+ private boolean[] resetState = null;
+
+ // is 'Show' selected?
+ private boolean showSelected;
+
+ // apply settings to selected (or all) sequences?
+ private boolean applyToSelectedSequences;
+
+ // apply settings to unselected (or all) sequences?
+ private boolean applyToUnselectedSequences;
+
+ // currently selected 'annotation type' checkboxes
+ private Map<String, String> selectedTypes = new HashMap<String, String>();
+
+ /**
+ * Constructor.
+ *
+ * @param alignPane
+ */
+ public AnnotationChooser(AlignmentPanel alignPane)
+ {
+ super();
+ this.ap = alignPane;
+ this.sg = alignPane.av.getSelectionGroup();
+ saveResetState(alignPane.getAlignment());
+
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ showFrame();
+ }
+
+ /**
+ * Save the initial show/hide state of all annotations to allow a Cancel
+ * operation.
+ *
+ * @param alignment
+ */
+ protected void saveResetState(AlignmentI alignment)
+ {
+ AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation();
+ final int count = annotations.length;
+ this.resetState = new boolean[count];
+ for (int i = 0; i < count; i++)
+ {
+ this.resetState[i] = annotations[i].visible;
+ }
+ }
+
+ /**
+ * Populate this frame with:
+ * <p>
+ * checkboxes for the types of annotation to show or hide (i.e. any annotation
+ * type shown for any sequence in the whole alignment)
+ * <p>
+ * option to show or hide selected types
+ * <p>
+ * option to show/hide for the currently selected group, or its inverse
+ * <p>
+ * OK and Cancel (reset) buttons
+ */
+ protected void jbInit()
+ {
+ setLayout(new GridLayout(3, 1));
+ add(buildAnnotationTypesPanel());
+ add(buildShowHideOptionsPanel());
+ add(buildActionButtonsPanel());
+ validate();
+ }
+
+ /**
+ * Construct the panel with checkboxes for annotation types.
+ *
+ * @return
+ */
+ protected JPanel buildAnnotationTypesPanel()
+ {
+ JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT));
+
+ List<String> annotationTypes = getAnnotationTypes(
+ this.ap.getAlignment(), true);
+
+ for (final String type : annotationTypes)
+ {
+ final Checkbox check = new Checkbox(type);
+ check.setFont(CHECKBOX_FONT);
+ check.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (evt.getStateChange() == ItemEvent.SELECTED)
+ {
+ AnnotationChooser.this.selectedTypes.put(type, type);
+ }
+ else
+ {
+ AnnotationChooser.this.selectedTypes.remove(type);
+ }
+ changeTypeSelected_actionPerformed(type);
+ }
+ });
+ jp.add(check);
+ }
+ return jp;
+ }
+
+ /**
+ * Update display when scope (All/Selected sequences/Unselected) is changed.
+ * <p>
+ * Set annotations (with one of the selected types) to the selected Show/Hide
+ * visibility, if they are in the new application scope. Set to the opposite
+ * if outside the scope.
+ * <p>
+ * Note this only affects sequence-specific annotations, others are left
+ * unchanged.
+ */
+ protected void changeApplyTo_actionPerformed()
+ {
+ setAnnotationVisibility(true);
+
+ // copied from AnnotationLabel.actionPerformed (after show/hide row)...
+ // TODO should drive this functionality into AlignmentPanel
+ ap.updateAnnotation();
+ // this.ap.annotationPanel.adjustPanelHeight();
+ // this.ap.alabels.setSize(this.ap.alabels.getSize().width,
+ // this.ap.annotationPanel.getSize().height);
+ // this.ap.validate();
+ this.ap.paintAlignment(true);
+ }
+
+ /**
+ * Update display when an annotation type is selected or deselected.
+ * <p>
+ * If the type is selected, set visibility of annotations of that type which
+ * are in the application scope (all, selected or unselected sequences).
+ * <p>
+ * If the type is unselected, set visibility to the opposite value. That is,
+ * treat select/deselect as a 'toggle' operation.
+ *
+ * @param type
+ */
+ protected void changeTypeSelected_actionPerformed(String type)
+ {
+ boolean typeSelected = this.selectedTypes.containsKey(type);
+ for (AlignmentAnnotation aa : this.ap.getAlignment()
+ .getAlignmentAnnotation())
+ {
+ if (aa.sequenceRef != null && type.equals(aa.label)
+ && isInActionScope(aa))
+ {
+ aa.visible = typeSelected ? this.showSelected : !this.showSelected;
+ }
+ }
+ ap.updateAnnotation();
+ // // this.ap.annotationPanel.adjustPanelHeight();
+ // this.ap.alabels.setSize(this.ap.alabels.getSize().width,
+ // this.ap.annotationPanel.getSize().height);
+ // this.ap.validate();
+ this.ap.paintAlignment(true);
+ }
+
+ /**
+ * Update display on change of choice of Show or Hide
+ * <p>
+ * For annotations of any selected type, set visibility of annotations of that
+ * type which are in the application scope (all, selected or unselected
+ * sequences).
+ *
+ * @param type
+ */
+ protected void changeShowHide_actionPerformed()
+ {
+ setAnnotationVisibility(false);
+
+ this.ap.updateAnnotation();
+ // this.ap.annotationPanel.adjustPanelHeight();
+ this.ap.paintAlignment(true);
+ }
+
+ /**
+ * Update visibility flags on annotation rows as per the current user choices.
+ *
+ * @param updateAllRows
+ */
+ protected void setAnnotationVisibility(boolean updateAllRows)
+ {
+ for (AlignmentAnnotation aa : this.ap.getAlignment()
+ .getAlignmentAnnotation())
+ {
+ if (aa.sequenceRef != null)
+ {
+ setAnnotationVisibility(aa, updateAllRows);
+ }
+ }
+ }
+
+ /**
+ * Determine and set the visibility of the given annotation from the currently
+ * selected options.
+ * <p>
+ * Only update annotations whose type is one of the selected types.
+ * <p>
+ * If its sequence is in the selected application scope
+ * (all/selected/unselected sequences), then we set its visibility according
+ * to the current choice of Show or Hide.
+ * <p>
+ * If force update of all rows is wanted, then set rows not in the sequence
+ * selection scope to the opposite visibility to those in scope.
+ *
+ * @param aa
+ * @param updateAllRows
+ */
+ protected void setAnnotationVisibility(AlignmentAnnotation aa,
+ boolean updateAllRows)
+ {
+ if (this.selectedTypes.containsKey(aa.label))
+ {
+ if (isInActionScope(aa))
+ {
+ aa.visible = this.showSelected;
+ }
+ else if (updateAllRows)
+ {
+ aa.visible = !this.showSelected;
+ }
+ }
+ // TODO force not visible if associated sequence is hidden?
+ // currently hiding a sequence does not hide its annotation rows
+ }
+
+ /**
+ * Answers true if the annotation falls in the current selection criteria for
+ * show/hide.
+ * <p>
+ * It must be in the sequence selection group (for 'Apply to selection'), or
+ * not in it (for 'Apply except to selection'). No check needed for 'Apply to
+ * all'.
+ *
+ * @param aa
+ * @return
+ */
+ protected boolean isInActionScope(AlignmentAnnotation aa)
+ {
+ boolean result = false;
+ if (this.applyToSelectedSequences && this.applyToUnselectedSequences)
+ {
+ // we don't care if the annotation's sequence is selected or not
+ result = true;
+ }
+ else if (this.sg == null)
+ {
+ // shouldn't happen - defensive programming
+ result = true;
+ }
+ else if (this.sg.getSequences().contains(aa.sequenceRef))
+ {
+ // annotation is for a member of the selection group
+ result = this.applyToSelectedSequences ? true : false;
+ }
+ else
+ {
+ // annotation is not associated with the selection group
+ result = this.applyToUnselectedSequences ? true : false;
+ }
+ return result;
+ }
+
+ /**
+ * Get annotation 'types' for an alignment, optionally restricted to
+ * sequence-specific annotations only. The label is currently used for 'type'.
+ *
+ * TODO refactor to helper class. See
+ * AnnotationColourChooser.getAnnotationItems() for another client
+ *
+ * @param alignment
+ * @param sequenceSpecific
+ * @return
+ */
+ public static List<String> getAnnotationTypes(AlignmentI alignment,
+ boolean sequenceSpecificOnly)
+ {
+ List<String> result = new ArrayList<String>();
+ for (AlignmentAnnotation aa : alignment.getAlignmentAnnotation())
+ {
+ if (!sequenceSpecificOnly || aa.sequenceRef != null)
+ {
+ String label = aa.label;
+ if (!result.contains(label))
+ {
+ result.add(label);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Construct the panel with options to:
+ * <p>
+ * show or hide the selected annotation types
+ * <p>
+ * do this for the current selection group or its inverse
+ *
+ * @return
+ */
+ protected JPanel buildShowHideOptionsPanel()
+ {
+ JPanel jp = new JPanel();
+ jp.setLayout(new BorderLayout());
+
+ JPanel showHideOptions = buildShowHidePanel();
+ jp.add(showHideOptions, BorderLayout.CENTER);
+
+ JPanel applyToOptions = buildApplyToOptionsPanel();
+ jp.add(applyToOptions, BorderLayout.SOUTH);
+
+ return jp;
+ }
+
+ /**
+ * Build a panel with radio buttons options for sequences to apply show/hide
+ * to. Options are all, current selection, all except current selection.
+ * Initial state has 'current selection' selected.
+ * <p>
+ * If the sequence group is null, then we are acting on the whole alignment,
+ * and only 'all sequences' is enabled (and selected).
+ *
+ * @return
+ */
+ protected JPanel buildApplyToOptionsPanel()
+ {
+ final boolean wholeAlignment = this.sg == null;
+ JPanel applyToOptions = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ CheckboxGroup actingOn = new CheckboxGroup();
+
+ String forAll = MessageManager.getString("label.all_sequences");
+ final Checkbox allSequences = new Checkbox(forAll, actingOn,
+ wholeAlignment);
+ allSequences.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (evt.getStateChange() == ItemEvent.SELECTED)
+ {
+ AnnotationChooser.this.setApplyToSelectedSequences(true);
+ AnnotationChooser.this.setApplyToUnselectedSequences(true);
+ AnnotationChooser.this.changeApplyTo_actionPerformed();
+ }
+ }
+ });
+ applyToOptions.add(allSequences);
+
+ String forSelected = MessageManager
+ .getString("label.selected_sequences");
+ final Checkbox selectedSequences = new Checkbox(forSelected, actingOn,
+ !wholeAlignment);
+ selectedSequences.setEnabled(!wholeAlignment);
+ selectedSequences.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (evt.getStateChange() == ItemEvent.SELECTED)
+ {
+ AnnotationChooser.this.setApplyToSelectedSequences(true);
+ AnnotationChooser.this.setApplyToUnselectedSequences(false);
+ AnnotationChooser.this.changeApplyTo_actionPerformed();
+ }
+ }
+ });
+ applyToOptions.add(selectedSequences);
+
+ String exceptSelected = MessageManager
+ .getString("label.except_selected_sequences");
+ final Checkbox unselectedSequences = new Checkbox(exceptSelected,
+ actingOn, false);
+ unselectedSequences.setEnabled(!wholeAlignment);
+ unselectedSequences.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (evt.getStateChange() == ItemEvent.SELECTED)
+ {
+ AnnotationChooser.this.setApplyToSelectedSequences(false);
+ AnnotationChooser.this.setApplyToUnselectedSequences(true);
+ AnnotationChooser.this.changeApplyTo_actionPerformed();
+ }
+ }
+ });
+ applyToOptions.add(unselectedSequences);
+
+ // set member variables to match the initial selection state
+ this.applyToSelectedSequences = selectedSequences.getState()
+ || allSequences.getState();
+ this.applyToUnselectedSequences = unselectedSequences.getState()
+ || allSequences.getState();
+
+ return applyToOptions;
+ }
+
+ /**
+ * Build a panel with radio button options to show or hide selected
+ * annotations.
+ *
+ * @return
+ */
+ protected JPanel buildShowHidePanel()
+ {
+ JPanel showHideOptions = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ CheckboxGroup showOrHide = new CheckboxGroup();
+
+ /*
+ * Radio button 'Show selected annotations' - initially unselected
+ */
+ String showLabel = MessageManager
+ .getString("label.show_selected_annotations");
+ final Checkbox showOption = new Checkbox(showLabel, showOrHide, false);
+ showOption.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (evt.getStateChange() == ItemEvent.SELECTED)
+ {
+ AnnotationChooser.this.setShowSelected(true);
+ AnnotationChooser.this.changeShowHide_actionPerformed();
+ }
+ }
+ });
+ showHideOptions.add(showOption);
+
+ /*
+ * Radio button 'hide selected annotations'- initially selected
+ */
+ String hideLabel = MessageManager
+ .getString("label.hide_selected_annotations");
+ final Checkbox hideOption = new Checkbox(hideLabel, showOrHide, true);
+ hideOption.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (evt.getStateChange() == ItemEvent.SELECTED)
+ {
+ AnnotationChooser.this.setShowSelected(false);
+ AnnotationChooser.this.changeShowHide_actionPerformed();
+ }
+ }
+ });
+ showHideOptions.add(hideOption);
+
+ /*
+ * Set member variable to match initial selection state
+ */
+ this.showSelected = showOption.getState();
+
+ return showHideOptions;
+ }
+
+ /**
+ * Construct the panel with OK and Cancel buttons.
+ *
+ * @return
+ */
+ protected JPanel buildActionButtonsPanel()
+ {
+ JPanel jp = new JPanel();
+ final Font labelFont = JvSwingUtils.getLabelFont();
+
+ JButton ok = new JButton(MessageManager.getString("action.ok"));
+ ok.setFont(labelFont);
+ ok.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ close_actionPerformed();
+ }
+ });
+ jp.add(ok);
+
+ JButton cancel = new JButton(MessageManager.getString("action.cancel"));
+ cancel.setFont(labelFont);
+ cancel.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed();
+ }
+ });
+ jp.add(cancel);
+
+ return jp;
+ }
+
+ /**
+ * On 'Cancel' button, undo any changes.
+ */
+ protected void cancel_actionPerformed()
+ {
+ resetOriginalState();
+ this.ap.repaint();
+ close_actionPerformed();
+ }
+
+ /**
+ * Restore annotation visibility to their state on entry here, and repaint
+ * alignment.
+ */
+ protected void resetOriginalState()
+ {
+ int i = 0;
+ for (AlignmentAnnotation aa : this.ap.getAlignment()
+ .getAlignmentAnnotation())
+ {
+ aa.visible = this.resetState[i++];
+ }
+ }
+
+ /**
+ * On 'Close' button, close the dialog.
+ */
+ protected void close_actionPerformed()
+ {
+ try
+ {
+ this.frame.setClosed(true);
+ } catch (Exception exe)
+ {
+ }
+ }
+
+ /**
+ * Render a frame containing this panel.
+ */
+ private void showFrame()
+ {
+ frame = new JInternalFrame();
+ frame.setContentPane(this);
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("label.choose_annotations"),
+ MY_FRAME_WIDTH, MY_FRAME_HEIGHT, true);
+ }
+
+ protected void setShowSelected(boolean showSelected)
+ {
+ this.showSelected = showSelected;
+ }
+
+ protected void setApplyToSelectedSequences(
+ boolean applyToSelectedSequences)
+ {
+ this.applyToSelectedSequences = applyToSelectedSequences;
+ }
+
+ protected void setApplyToUnselectedSequences(
+ boolean applyToUnselectedSequences)
+ {
+ this.applyToUnselectedSequences = applyToUnselectedSequences;
+ }
+
+ protected boolean isShowSelected()
+ {
+ return showSelected;
+ }
+
+ protected boolean isApplyToSelectedSequences()
+ {
+ return applyToSelectedSequences;
+ }
+
+ protected boolean isApplyToUnselectedSequences()
+ {
+ return applyToUnselectedSequences;
+ }
+
+}
diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java
index eca0b4c..adfb520 100644
--- a/src/jalview/gui/AnnotationColourChooser.java
+++ b/src/jalview/gui/AnnotationColourChooser.java
@@ -1,152 +1,150 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
+import jalview.bin.Cache;
+import jalview.datamodel.SequenceGroup;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.ColourSchemeI;
+import jalview.util.MessageManager;
-import javax.swing.*;
-import javax.swing.event.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Hashtable;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JColorChooser;
+import javax.swing.JComboBox;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
-import jalview.bin.Cache;
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import java.awt.Dimension;
-
-public class AnnotationColourChooser extends JPanel
+ at SuppressWarnings("serial")
+public class AnnotationColourChooser extends AnnotationRowFilter
{
- JInternalFrame frame;
- AlignViewport av;
+ ColourSchemeI oldcs;
- AlignmentPanel ap;
+ Hashtable<SequenceGroup, ColourSchemeI> oldgroupColours;
- ColourSchemeI oldcs;
+ /**
+ * enabled if the user is dragging the slider - try to keep updates to a
+ * minimun
+ */
+
+ JComboBox<String> annotations;
+
+ JButton defColours = new JButton();
- Hashtable oldgroupColours;
+ JPanel jPanel1 = new JPanel();
+
+ JPanel jPanel2 = new JPanel();
- jalview.datamodel.AlignmentAnnotation currentAnnotation;
+ BorderLayout borderLayout1 = new BorderLayout();
- boolean adjusting = false;
+ private JComboBox<String> threshold = new JComboBox<String>();
public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap)
{
+ super(av, ap);
oldcs = av.getGlobalColourScheme();
- if (av.alignment.getGroups() != null)
+ if (av.getAlignment().getGroups() != null)
{
- oldgroupColours = new Hashtable();
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ oldgroupColours = new Hashtable<SequenceGroup, ColourSchemeI>();
+ for (SequenceGroup sg : ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.get(g);
if (sg.cs != null)
{
oldgroupColours.put(sg, sg.cs);
}
}
}
- this.av = av;
- this.ap = ap;
frame = new JInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
- Desktop.addInternalFrame(frame, "Colour by Annotation", 520, 215);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("label.colour_by_annotation"), 520,
+ 215);
- slider.addChangeListener(new ChangeListener()
- {
- public void stateChanged(ChangeEvent evt)
- {
- if (!adjusting)
- {
- thresholdValue.setText(((float) slider.getValue() / 1000f) + "");
- valueChanged();
- }
- }
- });
- slider.addMouseListener(new MouseAdapter()
- {
- public void mouseReleased(MouseEvent evt)
- {
- ap.paintAlignment(true);
- }
- });
+ addSliderChangeListener();
+ addSliderMouseListeners();
- if (av.alignment.getAlignmentAnnotation() == null)
+ if (av.getAlignment().getAlignmentAnnotation() == null)
{
return;
}
// Always get default shading from preferences.
setDefaultMinMax();
-
+
+ adjusting = true;
if (oldcs instanceof AnnotationColourGradient)
{
AnnotationColourGradient acg = (AnnotationColourGradient) oldcs;
- currentColours.setSelected(acg.predefinedColours);
- if (!acg.predefinedColours)
+ currentColours.setSelected(acg.isPredefinedColours()
+ || acg.getBaseColour() != null);
+ if (!acg.isPredefinedColours() && acg.getBaseColour() == null)
{
- minColour.setBackground(acg.getMinColour());
+ minColour.setBackground(acg.getMinColour());
maxColour.setBackground(acg.getMaxColour());
}
- }
+ seqAssociated.setSelected(acg.isSeqAssociated());
- adjusting = true;
- Vector list = new Vector();
- int index = 1;
- for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)
- {
- String label = av.alignment.getAlignmentAnnotation()[i].label;
- if (!list.contains(label))
- list.addElement(label);
- else
- list.addElement(label + "_" + (index++));
}
+ annotations = new JComboBox<String>(
+ getAnnotationItems(seqAssociated.isSelected()));
- annotations = new JComboBox(list);
-
- threshold.addItem("No Threshold");
- threshold.addItem("Above Threshold");
- threshold.addItem("Below Threshold");
+ populateThresholdComboBox(threshold);
if (oldcs instanceof AnnotationColourGradient)
{
AnnotationColourGradient acg = (AnnotationColourGradient) oldcs;
annotations.setSelectedItem(acg.getAnnotation());
- switch (acg.getAboveThreshold()) {
+ switch (acg.getAboveThreshold())
+ {
case AnnotationColourGradient.NO_THRESHOLD:
- threshold.setSelectedItem("No Threshold");
+ getThreshold().setSelectedIndex(0);
break;
case AnnotationColourGradient.ABOVE_THRESHOLD:
- threshold.setSelectedItem("Above Threshold");
+ getThreshold().setSelectedIndex(1);
break;
case AnnotationColourGradient.BELOW_THRESHOLD:
- threshold.setSelectedItem("Below Threshold");
+ getThreshold().setSelectedIndex(2);
break;
- default:
- throw new Error("Implementation error: don't know about threshold setting for current AnnotationColourGradient.");
+ default:
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_dont_know_about_thereshold_setting"));
}
thresholdIsMin.setSelected(acg.thresholdIsMinMax);
- thresholdValue.setText(""+acg.getAnnotationThreshold());
+ thresholdValue.setText("" + acg.getAnnotationThreshold());
}
try
@@ -155,18 +153,11 @@ public class AnnotationColourChooser extends JPanel
} catch (Exception ex)
{
}
-
adjusting = false;
- changeColour();
- validate();
-
- }
-
- private void setDefaultMinMax()
- {
- minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange));
- maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red));
+ updateView();
+ frame.invalidate();
+ frame.pack();
}
public AnnotationColourChooser()
@@ -185,9 +176,10 @@ public class AnnotationColourChooser extends JPanel
minColour.setFont(JvSwingUtils.getLabelFont());
minColour.setBorder(BorderFactory.createEtchedBorder());
minColour.setPreferredSize(new Dimension(40, 20));
- minColour.setToolTipText("Minimum Colour");
+ minColour.setToolTipText(MessageManager.getString("label.min_colour"));
minColour.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent e)
{
if (minColour.isEnabled())
@@ -199,9 +191,10 @@ public class AnnotationColourChooser extends JPanel
maxColour.setFont(JvSwingUtils.getLabelFont());
maxColour.setBorder(BorderFactory.createEtchedBorder());
maxColour.setPreferredSize(new Dimension(40, 20));
- maxColour.setToolTipText("Maximum Colour");
+ maxColour.setToolTipText(MessageManager.getString("label.max_colour"));
maxColour.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent e)
{
if (maxColour.isEnabled())
@@ -211,45 +204,50 @@ public class AnnotationColourChooser extends JPanel
}
});
ok.setOpaque(false);
- ok.setText("OK");
+ ok.setText(MessageManager.getString("action.ok"));
ok.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
ok_actionPerformed(e);
}
});
cancel.setOpaque(false);
- cancel.setText("Cancel");
+ cancel.setText(MessageManager.getString("action.cancel"));
cancel.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
cancel_actionPerformed(e);
}
});
defColours.setOpaque(false);
- defColours.setText("Defaults");
- defColours.setToolTipText("Reset min and max colours to defaults from user preferences.");
+ defColours.setText(MessageManager.getString("action.set_defaults"));
+ defColours.setToolTipText(MessageManager
+ .getString("label.reset_min_max_colours_to_defaults"));
defColours.addActionListener(new ActionListener()
{
-
+
@Override
public void actionPerformed(ActionEvent arg0)
{
resetColours_actionPerformed(arg0);
}
});
-
+
annotations.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
annotations_actionPerformed(e);
}
});
- threshold.addActionListener(new ActionListener()
+ getThreshold().addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
threshold_actionPerformed(e);
@@ -257,6 +255,7 @@ public class AnnotationColourChooser extends JPanel
});
thresholdValue.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
thresholdValue_actionPerformed(e);
@@ -272,9 +271,11 @@ public class AnnotationColourChooser extends JPanel
thresholdValue.setColumns(7);
currentColours.setFont(JvSwingUtils.getLabelFont());
currentColours.setOpaque(false);
- currentColours.setText("Use Original Colours");
+ currentColours.setText(MessageManager
+ .getString("label.use_original_colours"));
currentColours.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
currentColours_actionPerformed(e);
@@ -282,298 +283,202 @@ public class AnnotationColourChooser extends JPanel
});
thresholdIsMin.setBackground(Color.white);
thresholdIsMin.setFont(JvSwingUtils.getLabelFont());
- thresholdIsMin.setText("Threshold is Min/Max");
+ thresholdIsMin.setText(MessageManager
+ .getString("label.threshold_minmax"));
thresholdIsMin.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
thresholdIsMin_actionPerformed(actionEvent);
}
});
+ seqAssociated.setBackground(Color.white);
+ seqAssociated.setFont(JvSwingUtils.getLabelFont());
+ seqAssociated.setText(MessageManager
+ .getString("label.per_sequence_only"));
+ seqAssociated.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ seqAssociated_actionPerformed(arg0, annotations, seqAssociated);
+ }
+ });
+
this.setLayout(borderLayout1);
- jPanel2.setLayout(new MigLayout("","[left][center][right]","[][][]"));
+ jPanel2.setLayout(new MigLayout("", "[left][center][right]", "[][][]"));
jPanel1.setBackground(Color.white);
jPanel2.setBackground(Color.white);
jPanel1.add(ok);
jPanel1.add(cancel);
- jPanel2.add(annotations);
+ jPanel2.add(annotations, "grow, wrap");
+ jPanel2.add(seqAssociated);
jPanel2.add(currentColours);
JPanel colpanel = new JPanel(new FlowLayout());
colpanel.setBackground(Color.white);
colpanel.add(minColour);
colpanel.add(maxColour);
jPanel2.add(colpanel, "wrap");
-
- jPanel2.add(threshold);
- jPanel2.add(defColours,"skip 1, wrap");
+ jPanel2.add(getThreshold());
+ jPanel2.add(defColours, "skip 1, wrap");
jPanel2.add(thresholdIsMin);
jPanel2.add(slider, "grow");
jPanel2.add(thresholdValue, "grow");
this.add(jPanel1, java.awt.BorderLayout.SOUTH);
this.add(jPanel2, java.awt.BorderLayout.CENTER);
+ this.validate();
}
protected void resetColours_actionPerformed(ActionEvent arg0)
{
setDefaultMinMax();
- changeColour();
+ updateView();
}
- JComboBox annotations;
-
- JPanel minColour = new JPanel();
-
- JPanel maxColour = new JPanel();
- JButton defColours = new JButton();
- JButton ok = new JButton();
-
- JButton cancel = new JButton();
-
- JPanel jPanel1 = new JPanel();
- JPanel jPanel2 = new JPanel();
-
- BorderLayout borderLayout1 = new BorderLayout();
-
- JComboBox threshold = new JComboBox();
-
-
- JSlider slider = new JSlider();
-
- JTextField thresholdValue = new JTextField(20);
-
- JCheckBox currentColours = new JCheckBox();
-
- JCheckBox thresholdIsMin = new JCheckBox();
+ private void setDefaultMinMax()
+ {
+ minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN",
+ Color.orange));
+ maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX",
+ Color.red));
+ }
public void minColour_actionPerformed()
{
Color col = JColorChooser.showDialog(this,
- "Select Colour for Minimum Value", minColour.getBackground());
+ MessageManager.getString("label.select_colour_minimum_value"),
+ minColour.getBackground());
if (col != null)
{
minColour.setBackground(col);
}
minColour.repaint();
- changeColour();
+ updateView();
}
public void maxColour_actionPerformed()
{
Color col = JColorChooser.showDialog(this,
- "Select Colour for Maximum Value", maxColour.getBackground());
+ MessageManager.getString("label.select_colour_maximum_value"),
+ maxColour.getBackground());
if (col != null)
{
maxColour.setBackground(col);
}
maxColour.repaint();
- changeColour();
+ updateView();
}
- void changeColour()
+ public void reset()
{
- // Check if combobox is still adjusting
- if (adjusting)
- {
- return;
- }
-
- currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations
- .getSelectedIndex()];
-
- int aboveThreshold = -1;
- if (threshold.getSelectedItem().equals("Above Threshold"))
- {
- aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD;
- }
- else if (threshold.getSelectedItem().equals("Below Threshold"))
- {
- aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;
- }
-
- slider.setEnabled(true);
- thresholdValue.setEnabled(true);
- thresholdIsMin.setEnabled(true);
-
- if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD)
- {
- slider.setEnabled(false);
- thresholdValue.setEnabled(false);
- thresholdValue.setText("");
- thresholdIsMin.setEnabled(false);
- }
- else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD
- && currentAnnotation.threshold == null)
- {
- currentAnnotation
- .setThreshold(new jalview.datamodel.GraphLine(
- (currentAnnotation.graphMax - currentAnnotation.graphMin) / 2f,
- "Threshold", Color.black));
- }
-
- if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD)
- {
- adjusting = true;
- float range = currentAnnotation.graphMax * 1000
- - currentAnnotation.graphMin * 1000;
-
- slider.setMinimum((int) (currentAnnotation.graphMin * 1000));
- slider.setMaximum((int) (currentAnnotation.graphMax * 1000));
- slider.setValue((int) (currentAnnotation.threshold.value * 1000));
- thresholdValue.setText(currentAnnotation.threshold.value + "");
- slider.setMajorTickSpacing((int) (range / 10f));
- slider.setEnabled(true);
- thresholdValue.setEnabled(true);
- adjusting = false;
- }
-
- AnnotationColourGradient acg = null;
- if (currentColours.isSelected())
- {
- acg = new AnnotationColourGradient(currentAnnotation,
- av.getGlobalColourScheme(), aboveThreshold);
- }
- else
- {
- acg = new AnnotationColourGradient(currentAnnotation,
- minColour.getBackground(), maxColour.getBackground(),
- aboveThreshold);
- }
-
- if (currentAnnotation.graphMin == 0f
- && currentAnnotation.graphMax == 0f)
+ av.setGlobalColourScheme(oldcs);
+ if (av.getAlignment().getGroups() != null)
{
- acg.predefinedColours = true;
- }
-
- acg.thresholdIsMinMax = thresholdIsMin.isSelected();
- av.setGlobalColourScheme(acg);
-
- if (av.alignment.getGroups() != null)
- {
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ for (SequenceGroup sg : ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.get(g);
-
- if (sg.cs == null)
- {
- continue;
- }
-
- if (currentColours.isSelected())
- {
- sg.cs = new AnnotationColourGradient(currentAnnotation, sg.cs,
- aboveThreshold);
- }
- else
- {
- sg.cs = new AnnotationColourGradient(currentAnnotation,
- minColour.getBackground(), maxColour.getBackground(),
- aboveThreshold);
- }
-
+ sg.cs = oldgroupColours.get(sg);
}
}
- // ensure all associated views (overviews, structures, etc) are notified of updated colours.
- ap.paintAlignment(true);
- }
-
- public void ok_actionPerformed(ActionEvent e)
- {
- changeColour();
- try
- {
- frame.setClosed(true);
- } catch (Exception ex)
- {
- }
- }
-
- public void cancel_actionPerformed(ActionEvent e)
- {
- reset();
- // ensure all original colouring is propagated to listeners.
- ap.paintAlignment(true);
- try
- {
- frame.setClosed(true);
- } catch (Exception ex)
- {
- }
}
- void reset()
+ public void valueChanged(boolean updateAllAnnotation)
{
- av.setGlobalColourScheme(oldcs);
- if (av.alignment.getGroups() != null)
+ if (slider.isEnabled())
{
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ if (currentColours.isSelected()
+ && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient))
{
- sg = (SequenceGroup) allGroups.get(g);
- sg.cs = (ColourSchemeI) oldgroupColours.get(sg);
+ updateView();
}
+ getCurrentAnnotation().threshold.value = slider.getValue() / 1000f;
+ propagateSeqAssociatedThreshold(updateAllAnnotation,
+ getCurrentAnnotation());
+ ap.paintAlignment(false);
}
}
- public void thresholdCheck_actionPerformed(ActionEvent e)
- {
- changeColour();
- }
-
- public void annotations_actionPerformed(ActionEvent e)
+ public JComboBox<String> getThreshold()
{
- changeColour();
+ return threshold;
}
- public void threshold_actionPerformed(ActionEvent e)
+ public void setThreshold(JComboBox<String> threshold)
{
- changeColour();
+ this.threshold = threshold;
}
- public void thresholdValue_actionPerformed(ActionEvent e)
+ public void currentColours_actionPerformed(ActionEvent e)
{
- try
- {
- float f = Float.parseFloat(thresholdValue.getText());
- slider.setValue((int) (f * 1000));
- } catch (NumberFormatException ex)
+ if (currentColours.isSelected())
{
+ reset();
}
+ maxColour.setEnabled(!currentColours.isSelected());
+ minColour.setEnabled(!currentColours.isSelected());
+ updateView();
}
- public void valueChanged()
+ @Override
+ public void updateView()
{
- if (currentColours.isSelected()
- && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient))
+ // Check if combobox is still adjusting
+ if (adjusting)
{
- changeColour();
+ return;
}
- currentAnnotation.threshold.value = (float) slider.getValue() / 1000f;
- ap.paintAlignment(false);
- }
+ setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[annmap[annotations
+ .getSelectedIndex()]]);
- public void currentColours_actionPerformed(ActionEvent e)
- {
- if (currentColours.isSelected())
+ int selectedThresholdItem = getSelectedThresholdItem(getThreshold()
+ .getSelectedIndex());
+
+ slider.setEnabled(true);
+ thresholdValue.setEnabled(true);
+ thresholdIsMin.setEnabled(true);
+
+ if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD)
{
- reset();
+ slider.setEnabled(false);
+ thresholdValue.setEnabled(false);
+ thresholdValue.setText("");
+ thresholdIsMin.setEnabled(false);
+ }
+ else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD
+ && getCurrentAnnotation().threshold == null)
+ {
+ getCurrentAnnotation()
+ .setThreshold(
+ new jalview.datamodel.GraphLine(
+ (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f,
+ "Threshold", Color.black));
}
- maxColour.setEnabled(!currentColours.isSelected());
- minColour.setEnabled(!currentColours.isSelected());
+ if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD)
+ {
+ adjusting = true;
+ float range = getCurrentAnnotation().graphMax * 1000
+ - getCurrentAnnotation().graphMin * 1000;
- changeColour();
- }
+ slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000));
+ slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000));
+ slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000));
+ thresholdValue.setText(getCurrentAnnotation().threshold.value + "");
+ slider.setMajorTickSpacing((int) (range / 10f));
+ slider.setEnabled(true);
+ thresholdValue.setEnabled(true);
+ adjusting = false;
+ }
+ colorAlignmContaining(getCurrentAnnotation(), selectedThresholdItem);
- public void thresholdIsMin_actionPerformed(ActionEvent actionEvent)
- {
- changeColour();
+ ap.alignmentChanged();
+ // ensure all associated views (overviews, structures, etc) are notified of
+ // updated colours.
+ ap.paintAlignment(true);
}
}
diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java
new file mode 100644
index 0000000..6b66d9c
--- /dev/null
+++ b/src/jalview/gui/AnnotationColumnChooser.java
@@ -0,0 +1,920 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.gui;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.util.MessageManager;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
+
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Iterator;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+import net.miginfocom.swing.MigLayout;
+
+ at SuppressWarnings("serial")
+public class AnnotationColumnChooser extends AnnotationRowFilter implements
+ ItemListener
+{
+
+ private JComboBox<String> annotations;
+
+ private JPanel actionPanel = new JPanel();
+
+ private JPanel thresholdPanel = new JPanel();
+
+ private JPanel switchableViewsPanel = new JPanel(new CardLayout());
+
+ private CardLayout switchableViewsLayout = (CardLayout) (switchableViewsPanel
+ .getLayout());
+
+ private JPanel noGraphFilterView = new JPanel();
+
+ private JPanel graphFilterView = new JPanel();
+
+ private JPanel annotationComboBoxPanel = new JPanel();
+
+ private BorderLayout borderLayout1 = new BorderLayout();
+
+ private JComboBox<String> threshold = new JComboBox<String>();
+
+ private StructureFilterPanel gStructureFilterPanel;
+
+ private StructureFilterPanel ngStructureFilterPanel;
+
+ private StructureFilterPanel currentStructureFilterPanel;
+
+ private SearchPanel currentSearchPanel;
+
+ private SearchPanel gSearchPanel;
+
+ private SearchPanel ngSearchPanel;
+
+ private FurtherActionPanel currentFurtherActionPanel;
+
+ private FurtherActionPanel gFurtherActionPanel;
+
+ private FurtherActionPanel ngFurtherActionPanel;
+
+ public static final int ACTION_OPTION_SELECT = 1;
+
+ public static int ACTION_OPTION_HIDE = 2;
+
+ public static String NO_GRAPH_VIEW = "0";
+
+ public static String GRAPH_VIEW = "1";
+
+ private int actionOption = ACTION_OPTION_SELECT;
+
+ private ColumnSelection oldColumnSelection;
+
+ public AnnotationColumnChooser()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap)
+ {
+ super(av, ap);
+ frame = new JInternalFrame();
+ frame.setContentPane(this);
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("label.select_by_annotation"), 520,
+ 215);
+
+ addSliderChangeListener();
+ addSliderMouseListeners();
+
+ if (av.getAlignment().getAlignmentAnnotation() == null)
+ {
+ return;
+ }
+ setOldColumnSelection(av.getColumnSelection());
+ adjusting = true;
+
+ setAnnotations(new JComboBox<String>(getAnnotationItems(false)));
+ populateThresholdComboBox(threshold);
+
+ // restore Object state from the previous session if one exists
+ if (av.getAnnotationColumnSelectionState() != null)
+ {
+ currentSearchPanel = av.getAnnotationColumnSelectionState()
+ .getCurrentSearchPanel();
+ currentStructureFilterPanel = av.getAnnotationColumnSelectionState()
+ .getCurrentStructureFilterPanel();
+ annotations.setSelectedIndex(av.getAnnotationColumnSelectionState()
+ .getAnnotations().getSelectedIndex());
+ threshold.setSelectedIndex(av.getAnnotationColumnSelectionState()
+ .getThreshold().getSelectedIndex());
+ actionOption = av.getAnnotationColumnSelectionState()
+ .getActionOption();
+ }
+
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ }
+ adjusting = false;
+
+ updateView();
+ frame.invalidate();
+ frame.pack();
+ }
+
+ private void jbInit() throws Exception
+ {
+ ok.setOpaque(false);
+ ok.setText(MessageManager.getString("action.ok"));
+ ok.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+
+ cancel.setOpaque(false);
+ cancel.setText(MessageManager.getString("action.cancel"));
+ cancel.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+
+ annotations.addItemListener(this);
+ annotations.setToolTipText(MessageManager
+ .getString("info.select_annotation_row"));
+ threshold.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ threshold_actionPerformed(e);
+ }
+ });
+
+ thresholdValue.setEnabled(false);
+ thresholdValue.setColumns(7);
+ thresholdValue.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ thresholdValue_actionPerformed(e);
+ }
+ });
+
+ slider.setPaintLabels(false);
+ slider.setPaintTicks(true);
+ slider.setBackground(Color.white);
+ slider.setEnabled(false);
+ slider.setOpaque(false);
+ slider.setPreferredSize(new Dimension(100, 32));
+
+ thresholdPanel.setBorder(new TitledBorder(MessageManager
+ .getString("label.threshold_filter")));
+ thresholdPanel.setBackground(Color.white);
+ thresholdPanel.setFont(JvSwingUtils.getLabelFont());
+ thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]"));
+
+ actionPanel.setBackground(Color.white);
+ actionPanel.setFont(JvSwingUtils.getLabelFont());
+
+ graphFilterView.setLayout(new MigLayout("", "[left][right]", "[][]"));
+ graphFilterView.setBackground(Color.white);
+
+ noGraphFilterView.setLayout(new MigLayout("", "[left][right]", "[][]"));
+ noGraphFilterView.setBackground(Color.white);
+
+ annotationComboBoxPanel.setBackground(Color.white);
+ annotationComboBoxPanel.setFont(JvSwingUtils.getLabelFont());
+
+ gSearchPanel = new SearchPanel(this);
+ ngSearchPanel = new SearchPanel(this);
+ gFurtherActionPanel = new FurtherActionPanel(this);
+ ngFurtherActionPanel = new FurtherActionPanel(this);
+ gStructureFilterPanel = new StructureFilterPanel(this);
+ ngStructureFilterPanel = new StructureFilterPanel(this);
+
+ thresholdPanel.add(getThreshold());
+ thresholdPanel.add(thresholdValue, "wrap");
+ thresholdPanel.add(slider, "grow, span, wrap");
+
+ actionPanel.add(ok);
+ actionPanel.add(cancel);
+
+ graphFilterView.add(gSearchPanel, "grow, span, wrap");
+ graphFilterView.add(gStructureFilterPanel, "grow, span, wrap");
+ graphFilterView.add(thresholdPanel, "grow, span, wrap");
+ graphFilterView.add(gFurtherActionPanel);
+
+ noGraphFilterView.add(ngSearchPanel, "grow, span, wrap");
+ noGraphFilterView.add(ngStructureFilterPanel, "grow, span, wrap");
+ noGraphFilterView.add(ngFurtherActionPanel);
+
+ annotationComboBoxPanel.add(getAnnotations());
+ switchableViewsPanel.add(noGraphFilterView,
+ AnnotationColumnChooser.NO_GRAPH_VIEW);
+ switchableViewsPanel.add(graphFilterView,
+ AnnotationColumnChooser.GRAPH_VIEW);
+
+ this.setLayout(borderLayout1);
+ this.add(annotationComboBoxPanel, java.awt.BorderLayout.PAGE_START);
+ this.add(switchableViewsPanel, java.awt.BorderLayout.CENTER);
+ this.add(actionPanel, java.awt.BorderLayout.SOUTH);
+
+ selectedAnnotationChanged();
+ updateThresholdPanelToolTip();
+ this.validate();
+ }
+
+ public void updateThresholdPanelToolTip()
+ {
+ thresholdValue.setToolTipText("");
+ slider.setToolTipText("");
+
+ String defaultTtip = MessageManager
+ .getString("info.change_threshold_mode_to_enable");
+
+ String threshold = getThreshold().getSelectedItem().toString();
+ if (threshold.equalsIgnoreCase("No Threshold"))
+ {
+ thresholdValue.setToolTipText(defaultTtip);
+ slider.setToolTipText(defaultTtip);
+ }
+ }
+
+ public void reset()
+ {
+ if (this.getOldColumnSelection() != null)
+ {
+ av.getColumnSelection().clear();
+
+ if (av.getAnnotationColumnSelectionState() != null)
+ {
+ ColumnSelection oldSelection = av
+ .getAnnotationColumnSelectionState()
+ .getOldColumnSelection();
+ if (oldSelection != null && oldSelection.getHiddenColumns() != null
+ && !oldSelection.getHiddenColumns().isEmpty())
+ {
+ for (Iterator<int[]> itr = oldSelection.getHiddenColumns()
+ .iterator(); itr.hasNext();)
+ {
+ int positions[] = itr.next();
+ av.hideColumns(positions[0], positions[1]);
+ }
+ }
+ av.setColumnSelection(oldSelection);
+ }
+ ap.paintAlignment(true);
+ }
+
+ }
+
+ public void valueChanged(boolean updateAllAnnotation)
+ {
+ if (slider.isEnabled())
+ {
+ getCurrentAnnotation().threshold.value = slider.getValue() / 1000f;
+ updateView();
+ propagateSeqAssociatedThreshold(updateAllAnnotation,
+ getCurrentAnnotation());
+ ap.paintAlignment(false);
+ }
+ }
+
+ public JComboBox<String> getThreshold()
+ {
+ return threshold;
+ }
+
+ public void setThreshold(JComboBox<String> threshold)
+ {
+ this.threshold = threshold;
+ }
+
+ public JComboBox<String> getAnnotations()
+ {
+ return annotations;
+ }
+
+ public void setAnnotations(JComboBox<String> annotations)
+ {
+ this.annotations = annotations;
+ }
+
+ @Override
+ public void updateView()
+ {
+ // Check if combobox is still adjusting
+ if (adjusting)
+ {
+ return;
+ }
+
+ AnnotationFilterParameter filterParams = new AnnotationFilterParameter();
+
+ setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations()
+ .getSelectedIndex()]]);
+
+ int selectedThresholdItem = getSelectedThresholdItem(getThreshold()
+ .getSelectedIndex());
+
+ slider.setEnabled(true);
+ thresholdValue.setEnabled(true);
+
+ if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD)
+ {
+ slider.setEnabled(false);
+ thresholdValue.setEnabled(false);
+ thresholdValue.setText("");
+ // build filter params
+ }
+ else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD)
+ {
+ if (getCurrentAnnotation().threshold == null)
+ {
+ getCurrentAnnotation()
+ .setThreshold(
+ new jalview.datamodel.GraphLine(
+ (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f,
+ "Threshold", Color.black));
+ }
+
+ adjusting = true;
+ float range = getCurrentAnnotation().graphMax * 1000
+ - getCurrentAnnotation().graphMin * 1000;
+
+ slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000));
+ slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000));
+ slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000));
+ thresholdValue.setText(getCurrentAnnotation().threshold.value + "");
+ slider.setMajorTickSpacing((int) (range / 10f));
+ slider.setEnabled(true);
+ thresholdValue.setEnabled(true);
+ adjusting = false;
+
+ // build filter params
+ filterParams
+ .setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);
+ if (getCurrentAnnotation().graph != AlignmentAnnotation.NO_GRAPH)
+ {
+ filterParams
+ .setThresholdValue(getCurrentAnnotation().threshold.value);
+
+ if (selectedThresholdItem == AnnotationColourGradient.ABOVE_THRESHOLD)
+ {
+ filterParams
+ .setThresholdType(AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD);
+ }
+ else if (selectedThresholdItem == AnnotationColourGradient.BELOW_THRESHOLD)
+ {
+ filterParams
+ .setThresholdType(AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD);
+ }
+ }
+ }
+
+ updateThresholdPanelToolTip();
+ if (currentStructureFilterPanel != null)
+ {
+ if (currentStructureFilterPanel.alphaHelix.isSelected())
+ {
+ filterParams.setFilterAlphaHelix(true);
+ }
+ if (currentStructureFilterPanel.betaStrand.isSelected())
+ {
+ filterParams.setFilterBetaSheet(true);
+ }
+ if (currentStructureFilterPanel.turn.isSelected())
+ {
+ filterParams.setFilterTurn(true);
+ }
+ }
+
+ if (currentSearchPanel != null)
+ {
+
+ if (!currentSearchPanel.searchBox.getText().isEmpty())
+ {
+ currentSearchPanel.description.setEnabled(true);
+ currentSearchPanel.displayName.setEnabled(true);
+ filterParams.setRegexString(currentSearchPanel.searchBox.getText());
+ if (currentSearchPanel.displayName.isSelected())
+ {
+ filterParams
+ .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING);
+ }
+ if (currentSearchPanel.description.isSelected())
+ {
+ filterParams
+ .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION);
+ }
+ }
+ else
+ {
+ currentSearchPanel.description.setEnabled(false);
+ currentSearchPanel.displayName.setEnabled(false);
+ }
+ }
+
+ av.getColumnSelection().filterAnnotations(
+ getCurrentAnnotation().annotations, filterParams);
+
+ av.showAllHiddenColumns();
+ if (getActionOption() == ACTION_OPTION_HIDE)
+ {
+ av.hideSelectedColumns();
+ }
+
+ filterParams = null;
+ av.setAnnotationColumnSelectionState(this);
+ ap.paintAlignment(true);
+ }
+
+ public ColumnSelection getOldColumnSelection()
+ {
+ return oldColumnSelection;
+ }
+
+ public void setOldColumnSelection(ColumnSelection currentColumnSelection)
+ {
+ if (currentColumnSelection != null)
+ {
+ this.oldColumnSelection = new ColumnSelection(currentColumnSelection);
+ }
+ }
+
+ public FurtherActionPanel getCurrentFutherActionPanel()
+ {
+ return currentFurtherActionPanel;
+ }
+
+ public void setCurrentFutherActionPanel(
+ FurtherActionPanel currentFutherActionPanel)
+ {
+ this.currentFurtherActionPanel = currentFutherActionPanel;
+ }
+
+ public SearchPanel getCurrentSearchPanel()
+ {
+ return currentSearchPanel;
+ }
+
+ public void setCurrentSearchPanel(SearchPanel currentSearchPanel)
+ {
+ this.currentSearchPanel = currentSearchPanel;
+ }
+
+ public int getActionOption()
+ {
+ return actionOption;
+ }
+
+ public void setActionOption(int actionOption)
+ {
+ this.actionOption = actionOption;
+ }
+
+ public StructureFilterPanel getCurrentStructureFilterPanel()
+ {
+ return currentStructureFilterPanel;
+ }
+
+ public void setCurrentStructureFilterPanel(
+ StructureFilterPanel currentStructureFilterPanel)
+ {
+ this.currentStructureFilterPanel = currentStructureFilterPanel;
+ }
+
+ public void select_action(ActionEvent actionEvent)
+ {
+ JRadioButton radioButton = (JRadioButton) actionEvent.getSource();
+ if (radioButton.isSelected())
+ {
+ setActionOption(ACTION_OPTION_SELECT);
+ updateView();
+ }
+ }
+
+ public void hide_action(ActionEvent actionEvent)
+ {
+ JRadioButton radioButton = (JRadioButton) actionEvent.getSource();
+ if (radioButton.isSelected())
+ {
+ setActionOption(ACTION_OPTION_HIDE);
+ updateView();
+ }
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ selectedAnnotationChanged();
+ }
+
+ public void selectedAnnotationChanged()
+ {
+ String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW;
+ if (av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations()
+ .getSelectedIndex()]].graph != AlignmentAnnotation.NO_GRAPH)
+ {
+ currentView = AnnotationColumnChooser.GRAPH_VIEW;
+ }
+
+ gSearchPanel.syncState();
+ gFurtherActionPanel.syncState();
+ gStructureFilterPanel.syncState();
+
+ ngSearchPanel.syncState();
+ ngFurtherActionPanel.syncState();
+ ngStructureFilterPanel.syncState();
+
+ switchableViewsLayout.show(switchableViewsPanel, currentView);
+ updateView();
+ }
+
+ public class FurtherActionPanel extends JPanel
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private JRadioButton hideOption = new JRadioButton();
+
+ private JRadioButton selectOption = new JRadioButton();
+
+ private ButtonGroup optionsGroup = new ButtonGroup();
+
+ public FurtherActionPanel(AnnotationColumnChooser aColChooser)
+ {
+ this.aColChooser = aColChooser;
+ JvSwingUtils.jvInitComponent(selectOption, "action.select");
+ selectOption.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ selectRadioAction(actionEvent);
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(hideOption, "action.hide");
+ hideOption.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ hideRadioAction(actionEvent);
+ }
+ });
+
+ optionsGroup.add(selectOption);
+ optionsGroup.add(hideOption);
+ optionsGroup.setSelected(selectOption.getModel(), true);
+
+ JvSwingUtils.jvInitComponent(this);
+ syncState();
+
+ this.add(selectOption);
+ this.add(hideOption);
+ }
+
+ public void selectRadioAction(ActionEvent actionEvent)
+ {
+ aColChooser.setCurrentFutherActionPanel(this);
+ aColChooser.select_action(actionEvent);
+ }
+
+ public void hideRadioAction(ActionEvent actionEvent)
+ {
+ aColChooser.setCurrentFutherActionPanel(this);
+ aColChooser.hide_action(actionEvent);
+ }
+
+ public void syncState()
+ {
+ if (aColChooser.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE)
+ {
+ this.optionsGroup.setSelected(this.hideOption.getModel(), true);
+ }
+ else
+ {
+ this.optionsGroup.setSelected(this.selectOption.getModel(), true);
+ }
+ }
+ }
+
+ public class StructureFilterPanel extends JPanel
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private JCheckBox alphaHelix = new JCheckBox();
+
+ private JCheckBox betaStrand = new JCheckBox();
+
+ private JCheckBox turn = new JCheckBox();
+
+ private JCheckBox all = new JCheckBox();
+
+ public StructureFilterPanel(AnnotationColumnChooser aColChooser)
+ {
+ this.aColChooser = aColChooser;
+
+ JvSwingUtils.jvInitComponent(alphaHelix, "label.alpha_helix");
+ alphaHelix.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ alphaHelix_actionPerformed();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(betaStrand, "label.beta_strand");
+ betaStrand.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ betaStrand_actionPerformed();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(turn, "label.turn");
+ turn.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ turn_actionPerformed();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(all, "label.select_all");
+ all.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ all_actionPerformed();
+ }
+ });
+
+ this.setBorder(new TitledBorder(MessageManager
+ .getString("label.structures_filter")));
+ JvSwingUtils.jvInitComponent(this);
+
+ this.add(all);
+ this.add(alphaHelix);
+ this.add(betaStrand);
+ this.add(turn);
+ }
+
+ public void alphaHelix_actionPerformed()
+ {
+ updateSelectAllState();
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void betaStrand_actionPerformed()
+ {
+ updateSelectAllState();
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void turn_actionPerformed()
+ {
+ updateSelectAllState();
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void all_actionPerformed()
+ {
+ if (all.isSelected())
+ {
+ alphaHelix.setSelected(true);
+ betaStrand.setSelected(true);
+ turn.setSelected(true);
+ }
+ else
+ {
+ alphaHelix.setSelected(false);
+ betaStrand.setSelected(false);
+ turn.setSelected(false);
+ }
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void updateSelectAllState()
+ {
+ if (alphaHelix.isSelected() && betaStrand.isSelected()
+ && turn.isSelected())
+ {
+ all.setSelected(true);
+ }
+ else
+ {
+ all.setSelected(false);
+ }
+ }
+
+ public void syncState()
+ {
+ StructureFilterPanel sfp = aColChooser
+ .getCurrentStructureFilterPanel();
+ if (sfp != null)
+ {
+ alphaHelix.setSelected(sfp.alphaHelix.isSelected());
+ betaStrand.setSelected(sfp.betaStrand.isSelected());
+ turn.setSelected(sfp.turn.isSelected());
+ if (sfp.all.isSelected())
+ {
+ all.setSelected(true);
+ alphaHelix.setSelected(true);
+ betaStrand.setSelected(true);
+ turn.setSelected(true);
+ }
+ }
+
+ }
+ }
+
+ public class SearchPanel extends JPanel
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private JCheckBox displayName = new JCheckBox();
+
+ private JCheckBox description = new JCheckBox();
+
+ private JTextField searchBox = new JTextField(10);
+
+ public SearchPanel(AnnotationColumnChooser aColChooser)
+ {
+
+ this.aColChooser = aColChooser;
+ JvSwingUtils.jvInitComponent(this);
+ this.setBorder(new TitledBorder(MessageManager
+ .getString("label.search_filter")));
+
+ JvSwingUtils.jvInitComponent(searchBox);
+ searchBox.setToolTipText(MessageManager
+ .getString("info.enter_search_text_here"));
+ searchBox.getDocument().addDocumentListener(new DocumentListener()
+ {
+ @Override
+ public void insertUpdate(DocumentEvent e)
+ {
+ searchStringAction();
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e)
+ {
+ searchStringAction();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e)
+ {
+ searchStringAction();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(displayName, "label.label");
+ displayName.setEnabled(false);
+ displayName.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ displayNameCheckboxAction();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(description, "label.description");
+ description.setEnabled(false);
+ description.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ discriptionCheckboxAction();
+ }
+ });
+
+ syncState();
+ this.add(searchBox);
+ this.add(displayName);
+ this.add(description);
+ }
+
+ public void displayNameCheckboxAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void discriptionCheckboxAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void searchStringAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ updateSearchPanelToolTips();
+ }
+
+ public void syncState()
+ {
+ SearchPanel sp = aColChooser.getCurrentSearchPanel();
+ if (sp != null)
+ {
+ description.setEnabled(sp.description.isEnabled());
+ description.setSelected(sp.description.isSelected());
+
+ displayName.setEnabled(sp.displayName.isEnabled());
+ displayName.setSelected(sp.displayName.isSelected());
+
+ searchBox.setText(sp.searchBox.getText());
+ }
+ updateSearchPanelToolTips();
+ }
+
+ public void updateSearchPanelToolTips()
+ {
+ String defaultTtip = MessageManager
+ .getString("info.enter_search_text_to_enable");
+ String labelTtip = MessageManager.formatMessage(
+ "info.search_in_annotation_label", annotations
+ .getSelectedItem().toString());
+ String descTtip = MessageManager.formatMessage(
+ "info.search_in_annotation_description", annotations
+ .getSelectedItem().toString());
+ displayName.setToolTipText(displayName.isEnabled() ? labelTtip
+ : defaultTtip);
+ description.setToolTipText(description.isEnabled() ? descTtip
+ : defaultTtip);
+ }
+ }
+
+}
diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java
index a6ccc7b..f7b7c61 100644
--- a/src/jalview/gui/AnnotationExporter.java
+++ b/src/jalview/gui/AnnotationExporter.java
@@ -1,303 +1,308 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.gui;
-
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-import jalview.datamodel.*;
-import jalview.io.*;
-
-/**
- *
- * GUI dialog for exporting features or alignment annotations depending upon
- * which method is called.
- *
- * @author AMW
- *
- */
-public class AnnotationExporter extends JPanel
-{
- JInternalFrame frame;
-
- AlignmentPanel ap;
-
- boolean features = true;
-
- AlignmentAnnotation[] annotations;
-
- Vector sequenceGroups;
-
- Hashtable alignmentProperties;
-
- public AnnotationExporter()
- {
- try
- {
- jbInit();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- frame = new JInternalFrame();
- frame.setContentPane(this);
- frame.setLayer(JLayeredPane.PALETTE_LAYER);
- Desktop.addInternalFrame(frame, "", frame.getPreferredSize().width, frame.getPreferredSize().height);
- }
-
- public void exportFeatures(AlignmentPanel ap)
- {
- this.ap = ap;
- features = true;
- CSVFormat.setVisible(false);
- frame.setTitle("Export Features");
- }
-
- public void exportAnnotations(AlignmentPanel ap,
- AlignmentAnnotation[] annotations, Vector sequenceGroups,
- Hashtable alProperties)
- {
- this.ap = ap;
- features = false;
- GFFFormat.setVisible(false);
- CSVFormat.setVisible(true);
- this.annotations = annotations;
- this.sequenceGroups = sequenceGroups;
- this.alignmentProperties = alProperties;
- frame.setTitle("Export Annotations");
- }
-
- public void toFile_actionPerformed(ActionEvent e)
- {
- JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
-
- chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle(features ? "Save Features to File"
- : "Save Annotation to File");
- chooser.setToolTipText("Save");
-
- int value = chooser.showSaveDialog(this);
-
- if (value == JalviewFileChooser.APPROVE_OPTION)
- {
- String text = "No features found on alignment";
- if (features)
- {
- if (GFFFormat.isSelected())
- {
- text = new FeaturesFile().printGFFFormat(ap.av.alignment
- .getDataset().getSequencesArray(),
- getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//);
- }
- else
- {
- text = new FeaturesFile().printJalviewFormat(ap.av.alignment
- .getDataset().getSequencesArray(),
- getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed);
- }
- }
- else
- {
- if (CSVFormat.isSelected())
- {
- text = new AnnotationFile().printCSVAnnotations(annotations);
- }
- else
- {
- text = new AnnotationFile().printAnnotations(annotations,
- sequenceGroups, alignmentProperties);
- }
- }
-
- try
- {
- java.io.PrintWriter out = new java.io.PrintWriter(
- new java.io.FileWriter(chooser.getSelectedFile()));
-
- out.print(text);
- out.close();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- close_actionPerformed(null);
- }
-
- public void toTextbox_actionPerformed(ActionEvent e)
- {
- String text = "No features found on alignment";
- if (features)
- {
- if (GFFFormat.isSelected())
- {
- text = new FeaturesFile().printGFFFormat(ap.av.alignment
- .getDataset().getSequencesArray(),
- getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());
- }
- else
- {
- text = new FeaturesFile().printJalviewFormat(ap.av.alignment
- .getDataset().getSequencesArray(),
- getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());
- }
- }
- else if (!features)
- {
- if (CSVFormat.isSelected())
- {
- text = new AnnotationFile().printCSVAnnotations(annotations);
- }
- else
- {
- text = new AnnotationFile().printAnnotations(annotations,
- sequenceGroups, alignmentProperties);
- }
- }
-
- CutAndPasteTransfer cap = new CutAndPasteTransfer();
- try
- {
- cap.setText(text);
- Desktop.addInternalFrame(cap, (features ? "Features for - "
- : "Annotations for - ") + ap.alignFrame.getTitle(), 600, 500);
- } catch (OutOfMemoryError oom)
- {
- new OOMWarning("generating "
- + (features ? "Features for - " : "Annotations for - ")
- + ap.alignFrame.getTitle(), oom);
- cap.dispose();
- }
-
- close_actionPerformed(null);
- }
-
- private Hashtable getDisplayedFeatureCols()
- {
- Hashtable fcols = new Hashtable();
- if (ap.av.featuresDisplayed == null)
- {
- return fcols;
- }
- Enumeration en = ap.av.featuresDisplayed.keys();
- FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider
- // higher
- // level
- // method ?
- while (en.hasMoreElements())
- {
- Object col = en.nextElement();
- fcols.put(col, fr.featureColours.get(col));
- }
- return fcols;
- }
-
- public void close_actionPerformed(ActionEvent e)
- {
- try
- {
- frame.setClosed(true);
- } catch (java.beans.PropertyVetoException ex)
- {
- }
- }
-
- private void jbInit() throws Exception
- {
- this.setLayout(new BorderLayout());
-
- toFile.setText("to File");
- toFile.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- toFile_actionPerformed(e);
- }
- });
- toTextbox.setText("to Textbox");
- toTextbox.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- toTextbox_actionPerformed(e);
- }
- });
- close.setText("Close");
- close.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- close_actionPerformed(e);
- }
- });
- jalviewFormat.setOpaque(false);
- jalviewFormat.setSelected(true);
- jalviewFormat.setText("Jalview");
- GFFFormat.setOpaque(false);
- GFFFormat.setText("GFF");
- CSVFormat.setOpaque(false);
- CSVFormat.setText("CSV(Spreadsheet)");
- jLabel1.setHorizontalAlignment(SwingConstants.TRAILING);
- jLabel1.setText("Format: ");
- this.setBackground(Color.white);
- jPanel3.setBorder(BorderFactory.createEtchedBorder());
- jPanel3.setOpaque(false);
- jPanel1.setOpaque(false);
- jPanel1.add(toFile);
- jPanel1.add(toTextbox);
- jPanel1.add(close);
- jPanel3.add(jLabel1);
- jPanel3.add(jalviewFormat);
- jPanel3.add(GFFFormat);
- jPanel3.add(CSVFormat);
- buttonGroup.add(jalviewFormat);
- buttonGroup.add(GFFFormat);
- buttonGroup.add(CSVFormat);
- this.add(jPanel3, BorderLayout.CENTER);
- this.add(jPanel1, BorderLayout.SOUTH);
- }
-
- JPanel jPanel1 = new JPanel();
-
- JButton toFile = new JButton();
-
- JButton toTextbox = new JButton();
-
- JButton close = new JButton();
-
- ButtonGroup buttonGroup = new ButtonGroup();
-
- JRadioButton jalviewFormat = new JRadioButton();
-
- JRadioButton GFFFormat = new JRadioButton();
-
- JRadioButton CSVFormat = new JRadioButton();
-
- JLabel jLabel1 = new JLabel();
-
- JPanel jPanel3 = new JPanel();
-
- FlowLayout flowLayout1 = new FlowLayout();
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.io.AnnotationFile;
+import jalview.io.FeaturesFile;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.SwingConstants;
+
+/**
+ *
+ * GUI dialog for exporting features or alignment annotations depending upon
+ * which method is called.
+ *
+ * @author AMW
+ *
+ */
+public class AnnotationExporter extends JPanel
+{
+ JInternalFrame frame;
+
+ AlignmentPanel ap;
+
+ boolean features = true;
+
+ private AlignmentAnnotation[] annotations;
+
+ private boolean wholeView;
+
+ public AnnotationExporter()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ frame = new JInternalFrame();
+ frame.setContentPane(this);
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);
+ Desktop.addInternalFrame(frame, "", frame.getPreferredSize().width,
+ frame.getPreferredSize().height);
+ }
+
+ public void exportFeatures(AlignmentPanel ap)
+ {
+ this.ap = ap;
+ features = true;
+ CSVFormat.setVisible(false);
+ frame.setTitle(MessageManager.getString("label.export_features"));
+ }
+
+ public void exportAnnotations(AlignmentPanel ap)
+ {
+ this.ap = ap;
+ annotations = ap.av.isShowAnnotation() ? null : ap.av.getAlignment()
+ .getAlignmentAnnotation();
+ wholeView = true;
+ startExportAnnotation();
+ }
+
+ public void exportAnnotations(AlignmentPanel alp,
+ AlignmentAnnotation[] toExport)
+ {
+ ap = alp;
+ annotations = toExport;
+ wholeView = false;
+ startExportAnnotation();
+ }
+
+ private void startExportAnnotation()
+ {
+ features = false;
+ GFFFormat.setVisible(false);
+ CSVFormat.setVisible(true);
+ frame.setTitle(MessageManager.getString("label.export_annotations"));
+ }
+
+ public void toFile_actionPerformed(ActionEvent e)
+ {
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle(features ? MessageManager
+ .getString("label.save_features_to_file") : MessageManager
+ .getString("label.save_annotation_to_file"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
+
+ int value = chooser.showSaveDialog(this);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ String text = getFileContents();
+
+ try
+ {
+ java.io.PrintWriter out = new java.io.PrintWriter(
+ new java.io.FileWriter(chooser.getSelectedFile()));
+
+ out.print(text);
+ out.close();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ close_actionPerformed(null);
+ }
+
+ private String getFileContents()
+ {
+ String text = MessageManager
+ .getString("label.no_features_on_alignment");
+ if (features)
+ {
+ if (GFFFormat.isSelected())
+ {
+ text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()
+ .getDataset().getSequencesArray(), ap.getFeatureRenderer()
+ .getDisplayedFeatureCols(), true, ap.av.isShowNPFeats());// ap.av.featuresDisplayed//);
+ }
+ else
+ {
+ text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()
+ .getDataset().getSequencesArray(), ap.getFeatureRenderer()
+ .getDisplayedFeatureCols(), true, ap.av.isShowNPFeats()); // ap.av.featuresDisplayed);
+ }
+ }
+ else
+ {
+ if (CSVFormat.isSelected())
+ {
+ text = new AnnotationFile().printCSVAnnotations(annotations);
+ }
+ else
+ {
+ if (wholeView)
+ {
+ text = new AnnotationFile().printAnnotationsForView(ap.av);
+ }
+ else
+ {
+ text = new AnnotationFile().printAnnotations(annotations, null,
+ null);
+ }
+ }
+ }
+ return text;
+ }
+
+ public void toTextbox_actionPerformed(ActionEvent e)
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();
+
+ try
+ {
+ String text = getFileContents();
+ cap.setText(text);
+ Desktop.addInternalFrame(
+ cap,
+ (features ? MessageManager.formatMessage(
+ "label.features_for_params",
+ new String[] { ap.alignFrame.getTitle() })
+ : MessageManager.formatMessage(
+ "label.annotations_for_params",
+ new String[] { ap.alignFrame.getTitle() })),
+ 600, 500);
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning((features ? MessageManager.formatMessage(
+ "label.generating_features_for_params",
+ new String[] { ap.alignFrame.getTitle() })
+ : MessageManager.formatMessage(
+ "label.generating_annotations_for_params",
+ new String[] { ap.alignFrame.getTitle() })), oom);
+ cap.dispose();
+ }
+
+ close_actionPerformed(null);
+ }
+
+ public void close_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ frame.setClosed(true);
+ } catch (java.beans.PropertyVetoException ex)
+ {
+ }
+ }
+
+ private void jbInit() throws Exception
+ {
+ this.setLayout(new BorderLayout());
+
+ toFile.setText(MessageManager.getString("label.to_file"));
+ toFile.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ toFile_actionPerformed(e);
+ }
+ });
+ toTextbox.setText(MessageManager.getString("label.to_textbox"));
+ toTextbox.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ toTextbox_actionPerformed(e);
+ }
+ });
+ close.setText(MessageManager.getString("action.close"));
+ close.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ close_actionPerformed(e);
+ }
+ });
+ jalviewFormat.setOpaque(false);
+ jalviewFormat.setSelected(true);
+ jalviewFormat.setText("Jalview");
+ GFFFormat.setOpaque(false);
+ GFFFormat.setText("GFF");
+ CSVFormat.setOpaque(false);
+ CSVFormat.setText(MessageManager.getString("label.csv_spreadsheet"));
+ jLabel1.setHorizontalAlignment(SwingConstants.TRAILING);
+ jLabel1.setText(MessageManager.getString("action.format") + " ");
+ this.setBackground(Color.white);
+ jPanel3.setBorder(BorderFactory.createEtchedBorder());
+ jPanel3.setOpaque(false);
+ jPanel1.setOpaque(false);
+ jPanel1.add(toFile);
+ jPanel1.add(toTextbox);
+ jPanel1.add(close);
+ jPanel3.add(jLabel1);
+ jPanel3.add(jalviewFormat);
+ jPanel3.add(GFFFormat);
+ jPanel3.add(CSVFormat);
+ buttonGroup.add(jalviewFormat);
+ buttonGroup.add(GFFFormat);
+ buttonGroup.add(CSVFormat);
+ this.add(jPanel3, BorderLayout.CENTER);
+ this.add(jPanel1, BorderLayout.SOUTH);
+ }
+
+ JPanel jPanel1 = new JPanel();
+
+ JButton toFile = new JButton();
+
+ JButton toTextbox = new JButton();
+
+ JButton close = new JButton();
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+
+ JRadioButton jalviewFormat = new JRadioButton();
+
+ JRadioButton GFFFormat = new JRadioButton();
+
+ JRadioButton CSVFormat = new JRadioButton();
+
+ JLabel jLabel1 = new JLabel();
+
+ JPanel jPanel3 = new JPanel();
+
+ FlowLayout flowLayout1 = new FlowLayout();
+}
diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java
index ff3b0cd..60324e5 100644
--- a/src/jalview/gui/AnnotationLabels.java
+++ b/src/jalview/gui/AnnotationLabels.java
@@ -1,33 +1,65 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
+import jalview.analysis.AlignmentUtils;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.io.FormatAdapter;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.RenderingHints;
+import java.awt.Toolkit;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import java.util.regex.Pattern;
-import java.awt.*;
-import java.awt.datatransfer.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import javax.swing.*;
-
-import jalview.datamodel.*;
-import jalview.io.*;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+import javax.swing.ToolTipManager;
/**
* DOCUMENT ME!
@@ -38,21 +70,27 @@ import jalview.io.*;
public class AnnotationLabels extends JPanel implements MouseListener,
MouseMotionListener, ActionListener
{
- static String TOGGLE_LABELSCALE = "Scale Label to Column";
+ private static final Pattern LEFT_ANGLE_BRACKET_PATTERN = Pattern
+ .compile("<");
+
+ String TOGGLE_LABELSCALE = MessageManager
+ .getString("label.scale_label_to_column");
- static String ADDNEW = "Add New Row";
+ String ADDNEW = MessageManager.getString("label.add_new_row");
- static String EDITNAME = "Edit Label/Description";
+ String EDITNAME = MessageManager
+ .getString("label.edit_label_description");
- static String HIDE = "Hide This Row";
+ String HIDE = MessageManager.getString("label.hide_row");
- static String DELETE = "Delete This Row";
+ String DELETE = MessageManager.getString("label.delete_row");
- static String SHOWALL = "Show All Hidden Rows";
+ String SHOWALL = MessageManager.getString("label.show_all_hidden_rows");
- static String OUTPUT_TEXT = "Export Annotation";
+ String OUTPUT_TEXT = MessageManager.getString("label.export_annotation");
- static String COPYCONS_SEQ = "Copy Consensus Sequence";
+ String COPYCONS_SEQ = MessageManager
+ .getString("label.copy_consensus_sequence");
boolean resizePanel = false;
@@ -70,7 +108,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
int selectedRow;
- int scrollOffset = 0;
+ private int scrollOffset = 0;
Font font = new Font("Arial", Font.PLAIN, 11);
@@ -110,10 +148,11 @@ public class AnnotationLabels extends JPanel implements MouseListener,
Graphics2D g = (Graphics2D) bi.getGraphics();
g.rotate(Math.toRadians(90));
g.drawImage(temp, 0, -bi.getWidth(this), this);
- image = (Image) bi;
+ image = bi;
addMouseListener(this);
addMouseMotionListener(this);
+ addMouseWheelListener(ap.getAnnotationPanel());
}
public AnnotationLabels(AlignViewport av)
@@ -143,7 +182,8 @@ public class AnnotationLabels extends JPanel implements MouseListener,
void getSelectedRow(int y)
{
int height = 0;
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment()
+ .getAlignmentAnnotation();
selectedRow = -2;
if (aa != null)
{
@@ -175,20 +215,21 @@ public class AnnotationLabels extends JPanel implements MouseListener,
*/
public void actionPerformed(ActionEvent evt)
{
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment()
+ .getAlignmentAnnotation();
if (evt.getActionCommand().equals(ADDNEW))
{
AlignmentAnnotation newAnnotation = new AlignmentAnnotation(null,
- null, new Annotation[ap.av.alignment.getWidth()]);
+ null, new Annotation[ap.av.getAlignment().getWidth()]);
if (!editLabelDescription(newAnnotation))
{
return;
}
- ap.av.alignment.addAnnotation(newAnnotation);
- ap.av.alignment.setAnnotationIndex(newAnnotation, 0);
+ ap.av.getAlignment().addAnnotation(newAnnotation);
+ ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0);
}
else if (evt.getActionCommand().equals(EDITNAME))
{
@@ -201,7 +242,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
}
else if (evt.getActionCommand().equals(DELETE))
{
- ap.av.alignment.deleteAnnotation(aa[selectedRow]);
+ ap.av.getAlignment().deleteAnnotation(aa[selectedRow]);
}
else if (evt.getActionCommand().equals(SHOWALL))
{
@@ -216,8 +257,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
else if (evt.getActionCommand().equals(OUTPUT_TEXT))
{
new AnnotationExporter().exportAnnotations(ap,
- new AlignmentAnnotation[]
- { aa[selectedRow] }, null, null);
+ new AlignmentAnnotation[] { aa[selectedRow] });
}
else if (evt.getActionCommand().equals(COPYCONS_SEQ))
{
@@ -241,11 +281,18 @@ public class AnnotationLabels extends JPanel implements MouseListener,
aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
}
+ refresh();
+
+ }
+
+ /**
+ * Redraw sensibly.
+ */
+ protected void refresh()
+ {
ap.validateAnnotationDimensions(false);
ap.addNotify();
ap.repaint();
- //validate();
- //ap.paintAlignment(true);
}
/**
@@ -286,7 +333,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
*/
public void mousePressed(MouseEvent evt)
{
- getSelectedRow(evt.getY() - scrollOffset);
+ getSelectedRow(evt.getY() - getScrollOffset());
oldY = evt.getY();
}
@@ -299,28 +346,29 @@ public class AnnotationLabels extends JPanel implements MouseListener,
public void mouseReleased(MouseEvent evt)
{
int start = selectedRow;
- getSelectedRow(evt.getY() - scrollOffset);
+ getSelectedRow(evt.getY() - getScrollOffset());
int end = selectedRow;
if (start != end)
{
// Swap these annotations
- AlignmentAnnotation startAA = ap.av.alignment
+ AlignmentAnnotation startAA = ap.av.getAlignment()
.getAlignmentAnnotation()[start];
if (end == -1)
{
- end = ap.av.alignment.getAlignmentAnnotation().length - 1;
+ end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
}
- AlignmentAnnotation endAA = ap.av.alignment.getAlignmentAnnotation()[end];
+ AlignmentAnnotation endAA = ap.av.getAlignment()
+ .getAlignmentAnnotation()[end];
- ap.av.alignment.getAlignmentAnnotation()[end] = startAA;
- ap.av.alignment.getAlignmentAnnotation()[start] = endAA;
+ ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
+ ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
}
resizePanel = false;
dragEvent = null;
repaint();
- ap.annotationPanel.repaint();
+ ap.getAnnotationPanel().repaint();
}
/**
@@ -368,8 +416,8 @@ public class AnnotationLabels extends JPanel implements MouseListener,
Dimension d = ap.annotationScroller.getPreferredSize();
int dif = evt.getY() - oldY;
- dif /= ap.av.charHeight;
- dif *= ap.av.charHeight;
+ dif /= ap.av.getCharHeight();
+ dif *= ap.av.getCharHeight();
if ((d.height - dif) > 20)
{
@@ -399,57 +447,78 @@ public class AnnotationLabels extends JPanel implements MouseListener,
{
resizePanel = evt.getY() < 10;
- getSelectedRow(evt.getY() - scrollOffset);
+ getSelectedRow(evt.getY() - getScrollOffset());
if (selectedRow > -1
- && ap.av.alignment.getAlignmentAnnotation().length > selectedRow)
+ && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow)
{
- AlignmentAnnotation aa = ap.av.alignment.getAlignmentAnnotation()[selectedRow];
-
+ AlignmentAnnotation aa = ap.av.getAlignment()
+ .getAlignmentAnnotation()[selectedRow];
+
StringBuffer desc = new StringBuffer();
if (aa.description != null
&& !aa.description.equals("New description"))
{
- // TODO: we could refactor and merge this code with the code in jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature tooltips
+ // TODO: we could refactor and merge this code with the code in
+ // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature
+ // tooltips
desc.append(aa.getDescription(true).trim());
// check to see if the description is an html fragment.
- if (desc.length()<6 || (desc.substring(0,6).toLowerCase().indexOf("<html>")<0))
+ if (desc.length() < 6
+ || (desc.substring(0, 6).toLowerCase().indexOf("<html>") < 0))
{
// clean the description ready for embedding in html
- desc = new StringBuffer(Pattern.compile("<").matcher(desc).replaceAll("<"));
+ desc = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(desc)
+ .replaceAll("<"));
desc.insert(0, "<html>");
- } else {
- // remove terminating html if any
- int i=desc.substring(desc.length()-7).toLowerCase().lastIndexOf("</html>");
- if (i>-1) {
- desc.setLength(desc.length()-7+i);
- }
+ }
+ else
+ {
+ // remove terminating html if any
+ int i = desc.substring(desc.length() - 7).toLowerCase()
+ .lastIndexOf("</html>");
+ if (i > -1)
+ {
+ desc.setLength(desc.length() - 7 + i);
+ }
}
if (aa.hasScore())
{
desc.append("<br/>");
}
-
-
- } else {
- // begin the tooltip's html fragment
- desc.append("<html>");
+ // if (aa.hasProperties())
+ // {
+ // desc.append("<table>");
+ // for (String prop : aa.getProperties())
+ // {
+ // desc.append("<tr><td>" + prop + "</td><td>"
+ // + aa.getProperty(prop) + "</td><tr>");
+ // }
+ // desc.append("</table>");
+ // }
}
- if (aa.hasScore())
+ else
{
- // TODO: limit precision of score to avoid noise from imprecise doubles (64.7 becomes 64.7+/some tiny value).
- desc.append(" Score: " + aa.score);
+ // begin the tooltip's html fragment
+ desc.append("<html>");
+ if (aa.hasScore())
+ {
+ // TODO: limit precision of score to avoid noise from imprecise
+ // doubles
+ // (64.7 becomes 64.7+/some tiny value).
+ desc.append(" Score: " + aa.score);
+ }
}
-
if (desc.length() > 6)
{
desc.append("</html>");
this.setToolTipText(desc.toString());
}
else
+ {
this.setToolTipText(null);
+ }
}
-
}
/**
@@ -460,7 +529,8 @@ public class AnnotationLabels extends JPanel implements MouseListener,
*/
public void mouseClicked(MouseEvent evt)
{
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ final AlignmentAnnotation[] aa = ap.av.getAlignment()
+ .getAlignmentAnnotation();
if (SwingUtilities.isLeftMouseButton(evt))
{
if (selectedRow > -1 && selectedRow < aa.length)
@@ -469,8 +539,9 @@ public class AnnotationLabels extends JPanel implements MouseListener,
{
if (evt.getClickCount() >= 2)
{
- // todo: make the ap scroll to the selection - not necessary, first click highlights/scrolls, second selects
- ap.seqPanel.ap.idPanel.highlightSearchResults(null);
+ // todo: make the ap scroll to the selection - not necessary, first
+ // click highlights/scrolls, second selects
+ ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
ap.av.setSelectionGroup(// new SequenceGroup(
aa[selectedRow].groupRef); // );
ap.paintAlignment(false);
@@ -479,25 +550,56 @@ public class AnnotationLabels extends JPanel implements MouseListener,
}
else
{
- ap.seqPanel.ap.idPanel
- .highlightSearchResults(aa[selectedRow].groupRef
- .getSequences(null));
+ ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(
+ aa[selectedRow].groupRef.getSequences(null));
}
return;
}
else if (aa[selectedRow].sequenceRef != null)
{
- Vector sr = new Vector();
- sr.addElement(aa[selectedRow].sequenceRef);
if (evt.getClickCount() == 1)
{
- ap.seqPanel.ap.idPanel.highlightSearchResults(sr);
+ ap.getSeqPanel().ap
+ .getIdPanel()
+ .highlightSearchResults(
+ Arrays.asList(new SequenceI[] { aa[selectedRow].sequenceRef }));
}
else if (evt.getClickCount() >= 2)
{
- ap.seqPanel.ap.idPanel.highlightSearchResults(null);
- SequenceGroup sg = new SequenceGroup();
- sg.addSequence(aa[selectedRow].sequenceRef, false);
+ ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
+ SequenceGroup sg = ap.av.getSelectionGroup();
+ if (sg != null)
+ {
+ // we make a copy rather than edit the current selection if no
+ // modifiers pressed
+ // see Enhancement JAL-1557
+ if (!(evt.isControlDown() || evt.isShiftDown()))
+ {
+ sg = new SequenceGroup(sg);
+ sg.clear();
+ sg.addSequence(aa[selectedRow].sequenceRef, false);
+ }
+ else
+ {
+ if (evt.isControlDown())
+ {
+ sg.addOrRemove(aa[selectedRow].sequenceRef, true);
+ }
+ else
+ {
+ // notionally, we should also add intermediate sequences from
+ // last added sequence ?
+ sg.addSequence(aa[selectedRow].sequenceRef, true);
+ }
+ }
+ }
+ else
+ {
+ sg = new SequenceGroup();
+ sg.setStartRes(0);
+ sg.setEndRes(ap.av.getAlignment().getWidth() - 1);
+ sg.addSequence(aa[selectedRow].sequenceRef, false);
+ }
ap.av.setSelectionGroup(sg);
ap.av.sendSelection();
ap.paintAlignment(false);
@@ -512,7 +614,8 @@ public class AnnotationLabels extends JPanel implements MouseListener,
return;
}
- JPopupMenu pop = new JPopupMenu("Annotations");
+ JPopupMenu pop = new JPopupMenu(
+ MessageManager.getString("label.annotations"));
JMenuItem item = new JMenuItem(ADDNEW);
item.addActionListener(this);
pop.add(item);
@@ -533,6 +636,39 @@ public class AnnotationLabels extends JPanel implements MouseListener,
item = new JMenuItem(HIDE);
item.addActionListener(this);
pop.add(item);
+ // JAL-1264 hide all sequence-specific annotations of this type
+ if (selectedRow < aa.length)
+ {
+ if (aa[selectedRow].sequenceRef != null)
+ {
+ final String label = aa[selectedRow].label;
+ JMenuItem hideType = new JMenuItem();
+ String text = MessageManager.getString("label.hide_all") + " "
+ + label;
+ hideType.setText(text);
+ hideType.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ AlignmentUtils.showOrHideSequenceAnnotations(
+ ap.av.getAlignment(), Collections.singleton(label),
+ null, false, false);
+ // for (AlignmentAnnotation ann : ap.av.getAlignment()
+ // .getAlignmentAnnotation())
+ // {
+ // if (ann.sequenceRef != null && ann.label != null
+ // && ann.label.equals(label))
+ // {
+ // ann.visible = false;
+ // }
+ // }
+ refresh();
+ }
+ });
+ pop.add(hideType);
+ }
+ }
item = new JMenuItem(DELETE);
item.addActionListener(this);
pop.add(item);
@@ -549,6 +685,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
// property methods
if (selectedRow < aa.length)
{
+ final String label = aa[selectedRow].label;
if (!aa[selectedRow].autoCalculated)
{
if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
@@ -562,15 +699,15 @@ public class AnnotationLabels extends JPanel implements MouseListener,
pop.add(item);
}
}
- else if (aa[selectedRow].label.indexOf("Consensus") > -1)
+ else if (label.indexOf("Consensus") > -1)
{
pop.addSeparator();
// av and sequencegroup need to implement same interface for
final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
- "Ignore Gaps In Consensus",
+ MessageManager.getString("label.ignore_gaps_consensus"),
(aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
.getIgnoreGapsConsensus() : ap.av
- .getIgnoreGapsConsensus());
+ .isIgnoreGapsConsensus());
final AlignmentAnnotation aaa = aa[selectedRow];
cbmi.addActionListener(new ActionListener()
{
@@ -580,7 +717,8 @@ public class AnnotationLabels extends JPanel implements MouseListener,
{
// TODO: pass on reference to ap so the view can be updated.
aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
- ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ ap.getAnnotationPanel().paint(
+ ap.getAnnotationPanel().getGraphics());
}
else
{
@@ -593,7 +731,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
if (aaa.groupRef != null)
{
final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
- "Show Group Histogram",
+ MessageManager.getString("label.show_group_histogram"),
aa[selectedRow].groupRef.isShowConsensusHistogram());
chist.addActionListener(new ActionListener()
{
@@ -612,7 +750,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
});
pop.add(chist);
final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
- "Show Group Logo",
+ MessageManager.getString("label.show_group_logo"),
aa[selectedRow].groupRef.isShowSequenceLogo());
cprofl.addActionListener(new ActionListener()
{
@@ -630,11 +768,34 @@ public class AnnotationLabels extends JPanel implements MouseListener,
}
});
pop.add(cprofl);
+ final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
+ MessageManager.getString("label.normalise_group_logo"),
+ aa[selectedRow].groupRef.isNormaliseSequenceLogo());
+ cproflnorm.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
+ // automatically enable logo display if we're clicked
+ aaa.groupRef.setshowSequenceLogo(true);
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cproflnorm);
}
else
{
final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
- "Show Histogram", av.isShowConsensusHistogram());
+ MessageManager.getString("label.show_histogram"),
+ av.isShowConsensusHistogram());
chist.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -646,13 +807,15 @@ public class AnnotationLabels extends JPanel implements MouseListener,
// can be
// updated.
av.setShowConsensusHistogram(chist.getState());
+ ap.alignFrame.setMenusForViewport();
ap.repaint();
// ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
}
});
pop.add(chist);
final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
- "Show Logo", av.isShowSequenceLogo());
+ MessageManager.getString("label.show_logo"),
+ av.isShowSequenceLogo());
cprof.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -664,11 +827,33 @@ public class AnnotationLabels extends JPanel implements MouseListener,
// can be
// updated.
av.setShowSequenceLogo(cprof.getState());
+ ap.alignFrame.setMenusForViewport();
ap.repaint();
// ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
}
});
pop.add(cprof);
+ final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
+ MessageManager.getString("label.normalise_logo"),
+ av.isNormaliseSequenceLogo());
+ cprofnorm.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ av.setShowSequenceLogo(true);
+ av.setNormaliseSequenceLogo(cprofnorm.getState());
+ ap.alignFrame.setMenusForViewport();
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cprofnorm);
}
final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
consclipbrd.addActionListener(this);
@@ -686,11 +871,9 @@ public class AnnotationLabels extends JPanel implements MouseListener,
*/
protected void copy_annotseqtoclipboard(SequenceI sq)
{
- SequenceI[] seqs = new SequenceI[]
- { sq };
+ SequenceI[] seqs = new SequenceI[] { sq };
String[] omitHidden = null;
- SequenceI[] dseqs = new SequenceI[]
- { sq.getDatasetSequence() };
+ SequenceI[] dseqs = new SequenceI[] { sq.getDatasetSequence() };
if (dseqs[0] == null)
{
dseqs[0] = new Sequence(sq);
@@ -700,34 +883,39 @@ public class AnnotationLabels extends JPanel implements MouseListener,
sq.setDatasetSequence(dseqs[0]);
}
Alignment ds = new Alignment(dseqs);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
sq.getLength(), seqs);
}
+ int[] alignmentStartEnd = new int[] { 0, ds.getWidth() - 1 };
+ List<int[]> hiddenCols = av.getColumnSelection().getHiddenColumns();
+ if (hiddenCols != null)
+ {
+ alignmentStartEnd = AlignFrame.getStartEnd(alignmentStartEnd,
+ hiddenCols);
+ }
String output = new FormatAdapter().formatSequences("Fasta", seqs,
- omitHidden);
+ omitHidden, alignmentStartEnd);
Toolkit.getDefaultToolkit().getSystemClipboard()
.setContents(new StringSelection(output), Desktop.instance);
- Vector hiddenColumns = null;
- if (av.hasHiddenColumns)
+ ArrayList<int[]> hiddenColumns = null;
+ if (av.hasHiddenColumns())
{
- hiddenColumns = new Vector();
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
+ hiddenColumns = new ArrayList<int[]>();
+ for (int[] region : av.getColumnSelection().getHiddenColumns())
{
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns()
- .elementAt(i);
-
- hiddenColumns.addElement(new int[]
- { region[0], region[1] });
+ hiddenColumns.add(new int[] { region[0], region[1] });
}
}
- Desktop.jalviewClipboard = new Object[]
- { seqs, ds, // what is the dataset of a consensus sequence ? need to flag
+ Desktop.jalviewClipboard = new Object[] { seqs, ds, // what is the dataset
+ // of a consensus
+ // sequence ? need to
+ // flag
// sequence as special.
hiddenColumns };
}
@@ -754,18 +942,41 @@ public class AnnotationLabels extends JPanel implements MouseListener,
RenderingHints.VALUE_ANTIALIAS_ON);
}
- drawComponent(g2, width);
+ drawComponent(g2, true, width);
}
/**
- * DOCUMENT ME!
+ * Draw the full set of annotation Labels for the alignment at the given
+ * cursor
*
* @param g
- * DOCUMENT ME!
+ * Graphics2D instance (needed for font scaling)
+ * @param width
+ * Width for scaling labels
+ *
*/
public void drawComponent(Graphics g, int width)
{
+ drawComponent(g, false, width);
+ }
+
+ private final boolean debugRedraw = false;
+
+ /**
+ * Draw the full set of annotation Labels for the alignment at the given
+ * cursor
+ *
+ * @param g
+ * Graphics2D instance (needed for font scaling)
+ * @param clip
+ * - true indicates that only current visible area needs to be
+ * rendered
+ * @param width
+ * Width for scaling labels
+ */
+ public void drawComponent(Graphics g, boolean clip, int width)
+ {
if (av.getFont().getSize() < 10)
{
g.setFont(font);
@@ -779,30 +990,74 @@ public class AnnotationLabels extends JPanel implements MouseListener,
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
- g.translate(0, scrollOffset);
+ g.translate(0, getScrollOffset());
g.setColor(Color.black);
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
int fontHeight = g.getFont().getSize();
int y = 0;
int x = 0;
int graphExtras = 0;
int offset = 0;
-
+ Font baseFont = g.getFont();
+ FontMetrics baseMetrics = fm;
+ int ofontH = fontHeight;
+ int sOffset = 0;
+ int visHeight = 0;
+ int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap
+ .getAnnotationPanel().getVisibleVRange() : null;
+ if (clip && visr != null)
+ {
+ sOffset = visr[0];
+ visHeight = visr[1];
+ }
+ boolean visible = true, before = false, after = false;
if (aa != null)
{
hasHiddenRows = false;
+ int olY = 0;
for (int i = 0; i < aa.length; i++)
{
- g.setColor(Color.black);
-
+ visible = true;
if (!aa[i].visible)
{
hasHiddenRows = true;
continue;
}
-
+ olY = y;
y += aa[i].height;
+ if (clip)
+ {
+ if (y < sOffset)
+ {
+ if (!before)
+ {
+ if (debugRedraw)
+ {
+ System.out.println("before vis: " + i);
+ }
+ before = true;
+ }
+ // don't draw what isn't visible
+ continue;
+ }
+ if (olY > visHeight)
+ {
+
+ if (!after)
+ {
+ if (debugRedraw)
+ {
+ System.out.println("Scroll offset: " + sOffset
+ + " after vis: " + i);
+ }
+ after = true;
+ }
+ // don't draw what isn't visible
+ continue;
+ }
+ }
+ g.setColor(Color.black);
offset = -aa[i].height / 2;
@@ -812,13 +1067,17 @@ public class AnnotationLabels extends JPanel implements MouseListener,
offset -= fm.getDescent();
}
else
+ {
offset += fm.getDescent();
+ }
x = width - fm.stringWidth(aa[i].label) - 3;
if (aa[i].graphGroup > -1)
{
int groupSize = 0;
+ // TODO: JAL-1291 revise rendering model so the graphGroup map is
+ // computed efficiently for all visible labels
for (int gg = 0; gg < aa.length; gg++)
{
if (aa[gg].graphGroup == aa[i].graphGroup)
@@ -826,30 +1085,55 @@ public class AnnotationLabels extends JPanel implements MouseListener,
groupSize++;
}
}
-
if (groupSize * (fontHeight + 8) < aa[i].height)
{
graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
}
-
- for (int gg = 0; gg < aa.length; gg++)
+ else
{
- if (aa[gg].graphGroup == aa[i].graphGroup)
+ // scale font to fit
+ float h = aa[i].height / (float) groupSize, s;
+ if (h < 9)
+ {
+ visible = false;
+ }
+ else
+ {
+ fontHeight = -8 + (int) h;
+ s = ((float) fontHeight) / (float) ofontH;
+ Font f = baseFont.deriveFont(AffineTransform
+ .getScaleInstance(s, s));
+ g.setFont(f);
+ fm = g.getFontMetrics();
+ graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
+ }
+ }
+ if (visible)
+ {
+ for (int gg = 0; gg < aa.length; gg++)
{
- x = width - fm.stringWidth(aa[gg].label) - 3;
- g.drawString(aa[gg].label, x, y - graphExtras);
- if (aa[gg].annotations[0] != null)
+ if (aa[gg].graphGroup == aa[i].graphGroup)
{
- g.setColor(aa[gg].annotations[0].colour);
- }
+ x = width - fm.stringWidth(aa[gg].label) - 3;
+ g.drawString(aa[gg].label, x, y - graphExtras);
+
+ if (aa[gg]._linecolour != null)
+ {
- g.drawLine(x, y - graphExtras - 3,
- x + fm.stringWidth(aa[gg].label), y - graphExtras - 3);
+ g.setColor(aa[gg]._linecolour);
+ g.drawLine(x, y - graphExtras + 3,
+ x + fm.stringWidth(aa[gg].label), y - graphExtras
+ + 3);
+ }
- g.setColor(Color.black);
- graphExtras += fontHeight + 8;
+ g.setColor(Color.black);
+ graphExtras += fontHeight + 8;
+ }
}
}
+ g.setFont(baseFont);
+ fm = baseMetrics;
+ fontHeight = ofontH;
}
else
{
@@ -860,19 +1144,25 @@ public class AnnotationLabels extends JPanel implements MouseListener,
if (resizePanel)
{
- g.drawImage(image, 2, 0 - scrollOffset, this);
+ g.drawImage(image, 2, 0 - getScrollOffset(), this);
}
else if (dragEvent != null && aa != null)
{
g.setColor(Color.lightGray);
g.drawString(aa[selectedRow].label, dragEvent.getX(),
- dragEvent.getY() - scrollOffset);
+ dragEvent.getY() - getScrollOffset());
}
- if ((aa == null) || (aa.length < 1))
+ if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
{
- g.drawString("Right click", 2, 8);
- g.drawString("to add annotation", 2, 18);
+ g.drawString(MessageManager.getString("label.right_click"), 2, 8);
+ g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
+ 18);
}
}
+
+ public int getScrollOffset()
+ {
+ return scrollOffset;
+ }
}
diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java
index 359c500..3f4c92a 100644
--- a/src/jalview/gui/AnnotationPanel.java
+++ b/src/jalview/gui/AnnotationPanel.java
@@ -1,74 +1,110 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.font.LineMetrics;
-import java.awt.geom.AffineTransform;
-import java.awt.image.*;
-import java.util.Hashtable;
-
-import javax.swing.*;
-
-import jalview.analysis.AAFrequency;
-import jalview.datamodel.*;
-import jalview.schemes.ColourSchemeI;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
+import jalview.renderer.AnnotationRenderer;
+import jalview.renderer.AwtRenderPanelI;
+import jalview.util.MessageManager;
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import java.awt.image.BufferedImage;
+
+import javax.swing.JColorChooser;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.Scrollable;
+import javax.swing.SwingUtilities;
+import javax.swing.ToolTipManager;
/**
- * DOCUMENT ME!
+ * AnnotationPanel displays visible portion of annotation rows below unwrapped
+ * alignment
*
* @author $author$
* @version $Revision$
*/
-public class AnnotationPanel extends JPanel implements MouseListener,
- MouseMotionListener, ActionListener, AdjustmentListener
+public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
+ MouseListener, MouseWheelListener, MouseMotionListener,
+ ActionListener, AdjustmentListener, Scrollable
{
- final String HELIX = "Helix";
+ String HELIX = MessageManager.getString("label.helix");
+
+ String SHEET = MessageManager.getString("label.sheet");
+
+ /**
+ * For RNA secondary structure "stems" aka helices
+ */
+ String STEM = MessageManager.getString("label.rna_helix");
- final String SHEET = "Sheet";
+ String LABEL = MessageManager.getString("label.label");
- final String LABEL = "Label";
+ String REMOVE = MessageManager.getString("label.remove_annotation");
- final String REMOVE = "Remove Annotation";
+ String COLOUR = MessageManager.getString("action.colour");
- final String COLOUR = "Colour";
+ public final Color HELIX_COLOUR = Color.red.darker();
- final Color HELIX_COLOUR = Color.red.darker();
+ public final Color SHEET_COLOUR = Color.green.darker().darker();
- final Color SHEET_COLOUR = Color.green.darker().darker();
+ public final Color STEM_COLOUR = Color.blue.darker();
/** DOCUMENT ME!! */
- AlignViewport av;
+ public AlignViewport av;
AlignmentPanel ap;
- int activeRow = -1;
+ public int activeRow = -1;
- BufferedImage image;
+ public BufferedImage image;
- BufferedImage fadedImage;
+ public volatile BufferedImage fadedImage;
Graphics2D gg;
- FontMetrics fm;
+ public FontMetrics fm;
- int imgWidth = 0;
+ public int imgWidth = 0;
boolean fastPaint = false;
@@ -85,6 +121,15 @@ public class AnnotationPanel extends JPanel implements MouseListener,
boolean MAC = false;
+ // for editing cursor
+ int cursorX = 0;
+
+ int cursorY = 0;
+
+ public final AnnotationRenderer renderer;
+
+ private MouseWheelListener[] _mwl;
+
/**
* Creates a new AnnotationPanel object.
*
@@ -94,7 +139,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
public AnnotationPanel(AlignmentPanel ap)
{
- MAC = new jalview.util.Platform().isAMac();
+ MAC = jalview.util.Platform.isAMac();
ToolTipManager.sharedInstance().registerComponent(this);
ToolTipManager.sharedInstance().setInitialDelay(0);
@@ -106,22 +151,97 @@ public class AnnotationPanel extends JPanel implements MouseListener,
addMouseMotionListener(this);
ap.annotationScroller.getVerticalScrollBar()
.addAdjustmentListener(this);
+ // save any wheel listeners on the scroller, so we can propagate scroll
+ // events to them.
+ _mwl = ap.annotationScroller.getMouseWheelListeners();
+ // and then set our own listener to consume all mousewheel events
+ ap.annotationScroller.addMouseWheelListener(this);
+ renderer = new AnnotationRenderer();
}
public AnnotationPanel(AlignViewport av)
{
this.av = av;
+ renderer = new AnnotationRenderer();
}
- /**
- * DOCUMENT ME!
+ @Override
+ public void mouseWheelMoved(MouseWheelEvent e)
+ {
+ if (e.isShiftDown())
+ {
+ e.consume();
+ if (e.getWheelRotation() > 0)
+ {
+ ap.scrollRight(true);
+ }
+ else
+ {
+ ap.scrollRight(false);
+ }
+ }
+ else
+ {
+ // TODO: find the correct way to let the event bubble up to
+ // ap.annotationScroller
+ for (MouseWheelListener mwl : _mwl)
+ {
+ if (mwl != null)
+ {
+ mwl.mouseWheelMoved(e);
+ }
+ if (e.isConsumed())
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ @Override
+ public Dimension getPreferredScrollableViewportSize()
+ {
+ return getPreferredSize();
+ }
+
+ @Override
+ public int getScrollableBlockIncrement(Rectangle visibleRect,
+ int orientation, int direction)
+ {
+ return 30;
+ }
+
+ @Override
+ public boolean getScrollableTracksViewportHeight()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean getScrollableTracksViewportWidth()
+ {
+ return true;
+ }
+
+ @Override
+ public int getScrollableUnitIncrement(Rectangle visibleRect,
+ int orientation, int direction)
+ {
+ return 30;
+ }
+
+ /*
+ * (non-Javadoc)
*
- * @param evt
- * DOCUMENT ME!
+ * @see
+ * java.awt.event.AdjustmentListener#adjustmentValueChanged(java.awt.event
+ * .AdjustmentEvent)
*/
+ @Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
- ap.alabels.setScrollOffset(-evt.getValue());
+ // update annotation label display
+ ap.getAlabels().setScrollOffset(-evt.getValue());
}
/**
@@ -132,7 +252,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
*/
public int adjustPanelHeight()
{
- int height=calcPanelHeight();
+ int height = av.calcPanelHeight();
this.setPreferredSize(new Dimension(1, height));
if (ap != null)
{
@@ -144,72 +264,15 @@ public class AnnotationPanel extends JPanel implements MouseListener,
}
/**
- * calculate the height for visible annotation, revalidating bounds where necessary
- * ABSTRACT GUI METHOD
- * @return total height of annotation
- */
- public int calcPanelHeight()
- {
- // setHeight of panels
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
- int height = 0;
-
- if (aa != null)
- {
- for (int i = 0; i < aa.length; i++)
- {
- if (aa[i] == null)
- {
- System.err.println("Null annotation row: ignoring.");
- continue;
- }
- if (!aa[i].visible)
- {
- continue;
- }
-
- aa[i].height = 0;
-
- if (aa[i].hasText)
- {
- aa[i].height += av.charHeight;
- }
-
- if (aa[i].hasIcons)
- {
- aa[i].height += 16;
- }
-
- if (aa[i].graph > 0)
- {
- aa[i].height += aa[i].graphHeight;
- }
-
- if (aa[i].height == 0)
- {
- aa[i].height = 20;
- }
-
- height += aa[i].height;
- }
- }
- if (height == 0)
- {
- // set minimum
- height = 20;
- }
- return height;
- }
-
- /**
* DOCUMENT ME!
*
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void actionPerformed(ActionEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
@@ -234,8 +297,8 @@ public class AnnotationPanel extends JPanel implements MouseListener,
else if (evt.getActionCommand().equals(LABEL))
{
String exMesg = collectAnnotVals(anot, av.getColumnSelection(), LABEL);
- String label = JOptionPane.showInputDialog(this, "Enter label",
- exMesg);
+ String label = JOptionPane.showInputDialog(this,
+ MessageManager.getString("label.enter_label"), exMesg);
if (label == null)
{
@@ -251,8 +314,10 @@ public class AnnotationPanel extends JPanel implements MouseListener,
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
+ {
continue;
+ }
if (anot[index] == null)
{
@@ -270,14 +335,17 @@ public class AnnotationPanel extends JPanel implements MouseListener,
else if (evt.getActionCommand().equals(COLOUR))
{
Color col = JColorChooser.showDialog(this,
- "Choose foreground colour", Color.black);
+ MessageManager.getString("label.select_foreground_colour"),
+ Color.black);
for (int i = 0; i < av.getColumnSelection().size(); i++)
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
+ {
continue;
+ }
if (anot[index] == null)
{
@@ -303,13 +371,20 @@ public class AnnotationPanel extends JPanel implements MouseListener,
symbol = "\u03B2";
}
+ // Added by LML to color stems
+ else if (evt.getActionCommand().equals(STEM))
+ {
+ type = 'S';
+ symbol = "\u03C3";
+ }
+
if (!aa[activeRow].hasIcons)
{
aa[activeRow].hasIcons = true;
}
- String label = JOptionPane.showInputDialog(
- "Enter a label for the structure?", symbol);
+ String label = JOptionPane.showInputDialog(MessageManager
+ .getString("label.enter_label_for_the_structure"), symbol);
if (label == null)
{
@@ -319,24 +394,33 @@ public class AnnotationPanel extends JPanel implements MouseListener,
if ((label.length() > 0) && !aa[activeRow].hasText)
{
aa[activeRow].hasText = true;
+ if (evt.getActionCommand().equals(STEM))
+ {
+ aa[activeRow].showAllColLabels = true;
+ }
}
-
for (int i = 0; i < av.getColumnSelection().size(); i++)
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
+ {
continue;
+ }
if (anot[index] == null)
{
anot[index] = new Annotation(label, "", type, 0);
}
- anot[index].secondaryStructure = type;
+ anot[index].secondaryStructure = type != 'S' ? type : label
+ .length() == 0 ? ' ' : label.charAt(0);
anot[index].displayCharacter = label;
+
}
}
+ av.getAlignment().validateAnnotation(aa[activeRow]);
+ ap.alignmentChanged();
adjustPanelHeight();
repaint();
@@ -349,22 +433,27 @@ public class AnnotationPanel extends JPanel implements MouseListener,
{
String collatedInput = "";
String last = "";
+ ColumnSelection viscols = av.getColumnSelection();
+ // TODO: refactor and save av.getColumnSelection for efficiency
for (int i = 0; i < columnSelection.size(); i++)
{
int index = columnSelection.columnAt(i);
// always check for current display state - just in case
- if (!av.colSel.isVisible(index))
+ if (!viscols.isVisible(index))
+ {
continue;
+ }
String tlabel = null;
if (anot[index] != null)
- {
+ { // LML added stem code
if (label2.equals(HELIX) || label2.equals(SHEET)
- || label2.equals(LABEL))
+ || label2.equals(STEM) || label2.equals(LABEL))
{
tlabel = anot[index].description;
if (tlabel == null || tlabel.length() < 1)
{
- if (label2.equals(HELIX) || label2.equals(SHEET))
+ if (label2.equals(HELIX) || label2.equals(SHEET)
+ || label2.equals(STEM))
{
tlabel = "" + anot[index].secondaryStructure;
}
@@ -393,10 +482,11 @@ public class AnnotationPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mousePressed(MouseEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
@@ -436,13 +526,27 @@ public class AnnotationPanel extends JPanel implements MouseListener,
return;
}
- JPopupMenu pop = new JPopupMenu("Structure type");
- JMenuItem item = new JMenuItem(HELIX);
- item.addActionListener(this);
- pop.add(item);
- item = new JMenuItem(SHEET);
- item.addActionListener(this);
- pop.add(item);
+ JPopupMenu pop = new JPopupMenu(
+ MessageManager.getString("label.structure_type"));
+ JMenuItem item;
+ /*
+ * Just display the needed structure options
+ */
+ if (av.getAlignment().isNucleotide() == true)
+ {
+ item = new JMenuItem(STEM);
+ item.addActionListener(this);
+ pop.add(item);
+ }
+ else
+ {
+ item = new JMenuItem(HELIX);
+ item.addActionListener(this);
+ pop.add(item);
+ item = new JMenuItem(SHEET);
+ item.addActionListener(this);
+ pop.add(item);
+ }
item = new JMenuItem(LABEL);
item.addActionListener(this);
pop.add(item);
@@ -462,7 +566,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
return;
}
- ap.scalePanel.mousePressed(evt);
+ ap.getScalePanel().mousePressed(evt);
}
@@ -472,12 +576,13 @@ public class AnnotationPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseReleased(MouseEvent evt)
{
graphStretch = -1;
graphStretchY = -1;
mouseDragging = false;
- ap.scalePanel.mouseReleased(evt);
+ ap.getScalePanel().mouseReleased(evt);
}
/**
@@ -486,9 +591,10 @@ public class AnnotationPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseEntered(MouseEvent evt)
{
- ap.scalePanel.mouseEntered(evt);
+ ap.getScalePanel().mouseEntered(evt);
}
/**
@@ -497,9 +603,10 @@ public class AnnotationPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseExited(MouseEvent evt)
{
- ap.scalePanel.mouseExited(evt);
+ ap.getScalePanel().mouseExited(evt);
}
/**
@@ -508,15 +615,16 @@ public class AnnotationPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseDragged(MouseEvent evt)
{
if (graphStretch > -1)
{
- av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
+ av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
- evt.getY();
- if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
+ if (av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight < 0)
{
- av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
+ av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight = 0;
}
graphStretchY = evt.getY();
adjustPanelHeight();
@@ -524,7 +632,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
}
else
{
- ap.scalePanel.mouseDragged(evt);
+ ap.getScalePanel().mouseDragged(evt);
}
}
@@ -534,9 +642,10 @@ public class AnnotationPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseMoved(MouseEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
@@ -570,13 +679,13 @@ public class AnnotationPanel extends JPanel implements MouseListener,
int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
if (row > -1 && aa[row].annotations != null
- && res < (int) aa[row].annotations.length)
+ && res < aa[row].annotations.length)
{
if (aa[row].graphGroup > -1)
{
@@ -600,7 +709,8 @@ public class AnnotationPanel extends JPanel implements MouseListener,
&& aa[row].annotations[res].description != null
&& aa[row].annotations[res].description.length() > 0)
{
- this.setToolTipText(aa[row].annotations[res].description);
+ this.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ aa[row].annotations[res].description));
}
else
{
@@ -633,16 +743,47 @@ public class AnnotationPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseClicked(MouseEvent evt)
{
+ // if (activeRow != -1)
+ // {
+ // AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
+ // AlignmentAnnotation anot = aa[activeRow];
+ // }
+ }
+
+ // TODO mouseClicked-content and drawCursor are quite experimental!
+ public void drawCursor(Graphics graphics, SequenceI seq, int res, int x1,
+ int y1)
+ {
+ int pady = av.getCharHeight() / 5;
+ int charOffset = 0;
+ graphics.setColor(Color.black);
+ graphics.fillRect(x1, y1, av.getCharWidth(), av.getCharHeight());
+
+ if (av.validCharWidth)
+ {
+ graphics.setColor(Color.white);
+
+ char s = seq.getCharAt(res);
+
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s), charOffset + x1,
+ (y1 + av.getCharHeight()) - pady);
+ }
+
}
+ private volatile boolean imageFresh = false;
+
/**
* DOCUMENT ME!
*
* @param g
* DOCUMENT ME!
*/
+ @Override
public void paintComponent(Graphics g)
{
g.setColor(Color.white);
@@ -658,14 +799,32 @@ public class AnnotationPanel extends JPanel implements MouseListener,
return;
}
}
- imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
+ imgWidth = (av.endRes - av.startRes + 1) * av.getCharWidth();
if (imgWidth < 1)
+ {
return;
- if (image == null || imgWidth != image.getWidth()
+ }
+ if (image == null || imgWidth != image.getWidth(this)
|| image.getHeight(this) != getHeight())
{
- image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),
- BufferedImage.TYPE_INT_RGB);
+ try
+ {
+ image = new BufferedImage(imgWidth, ap.getAnnotationPanel()
+ .getHeight(), BufferedImage.TYPE_INT_RGB);
+ } catch (OutOfMemoryError oom)
+ {
+ try
+ {
+ System.gc();
+ } catch (Exception x)
+ {
+ }
+ ;
+ new OOMWarning(
+ "Couldn't allocate memory to redraw screen. Please restart Jalview",
+ oom);
+ return;
+ }
gg = (Graphics2D) image.getGraphics();
if (av.antiAlias)
@@ -678,13 +837,20 @@ public class AnnotationPanel extends JPanel implements MouseListener,
fm = gg.getFontMetrics();
gg.setColor(Color.white);
gg.fillRect(0, 0, imgWidth, image.getHeight());
+ imageFresh = true;
}
drawComponent(gg, av.startRes, av.endRes + 1);
+ imageFresh = false;
g.drawImage(image, 0, 0, this);
}
/**
+ * set true to enable redraw timing debug output on stderr
+ */
+ private final boolean debugRedraw = false;
+
+ /**
* non-Thread safe repaint
*
* @param horizontal
@@ -692,24 +858,25 @@ public class AnnotationPanel extends JPanel implements MouseListener,
*/
public void fastPaint(int horizontal)
{
-
if ((horizontal == 0) || gg == null
- || av.alignment.getAlignmentAnnotation() == null
- || av.alignment.getAlignmentAnnotation().length < 1
- || av.updatingConsensus || av.updatingConservation)
+ || av.getAlignment().getAlignmentAnnotation() == null
+ || av.getAlignment().getAlignmentAnnotation().length < 1
+ || av.isCalcInProgress())
{
repaint();
return;
}
- gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);
-
+ long stime = System.currentTimeMillis();
+ gg.copyArea(0, 0, imgWidth, getHeight(),
+ -horizontal * av.getCharWidth(), 0);
+ long mtime = System.currentTimeMillis();
int sr = av.startRes;
int er = av.endRes + 1;
int transX = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
- transX = (er - sr - horizontal) * av.charWidth;
+ transX = (er - sr - horizontal) * av.getCharWidth();
sr = er - horizontal;
}
else if (horizontal < 0)
@@ -722,12 +889,21 @@ public class AnnotationPanel extends JPanel implements MouseListener,
drawComponent(gg, sr, er);
gg.translate(-transX, 0);
-
+ long dtime = System.currentTimeMillis();
fastPaint = true;
repaint();
+ long rtime = System.currentTimeMillis();
+ if (debugRedraw)
+ {
+ System.err.println("Scroll:\t" + horizontal + "\tCopyArea:\t"
+ + (mtime - stime) + "\tDraw component:\t" + (dtime - mtime)
+ + "\tRepaint call:\t" + (rtime - dtime));
+ }
}
+ private volatile boolean lastImageGood = false;
+
/**
* DOCUMENT ME!
*
@@ -740,18 +916,23 @@ public class AnnotationPanel extends JPanel implements MouseListener,
*/
public void drawComponent(Graphics g, int startRes, int endRes)
{
- if (av.updatingConsensus || av.updatingConservation)
+ BufferedImage oldFaded = fadedImage;
+ if (av.isCalcInProgress())
{
if (image == null)
{
+ lastImageGood = false;
return;
}
// We'll keep a record of the old image,
// and draw a faded image until the calculation
// has completed
- if (fadedImage == null || fadedImage.getWidth() != imgWidth
- || fadedImage.getHeight() != image.getHeight())
+ if (lastImageGood
+ && (fadedImage == null || fadedImage.getWidth() != imgWidth || fadedImage
+ .getHeight() != image.getHeight()))
{
+ // System.err.println("redraw faded image ("+(fadedImage==null ?
+ // "null image" : "") + " lastGood="+lastImageGood+")");
fadedImage = new BufferedImage(imgWidth, image.getHeight(),
BufferedImage.TYPE_INT_RGB);
@@ -765,15 +946,22 @@ public class AnnotationPanel extends JPanel implements MouseListener,
fadedG.drawImage(image, 0, 0, this);
}
+ // make sure we don't overwrite the last good faded image until all
+ // calculations have finished
+ lastImageGood = false;
}
else
{
+ if (fadedImage != null)
+ {
+ oldFaded = fadedImage;
+ }
fadedImage = null;
}
g.setColor(Color.white);
- g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());
+ g.fillRect(0, 0, (endRes - startRes) * av.getCharWidth(), getHeight());
g.setFont(av.getFont());
if (fm == null)
@@ -781,723 +969,62 @@ public class AnnotationPanel extends JPanel implements MouseListener,
fm = g.getFontMetrics();
}
- if ((av.alignment.getAlignmentAnnotation() == null)
- || (av.alignment.getAlignmentAnnotation().length < 1))
+ if ((av.getAlignment().getAlignmentAnnotation() == null)
+ || (av.getAlignment().getAlignmentAnnotation().length < 1))
{
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.black);
if (av.validCharWidth)
{
- g.drawString("Alignment has no annotations", 20, 15);
+ g.drawString(MessageManager
+ .getString("label.alignment_has_no_annotations"), 20, 15);
}
return;
}
-
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
-
- int x = 0, y = 0;
- int column = 0;
- char lastSS;
- int lastSSX;
- int iconOffset = 0;
- boolean validRes = false;
- boolean validEnd = false;
- boolean labelAllCols = false;
- boolean centreColLabels, centreColLabelsDef = av
- .getCentreColumnLabels();
- boolean scaleColLabel = false;
- boolean[] graphGroupDrawn = new boolean[aa.length];
- int charOffset = 0; // offset for a label
- float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
- // column.
- Font ofont = g.getFont();
- // \u03B2 \u03B1
- for (int i = 0; i < aa.length; i++)
+ lastImageGood = renderer.drawComponent(this, av, g, activeRow,
+ startRes, endRes);
+ if (!lastImageGood && fadedImage == null)
{
- AlignmentAnnotation row = aa[i];
-
- if (!row.visible)
- {
- continue;
- }
- centreColLabels = row.centreColLabels || centreColLabelsDef;
- labelAllCols = row.showAllColLabels;
- scaleColLabel = row.scaleColLabel;
- lastSS = ' ';
- lastSSX = 0;
-
- if (row.graph > 0)
- {
- if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
- {
- continue;
- }
-
- // this is so that we draw the characters below the graph
- y += row.height;
-
- if (row.hasText)
- {
- iconOffset = av.charHeight - fm.getDescent();
- y -= av.charHeight;
- }
- }
- else if (row.hasText)
- {
- iconOffset = av.charHeight - fm.getDescent();
-
- }
- else
- {
- iconOffset = 0;
- }
-
- if (av.updatingConsensus && aa[i] == av.consensus)
- {
- y += av.charHeight;
-
- g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
- - row.height, imgWidth, y, this);
- g.setColor(Color.black);
- // g.drawString("Calculating Consensus....",20, y-row.height/2);
-
- continue;
- }
- else if (av.updatingConservation
- && aa[i].label.equals("Conservation"))
- {
-
- y += av.charHeight;
- g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
- - row.height, imgWidth, y, this);
-
- g.setColor(Color.black);
- // g.drawString("Calculating Conservation.....",20, y-row.height/2);
-
- continue;
- }
- else if (av.updatingConservation && aa[i].label.equals("Quality"))
- {
-
- y += av.charHeight;
- g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
- - row.height, imgWidth, y, this);
- g.setColor(Color.black);
- // / g.drawString("Calculating Quality....",20, y-row.height/2);
-
- continue;
- }
-
- x = 0;
- while (x < endRes - startRes)
- {
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(
- startRes + x);
- if (column > row.annotations.length - 1)
- {
- break;
- }
- }
- else
- {
- column = startRes + x;
- }
-
- if ((row.annotations == null) || (row.annotations.length <= column)
- || (row.annotations[column] == null))
- {
- validRes = false;
- }
- else
- {
- validRes = true;
- }
-
- if (activeRow == i)
- {
- g.setColor(Color.red);
-
- if (av.getColumnSelection() != null)
- {
- for (int n = 0; n < av.getColumnSelection().size(); n++)
- {
- int v = av.getColumnSelection().columnAt(n);
-
- if (v == column)
- {
- g.fillRect(x * av.charWidth, y, av.charWidth, av.charHeight);
- }
- }
- }
- }
-
- if (av.validCharWidth && validRes
- && row.annotations[column].displayCharacter != null
- && (row.annotations[column].displayCharacter.length() > 0))
- {
-
- if (centreColLabels || scaleColLabel)
- {
- fmWidth = (float) fm.charsWidth(
- row.annotations[column].displayCharacter.toCharArray(),
- 0, row.annotations[column].displayCharacter.length());
-
- if (scaleColLabel)
- {
- // justify the label and scale to fit in column
- if (fmWidth > av.charWidth)
- {
- // scale only if the current font isn't already small enough
- fmScaling = av.charWidth;
- fmScaling /= fmWidth;
- g.setFont(ofont.deriveFont(AffineTransform
- .getScaleInstance(fmScaling, 1.0)));
- // and update the label's width to reflect the scaling.
- fmWidth = av.charWidth;
- }
- }
- }
- else
- {
- fmWidth = (float) fm
- .charWidth(row.annotations[column].displayCharacter
- .charAt(0));
- }
- charOffset = (int) ((av.charWidth - fmWidth) / 2f);
-
- if (row.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(row.annotations[column].colour);
-
- if (column == 0 || row.graph > 0)
- {
- g.drawString(row.annotations[column].displayCharacter,
- (x * av.charWidth) + charOffset, y + iconOffset);
- }
- else if (row.annotations[column - 1] == null
- || (labelAllCols
- || !row.annotations[column].displayCharacter
- .equals(row.annotations[column - 1].displayCharacter) || (row.annotations[column].displayCharacter
- .length() < 2 && row.annotations[column].secondaryStructure == ' ')))
- {
- g.drawString(row.annotations[column].displayCharacter, x
- * av.charWidth + charOffset, y + iconOffset);
- }
- g.setFont(ofont);
- }
-
- if (row.hasIcons)
- {
- if (!validRes
- || (row.annotations[column].secondaryStructure != lastSS))
- {
- switch (lastSS)
- {
- case 'H':
- g.setColor(HELIX_COLOUR);
- if (MAC)
- {
- // Off by 1 offset when drawing rects and ovals
- // to offscreen image on the MAC
- g.fillRoundRect(lastSSX, y + 4 + iconOffset,
- (x * av.charWidth) - lastSSX, 7, 8, 8);
- break;
- }
-
- int sCol = (lastSSX / av.charWidth) + startRes;
- int x1 = lastSSX;
- int x2 = (x * av.charWidth);
-
- if (sCol == 0
- || row.annotations[sCol - 1] == null
- || row.annotations[sCol - 1].secondaryStructure != 'H')
- {
- g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90,
- 180);
- x1 += av.charWidth / 2;
- }
-
- if (!validRes || row.annotations[column] == null
- || row.annotations[column].secondaryStructure != 'H')
- {
- g.fillArc((x * av.charWidth) - av.charWidth, y + 4
- + iconOffset, av.charWidth, 8, 270, 180);
- x2 -= av.charWidth / 2;
- }
-
- g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
- break;
-
- case 'E':
- g.setColor(SHEET_COLOUR);
- g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX - 4, 7);
- g.fillPolygon(new int[]
- { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
- (x * av.charWidth) }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
- 3);
-
- break;
-
- default:
- g.setColor(Color.gray);
- g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
- - lastSSX, 2);
-
- break;
- }
-
- if (validRes)
- {
- lastSS = row.annotations[column].secondaryStructure;
- }
- else
- {
- lastSS = ' ';
- }
-
- lastSSX = (x * av.charWidth);
- }
- }
-
- column++;
- x++;
- }
-
- if (column >= row.annotations.length)
- {
- column = row.annotations.length - 1;
- validEnd = false;
- }
- else
- {
- validEnd = true;
- }
-
- // x ++;
-
- if (row.hasIcons)
- {
- switch (lastSS)
- {
- case 'H':
- g.setColor(HELIX_COLOUR);
- if (MAC)
- {
- // Off by 1 offset when drawing rects and ovals
- // to offscreen image on the MAC
- g.fillRoundRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX, 7, 8, 8);
- break;
- }
-
- int sCol = (lastSSX / av.charWidth) + startRes;
- int x1 = lastSSX;
- int x2 = (x * av.charWidth);
-
- if (sCol == 0 || row.annotations[sCol - 1] == null
- || row.annotations[sCol - 1].secondaryStructure != 'H')
- {
- g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);
- x1 += av.charWidth / 2;
- }
-
- if (row.annotations[column] == null
- || row.annotations[column].secondaryStructure != 'H')
- {
- g.fillArc((x * av.charWidth) - av.charWidth,
- y + 4 + iconOffset, av.charWidth, 8, 270, 180);
- x2 -= av.charWidth / 2;
- }
-
- g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
-
- break;
-
- case 'E':
- g.setColor(SHEET_COLOUR);
-
- if (!validEnd || row.annotations[endRes] == null
- || row.annotations[endRes].secondaryStructure != 'E')
- {
- g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX - 4, 7);
- g.fillPolygon(new int[]
- { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
- (x * av.charWidth) }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset }, 3);
- }
- else
- {
- g.fillRect(lastSSX, y + 4 + iconOffset, (x + 1) * av.charWidth
- - lastSSX, 7);
- }
- break;
-
- default:
- g.setColor(Color.gray);
- g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
- - lastSSX, 2);
-
- break;
- }
- }
-
- if (row.graph > 0 && row.graphHeight > 0)
- {
- if (row.graph == AlignmentAnnotation.LINE_GRAPH)
- {
- if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
- {
- float groupmax = -999999, groupmin = 9999999;
- for (int gg = 0; gg < aa.length; gg++)
- {
- if (aa[gg].graphGroup != row.graphGroup)
- {
- continue;
- }
-
- if (aa[gg] != row)
- {
- aa[gg].visible = false;
- }
-
- if (aa[gg].graphMax > groupmax)
- {
- groupmax = aa[gg].graphMax;
- }
- if (aa[gg].graphMin < groupmin)
- {
- groupmin = aa[gg].graphMin;
- }
- }
-
- for (int gg = 0; gg < aa.length; gg++)
- {
- if (aa[gg].graphGroup == row.graphGroup)
- {
- drawLineGraph(g, aa[gg], startRes, endRes, y, groupmin,
- groupmax, row.graphHeight);
- }
- }
-
- graphGroupDrawn[row.graphGroup] = true;
- }
- else
- {
- drawLineGraph(g, row, startRes, endRes, y, row.graphMin,
- row.graphMax, row.graphHeight);
- }
- }
- else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
- {
- drawBarGraph(g, row, startRes, endRes, row.graphMin,
- row.graphMax, y);
- }
- }
-
- if (row.graph > 0 && row.hasText)
- {
- y += av.charHeight;
- }
-
- if (row.graph == 0)
- {
- y += aa[i].height;
- }
+ fadedImage = oldFaded;
}
}
- public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
- int eRes, int y, float min, float max, int graphHeight)
+ @Override
+ public FontMetrics getFontMetrics()
{
- if (sRes > aa.annotations.length)
- {
- return;
- }
-
- int x = 0;
-
- // Adjustment for fastpaint to left
- if (eRes < av.endRes)
- {
- eRes++;
- }
-
- eRes = Math.min(eRes, aa.annotations.length);
-
- if (sRes == 0)
- {
- x++;
- }
-
- int y1 = y, y2 = y;
- float range = max - min;
-
- // //Draw origin
- if (min < 0)
- {
- y2 = y - (int) ((0 - min / range) * graphHeight);
- }
-
- g.setColor(Color.gray);
- g.drawLine(x - av.charWidth, y2, (eRes - sRes + 1) * av.charWidth, y2);
-
- eRes = Math.min(eRes, aa.annotations.length);
-
- int column;
- int aaMax = aa.annotations.length - 1;
-
- while (x < eRes - sRes)
- {
- column = sRes + x;
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(column);
- }
-
- if (column > aaMax)
- {
- break;
- }
-
- if (aa.annotations[column] == null
- || aa.annotations[column - 1] == null)
- {
- x++;
- continue;
- }
-
- if (aa.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[column].colour);
-
- y1 = y
- - (int) (((aa.annotations[column - 1].value - min) / range) * graphHeight);
- y2 = y
- - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
-
- g.drawLine(x * av.charWidth - av.charWidth / 2, y1, x * av.charWidth
- + av.charWidth / 2, y2);
- x++;
- }
-
- if (aa.threshold != null)
- {
- g.setColor(aa.threshold.colour);
- Graphics2D g2 = (Graphics2D) g;
- g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
- BasicStroke.JOIN_ROUND, 3f, new float[]
- { 5f, 3f }, 0f));
-
- y2 = (int) (y - ((aa.threshold.value - min) / range) * graphHeight);
- g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
- g2.setStroke(new BasicStroke());
- }
+ return fm;
}
- public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes,
- int eRes, float min, float max, int y)
+ @Override
+ public Image getFadedImage()
{
- ColourSchemeI profcolour = av.getGlobalColourScheme();
- if (profcolour == null)
- {
- profcolour = new jalview.schemes.ZappoColourScheme();
- }
- if (sRes > aa.annotations.length)
- {
- return;
- }
- Font ofont = g.getFont();
- eRes = Math.min(eRes, aa.annotations.length);
-
- int x = 0, y1 = y, y2 = y;
-
- float range = max - min;
-
- if (min < 0)
- {
- y2 = y - (int) ((0 - min / (range)) * aa.graphHeight);
- }
-
- g.setColor(Color.gray);
-
- g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
-
- int column;
- int aaMax = aa.annotations.length - 1;
- boolean renderHistogram = true, renderProfile = true;
- if (aa.autoCalculated && aa.label.startsWith("Consensus"))
- {
- // TODO: generalise this to have render styles for consensus/profile data
- if (aa.groupRef != null)
- {
- renderHistogram = aa.groupRef.isShowConsensusHistogram();
- renderProfile = aa.groupRef.isShowSequenceLogo();
- }
- else
- {
- renderHistogram = av.isShowConsensusHistogram();
- renderProfile = av.isShowSequenceLogo();
- }
- }
- while (x < eRes - sRes)
- {
- column = sRes + x;
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(column);
- }
-
- if (column > aaMax)
- {
- break;
- }
-
- if (aa.annotations[column] == null)
- {
- x++;
- continue;
- }
- if (aa.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[column].colour);
-
- y1 = y
- - (int) (((aa.annotations[column].value - min) / (range)) * aa.graphHeight);
-
- if (renderHistogram)
- {
- if (y1 - y2 > 0)
- {
- g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
- }
- else
- {
- g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
- }
- }
- // draw profile if available
- if (renderProfile && aa.annotations[column].value != 0)
- {
- int profl[] = getProfileFor(aa, column);
- int ht = y1, htn = y2 - y1;// aa.graphHeight;
- float wdth;
- double ht2 = 0;
- char[] dc = new char[1];
- LineMetrics lm;
- for (int c = 1; profl != null && c < profl[0];)
- {
- dc[0] = (char) profl[c++];
- wdth = av.charWidth;
- wdth /= (float) fm.charsWidth(dc, 0, 1);
-
- if (c > 2)
- {
- ht += (int) ht2;
- }
- {
- // if (aa.annotations[column].value==0) {
- // g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(wdth,
- // (ht2=(aa.graphHeight*0.1/av.charHeight)))));
- // ht = y2-(int)ht2;
- // } else {
- g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
- wdth, (ht2 = (htn * ((double) profl[c++]) / 100.0))
- / av.charHeight)));
- lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
- // htn -=ht2;
- // }
- g.setColor(profcolour.findColour(dc[0])); // (av.globalColourScheme!=null)
- // ? );// try to get a
- // colourscheme for the
- // group(aa.groupRef.cs==null)
- // ? av.textColour2 :
- // cs.findColour(dc));
- g.drawChars(dc, 0, 1, x * av.charWidth,
- (int) (ht + lm.getHeight()));
- // ht+=g.getFontMetrics().getAscent()-g.getFontMetrics().getDescent();
- }
- }
- g.setFont(ofont);
- }
- x++;
- }
- if (aa.threshold != null)
- {
- g.setColor(aa.threshold.colour);
- Graphics2D g2 = (Graphics2D) g;
- g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
- BasicStroke.JOIN_ROUND, 3f, new float[]
- { 5f, 3f }, 0f));
-
- y2 = (int) (y - ((aa.threshold.value - min) / range) * aa.graphHeight);
- g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
- g2.setStroke(new BasicStroke());
- }
+ return fadedImage;
}
- private int[] getProfileFor(AlignmentAnnotation aa, int column)
+ @Override
+ public int getFadedImageWidth()
{
- if (aa.autoCalculated && aa.label.startsWith("Consensus"))
- {
- if (aa.groupRef != null && aa.groupRef.consensusData != null
- && aa.groupRef.isShowSequenceLogo())
- {
- return AAFrequency.extractProfile(
- aa.groupRef.consensusData[column],
- aa.groupRef.getIgnoreGapsConsensus());
- }
- // TODO extend annotation row to enable dynamic and static profile data to
- // be stored
- if (aa.groupRef == null && aa.sequenceRef == null
- && av.isShowSequenceLogo())
- {
- return AAFrequency.extractProfile(av.hconsensus[column],
- av.getIgnoreGapsConsensus());
- }
- }
- return null;
+ return imgWidth;
}
- // used by overview window
- public void drawGraph(Graphics g, AlignmentAnnotation aa, int width,
- int y, int sRes, int eRes)
- {
- eRes = Math.min(eRes, aa.annotations.length);
- g.setColor(Color.white);
- g.fillRect(0, 0, width, y);
- g.setColor(new Color(0, 0, 180));
-
- int x = 0, height;
+ private int[] bounds = new int[2];
- for (int j = sRes; j < eRes; j++)
+ @Override
+ public int[] getVisibleVRange()
+ {
+ if (ap != null && ap.getAlabels() != null)
{
- if (aa.annotations[j] != null)
- {
- if (aa.annotations[j].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[j].colour);
-
- height = (int) ((aa.annotations[j].value / aa.graphMax) * y);
- if (height > y)
- {
- height = y;
- }
-
- g.fillRect(x, y - height, av.charWidth, height);
- }
- x += av.charWidth;
+ int sOffset = -ap.getAlabels().getScrollOffset();
+ int visHeight = sOffset + ap.annotationSpaceFillerHolder.getHeight();
+ bounds[0] = sOffset;
+ bounds[1] = visHeight;
+ return bounds;
+ }
+ else
+ {
+ return null;
}
}
-
}
diff --git a/src/jalview/gui/AnnotationRowFilter.java b/src/jalview/gui/AnnotationRowFilter.java
new file mode 100644
index 0000000..de6a9d2
--- /dev/null
+++ b/src/jalview/gui/AnnotationRowFilter.java
@@ -0,0 +1,401 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.GraphLine;
+import jalview.datamodel.SequenceGroup;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.util.MessageManager;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JInternalFrame;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+ at SuppressWarnings("serial")
+public abstract class AnnotationRowFilter extends JPanel
+{
+ protected AlignViewport av;
+
+ protected AlignmentPanel ap;
+
+ protected int[] annmap;
+
+ protected boolean enableSeqAss = false;
+
+ private jalview.datamodel.AlignmentAnnotation currentAnnotation;
+
+ protected boolean adjusting = false;
+
+ protected JCheckBox currentColours = new JCheckBox();
+
+ protected JPanel minColour = new JPanel();
+
+ protected JPanel maxColour = new JPanel();
+
+ protected JCheckBox seqAssociated = new JCheckBox();
+
+ protected JCheckBox thresholdIsMin = new JCheckBox();
+
+ protected JSlider slider = new JSlider();
+
+ protected JTextField thresholdValue = new JTextField(20);
+
+ protected JInternalFrame frame;
+
+ protected JButton ok = new JButton();
+
+ protected JButton cancel = new JButton();
+
+ /**
+ * enabled if the user is dragging the slider - try to keep updates to a
+ * minimun
+ */
+ protected boolean sliderDragging = false;
+
+ protected void addSliderChangeListener()
+ {
+
+ slider.addChangeListener(new ChangeListener()
+ {
+ @Override
+ public void stateChanged(ChangeEvent evt)
+ {
+ if (!adjusting)
+ {
+ thresholdValue.setText((slider.getValue() / 1000f) + "");
+ valueChanged(!sliderDragging);
+ }
+ }
+ });
+ }
+
+ protected void addSliderMouseListeners()
+ {
+
+ slider.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mousePressed(MouseEvent e)
+ {
+ sliderDragging = true;
+ super.mousePressed(e);
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e)
+ {
+ sliderDragging = true;
+ super.mouseDragged(e);
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent evt)
+ {
+ if (sliderDragging)
+ {
+ sliderDragging = false;
+ valueChanged(true);
+ }
+ ap.paintAlignment(true);
+ }
+ });
+ }
+
+ public AnnotationRowFilter(AlignViewport av, final AlignmentPanel ap)
+ {
+ this.av = av;
+ this.ap = ap;
+ }
+
+ public AnnotationRowFilter()
+ {
+
+ }
+
+ public Vector<String> getAnnotationItems(boolean isSeqAssociated)
+ {
+ Vector<String> list = new Vector<String>();
+ int index = 1;
+ int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length];
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ {
+ if (av.getAlignment().getAlignmentAnnotation()[i].sequenceRef == null)
+ {
+ if (isSeqAssociated)
+ {
+ continue;
+ }
+ }
+ else
+ {
+ enableSeqAss = true;
+ }
+ String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+ if (!list.contains(label))
+ {
+ anmap[list.size()] = i;
+ list.add(label);
+
+ }
+ else
+ {
+ if (!isSeqAssociated)
+ {
+ anmap[list.size()] = i;
+ list.add(label + "_" + (index++));
+ }
+ }
+ }
+ this.annmap = new int[list.size()];
+ System.arraycopy(anmap, 0, this.annmap, 0, this.annmap.length);
+ return list;
+ }
+
+ protected int getSelectedThresholdItem(int indexValue)
+ {
+ int selectedThresholdItem = -1;
+ if (indexValue == 1)
+ {
+ selectedThresholdItem = AnnotationColourGradient.ABOVE_THRESHOLD;
+ }
+ else if (indexValue == 2)
+ {
+ selectedThresholdItem = AnnotationColourGradient.BELOW_THRESHOLD;
+ }
+ return selectedThresholdItem;
+ }
+
+ public void modelChanged()
+ {
+ seqAssociated.setEnabled(enableSeqAss);
+ }
+
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ frame.setClosed(true);
+ } catch (Exception ex)
+ {
+ }
+ }
+
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ reset();
+ ap.paintAlignment(true);
+ try
+ {
+ frame.setClosed(true);
+ } catch (Exception ex)
+ {
+ }
+ }
+
+ public void thresholdCheck_actionPerformed(ActionEvent e)
+ {
+ updateView();
+ }
+
+ public void annotations_actionPerformed(ActionEvent e)
+ {
+ updateView();
+ }
+
+ public void threshold_actionPerformed(ActionEvent e)
+ {
+ updateView();
+ }
+
+ public void thresholdValue_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ float f = Float.parseFloat(thresholdValue.getText());
+ slider.setValue((int) (f * 1000));
+ updateView();
+ } catch (NumberFormatException ex)
+ {
+ }
+ }
+
+ public void thresholdIsMin_actionPerformed(ActionEvent actionEvent)
+ {
+ updateView();
+ }
+
+ protected void populateThresholdComboBox(JComboBox<String> threshold)
+ {
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_no_thereshold"));
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_above_thereshold"));
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_below_thereshold"));
+ }
+
+ protected void seqAssociated_actionPerformed(ActionEvent arg0,
+ JComboBox<String> annotations, JCheckBox seqAssociated)
+ {
+ adjusting = true;
+ String cursel = (String) annotations.getSelectedItem();
+ boolean isvalid = false, isseqs = seqAssociated.isSelected();
+ annotations.removeAllItems();
+ for (String anitem : getAnnotationItems(seqAssociated.isSelected()))
+ {
+ if (anitem.equals(cursel) || (isseqs && cursel.startsWith(anitem)))
+ {
+ isvalid = true;
+ cursel = anitem;
+ }
+ annotations.addItem(anitem);
+ }
+ adjusting = false;
+ if (isvalid)
+ {
+ annotations.setSelectedItem(cursel);
+ }
+ else
+ {
+ if (annotations.getItemCount() > 0)
+ {
+ annotations.setSelectedIndex(0);
+ }
+ }
+ }
+
+ protected void propagateSeqAssociatedThreshold(boolean allAnnotation,
+ AlignmentAnnotation annotation)
+ {
+ if (annotation.sequenceRef == null || annotation.threshold == null)
+ {
+ return;
+ }
+
+ float thr = annotation.threshold.value;
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ {
+ AlignmentAnnotation aa = av.getAlignment().getAlignmentAnnotation()[i];
+ if (aa.label.equals(annotation.label)
+ && (annotation.getCalcId() == null ? aa.getCalcId() == null
+ : annotation.getCalcId().equals(aa.getCalcId())))
+ {
+ if (aa.threshold == null)
+ {
+ aa.threshold = new GraphLine(annotation.threshold);
+ }
+ else
+ {
+ aa.threshold.value = thr;
+ }
+ }
+ }
+ }
+
+ protected boolean colorAlignmContaining(
+ AlignmentAnnotation currentAnnotation, int selectedThresholdItem)
+ {
+
+ AnnotationColourGradient acg = null;
+ if (currentColours.isSelected())
+ {
+ acg = new AnnotationColourGradient(currentAnnotation,
+ av.getGlobalColourScheme(), selectedThresholdItem);
+ }
+ else
+ {
+ acg = new AnnotationColourGradient(currentAnnotation,
+ minColour.getBackground(), maxColour.getBackground(),
+ selectedThresholdItem);
+ }
+ acg.setSeqAssociated(seqAssociated.isSelected());
+
+ if (currentAnnotation.graphMin == 0f
+ && currentAnnotation.graphMax == 0f)
+ {
+ acg.setPredefinedColours(true);
+ }
+
+ acg.thresholdIsMinMax = thresholdIsMin.isSelected();
+
+ av.setGlobalColourScheme(acg);
+
+ if (av.getAlignment().getGroups() != null)
+ {
+
+ for (SequenceGroup sg : ap.av.getAlignment().getGroups())
+ {
+ if (sg.cs == null)
+ {
+ continue;
+ }
+
+ if (currentColours.isSelected())
+ {
+ sg.cs = new AnnotationColourGradient(currentAnnotation, sg.cs,
+ selectedThresholdItem);
+ ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated
+ .isSelected());
+
+ }
+ else
+ {
+ sg.cs = new AnnotationColourGradient(currentAnnotation,
+ minColour.getBackground(), maxColour.getBackground(),
+ selectedThresholdItem);
+ ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated
+ .isSelected());
+ }
+
+ }
+ }
+ return false;
+ }
+
+ public jalview.datamodel.AlignmentAnnotation getCurrentAnnotation()
+ {
+ return currentAnnotation;
+ }
+
+ public void setCurrentAnnotation(
+ jalview.datamodel.AlignmentAnnotation currentAnnotation)
+ {
+ this.currentAnnotation = currentAnnotation;
+ }
+
+ public abstract void valueChanged(boolean updateAllAnnotation);
+
+ public abstract void updateView();
+
+ public abstract void reset();
+}
diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java
index 2c0d7d6..55d5f8c 100644
--- a/src/jalview/gui/AppJmol.java
+++ b/src/jalview/gui/AppJmol.java
@@ -1,44 +1,81 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import java.awt.event.*;
-import java.io.*;
-
-import jalview.jbgui.GStructureViewer;
-import jalview.api.AlignmentViewPanel;
-import jalview.api.SequenceStructureBinding;
import jalview.bin.Cache;
-import jalview.datamodel.*;
-import jalview.gui.ViewSelectionMenu.ViewSetProvider;
-import jalview.structure.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
-import jalview.io.*;
-import jalview.schemes.*;
-
-public class AppJmol extends GStructureViewer implements Runnable,
- SequenceStructureBinding, ViewSetProvider
-
+import jalview.datamodel.SequenceI;
+import jalview.gui.StructureViewer.ViewerType;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.ZappoColourScheme;
+import jalview.structures.models.AAStructureBindingModel;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JColorChooser;
+import javax.swing.JInternalFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JSplitPane;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+
+public class AppJmol extends StructureViewerBase
{
AppJmolBinding jmb;
@@ -48,41 +85,6 @@ public class AppJmol extends GStructureViewer implements Runnable,
RenderPanel renderPanel;
- AlignmentPanel ap;
-
- Vector atomsPicked = new Vector();
-
- private boolean addingStructures = false;
-
- /**
- *
- * @param file
- * @param id
- * @param seq
- * @param ap
- * @param loadStatus
- * @param bounds
- * @deprecated defaults to AppJmol(String[] files, ... , viewid);
- */
- public AppJmol(String file, String id, SequenceI[] seq,
- AlignmentPanel ap, String loadStatus, Rectangle bounds)
- {
- this(file, id, seq, ap, loadStatus, bounds, null);
- }
-
- /**
- * @deprecated
- */
- public AppJmol(String file, String id, SequenceI[] seq,
- AlignmentPanel ap, String loadStatus, Rectangle bounds,
- String viewid)
- {
- this(new String[]
- { file }, new String[]
- { id }, new SequenceI[][]
- { seq }, ap, true, true, false, loadStatus, bounds, viewid);
- }
-
ViewSelectionMenu seqColourBy;
/**
@@ -98,26 +100,29 @@ public class AppJmol extends GStructureViewer implements Runnable,
* - add the alignment panel to the list used for aligning these
* structures
* @param leaveColouringToJmol
- * - do not update the colours from any other source. Jmol is handling them
+ * - do not update the colours from any other source. Jmol is
+ * handling them
* @param loadStatus
* @param bounds
* @param viewid
*/
public AppJmol(String[] files, String[] ids, SequenceI[][] seqs,
- AlignmentPanel ap, boolean usetoColour, boolean useToAlign, boolean leaveColouringToJmol,
- String loadStatus, Rectangle bounds, String viewid)
+ AlignmentPanel ap, boolean usetoColour, boolean useToAlign,
+ boolean leaveColouringToJmol, String loadStatus,
+ Rectangle bounds, String viewid)
{
PDBEntry[] pdbentrys = new PDBEntry[files.length];
for (int i = 0; i < pdbentrys.length; i++)
{
- PDBEntry pdbentry = new PDBEntry();
- pdbentry.setFile(files[i]);
- pdbentry.setId(ids[i]);
+ // PDBEntry pdbentry = new PDBEntry(files[i], ids[i]);
+ PDBEntry pdbentry = new PDBEntry(ids[i], null, PDBEntry.Type.PDB,
+ files[i]);
pdbentrys[i] = pdbentry;
}
// / TODO: check if protocol is needed to be set, and if chains are
// autodiscovered.
- jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(), pdbentrys, seqs, null, null);
+ jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(),
+ pdbentrys, seqs, null, null);
jmb.setLoadingFromArchive(true);
addAlignmentPanel(ap);
@@ -129,26 +134,27 @@ public class AppJmol extends GStructureViewer implements Runnable,
{
jmb.setColourBySequence(false);
seqColour.setSelected(false);
- jmolColour.setSelected(true);
+ viewerColour.setSelected(true);
}
- if (usetoColour)
+ else if (usetoColour)
{
useAlignmentPanelForColourbyseq(ap);
jmb.setColourBySequence(true);
seqColour.setSelected(true);
- jmolColour.setSelected(false);
+ viewerColour.setSelected(false);
}
this.setBounds(bounds);
initMenus();
- viewId = viewid;
+ setViewId(viewid);
// jalview.gui.Desktop.addInternalFrame(this, "Loading File",
// bounds.width,bounds.height);
this.addInternalFrameListener(new InternalFrameAdapter()
{
+ @Override
public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
{
- closeViewer();
+ closeViewer(false);
}
});
initJmol(loadStatus); // pdbentry, seq, JBPCHECK!
@@ -158,17 +164,18 @@ public class AppJmol extends GStructureViewer implements Runnable,
private void initMenus()
{
seqColour.setSelected(jmb.isColourBySequence());
- jmolColour.setSelected(!jmb.isColourBySequence());
- if (_colourwith==null)
+ viewerColour.setSelected(!jmb.isColourBySequence());
+ if (_colourwith == null)
{
- _colourwith=new Vector<AlignmentPanel>();
+ _colourwith = new Vector<AlignmentPanel>();
}
- if (_alignwith==null)
+ if (_alignwith == null)
{
- _alignwith=new Vector<AlignmentPanel>();
+ _alignwith = new Vector<AlignmentPanel>();
}
-
- seqColourBy = new ViewSelectionMenu("Colour by ..", this, _colourwith,
+
+ seqColourBy = new ViewSelectionMenu(
+ MessageManager.getString("label.colour_by"), this, _colourwith,
new ItemListener()
{
@@ -188,7 +195,8 @@ public class AppJmol extends GStructureViewer implements Runnable,
});
viewMenu.add(seqColourBy);
final ItemListener handler;
- JMenu alpanels = new ViewSelectionMenu("Superpose with ..", this,
+ JMenu alpanels = new ViewSelectionMenu(
+ MessageManager.getString("label.superpose_with"), this,
_alignwith, handler = new ItemListener()
{
@@ -196,13 +204,16 @@ public class AppJmol extends GStructureViewer implements Runnable,
public void itemStateChanged(ItemEvent e)
{
alignStructs.setEnabled(_alignwith.size() > 0);
- alignStructs.setToolTipText("Align structures using "
- + _alignwith.size() + " linked alignment views");
+ alignStructs.setToolTipText(MessageManager
+ .formatMessage(
+ "label.align_structures_using_linked_alignment_views",
+ new String[] { new Integer(_alignwith
+ .size()).toString() }));
}
});
handler.itemStateChanged(null);
- jmolActionMenu.add(alpanels);
- jmolActionMenu.addMenuListener(new MenuListener()
+ viewerActionMenu.add(alpanels);
+ viewerActionMenu.addMenuListener(new MenuListener()
{
@Override
@@ -226,10 +237,12 @@ public class AppJmol extends GStructureViewer implements Runnable,
}
});
}
+
IProgressIndicator progressBar = null;
/**
* add a single PDB structure to a new or existing Jmol view
+ *
* @param pdbentry
* @param seq
* @param chains
@@ -239,132 +252,78 @@ public class AppJmol extends GStructureViewer implements Runnable,
final AlignmentPanel ap)
{
progressBar = ap.alignFrame;
- // ////////////////////////////////
- // Is the pdb file already loaded?
- String alreadyMapped = ap.getStructureSelectionManager().alreadyMappedToFile(
- pdbentry.getId());
+ String pdbId = pdbentry.getId();
- if (alreadyMapped != null)
+ /*
+ * If the PDB file is already loaded, the user may just choose to add to an
+ * existing viewer (or cancel)
+ */
+ if (addAlreadyLoadedFile(seq, chains, ap, pdbId))
{
- int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- pdbentry.getId() + " is already displayed."
- + "\nDo you want to re-use this viewer ?",
- "Map Sequences to Visible Window: " + pdbentry.getId(),
- JOptionPane.YES_NO_OPTION);
-
- if (option == JOptionPane.YES_OPTION)
- {
- // TODO : Fix multiple seq to one chain issue here.
- ap.getStructureSelectionManager().setMapping(seq, chains, alreadyMapped,
- AppletFormatAdapter.FILE);
- if (ap.seqPanel.seqCanvas.fr != null)
- {
- ap.seqPanel.seqCanvas.fr.featuresAdded();
- ap.paintAlignment(true);
- }
-
- // Now this AppJmol is mapped to new sequences. We must add them to
- // the exisiting array
- JInternalFrame[] frames = Desktop.instance.getAllFrames();
-
- for (int i = 0; i < frames.length; i++)
- {
- if (frames[i] instanceof AppJmol)
- {
- final AppJmol topJmol = ((AppJmol) frames[i]);
- // JBPNOTE: this looks like a binding routine, rather than a gui
- // routine
- for (int pe = 0; pe < topJmol.jmb.pdbentry.length; pe++)
- {
- if (topJmol.jmb.pdbentry[pe].getFile().equals(alreadyMapped))
- {
- topJmol.jmb.addSequence(pe, seq);
- topJmol.addAlignmentPanel(ap);
- // add it to the set used for colouring
- topJmol.useAlignmentPanelForColourbyseq(ap);
- topJmol.buildJmolActionMenu();
- ap.getStructureSelectionManager().sequenceColoursChanged(ap);
- break;
- }
- }
- }
- }
-
- return;
- }
+ return;
}
- // /////////////////////////////////
- // Check if there are other Jmol views involving this alignment
- // and prompt user about adding this molecule to one of them
- Vector existingViews = getJmolsFor(ap);
- if (existingViews.size() > 0)
+
+ /*
+ * Check if there are other Jmol views involving this alignment and prompt
+ * user about adding this molecule to one of them
+ */
+ if (addToExistingViewer(pdbentry, seq, chains, ap, pdbId))
{
- Enumeration jm = existingViews.elements();
- while (jm.hasMoreElements())
- {
- AppJmol topJmol = (AppJmol) jm.nextElement();
- // TODO: highlight topJmol in view somehow
- int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- "Do you want to add " + pdbentry.getId()
- + " to the view called\n'" + topJmol.getTitle()
- + "'\n", "Align to existing structure view",
- JOptionPane.YES_NO_OPTION);
- if (option == JOptionPane.YES_OPTION)
- {
- topJmol.useAlignmentPanelForSuperposition(ap);
- topJmol.addStructure(pdbentry, seq, chains, true, ap.alignFrame);
- return;
- }
- }
+ return;
}
- // /////////////////////////////////
+
+ /*
+ * If the options above are declined or do not apply, open a new viewer
+ */
openNewJmol(ap, new PDBEntry[] { pdbentry }, new SequenceI[][] { seq });
}
- private void openNewJmol(AlignmentPanel ap, PDBEntry[] pdbentrys, SequenceI[][] seqs) {
- boolean promptUser=pdbentrys.length==1;
+
+ /**
+ * Answers true if this viewer already involves the given PDB ID
+ */
+ @Override
+ protected boolean hasPdbId(String pdbId)
+ {
+ return jmb.hasPdbId(pdbId);
+ }
+
+ private void openNewJmol(AlignmentPanel ap, PDBEntry[] pdbentrys,
+ SequenceI[][] seqs)
+ {
progressBar = ap.alignFrame;
- jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(), pdbentrys, seqs, null, null);
+ jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(),
+ pdbentrys, seqs, null, null);
addAlignmentPanel(ap);
useAlignmentPanelForColourbyseq(ap);
- if (pdbentrys.length>1)
+ if (pdbentrys.length > 1)
{
- alignAddedStructures=true;
+ alignAddedStructures = true;
useAlignmentPanelForSuperposition(ap);
}
jmb.setColourBySequence(true);
setSize(400, 400); // probably should be a configurable/dynamic default here
initMenus();
- worker=null;
- String filelist="";
-// for (PDBEntry pe: pdbentrys)
-// {
-// if (pe.getFile()==null)
- {
- addingStructures = false;
- worker = new Thread(this);
- worker.start();
-// break;
- }
-// filelist+=" \""+pe.getFile()+"\"";
-
-/* }
- if (worker==null)
+ worker = null;
{
- initJmol("load"+(pdbentrys.length>1 ? " APPEND" : "") + filelist);
+ addingStructures = false;
+ worker = new Thread(this);
+ worker.start();
}
-*/
this.addInternalFrameListener(new InternalFrameAdapter()
{
+ @Override
public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
{
- closeViewer();
+ closeViewer(false);
}
});
}
/**
- * create a new Jmol containing several structures superimposed using the given alignPanel.
+ * create a new Jmol containing several structures superimposed using the
+ * given alignPanel.
+ *
* @param ap
* @param pe
* @param seqs
@@ -375,210 +334,27 @@ public class AppJmol extends GStructureViewer implements Runnable,
}
/**
- * list of sequenceSet ids associated with the view
- */
- ArrayList<String> _aps = new ArrayList();
-
- public AlignmentPanel[] getAllAlignmentPanels()
- {
- AlignmentPanel[] t, list = new AlignmentPanel[0];
- for (String setid : _aps)
- {
- AlignmentPanel[] panels = PaintRefresher.getAssociatedPanels(setid);
- if (panels != null)
- {
- t = new AlignmentPanel[list.length + panels.length];
- System.arraycopy(list, 0, t, 0, list.length);
- System.arraycopy(panels, 0, t, list.length, panels.length);
- list = t;
- }
- }
-
- return list;
- }
-
- /**
- * list of alignment panels to use for superposition
- */
- Vector<AlignmentPanel> _alignwith = new Vector<AlignmentPanel>();
-
- /**
- * list of alignment panels that are used for colouring structures by aligned
- * sequences
- */
- Vector<AlignmentPanel> _colourwith = new Vector<AlignmentPanel>();
-
- /**
- * set the primary alignmentPanel reference and add another alignPanel to the
- * list of ones to use for colouring and aligning
- *
- * @param nap
- */
- public void addAlignmentPanel(AlignmentPanel nap)
- {
- if (ap == null)
- {
- ap = nap;
- }
- if (!_aps.contains(nap.av.getSequenceSetId()))
- {
- _aps.add(nap.av.getSequenceSetId());
- }
- }
-
- /**
- * remove any references held to the given alignment panel
- *
- * @param nap
+ * Returns a list of any Jmol viewers. The list is restricted to those linked
+ * to the given alignment panel if it is not null.
*/
- public void removeAlignmentPanel(AlignmentPanel nap)
- {
- try
- {
- _alignwith.remove(nap);
- _colourwith.remove(nap);
- if (ap == nap)
- {
- ap = null;
- for (AlignmentPanel aps : getAllAlignmentPanels())
- {
- if (aps != nap)
- {
- ap = aps;
- break;
- }
- }
- }
- } catch (Exception ex)
- {
- }
- if (ap != null)
- {
- buildJmolActionMenu();
- }
- }
-
- public void useAlignmentPanelForSuperposition(AlignmentPanel nap)
- {
- addAlignmentPanel(nap);
- if (!_alignwith.contains(nap))
- {
- _alignwith.add(nap);
- }
- }
-
- public void excludeAlignmentPanelForSuperposition(AlignmentPanel nap)
- {
- if (_alignwith.contains(nap))
- {
- _alignwith.remove(nap);
- }
- }
-
- public void useAlignmentPanelForColourbyseq(AlignmentPanel nap, boolean enableColourBySeq)
- {
- useAlignmentPanelForColourbyseq(nap);
- jmb.setColourBySequence(enableColourBySeq);
- seqColour.setSelected(enableColourBySeq);
- jmolColour.setSelected(!enableColourBySeq);
- }
- public void useAlignmentPanelForColourbyseq(AlignmentPanel nap)
- {
- addAlignmentPanel(nap);
- if (!_colourwith.contains(nap))
- {
- _colourwith.add(nap);
- }
- }
-
- public void excludeAlignmentPanelForColourbyseq(AlignmentPanel nap)
- {
- if (_colourwith.contains(nap))
- {
- _colourwith.remove(nap);
- }
- }
-
- /**
- * pdb retrieval thread.
- */
- private Thread worker = null;
-
- /**
- * add a new structure (with associated sequences and chains) to this viewer,
- * retrieving it if necessary first.
- *
- * @param pdbentry
- * @param seq
- * @param chains
- * @param alignFrame
- * @param align
- * if true, new structure(s) will be align using associated alignment
- */
- private void addStructure(final PDBEntry pdbentry, final SequenceI[] seq,
- final String[] chains, final boolean b,
- final IProgressIndicator alignFrame)
- {
- if (pdbentry.getFile() == null)
- {
- if (worker != null && worker.isAlive())
- {
- // a retrieval is in progress, wait around and add ourselves to the
- // queue.
- new Thread(new Runnable()
- {
- public void run()
- {
- while (worker != null && worker.isAlive() && _started)
- {
- try
- {
- Thread.sleep(100 + ((int) Math.random() * 100));
-
- } catch (Exception e)
- {
- }
-
- }
- // and call ourselves again.
- addStructure(pdbentry, seq, chains, b, alignFrame);
- }
- }).start();
- return;
- }
- }
- // otherwise, start adding the structure.
- jmb.addSequenceAndChain(new PDBEntry[]
- { pdbentry }, new SequenceI[][]
- { seq }, new String[][]
- { chains });
- addingStructures = true;
- _started = false;
- alignAddedStructures = b;
- progressBar = alignFrame; // visual indication happens on caller frame.
- (worker = new Thread(this)).start();
- return;
- }
-
- private Vector getJmolsFor(AlignmentPanel ap2)
+ @Override
+ protected List<StructureViewerBase> getViewersFor(AlignmentPanel apanel)
{
- Vector otherJmols = new Vector();
- // Now this AppJmol is mapped to new sequences. We must add them to
- // the exisiting array
+ List<StructureViewerBase> result = new ArrayList<StructureViewerBase>();
JInternalFrame[] frames = Desktop.instance.getAllFrames();
- for (int i = 0; i < frames.length; i++)
+ for (JInternalFrame frame : frames)
{
- if (frames[i] instanceof AppJmol)
+ if (frame instanceof AppJmol)
{
- AppJmol topJmol = ((AppJmol) frames[i]);
- if (topJmol.isLinkedWith(ap2))
+ if (apanel == null
+ || ((StructureViewerBase) frame).isLinkedWith(apanel))
{
- otherJmols.addElement(topJmol);
+ result.add((StructureViewerBase) frame);
}
}
}
- return otherJmols;
+ return result;
}
void initJmol(String command)
@@ -598,26 +374,27 @@ public class AppJmol extends GStructureViewer implements Runnable,
scriptWindow = new JPanel(bl);
scriptWindow.setVisible(false);
}
- ;
+
jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow,
null);
- jmb.newJmolPopup(true, "Jmol", true);
- if (command==null)
+ // jmb.newJmolPopup("Jmol");
+ if (command == null)
{
- command="";
+ command = "";
}
jmb.evalStateCommand(command);
jmb.setFinishedInit(true);
}
- void setChainMenuItems(Vector chains)
+ void setChainMenuItems(Vector<String> chains)
{
chainMenu.removeAll();
if (chains == null)
{
return;
}
- JMenuItem menuItem = new JMenuItem("All");
+ JMenuItem menuItem = new JMenuItem(
+ MessageManager.getString("label.all"));
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
@@ -626,7 +403,9 @@ public class AppJmol extends GStructureViewer implements Runnable,
for (int i = 0; i < chainMenu.getItemCount(); i++)
{
if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem)
+ {
((JCheckBoxMenuItem) chainMenu.getItem(i)).setSelected(true);
+ }
}
centerViewer();
allChainsSelected = false;
@@ -635,15 +414,17 @@ public class AppJmol extends GStructureViewer implements Runnable,
chainMenu.add(menuItem);
- for (int c = 0; c < chains.size(); c++)
+ for (String chain : chains)
{
- menuItem = new JCheckBoxMenuItem(chains.elementAt(c).toString(), true);
+ menuItem = new JCheckBoxMenuItem(chain, true);
menuItem.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent evt)
{
if (!allChainsSelected)
+ {
centerViewer();
+ }
}
});
@@ -653,13 +434,9 @@ public class AppJmol extends GStructureViewer implements Runnable,
boolean allChainsSelected = false;
- private boolean alignAddedStructures = false;
-
void centerViewer()
{
- Vector toshow = new Vector();
- String lbl;
- int mlength, p, mnum;
+ Vector<String> toshow = new Vector<String>();
for (int i = 0; i < chainMenu.getItemCount(); i++)
{
if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem)
@@ -674,10 +451,14 @@ public class AppJmol extends GStructureViewer implements Runnable,
jmb.centerViewer(toshow);
}
- void closeViewer()
+ public void closeViewer(boolean closeExternalViewer)
{
- jmb.closeViewer();
- ap = null;
+ // Jmol does not use an external viewer
+ if (jmb != null)
+ {
+ jmb.closeViewer();
+ }
+ setAlignmentPanel(null);
_aps.clear();
_alignwith.clear();
_colourwith.clear();
@@ -686,11 +467,6 @@ public class AppJmol extends GStructureViewer implements Runnable,
jmb = null;
}
- /**
- * state flag for PDB retrieval thread
- */
- private boolean _started = false;
-
public void run()
{
_started = true;
@@ -703,23 +479,23 @@ public class AppJmol extends GStructureViewer implements Runnable,
// TODO: replace with reference fetching/transfer code (validate PDBentry
// as a DBRef?)
jalview.ws.dbsources.Pdb pdbclient = new jalview.ws.dbsources.Pdb();
- for (int pi = 0; pi < jmb.pdbentry.length; pi++)
+ for (int pi = 0; pi < jmb.getPdbCount(); pi++)
{
- String file = jmb.pdbentry[pi].getFile();
+ String file = jmb.getPdbEntry(pi).getFile();
if (file == null)
{
// retrieve the pdb and store it locally
AlignmentI pdbseq = null;
- pdbid = jmb.pdbentry[pi].getId();
+ pdbid = jmb.getPdbEntry(pi).getId();
long hdl = pdbid.hashCode() - System.currentTimeMillis();
if (progressBar != null)
{
- progressBar.setProgressBar("Fetching PDB " + pdbid, hdl);
+ progressBar.setProgressBar(MessageManager.formatMessage(
+ "status.fetching_pdb", new String[] { pdbid }), hdl);
}
try
{
- pdbseq = pdbclient.getSequenceRecords(pdbid = jmb.pdbentry[pi]
- .getId());
+ pdbseq = pdbclient.getSequenceRecords(pdbid);
} catch (OutOfMemoryError oomerror)
{
new OOMWarning("Retrieving PDB id " + pdbid, oomerror);
@@ -730,15 +506,18 @@ public class AppJmol extends GStructureViewer implements Runnable,
}
if (progressBar != null)
{
- progressBar.setProgressBar("Finished.", hdl);
+ progressBar.setProgressBar(
+ MessageManager.getString("label.state_completed"), hdl);
}
if (pdbseq != null)
{
// just transfer the file name from the first sequence's first
// PDBEntry
- jmb.pdbentry[pi].setFile(file = ((PDBEntry) pdbseq
- .getSequenceAt(0).getPDBId().elementAt(0)).getFile());
- files.append(" \"" + file + "\"");
+ file = new File(pdbseq.getSequenceAt(0).getAllPDBEntries()
+ .elementAt(0).getFile()).getAbsolutePath();
+ jmb.getPdbEntry(pi).setFile(file);
+
+ files.append(" \"" + Platform.escapeString(file) + "\"");
}
else
{
@@ -761,7 +540,7 @@ public class AppJmol extends GStructureViewer implements Runnable,
}
if (file != null)
{
- files.append(" \"" + file + "\"");
+ files.append(" \"" + Platform.escapeString(file) + "\"");
}
}
}
@@ -777,11 +556,11 @@ public class AppJmol extends GStructureViewer implements Runnable,
if (errormsgs.length() > 0)
{
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "The following pdb entries could not be retrieved from the PDB:\n"
- + errormsgs.toString()
- + "\nPlease try downloading them manually.",
- "Couldn't load file", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage("label.pdb_entries_couldnt_be_retrieved",
+ new String[] { errormsgs.toString() }),
+ MessageManager.getString("label.couldnt_load_file"),
+ JOptionPane.ERROR_MESSAGE);
}
long lastnotify = jmb.getLoadNotifiesHandled();
@@ -811,7 +590,7 @@ public class AppJmol extends GStructureViewer implements Runnable,
final String command = cmd.toString();
cmd = null;
lastnotify = jmb.getLoadNotifiesHandled();
-
+
try
{
jmb.evalStateCommand(command);
@@ -826,10 +605,11 @@ public class AppJmol extends GStructureViewer implements Runnable,
Cache.log.error("Couldn't add files to Jmol viewer!", ex);
}
}
-
+
// need to wait around until script has finished
while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled()
- : (jmb.isFinishedInit() && jmb.getPdbFile().length!=jmb.pdbentry.length))
+ : (!jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb
+ .getPdbFile().length != jmb.getPdbCount()))
{
try
{
@@ -839,20 +619,35 @@ public class AppJmol extends GStructureViewer implements Runnable,
{
}
}
+
// refresh the sequence colours for the new structure(s)
for (AlignmentPanel ap : _colourwith)
{
jmb.updateColours(ap);
}
// do superposition if asked to
- if (alignAddedStructures)
+ if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
- alignStructs_withAllAlignPanels();
- // jmb.superposeStructures(ap.av.getAlignment(), -1, null);
+ if (jmb.viewer.isScriptExecuting())
+ {
+ javax.swing.SwingUtilities.invokeLater(this);
+ try
+ {
+ Thread.sleep(5);
+ } catch (InterruptedException q)
+ {
+ }
+ ;
+ return;
+ }
+ else
+ {
+ alignStructs_withAllAlignPanels();
+ }
}
});
alignAddedStructures = false;
@@ -864,24 +659,25 @@ public class AppJmol extends GStructureViewer implements Runnable,
worker = null;
}
+ @Override
public void pdbFile_actionPerformed(ActionEvent actionEvent)
{
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save PDB File");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager.getString("label.save_pdb_file"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
if (value == JalviewFileChooser.APPROVE_OPTION)
{
+ BufferedReader in = null;
try
{
// TODO: cope with multiple PDB files in view
- BufferedReader in = new BufferedReader(new FileReader(
- jmb.getPdbFile()[0]));
+ in = new BufferedReader(new FileReader(jmb.getPdbFile()[0]));
File outFile = chooser.getSelectedFile();
PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
@@ -897,21 +693,29 @@ public class AppJmol extends GStructureViewer implements Runnable,
} catch (Exception ex)
{
ex.printStackTrace();
+ } finally
+ {
+ if (in != null)
+ {
+ try
+ {
+ in.close();
+ } catch (IOException e)
+ {
+ // ignore
+ }
+ }
}
}
}
+ @Override
public void viewMapping_actionPerformed(ActionEvent actionEvent)
{
jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer();
try
{
- for (int pdbe = 0; pdbe < jmb.pdbentry.length; pdbe++)
- {
- cap.appendText(jmb.printMapping(
- jmb.pdbentry[pdbe].getFile()));
- cap.appendText("\n");
- }
+ cap.appendText(jmb.printMappings());
} catch (OutOfMemoryError e)
{
new OOMWarning(
@@ -920,65 +724,68 @@ public class AppJmol extends GStructureViewer implements Runnable,
cap.dispose();
return;
}
- jalview.gui.Desktop.addInternalFrame(cap, "PDB - Sequence Mapping",
- 550, 600);
+ jalview.gui.Desktop.addInternalFrame(cap,
+ MessageManager.getString("label.pdb_sequence_mapping"), 550,
+ 600);
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
+ @Override
public void eps_actionPerformed(ActionEvent e)
{
- makePDBImage(jalview.util.ImageMaker.EPS);
+ makePDBImage(jalview.util.ImageMaker.TYPE.EPS);
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
+ @Override
public void png_actionPerformed(ActionEvent e)
{
- makePDBImage(jalview.util.ImageMaker.PNG);
+ makePDBImage(jalview.util.ImageMaker.TYPE.PNG);
}
- void makePDBImage(int type)
+ void makePDBImage(jalview.util.ImageMaker.TYPE type)
{
int width = getWidth();
int height = getHeight();
jalview.util.ImageMaker im;
- if (type == jalview.util.ImageMaker.PNG)
+ if (type == jalview.util.ImageMaker.TYPE.PNG)
+ {
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from view",
+ width, height, null, null);
+ }
+ else if (type == jalview.util.ImageMaker.TYPE.EPS)
{
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.PNG,
- "Make PNG image from view", width, height, null, null);
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from view",
+ width, height, null, this.getTitle());
}
else
{
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.EPS,
- "Make EPS file from view", width, height, null,
- this.getTitle());
+
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
+ width, height, null, this.getTitle());
}
if (im.getGraphics() != null)
{
- Rectangle rect = new Rectangle(width, height);
- jmb.viewer.renderScreenImage(im.getGraphics(), rect.getSize(), rect);
+ jmb.viewer.renderScreenImage(im.getGraphics(), width, height);
im.writeImage();
}
}
- public void jmolColour_actionPerformed(ActionEvent actionEvent)
+
+ @Override
+ public void viewerColour_actionPerformed(ActionEvent actionEvent)
{
- if (jmolColour.isSelected()) {
+ if (viewerColour.isSelected())
+ {
// disable automatic sequence colouring.
jmb.setColourBySequence(false);
}
}
+
+ @Override
public void seqColour_actionPerformed(ActionEvent actionEvent)
{
jmb.setColourBySequence(seqColour.isSelected());
@@ -990,90 +797,110 @@ public class AppJmol extends GStructureViewer implements Runnable,
{
if (!jmb.isLoadingFromArchive())
{
- if (_colourwith.size()==0 && ap!=null) {
+ if (_colourwith.size() == 0 && getAlignmentPanel() != null)
+ {
// Make the currently displayed alignment panel the associated view
- _colourwith.add(ap.alignFrame.alignPanel);
+ _colourwith.add(getAlignmentPanel().alignFrame.alignPanel);
}
}
// Set the colour using the current view for the associated alignframe
for (AlignmentPanel ap : _colourwith)
{
- jmb.colourBySequence(ap.av.showSequenceFeatures, ap);
+ jmb.colourBySequence(ap);
}
}
}
+ @Override
public void chainColour_actionPerformed(ActionEvent actionEvent)
{
chainColour.setSelected(true);
jmb.colourByChain();
}
+ @Override
public void chargeColour_actionPerformed(ActionEvent actionEvent)
{
chargeColour.setSelected(true);
jmb.colourByCharge();
}
+ @Override
public void zappoColour_actionPerformed(ActionEvent actionEvent)
{
zappoColour.setSelected(true);
jmb.setJalviewColourScheme(new ZappoColourScheme());
}
+ @Override
public void taylorColour_actionPerformed(ActionEvent actionEvent)
{
taylorColour.setSelected(true);
jmb.setJalviewColourScheme(new TaylorColourScheme());
}
+ @Override
public void hydroColour_actionPerformed(ActionEvent actionEvent)
{
hydroColour.setSelected(true);
jmb.setJalviewColourScheme(new HydrophobicColourScheme());
}
+ @Override
public void helixColour_actionPerformed(ActionEvent actionEvent)
{
helixColour.setSelected(true);
jmb.setJalviewColourScheme(new HelixColourScheme());
}
+ @Override
public void strandColour_actionPerformed(ActionEvent actionEvent)
{
strandColour.setSelected(true);
jmb.setJalviewColourScheme(new StrandColourScheme());
}
+ @Override
public void turnColour_actionPerformed(ActionEvent actionEvent)
{
turnColour.setSelected(true);
jmb.setJalviewColourScheme(new TurnColourScheme());
}
+ @Override
public void buriedColour_actionPerformed(ActionEvent actionEvent)
{
buriedColour.setSelected(true);
jmb.setJalviewColourScheme(new BuriedColourScheme());
}
+ @Override
+ public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
+ {
+ setJalviewColourScheme(new PurinePyrimidineColourScheme());
+ }
+
+ @Override
public void userColour_actionPerformed(ActionEvent actionEvent)
{
userColour.setSelected(true);
new UserDefinedColours(this, null);
}
+ @Override
public void backGround_actionPerformed(ActionEvent actionEvent)
{
- java.awt.Color col = JColorChooser.showDialog(this,
- "Select Background Colour", null);
+ java.awt.Color col = JColorChooser
+ .showDialog(this, MessageManager
+ .getString("label.select_backgroud_colour"), null);
if (col != null)
{
jmb.setBackgroundColour(col);
}
}
- public void jmolHelp_actionPerformed(ActionEvent actionEvent)
+ @Override
+ public void showHelp_actionPerformed(ActionEvent actionEvent)
{
try
{
@@ -1121,31 +948,30 @@ public class AppJmol extends GStructureViewer implements Runnable,
{
final Dimension currentSize = new Dimension();
- final Rectangle rectClip = new Rectangle();
-
+ @Override
public void paintComponent(Graphics g)
{
getSize(currentSize);
- g.getClipBounds(rectClip);
- if (jmb.fileLoadingError != null)
+ if (jmb != null && jmb.fileLoadingError != null)
{
g.setColor(Color.black);
g.fillRect(0, 0, currentSize.width, currentSize.height);
g.setColor(Color.white);
g.setFont(new Font("Verdana", Font.BOLD, 14));
- g.drawString("Error loading file...", 20, currentSize.height / 2);
+ g.drawString(MessageManager.getString("label.error_loading_file")
+ + "...", 20, currentSize.height / 2);
StringBuffer sb = new StringBuffer();
int lines = 0;
- for (int e = 0; e < jmb.pdbentry.length; e++)
+ for (int e = 0; e < jmb.getPdbCount(); e++)
{
- sb.append(jmb.pdbentry[e].getId());
- if (e < jmb.pdbentry.length - 1)
+ sb.append(jmb.getPdbEntry(e).getId());
+ if (e < jmb.getPdbCount() - 1)
{
sb.append(",");
}
- if (e == jmb.pdbentry.length - 1 || sb.length() > 20)
+ if (e == jmb.getPdbCount() - 1 || sb.length() > 20)
{
lines++;
g.drawString(sb.toString(), 20, currentSize.height / 2 - lines
@@ -1159,26 +985,17 @@ public class AppJmol extends GStructureViewer implements Runnable,
g.fillRect(0, 0, currentSize.width, currentSize.height);
g.setColor(Color.white);
g.setFont(new Font("Verdana", Font.BOLD, 14));
- g.drawString("Retrieving PDB data....", 20, currentSize.height / 2);
+ g.drawString(MessageManager.getString("label.retrieving_pdb_data"),
+ 20, currentSize.height / 2);
}
else
{
- jmb.viewer.renderScreenImage(g, currentSize, rectClip);
+ jmb.viewer.renderScreenImage(g, currentSize.width,
+ currentSize.height);
}
}
}
- String viewId = null;
-
- public String getViewId()
- {
- if (viewId == null)
- {
- viewId = System.currentTimeMillis() + "." + this.hashCode();
- }
- return viewId;
- }
-
public void updateTitleAndMenus()
{
if (jmb.fileLoadingError != null && jmb.fileLoadingError.length() > 0)
@@ -1189,9 +1006,9 @@ public class AppJmol extends GStructureViewer implements Runnable,
setChainMenuItems(jmb.chainNames);
this.setTitle(jmb.getViewerTitle());
- if (jmb.getPdbFile().length > 1 && jmb.sequence.length > 1)
+ if (jmb.getPdbFile().length > 1 && jmb.getSequence().length > 1)
{
- jmolActionMenu.setVisible(true);
+ viewerActionMenu.setVisible(true);
}
if (!jmb.isLoadingFromArchive())
{
@@ -1199,27 +1016,6 @@ public class AppJmol extends GStructureViewer implements Runnable,
}
}
- protected void buildJmolActionMenu()
- {
- if (_alignwith == null)
- {
- _alignwith = new Vector<AlignmentPanel>();
- }
- if (_alignwith.size() == 0 && ap != null)
- {
- _alignwith.add(ap);
- }
- ;
- for (Component c : jmolActionMenu.getMenuComponents())
- {
- if (c != alignStructs)
- {
- jmolActionMenu.remove((JMenuItem) c);
- }
- }
- final ItemListener handler;
- }
-
/*
* (non-Javadoc)
*
@@ -1235,14 +1031,14 @@ public class AppJmol extends GStructureViewer implements Runnable,
private void alignStructs_withAllAlignPanels()
{
- if (ap == null)
+ if (getAlignmentPanel() == null)
{
return;
}
;
if (_alignwith.size() == 0)
{
- _alignwith.add(ap);
+ _alignwith.add(getAlignmentPanel());
}
;
try
@@ -1294,38 +1090,31 @@ public class AppJmol extends GStructureViewer implements Runnable,
return ap;
}
}
- return ap;
+ return getAlignmentPanel();
}
- /**
- *
- * @param ap2
- * @return true if this Jmol instance is linked with the given alignPanel
- */
- public boolean isLinkedWith(AlignmentPanel ap2)
+ @Override
+ public AAStructureBindingModel getBinding()
{
- return _aps.contains(ap2.av.getSequenceSetId());
+ return this.jmb;
}
- public boolean isUsedforaligment(AlignmentPanel ap2)
+ @Override
+ public String getStateInfo()
{
-
- return (_alignwith != null) && _alignwith.contains(ap2);
+ return jmb == null ? null : jmb.viewer.getStateInfo();
}
- public boolean isUsedforcolourby(AlignmentPanel ap2)
+ @Override
+ public ViewerType getViewerType()
{
- return (_colourwith != null) && _colourwith.contains(ap2);
+ return ViewerType.JMOL;
}
- /**
- *
- * @return TRUE if the view is NOT being coloured by sequence associations.
- */
- public boolean isColouredByJmol()
+ @Override
+ protected AAStructureBindingModel getBindingModel()
{
- return !jmb.isColourBySequence();
- }
-
+ return jmb;
+ }
}
diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java
index 22776f2..eb15a65 100644
--- a/src/jalview/gui/AppJmolBinding.java
+++ b/src/jalview/gui/AppJmolBinding.java
@@ -1,84 +1,80 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.Container;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.ContainerEvent;
-import java.awt.event.ContainerListener;
-import java.util.BitSet;
-
-import javax.swing.JPanel;
-
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
-import jalview.datamodel.AlignmentI;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.ext.jmol.JalviewJmolBinding;
import jalview.structure.StructureSelectionManager;
+import java.awt.Container;
+import java.util.Map;
+
import org.jmol.api.JmolAppConsoleInterface;
-import org.jmol.api.JmolViewer;
-import org.jmol.popup.JmolPopup;
-import org.openscience.jmol.app.jmolpanel.AppConsole;
+import org.jmol.java.BS;
+import org.openscience.jmol.app.jmolpanel.console.AppConsole;
-public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
+public class AppJmolBinding extends JalviewJmolBinding
{
-
- /**
- *
- */
private AppJmol appJmolWindow;
- public AppJmolBinding(AppJmol appJmol, StructureSelectionManager sSm, PDBEntry[] pdbentry,
- SequenceI[][] sequenceIs, String[][] chains, String protocol)
+ private FeatureRenderer fr = null;
+
+ public AppJmolBinding(AppJmol appJmol, StructureSelectionManager sSm,
+ PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
+ String protocol)
{
super(sSm, pdbentry, sequenceIs, chains, protocol);
appJmolWindow = appJmol;
}
- FeatureRenderer fr = null;
-
@Override
- public jalview.api.FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
+ public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
{
- AlignmentPanel ap = (alignment==null) ? appJmolWindow.ap : (AlignmentPanel) alignment;
- if (ap.av.showSequenceFeatures)
+ AlignmentPanel ap = (alignment == null) ? appJmolWindow
+ .getAlignmentPanel() : (AlignmentPanel) alignment;
+ if (ap.av.isShowSequenceFeatures())
{
if (fr == null)
{
- fr = new FeatureRenderer(ap);
+ fr = (jalview.gui.FeatureRenderer) ap.cloneFeatureRenderer();
+ }
+ else
+ {
+ ap.updateFeatureRenderer(fr);
}
-
- fr.transferSettings(ap.
- seqPanel.seqCanvas.getFeatureRenderer());
}
return fr;
}
@Override
- public jalview.api.SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
+ public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
{
- return new SequenceRenderer(((AlignmentPanel)alignment).av);
+ return new SequenceRenderer(((AlignmentPanel) alignment).av);
}
+ @Override
public void sendConsoleEcho(String strEcho)
{
if (console != null)
@@ -87,6 +83,7 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
}
}
+ @Override
public void sendConsoleMessage(String strStatus)
{
if (console != null && strStatus != null)
@@ -126,15 +123,19 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
public void updateColours(Object source)
{
- AlignmentPanel ap = (AlignmentPanel) source,topap;
+ AlignmentPanel ap = (AlignmentPanel) source;
// ignore events from panels not used to colour this view
if (!appJmolWindow.isUsedforcolourby(ap))
+ {
return;
- if (!isLoadingFromArchive()) {
- colourBySequence(ap.av.getShowSequenceFeatures(), ap);
+ }
+ if (!isLoadingFromArchive())
+ {
+ colourBySequence(ap);
}
}
+ @Override
public void notifyScriptTermination(String strStatus, int msWalltime)
{
// todo - script termination doesn't happen ?
@@ -148,54 +149,37 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
showUrl(url, "jmol");
}
- public void newJmolPopup(boolean translateLocale, String menuName,
- boolean asPopup)
+ public void newJmolPopup(String menuName)
{
-
- jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName,
- asPopup);
+ // jmolpopup = new JmolAwtPopup();
+ // jmolpopup.jpiInitialize((viewer), menuName);
}
- public void selectionChanged(BitSet arg0)
+ @Override
+ public void selectionChanged(BS arg0)
{
// TODO Auto-generated method stub
}
+ @Override
public void refreshPdbEntries()
{
// TODO Auto-generated method stub
}
+ @Override
public void showConsole(boolean b)
{
appJmolWindow.showConsole(b);
}
- /**
- * add the given sequences to the mapping scope for the given pdb file handle
- *
- * @param pdbFile
- * - pdbFile identifier
- * @param seq
- * - set of sequences it can be mapped to
- */
- public void addSequenceForStructFile(String pdbFile, SequenceI[] seq)
- {
- for (int pe = 0; pe < pdbentry.length; pe++)
- {
- if (pdbentry[pe].getFile().equals(pdbFile))
- {
- addSequence(pe, seq);
- }
- }
- }
-
@Override
- protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
+ protected JmolAppConsoleInterface createJmolConsole(
Container consolePanel, String buttonsToShow)
{
+ viewer.setJmolCallbackListener(this);
return new AppConsole(viewer, consolePanel, buttonsToShow);
}
@@ -203,28 +187,22 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
protected void releaseUIResources()
{
appJmolWindow = null;
- if (console != null)
- {
- try
- {
- console.setVisible(false);
- } catch (Error e)
- {
- } catch (Exception x)
- {
- }
- ;
- console = null;
- }
-
+ closeConsole();
}
@Override
public void releaseReferences(Object svl)
{
- if (svl instanceof SeqPanel) {
+ if (svl instanceof SeqPanel)
+ {
appJmolWindow.removeAlignmentPanel(((SeqPanel) svl).ap);
-
- };
+ }
+ }
+
+ @Override
+ public Map<String, Object> getJSpecViewProperty(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
}
}
diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java
new file mode 100644
index 0000000..3742864
--- /dev/null
+++ b/src/jalview/gui/AppVarna.java
@@ -0,0 +1,752 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.RnaViewerModel;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.ext.varna.RnaModel;
+import jalview.structure.SecondaryStructureListener;
+import jalview.structure.SelectionListener;
+import jalview.structure.SelectionSource;
+import jalview.structure.StructureSelectionManager;
+import jalview.structure.VamsasSource;
+import jalview.util.Comparison;
+import jalview.util.MessageManager;
+import jalview.util.ShiftList;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JSplitPane;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
+
+import fr.orsay.lri.varna.VARNAPanel;
+import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
+import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
+import fr.orsay.lri.varna.interfaces.InterfaceVARNASelectionListener;
+import fr.orsay.lri.varna.models.BaseList;
+import fr.orsay.lri.varna.models.FullBackup;
+import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation;
+import fr.orsay.lri.varna.models.rna.ModeleBase;
+import fr.orsay.lri.varna.models.rna.RNA;
+
+public class AppVarna extends JInternalFrame implements SelectionListener,
+ SecondaryStructureListener, InterfaceVARNASelectionListener,
+ VamsasSource
+{
+ private static final byte[] PAIRS = new byte[] { '(', ')', '[', ']', '{',
+ '}', '<', '>' };
+
+ private AppVarnaBinding vab;
+
+ private AlignmentPanel ap;
+
+ private String viewId;
+
+ private StructureSelectionManager ssm;
+
+ /*
+ * Lookup for sequence and annotation mapped to each RNA in the viewer. Using
+ * a linked hashmap means that order is preserved when saved to the project.
+ */
+ private Map<RNA, RnaModel> models = new LinkedHashMap<RNA, RnaModel>();
+
+ private Map<RNA, ShiftList> offsets = new Hashtable<RNA, ShiftList>();
+
+ private Map<RNA, ShiftList> offsetsInv = new Hashtable<RNA, ShiftList>();
+
+ private JSplitPane split;
+
+ private VarnaHighlighter mouseOverHighlighter = new VarnaHighlighter();
+
+ private VarnaHighlighter selectionHighlighter = new VarnaHighlighter();
+
+ private class VarnaHighlighter
+ {
+ private HighlightRegionAnnotation _lastHighlight;
+
+ private RNA _lastRNAhighlighted = null;
+
+ public VarnaHighlighter()
+ {
+
+ }
+
+ /**
+ * Constructor when restoring from Varna session, including any highlight
+ * state
+ *
+ * @param rna
+ */
+ public VarnaHighlighter(RNA rna)
+ {
+ // TODO nice try but doesn't work; do we need a highlighter per model?
+ _lastRNAhighlighted = rna;
+ List<HighlightRegionAnnotation> highlights = rna.getHighlightRegion();
+ if (highlights != null && !highlights.isEmpty())
+ {
+ _lastHighlight = highlights.get(0);
+ }
+ }
+
+ public void highlightRegion(RNA rna, int start, int end)
+ {
+ clearLastSelection();
+ HighlightRegionAnnotation highlight = new HighlightRegionAnnotation(
+ rna.getBasesBetween(start, end));
+ rna.addHighlightRegion(highlight);
+ _lastHighlight = highlight;
+ _lastRNAhighlighted = rna;
+ }
+
+ public HighlightRegionAnnotation getLastHighlight()
+ {
+ return _lastHighlight;
+ }
+
+ /**
+ * Clears all structure selection and refreshes the display
+ */
+ public void clearSelection()
+ {
+ if (_lastRNAhighlighted != null)
+ {
+ _lastRNAhighlighted.getHighlightRegion().clear();
+ vab.updateSelectedRNA(_lastRNAhighlighted);
+ _lastRNAhighlighted = null;
+ _lastHighlight = null;
+ }
+ }
+
+ /**
+ * Clear the last structure selection
+ */
+ public void clearLastSelection()
+ {
+ if (_lastRNAhighlighted != null)
+ {
+ _lastRNAhighlighted.removeHighlightRegion(_lastHighlight);
+ _lastRNAhighlighted = null;
+ _lastHighlight = null;
+ }
+ }
+ }
+
+ /**
+ * Constructor
+ *
+ * @param seq
+ * the RNA sequence
+ * @param aa
+ * the annotation with the secondary structure string
+ * @param ap
+ * the AlignmentPanel creating this object
+ */
+ public AppVarna(SequenceI seq, AlignmentAnnotation aa, AlignmentPanel ap)
+ {
+ this(ap);
+
+ String sname = aa.sequenceRef == null ? "secondary structure (alignment)"
+ : seq.getName() + " structure";
+ String theTitle = sname
+ + (aa.sequenceRef == null ? " trimmed to " + seq.getName() : "");
+ theTitle = MessageManager.formatMessage("label.varna_params",
+ new String[] { theTitle });
+ setTitle(theTitle);
+
+ String gappedTitle = sname + " (with gaps)";
+ RnaModel gappedModel = new RnaModel(gappedTitle, aa, seq, null, true);
+ addModel(gappedModel, gappedTitle);
+
+ String trimmedTitle = "trimmed " + sname;
+ RnaModel trimmedModel = new RnaModel(trimmedTitle, aa, seq, null, false);
+ addModel(trimmedModel, trimmedTitle);
+ vab.setSelectedIndex(0);
+ }
+
+ /**
+ * Constructor that links the viewer to a parent panel (but has no structures
+ * yet - use addModel to add them)
+ *
+ * @param ap
+ */
+ protected AppVarna(AlignmentPanel ap)
+ {
+ this.ap = ap;
+ this.viewId = System.currentTimeMillis() + "." + this.hashCode();
+ vab = new AppVarnaBinding();
+ initVarna();
+
+ this.ssm = ap.getStructureSelectionManager();
+ ssm.addStructureViewerListener(this);
+ ssm.addSelectionListener(this);
+ addInternalFrameListener(new InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosed(InternalFrameEvent evt)
+ {
+ close();
+ }
+ });
+ }
+
+ /**
+ * Constructor given viewer data read from a saved project file
+ *
+ * @param model
+ * @param ap
+ * the (or a) parent alignment panel
+ */
+ public AppVarna(RnaViewerModel model, AlignmentPanel ap)
+ {
+ this(ap);
+ setTitle(model.title);
+ this.viewId = model.viewId;
+ setBounds(model.x, model.y, model.width, model.height);
+ this.split.setDividerLocation(model.dividerLocation);
+ }
+
+ /**
+ * Constructs a split pane with an empty selection list and display panel, and
+ * adds it to the desktop
+ */
+ public void initVarna()
+ {
+ VARNAPanel varnaPanel = vab.get_varnaPanel();
+ setBackground(Color.white);
+ split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,
+ vab.getListPanel(), varnaPanel);
+ getContentPane().setLayout(new BorderLayout());
+ getContentPane().add(split, BorderLayout.CENTER);
+
+ varnaPanel.addSelectionListener(this);
+ jalview.gui.Desktop.addInternalFrame(this, "", getBounds().width,
+ getBounds().height);
+ this.pack();
+ showPanel(true);
+ }
+
+ /**
+ * Constructs a new RNA model from the given one, without gaps. Also
+ * calculates and saves a 'shift list'
+ *
+ * @param rna
+ * @param name
+ * @return
+ */
+ public RNA trimRNA(RNA rna, String name)
+ {
+ ShiftList offset = new ShiftList();
+
+ RNA rnaTrim = new RNA(name);
+ try
+ {
+ String structDBN = rna.getStructDBN(true);
+ rnaTrim.setRNA(rna.getSeq(), replaceOddGaps(structDBN));
+ } catch (ExceptionUnmatchedClosingParentheses e2)
+ {
+ e2.printStackTrace();
+ } catch (ExceptionFileFormatOrSyntax e3)
+ {
+ e3.printStackTrace();
+ }
+
+ String seq = rnaTrim.getSeq();
+ StringBuilder struc = new StringBuilder(256);
+ struc.append(rnaTrim.getStructDBN(true));
+ int ofstart = -1;
+ int sleng = seq.length();
+
+ for (int i = 0; i < sleng; i++)
+ {
+ if (Comparison.isGap(seq.charAt(i)))
+ {
+ if (ofstart == -1)
+ {
+ ofstart = i;
+ }
+ /*
+ * mark base or base & pair in the structure with *
+ */
+ if (!rnaTrim.findPair(i).isEmpty())
+ {
+ int m = rnaTrim.findPair(i).get(1);
+ int l = rnaTrim.findPair(i).get(0);
+
+ struc.replace(m, m + 1, "*");
+ struc.replace(l, l + 1, "*");
+ }
+ else
+ {
+ struc.replace(i, i + 1, "*");
+ }
+ }
+ else
+ {
+ if (ofstart > -1)
+ {
+ offset.addShift(offset.shift(ofstart), ofstart - i);
+ ofstart = -1;
+ }
+ }
+ }
+ // final gap
+ if (ofstart > -1)
+ {
+ offset.addShift(offset.shift(ofstart), ofstart - sleng);
+ ofstart = -1;
+ }
+
+ /*
+ * remove the marked gaps from the structure
+ */
+ String newStruc = struc.toString().replace("*", "");
+
+ /*
+ * remove gaps from the sequence
+ */
+ String newSeq = AlignSeq.extractGaps(Comparison.GapChars, seq);
+
+ try
+ {
+ rnaTrim.setRNA(newSeq, newStruc);
+ registerOffset(rnaTrim, offset);
+ } catch (ExceptionUnmatchedClosingParentheses e)
+ {
+ e.printStackTrace();
+ } catch (ExceptionFileFormatOrSyntax e)
+ {
+ e.printStackTrace();
+ }
+ return rnaTrim;
+ }
+
+ /**
+ * Save the sequence to structure mapping, and also its inverse.
+ *
+ * @param rnaTrim
+ * @param offset
+ */
+ private void registerOffset(RNA rnaTrim, ShiftList offset)
+ {
+ offsets.put(rnaTrim, offset);
+ offsetsInv.put(rnaTrim, offset.getInverse());
+ }
+
+ public void showPanel(boolean show)
+ {
+ this.setVisible(show);
+ }
+
+ /**
+ * If a mouseOver event from the AlignmentPanel is noticed the currently
+ * selected RNA in the VARNA window is highlighted at the specific position.
+ * To be able to remove it before the next highlight it is saved in
+ * _lastHighlight
+ *
+ * @param sequence
+ * @param index
+ * the aligned sequence position (base 0)
+ * @param position
+ * the dataset sequence position (base 1)
+ */
+ @Override
+ public void mouseOverSequence(SequenceI sequence, final int index,
+ final int position)
+ {
+ RNA rna = vab.getSelectedRNA();
+ if (rna == null)
+ {
+ return;
+ }
+ RnaModel rnaModel = models.get(rna);
+ if (rnaModel.seq == sequence)
+ {
+ int highlightPos = rnaModel.gapped ? index : position - 1;
+ mouseOverHighlighter.highlightRegion(rna, highlightPos, highlightPos);
+ vab.updateSelectedRNA(rna);
+ }
+ }
+
+ @Override
+ public void selection(SequenceGroup seqsel, ColumnSelection colsel,
+ SelectionSource source)
+ {
+ if (source != ap.av)
+ {
+ // ignore events from anything but our parent alignpanel
+ // TODO - reuse many-one panel-view system in jmol viewer
+ return;
+ }
+ RNA rna = vab.getSelectedRNA();
+ if (rna == null)
+ {
+ return;
+ }
+ if (seqsel != null && seqsel.getSize() > 0)
+ {
+ int start = seqsel.getStartRes(), end = seqsel.getEndRes();
+ ShiftList shift = offsets.get(rna);
+ if (shift != null)
+ {
+ start = shift.shift(start);
+ end = shift.shift(end);
+ }
+ selectionHighlighter.highlightRegion(rna, start, end);
+ selectionHighlighter.getLastHighlight().setOutlineColor(
+ seqsel.getOutlineColour());
+ // TODO - translate column markings to positions on structure if present.
+ vab.updateSelectedRNA(rna);
+ }
+ else
+ {
+ selectionHighlighter.clearSelection();
+ }
+ }
+
+ /**
+ * Respond to a change of the base hovered over in the Varna viewer
+ */
+ @Override
+ public void onHoverChanged(ModeleBase previousBase, ModeleBase newBase)
+ {
+ RNA rna = vab.getSelectedRNA();
+ ShiftList shift = offsetsInv.get(rna);
+ SequenceI seq = models.get(rna).seq;
+ if (newBase != null && seq != null)
+ {
+ if (shift != null)
+ {
+ int i = shift.shift(newBase.getIndex());
+ // System.err.println("shifted "+(arg1.getIndex())+" to "+i);
+ ssm.mouseOverVamsasSequence(seq, i, this);
+ }
+ else
+ {
+ ssm.mouseOverVamsasSequence(seq, newBase.getIndex(), this);
+ }
+ }
+ }
+
+ @Override
+ public void onSelectionChanged(BaseList arg0, BaseList arg1, BaseList arg2)
+ {
+ // TODO translate selected regions in VARNA to a selection on the
+ // alignpanel.
+
+ }
+
+ /**
+ * Returns the path to a temporary file containing a representation of the
+ * state of one Varna display
+ *
+ * @param rna
+ *
+ * @return
+ */
+ public String getStateInfo(RNA rna)
+ {
+ return vab.getStateInfo(rna);
+ }
+
+ public AlignmentPanel getAlignmentPanel()
+ {
+ return ap;
+ }
+
+ public String getViewId()
+ {
+ return viewId;
+ }
+
+ /**
+ * Returns true if any of the viewer's models (not necessarily the one
+ * currently displayed) is for the given sequence
+ *
+ * @param seq
+ * @return
+ */
+ public boolean isListeningFor(SequenceI seq)
+ {
+ for (RnaModel model : models.values())
+ {
+ if (model.seq == seq)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns a value representing the horizontal split divider location
+ *
+ * @return
+ */
+ public int getDividerLocation()
+ {
+ return split == null ? 0 : split.getDividerLocation();
+ }
+
+ /**
+ * Tidy up as necessary when the viewer panel is closed
+ */
+ protected void close()
+ {
+ /*
+ * Deregister as a listener, to release references to this object
+ */
+ if (ssm != null)
+ {
+ ssm.removeStructureViewerListener(AppVarna.this, null);
+ ssm.removeSelectionListener(AppVarna.this);
+ }
+ }
+
+ /**
+ * Returns the secondary structure annotation that this viewer displays for
+ * the given sequence
+ *
+ * @return
+ */
+ public AlignmentAnnotation getAnnotation(SequenceI seq)
+ {
+ for (RnaModel model : models.values())
+ {
+ if (model.seq == seq)
+ {
+ return model.ann;
+ }
+ }
+ return null;
+ }
+
+ public int getSelectedIndex()
+ {
+ return this.vab.getSelectedIndex();
+ }
+
+ /**
+ * Returns the set of models shown by the viewer
+ *
+ * @return
+ */
+ public Collection<RnaModel> getModels()
+ {
+ return models.values();
+ }
+
+ /**
+ * Add a model (e.g. loaded from project file)
+ *
+ * @param rna
+ * @param modelName
+ */
+ public RNA addModel(RnaModel model, String modelName)
+ {
+ if (!model.ann.isValidStruc())
+ {
+ throw new IllegalArgumentException("Invalid RNA structure annotation");
+ }
+
+ /*
+ * opened on request in Jalview session
+ */
+ RNA rna = new RNA(modelName);
+ String struc = model.ann.getRNAStruc();
+ struc = replaceOddGaps(struc);
+
+ String strucseq = model.seq.getSequenceAsString();
+ try
+ {
+ rna.setRNA(strucseq, struc);
+ } catch (ExceptionUnmatchedClosingParentheses e2)
+ {
+ e2.printStackTrace();
+ } catch (ExceptionFileFormatOrSyntax e3)
+ {
+ e3.printStackTrace();
+ }
+
+ if (!model.gapped)
+ {
+ rna = trimRNA(rna, modelName);
+ }
+ models.put(rna, new RnaModel(modelName, model.ann, model.seq, rna,
+ model.gapped));
+ vab.addStructure(rna);
+ return rna;
+ }
+
+ /**
+ * Constructs a shift list that describes the gaps in the sequence
+ *
+ * @param seq
+ * @return
+ */
+ protected ShiftList buildOffset(SequenceI seq)
+ {
+ // TODO refactor to avoid duplication with trimRNA()
+ // TODO JAL-1789 bugs in use of ShiftList here
+ ShiftList offset = new ShiftList();
+ int ofstart = -1;
+ int sleng = seq.getLength();
+ char[] seqChars = seq.getSequence();
+
+ for (int i = 0; i < sleng; i++)
+ {
+ if (Comparison.isGap(seqChars[i]))
+ {
+ if (ofstart == -1)
+ {
+ ofstart = i;
+ }
+ }
+ else
+ {
+ if (ofstart > -1)
+ {
+ offset.addShift(offset.shift(ofstart), ofstart - i);
+ ofstart = -1;
+ }
+ }
+ }
+ // final gap
+ if (ofstart > -1)
+ {
+ offset.addShift(offset.shift(ofstart), ofstart - sleng);
+ ofstart = -1;
+ }
+ return offset;
+ }
+
+ /**
+ * Set the selected index in the model selection list
+ *
+ * @param selectedIndex
+ */
+ public void setInitialSelection(final int selectedIndex)
+ {
+ /*
+ * empirically it needs a second for Varna/AWT to finish loading/drawing
+ * models for this to work; SwingUtilities.invokeLater _not_ a solution;
+ * explanation and/or better solution welcome!
+ */
+ synchronized (this)
+ {
+ try
+ {
+ wait(1000);
+ } catch (InterruptedException e)
+ {
+ // meh
+ }
+ }
+ vab.setSelectedIndex(selectedIndex);
+ }
+
+ /**
+ * Add a model with associated Varna session file
+ *
+ * @param rna
+ * @param modelName
+ */
+ public RNA addModelSession(RnaModel model, String modelName,
+ String sessionFile)
+ {
+ if (!model.ann.isValidStruc())
+ {
+ throw new IllegalArgumentException("Invalid RNA structure annotation");
+ }
+
+ try
+ {
+ FullBackup fromSession = vab.vp.loadSession(sessionFile);
+ vab.addStructure(fromSession.rna, fromSession.config);
+ RNA rna = fromSession.rna;
+ // copy the model, but now including the RNA object
+ RnaModel newModel = new RnaModel(model.title, model.ann, model.seq,
+ rna, model.gapped);
+ if (!model.gapped)
+ {
+ registerOffset(rna, buildOffset(model.seq));
+ }
+ models.put(rna, newModel);
+ // capture rna selection state when saved
+ selectionHighlighter = new VarnaHighlighter(rna);
+ return fromSession.rna;
+ } catch (ExceptionLoadingFailed e)
+ {
+ System.err
+ .println("Error restoring Varna session: " + e.getMessage());
+ return null;
+ }
+ }
+
+ /**
+ * Replace everything except RNA secondary structure characters with a period
+ *
+ * @param s
+ * @return
+ */
+ public static String replaceOddGaps(String s)
+ {
+ if (s == null)
+ {
+ return null;
+ }
+
+ // this is measured to be 10 times faster than a regex replace
+ boolean changed = false;
+ byte[] bytes = s.getBytes();
+ for (int i = 0; i < bytes.length; i++)
+ {
+ boolean ok = false;
+ // todo check for ((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z')) if
+ // wanted also
+ for (int j = 0; !ok && (j < PAIRS.length); j++)
+ {
+ if (bytes[i] == PAIRS[j])
+ {
+ ok = true;
+ }
+ }
+ if (!ok)
+ {
+ bytes[i] = '.';
+ changed = true;
+ }
+ }
+ return changed ? new String(bytes) : s;
+ }
+}
diff --git a/src/jalview/gui/AppVarnaBinding.java b/src/jalview/gui/AppVarnaBinding.java
new file mode 100644
index 0000000..366dc06
--- /dev/null
+++ b/src/jalview/gui/AppVarnaBinding.java
@@ -0,0 +1,577 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.datamodel.SequenceI;
+import jalview.ext.varna.JalviewVarnaBinding;
+import jalview.structure.AtomSpec;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetAdapter;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.DefaultListModel;
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.ListModel;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import fr.orsay.lri.varna.VARNAPanel;
+import fr.orsay.lri.varna.components.ReorderableJList;
+import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
+import fr.orsay.lri.varna.exceptions.ExceptionNAViewAlgorithm;
+import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
+import fr.orsay.lri.varna.models.FullBackup;
+import fr.orsay.lri.varna.models.VARNAConfig;
+import fr.orsay.lri.varna.models.rna.RNA;
+
+public class AppVarnaBinding extends JalviewVarnaBinding
+{
+ public VARNAPanel vp;
+
+ protected JPanel _listPanel = new JPanel();
+
+ private ReorderableJList _sideList = null;
+
+ private static String errorOpt = "error";
+
+ @SuppressWarnings("unused")
+ private boolean _error;
+
+ private Color _backgroundColor = Color.white;
+
+ private static int _nextID = 1;
+
+ @SuppressWarnings("unused")
+ private int _algoCode;
+
+ private BackupHolder _rnaList;
+
+ /**
+ * Constructor
+ */
+ public AppVarnaBinding()
+ {
+ init();
+ }
+
+ /**
+ * Constructs the VARNAPanel and an (empty) selection list of structures to
+ * show in it
+ */
+ private void init()
+ {
+ DefaultListModel<FullBackup> dlm = new DefaultListModel<FullBackup>();
+
+ int marginTools = 40;
+
+ DefaultListSelectionModel m = new DefaultListSelectionModel();
+ m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ m.setLeadAnchorNotificationEnabled(false);
+
+ _sideList = new ReorderableJList();
+ _sideList.setModel(dlm);
+ _sideList.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseClicked(MouseEvent e)
+ {
+ AppVarnaBinding.this.mouseClicked(e);
+ }
+ });
+ _sideList.setSelectionModel(m);
+ _sideList.setPreferredSize(new Dimension(100, 0));
+ _sideList.addListSelectionListener(new ListSelectionListener()
+ {
+ public void valueChanged(ListSelectionEvent evt)
+ {
+ changeSelectedStructure_actionPerformed(evt);
+ }
+ });
+ _rnaList = new BackupHolder(dlm, _sideList);
+
+ try
+ {
+ vp = new VARNAPanel("0", ".");
+ } catch (ExceptionNonEqualLength e)
+ {
+ vp.errorDialog(e);
+ }
+ vp.setPreferredSize(new Dimension(400, 400));
+
+ JScrollPane listScroller = new JScrollPane(_sideList);
+ listScroller.setPreferredSize(new Dimension(150, 0));
+
+ vp.setBackground(_backgroundColor);
+
+ JLabel j = new JLabel(
+ MessageManager.getString("label.structures_manager"),
+ JLabel.CENTER);
+ _listPanel.setLayout(new BorderLayout());
+
+ _listPanel.add(j, BorderLayout.NORTH);
+ _listPanel.add(listScroller, BorderLayout.CENTER);
+
+ new DropTarget(vp, new DropTargetAdapter()
+ {
+ @Override
+ public void drop(DropTargetDropEvent dtde)
+ {
+ AppVarnaBinding.this.drop(dtde);
+ }
+ });
+ }
+
+ public JPanel getListPanel()
+ {
+ return _listPanel;
+ }
+
+ /**
+ * Returns the currently selected RNA, or null if none selected
+ *
+ * @return
+ */
+ public RNA getSelectedRNA()
+ {
+ int selectedIndex = _sideList.getSelectedIndex();
+ if (selectedIndex < 0)
+ {
+ return null;
+ }
+ FullBackup selected = _rnaList.getElementAt(selectedIndex);
+ return selected.rna;
+ }
+
+ /**
+ * Substitute currently selected RNA with the edited one
+ *
+ * @param rnaEdit
+ */
+ public void updateSelectedRNA(RNA rnaEdit)
+ {
+ vp.repaint();
+ vp.showRNA(rnaEdit);
+ }
+
+ public static String generateDefaultName()
+ {
+ return "User file #" + _nextID++;
+ }
+
+ public String[][] getParameterInfo()
+ {
+ String[][] info = {
+ // Parameter Name Kind of Value Description,
+ { "sequenceDBN", "String", "A raw RNA sequence" },
+ { "structureDBN", "String",
+ "An RNA structure in dot bracket notation (DBN)" },
+ { errorOpt, "boolean", "To show errors" }, };
+ return info;
+ }
+
+ @SuppressWarnings("unused")
+ private Color getSafeColor(String col, Color def)
+ {
+ Color result;
+ try
+ {
+ result = Color.decode(col);
+ } catch (Exception e)
+ {
+ try
+ {
+ result = Color.getColor(col, def);
+ } catch (Exception e2)
+ {
+ return def;
+ }
+ }
+ return result;
+ }
+
+ public VARNAPanel get_varnaPanel()
+ {
+ return vp;
+ }
+
+ public void set_varnaPanel(VARNAPanel surface)
+ {
+ vp = surface;
+ }
+
+ public void drop(DropTargetDropEvent dtde)
+ {
+ try
+ {
+ Transferable tr = dtde.getTransferable();
+ DataFlavor[] flavors = tr.getTransferDataFlavors();
+ for (int i = 0; i < flavors.length; i++)
+ {
+ if (flavors[i].isFlavorJavaFileListType())
+ {
+ dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+ Object ob = tr.getTransferData(flavors[i]);
+ if (ob instanceof List)
+ {
+ List list = (List) ob;
+ for (int j = 0; j < list.size(); j++)
+ {
+ Object o = list.get(j);
+
+ if (dtde.getSource() instanceof DropTarget)
+ {
+ DropTarget dt = (DropTarget) dtde.getSource();
+ Component c = dt.getComponent();
+ if (c instanceof VARNAPanel)
+ {
+ String path = o.toString();
+ VARNAPanel varnaPanel = (VARNAPanel) c;
+ try
+ {
+ FullBackup bck = VARNAPanel.importSession(path);
+ _rnaList.add(bck.config, bck.rna, bck.name, true);
+ } catch (ExceptionLoadingFailed e3)
+ {
+ int mn = 1;
+ Collection<RNA> mdls = fr.orsay.lri.varna.factories.RNAFactory
+ .loadSecStr(path);
+ for (RNA r : mdls)
+ {
+ r.drawRNA(varnaPanel.getConfig());
+ String name = r.getName();
+ if (name.equals(""))
+ {
+ name = path.substring(path
+ .lastIndexOf(File.separatorChar) + 1);
+ }
+ if (mdls.size() > 1)
+ {
+ name += " (Model " + mn++ + ")";
+ }
+ _rnaList.add(varnaPanel.getConfig().clone(), r, name,
+ true);
+ }
+ }
+ }
+ }
+ }
+ }
+ // If we made it this far, everything worked.
+ dtde.dropComplete(true);
+ return;
+ }
+ }
+ // Hmm, the user must not have dropped a file list
+ dtde.rejectDrop();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ dtde.rejectDrop();
+ }
+
+ }
+
+ private class BackupHolder
+ {
+ private DefaultListModel<FullBackup> _rnalist;
+
+ private List<RNA> _rnas = new ArrayList<RNA>();
+
+ JList _l;
+
+ public BackupHolder(DefaultListModel<FullBackup> rnaList, JList l)
+ {
+ _rnalist = rnaList;
+ _l = l;
+ }
+
+ public void add(VARNAConfig c, RNA r, String name)
+ {
+ add(c, r, name, false);
+ }
+
+ /**
+ * Adds an entry to the end of the selection list and (optionally) sets it
+ * as selected
+ *
+ * @param c
+ * @param r
+ * @param name
+ * @param select
+ */
+ public void add(VARNAConfig c, RNA r, String name, boolean select)
+ {
+ if (select)
+ {
+ _l.removeSelectionInterval(0, _rnalist.size());
+ }
+ if (name.equals(""))
+ {
+ name = generateDefaultName();
+ }
+ FullBackup bck = new FullBackup(c, r, name);
+ _rnas.add(r);
+ _rnalist.addElement(bck);
+ if (select)
+ {
+ _l.setSelectedIndex(0);
+ }
+ }
+
+ public FullBackup getElementAt(int i)
+ {
+ return _rnalist.getElementAt(i);
+ }
+ }
+
+ public void mouseClicked(MouseEvent e)
+ {
+ if (e.getClickCount() == 2)
+ {
+ int index = _sideList.locationToIndex(e.getPoint());
+ ListModel<FullBackup> dlm = _sideList.getModel();
+ // FullBackup item = dlm.getElementAt(index);
+
+ _sideList.ensureIndexIsVisible(index);
+ /*
+ * TODO Object newName = JOptionPane.showInputDialog( this,
+ * "Specify a new name for this RNA", "Rename RNA",
+ * JOptionPane.QUESTION_MESSAGE, (Icon)null, null, item.toString()); if
+ * (newName!=null) { item.name = newName.toString();
+ * this._sideList.repaint(); }
+ */
+ }
+ }
+
+ @Override
+ public String[] getPdbFile()
+ {
+ return null;
+ }
+
+ @Override
+ public void releaseReferences(Object svl)
+ {
+ }
+
+ @Override
+ public void updateColours(Object source)
+ {
+ }
+
+ @Override
+ public void componentHidden(ComponentEvent e)
+ {
+ }
+
+ @Override
+ public void componentMoved(ComponentEvent e)
+ {
+ }
+
+ @Override
+ public void componentResized(ComponentEvent e)
+ {
+ }
+
+ @Override
+ public void componentShown(ComponentEvent e)
+ {
+ }
+
+ @Override
+ public void highlightAtoms(List<AtomSpec> atoms)
+ {
+ }
+
+ @Override
+ public boolean isListeningFor(SequenceI seq)
+ {
+ return true;
+ }
+
+ /**
+ * Returns the path to a temporary file containing a representation of the
+ * state of the Varna display, or null on any error
+ *
+ * @param rna
+ * @param jds
+ *
+ * @return
+ */
+ public String getStateInfo(RNA rna)
+ {
+ if (vp == null)
+ {
+ return null;
+ }
+
+ /*
+ * we have to show the RNA we want to save in the viewer; get the currently
+ * displayed model first so we can restore it
+ */
+ FullBackup sel = (FullBackup) _sideList.getSelectedValue();
+
+ FullBackup model = null;
+ ListModel models = _sideList.getModel();
+ for (int i = 0; i < models.getSize(); i++)
+ {
+ model = (FullBackup) models.getElementAt(i);
+ if (model.rna == rna)
+ {
+ break;
+ }
+ }
+ if (model == null)
+ {
+ return null;
+ }
+
+ /*
+ * switch display
+ */
+ vp.showRNA(model.rna, model.config);
+
+ try
+ {
+ File temp;
+ temp = File.createTempFile("varna", null);
+ temp.deleteOnExit();
+ String filePath = temp.getAbsolutePath();
+ vp.toXML(filePath);
+
+ /*
+ * restore the previous display
+ */
+ vp.showRNA(sel.rna, sel.config);
+
+ return filePath;
+ } catch (IOException e)
+ {
+ return null;
+ }
+ }
+
+ public int getSelectedIndex()
+ {
+ return _sideList.getSelectedIndex();
+ }
+
+ /**
+ * Switch the Varna display to the structure selected in the left hand panel
+ *
+ * @param evt
+ */
+ protected void changeSelectedStructure_actionPerformed(
+ ListSelectionEvent evt)
+ {
+ if (!evt.getValueIsAdjusting())
+ {
+ showSelectedStructure();
+ }
+ }
+
+ /**
+ *
+ */
+ protected void showSelectedStructure()
+ {
+ FullBackup sel = (FullBackup) _sideList.getSelectedValue();
+ if (sel != null)
+ {
+ vp.showRNA(sel.rna, sel.config);
+ }
+ }
+
+ /**
+ * Set and display the selected item in the list of structures
+ *
+ * @param selectedRna
+ */
+ public void setSelectedIndex(final int selectedRna)
+ {
+ /*
+ * note this does nothing if, say, selecting item 3 when only 1 has been
+ * added on load
+ */
+ _sideList.setSelectedIndex(selectedRna);
+ // TODO ? need a worker thread to get this to happen properly
+ }
+
+ /**
+ * Add an RNA structure to the selection list
+ *
+ * @param rna
+ */
+ public void addStructure(RNA rna)
+ {
+ VARNAConfig config = vp.getConfig().clone();
+ addStructure(rna, config);
+ }
+
+ /**
+ * @param rna
+ * @param config
+ */
+ protected void addStructure(final RNA rna, final VARNAConfig config)
+ {
+ drawRna(rna, config);
+ _rnaList.add(config, rna, rna.getName());
+ }
+
+ /**
+ * @param rna
+ * @param config
+ */
+ protected void drawRna(final RNA rna, final VARNAConfig config)
+ {
+ try
+ {
+ rna.drawRNA(rna.getDrawMode(), config);
+ } catch (ExceptionNAViewAlgorithm e)
+ {
+ // only throwable for draw mode = 3 NAView
+ System.err.println("Error drawing RNA: " + e.getMessage());
+ }
+ }
+}
diff --git a/src/jalview/gui/AssociatePdbFileWithSeq.java b/src/jalview/gui/AssociatePdbFileWithSeq.java
index 5c22e55..f67d6da 100644
--- a/src/jalview/gui/AssociatePdbFileWithSeq.java
+++ b/src/jalview/gui/AssociatePdbFileWithSeq.java
@@ -1,78 +1,94 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
-import javax.swing.JOptionPane;
-
+import jalview.api.StructureSelectionManagerProvider;
import jalview.datamodel.PDBEntry;
-import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+
+import javax.swing.JOptionPane;
/**
* GUI related routines for associating PDB files with sequences
+ *
* @author JimP
- *
+ *
*/
public class AssociatePdbFileWithSeq
{
-/**
- * assocate the given PDB file with
- * @param choice
- * @param sequence
- */
- public PDBEntry associatePdbWithSeq(String choice, String protocol, SequenceI sequence, boolean prompt)
+ /**
+ * assocate the given PDB file with
+ *
+ * @param choice
+ * @param sequence
+ */
+ public PDBEntry associatePdbWithSeq(String choice, String protocol,
+ SequenceI sequence, boolean prompt,
+ StructureSelectionManagerProvider ssmp)
{
PDBEntry entry = new PDBEntry();
- try
+ MCview.PDBfile pdbfile = null;
+ pdbfile = StructureSelectionManager.getStructureSelectionManager(ssmp)
+ .setMapping(false, new SequenceI[] { sequence }, null, choice,
+ protocol);
+ if (pdbfile == null)
{
- MCview.PDBfile pdbfile = new MCview.PDBfile(choice,
- protocol);
+ // stacktrace already thrown so just return
+ return null;
+ }
+ if (pdbfile.id == null)
+ {
+ String reply = null;
- if (pdbfile.id == null)
+ if (prompt)
{
- String reply = null;
-
- if (prompt) { reply = JOptionPane
- .showInternalInputDialog(
- Desktop.desktop,
- "Couldn't find a PDB id in the file supplied."
- + "Please enter an Id to identify this structure.",
- "No PDB Id in File", JOptionPane.QUESTION_MESSAGE);}
- if (reply == null)
- {
- return null;
- }
-
- entry.setId(reply);
+ reply = JOptionPane.showInternalInputDialog(Desktop.desktop,
+ MessageManager
+ .getString("label.couldnt_find_pdb_id_in_file"),
+ MessageManager.getString("label.no_pdb_id_in_file"),
+ JOptionPane.QUESTION_MESSAGE);
}
- else
+ if (reply == null)
{
- entry.setId(pdbfile.id);
+ return null;
}
- } catch (java.io.IOException ex)
+
+ entry.setId(reply);
+ }
+ else
{
- ex.printStackTrace();
+ entry.setId(pdbfile.id);
}
+ entry.setType(PDBEntry.Type.FILE);
- entry.setFile(choice);
- sequence.getDatasetSequence().addPDBId(entry);
+ if (pdbfile != null)
+ {
+ entry.setFile(choice);
+ sequence.getDatasetSequence().addPDBId(entry);
+ StructureSelectionManager.getStructureSelectionManager(ssmp)
+ .registerPDBEntry(entry);
+ }
return entry;
}
-
}
diff --git a/src/jalview/gui/BlogReader.java b/src/jalview/gui/BlogReader.java
index 2b728ae..5baed16 100644
--- a/src/jalview/gui/BlogReader.java
+++ b/src/jalview/gui/BlogReader.java
@@ -1,25 +1,31 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
import jalview.bin.Cache;
+import jalview.util.MessageManager;
+
import java.awt.BorderLayout;
import java.awt.Component;
+import java.awt.Dialog.ModalExclusionType;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
@@ -122,11 +128,12 @@ public class BlogReader extends JPanel
@Override
public void actionPerformed(ActionEvent arg0)
{
- if (xf!=null)
+ if (xf != null)
{
xf.dispose();
}
- xf=null;jd=null;
+ xf = null;
+ jd = null;
if (parent != null)
{
parent.showNews(false);
@@ -191,8 +198,8 @@ public class BlogReader extends JPanel
{
if (parent != null)
{
- Cache.log.info("News window closed.");
- jd=null;
+ Cache.log.debug("News window closed.");
+ jd = null;
parent.showNews(false);
}
}
@@ -239,7 +246,7 @@ public class BlogReader extends JPanel
public BlogReader(Desktop desktop)
{
- Cache.log.info("Constructing news reader.");
+ Cache.log.debug("Constructing news reader.");
parent = desktop;
_channelModel = new ChannelListModel();
@@ -268,10 +275,10 @@ public class BlogReader extends JPanel
if (setvisible)
{
- Cache.log.info("Will show jalview news automatically");
+ Cache.log.debug("Will show jalview news automatically");
showNews();
}
- Cache.log.info("Completed construction of reader.");
+ Cache.log.debug("Completed construction of reader.");
}
@@ -324,9 +331,11 @@ public class BlogReader extends JPanel
{
createDialog();
bounds = new Rectangle(5, 5, 550, 350);
- jd.initDialogFrame(me, true, false, "News from www.jalview.org",
+ jd.initDialogFrame(me, false, false,
+ MessageManager.getString("label.news_from_jalview"),
bounds.width, bounds.height);
- Cache.log.info("Displaying news.");
+ jd.frame.setModalExclusionType(ModalExclusionType.NO_EXCLUDE);
+ Cache.log.debug("Displaying news.");
jd.waitForInput();
}
}
@@ -413,7 +422,7 @@ public class BlogReader extends JPanel
{
jalview.bin.Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED",
lastDate);
- jalview.bin.Cache.log.info("Saved last read date as "
+ jalview.bin.Cache.log.debug("Saved last read date as "
+ jalview.bin.Cache.date_format.format(lastDate));
}
@@ -432,7 +441,9 @@ public class BlogReader extends JPanel
topBottomSplitPane.setBottomComponent(bottomPanel);
JScrollPane spTextDescription = new JScrollPane(textDescription);
textDescription.setText("");
- statusBar.setText(" [Status] ");
+ statusBar.setText(new StringBuffer("[")
+ .append(MessageManager.getString("label.status")).append("]")
+ .toString());
buttonRefresh.addActionListener(new ActionListener()
{
@@ -474,7 +485,7 @@ public class BlogReader extends JPanel
_popupChannels);
listItems.addMouseListener(popupAdapter);
listItems.setCellRenderer(new ItemsRenderer());
- lblChannels.setText("Channels");
+ lblChannels.setText(MessageManager.getString("label.channels"));
}
private void postInit()
@@ -750,16 +761,16 @@ public class BlogReader extends JPanel
+ jalview.bin.Cache.date_format.format(lastread.getTime()));
if (me.isNewsNew())
{
- Cache.log.info("There is news to read.");
+ Cache.log.debug("There is news to read.");
}
else
{
- Cache.log.info("There is no new news.");
+ Cache.log.debug("There is no new news.");
me.xf.setTitle("Testing : Last read is " + me.lastDate);
me.showNews();
me.xf.toFront();
}
- Cache.log.info("Waiting for closure.");
+ Cache.log.debug("Waiting for closure.");
do
{
try
@@ -773,18 +784,18 @@ public class BlogReader extends JPanel
if (me.isNewsNew())
{
- Cache.log.info("Still new news after reader displayed.");
+ Cache.log.debug("Still new news after reader displayed.");
}
if (lastread.getTime().before(me.lastDate))
{
- Cache.log.info("The news was read.");
+ Cache.log.debug("The news was read.");
lastread.setTime(me.lastDate);
}
else
{
lastread.add(Calendar.MONTH, 1);
}
-
+
}
}
@@ -808,8 +819,13 @@ class ChannelsRenderer extends DefaultListCellRenderer
if (value instanceof Channel)
{
Channel channel = (Channel) value;
- component.setText(channel.getTitle() + " ("
- + channel.getUnreadItemCount() + ")");
+ component
+ .setText(MessageManager.formatMessage(
+ "label.channel_title_item_count",
+ new String[] {
+ channel.getTitle(),
+ Integer.valueOf(channel.getUnreadItemCount())
+ .toString() }));
component.setToolTipText(channel.getURL());
}
return component;
@@ -832,9 +848,14 @@ class ItemsRenderer extends DefaultListCellRenderer
Item item = (Item) value;
if (item.getPublishDate() != null)
{
- component.setText(DateFormat.getDateInstance().format(
- item.getPublishDate())
- + " " + item.getTitle());
+ component.setText(MessageManager.formatMessage(
+ "label.blog_item_published_on_date",
+ new String[] {
+ DateFormat
+ .getDateInstance(DateFormat.LONG,
+ MessageManager.getLocale())
+ .format(item.getPublishDate()).toString(),
+ item.getTitle() }));
}
component.setToolTipText(item.getLink());
if (!item.isRead())
diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java
new file mode 100644
index 0000000..c902093
--- /dev/null
+++ b/src/jalview/gui/ChimeraViewFrame.java
@@ -0,0 +1,1211 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.bin.Cache;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.ext.rbvi.chimera.JalviewChimeraBinding;
+import jalview.gui.StructureViewer.ViewerType;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.ZappoColourScheme;
+import jalview.structures.models.AAStructureBindingModel;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+import jalview.ws.dbsources.Pdb;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JColorChooser;
+import javax.swing.JInternalFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+
+/**
+ * GUI elements for handling an external chimera display
+ *
+ * @author jprocter
+ *
+ */
+public class ChimeraViewFrame extends StructureViewerBase
+{
+ private JalviewChimeraBinding jmb;
+
+ private boolean allChainsSelected = false;
+
+ private IProgressIndicator progressBar = null;
+
+ /*
+ * Path to Chimera session file. This is set when an open Jalview/Chimera
+ * session is saved, or on restore from a Jalview project (if it holds the
+ * filename of any saved Chimera sessions).
+ */
+ private String chimeraSessionFile = null;
+
+ private Random random = new Random();
+
+ /**
+ * Initialise menu options.
+ */
+ private void initMenus()
+ {
+ viewerActionMenu.setText(MessageManager.getString("label.chimera"));
+ viewerColour.setText(MessageManager
+ .getString("label.colour_with_chimera"));
+ viewerColour.setToolTipText(MessageManager
+ .getString("label.let_chimera_manage_structure_colours"));
+ helpItem.setText(MessageManager.getString("label.chimera_help"));
+ seqColour.setSelected(jmb.isColourBySequence());
+ viewerColour.setSelected(!jmb.isColourBySequence());
+ if (_colourwith == null)
+ {
+ _colourwith = new Vector<AlignmentPanel>();
+ }
+ if (_alignwith == null)
+ {
+ _alignwith = new Vector<AlignmentPanel>();
+ }
+
+ // save As not yet implemented
+ savemenu.setVisible(false);
+
+ ViewSelectionMenu seqColourBy = new ViewSelectionMenu(
+ MessageManager.getString("label.colour_by"), this, _colourwith,
+ new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ if (!seqColour.isSelected())
+ {
+ seqColour.doClick();
+ }
+ else
+ {
+ // update the Chimera display now.
+ seqColour_actionPerformed(null);
+ }
+ }
+ });
+ viewMenu.add(seqColourBy);
+ viewMenu.add(fitToWindow);
+
+ final ItemListener handler;
+ JMenu alpanels = new ViewSelectionMenu(
+ MessageManager.getString("label.superpose_with"), this,
+ _alignwith, handler = new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ alignStructs.setEnabled(_alignwith.size() > 0);
+ alignStructs.setToolTipText(MessageManager
+ .formatMessage(
+ "label.align_structures_using_linked_alignment_views",
+ new Object[] { new Integer(_alignwith
+ .size()).toString() }));
+ }
+ });
+ handler.itemStateChanged(null);
+ viewerActionMenu.add(alpanels);
+ viewerActionMenu.addMenuListener(new MenuListener()
+ {
+
+ @Override
+ public void menuSelected(MenuEvent e)
+ {
+ handler.itemStateChanged(null);
+ }
+
+ @Override
+ public void menuDeselected(MenuEvent e)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void menuCanceled(MenuEvent e)
+ {
+ // TODO Auto-generated method stub
+ }
+ });
+ }
+
+ /**
+ * add a single PDB structure to a new or existing Chimera view
+ *
+ * @param pdbentry
+ * @param seq
+ * @param chains
+ * @param ap
+ */
+ public ChimeraViewFrame(PDBEntry pdbentry, SequenceI[] seq,
+ String[] chains, final AlignmentPanel ap)
+ {
+ super();
+ String pdbId = pdbentry.getId();
+
+ /*
+ * If the PDB file is already loaded, the user may just choose to add to an
+ * existing viewer (or cancel)
+ */
+ if (addAlreadyLoadedFile(seq, chains, ap, pdbId))
+ {
+ return;
+ }
+
+ /*
+ * Check if there are other Chimera views involving this alignment and give
+ * user the option to add and align this molecule to one of them (or cancel)
+ */
+ if (addToExistingViewer(pdbentry, seq, chains, ap, pdbId))
+ {
+ return;
+ }
+
+ /*
+ * If the options above are declined or do not apply, show the structure in
+ * a new viewer
+ */
+ openNewChimera(ap, new PDBEntry[] { pdbentry },
+ new SequenceI[][] { seq });
+ }
+
+ /**
+ * Create a helper to manage progress bar display
+ */
+ protected void createProgressBar()
+ {
+ if (progressBar == null)
+ {
+ progressBar = new ProgressBar(statusPanel, statusBar);
+ }
+ }
+
+ /**
+ * Answers true if this viewer already involves the given PDB ID
+ */
+ @Override
+ protected boolean hasPdbId(String pdbId)
+ {
+ return jmb.hasPdbId(pdbId);
+ }
+
+ private void openNewChimera(AlignmentPanel ap, PDBEntry[] pdbentrys,
+ SequenceI[][] seqs)
+ {
+ createProgressBar();
+ String[][] chains = extractChains(seqs);
+ jmb = new JalviewChimeraBindingModel(this,
+ ap.getStructureSelectionManager(), pdbentrys, seqs, chains,
+ null);
+ addAlignmentPanel(ap);
+ useAlignmentPanelForColourbyseq(ap);
+ if (pdbentrys.length > 1)
+ {
+ alignAddedStructures = true;
+ useAlignmentPanelForSuperposition(ap);
+ }
+ jmb.setColourBySequence(true);
+ setSize(400, 400); // probably should be a configurable/dynamic default here
+ initMenus();
+
+ addingStructures = false;
+ worker = new Thread(this);
+ worker.start();
+
+ this.addInternalFrameListener(new InternalFrameAdapter()
+ {
+ public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
+ {
+ closeViewer(false);
+ }
+ });
+
+ }
+
+ /**
+ * Retrieve chains for sequences by inspecting their PDB refs. The hope is
+ * that the first will be to the sequence's own chain. Really need a more
+ * managed way of doing this.
+ *
+ * @param seqs
+ * @return
+ */
+ protected String[][] extractChains(SequenceI[][] seqs)
+ {
+ String[][] chains = new String[seqs.length][];
+ for (int i = 0; i < seqs.length; i++)
+ {
+ chains[i] = new String[seqs[i].length];
+ int seqno = 0;
+ for (SequenceI seq : seqs[i])
+ {
+ String chain = null;
+ if (seq.getDatasetSequence() != null)
+ {
+ Vector<PDBEntry> pdbrefs = seq.getDatasetSequence()
+ .getAllPDBEntries();
+ if (pdbrefs != null && pdbrefs.size() > 0)
+ {
+ chain = pdbrefs.get(0).getChainCode();
+ }
+ }
+ chains[i][seqno++] = chain;
+ }
+ }
+ return chains;
+ }
+
+ /**
+ * Create a new viewer from saved session state data including Chimera session
+ * file
+ *
+ * @param chimeraSessionFile
+ * @param alignPanel
+ * @param pdbArray
+ * @param seqsArray
+ * @param colourByChimera
+ * @param colourBySequence
+ * @param newViewId
+ */
+ public ChimeraViewFrame(String chimeraSessionFile,
+ AlignmentPanel alignPanel, PDBEntry[] pdbArray,
+ SequenceI[][] seqsArray, boolean colourByChimera,
+ boolean colourBySequence, String newViewId)
+ {
+ super();
+ setViewId(newViewId);
+ this.chimeraSessionFile = chimeraSessionFile;
+ openNewChimera(alignPanel, pdbArray, seqsArray);
+ if (colourByChimera)
+ {
+ jmb.setColourBySequence(false);
+ seqColour.setSelected(false);
+ viewerColour.setSelected(true);
+ }
+ else if (colourBySequence)
+ {
+ jmb.setColourBySequence(true);
+ seqColour.setSelected(true);
+ viewerColour.setSelected(false);
+ }
+ }
+
+ /**
+ * create a new viewer containing several structures superimposed using the
+ * given alignPanel.
+ *
+ * @param pe
+ * @param seqs
+ * @param ap
+ */
+ public ChimeraViewFrame(PDBEntry[] pe, SequenceI[][] seqs,
+ AlignmentPanel ap)
+ {
+ super();
+ openNewChimera(ap, pe, seqs);
+ }
+
+ public ChimeraViewFrame(Map<PDBEntry, List<SequenceI>> toView,
+ AlignmentPanel alignPanel)
+ {
+ super();
+
+ /*
+ * Convert the map of sequences per pdb entry into the tied arrays expected
+ * by openNewChimera
+ *
+ * TODO pass the Map down to openNewChimera and its callees instead
+ */
+ final Set<PDBEntry> pdbEntries = toView.keySet();
+ PDBEntry[] pdbs = pdbEntries.toArray(new PDBEntry[pdbEntries.size()]);
+ SequenceI[][] seqsForPdbs = new SequenceI[pdbEntries.size()][];
+ for (int i = 0; i < pdbs.length; i++)
+ {
+ final List<SequenceI> seqsForPdb = toView.get(pdbs[i]);
+ seqsForPdbs[i] = seqsForPdb.toArray(new SequenceI[seqsForPdb.size()]);
+ }
+
+ openNewChimera(alignPanel, pdbs, seqsForPdbs);
+ }
+
+ /**
+ * Returns a list of any Chimera viewers in the desktop. The list is
+ * restricted to those linked to the given alignment panel if it is not null.
+ */
+ @Override
+ protected List<StructureViewerBase> getViewersFor(AlignmentPanel ap)
+ {
+ List<StructureViewerBase> result = new ArrayList<StructureViewerBase>();
+ JInternalFrame[] frames = Desktop.instance.getAllFrames();
+
+ for (JInternalFrame frame : frames)
+ {
+ if (frame instanceof ChimeraViewFrame)
+ {
+ if (ap == null || ((StructureViewerBase) frame).isLinkedWith(ap))
+ {
+ result.add((StructureViewerBase) frame);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Launch Chimera. If we have a chimera session file name, send Chimera the
+ * command to open its saved session file.
+ */
+ void initChimera()
+ {
+ jmb.setFinishedInit(false);
+ jalview.gui.Desktop.addInternalFrame(this,
+ jmb.getViewerTitle("Chimera", true), getBounds().width,
+ getBounds().height);
+
+ if (!jmb.launchChimera())
+ {
+ JOptionPane.showMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.chimera_failed"),
+ MessageManager.getString("label.error_loading_file"),
+ JOptionPane.ERROR_MESSAGE);
+ this.dispose();
+ return;
+ }
+
+ if (this.chimeraSessionFile != null)
+ {
+ boolean opened = jmb.openSession(chimeraSessionFile);
+ if (!opened)
+ {
+ System.err
+ .println("An error occurred opening Chimera session file "
+ + chimeraSessionFile);
+ }
+ }
+ jmb.setFinishedInit(true);
+
+ jmb.startChimeraListener();
+ }
+
+ /**
+ * If the list is not empty, add menu items for 'All' and each individual
+ * chain to the "View | Show Chain" sub-menu. Multiple selections are allowed.
+ *
+ * @param chainNames
+ */
+ void setChainMenuItems(List<String> chainNames)
+ {
+ chainMenu.removeAll();
+ if (chainNames == null || chainNames.isEmpty())
+ {
+ return;
+ }
+ JMenuItem menuItem = new JMenuItem(
+ MessageManager.getString("label.all"));
+ menuItem.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ allChainsSelected = true;
+ for (int i = 0; i < chainMenu.getItemCount(); i++)
+ {
+ if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem)
+ {
+ ((JCheckBoxMenuItem) chainMenu.getItem(i)).setSelected(true);
+ }
+ }
+ showSelectedChains();
+ allChainsSelected = false;
+ }
+ });
+
+ chainMenu.add(menuItem);
+
+ for (String chainName : chainNames)
+ {
+ menuItem = new JCheckBoxMenuItem(chainName, true);
+ menuItem.addItemListener(new ItemListener()
+ {
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (!allChainsSelected)
+ {
+ showSelectedChains();
+ }
+ }
+ });
+
+ chainMenu.add(menuItem);
+ }
+ }
+
+ /**
+ * Show only the selected chain(s) in the viewer
+ */
+ void showSelectedChains()
+ {
+ List<String> toshow = new ArrayList<String>();
+ for (int i = 0; i < chainMenu.getItemCount(); i++)
+ {
+ if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem)
+ {
+ JCheckBoxMenuItem item = (JCheckBoxMenuItem) chainMenu.getItem(i);
+ if (item.isSelected())
+ {
+ toshow.add(item.getText());
+ }
+ }
+ }
+ jmb.showChains(toshow);
+ }
+
+ /**
+ * Close down this instance of Jalview's Chimera viewer, giving the user the
+ * option to close the associated Chimera window (process). They may wish to
+ * keep it open until they have had an opportunity to save any work.
+ *
+ * @param closeChimera
+ * if true, close any linked Chimera process; if false, prompt first
+ */
+ public void closeViewer(boolean closeChimera)
+ {
+ if (jmb != null && jmb.isChimeraRunning())
+ {
+ if (!closeChimera)
+ {
+ String prompt = MessageManager.formatMessage(
+ "label.confirm_close_chimera",
+ new Object[] { jmb.getViewerTitle("Chimera", false) });
+ prompt = JvSwingUtils.wrapTooltip(true, prompt);
+ int confirm = JOptionPane.showConfirmDialog(this, prompt,
+ MessageManager.getString("label.close_viewer"),
+ JOptionPane.YES_NO_OPTION);
+ closeChimera = confirm == JOptionPane.YES_OPTION;
+ }
+ jmb.closeViewer(closeChimera);
+ }
+ setAlignmentPanel(null);
+ _aps.clear();
+ _alignwith.clear();
+ _colourwith.clear();
+ // TODO: check for memory leaks where instance isn't finalised because jmb
+ // holds a reference to the window
+ jmb = null;
+ }
+
+ /**
+ * Open any newly added PDB structures in Chimera, having first fetched data
+ * from PDB (if not already saved).
+ */
+ public void run()
+ {
+ _started = true;
+ // todo - record which pdbids were successfully imported.
+ StringBuilder errormsgs = new StringBuilder(128);
+ StringBuilder files = new StringBuilder(128);
+ List<PDBEntry> filePDB = new ArrayList<PDBEntry>();
+ List<Integer> filePDBpos = new ArrayList<Integer>();
+ PDBEntry thePdbEntry = null;
+ try
+ {
+ String[] curfiles = jmb.getPdbFile(); // files currently in viewer
+ // TODO: replace with reference fetching/transfer code (validate PDBentry
+ // as a DBRef?)
+ for (int pi = 0; pi < jmb.getPdbCount(); pi++)
+ {
+ String file = null;
+ thePdbEntry = jmb.getPdbEntry(pi);
+ if (thePdbEntry.getFile() == null)
+ {
+ /*
+ * Retrieve PDB data, save to file, attach to PDBEntry
+ */
+ file = fetchPdbFile(thePdbEntry);
+ if (file == null)
+ {
+ errormsgs.append("'" + thePdbEntry.getId() + "' ");
+ }
+ }
+ else
+ {
+ /*
+ * Got file already - ignore if already loaded in Chimera.
+ */
+ file = new File(thePdbEntry.getFile()).getAbsoluteFile()
+ .getPath();
+ if (curfiles != null && curfiles.length > 0)
+ {
+ addingStructures = true; // already files loaded.
+ for (int c = 0; c < curfiles.length; c++)
+ {
+ if (curfiles[c].equals(file))
+ {
+ file = null;
+ break;
+ }
+ }
+ }
+ }
+ if (file != null)
+ {
+ filePDB.add(thePdbEntry);
+ filePDBpos.add(Integer.valueOf(pi));
+ files.append(" \"" + Platform.escapeString(file) + "\"");
+ }
+ }
+ } catch (OutOfMemoryError oomerror)
+ {
+ new OOMWarning("Retrieving PDB files: " + thePdbEntry.getId(),
+ oomerror);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ errormsgs.append("When retrieving pdbfiles for '"
+ + thePdbEntry.getId() + "'");
+ }
+ if (errormsgs.length() > 0)
+ {
+
+ JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage("label.pdb_entries_couldnt_be_retrieved",
+ new Object[] { errormsgs.toString() }),
+ MessageManager.getString("label.couldnt_load_file"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+
+ if (files.length() > 0)
+ {
+ if (!addingStructures)
+ {
+ try
+ {
+ initChimera();
+ } catch (Exception ex)
+ {
+ Cache.log.error("Couldn't open Chimera viewer!", ex);
+ }
+ }
+ int num = -1;
+ for (PDBEntry pe : filePDB)
+ {
+ num++;
+ if (pe.getFile() != null)
+ {
+ try
+ {
+ int pos = filePDBpos.get(num).intValue();
+ long startTime = startProgressBar("Chimera "
+ + MessageManager.getString("status.opening_file"));
+ jmb.openFile(pe);
+ jmb.addSequence(pos, jmb.getSequence()[pos]);
+ File fl = new File(pe.getFile());
+ String protocol = AppletFormatAdapter.URL;
+ try
+ {
+ if (fl.exists())
+ {
+ protocol = AppletFormatAdapter.FILE;
+ }
+ } catch (Throwable e)
+ {
+ } finally
+ {
+ stopProgressBar("", startTime);
+ }
+ // Explicitly map to the filename used by Chimera ;
+ jmb.getSsm().setMapping(jmb.getSequence()[pos],
+ jmb.getChains()[pos], pe.getFile(), protocol);
+ } catch (OutOfMemoryError oomerror)
+ {
+ new OOMWarning(
+ "When trying to open and map structures from Chimera!",
+ oomerror);
+ } catch (Exception ex)
+ {
+ Cache.log.error("Couldn't open " + pe.getFile()
+ + " in Chimera viewer!", ex);
+ } finally
+ {
+ Cache.log.debug("File locations are " + files);
+ }
+ }
+ }
+ jmb.setFinishedInit(true);
+ jmb.setLoadingFromArchive(false);
+
+ // refresh the sequence colours for the new structure(s)
+ for (AlignmentPanel ap : _colourwith)
+ {
+ jmb.updateColours(ap);
+ }
+ // do superposition if asked to
+ if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
+ {
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ alignStructs_withAllAlignPanels();
+ }
+ }).start();
+ alignAddedStructures = false;
+ }
+ addingStructures = false;
+ }
+ _started = false;
+ worker = null;
+ }
+
+ /**
+ * Fetch PDB data and save to a local file. Returns the full path to the file,
+ * or null if fetch fails.
+ *
+ * @param processingEntry
+ * @return
+ * @throws Exception
+ */
+ private String fetchPdbFile(PDBEntry processingEntry) throws Exception
+ {
+ String filePath = null;
+ Pdb pdbclient = new Pdb();
+ AlignmentI pdbseq = null;
+ String pdbid = processingEntry.getId();
+ long handle = System.currentTimeMillis()
+ + Thread.currentThread().hashCode();
+
+ /*
+ * Write 'fetching PDB' progress on AlignFrame as we are not yet visible
+ */
+ String msg = MessageManager.formatMessage("status.fetching_pdb",
+ new Object[] { pdbid });
+ getAlignmentPanel().alignFrame.setProgressBar(msg, handle);
+ // long hdl = startProgressBar(MessageManager.formatMessage(
+ // "status.fetching_pdb", new Object[]
+ // { pdbid }));
+ try
+ {
+ pdbseq = pdbclient.getSequenceRecords(pdbid);
+ } catch (OutOfMemoryError oomerror)
+ {
+ new OOMWarning("Retrieving PDB id " + pdbid, oomerror);
+ } finally
+ {
+ msg = pdbid + " " + MessageManager.getString("label.state_completed");
+ getAlignmentPanel().alignFrame.setProgressBar(msg, handle);
+ // stopProgressBar(msg, hdl);
+ }
+ /*
+ * If PDB data were saved and are not invalid (empty alignment), return the
+ * file path.
+ */
+ if (pdbseq != null && pdbseq.getHeight() > 0)
+ {
+ // just use the file name from the first sequence's first PDBEntry
+ filePath = new File(pdbseq.getSequenceAt(0).getAllPDBEntries()
+ .elementAt(0).getFile()).getAbsolutePath();
+ processingEntry.setFile(filePath);
+ }
+ return filePath;
+ }
+
+ /**
+ * Convenience method to update the progress bar if there is one. Be sure to
+ * call stopProgressBar with the returned handle to remove the message.
+ *
+ * @param msg
+ * @param handle
+ */
+ public long startProgressBar(String msg)
+ {
+ // TODO would rather have startProgress/stopProgress as the
+ // IProgressIndicator interface
+ long tm = random.nextLong();
+ if (progressBar != null)
+ {
+ progressBar.setProgressBar(msg, tm);
+ }
+ return tm;
+ }
+
+ /**
+ * End the progress bar with the specified handle, leaving a message (if not
+ * null) on the status bar
+ *
+ * @param msg
+ * @param handle
+ */
+ public void stopProgressBar(String msg, long handle)
+ {
+ if (progressBar != null)
+ {
+ progressBar.setProgressBar(msg, handle);
+ }
+ }
+
+ @Override
+ public void pdbFile_actionPerformed(ActionEvent actionEvent)
+ {
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle(MessageManager.getString("label.save_pdb_file"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
+
+ int value = chooser.showSaveDialog(this);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ BufferedReader in = null;
+ try
+ {
+ // TODO: cope with multiple PDB files in view
+ in = new BufferedReader(new FileReader(jmb.getPdbFile()[0]));
+ File outFile = chooser.getSelectedFile();
+
+ PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
+ String data;
+ while ((data = in.readLine()) != null)
+ {
+ if (!(data.indexOf("<PRE>") > -1 || data.indexOf("</PRE>") > -1))
+ {
+ out.println(data);
+ }
+ }
+ out.close();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } finally
+ {
+ if (in != null)
+ {
+ try
+ {
+ in.close();
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void viewMapping_actionPerformed(ActionEvent actionEvent)
+ {
+ jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer();
+ try
+ {
+ cap.appendText(jmb.printMappings());
+ } catch (OutOfMemoryError e)
+ {
+ new OOMWarning(
+ "composing sequence-structure alignments for display in text box.",
+ e);
+ cap.dispose();
+ return;
+ }
+ jalview.gui.Desktop.addInternalFrame(cap,
+ MessageManager.getString("label.pdb_sequence_mapping"), 550,
+ 600);
+ }
+
+ @Override
+ public void eps_actionPerformed(ActionEvent e)
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.eps_generation_not_implemented"));
+ }
+
+ @Override
+ public void png_actionPerformed(ActionEvent e)
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.png_generation_not_implemented"));
+ }
+
+ @Override
+ public void viewerColour_actionPerformed(ActionEvent actionEvent)
+ {
+ if (viewerColour.isSelected())
+ {
+ // disable automatic sequence colouring.
+ jmb.setColourBySequence(false);
+ }
+ }
+
+ @Override
+ public void seqColour_actionPerformed(ActionEvent actionEvent)
+ {
+ jmb.setColourBySequence(seqColour.isSelected());
+ if (_colourwith == null)
+ {
+ _colourwith = new Vector<AlignmentPanel>();
+ }
+ if (jmb.isColourBySequence())
+ {
+ if (!jmb.isLoadingFromArchive())
+ {
+ if (_colourwith.size() == 0 && getAlignmentPanel() != null)
+ {
+ // Make the currently displayed alignment panel the associated view
+ _colourwith.add(getAlignmentPanel().alignFrame.alignPanel);
+ }
+ }
+ // Set the colour using the current view for the associated alignframe
+ for (AlignmentPanel ap : _colourwith)
+ {
+ jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap);
+ }
+ }
+ }
+
+ @Override
+ public void chainColour_actionPerformed(ActionEvent actionEvent)
+ {
+ chainColour.setSelected(true);
+ jmb.colourByChain();
+ }
+
+ @Override
+ public void chargeColour_actionPerformed(ActionEvent actionEvent)
+ {
+ chargeColour.setSelected(true);
+ jmb.colourByCharge();
+ }
+
+ @Override
+ public void zappoColour_actionPerformed(ActionEvent actionEvent)
+ {
+ zappoColour.setSelected(true);
+ jmb.setJalviewColourScheme(new ZappoColourScheme());
+ }
+
+ @Override
+ public void taylorColour_actionPerformed(ActionEvent actionEvent)
+ {
+ taylorColour.setSelected(true);
+ jmb.setJalviewColourScheme(new TaylorColourScheme());
+ }
+
+ @Override
+ public void hydroColour_actionPerformed(ActionEvent actionEvent)
+ {
+ hydroColour.setSelected(true);
+ jmb.setJalviewColourScheme(new HydrophobicColourScheme());
+ }
+
+ @Override
+ public void helixColour_actionPerformed(ActionEvent actionEvent)
+ {
+ helixColour.setSelected(true);
+ jmb.setJalviewColourScheme(new HelixColourScheme());
+ }
+
+ @Override
+ public void strandColour_actionPerformed(ActionEvent actionEvent)
+ {
+ strandColour.setSelected(true);
+ jmb.setJalviewColourScheme(new StrandColourScheme());
+ }
+
+ @Override
+ public void turnColour_actionPerformed(ActionEvent actionEvent)
+ {
+ turnColour.setSelected(true);
+ jmb.setJalviewColourScheme(new TurnColourScheme());
+ }
+
+ @Override
+ public void buriedColour_actionPerformed(ActionEvent actionEvent)
+ {
+ buriedColour.setSelected(true);
+ jmb.setJalviewColourScheme(new BuriedColourScheme());
+ }
+
+ @Override
+ public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
+ {
+ setJalviewColourScheme(new PurinePyrimidineColourScheme());
+ }
+
+ @Override
+ public void userColour_actionPerformed(ActionEvent actionEvent)
+ {
+ userColour.setSelected(true);
+ new UserDefinedColours(this, null);
+ }
+
+ @Override
+ public void backGround_actionPerformed(ActionEvent actionEvent)
+ {
+ java.awt.Color col = JColorChooser
+ .showDialog(this, MessageManager
+ .getString("label.select_backgroud_colour"), null);
+ if (col != null)
+ {
+ jmb.setBackgroundColour(col);
+ }
+ }
+
+ @Override
+ public void showHelp_actionPerformed(ActionEvent actionEvent)
+ {
+ try
+ {
+ jalview.util.BrowserLauncher
+ .openURL("https://www.cgl.ucsf.edu/chimera/docs/UsersGuide");
+ } catch (Exception ex)
+ {
+ }
+ }
+
+ public void updateTitleAndMenus()
+ {
+ if (jmb.fileLoadingError != null && jmb.fileLoadingError.length() > 0)
+ {
+ repaint();
+ return;
+ }
+ setChainMenuItems(jmb.getChainNames());
+
+ this.setTitle(jmb.getViewerTitle("Chimera", true));
+ if (jmb.getPdbFile().length > 1 && jmb.getSequence().length > 1)
+ {
+ viewerActionMenu.setVisible(true);
+ }
+ if (!jmb.isLoadingFromArchive())
+ {
+ seqColour_actionPerformed(null);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GStructureViewer#alignStructs_actionPerformed(java.awt.event
+ * .ActionEvent)
+ */
+ @Override
+ protected void alignStructs_actionPerformed(ActionEvent actionEvent)
+ {
+ alignStructs_withAllAlignPanels();
+ }
+
+ private void alignStructs_withAllAlignPanels()
+ {
+ if (getAlignmentPanel() == null)
+ {
+ return;
+ }
+
+ if (_alignwith.size() == 0)
+ {
+ _alignwith.add(getAlignmentPanel());
+ }
+
+ try
+ {
+ AlignmentI[] als = new Alignment[_alignwith.size()];
+ ColumnSelection[] alc = new ColumnSelection[_alignwith.size()];
+ int[] alm = new int[_alignwith.size()];
+ int a = 0;
+
+ for (AlignmentPanel ap : _alignwith)
+ {
+ als[a] = ap.av.getAlignment();
+ alm[a] = -1;
+ alc[a++] = ap.av.getColumnSelection();
+ }
+ jmb.superposeStructures(als, alm, alc);
+ } catch (Exception e)
+ {
+ StringBuffer sp = new StringBuffer();
+ for (AlignmentPanel ap : _alignwith)
+ {
+ sp.append("'" + ap.alignFrame.getTitle() + "' ");
+ }
+ Cache.log.info("Couldn't align structures with the " + sp.toString()
+ + "associated alignment panels.", e);
+ }
+ }
+
+ public void setJalviewColourScheme(ColourSchemeI ucs)
+ {
+ jmb.setJalviewColourScheme(ucs);
+
+ }
+
+ /**
+ *
+ * @param alignment
+ * @return first alignment panel displaying given alignment, or the default
+ * alignment panel
+ */
+ public AlignmentPanel getAlignmentPanelFor(AlignmentI alignment)
+ {
+ for (AlignmentPanel ap : getAllAlignmentPanels())
+ {
+ if (ap.av.getAlignment() == alignment)
+ {
+ return ap;
+ }
+ }
+ return getAlignmentPanel();
+ }
+
+ @Override
+ public AAStructureBindingModel getBinding()
+ {
+ return jmb;
+ }
+
+ /**
+ * Ask Chimera to save its session to the designated file path, or to a
+ * temporary file if the path is null. Returns the file path if successful,
+ * else null.
+ *
+ * @param filepath
+ * @see getStateInfo
+ */
+ protected String saveSession(String filepath)
+ {
+ String pathUsed = filepath;
+ try
+ {
+ if (pathUsed == null)
+ {
+ File tempFile = File.createTempFile("chimera", ".py");
+ tempFile.deleteOnExit();
+ pathUsed = tempFile.getPath();
+ }
+ boolean result = jmb.saveSession(pathUsed);
+ if (result)
+ {
+ this.chimeraSessionFile = pathUsed;
+ return pathUsed;
+ }
+ } catch (IOException e)
+ {
+ }
+ return null;
+ }
+
+ /**
+ * Returns a string representing the state of the Chimera session. This is
+ * done by requesting Chimera to save its session to a temporary file, then
+ * reading the file contents. Returns an empty string on any error.
+ */
+ @Override
+ public String getStateInfo()
+ {
+ String sessionFile = saveSession(null);
+ if (sessionFile == null)
+ {
+ return "";
+ }
+ InputStream is = null;
+ try
+ {
+ File f = new File(sessionFile);
+ byte[] bytes = new byte[(int) f.length()];
+ is = new FileInputStream(sessionFile);
+ is.read(bytes);
+ return new String(bytes);
+ } catch (IOException e)
+ {
+ return "";
+ } finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ } catch (IOException e)
+ {
+ // ignore
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void fitToWindow_actionPerformed()
+ {
+ jmb.focusView();
+ }
+
+ @Override
+ public ViewerType getViewerType()
+ {
+ return ViewerType.CHIMERA;
+ }
+
+ @Override
+ protected AAStructureBindingModel getBindingModel()
+ {
+ return jmb;
+ }
+}
diff --git a/src/jalview/gui/ConservationThread.java b/src/jalview/gui/ConservationThread.java
deleted file mode 100644
index 8f4a6a6..0000000
--- a/src/jalview/gui/ConservationThread.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.gui;
-
-import jalview.analysis.Conservation;
-import jalview.datamodel.Annotation;
-
-import java.awt.Color;
-
-class ConservationThread extends Thread
-{
- /**
- *
- */
- private AlignViewport alignViewport;
-
- AlignmentPanel ap;
-
- public ConservationThread(AlignViewport alignViewport, AlignmentPanel ap)
- {
- this.alignViewport = alignViewport;
- this.ap = ap;
- }
-
- public void run()
- {
- try
- {
- this.alignViewport.updatingConservation = true;
-
- while (AlignViewport.UPDATING_CONSERVATION)
- {
- try
- {
- if (ap != null)
- {
- ap.paintAlignment(false);
- }
- Thread.sleep(200);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- AlignViewport.UPDATING_CONSERVATION = true;
-
- int alWidth;
-
- if (alignViewport==null || alignViewport.alignment==null || (alWidth=alignViewport.alignment.getWidth())< 0)
- {
- this.alignViewport.updatingConservation = false;
- AlignViewport.UPDATING_CONSERVATION = false;
- return;
- }
-
- Conservation cons = new jalview.analysis.Conservation("All",
- jalview.schemes.ResidueProperties.propHash, 3,
- this.alignViewport.alignment.getSequences(), 0, alWidth - 1);
-
- cons.calculate();
- cons.verdict(false, this.alignViewport.ConsPercGaps);
-
- if (this.alignViewport.quality != null)
- {
- cons.findQuality();
- }
- cons.completeAnnotations(alignViewport.conservation,
- alignViewport.quality, 0, alWidth);
- } catch (OutOfMemoryError error)
- {
- new OOMWarning("calculating conservation", error);
-
- this.alignViewport.conservation = null;
- this.alignViewport.quality = null;
-
- }
-
- AlignViewport.UPDATING_CONSERVATION = false;
- this.alignViewport.updatingConservation = false;
-
- if (ap != null)
- {
- ap.paintAlignment(true);
- }
-
- }
-}
diff --git a/src/jalview/gui/Console.java b/src/jalview/gui/Console.java
index b4917ca..4118f91 100644
--- a/src/jalview/gui/Console.java
+++ b/src/jalview/gui/Console.java
@@ -1,26 +1,46 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.io.*;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GraphicsEnvironment;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.io.IOException;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.PrintStream;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
import org.apache.log4j.SimpleLayout;
@@ -91,7 +111,7 @@ public class Console extends WindowAdapter implements WindowListener,
// textArea = cpt.getTextArea();
textArea = new JTextArea();
textArea.setEditable(false);
- JButton button = new JButton("clear");
+ JButton button = new JButton(MessageManager.getString("action.clear"));
// frame = cpt;
frame.getContentPane().setLayout(new BorderLayout());
@@ -497,7 +517,7 @@ public class Console extends WindowAdapter implements WindowListener,
{
}
throw new NullPointerException(
- "Application test: throwing an NullPointerException It should arrive at the console");
+ MessageManager.getString("exception.application_test_npe"));
}
}
diff --git a/src/jalview/gui/CutAndPasteHtmlTransfer.java b/src/jalview/gui/CutAndPasteHtmlTransfer.java
new file mode 100644
index 0000000..7fded36
--- /dev/null
+++ b/src/jalview/gui/CutAndPasteHtmlTransfer.java
@@ -0,0 +1,244 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.jbgui.GCutAndPasteHtmlTransfer;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.io.StringWriter;
+
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkEvent.EventType;
+import javax.swing.event.HyperlinkListener;
+
+/**
+ * Cut'n'paste files into the desktop See JAL-1105
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class CutAndPasteHtmlTransfer extends GCutAndPasteHtmlTransfer
+{
+
+ AlignmentViewport viewport;
+
+ public CutAndPasteHtmlTransfer()
+ {
+ super();
+ displaySource.setSelected(false);
+ textarea.addKeyListener(new KeyListener()
+ {
+
+ @Override
+ public void keyTyped(KeyEvent arg0)
+ {
+ // if (arg0.isControlDown() && arg0.getKeyCode()==KeyEvent.VK_C)
+ // {
+ // copyItem_actionPerformed(null);
+ // }
+ arg0.consume();
+ }
+
+ @Override
+ public void keyReleased(KeyEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void keyPressed(KeyEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ textarea.setEditable(false);
+ textarea.addHyperlinkListener(new HyperlinkListener()
+ {
+
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent e)
+ {
+ if (e.getEventType().equals(EventType.ACTIVATED))
+ {
+ Desktop.showUrl(e.getURL().toExternalForm());
+ }
+ }
+ });
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ textarea.requestFocus();
+ }
+ });
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void setForInput(AlignmentViewport viewport)
+ {
+ this.viewport = viewport;
+ if (viewport != null)
+ {
+ ok.setText(MessageManager.getString("action.add"));
+ }
+
+ getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String getText()
+ {
+ return textarea.getText();
+ }
+
+ /**
+ * Set contents of HTML Display pane
+ *
+ * @param text
+ * HTML text
+ */
+ public void setText(String text)
+ {
+ textarea.setText(text);
+ }
+
+ public void save_actionPerformed(ActionEvent e)
+ {
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+
+ chooser.setAcceptAllFileFilterUsed(false);
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle(MessageManager
+ .getString("label.save_text_to_file"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
+
+ int value = chooser.showSaveDialog(this);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ try
+ {
+ java.io.PrintWriter out = new java.io.PrintWriter(
+ new java.io.FileWriter(chooser.getSelectedFile()));
+
+ out.print(getText());
+ out.close();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+ }
+
+ public void toggleHtml_actionPerformed(ActionEvent e)
+ {
+ String txt = textarea.getText();
+ textarea.setContentType(displaySource.isSelected() ? "text/text"
+ : "text/html");
+ textarea.setText(txt);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ public void copyItem_actionPerformed(ActionEvent e)
+ {
+ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
+ StringWriter sw = new StringWriter();
+ try
+ {
+ textarea.getEditorKit().write(sw, textarea.getDocument(),
+ textarea.getSelectionStart(),
+ textarea.getSelectionEnd() - textarea.getSelectionStart());
+ } catch (Exception x)
+ {
+ }
+ ;
+ StringSelection ssel = new StringSelection(sw.getBuffer().toString());
+ c.setContents(ssel, ssel);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ this.setClosed(true);
+ } catch (Exception ex)
+ {
+ }
+ }
+
+ public void textarea_mousePressed(MouseEvent e)
+ {
+ if (SwingUtilities.isRightMouseButton(e))
+ {
+ JPopupMenu popup = new JPopupMenu(
+ MessageManager.getString("action.edit"));
+ JMenuItem item = new JMenuItem(
+ MessageManager.getString("action.copy"));
+ item.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ copyItem_actionPerformed(e);
+ }
+ });
+ popup.add(item);
+ popup.show(this, e.getX() + 10, e.getY() + textarea.getY() + 40);
+
+ }
+ }
+
+}
diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java
index 18dffd6..9c5651a 100644
--- a/src/jalview/gui/CutAndPasteTransfer.java
+++ b/src/jalview/gui/CutAndPasteTransfer.java
@@ -1,33 +1,59 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.datatransfer.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.ComplexAlignFile;
+import jalview.api.FeaturesDisplayedI;
+import jalview.bin.Jalview;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.FileParse;
+import jalview.io.FormatAdapter;
+import jalview.io.IdentifyFile;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.jbgui.GCutAndPasteTransfer;
+import jalview.schemes.ColourSchemeI;
+import jalview.util.MessageManager;
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.jbgui.*;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
/**
- * DOCUMENT ME!
+ * Cut'n'paste files into the desktop See JAL-1105
*
* @author $author$
* @version $Revision$
@@ -35,7 +61,11 @@ import jalview.jbgui.*;
public class CutAndPasteTransfer extends GCutAndPasteTransfer
{
- AlignViewport viewport;
+ AlignmentViewPanel alignpanel;
+
+ AlignViewportI viewport;
+
+ FileParse source = null;
public CutAndPasteTransfer()
{
@@ -52,12 +82,16 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
/**
* DOCUMENT ME!
*/
- public void setForInput(AlignViewport viewport)
+ public void setForInput(AlignmentViewPanel viewpanel)
{
- this.viewport = viewport;
+ this.alignpanel = viewpanel;
+ if (alignpanel != null)
+ {
+ this.viewport = alignpanel.getAlignViewport();
+ }
if (viewport != null)
{
- ok.setText("Add");
+ ok.setText(MessageManager.getString("action.add"));
}
getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH);
@@ -96,8 +130,9 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
chooser.setAcceptAllFileFilterUsed(false);
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save Text to File");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.save_text_to_file"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
@@ -164,43 +199,89 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
*/
public void ok_actionPerformed(ActionEvent e)
{
- String format = new IdentifyFile().Identify(getText(), "Paste");
+ String text = getText();
+ if (text.trim().length() < 1)
+ {
+ return;
+ }
+
+ String format = new IdentifyFile().Identify(text, "Paste");
+ if (format == null || format.equalsIgnoreCase("EMPTY DATA FILE"))
+ {
+ System.err.println(MessageManager
+ .getString("label.couldnt_read_data"));
+ if (!Jalview.isHeadlessMode())
+ {
+ javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ AppletFormatAdapter.SUPPORTED_FORMATS,
+ MessageManager.getString("label.couldnt_read_data"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+ return;
+ }
+
// TODO: identify feature, annotation or tree file and parse appropriately.
- Alignment al = null;
+ AlignmentI al = null;
if (FormatAdapter.isValidFormat(format))
{
try
{
- al = new FormatAdapter().readFile(getText(), "Paste", format);
+ FormatAdapter fa = new FormatAdapter(alignpanel);
+ al = fa.readFile(getText(), "Paste", format);
+ source = fa.getAlignFile();
+
} catch (java.io.IOException ex)
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Couldn't read the pasted text.\n" + ex.toString(),
- "Error parsing text", JOptionPane.WARNING_MESSAGE);
+ MessageManager.formatMessage(
+ "label.couldnt_read_pasted_text",
+ new String[] { ex.toString() }), MessageManager
+ .getString("label.error_parsing_text"),
+ JOptionPane.WARNING_MESSAGE);
}
}
- if (al != null)
+ if (al != null && al.hasValidSequence())
{
+ String title = MessageManager.formatMessage(
+ "label.input_cut_paste_params", new String[] { format });
if (viewport != null)
{
- for (int i = 0; i < al.getHeight(); i++)
- {
- viewport.getAlignment().addSequence(al.getSequenceAt(i));
- }
-
- viewport.firePropertyChange("alignment", null, viewport
- .getAlignment().getSequences());
+ ((AlignViewport) viewport).addAlignment(al, title);
}
else
{
- AlignFrame af = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
+
+ AlignFrame af;
+ if (source instanceof ComplexAlignFile)
+ {
+ ColumnSelection colSel = ((ComplexAlignFile) source)
+ .getColumnSelection();
+ SequenceI[] hiddenSeqs = ((ComplexAlignFile) source)
+ .getHiddenSequences();
+ boolean showSeqFeatures = ((ComplexAlignFile) source)
+ .isShowSeqFeatures();
+ ColourSchemeI cs = ((ComplexAlignFile) source).getColourScheme();
+ FeaturesDisplayedI fd = ((ComplexAlignFile) source)
+ .getDisplayedFeatures();
+ af = new AlignFrame(al, hiddenSeqs, colSel,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ af.getViewport().setShowSequenceFeatures(showSeqFeatures);
+ af.getViewport().setFeaturesDisplayed(fd);
+ af.changeColour(cs);
+ }
+ else
+ {
+ af = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+ }
+
af.currentFileFormat = format;
- Desktop.addInternalFrame(af, "Cut & Paste input - " + format,
- AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
- af.statusBar.setText("Successfully pasted alignment file");
+ Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+ af.statusBar.setText(MessageManager
+ .getString("label.successfully_pasted_alignment_file"));
try
{
@@ -211,6 +292,18 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
}
}
}
+ else
+ {
+ System.err.println(MessageManager
+ .getString("label.couldnt_read_data"));
+ if (!Jalview.isHeadlessMode())
+ {
+ javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ AppletFormatAdapter.SUPPORTED_FORMATS,
+ MessageManager.getString("label.couldnt_read_data"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+ }
}
/**
@@ -233,8 +326,10 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
{
if (SwingUtilities.isRightMouseButton(e))
{
- JPopupMenu popup = new JPopupMenu("Edit");
- JMenuItem item = new JMenuItem("Copy");
+ JPopupMenu popup = new JPopupMenu(
+ MessageManager.getString("action.edit"));
+ JMenuItem item = new JMenuItem(
+ MessageManager.getString("action.copy"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -243,7 +338,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
}
});
popup.add(item);
- item = new JMenuItem("Paste");
+ item = new JMenuItem(MessageManager.getString("action.paste"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java
index c623530..c0fefd1 100644
--- a/src/jalview/gui/DasSourceBrowser.java
+++ b/src/jalview/gui/DasSourceBrowser.java
@@ -1,962 +1,844 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.gui;
-
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.table.*;
-
-import org.biojava.dasobert.dasregistry.*;
-import jalview.jbgui.*;
-import jalview.util.*;
-
-public class DasSourceBrowser extends GDasSourceBrowser implements
- Runnable, ListSelectionListener
-{
- static DasSource[] dasSources = null;
-
- Hashtable localSources = null;
-
- Vector selectedSources;
-
- public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das1/sources/";
-
- /**
- * true if thread is running and we are talking to DAS registry service
- */
- public boolean loadingDasSources = false;
-
- protected static String getDasRegistryURL()
- {
- String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
- DEFAULT_REGISTRY);
-
- if (registry.indexOf("/registry/das1/sources/") > -1)
- {
- jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
- DEFAULT_REGISTRY);
- registry = DEFAULT_REGISTRY;
- }
- return registry;
- }
-
- public DasSourceBrowser(FeatureSettings featureSettings)
- {
- fs = featureSettings;
- String registry = getDasRegistryURL();
-
- registryURL.setText(registry);
-
- setSelectedFromProperties();
-
- displayFullDetails(null);
- table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- filter1.addListSelectionListener(this);
- filter2.addListSelectionListener(this);
- filter3.addListSelectionListener(this);
-
- // Ask to be notified of selection changes.
- ListSelectionModel rowSM = table.getSelectionModel();
- rowSM.addListSelectionListener(new ListSelectionListener()
- {
- public void valueChanged(ListSelectionEvent e)
- {
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (!lsm.isSelectionEmpty())
- {
- int selectedRow = lsm.getMinSelectionIndex();
- displayFullDetails(table.getValueAt(selectedRow, 0).toString());
- }
- }
- });
-
- table.addMouseListener(new MouseAdapter()
- {
- public void mouseClicked(MouseEvent evt)
- {
- if (evt.getClickCount() == 2
- || SwingUtilities.isRightMouseButton(evt))
- {
- editRemoveLocalSource(evt);
- }
- }
- });
-
- if (dasSources != null)
- {
- init();
- }
- }
-
- FeatureSettings fs = null;
-
- public DasSourceBrowser()
- {
- this(null);
- }
-
- public void paintComponent(java.awt.Graphics g)
- {
- if (dasSources == null && !loadingDasSources)
- {
- Thread worker = new Thread(this);
- worker.start();
- }
- }
-
- void init()
- {
- int dSize = dasSources.length;
- Object[][] data = new Object[dSize][2];
- for (int i = 0; i < dSize; i++)
- {
- data[i][0] = dasSources[i].getNickname();
- data[i][1] = new Boolean(selectedSources.contains(dasSources[i]
- .getNickname()));
- }
-
- refreshTableData(data);
- setCapabilities(dasSources);
-
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- TableSorter sorter = (TableSorter) table.getModel();
- sorter.setSortingStatus(1, TableSorter.DESCENDING);
- sorter.setSortingStatus(1, TableSorter.NOT_SORTED);
- }
- });
-
- progressBar.setIndeterminate(false);
- progressBar.setVisible(false);
- addLocal.setVisible(true);
- refresh.setVisible(true);
- }
-
- public void refreshTableData(Object[][] data)
- {
- TableSorter sorter = new TableSorter(new DASTableModel(data));
- sorter.setTableHeader(table.getTableHeader());
- table.setModel(sorter);
- }
-
- void displayFullDetails(String nickName)
- {
-
- StringBuffer text = new StringBuffer(
- "<HTML><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");
-
- if (nickName == null)
- {
- fullDetails.setText(text + "Select a DAS service from the table"
- + " to read a full description here.</font></html>");
- return;
- }
-
- int dSize = dasSources.length;
- for (int i = 0; i < dSize; i++)
- {
- if (!dasSources[i].getNickname().equals(nickName))
- {
- continue;
- }
-
- DasSource ds = dasSources[i];
-
- text.append("<font color=\"#0000FF\">Id:</font> "
- + dasSources[i].getId() + "<br>");
- text.append("<font color=\"#0000FF\">Nickname:</font> "
- + dasSources[i].getNickname() + "<br>");
- text.append("<font color=\"#0000FF\">URL:</font> "
- + dasSources[i].getUrl() + "<br>");
-
- text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"
- + dasSources[i].getAdminemail()
- + "\">"
- + dasSources[i].getAdminemail() + "</a>" + "<br>");
-
- text.append("<font color=\"#0000FF\">Registered at:</font> "
- + dasSources[i].getRegisterDate() + "<br>");
-
- text.append("<font color=\"#0000FF\">Last successful test:</font> "
- + dasSources[i].getLeaseDate() + "<br>");
-
- text.append("<font color=\"#0000FF\">Labels:</font> ");
- for (int s = 0; s < dasSources[i].getLabels().length; s++)
- {
- text.append(dasSources[i].getLabels()[s]);
- if (s < dasSources[i].getLabels().length - 1)
- {
- text.append(",");
- }
- text.append(" ");
- }
- text.append("<br>");
-
- text.append("<font color=\"#0000FF\">Capabilities:</font> ");
- String[] scap = dasSources[i].getCapabilities();
- for (int j = 0; j < scap.length; j++)
- {
- text.append(scap[j]);
- if (j < scap.length - 1)
- {
- text.append(", ");
- }
- }
- text.append("<br>");
-
- text.append("<font color=\"#0000FF\">Coordinates:</font> ");
- DasCoordinateSystem[] dcs = ds.getCoordinateSystem();
- for (int j = 0; j < dcs.length; j++)
- {
- text.append("(" + dcs[j].getUniqueId() + ") "
- + dcs[j].getCategory() + ", " + dcs[j].getName());
- if (dcs[j].getNCBITaxId() != 0)
- {
- text.append(", " + dcs[j].getNCBITaxId());
- }
- if (dcs[j].getOrganismName().length() > 0)
- {
- text.append(", " + dcs[j].getOrganismName());
- }
-
- text.append("<br>");
- }
-
- text.append("<font color=\"#0000FF\">Description:</font> "
- + dasSources[i].getDescription() + "<br>");
-
- if (dasSources[i].getHelperurl() != null
- && dasSources[i].getHelperurl().length() > 0)
- {
- text.append("<font color=\"#0000FF\"><a href=\""
- + dasSources[i].getHelperurl()
- + "\">Go to site</a></font<br>");
- }
-
- text.append("</font></html>");
-
- break;
- }
-
- fullDetails.setText(text.toString());
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- fullDetailsScrollpane.getVerticalScrollBar().setValue(0);
- }
- });
- }
-
- public void run()
- {
- loadingDasSources = true;
-
- addLocal.setVisible(false);
- refresh.setVisible(false);
- progressBar.setVisible(true);
- progressBar.setIndeterminate(true);
- setParentGuiEnabled(false);
- // Refresh the source list.
- dasSources = null;
- getDASSource();
-
- init();
-
- setParentGuiEnabled(true);
- loadingDasSources = false;
-
- }
-
- private void setParentGuiEnabled(boolean b)
- {
- if (fs != null)
- {
- fs.fetchDAS.setEnabled(b);
- fs.saveDAS.setEnabled(b);
- }
- }
-
- public Vector getSelectedSources()
- {
- // wait around if we're still loading.
- while (dasSources == null)
- {
- if (!loadingDasSources)
- {
- new Thread(this).start();
- try
- {
- Thread.sleep(5);
- } catch (Exception e)
- {
- }
- ;
- while (loadingDasSources)
- {
- try
- {
- Thread.sleep(5);
- } catch (Exception e)
- {
- }
- ;
- }
- ;
- }
- }
-
- Vector selected = new Vector();
- for (int r = 0; r < selectedSources.size(); r++)
- {
- for (int i = 0; i < dasSources.length; i++)
- {
- if (dasSources[i].getNickname()
- .equals(selectedSources.elementAt(r)))
- {
- selected.addElement(dasSources[i]);
- break;
- }
- }
- }
-
- return selected;
- }
-
- /**
- * retrieve das sources from registry and add local source list
- *
- * @return
- */
- public DasSource[] getDASSource()
- {
- if (dasSources == null)
- {
- dasSources = jalview.ws.DasSequenceFeatureFetcher.getDASSources();
- appendLocalSources();
- }
-
- return dasSources;
- }
-
- public void refresh_actionPerformed(ActionEvent e)
- {
- saveProperties(jalview.bin.Cache.applicationProperties);
-
- Thread worker = new Thread(this);
- worker.start();
- }
-
- private void setCapabilities(DasSource[] sources)
- {
- Vector authority = new Vector();
- Vector type = new Vector();
- Vector label = new Vector();
-
- authority.addElement("Any");
- type.addElement("Any");
- label.addElement("Any");
-
- for (int i = 0; i < sources.length; i++)
- {
- DasSource ds = sources[i];
-
- DasCoordinateSystem[] dcs = ds.getCoordinateSystem();
-
- for (int j = 0; j < dcs.length; j++)
- {
- if (!type.contains(dcs[j].getCategory()))
- {
- type.addElement(dcs[j].getCategory());
- }
-
- if (!authority.contains(dcs[j].getName()))
- {
- authority.addElement(dcs[j].getName());
- }
- }
-
- String[] slabels = ds.getLabels();
- for (int s = 0; s < slabels.length; s++)
- {
- if (!label.contains(slabels[s]))
- {
- label.addElement(slabels[s]);
- }
- }
-
- }
-
- filter1.setListData(authority);
- filter2.setListData(type);
- filter3.setListData(label);
-
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- filter1.setSelectedIndex(0);
- filter2.setSelectedIndex(0);
- filter3.setSelectedIndex(0);
- }
- });
- }
-
- public void amendLocal(boolean newSource)
- {
- String url = "http://localhost:8080/", nickname = "";
- boolean seqsrc = false;
- if (!newSource)
- {
- int selectedRow = table.getSelectionModel().getMinSelectionIndex();
- nickname = table.getValueAt(selectedRow, 0).toString();
- url = ((DasSource) localSources.get(nickname)).getUrl();
- seqsrc = ((DasSource) localSources.get(nickname))
- .hasCapability("sequence");
- }
-
- JTextField nametf = new JTextField(nickname, 40);
- JTextField urltf = new JTextField(url, 40);
- JCheckBox seqs = new JCheckBox("Sequence Source");
- seqs.setSelected(seqsrc);
- JPanel panel = new JPanel(new BorderLayout());
- JPanel pane12 = new JPanel(new BorderLayout());
- pane12.add(new JLabel("Nickname: "), BorderLayout.CENTER);
- pane12.add(nametf, BorderLayout.EAST);
- panel.add(pane12, BorderLayout.NORTH);
- pane12 = new JPanel(new BorderLayout());
- pane12.add(new JLabel("URL: "), BorderLayout.NORTH);
- pane12.add(seqs, BorderLayout.SOUTH);
- pane12.add(urltf, BorderLayout.EAST);
- panel.add(pane12, BorderLayout.SOUTH);
-
- int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- panel, "Enter Nickname & URL of Local DAS Source",
- JOptionPane.OK_CANCEL_OPTION);
-
- if (reply != JOptionPane.OK_OPTION)
- {
- return;
- }
-
- if (!urltf.getText().endsWith("/"))
- {
- urltf.setText(urltf.getText() + "/");
- }
-
- Das1Source local = new Das1Source();
-
- local.setUrl(urltf.getText());
- local.setNickname(nametf.getText());
- if (seqs.isSelected())
- {
- local.setCapabilities(new String[]
- { "features", "sequence" });
- }
- if (localSources == null)
- {
- localSources = new Hashtable();
- }
-
- localSources.put(local.getNickname(), local);
-
- if (!newSource && !nickname.equals(nametf.getText()))
- {
- localSources.remove(nickname);
- }
-
- int size = dasSources.length;
- int adjust = newSource ? 1 : 0;
-
- Object[][] data = new Object[size + adjust][2];
- for (int i = 0; i < size; i++)
- {
- if (!newSource && dasSources[i].getNickname().equals(nickname))
- {
- ((DasSource) dasSources[i]).setNickname(local.getNickname());
- ((DasSource) dasSources[i]).setUrl(local.getUrl());
- data[i][0] = local.getNickname();
- data[i][1] = new Boolean(true);
- }
- else
- {
- data[i][0] = dasSources[i].getNickname();
- data[i][1] = new Boolean(selectedSources.contains(dasSources[i]
- .getNickname()));
- }
- }
-
- if (newSource)
- {
- data[size][0] = local.getNickname();
- data[size][1] = new Boolean(true);
- selectedSources.add(local.getNickname());
- }
-
- DasSource[] tmp = new DasSource[size + adjust];
-
- System.arraycopy(dasSources, 0, tmp, 0, size);
-
- if (newSource)
- {
- tmp[size] = local;
- }
-
- dasSources = tmp;
-
- refreshTableData(data);
-
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- scrollPane.getVerticalScrollBar().setValue(
- scrollPane.getVerticalScrollBar().getMaximum());
- }
- });
-
- displayFullDetails(local.getNickname());
- }
-
- public void editRemoveLocalSource(MouseEvent evt)
- {
- int selectedRow = table.getSelectionModel().getMinSelectionIndex();
- if (selectedRow == -1)
- {
- return;
- }
-
- String nickname = table.getValueAt(selectedRow, 0).toString();
-
- if (!localSources.containsKey(nickname))
- {
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "You can only edit or remove local DAS Sources!",
- "Public DAS source - not editable",
- JOptionPane.WARNING_MESSAGE);
- return;
- }
-
- Object[] options =
- { "Edit", "Remove", "Cancel" };
- int choice = JOptionPane.showInternalOptionDialog(Desktop.desktop,
- "Do you want to edit or remove " + nickname + "?",
- "Edit / Remove Local DAS Source",
- JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
- null, options, options[2]);
-
- switch (choice)
- {
- case 0:
- amendLocal(false);
- break;
- case 1:
- localSources.remove(nickname);
- selectedSources.remove(nickname);
- Object[][] data = new Object[dasSources.length - 1][2];
- DasSource[] tmp = new DasSource[dasSources.length - 1];
- int index = 0;
- for (int i = 0; i < dasSources.length; i++)
- {
- if (dasSources[i].getNickname().equals(nickname))
- {
- continue;
- }
- else
- {
- tmp[index] = dasSources[i];
- data[index][0] = dasSources[i].getNickname();
- data[index][1] = new Boolean(
- selectedSources.contains(dasSources[i].getNickname()));
- index++;
- }
- }
- dasSources = tmp;
- refreshTableData(data);
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- scrollPane.getVerticalScrollBar().setValue(
- scrollPane.getVerticalScrollBar().getMaximum());
- }
- });
-
- break;
- }
- }
-
- void appendLocalSources()
- {
- if (localSources == null)
- {
- return;
- }
- // note - we add all das sources to list so they can be filtered for the
- // standard fetchDbRefs function
- int size = dasSources != null ? dasSources.length : 0;
- int lsize = localSources.size();
-
- Object[][] data = new Object[size + lsize][2];
- for (int i = 0; i < size; i++)
- {
- data[i][0] = dasSources[i].getNickname();
- data[i][1] = new Boolean(selectedSources.contains(dasSources[i]
- .getNickname()));
- }
-
- DasSource[] tmp = new DasSource[size + lsize];
- if (dasSources != null)
- {
- System.arraycopy(dasSources, 0, tmp, 0, size);
- }
-
- Enumeration en = localSources.keys();
- int index = size;
- while (en.hasMoreElements())
- {
- String key = en.nextElement().toString();
- data[index][0] = key;
- data[index][1] = new Boolean(false);
- tmp[index] = new Das1Source();
- tmp[index].setNickname(key);
- tmp[index].setUrl(((DasSource) localSources.get(key)).getUrl());
-
- index++;
- }
-
- dasSources = tmp;
-
- refreshTableData(data);
- }
-
- public void valueChanged(ListSelectionEvent evt)
- {
- // Called when the MainTable selection changes
- if (evt.getValueIsAdjusting())
- {
- return;
- }
-
- displayFullDetails(null);
-
- // Filter the displayed data sources
- int dSize = dasSources.length;
-
- ArrayList names = new ArrayList();
- ArrayList selected = new ArrayList();
- DasSource ds;
-
- // The features filter is not visible, but we must still
- // filter the das source list here.
- // July 2006 - only 6 sources fo not serve features
- Object[] dummyFeatureList = new Object[]
- { "features" };
-
- for (int i = 0; i < dSize; i++)
- {
- ds = dasSources[i];
- DasCoordinateSystem[] dcs = ds.getCoordinateSystem();
-
- if (dcs.length == 0 && ds.getCapabilities().length == 0
- && filter1.getSelectedIndex() == 0
- && filter2.getSelectedIndex() == 0
- && filter3.getSelectedIndex() == 0)
- {
- // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT
- // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT
- // IS ADDED FROM THE REGISTRY
- names.add(ds.getNickname());
- selected.add(new Boolean(selectedSources.contains(ds.getNickname())));
- continue;
- }
-
- if (!selectedInList(dummyFeatureList, ds.getCapabilities())
- || !selectedInList(filter3.getSelectedValues(),
- ds.getLabels()))
- {
- continue;
- }
-
- for (int j = 0; j < dcs.length; j++)
- {
- if (selectedInList(filter1.getSelectedValues(), new String[]
- { dcs[j].getName() })
- && selectedInList(filter2.getSelectedValues(), new String[]
- { dcs[j].getCategory() }))
- {
- names.add(ds.getNickname());
- selected.add(new Boolean(selectedSources.contains(ds
- .getNickname())));
- break;
- }
- }
- }
-
- dSize = names.size();
- Object[][] data = new Object[dSize][2];
- for (int d = 0; d < dSize; d++)
- {
- data[d][0] = names.get(d);
- data[d][1] = selected.get(d);
- }
-
- refreshTableData(data);
- }
-
- boolean selectedInList(Object[] selection, String[] items)
- {
- for (int i = 0; i < selection.length; i++)
- {
- if (selection[i].equals("Any"))
- {
- return true;
- }
-
- for (int j = 0; j < items.length; j++)
- {
- if (selection[i].equals(items[j]))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- void setSelectedFromProperties()
- {
- String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
- "uniprot");
- StringTokenizer st = new StringTokenizer(active, "\t");
- selectedSources = new Vector();
- while (st.hasMoreTokens())
- {
- selectedSources.addElement(st.nextToken());
- }
-
- Vector _localSources = jalview.bin.Cache.getLocalDasSources();
- if (_localSources != null)
- {
- if (localSources == null)
- {
- localSources = new Hashtable();
- }
- Enumeration sources = _localSources.elements();
- while (sources.hasMoreElements())
- {
- Das1Source source = (Das1Source) sources.nextElement();
- localSources.put(source.getNickname(), source);
- }
- }
- }
-
- public void reset_actionPerformed(ActionEvent e)
- {
- registryURL.setText(DEFAULT_REGISTRY);
- }
-
- /**
- * set the DAS source settings in the given jalview properties.
- *
- * @param properties
- */
- public void saveProperties(Properties properties)
- {
- if (registryURL.getText() == null || registryURL.getText().length() < 1)
- {
- properties.remove(jalview.bin.Cache.DAS_REGISTRY_URL);
- }
- else
- {
- properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
- registryURL.getText());
- }
-
- StringBuffer sb = new StringBuffer();
- for (int r = 0; r < table.getModel().getRowCount(); r++)
- {
- if (((Boolean) table.getValueAt(r, 1)).booleanValue())
- {
- sb.append(table.getValueAt(r, 0) + "\t");
- }
- }
-
- properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE,
- sb.toString());
-
- if (localSources != null)
- {
- sb = new StringBuffer();
- Enumeration en = localSources.keys();
- while (en.hasMoreElements())
- {
- String token = en.nextElement().toString();
- sb.append(token
- + "|"
- + (((DasSource) localSources.get(token))
- .hasCapability("sequence") ? "sequence:" : "")
- + ((DasSource) localSources.get(token)).getUrl() + "\t");
- }
-
- properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE,
- sb.toString());
- }
-
- }
-
- class DASTableModel extends AbstractTableModel
- {
-
- public DASTableModel(Object[][] data)
- {
- this.data = data;
- }
-
- private String[] columnNames = new String[]
- { "Nickname", "Use Source" };
-
- private Object[][] data;
-
- public int getColumnCount()
- {
- return columnNames.length;
- }
-
- public int getRowCount()
- {
- return data.length;
- }
-
- public String getColumnName(int col)
- {
- return columnNames[col];
- }
-
- public Object getValueAt(int row, int col)
- {
- return data[row][col];
- }
-
- /*
- * JTable uses this method to determine the default renderer/ editor for
- * each cell. If we didn't implement this method, then the last column would
- * contain text ("true"/"false"), rather than a check box.
- */
- public Class getColumnClass(int c)
- {
- return getValueAt(0, c).getClass();
- }
-
- /*
- * Don't need to implement this method unless your table's editable.
- */
- public boolean isCellEditable(int row, int col)
- {
- // Note that the data/cell address is constant,
- // no matter where the cell appears onscreen.
- return col == 1;
-
- }
-
- /*
- * Don't need to implement this method unless your table's data can change.
- */
- public void setValueAt(Object value, int row, int col)
- {
- data[row][col] = value;
- fireTableCellUpdated(row, col);
-
- String name = getValueAt(row, 0).toString();
- boolean selected = ((Boolean) value).booleanValue();
-
- if (selectedSources.contains(name) && !selected)
- {
- selectedSources.remove(name);
- }
-
- if (!selectedSources.contains(name) && selected)
- {
- selectedSources.add(name);
- }
- }
- }
-
- public void initDasSources()
- {
-
- Thread thr = new Thread(new Runnable()
- {
- public void run()
- {
- // this actually initialises the das source list
- paintComponent(null); // yuk
- }
- });
- thr.start();
- while (loadingDasSources || dasSources == null)
- {
- try
- {
- Thread.sleep(10);
- } catch (Exception e)
- {
- }
- ;
- }
- }
-
- public Vector resolveSourceNicknames(Vector sources)
- {
-
- Vector resolved = new Vector();
- if (sources != null)
- {
- for (int i = 0; i < dasSources.length; i++)
- {
- if (sources.contains(dasSources[i].getNickname()))
- {
- if (!resolved.contains(dasSources[i]))
- {
- resolved.addElement(dasSources[i]);
- }
- }
- }
- }
- return resolved;
- }
-
- /**
- * disable or enable the buttons on the source browser
- *
- * @param b
- */
- public void setGuiEnabled(boolean b)
- {
- refresh.setEnabled(b);
- addLocal.setEnabled(b);
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.jbgui.GDasSourceBrowser;
+import jalview.util.MessageManager;
+import jalview.util.TableSorter;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.AbstractTableModel;
+
+import org.biodas.jdas.schema.sources.CAPABILITY;
+import org.biodas.jdas.schema.sources.COORDINATES;
+import org.biodas.jdas.schema.sources.PROP;
+import org.biodas.jdas.schema.sources.VERSION;
+
+public class DasSourceBrowser extends GDasSourceBrowser implements
+ Runnable, ListSelectionListener
+{
+ DasSourceRegistryI sourceRegistry = null;
+
+ Vector<String> selectedSources;
+
+ public DasSourceBrowser(FeatureSettings featureSettings)
+ {
+ fs = featureSettings;
+ // TODO DasSourceRegistryProvider API
+ sourceRegistry = jalview.bin.Cache.getDasSourceRegistry();
+ String registry = sourceRegistry.getDasRegistryURL();
+
+ registryURL.setText(registry);
+
+ setSelectedFromProperties();
+
+ displayFullDetails(null);
+ table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
+ filter1.addListSelectionListener(this);
+ filter2.addListSelectionListener(this);
+ filter3.addListSelectionListener(this);
+
+ // Ask to be notified of selection changes.
+ ListSelectionModel rowSM = table.getSelectionModel();
+ rowSM.addListSelectionListener(new ListSelectionListener()
+ {
+ public void valueChanged(ListSelectionEvent e)
+ {
+ ListSelectionModel lsm = (ListSelectionModel) e.getSource();
+ if (!lsm.isSelectionEmpty())
+ {
+ int selectedRow = lsm.getMinSelectionIndex();
+ displayFullDetails(table.getValueAt(selectedRow, 0).toString());
+ }
+ }
+ });
+
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent evt)
+ {
+ if (evt.getClickCount() == 2
+ || SwingUtilities.isRightMouseButton(evt))
+ {
+ editRemoveLocalSource(evt);
+ }
+ }
+ });
+
+ if (sourceRegistry.getSources() != null)
+ {
+ init();
+ }
+ }
+
+ FeatureSettings fs = null;
+
+ private boolean loadingDasSources;
+
+ public DasSourceBrowser()
+ {
+ this(null);
+ }
+
+ public void paintComponent(java.awt.Graphics g)
+ {
+ if (sourceRegistry == null)
+ {
+ Thread worker = new Thread(this);
+ worker.start();
+ }
+ }
+
+ void init()
+ {
+ List<jalviewSourceI> sources = sourceRegistry.getSources();
+ int dSize = sources.size();
+ Object[][] data = new Object[dSize][2];
+ for (int i = 0; i < dSize; i++)
+ {
+ data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname
+ data[i][1] = new Boolean(selectedSources.contains(sources.get(i)
+ .getTitle()));
+ }
+
+ refreshTableData(data);
+ setCapabilities(sourceRegistry);
+
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ TableSorter sorter = (TableSorter) table.getModel();
+ sorter.setSortingStatus(1, TableSorter.DESCENDING);
+ sorter.setSortingStatus(1, TableSorter.NOT_SORTED);
+ }
+ });
+
+ progressBar.setIndeterminate(false);
+ progressBar.setVisible(false);
+ addLocal.setVisible(true);
+ refresh.setVisible(true);
+ }
+
+ public void refreshTableData(Object[][] data)
+ {
+ TableSorter sorter = new TableSorter(new DASTableModel(data));
+ sorter.setTableHeader(table.getTableHeader());
+ table.setModel(sorter);
+ }
+
+ void displayFullDetails(String nickName)
+ {
+
+ StringBuffer text = new StringBuffer(
+ "<HTML><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");
+
+ if (nickName == null)
+ {
+ fullDetails.setText(text
+ + MessageManager
+ .getString("label.select_das_service_from_table"));
+ return;
+ }
+
+ int dSize = sourceRegistry.getSources().size();
+ for (jalviewSourceI ds : sourceRegistry.getSources())
+ {
+ if (!ds.getTitle().equals(nickName))
+ {
+ continue;
+ }
+
+ VERSION latest = ds.getVersion();
+ text.append("<font color=\"#0000FF\">Id:</font> " + ds.getUri()
+ + "<br>");
+ text.append("<font color=\"#0000FF\">Nickname:</font> "
+ + ds.getTitle() + "<br>");
+
+ text.append("<font color=\"#0000FF\">URL:</font> <a href=\""
+ + ds.getSourceURL() + "\">" + ds.getSourceURL() + "</a>"
+ + "<br>");
+ if (!ds.isLocal())
+ {
+ if (ds.getDocHref() != null && ds.getDocHref().length() > 0)
+ {
+ text.append("<font color=\"#0000FF\">Site:</font> <a href=\""
+ + ds.getDocHref() + "\">" + ds.getDocHref() + "</a>"
+ + "<br>");
+ }
+
+ text.append("<font color=\"#0000FF\">Description:</font> "
+ + ds.getDescription() + "<br>");
+
+ text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"
+ + ds.getEmail() + "\">" + ds.getEmail() + "</a>" + "<br>");
+
+ text.append("<font color=\"#0000FF\">Registered at:</font> "
+ + latest.getCreated() + "<br>");
+
+ // TODO: Identify last successful test date
+ // text.append("<font color=\"#0000FF\">Last successful test:</font> "
+ // + latest.dasSources[i].getLeaseDate() + "<br>");
+ }
+ else
+ {
+ text.append("Source was added manually.<br/>");
+ }
+ text.append("<font color=\"#0000FF\">Labels:</font> ");
+ boolean b = false;
+ for (PROP labl : latest.getPROP())
+ {
+ if (labl.getName().equalsIgnoreCase("LABEL"))
+ {
+ if (b)
+ {
+ text.append(",");
+ }
+ text.append(" ");
+
+ text.append(labl.getValue());
+ b = true;
+ }
+ ;
+ }
+ text.append("<br>");
+
+ text.append("<font color=\"#0000FF\">Capabilities:</font> ");
+ CAPABILITY[] scap = latest.getCAPABILITY().toArray(new CAPABILITY[0]);
+ for (int j = 0; j < scap.length; j++)
+ {
+ text.append(scap[j].getType());
+ if (j < scap.length - 1)
+ {
+ text.append(", ");
+ }
+ }
+ text.append("<br>");
+
+ text.append("<font color=\"#0000FF\">Coordinates:</font>");
+ int i = 1;
+ for (COORDINATES dcs : latest.getCOORDINATES())
+ {
+ text.append("<br/>" + i++ + ". ");
+ text.append(dcs.getAuthority() + " : " + dcs.getSource());
+ if (dcs.getTaxid() != null && dcs.getTaxid().trim().length() > 0)
+ {
+ text.append(" [TaxId:" + dcs.getTaxid() + "]");
+ }
+ if (dcs.getVersion() != null
+ && dcs.getVersion().trim().length() > 0)
+ {
+ {
+ text.append(" {v. " + dcs.getVersion() + "}");
+ }
+ }
+ text.append(" (<a href=\"" + dcs.getUri() + "\">" + dcs.getUri()
+ + "</a>)");
+ }
+ text.append("</font></html>");
+
+ break;
+ }
+
+ fullDetails.setText(text.toString());
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ fullDetailsScrollpane.getVerticalScrollBar().setValue(0);
+ }
+ });
+ }
+
+ public void run()
+ {
+ loadingDasSources = true;
+
+ addLocal.setVisible(false);
+ refresh.setVisible(false);
+ progressBar.setVisible(true);
+ progressBar.setIndeterminate(true);
+ setParentGuiEnabled(false);
+ // Refresh the source list.
+ sourceRegistry.refreshSources();
+
+ init();
+
+ setParentGuiEnabled(true);
+ loadingDasSources = false;
+
+ }
+
+ private void setParentGuiEnabled(boolean b)
+ {
+ if (fs != null)
+ {
+ fs.fetchDAS.setEnabled(b);
+ fs.saveDAS.setEnabled(b);
+ }
+ }
+
+ public Vector<jalviewSourceI> getSelectedSources()
+ {
+ // wait around if we're still loading.
+ while (sourceRegistry == null)
+ {
+ if (!loadingDasSources)
+ {
+ new Thread(this).start();
+ try
+ {
+ Thread.sleep(5);
+ } catch (Exception e)
+ {
+ }
+ ;
+ while (loadingDasSources)
+ {
+ try
+ {
+ Thread.sleep(5);
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ ;
+ }
+ }
+
+ Vector<jalviewSourceI> selected = new Vector<jalviewSourceI>();
+ for (String source : selectedSources)
+ {
+ jalviewSourceI srce = sourceRegistry.getSource(source);
+ if (srce != null)
+ {
+ selected.addElement(srce);
+ }
+ }
+ return selected;
+ }
+
+ public void refresh_actionPerformed(ActionEvent e)
+ {
+ saveProperties(jalview.bin.Cache.applicationProperties);
+
+ Thread worker = new Thread(this);
+ worker.start();
+ }
+
+ private void setCapabilities(DasSourceRegistryI sourceRegistry2)
+ {
+ Vector<String> authority = new Vector<String>();
+ Vector<String> type = new Vector<String>();
+ Vector<String> label = new Vector<String>();
+ Vector<String> taxIds = new Vector<String>();
+ authority.add("Any");
+ type.add("Any");
+ label.add("Any");
+
+ for (jalviewSourceI ds : sourceRegistry2.getSources())
+ {
+ VERSION latest = ds.getVersion();
+
+ for (COORDINATES cs : latest.getCOORDINATES())
+ {
+ if (!type.contains(cs.getSource()))
+ {
+ type.add(cs.getSource()); // source==category
+ }
+
+ if (!authority.contains(cs.getAuthority()))
+ {
+ authority.add(cs.getAuthority());
+ }
+ }
+
+ for (PROP slabel : latest.getPROP())
+ {
+ if (slabel.getName().equalsIgnoreCase("LABEL")
+ && !label.contains(slabel.getValue()))
+ {
+ label.add(slabel.getValue());
+ }
+ }
+
+ }
+
+ filter1.setListData(authority);
+ filter2.setListData(type);
+ filter3.setListData(label);
+ // filter4 taxIds
+
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ filter1.setSelectedIndex(0);
+ filter2.setSelectedIndex(0);
+ filter3.setSelectedIndex(0);
+ }
+ });
+ }
+
+ public void amendLocal(boolean newSource)
+ {
+ String url = "http://localhost:8080/", nickname = "";
+ boolean seqsrc = false;
+ if (!newSource)
+ {
+ int selectedRow = table.getSelectionModel().getMinSelectionIndex();
+ nickname = table.getValueAt(selectedRow, 0).toString();
+ jalviewSourceI source = sourceRegistry.getSource(nickname);
+ url = source.getUri();
+ seqsrc = source.isSequenceSource();
+ }
+
+ JTextField nametf = new JTextField(nickname, 40);
+ JTextField urltf = new JTextField(url, 40);
+ JCheckBox seqs = new JCheckBox(
+ MessageManager.getString("label.sequence_source"));
+ seqs.setSelected(seqsrc);
+ JPanel panel = new JPanel(new BorderLayout());
+ JPanel pane12 = new JPanel(new BorderLayout());
+ pane12.add(new JLabel(MessageManager.getString("label.name")),
+ BorderLayout.CENTER);
+ pane12.add(nametf, BorderLayout.EAST);
+ panel.add(pane12, BorderLayout.NORTH);
+ pane12 = new JPanel(new BorderLayout());
+ pane12.add(new JLabel(MessageManager.getString("label.url")),
+ BorderLayout.NORTH);
+ pane12.add(seqs, BorderLayout.SOUTH);
+ pane12.add(urltf, BorderLayout.EAST);
+ panel.add(pane12, BorderLayout.SOUTH);
+
+ int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ panel,
+ MessageManager.getString("label.enter_local_das_source"),
+ JOptionPane.OK_CANCEL_OPTION);
+
+ if (reply != JOptionPane.OK_OPTION)
+ {
+ return;
+ }
+
+ if (!urltf.getText().endsWith("/"))
+ {
+ urltf.setText(urltf.getText() + "/");
+ }
+
+ jalviewSourceI local = sourceRegistry.createLocalSource(
+ urltf.getText(), nametf.getText(), seqs.isSelected(), true);
+ List sources = sourceRegistry.getSources();
+ int osize = sources.size();
+ int size = osize + (newSource ? 1 : 0);
+
+ Object[][] data = new Object[size][2];
+ DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table
+ .getModel()).getTableModel() : null;
+ for (int i = 0; i < osize; i++)
+ {
+ String osrc = (dtm == null || i >= osize) ? null : (String) dtm
+ .getValueAt(i, 0);
+ if (!newSource && osrc != null
+ && dtm.getValueAt(i, 0).equals(nickname))
+ {
+ data[i][0] = local.getTitle();
+ data[i][1] = new Boolean(true);
+ }
+ else
+ {
+ data[i][0] = osrc;
+ data[i][1] = new Boolean(selectedSources.contains(osrc));
+ }
+ }
+ // Always add a new source at the end
+ if (newSource)
+ {
+ data[osize][0] = local.getTitle();
+ data[osize][1] = new Boolean(true);
+ selectedSources.add(local.getTitle());
+ }
+
+ refreshTableData(data);
+
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ scrollPane.getVerticalScrollBar().setValue(
+ scrollPane.getVerticalScrollBar().getMaximum());
+ }
+ });
+
+ displayFullDetails(local.getTitle());
+ }
+
+ public void editRemoveLocalSource(MouseEvent evt)
+ {
+ int selectedRow = table.getSelectionModel().getMinSelectionIndex();
+ if (selectedRow == -1)
+ {
+ return;
+ }
+
+ String nickname = table.getValueAt(selectedRow, 0).toString();
+
+ if (!sourceRegistry.getSource(nickname).isLocal())
+ {
+ JOptionPane
+ .showInternalMessageDialog(
+ Desktop.desktop,
+ MessageManager
+ .getString("label.you_can_only_edit_or_remove_local_das_sources"),
+ MessageManager.getString("label.public_das_source"),
+ JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ Object[] options = { "Edit", "Remove", "Cancel" };
+ int choice = JOptionPane.showInternalOptionDialog(Desktop.desktop,
+ "Do you want to edit or remove " + nickname + "?",
+ "Edit / Remove Local DAS Source",
+ JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
+ null, options, options[2]);
+
+ switch (choice)
+ {
+ case 0:
+ amendLocal(false);
+ break;
+ case 1:
+ sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname));
+ selectedSources.remove(nickname);
+ Object[][] data = new Object[sourceRegistry.getSources().size()][2];
+ int index = 0,
+ l = table.getRowCount();
+
+ for (int i = 0; i < l; i++)
+ {
+ String nm;
+ if ((nm = (String) table.getValueAt(i, 0)).equals(nickname))
+ {
+ continue;
+ }
+ else
+ {
+ data[index][0] = nm;
+ data[index][1] = new Boolean(selectedSources.contains(nm));
+ index++;
+ }
+ }
+ refreshTableData(data);
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ scrollPane.getVerticalScrollBar().setValue(
+ scrollPane.getVerticalScrollBar().getMaximum());
+ }
+ });
+
+ break;
+ }
+ }
+
+ public void valueChanged(ListSelectionEvent evt)
+ {
+ // Called when the MainTable selection changes
+ if (evt.getValueIsAdjusting())
+ {
+ return;
+ }
+
+ displayFullDetails(null);
+
+ // Filter the displayed data sources
+
+ ArrayList names = new ArrayList();
+ ArrayList selected = new ArrayList();
+
+ // The features filter is not visible, but we must still
+ // filter the das source list here.
+ // July 2006 - only 6 sources fo not serve features
+ Object[] dummyFeatureList = new Object[] { "features" };
+ List<jalviewSourceI> srcs = sourceRegistry.getSources();
+ for (jalviewSourceI ds : srcs)
+ {
+
+ VERSION v = ds.getVersion();
+ List<COORDINATES> coords = v.getCOORDINATES();
+ if (ds.isLocal()
+ || ((coords == null || coords.size() == 0)
+ && filter1.getSelectedIndex() == 0
+ && filter2.getSelectedIndex() == 0 && filter3
+ .getSelectedIndex() == 0))
+ {
+ // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT
+ // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT
+ // IS ADDED FROM THE REGISTRY
+ names.add(ds.getTitle());
+ selected.add(new Boolean(selectedSources.contains(ds.getTitle())));
+ continue;
+ }
+
+ if (!selectedInList(dummyFeatureList, ds.getCapabilityList(v))
+ || !selectedInList(filter3.getSelectedValues(),
+ ds.getLabelsFor(v)))
+ {
+ continue;
+ }
+
+ for (int j = 0; j < coords.size(); j++)
+ {
+ if (selectedInList(filter1.getSelectedValues(),
+ new String[] { coords.get(j).getAuthority() })
+ && selectedInList(filter2.getSelectedValues(), new String[]
+ { coords.get(j).getSource() }))
+ {
+ names.add(ds.getTitle());
+ selected.add(new Boolean(selectedSources.contains(ds.getTitle())));
+ break;
+ }
+ }
+ }
+
+ int dSize = names.size();
+ Object[][] data = new Object[dSize][2];
+ for (int d = 0; d < dSize; d++)
+ {
+ data[d][0] = names.get(d);
+ data[d][1] = selected.get(d);
+ }
+
+ refreshTableData(data);
+ }
+
+ private boolean selectedInList(Object[] selection, String[] items)
+ {
+ for (int i = 0; i < selection.length; i++)
+ {
+ if (selection[i].equals("Any"))
+ {
+ return true;
+ }
+ if (items == null || items.length == 0)
+ {
+ return false;
+ }
+ String sel = (items[0].startsWith("das1:") ? "das1:" : "")
+ + selection[i];
+ for (int j = 0; j < items.length; j++)
+ {
+ if (sel.equals(items[j]))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ void setSelectedFromProperties()
+ {
+ String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
+ "uniprot");
+ StringTokenizer st = new StringTokenizer(active, "\t");
+ selectedSources = new Vector();
+ while (st.hasMoreTokens())
+ {
+ selectedSources.addElement(st.nextToken());
+ }
+ }
+
+ public void reset_actionPerformed(ActionEvent e)
+ {
+ registryURL.setText(sourceRegistry.getDasRegistryURL());
+ }
+
+ /**
+ * set the DAS source settings in the given jalview properties.
+ *
+ * @param properties
+ */
+ public void saveProperties(Properties properties)
+ {
+ if (registryURL.getText() == null || registryURL.getText().length() < 1)
+ {
+ properties.remove(jalview.bin.Cache.DAS_REGISTRY_URL);
+ }
+ else
+ {
+ properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
+ registryURL.getText());
+ }
+
+ StringBuffer sb = new StringBuffer();
+ for (int r = 0; r < table.getModel().getRowCount(); r++)
+ {
+ if (((Boolean) table.getValueAt(r, 1)).booleanValue())
+ {
+ sb.append(table.getValueAt(r, 0) + "\t");
+ }
+ }
+
+ properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE,
+ sb.toString());
+
+ String sourceprop = sourceRegistry.getLocalSourceString();
+ properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sourceprop);
+ }
+
+ class DASTableModel extends AbstractTableModel
+ {
+
+ public DASTableModel(Object[][] data)
+ {
+ this.data = data;
+ }
+
+ private String[] columnNames = new String[] {
+ MessageManager.getString("label.nickname"),
+ MessageManager.getString("label.use_source") };
+
+ private Object[][] data;
+
+ public int getColumnCount()
+ {
+ return columnNames.length;
+ }
+
+ public int getRowCount()
+ {
+ return data.length;
+ }
+
+ public String getColumnName(int col)
+ {
+ return columnNames[col];
+ }
+
+ public Object getValueAt(int row, int col)
+ {
+ return data[row][col];
+ }
+
+ /*
+ * JTable uses this method to determine the default renderer/ editor for
+ * each cell. If we didn't implement this method, then the last column would
+ * contain text ("true"/"false"), rather than a check box.
+ */
+ public Class getColumnClass(int c)
+ {
+ return getValueAt(0, c).getClass();
+ }
+
+ /*
+ * Don't need to implement this method unless your table's editable.
+ */
+ public boolean isCellEditable(int row, int col)
+ {
+ // Note that the data/cell address is constant,
+ // no matter where the cell appears onscreen.
+ return col == 1;
+
+ }
+
+ /*
+ * Don't need to implement this method unless your table's data can change.
+ */
+ public void setValueAt(Object value, int row, int col)
+ {
+ data[row][col] = value;
+ fireTableCellUpdated(row, col);
+
+ String name = getValueAt(row, 0).toString();
+ boolean selected = ((Boolean) value).booleanValue();
+
+ if (selectedSources.contains(name) && !selected)
+ {
+ selectedSources.remove(name);
+ }
+
+ if (!selectedSources.contains(name) && selected)
+ {
+ selectedSources.add(name);
+ }
+ }
+ }
+
+ public void initDasSources()
+ {
+
+ Thread thr = new Thread(new Runnable()
+ {
+ public void run()
+ {
+ // this actually initialises the das source list
+ paintComponent(null); // yuk
+ }
+ });
+ thr.start();
+ while (loadingDasSources || sourceRegistry == null)
+ {
+ try
+ {
+ Thread.sleep(10);
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ }
+
+ /**
+ * disable or enable the buttons on the source browser
+ *
+ * @param b
+ */
+ public void setGuiEnabled(boolean b)
+ {
+ refresh.setEnabled(b);
+ addLocal.setEnabled(b);
+ }
+}
diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java
index 2a72e44..5c45232 100644
--- a/src/jalview/gui/Desktop.java
+++ b/src/jalview/gui/Desktop.java
@@ -1,28 +1,39 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
import jalview.io.FileLoader;
import jalview.io.FormatAdapter;
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
+import jalview.jbgui.GSplitFrame;
+import jalview.jbgui.GStructureViewer;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.ImageMaker;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
import jalview.ws.params.ParamManager;
import java.awt.BorderLayout;
@@ -62,8 +73,12 @@ import java.lang.reflect.Constructor;
import java.net.URL;
import java.util.ArrayList;
import java.util.Hashtable;
+import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Semaphore;
import javax.swing.DefaultDesktopManager;
import javax.swing.DesktopManager;
@@ -80,6 +95,8 @@ import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
@@ -91,7 +108,8 @@ import javax.swing.event.MenuListener;
* @version $Revision: 1.155 $
*/
public class Desktop extends jalview.jbgui.GDesktop implements
- DropTargetListener, ClipboardOwner, IProgressIndicator, jalview.api.StructureSelectionManagerProvider
+ DropTargetListener, ClipboardOwner, IProgressIndicator,
+ jalview.api.StructureSelectionManagerProvider
{
private JalviewChangeSupport changeSupport = new JalviewChangeSupport();
@@ -99,7 +117,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
/**
* news reader - null if it was never started.
*/
- private BlogReader jvnews=null;
+ private BlogReader jvnews = null;
+
+ private File projectFile;
/**
* @param listener
@@ -147,6 +167,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
static final int yOffset = 30;
+ private static AlignFrame currentAlignFrame;
+
public static jalview.ws.jws1.Discoverer discoverer;
public static Object[] jalviewClipboard;
@@ -204,6 +226,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
public void dragFrame(JComponent f, int newX, int newY)
{
+ if (newY < 0)
+ {
+ newY = 0;
+ }
delegate.dragFrame(f, newX, newY);
}
@@ -237,9 +263,14 @@ public class Desktop extends jalview.jbgui.GDesktop implements
delegate.openFrame(f);
}
+ @Override
public void resizeFrame(JComponent f, int newX, int newY, int newWidth,
int newHeight)
{
+ if (newY < 0)
+ {
+ newY = 0;
+ }
delegate.resizeFrame(f, newX, newY, newWidth, newHeight);
}
@@ -266,7 +297,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
instance = this;
doVamsasClientCheck();
doGroovyCheck();
-
+ doConfigureStructurePrefs();
setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE",
@@ -278,16 +309,17 @@ public class Desktop extends jalview.jbgui.GDesktop implements
desktop.setBackground(Color.white);
getContentPane().setLayout(new BorderLayout());
// alternate config - have scrollbars - see notes in JAL-153
- //JScrollPane sp = new JScrollPane();
- //sp.getViewport().setView(desktop);
- //getContentPane().add(sp, BorderLayout.CENTER);
+ // JScrollPane sp = new JScrollPane();
+ // sp.getViewport().setView(desktop);
+ // getContentPane().add(sp, BorderLayout.CENTER);
getContentPane().add(desktop, BorderLayout.CENTER);
- desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
-
+ desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
+
// This line prevents Windows Look&Feel resizing all new windows to maximum
// if previous window was maximised
desktop.setDesktopManager(new MyDesktopManager(
new DefaultDesktopManager()));
+
Rectangle dims = getLastKnownDimensions("");
if (dims != null)
{
@@ -296,14 +328,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
else
{
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- setBounds((int) (screenSize.width - 900) / 2,
- (int) (screenSize.height - 650) / 2, 900, 650);
+ setBounds((screenSize.width - 900) / 2,
+ (screenSize.height - 650) / 2, 900, 650);
}
jconsole = new Console(this, showjconsole);
// add essential build information
- jconsole.setHeader("Jalview Desktop "
+ jconsole.setHeader("Jalview Version: "
+ jalview.bin.Cache.getProperty("VERSION") + "\n"
- + "Build Date: "
+ + "Jalview Installation: "
+ + jalview.bin.Cache.getDefault("INSTALLATION", "unknown")
+ + "\n" + "Build Date: "
+ jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + "\n"
+ "Java version: " + System.getProperty("java.version") + "\n"
+ System.getProperty("os.arch") + " "
@@ -313,20 +347,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
showConsole(showjconsole);
showNews.setVisible(false);
- final Desktop me = this;
- // Thread off the news reader, in case there are connection problems.
- new Thread( new Runnable() {
- @Override
- public void run()
- {
- Cache.log.debug("Starting news thread.");
- jvnews = new BlogReader(me);
- showNews.setVisible(true);
- Cache.log.debug("Completed news thread.");
- }
- }).start();
-
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent evt)
@@ -335,7 +356,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
});
- this.addMouseListener(new MouseAdapter()
+ MouseAdapter ma;
+ this.addMouseListener(ma = new MouseAdapter()
{
public void mousePressed(MouseEvent evt)
{
@@ -345,16 +367,18 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
}
});
+ desktop.addMouseListener(ma);
+
this.addFocusListener(new FocusListener()
{
-
+
@Override
public void focusLost(FocusEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void focusGained(FocusEvent e)
{
@@ -381,7 +405,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
public void run()
{
Cache.log.debug("Filechooser init thread started.");
- JalviewFileChooser chooser = new JalviewFileChooser(
+ new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
jalview.io.AppletFormatAdapter.READABLE_EXTENSIONS,
jalview.io.AppletFormatAdapter.READABLE_FNAMES,
@@ -405,25 +429,69 @@ public class Desktop extends jalview.jbgui.GDesktop implements
});
}
+ public void doConfigureStructurePrefs()
+ {
+ // configure services
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(this);
+ if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true))
+ {
+ ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault(
+ Preferences.ADD_TEMPFACT_ANN, true));
+ ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault(
+ Preferences.STRUCT_FROM_PDB, true));
+ ssm.setSecStructServices(jalview.bin.Cache.getDefault(
+ Preferences.USE_RNAVIEW, true));
+ }
+ else
+ {
+ ssm.setAddTempFacAnnot(false);
+ ssm.setProcessSecondaryStructure(false);
+ ssm.setSecStructServices(false);
+ }
+ }
+
+ public void checkForNews()
+ {
+ final Desktop me = this;
+ // Thread off the news reader, in case there are connection problems.
+ addDialogThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ Cache.log.debug("Starting news thread.");
+
+ jvnews = new BlogReader(me);
+ showNews.setVisible(true);
+ Cache.log.debug("Completed news thread.");
+ }
+ });
+ }
+
+ @Override
protected void showNews_actionPerformed(ActionEvent e)
{
showNews(showNews.isSelected());
}
+
void showNews(boolean visible)
{
{
- Cache.log.debug((visible?"Showing":"Hiding")+" news.");
+ Cache.log.debug((visible ? "Showing" : "Hiding") + " news.");
showNews.setSelected(visible);
if (visible && !jvnews.isVisible())
{
- new Thread(new Runnable() {
+ new Thread(new Runnable()
+ {
@Override
public void run()
{
- long instance=System.currentTimeMillis();
- Desktop.instance.setProgressBar("Refreshing news", instance);
+ long now = System.currentTimeMillis();
+ Desktop.instance.setProgressBar(
+ MessageManager.getString("status.refreshing_news"), now);
jvnews.refreshNews();
- Desktop.instance.setProgressBar(null, instance);
+ Desktop.instance.setProgressBar(null, now);
jvnews.showNews();
}
}).start();
@@ -531,7 +599,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
void showPasteMenu(int x, int y)
{
JPopupMenu popup = new JPopupMenu();
- JMenuItem item = new JMenuItem("Paste To New Window");
+ JMenuItem item = new JMenuItem(
+ MessageManager.getString("label.paste_new_window"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
@@ -574,38 +643,84 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* Adds and opens the given frame to the desktop
*
* @param frame
- * DOCUMENT ME!
+ * Frame to show
* @param title
- * DOCUMENT ME!
+ * Visible Title
* @param w
- * DOCUMENT ME!
+ * width
* @param h
- * DOCUMENT ME!
+ * height
*/
public static synchronized void addInternalFrame(
final JInternalFrame frame, String title, int w, int h)
{
- addInternalFrame(frame, title, w, h, true);
+ addInternalFrame(frame, title, true, w, h, true);
}
/**
- * DOCUMENT ME!
+ * Add an internal frame to the Jalview desktop
*
* @param frame
- * DOCUMENT ME!
+ * Frame to show
* @param title
- * DOCUMENT ME!
+ * Visible Title
+ * @param makeVisible
+ * When true, display frame immediately, otherwise, caller must call
+ * setVisible themselves.
* @param w
- * DOCUMENT ME!
+ * width
* @param h
- * DOCUMENT ME!
+ * height
+ */
+ public static synchronized void addInternalFrame(
+ final JInternalFrame frame, String title, boolean makeVisible,
+ int w, int h)
+ {
+ addInternalFrame(frame, title, makeVisible, w, h, true);
+ }
+
+ /**
+ * Add an internal frame to the Jalview desktop and make it visible
+ *
+ * @param frame
+ * Frame to show
+ * @param title
+ * Visible Title
+ * @param w
+ * width
+ * @param h
+ * height
* @param resizable
- * DOCUMENT ME!
+ * Allow resize
*/
public static synchronized void addInternalFrame(
final JInternalFrame frame, String title, int w, int h,
boolean resizable)
{
+ addInternalFrame(frame, title, true, w, h, resizable);
+ }
+
+ /**
+ * Add an internal frame to the Jalview desktop
+ *
+ * @param frame
+ * Frame to show
+ * @param title
+ * Visible Title
+ * @param makeVisible
+ * When true, display frame immediately, otherwise, caller must call
+ * setVisible themselves.
+ * @param w
+ * width
+ * @param h
+ * height
+ * @param resizable
+ * Allow resize
+ */
+ public static synchronized void addInternalFrame(
+ final JInternalFrame frame, String title, boolean makeVisible,
+ int w, int h, boolean resizable)
+ {
// TODO: allow callers to determine X and Y position of frame (eg. via
// bounds object).
@@ -621,15 +736,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
// A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
// IF JALVIEW IS RUNNING HEADLESS
// ///////////////////////////////////////////////
- if (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true"))
+ if (instance == null
+ || (System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true")))
{
return;
}
openFrameCount++;
- frame.setVisible(true);
+ frame.setVisible(makeVisible);
frame.setClosable(true);
frame.setResizable(resizable);
frame.setMaximizable(resizable);
@@ -687,17 +803,17 @@ public class Desktop extends jalview.jbgui.GDesktop implements
});
menuItem.addMouseListener(new MouseListener()
{
-
+
@Override
public void mouseReleased(MouseEvent e)
{
}
-
+
@Override
public void mousePressed(MouseEvent e)
{
}
-
+
@Override
public void mouseExited(MouseEvent e)
{
@@ -708,7 +824,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
}
}
-
+
@Override
public void mouseEntered(MouseEvent e)
{
@@ -719,11 +835,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
}
}
-
+
@Override
public void mouseClicked(MouseEvent e)
{
-
+
}
});
@@ -737,10 +853,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements
frame.requestFocus();
} catch (java.beans.PropertyVetoException ve)
{
- }
- catch (java.lang.ClassCastException cex)
+ } catch (java.lang.ClassCastException cex)
{
- Cache.log.warn("Squashed a possible GUI implementation error. If you can recreate this, please look at http://issues.jalview.org/browse/JAL-869",cex);
+ Cache.log
+ .warn("Squashed a possible GUI implementation error. If you can recreate this, please look at http://issues.jalview.org/browse/JAL-869",
+ cex);
}
}
@@ -766,6 +883,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
}
+ @Override
public void dropActionChanged(DropTargetDragEvent evt)
{
}
@@ -778,6 +896,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
*/
public void drop(DropTargetDropEvent evt)
{
+ boolean success = true;
Transferable t = evt.getTransferable();
java.util.List files = null;
java.util.List protocols = null;
@@ -826,6 +945,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
} catch (Exception e)
{
+ success = false;
}
if (files != null)
@@ -854,8 +974,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
} catch (Exception ex)
{
+ success = false;
}
}
+ evt.dropComplete(success); // need this to ensure input focus is properly
+ // transfered to any new windows created
}
/**
@@ -864,6 +987,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* @param e
* DOCUMENT ME!
*/
+ @Override
public void inputLocalFileMenuItem_actionPerformed(AlignViewport viewport)
{
JalviewFileChooser chooser = new JalviewFileChooser(
@@ -873,8 +997,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Open local file");
- chooser.setToolTipText("Open");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.open_local_file"));
+ chooser.setToolTipText(MessageManager.getString("action.open"));
int value = chooser.showOpenDialog(this);
@@ -885,7 +1010,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
.getSelectedFile().getParent());
String format = null;
- if (chooser.getSelectedFormat().equals("Jalview"))
+ if (chooser.getSelectedFormat() != null
+ && chooser.getSelectedFormat().equals("Jalview"))
{
format = "Jalview";
}
@@ -898,6 +1024,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
new FileLoader().LoadFile(viewport, choice, FormatAdapter.FILE,
format);
+ // viewport.setShowSequenceFeatures(JSONFile.isSeqFeaturesEnabled());
+ // AlignFrame af = viewport.getAlignPanel().alignFrame;
+ // if (af != null)
+ // {
+ // af.changeColour(JSONFile.getColourScheme());
+ // af.setMenusForViewport();
+ // }
}
else
{
@@ -912,11 +1045,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* @param e
* DOCUMENT ME!
*/
+ @Override
public void inputURLMenuItem_actionPerformed(AlignViewport viewport)
{
// This construct allows us to have a wider textfield
// for viewing
- JLabel label = new JLabel("Enter URL of Input File");
+ JLabel label = new JLabel(
+ MessageManager.getString("label.input_file_url"));
final JComboBox history = new JComboBox();
JPanel panel = new JPanel(new GridLayout(2, 1));
@@ -941,7 +1076,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
int reply = JOptionPane.showInternalConfirmDialog(desktop, panel,
- "Input Alignment From URL", JOptionPane.OK_CANCEL_OPTION);
+ MessageManager.getString("label.input_alignment_from_url"),
+ JOptionPane.OK_CANCEL_OPTION);
if (reply != JOptionPane.OK_OPTION)
{
@@ -969,7 +1105,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
if (format.equals("URL NOT FOUND"))
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Couldn't locate " + url, "URL not found",
+ MessageManager.formatMessage("label.couldnt_locate",
+ new Object[] { url }), MessageManager
+ .getString("label.url_not_found"),
JOptionPane.WARNING_MESSAGE);
return;
@@ -987,21 +1125,27 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
/**
- * DOCUMENT ME!
+ * Opens the CutAndPaste window for the user to paste an alignment in to
*
- * @param e
- * DOCUMENT ME!
+ * @param viewPanel
+ * - if not null, the pasted alignment is added to the current
+ * alignment; if null, to a new alignment window
*/
- public void inputTextboxMenuItem_actionPerformed(AlignViewport viewport)
+ @Override
+ public void inputTextboxMenuItem_actionPerformed(
+ AlignmentViewPanel viewPanel)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
- cap.setForInput(viewport);
- Desktop.addInternalFrame(cap, "Cut & Paste Alignment File", 600, 500);
+ cap.setForInput(viewPanel);
+ Desktop.addInternalFrame(cap,
+ MessageManager.getString("label.cut_paste_alignmen_file"),
+ true, 600, 500);
}
/*
* Exit the program
*/
+ @Override
public void quit()
{
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
@@ -1017,12 +1161,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
storeLastKnownDimensions("JAVA_CONSOLE_", jconsole.getBounds());
jconsole.stopConsole();
}
- if (jvnews!=null)
+ if (jvnews != null)
{
storeLastKnownDimensions("JALVIEW_RSS_WINDOW_", jvnews.getBounds());
-
+
+ }
+ if (dialogExecutor != null)
+ {
+ dialogExecutor.shutdownNow();
}
-
+ closeAll_actionPerformed(null);
System.exit(0);
}
@@ -1044,32 +1192,85 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* @param e
* DOCUMENT ME!
*/
+ @Override
public void aboutMenuItem_actionPerformed(ActionEvent e)
{
- StringBuffer message = new StringBuffer("Jalview version "
- + jalview.bin.Cache.getProperty("VERSION") + "; last updated: "
- + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"));
+ // StringBuffer message = getAboutMessage(false);
+ // JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ //
+ // message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ new SplashScreen(true);
+ }
+ }).start();
+ }
+
+ public StringBuffer getAboutMessage(boolean shortv)
+ {
+ StringBuffer message = new StringBuffer();
+ message.append("<html>");
+ if (shortv)
+ {
+ message.append("<h1><strong>Version: "
+ + jalview.bin.Cache.getProperty("VERSION") + "</strong></h1>");
+ message.append("<strong>Last Updated: <em>"
+ + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")
+ + "</em></strong>");
- if (!jalview.bin.Cache.getProperty("LATEST_VERSION").equals(
- jalview.bin.Cache.getProperty("VERSION")))
+ }
+ else
{
- message.append("\n\n!! Jalview version "
- + jalview.bin.Cache.getProperty("LATEST_VERSION")
- + " is available for download from "+jalview.bin.Cache.getDefault("www.jalview.org","http://www.jalview.org")+" !!\n");
+ message.append("<strong>Version "
+ + jalview.bin.Cache.getProperty("VERSION")
+ + "; last updated: "
+ + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"));
}
- // TODO: update this text for each release or centrally store it for lite
- // and application
- message.append("\nAuthors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,\n David Martin & Geoff Barton."
- + "\nDevelopment managed by The Barton Group, University of Dundee, Scotland, UK.\n"
- + "\nFor help, see the FAQ at www.jalview.org and/or join the jalview-discuss at jalview.org mailing list\n"
- + "\nIf you use Jalview, please cite:"
- + "\nWaterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
- + "\nJalview Version 2 - a multiple sequence alignment editor and analysis workbench"
- + "\nBioinformatics doi: 10.1093/bioinformatics/btp033");
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
+ if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals(
+ "Checking"))
+ {
+ message.append("<br>...Checking latest version...</br>");
+ }
+ else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
+ .equals(jalview.bin.Cache.getProperty("VERSION")))
+ {
+ boolean red = false;
+ if (jalview.bin.Cache.getProperty("VERSION").toLowerCase()
+ .indexOf("automated build") == -1)
+ {
+ red = true;
+ // Displayed when code version and jnlp version do not match and code
+ // version is not a development build
+ message.append("<div style=\"color: #FF0000;font-style: bold;\">");
+ }
+
+ message.append("<br>!! Version "
+ + jalview.bin.Cache.getDefault("LATEST_VERSION",
+ "..Checking..")
+ + " is available for download from "
+ + jalview.bin.Cache.getDefault("www.jalview.org",
+ "http://www.jalview.org") + " !!");
+ if (red)
+ {
+ message.append("</div>");
+ }
+ }
+ message.append("<br>Authors: "
+ + jalview.bin.Cache
+ .getDefault("AUTHORFNAMES",
+ "The Jalview Authors (See AUTHORS file for current list)")
+ + "<br><br>Development managed by The Barton Group, University of Dundee, Scotland, UK.<br>"
+ + "<br><br>For help, see the FAQ at <a href=\"http://www.jalview.org/faq\">www.jalview.org/faq</a> and/or join the jalview-discuss at jalview.org mailing list"
+ + "<br><br>If you use Jalview, please cite:"
+ + "<br>Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
+ + "<br>Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
+ + "<br>Bioinformatics doi: 10.1093/bioinformatics/btp033"
+ + "</html>");
+ return message;
}
/**
@@ -1078,22 +1279,18 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* @param e
* DOCUMENT ME!
*/
+ @Override
public void documentationMenuItem_actionPerformed(ActionEvent e)
{
try
{
- ClassLoader cl = jalview.gui.Desktop.class.getClassLoader();
- java.net.URL url = javax.help.HelpSet.findHelpSet(cl, "help/help");
- javax.help.HelpSet hs = new javax.help.HelpSet(cl, url);
-
- javax.help.HelpBroker hb = hs.createHelpBroker();
- hb.setCurrentID("home");
- hb.setDisplayed(true);
+ Help.showHelpWindow();
} catch (Exception ex)
{
}
}
+ @Override
public void closeAll_actionPerformed(ActionEvent e)
{
JInternalFrame[] frames = desktop.getAllFrames();
@@ -1110,15 +1307,27 @@ public class Desktop extends jalview.jbgui.GDesktop implements
if (v_client != null)
{
// TODO clear binding to vamsas document objects on close_all
+ }
+ /*
+ * reset state of singleton objects as appropriate (clear down session state
+ * when all windows are closed)
+ */
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(this);
+ if (ssm != null)
+ {
+ ssm.resetAll();
}
}
+ @Override
public void raiseRelated_actionPerformed(ActionEvent e)
{
reorderAssociatedWindows(false, false);
}
+ @Override
public void minimizeAssociated_actionPerformed(ActionEvent e)
{
reorderAssociatedWindows(true, false);
@@ -1135,6 +1344,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* @seejalview.jbgui.GDesktop#garbageCollect_actionPerformed(java.awt.event.
* ActionEvent)
*/
+ @Override
protected void garbageCollect_actionPerformed(ActionEvent e)
{
// We simply collect the garbage
@@ -1150,6 +1360,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* jalview.jbgui.GDesktop#showMemusage_actionPerformed(java.awt.event.ActionEvent
* )
*/
+ @Override
protected void showMemusage_actionPerformed(ActionEvent e)
{
desktop.showMemoryUsage(showMemusage.isSelected());
@@ -1162,6 +1373,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* jalview.jbgui.GDesktop#showConsole_actionPerformed(java.awt.event.ActionEvent
* )
*/
+ @Override
protected void showConsole_actionPerformed(ActionEvent e)
{
showConsole(showConsole.isSelected());
@@ -1191,7 +1403,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
return;
}
- AlignViewport source = null, target = null;
+ AlignmentViewport source = null, target = null;
if (frames[0] instanceof AlignFrame)
{
source = ((AlignFrame) frames[0]).getCurrentView();
@@ -1266,6 +1478,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void preferences_actionPerformed(ActionEvent e)
{
new Preferences();
@@ -1277,15 +1490,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* @param e
* DOCUMENT ME!
*/
+ @Override
public void saveState_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "jar" }, new String[]
- { "Jalview Project" }, "Jalview Project");
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "jvp" }, new String[] { "Jalview Project" },
+ "Jalview Project");
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save State");
+ chooser.setDialogTitle(MessageManager.getString("label.save_state"));
int value = chooser.showSaveDialog(this);
@@ -1293,69 +1507,90 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
final Desktop me = this;
final java.io.File choice = chooser.getSelectedFile();
+ setProjectFile(choice);
+
new Thread(new Runnable()
{
public void run()
{
-
- setProgressBar("Saving jalview project " + choice.getName(),
- choice.hashCode());
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
- // TODO catch and handle errors for savestate
- // TODO prevent user from messing with the Desktop whilst we're saving
- try
- {
- new Jalview2XML().SaveState(choice);
- } catch (OutOfMemoryError oom)
- {
- new OOMWarning(
- "Whilst saving current state to " + choice.getName(), oom);
- } catch (Exception ex)
- {
- Cache.log
- .error("Problems whilst trying to save to "
- + choice.getName(), ex);
- JOptionPane.showMessageDialog(me,
- "Error whilst saving current state to " + choice.getName(),
- "Couldn't save project", JOptionPane.WARNING_MESSAGE);
- }
- setProgressBar(null, choice.hashCode());
+ // TODO: refactor to Jalview desktop session controller action.
+ setProgressBar(MessageManager.formatMessage(
+ "label.saving_jalview_project",
+ new Object[] { choice.getName() }), choice.hashCode());
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",
+ choice.getParent());
+ // TODO catch and handle errors for savestate
+ // TODO prevent user from messing with the Desktop whilst we're saving
+ try
+ {
+ new Jalview2XML().saveState(choice);
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("Whilst saving current state to "
+ + choice.getName(), oom);
+ } catch (Exception ex)
+ {
+ Cache.log.error(
+ "Problems whilst trying to save to " + choice.getName(),
+ ex);
+ JOptionPane.showMessageDialog(me, MessageManager.formatMessage(
+ "label.error_whilst_saving_current_state_to",
+ new Object[] { choice.getName() }), MessageManager
+ .getString("label.couldnt_save_project"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+ setProgressBar(null, choice.hashCode());
}
}).start();
}
}
+ private void setProjectFile(File choice)
+ {
+ this.projectFile = choice;
+ }
+
+ public File getProjectFile()
+ {
+ return this.projectFile;
+ }
+
/**
* DOCUMENT ME!
*
* @param e
* DOCUMENT ME!
*/
+ @Override
public void loadState_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "jar" }, new String[]
- { "Jalview Project" }, "Jalview Project");
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] {
+ "jvp", "jar" }, new String[] { "Jalview Project",
+ "Jalview Project (old)" }, "Jalview Project");
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Restore state");
+ chooser.setDialogTitle(MessageManager.getString("label.restore_state"));
int value = chooser.showOpenDialog(this);
if (value == JalviewFileChooser.APPROVE_OPTION)
{
- final String choice = chooser.getSelectedFile().getAbsolutePath();
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
- .getSelectedFile().getParent());
+ final File selectedFile = chooser.getSelectedFile();
+ setProjectFile(selectedFile);
+ final String choice = selectedFile.getAbsolutePath();
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",
+ selectedFile.getParent());
new Thread(new Runnable()
{
public void run()
{
- setProgressBar("loading jalview project " + choice,
- choice.hashCode());
+ setProgressBar(
+ MessageManager.formatMessage(
+ "label.loading_jalview_project",
+ new Object[] { choice }), choice.hashCode());
try
{
- new Jalview2XML().LoadJalviewAlign(choice);
+ new Jalview2XML().loadJalviewAlign(choice);
} catch (OutOfMemoryError oom)
{
new OOMWarning("Whilst loading project from " + choice, oom);
@@ -1363,9 +1598,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
Cache.log.error("Problems whilst loading project from "
+ choice, ex);
- JOptionPane.showMessageDialog(Desktop.desktop,
- "Error whilst loading project from " + choice,
- "Couldn't load project", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage(
+ "label.error_whilst_loading_project_from",
+ new Object[] { choice }), MessageManager
+ .getString("label.couldnt_load_project"),
+ JOptionPane.WARNING_MESSAGE);
}
setProgressBar(null, choice.hashCode());
}
@@ -1373,18 +1611,22 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
}
+ @Override
public void inputSequence_actionPerformed(ActionEvent e)
{
new SequenceFetcher(this);
}
JPanel progressPanel;
- ArrayList<JPanel> fileLoadingPanels=new ArrayList<JPanel>();
+
+ ArrayList<JPanel> fileLoadingPanels = new ArrayList<JPanel>();
+
public void startLoading(final String fileName)
{
if (fileLoadingCount == 0)
{
- fileLoadingPanels.add(addProgressPanel("Loading File: " + fileName + " "));
+ fileLoadingPanels.add(addProgressPanel(MessageManager.formatMessage(
+ "label.loading_file", new Object[] { fileName })));
}
fileLoadingCount++;
}
@@ -1393,11 +1635,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
if (progressPanel == null)
{
- progressPanel = new JPanel(new GridLayout(1,1));
+ progressPanel = new JPanel(new GridLayout(1, 1));
totalProgressCount = 0;
instance.getContentPane().add(progressPanel, BorderLayout.SOUTH);
}
- JPanel thisprogress=new JPanel(new BorderLayout(10,5));
+ JPanel thisprogress = new JPanel(new BorderLayout(10, 5));
JProgressBar progressBar = new JProgressBar();
progressBar.setIndeterminate(true);
@@ -1405,7 +1647,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
thisprogress.add(progressBar, BorderLayout.CENTER);
progressPanel.add(thisprogress);
- ((GridLayout)progressPanel.getLayout()).setRows(((GridLayout)progressPanel.getLayout()).getRows()+1);
+ ((GridLayout) progressPanel.getLayout())
+ .setRows(((GridLayout) progressPanel.getLayout()).getRows() + 1);
++totalProgressCount;
instance.validate();
return thisprogress;
@@ -1417,13 +1660,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
if (progressPanel != null)
{
- progressPanel.remove(progbar);
- GridLayout gl = (GridLayout) progressPanel.getLayout();
- gl.setRows(gl.getRows()-1);
- if (--totalProgressCount < 1)
+ synchronized (progressPanel)
{
- this.getContentPane().remove(progressPanel);
- progressPanel = null;
+ progressPanel.remove(progbar);
+ GridLayout gl = (GridLayout) progressPanel.getLayout();
+ gl.setRows(gl.getRows() - 1);
+ if (--totalProgressCount < 1)
+ {
+ this.getContentPane().remove(progressPanel);
+ progressPanel = null;
+ }
}
}
validate();
@@ -1434,9 +1680,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
fileLoadingCount--;
if (fileLoadingCount < 1)
{
- for (JPanel flp : fileLoadingPanels)
+ while (fileLoadingPanels.size() > 0)
{
- removeProgressPanel(flp);
+ removeProgressPanel(fileLoadingPanels.remove(0));
}
fileLoadingPanels.clear();
fileLoadingCount = 0;
@@ -1446,39 +1692,38 @@ public class Desktop extends jalview.jbgui.GDesktop implements
public static int getViewCount(String alignmentId)
{
- AlignViewport[] aps = getViewports(alignmentId);
+ AlignmentViewport[] aps = getViewports(alignmentId);
return (aps == null) ? 0 : aps.length;
}
/**
*
* @param alignmentId
+ * - if null, all sets are returned
* @return all AlignmentPanels concerning the alignmentId sequence set
*/
public static AlignmentPanel[] getAlignmentPanels(String alignmentId)
{
- int count = 0;
if (Desktop.desktop == null)
{
// no frames created and in headless mode
// TODO: verify that frames are recoverable when in headless mode
return null;
}
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
- ArrayList aps = new ArrayList();
- for (int t = 0; t < frames.length; t++)
+ List<AlignmentPanel> aps = new ArrayList<AlignmentPanel>();
+ AlignFrame[] frames = getAlignFrames();
+ if (frames == null)
{
- if (frames[t] instanceof AlignFrame)
+ return null;
+ }
+ for (AlignFrame af : frames)
+ {
+ for (AlignmentPanel ap : af.alignPanels)
{
- AlignFrame af = (AlignFrame) frames[t];
- for (int a = 0; a < af.alignPanels.size(); a++)
+ if (alignmentId == null
+ || alignmentId.equals(ap.av.getSequenceSetId()))
{
- if (alignmentId
- .equals(((AlignmentPanel) af.alignPanels.elementAt(a)).av
- .getSequenceSetId()))
- {
- aps.add(af.alignPanels.elementAt(a));
- }
+ aps.add(ap);
}
}
}
@@ -1486,11 +1731,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
return null;
}
- AlignmentPanel[] vap = new AlignmentPanel[aps.size()];
- for (int t = 0; t < vap.length; t++)
- {
- vap[t] = (AlignmentPanel) aps.get(t);
- }
+ AlignmentPanel[] vap = aps.toArray(new AlignmentPanel[aps.size()]);
return vap;
}
@@ -1498,52 +1739,53 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* get all the viewports on an alignment.
*
* @param sequenceSetId
- * unique alignment id
+ * unique alignment id (may be null - all viewports returned in that
+ * case)
* @return all viewports on the alignment bound to sequenceSetId
*/
- public static AlignViewport[] getViewports(String sequenceSetId)
+ public static AlignmentViewport[] getViewports(String sequenceSetId)
{
- Vector viewp = new Vector();
+ List<AlignmentViewport> viewp = new ArrayList<AlignmentViewport>();
if (desktop != null)
{
- javax.swing.JInternalFrame[] frames = instance.getAllFrames();
+ AlignFrame[] frames = Desktop.getAlignFrames();
- for (int t = 0; t < frames.length; t++)
+ for (AlignFrame afr : frames)
{
- if (frames[t] instanceof AlignFrame)
+ if (sequenceSetId == null
+ || afr.getViewport().getSequenceSetId()
+ .equals(sequenceSetId))
{
- AlignFrame afr = ((AlignFrame) frames[t]);
- if (afr.getViewport().getSequenceSetId().equals(sequenceSetId))
+ if (afr.alignPanels != null)
{
- if (afr.alignPanels != null)
+ for (AlignmentPanel ap : afr.alignPanels)
{
- for (int a = 0; a < afr.alignPanels.size(); a++)
+ if (sequenceSetId == null
+ || sequenceSetId.equals(ap.av.getSequenceSetId()))
{
- if (sequenceSetId.equals(((AlignmentPanel) afr.alignPanels
- .elementAt(a)).av.getSequenceSetId()))
- {
- viewp.addElement(((AlignmentPanel) afr.alignPanels
- .elementAt(a)).av);
- }
+ viewp.add(ap.av);
}
}
- else
- {
- viewp.addElement(((AlignFrame) frames[t]).getViewport());
- }
+ }
+ else
+ {
+ viewp.add(afr.getViewport());
}
}
}
if (viewp.size() > 0)
{
- AlignViewport[] vp = new AlignViewport[viewp.size()];
- viewp.copyInto(vp);
- return vp;
+ return viewp.toArray(new AlignmentViewport[viewp.size()]);
}
}
return null;
}
+ /**
+ * Explode the views in the given frame into separate AlignFrame
+ *
+ * @param af
+ */
public void explodeViews(AlignFrame af)
{
int size = af.alignPanels.size();
@@ -1554,15 +1796,21 @@ public class Desktop extends jalview.jbgui.GDesktop implements
for (int i = 0; i < size; i++)
{
- AlignmentPanel ap = (AlignmentPanel) af.alignPanels.elementAt(i);
+ AlignmentPanel ap = af.alignPanels.get(i);
AlignFrame newaf = new AlignFrame(ap);
- if (ap.av.explodedPosition != null
- && !ap.av.explodedPosition.equals(af.getBounds()))
+
+ /*
+ * Restore the view's last exploded frame geometry if known. Multiple
+ * views from one exploded frame share and restore the same (frame)
+ * position and size.
+ */
+ Rectangle geometry = ap.av.getExplodedGeometry();
+ if (geometry != null)
{
- newaf.setBounds(ap.av.explodedPosition);
+ newaf.setBounds(geometry);
}
- ap.av.gatherViewsHere = false;
+ ap.av.setGatherViewsHere(false);
addInternalFrame(newaf, af.getTitle(), AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
@@ -1573,12 +1821,20 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
+ /**
+ * Gather expanded views (separate AlignFrame's) with the same sequence set
+ * identifier back in to this frame as additional views, and close the
+ * expanded views. Note the expanded frames may themselves have multiple
+ * views. We take the lot.
+ *
+ * @param source
+ */
public void gatherViews(AlignFrame source)
{
- source.viewport.gatherViewsHere = true;
- source.viewport.explodedPosition = source.getBounds();
+ source.viewport.setGatherViewsHere(true);
+ source.viewport.setExplodedGeometry(source.getBounds());
JInternalFrame[] frames = desktop.getAllFrames();
- String viewId = source.viewport.sequenceSetID;
+ String viewId = source.viewport.getSequenceSetId();
for (int t = 0; t < frames.length; t++)
{
@@ -1588,12 +1844,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements
boolean gatherThis = false;
for (int a = 0; a < af.alignPanels.size(); a++)
{
- AlignmentPanel ap = (AlignmentPanel) af.alignPanels.elementAt(a);
+ AlignmentPanel ap = af.alignPanels.get(a);
if (viewId.equals(ap.av.getSequenceSetId()))
{
gatherThis = true;
- ap.av.gatherViewsHere = false;
- ap.av.explodedPosition = af.getBounds();
+ ap.av.setGatherViewsHere(false);
+ ap.av.setExplodedGeometry(af.getBounds());
source.addAlignmentPanel(ap, false);
}
}
@@ -1610,6 +1866,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
jalview.gui.VamsasApplication v_client = null;
+ @Override
public void vamsasImport_actionPerformed(ActionEvent e)
{
if (v_client == null)
@@ -1619,8 +1876,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Open a saved VAMSAS session");
- chooser.setToolTipText("select a vamsas session to be opened as a new vamsas session.");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.open_saved_vamsas_session"));
+ chooser.setToolTipText(MessageManager
+ .getString("label.select_vamsas_session_opened_as_new_vamsas_session"));
int value = chooser.showOpenDialog(this);
@@ -1629,10 +1888,15 @@ public class Desktop extends jalview.jbgui.GDesktop implements
String fle = chooser.getSelectedFile().toString();
if (!vamsasImport(chooser.getSelectedFile()))
{
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Couldn't import '" + fle + "' as a new vamsas session.",
- "Vamsas Document Import Failed",
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane
+ .showInternalMessageDialog(
+ Desktop.desktop,
+ MessageManager.formatMessage(
+ "label.couldnt_import_as_vamsas_session",
+ new Object[] { fle }),
+ MessageManager
+ .getString("label.vamsas_document_import_failed"),
+ JOptionPane.ERROR_MESSAGE);
}
}
}
@@ -1705,23 +1969,26 @@ public class Desktop extends jalview.jbgui.GDesktop implements
return false;
}
- setProgressBar("Importing VAMSAS session from " + file.getName(),
- file.hashCode());
+ setProgressBar(MessageManager.formatMessage(
+ "status.importing_vamsas_session_from",
+ new Object[] { file.getName() }), file.hashCode());
try
{
v_client = new jalview.gui.VamsasApplication(this, file, null);
} catch (Exception ex)
{
- setProgressBar("Importing VAMSAS session from " + file.getName(),
- file.hashCode());
+ setProgressBar(MessageManager.formatMessage(
+ "status.importing_vamsas_session_from",
+ new Object[] { file.getName() }), file.hashCode());
jalview.bin.Cache.log.error(
"New vamsas session from existing session file failed:", ex);
return false;
}
setupVamsasConnectedGui();
v_client.initial_update(); // TODO: thread ?
- setProgressBar("Importing VAMSAS session from " + file.getName(),
- file.hashCode());
+ setProgressBar(MessageManager.formatMessage(
+ "status.importing_vamsas_session_from",
+ new Object[] { file.getName() }), file.hashCode());
return v_client.inSession();
}
@@ -1730,11 +1997,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
if (v_client != null)
{
throw new Error(
- "Trying to join a vamsas session when another is already connected.");
+ MessageManager
+ .getString("error.try_join_vamsas_session_another"));
}
if (mysesid == null)
{
- throw new Error("Invalid vamsas session id.");
+ throw new Error(
+ MessageManager.getString("error.invalid_vamsas_session_id"));
}
v_client = new VamsasApplication(this, mysesid);
setupVamsasConnectedGui();
@@ -1742,6 +2011,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
return (v_client.inSession());
}
+ @Override
public void vamsasStart_actionPerformed(ActionEvent e)
{
if (v_client == null)
@@ -1774,7 +2044,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
protected void setupVamsasConnectedGui()
{
- vamsasStart.setText("Session Update");
+ vamsasStart.setText(MessageManager.getString("label.session_update"));
vamsasSave.setVisible(true);
vamsasStop.setVisible(true);
vamsasImport.setVisible(false); // Document import to existing session is
@@ -1786,9 +2056,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements
vamsasSave.setVisible(false);
vamsasStop.setVisible(false);
vamsasImport.setVisible(true);
- vamsasStart.setText("New Vamsas Session");
+ vamsasStart.setText(MessageManager
+ .getString("label.new_vamsas_session"));
}
+ @Override
public void vamsasStop_actionPerformed(ActionEvent e)
{
if (v_client != null)
@@ -1822,7 +2094,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
JMenuItem sessit = new JMenuItem();
sessit.setText(sess[i]);
- sessit.setToolTipText("Connect to session " + sess[i]);
+ sessit.setToolTipText(MessageManager.formatMessage(
+ "label.connect_to_session", new Object[] { sess[i] }));
final Desktop dsktp = this;
final String mysesid = sess[i];
sessit.addActionListener(new ActionListener()
@@ -1867,6 +2140,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
}
+ @Override
public void vamsasSave_actionPerformed(ActionEvent e)
{
if (v_client != null)
@@ -1874,19 +2148,20 @@ public class Desktop extends jalview.jbgui.GDesktop implements
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "vdj" }, // TODO: VAMSAS DOCUMENT EXTENSION is VDJ
- new String[]
- { "Vamsas Document" }, "Vamsas Document");
+ new String[] { "Vamsas Document" }, "Vamsas Document");
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save Vamsas Document Archive");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.save_vamsas_document_archive"));
int value = chooser.showSaveDialog(this);
if (value == JalviewFileChooser.APPROVE_OPTION)
{
java.io.File choice = chooser.getSelectedFile();
- JPanel progpanel = addProgressPanel("Saving VAMSAS Document to "
- + choice.getName());
+ JPanel progpanel = addProgressPanel(MessageManager.formatMessage(
+ "label.saving_vamsas_doc",
+ new Object[] { choice.getName() }));
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
String warnmsg = null;
String warnttl = null;
@@ -1938,7 +2213,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
if (b)
{
- vamUpdate = this.addProgressPanel("Updating vamsas session");
+ vamUpdate = this.addProgressPanel(MessageManager
+ .getString("label.updating_vamsas_session"));
}
vamsasStart.setVisible(!b);
vamsasStop.setVisible(!b);
@@ -1973,6 +2249,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
public class MyDesktopPane extends JDesktopPane implements Runnable
{
+ private static final float ONE_MB = 1048576f;
+
boolean showMemoryUsage = false;
Runtime runtime;
@@ -1987,10 +2265,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
showMemoryUsage(showMemoryUsage);
}
- public void showMemoryUsage(boolean showMemoryUsage)
+ public void showMemoryUsage(boolean showMemory)
{
- this.showMemoryUsage = showMemoryUsage;
- if (showMemoryUsage)
+ this.showMemoryUsage = showMemory;
+ if (showMemory)
{
Thread worker = new Thread(this);
worker.start();
@@ -2012,9 +2290,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
try
{
- maxMemory = runtime.maxMemory() / 1048576f;
- allocatedMemory = runtime.totalMemory() / 1048576f;
- freeMemory = runtime.freeMemory() / 1048576f;
+ maxMemory = runtime.maxMemory() / ONE_MB;
+ allocatedMemory = runtime.totalMemory() / ONE_MB;
+ freeMemory = runtime.freeMemory() / ONE_MB;
totalFreeMemory = freeMemory + (maxMemory - allocatedMemory);
percentUsage = (totalFreeMemory / maxMemory) * 100;
@@ -2035,32 +2313,35 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
}
+ @Override
public void paintComponent(Graphics g)
{
if (showMemoryUsage && g != null && df != null)
{
if (percentUsage < 20)
+ {
g.setColor(Color.red);
+ }
FontMetrics fm = g.getFontMetrics();
if (fm != null)
{
- g.drawString(
- "Total Free Memory: " + df.format(totalFreeMemory)
- + "MB; Max Memory: " + df.format(maxMemory)
- + "MB; " + df.format(percentUsage) + "%", 10,
+ g.drawString(MessageManager.formatMessage(
+ "label.memory_stats",
+ new Object[] { df.format(totalFreeMemory),
+ df.format(maxMemory), df.format(percentUsage) }), 10,
getHeight() - fm.getHeight());
}
}
}
-
}
/**
- * fixes stacking order after a modal dialog to ensure windows that should be on top actually are
+ * fixes stacking order after a modal dialog to ensure windows that should be
+ * on top actually are
*/
public void relayerWindows()
{
-
+
}
protected JMenuItem groovyShell;
@@ -2070,12 +2351,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements
if (jalview.bin.Cache.groovyJarsPresent())
{
groovyShell = new JMenuItem();
- groovyShell.setText("Groovy Console...");
+ groovyShell.setText(MessageManager.getString("label.groovy_console"));
groovyShell.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- groovyShell_actionPerformed(e);
+ groovyShell_actionPerformed();
}
});
toolsMenu.add(groovyShell);
@@ -2085,8 +2366,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
/**
* Accessor method to quickly get all the AlignmentFrames loaded.
+ *
+ * @return an array of AlignFrame, or null if none found
*/
- public static AlignFrame[] getAlignframes()
+ public static AlignFrame[] getAlignFrames()
{
JInternalFrame[] frames = Desktop.desktop.getAllFrames();
@@ -2094,35 +2377,44 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
return null;
}
- Vector avp = new Vector();
- try
+ List<AlignFrame> avp = new ArrayList<AlignFrame>();
+ // REVERSE ORDER
+ for (int i = frames.length - 1; i > -1; i--)
{
- // REVERSE ORDER
- for (int i = frames.length - 1; i > -1; i--)
+ if (frames[i] instanceof AlignFrame)
{
- if (frames[i] instanceof AlignFrame)
+ avp.add((AlignFrame) frames[i]);
+ }
+ else if (frames[i] instanceof SplitFrame)
+ {
+ /*
+ * Also check for a split frame containing an AlignFrame
+ */
+ GSplitFrame sf = (GSplitFrame) frames[i];
+ if (sf.getTopFrame() instanceof AlignFrame)
{
- AlignFrame af = (AlignFrame) frames[i];
- avp.addElement(af);
+ avp.add((AlignFrame) sf.getTopFrame());
+ }
+ if (sf.getBottomFrame() instanceof AlignFrame)
+ {
+ avp.add((AlignFrame) sf.getBottomFrame());
}
}
- } catch (Exception ex)
- {
- ex.printStackTrace();
}
if (avp.size() == 0)
{
return null;
}
- AlignFrame afs[] = new AlignFrame[avp.size()];
- for (int i = 0, j = avp.size(); i < j; i++)
- {
- afs[i] = (AlignFrame) avp.elementAt(i);
- }
- avp.clear();
+ AlignFrame afs[] = avp.toArray(new AlignFrame[avp.size()]);
return afs;
}
- public AppJmol[] getJmols()
+
+ /**
+ * Returns an array of any AppJmol frames in the Desktop (or null if none).
+ *
+ * @return
+ */
+ public GStructureViewer[] getJmols()
{
JInternalFrame[] frames = Desktop.desktop.getAllFrames();
@@ -2130,77 +2422,64 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
return null;
}
- Vector avp = new Vector();
- try
+ List<GStructureViewer> avp = new ArrayList<GStructureViewer>();
+ // REVERSE ORDER
+ for (int i = frames.length - 1; i > -1; i--)
{
- // REVERSE ORDER
- for (int i = frames.length - 1; i > -1; i--)
+ if (frames[i] instanceof AppJmol)
{
- if (frames[i] instanceof AppJmol)
- {
- AppJmol af = (AppJmol) frames[i];
- avp.addElement(af);
- }
+ GStructureViewer af = (GStructureViewer) frames[i];
+ avp.add(af);
}
- } catch (Exception ex)
- {
- ex.printStackTrace();
}
if (avp.size() == 0)
{
return null;
}
- AppJmol afs[] = new AppJmol[avp.size()];
- for (int i = 0, j = avp.size(); i < j; i++)
- {
- afs[i] = (AppJmol) avp.elementAt(i);
- }
- avp.clear();
+ GStructureViewer afs[] = avp.toArray(new GStructureViewer[avp.size()]);
return afs;
}
/**
* Add Groovy Support to Jalview
*/
- public void groovyShell_actionPerformed(ActionEvent e)
+ public void groovyShell_actionPerformed()
{
// use reflection to avoid creating compilation dependency.
if (!jalview.bin.Cache.groovyJarsPresent())
{
throw new Error(
- "Implementation Error. Cannot create groovyShell without Groovy on the classpath!");
+ MessageManager
+ .getString("error.implementation_error_cannot_create_groovyshell"));
}
try
{
- Class gcClass = Desktop.class.getClassLoader().loadClass(
+ Class<?> gcClass = Desktop.class.getClassLoader().loadClass(
"groovy.ui.Console");
- Constructor gccons = gcClass.getConstructor(null);
+ Constructor<?> gccons = gcClass.getConstructor();
java.lang.reflect.Method setvar = gcClass.getMethod("setVariable",
- new Class[]
- { String.class, Object.class });
- java.lang.reflect.Method run = gcClass.getMethod("run", null);
- Object gc = gccons.newInstance(null);
- setvar.invoke(gc, new Object[]
- { "Jalview", this });
- run.invoke(gc, null);
+ new Class[] { String.class, Object.class });
+ java.lang.reflect.Method run = gcClass.getMethod("run");
+ Object gc = gccons.newInstance();
+ setvar.invoke(gc, new Object[] { "Jalview", this });
+ run.invoke(gc);
} catch (Exception ex)
{
jalview.bin.Cache.log.error("Groovy Shell Creation failed.", ex);
- JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Couldn't create the groovy Shell. Check the error log for the details of what went wrong.",
- "Jalview Groovy Support Failed",
- JOptionPane.ERROR_MESSAGE);
+ MessageManager.getString("label.couldnt_create_groovy_shell"),
+ MessageManager.getString("label.groovy_support_failed"),
+ JOptionPane.ERROR_MESSAGE);
}
}
/**
* Progress bars managed by the IProgressIndicator method.
*/
- private Hashtable<Long,JPanel> progressBars;
- private Hashtable<Long,IProgressIndicatorHandler> progressBarHandlers;
+ private Hashtable<Long, JPanel> progressBars;
+
+ private Hashtable<Long, IProgressIndicatorHandler> progressBarHandlers;
/*
* (non-Javadoc)
@@ -2211,19 +2490,18 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
if (progressBars == null)
{
- progressBars = new Hashtable<Long,JPanel>();
- progressBarHandlers = new Hashtable<Long,IProgressIndicatorHandler>();
+ progressBars = new Hashtable<Long, JPanel>();
+ progressBarHandlers = new Hashtable<Long, IProgressIndicatorHandler>();
}
if (progressBars.get(new Long(id)) != null)
{
- JPanel progressPanel = progressBars
- .remove(new Long(id));
+ JPanel panel = progressBars.remove(new Long(id));
if (progressBarHandlers.contains(new Long(id)))
{
progressBarHandlers.remove(new Long(id));
}
- removeProgressPanel(progressPanel);
+ removeProgressPanel(panel);
}
else
{
@@ -2240,16 +2518,19 @@ public class Desktop extends jalview.jbgui.GDesktop implements
public void registerHandler(final long id,
final IProgressIndicatorHandler handler)
{
- if (progressBarHandlers == null || !progressBars.contains(new Long(id)))
+ if (progressBarHandlers == null
+ || !progressBars.containsKey(new Long(id)))
{
throw new Error(
- "call setProgressBar before registering the progress bar's handler.");
+ MessageManager
+ .getString("error.call_setprogressbar_before_registering_handler"));
}
progressBarHandlers.put(new Long(id), handler);
- final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
+ final JPanel progressPanel = progressBars.get(new Long(id));
if (handler.canCancel())
{
- JButton cancel = new JButton("Cancel");
+ JButton cancel = new JButton(
+ MessageManager.getString("action.cancel"));
final IProgressIndicator us = this;
cancel.addActionListener(new ActionListener()
{
@@ -2257,10 +2538,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
public void actionPerformed(ActionEvent e)
{
handler.cancelActivity(id);
- us.setProgressBar(
- "Cancelled "
- + ((JLabel) progressPanel.getComponent(0))
- .getText(), id);
+ us.setProgressBar(MessageManager.formatMessage(
+ "label.cancelled_params",
+ new Object[] { ((JLabel) progressPanel.getComponent(0))
+ .getText() }), id);
}
});
progressPanel.add(cancel, BorderLayout.EAST);
@@ -2268,20 +2549,35 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
/**
- * This will return the first AlignFrame viewing AlignViewport av. It will
- * break if there are more than one AlignFrames viewing a particular av. This
*
- * @param av
- * @return alignFrame for av
+ * @return true if any progress bars are still active
*/
- public static AlignFrame getAlignFrameFor(AlignViewport av)
+ @Override
+ public boolean operationInProgress()
+ {
+ if (progressBars != null && progressBars.size() > 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * This will return the first AlignFrame holding the given viewport instance.
+ * It will break if there are more than one AlignFrames viewing a particular
+ * av.
+ *
+ * @param viewport
+ * @return alignFrame for viewport
+ */
+ public static AlignFrame getAlignFrameFor(AlignViewportI viewport)
{
if (desktop != null)
{
- AlignmentPanel[] aps = getAlignmentPanels(av.getSequenceSetId());
+ AlignmentPanel[] aps = getAlignmentPanels(viewport.getSequenceSetId());
for (int panel = 0; aps != null && panel < aps.length; panel++)
{
- if (aps[panel] != null && aps[panel].av == av)
+ if (aps[panel] != null && aps[panel].av == viewport)
{
return aps[panel].alignFrame;
}
@@ -2330,37 +2626,21 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
boolean alive = true;
Thread t0 = null, t1 = null, t2 = null;
-
- // todo: changesupport handlers need to be transferred
- if (discoverer == null)
- {
- discoverer = new jalview.ws.jws1.Discoverer();
- // register PCS handler for desktop.
- discoverer.addPropertyChangeListener(changeSupport);
- }
- // JAL-940 - disabled JWS1 service configuration - always start discoverer until we phase out completely
+ // JAL-940 - JALVIEW 1 services are now being EOLed as of JABA 2.1 release
if (true)
{
- (t0 = new Thread(discoverer)).start();
- }
-
- try
- {
- if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
+ // todo: changesupport handlers need to be transferred
+ if (discoverer == null)
{
- // EnfinEnvision web service menu entries are rebuild every time the
- // menu is shown, so no changeSupport events are needed.
- jalview.ws.EnfinEnvision2OneWay.getInstance();
- (t1 = new Thread(jalview.ws.EnfinEnvision2OneWay.getInstance()))
- .start();
+ discoverer = new jalview.ws.jws1.Discoverer();
+ // register PCS handler for desktop.
+ discoverer.addPropertyChangeListener(changeSupport);
}
- } catch (Exception e)
- {
- Cache.log
- .info("Exception when trying to launch Envision2 workflow discovery.",
- e);
- Cache.log.info(e.getStackTrace());
+ // JAL-940 - disabled JWS1 service configuration - always start discoverer
+ // until we phase out completely
+ (t0 = new Thread(discoverer)).start();
}
+
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
if (jalview.ws.jws2.Jws2Discoverer.getDiscoverer().isRunning())
@@ -2369,9 +2649,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer().startDiscoverer(
changeSupport);
-
+
}
- Thread t3=null;
+ Thread t3 = null;
{
// TODO: do rest service discovery
}
@@ -2408,28 +2688,58 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
if (Cache.getDefault("SHOW_WSDISCOVERY_ERRORS", true))
{
- if (serviceChangedDialog == null)
- {
- // only run if we aren't already displaying one of these.
- javax.swing.SwingUtilities
- .invokeLater(serviceChangedDialog = new Runnable()
- {
- public void run()
- {
-
- JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
- ermsg
- + "It may be that you have invalid JABA URLs\nin your web service preferences.\n\nGo to the Web services tab of the\nTools->Preferences dialog box to change them.\n",
- "Preferences Problem",
- JOptionPane.WARNING_MESSAGE);
- serviceChangedDialog = null;
-
- }
- });
+ if (serviceChangedDialog == null)
+ {
+ // only run if we aren't already displaying one of these.
+ addDialogThread(serviceChangedDialog = new Runnable()
+ {
+ public void run()
+ {
+
+ /*
+ * JalviewDialog jd =new JalviewDialog() {
+ *
+ * @Override protected void cancelPressed() { // TODO
+ * Auto-generated method stub
+ *
+ * }@Override protected void okPressed() { // TODO
+ * Auto-generated method stub
+ *
+ * }@Override protected void raiseClosed() { // TODO
+ * Auto-generated method stub
+ *
+ * } }; jd.initDialogFrame(new
+ * JLabel("<html><table width=\"450\"><tr><td>" + ermsg +
+ * "<br/>It may be that you have invalid JABA URLs in your web service preferences,"
+ * + " or mis-configured HTTP proxy settings.<br/>" +
+ * "Check the <em>Connections</em> and <em>Web services</em> tab of the"
+ * +
+ * " Tools->Preferences dialog box to change them.</td></tr></table></html>"
+ * ), true, true, "Web Service Configuration Problem", 450,
+ * 400);
+ *
+ * jd.waitForInput();
+ */
+ JOptionPane
+ .showConfirmDialog(
+ Desktop.desktop,
+ new JLabel(
+ "<html><table width=\"450\"><tr><td>"
+ + ermsg
+ + "</td></tr></table>"
+ + "<p>It may be that you have invalid JABA URLs<br/>in your web service preferences,"
+ + "<br>or as a command-line argument, or mis-configured HTTP proxy settings.</p>"
+ + "<p>Check the <em>Connections</em> and <em>Web services</em> tab<br/>of the"
+ + " Tools->Preferences dialog box to change them.</p></html>"),
+ "Web Service Configuration Problem",
+ JOptionPane.DEFAULT_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ serviceChangedDialog = null;
+
+ }
+ });
+ }
}
- }
else
{
Cache.log
@@ -2453,12 +2763,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
showUrl(url, Desktop.instance);
}
+
/**
* Like showUrl but allows progress handler to be specified
+ *
* @param url
- * @param progress (null) or object implementing IProgressIndicator
+ * @param progress
+ * (null) or object implementing IProgressIndicator
*/
- public static void showUrl(final String url, final IProgressIndicator progress)
+ public static void showUrl(final String url,
+ final IProgressIndicator progress)
{
new Thread(new Runnable()
{
@@ -2466,23 +2780,25 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
try
{
- if (progress!=null) {
- progress.setProgressBar("Opening "+url, this.hashCode());
+ if (progress != null)
+ {
+ progress.setProgressBar(MessageManager.formatMessage(
+ "status.opening_params", new Object[] { url }), this
+ .hashCode());
}
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
- "Unixers: Couldn't find default web browser."
- + "\nAdd the full path to your browser in Preferences.",
- "Web browser not found",
- JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager
+ .getString("label.web_browser_not_found_unix"),
+ MessageManager.getString("label.web_browser_not_found"),
+ JOptionPane.WARNING_MESSAGE);
ex.printStackTrace();
}
- if (progress!=null) {
+ if (progress != null)
+ {
progress.setProgressBar(null, this.hashCode());
}
}
@@ -2500,5 +2816,256 @@ public class Desktop extends jalview.jbgui.GDesktop implements
return wsparamManager;
}
+ /**
+ * static hyperlink handler proxy method for use by Jalview's internal windows
+ *
+ * @param e
+ */
+ public static void hyperlinkUpdate(HyperlinkEvent e)
+ {
+ if (e.getEventType() == EventType.ACTIVATED)
+ {
+ String url = null;
+ try
+ {
+ url = e.getURL().toString();
+ Desktop.showUrl(url);
+ } catch (Exception x)
+ {
+ if (url != null)
+ {
+ if (Cache.log != null)
+ {
+ Cache.log.error("Couldn't handle string " + url + " as a URL.");
+ }
+ else
+ {
+ System.err.println("Couldn't handle string " + url
+ + " as a URL.");
+ }
+ }
+ // ignore any exceptions due to dud links.
+ }
+
+ }
+ }
+
+ /**
+ * single thread that handles display of dialogs to user.
+ */
+ ExecutorService dialogExecutor = Executors.newSingleThreadExecutor();
+
+ /**
+ * flag indicating if dialogExecutor should try to acquire a permit
+ */
+ private volatile boolean dialogPause = true;
+
+ /**
+ * pause the queue
+ */
+ private java.util.concurrent.Semaphore block = new Semaphore(0);
+
+ /**
+ * add another dialog thread to the queue
+ *
+ * @param prompter
+ */
+ public void addDialogThread(final Runnable prompter)
+ {
+ dialogExecutor.submit(new Runnable()
+ {
+ public void run()
+ {
+ if (dialogPause)
+ {
+ try
+ {
+ block.acquire();
+ } catch (InterruptedException x)
+ {
+ }
+ ;
+ }
+ if (instance == null)
+ {
+ return;
+ }
+ try
+ {
+ SwingUtilities.invokeAndWait(prompter);
+ } catch (Exception q)
+ {
+ Cache.log.warn("Unexpected Exception in dialog thread.", q);
+ }
+ }
+ });
+ }
+
+ public void startDialogQueue()
+ {
+ // set the flag so we don't pause waiting for another permit and semaphore
+ // the current task to begin
+ dialogPause = false;
+ block.release();
+ }
+
+ @Override
+ protected void snapShotWindow_actionPerformed(ActionEvent e)
+ {
+ invalidate();
+ File of;
+ ImageMaker im = new jalview.util.ImageMaker(this, ImageMaker.TYPE.EPS,
+ "View of Desktop", getWidth(), getHeight(), of = new File(
+ "Jalview_snapshot" + System.currentTimeMillis()
+ + ".eps"), "View of desktop");
+ try
+ {
+ paintAll(im.getGraphics());
+ im.writeImage();
+ } catch (Exception q)
+ {
+ Cache.log.error("Couldn't write snapshot to " + of.getAbsolutePath(),
+ q);
+ return;
+ }
+ Cache.log.info("Successfully written snapshot to file "
+ + of.getAbsolutePath());
+ }
+
+ /**
+ * Explode the views in the given frame into separate AlignFrame windows.
+ *
+ * @param sf
+ */
+ public void explodeViews(SplitFrame sf)
+ {
+ AlignFrame oldTopFrame = (AlignFrame) sf.getTopFrame();
+ AlignFrame oldBottomFrame = (AlignFrame) sf.getBottomFrame();
+ List<? extends AlignmentViewPanel> topPanels = oldTopFrame
+ .getAlignPanels();
+ List<? extends AlignmentViewPanel> bottomPanels = oldBottomFrame
+ .getAlignPanels();
+ int viewCount = topPanels.size();
+ if (viewCount < 2)
+ {
+ return;
+ }
+
+ /*
+ * Processing in reverse order works, forwards order leaves the first panels
+ * not visible. I don't know why!
+ */
+ for (int i = viewCount - 1; i >= 0; i--)
+ {
+ /*
+ * Make new top and bottom frames. These take over the respective
+ * AlignmentPanel objects, including their AlignmentViewports, so the
+ * cdna/protein relationships between the viewports is carried over to the
+ * new split frames.
+ */
+ AlignmentPanel topPanel = (AlignmentPanel) topPanels.get(i);
+ AlignFrame newTopFrame = new AlignFrame(topPanel);
+ newTopFrame.setSize(new Dimension(AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT));
+ newTopFrame.setVisible(true);
+ AlignmentPanel bottomPanel = (AlignmentPanel) bottomPanels.get(i);
+ AlignFrame newBottomFrame = new AlignFrame(bottomPanel);
+ newBottomFrame.setSize(new Dimension(AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT));
+ newBottomFrame.setVisible(true);
+ topPanel.av.setGatherViewsHere(false);
+ bottomPanel.av.setGatherViewsHere(false);
+ JInternalFrame splitFrame = new SplitFrame(newTopFrame,
+ newBottomFrame);
+ // either panel may hold previous exploded frame geometry
+ Rectangle geometry = ((AlignViewport) topPanel.getAlignViewport())
+ .getExplodedGeometry();
+ if (geometry != null)
+ {
+ splitFrame.setBounds(geometry);
+ }
+ Desktop.addInternalFrame(splitFrame, sf.getTitle(), -1, -1);
+ }
+
+ /*
+ * Clear references to the panels (now relocated in the new SplitFrames)
+ * before closing the old SplitFrame.
+ */
+ topPanels.clear();
+ bottomPanels.clear();
+ sf.close();
+ }
+
+ /**
+ * Gather expanded split frames, sharing the same pairs of sequence set ids,
+ * back into the given SplitFrame as additional views. Note that the gathered
+ * frames may themselves have multiple views.
+ *
+ * @param source
+ */
+ public void gatherViews(GSplitFrame source)
+ {
+ AlignFrame myTopFrame = (AlignFrame) source.getTopFrame();
+ AlignFrame myBottomFrame = (AlignFrame) source.getBottomFrame();
+ myTopFrame.viewport.setExplodedGeometry(source.getBounds());
+ myBottomFrame.viewport.setExplodedGeometry(source.getBounds());
+ myTopFrame.viewport.setGatherViewsHere(true);
+ myBottomFrame.viewport.setGatherViewsHere(true);
+ String topViewId = myTopFrame.viewport.getSequenceSetId();
+ String bottomViewId = myBottomFrame.viewport.getSequenceSetId();
+
+ JInternalFrame[] frames = desktop.getAllFrames();
+ for (JInternalFrame frame : frames)
+ {
+ if (frame instanceof SplitFrame && frame != source)
+ {
+ SplitFrame sf = (SplitFrame) frame;
+ AlignFrame topFrame = (AlignFrame) sf.getTopFrame();
+ AlignFrame bottomFrame = (AlignFrame) sf.getBottomFrame();
+ boolean gatherThis = false;
+ for (int a = 0; a < topFrame.alignPanels.size(); a++)
+ {
+ AlignmentPanel topPanel = topFrame.alignPanels.get(a);
+ AlignmentPanel bottomPanel = bottomFrame.alignPanels.get(a);
+ if (topViewId.equals(topPanel.av.getSequenceSetId())
+ && bottomViewId.equals(bottomPanel.av.getSequenceSetId()))
+ {
+ gatherThis = true;
+ topPanel.av.setGatherViewsHere(false);
+ bottomPanel.av.setGatherViewsHere(false);
+ // both panels refer to the same split frame geometry
+ Rectangle position = sf.getBounds();
+ topPanel.av.setExplodedGeometry(position);
+ bottomPanel.av.setExplodedGeometry(position);
+ myTopFrame.addAlignmentPanel(topPanel, false);
+ myBottomFrame.addAlignmentPanel(bottomPanel, false);
+ }
+ }
+
+ if (gatherThis)
+ {
+ topFrame.getAlignPanels().clear();
+ bottomFrame.getAlignPanels().clear();
+ sf.close();
+ }
+ }
+ }
+
+ /*
+ * The dust settles...give focus to the tab we did this from.
+ */
+ myTopFrame.setDisplayedView(myTopFrame.alignPanel);
+
+ }
+
+ public static AlignFrame getCurrentAlignFrame()
+ {
+ return currentAlignFrame;
+ }
+
+ public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
+ {
+ Desktop.currentAlignFrame = currentAlignFrame;
+ }
}
diff --git a/src/jalview/gui/EPSOptions.java b/src/jalview/gui/EPSOptions.java
index 5b4e77a..73abeaf 100644
--- a/src/jalview/gui/EPSOptions.java
+++ b/src/jalview/gui/EPSOptions.java
@@ -1,25 +1,40 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
public class EPSOptions extends JPanel
{
@@ -44,8 +59,7 @@ public class EPSOptions extends JPanel
bg.add(text);
JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION,
- JOptionPane.DEFAULT_OPTION, null, new Object[]
- { this });
+ JOptionPane.DEFAULT_OPTION, null, new Object[] { this });
dialog = pane.createDialog(Desktop.desktop, "EPS Rendering options");
dialog.setVisible(true);
@@ -55,13 +69,13 @@ public class EPSOptions extends JPanel
private void jbInit() throws Exception
{
lineart.setFont(JvSwingUtils.getLabelFont());
- lineart.setText("Lineart");
+ lineart.setText(MessageManager.getString("label.lineart"));
text.setFont(JvSwingUtils.getLabelFont());
- text.setText("Text");
+ text.setText(MessageManager.getString("action.text"));
text.setSelected(true);
askAgain.setFont(JvSwingUtils.getLabelFont());
- askAgain.setText("Don\'t ask me again");
- ok.setText("OK");
+ askAgain.setText(MessageManager.getString("label.dont_ask_me_again"));
+ ok.setText(MessageManager.getString("action.ok"));
ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -69,7 +83,7 @@ public class EPSOptions extends JPanel
ok_actionPerformed(e);
}
});
- cancel.setText("Cancel");
+ cancel.setText(MessageManager.getString("action.cancel"));
cancel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -78,7 +92,8 @@ public class EPSOptions extends JPanel
}
});
jLabel1.setFont(JvSwingUtils.getLabelFont());
- jLabel1.setText("Select EPS character rendering style");
+ jLabel1.setText(MessageManager
+ .getString("label.select_eps_character_rendering_style"));
this.setLayout(borderLayout1);
jPanel3.setBorder(BorderFactory.createEtchedBorder());
jPanel2.add(text);
diff --git a/src/jalview/gui/EditNameDialog.java b/src/jalview/gui/EditNameDialog.java
index a9fedf6..8c67f6e 100644
--- a/src/jalview/gui/EditNameDialog.java
+++ b/src/jalview/gui/EditNameDialog.java
@@ -1,32 +1,44 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import javax.swing.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Font;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
public class EditNameDialog
{
JTextField id, description;
- JButton ok = new JButton("Accept");
+ JButton ok = new JButton(MessageManager.getString("action.accept"));
- JButton cancel = new JButton("Cancel");
+ JButton cancel = new JButton(MessageManager.getString("action.cancel"));
boolean accept = false;
diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java
index e5ea8fe..25527dc 100644
--- a/src/jalview/gui/FeatureColourChooser.java
+++ b/src/jalview/gui/FeatureColourChooser.java
@@ -1,33 +1,51 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.border.LineBorder;
-import javax.swing.event.*;
+import jalview.datamodel.GraphLine;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.GraduatedColor;
+import jalview.util.MessageManager;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Hashtable;
+
+import javax.swing.BorderFactory;
+import javax.swing.JCheckBox;
+import javax.swing.JColorChooser;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.JTextField;
+import javax.swing.border.LineBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
public class FeatureColourChooser extends JalviewDialog
{
@@ -75,7 +93,8 @@ public class FeatureColourChooser extends JalviewDialog
this.fr = frender;
this.type = type;
ap = fr.ap;
- initDialogFrame(this,true, block,"Graduated Feature Colour for " + type, 480, 185);
+ initDialogFrame(this, true, block, "Graduated Feature Colour for "
+ + type, 480, 185);
// frame.setLayer(JLayeredPane.PALETTE_LAYER);
// Desktop.addInternalFrame(frame, "Graduated Feature Colour for "+type,
// 480, 145);
@@ -103,10 +122,10 @@ public class FeatureColourChooser extends JalviewDialog
}
});
- float mm[] = ((float[][]) fr.minmax.get(type))[0];
+ float mm[] = ((float[][]) fr.getMinMax().get(type))[0];
min = mm[0];
max = mm[1];
- oldcs = fr.featureColours.get(type);
+ oldcs = fr.getFeatureColours().get(type);
if (oldcs instanceof GraduatedColor)
{
if (((GraduatedColor) oldcs).isAutoScale())
@@ -180,7 +199,7 @@ public class FeatureColourChooser extends JalviewDialog
minColour.setFont(JvSwingUtils.getLabelFont());
minColour.setBorder(BorderFactory.createLineBorder(Color.black));
minColour.setPreferredSize(new Dimension(40, 20));
- minColour.setToolTipText("Minimum Colour");
+ minColour.setToolTipText(MessageManager.getString("label.min_colour"));
minColour.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
@@ -194,7 +213,7 @@ public class FeatureColourChooser extends JalviewDialog
maxColour.setFont(JvSwingUtils.getLabelFont());
maxColour.setBorder(BorderFactory.createLineBorder(Color.black));
maxColour.setPreferredSize(new Dimension(40, 20));
- maxColour.setToolTipText("Maximum Colour");
+ maxColour.setToolTipText(MessageManager.getString("label.max_colour"));
maxColour.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
@@ -206,9 +225,9 @@ public class FeatureColourChooser extends JalviewDialog
}
});
maxColour.setBorder(new LineBorder(Color.black));
- minText.setText("Min:");
+ minText.setText(MessageManager.getString("label.min"));
minText.setFont(JvSwingUtils.getLabelFont());
- maxText.setText("Max:");
+ maxText.setText(MessageManager.getString("label.max"));
maxText.setFont(JvSwingUtils.getLabelFont());
this.setLayout(borderLayout1);
jPanel2.setLayout(flowLayout1);
@@ -221,10 +240,14 @@ public class FeatureColourChooser extends JalviewDialog
threshold_actionPerformed(e);
}
});
- threshold.setToolTipText("Threshold the feature display by score.");
- threshold.addItem("No Threshold"); // index 0
- threshold.addItem("Above Threshold"); // index 1
- threshold.addItem("Below Threshold"); // index 2
+ threshold.setToolTipText(MessageManager
+ .getString("label.threshold_feature_display_by_score"));
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_no_thereshold")); // index 0
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_above_thereshold")); // index 1
+ threshold.addItem(MessageManager
+ .getString("label.threshold_feature_below_thereshold")); // index 2
jPanel3.setLayout(flowLayout2);
thresholdValue.addActionListener(new ActionListener()
{
@@ -239,14 +262,16 @@ public class FeatureColourChooser extends JalviewDialog
slider.setEnabled(false);
slider.setOpaque(false);
slider.setPreferredSize(new Dimension(100, 32));
- slider.setToolTipText("Adjust threshold");
+ slider.setToolTipText(MessageManager
+ .getString("label.adjust_thereshold"));
thresholdValue.setEnabled(false);
thresholdValue.setColumns(7);
jPanel3.setBackground(Color.white);
thresholdIsMin.setBackground(Color.white);
- thresholdIsMin.setText("Threshold is Min/Max");
- thresholdIsMin
- .setToolTipText("Toggle between absolute and relative display threshold.");
+ thresholdIsMin.setText(MessageManager
+ .getString("label.threshold_minmax"));
+ thresholdIsMin.setToolTipText(MessageManager
+ .getString("label.toggle_absolute_relative_display_threshold"));
thresholdIsMin.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -255,9 +280,11 @@ public class FeatureColourChooser extends JalviewDialog
}
});
colourByLabel.setBackground(Color.white);
- colourByLabel.setText("Colour by Label");
colourByLabel
- .setToolTipText("Display features of the same type with a different label using a different colour. (e.g. domain features)");
+ .setText(MessageManager.getString("label.colour_by_label"));
+ colourByLabel
+ .setToolTipText(MessageManager
+ .getString("label.display_features_same_type_different_label_using_different_colour"));
colourByLabel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -327,7 +354,8 @@ public class FeatureColourChooser extends JalviewDialog
public void minColour_actionPerformed()
{
Color col = JColorChooser.showDialog(this,
- "Select Colour for Minimum Value", minColour.getBackground());
+ MessageManager.getString("label.select_colour_minimum_value"),
+ minColour.getBackground());
if (col != null)
{
minColour.setBackground(col);
@@ -340,7 +368,8 @@ public class FeatureColourChooser extends JalviewDialog
public void maxColour_actionPerformed()
{
Color col = JColorChooser.showDialog(this,
- "Select Colour for Maximum Value", maxColour.getBackground());
+ MessageManager.getString("label.select_colour_maximum_value"),
+ maxColour.getBackground());
if (col != null)
{
maxColour.setBackground(col);
@@ -359,11 +388,11 @@ public class FeatureColourChooser extends JalviewDialog
}
int aboveThreshold = AnnotationColourGradient.NO_THRESHOLD;
- if (threshold.getSelectedItem().equals("Above Threshold"))
+ if (threshold.getSelectedIndex() == 1)
{
aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD;
}
- else if (threshold.getSelectedItem().equals("Below Threshold"))
+ else if (threshold.getSelectedIndex() == 2)
{
aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;
}
@@ -454,7 +483,7 @@ public class FeatureColourChooser extends JalviewDialog
maxColour.setForeground(oldmaxColour);
minColour.setForeground(oldminColour);
}
- fr.featureColours.put(type, acg);
+ fr.setColour(type, acg);
cs = acg;
ap.paintAlignment(false);
}
@@ -472,7 +501,6 @@ public class FeatureColourChooser extends JalviewDialog
changeColour();
}
-
public void cancelPressed()
{
reset();
@@ -480,7 +508,7 @@ public class FeatureColourChooser extends JalviewDialog
void reset()
{
- fr.featureColours.put(type, oldcs);
+ fr.setColour(type, oldcs);
ap.paintAlignment(false);
cs = null;
}
diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java
index 0679873..89e94c8 100644
--- a/src/jalview/gui/FeatureRenderer.java
+++ b/src/jalview/gui/FeatureRenderer.java
@@ -1,34 +1,53 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-import javax.swing.*;
-
-import jalview.datamodel.*;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
import jalview.schemes.GraduatedColor;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JColorChooser;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSpinner;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
/**
* DOCUMENT ME!
@@ -36,38 +55,13 @@ import jalview.schemes.GraduatedColor;
* @author $author$
* @version $Revision$
*/
-public class FeatureRenderer implements jalview.api.FeatureRenderer
+public class FeatureRenderer extends
+ jalview.renderer.seqfeatures.FeatureRenderer implements
+ jalview.api.FeatureRenderer
{
- AlignmentPanel ap;
-
- AlignViewport av;
-
Color resBoxColour;
- /**
- * global transparency for feature
- */
- float transparency = 1.0f;
-
- FontMetrics fm;
-
- int charOffset;
-
- Hashtable featureColours = new Hashtable();
-
- // A higher level for grouping features of a
- // particular type
- Hashtable featureGroups = new Hashtable();
-
- // This is actually an Integer held in the hashtable,
- // Retrieved using the key feature type
- Object currentColour;
-
- String[] renderOrder;
-
- PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
-
- Vector allfeatures;
+ AlignmentPanel ap;
/**
* Creates a new FeatureRenderer object.
@@ -77,889 +71,14 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
*/
public FeatureRenderer(AlignmentPanel ap)
{
+ super();
this.ap = ap;
this.av = ap.av;
- }
-
- public class FeatureRendererSettings implements Cloneable
- {
- String[] renderOrder;
-
- Hashtable featureGroups;
-
- Hashtable featureColours;
-
- float transparency;
-
- Hashtable featureOrder;
-
- public FeatureRendererSettings(String[] renderOrder,
- Hashtable featureGroups, Hashtable featureColours,
- float transparency, Hashtable featureOrder)
- {
- super();
- this.renderOrder = renderOrder;
- this.featureGroups = featureGroups;
- this.featureColours = featureColours;
- this.transparency = transparency;
- this.featureOrder = featureOrder;
- }
-
- /**
- * create an independent instance of the feature renderer settings
- *
- * @param fr
- */
- public FeatureRendererSettings(FeatureRenderer fr)
- {
- renderOrder = null;
- featureGroups = new Hashtable();
- featureColours = new Hashtable();
- featureOrder = new Hashtable();
- if (fr.renderOrder != null)
- {
- this.renderOrder = new String[fr.renderOrder.length];
- System.arraycopy(fr.renderOrder, 0, renderOrder, 0,
- renderOrder.length);
- }
- if (fr.featureGroups != null)
- {
- this.featureGroups = new Hashtable(fr.featureGroups);
- }
- if (fr.featureColours != null)
- {
- this.featureColours = new Hashtable(fr.featureColours);
- }
- Enumeration en = fr.featureColours.keys();
- while (en.hasMoreElements())
- {
- Object next = en.nextElement();
- Object val = featureColours.get(next);
- if (val instanceof GraduatedColor)
- {
- featureColours
- .put(next, new GraduatedColor((GraduatedColor) val));
- }
- }
- this.transparency = fr.transparency;
- if (fr.featureOrder != null)
- {
- this.featureOrder = new Hashtable(fr.featureOrder);
- }
- }
- }
-
- public FeatureRendererSettings getSettings()
- {
- return new FeatureRendererSettings(this);
- }
-
- public void transferSettings(FeatureRendererSettings fr)
- {
- this.renderOrder = fr.renderOrder;
- this.featureGroups = fr.featureGroups;
- this.featureColours = fr.featureColours;
- this.transparency = fr.transparency;
- this.featureOrder = fr.featureOrder;
- }
-
- public void transferSettings(FeatureRenderer fr)
- {
- FeatureRendererSettings frs = new FeatureRendererSettings(fr);
- this.renderOrder = frs.renderOrder;
- this.featureGroups = frs.featureGroups;
- this.featureColours = frs.featureColours;
- this.transparency = frs.transparency;
- this.featureOrder = frs.featureOrder;
- if (av != null && av!=fr.av)
- {
- // copy over the displayed feature settings
- if (fr.av != null)
- {
- if (fr.av.featuresDisplayed != null)
- {
- // update display settings
- if (av.featuresDisplayed == null)
- {
- av.featuresDisplayed = new Hashtable(fr.av.featuresDisplayed);
- }
- else
- {
- av.featuresDisplayed.clear();
- Enumeration en = fr.av.featuresDisplayed.keys();
- while (en.hasMoreElements())
- {
- av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE);
- }
-
- }
- }
- }
- }
- }
-
- BufferedImage offscreenImage;
-
- boolean offscreenRender = false;
-
- public Color findFeatureColour(Color initialCol, SequenceI seq, int res)
- {
- return new Color(findFeatureColour(initialCol.getRGB(), seq, res));
- }
-
- /**
- * This is used by the Molecule Viewer and Overview to get the accurate
- * colourof the rendered sequence
- */
- public synchronized int findFeatureColour(int initialCol, SequenceI seq, int column)
- {
- if (!av.showSequenceFeatures)
- {
- return initialCol;
- }
-
- if (seq != lastSeq)
- {
- lastSeq = seq;
- sequenceFeatures = lastSeq.getDatasetSequence().getSequenceFeatures();
- if (sequenceFeatures != null)
- {
- sfSize = sequenceFeatures.length;
- }
- }
-
- if (sequenceFeatures != lastSeq.getDatasetSequence()
- .getSequenceFeatures())
- {
- sequenceFeatures = lastSeq.getDatasetSequence().getSequenceFeatures();
- if (sequenceFeatures != null)
- {
- sfSize = sequenceFeatures.length;
- }
- }
-
- if (sequenceFeatures == null || sfSize == 0)
- {
- return initialCol;
- }
-
- if (jalview.util.Comparison.isGap(lastSeq.getCharAt(column)))
- {
- return Color.white.getRGB();
- }
-
- // Only bother making an offscreen image if transparency is applied
- if (transparency != 1.0f && offscreenImage == null)
- {
- offscreenImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
- }
-
- currentColour = null;
- // TODO: non-threadsafe - each rendering thread needs its own instance of the feature renderer - or this should be synchronized.
- offscreenRender = true;
-
- if (offscreenImage != null)
- {
- offscreenImage.setRGB(0, 0, initialCol);
- drawSequence(offscreenImage.getGraphics(), lastSeq, column, column, 0);
-
- return offscreenImage.getRGB(0, 0);
- }
- else
- {
- drawSequence(null, lastSeq, lastSeq.findPosition(column), -1, -1);
-
- if (currentColour == null)
- {
- return initialCol;
- }
- else
- {
- return ((Integer) currentColour).intValue();
- }
- }
-
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param g
- * DOCUMENT ME!
- * @param seq
- * DOCUMENT ME!
- * @param sg
- * DOCUMENT ME!
- * @param start
- * DOCUMENT ME!
- * @param end
- * DOCUMENT ME!
- * @param x1
- * DOCUMENT ME!
- * @param y1
- * DOCUMENT ME!
- * @param width
- * DOCUMENT ME!
- * @param height
- * DOCUMENT ME!
- */
- // String type;
- // SequenceFeature sf;
- SequenceI lastSeq;
-
- SequenceFeature[] sequenceFeatures;
-
- int sfSize, sfindex, spos, epos;
-
- /**
- * show scores as heights
- */
- protected boolean varyHeight = false;
-
- synchronized public void drawSequence(Graphics g, SequenceI seq,
- int start, int end, int y1)
- {
-
- if (seq.getDatasetSequence().getSequenceFeatures() == null
- || seq.getDatasetSequence().getSequenceFeatures().length == 0)
- {
- return;
- }
-
- if (g != null)
- {
- fm = g.getFontMetrics();
- }
-
- if (av.featuresDisplayed == null || renderOrder == null
- || newFeatureAdded)
- {
- findAllFeatures();
- if (av.featuresDisplayed.size() < 1)
- {
- return;
- }
-
- sequenceFeatures = seq.getDatasetSequence().getSequenceFeatures();
- }
-
- if (lastSeq == null
- || seq != lastSeq
- || seq.getDatasetSequence().getSequenceFeatures() != sequenceFeatures)
- {
- lastSeq = seq;
- sequenceFeatures = seq.getDatasetSequence().getSequenceFeatures();
- }
-
- if (transparency != 1 && g != null)
- {
- Graphics2D g2 = (Graphics2D) g;
- g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
- transparency));
- }
-
- if (!offscreenRender)
- {
- spos = lastSeq.findPosition(start);
- epos = lastSeq.findPosition(end);
- }
-
- sfSize = sequenceFeatures.length;
- String type;
- for (int renderIndex = 0; renderIndex < renderOrder.length; renderIndex++)
- {
- type = renderOrder[renderIndex];
-
- if (type == null || !av.featuresDisplayed.containsKey(type))
- {
- continue;
- }
-
- // loop through all features in sequence to find
- // current feature to render
- for (sfindex = 0; sfindex < sfSize; sfindex++)
- {
- if (!sequenceFeatures[sfindex].type.equals(type))
- {
- continue;
- }
-
- if (featureGroups != null
- && sequenceFeatures[sfindex].featureGroup != null
- && sequenceFeatures[sfindex].featureGroup.length() != 0
- && featureGroups
- .containsKey(sequenceFeatures[sfindex].featureGroup)
- && !((Boolean) featureGroups
- .get(sequenceFeatures[sfindex].featureGroup))
- .booleanValue())
- {
- continue;
- }
-
- if (!offscreenRender
- && (sequenceFeatures[sfindex].getBegin() > epos || sequenceFeatures[sfindex]
- .getEnd() < spos))
- {
- continue;
- }
-
- if (offscreenRender && offscreenImage == null)
- {
- if (sequenceFeatures[sfindex].begin <= start
- && sequenceFeatures[sfindex].end >= start)
- {
- // this is passed out to the overview and other sequence renderers
- // (e.g. molecule viewer) to get displayed colour for rendered
- // sequence
- currentColour = new Integer(
- getColour(sequenceFeatures[sfindex]).getRGB());
- // used to be retreived from av.featuresDisplayed
- // currentColour = av.featuresDisplayed
- // .get(sequenceFeatures[sfindex].type);
-
- }
- }
- else if (sequenceFeatures[sfindex].type.equals("disulfide bond"))
- {
-
- renderFeature(g, seq,
- seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
- seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
- getColour(sequenceFeatures[sfindex])
- // new Color(((Integer) av.featuresDisplayed
- // .get(sequenceFeatures[sfindex].type)).intValue())
- , start, end, y1);
- renderFeature(g, seq,
- seq.findIndex(sequenceFeatures[sfindex].end) - 1,
- seq.findIndex(sequenceFeatures[sfindex].end) - 1,
- getColour(sequenceFeatures[sfindex])
- // new Color(((Integer) av.featuresDisplayed
- // .get(sequenceFeatures[sfindex].type)).intValue())
- , start, end, y1);
-
- }
- else if (showFeature(sequenceFeatures[sfindex]))
- {
- if (av.showSeqFeaturesHeight
- && sequenceFeatures[sfindex].score != Float.NaN)
- {
- renderScoreFeature(g, seq,
- seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
- seq.findIndex(sequenceFeatures[sfindex].end) - 1,
- getColour(sequenceFeatures[sfindex]), start, end, y1,
- normaliseScore(sequenceFeatures[sfindex]));
- }
- else
- {
- renderFeature(g, seq,
- seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
- seq.findIndex(sequenceFeatures[sfindex].end) - 1,
- getColour(sequenceFeatures[sfindex]), start, end, y1);
- }
- }
-
- }
-
- }
-
- if (transparency != 1.0f && g != null)
- {
- Graphics2D g2 = (Graphics2D) g;
- g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
- 1.0f));
- }
- }
-
- Hashtable minmax = new Hashtable();
-
- /**
- * normalise a score against the max/min bounds for the feature type.
- *
- * @param sequenceFeature
- * @return byte[] { signed, normalised signed (-127 to 127) or unsigned
- * (0-255) value.
- */
- private final byte[] normaliseScore(SequenceFeature sequenceFeature)
- {
- float[] mm = ((float[][]) minmax.get(sequenceFeature.type))[0];
- final byte[] r = new byte[]
- { 0, (byte) 255 };
- if (mm != null)
- {
- if (r[0] != 0 || mm[0] < 0.0)
- {
- r[0] = 1;
- r[1] = (byte) ((int) 128.0 + 127.0 * (sequenceFeature.score / mm[1]));
- }
- else
- {
- r[1] = (byte) ((int) 255.0 * (sequenceFeature.score / mm[1]));
- }
- }
- return r;
- }
-
- char s;
-
- int i;
-
- void renderFeature(Graphics g, SequenceI seq, int fstart, int fend,
- Color featureColour, int start, int end, int y1)
- {
-
- if (((fstart <= end) && (fend >= start)))
- {
- if (fstart < start)
- { // fix for if the feature we have starts before the sequence start,
- fstart = start; // but the feature end is still valid!!
- }
-
- if (fend >= end)
- {
- fend = end;
- }
- int pady = (y1 + av.charHeight) - av.charHeight / 5;
- for (i = fstart; i <= fend; i++)
- {
- s = seq.getCharAt(i);
-
- if (jalview.util.Comparison.isGap(s))
- {
- continue;
- }
-
- g.setColor(featureColour);
-
- g.fillRect((i - start) * av.charWidth, y1, av.charWidth,
- av.charHeight);
-
- if (offscreenRender || !av.validCharWidth)
- {
- continue;
- }
-
- g.setColor(Color.white);
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
- g.drawString(String.valueOf(s), charOffset
- + (av.charWidth * (i - start)), pady);
-
- }
- }
- }
-
- void renderScoreFeature(Graphics g, SequenceI seq, int fstart, int fend,
- Color featureColour, int start, int end, int y1, byte[] bs)
- {
-
- if (((fstart <= end) && (fend >= start)))
- {
- if (fstart < start)
- { // fix for if the feature we have starts before the sequence start,
- fstart = start; // but the feature end is still valid!!
- }
-
- if (fend >= end)
- {
- fend = end;
- }
- int pady = (y1 + av.charHeight) - av.charHeight / 5;
- int ystrt = 0, yend = av.charHeight;
- if (bs[0] != 0)
- {
- // signed - zero is always middle of residue line.
- if (bs[1] < 128)
- {
- yend = av.charHeight * (128 - bs[1]) / 512;
- ystrt = av.charHeight - yend / 2;
- }
- else
- {
- ystrt = av.charHeight / 2;
- yend = av.charHeight * (bs[1] - 128) / 512;
- }
- }
- else
- {
- yend = av.charHeight * bs[1] / 255;
- ystrt = av.charHeight - yend;
-
- }
- for (i = fstart; i <= fend; i++)
- {
- s = seq.getCharAt(i);
-
- if (jalview.util.Comparison.isGap(s))
- {
- continue;
- }
-
- g.setColor(featureColour);
- int x = (i - start) * av.charWidth;
- g.drawRect(x, y1, av.charWidth, av.charHeight);
- g.fillRect(x, y1 + ystrt, av.charWidth, yend);
-
- if (offscreenRender || !av.validCharWidth)
- {
- continue;
- }
-
- g.setColor(Color.black);
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
- g.drawString(String.valueOf(s), charOffset
- + (av.charWidth * (i - start)), pady);
-
- }
- }
- }
-
- boolean newFeatureAdded = false;
-
- /**
- * Called when alignment in associated view has new/modified features to
- * discover and display.
- *
- */
- public void featuresAdded()
- {
- lastSeq = null;
- findAllFeatures();
- }
-
- boolean findingFeatures = false;
-
- /**
- * search the alignment for all new features, give them a colour and display
- * them. Then fires a PropertyChangeEvent on the changeSupport object.
- *
- */
- void findAllFeatures()
- {
- synchronized (firing)
+ if (ap != null && ap.getSeqPanel() != null
+ && ap.getSeqPanel().seqCanvas != null
+ && ap.getSeqPanel().seqCanvas.fr != null)
{
- if (firing.equals(Boolean.FALSE))
- {
- firing = Boolean.TRUE;
- findAllFeatures(true); // add all new features as visible
- changeSupport.firePropertyChange("changeSupport", null, null);
- firing = Boolean.FALSE;
- }
- }
- }
-
- /**
- * Searches alignment for all features and updates colours
- *
- * @param newMadeVisible
- * if true newly added feature types will be rendered immediatly
- */
- synchronized void findAllFeatures(boolean newMadeVisible)
- {
- newFeatureAdded = false;
-
- if (findingFeatures)
- {
- newFeatureAdded = true;
- return;
- }
-
- findingFeatures = true;
-
- if (av.featuresDisplayed == null)
- {
- av.featuresDisplayed = new Hashtable();
- }
-
- allfeatures = new Vector();
- Vector oldfeatures = new Vector();
- if (renderOrder != null)
- {
- for (int i = 0; i < renderOrder.length; i++)
- {
- if (renderOrder[i] != null)
- {
- oldfeatures.addElement(renderOrder[i]);
- }
- }
- }
- if (minmax == null)
- {
- minmax = new Hashtable();
- }
- for (int i = 0; i < av.alignment.getHeight(); i++)
- {
- SequenceFeature[] features = av.alignment.getSequenceAt(i)
- .getDatasetSequence().getSequenceFeatures();
-
- if (features == null)
- {
- continue;
- }
-
- int index = 0;
- while (index < features.length)
- {
- if (!av.featuresDisplayed.containsKey(features[index].getType()))
- {
-
- if (featureGroups.containsKey(features[index].getType()))
- {
- boolean visible = ((Boolean) featureGroups
- .get(features[index].featureGroup)).booleanValue();
-
- if (!visible)
- {
- index++;
- continue;
- }
- }
-
- if (!(features[index].begin == 0 && features[index].end == 0))
- {
- // If beginning and end are 0, the feature is for the whole sequence
- // and we don't want to render the feature in the normal way
-
- if (newMadeVisible
- && !oldfeatures.contains(features[index].getType()))
- {
- // this is a new feature type on the alignment. Mark it for
- // display.
- av.featuresDisplayed.put(features[index].getType(),
- new Integer(getColour(features[index].getType())
- .getRGB()));
- setOrder(features[index].getType(), 0);
- }
- }
- }
- if (!allfeatures.contains(features[index].getType()))
- {
- allfeatures.addElement(features[index].getType());
- }
- if (features[index].score != Float.NaN)
- {
- int nonpos = features[index].getBegin() >= 1 ? 0 : 1;
- float[][] mm = (float[][]) minmax.get(features[index].getType());
- if (mm == null)
- {
- mm = new float[][]
- { null, null };
- minmax.put(features[index].getType(), mm);
- }
- if (mm[nonpos] == null)
- {
- mm[nonpos] = new float[]
- { features[index].score, features[index].score };
-
- }
- else
- {
- if (mm[nonpos][0] > features[index].score)
- {
- mm[nonpos][0] = features[index].score;
- }
- if (mm[nonpos][1] < features[index].score)
- {
- mm[nonpos][1] = features[index].score;
- }
- }
- }
- index++;
- }
- }
- updateRenderOrder(allfeatures);
- findingFeatures = false;
- }
-
- protected Boolean firing = Boolean.FALSE;
-
- /**
- * replaces the current renderOrder with the unordered features in
- * allfeatures. The ordering of any types in both renderOrder and allfeatures
- * is preserved, and all new feature types are rendered on top of the existing
- * types, in the order given by getOrder or the order given in allFeatures.
- * Note. this operates directly on the featureOrder hash for efficiency. TODO:
- * eliminate the float storage for computing/recalling the persistent ordering
- * New Cability: updates min/max for colourscheme range if its dynamic
- *
- * @param allFeatures
- */
- private void updateRenderOrder(Vector allFeatures)
- {
- Vector allfeatures = new Vector(allFeatures);
- String[] oldRender = renderOrder;
- renderOrder = new String[allfeatures.size()];
- Object mmrange, fc = null;
- boolean initOrders = (featureOrder == null);
- int opos = 0;
- if (oldRender != null && oldRender.length > 0)
- {
- for (int j = 0; j < oldRender.length; j++)
- {
- if (oldRender[j] != null)
- {
- if (initOrders)
- {
- setOrder(oldRender[j], (1 - (1 + (float) j)
- / (float) oldRender.length));
- }
- if (allfeatures.contains(oldRender[j]))
- {
- renderOrder[opos++] = oldRender[j]; // existing features always
- // appear below new features
- allfeatures.removeElement(oldRender[j]);
- if (minmax != null)
- {
- mmrange = minmax.get(oldRender[j]);
- if (mmrange != null)
- {
- fc = featureColours.get(oldRender[j]);
- if (fc != null && fc instanceof GraduatedColor
- && ((GraduatedColor) fc).isAutoScale())
- {
- ((GraduatedColor) fc).updateBounds(
- ((float[][]) mmrange)[0][0],
- ((float[][]) mmrange)[0][1]);
- }
- }
- }
- }
- }
- }
- }
- if (allfeatures.size() == 0)
- {
- // no new features - leave order unchanged.
- return;
- }
- int i = allfeatures.size() - 1;
- int iSize = i;
- boolean sort = false;
- String[] newf = new String[allfeatures.size()];
- float[] sortOrder = new float[allfeatures.size()];
- Enumeration en = allfeatures.elements();
- // sort remaining elements
- while (en.hasMoreElements())
- {
- newf[i] = en.nextElement().toString();
- if (minmax != null)
- {
- // update from new features minmax if necessary
- mmrange = minmax.get(newf[i]);
- if (mmrange != null)
- {
- fc = featureColours.get(newf[i]);
- if (fc != null && fc instanceof GraduatedColor
- && ((GraduatedColor) fc).isAutoScale())
- {
- ((GraduatedColor) fc).updateBounds(((float[][]) mmrange)[0][0],
- ((float[][]) mmrange)[0][1]);
- }
- }
- }
- if (initOrders || !featureOrder.containsKey(newf[i]))
- {
- int denom = initOrders ? allfeatures.size() : featureOrder.size();
- // new unordered feature - compute persistent ordering at head of
- // existing features.
- setOrder(newf[i], i / (float) denom);
- }
- // set order from newly found feature from persisted ordering.
- sortOrder[i] = 2 - ((Float) featureOrder.get(newf[i])).floatValue();
- if (i < iSize)
- {
- // only sort if we need to
- sort = sort || sortOrder[i] > sortOrder[i + 1];
- }
- i--;
- }
- if (iSize > 1 && sort)
- {
- jalview.util.QuickSort.sort(sortOrder, newf);
- }
- sortOrder = null;
- System.arraycopy(newf, 0, renderOrder, opos, newf.length);
- }
-
- /**
- * get a feature style object for the given type string. Creates a
- * java.awt.Color for a featureType with no existing colourscheme. TODO:
- * replace return type with object implementing standard abstract colour/style
- * interface
- *
- * @param featureType
- * @return java.awt.Color or GraduatedColor
- */
- public Object getFeatureStyle(String featureType)
- {
- Object fc = featureColours.get(featureType);
- if (fc == null)
- {
- jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme();
- Color col = ucs.createColourFromName(featureType);
- featureColours.put(featureType, fc = col);
- }
- return fc;
- }
-
- /**
- * return a nominal colour for this feature
- *
- * @param featureType
- * @return standard color, or maximum colour for graduated colourscheme
- */
- public Color getColour(String featureType)
- {
- Object fc = getFeatureStyle(featureType);
-
- if (fc instanceof Color)
- {
- return (Color) fc;
- }
- else
- {
- if (fc instanceof GraduatedColor)
- {
- return ((GraduatedColor) fc).getMaxColor();
- }
- }
- throw new Error("Implementation Error: Unrecognised render object "
- + fc.getClass() + " for features of type " + featureType);
- }
-
- /**
- * calculate the render colour for a specific feature using current feature
- * settings.
- *
- * @param feature
- * @return render colour for the given feature
- */
- public Color getColour(SequenceFeature feature)
- {
- Object fc = getFeatureStyle(feature.getType());
- if (fc instanceof Color)
- {
- return (Color) fc;
- }
- else
- {
- if (fc instanceof GraduatedColor)
- {
- return ((GraduatedColor) fc).findColor(feature);
- }
- }
- throw new Error("Implementation Error: Unrecognised render object "
- + fc.getClass() + " for features of type " + feature.getType());
- }
-
- private boolean showFeature(SequenceFeature sequenceFeature)
- {
- Object fc = getFeatureStyle(sequenceFeature.type);
- if (fc instanceof GraduatedColor)
- {
- return ((GraduatedColor) fc).isColored(sequenceFeature);
- }
- else
- {
- return true;
+ transferSettings(ap.getSeqPanel().seqCanvas.fr);
}
}
@@ -1007,7 +126,8 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
if (fcol instanceof Color)
{
Color col = JColorChooser.showDialog(Desktop.desktop,
- "Select Feature Colour", ((Color) fcol));
+ MessageManager.getString("label.select_feature_colour"),
+ ((Color) fcol));
if (col != null)
{
fcol = col;
@@ -1049,7 +169,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
{
panel = new JPanel(new GridLayout(4, 1));
tmp = new JPanel();
- tmp.add(new JLabel("Select Feature: "));
+ tmp.add(new JLabel(MessageManager.getString("label.select_feature")));
overlaps = new JComboBox();
for (int i = 0; i < features.length; i++)
{
@@ -1078,7 +198,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
highlight.addResult(sequences[0], features[index].getBegin(),
features[index].getEnd());
- ap.seqPanel.seqCanvas.highlightSearchResults(highlight);
+ ap.getSeqPanel().seqCanvas.highlightSearchResults(highlight);
}
Object col = getFeatureStyle(name.getText());
@@ -1099,17 +219,19 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
tmp = new JPanel();
panel.add(tmp);
- tmp.add(new JLabel("Name: ", JLabel.RIGHT));
+ tmp.add(new JLabel(MessageManager.getString("label.name"), JLabel.RIGHT));
tmp.add(name);
tmp = new JPanel();
panel.add(tmp);
- tmp.add(new JLabel("Group: ", JLabel.RIGHT));
+ tmp.add(new JLabel(MessageManager.getString("label.group") + ":",
+ JLabel.RIGHT));
tmp.add(source);
tmp = new JPanel();
panel.add(tmp);
- tmp.add(new JLabel("Colour: ", JLabel.RIGHT));
+ tmp.add(new JLabel(MessageManager.getString("label.colour"),
+ JLabel.RIGHT));
tmp.add(colour);
colour.setPreferredSize(new Dimension(150, 15));
colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 9));
@@ -1121,7 +243,8 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
bigPanel.add(panel, BorderLayout.NORTH);
panel = new JPanel();
- panel.add(new JLabel("Description: ", JLabel.RIGHT));
+ panel.add(new JLabel(MessageManager.getString("label.description"),
+ JLabel.RIGHT));
description.setFont(JvSwingUtils.getTextAreaFont());
description.setLineWrap(true);
panel.add(new JScrollPane(description));
@@ -1131,9 +254,11 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
bigPanel.add(panel, BorderLayout.SOUTH);
panel = new JPanel();
- panel.add(new JLabel(" Start:", JLabel.RIGHT));
+ panel.add(new JLabel(MessageManager.getString("label.start"),
+ JLabel.RIGHT));
panel.add(start);
- panel.add(new JLabel(" End:", JLabel.RIGHT));
+ panel.add(new JLabel(MessageManager.getString("label.end"),
+ JLabel.RIGHT));
panel.add(end);
bigPanel.add(panel, BorderLayout.CENTER);
}
@@ -1185,21 +310,22 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
Object[] options;
if (!newFeatures)
{
- options = new Object[]
- { "Amend", "Delete", "Cancel" };
+ options = new Object[] { "Amend", "Delete", "Cancel" };
}
else
{
- options = new Object[]
- { "OK", "Cancel" };
+ options = new Object[] { "OK", "Cancel" };
}
- String title = newFeatures ? "Create New Sequence Feature(s)"
- : "Amend/Delete Features for " + sequences[0].getName();
+ String title = newFeatures ? MessageManager
+ .getString("label.create_new_sequence_features")
+ : MessageManager.formatMessage("label.amend_delete_features",
+ new String[] { sequences[0].getName() });
int reply = JOptionPane.showInternalOptionDialog(Desktop.desktop,
bigPanel, title, JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE, null, options, "OK");
+ JOptionPane.QUESTION_MESSAGE, null, options,
+ MessageManager.getString("action.ok"));
jalview.io.FeaturesFile ffile = new jalview.io.FeaturesFile();
@@ -1213,7 +339,9 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
lastDescriptionAdded = description.getText().replaceAll("\n", " ");
// TODO: determine if the null feature group is valid
if (lastFeatureGroupAdded.length() < 1)
+ {
lastFeatureGroupAdded = null;
+ }
}
if (!newFeatures)
@@ -1231,7 +359,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
sf.description = lastDescriptionAdded;
setColour(sf.type, fcol);
- av.featuresDisplayed.put(sf.type, getColour(sf.type));
+ getFeaturesDisplayed().setVisible(sf.type);
try
{
@@ -1252,27 +380,19 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
for (int i = 0; i < sequences.length; i++)
{
features[i].type = lastFeatureAdded;
- if (lastFeatureGroupAdded != null)
- features[i].featureGroup = lastFeatureGroupAdded;
+ // fix for JAL-1538 - always set feature group here
+ features[i].featureGroup = lastFeatureGroupAdded;
features[i].description = lastDescriptionAdded;
sequences[i].addSequenceFeature(features[i]);
ffile.parseDescriptionHTML(features[i], false);
}
- if (av.featuresDisplayed == null)
- {
- av.featuresDisplayed = new Hashtable();
- }
-
if (lastFeatureGroupAdded != null)
{
- if (featureGroups == null)
- featureGroups = new Hashtable();
- featureGroups.put(lastFeatureGroupAdded, new Boolean(true));
+ setGroupVisibility(lastFeatureGroupAdded, true);
}
setColour(lastFeatureAdded, fcol);
- av.featuresDisplayed.put(lastFeatureAdded,
- getColour(lastFeatureAdded));
+ setVisible(lastFeatureAdded);
findAllFeatures(false);
@@ -1318,145 +438,4 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
// colour.setForeground(colour.getBackground());
}
}
-
- public void setColour(String featureType, Object col)
- {
- // overwrite
- // Color _col = (col instanceof Color) ? ((Color) col) : (col instanceof
- // GraduatedColor) ? ((GraduatedColor) col).getMaxColor() : null;
- // Object c = featureColours.get(featureType);
- // if (c == null || c instanceof Color || (c instanceof GraduatedColor &&
- // !((GraduatedColor)c).getMaxColor().equals(_col)))
- {
- featureColours.put(featureType, col);
- }
- }
-
- public void setTransparency(float value)
- {
- transparency = value;
- }
-
- public float getTransparency()
- {
- return transparency;
- }
-
- /**
- * Replace current ordering with new ordering
- *
- * @param data
- * { String(Type), Colour(Type), Boolean(Displayed) }
- */
- public void setFeaturePriority(Object[][] data)
- {
- setFeaturePriority(data, true);
- }
-
- /**
- *
- * @param data
- * { String(Type), Colour(Type), Boolean(Displayed) }
- * @param visibleNew
- * when true current featureDisplay list will be cleared
- */
- public void setFeaturePriority(Object[][] data, boolean visibleNew)
- {
- if (visibleNew)
- {
- if (av.featuresDisplayed != null)
- {
- av.featuresDisplayed.clear();
- }
- else
- {
- av.featuresDisplayed = new Hashtable();
- }
- }
- if (data == null)
- {
- return;
- }
-
- // The feature table will display high priority
- // features at the top, but theses are the ones
- // we need to render last, so invert the data
- renderOrder = new String[data.length];
-
- if (data.length > 0)
- {
- for (int i = 0; i < data.length; i++)
- {
- String type = data[i][0].toString();
- setColour(type, data[i][1]); // todo : typesafety - feature color
- // interface object
- if (((Boolean) data[i][2]).booleanValue())
- {
- av.featuresDisplayed.put(type, new Integer(getColour(type)
- .getRGB()));
- }
-
- renderOrder[data.length - i - 1] = type;
- }
- }
-
- }
-
- Hashtable featureOrder = null;
-
- /**
- * analogous to colour - store a normalized ordering for all feature types in
- * this rendering context.
- *
- * @param type
- * Feature type string
- * @param position
- * normalized priority - 0 means always appears on top, 1 means
- * always last.
- */
- public float setOrder(String type, float position)
- {
- if (featureOrder == null)
- {
- featureOrder = new Hashtable();
- }
- featureOrder.put(type, new Float(position));
- return position;
- }
-
- /**
- * get the global priority (0 (top) to 1 (bottom))
- *
- * @param type
- * @return [0,1] or -1 for a type without a priority
- */
- public float getOrder(String type)
- {
- if (featureOrder != null)
- {
- if (featureOrder.containsKey(type))
- {
- return ((Float) featureOrder.get(type)).floatValue();
- }
- }
- return -1;
- }
-
- /**
- * @param listener
- * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
- */
- public void addPropertyChangeListener(PropertyChangeListener listener)
- {
- changeSupport.addPropertyChangeListener(listener);
- }
-
- /**
- * @param listener
- * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
- */
- public void removePropertyChangeListener(PropertyChangeListener listener)
- {
- changeSupport.removePropertyChangeListener(listener);
- }
}
diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java
index fae5259..a2d0559 100644
--- a/src/jalview/gui/FeatureSettings.java
+++ b/src/jalview/gui/FeatureSettings.java
@@ -1,45 +1,96 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.io.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.table.*;
-
-import jalview.analysis.AlignmentSorter;
+import jalview.api.FeatureSettingsControllerI;
import jalview.bin.Cache;
-import jalview.commands.OrderCommand;
-import jalview.datamodel.*;
-import jalview.io.*;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.Help.HelpId;
+import jalview.io.JalviewFileChooser;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.GraduatedColor;
-
-public class FeatureSettings extends JPanel
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionAdapter;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.help.HelpSetException;
+import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JColorChooser;
+import javax.swing.JDialog;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JLayeredPane;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JSlider;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+
+public class FeatureSettings extends JPanel implements
+ FeatureSettingsControllerI
{
DasSourceBrowser dassourceBrowser;
@@ -55,6 +106,8 @@ public class FeatureSettings extends JPanel
Object[][] originalData;
+ private float originalTransparency;
+
final JInternalFrame frame;
JScrollPane scrollPane = new JScrollPane();
@@ -71,8 +124,9 @@ public class FeatureSettings extends JPanel
{
this.af = af;
fr = af.getFeatureRenderer();
-
- transparency.setMaximum(100 - (int) (fr.transparency * 100));
+ // allow transparency to be recovered
+ transparency.setMaximum(100 - (int) ((originalTransparency = fr
+ .getTransparency()) * 100));
try
{
@@ -82,7 +136,22 @@ public class FeatureSettings extends JPanel
ex.printStackTrace();
}
- table = new JTable();
+ table = new JTable()
+ {
+ @Override
+ public String getToolTipText(MouseEvent e)
+ {
+ if (table.columnAtPoint(e.getPoint()) == 0)
+ {
+ /*
+ * Tooltip for feature name only
+ */
+ return JvSwingUtils.wrapTooltip(true, MessageManager
+ .getString("label.feature_settings_click_drag"));
+ }
+ return null;
+ }
+ };
table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12));
table.setFont(new Font("Verdana", Font.PLAIN, 12));
table.setDefaultRenderer(Color.class, new ColorRenderer());
@@ -98,11 +167,31 @@ public class FeatureSettings extends JPanel
public void mousePressed(MouseEvent evt)
{
selectedRow = table.rowAtPoint(evt.getPoint());
- if (javax.swing.SwingUtilities.isRightMouseButton(evt))
+ if (SwingUtilities.isRightMouseButton(evt))
+ {
+ popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0),
+ table.getValueAt(selectedRow, 1), fr.getMinMax(),
+ evt.getX(), evt.getY());
+ }
+ else if (evt.getClickCount() == 2)
+ {
+ fr.ap.alignFrame.avc.markColumnsContainingFeatures(
+ evt.isAltDown(), evt.isShiftDown() || evt.isMetaDown(),
+ evt.isMetaDown(),
+ (String) table.getValueAt(selectedRow, 0));
+ }
+ }
+
+ // isPopupTrigger fires on mouseReleased on Mac
+ @Override
+ public void mouseReleased(MouseEvent evt)
+ {
+ selectedRow = table.rowAtPoint(evt.getPoint());
+ if (evt.isPopupTrigger())
{
popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0),
- table.getValueAt(selectedRow, 1), fr.minmax, evt.getX(),
- evt.getY());
+ table.getValueAt(selectedRow, 1), fr.getMinMax(),
+ evt.getX(), evt.getY());
}
}
});
@@ -131,19 +220,19 @@ public class FeatureSettings extends JPanel
}
}
});
-
+ // table.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ // MessageManager.getString("label.feature_settings_click_drag")));
scrollPane.setViewportView(table);
dassourceBrowser = new DasSourceBrowser(this);
dasSettingsPane.add(dassourceBrowser, BorderLayout.CENTER);
- if (af.getViewport().featuresDisplayed == null
- || fr.renderOrder == null)
+ if (af.getViewport().isShowSequenceFeatures() || !fr.hasRenderOrder())
{
fr.findAllFeatures(true); // display everything!
}
- setTableData();
+ discoverAllFeatureData();
final PropertyChangeListener change;
final FeatureSettings fs = this;
fr.addPropertyChangeListener(change = new PropertyChangeListener()
@@ -165,11 +254,15 @@ public class FeatureSettings extends JPanel
frame.setContentPane(this);
if (new jalview.util.Platform().isAMac())
{
- Desktop.addInternalFrame(frame, "Sequence Feature Settings", 475, 480);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("label.sequence_feature_settings"),
+ 475, 480);
}
else
{
- Desktop.addInternalFrame(frame, "Sequence Feature Settings", 400, 450);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("label.sequence_feature_settings"),
+ 400, 450);
}
frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
@@ -187,8 +280,10 @@ public class FeatureSettings extends JPanel
protected void popupSort(final int selectedRow, final String type,
final Object typeCol, final Hashtable minmax, int x, int y)
{
- JPopupMenu men = new JPopupMenu("Settings for " + type);
- JMenuItem scr = new JMenuItem("Sort by Score");
+ JPopupMenu men = new JPopupMenu(MessageManager.formatMessage(
+ "label.settings_for_param", new String[] { type }));
+ JMenuItem scr = new JMenuItem(
+ MessageManager.getString("label.sort_by_score"));
men.add(scr);
final FeatureSettings me = this;
scr.addActionListener(new ActionListener()
@@ -196,19 +291,18 @@ public class FeatureSettings extends JPanel
public void actionPerformed(ActionEvent e)
{
- me.sortByScore(new String[]
- { type });
+ me.af.avc.sortAlignmentByFeatureScore(new String[] { type });
}
});
- JMenuItem dens = new JMenuItem("Sort by Density");
+ JMenuItem dens = new JMenuItem(
+ MessageManager.getString("label.sort_by_density"));
dens.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- me.sortByDens(new String[]
- { type });
+ me.af.avc.sortAlignmentByFeatureDensity(new String[] { type });
}
});
@@ -290,6 +384,32 @@ public class FeatureSettings extends JPanel
});
}
}
+ JMenuItem selCols = new JMenuItem(
+ MessageManager.getString("label.select_columns_containing"));
+ selCols.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, false,
+ false, type);
+ }
+ });
+ JMenuItem clearCols = new JMenuItem(
+ MessageManager.getString("label.select_columns_not_containing"));
+ clearCols.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, false,
+ false, type);
+ }
+ });
+ men.add(selCols);
+ men.add(clearCols);
men.show(table, x, y);
}
@@ -303,27 +423,22 @@ public class FeatureSettings extends JPanel
*/
Hashtable typeWidth = null;
- synchronized public void setTableData()
+ @Override
+ synchronized public void discoverAllFeatureData()
{
- if (fr.featureGroups == null)
- {
- fr.featureGroups = new Hashtable();
- }
Vector allFeatures = new Vector();
Vector allGroups = new Vector();
SequenceFeature[] tmpfeatures;
String group;
- for (int i = 0; i < af.getViewport().alignment.getHeight(); i++)
+ for (int i = 0; i < af.getViewport().getAlignment().getHeight(); i++)
{
- if (af.getViewport().alignment.getSequenceAt(i).getDatasetSequence()
- .getSequenceFeatures() == null)
+ tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
+ .getSequenceFeatures();
+ if (tmpfeatures == null)
{
continue;
}
- tmpfeatures = af.getViewport().alignment.getSequenceAt(i)
- .getDatasetSequence().getSequenceFeatures();
-
int index = 0;
while (index < tmpfeatures.length)
{
@@ -339,10 +454,7 @@ public class FeatureSettings extends JPanel
if (!allGroups.contains(group))
{
allGroups.addElement(group);
- if (group != null)
- {
- checkGroupState(group);
- }
+ checkGroupState(group);
}
}
@@ -360,21 +472,14 @@ public class FeatureSettings extends JPanel
}
/**
+ * Synchronise gui group list and check visibility of group
*
* @param group
- * @return true if group has been seen before and is already added to set.
+ * @return true if group is visible
*/
private boolean checkGroupState(String group)
{
- boolean visible;
- if (fr.featureGroups.containsKey(group))
- {
- visible = ((Boolean) fr.featureGroups.get(group)).booleanValue();
- }
- else
- {
- visible = true; // new group is always made visible
- }
+ boolean visible = fr.checkGroupVisibility(group, true);
if (groupPanel == null)
{
@@ -395,10 +500,8 @@ public class FeatureSettings extends JPanel
if (alreadyAdded)
{
- return true;
+ return visible;
}
-
- fr.featureGroups.put(group, new Boolean(visible));
final String grp = group;
final JCheckBox check = new JCheckBox(group, visible);
check.setFont(new Font("Serif", Font.BOLD, 12));
@@ -406,20 +509,18 @@ public class FeatureSettings extends JPanel
{
public void itemStateChanged(ItemEvent evt)
{
- fr.featureGroups.put(check.getText(),
- new Boolean(check.isSelected()));
- af.alignPanel.seqPanel.seqCanvas.repaint();
+ fr.setGroupVisibility(check.getText(), check.isSelected());
+ af.alignPanel.getSeqPanel().seqCanvas.repaint();
if (af.alignPanel.overviewPanel != null)
{
af.alignPanel.overviewPanel.updateOverviewImage();
}
- resetTable(new String[]
- { grp });
+ resetTable(new String[] { grp });
}
});
groupPanel.add(check);
- return false;
+ return visible;
}
boolean resettingTable = false;
@@ -442,11 +543,11 @@ public class FeatureSettings extends JPanel
// Find out which features should be visible depending on which groups
// are selected / deselected
// and recompute average width ordering
- for (int i = 0; i < af.getViewport().alignment.getHeight(); i++)
+ for (int i = 0; i < af.getViewport().getAlignment().getHeight(); i++)
{
- tmpfeatures = af.getViewport().alignment.getSequenceAt(i)
- .getDatasetSequence().getSequenceFeatures();
+ tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
+ .getSequenceFeatures();
if (tmpfeatures == null)
{
continue;
@@ -463,11 +564,8 @@ public class FeatureSettings extends JPanel
continue;
}
- if (group == null || fr.featureGroups.get(group) == null
- || ((Boolean) fr.featureGroups.get(group)).booleanValue())
+ if (group == null || checkGroupState(group))
{
- if (group != null)
- checkGroupState(group);
type = tmpfeatures[index].getType();
if (!visibleChecks.contains(type))
{
@@ -502,17 +600,20 @@ public class FeatureSettings extends JPanel
Object[][] data = new Object[fSize][3];
int dataIndex = 0;
- if (fr.renderOrder != null)
+ if (fr.hasRenderOrder())
{
if (!handlingUpdate)
+ {
fr.findAllFeatures(groupChanged != null); // prod to update
- // colourschemes. but don't
- // affect display
- // First add the checks in the previous render order,
- // in case the window has been closed and reopened
- for (int ro = fr.renderOrder.length - 1; ro > -1; ro--)
+ // colourschemes. but don't
+ // affect display
+ // First add the checks in the previous render order,
+ // in case the window has been closed and reopened
+ }
+ List<String> frl = fr.getRenderOrder();
+ for (int ro = frl.size() - 1; ro > -1; ro--)
{
- type = fr.renderOrder[ro];
+ type = frl.get(ro);
if (!visibleChecks.contains(type))
{
@@ -521,8 +622,8 @@ public class FeatureSettings extends JPanel
data[dataIndex][0] = type;
data[dataIndex][1] = fr.getFeatureStyle(type);
- data[dataIndex][2] = new Boolean(
- af.getViewport().featuresDisplayed.containsKey(type));
+ data[dataIndex][2] = new Boolean(af.getViewport()
+ .getFeaturesDisplayed().isVisible(type));
dataIndex++;
visibleChecks.removeElement(type);
}
@@ -540,7 +641,7 @@ public class FeatureSettings extends JPanel
if (data[dataIndex][1] == null)
{
// "Colour has been updated in another view!!"
- fr.renderOrder = null;
+ fr.clearRenderOrder();
return;
}
@@ -562,8 +663,8 @@ public class FeatureSettings extends JPanel
if (groupPanel != null)
{
- groupPanel.setLayout(new GridLayout(fr.featureGroups.size() / 4 + 1,
- 4));
+ groupPanel.setLayout(new GridLayout(
+ fr.getFeatureGroupsSize() / 4 + 1, 4));
groupPanel.validate();
bigPanel.add(groupPanel, BorderLayout.NORTH);
@@ -586,23 +687,31 @@ public class FeatureSettings extends JPanel
{
order[i] = fr.getOrder(data[i][0].toString());
if (order[i] < 0)
+ {
order[i] = fr.setOrder(data[i][0].toString(), i / order.length);
+ }
if (i > 1)
+ {
sort = sort || order[i - 1] > order[i];
+ }
}
if (sort)
+ {
jalview.util.QuickSort.sort(order, data);
+ }
}
void load()
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "fc" }, new String[]
- { "Sequence Feature Colours" }, "Sequence Feature Colours");
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "fc" },
+ new String[] { "Sequence Feature Colours" },
+ "Sequence Feature Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Load Feature Colours");
- chooser.setToolTipText("Load");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.load_feature_colours"));
+ chooser.setToolTipText(MessageManager.getString("action.load"));
int value = chooser.showOpenDialog(this);
@@ -616,8 +725,7 @@ public class FeatureSettings extends JPanel
file), "UTF-8");
jalview.schemabinding.version2.JalviewUserColours jucs = new jalview.schemabinding.version2.JalviewUserColours();
- jucs = (jalview.schemabinding.version2.JalviewUserColours) jucs
- .unmarshal(in);
+ jucs = jucs.unmarshal(in);
for (int i = jucs.getColourCount() - 1; i >= 0; i--)
{
@@ -695,12 +803,14 @@ public class FeatureSettings extends JPanel
void save()
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "fc" }, new String[]
- { "Sequence Feature Colours" }, "Sequence Feature Colours");
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "fc" },
+ new String[] { "Sequence Feature Colours" },
+ "Sequence Feature Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Save Feature Colour Scheme");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.save_feature_colours"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
@@ -714,13 +824,14 @@ public class FeatureSettings extends JPanel
PrintWriter out = new PrintWriter(new OutputStreamWriter(
new FileOutputStream(choice), "UTF-8"));
- Enumeration e = fr.featureColours.keys();
- float[] sortOrder = new float[fr.featureColours.size()];
- String[] sortTypes = new String[fr.featureColours.size()];
+ Set fr_colours = fr.getAllFeatureColours();
+ Iterator e = fr_colours.iterator();
+ float[] sortOrder = new float[fr_colours.size()];
+ String[] sortTypes = new String[fr_colours.size()];
int i = 0;
- while (e.hasMoreElements())
+ while (e.hasNext())
{
- sortTypes[i] = e.nextElement().toString();
+ sortTypes[i] = e.next().toString();
sortOrder[i] = fr.getOrder(sortTypes[i]);
i++;
}
@@ -782,7 +893,9 @@ public class FeatureSettings extends JPanel
public void orderByAvWidth()
{
if (table == null || table.getModel() == null)
+ {
return;
+ }
Object[][] data = ((FeatureTableModel) table.getModel()).getData();
float[] width = new float[data.length];
float[] awidth;
@@ -804,7 +917,9 @@ public class FeatureSettings extends JPanel
width[i] = 0;
}
if (max < width[i])
+ {
max = width[i];
+ }
}
boolean sort = false;
for (int i = 0; i < width.length; i++)
@@ -824,11 +939,15 @@ public class FeatureSettings extends JPanel
fr.setOrder(data[i][0].toString(), width[i]); // store for later
}
if (i > 0)
+ {
sort = sort || width[i - 1] > width[i];
+ }
}
if (sort)
+ {
jalview.util.QuickSort.sort(width, data);
- // update global priority order
+ // update global priority order
+ }
updateFeatureRenderer(data, false);
table.repaint();
@@ -896,7 +1015,9 @@ public class FeatureSettings extends JPanel
JButton sortByDens = new JButton();
- JPanel transbuttons = new JPanel(new GridLayout(4, 1));
+ JButton help = new JButton();
+
+ JPanel transbuttons = new JPanel(new GridLayout(5, 1));
private void jbInit() throws Exception
{
@@ -905,7 +1026,7 @@ public class FeatureSettings extends JPanel
dasSettingsPane.setLayout(borderLayout3);
bigPanel.setLayout(borderLayout4);
invert.setFont(JvSwingUtils.getLabelFont());
- invert.setText("Invert Selection");
+ invert.setText(MessageManager.getString("label.invert_selection"));
invert.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -914,7 +1035,7 @@ public class FeatureSettings extends JPanel
}
});
optimizeOrder.setFont(JvSwingUtils.getLabelFont());
- optimizeOrder.setText("Optimise Order");
+ optimizeOrder.setText(MessageManager.getString("label.optimise_order"));
optimizeOrder.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -923,35 +1044,68 @@ public class FeatureSettings extends JPanel
}
});
sortByScore.setFont(JvSwingUtils.getLabelFont());
- sortByScore.setText("Seq sort by Score");
+ sortByScore
+ .setText(MessageManager.getString("label.seq_sort_by_score"));
sortByScore.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- sortByScore(null);
+ af.avc.sortAlignmentByFeatureScore(null);
}
});
sortByDens.setFont(JvSwingUtils.getLabelFont());
- sortByDens.setText("Seq Sort by density");
+ sortByDens.setText(MessageManager
+ .getString("label.sequence_sort_by_density"));
sortByDens.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- sortByDens(null);
+ af.avc.sortAlignmentByFeatureDensity(null);
+ }
+ });
+ help.setFont(JvSwingUtils.getLabelFont());
+ help.setText(MessageManager.getString("action.help"));
+ help.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ Help.showHelpWindow(HelpId.SequenceFeatureSettings);
+ } catch (HelpSetException e1)
+ {
+ e1.printStackTrace();
+ }
+ }
+ });
+ help.setFont(JvSwingUtils.getLabelFont());
+ help.setText(MessageManager.getString("action.help"));
+ help.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ Help.showHelpWindow(HelpId.SequenceFeatureSettings);
+ } catch (HelpSetException e1)
+ {
+ e1.printStackTrace();
+ }
}
});
cancel.setFont(JvSwingUtils.getLabelFont());
- cancel.setText("Cancel");
+ cancel.setText(MessageManager.getString("action.cancel"));
cancel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
+ fr.setTransparency(originalTransparency);
updateFeatureRenderer(originalData);
close();
}
});
ok.setFont(JvSwingUtils.getLabelFont());
- ok.setText("OK");
+ ok.setText(MessageManager.getString("action.ok"));
ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -960,7 +1114,7 @@ public class FeatureSettings extends JPanel
}
});
loadColours.setFont(JvSwingUtils.getLabelFont());
- loadColours.setText("Load Colours");
+ loadColours.setText(MessageManager.getString("label.load_colours"));
loadColours.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -969,7 +1123,7 @@ public class FeatureSettings extends JPanel
}
});
saveColours.setFont(JvSwingUtils.getLabelFont());
- saveColours.setText("Save Colours");
+ saveColours.setText(MessageManager.getString("label.save_colours"));
saveColours.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -981,13 +1135,15 @@ public class FeatureSettings extends JPanel
{
public void stateChanged(ChangeEvent evt)
{
- fr.setTransparency((float) (100 - transparency.getValue()) / 100f);
+ fr.setTransparency((100 - transparency.getValue()) / 100f);
af.alignPanel.paintAlignment(true);
}
});
transparency.setMaximum(70);
- fetchDAS.setText("Fetch DAS Features");
+ transparency.setToolTipText(MessageManager
+ .getString("label.transparency_tip"));
+ fetchDAS.setText(MessageManager.getString("label.fetch_das_features"));
fetchDAS.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -995,7 +1151,7 @@ public class FeatureSettings extends JPanel
fetchDAS_actionPerformed(e);
}
});
- saveDAS.setText("Save as default");
+ saveDAS.setText(MessageManager.getString("action.save_as_default"));
saveDAS.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -1006,7 +1162,7 @@ public class FeatureSettings extends JPanel
dasButtonPanel.setBorder(BorderFactory.createEtchedBorder());
dasSettingsPane.setBorder(null);
cancelDAS.setEnabled(false);
- cancelDAS.setText("Cancel Fetch");
+ cancelDAS.setText(MessageManager.getString("action.cancel_fetch"));
cancelDAS.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -1015,13 +1171,18 @@ public class FeatureSettings extends JPanel
}
});
this.add(tabbedPane, java.awt.BorderLayout.CENTER);
- tabbedPane.addTab("Feature Settings", settingsPane);
- tabbedPane.addTab("DAS Settings", dasSettingsPane);
+ tabbedPane.addTab(MessageManager.getString("label.feature_settings"),
+ settingsPane);
+ tabbedPane.addTab(MessageManager.getString("label.das_settings"),
+ dasSettingsPane);
bigPanel.add(transPanel, java.awt.BorderLayout.SOUTH);
transbuttons.add(optimizeOrder);
transbuttons.add(invert);
transbuttons.add(sortByScore);
transbuttons.add(sortByDens);
+ transbuttons.add(help);
+ JPanel sliderPanel = new JPanel();
+ sliderPanel.add(transparency);
transPanel.add(transparency);
transPanel.add(transbuttons);
buttonPanel.add(ok);
@@ -1037,130 +1198,6 @@ public class FeatureSettings extends JPanel
settingsPane.add(buttonPanel, java.awt.BorderLayout.SOUTH);
}
- protected void sortByDens(String[] typ)
- {
- sortBy(typ, "Sort by Density", AlignmentSorter.FEATURE_DENSITY);
- }
-
- protected void sortBy(String[] typ, String methodText, final String method)
- {
- if (typ == null)
- {
- typ = getDisplayedFeatureTypes();
- }
- String gps[] = null;
- gps = getDisplayedFeatureGroups();
- if (typ != null)
- {
- ArrayList types = new ArrayList();
- for (int i = 0; i < typ.length; i++)
- {
- if (typ[i] != null)
- {
- types.add(typ[i]);
- }
- typ = new String[types.size()];
- types.toArray(typ);
- }
- }
- if (gps != null)
- {
- ArrayList grps = new ArrayList();
-
- for (int i = 0; i < gps.length; i++)
- {
- if (gps[i] != null)
- {
- grps.add(gps[i]);
- }
- }
- gps = new String[grps.size()];
- grps.toArray(gps);
- }
- AlignmentPanel alignPanel = af.alignPanel;
- AlignmentI al = alignPanel.av.getAlignment();
-
- int start, stop;
- SequenceGroup sg = alignPanel.av.getSelectionGroup();
- if (sg != null)
- {
- start = sg.getStartRes();
- stop = sg.getEndRes();
- }
- else
- {
- start = 0;
- stop = al.getWidth();
- }
- SequenceI[] oldOrder = al.getSequencesArray();
- AlignmentSorter.sortByFeature(typ, gps, start, stop, al, method);
- af.addHistoryItem(new OrderCommand(methodText, oldOrder, alignPanel.av
- .getAlignment()));
- alignPanel.paintAlignment(true);
-
- }
-
- protected void sortByScore(String[] typ)
- {
- sortBy(typ, "Sort by Feature Score", AlignmentSorter.FEATURE_SCORE);
- }
-
- private String[] getDisplayedFeatureTypes()
- {
- String[] typ = null;
- if (fr != null)
- {
- synchronized (fr.renderOrder)
- {
- typ = new String[fr.renderOrder.length];
- System.arraycopy(fr.renderOrder, 0, typ, 0, typ.length);
- for (int i = 0; i < typ.length; i++)
- {
- if (af.viewport.featuresDisplayed.get(typ[i]) == null)
- {
- typ[i] = null;
- }
- }
- }
- }
- return typ;
- }
-
- private String[] getDisplayedFeatureGroups()
- {
- String[] gps = null;
- if (fr != null)
- {
-
- if (fr.featureGroups != null)
- {
- Enumeration en = fr.featureGroups.keys();
- gps = new String[fr.featureColours.size()];
- int g = 0;
- boolean valid = false;
- while (en.hasMoreElements())
- {
- String gp = (String) en.nextElement();
- Boolean on = (Boolean) fr.featureGroups.get(gp);
- if (on != null && on.booleanValue())
- {
- valid = true;
- gps[g++] = gp;
- }
- }
- while (g < gps.length)
- {
- gps[g++] = null;
- }
- if (!valid)
- {
- return null;
- }
- }
- }
- return gps;
- }
-
public void fetchDAS_actionPerformed(ActionEvent e)
{
fetchDAS.setEnabled(false);
@@ -1177,12 +1214,12 @@ public class FeatureSettings extends JPanel
* @param checkDbRefs
* @param promptFetchDbRefs
*/
- private void doDasFeatureFetch(Vector selectedSources,
+ private void doDasFeatureFetch(List<jalviewSourceI> selectedSources,
boolean checkDbRefs, boolean promptFetchDbRefs)
{
SequenceI[] dataset, seqs;
int iSize;
- AlignViewport vp = af.getViewport();
+ AlignmentViewport vp = af.getViewport();
if (vp.getSelectionGroup() != null
&& vp.getSelectionGroup().getSize() > 0)
{
@@ -1225,9 +1262,9 @@ public class FeatureSettings extends JPanel
* Vector of Strings to resolve to DAS source nicknames.
* @return sources that are present in source list.
*/
- public Vector resolveSourceNicknames(Vector sources)
+ public List<jalviewSourceI> resolveSourceNicknames(Vector sources)
{
- return dassourceBrowser.resolveSourceNicknames(sources);
+ return dassourceBrowser.sourceRegistry.resolveSourceNicknames(sources);
}
/**
@@ -1253,14 +1290,15 @@ public class FeatureSettings extends JPanel
public void fetchDasFeatures(Vector sources, boolean block)
{
initDasSources();
- Vector resolved = resolveSourceNicknames(sources);
+ List<jalviewSourceI> resolved = dassourceBrowser.sourceRegistry
+ .resolveSourceNicknames(sources);
if (resolved.size() == 0)
{
resolved = dassourceBrowser.getSelectedSources();
}
if (resolved.size() > 0)
{
- final Vector dassources = resolved;
+ final List<jalviewSourceI> dassources = resolved;
fetchDAS.setEnabled(false);
// cancelDAS.setEnabled(true); doDasFetch does this.
Runnable fetcher = new Runnable()
@@ -1309,11 +1347,15 @@ public class FeatureSettings extends JPanel
public void noDasSourceActive()
{
complete();
- JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- "No das sources were selected.\n"
- + "Please select some sources and\n" + " try again.",
- "No Sources Selected", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane
+ .showInternalConfirmDialog(
+ Desktop.desktop,
+ MessageManager
+ .getString("label.no_das_sources_selected_warn"),
+ MessageManager
+ .getString("label.no_das_sources_selected_title"),
+ JOptionPane.DEFAULT_OPTION,
+ JOptionPane.INFORMATION_MESSAGE);
}
// ///////////////////////////////////////////////////////////////////////
@@ -1326,8 +1368,10 @@ public class FeatureSettings extends JPanel
this.data = data;
}
- private String[] columnNames =
- { "Feature Type", "Colour", "Display" };
+ private String[] columnNames = {
+ MessageManager.getString("label.feature_type"),
+ MessageManager.getString("action.colour"),
+ MessageManager.getString("label.display") };
private Object[][] data;
@@ -1592,7 +1636,7 @@ class FeatureIcon implements Icon
// width/g.getFontMetrics().stringWidth("Label"),
// height/g.getFontMetrics().getHeight())));
- g.drawString("Label", 0, 0);
+ g.drawString(MessageManager.getString("label.label"), 0, 0);
}
else
diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java
index 05fad6f..1a7da1f 100644
--- a/src/jalview/gui/Finder.java
+++ b/src/jalview/gui/Finder.java
@@ -1,40 +1,63 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.jbgui.GFinder;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.util.Vector;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
-import jalview.datamodel.*;
-import jalview.jbgui.*;
+import javax.swing.AbstractAction;
+import javax.swing.JComponent;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JOptionPane;
+import javax.swing.KeyStroke;
/**
- * DOCUMENT ME!
+ * Performs the menu option for searching the alignment, for the next or all
+ * matches. If matches are found, they are highlighted, and the user has the
+ * option to create a new feature on the alignment for the matched positions.
+ *
+ * Searches can be for a simple base sequence, or may use a regular expression.
+ * Any gaps are ignored.
*
* @author $author$
* @version $Revision$
*/
public class Finder extends GFinder
{
- AlignViewport av;
+ private static final int HEIGHT = 110;
+
+ private static final int WIDTH = 340;
+
+ AlignmentViewport av;
AlignmentPanel ap;
@@ -47,14 +70,7 @@ public class Finder extends GFinder
SearchResults searchResults;
/**
- * Creates a new Finder object.
- *
- * @param av
- * DOCUMENT ME!
- * @param ap
- * DOCUMENT ME!
- * @param f
- * DOCUMENT ME!
+ * Creates a new Finder object with no associated viewport or panel.
*/
public Finder()
{
@@ -62,7 +78,14 @@ public class Finder extends GFinder
focusfixed = false;
}
- public Finder(AlignViewport viewport, AlignmentPanel alignPanel)
+ /**
+ * Constructor given an associated viewport and alignment panel. Constructs
+ * and displays an internal frame where the user can enter a search string.
+ *
+ * @param viewport
+ * @param alignPanel
+ */
+ public Finder(AlignmentViewport viewport, AlignmentPanel alignPanel)
{
av = viewport;
ap = alignPanel;
@@ -70,16 +93,42 @@ public class Finder extends GFinder
frame = new JInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
- Desktop.addInternalFrame(frame, "Find", 340, 110);
+ addEscapeHandler();
+ Desktop.addInternalFrame(frame, MessageManager.getString("label.find"),
+ WIDTH, HEIGHT);
textfield.requestFocus();
}
/**
- * DOCUMENT ME!
+ * Add a handler for the Escape key when the window has focus
+ */
+ private void addEscapeHandler()
+ {
+ getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "Cancel");
+ getRootPane().getActionMap().put("Cancel", new AbstractAction()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ escapeActionPerformed();
+ }
+ });
+ }
+
+ /**
+ * Close the panel on Escape key press
+ */
+ protected void escapeActionPerformed()
+ {
+ setVisible(false);
+ frame.dispose();
+ }
+
+ /**
+ * Performs the 'Find Next' action.
*
* @param e
- * DOCUMENT ME!
*/
public void findNext_actionPerformed(ActionEvent e)
{
@@ -90,10 +139,9 @@ public class Finder extends GFinder
}
/**
- * DOCUMENT ME!
+ * Performs the 'Find All' action.
*
* @param e
- * DOCUMENT ME!
*/
public void findAll_actionPerformed(ActionEvent e)
{
@@ -165,7 +213,7 @@ public class Finder extends GFinder
searchResults.getResultEnd(i), "Search Results");
}
- if (ap.seqPanel.seqCanvas.getFeatureRenderer().amendFeatures(seqs,
+ if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(seqs,
features, true, ap))
{
ap.alignFrame.showSeqFeatures.setSelected(true);
@@ -175,10 +223,10 @@ public class Finder extends GFinder
}
/**
- * incrementally search the alignment
+ * Search the alignment for the next or all matches. If 'all matches', a
+ * dialog is shown with the number of sequence ids and subsequences matched.
*
* @param findAll
- * true means find all results and raise a dialog box
*/
void doSearch(boolean findAll)
{
@@ -186,7 +234,7 @@ public class Finder extends GFinder
String searchString = textfield.getText().trim();
- if (searchString.length() < 1)
+ if (isInvalidSearchString(searchString))
{
return;
}
@@ -195,8 +243,10 @@ public class Finder extends GFinder
// TODO: add switches to control what is searched - sequences, IDS,
// descriptions, features
jalview.analysis.Finder finder = new jalview.analysis.Finder(
- av.alignment, av.getSelectionGroup(), seqIndex, resIndex);
+ av.getAlignment(), av.getSelectionGroup(), seqIndex, resIndex);
finder.setCaseSensitive(caseSensitive.isSelected());
+ finder.setIncludeDescription(searchDescription.isSelected());
+
finder.setFindAll(findAll);
finder.find(searchString); // returns true if anything was actually found
@@ -212,11 +262,11 @@ public class Finder extends GFinder
if ((idMatch.size() > 0))
{
haveResults = true;
- ap.idPanel.highlightSearchResults(idMatch);
+ ap.getIdPanel().highlightSearchResults(idMatch);
}
else
{
- ap.idPanel.highlightSearchResults(null);
+ ap.getIdPanel().highlightSearchResults(null);
}
if (searchResults.getSize() > 0)
@@ -236,29 +286,84 @@ public class Finder extends GFinder
// 'SelectRegion' selection
if (!haveResults)
{
- JOptionPane.showInternalMessageDialog(this, "Finished searching",
- null, JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showInternalMessageDialog(this,
+ MessageManager.getString("label.finished_searching"), null,
+ JOptionPane.INFORMATION_MESSAGE);
resIndex = -1;
seqIndex = 0;
}
-
- if (findAll)
+ else
{
- String message = (idMatch.size() > 0) ? "" + idMatch.size() + " IDs"
- : "";
- if (searchResults != null)
+ if (findAll)
{
- if (idMatch.size() > 0 && searchResults.getSize() > 0)
+ // then we report the matches that were found
+ String message = (idMatch.size() > 0) ? "" + idMatch.size()
+ + " IDs" : "";
+ if (searchResults != null)
{
- message += " and ";
+ if (idMatch.size() > 0 && searchResults.getSize() > 0)
+ {
+ message += " and ";
+ }
+ message += searchResults.getSize()
+ + " subsequence matches found.";
}
- message += searchResults.getSize() + " subsequence matches found.";
+ JOptionPane.showInternalMessageDialog(this, message, null,
+ JOptionPane.INFORMATION_MESSAGE);
+ resIndex = -1;
+ seqIndex = 0;
}
- JOptionPane.showInternalMessageDialog(this, message, null,
- JOptionPane.INFORMATION_MESSAGE);
- resIndex = -1;
- seqIndex = 0;
}
}
+
+ /**
+ * Displays an error dialog, and answers false, if the search string is
+ * invalid, else answers true.
+ *
+ * @param searchString
+ * @return
+ */
+ protected boolean isInvalidSearchString(String searchString)
+ {
+ String error = getSearchValidationError(searchString);
+ if (error == null)
+ {
+ return false;
+ }
+ JOptionPane.showInternalMessageDialog(this, error,
+ MessageManager.getString("label.invalid_search"), // $NON-NLS-1$
+ JOptionPane.ERROR_MESSAGE);
+ return true;
+ }
+
+ /**
+ * Returns an error message string if the search string is invalid, else
+ * returns null.
+ *
+ * Currently validation is limited to checking the string is not empty, and is
+ * a valid regular expression (simple searches for base sub-sequences will
+ * pass this test). Additional validations may be added in future if the
+ * search syntax is expanded.
+ *
+ * @param searchString
+ * @return
+ */
+ protected String getSearchValidationError(String searchString)
+ {
+ String error = null;
+ if (searchString == null || searchString.length() == 0)
+ {
+ error = MessageManager.getString("label.invalid_search");
+ }
+ try
+ {
+ Pattern.compile(searchString);
+ } catch (PatternSyntaxException e)
+ {
+ error = MessageManager.getString("error.invalid_regex") + ": "
+ + e.getDescription();
+ }
+ return error;
+ }
}
diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java
index d996aaf..df3bfc2 100644
--- a/src/jalview/gui/FontChooser.java
+++ b/src/jalview/gui/FontChooser.java
@@ -1,28 +1,37 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.bin.Cache;
+import jalview.jbgui.GFontChooser;
+import jalview.util.MessageManager;
+
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.event.ActionEvent;
+import java.awt.geom.Rectangle2D;
-import jalview.bin.*;
-import jalview.jbgui.*;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JOptionPane;
/**
* DOCUMENT ME!
@@ -36,12 +45,24 @@ public class FontChooser extends GFontChooser
TreePanel tp;
+ /*
+ * The font on opening the dialog (to be restored on Cancel)
+ */
Font oldFont;
+ boolean oldProteinScale;
+
boolean init = true;
JInternalFrame frame;
+ /*
+ * The last font settings selected in the dialog
+ */
+ private Font lastSelected = null;
+
+ private boolean lastSelMono = false;
+
/**
* Creates a new FontChooser object.
*
@@ -67,6 +88,8 @@ public class FontChooser extends GFontChooser
public FontChooser(AlignmentPanel ap)
{
oldFont = ap.av.getFont();
+ oldProteinScale = ap.av.isScaleProteinAsCdna();
+
this.ap = ap;
init();
}
@@ -78,14 +101,29 @@ public class FontChooser extends GFontChooser
smoothFont.setSelected(ap.av.antiAlias);
+ /*
+ * Enable 'scale protein as cDNA' in a SplitFrame view. The selection is
+ * stored in the ViewStyle of both dna and protein Viewport
+ */
+ scaleAsCdna.setEnabled(false);
+ if (ap.av.getCodingComplement() != null)
+ {
+ scaleAsCdna.setEnabled(true);
+ scaleAsCdna.setVisible(true);
+ scaleAsCdna.setSelected(ap.av.isScaleProteinAsCdna());
+ }
+
if (tp != null)
{
- Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 340, 170,
- false);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("action.change_font_tree_panel"),
+ 400, 200, false);
}
else
{
- Desktop.addInternalFrame(frame, "Change Font", 340, 170, false);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("action.change_font"), 380, 200,
+ false);
}
frame.setLayer(JLayeredPane.PALETTE_LAYER);
@@ -100,7 +138,7 @@ public class FontChooser extends GFontChooser
for (int i = 1; i < 51; i++)
{
- fontSize.addItem(i + "");
+ fontSize.addItem(i);
}
fontStyle.addItem("plain");
@@ -108,7 +146,7 @@ public class FontChooser extends GFontChooser
fontStyle.addItem("italic");
fontName.setSelectedItem(oldFont.getName());
- fontSize.setSelectedItem(oldFont.getSize() + "");
+ fontSize.setSelectedItem(oldFont.getSize());
fontStyle.setSelectedIndex(oldFont.getStyle());
FontMetrics fm = getGraphics().getFontMetrics(oldFont);
@@ -122,7 +160,7 @@ public class FontChooser extends GFontChooser
public void smoothFont_actionPerformed(ActionEvent e)
{
ap.av.antiAlias = smoothFont.isSelected();
- ap.annotationPanel.image = null;
+ ap.getAnnotationPanel().image = null;
ap.paintAlignment(true);
}
@@ -160,15 +198,21 @@ public class FontChooser extends GFontChooser
{
if (ap != null)
{
- ap.av.setFont(oldFont);
+ ap.av.setFont(oldFont, true);
+ ap.av.setScaleProteinAsCdna(oldProteinScale);
ap.paintAlignment(true);
+ if (scaleAsCdna.isEnabled())
+ {
+ ap.av.setScaleProteinAsCdna(oldProteinScale);
+ ap.av.getCodingComplement().setScaleProteinAsCdna(oldProteinScale);
+ }
}
else if (tp != null)
{
tp.setTreeFont(oldFont);
}
fontName.setSelectedItem(oldFont.getName());
- fontSize.setSelectedItem(oldFont.getSize() + "");
+ fontSize.setSelectedItem(oldFont.getSize());
fontStyle.setSelectedIndex(oldFont.getStyle());
try
@@ -184,25 +228,71 @@ public class FontChooser extends GFontChooser
*/
void changeFont()
{
+ if (lastSelected == null)
+ {
+ // initialise with original font
+ lastSelected = oldFont;
+ FontMetrics fm = getGraphics().getFontMetrics(oldFont);
+ double mw = fm.getStringBounds("M", getGraphics()).getWidth();
+ double iw = fm.getStringBounds("I", getGraphics()).getWidth();
+ lastSelMono = (mw == iw); // == on double - flaky?
+ }
+
Font newFont = new Font(fontName.getSelectedItem().toString(),
- fontStyle.getSelectedIndex(), Integer.parseInt(fontSize
- .getSelectedItem().toString()));
+ fontStyle.getSelectedIndex(),
+ (Integer) fontSize.getSelectedItem());
+ FontMetrics fm = getGraphics().getFontMetrics(newFont);
+ double mw = fm.getStringBounds("M", getGraphics()).getWidth();
+ final Rectangle2D iBounds = fm.getStringBounds("I", getGraphics());
+ double iw = iBounds.getWidth();
+ if (mw < 1 || iw < 1)
+ {
+ final String messageKey = iBounds.getHeight() < 1 ? "label.font_doesnt_have_letters_defined"
+ : "label.font_too_small";
+ JOptionPane.showInternalMessageDialog(this,
+ MessageManager.getString(messageKey),
+ MessageManager.getString("label.invalid_font"),
+ JOptionPane.WARNING_MESSAGE);
+ /*
+ * Restore the changed value - note this will reinvoke this method via the
+ * ActionListener, but now validation should pass
+ */
+ if (lastSelected.getSize() != (Integer) fontSize.getSelectedItem()) // autoboxing
+ {
+ fontSize.setSelectedItem(lastSelected.getSize());
+ }
+ if (!lastSelected.getName().equals(
+ fontName.getSelectedItem().toString()))
+ {
+ fontName.setSelectedItem(lastSelected.getName());
+ }
+ if (lastSelected.getStyle() != fontStyle.getSelectedIndex())
+ {
+ fontStyle.setSelectedIndex(lastSelected.getStyle());
+ }
+ if (lastSelMono != monospaced.isSelected())
+ {
+ monospaced.setSelected(lastSelMono);
+ }
+ return;
+ }
if (tp != null)
{
tp.setTreeFont(newFont);
}
else if (ap != null)
{
- ap.av.setFont(newFont);
+ ap.av.setFont(newFont, true);
ap.fontChanged();
}
- FontMetrics fm = getGraphics().getFontMetrics(newFont);
-
- monospaced.setSelected(fm.getStringBounds("M", getGraphics())
- .getWidth() == fm.getStringBounds("|", getGraphics())
- .getWidth());
+ monospaced.setSelected(mw == iw);
+ /*
+ * Remember latest valid selection, so it can be restored if followed by an
+ * invalid one
+ */
+ lastSelected = newFont;
}
/**
@@ -254,10 +344,10 @@ public class FontChooser extends GFontChooser
}
/**
- * DOCUMENT ME!
+ * Make selected settings the defaults by storing them (via Cache class) in
+ * the .jalview_properties file (the file is only written when Jalview exits)
*
* @param e
- * DOCUMENT ME!
*/
public void defaultButton_actionPerformed(ActionEvent e)
{
@@ -266,5 +356,25 @@ public class FontChooser extends GFontChooser
Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString());
Cache.setProperty("ANTI_ALIAS",
Boolean.toString(smoothFont.isSelected()));
+ Cache.setProperty(Preferences.SCALE_PROTEIN_TO_CDNA,
+ Boolean.toString(scaleAsCdna.isSelected()));
+ }
+
+ /**
+ * Turn on/off scaling of protein characters to 3 times the width of cDNA
+ * characters
+ */
+ @Override
+ protected void scaleAsCdna_actionPerformed(ActionEvent e)
+ {
+ ap.av.setScaleProteinAsCdna(scaleAsCdna.isSelected());
+ ap.av.getCodingComplement().setScaleProteinAsCdna(
+ scaleAsCdna.isSelected());
+ final SplitFrame splitFrame = (SplitFrame) ap.alignFrame
+ .getSplitViewContainer();
+ splitFrame.adjustLayout();
+ splitFrame.repaint();
+ // ap.paintAlignment(true);
+ // TODO would like to repaint
}
}
diff --git a/src/jalview/gui/HTMLOptions.java b/src/jalview/gui/HTMLOptions.java
new file mode 100644
index 0000000..2b9f764
--- /dev/null
+++ b/src/jalview/gui/HTMLOptions.java
@@ -0,0 +1,162 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+
+public class HTMLOptions extends JPanel
+{
+ JDialog dialog;
+
+ public boolean cancelled = false;
+
+ String value;
+
+ public HTMLOptions()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ ButtonGroup bg = new ButtonGroup();
+ bg.add(lineart);
+ bg.add(text);
+
+ JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION,
+ JOptionPane.DEFAULT_OPTION, null, new Object[] { this });
+
+ dialog = pane.createDialog(Desktop.desktop, "HTML Rendering options");
+ dialog.setVisible(true);
+
+ }
+
+ private void jbInit() throws Exception
+ {
+ lineart.setFont(JvSwingUtils.getLabelFont());
+ lineart.setText(MessageManager.getString("label.lineart"));
+ text.setFont(JvSwingUtils.getLabelFont());
+ text.setText(MessageManager.getString("action.text"));
+ text.setSelected(true);
+ askAgain.setFont(JvSwingUtils.getLabelFont());
+ askAgain.setText(MessageManager.getString("label.dont_ask_me_again"));
+ ok.setText(MessageManager.getString("action.ok"));
+ ok.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+ cancel.setText(MessageManager.getString("action.cancel"));
+ cancel.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ jLabel1.setFont(JvSwingUtils.getLabelFont());
+ jLabel1.setText("Select HTML character rendering style");
+ this.setLayout(borderLayout1);
+ jPanel3.setBorder(BorderFactory.createEtchedBorder());
+ jPanel2.add(text);
+ jPanel2.add(lineart);
+ jPanel2.add(askAgain);
+ jPanel1.add(ok);
+ jPanel1.add(cancel);
+ jPanel3.add(jLabel1);
+ jPanel3.add(jPanel2);
+ this.add(jPanel3, java.awt.BorderLayout.CENTER);
+ this.add(jPanel1, java.awt.BorderLayout.SOUTH);
+ }
+
+ JRadioButton lineart = new JRadioButton();
+
+ JRadioButton text = new JRadioButton();
+
+ JCheckBox askAgain = new JCheckBox();
+
+ JButton ok = new JButton();
+
+ JButton cancel = new JButton();
+
+ JPanel jPanel1 = new JPanel();
+
+ JLabel jLabel1 = new JLabel();
+
+ JPanel jPanel2 = new JPanel();
+
+ JPanel jPanel3 = new JPanel();
+
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ if (lineart.isSelected())
+ {
+ value = "Lineart";
+ }
+ else
+ {
+ value = "Text";
+ }
+
+ if (!askAgain.isSelected())
+ {
+ jalview.bin.Cache.applicationProperties.remove("HTML_RENDERING");
+ }
+ else
+ {
+ jalview.bin.Cache.setProperty("HTML_RENDERING", value);
+ }
+
+ dialog.setVisible(false);
+ }
+
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ cancelled = true;
+ dialog.setVisible(false);
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+}
diff --git a/src/jalview/gui/Help.java b/src/jalview/gui/Help.java
new file mode 100644
index 0000000..ee91713
--- /dev/null
+++ b/src/jalview/gui/Help.java
@@ -0,0 +1,110 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import java.net.URL;
+
+import javax.help.BadIDException;
+import javax.help.HelpBroker;
+import javax.help.HelpSet;
+import javax.help.HelpSetException;
+
+/**
+ * Utility class to show the help documentation window.
+ *
+ * @author gmcarstairs
+ *
+ */
+public class Help
+{
+ public enum HelpId
+ {
+ Home("home"), SequenceFeatureSettings("seqfeatures.settings"), StructureViewer(
+ "viewingpdbs");
+
+ private String id;
+
+ private HelpId(String loc)
+ {
+ this.id = loc;
+ }
+
+ @Override
+ public String toString()
+ {
+ return this.id;
+ }
+ }
+
+ private static final long HALF_A_MO = 500; // half a second
+
+ private static long lastOpenedTime = 0L;
+
+ /**
+ * Not instantiable
+ */
+ private Help()
+ {
+
+ }
+
+ /**
+ * Show help text in a new window. But do nothing if within half a second of
+ * the last invocation.
+ *
+ * This is a workaround for issue JAL-914 - both Desktop and AlignFrame
+ * responding to F1 key, resulting in duplicate help windows opened.
+ *
+ * @param id
+ * TODO
+ *
+ * @throws HelpSetException
+ */
+ public static void showHelpWindow(HelpId id) throws HelpSetException
+ {
+ long timeNow = System.currentTimeMillis();
+
+ if (timeNow - lastOpenedTime > HALF_A_MO)
+ {
+ lastOpenedTime = timeNow;
+ ClassLoader cl = Desktop.class.getClassLoader();
+ URL url = HelpSet.findHelpSet(cl, "help/help"); // $NON-NLS-$
+ HelpSet hs = new HelpSet(cl, url);
+
+ HelpBroker hb = hs.createHelpBroker();
+ try
+ {
+ hb.setCurrentID(id.toString());
+ } catch (BadIDException bad)
+ {
+ System.out.println("Bad help link: " + id.toString()
+ + ": must match a target in help.jhm");
+ throw bad;
+ }
+ hb.setDisplayed(true);
+ }
+ }
+
+ public static void showHelpWindow() throws HelpSetException
+ {
+ showHelpWindow(HelpId.Home);
+ }
+}
diff --git a/src/jalview/gui/IProgressIndicator.java b/src/jalview/gui/IProgressIndicator.java
index 943c83d..5bbf9f6 100644
--- a/src/jalview/gui/IProgressIndicator.java
+++ b/src/jalview/gui/IProgressIndicator.java
@@ -1,49 +1,58 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.gui;
-
-/**
- * Visual progress indicator interface.
- *
- * @author JimP
- *
- */
-public interface IProgressIndicator
-{
- /**
- * Visual indication of some operation taking place. On first call with a
- * particular ID an indicator with the given message is added. The indicator
- * is removed with a second call with same ID.
- *
- * @param message
- * - displayed message for operation
- * @param id
- * - unique handle for this indicator
- */
- public abstract void setProgressBar(String message, long id);
-
- /**
- * register a handler for the progress bar identified by id
- *
- * @param id
- * @param handler
- */
- public abstract void registerHandler(long id,
- IProgressIndicatorHandler handler);
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+/**
+ * Visual progress indicator interface.
+ *
+ * @author JimP
+ *
+ */
+public interface IProgressIndicator
+{
+ /**
+ * Visual indication of some operation taking place. On first call with a
+ * particular ID an indicator with the given message is added. The indicator
+ * is removed with a second call with same ID.
+ *
+ * @param message
+ * - displayed message for operation
+ * @param id
+ * - unique handle for this indicator
+ */
+ public abstract void setProgressBar(String message, long id);
+
+ /**
+ * register a handler for the progress bar identified by id
+ *
+ * @param id
+ * @param handler
+ */
+ public abstract void registerHandler(long id,
+ IProgressIndicatorHandler handler);
+
+ /**
+ *
+ * @return true if any progress bars are still active
+ */
+ boolean operationInProgress();
+
+}
diff --git a/src/jalview/gui/IProgressIndicatorHandler.java b/src/jalview/gui/IProgressIndicatorHandler.java
index 3e8fa2f..64d93b4 100644
--- a/src/jalview/gui/IProgressIndicatorHandler.java
+++ b/src/jalview/gui/IProgressIndicatorHandler.java
@@ -1,35 +1,38 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.gui;
-
-public interface IProgressIndicatorHandler
-{
- /**
- *
- * @return true if a cancel button can be shown
- */
- public boolean canCancel();
-
- /**
- * Callback to cancel activity if the cancel button is pressed.
- *
- * @param id
- * @return true if activity was cancelled
- */
- public boolean cancelActivity(long id);
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+public interface IProgressIndicatorHandler
+{
+ /**
+ *
+ * @return true if a cancel button can be shown
+ */
+ public boolean canCancel();
+
+ /**
+ * Callback to cancel activity if the cancel button is pressed.
+ *
+ * @param id
+ * @return true if activity was cancelled
+ */
+ public boolean cancelActivity(long id);
+}
diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java
index 5cd7c51..d7a8f00 100644
--- a/src/jalview/gui/IdCanvas.java
+++ b/src/jalview/gui/IdCanvas.java
@@ -1,27 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.image.*;
-import javax.swing.*;
+import jalview.datamodel.SequenceI;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.util.List;
-import jalview.datamodel.*;
+import javax.swing.JPanel;
/**
* DOCUMENT ME!
@@ -47,7 +58,7 @@ public class IdCanvas extends JPanel
boolean fastPaint = false;
- java.util.Vector searchResults;
+ List<SequenceI> searchResults;
FontMetrics fm;
@@ -55,7 +66,7 @@ public class IdCanvas extends JPanel
AnnotationPanel ap;
- Font idfont;
+ private Font idfont;
/**
* Creates a new IdCanvas object.
@@ -75,6 +86,8 @@ public class IdCanvas extends JPanel
*
* @param gg
* DOCUMENT ME!
+ * @param hiddenRows
+ * true - check and display hidden row marker if need be
* @param s
* DOCUMENT ME!
* @param i
@@ -84,12 +97,12 @@ public class IdCanvas extends JPanel
* @param ypos
* DOCUMENT ME!
*/
- public void drawIdString(Graphics2D gg, SequenceI s, int i, int starty,
- int ypos)
+ public void drawIdString(Graphics2D gg, boolean hiddenRows, SequenceI s,
+ int i, int starty, int ypos)
{
int xPos = 0;
int panelWidth = getWidth();
- int charHeight = av.charHeight;
+ int charHeight = av.getCharHeight();
if ((searchResults != null) && searchResults.contains(s))
{
@@ -114,7 +127,7 @@ public class IdCanvas extends JPanel
gg.setColor(Color.black);
}
- if (av.rightAlignIds)
+ if (av.isRightAlignIds())
{
xPos = panelWidth
- fm.stringWidth(s.getDisplayId(av.getShowJVSuffix())) - 4;
@@ -123,7 +136,7 @@ public class IdCanvas extends JPanel
gg.drawString(s.getDisplayId(av.getShowJVSuffix()), xPos,
(((i - starty + 1) * charHeight) + ypos) - (charHeight / 5));
- if (av.hasHiddenRows && av.showHiddenMarkers)
+ if (hiddenRows)
{
drawMarker(i, starty, ypos);
}
@@ -145,7 +158,8 @@ public class IdCanvas extends JPanel
return;
}
- gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.charHeight);
+ gg.copyArea(0, 0, getWidth(), imgHeight, 0,
+ -vertical * av.getCharHeight());
int ss = av.startSeq;
int es = av.endSeq;
@@ -161,7 +175,7 @@ public class IdCanvas extends JPanel
}
else
{
- transY = imgHeight - (vertical * av.charHeight);
+ transY = imgHeight - (vertical * av.getCharHeight());
}
}
else if (vertical < 0)
@@ -206,7 +220,7 @@ public class IdCanvas extends JPanel
int oldHeight = imgHeight;
imgHeight = getHeight();
- imgHeight -= (imgHeight % av.charHeight);
+ imgHeight -= (imgHeight % av.getCharHeight());
if (imgHeight < 1)
{
@@ -240,17 +254,17 @@ public class IdCanvas extends JPanel
*/
void drawIds(int starty, int endy)
{
- if (av.seqNameItalics)
+ if (av.isSeqNameItalics())
{
- idfont = new Font(av.getFont().getName(), Font.ITALIC, av.getFont()
- .getSize());
+ setIdfont(new Font(av.getFont().getName(), Font.ITALIC, av.getFont()
+ .getSize()));
}
else
{
- idfont = av.getFont();
+ setIdfont(av.getFont());
}
- gg.setFont(idfont);
+ gg.setFont(getIdfont());
fm = gg.getFontMetrics();
if (av.antiAlias)
@@ -262,19 +276,22 @@ public class IdCanvas extends JPanel
Color currentColor = Color.white;
Color currentTextColor = Color.black;
+ final boolean doHiddenCheck = av.isDisplayReferenceSeq()
+ || av.hasHiddenRows(), hiddenRows = av.hasHiddenRows();
+
if (av.getWrapAlignment())
{
- int maxwidth = av.alignment.getWidth();
- int alheight = av.alignment.getHeight();
+ int maxwidth = av.getAlignment().getWidth();
+ int alheight = av.getAlignment().getHeight();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
int annotationHeight = 0;
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
if (ap == null)
{
@@ -288,13 +305,13 @@ public class IdCanvas extends JPanel
}
}
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = alheight * av.charHeight + hgap + annotationHeight;
+ int cHeight = alheight * av.getCharHeight() + hgap + annotationHeight;
int rowSize = av.getEndRes() - av.getStartRes();
@@ -304,24 +321,24 @@ public class IdCanvas extends JPanel
{
for (int i = starty; i < alheight; i++)
{
- SequenceI s = av.alignment.getSequenceAt(i);
- if (av.hasHiddenRows)
+ SequenceI s = av.getAlignment().getSequenceAt(i);
+ if (doHiddenCheck)
{
setHiddenFont(s);
}
else
{
- gg.setFont(idfont);
+ gg.setFont(getIdfont());
}
- drawIdString(gg, s, i, 0, ypos);
+ drawIdString(gg, hiddenRows, s, i, 0, ypos);
}
- if (labels != null && av.showAnnotation)
+ if (labels != null && av.isShowAnnotation())
{
- gg.translate(0, ypos + (alheight * av.charHeight));
+ gg.translate(0, ypos + (alheight * av.getCharHeight()));
labels.drawComponent(gg, getWidth());
- gg.translate(0, -ypos - (alheight * av.charHeight));
+ gg.translate(0, -ypos - (alheight * av.getCharHeight()));
}
}
}
@@ -338,14 +355,14 @@ public class IdCanvas extends JPanel
// Now draw the id strings
for (int i = starty; i < endy; i++)
{
- sequence = av.alignment.getSequenceAt(i);
+ sequence = av.getAlignment().getSequenceAt(i);
if (sequence == null)
{
continue;
}
- if (av.hasHiddenRows)
+ if (doHiddenCheck)
{
setHiddenFont(sequence);
}
@@ -371,23 +388,23 @@ public class IdCanvas extends JPanel
gg.setColor(currentColor);
- gg.fillRect(0, (i - starty) * av.charHeight, getWidth(),
- av.charHeight);
+ gg.fillRect(0, (i - starty) * av.getCharHeight(), getWidth(),
+ av.getCharHeight());
gg.setColor(currentTextColor);
String string = sequence.getDisplayId(av.getShowJVSuffix());
- if (av.rightAlignIds)
+ if (av.isRightAlignIds())
{
xPos = panelWidth - fm.stringWidth(string) - 4;
}
gg.drawString(string, xPos,
- (((i - starty) * av.charHeight) + av.charHeight)
- - (av.charHeight / 5));
+ (((i - starty) * av.getCharHeight()) + av.getCharHeight())
+ - (av.getCharHeight() / 5));
- if (av.hasHiddenRows && av.showHiddenMarkers)
+ if (hiddenRows)
{
drawMarker(i, starty, 0);
}
@@ -400,7 +417,7 @@ public class IdCanvas extends JPanel
void drawMarker(int i, int starty, int yoffset)
{
- SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences;
+ SequenceI[] hseqs = av.getAlignment().getHiddenSequences().hiddenSequences;
// Use this method here instead of calling hiddenSeq adjust
// 3 times.
int hSize = hseqs.length;
@@ -435,25 +452,24 @@ public class IdCanvas extends JPanel
if (below)
{
gg.fillPolygon(
- new int[]
- { getWidth() - av.charHeight, getWidth() - av.charHeight,
- getWidth() }, new int[]
- {
- (i - starty) * av.charHeight + yoffset,
- (i - starty) * av.charHeight + yoffset + av.charHeight
- / 4, (i - starty) * av.charHeight + yoffset }, 3);
+ new int[] { getWidth() - av.getCharHeight(),
+ getWidth() - av.getCharHeight(), getWidth() },
+ new int[] {
+ (i - starty) * av.getCharHeight() + yoffset,
+ (i - starty) * av.getCharHeight() + yoffset
+ + av.getCharHeight() / 4,
+ (i - starty) * av.getCharHeight() + yoffset }, 3);
}
if (above)
{
gg.fillPolygon(
- new int[]
- { getWidth() - av.charHeight, getWidth() - av.charHeight,
- getWidth() }, new int[]
- {
- (i - starty + 1) * av.charHeight + yoffset,
- (i - starty + 1) * av.charHeight + yoffset
- - av.charHeight / 4,
- (i - starty + 1) * av.charHeight + yoffset }, 3);
+ new int[] { getWidth() - av.getCharHeight(),
+ getWidth() - av.getCharHeight(), getWidth() },
+ new int[] {
+ (i - starty + 1) * av.getCharHeight() + yoffset,
+ (i - starty + 1) * av.getCharHeight() + yoffset
+ - av.getCharHeight() / 4,
+ (i - starty + 1) * av.getCharHeight() + yoffset }, 3);
}
}
@@ -463,26 +479,35 @@ public class IdCanvas extends JPanel
Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont()
.getSize());
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(seq))
+ if (av.isHiddenRepSequence(seq))
{
gg.setFont(bold);
}
else
{
- gg.setFont(idfont);
+ gg.setFont(getIdfont());
}
}
/**
* DOCUMENT ME!
*
- * @param found
+ * @param list
* DOCUMENT ME!
*/
- public void setHighlighted(java.util.Vector found)
+ public void setHighlighted(List<SequenceI> list)
{
- searchResults = found;
+ searchResults = list;
repaint();
}
+
+ public Font getIdfont()
+ {
+ return idfont;
+ }
+
+ public void setIdfont(Font idfont)
+ {
+ this.idfont = idfont;
+ }
}
diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java
index 1732291..b5569c3 100644
--- a/src/jalview/gui/IdPanel.java
+++ b/src/jalview/gui/IdPanel.java
@@ -1,33 +1,51 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.event.*;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.io.SequenceAnnotationReport;
+import jalview.util.MessageManager;
+import jalview.util.UrlLink;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.BorderLayout;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import java.util.List;
import java.util.Vector;
-import javax.swing.*;
-
-import jalview.datamodel.*;
-import jalview.util.UrlLink;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.ToolTipManager;
/**
- * DOCUMENT ME!
+ * This panel hosts alignment sequence ids and responds to mouse clicks on them,
+ * as well as highlighting ids matched by a search from the Find menu.
*
* @author $author$
* @version $Revision$
@@ -35,9 +53,9 @@ import jalview.util.UrlLink;
public class IdPanel extends JPanel implements MouseListener,
MouseMotionListener, MouseWheelListener
{
- protected IdCanvas idCanvas;
+ private IdCanvas idCanvas;
- protected AlignViewport av;
+ protected AlignmentViewport av;
protected AlignmentPanel alignPanel;
@@ -52,22 +70,23 @@ public class IdPanel extends JPanel implements MouseListener,
boolean mouseDragging = false;
+ private final SequenceAnnotationReport seqAnnotReport;
+
/**
* Creates a new IdPanel object.
*
* @param av
- * DOCUMENT ME!
* @param parent
- * DOCUMENT ME!
*/
public IdPanel(AlignViewport av, AlignmentPanel parent)
{
this.av = av;
alignPanel = parent;
- idCanvas = new IdCanvas(av);
+ setIdCanvas(new IdCanvas(av));
linkImageURL = getClass().getResource("/images/link.gif").toString();
+ seqAnnotReport = new SequenceAnnotationReport(linkImageURL);
setLayout(new BorderLayout());
- add(idCanvas, BorderLayout.CENTER);
+ add(getIdCanvas(), BorderLayout.CENTER);
addMouseListener(this);
addMouseMotionListener(this);
addMouseWheelListener(this);
@@ -75,86 +94,41 @@ public class IdPanel extends JPanel implements MouseListener,
}
/**
- * DOCUMENT ME!
+ * Respond to mouse movement by constructing tooltip text for the sequence id
+ * under the mouse.
*
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseMoved(MouseEvent e)
{
- SeqPanel sp = alignPanel.seqPanel;
+ SeqPanel sp = alignPanel.getSeqPanel();
int seq = Math.max(0, sp.findSeq(e));
- String tmp;
- if (seq > -1 && seq < av.alignment.getHeight())
+ if (seq > -1 && seq < av.getAlignment().getHeight())
{
- SequenceI sequence = av.alignment.getSequenceAt(seq);
- StringBuffer tip = new StringBuffer();
- tip.append("<i>");
-
- int maxWidth = 0;
- if (sequence.getDescription() != null)
- {
- tmp = sequence.getDescription();
- tip.append("<br>" + tmp);
- maxWidth = Math.max(maxWidth, tmp.length());
- }
-
- DBRefEntry[] dbrefs = sequence.getDatasetSequence().getDBRef();
- if (av.isShowDbRefs() && dbrefs != null)
- {
- for (int i = 0; i < dbrefs.length; i++)
- {
- tip.append("<br>");
- tmp = dbrefs[i].getSource() + " " + dbrefs[i].getAccessionId();
- tip.append(tmp);
- maxWidth = Math.max(maxWidth, tmp.length());
- }
- }
-
- // ADD NON POSITIONAL SEQUENCE INFO
- SequenceFeature[] features = sequence.getDatasetSequence()
- .getSequenceFeatures();
- SequenceFeature[] tfeat = new SequenceFeature[1];
- if (av.isShowNpFeats() && features != null)
- {
- for (int i = 0; i < features.length; i++)
- {
- if (features[i].begin == 0 && features[i].end == 0)
- {
- int sz = -tip.length();
- tfeat[0] = features[i];
- sp.appendFeatures(tip, linkImageURL, 0, tfeat,
- sp.seqCanvas.fr.minmax);
- sz += tip.length();
- maxWidth = Math.max(maxWidth, sz);
- }
- }
- }
-
- if (maxWidth > 60)
- {
- tip.insert(0, "<table width=350 border=0><tr><td><i>");
- tip.append("</i></td></tr></table>");
- }
-
- tip.append("</html>");
-
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);
+ StringBuffer tip = new StringBuffer(64);
+ seqAnnotReport.createSequenceAnnotationReport(tip, sequence,
+ av.isShowDBRefs(), av.isShowNPFeats(),
+ sp.seqCanvas.fr.getMinMax());
setToolTipText("<html>" + sequence.getDisplayId(true) + " "
- + tip.toString());
+ + tip.toString() + "</html>");
}
}
/**
- * DOCUMENT ME!
+ * Responds to a mouse drag by selecting the sequences under the dragged
+ * region.
*
* @param e
- * DOCUMENT ME!
*/
+ @Override
public void mouseDragged(MouseEvent e)
{
mouseDragging = true;
- int seq = Math.max(0, alignPanel.seqPanel.findSeq(e));
+ int seq = Math.max(0, alignPanel.getSeqPanel().findSeq(e));
if (seq < lastid)
{
@@ -169,39 +143,66 @@ public class IdPanel extends JPanel implements MouseListener,
alignPanel.paintAlignment(true);
}
+ /**
+ * Response to the mouse wheel by scrolling the alignment panel.
+ */
+ @Override
public void mouseWheelMoved(MouseWheelEvent e)
{
e.consume();
if (e.getWheelRotation() > 0)
{
- alignPanel.scrollUp(false);
+ if (e.isShiftDown())
+ {
+ alignPanel.scrollRight(true);
+ }
+ else
+ {
+ alignPanel.scrollUp(false);
+ }
}
else
{
- alignPanel.scrollUp(true);
+ if (e.isShiftDown())
+ {
+ alignPanel.scrollRight(false);
+ }
+ else
+ {
+ alignPanel.scrollUp(true);
+ }
}
}
/**
- * DOCUMENT ME!
+ * Handle a mouse click event. Currently only responds to a double-click. The
+ * action is to try to open a browser window at a URL that searches for the
+ * selected sequence id. The search URL is configured in Preferences |
+ * Connections | URL link from Sequence ID. For example:
+ *
+ * http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$
*
* @param e
- * DOCUMENT ME!
*/
+ @Override
public void mouseClicked(MouseEvent e)
{
- if (e.getClickCount() < 2)
+ /*
+ * Ignore single click. Ignore 'left' click followed by 'right' click (user
+ * selects a row then its pop-up menu).
+ */
+ if (e.getClickCount() < 2 || SwingUtilities.isRightMouseButton(e))
{
return;
}
- java.util.Vector links = Preferences.sequenceURLLinks;
+ Vector links = Preferences.sequenceURLLinks;
if (links == null || links.size() < 1)
{
return;
}
- int seq = alignPanel.seqPanel.findSeq(e);
+ int seq = alignPanel.getSeqPanel().findSeq(e);
String url = null;
int i = 0;
String id = av.getAlignment().getSequenceAt(seq).getName();
@@ -243,15 +244,12 @@ public class IdPanel extends JPanel implements MouseListener,
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
- "Unixers: Couldn't find default web browser."
- + "\nAdd the full path to your browser in Preferences.",
- "Web browser not found", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.web_browser_not_found_unix"),
+ MessageManager.getString("label.web_browser_not_found"),
+ JOptionPane.WARNING_MESSAGE);
ex.printStackTrace();
}
-
}
/**
@@ -260,6 +258,7 @@ public class IdPanel extends JPanel implements MouseListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseEntered(MouseEvent e)
{
if (scrollThread != null)
@@ -274,6 +273,7 @@ public class IdPanel extends JPanel implements MouseListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseExited(MouseEvent e)
{
if (av.getWrapAlignment())
@@ -287,34 +287,42 @@ public class IdPanel extends JPanel implements MouseListener,
}
if (mouseDragging && (e.getY() >= getHeight())
- && (av.alignment.getHeight() > av.getEndSeq()))
+ && (av.getAlignment().getHeight() > av.getEndSeq()))
{
scrollThread = new ScrollThread(false);
}
}
/**
- * DOCUMENT ME!
+ * Respond to a mouse press. Does nothing for (left) double-click as this is
+ * handled by mouseClicked().
+ *
+ * Right mouse down - construct and show context menu.
+ *
+ * Ctrl-down or Shift-down - add to or expand current selection group if there
+ * is one.
+ *
+ * Mouse down - select this sequence.
*
* @param e
- * DOCUMENT ME!
*/
+ @Override
public void mousePressed(MouseEvent e)
{
- if (e.getClickCount() == 2)
+ if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e))
{
return;
}
- int seq = alignPanel.seqPanel.findSeq(e);
+ int seq = alignPanel.getSeqPanel().findSeq(e);
- if (javax.swing.SwingUtilities.isRightMouseButton(e))
+ if (SwingUtilities.isRightMouseButton(e))
{
Sequence sq = (Sequence) av.getAlignment().getSequenceAt(seq);
// build a new links menu based on the current links + any non-positional
// features
Vector nlinks = new Vector(Preferences.sequenceURLLinks);
- SequenceFeature sf[] = sq==null ? null : sq.getDatasetSequence().getSequenceFeatures();
+ SequenceFeature sf[] = sq == null ? null : sq.getSequenceFeatures();
for (int sl = 0; sf != null && sl < sf.length; sl++)
{
if (sf[sl].begin == sf[sl].end && sf[sl].begin == 0)
@@ -342,7 +350,7 @@ public class IdPanel extends JPanel implements MouseListener,
{
av.setSelectionGroup(new SequenceGroup());
av.getSelectionGroup().setStartRes(0);
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+ av.getSelectionGroup().setEndRes(av.getAlignment().getWidth() - 1);
}
if (e.isShiftDown() && (lastid != -1))
@@ -353,14 +361,16 @@ public class IdPanel extends JPanel implements MouseListener,
{
selectSeq(seq);
}
+ // TODO is this addition ok here?
+ av.isSelectionGroupChanged(true);
+
alignPanel.paintAlignment(true);
}
/**
- * DOCUMENT ME!
+ * Toggle whether the sequence is part of the current selection group.
*
* @param seq
- * DOCUMENT ME!
*/
void selectSeq(int seq)
{
@@ -371,12 +381,11 @@ public class IdPanel extends JPanel implements MouseListener,
}
/**
- * DOCUMENT ME!
+ * Add contiguous rows of the alignment to the current selection group. Does
+ * nothing if there is no selection group.
*
* @param start
- * DOCUMENT ME!
* @param end
- * DOCUMENT ME!
*/
void selectSeqs(int start, int end)
{
@@ -403,16 +412,17 @@ public class IdPanel extends JPanel implements MouseListener,
for (int i = start; i <= end; i++)
{
av.getSelectionGroup().addSequence(
- av.getAlignment().getSequenceAt(i), true);
+ av.getAlignment().getSequenceAt(i), i == end);
}
}
/**
- * DOCUMENT ME!
+ * Respond to mouse released. Refreshes the display and triggers broadcast of
+ * the new selection group to any listeners.
*
* @param e
- * DOCUMENT ME!
*/
+ @Override
public void mouseReleased(MouseEvent e)
{
if (scrollThread != null)
@@ -427,21 +437,21 @@ public class IdPanel extends JPanel implements MouseListener,
}
/**
- * DOCUMENT ME!
+ * Highlight sequence ids that match the given list, and if necessary scroll
+ * to the start sequence of the list.
*
- * @param found
- * DOCUMENT ME!
+ * @param list
*/
- public void highlightSearchResults(java.util.Vector found)
+ public void highlightSearchResults(List<SequenceI> list)
{
- idCanvas.setHighlighted(found);
+ getIdCanvas().setHighlighted(list);
- if (found == null)
+ if (list == null)
{
return;
}
- int index = av.alignment.findIndex((SequenceI) found.get(0));
+ int index = av.getAlignment().findIndex(list.get(0));
// do we need to scroll the panel?
if ((av.getStartSeq() > index) || (av.getEndSeq() < index))
@@ -450,6 +460,16 @@ public class IdPanel extends JPanel implements MouseListener,
}
}
+ public IdCanvas getIdCanvas()
+ {
+ return idCanvas;
+ }
+
+ public void setIdCanvas(IdCanvas idCanvas)
+ {
+ this.idCanvas = idCanvas;
+ }
+
// this class allows scrolling off the bottom of the visible alignment
class ScrollThread extends Thread
{
@@ -468,6 +488,7 @@ public class IdPanel extends JPanel implements MouseListener,
running = false;
}
+ @Override
public void run()
{
running = true;
diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java
index f7ff75a..f26dfa7 100644
--- a/src/jalview/gui/IdwidthAdjuster.java
+++ b/src/jalview/gui/IdwidthAdjuster.java
@@ -1,25 +1,35 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.api.AlignViewportI;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+
+import javax.swing.JPanel;
/**
* DOCUMENT ME!
@@ -80,6 +90,20 @@ public class IdwidthAdjuster extends JPanel implements MouseListener,
{
active = false;
repaint();
+
+ /*
+ * If in a SplitFrame with co-scaled alignments, set the other's id width to
+ * match
+ */
+ final AlignViewportI viewport = ap.getAlignViewport();
+ if (viewport.getCodingComplement() != null
+ && viewport.isScaleProteinAsCdna())
+ {
+ viewport.getCodingComplement().setIdWidth(viewport.getIdWidth());
+ SplitFrame sf = (SplitFrame) ap.alignFrame.getSplitViewContainer();
+ sf.repaint();
+ }
+
}
/**
@@ -116,13 +140,15 @@ public class IdwidthAdjuster extends JPanel implements MouseListener,
{
active = true;
- Dimension d = ap.idPanel.idCanvas.getPreferredSize();
+ final AlignViewportI viewport = ap.getAlignViewport();
+ int curwidth = viewport.getIdWidth();
int dif = evt.getX() - oldX;
- if (((d.width + dif) > 20) || (dif > 0))
+ final int newWidth = curwidth + dif;
+ if ((newWidth > 20) || (dif > 0))
{
- ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif,
- d.height));
+ viewport.setIdWidth(newWidth);
+
ap.paintAlignment(true);
}
diff --git a/src/jalview/gui/JDatabaseTree.java b/src/jalview/gui/JDatabaseTree.java
new file mode 100644
index 0000000..0ee8008
--- /dev/null
+++ b/src/jalview/gui/JDatabaseTree.java
@@ -0,0 +1,573 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.bin.Cache;
+import jalview.util.MessageManager;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeCellRenderer;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+
+public class JDatabaseTree extends JalviewDialog implements KeyListener
+{
+ boolean allowMultiSelections = false;
+
+ public int action;
+
+ JButton getDatabaseSelectorButton()
+ {
+ final JButton viewdbs = new JButton(
+ MessageManager.getString("action.select_ddbb"));
+ viewdbs.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ showDialog(null);
+ }
+ });
+ return viewdbs;
+ }
+
+ JScrollPane svp;
+
+ JTree dbviews;
+
+ private jalview.ws.SequenceFetcher sfetcher;
+
+ private JLabel dbstatus, dbstatex;
+
+ public JDatabaseTree(jalview.ws.SequenceFetcher sfetch)
+ {
+ initDialogFrame(this, true, false,
+ MessageManager
+ .getString("label.select_database_retrieval_source"),
+ 650, 490);
+ /*
+ * Dynamically generated database list will need a translation function from
+ * internal source to externally distinct names. UNIPROT and UP_NAME are
+ * identical DB sources, and should be collapsed.
+ */
+ DefaultMutableTreeNode tn = null, root = new DefaultMutableTreeNode();
+ Hashtable<String, DefaultMutableTreeNode> source = new Hashtable<String, DefaultMutableTreeNode>();
+ sfetcher = sfetch;
+ String dbs[] = sfetch.getSupportedDb();
+ Hashtable<String, String> ht = new Hashtable<String, String>();
+ for (int i = 0; i < dbs.length; i++)
+ {
+ tn = source.get(dbs[i]);
+ List<DbSourceProxy> srcs = sfetch.getSourceProxy(dbs[i]);
+ if (tn == null)
+ {
+ source.put(dbs[i], tn = new DefaultMutableTreeNode(dbs[i], true));
+ }
+ for (DbSourceProxy dbp : srcs)
+ {
+ if (ht.get(dbp.getDbName()) == null)
+ {
+ tn.add(new DefaultMutableTreeNode(dbp, false));
+ ht.put(dbp.getDbName(), dbp.getDbName());
+ }
+ else
+ {
+ System.err.println("dupe ig for : " + dbs[i] + " \t"
+ + dbp.getDbName() + " (" + dbp.getDbSource() + ")");
+ source.remove(tn);
+ }
+ }
+ }
+ for (int i = 0; i < dbs.length; i++)
+ {
+ tn = source.get(dbs[i]);
+ if (tn == null)
+ {
+ continue;
+ }
+ if (tn.getChildCount() == 1)
+ {
+ DefaultMutableTreeNode ttn = (DefaultMutableTreeNode) tn
+ .getChildAt(0);
+ // remove nodes with only one child
+ tn.setUserObject(ttn.getUserObject());
+ tn.removeAllChildren();
+ source.put(dbs[i], tn);
+ tn.setAllowsChildren(false);
+ }
+ root.add(tn);
+ }
+ // and sort the tree
+ sortTreeNodes(root);
+ svp = new JScrollPane();
+ // svp.setAutoscrolls(true);
+ dbviews = new JTree(new DefaultTreeModel(root, false));
+ dbviews.setCellRenderer(new DbTreeRenderer(this));
+
+ dbviews.getSelectionModel().setSelectionMode(
+ TreeSelectionModel.SINGLE_TREE_SELECTION);
+ svp.getViewport().setView(dbviews);
+ // svp.getViewport().setMinimumSize(new Dimension(300,200));
+ // svp.setSize(300,250);
+ // JPanel panel=new JPanel();
+ // panel.setSize(new Dimension(350,220));
+ // panel.add(svp);
+ dbviews.addTreeSelectionListener(new TreeSelectionListener()
+ {
+
+ @Override
+ public void valueChanged(TreeSelectionEvent arg0)
+ {
+ _setSelectionState();
+ }
+ });
+ JPanel jc = new JPanel(new BorderLayout()), j = new JPanel(
+ new FlowLayout());
+ jc.add(svp, BorderLayout.CENTER);
+
+ java.awt.Font f;
+ // TODO: make the panel stay a fixed size for longest dbname+example set.
+ JPanel dbstat = new JPanel(new GridLayout(2, 1));
+ dbstatus = new JLabel(" "); // set the height correctly for layout
+ dbstatus.setFont(f = JvSwingUtils.getLabelFont(false, true));
+ dbstatus.setSize(new Dimension(290, 50));
+ dbstatex = new JLabel(" ");
+ dbstatex.setFont(f);
+ dbstatex.setSize(new Dimension(290, 50));
+ dbstat.add(dbstatus);
+ dbstat.add(dbstatex);
+ jc.add(dbstat, BorderLayout.SOUTH);
+ jc.validate();
+ // j.setPreferredSize(new Dimension(300,50));
+ add(jc, BorderLayout.CENTER);
+ j.add(ok);
+ j.add(cancel);
+ add(j, BorderLayout.SOUTH);
+ dbviews.addKeyListener(this);
+ validate();
+ }
+
+ private void sortTreeNodes(DefaultMutableTreeNode root)
+ {
+ if (root.getChildCount() == 0)
+ {
+ return;
+ }
+ int count = root.getChildCount();
+ String[] names = new String[count];
+ DefaultMutableTreeNode[] nodes = new DefaultMutableTreeNode[count];
+ for (int i = 0; i < count; i++)
+ {
+ TreeNode node = root.getChildAt(i);
+ if (node instanceof DefaultMutableTreeNode)
+ {
+ DefaultMutableTreeNode child = (DefaultMutableTreeNode) node;
+ nodes[i] = child;
+ if (child.getUserObject() instanceof DbSourceProxy)
+ {
+ names[i] = ((DbSourceProxy) child.getUserObject()).getDbName()
+ .toLowerCase();
+ }
+ else
+ {
+ names[i] = ((String) child.getUserObject()).toLowerCase();
+ sortTreeNodes(child);
+ }
+ }
+ else
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_cant_reorder_tree"));
+ }
+ }
+ jalview.util.QuickSort.sort(names, nodes);
+ root.removeAllChildren();
+ for (int i = count - 1; i >= 0; i--)
+ {
+ root.add(nodes[i]);
+ }
+ }
+
+ private class DbTreeRenderer extends DefaultTreeCellRenderer implements
+ TreeCellRenderer
+ {
+ JDatabaseTree us;
+
+ public DbTreeRenderer(JDatabaseTree me)
+ {
+ us = me;
+ }
+
+ private Component returnLabel(String txt)
+ {
+ JLabel jl = new JLabel(txt);
+ jl.setFont(JvSwingUtils.getLabelFont());
+ return jl;
+ }
+
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree, Object value,
+ boolean selected, boolean expanded, boolean leaf, int row,
+ boolean hasFocus)
+ {
+ String val = "";
+ if (value != null && value instanceof DefaultMutableTreeNode)
+ {
+ DefaultMutableTreeNode vl = (DefaultMutableTreeNode) value;
+ value = vl.getUserObject();
+ if (value instanceof DbSourceProxy)
+ {
+ val = (((DbSourceProxy) value).getDbName());
+ }
+ else
+ {
+ if (value instanceof String)
+ {
+ val = ((String) value);
+ }
+ }
+ }
+ if (value == null)
+ {
+ val = ("");
+ }
+ return super.getTreeCellRendererComponent(tree, val, selected,
+ expanded, leaf, row, hasFocus);
+
+ }
+ }
+
+ List<DbSourceProxy> oldselection, selection = null;
+
+ TreePath[] tsel = null, oldtsel = null;
+
+ @Override
+ protected void raiseClosed()
+ {
+ for (ActionListener al : lstners)
+ {
+ al.actionPerformed(null);
+ }
+ }
+
+ @Override
+ protected void okPressed()
+ {
+ _setSelectionState();
+ closeDialog();
+ }
+
+ @Override
+ protected void cancelPressed()
+ {
+ selection = oldselection;
+ tsel = oldtsel;
+ _revertSelectionState();
+ closeDialog();
+ }
+
+ private void showDialog(Container parent)
+ {
+ oldselection = selection;
+ oldtsel = tsel;
+ validate();
+ waitForInput();
+ }
+
+ public boolean hasSelection()
+ {
+ return selection == null ? false : selection.size() == 0 ? false : true;
+ }
+
+ public List<DbSourceProxy> getSelectedSources()
+ {
+ return selection;
+ }
+
+ /**
+ * disable or enable selection handler
+ */
+ boolean handleSelections = true;
+
+ private void _setSelectionState()
+ {
+ if (!handleSelections)
+ {
+ return;
+ }
+ if (dbviews.getSelectionCount() == 0)
+ {
+ selection = null;
+ }
+ tsel = dbviews.getSelectionPaths();
+ boolean forcedFirstChild = false;
+ List<DbSourceProxy> srcs = new ArrayList<DbSourceProxy>();
+ if (tsel != null)
+ {
+ for (TreePath tp : tsel)
+ {
+ DefaultMutableTreeNode admt, dmt = (DefaultMutableTreeNode) tp
+ .getLastPathComponent();
+ if (dmt.getUserObject() != null)
+ {
+ if (dmt.getUserObject() instanceof DbSourceProxy)
+ {
+ srcs.add((DbSourceProxy) dmt.getUserObject());
+ }
+ else
+ {
+ if (allowMultiSelections)
+ {
+ srcs.addAll(sfetcher.getSourceProxy((String) dmt
+ .getUserObject()));
+ }
+ else
+ {
+ srcs.add(sfetcher
+ .getSourceProxy((String) dmt.getUserObject()).get(0));
+ forcedFirstChild = true;
+ }
+ }
+ }
+ }
+ }
+ updateDbStatus(srcs, forcedFirstChild);
+ selection = srcs;
+ }
+
+ private void _revertSelectionState()
+ {
+ handleSelections = false;
+ if (selection == null || selection.size() == 0)
+ {
+ dbviews.clearSelection();
+ }
+ else
+ {
+ dbviews.setSelectionPaths(tsel);
+ }
+ handleSelections = true;
+ }
+
+ private void updateDbStatus(List<DbSourceProxy> srcs,
+ boolean forcedFirstChild)
+ {
+ int x = 0;
+ String nm = "", qr = "";
+ for (DbSourceProxy dbs : srcs)
+ {
+ String tq = dbs.getTestQuery();
+ nm = dbs.getDbName();
+ if (tq != null && tq.trim().length() > 0 && dbs.isValidReference(tq))
+ {
+ qr = tq;
+ x++;
+ }
+ }
+
+ if (allowMultiSelections)
+ {
+ dbstatus.setText(MessageManager.formatMessage(
+ "label.selected_database_to_fetch_from", new String[] {
+ Integer.valueOf(srcs.size()).toString(),
+ (srcs.size() == 1 ? "" : "s"),
+ (srcs.size() > 0 ? " with " + x + " test quer"
+ + (x == 1 ? "y" : "ies") : ".") }));
+ dbstatex.setText(" ");
+ }
+ else
+ {
+ if (nm.length() > 0)
+ {
+ dbstatus.setText(MessageManager.formatMessage(
+ "label.database_param", new String[] { nm }));
+ if (qr.length() > 0)
+ {
+ dbstatex.setText(MessageManager.formatMessage(
+ "label.example_param", new String[] { qr }));
+ }
+ else
+ {
+ dbstatex.setText(" ");
+ }
+ }
+ else
+ {
+ dbstatus.setText(" ");
+ }
+ }
+ dbstatus.invalidate();
+ dbstatex.invalidate();
+ }
+
+ public String getSelectedItem()
+ {
+ if (hasSelection())
+ {
+ return getSelectedSources().get(0).getDbName();
+ }
+ return null;
+ }
+
+ public String getExampleQueries()
+ {
+ if (!hasSelection())
+ {
+ return null;
+ }
+ StringBuffer sb = new StringBuffer();
+ HashSet<String> hs = new HashSet<String>();
+ for (DbSourceProxy dbs : getSelectedSources())
+ {
+ String tq = dbs.getTestQuery();
+ ;
+ if (hs.add(tq))
+ {
+ if (sb.length() > 0)
+ {
+ sb.append(";");
+ }
+ sb.append(tq);
+ }
+ }
+ return sb.toString();
+ }
+
+ List<ActionListener> lstners = new Vector<ActionListener>();
+
+ public void addActionListener(ActionListener actionListener)
+ {
+ lstners.add(actionListener);
+ }
+
+ public void removeActionListener(ActionListener actionListener)
+ {
+ lstners.remove(actionListener);
+ }
+
+ public static void main(String args[])
+ {
+ Cache.getDasSourceRegistry();
+ JDatabaseTree jdt = new JDatabaseTree(new jalview.ws.SequenceFetcher());
+ JFrame foo = new JFrame();
+ foo.setLayout(new BorderLayout());
+ foo.add(jdt.getDatabaseSelectorButton(), BorderLayout.CENTER);
+ foo.pack();
+ foo.setVisible(true);
+ int nultimes = 5;
+ final Thread us = Thread.currentThread();
+ jdt.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ us.interrupt();
+ }
+ });
+ do
+ {
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
+ {
+ nultimes--;
+ if (!jdt.hasSelection())
+ {
+ System.out.println("No Selection");
+ }
+ else
+ {
+ System.out.println("Selection: " + jdt.getSelectedItem());
+ int s = 1;
+ for (DbSourceProxy pr : jdt.getSelectedSources())
+ {
+ System.out.println("Source " + s++ + ": " + pr.getDbName()
+ + " (" + pr.getDbSource() + ") Version "
+ + pr.getDbVersion() + ". Test:\t" + pr.getTestQuery());
+ }
+ System.out.println("Test queries: " + jdt.getExampleQueries());
+ }
+ }
+ } while (nultimes > 0 && foo.isVisible());
+ foo.setVisible(false);
+ }
+
+ @Override
+ public void keyPressed(KeyEvent arg0)
+ {
+ if (!arg0.isConsumed() && arg0.getKeyCode() == KeyEvent.VK_ENTER)
+ {
+ action = arg0.getKeyCode();
+ okPressed();
+ }
+ if (!arg0.isConsumed() && arg0.getKeyChar() == KeyEvent.VK_ESCAPE)
+ {
+ action = arg0.getKeyCode();
+ cancelPressed();
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void keyTyped(KeyEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java
index cb29ab5..d920c7f 100644
--- a/src/jalview/gui/Jalview2XML.java
+++ b/src/jalview/gui/Jalview2XML.java
@@ -1,44 +1,133 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.Rectangle;
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.net.*;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.jar.*;
-
-import javax.swing.*;
-
-import org.exolab.castor.xml.*;
-
-import uk.ac.vamsas.objects.utils.MapList;
+import jalview.api.ViewStyleI;
+import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
+import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.RnaViewerModel;
+import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
-import jalview.schemabinding.version2.*;
-import jalview.schemes.*;
+import jalview.datamodel.StructureViewerModel;
+import jalview.datamodel.StructureViewerModel.StructureData;
+import jalview.ext.varna.RnaModel;
+import jalview.gui.StructureViewer.ViewerType;
+import jalview.schemabinding.version2.AlcodMap;
+import jalview.schemabinding.version2.AlcodonFrame;
+import jalview.schemabinding.version2.Annotation;
+import jalview.schemabinding.version2.AnnotationColours;
+import jalview.schemabinding.version2.AnnotationElement;
+import jalview.schemabinding.version2.CalcIdParam;
+import jalview.schemabinding.version2.DBRef;
+import jalview.schemabinding.version2.Features;
+import jalview.schemabinding.version2.Group;
+import jalview.schemabinding.version2.HiddenColumns;
+import jalview.schemabinding.version2.JGroup;
+import jalview.schemabinding.version2.JSeq;
+import jalview.schemabinding.version2.JalviewModel;
+import jalview.schemabinding.version2.JalviewModelSequence;
+import jalview.schemabinding.version2.MapListFrom;
+import jalview.schemabinding.version2.MapListTo;
+import jalview.schemabinding.version2.Mapping;
+import jalview.schemabinding.version2.MappingChoice;
+import jalview.schemabinding.version2.OtherData;
+import jalview.schemabinding.version2.PdbentryItem;
+import jalview.schemabinding.version2.Pdbids;
+import jalview.schemabinding.version2.Property;
+import jalview.schemabinding.version2.RnaViewer;
+import jalview.schemabinding.version2.SecondaryStructure;
+import jalview.schemabinding.version2.Sequence;
+import jalview.schemabinding.version2.SequenceSet;
+import jalview.schemabinding.version2.SequenceSetProperties;
+import jalview.schemabinding.version2.Setting;
+import jalview.schemabinding.version2.StructureState;
+import jalview.schemabinding.version2.ThresholdLine;
+import jalview.schemabinding.version2.Tree;
+import jalview.schemabinding.version2.UserColours;
+import jalview.schemabinding.version2.Viewport;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.GraduatedColor;
+import jalview.schemes.ResidueColourScheme;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
import jalview.structure.StructureSelectionManager;
+import jalview.structures.models.AAStructureBindingModel;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
import jalview.util.jarInputStreamProvider;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
+import jalview.viewmodel.seqfeatures.FeaturesDisplayed;
+import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.jws2.dm.AAConSettings;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.AutoCalcSetting;
+import jalview.ws.params.WsParamSetI;
+
+import java.awt.Rectangle;
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
/**
* Write out the current jalview desktop state as a Jalview XML stream.
@@ -52,6 +141,44 @@ import jalview.util.jarInputStreamProvider;
*/
public class Jalview2XML
{
+ private static final String VIEWER_PREFIX = "viewer_";
+
+ private static final String RNA_PREFIX = "rna_";
+
+ private static final String UTF_8 = "UTF-8";
+
+ // use this with nextCounter() to make unique names for entities
+ private int counter = 0;
+
+ /*
+ * SequenceI reference -> XML ID string in jalview XML. Populated as XML reps
+ * of sequence objects are created.
+ */
+ IdentityHashMap<SequenceI, String> seqsToIds = null;
+
+ /**
+ * jalview XML Sequence ID to jalview sequence object reference (both dataset
+ * and alignment sequences. Populated as XML reps of sequence objects are
+ * created.)
+ */
+ Map<String, SequenceI> seqRefIds = null;
+
+ Vector frefedSequence = null;
+
+ boolean raiseGUI = true; // whether errors are raised in dialog boxes or not
+
+ /*
+ * Map of reconstructed AlignFrame objects that appear to have come from
+ * SplitFrame objects (have a dna/protein complement view).
+ */
+ private Map<Viewport, AlignFrame> splitFrameCandidates = new HashMap<Viewport, AlignFrame>();
+
+ /*
+ * Map from displayed rna structure models to their saved session state jar
+ * entry names
+ */
+ private Map<RnaModel, String> rnaSessions = new HashMap<RnaModel, String>();
+
/**
* create/return unique hash string for sq
*
@@ -66,7 +193,7 @@ public class Jalview2XML
}
if (seqsToIds.containsKey(sq))
{
- return (String) seqsToIds.get(sq);
+ return seqsToIds.get(sq);
}
else
{
@@ -107,31 +234,14 @@ public class Jalview2XML
{
if (seqsToIds == null)
{
- seqsToIds = new IdentityHashMap();
+ seqsToIds = new IdentityHashMap<SequenceI, String>();
}
if (seqRefIds == null)
{
- seqRefIds = new Hashtable();
+ seqRefIds = new HashMap<String, SequenceI>();
}
}
- /**
- * SequenceI reference -> XML ID string in jalview XML. Populated as XML reps
- * of sequence objects are created.
- */
- java.util.IdentityHashMap seqsToIds = null;
-
- /**
- * jalview XML Sequence ID to jalview sequence object reference (both dataset
- * and alignment sequences. Populated as XML reps of sequence objects are
- * created.)
- */
- java.util.Hashtable seqRefIds = null; // key->SequenceI resolution
-
- Vector frefedSequence = null;
-
- boolean raiseGUI = true; // whether errors are raised in dialog boxes or not
-
public Jalview2XML()
{
}
@@ -156,7 +266,7 @@ public class Jalview2XML
{
if (ref[1] instanceof jalview.datamodel.Mapping)
{
- SequenceI seq = (SequenceI) seqRefIds.get(sref);
+ SequenceI seq = seqRefIds.get(sref);
while (seq.getDatasetSequence() != null)
{
seq = seq.getDatasetSequence();
@@ -167,7 +277,7 @@ public class Jalview2XML
{
if (ref[1] instanceof jalview.datamodel.AlignedCodonFrame)
{
- SequenceI seq = (SequenceI) seqRefIds.get(sref);
+ SequenceI seq = seqRefIds.get(sref);
while (seq.getDatasetSequence() != null)
{
seq = seq.getDatasetSequence();
@@ -217,28 +327,29 @@ public class Jalview2XML
}
/**
- * This maintains a list of viewports, the key being the seqSetId. Important
- * to set historyItem and redoList for multiple views
+ * This maintains a map of viewports, the key being the seqSetId. Important to
+ * set historyItem and redoList for multiple views
*/
- Hashtable viewportsAdded;
+ Map<String, AlignViewport> viewportsAdded = new HashMap<String, AlignViewport>();
- Hashtable annotationIds = new Hashtable();
+ Map<String, AlignmentAnnotation> annotationIds = new HashMap<String, AlignmentAnnotation>();
String uniqueSetSuffix = "";
/**
* List of pdbfiles added to Jar
*/
- Vector pdbfiles = null;
+ List<String> pdbfiles = null;
// SAVES SEVERAL ALIGNMENT WINDOWS TO SAME JARFILE
- public void SaveState(File statefile)
+ public void saveState(File statefile)
{
+ FileOutputStream fos = null;
try
{
- FileOutputStream fos = new FileOutputStream(statefile);
+ fos = new FileOutputStream(statefile);
JarOutputStream jout = new JarOutputStream(fos);
- SaveState(jout);
+ saveState(jout);
} catch (Exception e)
{
@@ -254,6 +365,18 @@ public class Jalview2XML
errorMessage += "(output file was '" + statefile + "')";
}
e.printStackTrace();
+ } finally
+ {
+ if (fos != null)
+ {
+ try
+ {
+ fos.close();
+ } catch (IOException e)
+ {
+ // ignore
+ }
+ }
}
reportErrors();
}
@@ -263,83 +386,72 @@ public class Jalview2XML
*
* @param jout
*/
- public void SaveState(JarOutputStream jout)
+ public void saveState(JarOutputStream jout)
{
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ AlignFrame[] frames = Desktop.getAlignFrames();
if (frames == null)
{
return;
}
+ Hashtable<String, AlignFrame> dsses = new Hashtable<String, AlignFrame>();
+
+ /*
+ * ensure cached data is clear before starting
+ */
+ // todo tidy up seqRefIds, seqsToIds initialisation / reset
+ rnaSessions.clear();
+ splitFrameCandidates.clear();
+
try
{
// NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS
// //////////////////////////////////////////////////
- // NOTE ALSO new PrintWriter must be used for each new JarEntry
- PrintWriter out = null;
- Vector shortNames = new Vector();
+ List<String> shortNames = new ArrayList<String>();
+ List<String> viewIds = new ArrayList<String>();
// REVERSE ORDER
for (int i = frames.length - 1; i > -1; i--)
{
- if (frames[i] instanceof AlignFrame)
+ AlignFrame af = frames[i];
+ // skip ?
+ if (skipList != null
+ && skipList
+ .containsKey(af.getViewport().getSequenceSetId()))
{
- AlignFrame af = (AlignFrame) frames[i];
- // skip ?
- if (skipList != null
- && skipList.containsKey(af.getViewport()
- .getSequenceSetId()))
- {
- continue;
- }
-
- String shortName = af.getTitle();
+ continue;
+ }
- if (shortName.indexOf(File.separatorChar) > -1)
- {
- shortName = shortName.substring(shortName
- .lastIndexOf(File.separatorChar) + 1);
- }
+ String shortName = makeFilename(af, shortNames);
- int count = 1;
+ int ap, apSize = af.alignPanels.size();
- while (shortNames.contains(shortName))
+ for (ap = 0; ap < apSize; ap++)
+ {
+ AlignmentPanel apanel = af.alignPanels.get(ap);
+ String fileName = apSize == 1 ? shortName : ap + shortName;
+ if (!fileName.endsWith(".xml"))
{
- if (shortName.endsWith("_" + (count - 1)))
- {
- shortName = shortName
- .substring(0, shortName.lastIndexOf("_"));
- }
-
- shortName = shortName.concat("_" + count);
- count++;
+ fileName = fileName + ".xml";
}
- shortNames.addElement(shortName);
-
- if (!shortName.endsWith(".xml"))
- {
- shortName = shortName + ".xml";
- }
+ saveState(apanel, fileName, jout, viewIds);
- int ap, apSize = af.alignPanels.size();
- for (ap = 0; ap < apSize; ap++)
+ String dssid = getDatasetIdRef(af.getViewport().getAlignment()
+ .getDataset());
+ if (!dsses.containsKey(dssid))
{
- AlignmentPanel apanel = (AlignmentPanel) af.alignPanels
- .elementAt(ap);
- String fileName = apSize == 1 ? shortName : ap + shortName;
- if (!fileName.endsWith(".xml"))
- {
- fileName = fileName + ".xml";
- }
-
- SaveState(apanel, fileName, jout);
+ dsses.put(dssid, af);
}
}
}
+
+ writeDatasetFor(dsses, "" + jout.hashCode() + " " + uniqueSetSuffix,
+ jout);
+
try
{
jout.flush();
@@ -360,27 +472,77 @@ public class Jalview2XML
}
}
+ /**
+ * Generates a distinct file name, based on the title of the AlignFrame, by
+ * appending _n for increasing n until an unused name is generated. The new
+ * name (without its extension) is added to the list.
+ *
+ * @param af
+ * @param namesUsed
+ * @return the generated name, with .xml extension
+ */
+ protected String makeFilename(AlignFrame af, List<String> namesUsed)
+ {
+ String shortName = af.getTitle();
+
+ if (shortName.indexOf(File.separatorChar) > -1)
+ {
+ shortName = shortName.substring(shortName
+ .lastIndexOf(File.separatorChar) + 1);
+ }
+
+ int count = 1;
+
+ while (namesUsed.contains(shortName))
+ {
+ if (shortName.endsWith("_" + (count - 1)))
+ {
+ shortName = shortName.substring(0, shortName.lastIndexOf("_"));
+ }
+
+ shortName = shortName.concat("_" + count);
+ count++;
+ }
+
+ namesUsed.add(shortName);
+
+ if (!shortName.endsWith(".xml"))
+ {
+ shortName = shortName + ".xml";
+ }
+ return shortName;
+ }
+
// USE THIS METHOD TO SAVE A SINGLE ALIGNMENT WINDOW
- public boolean SaveAlignment(AlignFrame af, String jarFile,
+ public boolean saveAlignment(AlignFrame af, String jarFile,
String fileName)
{
try
{
- int ap, apSize = af.alignPanels.size();
+ int ap = 0;
+ int apSize = af.alignPanels.size();
FileOutputStream fos = new FileOutputStream(jarFile);
JarOutputStream jout = new JarOutputStream(fos);
- for (ap = 0; ap < apSize; ap++)
+ Hashtable<String, AlignFrame> dsses = new Hashtable<String, AlignFrame>();
+ List<String> viewIds = new ArrayList<String>();
+
+ for (AlignmentPanel apanel : af.alignPanels)
{
- AlignmentPanel apanel = (AlignmentPanel) af.alignPanels
- .elementAt(ap);
String jfileName = apSize == 1 ? fileName : fileName + ap;
+ ap++;
if (!jfileName.endsWith(".xml"))
{
jfileName = jfileName + ".xml";
}
- SaveState(apanel, jfileName, jout);
+ saveState(apanel, jfileName, jout, viewIds);
+ String dssid = getDatasetIdRef(af.getViewport().getAlignment()
+ .getDataset());
+ if (!dsses.containsKey(dssid))
+ {
+ dsses.put(dssid, af);
+ }
}
-
+ writeDatasetFor(dsses, fileName, jout);
try
{
jout.flush();
@@ -398,25 +560,69 @@ public class Jalview2XML
}
}
+ private void writeDatasetFor(Hashtable<String, AlignFrame> dsses,
+ String fileName, JarOutputStream jout)
+ {
+
+ for (String dssids : dsses.keySet())
+ {
+ AlignFrame _af = dsses.get(dssids);
+ String jfileName = fileName + " Dataset for " + _af.getTitle();
+ if (!jfileName.endsWith(".xml"))
+ {
+ jfileName = jfileName + ".xml";
+ }
+ saveState(_af.alignPanel, jfileName, true, jout, null);
+ }
+ }
+
+ /**
+ * create a JalviewModel from an alignment view and marshall it to a
+ * JarOutputStream
+ *
+ * @param ap
+ * panel to create jalview model for
+ * @param fileName
+ * name of alignment panel written to output stream
+ * @param jout
+ * jar output stream
+ * @param viewIds
+ * @param out
+ * jar entry name
+ */
+ public JalviewModel saveState(AlignmentPanel ap, String fileName,
+ JarOutputStream jout, List<String> viewIds)
+ {
+ return saveState(ap, fileName, false, jout, viewIds);
+ }
+
/**
- * create a JalviewModel from an algnment view and marshall it to a
+ * create a JalviewModel from an alignment view and marshall it to a
* JarOutputStream
*
* @param ap
* panel to create jalview model for
* @param fileName
* name of alignment panel written to output stream
+ * @param storeDS
+ * when true, only write the dataset for the alignment, not the data
+ * associated with the view.
* @param jout
* jar output stream
* @param out
* jar entry name
*/
- public JalviewModel SaveState(AlignmentPanel ap, String fileName,
- JarOutputStream jout)
+ public JalviewModel saveState(AlignmentPanel ap, String fileName,
+ boolean storeDS, JarOutputStream jout, List<String> viewIds)
{
+ if (viewIds == null)
+ {
+ viewIds = new ArrayList<String>();
+ }
+
initSeqRefs();
- Vector jmolViewIds = new Vector(); //
- Vector userColours = new Vector();
+
+ List<UserColourScheme> userColours = new ArrayList<UserColourScheme>();
AlignViewport av = ap.av;
@@ -424,11 +630,12 @@ public class Jalview2XML
object.setVamsasModel(new jalview.schemabinding.version2.VamsasModel());
object.setCreationDate(new java.util.Date(System.currentTimeMillis()));
- object.setVersion(jalview.bin.Cache.getProperty("VERSION"));
+ object.setVersion(jalview.bin.Cache.getDefault("VERSION",
+ "Development Build"));
- jalview.datamodel.AlignmentI jal = av.alignment;
+ jalview.datamodel.AlignmentI jal = av.getAlignment();
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
jal = jal.getHiddenSequences().getFullAlignment();
}
@@ -443,6 +650,11 @@ public class Jalview2XML
{
// dataset id is the dataset's hashcode
vamsasSet.setDatasetId(getDatasetIdRef(jal.getDataset()));
+ if (storeDS)
+ {
+ // switch jal and the dataset
+ jal = jal.getDataset();
+ }
}
if (jal.getProperties() != null)
{
@@ -458,14 +670,15 @@ public class Jalview2XML
}
JSeq jseq;
+ Set<String> calcIdSet = new HashSet<String>();
// SAVE SEQUENCES
- String id = "";
- jalview.datamodel.SequenceI jds;
for (int i = 0; i < jal.getHeight(); i++)
{
- jds = jal.getSequenceAt(i);
- id = seqHash(jds);
+ final SequenceI jds = jal.getSequenceAt(i);
+ final SequenceI jdatasq = jds.getDatasetSequence() == null ? jds
+ : jds.getDatasetSequence();
+ String id = seqHash(jds);
if (seqRefIds.get(id) != null)
{
@@ -496,31 +709,34 @@ public class Jalview2XML
jseq.setColour(av.getSequenceColour(jds).getRGB());
jseq.setId(id); // jseq id should be a string not a number
-
- if (av.hasHiddenRows)
+ if (!storeDS)
{
- jseq.setHidden(av.alignment.getHiddenSequences().isHidden(jds));
-
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(jal.getSequenceAt(i)))
+ // Store any sequences this sequence represents
+ if (av.hasHiddenRows())
{
- jalview.datamodel.SequenceI[] reps = ((jalview.datamodel.SequenceGroup) av.hiddenRepSequences
- .get(jal.getSequenceAt(i))).getSequencesInOrder(jal);
+ jseq.setHidden(av.getAlignment().getHiddenSequences()
+ .isHidden(jds));
- for (int h = 0; h < reps.length; h++)
+ if (av.isHiddenRepSequence(jal.getSequenceAt(i)))
{
- if (reps[h] != jal.getSequenceAt(i))
+ jalview.datamodel.SequenceI[] reps = av
+ .getRepresentedSequences(jal.getSequenceAt(i))
+ .getSequencesInOrder(jal);
+
+ for (int h = 0; h < reps.length; h++)
{
- jseq.addHiddenSequences(jal.findIndex(reps[h]));
+ if (reps[h] != jal.getSequenceAt(i))
+ {
+ jseq.addHiddenSequences(jal.findIndex(reps[h]));
+ }
}
}
}
}
- if (jds.getDatasetSequence().getSequenceFeatures() != null)
+ if (jds.getSequenceFeatures() != null)
{
- jalview.datamodel.SequenceFeature[] sf = jds.getDatasetSequence()
- .getSequenceFeatures();
+ jalview.datamodel.SequenceFeature[] sf = jds.getSequenceFeatures();
int index = 0;
while (index < sf.length)
{
@@ -561,83 +777,51 @@ public class Jalview2XML
}
}
- if (jds.getDatasetSequence().getPDBId() != null)
+ if (jdatasq.getAllPDBEntries() != null)
{
- Enumeration en = jds.getDatasetSequence().getPDBId().elements();
+ Enumeration en = jdatasq.getAllPDBEntries().elements();
while (en.hasMoreElements())
{
Pdbids pdb = new Pdbids();
jalview.datamodel.PDBEntry entry = (jalview.datamodel.PDBEntry) en
.nextElement();
- pdb.setId(entry.getId());
+ String pdbId = entry.getId();
+ pdb.setId(pdbId);
pdb.setType(entry.getType());
- AppJmol jmol;
+ /*
+ * Store any structure views associated with this sequence. This
+ * section copes with duplicate entries in the project, so a dataset
+ * only view *should* be coped with sensibly.
+ */
// This must have been loaded, is it still visible?
JInternalFrame[] frames = Desktop.desktop.getAllFrames();
String matchedFile = null;
for (int f = frames.length - 1; f > -1; f--)
{
- if (frames[f] instanceof AppJmol)
+ if (frames[f] instanceof StructureViewerBase)
{
- jmol = (AppJmol) frames[f];
- for (int peid = 0; peid < jmol.jmb.pdbentry.length; peid++)
+ StructureViewerBase viewFrame = (StructureViewerBase) frames[f];
+ matchedFile = saveStructureState(ap, jds, pdb, entry,
+ viewIds, matchedFile, viewFrame);
+ /*
+ * Only store each structure viewer's state once in the project
+ * jar. First time through only (storeDS==false)
+ */
+ String viewId = viewFrame.getViewId();
+ if (!storeDS && !viewIds.contains(viewId))
{
- if (!jmol.jmb.pdbentry[peid].getId().equals(entry.getId())
- && !(entry.getId().length() > 4 && entry
- .getId()
- .toLowerCase()
- .startsWith(
- jmol.jmb.pdbentry[peid].getId()
- .toLowerCase())))
- continue;
- if (matchedFile == null)
- {
- matchedFile = jmol.jmb.pdbentry[peid].getFile();
- }
- else if (!matchedFile.equals(jmol.jmb.pdbentry[peid]
- .getFile()))
+ viewIds.add(viewId);
+ try
{
- Cache.log
- .warn("Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): "
- + jmol.jmb.pdbentry[peid].getFile());
- ; // record the
- }
- // file so we
- // can get at it if the ID
- // match is ambiguous (e.g.
- // 1QIP==1qipA)
- String statestring = jmol.jmb.viewer.getStateInfo();
-
- for (int smap = 0; smap < jmol.jmb.sequence[peid].length; smap++)
+ String viewerState = viewFrame.getStateInfo();
+ writeJarEntry(jout, getViewerJarEntryName(viewId),
+ viewerState.getBytes());
+ } catch (IOException e)
{
- if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1)
- {
- StructureState state = new StructureState();
- state.setVisible(true);
- state.setXpos(jmol.getX());
- state.setYpos(jmol.getY());
- state.setWidth(jmol.getWidth());
- state.setHeight(jmol.getHeight());
- state.setViewId(jmol.getViewId());
- state.setAlignwithAlignPanel(jmol.isUsedforaligment(ap));
- state.setColourwithAlignPanel(jmol
- .isUsedforcolourby(ap));
- state.setColourByJmol(jmol.isColouredByJmol());
- if (!jmolViewIds.contains(state.getViewId()))
- {
- // Make sure we only store a Jmol state once in each XML
- // document.
- jmolViewIds.addElement(state.getViewId());
- state.setContent(statestring.replaceAll("\n", ""));
- }
- else
- {
- state.setContent("# duplicate state");
- }
- pdb.addStructureState(state);
- }
+ System.err.println("Error saving viewer state: "
+ + e.getMessage());
}
}
}
@@ -653,37 +837,17 @@ public class Jalview2XML
pdb.setFile(matchedFile); // entry.getFile());
if (pdbfiles == null)
{
- pdbfiles = new Vector();
+ pdbfiles = new ArrayList<String>();
}
- if (!pdbfiles.contains(entry.getId()))
+ if (!pdbfiles.contains(pdbId))
{
- pdbfiles.addElement(entry.getId());
- try
- {
- File file = new File(matchedFile);
- if (file.exists() && jout != null)
- {
- byte[] data = new byte[(int) file.length()];
- jout.putNextEntry(new JarEntry(entry.getId()));
- DataInputStream dis = new DataInputStream(
- new FileInputStream(file));
- dis.readFully(data);
-
- DataOutputStream dout = new DataOutputStream(jout);
- dout.write(data, 0, data.length);
- dout.flush();
- jout.closeEntry();
- }
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
+ pdbfiles.add(pdbId);
+ copyFileToJar(jout, matchedFile, pdbId);
}
}
- if (entry.getProperty() != null)
+ if (entry.getProperty() != null && !entry.getProperty().isEmpty())
{
PdbentryItem item = new PdbentryItem();
Hashtable properties = entry.getProperty();
@@ -703,39 +867,28 @@ public class Jalview2XML
}
}
+ saveRnaViewers(jout, jseq, jds, viewIds, ap, storeDS);
+
jms.addJSeq(jseq);
}
- if (av.hasHiddenRows)
+ if (!storeDS && av.hasHiddenRows())
{
- jal = av.alignment;
+ jal = av.getAlignment();
}
// SAVE MAPPINGS
- if (jal.getCodonFrames() != null && jal.getCodonFrames().length > 0)
+ if (jal.getCodonFrames() != null)
{
- jalview.datamodel.AlignedCodonFrame[] jac = jal.getCodonFrames();
- for (int i = 0; i < jac.length; i++)
+ Set<AlignedCodonFrame> jac = jal.getCodonFrames();
+ for (AlignedCodonFrame acf : jac)
{
AlcodonFrame alc = new AlcodonFrame();
vamsasSet.addAlcodonFrame(alc);
- for (int p = 0; p < jac[i].aaWidth; p++)
- {
- Alcodon cmap = new Alcodon();
- if (jac[i].codons[p] != null)
- {
- // Null codons indicate a gapped column in the translated peptide
- // alignment.
- cmap.setPos1(jac[i].codons[p][0]);
- cmap.setPos2(jac[i].codons[p][1]);
- cmap.setPos3(jac[i].codons[p][2]);
- }
- alc.addAlcodon(cmap);
- }
- if (jac[i].getProtMappings() != null
- && jac[i].getProtMappings().length > 0)
+ if (acf.getProtMappings() != null
+ && acf.getProtMappings().length > 0)
{
- SequenceI[] dnas = jac[i].getdnaSeqs();
- jalview.datamodel.Mapping[] pmaps = jac[i].getProtMappings();
+ SequenceI[] dnas = acf.getdnaSeqs();
+ jalview.datamodel.Mapping[] pmaps = acf.getProtMappings();
for (int m = 0; m < pmaps.length; m++)
{
AlcodMap alcmap = new AlcodMap();
@@ -745,12 +898,43 @@ public class Jalview2XML
alc.addAlcodMap(alcmap);
}
}
+
+ // {
+ // AlcodonFrame alc = new AlcodonFrame();
+ // vamsasSet.addAlcodonFrame(alc);
+ // for (int p = 0; p < acf.aaWidth; p++)
+ // {
+ // Alcodon cmap = new Alcodon();
+ // if (acf.codons[p] != null)
+ // {
+ // // Null codons indicate a gapped column in the translated peptide
+ // // alignment.
+ // cmap.setPos1(acf.codons[p][0]);
+ // cmap.setPos2(acf.codons[p][1]);
+ // cmap.setPos3(acf.codons[p][2]);
+ // }
+ // alc.addAlcodon(cmap);
+ // }
+ // if (acf.getProtMappings() != null
+ // && acf.getProtMappings().length > 0)
+ // {
+ // SequenceI[] dnas = acf.getdnaSeqs();
+ // jalview.datamodel.Mapping[] pmaps = acf.getProtMappings();
+ // for (int m = 0; m < pmaps.length; m++)
+ // {
+ // AlcodMap alcmap = new AlcodMap();
+ // alcmap.setDnasq(seqHash(dnas[m]));
+ // alcmap.setMapping(createVamsasMapping(pmaps[m], dnas[m], null,
+ // false));
+ // alc.addAlcodMap(alcmap);
+ // }
+ // }
}
}
// SAVE TREES
// /////////////////////////////////
- if (av.currentTree != null)
+ if (!storeDS && av.currentTree != null)
{
// FIND ANY ASSOCIATED TREES
// NOT IMPLEMENTED FOR HEADLESS STATE AT PRESENT
@@ -764,7 +948,7 @@ public class Jalview2XML
{
TreePanel tp = (TreePanel) frames[t];
- if (tp.treeCanvas.av.alignment == jal)
+ if (tp.treeCanvas.av.getAlignment() == jal)
{
Tree tree = new Tree();
tree.setTitle(tp.getTitle());
@@ -797,437 +981,338 @@ public class Jalview2XML
/**
* store forward refs from an annotationRow to any groups
*/
- IdentityHashMap groupRefs = new IdentityHashMap();
- if (jal.getAlignmentAnnotation() != null)
+ IdentityHashMap<SequenceGroup, String> groupRefs = new IdentityHashMap<SequenceGroup, String>();
+ if (storeDS)
{
- jalview.datamodel.AlignmentAnnotation[] aa = jal
- .getAlignmentAnnotation();
-
- for (int i = 0; i < aa.length; i++)
+ for (SequenceI sq : jal.getSequences())
{
- Annotation an = new Annotation();
-
- if (aa[i].annotationId != null)
- {
- annotationIds.put(aa[i].annotationId, aa[i]);
- }
-
- an.setId(aa[i].annotationId);
-
- an.setVisible(aa[i].visible);
-
- an.setDescription(aa[i].description);
-
- if (aa[i].sequenceRef != null)
- {
- // TODO later annotation sequenceRef should be the XML ID of the
- // sequence rather than its display name
- an.setSequenceRef(aa[i].sequenceRef.getName());
- }
- if (aa[i].groupRef != null)
- {
- Object groupIdr = groupRefs.get(aa[i].groupRef);
- if (groupIdr == null)
- {
- // make a locally unique String
- groupRefs.put(aa[i].groupRef,
- groupIdr = ("" + System.currentTimeMillis()
- + aa[i].groupRef.getName() + groupRefs.size()));
- }
- an.setGroupRef(groupIdr.toString());
- }
-
- // store all visualization attributes for annotation
- an.setGraphHeight(aa[i].graphHeight);
- an.setCentreColLabels(aa[i].centreColLabels);
- an.setScaleColLabels(aa[i].scaleColLabel);
- an.setShowAllColLabels(aa[i].showAllColLabels);
-
- if (aa[i].graph > 0)
- {
- an.setGraph(true);
- an.setGraphType(aa[i].graph);
- an.setGraphGroup(aa[i].graphGroup);
- if (aa[i].getThreshold() != null)
- {
- ThresholdLine line = new ThresholdLine();
- line.setLabel(aa[i].getThreshold().label);
- line.setValue(aa[i].getThreshold().value);
- line.setColour(aa[i].getThreshold().colour.getRGB());
- an.setThresholdLine(line);
- }
- }
- else
- {
- an.setGraph(false);
- }
-
- an.setLabel(aa[i].label);
-
- if (aa[i] == av.quality || aa[i] == av.conservation
- || aa[i] == av.consensus || aa[i].autoCalculated)
- {
- // new way of indicating autocalculated annotation -
- an.setAutoCalculated(aa[i].autoCalculated);
- }
- if (aa[i].hasScore())
- {
- an.setScore(aa[i].getScore());
- }
- AnnotationElement ae;
- if (aa[i].annotations != null)
+ // Store annotation on dataset sequences only
+ AlignmentAnnotation[] aa = sq.getAnnotation();
+ if (aa != null && aa.length > 0)
{
- an.setScoreOnly(false);
- for (int a = 0; a < aa[i].annotations.length; a++)
- {
- if ((aa[i] == null) || (aa[i].annotations[a] == null))
- {
- continue;
- }
-
- ae = new AnnotationElement();
- if (aa[i].annotations[a].description != null)
- ae.setDescription(aa[i].annotations[a].description);
- if (aa[i].annotations[a].displayCharacter != null)
- ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter);
-
- if (!Float.isNaN(aa[i].annotations[a].value))
- ae.setValue(aa[i].annotations[a].value);
-
- ae.setPosition(a);
- if (aa[i].annotations[a].secondaryStructure != ' '
- && aa[i].annotations[a].secondaryStructure != '\0')
- ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure
- + "");
-
- if (aa[i].annotations[a].colour != null
- && aa[i].annotations[a].colour != java.awt.Color.black)
- {
- ae.setColour(aa[i].annotations[a].colour.getRGB());
- }
-
- an.addAnnotationElement(ae);
- if (aa[i].autoCalculated)
- {
- // only write one non-null entry into the annotation row -
- // sufficient to get the visualization attributes necessary to
- // display data
- continue;
- }
- }
- }
- else
- {
- an.setScoreOnly(true);
+ storeAlignmentAnnotation(aa, groupRefs, av, calcIdSet, storeDS,
+ vamsasSet);
}
- vamsasSet.addAnnotation(an);
+ }
+ }
+ else
+ {
+ if (jal.getAlignmentAnnotation() != null)
+ {
+ // Store the annotation shown on the alignment.
+ AlignmentAnnotation[] aa = jal.getAlignmentAnnotation();
+ storeAlignmentAnnotation(aa, groupRefs, av, calcIdSet, storeDS,
+ vamsasSet);
}
}
// SAVE GROUPS
if (jal.getGroups() != null)
{
JGroup[] groups = new JGroup[jal.getGroups().size()];
-
- for (int i = 0; i < groups.length; i++)
+ int i = -1;
+ for (jalview.datamodel.SequenceGroup sg : jal.getGroups())
{
- groups[i] = new JGroup();
+ JGroup jGroup = new JGroup();
+ groups[++i] = jGroup;
- jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup) jal
- .getGroups().elementAt(i);
- groups[i].setStart(sg.getStartRes());
- groups[i].setEnd(sg.getEndRes());
- groups[i].setName(sg.getName());
+ jGroup.setStart(sg.getStartRes());
+ jGroup.setEnd(sg.getEndRes());
+ jGroup.setName(sg.getName());
if (groupRefs.containsKey(sg))
{
- // group has references so set it's ID field
- groups[i].setId(groupRefs.get(sg).toString());
+ // group has references so set its ID field
+ jGroup.setId(groupRefs.get(sg));
}
if (sg.cs != null)
{
if (sg.cs.conservationApplied())
{
- groups[i].setConsThreshold(sg.cs.getConservationInc());
+ jGroup.setConsThreshold(sg.cs.getConservationInc());
if (sg.cs instanceof jalview.schemes.UserColourScheme)
{
- groups[i].setColour(SetUserColourScheme(sg.cs, userColours,
- jms));
+ jGroup.setColour(setUserColourScheme(sg.cs, userColours, jms));
}
else
{
- groups[i]
- .setColour(ColourSchemeProperty.getColourName(sg.cs));
+ jGroup.setColour(ColourSchemeProperty.getColourName(sg.cs));
}
}
else if (sg.cs instanceof jalview.schemes.AnnotationColourGradient)
{
- groups[i]
- .setColour(ColourSchemeProperty
- .getColourName(((jalview.schemes.AnnotationColourGradient) sg.cs)
- .getBaseColour()));
+ jGroup.setColour("AnnotationColourGradient");
+ jGroup.setAnnotationColours(constructAnnotationColours(
+ (jalview.schemes.AnnotationColourGradient) sg.cs,
+ userColours, jms));
}
else if (sg.cs instanceof jalview.schemes.UserColourScheme)
{
- groups[i]
- .setColour(SetUserColourScheme(sg.cs, userColours, jms));
+ jGroup.setColour(setUserColourScheme(sg.cs, userColours, jms));
}
else
{
- groups[i].setColour(ColourSchemeProperty.getColourName(sg.cs));
+ jGroup.setColour(ColourSchemeProperty.getColourName(sg.cs));
}
- groups[i].setPidThreshold(sg.cs.getThreshold());
+ jGroup.setPidThreshold(sg.cs.getThreshold());
}
- groups[i].setOutlineColour(sg.getOutlineColour().getRGB());
- groups[i].setDisplayBoxes(sg.getDisplayBoxes());
- groups[i].setDisplayText(sg.getDisplayText());
- groups[i].setColourText(sg.getColourText());
- groups[i].setTextCol1(sg.textColour.getRGB());
- groups[i].setTextCol2(sg.textColour2.getRGB());
- groups[i].setTextColThreshold(sg.thresholdTextColour);
- groups[i].setShowUnconserved(sg.getShowNonconserved());
- groups[i].setIgnoreGapsinConsensus(sg.getIgnoreGapsConsensus());
- groups[i].setShowConsensusHistogram(sg.isShowConsensusHistogram());
- groups[i].setShowSequenceLogo(sg.isShowSequenceLogo());
- for (int s = 0; s < sg.getSize(); s++)
+ jGroup.setOutlineColour(sg.getOutlineColour().getRGB());
+ jGroup.setDisplayBoxes(sg.getDisplayBoxes());
+ jGroup.setDisplayText(sg.getDisplayText());
+ jGroup.setColourText(sg.getColourText());
+ jGroup.setTextCol1(sg.textColour.getRGB());
+ jGroup.setTextCol2(sg.textColour2.getRGB());
+ jGroup.setTextColThreshold(sg.thresholdTextColour);
+ jGroup.setShowUnconserved(sg.getShowNonconserved());
+ jGroup.setIgnoreGapsinConsensus(sg.getIgnoreGapsConsensus());
+ jGroup.setShowConsensusHistogram(sg.isShowConsensusHistogram());
+ jGroup.setShowSequenceLogo(sg.isShowSequenceLogo());
+ jGroup.setNormaliseSequenceLogo(sg.isNormaliseSequenceLogo());
+ for (SequenceI seq : sg.getSequences())
{
- jalview.datamodel.Sequence seq = (jalview.datamodel.Sequence) sg
- .getSequenceAt(s);
- groups[i].addSeq(seqHash(seq));
+ jGroup.addSeq(seqHash(seq));
}
}
jms.setJGroup(groups);
}
+ if (!storeDS)
+ {
+ // /////////SAVE VIEWPORT
+ Viewport view = new Viewport();
+ view.setTitle(ap.alignFrame.getTitle());
+ view.setSequenceSetId(makeHashCode(av.getSequenceSetId(),
+ av.getSequenceSetId()));
+ view.setId(av.getViewId());
+ if (av.getCodingComplement() != null)
+ {
+ view.setComplementId(av.getCodingComplement().getViewId());
+ }
+ view.setViewName(av.viewName);
+ view.setGatheredViews(av.isGatherViewsHere());
- // /////////SAVE VIEWPORT
- Viewport view = new Viewport();
- view.setTitle(ap.alignFrame.getTitle());
- view.setSequenceSetId(makeHashCode(av.getSequenceSetId(),
- av.getSequenceSetId()));
- view.setId(av.getViewId());
- view.setViewName(av.viewName);
- view.setGatheredViews(av.gatherViewsHere);
-
- if (ap.av.explodedPosition != null)
- {
- view.setXpos(av.explodedPosition.x);
- view.setYpos(av.explodedPosition.y);
- view.setWidth(av.explodedPosition.width);
- view.setHeight(av.explodedPosition.height);
- }
- else
- {
- view.setXpos(ap.alignFrame.getBounds().x);
- view.setYpos(ap.alignFrame.getBounds().y);
- view.setWidth(ap.alignFrame.getBounds().width);
- view.setHeight(ap.alignFrame.getBounds().height);
- }
-
- view.setStartRes(av.startRes);
- view.setStartSeq(av.startSeq);
+ Rectangle position = ap.av.getExplodedGeometry();
+ if (position == null)
+ {
+ position = ap.alignFrame.getBounds();
+ }
+ view.setXpos(position.x);
+ view.setYpos(position.y);
+ view.setWidth(position.width);
+ view.setHeight(position.height);
- if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)
- {
- view.setBgColour(SetUserColourScheme(av.getGlobalColourScheme(),
- userColours, jms));
- }
- else if (av.getGlobalColourScheme() instanceof jalview.schemes.AnnotationColourGradient)
- {
- jalview.schemes.AnnotationColourGradient acg = (jalview.schemes.AnnotationColourGradient) av
- .getGlobalColourScheme();
+ view.setStartRes(av.startRes);
+ view.setStartSeq(av.startSeq);
- AnnotationColours ac = new AnnotationColours();
- ac.setAboveThreshold(acg.getAboveThreshold());
- ac.setThreshold(acg.getAnnotationThreshold());
- ac.setAnnotation(acg.getAnnotation());
- if (acg.getBaseColour() instanceof jalview.schemes.UserColourScheme)
+ if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)
{
- ac.setColourScheme(SetUserColourScheme(acg.getBaseColour(),
+ view.setBgColour(setUserColourScheme(av.getGlobalColourScheme(),
userColours, jms));
}
+ else if (av.getGlobalColourScheme() instanceof jalview.schemes.AnnotationColourGradient)
+ {
+ AnnotationColours ac = constructAnnotationColours(
+ (jalview.schemes.AnnotationColourGradient) av
+ .getGlobalColourScheme(),
+ userColours, jms);
+
+ view.setAnnotationColours(ac);
+ view.setBgColour("AnnotationColourGradient");
+ }
else
{
- ac.setColourScheme(ColourSchemeProperty.getColourName(acg
- .getBaseColour()));
+ view.setBgColour(ColourSchemeProperty.getColourName(av
+ .getGlobalColourScheme()));
}
- ac.setMaxColour(acg.getMaxColour().getRGB());
- ac.setMinColour(acg.getMinColour().getRGB());
- view.setAnnotationColours(ac);
- view.setBgColour("AnnotationColourGradient");
- }
- else
- {
- view.setBgColour(ColourSchemeProperty.getColourName(av
- .getGlobalColourScheme()));
- }
-
- ColourSchemeI cs = av.getGlobalColourScheme();
+ ColourSchemeI cs = av.getGlobalColourScheme();
- if (cs != null)
- {
- if (cs.conservationApplied())
+ if (cs != null)
{
- view.setConsThreshold(cs.getConservationInc());
- if (cs instanceof jalview.schemes.UserColourScheme)
+ if (cs.conservationApplied())
{
- view.setBgColour(SetUserColourScheme(cs, userColours, jms));
+ view.setConsThreshold(cs.getConservationInc());
+ if (cs instanceof jalview.schemes.UserColourScheme)
+ {
+ view.setBgColour(setUserColourScheme(cs, userColours, jms));
+ }
}
- }
- if (cs instanceof ResidueColourScheme)
- {
- view.setPidThreshold(cs.getThreshold());
+ if (cs instanceof ResidueColourScheme)
+ {
+ view.setPidThreshold(cs.getThreshold());
+ }
}
- }
- view.setConservationSelected(av.getConservationSelected());
- view.setPidSelected(av.getAbovePIDThreshold());
- view.setFontName(av.font.getName());
- view.setFontSize(av.font.getSize());
- view.setFontStyle(av.font.getStyle());
- view.setRenderGaps(av.renderGaps);
- view.setShowAnnotation(av.getShowAnnotation());
- view.setShowBoxes(av.getShowBoxes());
- view.setShowColourText(av.getColourText());
- view.setShowFullId(av.getShowJVSuffix());
- view.setRightAlignIds(av.rightAlignIds);
- view.setShowSequenceFeatures(av.showSequenceFeatures);
- view.setShowText(av.getShowText());
- view.setShowUnconserved(av.getShowUnconserved());
- view.setWrapAlignment(av.getWrapAlignment());
- view.setTextCol1(av.textColour.getRGB());
- view.setTextCol2(av.textColour2.getRGB());
- view.setTextColThreshold(av.thresholdTextColour);
- view.setShowConsensusHistogram(av.isShowConsensusHistogram());
- view.setShowSequenceLogo(av.isShowSequenceLogo());
- view.setShowGroupConsensus(av.isShowGroupConsensus());
- view.setShowGroupConservation(av.isShowGroupConservation());
- view.setShowNPfeatureTooltip(av.isShowNpFeats());
- view.setShowDbRefTooltip(av.isShowDbRefs());
- view.setFollowHighlight(av.followHighlight);
- view.setFollowSelection(av.followSelection);
- view.setIgnoreGapsinConsensus(av.getIgnoreGapsConsensus());
- if (av.featuresDisplayed != null)
- {
- jalview.schemabinding.version2.FeatureSettings fs = new jalview.schemabinding.version2.FeatureSettings();
+ view.setConservationSelected(av.getConservationSelected());
+ view.setPidSelected(av.getAbovePIDThreshold());
+ view.setFontName(av.font.getName());
+ view.setFontSize(av.font.getSize());
+ view.setFontStyle(av.font.getStyle());
+ view.setScaleProteinAsCdna(av.getViewStyle().isScaleProteinAsCdna());
+ view.setRenderGaps(av.isRenderGaps());
+ view.setShowAnnotation(av.isShowAnnotation());
+ view.setShowBoxes(av.getShowBoxes());
+ view.setShowColourText(av.getColourText());
+ view.setShowFullId(av.getShowJVSuffix());
+ view.setRightAlignIds(av.isRightAlignIds());
+ view.setShowSequenceFeatures(av.isShowSequenceFeatures());
+ view.setShowText(av.getShowText());
+ view.setShowUnconserved(av.getShowUnconserved());
+ view.setWrapAlignment(av.getWrapAlignment());
+ view.setTextCol1(av.getTextColour().getRGB());
+ view.setTextCol2(av.getTextColour2().getRGB());
+ view.setTextColThreshold(av.getThresholdTextColour());
+ view.setShowConsensusHistogram(av.isShowConsensusHistogram());
+ view.setShowSequenceLogo(av.isShowSequenceLogo());
+ view.setNormaliseSequenceLogo(av.isNormaliseSequenceLogo());
+ view.setShowGroupConsensus(av.isShowGroupConsensus());
+ view.setShowGroupConservation(av.isShowGroupConservation());
+ view.setShowNPfeatureTooltip(av.isShowNPFeats());
+ view.setShowDbRefTooltip(av.isShowDBRefs());
+ view.setFollowHighlight(av.isFollowHighlight());
+ view.setFollowSelection(av.followSelection);
+ view.setIgnoreGapsinConsensus(av.isIgnoreGapsConsensus());
+ if (av.getFeaturesDisplayed() != null)
+ {
+ jalview.schemabinding.version2.FeatureSettings fs = new jalview.schemabinding.version2.FeatureSettings();
- String[] renderOrder = ap.seqPanel.seqCanvas.getFeatureRenderer().renderOrder;
+ String[] renderOrder = ap.getSeqPanel().seqCanvas
+ .getFeatureRenderer().getRenderOrder()
+ .toArray(new String[0]);
- Vector settingsAdded = new Vector();
- Object gstyle = null;
- GraduatedColor gcol = null;
- if (renderOrder != null)
- {
- for (int ro = 0; ro < renderOrder.length; ro++)
+ Vector settingsAdded = new Vector();
+ Object gstyle = null;
+ GraduatedColor gcol = null;
+ if (renderOrder != null)
{
- gstyle = ap.seqPanel.seqCanvas.getFeatureRenderer()
- .getFeatureStyle(renderOrder[ro]);
- Setting setting = new Setting();
- setting.setType(renderOrder[ro]);
- if (gstyle instanceof GraduatedColor)
- {
- gcol = (GraduatedColor) gstyle;
- setting.setColour(gcol.getMaxColor().getRGB());
- setting.setMincolour(gcol.getMinColor().getRGB());
- setting.setMin(gcol.getMin());
- setting.setMax(gcol.getMax());
- setting.setColourByLabel(gcol.isColourByLabel());
- setting.setAutoScale(gcol.isAutoScale());
- setting.setThreshold(gcol.getThresh());
- setting.setThreshstate(gcol.getThreshType());
- }
- else
+ for (int ro = 0; ro < renderOrder.length; ro++)
{
- setting.setColour(ap.seqPanel.seqCanvas.getFeatureRenderer()
- .getColour(renderOrder[ro]).getRGB());
+ gstyle = ap.getSeqPanel().seqCanvas.getFeatureRenderer()
+ .getFeatureStyle(renderOrder[ro]);
+ Setting setting = new Setting();
+ setting.setType(renderOrder[ro]);
+ if (gstyle instanceof GraduatedColor)
+ {
+ gcol = (GraduatedColor) gstyle;
+ setting.setColour(gcol.getMaxColor().getRGB());
+ setting.setMincolour(gcol.getMinColor().getRGB());
+ setting.setMin(gcol.getMin());
+ setting.setMax(gcol.getMax());
+ setting.setColourByLabel(gcol.isColourByLabel());
+ setting.setAutoScale(gcol.isAutoScale());
+ setting.setThreshold(gcol.getThresh());
+ setting.setThreshstate(gcol.getThreshType());
+ }
+ else
+ {
+ setting.setColour(ap.getSeqPanel().seqCanvas
+ .getFeatureRenderer().getColour(renderOrder[ro])
+ .getRGB());
+ }
+
+ setting.setDisplay(av.getFeaturesDisplayed().isVisible(
+ renderOrder[ro]));
+ float rorder = ap.getSeqPanel().seqCanvas.getFeatureRenderer()
+ .getOrder(renderOrder[ro]);
+ if (rorder > -1)
+ {
+ setting.setOrder(rorder);
+ }
+ fs.addSetting(setting);
+ settingsAdded.addElement(renderOrder[ro]);
}
+ }
+
+ // Make sure we save none displayed feature settings
+ Iterator en = ap.getSeqPanel().seqCanvas.getFeatureRenderer()
+ .getFeatureColours().keySet().iterator();
+ while (en.hasNext())
+ {
+ String key = en.next().toString();
+ if (settingsAdded.contains(key))
+ {
+ continue;
+ }
+
+ Setting setting = new Setting();
+ setting.setType(key);
+ setting.setColour(ap.getSeqPanel().seqCanvas.getFeatureRenderer()
+ .getColour(key).getRGB());
- setting.setDisplay(av.featuresDisplayed
- .containsKey(renderOrder[ro]));
- float rorder = ap.seqPanel.seqCanvas.getFeatureRenderer()
- .getOrder(renderOrder[ro]);
+ setting.setDisplay(false);
+ float rorder = ap.getSeqPanel().seqCanvas.getFeatureRenderer()
+ .getOrder(key);
if (rorder > -1)
{
setting.setOrder(rorder);
}
fs.addSetting(setting);
- settingsAdded.addElement(renderOrder[ro]);
+ settingsAdded.addElement(key);
}
- }
-
- // Make sure we save none displayed feature settings
- Enumeration en = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours
- .keys();
- while (en.hasMoreElements())
- {
- String key = en.nextElement().toString();
- if (settingsAdded.contains(key))
+ // is groups actually supposed to be a map here ?
+ en = ap.getSeqPanel().seqCanvas.getFeatureRenderer()
+ .getFeatureGroups().iterator();
+ Vector groupsAdded = new Vector();
+ while (en.hasNext())
{
- continue;
+ String grp = en.next().toString();
+ if (groupsAdded.contains(grp))
+ {
+ continue;
+ }
+ Group g = new Group();
+ g.setName(grp);
+ g.setDisplay(((Boolean) ap.getSeqPanel().seqCanvas
+ .getFeatureRenderer().checkGroupVisibility(grp, false))
+ .booleanValue());
+ fs.addGroup(g);
+ groupsAdded.addElement(grp);
}
+ jms.setFeatureSettings(fs);
- Setting setting = new Setting();
- setting.setType(key);
- setting.setColour(ap.seqPanel.seqCanvas.getFeatureRenderer()
- .getColour(key).getRGB());
+ }
- setting.setDisplay(false);
- float rorder = ap.seqPanel.seqCanvas.getFeatureRenderer().getOrder(
- key);
- if (rorder > -1)
+ if (av.hasHiddenColumns())
+ {
+ if (av.getColumnSelection() == null
+ || av.getColumnSelection().getHiddenColumns() == null)
{
- setting.setOrder(rorder);
+ warn("REPORT BUG: avoided null columnselection bug (DMAM reported). Please contact Jim about this.");
}
- fs.addSetting(setting);
- settingsAdded.addElement(key);
- }
- en = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups.keys();
- Vector groupsAdded = new Vector();
- while (en.hasMoreElements())
- {
- String grp = en.nextElement().toString();
- if (groupsAdded.contains(grp))
+ else
{
- continue;
+ for (int c = 0; c < av.getColumnSelection().getHiddenColumns()
+ .size(); c++)
+ {
+ int[] region = av.getColumnSelection().getHiddenColumns()
+ .get(c);
+ HiddenColumns hc = new HiddenColumns();
+ hc.setStart(region[0]);
+ hc.setEnd(region[1]);
+ view.addHiddenColumns(hc);
+ }
}
- Group g = new Group();
- g.setName(grp);
- g.setDisplay(((Boolean) ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups
- .get(grp)).booleanValue());
- fs.addGroup(g);
- groupsAdded.addElement(grp);
- }
- jms.setFeatureSettings(fs);
-
- }
-
- if (av.hasHiddenColumns)
- {
- if (av.getColumnSelection() == null
- || av.getColumnSelection().getHiddenColumns() == null)
- {
- warn("REPORT BUG: avoided null columnselection bug (DMAM reported). Please contact Jim about this.");
}
- else
+ if (calcIdSet.size() > 0)
{
- for (int c = 0; c < av.getColumnSelection().getHiddenColumns()
- .size(); c++)
+ for (String calcId : calcIdSet)
{
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns()
- .elementAt(c);
- HiddenColumns hc = new HiddenColumns();
- hc.setStart(region[0]);
- hc.setEnd(region[1]);
- view.addHiddenColumns(hc);
+ if (calcId.trim().length() > 0)
+ {
+ CalcIdParam cidp = createCalcIdParam(calcId, av);
+ // Some calcIds have no parameters.
+ if (cidp != null)
+ {
+ view.addCalcIdParam(cidp);
+ }
+ }
}
}
- }
-
- jms.addViewport(view);
+ jms.addViewport(view);
+ }
object.setJalviewModelSequence(jms);
object.getVamsasModel().addSequenceSet(vamsasSet);
@@ -1238,12 +1323,12 @@ public class Jalview2XML
// using save and then load
try
{
+ System.out.println("Writing jar entry " + fileName);
JarEntry entry = new JarEntry(fileName);
jout.putNextEntry(entry);
PrintWriter pout = new PrintWriter(new OutputStreamWriter(jout,
- "UTF-8"));
- org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(
- pout);
+ UTF_8));
+ Marshaller marshaller = new Marshaller(pout);
marshaller.marshal(object);
pout.flush();
jout.closeEntry();
@@ -1257,6 +1342,523 @@ public class Jalview2XML
}
/**
+ * Save any Varna viewers linked to this sequence. Writes an rnaViewer element
+ * for each viewer, with
+ * <ul>
+ * <li>viewer geometry (position, size, split pane divider location)</li>
+ * <li>index of the selected structure in the viewer (currently shows gapped
+ * or ungapped)</li>
+ * <li>the id of the annotation holding RNA secondary structure</li>
+ * <li>(currently only one SS is shown per viewer, may be more in future)</li>
+ * </ul>
+ * Varna viewer state is also written out (in native Varna XML) to separate
+ * project jar entries. A separate entry is written for each RNA structure
+ * displayed, with the naming convention
+ * <ul>
+ * <li>rna_viewId_sequenceId_annotationId_[gapped|trimmed]</li>
+ * </ul>
+ *
+ * @param jout
+ * @param jseq
+ * @param jds
+ * @param viewIds
+ * @param ap
+ * @param storeDataset
+ */
+ protected void saveRnaViewers(JarOutputStream jout, JSeq jseq,
+ final SequenceI jds, List<String> viewIds, AlignmentPanel ap,
+ boolean storeDataset)
+ {
+ if (Desktop.desktop == null)
+ {
+ return;
+ }
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ for (int f = frames.length - 1; f > -1; f--)
+ {
+ if (frames[f] instanceof AppVarna)
+ {
+ AppVarna varna = (AppVarna) frames[f];
+ /*
+ * link the sequence to every viewer that is showing it and is linked to
+ * its alignment panel
+ */
+ if (varna.isListeningFor(jds) && ap == varna.getAlignmentPanel())
+ {
+ String viewId = varna.getViewId();
+ RnaViewer rna = new RnaViewer();
+ rna.setViewId(viewId);
+ rna.setTitle(varna.getTitle());
+ rna.setXpos(varna.getX());
+ rna.setYpos(varna.getY());
+ rna.setWidth(varna.getWidth());
+ rna.setHeight(varna.getHeight());
+ rna.setDividerLocation(varna.getDividerLocation());
+ rna.setSelectedRna(varna.getSelectedIndex());
+ jseq.addRnaViewer(rna);
+
+ /*
+ * Store each Varna panel's state once in the project per sequence.
+ * First time through only (storeDataset==false)
+ */
+ // boolean storeSessions = false;
+ // String sequenceViewId = viewId + seqsToIds.get(jds);
+ // if (!storeDataset && !viewIds.contains(sequenceViewId))
+ // {
+ // viewIds.add(sequenceViewId);
+ // storeSessions = true;
+ // }
+ for (RnaModel model : varna.getModels())
+ {
+ if (model.seq == jds)
+ {
+ /*
+ * VARNA saves each view (sequence or alignment secondary
+ * structure, gapped or trimmed) as a separate XML file
+ */
+ String jarEntryName = rnaSessions.get(model);
+ if (jarEntryName == null)
+ {
+
+ String varnaStateFile = varna.getStateInfo(model.rna);
+ jarEntryName = RNA_PREFIX + viewId + "_" + nextCounter();
+ copyFileToJar(jout, varnaStateFile, jarEntryName);
+ rnaSessions.put(model, jarEntryName);
+ }
+ SecondaryStructure ss = new SecondaryStructure();
+ String annotationId = varna.getAnnotation(jds).annotationId;
+ ss.setAnnotationId(annotationId);
+ ss.setViewerState(jarEntryName);
+ ss.setGapped(model.gapped);
+ ss.setTitle(model.title);
+ rna.addSecondaryStructure(ss);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Copy the contents of a file to a new entry added to the output jar
+ *
+ * @param jout
+ * @param infilePath
+ * @param jarEntryName
+ */
+ protected void copyFileToJar(JarOutputStream jout, String infilePath,
+ String jarEntryName)
+ {
+ DataInputStream dis = null;
+ try
+ {
+ File file = new File(infilePath);
+ if (file.exists() && jout != null)
+ {
+ dis = new DataInputStream(new FileInputStream(file));
+ byte[] data = new byte[(int) file.length()];
+ dis.readFully(data);
+ writeJarEntry(jout, jarEntryName, data);
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } finally
+ {
+ if (dis != null)
+ {
+ try
+ {
+ dis.close();
+ } catch (IOException e)
+ {
+ // ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * Write the data to a new entry of given name in the output jar file
+ *
+ * @param jout
+ * @param jarEntryName
+ * @param data
+ * @throws IOException
+ */
+ protected void writeJarEntry(JarOutputStream jout, String jarEntryName,
+ byte[] data) throws IOException
+ {
+ if (jout != null)
+ {
+ System.out.println("Writing jar entry " + jarEntryName);
+ jout.putNextEntry(new JarEntry(jarEntryName));
+ DataOutputStream dout = new DataOutputStream(jout);
+ dout.write(data, 0, data.length);
+ dout.flush();
+ jout.closeEntry();
+ }
+ }
+
+ /**
+ * Save the state of a structure viewer
+ *
+ * @param ap
+ * @param jds
+ * @param pdb
+ * the archive XML element under which to save the state
+ * @param entry
+ * @param viewIds
+ * @param matchedFile
+ * @param viewFrame
+ * @return
+ */
+ protected String saveStructureState(AlignmentPanel ap, SequenceI jds,
+ Pdbids pdb, PDBEntry entry, List<String> viewIds,
+ String matchedFile, StructureViewerBase viewFrame)
+ {
+ final AAStructureBindingModel bindingModel = viewFrame.getBinding();
+
+ /*
+ * Look for any bindings for this viewer to the PDB file of interest
+ * (including part matches excluding chain id)
+ */
+ for (int peid = 0; peid < bindingModel.getPdbCount(); peid++)
+ {
+ final PDBEntry pdbentry = bindingModel.getPdbEntry(peid);
+ final String pdbId = pdbentry.getId();
+ if (!pdbId.equals(entry.getId())
+ && !(entry.getId().length() > 4 && entry.getId()
+ .toLowerCase().startsWith(pdbId.toLowerCase())))
+ {
+ /*
+ * not interested in a binding to a different PDB entry here
+ */
+ continue;
+ }
+ if (matchedFile == null)
+ {
+ matchedFile = pdbentry.getFile();
+ }
+ else if (!matchedFile.equals(pdbentry.getFile()))
+ {
+ Cache.log
+ .warn("Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): "
+ + pdbentry.getFile());
+ }
+ // record the
+ // file so we
+ // can get at it if the ID
+ // match is ambiguous (e.g.
+ // 1QIP==1qipA)
+
+ for (int smap = 0; smap < viewFrame.getBinding().getSequence()[peid].length; smap++)
+ {
+ // if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1)
+ if (jds == viewFrame.getBinding().getSequence()[peid][smap])
+ {
+ StructureState state = new StructureState();
+ state.setVisible(true);
+ state.setXpos(viewFrame.getX());
+ state.setYpos(viewFrame.getY());
+ state.setWidth(viewFrame.getWidth());
+ state.setHeight(viewFrame.getHeight());
+ final String viewId = viewFrame.getViewId();
+ state.setViewId(viewId);
+ state.setAlignwithAlignPanel(viewFrame.isUsedforaligment(ap));
+ state.setColourwithAlignPanel(viewFrame.isUsedforcolourby(ap));
+ state.setColourByJmol(viewFrame.isColouredByViewer());
+ state.setType(viewFrame.getViewerType().toString());
+ pdb.addStructureState(state);
+ }
+ }
+ }
+ return matchedFile;
+ }
+
+ private AnnotationColours constructAnnotationColours(
+ AnnotationColourGradient acg, List<UserColourScheme> userColours,
+ JalviewModelSequence jms)
+ {
+ AnnotationColours ac = new AnnotationColours();
+ ac.setAboveThreshold(acg.getAboveThreshold());
+ ac.setThreshold(acg.getAnnotationThreshold());
+ ac.setAnnotation(acg.getAnnotation());
+ if (acg.getBaseColour() instanceof jalview.schemes.UserColourScheme)
+ {
+ ac.setColourScheme(setUserColourScheme(acg.getBaseColour(),
+ userColours, jms));
+ }
+ else
+ {
+ ac.setColourScheme(ColourSchemeProperty.getColourName(acg
+ .getBaseColour()));
+ }
+
+ ac.setMaxColour(acg.getMaxColour().getRGB());
+ ac.setMinColour(acg.getMinColour().getRGB());
+ ac.setPerSequence(acg.isSeqAssociated());
+ ac.setPredefinedColours(acg.isPredefinedColours());
+ return ac;
+ }
+
+ private void storeAlignmentAnnotation(AlignmentAnnotation[] aa,
+ IdentityHashMap<SequenceGroup, String> groupRefs,
+ AlignmentViewport av, Set<String> calcIdSet, boolean storeDS,
+ SequenceSet vamsasSet)
+ {
+
+ for (int i = 0; i < aa.length; i++)
+ {
+ Annotation an = new Annotation();
+
+ AlignmentAnnotation annotation = aa[i];
+ if (annotation.annotationId != null)
+ {
+ annotationIds.put(annotation.annotationId, annotation);
+ }
+
+ an.setId(annotation.annotationId);
+
+ an.setVisible(annotation.visible);
+
+ an.setDescription(annotation.description);
+
+ if (annotation.sequenceRef != null)
+ {
+ // 2.9 JAL-1781 xref on sequence id rather than name
+ an.setSequenceRef(seqsToIds.get(annotation.sequenceRef));
+ }
+ if (annotation.groupRef != null)
+ {
+ String groupIdr = groupRefs.get(annotation.groupRef);
+ if (groupIdr == null)
+ {
+ // make a locally unique String
+ groupRefs.put(
+ annotation.groupRef,
+ groupIdr = ("" + System.currentTimeMillis()
+ + annotation.groupRef.getName() + groupRefs
+ .size()));
+ }
+ an.setGroupRef(groupIdr.toString());
+ }
+
+ // store all visualization attributes for annotation
+ an.setGraphHeight(annotation.graphHeight);
+ an.setCentreColLabels(annotation.centreColLabels);
+ an.setScaleColLabels(annotation.scaleColLabel);
+ an.setShowAllColLabels(annotation.showAllColLabels);
+ an.setBelowAlignment(annotation.belowAlignment);
+
+ if (annotation.graph > 0)
+ {
+ an.setGraph(true);
+ an.setGraphType(annotation.graph);
+ an.setGraphGroup(annotation.graphGroup);
+ if (annotation.getThreshold() != null)
+ {
+ ThresholdLine line = new ThresholdLine();
+ line.setLabel(annotation.getThreshold().label);
+ line.setValue(annotation.getThreshold().value);
+ line.setColour(annotation.getThreshold().colour.getRGB());
+ an.setThresholdLine(line);
+ }
+ }
+ else
+ {
+ an.setGraph(false);
+ }
+
+ an.setLabel(annotation.label);
+
+ if (annotation == av.getAlignmentQualityAnnot()
+ || annotation == av.getAlignmentConservationAnnotation()
+ || annotation == av.getAlignmentConsensusAnnotation()
+ || annotation.autoCalculated)
+ {
+ // new way of indicating autocalculated annotation -
+ an.setAutoCalculated(annotation.autoCalculated);
+ }
+ if (annotation.hasScore())
+ {
+ an.setScore(annotation.getScore());
+ }
+
+ if (annotation.getCalcId() != null)
+ {
+ calcIdSet.add(annotation.getCalcId());
+ an.setCalcId(annotation.getCalcId());
+ }
+ if (annotation.hasProperties())
+ {
+ for (String pr : annotation.getProperties())
+ {
+ Property prop = new Property();
+ prop.setName(pr);
+ prop.setValue(annotation.getProperty(pr));
+ an.addProperty(prop);
+ }
+ }
+
+ AnnotationElement ae;
+ if (annotation.annotations != null)
+ {
+ an.setScoreOnly(false);
+ for (int a = 0; a < annotation.annotations.length; a++)
+ {
+ if ((annotation == null) || (annotation.annotations[a] == null))
+ {
+ continue;
+ }
+
+ ae = new AnnotationElement();
+ if (annotation.annotations[a].description != null)
+ {
+ ae.setDescription(annotation.annotations[a].description);
+ }
+ if (annotation.annotations[a].displayCharacter != null)
+ {
+ ae.setDisplayCharacter(annotation.annotations[a].displayCharacter);
+ }
+
+ if (!Float.isNaN(annotation.annotations[a].value))
+ {
+ ae.setValue(annotation.annotations[a].value);
+ }
+
+ ae.setPosition(a);
+ if (annotation.annotations[a].secondaryStructure > ' ')
+ {
+ ae.setSecondaryStructure(annotation.annotations[a].secondaryStructure
+ + "");
+ }
+
+ if (annotation.annotations[a].colour != null
+ && annotation.annotations[a].colour != java.awt.Color.black)
+ {
+ ae.setColour(annotation.annotations[a].colour.getRGB());
+ }
+
+ an.addAnnotationElement(ae);
+ if (annotation.autoCalculated)
+ {
+ // only write one non-null entry into the annotation row -
+ // sufficient to get the visualization attributes necessary to
+ // display data
+ continue;
+ }
+ }
+ }
+ else
+ {
+ an.setScoreOnly(true);
+ }
+ if (!storeDS || (storeDS && !annotation.autoCalculated))
+ {
+ // skip autocalculated annotation - these are only provided for
+ // alignments
+ vamsasSet.addAnnotation(an);
+ }
+ }
+
+ }
+
+ private CalcIdParam createCalcIdParam(String calcId, AlignViewport av)
+ {
+ AutoCalcSetting settings = av.getCalcIdSettingsFor(calcId);
+ if (settings != null)
+ {
+ CalcIdParam vCalcIdParam = new CalcIdParam();
+ vCalcIdParam.setCalcId(calcId);
+ vCalcIdParam.addServiceURL(settings.getServiceURI());
+ // generic URI allowing a third party to resolve another instance of the
+ // service used for this calculation
+ for (String urls : settings.getServiceURLs())
+ {
+ vCalcIdParam.addServiceURL(urls);
+ }
+ vCalcIdParam.setVersion("1.0");
+ if (settings.getPreset() != null)
+ {
+ WsParamSetI setting = settings.getPreset();
+ vCalcIdParam.setName(setting.getName());
+ vCalcIdParam.setDescription(setting.getDescription());
+ }
+ else
+ {
+ vCalcIdParam.setName("");
+ vCalcIdParam.setDescription("Last used parameters");
+ }
+ // need to be able to recover 1) settings 2) user-defined presets or
+ // recreate settings from preset 3) predefined settings provided by
+ // service - or settings that can be transferred (or discarded)
+ vCalcIdParam.setParameters(settings.getWsParamFile().replace("\n",
+ "|\\n|"));
+ vCalcIdParam.setAutoUpdate(settings.isAutoUpdate());
+ // todo - decide if updateImmediately is needed for any projects.
+
+ return vCalcIdParam;
+ }
+ return null;
+ }
+
+ private boolean recoverCalcIdParam(CalcIdParam calcIdParam,
+ AlignViewport av)
+ {
+ if (calcIdParam.getVersion().equals("1.0"))
+ {
+ Jws2Instance service = Jws2Discoverer.getDiscoverer()
+ .getPreferredServiceFor(calcIdParam.getServiceURL());
+ if (service != null)
+ {
+ WsParamSetI parmSet = null;
+ try
+ {
+ parmSet = service.getParamStore().parseServiceParameterFile(
+ calcIdParam.getName(), calcIdParam.getDescription(),
+ calcIdParam.getServiceURL(),
+ calcIdParam.getParameters().replace("|\\n|", "\n"));
+ } catch (IOException x)
+ {
+ warn("Couldn't parse parameter data for "
+ + calcIdParam.getCalcId(), x);
+ return false;
+ }
+ List<ArgumentI> argList = null;
+ if (calcIdParam.getName().length() > 0)
+ {
+ parmSet = service.getParamStore()
+ .getPreset(calcIdParam.getName());
+ if (parmSet != null)
+ {
+ // TODO : check we have a good match with settings in AACon -
+ // otherwise we'll need to create a new preset
+ }
+ }
+ else
+ {
+ argList = parmSet.getArguments();
+ parmSet = null;
+ }
+ AAConSettings settings = new AAConSettings(
+ calcIdParam.isAutoUpdate(), service, parmSet, argList);
+ av.setCalcIdSettingsFor(calcIdParam.getCalcId(), settings,
+ calcIdParam.isNeedsUpdate());
+ return true;
+ }
+ else
+ {
+ warn("Cannot resolve a service for the parameters used in this project. Try configuring a JABAWS server.");
+ return false;
+ }
+ }
+ throw new Error(MessageManager.formatMessage(
+ "error.unsupported_version_calcIdparam",
+ new Object[] { calcIdParam.toString() }));
+ }
+
+ /**
* External mapping between jalview objects and objects yielding a valid and
* unique object ID string. This is null for normal Jalview project IO, but
* non-null when a jalview project is being read or written as part of a
@@ -1375,20 +1977,20 @@ public class Jalview2XML
mp = new Mapping();
jalview.util.MapList mlst = jmp.getMap();
- int r[] = mlst.getFromRanges();
- for (int s = 0; s < r.length; s += 2)
+ List<int[]> r = mlst.getFromRanges();
+ for (int[] range : r)
{
MapListFrom mfrom = new MapListFrom();
- mfrom.setStart(r[s]);
- mfrom.setEnd(r[s + 1]);
+ mfrom.setStart(range[0]);
+ mfrom.setEnd(range[1]);
mp.addMapListFrom(mfrom);
}
r = mlst.getToRanges();
- for (int s = 0; s < r.length; s += 2)
+ for (int[] range : r)
{
MapListTo mto = new MapListTo();
- mto.setStart(r[s]);
- mto.setEnd(r[s + 1]);
+ mto.setStart(range[0]);
+ mto.setEnd(range[1]);
mp.addMapListTo(mto);
}
mp.setMapFromUnit(mlst.getFromRatio());
@@ -1434,8 +2036,8 @@ public class Jalview2XML
return mp;
}
- String SetUserColourScheme(jalview.schemes.ColourSchemeI cs,
- Vector userColours, JalviewModelSequence jms)
+ String setUserColourScheme(jalview.schemes.ColourSchemeI cs,
+ List<UserColourScheme> userColours, JalviewModelSequence jms)
{
String id = null;
jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme) cs;
@@ -1480,7 +2082,7 @@ public class Jalview2XML
return id;
}
- jalview.schemes.UserColourScheme GetUserColourScheme(
+ jalview.schemes.UserColourScheme getUserColourScheme(
JalviewModelSequence jms, String id)
{
UserColours[] uc = jms.getUserColours();
@@ -1538,36 +2140,54 @@ public class Jalview2XML
* @param file
* - HTTP URL or filename
*/
- public AlignFrame LoadJalviewAlign(final String file)
+ public AlignFrame loadJalviewAlign(final String file)
{
jalview.gui.AlignFrame af = null;
try
{
+ // create list to store references for any new Jmol viewers created
+ newStructureViewers = new Vector<JalviewStructureDisplayI>();
// UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING
// Workaround is to make sure caller implements the JarInputStreamProvider
// interface
// so we can re-open the jar input stream for each entry.
jarInputStreamProvider jprovider = createjarInputStreamProvider(file);
- af = LoadJalviewAlign(jprovider);
+ af = loadJalviewAlign(jprovider);
+
} catch (MalformedURLException e)
{
errorMessage = "Invalid URL format for '" + file + "'";
reportErrors();
- }
- return af;
- }
-
- private jarInputStreamProvider createjarInputStreamProvider(
+ } finally
+ {
+ try
+ {
+ SwingUtilities.invokeAndWait(new Runnable()
+ {
+ public void run()
+ {
+ setLoadingFinishedForNewStructureViewers();
+ };
+ });
+ } catch (Exception x)
+ {
+ System.err.println("Error loading alignment: " + x.getMessage());
+ }
+ }
+ return af;
+ }
+
+ private jarInputStreamProvider createjarInputStreamProvider(
final String file) throws MalformedURLException
{
URL url = null;
errorMessage = null;
uniqueSetSuffix = null;
seqRefIds = null;
- viewportsAdded = null;
+ viewportsAdded.clear();
frefedSequence = null;
if (file.startsWith("http://"))
@@ -1578,6 +2198,7 @@ public class Jalview2XML
return new jarInputStreamProvider()
{
+ @Override
public JarInputStream getJarInputStream() throws IOException
{
if (_url != null)
@@ -1590,6 +2211,7 @@ public class Jalview2XML
}
}
+ @Override
public String getFilename()
{
return file;
@@ -1606,7 +2228,7 @@ public class Jalview2XML
* @param jprovider
* @return
*/
- public AlignFrame LoadJalviewAlign(final jarInputStreamProvider jprovider)
+ public AlignFrame loadJalviewAlign(final jarInputStreamProvider jprovider)
{
errorMessage = null;
if (uniqueSetSuffix == null)
@@ -1615,19 +2237,15 @@ public class Jalview2XML
}
if (seqRefIds == null)
{
- seqRefIds = new Hashtable();
- }
- if (viewportsAdded == null)
- {
- viewportsAdded = new Hashtable();
+ seqRefIds = new HashMap<String, SequenceI>();
}
if (frefedSequence == null)
{
frefedSequence = new Vector();
}
- jalview.gui.AlignFrame af = null;
- Hashtable gatherToThisFrame = new Hashtable();
+ AlignFrame af = null, _af = null;
+ Map<String, AlignFrame> gatherToThisFrame = new HashMap<String, AlignFrame>();
final String file = jprovider.getFilename();
try
{
@@ -1645,7 +2263,7 @@ public class Jalview2XML
if (jarentry != null && jarentry.getName().endsWith(".xml"))
{
- InputStreamReader in = new InputStreamReader(jin, "UTF-8");
+ InputStreamReader in = new InputStreamReader(jin, UTF_8);
JalviewModel object = new JalviewModel();
Unmarshaller unmar = new Unmarshaller(object);
@@ -1653,10 +2271,14 @@ public class Jalview2XML
object = (JalviewModel) unmar.unmarshal(in);
if (true) // !skipViewport(object))
{
- af = LoadFromObject(object, file, true, jprovider);
- if (af.viewport.gatherViewsHere)
+ _af = loadFromObject(object, file, true, jprovider);
+ if (object.getJalviewModelSequence().getViewportCount() > 0)
{
- gatherToThisFrame.put(af.viewport.getSequenceSetId(), af);
+ af = _af;
+ if (af.viewport.isGatherViewsHere())
+ {
+ gatherToThisFrame.put(af.viewport.getSequenceSetId(), af);
+ }
}
}
entryCount++;
@@ -1668,13 +2290,7 @@ public class Jalview2XML
}
} while (jarentry != null);
resolveFrefedSequences();
- } catch (java.io.FileNotFoundException ex)
- {
- ex.printStackTrace();
- errorMessage = "Couldn't locate Jalview XML file : " + file;
- System.err.println("Exception whilst loading jalview XML file : "
- + ex + "\n");
- } catch (java.net.UnknownHostException ex)
+ } catch (IOException ex)
{
ex.printStackTrace();
errorMessage = "Couldn't locate Jalview XML file : " + file;
@@ -1723,11 +2339,20 @@ public class Jalview2XML
Desktop.instance.stopLoading();
}
- Enumeration en = gatherToThisFrame.elements();
- while (en.hasMoreElements())
+ /*
+ * Regather multiple views (with the same sequence set id) to the frame (if
+ * any) that is flagged as the one to gather to, i.e. convert them to tabbed
+ * views instead of separate frames. Note this doesn't restore a state where
+ * some expanded views in turn have tabbed views - the last "first tab" read
+ * in will play the role of gatherer for all.
+ */
+ for (AlignFrame fr : gatherToThisFrame.values())
{
- Desktop.instance.gatherViews((AlignFrame) en.nextElement());
+ Desktop.instance.gatherViews(fr);
}
+
+ restoreSplitFrames();
+
if (errorMessage != null)
{
reportErrors();
@@ -1736,6 +2361,110 @@ public class Jalview2XML
}
/**
+ * Try to reconstruct and display SplitFrame windows, where each contains
+ * complementary dna and protein alignments. Done by pairing up AlignFrame
+ * objects (created earlier) which have complementary viewport ids associated.
+ */
+ protected void restoreSplitFrames()
+ {
+ List<SplitFrame> gatherTo = new ArrayList<SplitFrame>();
+ List<AlignFrame> addedToSplitFrames = new ArrayList<AlignFrame>();
+ Map<String, AlignFrame> dna = new HashMap<String, AlignFrame>();
+
+ /*
+ * Identify the DNA alignments
+ */
+ for (Entry<Viewport, AlignFrame> candidate : splitFrameCandidates
+ .entrySet())
+ {
+ AlignFrame af = candidate.getValue();
+ if (af.getViewport().getAlignment().isNucleotide())
+ {
+ dna.put(candidate.getKey().getId(), af);
+ }
+ }
+
+ /*
+ * Try to match up the protein complements
+ */
+ for (Entry<Viewport, AlignFrame> candidate : splitFrameCandidates
+ .entrySet())
+ {
+ AlignFrame af = candidate.getValue();
+ if (!af.getViewport().getAlignment().isNucleotide())
+ {
+ String complementId = candidate.getKey().getComplementId();
+ // only non-null complements should be in the Map
+ if (complementId != null && dna.containsKey(complementId))
+ {
+ final AlignFrame dnaFrame = dna.get(complementId);
+ SplitFrame sf = createSplitFrame(dnaFrame, af);
+ addedToSplitFrames.add(dnaFrame);
+ addedToSplitFrames.add(af);
+ if (af.viewport.isGatherViewsHere())
+ {
+ gatherTo.add(sf);
+ }
+ }
+ }
+ }
+
+ /*
+ * Open any that we failed to pair up (which shouldn't happen!) as
+ * standalone AlignFrame's.
+ */
+ for (Entry<Viewport, AlignFrame> candidate : splitFrameCandidates
+ .entrySet())
+ {
+ AlignFrame af = candidate.getValue();
+ if (!addedToSplitFrames.contains(af))
+ {
+ Viewport view = candidate.getKey();
+ Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(),
+ view.getHeight());
+ System.err.println("Failed to restore view " + view.getTitle()
+ + " to split frame");
+ }
+ }
+
+ /*
+ * Gather back into tabbed views as flagged.
+ */
+ for (SplitFrame sf : gatherTo)
+ {
+ Desktop.instance.gatherViews(sf);
+ }
+
+ splitFrameCandidates.clear();
+ }
+
+ /**
+ * Construct and display one SplitFrame holding DNA and protein alignments.
+ *
+ * @param dnaFrame
+ * @param proteinFrame
+ * @return
+ */
+ protected SplitFrame createSplitFrame(AlignFrame dnaFrame,
+ AlignFrame proteinFrame)
+ {
+ SplitFrame splitFrame = new SplitFrame(dnaFrame, proteinFrame);
+ String title = MessageManager.getString("label.linked_view_title");
+ int width = (int) dnaFrame.getBounds().getWidth();
+ int height = (int) (dnaFrame.getBounds().getHeight()
+ + proteinFrame.getBounds().getHeight() + 50);
+ Desktop.addInternalFrame(splitFrame, title, width, height);
+
+ /*
+ * And compute cDNA consensus (couldn't do earlier with consensus as
+ * mappings were not yet present)
+ */
+ proteinFrame.viewport.alignmentChanged(proteinFrame.alignPanel);
+
+ return splitFrame;
+ }
+
+ /**
* check errorMessage for a valid error message and raise an error box in the
* GUI or write the current errorMessage to stderr and then clear the error
* state.
@@ -1754,6 +2483,7 @@ public class Jalview2XML
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
@@ -1771,22 +2501,56 @@ public class Jalview2XML
errorMessage = null;
}
- Hashtable alreadyLoadedPDB;
+ Map<String, String> alreadyLoadedPDB = new HashMap<String, String>();
/**
* when set, local views will be updated from view stored in JalviewXML
* Currently (28th Sep 2008) things will go horribly wrong in vamsas document
* sync if this is set to true.
*/
- private boolean updateLocalViews = false;
+ private final boolean updateLocalViews = false;
+ /**
+ * Returns the path to a temporary file holding the PDB file for the given PDB
+ * id. The first time of asking, searches for a file of that name in the
+ * Jalview project jar, and copies it to a new temporary file. Any repeat
+ * requests just return the path to the file previously created.
+ *
+ * @param jprovider
+ * @param pdbId
+ * @return
+ */
String loadPDBFile(jarInputStreamProvider jprovider, String pdbId)
{
- if (alreadyLoadedPDB == null)
- alreadyLoadedPDB = new Hashtable();
-
if (alreadyLoadedPDB.containsKey(pdbId))
+ {
return alreadyLoadedPDB.get(pdbId).toString();
+ }
+
+ String tempFile = copyJarEntry(jprovider, pdbId, "jalview_pdb");
+ if (tempFile != null)
+ {
+ alreadyLoadedPDB.put(pdbId, tempFile);
+ }
+ return tempFile;
+ }
+
+ /**
+ * Copies the jar entry of given name to a new temporary file and returns the
+ * path to the file, or null if the entry is not found.
+ *
+ * @param jprovider
+ * @param jarEntryName
+ * @param prefix
+ * a prefix for the temporary file name, must be at least three
+ * characters long
+ * @return
+ */
+ protected String copyJarEntry(jarInputStreamProvider jprovider,
+ String jarEntryName, String prefix)
+ {
+ BufferedReader in = null;
+ PrintWriter out = null;
try
{
@@ -1801,38 +2565,46 @@ public class Jalview2XML
do
{
entry = jin.getNextJarEntry();
- } while (entry != null && !entry.getName().equals(pdbId));
+ } while (entry != null && !entry.getName().equals(jarEntryName));
if (entry != null)
{
- BufferedReader in = new BufferedReader(new InputStreamReader(jin));
- File outFile = File.createTempFile("jalview_pdb", ".txt");
+ in = new BufferedReader(new InputStreamReader(jin, UTF_8));
+ File outFile = File.createTempFile(prefix, ".tmp");
outFile.deleteOnExit();
- PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
+ out = new PrintWriter(new FileOutputStream(outFile));
String data;
while ((data = in.readLine()) != null)
{
out.println(data);
}
- try
- {
- out.flush();
- } catch (Exception foo)
- {
- }
- ;
- out.close();
-
- alreadyLoadedPDB.put(pdbId, outFile.getAbsolutePath());
- return outFile.getAbsolutePath();
+ out.flush();
+ String t = outFile.getAbsolutePath();
+ return t;
}
else
{
- warn("Couldn't find PDB file entry in Jalview Jar for " + pdbId);
+ warn("Couldn't find entry in Jalview Jar for " + jarEntryName);
}
} catch (Exception ex)
{
ex.printStackTrace();
+ } finally
+ {
+ if (in != null)
+ {
+ try
+ {
+ in.close();
+ } catch (IOException e)
+ {
+ // ignore
+ }
+ }
+ if (out != null)
+ {
+ out.close();
+ }
}
return null;
@@ -1870,7 +2642,7 @@ public class Jalview2XML
* data source provider
* @return alignment frame created from view stored in DOM
*/
- AlignFrame LoadFromObject(JalviewModel object, String file,
+ AlignFrame loadFromObject(JalviewModel object, String file,
boolean loadTreesAndStructures, jarInputStreamProvider jprovider)
{
SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);
@@ -1878,26 +2650,28 @@ public class Jalview2XML
JalviewModelSequence jms = object.getJalviewModelSequence();
- Viewport view = jms.getViewport(0);
+ Viewport view = (jms.getViewportCount() > 0) ? jms.getViewport(0)
+ : null;
+
// ////////////////////////////////
// LOAD SEQUENCES
- Vector hiddenSeqs = null;
+ List<SequenceI> hiddenSeqs = null;
jalview.datamodel.Sequence jseq;
- ArrayList tmpseqs = new ArrayList();
+ List<SequenceI> tmpseqs = new ArrayList<SequenceI>();
boolean multipleView = false;
- JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();
+ JSeq[] jseqs = object.getJalviewModelSequence().getJSeq();
int vi = 0; // counter in vamsasSeq array
- for (int i = 0; i < JSEQ.length; i++)
+ for (int i = 0; i < jseqs.length; i++)
{
- String seqId = JSEQ[i].getId();
+ String seqId = jseqs[i].getId();
if (seqRefIds.get(seqId) != null)
{
- tmpseqs.add((jalview.datamodel.Sequence) seqRefIds.get(seqId));
+ tmpseqs.add(seqRefIds.get(seqId));
multipleView = true;
}
else
@@ -1905,23 +2679,22 @@ public class Jalview2XML
jseq = new jalview.datamodel.Sequence(vamsasSeq[vi].getName(),
vamsasSeq[vi].getSequence());
jseq.setDescription(vamsasSeq[vi].getDescription());
- jseq.setStart(JSEQ[i].getStart());
- jseq.setEnd(JSEQ[i].getEnd());
+ jseq.setStart(jseqs[i].getStart());
+ jseq.setEnd(jseqs[i].getEnd());
jseq.setVamsasId(uniqueSetSuffix + seqId);
seqRefIds.put(vamsasSeq[vi].getId(), jseq);
tmpseqs.add(jseq);
vi++;
}
- if (JSEQ[i].getHidden())
+ if (jseqs[i].getHidden())
{
if (hiddenSeqs == null)
{
- hiddenSeqs = new Vector();
+ hiddenSeqs = new ArrayList<SequenceI>();
}
- hiddenSeqs.addElement((jalview.datamodel.Sequence) seqRefIds
- .get(seqId));
+ hiddenSeqs.add(seqRefIds.get(seqId));
}
}
@@ -1929,13 +2702,10 @@ public class Jalview2XML
// /
// Create the alignment object from the sequence set
// ///////////////////////////////
- jalview.datamodel.Sequence[] orderedSeqs = new jalview.datamodel.Sequence[tmpseqs
- .size()];
+ SequenceI[] orderedSeqs = tmpseqs
+ .toArray(new SequenceI[tmpseqs.size()]);
- tmpseqs.toArray(orderedSeqs);
-
- jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(
- orderedSeqs);
+ Alignment al = new Alignment(orderedSeqs);
// / Add the alignment properties
for (int i = 0; i < vamsasSet.getSequenceSetPropertiesCount(); i++)
@@ -1955,20 +2725,23 @@ public class Jalview2XML
}
else
{
- recoverDatasetFor(vamsasSet, al);
+ // recover dataset - passing on flag indicating if this a 'viewless'
+ // sequence set (a.k.a. a stored dataset for the project)
+ recoverDatasetFor(vamsasSet, al, object.getJalviewModelSequence()
+ .getViewportCount() == 0);
}
// ///////////////////////////////
- Hashtable pdbloaded = new Hashtable();
+ Hashtable pdbloaded = new Hashtable(); // TODO nothing writes to this??
if (!multipleView)
{
// load sequence features, database references and any associated PDB
// structures for the alignment
for (int i = 0; i < vamsasSeq.length; i++)
{
- if (JSEQ[i].getFeaturesCount() > 0)
+ if (jseqs[i].getFeaturesCount() > 0)
{
- Features[] features = JSEQ[i].getFeatures();
+ Features[] features = jseqs[i].getFeatures();
for (int f = 0; f < features.length; f++)
{
jalview.datamodel.SequenceFeature sf = new jalview.datamodel.SequenceFeature(
@@ -1998,14 +2771,24 @@ public class Jalview2XML
{
addDBRefs(al.getSequenceAt(i).getDatasetSequence(), vamsasSeq[i]);
}
- if (JSEQ[i].getPdbidsCount() > 0)
+ if (jseqs[i].getPdbidsCount() > 0)
{
- Pdbids[] ids = JSEQ[i].getPdbids();
+ Pdbids[] ids = jseqs[i].getPdbids();
for (int p = 0; p < ids.length; p++)
{
jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry();
entry.setId(ids[p].getId());
- entry.setType(ids[p].getType());
+ if (ids[p].getType() != null)
+ {
+ if (ids[p].getType().equalsIgnoreCase("PDB"))
+ {
+ entry.setType(PDBEntry.Type.PDB);
+ }
+ else
+ {
+ entry.setType(PDBEntry.Type.FILE);
+ }
+ }
if (ids[p].getFile() != null)
{
if (!pdbloaded.containsKey(ids[p].getFile()))
@@ -2017,7 +2800,8 @@ public class Jalview2XML
entry.setFile(pdbloaded.get(ids[p].getId()).toString());
}
}
-
+ StructureSelectionManager.getStructureSelectionManager(
+ Desktop.instance).registerPDBEntry(entry);
al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);
}
}
@@ -2034,35 +2818,13 @@ public class Jalview2XML
AlcodonFrame[] alc = vamsasSet.getAlcodonFrame();
for (int i = 0; i < alc.length; i++)
{
- jalview.datamodel.AlignedCodonFrame cf = new jalview.datamodel.AlignedCodonFrame(
- alc[i].getAlcodonCount());
- if (alc[i].getAlcodonCount() > 0)
- {
- Alcodon[] alcods = alc[i].getAlcodon();
- for (int p = 0; p < cf.codons.length; p++)
- {
- if (alcods[p].hasPos1() && alcods[p].hasPos2()
- && alcods[p].hasPos3())
- {
- // translated codons require three valid positions
- cf.codons[p] = new int[3];
- cf.codons[p][0] = (int) alcods[p].getPos1();
- cf.codons[p][1] = (int) alcods[p].getPos2();
- cf.codons[p][2] = (int) alcods[p].getPos3();
- }
- else
- {
- cf.codons[p] = null;
- }
- }
- }
+ AlignedCodonFrame cf = new AlignedCodonFrame();
if (alc[i].getAlcodMapCount() > 0)
{
AlcodMap[] maps = alc[i].getAlcodMap();
for (int m = 0; m < maps.length; m++)
{
- SequenceI dnaseq = (SequenceI) seqRefIds
- .get(maps[m].getDnasq());
+ SequenceI dnaseq = seqRefIds.get(maps[m].getDnasq());
// Load Mapping
jalview.datamodel.Mapping mapping = null;
// attach to dna sequence reference.
@@ -2077,23 +2839,23 @@ public class Jalview2XML
else
{
// defer to later
- frefedSequence.add(new Object[]
- { maps[m].getDnasq(), cf, mapping });
+ frefedSequence.add(new Object[] { maps[m].getDnasq(), cf,
+ mapping });
}
}
}
al.addCodonFrame(cf);
}
-
}
// ////////////////////////////////
// LOAD ANNOTATIONS
- ArrayList<JvAnnotRow> autoAlan = new ArrayList<JvAnnotRow>();
- /**
+ List<JvAnnotRow> autoAlan = new ArrayList<JvAnnotRow>();
+
+ /*
* store any annotations which forward reference a group's ID
*/
- Hashtable<String, ArrayList<jalview.datamodel.AlignmentAnnotation>> groupAnnotRefs = new Hashtable<String, ArrayList<jalview.datamodel.AlignmentAnnotation>>();
+ Map<String, List<AlignmentAnnotation>> groupAnnotRefs = new Hashtable<String, List<AlignmentAnnotation>>();
if (vamsasSet.getAnnotationCount() > 0)
{
@@ -2101,57 +2863,66 @@ public class Jalview2XML
for (int i = 0; i < an.length; i++)
{
+ Annotation annotation = an[i];
+
/**
* test if annotation is automatically calculated for this view only
*/
boolean autoForView = false;
- if (an[i].getLabel().equals("Quality")
- || an[i].getLabel().equals("Conservation")
- || an[i].getLabel().equals("Consensus"))
+ if (annotation.getLabel().equals("Quality")
+ || annotation.getLabel().equals("Conservation")
+ || annotation.getLabel().equals("Consensus"))
{
// Kludge for pre 2.5 projects which lacked the autocalculated flag
autoForView = true;
- if (!an[i].hasAutoCalculated())
+ if (!annotation.hasAutoCalculated())
{
- an[i].setAutoCalculated(true);
+ annotation.setAutoCalculated(true);
}
}
if (autoForView
- || (an[i].hasAutoCalculated() && an[i].isAutoCalculated()))
+ || (annotation.hasAutoCalculated() && annotation
+ .isAutoCalculated()))
{
// remove ID - we don't recover annotation from other views for
// view-specific annotation
- an[i].setId(null);
+ annotation.setId(null);
}
// set visiblity for other annotation in this view
- if (an[i].getId() != null
- && annotationIds.containsKey(an[i].getId()))
+ String annotationId = annotation.getId();
+ if (annotationId != null && annotationIds.containsKey(annotationId))
{
- jalview.datamodel.AlignmentAnnotation jda = (jalview.datamodel.AlignmentAnnotation) annotationIds
- .get(an[i].getId());
+ AlignmentAnnotation jda = annotationIds.get(annotationId);
// in principle Visible should always be true for annotation displayed
// in multiple views
- if (an[i].hasVisible())
- jda.visible = an[i].getVisible();
+ if (annotation.hasVisible())
+ {
+ jda.visible = annotation.getVisible();
+ }
al.addAnnotation(jda);
continue;
}
// Construct new annotation from model.
- AnnotationElement[] ae = an[i].getAnnotationElement();
+ AnnotationElement[] ae = annotation.getAnnotationElement();
jalview.datamodel.Annotation[] anot = null;
-
- if (!an[i].getScoreOnly())
+ java.awt.Color firstColour = null;
+ int anpos;
+ if (!annotation.getScoreOnly())
{
anot = new jalview.datamodel.Annotation[al.getWidth()];
for (int aa = 0; aa < ae.length && aa < anot.length; aa++)
{
- if (ae[aa].getPosition() >= anot.length)
+ anpos = ae[aa].getPosition();
+
+ if (anpos >= anot.length)
+ {
continue;
+ }
- anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(
+ anot[anpos] = new jalview.datamodel.Annotation(
ae[aa].getDisplayCharacter(), ae[aa].getDescription(),
(ae[aa].getSecondaryStructure() == null || ae[aa]
@@ -2167,33 +2938,36 @@ public class Jalview2XML
// {
// anot[ae[aa].getPosition()].displayCharacter = "";
// }
- anot[ae[aa].getPosition()].colour = new java.awt.Color(
- ae[aa].getColour());
+ anot[anpos].colour = new java.awt.Color(ae[aa].getColour());
+ if (firstColour == null)
+ {
+ firstColour = anot[anpos].colour;
+ }
}
}
jalview.datamodel.AlignmentAnnotation jaa = null;
- if (an[i].getGraph())
+ if (annotation.getGraph())
{
float llim = 0, hlim = 0;
// if (autoForView || an[i].isAutoCalculated()) {
// hlim=11f;
// }
- jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),
- an[i].getDescription(), anot, llim, hlim,
- an[i].getGraphType());
+ jaa = new jalview.datamodel.AlignmentAnnotation(
+ annotation.getLabel(), annotation.getDescription(), anot,
+ llim, hlim, annotation.getGraphType());
- jaa.graphGroup = an[i].getGraphGroup();
-
- if (an[i].getThresholdLine() != null)
+ jaa.graphGroup = annotation.getGraphGroup();
+ jaa._linecolour = firstColour;
+ if (annotation.getThresholdLine() != null)
{
- jaa.setThreshold(new jalview.datamodel.GraphLine(an[i]
- .getThresholdLine().getValue(), an[i]
+ jaa.setThreshold(new jalview.datamodel.GraphLine(annotation
+ .getThresholdLine().getValue(), annotation
.getThresholdLine().getLabel(), new java.awt.Color(
- an[i].getThresholdLine().getColour())));
+ annotation.getThresholdLine().getColour())));
}
- if (autoForView || an[i].isAutoCalculated())
+ if (autoForView || annotation.isAutoCalculated())
{
// Hardwire the symbol display line to ensure that labels for
// histograms are displayed
@@ -2204,31 +2978,35 @@ public class Jalview2XML
{
jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),
an[i].getDescription(), anot);
+ jaa._linecolour = firstColour;
}
- if (autoForView)
+ // register new annotation
+ if (an[i].getId() != null)
{
- // register new annotation
- if (an[i].getId() != null)
+ annotationIds.put(an[i].getId(), jaa);
+ jaa.annotationId = an[i].getId();
+ }
+ // recover sequence association
+ String sequenceRef = an[i].getSequenceRef();
+ if (sequenceRef != null)
+ {
+ // from 2.9 sequenceRef is to sequence id (JAL-1781)
+ SequenceI sequence = seqRefIds.get(sequenceRef);
+ if (sequence == null)
{
- annotationIds.put(an[i].getId(), jaa);
- jaa.annotationId = an[i].getId();
+ // in pre-2.9 projects sequence ref is to sequence name
+ sequence = al.findName(sequenceRef);
}
- // recover sequence association
- if (an[i].getSequenceRef() != null)
+ if (sequence != null)
{
- if (al.findName(an[i].getSequenceRef()) != null)
- {
- jaa.createSequenceMapping(
- al.findName(an[i].getSequenceRef()), 1, true);
- al.findName(an[i].getSequenceRef()).addAlignmentAnnotation(
- jaa);
- }
+ jaa.createSequenceMapping(sequence, 1, true);
+ sequence.addAlignmentAnnotation(jaa);
}
}
// and make a note of any group association
if (an[i].getGroupRef() != null && an[i].getGroupRef().length() > 0)
{
- ArrayList<jalview.datamodel.AlignmentAnnotation> aal = groupAnnotRefs
+ List<jalview.datamodel.AlignmentAnnotation> aal = groupAnnotRefs
.get(an[i].getGroupRef());
if (aal == null)
{
@@ -2243,10 +3021,14 @@ public class Jalview2XML
jaa.setScore(an[i].getScore());
}
if (an[i].hasVisible())
+ {
jaa.visible = an[i].getVisible();
+ }
if (an[i].hasCentreColLabels())
+ {
jaa.centreColLabels = an[i].getCentreColLabels();
+ }
if (an[i].hasScaleColLabels())
{
@@ -2263,6 +3045,19 @@ public class Jalview2XML
{
jaa.graphHeight = an[i].getGraphHeight();
}
+ if (an[i].hasBelowAlignment())
+ {
+ jaa.belowAlignment = an[i].isBelowAlignment();
+ }
+ jaa.setCalcId(an[i].getCalcId());
+ if (an[i].getPropertyCount() > 0)
+ {
+ for (jalview.schemabinding.version2.Property prop : an[i]
+ .getProperty())
+ {
+ jaa.setProperty(prop.getName(), prop.getValue());
+ }
+ }
if (jaa.autoCalculated)
{
autoAlan.add(new JvAnnotRow(i, jaa));
@@ -2276,42 +3071,46 @@ public class Jalview2XML
}
}
}
-
// ///////////////////////
// LOAD GROUPS
// Create alignment markup and styles for this view
if (jms.getJGroupCount() > 0)
{
JGroup[] groups = jms.getJGroup();
-
+ boolean addAnnotSchemeGroup = false;
for (int i = 0; i < groups.length; i++)
{
+ JGroup jGroup = groups[i];
ColourSchemeI cs = null;
-
- if (groups[i].getColour() != null)
+ if (jGroup.getColour() != null)
{
- if (groups[i].getColour().startsWith("ucs"))
+ if (jGroup.getColour().startsWith("ucs"))
+ {
+ cs = getUserColourScheme(jms, jGroup.getColour());
+ }
+ else if (jGroup.getColour().equals("AnnotationColourGradient")
+ && jGroup.getAnnotationColours() != null)
{
- cs = GetUserColourScheme(jms, groups[i].getColour());
+ addAnnotSchemeGroup = true;
+ cs = null;
}
else
{
- cs = ColourSchemeProperty.getColour(al, groups[i].getColour());
+ cs = ColourSchemeProperty.getColour(al, jGroup.getColour());
}
if (cs != null)
{
- cs.setThreshold(groups[i].getPidThreshold(), true);
+ cs.setThreshold(jGroup.getPidThreshold(), true);
}
}
- Vector seqs = new Vector();
+ Vector<SequenceI> seqs = new Vector<SequenceI>();
- for (int s = 0; s < groups[i].getSeqCount(); s++)
+ for (int s = 0; s < jGroup.getSeqCount(); s++)
{
- String seqId = groups[i].getSeq(s) + "";
- jalview.datamodel.SequenceI ts = (jalview.datamodel.SequenceI) seqRefIds
- .get(seqId);
+ String seqId = jGroup.getSeq(s) + "";
+ SequenceI ts = seqRefIds.get(seqId);
if (ts != null)
{
@@ -2324,32 +3123,35 @@ public class Jalview2XML
continue;
}
- jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup(
- seqs, groups[i].getName(), cs, groups[i].getDisplayBoxes(),
- groups[i].getDisplayText(), groups[i].getColourText(),
- groups[i].getStart(), groups[i].getEnd());
+ SequenceGroup sg = new SequenceGroup(seqs, jGroup.getName(), cs,
+ jGroup.getDisplayBoxes(), jGroup.getDisplayText(),
+ jGroup.getColourText(), jGroup.getStart(), jGroup.getEnd());
- sg.setOutlineColour(new java.awt.Color(groups[i].getOutlineColour()));
+ sg.setOutlineColour(new java.awt.Color(jGroup.getOutlineColour()));
- sg.textColour = new java.awt.Color(groups[i].getTextCol1());
- sg.textColour2 = new java.awt.Color(groups[i].getTextCol2());
- sg.setShowNonconserved(groups[i].hasShowUnconserved() ? groups[i]
+ sg.textColour = new java.awt.Color(jGroup.getTextCol1());
+ sg.textColour2 = new java.awt.Color(jGroup.getTextCol2());
+ sg.setShowNonconserved(jGroup.hasShowUnconserved() ? jGroup
.isShowUnconserved() : false);
- sg.thresholdTextColour = groups[i].getTextColThreshold();
- if (groups[i].hasShowConsensusHistogram())
+ sg.thresholdTextColour = jGroup.getTextColThreshold();
+ if (jGroup.hasShowConsensusHistogram())
{
- sg.setShowConsensusHistogram(groups[i].isShowConsensusHistogram());
+ sg.setShowConsensusHistogram(jGroup.isShowConsensusHistogram());
}
;
- if (groups[i].hasShowSequenceLogo())
+ if (jGroup.hasShowSequenceLogo())
{
- sg.setshowSequenceLogo(groups[i].isShowSequenceLogo());
+ sg.setshowSequenceLogo(jGroup.isShowSequenceLogo());
}
- if (groups[i].hasIgnoreGapsinConsensus())
+ if (jGroup.hasNormaliseSequenceLogo())
{
- sg.setIgnoreGapsConsensus(groups[i].getIgnoreGapsinConsensus());
+ sg.setNormaliseSequenceLogo(jGroup.isNormaliseSequenceLogo());
}
- if (groups[i].getConsThreshold() != 0)
+ if (jGroup.hasIgnoreGapsinConsensus())
+ {
+ sg.setIgnoreGapsConsensus(jGroup.getIgnoreGapsinConsensus());
+ }
+ if (jGroup.getConsThreshold() != 0)
{
jalview.analysis.Conservation c = new jalview.analysis.Conservation(
"All", ResidueProperties.propHash, 3,
@@ -2359,14 +3161,14 @@ public class Jalview2XML
sg.cs.setConservation(c);
}
- if (groups[i].getId() != null && groupAnnotRefs.size() > 0)
+ if (jGroup.getId() != null && groupAnnotRefs.size() > 0)
{
// re-instate unique group/annotation row reference
- ArrayList<jalview.datamodel.AlignmentAnnotation> jaal = groupAnnotRefs
- .get(groups[i].getId());
+ List<AlignmentAnnotation> jaal = groupAnnotRefs.get(jGroup
+ .getId());
if (jaal != null)
{
- for (jalview.datamodel.AlignmentAnnotation jaa : jaal)
+ for (AlignmentAnnotation jaa : jaal)
{
jaa.groupRef = sg;
if (jaa.autoCalculated)
@@ -2388,10 +3190,19 @@ public class Jalview2XML
}
}
al.addGroup(sg);
-
+ if (addAnnotSchemeGroup)
+ {
+ // reconstruct the annotation colourscheme
+ sg.cs = constructAnnotationColour(jGroup.getAnnotationColours(),
+ null, al, jms, false);
+ }
}
}
-
+ if (view == null)
+ {
+ // only dataset in this model, so just return.
+ return null;
+ }
// ///////////////////////////////
// LOAD VIEWPORT
@@ -2435,6 +3246,13 @@ public class Jalview2XML
}
}
+ /**
+ * indicate that annotation colours are applied across all groups (pre
+ * Jalview 2.8.1 behaviour)
+ */
+ boolean doGroupAnnColour = isVersionStringLaterThan("2.8.1",
+ object.getVersion());
+
AlignmentPanel ap = null;
boolean isnewview = true;
if (viewId != null)
@@ -2462,442 +3280,839 @@ public class Jalview2XML
if (isnewview)
{
- af = loadViewport(file, JSEQ, hiddenSeqs, al, jms, view,
+ af = loadViewport(file, jseqs, hiddenSeqs, al, jms, view,
uniqueSeqSetId, viewId, autoAlan);
av = af.viewport;
ap = af.alignPanel;
}
- // LOAD TREES
- // /////////////////////////////////////
- if (loadTreesAndStructures && jms.getTreeCount() > 0)
+
+ /*
+ * Load any trees, PDB structures and viewers
+ *
+ * Not done if flag is false (when this method is used for New View)
+ */
+ if (loadTreesAndStructures)
{
- try
+ loadTrees(jms, view, af, av, ap);
+ loadPDBStructures(jprovider, jseqs, af, ap);
+ loadRnaViewers(jprovider, jseqs, ap);
+ }
+ // and finally return.
+ return af;
+ }
+
+ /**
+ * Instantiate and link any saved RNA (Varna) viewers. The state of the Varna
+ * panel is restored from separate jar entries, two (gapped and trimmed) per
+ * sequence and secondary structure.
+ *
+ * Currently each viewer shows just one sequence and structure (gapped and
+ * trimmed), however this method is designed to support multiple sequences or
+ * structures in viewers if wanted in future.
+ *
+ * @param jprovider
+ * @param jseqs
+ * @param ap
+ */
+ private void loadRnaViewers(jarInputStreamProvider jprovider,
+ JSeq[] jseqs, AlignmentPanel ap)
+ {
+ /*
+ * scan the sequences for references to viewers; create each one the first
+ * time it is referenced, add Rna models to existing viewers
+ */
+ for (JSeq jseq : jseqs)
+ {
+ for (int i = 0; i < jseq.getRnaViewerCount(); i++)
{
- for (int t = 0; t < jms.getTreeCount(); t++)
+ RnaViewer viewer = jseq.getRnaViewer(i);
+ AppVarna appVarna = findOrCreateVarnaViewer(viewer,
+ uniqueSetSuffix, ap);
+
+ for (int j = 0; j < viewer.getSecondaryStructureCount(); j++)
{
+ SecondaryStructure ss = viewer.getSecondaryStructure(j);
+ SequenceI seq = seqRefIds.get(jseq.getId());
+ AlignmentAnnotation ann = this.annotationIds.get(ss
+ .getAnnotationId());
- Tree tree = jms.getTree(t);
+ /*
+ * add the structure to the Varna display (with session state copied
+ * from the jar to a temporary file)
+ */
+ boolean gapped = ss.isGapped();
+ String rnaTitle = ss.getTitle();
+ String sessionState = ss.getViewerState();
+ String tempStateFile = copyJarEntry(jprovider, sessionState,
+ "varna");
+ RnaModel rna = new RnaModel(rnaTitle, ann, seq, null, gapped);
+ appVarna.addModelSession(rna, rnaTitle, tempStateFile);
+ }
+ appVarna.setInitialSelection(viewer.getSelectedRna());
+ }
+ }
+ }
- TreePanel tp = (TreePanel) retrieveExistingObj(tree.getId());
- if (tp == null)
- {
- tp = af.ShowNewickTree(
- new jalview.io.NewickFile(tree.getNewick()),
- tree.getTitle(), tree.getWidth(), tree.getHeight(),
- tree.getXpos(), tree.getYpos());
- if (tree.getId() != null)
- {
- // perhaps bind the tree id to something ?
- }
- }
- else
- {
- // update local tree attributes ?
- // TODO: should check if tp has been manipulated by user - if so its
- // settings shouldn't be modified
- tp.setTitle(tree.getTitle());
- tp.setBounds(new Rectangle(tree.getXpos(), tree.getYpos(), tree
- .getWidth(), tree.getHeight()));
- tp.av = av; // af.viewport; // TODO: verify 'associate with all
- // views'
- // works still
- tp.treeCanvas.av = av; // af.viewport;
- tp.treeCanvas.ap = ap; // af.alignPanel;
+ /**
+ * Locate and return an already instantiated matching AppVarna, or create one
+ * if not found
+ *
+ * @param viewer
+ * @param viewIdSuffix
+ * @param ap
+ * @return
+ */
+ protected AppVarna findOrCreateVarnaViewer(RnaViewer viewer,
+ String viewIdSuffix, AlignmentPanel ap)
+ {
+ /*
+ * on each load a suffix is appended to the saved viewId, to avoid conflicts
+ * if load is repeated
+ */
+ String postLoadId = viewer.getViewId() + viewIdSuffix;
+ for (JInternalFrame frame : getAllFrames())
+ {
+ if (frame instanceof AppVarna)
+ {
+ AppVarna varna = (AppVarna) frame;
+ if (postLoadId.equals(varna.getViewId()))
+ {
+ // this viewer is already instantiated
+ // could in future here add ap as another 'parent' of the
+ // AppVarna window; currently just 1-to-many
+ return varna;
+ }
+ }
+ }
- }
- if (tp == null)
- {
- warn("There was a problem recovering stored Newick tree: \n"
- + tree.getNewick());
- continue;
- }
+ /*
+ * viewer not found - make it
+ */
+ RnaViewerModel model = new RnaViewerModel(postLoadId,
+ viewer.getTitle(), viewer.getXpos(), viewer.getYpos(),
+ viewer.getWidth(), viewer.getHeight(),
+ viewer.getDividerLocation());
+ AppVarna varna = new AppVarna(model, ap);
- tp.fitToWindow.setState(tree.getFitToWindow());
- tp.fitToWindow_actionPerformed(null);
+ return varna;
+ }
- if (tree.getFontName() != null)
- {
- tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree
- .getFontStyle(), tree.getFontSize()));
- }
- else
+ /**
+ * Load any saved trees
+ *
+ * @param jms
+ * @param view
+ * @param af
+ * @param av
+ * @param ap
+ */
+ protected void loadTrees(JalviewModelSequence jms, Viewport view,
+ AlignFrame af, AlignViewport av, AlignmentPanel ap)
+ {
+ // TODO result of automated refactoring - are all these parameters needed?
+ try
+ {
+ for (int t = 0; t < jms.getTreeCount(); t++)
+ {
+
+ Tree tree = jms.getTree(t);
+
+ TreePanel tp = (TreePanel) retrieveExistingObj(tree.getId());
+ if (tp == null)
+ {
+ tp = af.ShowNewickTree(
+ new jalview.io.NewickFile(tree.getNewick()),
+ tree.getTitle(), tree.getWidth(), tree.getHeight(),
+ tree.getXpos(), tree.getYpos());
+ if (tree.getId() != null)
{
- tp.setTreeFont(new java.awt.Font(view.getFontName(), view
- .getFontStyle(), tree.getFontSize()));
+ // perhaps bind the tree id to something ?
}
+ }
+ else
+ {
+ // update local tree attributes ?
+ // TODO: should check if tp has been manipulated by user - if so its
+ // settings shouldn't be modified
+ tp.setTitle(tree.getTitle());
+ tp.setBounds(new Rectangle(tree.getXpos(), tree.getYpos(), tree
+ .getWidth(), tree.getHeight()));
+ tp.av = av; // af.viewport; // TODO: verify 'associate with all
+ // views'
+ // works still
+ tp.treeCanvas.av = av; // af.viewport;
+ tp.treeCanvas.ap = ap; // af.alignPanel;
- tp.showPlaceholders(tree.getMarkUnlinked());
- tp.showBootstrap(tree.getShowBootstrap());
- tp.showDistances(tree.getShowDistances());
+ }
+ if (tp == null)
+ {
+ warn("There was a problem recovering stored Newick tree: \n"
+ + tree.getNewick());
+ continue;
+ }
- tp.treeCanvas.threshold = tree.getThreshold();
+ tp.fitToWindow.setState(tree.getFitToWindow());
+ tp.fitToWindow_actionPerformed(null);
- if (tree.getCurrentTree())
- {
- af.viewport.setCurrentTree(tp.getTree());
- }
+ if (tree.getFontName() != null)
+ {
+ tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree
+ .getFontStyle(), tree.getFontSize()));
+ }
+ else
+ {
+ tp.setTreeFont(new java.awt.Font(view.getFontName(), view
+ .getFontStyle(), tree.getFontSize()));
}
- } catch (Exception ex)
- {
- ex.printStackTrace();
+ tp.showPlaceholders(tree.getMarkUnlinked());
+ tp.showBootstrap(tree.getShowBootstrap());
+ tp.showDistances(tree.getShowDistances());
+
+ tp.treeCanvas.threshold = tree.getThreshold();
+
+ if (tree.getCurrentTree())
+ {
+ af.viewport.setCurrentTree(tp.getTree());
+ }
}
- }
- // //LOAD STRUCTURES
- if (loadTreesAndStructures)
+ } catch (Exception ex)
{
- // run through all PDB ids on the alignment, and collect mappings between
- // jmol view ids and all sequences referring to it
- Hashtable<String, Object[]> jmolViewIds = new Hashtable();
+ ex.printStackTrace();
+ }
+ }
- for (int i = 0; i < JSEQ.length; i++)
+ /**
+ * Load and link any saved structure viewers.
+ *
+ * @param jprovider
+ * @param jseqs
+ * @param af
+ * @param ap
+ */
+ protected void loadPDBStructures(jarInputStreamProvider jprovider,
+ JSeq[] jseqs, AlignFrame af, AlignmentPanel ap)
+ {
+ /*
+ * Run through all PDB ids on the alignment, and collect mappings between
+ * distinct view ids and all sequences referring to that view.
+ */
+ Map<String, StructureViewerModel> structureViewers = new LinkedHashMap<String, StructureViewerModel>();
+
+ for (int i = 0; i < jseqs.length; i++)
+ {
+ if (jseqs[i].getPdbidsCount() > 0)
{
- if (JSEQ[i].getPdbidsCount() > 0)
+ Pdbids[] ids = jseqs[i].getPdbids();
+ for (int p = 0; p < ids.length; p++)
{
- Pdbids[] ids = JSEQ[i].getPdbids();
- for (int p = 0; p < ids.length; p++)
+ final int structureStateCount = ids[p].getStructureStateCount();
+ for (int s = 0; s < structureStateCount; s++)
{
- for (int s = 0; s < ids[p].getStructureStateCount(); s++)
+ // check to see if we haven't already created this structure view
+ final StructureState structureState = ids[p]
+ .getStructureState(s);
+ String sviewid = (structureState.getViewId() == null) ? null
+ : structureState.getViewId() + uniqueSetSuffix;
+ jalview.datamodel.PDBEntry jpdb = new jalview.datamodel.PDBEntry();
+ // Originally : ids[p].getFile()
+ // : TODO: verify external PDB file recovery still works in normal
+ // jalview project load
+ jpdb.setFile(loadPDBFile(jprovider, ids[p].getId()));
+ jpdb.setId(ids[p].getId());
+
+ int x = structureState.getXpos();
+ int y = structureState.getYpos();
+ int width = structureState.getWidth();
+ int height = structureState.getHeight();
+
+ // Probably don't need to do this anymore...
+ // Desktop.desktop.getComponentAt(x, y);
+ // TODO: NOW: check that this recovers the PDB file correctly.
+ String pdbFile = loadPDBFile(jprovider, ids[p].getId());
+ jalview.datamodel.SequenceI seq = seqRefIds.get(jseqs[i]
+ .getId() + "");
+ if (sviewid == null)
{
- // check to see if we haven't already created this structure view
- String sviewid = (ids[p].getStructureState(s).getViewId() == null) ? null
- : ids[p].getStructureState(s).getViewId()
- + uniqueSetSuffix;
- jalview.datamodel.PDBEntry jpdb = new jalview.datamodel.PDBEntry();
- // Originally : ids[p].getFile()
- // : TODO: verify external PDB file recovery still works in normal
- // jalview project load
- jpdb.setFile(loadPDBFile(jprovider, ids[p].getId()));
- jpdb.setId(ids[p].getId());
-
- int x = ids[p].getStructureState(s).getXpos();
- int y = ids[p].getStructureState(s).getYpos();
- int width = ids[p].getStructureState(s).getWidth();
- int height = ids[p].getStructureState(s).getHeight();
-
- // Probably don't need to do this anymore...
- // Desktop.desktop.getComponentAt(x, y);
- // TODO: NOW: check that this recovers the PDB file correctly.
- String pdbFile = loadPDBFile(jprovider, ids[p].getId());
- jalview.datamodel.SequenceI seq = (jalview.datamodel.SequenceI) seqRefIds
- .get(JSEQ[i].getId() + "");
- if (sviewid == null)
- {
- sviewid = "_jalview_pre2_4_" + x + "," + y + "," + width
- + "," + height;
- }
- if (!jmolViewIds.containsKey(sviewid))
- {
- jmolViewIds.put(sviewid, new Object[]
- { new int[]
- { x, y, width, height }, "",
- new Hashtable<String, Object[]>(), new boolean[]
- { false, false, true } });
- // Legacy pre-2.7 conversion JAL-823 :
- // do not assume any view has to be linked for colour by
- // sequence
- }
+ sviewid = "_jalview_pre2_4_" + x + "," + y + "," + width
+ + "," + height;
+ }
+ if (!structureViewers.containsKey(sviewid))
+ {
+ structureViewers.put(sviewid,
+ new StructureViewerModel(x, y, width, height, false,
+ false, true, structureState.getViewId(),
+ structureState.getType()));
+ // Legacy pre-2.7 conversion JAL-823 :
+ // do not assume any view has to be linked for colour by
+ // sequence
+ }
- // assemble String[] { pdb files }, String[] { id for each
- // file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, {
- // seqs_file 2}, boolean[] {
- // linkAlignPanel,superposeWithAlignpanel}} from hash
- Object[] jmoldat = (Object[]) jmolViewIds.get(sviewid);
- ((boolean[]) jmoldat[3])[0] |= ids[p].getStructureState(s)
- .hasAlignwithAlignPanel() ? ids[p].getStructureState(
- s).getAlignwithAlignPanel() : false;
- // never colour by linked panel if not specified
- ((boolean[]) jmoldat[3])[1] |= ids[p].getStructureState(s)
- .hasColourwithAlignPanel() ? ids[p]
- .getStructureState(s).getColourwithAlignPanel()
- : false;
- // default for pre-2.7 projects is that Jmol colouring is enabled
- ((boolean[]) jmoldat[3])[2] &= ids[p].getStructureState(s)
- .hasColourByJmol() ? ids[p].getStructureState(s)
- .getColourByJmol() : true;
-
- if (((String) jmoldat[1]).length() < ids[p]
- .getStructureState(s).getContent().length())
+ // assemble String[] { pdb files }, String[] { id for each
+ // file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, {
+ // seqs_file 2}, boolean[] {
+ // linkAlignPanel,superposeWithAlignpanel}} from hash
+ StructureViewerModel jmoldat = structureViewers.get(sviewid);
+ jmoldat.setAlignWithPanel(jmoldat.isAlignWithPanel()
+ | (structureState.hasAlignwithAlignPanel() ? structureState
+ .getAlignwithAlignPanel() : false));
+
+ /*
+ * Default colour by linked panel to false if not specified (e.g.
+ * for pre-2.7 projects)
+ */
+ boolean colourWithAlignPanel = jmoldat.isColourWithAlignPanel();
+ colourWithAlignPanel |= (structureState
+ .hasColourwithAlignPanel() ? structureState
+ .getColourwithAlignPanel() : false);
+ jmoldat.setColourWithAlignPanel(colourWithAlignPanel);
+
+ /*
+ * Default colour by viewer to true if not specified (e.g. for
+ * pre-2.7 projects)
+ */
+ boolean colourByViewer = jmoldat.isColourByViewer();
+ colourByViewer &= structureState.hasColourByJmol() ? structureState
+ .getColourByJmol() : true;
+ jmoldat.setColourByViewer(colourByViewer);
+
+ if (jmoldat.getStateData().length() < structureState
+ .getContent().length())
+ {
{
- {
- jmoldat[1] = ids[p].getStructureState(s).getContent();
- }
+ jmoldat.setStateData(structureState.getContent());
}
- if (ids[p].getFile() != null)
+ }
+ if (ids[p].getFile() != null)
+ {
+ File mapkey = new File(ids[p].getFile());
+ StructureData seqstrmaps = jmoldat.getFileData().get(mapkey);
+ if (seqstrmaps == null)
{
- Object[] seqstrmaps = (Object[]) ((Hashtable) jmoldat[2])
- .get(ids[p].getFile());
- if (seqstrmaps == null)
- {
- ((Hashtable) jmoldat[2]).put(
- new File(ids[p].getFile()).toString(),
- seqstrmaps = new Object[]
- { pdbFile, ids[p].getId(), new Vector(),
- new Vector() });
- }
- if (!((Vector) seqstrmaps[2]).contains(seq))
- {
- ((Vector) seqstrmaps[2]).addElement(seq);
- // ((Vector)seqstrmaps[3]).addElement(n) :
- // in principle, chains
- // should be stored here : do we need to
- // TODO: store and recover seq/pdb_id :
- // chain mappings
- }
+ jmoldat.getFileData().put(
+ mapkey,
+ seqstrmaps = jmoldat.new StructureData(pdbFile,
+ ids[p].getId()));
}
- else
+ if (!seqstrmaps.getSeqList().contains(seq))
{
- errorMessage = ("The Jmol views in this project were imported\nfrom an older version of Jalview.\nPlease review the sequence colour associations\nin the Colour by section of the Jmol View menu.\n\nIn the case of problems, see note at\nhttp://issues.jalview.org/browse/JAL-747");
- warn(errorMessage);
+ seqstrmaps.getSeqList().add(seq);
+ // TODO and chains?
}
}
+ else
+ {
+ errorMessage = ("The Jmol views in this project were imported\nfrom an older version of Jalview.\nPlease review the sequence colour associations\nin the Colour by section of the Jmol View menu.\n\nIn the case of problems, see note at\nhttp://issues.jalview.org/browse/JAL-747");
+ warn(errorMessage);
+ }
}
}
}
+ }
+ // Instantiate the associated structure views
+ for (Entry<String, StructureViewerModel> entry : structureViewers
+ .entrySet())
+ {
+ try
{
+ createOrLinkStructureViewer(entry, af, ap, jprovider);
+ } catch (Exception e)
+ {
+ System.err.println("Error loading structure viewer: "
+ + e.getMessage());
+ // failed - try the next one
+ }
+ }
+ }
- // Instantiate the associated Jmol views
- for (Entry<String, Object[]> entry : jmolViewIds.entrySet())
- {
- String sviewid = entry.getKey();
- Object[] svattrib = entry.getValue();
- int[] geom = (int[]) svattrib[0];
- String state = (String) svattrib[1];
- Hashtable<String, Object[]> oldFiles = (Hashtable<String, Object[]>) svattrib[2];
- final boolean useinJmolsuperpos = ((boolean[]) svattrib[3])[0], usetoColourbyseq = ((boolean[]) svattrib[3])[1], jmolColouring = ((boolean[]) svattrib[3])[2];
- int x = geom[0], y = geom[1], width = geom[2], height = geom[3];
- // collate the pdbfile -> sequence mappings from this view
- Vector<String> pdbfilenames = new Vector<String>();
- Vector<SequenceI[]> seqmaps = new Vector<SequenceI[]>();
- Vector<String> pdbids = new Vector<String>();
+ /**
+ *
+ * @param viewerData
+ * @param af
+ * @param ap
+ * @param jprovider
+ */
+ protected void createOrLinkStructureViewer(
+ Entry<String, StructureViewerModel> viewerData, AlignFrame af,
+ AlignmentPanel ap, jarInputStreamProvider jprovider)
+ {
+ final StructureViewerModel stateData = viewerData.getValue();
+
+ /*
+ * Search for any viewer windows already open from other alignment views
+ * that exactly match the stored structure state
+ */
+ StructureViewerBase comp = findMatchingViewer(viewerData);
+
+ if (comp != null)
+ {
+ linkStructureViewer(ap, comp, stateData);
+ return;
+ }
+
+ /*
+ * From 2.9: stateData.type contains JMOL or CHIMERA, data is in jar entry
+ * "viewer_"+stateData.viewId
+ */
+ if (ViewerType.CHIMERA.toString().equals(stateData.getType()))
+ {
+ createChimeraViewer(viewerData, af, jprovider);
+ }
+ else
+ {
+ /*
+ * else Jmol (if pre-2.9, stateData contains JMOL state string)
+ */
+ createJmolViewer(viewerData, af, jprovider);
+ }
+ }
+
+ /**
+ * Create a new Chimera viewer.
+ *
+ * @param data
+ * @param af
+ * @param jprovider
+ */
+ protected void createChimeraViewer(
+ Entry<String, StructureViewerModel> viewerData, AlignFrame af,
+ jarInputStreamProvider jprovider)
+ {
+ StructureViewerModel data = viewerData.getValue();
+ String chimeraSessionFile = data.getStateData();
+
+ /*
+ * Copy Chimera session from jar entry "viewer_"+viewId to a temporary file
+ *
+ * NB this is the 'saved' viewId as in the project file XML, _not_ the
+ * 'uniquified' sviewid used to reconstruct the viewer here
+ */
+ String viewerJarEntryName = getViewerJarEntryName(data.getViewId());
+ chimeraSessionFile = copyJarEntry(jprovider, viewerJarEntryName,
+ "chimera");
+
+ Set<Entry<File, StructureData>> fileData = data.getFileData()
+ .entrySet();
+ List<PDBEntry> pdbs = new ArrayList<PDBEntry>();
+ List<SequenceI[]> allseqs = new ArrayList<SequenceI[]>();
+ for (Entry<File, StructureData> pdb : fileData)
+ {
+ String filePath = pdb.getValue().getFilePath();
+ String pdbId = pdb.getValue().getPdbId();
+ // pdbs.add(new PDBEntry(filePath, pdbId));
+ pdbs.add(new PDBEntry(pdbId, null, PDBEntry.Type.PDB, filePath));
+ final List<SequenceI> seqList = pdb.getValue().getSeqList();
+ SequenceI[] seqs = seqList.toArray(new SequenceI[seqList.size()]);
+ allseqs.add(seqs);
+ }
+
+ boolean colourByChimera = data.isColourByViewer();
+ boolean colourBySequence = data.isColourWithAlignPanel();
+
+ // TODO use StructureViewer as a factory here, see JAL-1761
+ final PDBEntry[] pdbArray = pdbs.toArray(new PDBEntry[pdbs.size()]);
+ final SequenceI[][] seqsArray = allseqs.toArray(new SequenceI[allseqs
+ .size()][]);
+ String newViewId = viewerData.getKey();
+
+ ChimeraViewFrame cvf = new ChimeraViewFrame(chimeraSessionFile,
+ af.alignPanel, pdbArray, seqsArray, colourByChimera,
+ colourBySequence, newViewId);
+ cvf.setSize(data.getWidth(), data.getHeight());
+ cvf.setLocation(data.getX(), data.getY());
+ }
+
+ /**
+ * Create a new Jmol window. First parse the Jmol state to translate filenames
+ * loaded into the view, and record the order in which files are shown in the
+ * Jmol view, so we can add the sequence mappings in same order.
+ *
+ * @param viewerData
+ * @param af
+ * @param jprovider
+ */
+ protected void createJmolViewer(
+ final Entry<String, StructureViewerModel> viewerData,
+ AlignFrame af, jarInputStreamProvider jprovider)
+ {
+ final StructureViewerModel svattrib = viewerData.getValue();
+ String state = svattrib.getStateData();
+
+ /*
+ * Pre-2.9: state element value is the Jmol state string
+ *
+ * 2.9+: @type is "JMOL", state data is in a Jar file member named "viewer_"
+ * + viewId
+ */
+ if (ViewerType.JMOL.toString().equals(svattrib.getType()))
+ {
+ state = readJarEntry(jprovider,
+ getViewerJarEntryName(svattrib.getViewId()));
+ }
+
+ List<String> pdbfilenames = new ArrayList<String>();
+ List<SequenceI[]> seqmaps = new ArrayList<SequenceI[]>();
+ List<String> pdbids = new ArrayList<String>();
+ StringBuilder newFileLoc = new StringBuilder(64);
+ int cp = 0, ncp, ecp;
+ Map<File, StructureData> oldFiles = svattrib.getFileData();
+ while ((ncp = state.indexOf("load ", cp)) > -1)
+ {
+ do
+ {
+ // look for next filename in load statement
+ newFileLoc.append(state.substring(cp,
+ ncp = (state.indexOf("\"", ncp + 1) + 1)));
+ String oldfilenam = state.substring(ncp,
+ ecp = state.indexOf("\"", ncp));
+ // recover the new mapping data for this old filename
+ // have to normalize filename - since Jmol and jalview do
+ // filename
+ // translation differently.
+ StructureData filedat = oldFiles.get(new File(oldfilenam));
+ newFileLoc.append(Platform.escapeString(filedat.getFilePath()));
+ pdbfilenames.add(filedat.getFilePath());
+ pdbids.add(filedat.getPdbId());
+ seqmaps.add(filedat.getSeqList().toArray(new SequenceI[0]));
+ newFileLoc.append("\"");
+ cp = ecp + 1; // advance beyond last \" and set cursor so we can
+ // look for next file statement.
+ } while ((ncp = state.indexOf("/*file*/", cp)) > -1);
+ }
+ if (cp > 0)
+ {
+ // just append rest of state
+ newFileLoc.append(state.substring(cp));
+ }
+ else
+ {
+ System.err.print("Ignoring incomplete Jmol state for PDB ids: ");
+ newFileLoc = new StringBuilder(state);
+ newFileLoc.append("; load append ");
+ for (File id : oldFiles.keySet())
+ {
+ // add this and any other pdb files that should be present in
+ // the viewer
+ StructureData filedat = oldFiles.get(id);
+ newFileLoc.append(filedat.getFilePath());
+ pdbfilenames.add(filedat.getFilePath());
+ pdbids.add(filedat.getPdbId());
+ seqmaps.add(filedat.getSeqList().toArray(new SequenceI[0]));
+ newFileLoc.append(" \"");
+ newFileLoc.append(filedat.getFilePath());
+ newFileLoc.append("\"");
+
+ }
+ newFileLoc.append(";");
+ }
- // Search to see if we've already created this Jmol view
- AppJmol comp = null;
- JInternalFrame[] frames = null;
- do
+ if (newFileLoc.length() == 0)
+ {
+ return;
+ }
+ int histbug = newFileLoc.indexOf("history = ");
+ if (histbug > -1)
+ {
+ /*
+ * change "history = [true|false];" to "history = [1|0];"
+ */
+ histbug += 10;
+ int diff = histbug == -1 ? -1 : newFileLoc.indexOf(";", histbug);
+ String val = (diff == -1) ? null : newFileLoc
+ .substring(histbug, diff);
+ if (val != null && val.length() >= 4)
+ {
+ if (val.contains("e")) // eh? what can it be?
+ {
+ if (val.trim().equals("true"))
{
- try
- {
- frames = Desktop.desktop.getAllFrames();
- } catch (ArrayIndexOutOfBoundsException e)
- {
- // occasional No such child exceptions are thrown here...
- frames = null;
- try
- {
- Thread.sleep(10);
- } catch (Exception f)
- {
- }
- ;
- }
- } while (frames == null);
- // search for any Jmol windows already open from other
- // alignment views that exactly match the stored structure state
- for (int f = 0; comp == null && f < frames.length; f++)
+ val = "1";
+ }
+ else
{
- if (frames[f] instanceof AppJmol)
- {
- if (sviewid != null
- && ((AppJmol) frames[f]).getViewId().equals(sviewid))
- {
- // post jalview 2.4 schema includes structure view id
- comp = (AppJmol) frames[f];
- }
- else if (frames[f].getX() == x && frames[f].getY() == y
- && frames[f].getHeight() == height
- && frames[f].getWidth() == width)
- {
- comp = (AppJmol) frames[f];
- }
- }
+ val = "0";
}
+ newFileLoc.replace(histbug, diff, val);
+ }
+ }
+ }
- if (comp == null)
+ final String[] pdbf = pdbfilenames.toArray(new String[pdbfilenames
+ .size()]);
+ final String[] id = pdbids.toArray(new String[pdbids.size()]);
+ final SequenceI[][] sq = seqmaps
+ .toArray(new SequenceI[seqmaps.size()][]);
+ final String fileloc = newFileLoc.toString();
+ final String sviewid = viewerData.getKey();
+ final AlignFrame alf = af;
+ final Rectangle rect = new Rectangle(svattrib.getX(), svattrib.getY(),
+ svattrib.getWidth(), svattrib.getHeight());
+ try
+ {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ JalviewStructureDisplayI sview = null;
+ try
{
- // create a new Jmol window.
- // First parse the Jmol state to translate filenames loaded into the
- // view, and record the order in which files are shown in the Jmol
- // view, so we can add the sequence mappings in same order.
- StringBuffer newFileLoc = null;
- int cp = 0, ncp, ecp;
- while ((ncp = state.indexOf("load ", cp)) > -1)
- {
- if (newFileLoc == null)
- {
- newFileLoc = new StringBuffer();
- }
- newFileLoc.append(state.substring(cp,
- ncp = (state.indexOf("\"", ncp + 1) + 1)));
- String oldfilenam = state.substring(ncp,
- ecp = state.indexOf("\"", ncp));
- // recover the new mapping data for this old filename
- // have to normalize filename - since Jmol and jalview do filename
- // translation differently.
- Object[] filedat = oldFiles.get(new File(oldfilenam)
- .toString());
- newFileLoc.append(((String) filedat[0]));
- pdbfilenames.addElement((String) filedat[0]);
- pdbids.addElement((String) filedat[1]);
- seqmaps.addElement((SequenceI[]) ((Vector<SequenceI>) filedat[2])
- .toArray(new SequenceI[0]));
- newFileLoc.append("\"");
- cp = ecp + 1; // advance beyond last \" and set cursor so we can
- // look for next file statement.
- }
- if (cp > 0)
+ sview = new StructureViewer(alf.alignPanel
+ .getStructureSelectionManager()).createView(
+ StructureViewer.ViewerType.JMOL, pdbf, id, sq,
+ alf.alignPanel, svattrib, fileloc, rect, sviewid);
+ addNewStructureViewer(sview);
+ } catch (OutOfMemoryError ex)
+ {
+ new OOMWarning("restoring structure view for PDB id " + id,
+ (OutOfMemoryError) ex.getCause());
+ if (sview != null && sview.isVisible())
{
- // just append rest of state
- newFileLoc.append(state.substring(cp));
+ sview.closeViewer(false);
+ sview.setVisible(false);
+ sview.dispose();
}
- else
- {
- System.err
- .print("Ignoring incomplete Jmol state for PDB ids: ");
- newFileLoc = new StringBuffer(state);
- newFileLoc.append("; load append ");
- for (String id : oldFiles.keySet())
- {
- // add this and any other pdb files that should be present in
- // the viewer
- Object[] filedat = oldFiles.get(id);
- String nfilename;
- newFileLoc.append(((String) filedat[0]));
- pdbfilenames.addElement((String) filedat[0]);
- pdbids.addElement((String) filedat[1]);
- seqmaps.addElement((SequenceI[]) ((Vector<SequenceI>) filedat[2])
- .toArray(new SequenceI[0]));
- newFileLoc.append(" \"");
- newFileLoc.append((String) filedat[0]);
- newFileLoc.append("\"");
+ }
+ }
+ });
+ } catch (InvocationTargetException ex)
+ {
+ warn("Unexpected error when opening Jmol view.", ex);
- }
- newFileLoc.append(";");
- }
+ } catch (InterruptedException e)
+ {
+ // e.printStackTrace();
+ }
- if (newFileLoc != null)
- {
- int histbug = newFileLoc.indexOf("history = ");
- histbug += 10;
- int diff = histbug == -1 ? -1 : newFileLoc.indexOf(";",
- histbug);
- String val = (diff == -1) ? null : newFileLoc.substring(
- histbug, diff);
- if (val != null && val.length() >= 4)
- {
- if (val.contains("e"))
- {
- if (val.trim().equals("true"))
- {
- val = "1";
- }
- else
- {
- val = "0";
- }
- newFileLoc.replace(histbug, diff, val);
- }
- }
- // TODO: assemble String[] { pdb files }, String[] { id for each
- // file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, {
- // seqs_file 2}} from hash
- final String[] pdbf = (String[]) pdbfilenames
- .toArray(new String[pdbfilenames.size()]), id = (String[]) pdbids
- .toArray(new String[pdbids.size()]);
- final SequenceI[][] sq = (SequenceI[][]) seqmaps
- .toArray(new SequenceI[seqmaps.size()][]);
- final String fileloc = newFileLoc.toString(), vid = sviewid;
- final AlignFrame alf = af;
- final java.awt.Rectangle rect = new java.awt.Rectangle(x, y,
- width, height);
- try
- {
- javax.swing.SwingUtilities.invokeAndWait(new Runnable()
- {
- public void run()
- {
- AppJmol sview = null;
- try
- {
- sview = new AppJmol(pdbf, id, sq, alf.alignPanel,
- useinJmolsuperpos, usetoColourbyseq,
- jmolColouring, fileloc, rect, vid);
- } catch (OutOfMemoryError ex)
- {
- new OOMWarning("restoring structure view for PDB id "
- + id, (OutOfMemoryError) ex.getCause());
- if (sview != null && sview.isVisible())
- {
- sview.closeViewer();
- sview.setVisible(false);
- sview.dispose();
- }
- }
- }
- });
- } catch (InvocationTargetException ex)
- {
- warn("Unexpected error when opening Jmol view.", ex);
+ }
+
+ /**
+ * Generates a name for the entry in the project jar file to hold state
+ * information for a structure viewer
+ *
+ * @param viewId
+ * @return
+ */
+ protected String getViewerJarEntryName(String viewId)
+ {
+ return VIEWER_PREFIX + viewId;
+ }
+
+ /**
+ * Returns any open frame that matches given structure viewer data. The match
+ * is based on the unique viewId, or (for older project versions) the frame's
+ * geometry.
+ *
+ * @param viewerData
+ * @return
+ */
+ protected StructureViewerBase findMatchingViewer(
+ Entry<String, StructureViewerModel> viewerData)
+ {
+ final String sviewid = viewerData.getKey();
+ final StructureViewerModel svattrib = viewerData.getValue();
+ StructureViewerBase comp = null;
+ JInternalFrame[] frames = getAllFrames();
+ for (JInternalFrame frame : frames)
+ {
+ if (frame instanceof StructureViewerBase)
+ {
+ /*
+ * Post jalview 2.4 schema includes structure view id
+ */
+ if (sviewid != null
+ && ((StructureViewerBase) frame).getViewId()
+ .equals(sviewid))
+ {
+ comp = (StructureViewerBase) frame;
+ break; // break added in 2.9
+ }
+ /*
+ * Otherwise test for matching position and size of viewer frame
+ */
+ else if (frame.getX() == svattrib.getX()
+ && frame.getY() == svattrib.getY()
+ && frame.getHeight() == svattrib.getHeight()
+ && frame.getWidth() == svattrib.getWidth())
+ {
+ comp = (StructureViewerBase) frame;
+ // no break in faint hope of an exact match on viewId
+ }
+ }
+ }
+ return comp;
+ }
+
+ /**
+ * Link an AlignmentPanel to an existing structure viewer.
+ *
+ * @param ap
+ * @param viewer
+ * @param oldFiles
+ * @param useinViewerSuperpos
+ * @param usetoColourbyseq
+ * @param viewerColouring
+ */
+ protected void linkStructureViewer(AlignmentPanel ap,
+ StructureViewerBase viewer, StructureViewerModel stateData)
+ {
+ // NOTE: if the jalview project is part of a shared session then
+ // view synchronization should/could be done here.
+
+ final boolean useinViewerSuperpos = stateData.isAlignWithPanel();
+ final boolean usetoColourbyseq = stateData.isColourWithAlignPanel();
+ final boolean viewerColouring = stateData.isColourByViewer();
+ Map<File, StructureData> oldFiles = stateData.getFileData();
+
+ /*
+ * Add mapping for sequences in this view to an already open viewer
+ */
+ final AAStructureBindingModel binding = viewer.getBinding();
+ for (File id : oldFiles.keySet())
+ {
+ // add this and any other pdb files that should be present in the
+ // viewer
+ StructureData filedat = oldFiles.get(id);
+ String pdbFile = filedat.getFilePath();
+ SequenceI[] seq = filedat.getSeqList().toArray(new SequenceI[0]);
+ binding.getSsm().setMapping(seq, null, pdbFile,
+ jalview.io.AppletFormatAdapter.FILE);
+ binding.addSequenceForStructFile(pdbFile, seq);
+ }
+ // and add the AlignmentPanel's reference to the view panel
+ viewer.addAlignmentPanel(ap);
+ if (useinViewerSuperpos)
+ {
+ viewer.useAlignmentPanelForSuperposition(ap);
+ }
+ else
+ {
+ viewer.excludeAlignmentPanelForSuperposition(ap);
+ }
+ if (usetoColourbyseq)
+ {
+ viewer.useAlignmentPanelForColourbyseq(ap, !viewerColouring);
+ }
+ else
+ {
+ viewer.excludeAlignmentPanelForColourbyseq(ap);
+ }
+ }
- } catch (InterruptedException e)
- {
- // e.printStackTrace();
- }
- }
+ /**
+ * Get all frames within the Desktop.
+ *
+ * @return
+ */
+ protected JInternalFrame[] getAllFrames()
+ {
+ JInternalFrame[] frames = null;
+ // TODO is this necessary - is it safe - risk of hanging?
+ do
+ {
+ try
+ {
+ frames = Desktop.desktop.getAllFrames();
+ } catch (ArrayIndexOutOfBoundsException e)
+ {
+ // occasional No such child exceptions are thrown here...
+ try
+ {
+ Thread.sleep(10);
+ } catch (InterruptedException f)
+ {
+ }
+ }
+ } while (frames == null);
+ return frames;
+ }
- }
- else
- // if (comp != null)
+ /**
+ *
+ * @param supported
+ * - minimum version we are comparing against
+ * @param version
+ * - version of data being processsed.
+ * @return true if version is development/null or evaluates to the same or
+ * later X.Y.Z (where X,Y,Z are like [0-9]+b?[0-9]*)
+ */
+ protected boolean isVersionStringLaterThan(String supported,
+ String version)
+ {
+ if (version == null || version.equalsIgnoreCase("DEVELOPMENT BUILD")
+ || version.equalsIgnoreCase("Test")
+ || version.equalsIgnoreCase("AUTOMATED BUILD"))
+ {
+ System.err.println("Assuming project file with "
+ + (version == null ? "null" : version)
+ + " is compatible with Jalview version " + supported);
+ return true;
+ }
+ else
+ {
+ StringTokenizer currentV = new StringTokenizer(supported, "."), fileV = new StringTokenizer(
+ version, ".");
+ while (currentV.hasMoreTokens() && fileV.hasMoreTokens())
+ {
+ // convert b to decimal to catch bugfix releases within a series
+ String curT = currentV.nextToken().toLowerCase().replace('b', '.');
+ String fileT = fileV.nextToken().toLowerCase().replace('b', '.');
+ try
+ {
+ if (Float.valueOf(curT) > Float.valueOf(fileT))
{
- // NOTE: if the jalview project is part of a shared session then
- // view synchronization should/could be done here.
-
- // add mapping for sequences in this view to an already open Jmol
- // instance
- for (String id : oldFiles.keySet())
- {
- // add this and any other pdb files that should be present in the
- // viewer
- Object[] filedat = oldFiles.get(id);
- String pdbFile = (String) filedat[0];
- SequenceI[] seq = (SequenceI[]) ((Vector<SequenceI>) filedat[2])
- .toArray(new SequenceI[0]);
- ((AppJmol) comp).jmb.ssm.setMapping(seq, null, pdbFile,
- jalview.io.AppletFormatAdapter.FILE);
- ((AppJmol) comp).jmb.addSequenceForStructFile(pdbFile, seq);
- }
- // and add the AlignmentPanel's reference to the Jmol view
- ((AppJmol) comp).addAlignmentPanel(ap);
- if (useinJmolsuperpos)
- {
- ((AppJmol) comp).useAlignmentPanelForSuperposition(ap);
- }
- else
- {
- ((AppJmol) comp).excludeAlignmentPanelForSuperposition(ap);
- }
- if (usetoColourbyseq)
- {
- ((AppJmol) comp).useAlignmentPanelForColourbyseq(ap,
- !jmolColouring);
- }
- else
- {
- ((AppJmol) comp).excludeAlignmentPanelForColourbyseq(ap);
- }
+ // current version is newer than the version that wrote the file
+ return false;
}
+ } catch (NumberFormatException nfe)
+ {
+ System.err
+ .println("** WARNING: Version comparison failed for tokens ("
+ + curT
+ + ") and ("
+ + fileT
+ + ")\n** Current: '"
+ + supported + "' and Version: '" + version + "'");
}
}
+ if (currentV.hasMoreElements())
+ {
+ // fileV has no minor version but identical series to current
+ return false;
+ }
+ }
+ return true;
+ }
+
+ Vector<JalviewStructureDisplayI> newStructureViewers = null;
+
+ protected void addNewStructureViewer(JalviewStructureDisplayI sview)
+ {
+ if (newStructureViewers != null)
+ {
+ sview.getBinding().setFinishedLoadingFromArchive(false);
+ newStructureViewers.add(sview);
+ }
+ }
+
+ protected void setLoadingFinishedForNewStructureViewers()
+ {
+ if (newStructureViewers != null)
+ {
+ for (JalviewStructureDisplayI sview : newStructureViewers)
+ {
+ sview.getBinding().setFinishedLoadingFromArchive(true);
+ }
+ newStructureViewers.clear();
+ newStructureViewers = null;
}
- // and finally return.
- return af;
}
- AlignFrame loadViewport(String file, JSeq[] JSEQ, Vector hiddenSeqs,
- Alignment al, JalviewModelSequence jms, Viewport view,
- String uniqueSeqSetId, String viewId,
- ArrayList<JvAnnotRow> autoAlan)
+ AlignFrame loadViewport(String file, JSeq[] JSEQ,
+ List<SequenceI> hiddenSeqs, Alignment al,
+ JalviewModelSequence jms, Viewport view, String uniqueSeqSetId,
+ String viewId, List<JvAnnotRow> autoAlan)
{
AlignFrame af = null;
af = new AlignFrame(al, view.getWidth(), view.getHeight(),
@@ -2907,23 +4122,22 @@ public class Jalview2XML
for (int i = 0; i < JSEQ.length; i++)
{
- af.viewport.setSequenceColour(af.viewport.alignment.getSequenceAt(i),
- new java.awt.Color(JSEQ[i].getColour()));
+ af.viewport.setSequenceColour(af.viewport.getAlignment()
+ .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour()));
}
- af.viewport.gatherViewsHere = view.getGatheredViews();
+ af.viewport.setGatherViewsHere(view.getGatheredViews());
if (view.getSequenceSetId() != null)
{
- jalview.gui.AlignViewport av = (jalview.gui.AlignViewport) viewportsAdded
- .get(uniqueSeqSetId);
+ AlignmentViewport av = viewportsAdded.get(uniqueSeqSetId);
- af.viewport.sequenceSetID = uniqueSeqSetId;
+ af.viewport.setSequenceSetId(uniqueSeqSetId);
if (av != null)
{
// propagate shared settings to this new view
- af.viewport.historyList = av.historyList;
- af.viewport.redoList = av.redoList;
+ af.viewport.setHistoryList(av.getHistoryList());
+ af.viewport.setRedoList(av.getRedoList());
}
else
{
@@ -2948,14 +4162,17 @@ public class Jalview2XML
af.viewport.hideRepSequences(al.getSequenceAt(s), hidden);
}
- jalview.datamodel.SequenceI[] hseqs = new jalview.datamodel.SequenceI[hiddenSeqs
- .size()];
-
- for (int s = 0; s < hiddenSeqs.size(); s++)
- {
- hseqs[s] = (jalview.datamodel.SequenceI) hiddenSeqs.elementAt(s);
- }
-
+ // jalview.datamodel.SequenceI[] hseqs = new
+ // jalview.datamodel.SequenceI[hiddenSeqs
+ // .size()];
+ //
+ // for (int s = 0; s < hiddenSeqs.size(); s++)
+ // {
+ // hseqs[s] = (jalview.datamodel.SequenceI) hiddenSeqs.elementAt(s);
+ // }
+
+ SequenceI[] hseqs = hiddenSeqs.toArray(new SequenceI[hiddenSeqs
+ .size()]);
af.viewport.hideSequence(hseqs);
}
@@ -2975,125 +4192,46 @@ public class Jalview2XML
af.viewport.setConservationSelected(view.getConservationSelected());
af.viewport.setShowJVSuffix(view.getShowFullId());
- af.viewport.rightAlignIds = view.getRightAlignIds();
- af.viewport.setFont(new java.awt.Font(view.getFontName(), view
- .getFontStyle(), view.getFontSize()));
- af.alignPanel.fontChanged();
+ af.viewport.setRightAlignIds(view.getRightAlignIds());
+ af.viewport.setFont(
+ new java.awt.Font(view.getFontName(), view.getFontStyle(), view
+ .getFontSize()), true);
+ ViewStyleI vs = af.viewport.getViewStyle();
+ vs.setScaleProteinAsCdna(view.isScaleProteinAsCdna());
+ af.viewport.setViewStyle(vs);
+ // TODO: allow custom charWidth/Heights to be restored by updating them
+ // after setting font - which means set above to false
af.viewport.setRenderGaps(view.getRenderGaps());
af.viewport.setWrapAlignment(view.getWrapAlignment());
- af.alignPanel.setWrapAlignment(view.getWrapAlignment());
af.viewport.setShowAnnotation(view.getShowAnnotation());
- af.alignPanel.setAnnotationVisible(view.getShowAnnotation());
af.viewport.setShowBoxes(view.getShowBoxes());
af.viewport.setShowText(view.getShowText());
- af.viewport.textColour = new java.awt.Color(view.getTextCol1());
- af.viewport.textColour2 = new java.awt.Color(view.getTextCol2());
- af.viewport.thresholdTextColour = view.getTextColThreshold();
+ af.viewport.setTextColour(new java.awt.Color(view.getTextCol1()));
+ af.viewport.setTextColour2(new java.awt.Color(view.getTextCol2()));
+ af.viewport.setThresholdTextColour(view.getTextColThreshold());
af.viewport.setShowUnconserved(view.hasShowUnconserved() ? view
.isShowUnconserved() : false);
af.viewport.setStartRes(view.getStartRes());
af.viewport.setStartSeq(view.getStartSeq());
-
+ af.alignPanel.updateLayout();
ColourSchemeI cs = null;
// apply colourschemes
if (view.getBgColour() != null)
{
if (view.getBgColour().startsWith("ucs"))
{
- cs = GetUserColourScheme(jms, view.getBgColour());
+ cs = getUserColourScheme(jms, view.getBgColour());
}
else if (view.getBgColour().startsWith("Annotation"))
{
- // int find annotation
- if (af.viewport.alignment.getAlignmentAnnotation() != null)
- {
- for (int i = 0; i < af.viewport.alignment
- .getAlignmentAnnotation().length; i++)
- {
- if (af.viewport.alignment.getAlignmentAnnotation()[i].label
- .equals(view.getAnnotationColours().getAnnotation()))
- {
- if (af.viewport.alignment.getAlignmentAnnotation()[i]
- .getThreshold() == null)
- {
- af.viewport.alignment.getAlignmentAnnotation()[i]
- .setThreshold(new jalview.datamodel.GraphLine(view
- .getAnnotationColours().getThreshold(),
- "Threshold", java.awt.Color.black)
-
- );
- }
-
- if (view.getAnnotationColours().getColourScheme()
- .equals("None"))
- {
- cs = new AnnotationColourGradient(
- af.viewport.alignment.getAlignmentAnnotation()[i],
- new java.awt.Color(view.getAnnotationColours()
- .getMinColour()), new java.awt.Color(view
- .getAnnotationColours().getMaxColour()),
- view.getAnnotationColours().getAboveThreshold());
- }
- else if (view.getAnnotationColours().getColourScheme()
- .startsWith("ucs"))
- {
- cs = new AnnotationColourGradient(
- af.viewport.alignment.getAlignmentAnnotation()[i],
- GetUserColourScheme(jms, view
- .getAnnotationColours().getColourScheme()),
- view.getAnnotationColours().getAboveThreshold());
- }
- else
- {
- cs = new AnnotationColourGradient(
- af.viewport.alignment.getAlignmentAnnotation()[i],
- ColourSchemeProperty.getColour(al, view
- .getAnnotationColours().getColourScheme()),
- view.getAnnotationColours().getAboveThreshold());
- }
-
- // Also use these settings for all the groups
- if (al.getGroups() != null)
- {
- for (int g = 0; g < al.getGroups().size(); g++)
- {
- jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup) al
- .getGroups().elementAt(g);
-
- if (sg.cs == null)
- {
- continue;
- }
-
- /*
- * if
- * (view.getAnnotationColours().getColourScheme().equals("None"
- * )) { sg.cs = new AnnotationColourGradient(
- * af.viewport.alignment.getAlignmentAnnotation()[i], new
- * java.awt.Color(view.getAnnotationColours().
- * getMinColour()), new
- * java.awt.Color(view.getAnnotationColours().
- * getMaxColour()),
- * view.getAnnotationColours().getAboveThreshold()); } else
- */
- {
- sg.cs = new AnnotationColourGradient(
- af.viewport.alignment.getAlignmentAnnotation()[i],
- sg.cs, view.getAnnotationColours()
- .getAboveThreshold());
- }
-
- }
- }
+ AnnotationColours viewAnnColour = view.getAnnotationColours();
+ cs = constructAnnotationColour(viewAnnColour, af, al, jms, true);
- break;
- }
+ // annpos
- }
- }
}
else
{
@@ -3103,7 +4241,7 @@ public class Jalview2XML
if (cs != null)
{
cs.setThreshold(view.getPidThreshold(), true);
- cs.setConsensus(af.viewport.hconsensus);
+ cs.setConsensus(af.viewport.getSequenceConsensusHash());
}
}
@@ -3119,22 +4257,20 @@ public class Jalview2XML
af.viewport.setColourAppliesToAllGroups(true);
- if (view.getShowSequenceFeatures())
- {
- af.viewport.showSequenceFeatures = true;
- }
+ af.viewport.setShowSequenceFeatures(view.getShowSequenceFeatures());
+
if (view.hasCentreColumnLabels())
{
af.viewport.setCentreColumnLabels(view.getCentreColumnLabels());
}
if (view.hasIgnoreGapsinConsensus())
{
- af.viewport.ignoreGapsInConsensusCalculation = view
- .getIgnoreGapsinConsensus();
+ af.viewport.setIgnoreGapsConsensus(view.getIgnoreGapsinConsensus(),
+ null);
}
if (view.hasFollowHighlight())
{
- af.viewport.followHighlight = view.getFollowHighlight();
+ af.viewport.setFollowHighlight(view.getFollowHighlight());
}
if (view.hasFollowSelection())
{
@@ -3151,19 +4287,23 @@ public class Jalview2XML
}
if (view.hasShowSequenceLogo())
{
- af.viewport.showSequenceLogo = view.getShowSequenceLogo();
+ af.viewport.setShowSequenceLogo(view.getShowSequenceLogo());
}
else
{
- af.viewport.showSequenceLogo = false;
+ af.viewport.setShowSequenceLogo(false);
+ }
+ if (view.hasNormaliseSequenceLogo())
+ {
+ af.viewport.setNormaliseSequenceLogo(view.getNormaliseSequenceLogo());
}
if (view.hasShowDbRefTooltip())
{
- af.viewport.setShowDbRefs(view.getShowDbRefTooltip());
+ af.viewport.setShowDBRefs(view.getShowDbRefTooltip());
}
if (view.hasShowNPfeatureTooltip())
{
- af.viewport.setShowNpFeats(view.hasShowNPfeatureTooltip());
+ af.viewport.setShowNPFeats(view.hasShowNPfeatureTooltip());
}
if (view.hasShowGroupConsensus())
{
@@ -3185,9 +4325,14 @@ public class Jalview2XML
// recover featre settings
if (jms.getFeatureSettings() != null)
{
- af.viewport.featuresDisplayed = new Hashtable();
+ FeaturesDisplayed fdi;
+ af.viewport.setFeaturesDisplayed(fdi = new FeaturesDisplayed());
String[] renderOrder = new String[jms.getFeatureSettings()
.getSettingCount()];
+ Hashtable featureGroups = new Hashtable();
+ Hashtable featureColours = new Hashtable();
+ Hashtable featureOrder = new Hashtable();
+
for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++)
{
Setting setting = jms.getFeatureSettings().getSetting(fs);
@@ -3214,37 +4359,42 @@ public class Jalview2XML
gc.setColourByLabel(setting.getColourByLabel());
}
// and put in the feature colour table.
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(
- setting.getType(), gc);
+ featureColours.put(setting.getType(), gc);
}
else
{
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(
- setting.getType(),
+ featureColours.put(setting.getType(),
new java.awt.Color(setting.getColour()));
}
renderOrder[fs] = setting.getType();
if (setting.hasOrder())
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setOrder(
- setting.getType(), setting.getOrder());
+ {
+ featureOrder.put(setting.getType(), setting.getOrder());
+ }
else
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setOrder(
- setting.getType(),
- fs / jms.getFeatureSettings().getSettingCount());
+ {
+ featureOrder.put(setting.getType(), new Float(fs
+ / jms.getFeatureSettings().getSettingCount()));
+ }
if (setting.getDisplay())
{
- af.viewport.featuresDisplayed.put(setting.getType(), new Integer(
- setting.getColour()));
+ fdi.setVisible(setting.getType());
}
}
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder;
- Hashtable fgtable;
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureGroups = fgtable = new Hashtable();
+ Hashtable fgtable = new Hashtable();
for (int gs = 0; gs < jms.getFeatureSettings().getGroupCount(); gs++)
{
Group grp = jms.getFeatureSettings().getGroup(gs);
fgtable.put(grp.getName(), new Boolean(grp.getDisplay()));
}
+ // FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder,
+ // fgtable, featureColours, jms.getFeatureSettings().hasTransparency() ?
+ // jms.getFeatureSettings().getTransparency() : 0.0, featureOrder);
+ FeatureRendererSettings frs = new FeatureRendererSettings(
+ renderOrder, fgtable, featureColours, 1.0f, featureOrder);
+ af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()
+ .transferSettings(frs);
+
}
if (view.getHiddenColumnsCount() > 0)
@@ -3256,18 +4406,175 @@ public class Jalview2XML
);
}
}
-
+ if (view.getCalcIdParam() != null)
+ {
+ for (CalcIdParam calcIdParam : view.getCalcIdParam())
+ {
+ if (calcIdParam != null)
+ {
+ if (recoverCalcIdParam(calcIdParam, af.viewport))
+ {
+ }
+ else
+ {
+ warn("Couldn't recover parameters for "
+ + calcIdParam.getCalcId());
+ }
+ }
+ }
+ }
af.setMenusFromViewport(af.viewport);
+
// TODO: we don't need to do this if the viewport is aready visible.
- Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(),
- view.getHeight());
- af.alignPanel.updateAnnotation(false); // recompute any autoannotation
- reorderAutoannotation(af, al, autoAlan);
+ /*
+ * Add the AlignFrame to the desktop (it may be 'gathered' later), unless it
+ * has a 'cdna/protein complement' view, in which case save it in order to
+ * populate a SplitFrame once all views have been read in.
+ */
+ String complementaryViewId = view.getComplementId();
+ if (complementaryViewId == null)
+ {
+ Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(),
+ view.getHeight());
+ // recompute any autoannotation
+ af.alignPanel.updateAnnotation(false, true);
+ reorderAutoannotation(af, al, autoAlan);
+ af.alignPanel.alignmentChanged();
+ }
+ else
+ {
+ splitFrameCandidates.put(view, af);
+ }
return af;
}
+ private ColourSchemeI constructAnnotationColour(
+ AnnotationColours viewAnnColour, AlignFrame af, Alignment al,
+ JalviewModelSequence jms, boolean checkGroupAnnColour)
+ {
+ boolean propagateAnnColour = false;
+ ColourSchemeI cs = null;
+ AlignmentI annAlignment = af != null ? af.viewport.getAlignment() : al;
+ if (checkGroupAnnColour && al.getGroups() != null
+ && al.getGroups().size() > 0)
+ {
+ // pre 2.8.1 behaviour
+ // check to see if we should transfer annotation colours
+ propagateAnnColour = true;
+ for (jalview.datamodel.SequenceGroup sg : al.getGroups())
+ {
+ if (sg.cs instanceof AnnotationColourGradient)
+ {
+ propagateAnnColour = false;
+ }
+ }
+ }
+ // int find annotation
+ if (annAlignment.getAlignmentAnnotation() != null)
+ {
+ for (int i = 0; i < annAlignment.getAlignmentAnnotation().length; i++)
+ {
+ if (annAlignment.getAlignmentAnnotation()[i].label
+ .equals(viewAnnColour.getAnnotation()))
+ {
+ if (annAlignment.getAlignmentAnnotation()[i].getThreshold() == null)
+ {
+ annAlignment.getAlignmentAnnotation()[i]
+ .setThreshold(new jalview.datamodel.GraphLine(
+ viewAnnColour.getThreshold(), "Threshold",
+ java.awt.Color.black)
+
+ );
+ }
+
+ if (viewAnnColour.getColourScheme().equals("None"))
+ {
+ cs = new AnnotationColourGradient(
+ annAlignment.getAlignmentAnnotation()[i],
+ new java.awt.Color(viewAnnColour.getMinColour()),
+ new java.awt.Color(viewAnnColour.getMaxColour()),
+ viewAnnColour.getAboveThreshold());
+ }
+ else if (viewAnnColour.getColourScheme().startsWith("ucs"))
+ {
+ cs = new AnnotationColourGradient(
+ annAlignment.getAlignmentAnnotation()[i],
+ getUserColourScheme(jms,
+ viewAnnColour.getColourScheme()),
+ viewAnnColour.getAboveThreshold());
+ }
+ else
+ {
+ cs = new AnnotationColourGradient(
+ annAlignment.getAlignmentAnnotation()[i],
+ ColourSchemeProperty.getColour(al,
+ viewAnnColour.getColourScheme()),
+ viewAnnColour.getAboveThreshold());
+ }
+ if (viewAnnColour.hasPerSequence())
+ {
+ ((AnnotationColourGradient) cs).setSeqAssociated(viewAnnColour
+ .isPerSequence());
+ }
+ if (viewAnnColour.hasPredefinedColours())
+ {
+ ((AnnotationColourGradient) cs)
+ .setPredefinedColours(viewAnnColour
+ .isPredefinedColours());
+ }
+ if (propagateAnnColour && al.getGroups() != null)
+ {
+ // Also use these settings for all the groups
+ for (int g = 0; g < al.getGroups().size(); g++)
+ {
+ jalview.datamodel.SequenceGroup sg = al.getGroups().get(g);
+
+ if (sg.cs == null)
+ {
+ continue;
+ }
+
+ /*
+ * if (viewAnnColour.getColourScheme().equals("None" )) { sg.cs =
+ * new AnnotationColourGradient(
+ * annAlignment.getAlignmentAnnotation()[i], new
+ * java.awt.Color(viewAnnColour. getMinColour()), new
+ * java.awt.Color(viewAnnColour. getMaxColour()),
+ * viewAnnColour.getAboveThreshold()); } else
+ */
+ {
+ sg.cs = new AnnotationColourGradient(
+ annAlignment.getAlignmentAnnotation()[i], sg.cs,
+ viewAnnColour.getAboveThreshold());
+ if (cs instanceof AnnotationColourGradient)
+ {
+ if (viewAnnColour.hasPerSequence())
+ {
+ ((AnnotationColourGradient) cs)
+ .setSeqAssociated(viewAnnColour.isPerSequence());
+ }
+ if (viewAnnColour.hasPredefinedColours())
+ {
+ ((AnnotationColourGradient) cs)
+ .setPredefinedColours(viewAnnColour
+ .isPredefinedColours());
+ }
+ }
+ }
+
+ }
+ }
+
+ break;
+ }
+
+ }
+ }
+ return cs;
+ }
+
private void reorderAutoannotation(AlignFrame af, Alignment al,
- ArrayList<JvAnnotRow> autoAlan)
+ List<JvAnnotRow> autoAlan)
{
// copy over visualization settings for autocalculated annotation in the
// view
@@ -3276,8 +4583,8 @@ public class Jalview2XML
/**
* Kludge for magic autoannotation names (see JAL-811)
*/
- String[] magicNames = new String[]
- { "Consensus", "Quality", "Conservation" };
+ String[] magicNames = new String[] { "Consensus", "Quality",
+ "Conservation" };
JvAnnotRow nullAnnot = new JvAnnotRow(-1, null);
Hashtable<String, JvAnnotRow> visan = new Hashtable<String, JvAnnotRow>();
for (String nm : magicNames)
@@ -3286,21 +4593,34 @@ public class Jalview2XML
}
for (JvAnnotRow auan : autoAlan)
{
- visan.put(auan.template.label, auan);
+ visan.put(auan.template.label
+ + (auan.template.getCalcId() == null ? "" : "\t"
+ + auan.template.getCalcId()), auan);
}
int hSize = al.getAlignmentAnnotation().length;
- ArrayList<JvAnnotRow> reorder = new ArrayList<JvAnnotRow>();
+ List<JvAnnotRow> reorder = new ArrayList<JvAnnotRow>();
+ // work through any autoCalculated annotation already on the view
+ // removing it if it should be placed in a different location on the
+ // annotation panel.
+ List<String> remains = new ArrayList<String>(visan.keySet());
for (int h = 0; h < hSize; h++)
{
jalview.datamodel.AlignmentAnnotation jalan = al
.getAlignmentAnnotation()[h];
if (jalan.autoCalculated)
{
- JvAnnotRow valan = visan.get(jalan.label);
+ String k;
+ JvAnnotRow valan = visan.get(k = jalan.label);
+ if (jalan.getCalcId() != null)
+ {
+ valan = visan.get(k = jalan.label + "\t" + jalan.getCalcId());
+ }
+
if (valan != null)
{
// delete the auto calculated row from the alignment
- al.deleteAnnotation(al.getAlignmentAnnotation()[h], false);
+ al.deleteAnnotation(jalan, false);
+ remains.remove(k);
hSize--;
h--;
if (valan != nullAnnot)
@@ -3322,6 +4642,18 @@ public class Jalview2XML
}
}
}
+ // Add any (possibly stale) autocalculated rows that were not appended to
+ // the view during construction
+ for (String other : remains)
+ {
+ JvAnnotRow othera = visan.get(other);
+ if (othera != nullAnnot && othera.template.getCalcId() != null
+ && othera.template.getCalcId().length() > 0)
+ {
+ reorder.add(othera);
+ }
+ }
+ // now put the automatic annotation in its correct place
int s = 0, srt[] = new int[reorder.size()];
JvAnnotRow[] rws = new JvAnnotRow[reorder.size()];
for (JvAnnotRow jvar : reorder)
@@ -3378,7 +4710,7 @@ public class Jalview2XML
return false;
}
- public void AddToSkipList(AlignFrame af)
+ public void addToSkipList(AlignFrame af)
{
if (skipList == null)
{
@@ -3396,7 +4728,8 @@ public class Jalview2XML
}
}
- private void recoverDatasetFor(SequenceSet vamsasSet, Alignment al)
+ private void recoverDatasetFor(SequenceSet vamsasSet, Alignment al,
+ boolean ignoreUnrefed)
{
jalview.datamodel.Alignment ds = getDatasetFor(vamsasSet.getDatasetId());
Vector dseqs = null;
@@ -3408,7 +4741,7 @@ public class Jalview2XML
for (int i = 0, iSize = vamsasSet.getSequenceCount(); i < iSize; i++)
{
Sequence vamsasSeq = vamsasSet.getSequence(i);
- ensureJalviewDatasetSequence(vamsasSeq, ds, dseqs);
+ ensureJalviewDatasetSequence(vamsasSeq, ds, dseqs, ignoreUnrefed);
}
// create a new dataset
if (ds == null)
@@ -3421,7 +4754,7 @@ public class Jalview2XML
addDatasetRef(vamsasSet.getDatasetId(), ds);
}
// set the dataset for the newly imported alignment.
- if (al.getDataset() == null)
+ if (al.getDataset() == null && !ignoreUnrefed)
{
al.setDataset(ds);
}
@@ -3437,25 +4770,27 @@ public class Jalview2XML
* vector to add new dataset sequence to
*/
private void ensureJalviewDatasetSequence(Sequence vamsasSeq,
- AlignmentI ds, Vector dseqs)
+ AlignmentI ds, Vector dseqs, boolean ignoreUnrefed)
{
// JBP TODO: Check this is called for AlCodonFrames to support recovery of
// xRef Codon Maps
- jalview.datamodel.Sequence sq = (jalview.datamodel.Sequence) seqRefIds
- .get(vamsasSeq.getId());
- jalview.datamodel.SequenceI dsq = null;
+ SequenceI sq = seqRefIds.get(vamsasSeq.getId());
+ SequenceI dsq = null;
if (sq != null && sq.getDatasetSequence() != null)
{
- dsq = (jalview.datamodel.SequenceI) sq.getDatasetSequence();
+ dsq = sq.getDatasetSequence();
+ }
+ if (sq == null && ignoreUnrefed)
+ {
+ return;
}
-
String sqid = vamsasSeq.getDsseqid();
if (dsq == null)
{
// need to create or add a new dataset sequence reference to this sequence
if (sqid != null)
{
- dsq = (jalview.datamodel.SequenceI) seqRefIds.get(sqid);
+ dsq = seqRefIds.get(sqid);
}
// check again
if (dsq == null)
@@ -3486,6 +4821,24 @@ public class Jalview2XML
if (sq != dsq)
{ // make this dataset sequence sq's dataset sequence
sq.setDatasetSequence(dsq);
+ // and update the current dataset alignment
+ if (ds == null)
+ {
+ if (dseqs != null)
+ {
+ if (!dseqs.contains(dsq))
+ {
+ dseqs.add(dsq);
+ }
+ }
+ else
+ {
+ if (ds.findIndex(dsq) < 0)
+ {
+ ds.addSequence(dsq);
+ }
+ }
+ }
}
}
}
@@ -3497,7 +4850,7 @@ public class Jalview2XML
// if (pre || post)
if (sq != dsq)
{
- StringBuffer sb = new StringBuffer();
+ // StringBuffer sb = new StringBuffer();
String newres = jalview.analysis.AlignSeq.extractGaps(
jalview.util.Comparison.GapChars, sq.getSequenceAsString());
if (!newres.equalsIgnoreCase(dsq.getSequenceAsString())
@@ -3512,31 +4865,36 @@ public class Jalview2XML
* sb.append(newres.substring(newres.length() - sq.getEnd() -
* dsq.getEnd())); dsq.setEnd(sq.getEnd()); }
*/
- dsq.setSequence(sb.toString());
+ dsq.setSequence(newres);
}
// TODO: merges will never happen if we 'know' we have the real dataset
// sequence - this should be detected when id==dssid
- System.err.println("DEBUG Notice: Merged dataset sequence"); // ("
+ System.err
+ .println("DEBUG Notice: Merged dataset sequence (if you see this often, post at http://issues.jalview.org/browse/JAL-1474)"); // ("
// + (pre ? "prepended" : "") + " "
// + (post ? "appended" : ""));
}
}
}
- java.util.Hashtable datasetIds = null;
+ /*
+ * TODO use AlignmentI here and in related methods - needs
+ * AlignmentI.getDataset() changed to return AlignmentI instead of Alignment
+ */
+ Hashtable<String, Alignment> datasetIds = null;
- java.util.IdentityHashMap dataset2Ids = null;
+ IdentityHashMap<Alignment, String> dataset2Ids = null;
private Alignment getDatasetFor(String datasetId)
{
if (datasetIds == null)
{
- datasetIds = new Hashtable();
+ datasetIds = new Hashtable<String, Alignment>();
return null;
}
if (datasetIds.containsKey(datasetId))
{
- return (Alignment) datasetIds.get(datasetId);
+ return datasetIds.get(datasetId);
}
return null;
}
@@ -3545,7 +4903,7 @@ public class Jalview2XML
{
if (datasetIds == null)
{
- datasetIds = new Hashtable();
+ datasetIds = new Hashtable<String, Alignment>();
}
datasetIds.put(datasetId, dataset);
}
@@ -3556,7 +4914,7 @@ public class Jalview2XML
* @param dataset
* @return
*/
- private String getDatasetIdRef(jalview.datamodel.Alignment dataset)
+ private String getDatasetIdRef(Alignment dataset)
{
if (dataset.getDataset() != null)
{
@@ -3568,11 +4926,11 @@ public class Jalview2XML
// make a new datasetId and record it
if (dataset2Ids == null)
{
- dataset2Ids = new IdentityHashMap();
+ dataset2Ids = new IdentityHashMap<Alignment, String>();
}
else
{
- datasetId = (String) dataset2Ids.get(dataset);
+ datasetId = dataset2Ids.get(dataset);
}
if (datasetId == null)
{
@@ -3632,12 +4990,11 @@ public class Jalview2XML
/**
* recover from hash
*/
- jmap.setTo((SequenceI) seqRefIds.get(dsfor));
+ jmap.setTo(seqRefIds.get(dsfor));
}
else
{
- frefedSequence.add(new Object[]
- { dsfor, jmap });
+ frefedSequence.add(new Object[] { dsfor, jmap });
}
}
else
@@ -3646,14 +5003,14 @@ public class Jalview2XML
* local sequence definition
*/
Sequence ms = mc.getSequence();
- jalview.datamodel.Sequence djs = null;
+ SequenceI djs = null;
String sqid = ms.getDsseqid();
if (sqid != null && sqid.length() > 0)
{
/*
* recover dataset sequence
*/
- djs = (jalview.datamodel.Sequence) seqRefIds.get(sqid);
+ djs = seqRefIds.get(sqid);
}
else
{
@@ -3691,8 +5048,7 @@ public class Jalview2XML
boolean keepSeqRefs)
{
initSeqRefs();
- jalview.schemabinding.version2.JalviewModel jm = SaveState(ap, null,
- null);
+ JalviewModel jm = saveState(ap, null, null, null);
if (!keepSeqRefs)
{
@@ -3712,18 +5068,18 @@ public class Jalview2XML
frefedSequence = new Vector();
}
- viewportsAdded = new Hashtable();
+ viewportsAdded.clear();
- AlignFrame af = LoadFromObject(jm, null, false, null);
+ AlignFrame af = loadFromObject(jm, null, false, null);
af.alignPanels.clear();
af.closeMenuItem_actionPerformed(true);
/*
- * if(ap.av.alignment.getAlignmentAnnotation()!=null) { for(int i=0;
- * i<ap.av.alignment.getAlignmentAnnotation().length; i++) {
- * if(!ap.av.alignment.getAlignmentAnnotation()[i].autoCalculated) {
- * af.alignPanel.av.alignment.getAlignmentAnnotation()[i] =
- * ap.av.alignment.getAlignmentAnnotation()[i]; } } }
+ * if(ap.av.getAlignment().getAlignmentAnnotation()!=null) { for(int i=0;
+ * i<ap.av.getAlignment().getAlignmentAnnotation().length; i++) {
+ * if(!ap.av.getAlignment().getAlignmentAnnotation()[i].autoCalculated) {
+ * af.alignPanel.av.getAlignment().getAlignmentAnnotation()[i] =
+ * ap.av.getAlignment().getAlignmentAnnotation()[i]; } } }
*/
return af.alignPanel;
@@ -3733,7 +5089,7 @@ public class Jalview2XML
* flag indicating if hashtables should be cleared on finalization TODO this
* flag may not be necessary
*/
- private boolean _cleartables = true;
+ private final boolean _cleartables = true;
private Hashtable jvids2vobj;
@@ -3742,6 +5098,7 @@ public class Jalview2XML
*
* @see java.lang.Object#finalize()
*/
+ @Override
protected void finalize() throws Throwable
{
// really make sure we have no buried refs left.
@@ -3847,24 +5204,20 @@ public class Jalview2XML
// register sequence object so the XML parser can recover it.
if (seqRefIds == null)
{
- seqRefIds = new Hashtable();
+ seqRefIds = new HashMap<String, SequenceI>();
}
if (seqsToIds == null)
{
- seqsToIds = new IdentityHashMap();
+ seqsToIds = new IdentityHashMap<SequenceI, String>();
}
- seqRefIds.put(jv2vobj.get(jvobj).toString(), jvobj);
- seqsToIds.put(jvobj, id);
+ seqRefIds.put(jv2vobj.get(jvobj).toString(), (SequenceI) jvobj);
+ seqsToIds.put((SequenceI) jvobj, id);
}
else if (jvobj instanceof jalview.datamodel.AlignmentAnnotation)
{
- if (annotationIds == null)
- {
- annotationIds = new Hashtable();
- }
String anid;
- annotationIds.put(anid = jv2vobj.get(jvobj).toString(), jvobj);
- jalview.datamodel.AlignmentAnnotation jvann = (jalview.datamodel.AlignmentAnnotation) jvobj;
+ AlignmentAnnotation jvann = (AlignmentAnnotation) jvobj;
+ annotationIds.put(anid = jv2vobj.get(jvobj).toString(), jvann);
if (jvann.annotationId == null)
{
jvann.annotationId = anid;
@@ -3886,7 +5239,9 @@ public class Jalview2XML
}
}
else
+ {
Cache.log.debug("Ignoring " + jvobj.getClass() + " (ID = " + id);
+ }
}
}
@@ -3914,4 +5269,76 @@ public class Jalview2XML
skipList = skipList2;
}
+ /**
+ * Reads the jar entry of given name and returns its contents, or null if the
+ * entry is not found.
+ *
+ * @param jprovider
+ * @param jarEntryName
+ * @return
+ */
+ protected String readJarEntry(jarInputStreamProvider jprovider,
+ String jarEntryName)
+ {
+ String result = null;
+ BufferedReader in = null;
+
+ try
+ {
+ /*
+ * Reopen the jar input stream and traverse its entries to find a matching
+ * name
+ */
+ JarInputStream jin = jprovider.getJarInputStream();
+ JarEntry entry = null;
+ do
+ {
+ entry = jin.getNextJarEntry();
+ } while (entry != null && !entry.getName().equals(jarEntryName));
+
+ if (entry != null)
+ {
+ StringBuilder out = new StringBuilder(256);
+ in = new BufferedReader(new InputStreamReader(jin, UTF_8));
+ String data;
+
+ while ((data = in.readLine()) != null)
+ {
+ out.append(data);
+ }
+ result = out.toString();
+ }
+ else
+ {
+ warn("Couldn't find entry in Jalview Jar for " + jarEntryName);
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } finally
+ {
+ if (in != null)
+ {
+ try
+ {
+ in.close();
+ } catch (IOException e)
+ {
+ // ignore
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns an incrementing counter (0, 1, 2...)
+ *
+ * @return
+ */
+ private synchronized int nextCounter()
+ {
+ return counter++;
+ }
}
diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java
index c8ac01c..b9d4391 100644
--- a/src/jalview/gui/Jalview2XML_V1.java
+++ b/src/jalview/gui/Jalview2XML_V1.java
@@ -1,468 +1,512 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.gui;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.util.jar.*;
-
-import javax.swing.*;
-
-import org.exolab.castor.xml.*;
-import jalview.binding.*;
-import jalview.schemes.*;
-import jalview.util.jarInputStreamProvider;
-
-/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
- */
-public class Jalview2XML_V1
-{
- boolean raiseGUI = true;
-
- public Jalview2XML_V1()
- {
-
- };
-
- public Jalview2XML_V1(boolean raiseGUI)
- {
- this.raiseGUI = raiseGUI;
- };
-
- jalview.schemes.UserColourScheme GetUserColourScheme(
- JalviewModelSequence jms, String id)
- {
- UserColours[] uc = jms.getUserColours();
- UserColours colours = null;
-
- for (int i = 0; i < uc.length; i++)
- {
- if (uc[i].getId().equals(id))
- {
- colours = uc[i];
-
- break;
- }
- }
-
- int csize = colours.getUserColourScheme().getColourCount();
- java.awt.Color[] newColours = new java.awt.Color[csize];
-
- for (int i = 0; i < csize; i++)
- {
- newColours[i] = new java.awt.Color(Integer.parseInt(colours
- .getUserColourScheme().getColour(i).getRGB(), 16));
- }
-
- return new jalview.schemes.UserColourScheme(newColours);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param file
- * DOCUMENT ME!
- */
- public AlignFrame LoadJalviewAlign(final jarInputStreamProvider jprovider)
- {
- final String file = jprovider.getFilename();
- jalview.gui.AlignFrame af = null;
-
- try
- {
- JarInputStream jin = null;
- JarEntry jarentry = null;
- int entryCount = 1;
-
- do
- {
- jin = jprovider.getJarInputStream();
-
- for (int i = 0; i < entryCount; i++)
- {
- jarentry = jin.getNextJarEntry();
- }
-
- class NoDescIDResolver implements IDResolver
- {
- public Object resolve(String idref)
- {
- System.out.println(idref + " used");
- return null;
- }
- }
-
- if (jarentry != null)
- {
- InputStreamReader in = new InputStreamReader(jin, "UTF-8");
- JalviewModel object = new JalviewModel();
-
- object = (JalviewModel) object.unmarshal(in);
-
- af = LoadFromObject(object, file);
- entryCount++;
- }
- } while (jarentry != null);
- } catch (final java.net.UnknownHostException ex)
- {
- ex.printStackTrace();
- if (raiseGUI)
- {
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
-
- System.err.println("Couldn't locate Jalview XML file : " + ex
- + "\n");
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Couldn't locate " + file, "URL not found",
- JOptionPane.WARNING_MESSAGE);
- }
- });
- }
- ;
- } catch (Exception ex)
- {
- System.err.println("Exception whilst loading jalview XML file : ");
- ex.printStackTrace();
- if (raiseGUI)
- {
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
-
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Error loading " + file, "Error loading Jalview file",
- JOptionPane.WARNING_MESSAGE);
- }
- });
- }
- }
-
- return af;
- }
-
- AlignFrame LoadFromObject(JalviewModel object, String file)
- {
- Vector seqids = new Vector();
- SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);
- Sequence[] vamsasSeq = vamsasSet.getSequence();
-
- JalviewModelSequence jms = object.getJalviewModelSequence();
-
- // ////////////////////////////////
- // LOAD SEQUENCES
- jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length];
- JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();
- for (int i = 0; i < vamsasSeq.length; i++)
- {
- jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),
- vamsasSeq[i].getSequence());
- jseqs[i].setStart(JSEQ[i].getStart());
- jseqs[i].setEnd(JSEQ[i].getEnd());
- seqids.add(jseqs[i]);
- }
-
- // /SequenceFeatures are added to the DatasetSequence,
- // so we must create the dataset before loading features
- // ///////////////////////////////
- jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);
- al.setDataset(null);
- // ///////////////////////////////
-
- for (int i = 0; i < vamsasSeq.length; i++)
- {
- if (JSEQ[i].getFeaturesCount() > 0)
- {
- Features[] features = JSEQ[i].getFeatures();
- for (int f = 0; f < features.length; f++)
- {
- jalview.datamodel.SequenceFeature sf = new jalview.datamodel.SequenceFeature(
- features[f].getType(), features[f].getDescription(),
- features[f].getStatus(), features[f].getBegin(),
- features[f].getEnd(), null);
-
- al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf);
- }
- }
- if (JSEQ[i].getPdbidsCount() > 0)
- {
- Pdbids[] ids = JSEQ[i].getPdbids();
- for (int p = 0; p < ids.length; p++)
- {
- jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry();
- entry.setId(ids[p].getId());
- entry.setType(ids[p].getType());
- al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);
- }
-
- }
- }
-
- // ///////////////////////////////
- // ////////////////////////////////
- // LOAD ANNOTATIONS
- if (vamsasSet.getAnnotation() != null)
- {
- Annotation[] an = vamsasSet.getAnnotation();
-
- for (int i = 0; i < an.length; i++)
- {
- AnnotationElement[] ae = an[i].getAnnotationElement();
- jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al
- .getWidth()];
-
- for (int aa = 0; aa < ae.length; aa++)
- {
- anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(
- ae[aa].getDisplayCharacter(), ae[aa].getDescription(),
- ae[aa].getSecondaryStructure().charAt(0),
- ae[aa].getValue());
- }
-
- jalview.datamodel.AlignmentAnnotation jaa = null;
-
- if (an[i].getGraph())
- {
- jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),
- an[i].getDescription(), anot, 0, 0,
- jalview.datamodel.AlignmentAnnotation.BAR_GRAPH);
- }
- else
- {
- jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),
- an[i].getDescription(), anot);
- }
-
- al.addAnnotation(jaa);
- }
- }
-
- // ///////////////////////////////
- // LOAD VIEWPORT
- Viewport[] views = jms.getViewport();
- Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER
-
- AlignFrame af = new AlignFrame(al, view.getWidth(), view.getHeight());
-
- af.setFileName(file, "Jalview");
-
- for (int i = 0; i < JSEQ.length; i++)
- {
- af.viewport.setSequenceColour(af.viewport.alignment.getSequenceAt(i),
- new java.awt.Color(JSEQ[i].getColour()));
- }
-
- // af.changeColour() );
- // ///////////////////////
- // LOAD GROUPS
- if (jms.getJGroupCount() > 0)
- {
- JGroup[] groups = jms.getJGroup();
-
- for (int i = 0; i < groups.length; i++)
- {
- ColourSchemeI cs = null;
-
- if (groups[i].getColour() != null)
- {
- if (groups[i].getColour().startsWith("ucs"))
- {
- cs = GetUserColourScheme(jms, groups[i].getColour());
- }
- else
- {
- cs = ColourSchemeProperty.getColour(al, groups[i].getColour());
- }
-
- if (cs != null)
- {
- cs.setThreshold(groups[i].getPidThreshold(), true);
- }
-
- }
-
- Vector seqs = new Vector();
- int[] ids = groups[i].getSeq();
-
- for (int s = 0; s < ids.length; s++)
- {
- seqs.addElement((jalview.datamodel.SequenceI) seqids
- .elementAt(ids[s]));
- }
-
- jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup(
- seqs, groups[i].getName(), cs, groups[i].getDisplayBoxes(),
- groups[i].getDisplayText(), groups[i].getColourText(),
- groups[i].getStart(), groups[i].getEnd());
-
- sg.setOutlineColour(new java.awt.Color(groups[i].getOutlineColour()));
-
- if (groups[i].getConsThreshold() != 0)
- {
- jalview.analysis.Conservation c = new jalview.analysis.Conservation(
- "All", ResidueProperties.propHash, 3,
- sg.getSequences(null), 0, sg.getWidth() - 1);
- c.calculate();
- c.verdict(false, 25);
- sg.cs.setConservation(c);
- }
-
- al.addGroup(sg);
- }
- }
-
- af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),
- view.getHeight());
- af.viewport.setStartRes(view.getStartRes());
- af.viewport.setStartSeq(view.getStartSeq());
- af.viewport.setShowAnnotation(view.getShowAnnotation());
- af.viewport.setAbovePIDThreshold(view.getPidSelected());
- af.viewport.setColourText(view.getShowColourText());
- af.viewport.setConservationSelected(view.getConservationSelected());
- af.viewport.setShowJVSuffix(view.getShowFullId());
- af.viewport.setFont(new java.awt.Font(view.getFontName(), view
- .getFontStyle(), view.getFontSize()));
- af.alignPanel.fontChanged();
-
- af.viewport.setRenderGaps(view.getRenderGaps());
- af.viewport.setWrapAlignment(view.getWrapAlignment());
- af.alignPanel.setWrapAlignment(view.getWrapAlignment());
- af.viewport.setShowAnnotation(view.getShowAnnotation());
- af.alignPanel.setAnnotationVisible(view.getShowAnnotation());
- af.viewport.setShowBoxes(view.getShowBoxes());
- af.viewport.setShowText(view.getShowText());
-
- ColourSchemeI cs = null;
-
- if (view.getBgColour() != null)
- {
- if (view.getBgColour().startsWith("ucs"))
- {
- cs = GetUserColourScheme(jms, view.getBgColour());
- }
- else
- {
- cs = ColourSchemeProperty.getColour(al, view.getBgColour());
- }
-
- if (cs != null)
- {
- cs.setThreshold(view.getPidThreshold(), true);
- cs.setConsensus(af.viewport.hconsensus);
- }
- }
-
- af.viewport.setGlobalColourScheme(cs);
- af.viewport.setColourAppliesToAllGroups(false);
- af.changeColour(cs);
- if (view.getConservationSelected() && cs != null)
- {
- cs.setConservationInc(view.getConsThreshold());
- }
-
- af.viewport.setColourAppliesToAllGroups(true);
- af.viewport.showSequenceFeatures = view.getShowSequenceFeatures();
-
- if (jms.getFeatureSettings() != null)
- {
- af.viewport.featuresDisplayed = new Hashtable();
- String[] renderOrder = new String[jms.getFeatureSettings()
- .getSettingCount()];
- for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++)
- {
- Setting setting = jms.getFeatureSettings().getSetting(fs);
-
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(
- setting.getType(), new java.awt.Color(setting.getColour()));
-
- renderOrder[fs] = setting.getType();
-
- if (setting.getDisplay())
- {
- af.viewport.featuresDisplayed.put(setting.getType(), new Integer(
- setting.getColour()));
- }
- }
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder;
- }
-
- af.setMenusFromViewport(af.viewport);
-
- Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(),
- view.getHeight());
-
- // LOAD TREES
- // /////////////////////////////////////
- if (jms.getTreeCount() > 0)
- {
- try
- {
- for (int t = 0; t < jms.getTreeCount(); t++)
- {
-
- Tree tree = jms.getTree(t);
-
- TreePanel tp = af.ShowNewickTree(
- new jalview.io.NewickFile(tree.getNewick()),
- tree.getTitle(), tree.getWidth(), tree.getHeight(),
- tree.getXpos(), tree.getYpos());
-
- tp.fitToWindow.setState(tree.getFitToWindow());
- tp.fitToWindow_actionPerformed(null);
-
- if (tree.getFontName() != null)
- {
- tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree
- .getFontStyle(), tree.getFontSize()));
- }
- else
- {
- tp.setTreeFont(new java.awt.Font(view.getFontName(), view
- .getFontStyle(), tree.getFontSize()));
- }
-
- tp.showPlaceholders(tree.getMarkUnlinked());
- tp.showBootstrap(tree.getShowBootstrap());
- tp.showDistances(tree.getShowDistances());
-
- tp.treeCanvas.threshold = tree.getThreshold();
-
- if (tree.getCurrentTree())
- {
- af.viewport.setCurrentTree(tp.getTree());
- }
- }
-
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- }
-
- return af;
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.binding.Annotation;
+import jalview.binding.AnnotationElement;
+import jalview.binding.Features;
+import jalview.binding.JGroup;
+import jalview.binding.JSeq;
+import jalview.binding.JalviewModel;
+import jalview.binding.JalviewModelSequence;
+import jalview.binding.Pdbids;
+import jalview.binding.Sequence;
+import jalview.binding.SequenceSet;
+import jalview.binding.Setting;
+import jalview.binding.Tree;
+import jalview.binding.UserColours;
+import jalview.binding.Viewport;
+import jalview.datamodel.PDBEntry;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+import jalview.util.jarInputStreamProvider;
+import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
+
+import java.io.InputStreamReader;
+import java.util.Hashtable;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import javax.swing.JOptionPane;
+
+import org.exolab.castor.xml.IDResolver;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class Jalview2XML_V1
+{
+ boolean raiseGUI = true;
+
+ public Jalview2XML_V1()
+ {
+
+ };
+
+ public Jalview2XML_V1(boolean raiseGUI)
+ {
+ this.raiseGUI = raiseGUI;
+ };
+
+ jalview.schemes.UserColourScheme GetUserColourScheme(
+ JalviewModelSequence jms, String id)
+ {
+ UserColours[] uc = jms.getUserColours();
+ UserColours colours = null;
+
+ for (int i = 0; i < uc.length; i++)
+ {
+ if (uc[i].getId().equals(id))
+ {
+ colours = uc[i];
+
+ break;
+ }
+ }
+
+ int csize = colours.getUserColourScheme().getColourCount();
+ java.awt.Color[] newColours = new java.awt.Color[csize];
+
+ for (int i = 0; i < csize; i++)
+ {
+ newColours[i] = new java.awt.Color(Integer.parseInt(colours
+ .getUserColourScheme().getColour(i).getRGB(), 16));
+ }
+
+ return new jalview.schemes.UserColourScheme(newColours);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param file
+ * DOCUMENT ME!
+ */
+ public AlignFrame LoadJalviewAlign(final jarInputStreamProvider jprovider)
+ {
+ final String file = jprovider.getFilename();
+ jalview.gui.AlignFrame af = null;
+
+ try
+ {
+ JarInputStream jin = null;
+ JarEntry jarentry = null;
+ int entryCount = 1;
+
+ do
+ {
+ jin = jprovider.getJarInputStream();
+
+ for (int i = 0; i < entryCount; i++)
+ {
+ jarentry = jin.getNextJarEntry();
+ }
+
+ class NoDescIDResolver implements IDResolver
+ {
+ public Object resolve(String idref)
+ {
+ System.out.println(idref + " used");
+ return null;
+ }
+ }
+
+ if (jarentry != null)
+ {
+ InputStreamReader in = new InputStreamReader(jin, "UTF-8");
+ JalviewModel object = new JalviewModel();
+
+ object = object.unmarshal(in);
+
+ af = LoadFromObject(object, file);
+ entryCount++;
+ }
+ } while (jarentry != null);
+ } catch (final java.net.UnknownHostException ex)
+ {
+ ex.printStackTrace();
+ if (raiseGUI)
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+
+ System.err.println("Couldn't locate Jalview XML file : " + ex
+ + "\n");
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.formatMessage("label.couldnt_locate",
+ new String[] { file }), MessageManager
+ .getString("label.url_not_found"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+ });
+ }
+ ;
+ } catch (Exception ex)
+ {
+ System.err.println("Exception whilst loading jalview XML file : ");
+ ex.printStackTrace();
+ if (raiseGUI)
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.formatMessage(
+ "label.error_loading_file_params", new String[]
+ { file }), MessageManager
+ .getString("label.error_loading_jalview_file"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+ });
+ }
+ }
+
+ return af;
+ }
+
+ AlignFrame LoadFromObject(JalviewModel object, String file)
+ {
+ Vector seqids = new Vector();
+ SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);
+ Sequence[] vamsasSeq = vamsasSet.getSequence();
+
+ JalviewModelSequence jms = object.getJalviewModelSequence();
+
+ // ////////////////////////////////
+ // LOAD SEQUENCES
+ jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length];
+ JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();
+ for (int i = 0; i < vamsasSeq.length; i++)
+ {
+ jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),
+ vamsasSeq[i].getSequence());
+ jseqs[i].setStart(JSEQ[i].getStart());
+ jseqs[i].setEnd(JSEQ[i].getEnd());
+ seqids.add(jseqs[i]);
+ }
+
+ // /SequenceFeatures are added to the DatasetSequence,
+ // so we must create the dataset before loading features
+ // ///////////////////////////////
+ jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);
+ al.setDataset(null);
+ // ///////////////////////////////
+
+ for (int i = 0; i < vamsasSeq.length; i++)
+ {
+ if (JSEQ[i].getFeaturesCount() > 0)
+ {
+ Features[] features = JSEQ[i].getFeatures();
+ for (int f = 0; f < features.length; f++)
+ {
+ jalview.datamodel.SequenceFeature sf = new jalview.datamodel.SequenceFeature(
+ features[f].getType(), features[f].getDescription(),
+ features[f].getStatus(), features[f].getBegin(),
+ features[f].getEnd(), null);
+
+ al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf);
+ }
+ }
+ if (JSEQ[i].getPdbidsCount() > 0)
+ {
+ Pdbids[] ids = JSEQ[i].getPdbids();
+ for (int p = 0; p < ids.length; p++)
+ {
+ jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry();
+ entry.setId(ids[p].getId());
+ if (ids[p].getType() != null)
+ {
+ if (ids[p].getType().equalsIgnoreCase("PDB"))
+ {
+ entry.setType(PDBEntry.Type.PDB);
+ }
+ else
+ {
+ entry.setType(PDBEntry.Type.FILE);
+ }
+ }
+ al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);
+ StructureSelectionManager.getStructureSelectionManager(
+ Desktop.instance).registerPDBEntry(entry);
+ }
+
+ }
+ }
+
+ // ///////////////////////////////
+ // ////////////////////////////////
+ // LOAD ANNOTATIONS
+ if (vamsasSet.getAnnotation() != null)
+ {
+ Annotation[] an = vamsasSet.getAnnotation();
+
+ for (int i = 0; i < an.length; i++)
+ {
+ AnnotationElement[] ae = an[i].getAnnotationElement();
+ jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al
+ .getWidth()];
+
+ for (int aa = 0; aa < ae.length; aa++)
+ {
+ anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(
+ ae[aa].getDisplayCharacter(), ae[aa].getDescription(),
+ ae[aa].getSecondaryStructure().charAt(0),
+ ae[aa].getValue());
+ }
+
+ jalview.datamodel.AlignmentAnnotation jaa = null;
+
+ if (an[i].getGraph())
+ {
+ jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),
+ an[i].getDescription(), anot, 0, 0,
+ jalview.datamodel.AlignmentAnnotation.BAR_GRAPH);
+ }
+ else
+ {
+ jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),
+ an[i].getDescription(), anot);
+ }
+
+ al.addAnnotation(jaa);
+ }
+ }
+
+ // ///////////////////////////////
+ // LOAD VIEWPORT
+ Viewport[] views = jms.getViewport();
+ Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER
+
+ AlignFrame af = new AlignFrame(al, view.getWidth(), view.getHeight());
+
+ af.setFileName(file, "Jalview");
+
+ for (int i = 0; i < JSEQ.length; i++)
+ {
+ af.viewport.setSequenceColour(af.viewport.getAlignment()
+ .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour()));
+ }
+
+ // af.changeColour() );
+ // ///////////////////////
+ // LOAD GROUPS
+ if (jms.getJGroupCount() > 0)
+ {
+ JGroup[] groups = jms.getJGroup();
+
+ for (int i = 0; i < groups.length; i++)
+ {
+ ColourSchemeI cs = null;
+
+ if (groups[i].getColour() != null)
+ {
+ if (groups[i].getColour().startsWith("ucs"))
+ {
+ cs = GetUserColourScheme(jms, groups[i].getColour());
+ }
+ else
+ {
+ cs = ColourSchemeProperty.getColour(al, groups[i].getColour());
+ }
+
+ if (cs != null)
+ {
+ cs.setThreshold(groups[i].getPidThreshold(), true);
+ }
+
+ }
+
+ Vector seqs = new Vector();
+ int[] ids = groups[i].getSeq();
+
+ for (int s = 0; s < ids.length; s++)
+ {
+ seqs.addElement(seqids.elementAt(ids[s]));
+ }
+
+ jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup(
+ seqs, groups[i].getName(), cs, groups[i].getDisplayBoxes(),
+ groups[i].getDisplayText(), groups[i].getColourText(),
+ groups[i].getStart(), groups[i].getEnd());
+
+ sg.setOutlineColour(new java.awt.Color(groups[i].getOutlineColour()));
+
+ if (groups[i].getConsThreshold() != 0)
+ {
+ jalview.analysis.Conservation c = new jalview.analysis.Conservation(
+ "All", ResidueProperties.propHash, 3,
+ sg.getSequences(null), 0, sg.getWidth() - 1);
+ c.calculate();
+ c.verdict(false, 25);
+ sg.cs.setConservation(c);
+ }
+
+ al.addGroup(sg);
+ }
+ }
+
+ af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),
+ view.getHeight());
+ af.viewport.setStartRes(view.getStartRes());
+ af.viewport.setStartSeq(view.getStartSeq());
+ af.viewport.setShowAnnotation(view.getShowAnnotation());
+ af.viewport.setAbovePIDThreshold(view.getPidSelected());
+ af.viewport.setColourText(view.getShowColourText());
+ af.viewport.setConservationSelected(view.getConservationSelected());
+ af.viewport.setShowJVSuffix(view.getShowFullId());
+ af.viewport.setFont(
+ new java.awt.Font(view.getFontName(), view.getFontStyle(), view
+ .getFontSize()), true);
+
+ af.viewport.setRenderGaps(view.getRenderGaps());
+ af.viewport.setWrapAlignment(view.getWrapAlignment());
+
+ af.viewport.setShowAnnotation(view.isShowAnnotation());
+ af.viewport.setShowBoxes(view.getShowBoxes());
+ af.viewport.setShowText(view.getShowText());
+
+ ColourSchemeI cs = null;
+
+ if (view.getBgColour() != null)
+ {
+ if (view.getBgColour().startsWith("ucs"))
+ {
+ cs = GetUserColourScheme(jms, view.getBgColour());
+ }
+ else
+ {
+ cs = ColourSchemeProperty.getColour(al, view.getBgColour());
+ }
+
+ if (cs != null)
+ {
+ cs.setThreshold(view.getPidThreshold(), true);
+ cs.setConsensus(af.viewport.getSequenceConsensusHash());
+ }
+ }
+
+ af.viewport.setGlobalColourScheme(cs);
+ af.viewport.setColourAppliesToAllGroups(false);
+ af.alignPanel.updateLayout();
+ af.changeColour(cs);
+ if (view.getConservationSelected() && cs != null)
+ {
+ cs.setConservationInc(view.getConsThreshold());
+ }
+
+ af.viewport.setColourAppliesToAllGroups(true);
+ af.viewport.setShowSequenceFeatures(view.getShowSequenceFeatures());
+
+ if (jms.getFeatureSettings() != null)
+ {
+ Hashtable featuresDisplayed = new Hashtable();
+ Hashtable featureColours = new Hashtable();
+ String[] renderOrder = new String[jms.getFeatureSettings()
+ .getSettingCount()];
+ for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++)
+ {
+ Setting setting = jms.getFeatureSettings().getSetting(fs);
+
+ featureColours.put(setting.getType(),
+ new java.awt.Color(setting.getColour()));
+
+ renderOrder[fs] = setting.getType();
+
+ if (setting.getDisplay())
+ {
+ featuresDisplayed.put(setting.getType(),
+ new Integer(setting.getColour()));
+ }
+ }
+ FeatureRendererSettings frs = new FeatureRendererSettings(
+ renderOrder, new Hashtable(), featureColours, 1.0f, null);
+ af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()
+ .transferSettings(frs);
+ }
+
+ af.setMenusFromViewport(af.viewport);
+
+ Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(),
+ view.getHeight());
+
+ // LOAD TREES
+ // /////////////////////////////////////
+ if (jms.getTreeCount() > 0)
+ {
+ try
+ {
+ for (int t = 0; t < jms.getTreeCount(); t++)
+ {
+
+ Tree tree = jms.getTree(t);
+
+ TreePanel tp = af.ShowNewickTree(
+ new jalview.io.NewickFile(tree.getNewick()),
+ tree.getTitle(), tree.getWidth(), tree.getHeight(),
+ tree.getXpos(), tree.getYpos());
+
+ tp.fitToWindow.setState(tree.getFitToWindow());
+ tp.fitToWindow_actionPerformed(null);
+
+ if (tree.getFontName() != null)
+ {
+ tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree
+ .getFontStyle(), tree.getFontSize()));
+ }
+ else
+ {
+ tp.setTreeFont(new java.awt.Font(view.getFontName(), view
+ .getFontStyle(), tree.getFontSize()));
+ }
+
+ tp.showPlaceholders(tree.getMarkUnlinked());
+ tp.showBootstrap(tree.getShowBootstrap());
+ tp.showDistances(tree.getShowDistances());
+
+ tp.treeCanvas.threshold = tree.getThreshold();
+
+ if (tree.getCurrentTree())
+ {
+ af.viewport.setCurrentTree(tp.getTree());
+ }
+ }
+
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+
+ return af;
+ }
+}
diff --git a/src/jalview/gui/JalviewAppender.java b/src/jalview/gui/JalviewAppender.java
index 6842fa3..99aa5b8 100644
--- a/src/jalview/gui/JalviewAppender.java
+++ b/src/jalview/gui/JalviewAppender.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
diff --git a/src/jalview/gui/JalviewChangeSupport.java b/src/jalview/gui/JalviewChangeSupport.java
index 97e3315..63cb46c 100644
--- a/src/jalview/gui/JalviewChangeSupport.java
+++ b/src/jalview/gui/JalviewChangeSupport.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
import java.beans.PropertyChangeEvent;
@@ -30,8 +33,8 @@ public class JalviewChangeSupport implements PropertyChangeListener
/**
* change listeners are notified of changes to resources so they can update
- * their state. E.g. - the 'services' property notifies when the available
- * set of web service endpoints have changed.
+ * their state. E.g. - the 'services' property notifies when the available set
+ * of web service endpoints have changed.
*/
private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
this);
@@ -65,8 +68,7 @@ public class JalviewChangeSupport implements PropertyChangeListener
*
* @param newValue
*
- * @see
- * java.beans.PropertyChangeSupport#firePropertyChange(java.lang.String,
+ * @see java.beans.PropertyChangeSupport#firePropertyChange(java.lang.String,
* java.lang.Object, java.lang.Object) public void firePropertyChange(String
* propertyName, Object oldValue, Object newValue) {
* changeSupport.firePropertyChange(propertyName, oldValue, newValue); }
@@ -84,4 +86,4 @@ public class JalviewChangeSupport implements PropertyChangeListener
changeSupport.removePropertyChangeListener(propertyName, listener);
}
-}
\ No newline at end of file
+}
diff --git a/src/jalview/gui/JalviewChimeraBindingModel.java b/src/jalview/gui/JalviewChimeraBindingModel.java
new file mode 100644
index 0000000..4637f07
--- /dev/null
+++ b/src/jalview/gui/JalviewChimeraBindingModel.java
@@ -0,0 +1,138 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.ext.rbvi.chimera.JalviewChimeraBinding;
+import jalview.structure.StructureSelectionManager;
+
+public class JalviewChimeraBindingModel extends JalviewChimeraBinding
+{
+ private ChimeraViewFrame cvf;
+
+ private FeatureRenderer fr = null;
+
+ public JalviewChimeraBindingModel(ChimeraViewFrame chimeraViewFrame,
+ StructureSelectionManager ssm, PDBEntry[] pdbentry,
+ SequenceI[][] sequenceIs, String[][] chains, String protocol)
+ {
+ super(ssm, pdbentry, sequenceIs, chains, protocol);
+ cvf = chimeraViewFrame;
+ }
+
+ @Override
+ public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
+ {
+ AlignmentPanel ap = (alignment == null) ? cvf.getAlignmentPanel()
+ : (AlignmentPanel) alignment;
+ if (ap.av.isShowSequenceFeatures())
+ {
+ if (fr == null)
+ {
+ fr = (jalview.gui.FeatureRenderer) ap.cloneFeatureRenderer();
+ }
+ else
+ {
+ ap.updateFeatureRenderer(fr);
+ }
+ }
+
+ return fr;
+ }
+
+ @Override
+ public jalview.api.SequenceRenderer getSequenceRenderer(
+ AlignmentViewPanel alignment)
+ {
+ return new SequenceRenderer(((AlignmentPanel) alignment).av);
+ }
+
+ @Override
+ public void refreshGUI()
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ cvf.updateTitleAndMenus();
+ cvf.revalidate();
+ }
+ });
+ }
+
+ public void updateColours(Object source)
+ {
+ AlignmentPanel ap = (AlignmentPanel) source;
+ // ignore events from panels not used to colour this view
+ if (!cvf.isUsedforcolourby(ap))
+ {
+ return;
+ }
+ if (!isLoadingFromArchive())
+ {
+ colourBySequence(ap.av.isShowSequenceFeatures(), ap);
+ }
+ }
+
+ @Override
+ public void releaseReferences(Object svl)
+ {
+ }
+
+ @Override
+ protected void releaseUIResources()
+ {
+ }
+
+ @Override
+ public void refreshPdbEntries()
+ {
+ }
+
+ /**
+ * Send an asynchronous command to Chimera, in a new thread, optionally with
+ * an 'in progress' message in a progress bar somewhere
+ */
+ protected void sendAsynchronousCommand(final String command,
+ final String progressMsg)
+ {
+ Thread thread = new Thread(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ long stm = cvf.startProgressBar(progressMsg);
+ try
+ {
+ sendChimeraCommand(command, false);
+ } finally
+ {
+ cvf.stopProgressBar(null, stm);
+ }
+ }
+ });
+ thread.start();
+
+ }
+}
diff --git a/src/jalview/gui/JalviewDialog.java b/src/jalview/gui/JalviewDialog.java
index eee5ffe..895abcb 100644
--- a/src/jalview/gui/JalviewDialog.java
+++ b/src/jalview/gui/JalviewDialog.java
@@ -1,22 +1,27 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
+import jalview.util.MessageManager;
+
import java.awt.Container;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
@@ -29,19 +34,24 @@ import javax.swing.JDialog;
import javax.swing.JPanel;
/**
- * Boilerplate dialog class. Implements basic functionality necessary for model blocking/non-blocking dialogs
- * with an OK and Cancel button ready to add to the content pane.
+ * Boilerplate dialog class. Implements basic functionality necessary for model
+ * blocking/non-blocking dialogs with an OK and Cancel button ready to add to
+ * the content pane.
+ *
* @author jimp
- *
+ *
*/
public abstract class JalviewDialog extends JPanel
{
protected JDialog frame;
+
protected JButton ok = new JButton();
+
protected JButton cancel = new JButton();
- boolean block=false;
-
+
+ boolean block = false;
+
public void waitForInput()
{
if (!block)
@@ -62,25 +72,27 @@ public abstract class JalviewDialog extends JPanel
}
}
- protected void initDialogFrame(Container content,
- boolean modal, boolean block, String title, int width, int height)
+ protected void initDialogFrame(Container content, boolean modal,
+ boolean block, String title, int width, int height)
{
-
- frame = new JDialog(Desktop.instance, true);
+
+ frame = new JDialog(Desktop.instance, modal);
frame.setTitle(title);
- if (Desktop.instance!=null)
+ if (Desktop.instance != null)
{
- Rectangle deskr = Desktop.instance.getBounds();
- frame.setBounds(new Rectangle((int) (deskr.getCenterX() - width/2),
- (int) (deskr.getCenterY() - height/2), width, height));
- } else {
- frame.setSize(width,height);
+ Rectangle deskr = Desktop.instance.getBounds();
+ frame.setBounds(new Rectangle((int) (deskr.getCenterX() - width / 2),
+ (int) (deskr.getCenterY() - height / 2), width, height));
+ }
+ else
+ {
+ frame.setSize(width, height);
}
frame.setContentPane(content);
this.block = block;
-
+
ok.setOpaque(false);
- ok.setText("OK");
+ ok.setText(MessageManager.getString("action.ok"));
ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -90,7 +102,7 @@ public abstract class JalviewDialog extends JPanel
}
});
cancel.setOpaque(false);
- cancel.setText("Cancel");
+ cancel.setText(MessageManager.getString("action.cancel"));
cancel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -101,55 +113,56 @@ public abstract class JalviewDialog extends JPanel
});
frame.addWindowListener(new WindowListener()
{
-
+
@Override
public void windowOpened(WindowEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void windowIconified(WindowEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void windowDeiconified(WindowEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void windowDeactivated(WindowEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void windowClosing(WindowEvent e)
{
// user has cancelled the dialog
closeDialog();
}
-
+
@Override
public void windowClosed(WindowEvent e)
{
}
-
+
@Override
public void windowActivated(WindowEvent e)
{
// TODO Auto-generated method stub
-
+
}
});
}
+
/**
* clean up and raise the 'dialog closed' event by calling raiseClosed
*/
@@ -163,9 +176,11 @@ public abstract class JalviewDialog extends JPanel
{
}
}
-
+
protected abstract void raiseClosed();
+
protected abstract void okPressed();
+
protected abstract void cancelPressed();
-
+
}
diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java
index 9573e1f..7392488 100644
--- a/src/jalview/gui/JvSwingUtils.java
+++ b/src/jalview/gui/JvSwingUtils.java
@@ -1,34 +1,43 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
+import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.event.ActionListener;
+import java.util.Objects;
+import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
-import javax.swing.JTextArea;
+import javax.swing.JScrollBar;
import javax.swing.SwingConstants;
/**
@@ -40,25 +49,47 @@ import javax.swing.SwingConstants;
public final class JvSwingUtils
{
/**
- * wrap a bare html safe string to around 60 characters per line using a
- * <table width=350>
- * <tr>
- * <td></td> field
+ * wrap a bare html safe string to around 60 characters per line using a CSS
+ * style class specifying word-wrap and break-word
*
+ * @param enclose
+ * if true, add <html> wrapper tags
* @param ttext
+ *
* @return
*/
- public static String wrapTooltip(String ttext)
+ public static String wrapTooltip(boolean enclose, String ttext)
{
- if (ttext.length() < 60)
+ Objects.requireNonNull(ttext, "Tootip text to format must not be null!");
+ ttext = ttext.trim();
+ boolean maxLengthExceeded = false;
+
+ if (ttext.contains("<br>"))
{
- return ttext;
+ String[] htmllines = ttext.split("<br>");
+ for (String line : htmllines)
+ {
+ maxLengthExceeded = line.length() > 60;
+ if (maxLengthExceeded)
+ {
+ break;
+ }
+ }
}
else
{
- return "<table width=350 border=0><tr><td>" + ttext
- + "</td></tr></table>";
+ maxLengthExceeded = ttext.length() > 60;
}
+
+ if (!maxLengthExceeded)
+ {
+ return enclose ? "<html>" + ttext + "</html>" : ttext;
+ }
+
+ return (enclose ? "<html>" : "")
+ + "<style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
+ + ttext + "</p>" + ((enclose ? "</html>" : ""));
+
}
public static JButton makeButton(String label, String tooltip,
@@ -100,7 +131,7 @@ public final class JvSwingUtils
menu.add(submenuinstance);
}
return submenuinstance;
-
+
}
/**
@@ -109,18 +140,18 @@ public final class JvSwingUtils
* @param tooltip
* @param label
* @param valBox
- * @return the GUI element created that was added to the layout so it's attributes can be changed.
+ * @return the GUI element created that was added to the layout so it's
+ * attributes can be changed.
*/
- public static JPanel addtoLayout(JPanel panel, String tooltip, JComponent label, JComponent valBox)
+ public static JPanel addtoLayout(JPanel panel, String tooltip,
+ JComponent label, JComponent valBox)
{
- JPanel laypanel = new JPanel(),labPanel=new JPanel(), valPanel=new JPanel();
- // laypanel.setSize(panel.getPreferredSize());
- // laypanel.setLayout(null);
+ JPanel laypanel = new JPanel(new GridLayout(1, 2));
+ JPanel labPanel = new JPanel(new BorderLayout());
+ JPanel valPanel = new JPanel();
labPanel.setBounds(new Rectangle(7, 7, 158, 23));
- valPanel.setBounds(new Rectangle(172, 7, 270,23));
- //labPanel.setLayout(new GridLayout(1,1));
- //valPanel.setLayout(new GridLayout(1,1));
- labPanel.add(label);
+ valPanel.setBounds(new Rectangle(172, 7, 270, 23));
+ labPanel.add(label, BorderLayout.WEST);
valPanel.add(valBox);
laypanel.add(labPanel);
laypanel.add(valPanel);
@@ -135,60 +166,139 @@ public final class JvSwingUtils
public static void mgAddtoLayout(JPanel cpanel, String tooltip,
JLabel jLabel, JComponent name)
{
- mgAddtoLayout(cpanel, tooltip, jLabel, name,null);
+ mgAddtoLayout(cpanel, tooltip, jLabel, name, null);
}
+
public static void mgAddtoLayout(JPanel cpanel, String tooltip,
JLabel jLabel, JComponent name, String params)
{
cpanel.add(jLabel);
- if (params==null) {
+ if (params == null)
+ {
cpanel.add(name);
- } else {cpanel.add(name, params);
+ }
+ else
+ {
+ cpanel.add(name, params);
}
name.setToolTipText(tooltip);
jLabel.setToolTipText(tooltip);
}
/**
- * standard font for labels and check boxes in dialog boxes
+ * standard font for labels and check boxes in dialog boxes
+ *
* @return
*/
public static Font getLabelFont()
{
- return getLabelFont(false,false);
+ return getLabelFont(false, false);
}
+
public static Font getLabelFont(boolean bold, boolean italic)
{
- return new java.awt.Font("Verdana", (!bold && !italic) ? Font.PLAIN : (bold ? Font.BOLD : 0) + (italic ? Font.ITALIC : 0), 11);
+ return new java.awt.Font("Verdana", (!bold && !italic) ? Font.PLAIN
+ : (bold ? Font.BOLD : 0) + (italic ? Font.ITALIC : 0), 11);
}
/**
* standard font for editable text areas
+ *
* @return
*/
public static Font getTextAreaFont()
{
- return getLabelFont(false,false);
+ return getLabelFont(false, false);
}
/**
- * clean up a swing menu.
- * Removes any empty submenus without selection listeners.
+ * clean up a swing menu. Removes any empty submenus without selection
+ * listeners.
+ *
* @param webService
*/
public static void cleanMenu(JMenu webService)
{
- for (int i=0;i<webService.getItemCount(); )
+ for (int i = 0; i < webService.getItemCount();)
{
JMenuItem item = webService.getItem(i);
- if (item instanceof JMenu && ((JMenu)item).getItemCount()==0)
+ if (item instanceof JMenu && ((JMenu) item).getItemCount() == 0)
{
webService.remove(i);
- } else {
+ }
+ else
+ {
i++;
}
}
}
+ /**
+ * Returns the proportion of its range that a scrollbar's position represents,
+ * as a value between 0 and 1. For example if the whole range is from 0 to
+ * 200, then a position of 40 gives proportion = 0.2.
+ *
+ * @see http://www.javalobby.org/java/forums/t33050.html#91885334
+ *
+ * @param scroll
+ * @return
+ */
+ public static float getScrollBarProportion(JScrollBar scroll)
+ {
+ /*
+ * The extent (scroll handle width) deduction gives the true operating range
+ * of possible positions.
+ */
+ int possibleRange = scroll.getMaximum() - scroll.getMinimum()
+ - scroll.getModel().getExtent();
+ float valueInRange = scroll.getValue()
+ - (scroll.getModel().getExtent() / 2f);
+ float proportion = valueInRange / possibleRange;
+ return proportion;
+ }
+
+ /**
+ * Returns the scroll bar position in its range that would match the given
+ * proportion (between 0 and 1) of the whole. For example if the whole range
+ * is from 0 to 200, then a proportion of 0.25 gives position 50.
+ *
+ * @param scrollbar
+ * @param proportion
+ * @return
+ */
+ public static int getScrollValueForProportion(JScrollBar scrollbar,
+ float proportion)
+ {
+ /*
+ * The extent (scroll handle width) deduction gives the true operating range
+ * of possible positions.
+ */
+ float fraction = proportion
+ * (scrollbar.getMaximum() - scrollbar.getMinimum() - scrollbar
+ .getModel().getExtent())
+ + (scrollbar.getModel().getExtent() / 2f);
+ return Math.min(Math.round(fraction), scrollbar.getMaximum());
+ }
+
+ public static void jvInitComponent(AbstractButton comp, String i18nString)
+ {
+ setColorAndFont(comp);
+ if (i18nString != null && !i18nString.isEmpty())
+ {
+ comp.setText(MessageManager.getString(i18nString));
+ }
+ }
+
+ public static void jvInitComponent(JComponent comp)
+ {
+ setColorAndFont(comp);
+ }
+
+ private static void setColorAndFont(JComponent comp)
+ {
+ comp.setBackground(Color.white);
+ comp.setFont(JvSwingUtils.getLabelFont());
+ }
+
}
diff --git a/src/jalview/gui/MenuChooser.java b/src/jalview/gui/MenuChooser.java
new file mode 100644
index 0000000..4810279
--- /dev/null
+++ b/src/jalview/gui/MenuChooser.java
@@ -0,0 +1,99 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+public class MenuChooser implements ActionListener
+{
+ public static boolean protein;
+
+ private JFrame choosemenu = new JFrame("Animation");
+
+ private JButton bouton = new JButton("bouton 1");
+
+ private JButton bouton2 = new JButton("bouton 2");
+
+ private JPanel container = new JPanel();
+
+ private JLabel label = new JLabel("Le JLabel");
+
+ public MenuChooser()
+ {
+
+ choosemenu.setSize(300, 300);
+ choosemenu.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ choosemenu.setLocationRelativeTo(null);
+
+ container.setBackground(Color.white);
+ container.setLayout(new BorderLayout());
+
+ // On ajoute notre Fenetre à la liste des auditeurs de notre Bouton
+ bouton.addActionListener(this);
+ bouton2.addActionListener(this);
+
+ JPanel south = new JPanel();
+ south.add(bouton);
+ south.add(bouton2);
+ container.add(south, BorderLayout.SOUTH);
+
+ // On change la couleur de police
+ label.setForeground(Color.blue);
+ // Et on change l'alignement du texte grâce aux attributs static de la
+ // classe JLabel
+ label.setHorizontalAlignment(JLabel.CENTER);
+
+ container.add(label, BorderLayout.NORTH);
+
+ choosemenu.setContentPane(container);
+ choosemenu.setVisible(true);
+
+ }
+
+ // ...
+
+ // *******************************************************************************
+ // LA VOILAAAAAAAAAAAAAA
+ // *******************************************************************************
+ /**
+ * C'est la méthode qui sera appelée lors d'un clic sur notre bouton
+ */
+ public void actionPerformed(ActionEvent arg0)
+ {
+
+ if (arg0.getSource() == bouton)
+ protein = false;
+ label.setText("RNA menu");
+
+ if (arg0.getSource() == bouton2)
+ label.setText("Protein menu");
+ protein = true;
+ }
+
+}
diff --git a/src/jalview/gui/OOMWarning.java b/src/jalview/gui/OOMWarning.java
index b14ac14..e37dd07 100644
--- a/src/jalview/gui/OOMWarning.java
+++ b/src/jalview/gui/OOMWarning.java
@@ -1,88 +1,89 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.gui;
-
-import java.awt.Component;
-
-public class OOMWarning implements Runnable
-{
- String action = null;
-
- String instructions = "";
-
- public static boolean oomInprogress = false;
-
- Component desktop = null;
-
- /**
- * Raise an out of memory error.
- *
- * @param action
- * - what was going on when OutOfMemory exception occured.
- * @param instance
- * - Window where the dialog will appear
- * @param oomex
- * - the actual exception - to be written to stderr or debugger.
- */
- OOMWarning(final String action, final OutOfMemoryError oomex,
- final Component instance)
- {
- if (!oomInprogress)
- {
- oomInprogress = true;
- this.action = action;
- desktop = instance;
- if (oomex != null)
- {
- if (jalview.bin.Cache.log != null)
- {
- jalview.bin.Cache.log
- .error("Out of Memory when " + action, oomex);
- }
- else
- {
- System.err.println("Out of Memory when " + action);
- oomex.printStackTrace();
- }
- }
- javax.swing.SwingUtilities.invokeLater(this);
- System.gc();
- }
- }
-
- public OOMWarning(String string, OutOfMemoryError oomerror)
- {
- this(string, oomerror, Desktop.desktop);
- }
-
- public void run()
- {
- javax.swing.JOptionPane
- .showInternalMessageDialog(
- desktop,
- "Out of memory when "
- + action
- + "!!"
- + "\nSee help files for increasing Java Virtual Machine memory.",
- "Out of memory",
- javax.swing.JOptionPane.WARNING_MESSAGE);
- // hope that there's enough memory left that no more appear.
- oomInprogress = false;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.util.MessageManager;
+
+import java.awt.Component;
+
+public class OOMWarning implements Runnable
+{
+ String action = null;
+
+ String instructions = "";
+
+ public static boolean oomInprogress = false;
+
+ Component desktop = null;
+
+ /**
+ * Raise an out of memory error.
+ *
+ * @param action
+ * - what was going on when OutOfMemory exception occured.
+ * @param instance
+ * - Window where the dialog will appear
+ * @param oomex
+ * - the actual exception - to be written to stderr or debugger.
+ */
+ OOMWarning(final String action, final OutOfMemoryError oomex,
+ final Component instance)
+ {
+ if (!oomInprogress)
+ {
+ oomInprogress = true;
+ this.action = action;
+ desktop = instance;
+ if (oomex != null)
+ {
+ if (jalview.bin.Cache.log != null)
+ {
+ jalview.bin.Cache.log
+ .error("Out of Memory when " + action, oomex);
+ }
+ else
+ {
+ System.err.println("Out of Memory when " + action);
+ oomex.printStackTrace();
+ }
+ }
+ javax.swing.SwingUtilities.invokeLater(this);
+ System.gc();
+ }
+ }
+
+ public OOMWarning(String string, OutOfMemoryError oomerror)
+ {
+ this(string, oomerror, Desktop.desktop);
+ }
+
+ public void run()
+ {
+ javax.swing.JOptionPane.showInternalMessageDialog(desktop,
+ MessageManager.formatMessage("warn.out_of_memory_when_action",
+ new String[] { action }), MessageManager
+ .getString("label.out_of_memory"),
+ javax.swing.JOptionPane.WARNING_MESSAGE);
+ // hope that there's enough memory left that no more appear.
+ oomInprogress = false;
+ }
+
+}
diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java
index 106c3b7..d2efc7e 100644
--- a/src/jalview/gui/OptsAndParamsPage.java
+++ b/src/jalview/gui/OptsAndParamsPage.java
@@ -1,22 +1,26 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
+import jalview.util.MessageManager;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.OptionI;
import jalview.ws.params.ParameterI;
@@ -37,7 +41,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Hashtable;
import java.util.List;
import java.util.Map;
@@ -107,32 +110,32 @@ public class OptsAndParamsPage
{
hasLink = true;
- enabled.setToolTipText("<html>"
- + JvSwingUtils
- .wrapTooltip(((desc == null) ? "see further details by right-clicking"
+ enabled.setToolTipText(JvSwingUtils
+ .wrapTooltip(
+ true,
+ ((desc == null || desc.trim().length() == 0) ? MessageManager
+ .getString("label.opt_and_params_further_details ")
: desc)
- + "<br><img src=\"" + linkImageURL + "\"/>")
- + "</html>");
+ + "<br><img src=\"" + linkImageURL + "\"/>"));
enabled.addMouseListener(this);
}
else
{
- if (desc != null)
+ if (desc != null && desc.trim().length() > 0)
{
- enabled.setToolTipText("<html>"
- + JvSwingUtils.wrapTooltip(opt.getDescription())
- + "</html>");
+ enabled.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ opt.getDescription()));
}
}
add(enabled, BorderLayout.NORTH);
+ for (Object str : opt.getPossibleValues())
+ {
+ val.addItem((String) str);
+ }
+ val.setSelectedItem((String) opt.getValue());
if (opt.getPossibleValues().size() > 1)
{
setLayout(new GridLayout(1, 2));
- for (Object str : opt.getPossibleValues())
- {
- val.addItem((String) str);
- }
- val.setSelectedItem((String) opt.getValue());
val.addActionListener(this);
add(val, BorderLayout.SOUTH);
}
@@ -169,7 +172,8 @@ public class OptsAndParamsPage
}
else
{
- notmod &= initVal == null;
+ notmod &= (initVal != null) ? initVal.equals(val.getSelectedItem())
+ : val.getSelectedItem() != initVal;
}
poparent.argSetModified(this, !notmod);
}
@@ -181,11 +185,24 @@ public class OptsAndParamsPage
return null;
}
OptionI opt = option.copy();
-
+ if (opt.getPossibleValues() != null
+ && opt.getPossibleValues().size() == 1)
+ {
+ // Hack to make sure the default value for an enabled option with only
+ // one value is actually returned
+ opt.setValue(opt.getPossibleValues().get(0));
+ }
if (val.getSelectedItem() != null)
{
opt.setValue((String) val.getSelectedItem());
}
+ else
+ {
+ if (option.getValue() != null)
+ {
+ opt.setValue(option.getValue());
+ }
+ }
return opt;
}
@@ -221,10 +238,11 @@ public class OptsAndParamsPage
}
- public void resetToDefault()
+ public void resetToDefault(boolean setDefaultParams)
{
enabled.setSelected(false);
- if (option.isRequired())
+ if (option.isRequired()
+ || (setDefaultParams && option.getValue() != null))
{
// Apply default value
selectOption(option, option.getValue());
@@ -241,7 +259,7 @@ public class OptsAndParamsPage
}
else
{
- initVal = (initEnabled) ? option.getValue() : null;
+ initVal = (initEnabled) ? (String) val.getSelectedItem() : null;
}
}
@@ -301,7 +319,7 @@ public class OptsAndParamsPage
choice = true;
}
}
-
+
if (!compact)
{
makeExpanderParam(parm);
@@ -315,9 +333,9 @@ public class OptsAndParamsPage
private void makeCompactParam(ParameterI parm)
{
- setLayout(new MigLayout("","[][grow]"));
+ setLayout(new MigLayout("", "[][grow]"));
- String ttipText=null;
+ String ttipText = null;
controlPanel.setLayout(new BorderLayout());
@@ -325,15 +343,20 @@ public class OptsAndParamsPage
&& parm.getDescription().trim().length() > 0)
{
// Only create description boxes if there actually is a description.
- ttipText = ("<html>"
- + JvSwingUtils
- .wrapTooltip(parm.getDescription()+(finfo!=null ?"<br><img src=\""
- + linkImageURL
- + "\"/> Right click for further information.":""))
- + "</html>");
- }
-
- JvSwingUtils.mgAddtoLayout(this, ttipText, new JLabel(parm.getName()),controlPanel, "");
+ ttipText = (JvSwingUtils
+ .wrapTooltip(
+ true,
+ parm.getDescription()
+ + (finfo != null ? "<br><img src=\""
+ + linkImageURL
+ + "\"/>"
+ + MessageManager
+ .getString("label.opt_and_params_further_detail")
+ : "")));
+ }
+
+ JvSwingUtils.mgAddtoLayout(this, ttipText,
+ new JLabel(parm.getName()), controlPanel, "");
updateControls(parm);
validate();
}
@@ -370,20 +393,21 @@ public class OptsAndParamsPage
// Only create description boxes if there actually is a description.
if (finfo != null)
{
- showDesc.setToolTipText("<html>"
- + JvSwingUtils
- .wrapTooltip("Click to show brief description<br><img src=\""
- + linkImageURL
- + "\"/> Right click for further information.")
- + "</html>");
+ showDesc.setToolTipText(JvSwingUtils.wrapTooltip(
+ true,
+ MessageManager
+ .formatMessage(
+ "label.opt_and_params_show_brief_desc_image_link",
+ new String[] { linkImageURL
+ .toExternalForm() })));
showDesc.addMouseListener(this);
}
else
{
- showDesc.setToolTipText("<html>"
- + JvSwingUtils
- .wrapTooltip("Click to show brief description.")
- + "</html>");
+ showDesc.setToolTipText(JvSwingUtils.wrapTooltip(
+ true,
+ MessageManager
+ .getString("label.opt_and_params_show_brief_desc")));
}
showDesc.addActionListener(new ActionListener()
{
@@ -566,21 +590,24 @@ public class OptsAndParamsPage
valueField.addActionListener(this);
valueField.addKeyListener(new KeyListener()
{
-
+
@Override
public void keyTyped(KeyEvent e)
{
}
-
+
@Override
public void keyReleased(KeyEvent e)
{
- if (valueField.getText().trim().length()>0)
+ if (e.isActionKey())
+ {
+ if (valueField.getText().trim().length() > 0)
{
- actionPerformed(null);
+ actionPerformed(null);
}
+ }
}
-
+
@Override
public void keyPressed(KeyEvent e)
{
@@ -651,24 +678,26 @@ public class OptsAndParamsPage
{
}
;
+ // update value field to reflect any bound checking we performed.
+ valueField.setText("" + iVal);
if (validator.getMin() != null && validator.getMax() != null)
{
slider.getModel().setRangeProperties(iVal, 1,
validator.getMin().intValue(),
- validator.getMax().intValue(), true);
+ validator.getMax().intValue() + 1, true);
}
else
{
slider.setVisible(false);
}
- return new int[]
- { iVal };
+ return new int[] { iVal };
}
else
{
fVal = 0f;
try
{
+ valueField.setText(valueField.getText().trim());
fVal = Float.valueOf(valueField.getText());
if (validator.getMin() != null
&& validator.getMin().floatValue() > fVal)
@@ -676,6 +705,8 @@ public class OptsAndParamsPage
fVal = validator.getMin().floatValue();
// TODO: provide visual indication that hard limit was reached for
// this parameter
+ // update value field to reflect any bound checking we performed.
+ valueField.setText("" + fVal);
}
if (validator.getMax() != null
&& validator.getMax().floatValue() < fVal)
@@ -683,6 +714,8 @@ public class OptsAndParamsPage
fVal = validator.getMax().floatValue();
// TODO: provide visual indication that hard limit was reached for
// this parameter
+ // update value field to reflect any bound checking we performed.
+ valueField.setText("" + fVal);
}
} catch (Exception e)
{
@@ -690,16 +723,16 @@ public class OptsAndParamsPage
;
if (validator.getMin() != null && validator.getMax() != null)
{
- slider.getModel().setRangeProperties((int) fVal * 1000, 1,
- (int) validator.getMin().floatValue() * 1000,
- (int) validator.getMax().floatValue() * 1000, true);
+ slider.getModel().setRangeProperties((int) (fVal * 1000f), 1,
+ (int) (validator.getMin().floatValue() * 1000f),
+ 1 + (int) (validator.getMax().floatValue() * 1000f),
+ true);
}
else
{
slider.setVisible(false);
}
- return new float[]
- { fVal };
+ return new float[] { fVal };
}
}
else
@@ -707,13 +740,11 @@ public class OptsAndParamsPage
if (!choice)
{
slider.setVisible(false);
- return new String[]
- { valueField.getText().trim() };
+ return new String[] { valueField.getText().trim() };
}
else
{
- return new String[]
- { (String) choicebox.getSelectedItem() };
+ return new String[] { (String) choicebox.getSelectedItem() };
}
}
@@ -728,12 +759,14 @@ public class OptsAndParamsPage
public OptsAndParamsPage(OptsParametersContainerI paramContainer)
{
- this(paramContainer,false);
+ this(paramContainer, false);
}
- public OptsAndParamsPage(OptsParametersContainerI paramContainer, boolean compact)
+
+ public OptsAndParamsPage(OptsParametersContainerI paramContainer,
+ boolean compact)
{
poparent = paramContainer;
- this.compact=compact;
+ this.compact = compact;
}
public static void showUrlPopUp(JComponent invoker, final String finfo,
@@ -741,7 +774,8 @@ public class OptsAndParamsPage
{
JPopupMenu mnu = new JPopupMenu();
- JMenuItem mitem = new JMenuItem("View " + finfo);
+ JMenuItem mitem = new JMenuItem(MessageManager.formatMessage(
+ "label.view_params", new String[] { finfo }));
mitem.addActionListener(new ActionListener()
{
@@ -758,9 +792,9 @@ public class OptsAndParamsPage
URL linkImageURL = getClass().getResource("/images/link.gif");
- Map<String, OptionBox> optSet = new Hashtable<String, OptionBox>();
+ Map<String, OptionBox> optSet = new java.util.LinkedHashMap<String, OptionBox>();
- Map<String, ParamBox> paramSet = new Hashtable<String, ParamBox>();
+ Map<String, ParamBox> paramSet = new java.util.LinkedHashMap<String, ParamBox>();
public Map<String, OptionBox> getOptSet()
{
@@ -827,7 +861,9 @@ public class OptsAndParamsPage
}
else
{
- throw new Error("Invalid value " + string + " for option " + option);
+ throw new Error(MessageManager.formatMessage(
+ "error.invalid_value_for_option", new String[] { string,
+ option.getName() }));
}
}
diff --git a/src/jalview/gui/OptsParametersContainerI.java b/src/jalview/gui/OptsParametersContainerI.java
index 64e3d29..16b57e6 100644
--- a/src/jalview/gui/OptsParametersContainerI.java
+++ b/src/jalview/gui/OptsParametersContainerI.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
-import jalview.gui.OptsAndParamsPage.ParamBox;
-import jalview.gui.OptsAndParamsPage.OptionBox;
-
public interface OptsParametersContainerI
{
diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java
index f8299bf..9397ceb 100644
--- a/src/jalview/gui/OverviewPanel.java
+++ b/src/jalview/gui/OverviewPanel.java
@@ -1,26 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import javax.swing.*;
+import jalview.renderer.AnnotationRenderer;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionAdapter;
+import java.awt.image.BufferedImage;
+
+import javax.swing.JPanel;
/**
* DOCUMENT ME!
@@ -36,6 +48,8 @@ public class OverviewPanel extends JPanel implements Runnable
AlignmentPanel ap;
+ final AnnotationRenderer renderer = new AnnotationRenderer();
+
float scalew = 1f;
float scaleh = 1f;
@@ -60,7 +74,7 @@ public class OverviewPanel extends JPanel implements Runnable
// main visible SeqCanvas
SequenceRenderer sr;
- FeatureRenderer fr;
+ jalview.renderer.seqfeatures.FeatureRenderer fr;
/**
* Creates a new OverviewPanel object.
@@ -80,15 +94,15 @@ public class OverviewPanel extends JPanel implements Runnable
fr = new FeatureRenderer(ap);
// scale the initial size of overviewpanel to shape of alignment
- float initialScale = (float) av.alignment.getWidth()
- / (float) av.alignment.getHeight();
+ float initialScale = (float) av.getAlignment().getWidth()
+ / (float) av.getAlignment().getHeight();
- if (av.conservation == null)
+ if (av.getAlignmentConservationAnnotation() == null)
{
graphHeight = 0;
}
- if (av.alignment.getWidth() > av.alignment.getHeight())
+ if (av.getAlignment().getWidth() > av.getAlignment().getHeight())
{
// wider
width = 400;
@@ -112,6 +126,7 @@ public class OverviewPanel extends JPanel implements Runnable
addComponentListener(new ComponentAdapter()
{
+ @Override
public void componentResized(ComponentEvent evt)
{
if ((getWidth() != width)
@@ -124,9 +139,10 @@ public class OverviewPanel extends JPanel implements Runnable
addMouseMotionListener(new MouseMotionAdapter()
{
+ @Override
public void mouseDragged(MouseEvent evt)
{
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
// TODO: feature: jv2.5 detect shift drag and update selection from
// it.
@@ -139,9 +155,10 @@ public class OverviewPanel extends JPanel implements Runnable
addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent evt)
{
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
boxX = evt.getX();
boxY = evt.getY();
@@ -175,7 +192,7 @@ public class OverviewPanel extends JPanel implements Runnable
if (boxX > (width - boxWidth))
{
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
// Try smallest possible box
boxWidth = (int) ((av.endRes - av.startRes + 1) * av.getCharWidth() * scalew);
@@ -186,7 +203,7 @@ public class OverviewPanel extends JPanel implements Runnable
int col = (int) (boxX / scalew / av.getCharWidth());
int row = (int) (boxY / scaleh / av.getCharHeight());
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
if (!av.getColumnSelection().isVisible(col))
{
@@ -196,10 +213,10 @@ public class OverviewPanel extends JPanel implements Runnable
col = av.getColumnSelection().findColumnPosition(col);
}
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(
- row);
+ row = av.getAlignment().getHiddenSequences()
+ .findIndexWithoutHiddenSeqs(row);
}
ap.setScrollValues(col, row);
@@ -239,18 +256,19 @@ public class OverviewPanel extends JPanel implements Runnable
/**
* DOCUMENT ME!
*/
+ @Override
public void run()
{
miniMe = null;
- if (av.showSequenceFeatures)
+ if (av.isShowSequenceFeatures())
{
- fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer());
+ fr.transferSettings(ap.getSeqPanel().seqCanvas.getFeatureRenderer());
}
- int alwidth = av.alignment.getWidth();
- int alheight = av.alignment.getHeight()
- + av.alignment.getHiddenSequences().getSize();
+ int alwidth = av.getAlignment().getWidth();
+ int alheight = av.getAlignment().getHeight()
+ + av.getAlignment().getHiddenSequences().getSize();
setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));
@@ -274,6 +292,8 @@ public class OverviewPanel extends JPanel implements Runnable
int color = Color.white.getRGB();
int row, col;
jalview.datamodel.SequenceI seq;
+ final boolean hasHiddenRows = av.hasHiddenRows(), hasHiddenCols = av
+ .hasHiddenColumns();
boolean hiddenRow = false;
for (row = 0; row < sequencesHeight; row++)
{
@@ -291,15 +311,16 @@ public class OverviewPanel extends JPanel implements Runnable
lastrow = (int) (row * sampleRow);
hiddenRow = false;
- if (av.hasHiddenRows)
+ if (hasHiddenRows)
{
- seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);
+ seq = av.getAlignment().getHiddenSequences()
+ .getHiddenSequence(lastrow);
if (seq == null)
{
- int index = av.alignment.getHiddenSequences()
+ int index = av.getAlignment().getHiddenSequences()
.findIndexWithoutHiddenSeqs(lastrow);
- seq = av.alignment.getSequenceAt(index);
+ seq = av.getAlignment().getSequenceAt(index);
}
else
{
@@ -308,7 +329,7 @@ public class OverviewPanel extends JPanel implements Runnable
}
else
{
- seq = av.alignment.getSequenceAt(lastrow);
+ seq = av.getAlignment().getSequenceAt(lastrow);
}
if (seq == null)
@@ -332,7 +353,7 @@ public class OverviewPanel extends JPanel implements Runnable
{
color = sr.getResidueBoxColour(seq, lastcol).getRGB();
- if (av.showSequenceFeatures)
+ if (av.isShowSequenceFeatures())
{
color = fr.findFeatureColour(color, seq, lastcol);
}
@@ -343,8 +364,8 @@ public class OverviewPanel extends JPanel implements Runnable
}
if (hiddenRow
- || (av.hasHiddenColumns && !av.getColumnSelection()
- .isVisible(lastcol)))
+ || (hasHiddenCols && !av.getColumnSelection().isVisible(
+ lastcol)))
{
color = new Color(color).darker().darker().getRGB();
}
@@ -354,14 +375,16 @@ public class OverviewPanel extends JPanel implements Runnable
}
}
- if (av.conservation != null)
+ if (av.getAlignmentConservationAnnotation() != null)
{
+ renderer.updateFromAlignViewport(av);
for (col = 0; col < width; col++)
{
lastcol = (int) (col * sampleCol);
{
mg.translate(col, sequencesHeight);
- ap.annotationPanel.drawGraph(mg, av.conservation,
+ renderer.drawGraph(mg, av.getAlignmentConservationAnnotation(),
+ av.getAlignmentConservationAnnotation().annotations,
(int) (sampleCol) + 1, graphHeight,
(int) (col * sampleCol), (int) (col * sampleCol) + 1);
mg.translate(-col, -sequencesHeight);
@@ -386,14 +409,15 @@ public class OverviewPanel extends JPanel implements Runnable
*/
public void setBoxPosition()
{
- int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();
- int fullsizeHeight = (av.alignment.getHeight() + av.alignment
- .getHiddenSequences().getSize()) * av.getCharHeight();
+ int fullsizeWidth = av.getAlignment().getWidth() * av.getCharWidth();
+ int fullsizeHeight = (av.getAlignment().getHeight() + av.getAlignment()
+ .getHiddenSequences().getSize())
+ * av.getCharHeight();
int startRes = av.getStartRes();
int endRes = av.getEndRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);
endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);
@@ -402,12 +426,12 @@ public class OverviewPanel extends JPanel implements Runnable
int startSeq = av.startSeq;
int endSeq = av.endSeq;
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- startSeq = av.alignment.getHiddenSequences().adjustForHiddenSeqs(
- startSeq);
+ startSeq = av.getAlignment().getHiddenSequences()
+ .adjustForHiddenSeqs(startSeq);
- endSeq = av.alignment.getHiddenSequences()
+ endSeq = av.getAlignment().getHiddenSequences()
.adjustForHiddenSeqs(endSeq);
}
@@ -418,7 +442,7 @@ public class OverviewPanel extends JPanel implements Runnable
boxX = (int) (startRes * av.getCharWidth() * scalew);
boxY = (int) (startSeq * av.getCharHeight() * scaleh);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
boxWidth = (int) ((endRes - startRes + 1) * av.getCharWidth() * scalew);
}
@@ -438,6 +462,7 @@ public class OverviewPanel extends JPanel implements Runnable
* @param g
* DOCUMENT ME!
*/
+ @Override
public void paintComponent(Graphics g)
{
if (resizing)
diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java
index ac37106..57a14a0 100644
--- a/src/jalview/gui/PCAPanel.java
+++ b/src/jalview/gui/PCAPanel.java
@@ -1,32 +1,52 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.print.*;
-import javax.swing.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.jbgui.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SeqCigar;
+import jalview.datamodel.SequenceI;
+import jalview.jbgui.GPCAPanel;
+import jalview.schemes.ResidueProperties;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.viewmodel.PCAModel;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JColorChooser;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JRadioButtonMenuItem;
/**
* DOCUMENT ME!
@@ -34,22 +54,21 @@ import jalview.jbgui.*;
* @author $author$
* @version $Revision$
*/
-public class PCAPanel extends GPCAPanel implements Runnable
+public class PCAPanel extends GPCAPanel implements Runnable,
+ IProgressIndicator
{
- PCA pca;
-
- int top;
+ private IProgressIndicator progressBar;
RotatableCanvas rc;
AlignmentPanel ap;
- AlignViewport av;
+ AlignmentViewport av;
- AlignmentView seqstrings;
+ PCAModel pcaModel;
- SequenceI[] seqs;
+ int top = 0;
/**
* Creates a new PCAPanel object.
@@ -64,16 +83,21 @@ public class PCAPanel extends GPCAPanel implements Runnable
this.av = ap.av;
this.ap = ap;
- boolean sameLength = true;
+ progressBar = new ProgressBar(statusPanel, statusBar);
- seqstrings = av.getAlignmentView(av.getSelectionGroup() != null);
- if (av.getSelectionGroup() == null)
+ boolean sameLength = true;
+ boolean selected = av.getSelectionGroup() != null
+ && av.getSelectionGroup().getSize() > 0;
+ AlignmentView seqstrings = av.getAlignmentView(selected);
+ boolean nucleotide = av.getAlignment().isNucleotide();
+ SequenceI[] seqs;
+ if (!selected)
{
- seqs = av.alignment.getSequencesArray();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
}
SeqCigar sq[] = seqstrings.getSequences();
int length = sq[0].getWidth();
@@ -89,19 +113,14 @@ public class PCAPanel extends GPCAPanel implements Runnable
if (!sameLength)
{
- JOptionPane
- .showMessageDialog(
- Desktop.desktop,
- "The sequences must be aligned before calculating PCA.\n"
- + "Try using the Pad function in the edit menu,\n"
- + "or one of the multiple sequence alignment web services.",
- "Sequences not aligned", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.pca_sequences_not_aligned"),
+ MessageManager.getString("label.sequences_not_aligned"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
-
- Desktop.addInternalFrame(this, "Principal component analysis", 400, 400);
-
+ pcaModel = new PCAModel(seqstrings, seqs, nucleotide);
PaintRefresher.Register(this, av.getSequenceSetId());
rc = new RotatableCanvas(ap);
@@ -110,9 +129,48 @@ public class PCAPanel extends GPCAPanel implements Runnable
worker.start();
}
+ @Override
+ protected void scoreMatrix_menuSelected()
+ {
+ scoreMatrixMenu.removeAll();
+ for (final String sm : ResidueProperties.scoreMatrices.keySet())
+ {
+ if (ResidueProperties.getScoreMatrix(sm) != null)
+ {
+ // create an entry for this score matrix for use in PCA
+ JCheckBoxMenuItem jm = new JCheckBoxMenuItem();
+ jm.setText(MessageManager
+ .getStringOrReturn("label.score_model", sm));
+ jm.setSelected(pcaModel.getScore_matrix().equals(sm));
+ if ((ResidueProperties.scoreMatrices.get(sm).isDNA() && ResidueProperties.scoreMatrices
+ .get(sm).isProtein())
+ || pcaModel.isNucleotide() == ResidueProperties.scoreMatrices
+ .get(sm).isDNA())
+ {
+ final PCAPanel us = this;
+ jm.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ if (!pcaModel.getScore_matrix().equals(sm))
+ {
+ pcaModel.setScore_matrix(sm);
+ Thread worker = new Thread(us);
+ worker.start();
+ }
+ }
+ });
+ scoreMatrixMenu.add(jm);
+ }
+ }
+ }
+ }
+
public void bgcolour_actionPerformed(ActionEvent e)
{
- Color col = JColorChooser.showDialog(this, "Select Background Colour",
+ Color col = JColorChooser.showDialog(this,
+ MessageManager.getString("label.select_backgroud_colour"),
rc.bgColour);
if (col != null)
@@ -127,56 +185,81 @@ public class PCAPanel extends GPCAPanel implements Runnable
*/
public void run()
{
+ long progId = System.currentTimeMillis();
+ IProgressIndicator progress = this;
+ String message = MessageManager.getString("label.pca_recalculating");
+ if (getParent() == null)
+ {
+ progress = ap.alignFrame;
+ message = MessageManager.getString("label.pca_calculating");
+ }
+ progress.setProgressBar(message, progId);
try
{
- pca = new PCA(seqstrings.getSequenceStrings(' '));
- pca.run();
-
- // Now find the component coordinates
- int ii = 0;
-
- while ((ii < seqs.length) && (seqs[ii] != null))
- {
- ii++;
- }
-
- double[][] comps = new double[ii][ii];
-
- for (int i = 0; i < ii; i++)
- {
- if (pca.getEigenvalue(i) > 1e-4)
- {
- comps[i] = pca.component(i);
- }
- }
-
+ calcSettings.setEnabled(false);
+ pcaModel.run();
// ////////////////
xCombobox.setSelectedIndex(0);
yCombobox.setSelectedIndex(1);
zCombobox.setSelectedIndex(2);
- top = pca.getM().rows - 1;
+ pcaModel.updateRc(rc);
+ // rc.invalidate();
+ nuclSetting.setSelected(pcaModel.isNucleotide());
+ protSetting.setSelected(!pcaModel.isNucleotide());
+ jvVersionSetting.setSelected(pcaModel.isJvCalcMode());
+ top = pcaModel.getTop();
- Vector points = new Vector();
- float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100);
+ } catch (OutOfMemoryError er)
+ {
+ new OOMWarning("calculating PCA", er);
+ return;
+ } finally
+ {
+ progress.setProgressBar("", progId);
+ }
+ calcSettings.setEnabled(true);
+ repaint();
+ if (getParent() == null)
+ {
+ addKeyListener(rc);
+ Desktop.addInternalFrame(this, MessageManager
+ .getString("label.principal_component_analysis"), 475, 450);
+ }
+ }
- for (int i = 0; i < pca.getM().rows; i++)
- {
- SequencePoint sp = new SequencePoint(seqs[i], scores[i]);
- points.addElement(sp);
- }
+ @Override
+ protected void nuclSetting_actionPerfomed(ActionEvent arg0)
+ {
+ if (!pcaModel.isNucleotide())
+ {
+ pcaModel.setNucleotide(true);
+ pcaModel.setScore_matrix("DNA");
+ Thread worker = new Thread(this);
+ worker.start();
+ }
- rc.setPoints(points, pca.getM().rows);
- rc.repaint();
+ }
- addKeyListener(rc);
+ @Override
+ protected void protSetting_actionPerfomed(ActionEvent arg0)
+ {
- } catch (OutOfMemoryError er)
+ if (pcaModel.isNucleotide())
{
- new OOMWarning("calculating PCA", er);
-
+ pcaModel.setNucleotide(false);
+ pcaModel.setScore_matrix("BLOSUM62");
+ Thread worker = new Thread(this);
+ worker.start();
}
+ }
+ @Override
+ protected void jvVersionSetting_actionPerfomed(ActionEvent arg0)
+ {
+ pcaModel.setJvCalcMode(jvVersionSetting.isSelected());
+ Thread worker = new Thread(this);
+ worker.start();
}
/**
@@ -192,14 +275,7 @@ public class PCAPanel extends GPCAPanel implements Runnable
int dim1 = top - xCombobox.getSelectedIndex();
int dim2 = top - yCombobox.getSelectedIndex();
int dim3 = top - zCombobox.getSelectedIndex();
-
- float[][] scores = pca.getComponents(dim1, dim2, dim3, 100);
-
- for (int i = 0; i < pca.getM().rows; i++)
- {
- ((SequencePoint) rc.points.elementAt(i)).coord = scores[i];
- }
-
+ pcaModel.updateRcView(dim1, dim2, dim3);
rc.img = null;
rc.rotmat.setIdentity();
rc.initAxes();
@@ -244,8 +320,9 @@ public class PCAPanel extends GPCAPanel implements Runnable
CutAndPasteTransfer cap = new CutAndPasteTransfer();
try
{
- cap.setText(pca.getDetails());
- Desktop.addInternalFrame(cap, "PCA details", 500, 500);
+ cap.setText(pcaModel.getDetails());
+ Desktop.addInternalFrame(cap,
+ MessageManager.getString("label.pca_details"), 500, 500);
} catch (OutOfMemoryError oom)
{
new OOMWarning("opening PCA details", oom);
@@ -268,7 +345,7 @@ public class PCAPanel extends GPCAPanel implements Runnable
{
// this was cut'n'pasted from the equivalent TreePanel method - we should
// make this an abstract function of all jalview analysis windows
- if (seqstrings == null)
+ if (pcaModel.getSeqtrings() == null)
{
jalview.bin.Cache.log
.info("Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action.");
@@ -290,7 +367,8 @@ public class PCAPanel extends GPCAPanel implements Runnable
{
}
;
- Object[] alAndColsel = seqstrings.getAlignmentAndColumnSelection(gc);
+ Object[] alAndColsel = pcaModel.getSeqtrings()
+ .getAlignmentAndColumnSelection(gc);
if (alAndColsel != null && alAndColsel[0] != null)
{
@@ -318,8 +396,10 @@ public class PCAPanel extends GPCAPanel implements Runnable
// af.addSortByOrderMenuItem(ServiceName + " Ordering",
// msaorder);
- Desktop.addInternalFrame(af, "Original Data for " + this.title,
- AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ Desktop.addInternalFrame(af, MessageManager.formatMessage(
+ "label.original_data_for_params",
+ new String[] { this.title }), AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
}
}
/*
@@ -384,7 +464,7 @@ public class PCAPanel extends GPCAPanel implements Runnable
*/
public void eps_actionPerformed(ActionEvent e)
{
- makePCAImage(jalview.util.ImageMaker.EPS);
+ makePCAImage(jalview.util.ImageMaker.TYPE.EPS);
}
/**
@@ -395,26 +475,34 @@ public class PCAPanel extends GPCAPanel implements Runnable
*/
public void png_actionPerformed(ActionEvent e)
{
- makePCAImage(jalview.util.ImageMaker.PNG);
+ makePCAImage(jalview.util.ImageMaker.TYPE.PNG);
}
- void makePCAImage(int type)
+ void makePCAImage(jalview.util.ImageMaker.TYPE type)
{
int width = rc.getWidth();
int height = rc.getHeight();
jalview.util.ImageMaker im;
- if (type == jalview.util.ImageMaker.PNG)
+ if (type == jalview.util.ImageMaker.TYPE.PNG)
+ {
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from PCA",
+ width, height, null, null);
+ }
+ else if (type == jalview.util.ImageMaker.TYPE.EPS)
{
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.PNG,
- "Make PNG image from PCA", width, height, null, null);
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from PCA",
+ width, height, null, this.getTitle());
}
else
{
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.EPS,
- "Make EPS file from PCA", width, height, null,
- this.getTitle());
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
+ width, height, null, this.getTitle());
+
}
if (im.getGraphics() != null)
@@ -504,8 +592,12 @@ public class PCAPanel extends GPCAPanel implements Runnable
CutAndPasteTransfer cap = new CutAndPasteTransfer();
try
{
- cap.setText(getPointsasCsv(false));
- Desktop.addInternalFrame(cap, "Points for " + getTitle(), 500, 500);
+ cap.setText(pcaModel.getPointsasCsv(false,
+ xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(),
+ zCombobox.getSelectedIndex()));
+ Desktop.addInternalFrame(cap, MessageManager.formatMessage(
+ "label.points_for_params", new String[] { this.getTitle() }),
+ 500, 500);
} catch (OutOfMemoryError oom)
{
new OOMWarning("exporting PCA points", oom);
@@ -513,56 +605,6 @@ public class PCAPanel extends GPCAPanel implements Runnable
}
}
- private String getPointsasCsv(boolean transformed)
- {
- StringBuffer csv = new StringBuffer();
- csv.append("\"Sequence\"");
- if (transformed)
- {
- csv.append(",");
- csv.append(xCombobox.getSelectedIndex());
- csv.append(",");
- csv.append(yCombobox.getSelectedIndex());
- csv.append(",");
- csv.append(zCombobox.getSelectedIndex());
- }
- else
- {
- for (int d = 1, dmax = pca.component(1).length; d <= dmax; d++)
- {
- csv.append("," + d);
- }
- }
- csv.append("\n");
- for (int s = 0; s < seqs.length; s++)
- {
- csv.append("\"" + seqs[s].getName() + "\"");
- double fl[];
- if (!transformed)
- {
- // output pca in correct order
- fl = pca.component(s);
- for (int d = fl.length - 1; d >= 0; d--)
- {
- csv.append(",");
- csv.append(fl[d]);
- }
- }
- else
- {
- // output current x,y,z coords for points
- fl = rc.getPointPosition(s);
- for (int d = 0; d < fl.length; d++)
- {
- csv.append(",");
- csv.append(fl[d]);
- }
- }
- csv.append("\n");
- }
- return csv.toString();
- }
-
/*
* (non-Javadoc)
*
@@ -575,9 +617,12 @@ public class PCAPanel extends GPCAPanel implements Runnable
CutAndPasteTransfer cap = new CutAndPasteTransfer();
try
{
- cap.setText(getPointsasCsv(true));
- Desktop.addInternalFrame(cap, "Transformed points for " + getTitle(),
- 500, 500);
+ cap.setText(pcaModel.getPointsasCsv(true,
+ xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(),
+ zCombobox.getSelectedIndex()));
+ Desktop.addInternalFrame(cap, MessageManager.formatMessage(
+ "label.transformed_points_for_params",
+ new String[] { this.getTitle() }), 500, 500);
} catch (OutOfMemoryError oom)
{
new OOMWarning("exporting transformed PCA points", oom);
@@ -585,4 +630,110 @@ public class PCAPanel extends GPCAPanel implements Runnable
}
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
+ */
+ @Override
+ public void setProgressBar(String message, long id)
+ {
+ progressBar.setProgressBar(message, id);
+ // if (progressBars == null)
+ // {
+ // progressBars = new Hashtable();
+ // progressBarHandlers = new Hashtable();
+ // }
+ //
+ // JPanel progressPanel;
+ // Long lId = new Long(id);
+ // GridLayout layout = (GridLayout) statusPanel.getLayout();
+ // if (progressBars.get(lId) != null)
+ // {
+ // progressPanel = (JPanel) progressBars.get(new Long(id));
+ // statusPanel.remove(progressPanel);
+ // progressBars.remove(lId);
+ // progressPanel = null;
+ // if (message != null)
+ // {
+ // statusBar.setText(message);
+ // }
+ // if (progressBarHandlers.contains(lId))
+ // {
+ // progressBarHandlers.remove(lId);
+ // }
+ // layout.setRows(layout.getRows() - 1);
+ // }
+ // else
+ // {
+ // progressPanel = new JPanel(new BorderLayout(10, 5));
+ //
+ // JProgressBar progressBar = new JProgressBar();
+ // progressBar.setIndeterminate(true);
+ //
+ // progressPanel.add(new JLabel(message), BorderLayout.WEST);
+ // progressPanel.add(progressBar, BorderLayout.CENTER);
+ //
+ // layout.setRows(layout.getRows() + 1);
+ // statusPanel.add(progressPanel);
+ //
+ // progressBars.put(lId, progressPanel);
+ // }
+ // // update GUI
+ // // setMenusForViewport();
+ // validate();
+ }
+
+ @Override
+ public void registerHandler(final long id,
+ final IProgressIndicatorHandler handler)
+ {
+ progressBar.registerHandler(id, handler);
+ // if (progressBarHandlers == null || !progressBars.contains(new Long(id)))
+ // {
+ // throw new
+ // Error(MessageManager.getString("error.call_setprogressbar_before_registering_handler"));
+ // }
+ // progressBarHandlers.put(new Long(id), handler);
+ // final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
+ // if (handler.canCancel())
+ // {
+ // JButton cancel = new JButton(
+ // MessageManager.getString("action.cancel"));
+ // final IProgressIndicator us = this;
+ // cancel.addActionListener(new ActionListener()
+ // {
+ //
+ // @Override
+ // public void actionPerformed(ActionEvent e)
+ // {
+ // handler.cancelActivity(id);
+ // us.setProgressBar(MessageManager.formatMessage("label.cancelled_params",
+ // new String[]{((JLabel) progressPanel.getComponent(0)).getText()}), id);
+ // }
+ // });
+ // progressPanel.add(cancel, BorderLayout.EAST);
+ // }
+ }
+
+ /**
+ *
+ * @return true if any progress bars are still active
+ */
+ @Override
+ public boolean operationInProgress()
+ {
+ return progressBar.operationInProgress();
+ }
+
+ @Override
+ protected void resetButton_actionPerformed(ActionEvent e)
+ {
+ int t = top;
+ top = 0; // ugly - prevents dimensionChanged events from being processed
+ xCombobox.setSelectedIndex(0);
+ yCombobox.setSelectedIndex(1);
+ top = t;
+ zCombobox.setSelectedIndex(2);
+ }
}
diff --git a/src/jalview/gui/PDBSearchPanel.java b/src/jalview/gui/PDBSearchPanel.java
new file mode 100644
index 0000000..4c89f12
--- /dev/null
+++ b/src/jalview/gui/PDBSearchPanel.java
@@ -0,0 +1,317 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.gui;
+
+import jalview.jbgui.GPDBSearchPanel;
+import jalview.jbgui.PDBDocFieldPreferences;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.PDBRestClient;
+import jalview.ws.dbsources.PDBRestClient.PDBDocField;
+import jalview.ws.uimodel.PDBRestRequest;
+import jalview.ws.uimodel.PDBRestResponse;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.swing.table.DefaultTableModel;
+
+ at SuppressWarnings("serial")
+public class PDBSearchPanel extends GPDBSearchPanel
+{
+ private SequenceFetcher seqFetcher;
+
+ private IProgressIndicator progressIdicator;
+
+ private Collection<PDBDocField> wantedFields;
+
+ public PDBSearchPanel(SequenceFetcher seqFetcher)
+ {
+ this.seqFetcher = seqFetcher;
+ this.progressIdicator = (seqFetcher == null) ? null : seqFetcher
+ .getProgressIndicator();
+ }
+
+ /**
+ * Action performed when an input is detected on txt_search field.
+ */
+ @Override
+ public void txt_search_ActionPerformed()
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ lbl_loading.setVisible(false);
+ errorWarning.setLength(0);
+ lbl_warning.setVisible(false);
+ btn_ok.setEnabled(false);
+ boolean allowEmptySequence = false;
+ mainFrame.setTitle(MessageManager
+ .getString("label.pdb_sequence_getcher"));
+ tbl_summary.setModel(new DefaultTableModel());
+ if (txt_search.getText().trim().length() > 0)
+ {
+ lbl_loading.setVisible(true);
+ long startTime = System.currentTimeMillis();
+
+ String searchTarget = ((PDBDocField) cmb_searchTarget
+ .getSelectedItem()).getCode();
+
+ wantedFields = PDBDocFieldPreferences.getSearchSummaryFields();
+
+ String searchTerm = decodeSearchTerm(txt_search.getText(),
+ searchTarget);
+
+ PDBRestRequest request = new PDBRestRequest();
+ request.setAllowEmptySeq(allowEmptySequence);
+ request.setResponseSize(100);
+ request.setFieldToSearchBy("(" + searchTarget + ":");
+ request.setSearchTerm(searchTerm + ")");
+ request.setWantedFields(wantedFields);
+ // System.out.println(">>>>>>>>>>>>>> " + request.getQuery());
+ PDBRestClient pdbRestCleint = new PDBRestClient();
+ PDBRestResponse resultList;
+ try
+ {
+ resultList = pdbRestCleint.executeRequest(request);
+ } catch (Exception e)
+ {
+ // e.printStackTrace();
+ errorWarning.append(e.getMessage());
+ checkForErrors();
+ return;
+ }
+
+ if (resultList.getSearchSummary() != null)
+ {
+ tbl_summary.setModel(PDBRestResponse.getTableModel(request,
+ resultList.getSearchSummary()));
+ }
+
+ long endTime = System.currentTimeMillis();
+ int resultSetCount = resultList.getNumberOfItemsFound();
+ String result = (resultSetCount > 1) ? MessageManager
+ .getString("label.results") : MessageManager
+ .getString("label.result");
+ mainFrame.setTitle(frameTitle + " - " + resultSetCount + " "
+ + result + " (" + (endTime - startTime) + " milli secs)");
+ lbl_loading.setVisible(false);
+ }
+ }
+ }.start();
+ }
+
+ public static String decodeSearchTerm(String enteredText,
+ String targetField)
+ {
+ String foundSearchTerms = enteredText;
+ StringBuilder foundSearchTermsBuilder = new StringBuilder();
+ if (enteredText.contains(";"))
+ {
+ String[] searchTerms = enteredText.split(";");
+ for (String searchTerm : searchTerms)
+ {
+ if (searchTerm.contains(":"))
+ {
+ foundSearchTermsBuilder.append(targetField).append(":")
+ .append(searchTerm.split(":")[0]).append(" OR ");
+ }
+ else
+ {
+ foundSearchTermsBuilder.append(targetField).append(":")
+ .append(searchTerm).append(" OR ");
+ }
+ }
+ int endIndex = foundSearchTermsBuilder.lastIndexOf(" OR ");
+ foundSearchTerms = foundSearchTermsBuilder.toString();
+ if (foundSearchTerms.contains(" OR "))
+ {
+ foundSearchTerms = foundSearchTerms.substring(
+ targetField.length() + 1, endIndex);
+ }
+ }
+ else if (enteredText.contains(":"))
+ {
+ foundSearchTerms = foundSearchTerms.split(":")[0];
+ }
+ return foundSearchTerms;
+ }
+
+ @Override
+ public void btn_ok_ActionPerformed()
+ {
+ loadSelectedPDBSequencesToAlignment();
+ }
+
+ @Override
+ public void btn_back_ActionPerformed()
+ {
+ mainFrame.dispose();
+ new SequenceFetcher(progressIdicator);
+ }
+
+ @Override
+ public void btn_cancel_ActionPerformed()
+ {
+ mainFrame.dispose();
+ }
+
+ public void transferToSequenceFetcher(String ids)
+ {
+ // mainFrame.dispose();
+ seqFetcher.textArea.setText(ids);
+ Thread worker = new Thread(seqFetcher);
+ worker.start();
+ }
+
+ /**
+ * Add the discovered/selected sequences to a target alignment window
+ */
+ public void loadSelectedPDBSequencesToAlignment()
+ {
+ // mainFrame.dispose();
+ disableActionButtons();
+ StringBuilder selectedIds = new StringBuilder();
+ HashSet<String> selectedIdsSet = new HashSet<String>();
+ int pdbIdCol = PDBRestClient.getPDBIdColumIndex(wantedFields, false);
+ int[] selectedRows = tbl_summary.getSelectedRows();
+ for (int summaryRow : selectedRows)
+ {
+ String pdbIdStr = tbl_summary.getValueAt(summaryRow, pdbIdCol)
+ .toString();
+ String searchTerm = txt_search.getText();
+ selectedIdsSet.add(getPDBIdwithSpecifiedChain(pdbIdStr, searchTerm));
+ }
+
+ for (String selectedId : selectedIdsSet)
+ {
+ selectedIds.append(selectedId).append(";");
+ }
+
+ String ids = selectedIds.toString();
+ // System.out.println(">>>>>>>>>>>>>>>> selected Ids: " + ids);
+ seqFetcher.textArea.setText(ids);
+ Thread worker = new Thread(seqFetcher);
+ worker.start();
+ delayAndEnableActionButtons();
+
+ }
+
+ private void disableActionButtons()
+ {
+ btn_ok.setEnabled(false);
+ btn_back.setEnabled(false);
+ btn_cancel.setEnabled(false);
+ }
+
+ private void delayAndEnableActionButtons()
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(1500);
+ } catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ btn_ok.setEnabled(true);
+ btn_back.setEnabled(true);
+ btn_cancel.setEnabled(true);
+ }
+ }.start();
+ }
+
+ public static String getPDBIdwithSpecifiedChain(String pdbId,
+ String searchTerm)
+ {
+ String pdbIdWithChainCode = "";
+ if (searchTerm.contains(";"))
+ {
+ String[] foundTerms = searchTerm.split(";");
+ for (String foundTerm : foundTerms)
+ {
+ if (foundTerm.contains(pdbId))
+ {
+ pdbIdWithChainCode = foundTerm;
+ }
+ }
+ }
+ else if (searchTerm.contains(pdbId))
+ {
+ pdbIdWithChainCode = searchTerm;
+ }
+ else
+ {
+ pdbIdWithChainCode = pdbId;
+ }
+ return pdbIdWithChainCode;
+ }
+
+ /**
+ * Populates search target combo-box options
+ */
+ public void populateCmbSearchTargetOptions()
+ {
+ List<PDBDocField> searchableTargets = new ArrayList<PDBDocField>();
+ searchableTargets.add(PDBDocField.PDB_ID);
+ searchableTargets.add(PDBDocField.PFAM_ACCESSION);
+ searchableTargets.add(PDBDocField.MOLECULE_TYPE);
+ searchableTargets.add(PDBDocField.MOLECULE_NAME);
+ searchableTargets.add(PDBDocField.UNIPROT_ACCESSION);
+ searchableTargets.add(PDBDocField.GENE_NAME);
+ searchableTargets.add(PDBDocField.GENUS);
+ searchableTargets.add(PDBDocField.ALL);
+
+ Collections.sort(searchableTargets, new Comparator<PDBDocField>()
+ {
+ @Override
+ public int compare(PDBDocField o1, PDBDocField o2)
+ {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+
+ for (PDBDocField searchTarget : searchableTargets)
+ {
+ cmb_searchTarget.addItem(searchTarget);
+ }
+ }
+
+ public void checkForErrors()
+ {
+ lbl_warning.setVisible(false);
+ if (errorWarning.length() > 0)
+ {
+ lbl_loading.setVisible(false);
+ lbl_warning.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ errorWarning.toString()));
+ lbl_warning.setVisible(true);
+ }
+ }
+}
diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java
index 41a0da9..1b90d82 100644
--- a/src/jalview/gui/PaintRefresher.java
+++ b/src/jalview/gui/PaintRefresher.java
@@ -1,87 +1,99 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.awt.Component;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
/**
- * DOCUMENT ME!
+ * Route datamodel/view update events for a sequence set to any display
+ * components involved TODO: JV3 refactor to abstract gui/view package
*
* @author $author$
* @version $Revision$
*/
public class PaintRefresher
{
- static Hashtable components;
+ static Map<String, List<Component>> components = new HashMap<String, List<Component>>();
/**
- * DOCUMENT ME!
+ * Add the given component to those registered under the given sequence set
+ * id. Does nothing if already added.
*
* @param comp
- * DOCUMENT ME!
* @param al
- * DOCUMENT ME!
*/
public static void Register(Component comp, String seqSetId)
{
- if (components == null)
- {
- components = new Hashtable();
- }
-
if (components.containsKey(seqSetId))
{
- Vector comps = (Vector) components.get(seqSetId);
+ List<Component> comps = components.get(seqSetId);
if (!comps.contains(comp))
{
- comps.addElement(comp);
+ comps.add(comp);
}
}
else
{
- Vector vcoms = new Vector();
- vcoms.addElement(comp);
+ List<Component> vcoms = new ArrayList<Component>();
+ vcoms.add(comp);
components.put(seqSetId, vcoms);
}
}
+ /**
+ * Remove this component from all registrations. Also removes a registered
+ * sequence set id if there are no remaining components registered against it.
+ *
+ * @param comp
+ */
public static void RemoveComponent(Component comp)
{
- if (components == null)
- {
- return;
- }
-
- Enumeration en = components.keys();
- while (en.hasMoreElements())
+ List<String> emptied = new ArrayList<String>();
+ for (Entry<String, List<Component>> registered : components.entrySet())
{
- String id = en.nextElement().toString();
- Vector comps = (Vector) components.get(id);
+ String id = registered.getKey();
+ List<Component> comps = components.get(id);
comps.remove(comp);
- if (comps.size() == 0)
+ if (comps.isEmpty())
{
- components.remove(id);
+ emptied.add(id);
}
}
+
+ /*
+ * Remove now empty ids after the above (to avoid
+ * ConcurrentModificationException).
+ */
+ for (String id : emptied)
+ {
+ components.remove(id);
+ }
}
public static void Refresh(Component source, String id)
@@ -92,24 +104,15 @@ public class PaintRefresher
public static void Refresh(Component source, String id,
boolean alignmentChanged, boolean validateSequences)
{
- if (components == null)
- {
- return;
- }
-
- Component comp;
- Vector comps = (Vector) components.get(id);
+ List<Component> comps = components.get(id);
if (comps == null)
{
return;
}
- Enumeration e = comps.elements();
- while (e.hasMoreElements())
+ for (Component comp : comps)
{
- comp = (Component) e.nextElement();
-
if (comp == source)
{
continue;
@@ -118,8 +121,8 @@ public class PaintRefresher
if (validateSequences && comp instanceof AlignmentPanel
&& source instanceof AlignmentPanel)
{
- validateSequences(((AlignmentPanel) source).av.alignment,
- ((AlignmentPanel) comp).av.alignment);
+ validateSequences(((AlignmentPanel) source).av.getAlignment(),
+ ((AlignmentPanel) comp).av.getAlignment());
}
if (comp instanceof AlignmentPanel && alignmentChanged)
@@ -179,7 +182,20 @@ public class PaintRefresher
{
if (i < comp.getHeight())
{
- comp.getSequences().insertElementAt(a1[i], i);
+ // TODO: the following does not trigger any recalculation of
+ // height/etc, or maintain the dataset
+ if (comp.getDataset() != source.getDataset())
+ {
+ // raise an implementation warning here - not sure if this situation
+ // will ever occur
+ System.err
+ .println("IMPLEMENTATION PROBLEM: DATASET out of sync due to an insert whilst calling PaintRefresher.validateSequences(AlignmentI, ALignmentI)");
+ }
+ List<SequenceI> alsq;
+ synchronized (alsq = comp.getSequences())
+ {
+ alsq.add(i, a1[i]);
+ }
}
else
{
@@ -224,22 +240,20 @@ public class PaintRefresher
static AlignmentPanel[] getAssociatedPanels(String id)
{
- if (components==null) { return new AlignmentPanel[0]; };
- Vector comps = (Vector) components.get(id);
- if (comps==null) { return new AlignmentPanel[0]; };
- Vector tmp = new Vector();
- int i, iSize = comps.size();
- for (i = 0; i < iSize; i++)
+ List<Component> comps = components.get(id);
+ if (comps == null)
{
- if (comps.elementAt(i) instanceof AlignmentPanel)
+ return new AlignmentPanel[0];
+ }
+ List<AlignmentPanel> tmp = new ArrayList<AlignmentPanel>();
+ for (Component comp : comps)
+ {
+ if (comp instanceof AlignmentPanel)
{
- tmp.addElement(((AlignmentPanel) comps.elementAt(i)));
+ tmp.add((AlignmentPanel) comp);
}
}
- AlignmentPanel[] result = new AlignmentPanel[tmp.size()];
- tmp.toArray(result);
-
- return result;
+ return tmp.toArray(new AlignmentPanel[tmp.size()]);
}
}
diff --git a/src/jalview/gui/PairwiseAlignPanel.java b/src/jalview/gui/PairwiseAlignPanel.java
index 5ca572c..294bb9d 100644
--- a/src/jalview/gui/PairwiseAlignPanel.java
+++ b/src/jalview/gui/PairwiseAlignPanel.java
@@ -1,29 +1,35 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.event.*;
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.jbgui.GPairwiseAlignPanel;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.jbgui.*;
+import java.awt.event.ActionEvent;
+import java.util.Vector;
/**
* DOCUMENT ME!
@@ -34,7 +40,7 @@ import jalview.jbgui.*;
public class PairwiseAlignPanel extends GPairwiseAlignPanel
{
- AlignViewport av;
+ AlignmentViewport av;
Vector sequences;
@@ -44,7 +50,7 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel
* @param av
* DOCUMENT ME!
*/
- public PairwiseAlignPanel(AlignViewport av)
+ public PairwiseAlignPanel(AlignmentViewport av)
{
super();
this.av = av;
@@ -56,14 +62,14 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel
if (av.getSelectionGroup() == null)
{
- seqs = av.alignment.getSequencesArray();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
}
- String type = (av.alignment.isNucleotide()) ? AlignSeq.DNA
+ String type = (av.getAlignment().isNucleotide()) ? AlignSeq.DNA
: AlignSeq.PEP;
float[][] scores = new float[seqs.length][seqs.length];
@@ -94,13 +100,8 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel
totscore = totscore + scores[i][j];
textarea.append(as.getOutput());
- seq = new Sequence(as.getS1().getName(), as.getAStr1(), as.getS1()
- .getStart(), as.getS1().getEnd());
- sequences.add(seq);
-
- seq = new Sequence(as.getS2().getName(), as.getAStr2(), as.getS2()
- .getStart(), as.getS2().getEnd());
- sequences.add(seq);
+ sequences.add(as.getAlignedSeq1());
+ sequences.add(as.getAlignedSeq2());
}
}
@@ -148,7 +149,8 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel
AlignFrame af = new AlignFrame(new Alignment(seq),
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
- Desktop.addInternalFrame(af, "Pairwise Aligned Sequences",
+ Desktop.addInternalFrame(af,
+ MessageManager.getString("label.pairwise_aligned_sequences"),
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
}
}
diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java
index 1cc4cd7..d344c0c 100644
--- a/src/jalview/gui/PopupMenu.java
+++ b/src/jalview/gui/PopupMenu.java
@@ -1,39 +1,85 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-import MCview.*;
-import jalview.analysis.*;
-import jalview.commands.*;
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.schemes.*;
+import jalview.analysis.AAFrequency;
+import jalview.analysis.AlignmentAnnotationUtils;
+import jalview.analysis.AlignmentUtils;
+import jalview.analysis.Conservation;
+import jalview.commands.ChangeCaseCommand;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.io.FormatAdapter;
+import jalview.io.SequenceAnnotationReport;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.ClustalxColourScheme;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.NucleotideColourScheme;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.UserColourScheme;
+import jalview.schemes.ZappoColourScheme;
import jalview.util.GroupUrlLink;
import jalview.util.GroupUrlLink.UrlStringTooLongException;
+import jalview.util.MessageManager;
import jalview.util.UrlLink;
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Vector;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JColorChooser;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
+import javax.swing.JRadioButtonMenuItem;
+
/**
* DOCUMENT ME!
*
@@ -42,6 +88,10 @@ import jalview.util.UrlLink;
*/
public class PopupMenu extends JPopupMenu
{
+ private static final String ALL_ANNOTATIONS = "All";
+
+ private static final String COMMA = ",";
+
JMenu groupMenu = new JMenu();
JMenuItem groupName = new JMenuItem();
@@ -70,6 +120,10 @@ public class PopupMenu extends JPopupMenu
protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();
protected JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();
@@ -80,7 +134,17 @@ public class PopupMenu extends JPopupMenu
JMenuItem sequenceName = new JMenuItem();
- Sequence sequence;
+ JMenuItem sequenceDetails = new JMenuItem();
+
+ JMenuItem sequenceSelDetails = new JMenuItem();
+
+ JMenuItem makeReferenceSeq = new JMenuItem();
+
+ JMenuItem chooseAnnotations = new JMenuItem();
+
+ SequenceI sequence;
+
+ JMenuItem createGroupMenuItem = new JMenuItem();
JMenuItem unGroupMenuItem = new JMenuItem();
@@ -120,23 +184,36 @@ public class PopupMenu extends JPopupMenu
JMenu outputMenu = new JMenu();
+ JMenu seqShowAnnotationsMenu = new JMenu();
+
+ JMenu seqHideAnnotationsMenu = new JMenu();
+
+ JMenuItem seqAddReferenceAnnotations = new JMenuItem(
+ MessageManager.getString("label.add_reference_annotations"));
+
+ JMenu groupShowAnnotationsMenu = new JMenu();
+
+ JMenu groupHideAnnotationsMenu = new JMenu();
+
+ JMenuItem groupAddReferenceAnnotations = new JMenuItem(
+ MessageManager.getString("label.add_reference_annotations"));
+
JMenuItem sequenceFeature = new JMenuItem();
JMenuItem textColour = new JMenuItem();
JMenu jMenu1 = new JMenu();
- JMenu structureMenu = new JMenu();
+ JMenuItem pdbStructureDialog = new JMenuItem();
- JMenu viewStructureMenu = new JMenu();
+ JMenu rnaStructureMenu = new JMenu();
- // JMenu colStructureMenu = new JMenu();
JMenuItem editSequence = new JMenuItem();
- // JMenuItem annotationMenuItem = new JMenuItem();
-
JMenu groupLinksMenu;
+ JMenuItem hideInsertions = new JMenuItem();
+
/**
* Creates a new PopupMenu object.
*
@@ -157,8 +234,8 @@ public class PopupMenu extends JPopupMenu
* @param links
* @param groupLinks
*/
- public PopupMenu(final AlignmentPanel ap, Sequence seq, Vector links,
- Vector groupLinks)
+ public PopupMenu(final AlignmentPanel ap, final SequenceI seq,
+ Vector links, Vector groupLinks)
{
// /////////////////////////////////////////////////////////
// If this is activated from the sequence panel, the user may want to
@@ -183,6 +260,8 @@ public class PopupMenu extends JPopupMenu
colours.add(userDefinedColour);
colours.add(PIDColour);
colours.add(BLOSUM62Colour);
+ colours.add(purinePyrimidineColour);
+ colours.add(RNAInteractionColour);
for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++)
{
@@ -191,6 +270,7 @@ public class PopupMenu extends JPopupMenu
item.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
outputText_actionPerformed(e);
@@ -200,6 +280,29 @@ public class PopupMenu extends JPopupMenu
outputMenu.add(item);
}
+ /*
+ * Build menus for annotation types that may be shown or hidden, and for
+ * 'reference annotations' that may be added to the alignment. First for the
+ * currently selected sequence (if there is one):
+ */
+ final List<SequenceI> selectedSequence = (seq == null ? Collections
+ .<SequenceI> emptyList() : Arrays.asList(seq));
+ buildAnnotationTypesMenus(seqShowAnnotationsMenu,
+ seqHideAnnotationsMenu, selectedSequence);
+ configureReferenceAnnotationsMenu(seqAddReferenceAnnotations,
+ selectedSequence);
+
+ /*
+ * And repeat for the current selection group (if there is one):
+ */
+ final List<SequenceI> selectedGroup = (ap.av.getSelectionGroup() == null ? Collections
+ .<SequenceI> emptyList() : ap.av.getSelectionGroup()
+ .getSequences());
+ buildAnnotationTypesMenus(groupShowAnnotationsMenu,
+ groupHideAnnotationsMenu, selectedGroup);
+ configureReferenceAnnotationsMenu(groupAddReferenceAnnotations,
+ selectedGroup);
+
try
{
jbInit();
@@ -212,49 +315,95 @@ public class PopupMenu extends JPopupMenu
if (seq != null)
{
sequenceMenu.setText(sequence.getName());
-
- if (seq.getDatasetSequence().getPDBId() != null
- && seq.getDatasetSequence().getPDBId().size() > 0)
+ if (seq == ap.av.getAlignment().getSeqrep())
{
- java.util.Enumeration e = seq.getDatasetSequence().getPDBId()
- .elements();
+ makeReferenceSeq.setText(MessageManager
+ .getString("action.unmark_as_reference"));
+ }
+ else
+ {
+ makeReferenceSeq.setText(MessageManager
+ .getString("action.set_as_reference"));
+ }
- while (e.hasMoreElements())
+ if (!ap.av.getAlignment().isNucleotide())
+ {
+ remove(rnaStructureMenu);
+ }
+ else
+ {
+ int origCount = rnaStructureMenu.getItemCount();
+ /*
+ * add menu items to 2D-render any alignment or sequence secondary
+ * structure annotation
+ */
+ AlignmentAnnotation[] aas = ap.av.getAlignment()
+ .getAlignmentAnnotation();
+ if (aas != null)
{
- final PDBEntry pdb = (PDBEntry) e.nextElement();
-
- menuItem = new JMenuItem();
- menuItem.setText(pdb.getId());
- menuItem.addActionListener(new java.awt.event.ActionListener()
+ for (final AlignmentAnnotation aa : aas)
{
- public void actionPerformed(ActionEvent e)
+ if (aa.isValidStruc() && aa.sequenceRef == null)
{
- // TODO re JAL-860: optionally open dialog or provide a menu entry allowing user to open just one structure per sequence
- new AppJmol(pdb, ap.av.collateForPDB(new PDBEntry[] { pdb })[0], null, ap);
- // new PDBViewer(pdb, seqs2, null, ap, AppletFormatAdapter.FILE);
+ /*
+ * valid alignment RNA secondary structure annotation
+ */
+ menuItem = new JMenuItem();
+ menuItem.setText(MessageManager.formatMessage(
+ "label.2d_rna_structure_line",
+ new Object[] { aa.label }));
+ menuItem.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new AppVarna(seq, aa, ap);
+ }
+ });
+ rnaStructureMenu.add(menuItem);
}
+ }
+ }
- });
- viewStructureMenu.add(menuItem);
-
- /*
- * menuItem = new JMenuItem(); menuItem.setText(pdb.getId());
- * menuItem.addActionListener(new java.awt.event.ActionListener() {
- * public void actionPerformed(ActionEvent e) {
- * colourByStructure(pdb.getId()); } });
- * colStructureMenu.add(menuItem);
- */
+ if (seq.getAnnotation() != null)
+ {
+ AlignmentAnnotation seqAnns[] = seq.getAnnotation();
+ for (final AlignmentAnnotation aa : seqAnns)
+ {
+ if (aa.isValidStruc())
+ {
+ /*
+ * valid sequence RNA secondary structure annotation
+ */
+ // TODO: make rnastrucF a bit more nice
+ menuItem = new JMenuItem();
+ menuItem.setText(MessageManager.formatMessage(
+ "label.2d_rna_sequence_name",
+ new Object[] { seq.getName() }));
+ menuItem.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: VARNA does'nt print gaps in the sequence
+ new AppVarna(seq, aa, ap);
+ }
+ });
+ rnaStructureMenu.add(menuItem);
+ }
+ }
+ }
+ if (rnaStructureMenu.getItemCount() == origCount)
+ {
+ remove(rnaStructureMenu);
}
- }
- else
- {
- structureMenu.remove(viewStructureMenu);
- // structureMenu.remove(colStructureMenu);
}
- menuItem = new JMenuItem("Hide Sequences");
+ menuItem = new JMenuItem(
+ MessageManager.getString("action.hide_sequences"));
menuItem.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
hideSequences(false);
@@ -265,9 +414,12 @@ public class PopupMenu extends JPopupMenu
if (ap.av.getSelectionGroup() != null
&& ap.av.getSelectionGroup().getSize() > 1)
{
- menuItem = new JMenuItem("Represent Group with " + seq.getName());
+ menuItem = new JMenuItem(MessageManager.formatMessage(
+ "label.represent_group_with",
+ new Object[] { seq.getName() }));
menuItem.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
hideSequences(true);
@@ -276,16 +428,18 @@ public class PopupMenu extends JPopupMenu
sequenceMenu.add(menuItem);
}
- if (ap.av.hasHiddenRows)
+ if (ap.av.hasHiddenRows())
{
- final int index = ap.av.alignment.findIndex(seq);
+ final int index = ap.av.getAlignment().findIndex(seq);
if (ap.av.adjustForHiddenSeqs(index)
- ap.av.adjustForHiddenSeqs(index - 1) > 1)
{
- menuItem = new JMenuItem("Reveal Sequences");
+ menuItem = new JMenuItem(
+ MessageManager.getString("action.reveal_sequences"));
menuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
ap.av.showSequence(index);
@@ -300,11 +454,14 @@ public class PopupMenu extends JPopupMenu
}
}
// for the case when no sequences are even visible
- if (ap.av.hasHiddenRows) {
+ if (ap.av.hasHiddenRows())
+ {
{
- menuItem = new JMenuItem("Reveal All");
+ menuItem = new JMenuItem(
+ MessageManager.getString("action.reveal_all"));
menuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
ap.av.showAllHiddenSeqs();
@@ -321,11 +478,15 @@ public class PopupMenu extends JPopupMenu
}
SequenceGroup sg = ap.av.getSelectionGroup();
+ boolean isDefinedGroup = (sg != null) ? ap.av.getAlignment()
+ .getGroups().contains(sg) : false;
- if (sg != null&& sg.getSize()>0)
+ if (sg != null && sg.getSize() > 0)
{
- groupName.setText("Name: "+sg.getName());
- groupName.setText("Edit name and description of current group.");
+ groupName.setText(MessageManager.formatMessage("label.name_param",
+ new Object[] { sg.getName() }));
+ groupName.setText(MessageManager
+ .getString("label.edit_name_and_description_current_group"));
if (sg.cs instanceof ZappoColourScheme)
{
@@ -371,6 +532,15 @@ public class PopupMenu extends JPopupMenu
{
clustalColour.setSelected(true);
}
+ else if (sg.cs instanceof PurinePyrimidineColourScheme)
+ {
+ purinePyrimidineColour.setSelected(true);
+ }
+
+ /*
+ * else if (sg.cs instanceof CovariationColourScheme) {
+ * covariationColour.setSelected(true); }
+ */
else
{
noColourmenuItem.setSelected(true);
@@ -390,42 +560,30 @@ public class PopupMenu extends JPopupMenu
buildGroupURLMenu(sg, groupLinks);
}
// Add a 'show all structures' for the current selection
- Hashtable<String, PDBEntry> pdbe=new Hashtable<String,PDBEntry>();
- SequenceI sqass=null;
- for (SequenceI sq: ap.av.getSequenceSelection())
+ Hashtable<String, PDBEntry> pdbe = new Hashtable<String, PDBEntry>(), reppdb = new Hashtable<String, PDBEntry>();
+ SequenceI sqass = null;
+ for (SequenceI sq : ap.av.getSequenceSelection())
{
- Vector<PDBEntry> pes = (Vector<PDBEntry>) sq.getDatasetSequence().getPDBId();
- if (pes!=null) {
- for (PDBEntry pe: pes)
+ Vector<PDBEntry> pes = sq.getDatasetSequence().getAllPDBEntries();
+ if (pes != null && pes.size() > 0)
+ {
+ reppdb.put(pes.get(0).getId(), pes.get(0));
+ for (PDBEntry pe : pes)
{
- pdbe.put(pe.getId(), pe);
- if (sqass==null)
+ pdbe.put(pe.getId(), pe);
+ if (sqass == null)
{
sqass = sq;
}
}
}
}
- if (pdbe.size()>0)
+ if (pdbe.size() > 0)
{
- final PDBEntry[] pe = pdbe.values().toArray(new PDBEntry[pdbe.size()]);
- final JMenuItem gpdbview;
- if (pdbe.size()==1)
- {
- structureMenu.add(gpdbview=new JMenuItem("View structure for "+sqass.getDisplayId(false)));
- } else {
- structureMenu.add(gpdbview=new JMenuItem("View all "+pdbe.size()+" structures."));
- }
- gpdbview.setToolTipText("Open a new Jmol view with all structures associated with the current selection and superimpose them using the alignment.");
- gpdbview.addActionListener(new ActionListener()
- {
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- new AppJmol(ap, pe, ap.av.collateForPDB(pe));
- }
- });
+ final PDBEntry[] pe = pdbe.values().toArray(
+ new PDBEntry[pdbe.size()]), pr = reppdb.values().toArray(
+ new PDBEntry[reppdb.size()]);
+ final JMenuItem gpdbview, rpdbview;
}
}
else
@@ -434,21 +592,30 @@ public class PopupMenu extends JPopupMenu
editMenu.setVisible(false);
}
- if (!ap.av.alignment.getGroups().contains(sg))
+ if (!isDefinedGroup)
{
+ createGroupMenuItem.setVisible(true);
unGroupMenuItem.setVisible(false);
+ jMenu1.setText(MessageManager.getString("action.edit_new_group"));
+ }
+ else
+ {
+ createGroupMenuItem.setVisible(false);
+ unGroupMenuItem.setVisible(true);
+ jMenu1.setText(MessageManager.getString("action.edit_group"));
}
if (seq == null)
{
sequenceMenu.setVisible(false);
- structureMenu.setVisible(false);
+ pdbStructureDialog.setVisible(false);
+ rnaStructureMenu.setVisible(false);
}
if (links != null && links.size() > 0)
{
- JMenu linkMenu = new JMenu("Link");
+ JMenu linkMenu = new JMenu(MessageManager.getString("action.link"));
Vector linkset = new Vector();
for (int i = 0; i < links.size(); i++)
{
@@ -470,13 +637,12 @@ public class PopupMenu extends JPopupMenu
continue;
}
final String label = urlLink.getLabel();
- if (seq!=null && urlLink.isDynamic())
+ if (seq != null && urlLink.isDynamic())
{
// collect matching db-refs
DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs(
- seq.getDBRef(), new String[]
- { urlLink.getTarget() });
+ seq.getDBRef(), new String[] { urlLink.getTarget() });
// collect id string too
String id = seq.getName();
String descr = seq.getDescription();
@@ -568,6 +734,133 @@ public class PopupMenu extends JPopupMenu
}
}
+ /**
+ * Add annotation types to 'Show annotations' and/or 'Hide annotations' menus.
+ * "All" is added first, followed by a separator. Then add any annotation
+ * types associated with the current selection. Separate menus are built for
+ * the selected sequence group (if any), and the selected sequence.
+ * <p>
+ * Some annotation rows are always rendered together - these can be identified
+ * by a common graphGroup property > -1. Only one of each group will be marked
+ * as visible (to avoid duplication of the display). For such groups we add a
+ * composite type name, e.g.
+ * <p>
+ * IUPredWS (Long), IUPredWS (Short)
+ *
+ * @param seq
+ */
+ protected void buildAnnotationTypesMenus(JMenu showMenu, JMenu hideMenu,
+ List<SequenceI> forSequences)
+ {
+ showMenu.removeAll();
+ hideMenu.removeAll();
+
+ final List<String> all = Arrays.asList(ALL_ANNOTATIONS);
+ addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, true);
+ addAnnotationTypeToShowHide(hideMenu, forSequences, "", all, true,
+ false);
+ showMenu.addSeparator();
+ hideMenu.addSeparator();
+
+ final AlignmentAnnotation[] annotations = ap.getAlignment()
+ .getAlignmentAnnotation();
+
+ /*
+ * Find shown/hidden annotations types, distinguished by source (calcId),
+ * and grouped by graphGroup. Using LinkedHashMap means we will retrieve in
+ * the insertion order, which is the order of the annotations on the
+ * alignment.
+ */
+ Map<String, List<List<String>>> shownTypes = new LinkedHashMap<String, List<List<String>>>();
+ Map<String, List<List<String>>> hiddenTypes = new LinkedHashMap<String, List<List<String>>>();
+ AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes,
+ AlignmentAnnotationUtils.asList(annotations), forSequences);
+
+ for (String calcId : hiddenTypes.keySet())
+ {
+ for (List<String> type : hiddenTypes.get(calcId))
+ {
+ addAnnotationTypeToShowHide(showMenu, forSequences, calcId, type,
+ false, true);
+ }
+ }
+ // grey out 'show annotations' if none are hidden
+ showMenu.setEnabled(!hiddenTypes.isEmpty());
+
+ for (String calcId : shownTypes.keySet())
+ {
+ for (List<String> type : shownTypes.get(calcId))
+ {
+ addAnnotationTypeToShowHide(hideMenu, forSequences, calcId, type,
+ false, false);
+ }
+ }
+ // grey out 'hide annotations' if none are shown
+ hideMenu.setEnabled(!shownTypes.isEmpty());
+ }
+
+ /**
+ * Returns a list of sequences - either the current selection group (if there
+ * is one), else the specified single sequence.
+ *
+ * @param seq
+ * @return
+ */
+ protected List<SequenceI> getSequenceScope(SequenceI seq)
+ {
+ List<SequenceI> forSequences = null;
+ final SequenceGroup selectionGroup = ap.av.getSelectionGroup();
+ if (selectionGroup != null && selectionGroup.getSize() > 0)
+ {
+ forSequences = selectionGroup.getSequences();
+ }
+ else
+ {
+ forSequences = seq == null ? Collections.<SequenceI> emptyList()
+ : Arrays.asList(seq);
+ }
+ return forSequences;
+ }
+
+ /**
+ * Add one annotation type to the 'Show Annotations' or 'Hide Annotations'
+ * menus.
+ *
+ * @param showOrHideMenu
+ * the menu to add to
+ * @param forSequences
+ * the sequences whose annotations may be shown or hidden
+ * @param calcId
+ * @param types
+ * the label to add
+ * @param allTypes
+ * if true this is a special label meaning 'All'
+ * @param actionIsShow
+ * if true, the select menu item action is to show the annotation
+ * type, else hide
+ */
+ protected void addAnnotationTypeToShowHide(JMenu showOrHideMenu,
+ final List<SequenceI> forSequences, String calcId,
+ final List<String> types, final boolean allTypes,
+ final boolean actionIsShow)
+ {
+ String label = types.toString(); // [a, b, c]
+ label = label.substring(1, label.length() - 1); // a, b, c
+ final JMenuItem item = new JMenuItem(label);
+ item.setToolTipText(calcId);
+ item.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ AlignmentUtils.showOrHideSequenceAnnotations(ap.getAlignment(),
+ types, forSequences, allTypes, actionIsShow);
+ refresh();
+ }
+ });
+ showOrHideMenu.add(item);
+ }
+
private void buildGroupURLMenu(SequenceGroup sg, Vector groupLinks)
{
@@ -575,11 +868,18 @@ public class PopupMenu extends JPopupMenu
// menu appears asap
// sequence only URLs
// ID/regex match URLs
- groupLinksMenu = new JMenu("Group Link");
- JMenu[] linkMenus = new JMenu[]
- { null, new JMenu("IDS"), new JMenu("Sequences"),
- new JMenu("IDS and Sequences") }; // three types of url that might be
- // created.
+ groupLinksMenu = new JMenu(
+ MessageManager.getString("action.group_link"));
+ JMenu[] linkMenus = new JMenu[] { null,
+ new JMenu(MessageManager.getString("action.ids")),
+ new JMenu(MessageManager.getString("action.sequences")),
+ new JMenu(MessageManager.getString("action.ids_sequences")) }; // three
+ // types
+ // of url
+ // that
+ // might
+ // be
+ // created.
SequenceI[] seqs = ap.av.getSelectionAsNewSequence();
String[][] idandseqs = GroupUrlLink.formStrings(seqs);
Hashtable commonDbrefs = new Hashtable();
@@ -606,8 +906,7 @@ public class PopupMenu extends JPopupMenu
if (sarray == null)
{
sarray = new Object[2];
- sarray[0] = new int[]
- { 0 };
+ sarray[0] = new int[] { 0 };
sarray[1] = new String[seqs.length];
commonDbrefs.put(src, sarray);
@@ -688,8 +987,6 @@ public class PopupMenu extends JPopupMenu
if (urlset != null)
{
int type = urlLink.getGroupURLType() & 3;
- // System.out.println(urlLink.getGroupURLType()
- // +" "+((String[])urlset[3])[0]);
// first two bits ofurlLink type bitfield are sequenceids and sequences
// TODO: FUTURE: ensure the groupURL menu structure can be generalised
addshowLink(linkMenus[type], label
@@ -701,7 +998,8 @@ public class PopupMenu extends JPopupMenu
}
if (addMenu)
{
- groupLinksMenu = new JMenu("Group Links");
+ groupLinksMenu = new JMenu(
+ MessageManager.getString("action.group_link"));
for (int m = 0; m < linkMenus.length; m++)
{
if (linkMenus[m] != null
@@ -727,14 +1025,17 @@ public class PopupMenu extends JPopupMenu
private void addshowLink(JMenu linkMenu, String label, final String url)
{
JMenuItem item = new JMenuItem(label);
- item.setToolTipText("open URL: " + url);
+ item.setToolTipText(MessageManager.formatMessage(
+ "label.open_url_param", new Object[] { url }));
item.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
new Thread(new Runnable()
{
+ @Override
public void run()
{
showLink(url);
@@ -762,23 +1063,20 @@ public class PopupMenu extends JPopupMenu
final GroupUrlLink urlgenerator, final Object[] urlstub)
{
JMenuItem item = new JMenuItem(label);
- item.setToolTipText("open URL (" + urlgenerator.getUrl_prefix()
- + "..) (" + urlgenerator.getNumberInvolved(urlstub) + " seqs)"); // TODO:
- // put
- // in
- // info
- // about
- // what
- // is
- // being
- // sent.
+ item.setToolTipText(MessageManager.formatMessage(
+ "label.open_url_seqs_param",
+ new Object[] { urlgenerator.getUrl_prefix(),
+ urlgenerator.getNumberInvolved(urlstub) }));
+ // TODO: put in info about what is being sent.
item.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
new Thread(new Runnable()
{
+ @Override
public void run()
{
try
@@ -804,198 +1102,338 @@ public class PopupMenu extends JPopupMenu
*/
private void jbInit() throws Exception
{
- groupMenu.setText("Group");
- groupMenu.setText("Selection");
- groupName.setText("Name");
+ groupMenu.setText(MessageManager.getString("label.group"));
+ groupMenu.setText(MessageManager.getString("label.selection"));
+ groupName.setText(MessageManager.getString("label.name"));
groupName.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
groupName_actionPerformed();
}
});
- sequenceMenu.setText("Sequence");
- sequenceName.setText("Edit Name/Description");
+ sequenceMenu.setText(MessageManager.getString("label.sequence"));
+ sequenceName.setText(MessageManager
+ .getString("label.edit_name_description"));
sequenceName.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
sequenceName_actionPerformed();
}
});
+ chooseAnnotations.setText(MessageManager
+ .getString("action.choose_annotations"));
+ chooseAnnotations.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ chooseAnnotations_actionPerformed(e);
+ }
+ });
+ sequenceDetails.setText(MessageManager
+ .getString("label.sequence_details"));
+ sequenceDetails.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ sequenceDetails_actionPerformed();
+ }
+ });
+ sequenceSelDetails.setText(MessageManager
+ .getString("label.sequence_details"));
+ sequenceSelDetails
+ .addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ sequenceSelectionDetails_actionPerformed();
+ }
+ });
PIDColour.setFocusPainted(false);
- unGroupMenuItem.setText("Remove Group");
+ unGroupMenuItem
+ .setText(MessageManager.getString("action.remove_group"));
unGroupMenuItem.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
unGroupMenuItem_actionPerformed();
}
});
+ createGroupMenuItem.setText(MessageManager
+ .getString("action.create_group"));
+ createGroupMenuItem
+ .addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ createGroupMenuItem_actionPerformed();
+ }
+ });
- outline.setText("Border colour");
+ outline.setText(MessageManager.getString("action.border_colour"));
outline.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
outline_actionPerformed();
}
});
- nucleotideMenuItem.setText("Nucleotide");
+ nucleotideMenuItem
+ .setText(MessageManager.getString("label.nucleotide"));
nucleotideMenuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
nucleotideMenuItem_actionPerformed();
}
});
- colourMenu.setText("Group Colour");
- showBoxes.setText("Boxes");
+ colourMenu.setText(MessageManager.getString("label.group_colour"));
+ showBoxes.setText(MessageManager.getString("action.boxes"));
showBoxes.setState(true);
showBoxes.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showBoxes_actionPerformed();
}
});
- showText.setText("Text");
+ showText.setText(MessageManager.getString("action.text"));
showText.setState(true);
showText.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showText_actionPerformed();
}
});
- showColourText.setText("Colour Text");
+ showColourText.setText(MessageManager.getString("label.colour_text"));
showColourText.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showColourText_actionPerformed();
}
});
- displayNonconserved.setText("Show Nonconserved");
+ displayNonconserved.setText(MessageManager
+ .getString("label.show_non_conversed"));
displayNonconserved.setState(true);
displayNonconserved.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showNonconserved_actionPerformed();
}
});
- editMenu.setText("Edit");
- cut.setText("Cut");
+ editMenu.setText(MessageManager.getString("action.edit"));
+ cut.setText(MessageManager.getString("action.cut"));
cut.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
cut_actionPerformed();
}
});
- upperCase.setText("To Upper Case");
+ upperCase.setText(MessageManager.getString("label.to_upper_case"));
upperCase.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
changeCase(e);
}
});
- copy.setText("Copy");
+ copy.setText(MessageManager.getString("action.copy"));
copy.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
copy_actionPerformed();
}
});
- lowerCase.setText("To Lower Case");
+ lowerCase.setText(MessageManager.getString("label.to_lower_case"));
lowerCase.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
changeCase(e);
}
});
- toggle.setText("Toggle Case");
+ toggle.setText(MessageManager.getString("label.toggle_case"));
toggle.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
changeCase(e);
}
});
- pdbMenu.setText("Associate Structure with Sequence");
- pdbFromFile.setText("From File");
+ pdbMenu.setText(MessageManager
+ .getString("label.associate_structure_with_sequence"));
+ pdbFromFile.setText(MessageManager.getString("label.from_file"));
pdbFromFile.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
pdbFromFile_actionPerformed();
}
});
- enterPDB.setText("Enter PDB Id");
+
+ enterPDB.setText(MessageManager.getString("label.enter_pdb_id"));
enterPDB.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
enterPDB_actionPerformed();
}
});
- discoverPDB.setText("Discover PDB ids");
+ discoverPDB.setText(MessageManager.getString("label.discover_pdb_ids"));
discoverPDB.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
discoverPDB_actionPerformed();
}
});
- outputMenu.setText("Output to Textbox...");
- sequenceFeature.setText("Create Sequence Feature");
+ outputMenu.setText(MessageManager.getString("label.out_to_textbox")
+ + "...");
+ seqShowAnnotationsMenu.setText(MessageManager
+ .getString("label.show_annotations"));
+ seqHideAnnotationsMenu.setText(MessageManager
+ .getString("label.hide_annotations"));
+ groupShowAnnotationsMenu.setText(MessageManager
+ .getString("label.show_annotations"));
+ groupHideAnnotationsMenu.setText(MessageManager
+ .getString("label.hide_annotations"));
+ sequenceFeature.setText(MessageManager
+ .getString("label.create_sequence_feature"));
sequenceFeature.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
sequenceFeature_actionPerformed();
}
});
- textColour.setText("Text Colour");
+ textColour.setText(MessageManager.getString("label.text_colour"));
textColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
textColour_actionPerformed();
}
});
- jMenu1.setText("Group");
- structureMenu.setText("Structure");
- viewStructureMenu.setText("View Structure");
+ jMenu1.setText(MessageManager.getString("label.group"));
+ pdbStructureDialog.setText(MessageManager
+ .getString("label.show_pdbstruct_dialog"));
+ pdbStructureDialog.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ SequenceI[] selectedSeqs = new SequenceI[] { sequence };
+ if (ap.av.getSelectionGroup() != null)
+ {
+ selectedSeqs = ap.av.getSequenceSelection();
+ }
+ new StructureChooser(selectedSeqs, sequence, ap);
+ }
+ });
+
+ rnaStructureMenu.setText(MessageManager
+ .getString("label.view_rna_structure"));
+
// colStructureMenu.setText("Colour By Structure");
- editSequence.setText("Edit Sequence...");
+ editSequence.setText(MessageManager.getString("label.edit_sequence")
+ + "...");
editSequence.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
editSequence_actionPerformed(actionEvent);
}
});
+ makeReferenceSeq.setText(MessageManager
+ .getString("label.mark_as_representative"));
+ makeReferenceSeq.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ makeReferenceSeq_actionPerformed(actionEvent);
+
+ }
+ });
+ hideInsertions.setText(MessageManager
+ .getString("label.hide_insertions"));
+ hideInsertions.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ hideInsertions_actionPerformed(e);
+ }
+ });
/*
* annotationMenuItem.setText("By Annotation");
* annotationMenuItem.addActionListener(new ActionListener() { public void
* actionPerformed(ActionEvent actionEvent) {
* annotationMenuItem_actionPerformed(actionEvent); } });
*/
-
+ groupMenu.add(sequenceSelDetails);
add(groupMenu);
-
add(sequenceMenu);
- this.add(structureMenu);
+ add(rnaStructureMenu);
+ add(pdbStructureDialog);
+ if (sequence != null)
+ {
+ add(hideInsertions);
+ }
+ // annotations configuration panel suppressed for now
+ // groupMenu.add(chooseAnnotations);
+
+ /*
+ * Add show/hide annotations to the Sequence menu, and to the Selection menu
+ * (if a selection group is in force).
+ */
+ sequenceMenu.add(seqShowAnnotationsMenu);
+ sequenceMenu.add(seqHideAnnotationsMenu);
+ sequenceMenu.add(seqAddReferenceAnnotations);
+ groupMenu.add(groupShowAnnotationsMenu);
+ groupMenu.add(groupHideAnnotationsMenu);
+ groupMenu.add(groupAddReferenceAnnotations);
groupMenu.add(editMenu);
groupMenu.add(outputMenu);
groupMenu.add(sequenceFeature);
+ groupMenu.add(createGroupMenuItem);
+ groupMenu.add(unGroupMenuItem);
groupMenu.add(jMenu1);
sequenceMenu.add(sequenceName);
+ sequenceMenu.add(sequenceDetails);
+ sequenceMenu.add(makeReferenceSeq);
colourMenu.add(textColour);
colourMenu.add(noColourmenuItem);
colourMenu.add(clustalColour);
@@ -1009,6 +1447,11 @@ public class PopupMenu extends JPopupMenu
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(nucleotideMenuItem);
+ if (ap.getAlignment().isNucleotide())
+ {
+ // JBPNote - commented since the colourscheme isn't functional
+ colourMenu.add(purinePyrimidineColour);
+ }
colourMenu.add(userDefinedColour);
if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
@@ -1021,6 +1464,7 @@ public class PopupMenu extends JPopupMenu
JMenuItem item = new JMenuItem(userColours.nextElement().toString());
item.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
userDefinedColour_actionPerformed(evt);
@@ -1033,7 +1477,6 @@ public class PopupMenu extends JPopupMenu
colourMenu.addSeparator();
colourMenu.add(abovePIDColour);
colourMenu.add(conservationMenuItem);
- // colourMenu.add(annotationMenuItem);
editMenu.add(copy);
editMenu.add(cut);
editMenu.add(editSequence);
@@ -1041,129 +1484,168 @@ public class PopupMenu extends JPopupMenu
editMenu.add(lowerCase);
editMenu.add(toggle);
pdbMenu.add(pdbFromFile);
+ // JBPNote: These shouldn't be added here - should appear in a generic
+ // 'apply web service to this sequence menu'
+ // pdbMenu.add(RNAFold);
+ // pdbMenu.add(ContraFold);
pdbMenu.add(enterPDB);
pdbMenu.add(discoverPDB);
jMenu1.add(groupName);
- jMenu1.add(unGroupMenuItem);
jMenu1.add(colourMenu);
jMenu1.add(showBoxes);
jMenu1.add(showText);
jMenu1.add(showColourText);
jMenu1.add(outline);
jMenu1.add(displayNonconserved);
- structureMenu.add(pdbMenu);
- structureMenu.add(viewStructureMenu);
- // structureMenu.add(colStructureMenu);
- noColourmenuItem.setText("None");
+ noColourmenuItem.setText(MessageManager.getString("label.none"));
noColourmenuItem.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
noColourmenuItem_actionPerformed();
}
});
- clustalColour.setText("Clustalx colours");
+ clustalColour.setText(MessageManager
+ .getString("label.clustalx_colours"));
clustalColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
clustalColour_actionPerformed();
}
});
- zappoColour.setText("Zappo");
+ zappoColour.setText(MessageManager.getString("label.zappo"));
zappoColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
zappoColour_actionPerformed();
}
});
- taylorColour.setText("Taylor");
+ taylorColour.setText(MessageManager.getString("label.taylor"));
taylorColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
taylorColour_actionPerformed();
}
});
- hydrophobicityColour.setText("Hydrophobicity");
+ hydrophobicityColour.setText(MessageManager
+ .getString("label.hydrophobicity"));
hydrophobicityColour
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
hydrophobicityColour_actionPerformed();
}
});
- helixColour.setText("Helix propensity");
+ helixColour.setText(MessageManager.getString("label.helix_propensity"));
helixColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
helixColour_actionPerformed();
}
});
- strandColour.setText("Strand propensity");
+ strandColour.setText(MessageManager
+ .getString("label.strand_propensity"));
strandColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
strandColour_actionPerformed();
}
});
- turnColour.setText("Turn propensity");
+ turnColour.setText(MessageManager.getString("label.turn_propensity"));
turnColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
turnColour_actionPerformed();
}
});
- buriedColour.setText("Buried Index");
+ buriedColour.setText(MessageManager.getString("label.buried_index"));
buriedColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
buriedColour_actionPerformed();
}
});
- abovePIDColour.setText("Above % Identity");
+ abovePIDColour.setText(MessageManager
+ .getString("label.above_identity_percentage"));
abovePIDColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
abovePIDColour_actionPerformed();
}
});
- userDefinedColour.setText("User Defined...");
+ userDefinedColour.setText(MessageManager
+ .getString("action.user_defined"));
userDefinedColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
userDefinedColour_actionPerformed(e);
}
});
- PIDColour.setText("Percentage Identity");
+ PIDColour
+ .setText(MessageManager.getString("label.percentage_identity"));
PIDColour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
PIDColour_actionPerformed();
}
});
- BLOSUM62Colour.setText("BLOSUM62");
+ BLOSUM62Colour.setText(MessageManager.getString("label.blosum62"));
BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
BLOSUM62Colour_actionPerformed();
}
});
- conservationMenuItem.setText("Conservation");
+ purinePyrimidineColour.setText(MessageManager
+ .getString("label.purine_pyrimidine"));
+ purinePyrimidineColour
+ .addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ purinePyrimidineColour_actionPerformed();
+ }
+ });
+
+ /*
+ * covariationColour.addActionListener(new java.awt.event.ActionListener() {
+ * public void actionPerformed(ActionEvent e) {
+ * covariationColour_actionPerformed(); } });
+ */
+
+ conservationMenuItem.setText(MessageManager
+ .getString("label.conservation"));
conservationMenuItem
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
conservationMenuItem_actionPerformed();
@@ -1171,6 +1653,161 @@ public class PopupMenu extends JPopupMenu
});
}
+ /**
+ * Check for any annotations on the underlying dataset sequences (for the
+ * current selection group) which are not 'on the alignment'.If any are found,
+ * enable the option to add them to the alignment. The criteria for 'on the
+ * alignment' is finding an alignment annotation on the alignment, matched on
+ * calcId, label and sequenceRef.
+ *
+ * A tooltip is also constructed that displays the source (calcId) and type
+ * (label) of the annotations that can be added.
+ *
+ * @param menuItem
+ * @param forSequences
+ */
+ protected void configureReferenceAnnotationsMenu(JMenuItem menuItem,
+ List<SequenceI> forSequences)
+ {
+ menuItem.setEnabled(false);
+
+ /*
+ * Temporary store to hold distinct calcId / type pairs for the tooltip.
+ * Using TreeMap means calcIds are shown in alphabetical order.
+ */
+ Map<String, String> tipEntries = new TreeMap<String, String>();
+ final Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<SequenceI, List<AlignmentAnnotation>>();
+ AlignmentI al = this.ap.av.getAlignment();
+ AlignmentUtils.findAddableReferenceAnnotations(forSequences,
+ tipEntries, candidates, al);
+ if (!candidates.isEmpty())
+ {
+ StringBuilder tooltip = new StringBuilder(64);
+ tooltip.append(MessageManager.getString("label.add_annotations_for"));
+
+ /*
+ * Found annotations that could be added. Enable the menu item, and
+ * configure its tooltip and action.
+ */
+ menuItem.setEnabled(true);
+ for (String calcId : tipEntries.keySet())
+ {
+ tooltip.append("<br/>" + calcId + "/" + tipEntries.get(calcId));
+ }
+ String tooltipText = JvSwingUtils.wrapTooltip(true,
+ tooltip.toString());
+ menuItem.setToolTipText(tooltipText);
+
+ menuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ addReferenceAnnotations_actionPerformed(candidates);
+ }
+ });
+ }
+ }
+
+ /**
+ * Add annotations to the sequences and to the alignment.
+ *
+ * @param candidates
+ * a map whose keys are sequences on the alignment, and values a list
+ * of annotations to add to each sequence
+ */
+ protected void addReferenceAnnotations_actionPerformed(
+ Map<SequenceI, List<AlignmentAnnotation>> candidates)
+ {
+ final SequenceGroup selectionGroup = this.ap.av.getSelectionGroup();
+ final AlignmentI alignment = this.ap.getAlignment();
+ AlignmentUtils.addReferenceAnnotations(candidates, alignment,
+ selectionGroup);
+ refresh();
+ }
+
+ protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent)
+ {
+ if (!ap.av.getAlignment().hasSeqrep())
+ {
+ // initialise the display flags so the user sees something happen
+ ap.av.setDisplayReferenceSeq(true);
+ ap.av.setColourByReferenceSeq(true);
+ ap.av.getAlignment().setSeqrep(sequence);
+ }
+ else
+ {
+ if (ap.av.getAlignment().getSeqrep() == sequence)
+ {
+ ap.av.getAlignment().setSeqrep(null);
+ }
+ else
+ {
+ ap.av.getAlignment().setSeqrep(sequence);
+ }
+ }
+ refresh();
+ }
+
+ protected void hideInsertions_actionPerformed(ActionEvent actionEvent)
+ {
+ if (sequence != null)
+ {
+ ColumnSelection cs = ap.av.getColumnSelection();
+ if (cs == null)
+ {
+ cs = new ColumnSelection();
+ }
+ cs.hideInsertionsFor(sequence);
+ ap.av.setColumnSelection(cs);
+ }
+ refresh();
+ }
+
+ protected void sequenceSelectionDetails_actionPerformed()
+ {
+ createSequenceDetailsReport(ap.av.getSequenceSelection());
+ }
+
+ protected void sequenceDetails_actionPerformed()
+ {
+ createSequenceDetailsReport(new SequenceI[] { sequence });
+ }
+
+ public void createSequenceDetailsReport(SequenceI[] sequences)
+ {
+ CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer();
+ StringBuffer contents = new StringBuffer();
+ for (SequenceI seq : sequences)
+ {
+ contents.append("<p><h2>"
+ + MessageManager
+ .formatMessage(
+ "label.create_sequence_details_report_annotation_for",
+ new Object[] { seq.getDisplayId(true) })
+ + "</h2></p><p>");
+ new SequenceAnnotationReport(null)
+ .createSequenceAnnotationReport(
+ contents,
+ seq,
+ true,
+ true,
+ false,
+ (ap.getSeqPanel().seqCanvas.fr != null) ? ap
+ .getSeqPanel().seqCanvas.fr.getMinMax()
+ : null);
+ contents.append("</p>");
+ }
+ cap.setText("<html>" + contents.toString() + "</html>");
+
+ Desktop.addInternalFrame(cap, MessageManager.formatMessage(
+ "label.sequence_details_for",
+ (sequences.length == 1 ? new Object[] { sequences[0]
+ .getDisplayId(true) } : new Object[] { MessageManager
+ .getString("label.selection") })), 500, 400);
+
+ }
+
protected void showNonconserved_actionPerformed()
{
getGroup().setShowNonconserved(displayNonconserved.isSelected());
@@ -1197,9 +1834,7 @@ public class PopupMenu extends JPopupMenu
protected void clustalColour_actionPerformed()
{
SequenceGroup sg = getGroup();
- sg.cs = new ClustalxColourScheme(
- sg.getSequences(ap.av.hiddenRepSequences),
- ap.av.alignment.getWidth());
+ sg.cs = new ClustalxColourScheme(sg, ap.av.getHiddenRepSequences());
refresh();
}
@@ -1299,6 +1934,16 @@ public class PopupMenu extends JPopupMenu
refresh();
}
+ protected void purinePyrimidineColour_actionPerformed()
+ {
+ getGroup().cs = new PurinePyrimidineColourScheme();
+ refresh();
+ }
+
+ /*
+ * protected void covariationColour_actionPerformed() { getGroup().cs = new
+ * CovariationColourScheme(sequence.getAnnotation()[0]); refresh(); }
+ */
/**
* DOCUMENT ME!
*
@@ -1316,20 +1961,20 @@ public class PopupMenu extends JPopupMenu
if (abovePIDColour.isSelected())
{
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
- sg.getEndRes() + 1));
+ sg.getSequences(ap.av.getHiddenRepSequences()),
+ sg.getStartRes(), sg.getEndRes() + 1));
int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup()
.getName());
- sg.cs.setThreshold(threshold, ap.av.getIgnoreGapsConsensus());
+ sg.cs.setThreshold(threshold, ap.av.isIgnoreGapsConsensus());
SliderPanel.showPIDSlider();
}
else
// remove PIDColouring
{
- sg.cs.setThreshold(0, ap.av.getIgnoreGapsConsensus());
+ sg.cs.setThreshold(0, ap.av.isIgnoreGapsConsensus());
}
refresh();
@@ -1345,7 +1990,7 @@ public class PopupMenu extends JPopupMenu
{
SequenceGroup sg = getGroup();
- if (e.getActionCommand().equals("User Defined..."))
+ if (e.getSource().equals(userDefinedColour))
{
new UserDefinedColours(ap, sg);
}
@@ -1360,6 +2005,18 @@ public class PopupMenu extends JPopupMenu
}
/**
+ * Open a panel where the user can choose which types of sequence annotation
+ * to show or hide.
+ *
+ * @param e
+ */
+ protected void chooseAnnotations_actionPerformed(ActionEvent e)
+ {
+ // todo correct way to guard against opening a duplicate panel?
+ new AnnotationChooser(ap);
+ }
+
+ /**
* DOCUMENT ME!
*
* @param e
@@ -1370,8 +2027,8 @@ public class PopupMenu extends JPopupMenu
SequenceGroup sg = getGroup();
sg.cs = new PIDColourScheme();
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
- sg.getEndRes() + 1));
+ sg.getSequences(ap.av.getHiddenRepSequences()),
+ sg.getStartRes(), sg.getEndRes() + 1));
refresh();
}
@@ -1388,8 +2045,8 @@ public class PopupMenu extends JPopupMenu
sg.cs = new Blosum62ColourScheme();
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
- sg.getEndRes() + 1));
+ sg.getSequences(ap.av.getHiddenRepSequences()),
+ sg.getStartRes(), sg.getEndRes() + 1));
refresh();
}
@@ -1422,13 +2079,14 @@ public class PopupMenu extends JPopupMenu
if (conservationMenuItem.isSelected())
{
+ // JBPNote: Conservation name shouldn't be i18n translated
Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3,
- sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
+ ResidueProperties.propHash, 3, sg.getSequences(ap.av
+ .getHiddenRepSequences()), sg.getStartRes(),
sg.getEndRes() + 1);
c.calculate();
- c.verdict(false, ap.av.ConsPercGaps);
+ c.verdict(false, ap.av.getConsPercGaps());
sg.cs.setConservation(c);
@@ -1456,7 +2114,7 @@ public class PopupMenu extends JPopupMenu
sequence.getAnnotation()[0], null,
AnnotationColourGradient.NO_THRESHOLD);
- acg.predefinedColours = true;
+ acg.setPredefinedColours(true);
sg.cs = acg;
refresh();
@@ -1473,8 +2131,10 @@ public class PopupMenu extends JPopupMenu
SequenceGroup sg = getGroup();
EditNameDialog dialog = new EditNameDialog(sg.getName(),
- sg.getDescription(), " Group Name ",
- "Group Description ", "Edit Group Name/Description",
+ sg.getDescription(), " "
+ + MessageManager.getString("label.group_name") + " ",
+ MessageManager.getString("label.group_description") + " ",
+ MessageManager.getString("label.edit_group_name_description"),
ap.alignFrame);
if (!dialog.accept)
@@ -1498,7 +2158,7 @@ public class PopupMenu extends JPopupMenu
// this method won't add a new group if it already exists
if (sg != null)
{
- ap.av.alignment.addGroup(sg);
+ ap.av.getAlignment().addGroup(sg);
}
return sg;
@@ -1513,8 +2173,12 @@ public class PopupMenu extends JPopupMenu
void sequenceName_actionPerformed()
{
EditNameDialog dialog = new EditNameDialog(sequence.getName(),
- sequence.getDescription(), " Sequence Name ",
- "Sequence Description ", "Edit Sequence Name/Description",
+ sequence.getDescription(),
+ " " + MessageManager.getString("label.sequence_name")
+ + " ",
+ MessageManager.getString("label.sequence_description") + " ",
+ MessageManager
+ .getString("label.edit_sequence_name_description"),
ap.alignFrame);
if (!dialog.accept)
@@ -1526,10 +2190,14 @@ public class PopupMenu extends JPopupMenu
{
if (dialog.getName().indexOf(" ") > -1)
{
- JOptionPane.showMessageDialog(ap,
- "Spaces have been converted to \"_\"",
- "No spaces allowed in Sequence Name",
- JOptionPane.WARNING_MESSAGE);
+ JOptionPane
+ .showMessageDialog(
+ ap,
+ MessageManager
+ .getString("label.spaces_converted_to_backslashes"),
+ MessageManager
+ .getString("label.no_spaces_allowed_sequence_name"),
+ JOptionPane.WARNING_MESSAGE);
}
sequence.setName(dialog.getName().replace(' ', '_'));
@@ -1552,11 +2220,18 @@ public class PopupMenu extends JPopupMenu
void unGroupMenuItem_actionPerformed()
{
SequenceGroup sg = ap.av.getSelectionGroup();
- ap.av.alignment.deleteGroup(sg);
+ ap.av.getAlignment().deleteGroup(sg);
ap.av.setSelectionGroup(null);
refresh();
}
+ void createGroupMenuItem_actionPerformed()
+ {
+ getGroup(); // implicitly creates group - note - should apply defaults / use
+ // standard alignment window logic for this
+ refresh();
+ }
+
/**
* DOCUMENT ME!
*
@@ -1566,7 +2241,8 @@ public class PopupMenu extends JPopupMenu
protected void outline_actionPerformed()
{
SequenceGroup sg = getGroup();
- Color col = JColorChooser.showDialog(this, "Select Outline Colour",
+ Color col = JColorChooser.showDialog(this,
+ MessageManager.getString("label.select_outline_colour"),
Color.BLUE);
if (col != null)
@@ -1620,12 +2296,10 @@ public class PopupMenu extends JPopupMenu
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
- "Unixers: Couldn't find default web browser."
- + "\nAdd the full path to your browser in Preferences.",
- "Web browser not found", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.web_browser_not_found_unix"),
+ MessageManager.getString("label.web_browser_not_found"),
+ JOptionPane.WARNING_MESSAGE);
ex.printStackTrace();
}
@@ -1636,8 +2310,7 @@ public class PopupMenu extends JPopupMenu
SequenceGroup sg = ap.av.getSelectionGroup();
if (sg == null || sg.getSize() < 1)
{
- ap.av.hideSequence(new SequenceI[]
- { sequence });
+ ap.av.hideSequence(new SequenceI[] { sequence });
return;
}
@@ -1651,15 +2324,7 @@ public class PopupMenu extends JPopupMenu
}
int gsize = sg.getSize();
- SequenceI[] hseqs;
-
- hseqs = new SequenceI[gsize];
-
- int index = 0;
- for (int i = 0; i < gsize; i++)
- {
- hseqs[index++] = sg.getSequenceAt(i);
- }
+ SequenceI[] hseqs = sg.getSequences().toArray(new SequenceI[gsize]);
ap.av.hideSequence(hseqs);
// refresh(); TODO: ? needed ?
@@ -1683,31 +2348,31 @@ public class PopupMenu extends JPopupMenu
if (sg != null)
{
- int[][] startEnd = ap.av.getVisibleRegionBoundaries(sg.getStartRes(),
- sg.getEndRes() + 1);
+ List<int[]> startEnd = ap.av.getVisibleRegionBoundaries(
+ sg.getStartRes(), sg.getEndRes() + 1);
String description;
int caseChange;
if (source == toggle)
{
- description = "Toggle Case";
+ description = MessageManager.getString("label.toggle_case");
caseChange = ChangeCaseCommand.TOGGLE_CASE;
}
else if (source == upperCase)
{
- description = "To Upper Case";
+ description = MessageManager.getString("label.to_upper_case");
caseChange = ChangeCaseCommand.TO_UPPER;
}
else
{
- description = "To Lower Case";
+ description = MessageManager.getString("label.to_lower_case");
caseChange = ChangeCaseCommand.TO_LOWER;
}
ChangeCaseCommand caseCommand = new ChangeCaseCommand(description,
- sg.getSequencesAsArray(ap.av.hiddenRepSequences), startEnd,
- caseChange);
+ sg.getSequencesAsArray(ap.av.getHiddenRepSequences()),
+ startEnd, caseChange);
ap.alignFrame.addHistoryItem(caseCommand);
@@ -1721,30 +2386,18 @@ public class PopupMenu extends JPopupMenu
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
cap.setForInput(null);
- Desktop.addInternalFrame(cap,
- "Alignment output - " + e.getActionCommand(), 600, 500);
+ Desktop.addInternalFrame(cap, MessageManager.formatMessage(
+ "label.alignment_output_command",
+ new Object[] { e.getActionCommand() }), 600, 500);
String[] omitHidden = null;
System.out.println("PROMPT USER HERE"); // TODO: decide if a prompt happens
// or we simply trust the user wants
// wysiwig behaviour
- SequenceGroup sg = ap.av.getSelectionGroup();
- ColumnSelection csel = new ColumnSelection(ap.av.getColumnSelection());
- omitHidden = ap.av.getViewAsString(true);
- Alignment oal = new Alignment(ap.av.getSequenceSelection());
- AlignmentAnnotation[] nala = ap.av.alignment.getAlignmentAnnotation();
- if (nala != null)
- {
- for (int i = 0; i < nala.length; i++)
- {
- AlignmentAnnotation na = nala[i];
- oal.addAnnotation(na);
- }
- }
- cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(),
- oal, omitHidden, csel, sg));
- oal = null;
+
+ cap.setText(new FormatAdapter(ap).formatSequences(e.getActionCommand(),
+ ap, true));
}
public void pdbFromFile_actionPerformed()
@@ -1752,8 +2405,12 @@ public class PopupMenu extends JPopupMenu
jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Select a PDB file for "+sequence.getDisplayId(false));
- chooser.setToolTipText("Load a PDB file and associate it with sequence '"+sequence.getDisplayId(false)+"'");
+ chooser.setDialogTitle(MessageManager.formatMessage(
+ "label.select_pdb_file_for",
+ new Object[] { sequence.getDisplayId(false) }));
+ chooser.setToolTipText(MessageManager.formatMessage(
+ "label.load_pdb_file_associate_with_sequence",
+ new Object[] { sequence.getDisplayId(false) }));
int value = chooser.showOpenDialog(null);
@@ -1761,7 +2418,9 @@ public class PopupMenu extends JPopupMenu
{
String choice = chooser.getSelectedFile().getPath();
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
- new AssociatePdbFileWithSeq().associatePdbWithSeq(choice, jalview.io.AppletFormatAdapter.FILE, sequence, true);
+ new AssociatePdbFileWithSeq().associatePdbWithSeq(choice,
+ jalview.io.AppletFormatAdapter.FILE, sequence, true,
+ Desktop.instance);
}
}
@@ -1769,7 +2428,9 @@ public class PopupMenu extends JPopupMenu
public void enterPDB_actionPerformed()
{
String id = JOptionPane.showInternalInputDialog(Desktop.desktop,
- "Enter PDB Id", "Enter PDB Id", JOptionPane.QUESTION_MESSAGE);
+ MessageManager.getString("label.enter_pdb_id"),
+ MessageManager.getString("label.enter_pdb_id"),
+ JOptionPane.QUESTION_MESSAGE);
if (id != null && id.length() > 0)
{
@@ -1782,11 +2443,12 @@ public class PopupMenu extends JPopupMenu
public void discoverPDB_actionPerformed()
{
- final SequenceI[] sequences = ((ap.av.selectionGroup == null) ? new Sequence[]
+ final SequenceI[] sequences = ((ap.av.getSelectionGroup() == null) ? new SequenceI[]
{ sequence }
- : ap.av.selectionGroup.getSequencesInOrder(ap.av.alignment));
+ : ap.av.getSequenceSelection());
Thread discpdb = new Thread(new Runnable()
{
+ @Override
public void run()
{
@@ -1828,7 +2490,7 @@ public class PopupMenu extends JPopupMenu
System.arraycopy(features, 0, tfeatures, 0, rsize);
features = tfeatures;
seqs = rseqs;
- if (ap.seqPanel.seqCanvas.getFeatureRenderer().amendFeatures(seqs,
+ if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(seqs,
features, true, ap))
{
ap.alignFrame.setShowSeqFeatures(true);
@@ -1847,16 +2509,16 @@ public class PopupMenu extends JPopupMenu
public void colourByStructure(String pdbid)
{
- Annotation[] anots = ap.av.getStructureSelectionManager().colourSequenceFromStructure(
- sequence, pdbid);
+ Annotation[] anots = ap.av.getStructureSelectionManager()
+ .colourSequenceFromStructure(sequence, pdbid);
AlignmentAnnotation an = new AlignmentAnnotation("Structure",
"Coloured by " + pdbid, anots);
- ap.av.alignment.addAnnotation(an);
+ ap.av.getAlignment().addAnnotation(an);
an.createSequenceMapping(sequence, 0, true);
// an.adjustForAlignment();
- ap.av.alignment.setAnnotationIndex(an, 0);
+ ap.av.getAlignment().setAnnotationIndex(an, 0);
ap.adjustAnnotationHeight();
@@ -1871,20 +2533,25 @@ public class PopupMenu extends JPopupMenu
if (sg != null)
{
if (sequence == null)
- sequence = (Sequence) sg.getSequenceAt(0);
+ {
+ sequence = sg.getSequenceAt(0);
+ }
EditNameDialog dialog = new EditNameDialog(
sequence.getSequenceAsString(sg.getStartRes(),
- sg.getEndRes() + 1), null, "Edit Sequence ", null,
- "Edit Sequence", ap.alignFrame);
+ sg.getEndRes() + 1), null,
+ MessageManager.getString("label.edit_sequence"), null,
+ MessageManager.getString("label.edit_sequence"),
+ ap.alignFrame);
if (dialog.accept)
{
- EditCommand editCommand = new EditCommand("Edit Sequences",
- EditCommand.REPLACE, dialog.getName().replace(' ',
+ EditCommand editCommand = new EditCommand(
+ MessageManager.getString("label.edit_sequences"),
+ Action.REPLACE, dialog.getName().replace(' ',
ap.av.getGapCharacter()),
- sg.getSequencesAsArray(ap.av.hiddenRepSequences),
- sg.getStartRes(), sg.getEndRes() + 1, ap.av.alignment);
+ sg.getSequencesAsArray(ap.av.getHiddenRepSequences()),
+ sg.getStartRes(), sg.getEndRes() + 1, ap.av.getAlignment());
ap.alignFrame.addHistoryItem(editCommand);
diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java
index 27c455e..78a21c8 100644
--- a/src/jalview/gui/Preferences.java
+++ b/src/jalview/gui/Preferences.java
@@ -1,34 +1,57 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-import jalview.bin.*;
-import jalview.io.*;
-import jalview.jbgui.*;
-import jalview.schemes.*;
-import jalview.ws.EnfinEnvision2OneWay;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.bin.Cache;
+import jalview.gui.Help.HelpId;
+import jalview.gui.StructureViewer.ViewerType;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.jbgui.GPreferences;
+import jalview.jbgui.GSequenceLink;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.help.HelpSetException;
+import javax.swing.JColorChooser;
+import javax.swing.JFileChooser;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
/**
* DOCUMENT ME!
@@ -38,6 +61,35 @@ import jalview.ws.EnfinEnvision2OneWay;
*/
public class Preferences extends GPreferences
{
+ public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME";
+
+ public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA";
+
+ public static final String DEFAULT_COLOUR = "DEFAULT_COLOUR";
+
+ public static final String DEFAULT_COLOUR_PROT = "DEFAULT_COLOUR_PROT";
+
+ public static final String DEFAULT_COLOUR_NUC = "DEFAULT_COLOUR_NUC";
+
+ public static final String ADD_TEMPFACT_ANN = "ADD_TEMPFACT_ANN";
+
+ public static final String ADD_SS_ANN = "ADD_SS_ANN";
+
+ public static final String USE_RNAVIEW = "USE_RNAVIEW";
+
+ public static final String STRUCT_FROM_PDB = "STRUCT_FROM_PDB";
+
+ public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY";
+
+ public static final String CHIMERA_PATH = "CHIMERA_PATH";
+
+ public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
+
+ public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
+
+ private static final int MIN_FONT_SIZE = 1;
+
+ private static final int MAX_FONT_SIZE = 30;
/**
* Holds name and link separated with | character. Sequence ID must be
@@ -59,7 +111,7 @@ public class Preferences extends GPreferences
String string = Cache
.getDefault(
"SEQUENCE_LINKS",
- "SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry");
+ "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$");
sequenceURLLinks = new Vector();
try
@@ -81,15 +133,25 @@ public class Preferences extends GPreferences
{
System.out.println(ex + "\nError parsing sequence links");
}
+ {
+ // upgrade old SRS link
+ int srsPos = sequenceURLLinks
+ .indexOf("SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry");
+ if (srsPos > -1)
+ {
+ sequenceURLLinks
+ .setElementAt(
+ "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$",
+ srsPos);
+ }
+ }
+
/**
* TODO: reformulate groupURL encoding so two or more can be stored in the
* .properties file as '|' separated strings
*/
groupURLLinks = new Vector();
- // groupURLLinks.addElement("UNIPROT|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=Default&datasetName=JalviewIDs$DATASETID$&input=$SEQUENCEIDS$&inputType=0|,");
- // groupURLLinks.addElement("Seqs|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=Default&datasetName=JalviewSeqs$DATASETID$&input=$SEQUENCES=/([A-Za-z]+)+/=$&inputType=1|,");
-
}
Vector nameLinks, urlLinks;
@@ -105,23 +167,27 @@ public class Preferences extends GPreferences
*/
public Preferences()
{
-
+ super();
frame = new JInternalFrame();
frame.setContentPane(this);
dasSource = new DasSourceBrowser();
- dasPanel.add(dasSource, BorderLayout.CENTER);
+ dasTab.add(dasSource, BorderLayout.CENTER);
wsPrefs = new WsPreferences();
- wsPanel.add(wsPrefs, BorderLayout.CENTER);
- int width = 500, height = 420;
+ wsTab.add(wsPrefs, BorderLayout.CENTER);
+ int width = 500, height = 450;
if (new jalview.util.Platform().isAMac())
{
width = 570;
- height = 460;
+ height = 480;
}
- Desktop.addInternalFrame(frame, "Preferences", width, height);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("label.preferences"), width, height);
frame.setMinimumSize(new Dimension(width, height));
+ /*
+ * Set Visual tab defaults
+ */
seqLimit.setSelected(Cache.getDefault("SHOW_JVSUFFIX", true));
rightAlign.setSelected(Cache.getDefault("RIGHT_ALIGN_IDS", false));
fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false));
@@ -133,35 +199,27 @@ public class Preferences extends GPreferences
openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false));
showUnconserved
.setSelected(Cache.getDefault("SHOW_UNCONSERVED", false));
+ showGroupConsensus.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS",
+ false));
+ showGroupConservation.setSelected(Cache.getDefault(
+ "SHOW_GROUP_CONSERVATION", false));
+ showConsensHistogram.setSelected(Cache.getDefault(
+ "SHOW_CONSENSUS_HISTOGRAM", true));
+ showConsensLogo.setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO",
+ false));
showNpTooltip.setSelected(Cache
.getDefault("SHOW_NPFEATS_TOOLTIP", true));
showDbRefTooltip.setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP",
true));
- sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false));
- for (int i = ColourSchemeProperty.FIRST_COLOUR; i <= ColourSchemeProperty.LAST_COLOUR; i++)
- {
- colour.addItem(ColourSchemeProperty.getColourName(i));
- }
-
- String string = Cache.getDefault("DEFAULT_COLOUR", "None");
-
- colour.setSelectedItem(string);
-
- /**
- * default min-max colours for annotation shading
- */
- minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange));
- maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red));
String[] fonts = java.awt.GraphicsEnvironment
.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
-
for (int i = 0; i < fonts.length; i++)
{
fontNameCB.addItem(fonts[i]);
}
- for (int i = 1; i < 31; i++)
+ for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++)
{
fontSizeCB.addItem(i + "");
}
@@ -176,6 +234,8 @@ public class Preferences extends GPreferences
+ ""));
smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false));
+ scaleProteinToCdna.setSelected(Cache.getDefault(SCALE_PROTEIN_TO_CDNA,
+ false));
idItalics.setSelected(Cache.getDefault("ID_ITALICS", true));
@@ -186,47 +246,75 @@ public class Preferences extends GPreferences
gapSymbolCB.setSelectedItem(Cache.getDefault("GAP_SYMBOL", "-"));
- startupCheckbox
- .setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true));
- startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE",
- Cache.getDefault("www.jalview.org","http://www.jalview.org")+"/examples/exampleFile_2_3.jar"));
-
sortby.addItem("No sort");
sortby.addItem("Id");
sortby.addItem("Pairwise Identity");
sortby.setSelectedItem(Cache.getDefault("SORT_ALIGNMENT", "No sort"));
- epsRendering.addItem("Prompt each time");
- epsRendering.addItem("Lineart");
- epsRendering.addItem("Text");
- epsRendering.setSelectedItem(Cache.getDefault("EPS_RENDERING",
- "Prompt each time"));
-
- blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true));
- clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true));
- fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true));
- msfjv.setSelected(Cache.getDefault("MSF_JVSUFFIX", true));
- pfamjv.setSelected(Cache.getDefault("PFAM_JVSUFFIX", true));
- pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true));
- pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true));
-
- modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false));
-
- autoCalculateConsCheck.setSelected(Cache.getDefault(
- "AUTO_CALC_CONSENSUS", true));
- showGroupConsensus.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS",
- false));
- showGroupConservation.setSelected(Cache.getDefault(
- "SHOW_GROUP_CONSERVATION", false));
- showConsensHistogram.setSelected(Cache.getDefault(
- "SHOW_CONSENSUS_HISTOGRAM", true));
- showConsensLogo.setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO",
- false));
+ sortAnnBy.addItem(SequenceAnnotationOrder.NONE.toString());
+ sortAnnBy
+ .addItem(SequenceAnnotationOrder.SEQUENCE_AND_LABEL.toString());
+ sortAnnBy
+ .addItem(SequenceAnnotationOrder.LABEL_AND_SEQUENCE.toString());
+ SequenceAnnotationOrder savedSort = SequenceAnnotationOrder
+ .valueOf(Cache.getDefault(SORT_ANNOTATIONS,
+ SequenceAnnotationOrder.NONE.name()));
+ sortAnnBy.setSelectedItem(savedSort.toString());
+
+ sortAutocalc.addItem("Autocalculated first");
+ sortAutocalc.addItem("Autocalculated last");
+ final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE, true);
+ sortAutocalc.setSelectedItem(showAbove ? sortAutocalc.getItemAt(0)
+ : sortAutocalc.getItemAt(1));
+ startupCheckbox
+ .setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true));
+ startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE",
+ Cache.getDefault("www.jalview.org", "http://www.jalview.org")
+ + "/examples/exampleFile_2_3.jar"));
- padGaps.setSelected(Cache.getDefault("PAD_GAPS", false));
+ /*
+ * Set Colours tab defaults
+ */
+ for (int i = ColourSchemeProperty.FIRST_COLOUR; i <= ColourSchemeProperty.LAST_COLOUR; i++)
+ {
+ protColour.addItem(ColourSchemeProperty.getColourName(i));
+ nucColour.addItem(ColourSchemeProperty.getColourName(i));
+ }
+ String oldProp = Cache.getDefault(DEFAULT_COLOUR, "None");
+ String newProp = Cache.getDefault(DEFAULT_COLOUR_PROT, null);
+ protColour.setSelectedItem(newProp != null ? newProp : oldProp);
+ newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null);
+ nucColour.setSelectedItem(newProp != null ? newProp : oldProp);
+ minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN",
+ Color.orange));
+ maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX",
+ Color.red));
+
+ /*
+ * Set Structure tab defaults.
+ */
+ final boolean structSelected = Cache.getDefault(STRUCT_FROM_PDB, false);
+ structFromPdb.setSelected(structSelected);
+ useRnaView.setSelected(Cache.getDefault(USE_RNAVIEW, false));
+ useRnaView.setEnabled(structSelected);
+ addSecondaryStructure.setSelected(Cache.getDefault(ADD_SS_ANN, false));
+ addSecondaryStructure.setEnabled(structSelected);
+ addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false));
+ addTempFactor.setEnabled(structSelected);
+ structViewer.setSelectedItem(Cache.getDefault(STRUCTURE_DISPLAY,
+ ViewerType.JMOL.name()));
+ chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, ""));
+ chimeraPath.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ validateChimeraPath();
+ }
+ });
- /***************************************************************************
- * Set up Connections
+ /*
+ * Set Connections tab defaults
*/
nameLinks = new Vector();
urlLinks = new Vector();
@@ -248,34 +336,64 @@ public class Preferences extends GPreferences
defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", ""));
usagestats.setSelected(Cache.getDefault("USAGESTATS", false));
+ // note antisense here: default is true
questionnaire
- .setSelected(Cache.getProperty("NOQUESTIONNAIRES") == null); // note
- // antisense
- // here
- versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true)); // default
- // is
- // true
+ .setSelected(Cache.getProperty("NOQUESTIONNAIRES") == null);
+ versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true));
+
+ /*
+ * Set Output tab defaults
+ */
+ epsRendering
+ .addItem(MessageManager.getString("label.prompt_each_time"));
+ epsRendering.addItem(MessageManager.getString("label.lineart"));
+ epsRendering.addItem(MessageManager.getString("action.text"));
+ epsRendering.setSelectedItem(Cache.getDefault("EPS_RENDERING",
+ "Prompt each time"));
+ autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false));
+ userIdWidth.setEnabled(!autoIdWidth.isSelected());
+ userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
+ Integer wi = Cache.getIntegerProperty("FIGURE_USERIDWIDTH");
+ userIdWidth.setText(wi == null ? "" : wi.toString());
+ blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true));
+ clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true));
+ fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true));
+ msfjv.setSelected(Cache.getDefault("MSF_JVSUFFIX", true));
+ pfamjv.setSelected(Cache.getDefault("PFAM_JVSUFFIX", true));
+ pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true));
+ pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true));
+ modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false));
+ embbedBioJSON.setSelected(Cache.getDefault("EXPORT_EMBBED_BIOJSON",
+ true));
+
+ /*
+ * Set Editing tab defaults
+ */
+ autoCalculateConsCheck.setSelected(Cache.getDefault(
+ "AUTO_CALC_CONSENSUS", true));
+ padGaps.setSelected(Cache.getDefault("PAD_GAPS", false));
+ sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false));
+
annotations_actionPerformed(null); // update the display of the annotation
// settings
- try
- {
- jbInit();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
}
/**
- * DOCUMENT ME!
+ * Save user selections on the Preferences tabs to the Cache and write out to
+ * file.
*
* @param e
- * DOCUMENT ME!
*/
public void ok_actionPerformed(ActionEvent e)
{
+ if (!validateSettings())
+ {
+ return;
+ }
+ /*
+ * Save Visual settings
+ */
Cache.applicationProperties.setProperty("SHOW_JVSUFFIX",
Boolean.toString(seqLimit.isSelected()));
Cache.applicationProperties.setProperty("RIGHT_ALIGN_IDS",
@@ -293,8 +411,6 @@ public class Preferences extends GPreferences
Cache.applicationProperties.setProperty("SHOW_IDENTITY",
Boolean.toString(identity.isSelected()));
- Cache.applicationProperties.setProperty("DEFAULT_COLOUR", colour
- .getSelectedItem().toString());
Cache.applicationProperties.setProperty("GAP_SYMBOL", gapSymbolCB
.getSelectedItem().toString());
@@ -319,6 +435,8 @@ public class Preferences extends GPreferences
Boolean.toString(showConsensLogo.isSelected()));
Cache.applicationProperties.setProperty("ANTI_ALIAS",
Boolean.toString(smoothFont.isSelected()));
+ Cache.applicationProperties.setProperty(SCALE_PROTEIN_TO_CDNA,
+ Boolean.toString(scaleProteinToCdna.isSelected()));
Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP",
Boolean.toString(showNpTooltip.isSelected()));
Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP",
@@ -335,9 +453,49 @@ public class Preferences extends GPreferences
Cache.applicationProperties.setProperty("SORT_ALIGNMENT", sortby
.getSelectedItem().toString());
- Cache.setColourProperty("ANNOTATIONCOLOUR_MIN", minColour.getBackground());
- Cache.setColourProperty("ANNOTATIONCOLOUR_MAX", maxColour.getBackground());
-
+ // convert description of sort order to enum name for save
+ SequenceAnnotationOrder annSortOrder = SequenceAnnotationOrder
+ .forDescription(sortAnnBy.getSelectedItem().toString());
+ if (annSortOrder != null)
+ {
+ Cache.applicationProperties.setProperty(SORT_ANNOTATIONS,
+ annSortOrder.name());
+ }
+
+ final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0;
+ Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE, Boolean
+ .valueOf(showAutocalcFirst).toString());
+
+ /*
+ * Save Colours settings
+ */
+ Cache.applicationProperties.setProperty(DEFAULT_COLOUR_PROT, protColour
+ .getSelectedItem().toString());
+ Cache.applicationProperties.setProperty(DEFAULT_COLOUR_NUC, nucColour
+ .getSelectedItem().toString());
+ Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
+ minColour.getBackground());
+ Cache.setColourProperty("ANNOTATIONCOLOUR_MAX",
+ maxColour.getBackground());
+
+ /*
+ * Save Structure settings
+ */
+ Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN,
+ Boolean.toString(addTempFactor.isSelected()));
+ Cache.applicationProperties.setProperty(ADD_SS_ANN,
+ Boolean.toString(addSecondaryStructure.isSelected()));
+ Cache.applicationProperties.setProperty(USE_RNAVIEW,
+ Boolean.toString(useRnaView.isSelected()));
+ Cache.applicationProperties.setProperty(STRUCT_FROM_PDB,
+ Boolean.toString(structFromPdb.isSelected()));
+ Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY, structViewer
+ .getSelectedItem().toString());
+ Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
+
+ /*
+ * Save Output settings
+ */
if (epsRendering.getSelectedItem().equals("Prompt each time"))
{
Cache.applicationProperties.remove("EPS_RENDERING");
@@ -348,15 +506,10 @@ public class Preferences extends GPreferences
.getSelectedItem().toString());
}
- if (defaultBrowser.getText().trim().length() < 1)
- {
- Cache.applicationProperties.remove("DEFAULT_BROWSER");
- }
- else
- {
- Cache.applicationProperties.setProperty("DEFAULT_BROWSER",
- defaultBrowser.getText());
- }
+ /*
+ * Save Connections settings
+ */
+ Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText());
jalview.util.BrowserLauncher.resetBrowser();
@@ -384,25 +537,9 @@ public class Preferences extends GPreferences
Cache.applicationProperties.setProperty("USE_PROXY",
Boolean.toString(useProxy.isSelected()));
- if (proxyServerTB.getText().trim().length() < 1)
- {
- Cache.applicationProperties.remove("PROXY_SERVER");
- }
- else
- {
- Cache.applicationProperties.setProperty("PROXY_SERVER",
- proxyServerTB.getText());
- }
+ Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText());
- if (proxyPortTB.getText().trim().length() < 1)
- {
- Cache.applicationProperties.remove("PROXY_PORT");
- }
- else
- {
- Cache.applicationProperties.setProperty("PROXY_PORT",
- proxyPortTB.getText());
- }
+ Cache.setOrRemove("PROXY_PORT", proxyPortTB.getText());
if (useProxy.isSelected())
{
@@ -432,6 +569,10 @@ public class Preferences extends GPreferences
// by just adding the given line
Cache.removeProperty("NOQUESTIONNAIRES");
}
+
+ /*
+ * Save Output settings
+ */
Cache.applicationProperties.setProperty("BLC_JVSUFFIX",
Boolean.toString(blcjv.isSelected()));
Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX",
@@ -448,8 +589,19 @@ public class Preferences extends GPreferences
Boolean.toString(pirjv.isSelected()));
Cache.applicationProperties.setProperty("PIR_MODELLER",
Boolean.toString(modellerOutput.isSelected()));
+ Cache.applicationProperties.setProperty("EXPORT_EMBBED_BIOJSON",
+ Boolean.toString(embbedBioJSON.isSelected()));
jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected();
+ Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH",
+ Boolean.toString(autoIdWidth.isSelected()));
+ userIdWidth_actionPerformed();
+ Cache.applicationProperties.setProperty("FIGURE_USERIDWIDTH",
+ userIdWidth.getText());
+
+ /*
+ * Save Editing settings
+ */
Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS",
Boolean.toString(autoCalculateConsCheck.isSelected()));
Cache.applicationProperties.setProperty("SORT_BY_TREE",
@@ -460,6 +612,7 @@ public class Preferences extends GPreferences
dasSource.saveProperties(Cache.applicationProperties);
wsPrefs.updateAndRefreshWsMenuConfig(false);
Cache.saveProperties();
+ Desktop.instance.doConfigureStructurePrefs();
try
{
frame.setClosed(true);
@@ -469,19 +622,42 @@ public class Preferences extends GPreferences
}
/**
+ * Do any necessary validation before saving settings. Return focus to the
+ * first tab which fails validation.
+ *
+ * @return
+ */
+ private boolean validateSettings()
+ {
+ if (!validateStructure())
+ {
+ structureTab.requestFocusInWindow();
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected boolean validateStructure()
+ {
+ return validateChimeraPath();
+
+ }
+
+ /**
* DOCUMENT ME!
*/
public void startupFileTextfield_mouseClicked()
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
- new String[]
- { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "jar" },
- new String[]
- { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview" },
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] {
+ "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",
+ "jar" }, new String[] { "Fasta", "Clustal", "PFAM", "MSF",
+ "PIR", "BLC", "Jalview" },
jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Select startup file");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.select_startup_file"));
int value = chooser.showOpenDialog(this);
@@ -539,8 +715,8 @@ public class Preferences extends GPreferences
while (!valid)
{
if (JOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
- "New sequence URL link", JOptionPane.OK_CANCEL_OPTION, -1,
- null) == JOptionPane.OK_OPTION)
+ MessageManager.getString("label.new_sequence_url_link"),
+ JOptionPane.OK_CANCEL_OPTION, -1, null) == JOptionPane.OK_OPTION)
{
if (link.checkValid())
{
@@ -565,7 +741,8 @@ public class Preferences extends GPreferences
if (index == -1)
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "No link selected!", "No link selected",
+ MessageManager.getString("label.no_link_selected"),
+ MessageManager.getString("label.no_link_selected"),
JOptionPane.WARNING_MESSAGE);
return;
}
@@ -578,8 +755,8 @@ public class Preferences extends GPreferences
{
if (JOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
- "New sequence URL link", JOptionPane.OK_CANCEL_OPTION, -1,
- null) == JOptionPane.OK_OPTION)
+ MessageManager.getString("label.new_sequence_url_link"),
+ JOptionPane.OK_CANCEL_OPTION, -1, null) == JOptionPane.OK_OPTION)
{
if (link.checkValid())
{
@@ -603,7 +780,8 @@ public class Preferences extends GPreferences
if (index == -1)
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "No link selected!", "No link selected",
+ MessageManager.getString("label.no_link_selected"),
+ MessageManager.getString("label.no_link_selected"),
JOptionPane.WARNING_MESSAGE);
return;
}
@@ -621,7 +799,8 @@ public class Preferences extends GPreferences
public void defaultBrowser_mouseClicked(MouseEvent e)
{
JFileChooser chooser = new JFileChooser(".");
- chooser.setDialogTitle("Select default web browser");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.select_default_browser"));
int value = chooser.showOpenDialog(this);
@@ -645,34 +824,136 @@ public class Preferences extends GPreferences
super.showunconserved_actionPerformed(e);
}
- private void jbInit() throws Exception
- {
- }
-
public static Collection getGroupURLLinks()
{
return groupURLLinks;
}
- public void minColour_actionPerformed()
+
+ @Override
+ public void minColour_actionPerformed(JPanel panel)
{
Color col = JColorChooser.showDialog(this,
- "Select Colour for Minimum Value", minColour.getBackground());
+ MessageManager.getString("label.select_colour_minimum_value"),
+ minColour.getBackground());
if (col != null)
{
- minColour.setBackground(col);
+ panel.setBackground(col);
}
- minColour.repaint();
+ panel.repaint();
}
- public void maxColour_actionPerformed()
+ @Override
+ public void maxColour_actionPerformed(JPanel panel)
{
Color col = JColorChooser.showDialog(this,
- "Select Colour for Maximum Value", maxColour.getBackground());
+ MessageManager.getString("label.select_colour_maximum_value"),
+ maxColour.getBackground());
if (col != null)
{
- maxColour.setBackground(col);
+ panel.setBackground(col);
+ }
+ panel.repaint();
+ }
+
+ @Override
+ protected void userIdWidth_actionPerformed()
+ {
+ try
+ {
+ String val = userIdWidth.getText().trim();
+ if (val.length() > 0)
+ {
+ Integer iw = Integer.parseInt(val);
+ if (iw.intValue() < 12)
+ {
+ throw new NumberFormatException();
+ }
+ userIdWidth.setText(iw.toString());
+ }
+ } catch (NumberFormatException x)
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
+ .getString("warn.user_defined_width_requirements"),
+ MessageManager.getString("label.invalid_id_column_width"),
+ JOptionPane.WARNING_MESSAGE);
+ userIdWidth.setText("");
+ }
+ }
+
+ @Override
+ protected void autoIdWidth_actionPerformed()
+ {
+ userIdWidth.setEnabled(!autoIdWidth.isSelected());
+ userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
+ }
+
+ /**
+ * Returns true if chimera path is to a valid executable, else show an error
+ * dialog.
+ */
+ private boolean validateChimeraPath()
+ {
+ if (chimeraPath.getText().trim().length() > 0)
+ {
+ File f = new File(chimeraPath.getText());
+ if (!f.canExecute())
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.invalid_chimera_path"),
+ MessageManager.getString("label.invalid_name"),
+ JOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * If Chimera is selected, check it can be found on default or user-specified
+ * path, if not show a warning/help dialog.
+ */
+ @Override
+ protected void structureViewer_actionPerformed(String selectedItem)
+ {
+ if (!selectedItem.equals(ViewerType.CHIMERA.name()))
+ {
+ return;
+ }
+ boolean found = false;
+
+ /*
+ * Try user-specified and standard paths for Chimera executable.
+ */
+ List<String> paths = StructureManager.getChimeraPaths();
+ paths.add(0, chimeraPath.getText());
+ for (String path : paths)
+ {
+ if (new File(path.trim()).canExecute())
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ String[] options = { "OK", "Help" };
+ int showHelp = JOptionPane.showInternalOptionDialog(
+ Desktop.desktop,
+ JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.chimera_missing")),
+ "", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
+ null, options, options[0]);
+ if (showHelp == JOptionPane.NO_OPTION)
+ {
+ try
+ {
+ Help.showHelpWindow(HelpId.StructureViewer);
+ } catch (HelpSetException e)
+ {
+ e.printStackTrace();
+ }
+ }
}
- maxColour.repaint();
}
}
diff --git a/src/jalview/gui/ProgressBar.java b/src/jalview/gui/ProgressBar.java
new file mode 100644
index 0000000..f6710bc
--- /dev/null
+++ b/src/jalview/gui/ProgressBar.java
@@ -0,0 +1,255 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.SwingUtilities;
+
+/**
+ * A class to manage multiple progress bars embedded in a JPanel.
+ */
+/*
+ * Refactored from code duplicated in AlignFrame, PCAPanel, WebserviceInfo.
+ */
+public class ProgressBar implements IProgressIndicator
+{
+ /*
+ * Progress bars in progress, keyed by any arbitrary long value
+ */
+ Map<Long, JPanel> progressBars;
+
+ /*
+ * Optional handlers for the progress bars
+ */
+ Map<Long, IProgressIndicatorHandler> progressBarHandlers;
+
+ /*
+ * The panel containing the progress bars - must have GridLayout
+ */
+ private JPanel statusPanel;
+
+ /*
+ * Optional label where a status update message can be written on completion
+ * of progress
+ */
+ private JLabel statusBar;
+
+ /**
+ * Constructor. Note that the container of the progress bars, and the status
+ * bar to which an optional completion message is written, should be unchanged
+ * for the lifetime of this object for consistent behaviour.
+ *
+ * @param container
+ * the panel holding the progress bars; must have GridLayout manager
+ * @param statusBar
+ * an optional place to write a message when a progress bar is
+ * removed
+ */
+ public ProgressBar(JPanel container, JLabel statusBar)
+ {
+ if (container == null)
+ {
+ throw new NullPointerException();
+ }
+ if (!GridLayout.class
+ .isAssignableFrom(container.getLayout().getClass()))
+ {
+ throw new IllegalArgumentException("Container must have GridLayout");
+ }
+ this.statusPanel = container;
+ this.statusBar = statusBar;
+ this.progressBars = new Hashtable<Long, JPanel>();
+ this.progressBarHandlers = new Hashtable<Long, IProgressIndicatorHandler>();
+
+ }
+
+ /**
+ * Returns true if any progress bars are still active
+ *
+ * @return
+ */
+ @Override
+ public boolean operationInProgress()
+ {
+ if (progressBars != null && progressBars.size() > 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * First call for a given id will show the message as a new progress bar. A
+ * second call with the same id will remove it. The 'removal' message is
+ * written to the status bar field (if neither is null).
+ *
+ * To avoid progress bars being left orphaned, ensure their removal is
+ * performed in a finally block if there is any risk of an error during
+ * execution.
+ */
+ @Override
+ public void setProgressBar(String message, long id)
+ {
+ Long longId = Long.valueOf(id);
+
+ JPanel progressPanel = progressBars.get(longId);
+ if (progressPanel != null)
+ {
+ /*
+ * Progress bar is displayed for this id - remove it now, and any handler
+ */
+ progressBars.remove(id);
+ if (message != null && statusBar != null)
+ {
+ statusBar.setText(message);
+ }
+ if (progressBarHandlers.containsKey(longId))
+ {
+ progressBarHandlers.remove(longId);
+ }
+ removeRow(progressPanel);
+ }
+ else
+ {
+ /*
+ * No progress bar for this id - add one now
+ */
+ progressPanel = new JPanel(new BorderLayout(10, 5));
+
+ JProgressBar progressBar = new JProgressBar();
+ progressBar.setIndeterminate(true);
+
+ progressPanel.add(new JLabel(message), BorderLayout.WEST);
+ progressPanel.add(progressBar, BorderLayout.CENTER);
+
+ addRow(progressPanel);
+
+ progressBars.put(longId, progressPanel);
+ }
+
+ refreshLayout();
+ }
+
+ /**
+ * Lays out progress bar container hierarchy
+ */
+ protected void refreshLayout()
+ {
+ /*
+ * lay out progress bar container hierarchy
+ */
+ Component root = SwingUtilities.getRoot(statusPanel);
+ if (root != null)
+ {
+ root.validate();
+ }
+ }
+
+ /**
+ * Remove one row with a progress bar, in a thread-safe manner
+ *
+ * @param progressPanel
+ */
+ protected void removeRow(JPanel progressPanel)
+ {
+ synchronized (statusPanel)
+ {
+ statusPanel.remove(progressPanel);
+ GridLayout layout = (GridLayout) statusPanel.getLayout();
+ layout.setRows(layout.getRows() - 1);
+ statusPanel.remove(progressPanel);
+ }
+ }
+
+ /**
+ * Add one row with a progress bar, in a thread-safe manner
+ *
+ * @param progressPanel
+ */
+ protected void addRow(JPanel progressPanel)
+ {
+ synchronized (statusPanel)
+ {
+ GridLayout layout = (GridLayout) statusPanel.getLayout();
+ layout.setRows(layout.getRows() + 1);
+ statusPanel.add(progressPanel);
+ }
+ }
+
+ /**
+ * Add a 'Cancel' handler for the given progress bar id. This should be called
+ * _after_ setProgressBar to have any effect.
+ */
+ @Override
+ public void registerHandler(final long id,
+ final IProgressIndicatorHandler handler)
+ {
+ Long longId = Long.valueOf(id);
+ final JPanel progressPanel = progressBars.get(longId);
+ if (progressPanel == null)
+ {
+ System.err
+ .println("call setProgressBar before registering the progress bar's handler.");
+ return;
+ }
+
+ /*
+ * Nothing useful to do if not a Cancel handler
+ */
+ if (!handler.canCancel())
+ {
+ return;
+ }
+
+ progressBarHandlers.put(longId, handler);
+ JButton cancel = new JButton(MessageManager.getString("action.cancel"));
+ final IProgressIndicator us = this;
+ cancel.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ handler.cancelActivity(id);
+ us.setProgressBar(MessageManager.formatMessage(
+ "label.cancelled_params",
+ new Object[] { ((JLabel) progressPanel.getComponent(0))
+ .getText() }), id);
+ }
+ });
+ progressPanel.add(cancel, BorderLayout.EAST);
+ refreshLayout();
+ }
+
+}
diff --git a/src/jalview/gui/PromptUserConfig.java b/src/jalview/gui/PromptUserConfig.java
index fae7783..f802149 100644
--- a/src/jalview/gui/PromptUserConfig.java
+++ b/src/jalview/gui/PromptUserConfig.java
@@ -1,29 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
import jalview.bin.Cache;
import java.awt.Component;
-import java.io.*;
-import java.net.*;
-import javax.swing.*;
+import javax.swing.JOptionPane;
public class PromptUserConfig implements Runnable
{
@@ -200,14 +201,15 @@ public class PromptUserConfig implements Runnable
}
try
{
- int reply = JOptionPane.showInternalConfirmDialog(
+ int reply = JOptionPane.showConfirmDialog(
Desktop.desktop, // component,
dialogText, dialogTitle,
(allowCancel) ? JOptionPane.YES_NO_CANCEL_OPTION
: JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
- // now, ask the desktop to relayer any external windows that might have been obsured
- if (Desktop.instance!=null)
+ // now, ask the desktop to relayer any external windows that might have
+ // been obsured
+ if (Desktop.instance != null)
{
Desktop.instance.relayerWindows();
}
diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java
index 16db1fa..4998bcc 100644
--- a/src/jalview/gui/RedundancyPanel.java
+++ b/src/jalview/gui/RedundancyPanel.java
@@ -1,32 +1,46 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.commands.*;
-import jalview.datamodel.*;
-import jalview.jbgui.*;
-import jalview.util.*;
+import jalview.analysis.AlignSeq;
+import jalview.commands.CommandI;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.jbgui.GSliderPanel;
+import jalview.util.MessageManager;
+
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+import java.util.Vector;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JProgressBar;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
/**
* DOCUMENT ME!
@@ -40,7 +54,9 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
AlignmentPanel ap;
- Stack historyList = new Stack(); // simpler than synching with alignFrame.
+ Stack<CommandI> historyList = new Stack<CommandI>();
+
+ // simpler than synching with alignFrame.
float[] redundancy;
@@ -73,7 +89,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
}
});
- applyButton.setText("Remove");
+ applyButton.setText(MessageManager.getString("action.remove"));
allGroupsCheck.setVisible(false);
slider.setMinimum(0);
slider.setMaximum(100);
@@ -84,13 +100,14 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
frame = new JInternalFrame();
frame.setContentPane(this);
- Desktop.addInternalFrame(frame, "Redundancy threshold selection", 400,
- 100, false);
+ Desktop.addInternalFrame(frame, MessageManager
+ .getString("label.redundancy_threshold_selection"), 400, 100,
+ false);
frame.addInternalFrameListener(new InternalFrameAdapter()
{
public void internalFrameClosing(InternalFrameEvent evt)
{
- ap.idPanel.idCanvas.setHighlighted(null);
+ ap.getIdPanel().getIdCanvas().setHighlighted(null);
}
});
@@ -114,7 +131,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
progress.setIndeterminate(true);
southPanel.add(progress, java.awt.BorderLayout.SOUTH);
- label.setText("Calculating....");
+ label.setText(MessageManager.getString("label.calculating"));
slider.setVisible(false);
applyButton.setEnabled(false);
@@ -131,79 +148,37 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
if ((sg != null) && (sg.getSize() >= 1))
{
- originalSequences = sg.getSequencesInOrder(ap.av.alignment);
+ originalSequences = sg.getSequencesInOrder(ap.av.getAlignment());
start = sg.getStartRes();
end = sg.getEndRes();
}
else
{
- originalSequences = ap.av.alignment.getSequencesArray();
+ originalSequences = ap.av.getAlignment().getSequencesArray();
start = 0;
- end = ap.av.alignment.getWidth();
+ end = ap.av.getAlignment().getWidth();
}
height = originalSequences.length;
-
- redundancy = new float[height];
- for (int i = 0; i < height; i++)
- {
- redundancy[i] = 0f;
- }
-
- if (ap.av.hasHiddenColumns)
+ if (ap.av.hasHiddenColumns())
{
omitHidden = ap.av.getViewAsString(sg != null);
}
-
- // long start = System.currentTimeMillis();
-
- float pid;
- String seqi, seqj;
- for (int i = 0; i < height; i++)
- {
-
- for (int j = 0; j < i; j++)
- {
- if (i == j)
- {
- continue;
- }
-
- if (omitHidden == null)
- {
- seqi = originalSequences[i].getSequenceAsString(start, end);
- seqj = originalSequences[j].getSequenceAsString(start, end);
- }
- else
- {
- seqi = omitHidden[i];
- seqj = omitHidden[j];
- }
-
- pid = Comparison.PID(seqi, seqj);
-
- if (seqj.length() < seqi.length())
- {
- redundancy[j] = Math.max(pid, redundancy[j]);
- }
- else
- {
- redundancy[i] = Math.max(pid, redundancy[i]);
- }
-
- }
- }
+ redundancy = AlignSeq.computeRedundancyMatrix(originalSequences,
+ omitHidden, start, end, false);
progress.setIndeterminate(false);
progress.setVisible(false);
progress = null;
- label.setText("Enter the redundancy threshold");
+ label.setText(MessageManager
+ .getString("label.enter_redundancy_thereshold"));
slider.setVisible(true);
applyButton.setEnabled(true);
valueField.setVisible(true);
validate();
+ sliderValueChanged();
// System.out.println((System.currentTimeMillis()-start));
}
@@ -215,21 +190,15 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
}
float value = slider.getValue();
-
+ List<SequenceI> redundantSequences = new ArrayList<SequenceI>();
for (int i = 0; i < redundancy.length; i++)
{
- if (value > redundancy[i])
- {
- redundantSeqs.remove(originalSequences[i]);
- }
- else if (!redundantSeqs.contains(originalSequences[i]))
+ if (value <= redundancy[i])
{
- redundantSeqs.add(originalSequences[i]);
+ redundantSequences.add(originalSequences[i]);
}
-
}
-
- ap.idPanel.idCanvas.setHighlighted(redundantSeqs);
+ ap.getIdPanel().getIdCanvas().setHighlighted(redundantSequences);
}
/**
@@ -272,13 +241,13 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
}
}
- EditCommand cut = new EditCommand("Remove Redundancy",
- EditCommand.CUT, deleted, 0, width, ap.av.alignment);
+ EditCommand cut = new EditCommand(
+ MessageManager.getString("action.remove_redundancy"),
+ Action.CUT, deleted, 0, width, ap.av.getAlignment());
for (int i = 0; i < del.size(); i++)
{
- ap.av.alignment.deleteSequence(deleted[i]);
- PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
+ ap.av.getAlignment().deleteSequence(deleted[i]);
if (sg != null)
{
sg.deleteSequence(deleted[i], false);
@@ -289,6 +258,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
ap.alignFrame.addHistoryItem(cut);
+ PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
ap.av.firePropertyChange("alignment", null, ap.av.getAlignment()
.getSequences());
}
@@ -303,12 +273,19 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
*/
public void undoButton_actionPerformed(ActionEvent e)
{
- CommandI command = (CommandI) historyList.pop();
- command.undoCommand(af.getViewAlignments());
+ if (historyList == null || historyList.isEmpty())
+ {
+ undoButton.setEnabled(false);
+ return;
+ }
- if (ap.av.historyList.contains(command))
+ CommandI command = historyList.pop();
+ if (ap.av.getHistoryList().contains(command))
{
- ap.av.historyList.remove(command);
+ command.undoCommand(af.getViewAlignments());
+ ap.av.getHistoryList().remove(command);
+ ap.av.firePropertyChange("alignment", null, ap.av.getAlignment()
+ .getSequences());
af.updateEditMenuBar();
}
diff --git a/src/jalview/gui/RestInputParamEditDialog.java b/src/jalview/gui/RestInputParamEditDialog.java
index fcff86d..80dc8fb 100644
--- a/src/jalview/gui/RestInputParamEditDialog.java
+++ b/src/jalview/gui/RestInputParamEditDialog.java
@@ -1,43 +1,41 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
+import jalview.jbgui.GRestInputParamEditDialog;
+import jalview.ws.params.InvalidArgumentException;
+import jalview.ws.params.OptionI;
+import jalview.ws.params.ParameterI;
+import jalview.ws.rest.InputType;
+import jalview.ws.rest.RestServiceDescription;
+
import java.util.ArrayList;
import java.util.Hashtable;
-import javax.swing.JDialog;
-import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.event.ListSelectionEvent;
-import com.sun.tools.corba.se.idl.InvalidArgument;
-
import net.miginfocom.swing.MigLayout;
-import jalview.jbgui.GRestInputParamEditDialog;
-import jalview.ws.params.ArgumentI;
-import jalview.ws.params.InvalidArgumentException;
-import jalview.ws.params.OptionI;
-import jalview.ws.params.ParameterI;
-import jalview.ws.rest.InputType;
-import jalview.ws.rest.RestServiceDescription;
-
public class RestInputParamEditDialog extends GRestInputParamEditDialog
implements OptsParametersContainerI
{
@@ -45,14 +43,14 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
Hashtable<String, ArrayList<JPanel>> typeopts = new Hashtable<String, ArrayList<JPanel>>();
- Hashtable<String,OptsAndParamsPage> opanps = new Hashtable<String, OptsAndParamsPage>();
-
+ Hashtable<String, OptsAndParamsPage> opanps = new Hashtable<String, OptsAndParamsPage>();
+
private InputType getTypeFor(String name)
{
try
{
return (InputType) (typeclass.get(name).getConstructor()
- .newInstance(null));
+ .newInstance());
} catch (Throwable x)
{
System.err
@@ -63,53 +61,60 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
}
int reply;
+
JalviewDialog frame = new JalviewDialog()
{
-
+
@Override
protected void raiseClosed()
{
-
+
}
-
+
@Override
protected void okPressed()
{
- reply=JOptionPane.OK_OPTION;
+ reply = JOptionPane.OK_OPTION;
}
-
+
@Override
protected void cancelPressed()
{
- reply=JOptionPane.CANCEL_OPTION;
-
+ reply = JOptionPane.CANCEL_OPTION;
+
}
};
- InputType old,current;
+
+ InputType old, current;
+
public RestInputParamEditDialog(
RestServiceEditorPane restServiceEditorPane,
RestServiceDescription currentservice, InputType toedit)
{
initFor(restServiceEditorPane, currentservice, toedit);
frame.waitForInput();
- // TODO: warn user if they are about to overwrite an existing parameter because they have used the same name when editing a different parameter.
+ // TODO: warn user if they are about to overwrite an existing parameter
+ // because they have used the same name when editing a different parameter.
// TODO: make any press of the return key cause 'OK' to be pressed
}
+
private void initFor(RestServiceEditorPane restServiceEditorPane,
RestServiceDescription currentservice, InputType toedit)
{
okcancel.add(frame.cancel);
okcancel.add(frame.ok);
- frame.initDialogFrame(dpane, true, true, "Edit parameter for service "+currentservice.getName(), 600,800);
-
+ frame.initDialogFrame(dpane, true, true, "Edit parameter for service "
+ + currentservice.getName(), 600, 800);
+
initTypeLists();
- reply=JOptionPane.CANCEL_OPTION;
+ reply = JOptionPane.CANCEL_OPTION;
old = toedit;
current = null;
- if (old!=null) {
+ if (old != null)
+ {
setStateFor(old);
}
- updated = updated && reply==JOptionPane.OK_OPTION;
+ updated = updated && reply == JOptionPane.OK_OPTION;
frame.validate();
}
@@ -117,7 +122,7 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
RestServiceEditorPane restServiceEditorPane,
RestServiceDescription currentservice, String string)
{
- initFor(restServiceEditorPane, currentservice,null);
+ initFor(restServiceEditorPane, currentservice, null);
tok.setText(string);
frame.waitForInput();
}
@@ -125,14 +130,17 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
private void setStateFor(InputType current)
{
tok.setText(current.token);
- OptsAndParamsPage opanp=opanps.get(current.getURLtokenPrefix());
- for (OptionI ops:current.getOptions())
+ OptsAndParamsPage opanp = opanps.get(current.getURLtokenPrefix());
+ for (OptionI ops : current.getOptions())
{
if (ops instanceof ParameterI)
{
opanp.setParameter((ParameterI) ops);
- } else {
- if (ops.getValue()!=null && ops.getValue().length()>0) {
+ }
+ else
+ {
+ if (ops.getValue() != null && ops.getValue().length() > 0)
+ {
opanp.selectOption(ops, ops.getValue());
}
}
@@ -140,27 +148,36 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
typeList.setSelectedValue(current.getURLtokenPrefix(), true);
type_SelectionChangedActionPerformed(null);
}
+
private void updateCurrentType()
{
- if (typeList.getSelectedValue()!=null) {
- InputType newType = getTypeFor((String)typeList.getSelectedValue());
- if (newType!=null) {
- newType.token = tok.getText().trim();
- try {
- newType.configureFromArgumentI(opanps.get(newType.getURLtokenPrefix()).getCurrentSettings());
- current=newType;
- updated=true;
- } catch (InvalidArgumentException ex) {
- System.err.println("IMPLEMENTATION ERROR: Invalid argument for type : "+typeList.getSelectedValue()+"\n");
- ex.printStackTrace();
+ if (typeList.getSelectedValue() != null)
+ {
+ InputType newType = getTypeFor((String) typeList.getSelectedValue());
+ if (newType != null)
+ {
+ newType.token = tok.getText().trim();
+ try
+ {
+ newType.configureFromArgumentI(opanps.get(
+ newType.getURLtokenPrefix()).getCurrentSettings());
+ current = newType;
+ updated = true;
+ } catch (InvalidArgumentException ex)
+ {
+ System.err
+ .println("IMPLEMENTATION ERROR: Invalid argument for type : "
+ + typeList.getSelectedValue() + "\n");
+ ex.printStackTrace();
+ }
}
}
- }
-
+
}
+
private void initTypeLists()
{
- ArrayList<String> types=new ArrayList<String>();
+ ArrayList<String> types = new ArrayList<String>();
// populate type list
for (Class type : RestServiceDescription.getInputTypes())
{
@@ -170,11 +187,11 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
{
JPanel inopts = new JPanel(new MigLayout());
ArrayList<JPanel> opts = new ArrayList<JPanel>(), prms = new ArrayList<JPanel>();
- jtype = (InputType) (type.getConstructor().newInstance(null));
+ jtype = (InputType) (type.getConstructor().newInstance());
typeclass.put(jtype.getURLtokenPrefix(), type);
// and populate parameters from this type
- OptsAndParamsPage opanp = new OptsAndParamsPage(this,true);
- opanps.put(jtype.getURLtokenPrefix(),opanp);
+ OptsAndParamsPage opanp = new OptsAndParamsPage(this, true);
+ opanps.put(jtype.getURLtokenPrefix(), opanp);
for (OptionI opt : jtype.getOptions())
{
@@ -202,7 +219,7 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
}
}
typeList.setListData(types.toArray());
-
+
}
@Override
@@ -215,7 +232,7 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
for (JPanel opt : typeopts.get(typen))
{
opt.setOpaque(true);
- options.add(opt,"wrap");
+ options.add(opt, "wrap");
}
options.invalidate();
optionsPanel.setVisible(true);
@@ -228,7 +245,8 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
updateCurrentType();
}
- boolean updated=false;
+ boolean updated = false;
+
public boolean wasUpdated()
{
return updated;
@@ -244,15 +262,16 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog
@Override
protected void tokChanged_actionPerformed()
{
- if (tok.getText().trim().length()>0)
+ if (tok.getText().trim().length() > 0)
{
- if (current!=null)
+ if (current != null)
{
current.token = tok.getText().trim();
- updated = true;
- }
+ updated = true;
+ }
}
}
+
@Override
public void argSetModified(Object modifiedElement, boolean b)
{
diff --git a/src/jalview/gui/RestServiceEditorPane.java b/src/jalview/gui/RestServiceEditorPane.java
index dee5d7e..4e42bf0 100644
--- a/src/jalview/gui/RestServiceEditorPane.java
+++ b/src/jalview/gui/RestServiceEditorPane.java
@@ -1,24 +1,28 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
import jalview.io.packed.DataProvider.JvDataType;
import jalview.jbgui.GRestServiceEditorPane;
+import jalview.util.MessageManager;
import jalview.ws.rest.InputType;
import jalview.ws.rest.RestServiceDescription;
@@ -68,40 +72,47 @@ public class RestServiceEditorPane extends GRestServiceEditorPane
public void keyTyped(KeyEvent e)
{
}
-
+
@Override
public void keyReleased(KeyEvent e)
{
- refreshCutnPaste(true);
+ refreshCutnPaste(true);
}
-
+
@Override
public void keyPressed(KeyEvent e)
{
-
+
}
});
panels.addChangeListener(new ChangeListener()
{
/**
- * last panel selected - used to decide whether the service or the GUI has the latest info
+ * last panel selected - used to decide whether the service or the GUI has
+ * the latest info
*/
Object lastComp;
+
@Override
public void stateChanged(ChangeEvent e)
{
- if (lastComp!=paste) {
+ if (lastComp != paste)
+ {
updateServiceFromGui();
refreshCutnPaste(false);
- } else {
+ }
+ else
+ {
refreshCutnPaste(true);
}
lastComp = panels.getSelectedComponent();
-
+
}
- });
- currentservice = new RestServiceDescription("Analysis", "service description", "service name", "http://localhost/", "", null, false, false, '-');
+ });
+ currentservice = new RestServiceDescription("Analysis",
+ "service description", "service name", "http://localhost/", "",
+ null, false, false, '-');
initGuiWith(currentservice);
refreshCutnPaste(false);
updateButtons();
@@ -111,10 +122,15 @@ public class RestServiceEditorPane extends GRestServiceEditorPane
{
this();
oldservice = toedit;
- if (oldservice!=null)
- { currentservice = new RestServiceDescription(toedit);
- } else {
- currentservice = new RestServiceDescription("Analysis", "service description", "service name", "http://localhost/", "", null, false, false, '-');
+ if (oldservice != null)
+ {
+ currentservice = new RestServiceDescription(toedit);
+ }
+ else
+ {
+ currentservice = new RestServiceDescription("Analysis",
+ "service description", "service name", "http://localhost/",
+ "", null, false, false, '-');
}
initGuiWith(currentservice);
refreshCutnPaste(false);
@@ -152,7 +168,7 @@ public class RestServiceEditorPane extends GRestServiceEditorPane
gapChar.addItem(".");
gapChar.addItem(" ");
gapChar.addItem("-");
- if (currentservice==null)
+ if (currentservice == null)
{
name.setText("");
descr.setText("");
@@ -160,194 +176,236 @@ public class RestServiceEditorPane extends GRestServiceEditorPane
urlsuff.setText("");
action.setSelectedItem("Analysis");
gapChar.setSelectedItem("-");
- } else {
- name.setText(currentservice.getName());
- descr.setText(currentservice.getDescription());
- url.setText(currentservice.getPostUrl());
- urlsuff.setText(currentservice.getUrlSuffix());
- for (Map.Entry<String, InputType> inparam : currentservice
- .getInputParams().entrySet())
- {
- _iparam.add(inparam.getKey() + " "
- + inparam.getValue().getURLtokenPrefix() + ":"
- + inparam.getValue().getURLEncodedParameter().toString());
}
-
- for (JvDataType oparam : currentservice.getResultDataTypes())
+ else
{
- _rparam.add(oparam.name());
- }
- iprms.setListData(_iparam);
- rdata.setListData(_rparam);
+ name.setText(currentservice.getName());
+ descr.setText(currentservice.getDescription());
+ url.setText(currentservice.getPostUrl());
+ urlsuff.setText(currentservice.getUrlSuffix());
+ for (Map.Entry<String, InputType> inparam : currentservice
+ .getInputParams().entrySet())
+ {
+ _iparam.add(inparam.getKey() + " "
+ + inparam.getValue().getURLtokenPrefix() + ":"
+ + inparam.getValue().getURLEncodedParameter().toString());
+ }
- action.setSelectedItem(currentservice.getAction());
+ for (JvDataType oparam : currentservice.getResultDataTypes())
+ {
+ _rparam.add(oparam.name());
+ }
+ iprms.setListData(_iparam);
+ rdata.setListData(_rparam);
+
+ action.setSelectedItem(currentservice.getAction());
- gapChar.setSelectedItem(""+currentservice.getGapCharacter());
+ gapChar.setSelectedItem("" + currentservice.getGapCharacter());
}
revalidate();
}
+
private String getSelectedInputToken()
{
- if (iprms.getSelectedIndex()>-1)
+ if (iprms.getSelectedIndex() > -1)
{
- String toktoedit = (String) iprms.getSelectedValue();
- toktoedit=toktoedit.substring(0, toktoedit.indexOf(" "));
- return toktoedit;
+ String toktoedit = (String) iprms.getSelectedValue();
+ toktoedit = toktoedit.substring(0, toktoedit.indexOf(" "));
+ return toktoedit;
}
return null;
}
+
@Override
protected void iprmListSelection_doubleClicked()
{
String toktoedit = getSelectedInputToken();
- if (toktoedit!=null)
+ if (toktoedit != null)
{
InputType toedit = currentservice.getInputParams().get(toktoedit);
- String oldParam=toktoedit;
- RestInputParamEditDialog dialog=new RestInputParamEditDialog(this, currentservice, toedit);
- if (dialog.wasUpdated()) {
+ String oldParam = toktoedit;
+ RestInputParamEditDialog dialog = new RestInputParamEditDialog(this,
+ currentservice, toedit);
+ if (dialog.wasUpdated())
+ {
currentservice.getInputParams().remove(oldParam);
- currentservice.getInputParams().put(dialog.current.token, dialog.current);
+ currentservice.getInputParams().put(dialog.current.token,
+ dialog.current);
initGuiWith(currentservice);
}
-
+
}
}
+
@Override
protected void iprmsAdd_actionPerformed(ActionEvent e)
{
- RestInputParamEditDialog dialog=new RestInputParamEditDialog(this, currentservice, "param"+(1+currentservice.getInputParams().size()));
- if (dialog.wasUpdated()) {
- currentservice.getInputParams().put(dialog.current.token, dialog.current);
+ RestInputParamEditDialog dialog = new RestInputParamEditDialog(this,
+ currentservice, "param"
+ + (1 + currentservice.getInputParams().size()));
+ if (dialog.wasUpdated())
+ {
+ currentservice.getInputParams().put(dialog.current.token,
+ dialog.current);
initGuiWith(currentservice);
}
}
+
@Override
protected void iprmsRem_actionPerformed(ActionEvent e)
{
String toktoedit = getSelectedInputToken();
- if (toktoedit!=null)
+ if (toktoedit != null)
{
currentservice.getInputParams().remove(toktoedit);
initGuiWith(currentservice);
}
}
+
@Override
protected void rdata_rightClicked(MouseEvent mouse)
{
final int rdatasel = rdata.getSelectedIndex();
- if (rdatasel>-1)
+ if (rdatasel > -1)
{
- JPopupMenu popup = new JPopupMenu("Select return type");
- for (final JvDataType type:JvDataType.values()) {
- popup.add(new JMenuItem(type.name())).addActionListener(new ActionListener()
- {
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- currentservice.getResultDataTypes().set(rdatasel, type);
- initGuiWith(currentservice);
- rdata.setSelectedIndex(rdatasel);
- }
- });
+ JPopupMenu popup = new JPopupMenu(
+ MessageManager.getString("label.select_return_type"));
+ for (final JvDataType type : JvDataType.values())
+ {
+ popup.add(new JMenuItem(type.name())).addActionListener(
+ new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ currentservice.getResultDataTypes().set(rdatasel, type);
+ initGuiWith(currentservice);
+ rdata.setSelectedIndex(rdatasel);
+ }
+ });
}
popup.show(rdata, mouse.getX(), mouse.getY());
}
}
+
@Override
protected void rdataAdd_actionPerformed(ActionEvent e)
{
int p;
- if ((p=rdata.getSelectedIndex())>-1)
+ if ((p = rdata.getSelectedIndex()) > -1)
+ {
+ currentservice.getResultDataTypes().add(p + 1, JvDataType.ANNOTATION);
+ }
+ else
{
- currentservice.getResultDataTypes().add(p+1, JvDataType.ANNOTATION);
- } else {
currentservice.addResultDatatype(JvDataType.ANNOTATION);
}
initGuiWith(currentservice);
- rdata.setSelectedIndex(p==-1 ? currentservice.getResultDataTypes().size()-1 : p+1);
+ rdata.setSelectedIndex(p == -1 ? currentservice.getResultDataTypes()
+ .size() - 1 : p + 1);
}
+
@Override
protected void rdataNdown_actionPerformed(ActionEvent e)
{
int p;
- if ((p=rdata.getSelectedIndex())>-1 && p<_rparam.size()-1)
+ if ((p = rdata.getSelectedIndex()) > -1 && p < _rparam.size() - 1)
{
List<JvDataType> rtypes = currentservice.getResultDataTypes();
- JvDataType below = rtypes.get(p+1);
- rtypes.set(p+1, rtypes.get(p));
+ JvDataType below = rtypes.get(p + 1);
+ rtypes.set(p + 1, rtypes.get(p));
rtypes.set(p, below);
initGuiWith(currentservice);
- rdata.setSelectedIndex(p+1);
+ rdata.setSelectedIndex(p + 1);
}
}
+
@Override
protected void rdataNup_actionPerformed(ActionEvent e)
{
int p;
- if ((p=rdata.getSelectedIndex())>0)
+ if ((p = rdata.getSelectedIndex()) > 0)
{
List<JvDataType> rtypes = currentservice.getResultDataTypes();
- JvDataType above = rtypes.get(p-1);
- rtypes.set(p-1, rtypes.get(p));
+ JvDataType above = rtypes.get(p - 1);
+ rtypes.set(p - 1, rtypes.get(p));
rtypes.set(p, above);
initGuiWith(currentservice);
- rdata.setSelectedIndex(p-1);
+ rdata.setSelectedIndex(p - 1);
}
}
+
@Override
protected void rdataRem_actionPerformed(ActionEvent e)
{
- if (rdata.getSelectedIndex()>-1)
+ if (rdata.getSelectedIndex() > -1)
{
currentservice.getResultDataTypes().remove(rdata.getSelectedIndex());
initGuiWith(currentservice);
}
}
- private boolean updateServiceFromGui() {
- Map<String,InputType>inputTypes = new HashMap<String, InputType>();
- StringBuffer warnings=new StringBuffer();
- for (String its:_iparam)
+ private boolean updateServiceFromGui()
+ {
+ Map<String, InputType> inputTypes = new HashMap<String, InputType>();
+ StringBuffer warnings = new StringBuffer();
+ for (String its : _iparam)
{
- Matcher mtch = Pattern.compile("(\\S+)\\s(\\S+):\\[(.+)]").matcher(its);
- if (mtch.find()) {
- if (!RestServiceDescription.parseTypeString(mtch.group(2)+":"+mtch.group(3), mtch.group(1), mtch.group(2),mtch.group(3), inputTypes, warnings))
+ Matcher mtch = Pattern.compile("(\\S+)\\s(\\S+):\\[(.+)]").matcher(
+ its);
+ if (mtch.find())
+ {
+ if (!RestServiceDescription.parseTypeString(mtch.group(2) + ":"
+ + mtch.group(3), mtch.group(1), mtch.group(2),
+ mtch.group(3), inputTypes, warnings))
{
- System.err.println("IMPLEMENTATION PROBLEM: Cannot parse RestService input parameter string '"+its+"'"+"\n"+warnings);
- }
+ System.err
+ .println("IMPLEMENTATION PROBLEM: Cannot parse RestService input parameter string '"
+ + its + "'" + "\n" + warnings);
+ }
}
}
- char gc = gapChar.getSelectedItem()==null ? ' ' : ((String)gapChar.getSelectedItem()).charAt(0);
- RestServiceDescription newService = new RestServiceDescription((String) action.getSelectedItem(),
- descr.getText().trim(), name.getText().trim(), url.getText().trim(), urlsuff.getText().trim(), inputTypes, hSeparable.isSelected(), vSeparable.isSelected(), gc);
-
+ char gc = gapChar.getSelectedItem() == null ? ' ' : ((String) gapChar
+ .getSelectedItem()).charAt(0);
+ RestServiceDescription newService = new RestServiceDescription(
+ (String) action.getSelectedItem(), descr.getText().trim(), name
+ .getText().trim(), url.getText().trim(), urlsuff
+ .getText().trim(), inputTypes, hSeparable.isSelected(),
+ vSeparable.isSelected(), gc);
+
if (newService.isValid())
{
- for (String its:_rparam)
+ for (String its : _rparam)
{
JvDataType dtype;
- try {
+ try
+ {
dtype = JvDataType.valueOf(its);
newService.addResultDatatype(dtype);
- }
- catch (Throwable x)
+ } catch (Throwable x)
{
- System.err.println("IMPLEMENTATION PROBLEM: Cannot parse RestService output parameter string '"+its+"'"+"\n"+warnings);
+ System.err
+ .println("IMPLEMENTATION PROBLEM: Cannot parse RestService output parameter string '"
+ + its + "'" + "\n" + warnings);
}
}
currentservice = newService;
return true;
- } else {
- System.err.println("IMPLEMENTATION PROBLEM: Restservice generated from GUI is invalid\n"+warnings);
+ }
+ else
+ {
+ System.err
+ .println("IMPLEMENTATION PROBLEM: Restservice generated from GUI is invalid\n"
+ + warnings);
}
return false;
}
+
protected void refreshCutnPaste(boolean reparse)
{
if (!reparse && currentservice.isValid())
@@ -370,26 +428,30 @@ public class RestServiceEditorPane extends GRestServiceEditorPane
{
parseWarnings.setVisible(false);
parseRes.setText("");
- initGuiWith(currentservice=rsd);
+ initGuiWith(currentservice = rsd);
}
else
{
- parseRes.setText("Parsing failed. Syntax errors shown below\n"
- + rsd.getInvalidMessage());
+ parseRes.setText(MessageManager
+ .formatMessage(
+ "label.parsing_failed_syntax_errors_shown_below_param",
+ new String[] { rsd.getInvalidMessage() }));
parseWarnings.setVisible(true);
}
} catch (Throwable e)
{
e.printStackTrace();
- parseRes.setText("\nParsing failed. An unrecoverable exception was thrown:\n"
- + e.toString());
+ parseRes.setText(MessageManager
+ .formatMessage(
+ "label.parsing_failed_unrecoverable_exception_thrown_param",
+ new String[] { e.toString() }));
parseWarnings.setVisible(true);
}
}
paste.revalidate();
}
}
-
+
}
public static void main(String[] args)
@@ -402,15 +464,18 @@ public class RestServiceEditorPane extends GRestServiceEditorPane
public void run()
{
- boolean nulserv=true;
+ boolean nulserv = true;
while (visible)
{
final Thread runner = Thread.currentThread();
JFrame df = new JFrame();
df.getContentPane().setLayout(new BorderLayout());
df.getContentPane().add(
- (nulserv=!nulserv) ? new RestServiceEditorPane(jalview.ws.rest.RestClient
- .makeShmmrRestClient().getRestDescription()) : new RestServiceEditorPane(),
+ (nulserv = !nulserv) ? new RestServiceEditorPane(
+ jalview.ws.rest.RestClient
+ .makeShmmrRestClient()
+ .getRestDescription())
+ : new RestServiceEditorPane(),
BorderLayout.CENTER);
df.setBounds(100, 100, 600, 400);
df.addComponentListener(new ComponentListener()
@@ -460,42 +525,45 @@ public class RestServiceEditorPane extends GRestServiceEditorPane
}
}
- String finalService=null;
+
+ String finalService = null;
+
public void showDialog(String title)
{
- if (oldservice!=null)
+ if (oldservice != null)
{
finalService = oldservice.toString();
}
JalviewDialog jvd = new JalviewDialog()
{
-
+
@Override
protected void raiseClosed()
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
protected void okPressed()
{
updateServiceFromGui();
- finalService = currentservice.toString();
+ finalService = currentservice.toString();
}
-
+
@Override
protected void cancelPressed()
{
-
+
}
};
- JPanel pane = new JPanel(new BorderLayout()),okcancel=new JPanel(new FlowLayout());
- pane.add(this,BorderLayout.CENTER);
+ JPanel pane = new JPanel(new BorderLayout()), okcancel = new JPanel(
+ new FlowLayout());
+ pane.add(this, BorderLayout.CENTER);
okcancel.add(jvd.ok);
okcancel.add(jvd.cancel);
pane.add(okcancel, BorderLayout.SOUTH);
- jvd.initDialogFrame(pane, true, true, title, 600,350);
+ jvd.initDialogFrame(pane, true, true, title, 600, 350);
jvd.waitForInput();
}
diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java
index 713f9b1..441fa5f 100644
--- a/src/jalview/gui/RotatableCanvas.java
+++ b/src/jalview/gui/RotatableCanvas.java
@@ -1,30 +1,52 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-import jalview.datamodel.*;
-import jalview.math.*;
+import jalview.api.RotatableCanvasI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequencePoint;
+import jalview.math.RotatableMatrix;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.RenderingHints;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import java.util.Vector;
+
+import javax.swing.JPanel;
+import javax.swing.ToolTipManager;
/**
* DOCUMENT ME!
@@ -33,7 +55,7 @@ import jalview.math.*;
* @version $Revision$
*/
public class RotatableCanvas extends JPanel implements MouseListener,
- MouseMotionListener, KeyListener
+ MouseMotionListener, KeyListener, RotatableCanvasI
{
RotatableMatrix idmat = new RotatableMatrix(3, 3);
@@ -96,7 +118,7 @@ public class RotatableCanvas extends JPanel implements MouseListener,
float scalefactor = 1;
- AlignViewport av;
+ AlignmentViewport av;
AlignmentPanel ap;
@@ -138,14 +160,18 @@ public class RotatableCanvas extends JPanel implements MouseListener,
repaint();
}
+ boolean first = true;
+
public void setPoints(Vector points, int npoint)
{
this.points = points;
this.npoint = npoint;
- ToolTipManager.sharedInstance().registerComponent(this);
- ToolTipManager.sharedInstance().setInitialDelay(0);
- ToolTipManager.sharedInstance().setDismissDelay(10000);
-
+ if (first)
+ {
+ ToolTipManager.sharedInstance().registerComponent(this);
+ ToolTipManager.sharedInstance().setInitialDelay(0);
+ ToolTipManager.sharedInstance().setDismissDelay(10000);
+ }
prefsize = getPreferredSize();
orig = new float[npoint][3];
@@ -186,11 +212,14 @@ public class RotatableCanvas extends JPanel implements MouseListener,
findWidth();
scale = findScale();
+ if (first)
+ {
- addMouseListener(this);
-
- addMouseMotionListener(this);
+ addMouseListener(this);
+ addMouseMotionListener(this);
+ }
+ first = false;
}
public void initAxes()
@@ -361,7 +390,8 @@ public class RotatableCanvas extends JPanel implements MouseListener,
if (points == null)
{
g.setFont(new Font("Verdana", Font.PLAIN, 18));
- g.drawString("Calculating PCA....", 20, getHeight() / 2);
+ g.drawString(MessageManager.getString("label.calculating_pca")
+ + "....", 20, getHeight() / 2);
}
else
{
@@ -644,7 +674,7 @@ public class RotatableCanvas extends JPanel implements MouseListener,
aps[a].av.setSelectionGroup(new SequenceGroup());
aps[a].av.getSelectionGroup().addOrRemove(found, true);
aps[a].av.getSelectionGroup().setEndRes(
- aps[a].av.alignment.getWidth() - 1);
+ aps[a].av.getAlignment().getWidth() - 1);
}
}
PaintRefresher.Refresh(this, av.getSequenceSetId());
@@ -812,8 +842,7 @@ public class RotatableCanvas extends JPanel implements MouseListener,
}
else
{
- return new AlignmentPanel[]
- { ap };
+ return new AlignmentPanel[] { ap };
}
}
diff --git a/src/jalview/gui/SVGOptions.java b/src/jalview/gui/SVGOptions.java
new file mode 100644
index 0000000..21319eb
--- /dev/null
+++ b/src/jalview/gui/SVGOptions.java
@@ -0,0 +1,162 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+
+public class SVGOptions extends JPanel
+{
+ JDialog dialog;
+
+ public boolean cancelled = false;
+
+ String value;
+
+ public SVGOptions()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ ButtonGroup bg = new ButtonGroup();
+ bg.add(lineart);
+ bg.add(text);
+
+ JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION,
+ JOptionPane.DEFAULT_OPTION, null, new Object[] { this });
+
+ dialog = pane.createDialog(Desktop.desktop, "SVG Rendering options");
+ dialog.setVisible(true);
+
+ }
+
+ private void jbInit() throws Exception
+ {
+ lineart.setFont(JvSwingUtils.getLabelFont());
+ lineart.setText(MessageManager.getString("label.lineart"));
+ text.setFont(JvSwingUtils.getLabelFont());
+ text.setText(MessageManager.getString("action.text"));
+ text.setSelected(true);
+ askAgain.setFont(JvSwingUtils.getLabelFont());
+ askAgain.setText(MessageManager.getString("label.dont_ask_me_again"));
+ ok.setText(MessageManager.getString("action.ok"));
+ ok.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+ cancel.setText(MessageManager.getString("action.cancel"));
+ cancel.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ jLabel1.setFont(JvSwingUtils.getLabelFont());
+ jLabel1.setText("Select SVG character rendering style");
+ this.setLayout(borderLayout1);
+ jPanel3.setBorder(BorderFactory.createEtchedBorder());
+ jPanel2.add(text);
+ jPanel2.add(lineart);
+ jPanel2.add(askAgain);
+ jPanel1.add(ok);
+ jPanel1.add(cancel);
+ jPanel3.add(jLabel1);
+ jPanel3.add(jPanel2);
+ this.add(jPanel3, java.awt.BorderLayout.CENTER);
+ this.add(jPanel1, java.awt.BorderLayout.SOUTH);
+ }
+
+ JRadioButton lineart = new JRadioButton();
+
+ JRadioButton text = new JRadioButton();
+
+ JCheckBox askAgain = new JCheckBox();
+
+ JButton ok = new JButton();
+
+ JButton cancel = new JButton();
+
+ JPanel jPanel1 = new JPanel();
+
+ JLabel jLabel1 = new JLabel();
+
+ JPanel jPanel2 = new JPanel();
+
+ JPanel jPanel3 = new JPanel();
+
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ if (lineart.isSelected())
+ {
+ value = "Lineart";
+ }
+ else
+ {
+ value = "Text";
+ }
+
+ if (!askAgain.isSelected())
+ {
+ jalview.bin.Cache.applicationProperties.remove("SVG_RENDERING");
+ }
+ else
+ {
+ jalview.bin.Cache.setProperty("SVG_RENDERING", value);
+ }
+
+ dialog.setVisible(false);
+ }
+
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ cancelled = true;
+ dialog.setVisible(false);
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+}
diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java
index a4f6546..21db011 100644
--- a/src/jalview/gui/ScalePanel.java
+++ b/src/jalview/gui/ScalePanel.java
@@ -1,27 +1,46 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-import jalview.datamodel.*;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+import javax.swing.ToolTipManager;
/**
* DOCUMENT ME!
@@ -70,14 +89,14 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
int x = (evt.getX() / av.getCharWidth()) + av.getStartRes();
final int res;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
x = av.getColumnSelection().adjustForHiddenColumns(x);
}
- if (x >= av.alignment.getWidth())
+ if (x >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
else
{
@@ -92,7 +111,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
JPopupMenu pop = new JPopupMenu();
if (reveal != null)
{
- JMenuItem item = new JMenuItem("Reveal");
+ JMenuItem item = new JMenuItem(
+ MessageManager.getString("label.reveal"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -108,9 +128,10 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
});
pop.add(item);
- if (av.getColumnSelection().getHiddenColumns().size() > 1)
+ if (av.getColumnSelection().hasHiddenColumns())
{
- item = new JMenuItem("Reveal All");
+ item = new JMenuItem(
+ MessageManager.getString("action.reveal_all"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -130,15 +151,16 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
}
else if (av.getColumnSelection().contains(res))
{
- JMenuItem item = new JMenuItem("Hide Columns");
+ JMenuItem item = new JMenuItem(
+ MessageManager.getString("label.hide_columns"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
av.hideColumns(res, res);
if (av.getSelectionGroup() != null
- && av.getSelectionGroup().getSize() == av.alignment
- .getHeight())
+ && av.getSelectionGroup().getSize() == av
+ .getAlignment().getHeight())
{
av.setSelectionGroup(null);
}
@@ -165,7 +187,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
av.getColumnSelection().addElement(res);
SequenceGroup sg = new SequenceGroup();
// try to be as quick as possible
- SequenceI[] iVec = av.alignment.getSequencesArray();
+ SequenceI[] iVec = av.getAlignment().getSequencesArray();
for (int i = 0; i < iVec.length; i++)
{
sg.addSequence(iVec[i], false);
@@ -205,14 +227,14 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
- if (res >= av.alignment.getWidth())
+ if (res >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (!stretchingGroup)
@@ -256,14 +278,14 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
res = 0;
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
- if (res >= av.alignment.getWidth())
+ if (res >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (res < min)
@@ -319,7 +341,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
{
if (mouseDragging)
{
- ap.seqPanel.scrollCanvas(null);
+ ap.getSeqPanel().scrollCanvas(null);
}
}
@@ -327,7 +349,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
{
if (mouseDragging)
{
- ap.seqPanel.scrollCanvas(evt);
+ ap.getSeqPanel().scrollCanvas(evt);
}
}
@@ -337,7 +359,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
public void mouseMoved(MouseEvent evt)
{
- if (!av.hasHiddenColumns)
+ if (!av.hasHiddenColumns())
{
return;
}
@@ -347,24 +369,24 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
res = av.getColumnSelection().adjustForHiddenColumns(res);
reveal = null;
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
+ if (av.getColumnSelection().getHiddenColumns() != null)
{
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns()
- .elementAt(i);
- if (res + 1 == region[0] || res - 1 == region[1])
+ for (int[] region : av.getColumnSelection().getHiddenColumns())
{
- reveal = region;
- ToolTipManager.sharedInstance().registerComponent(this);
- this.setToolTipText("Reveal Hidden Columns with Right Mouse Button");
- break;
- }
- else
- {
- this.setToolTipText(null);
+ if (res + 1 == region[0] || res - 1 == region[1])
+ {
+ reveal = region;
+ ToolTipManager.sharedInstance().registerComponent(this);
+ this.setToolTipText(MessageManager
+ .getString("label.reveal_hidden_columns"));
+ break;
+ }
+ else
+ {
+ this.setToolTipText(null);
+ }
}
-
}
-
repaint();
}
@@ -401,6 +423,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
// Fill the selected columns
ColumnSelection cs = av.getColumnSelection();
+ int avCharWidth = av.getCharWidth(), avCharHeight = av.getCharHeight();
+
int s;
if (cs != null)
{
@@ -409,7 +433,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
for (int i = 0; i < cs.size(); i++)
{
int sel = cs.columnAt(i);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
if (cs.isVisible(sel))
{
@@ -423,7 +447,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
if ((sel >= startx) && (sel <= endx))
{
- gg.fillRect((sel - startx) * av.charWidth, 0, av.charWidth,
+ gg.fillRect((sel - startx) * avCharWidth, 0, avCharWidth,
getHeight());
}
}
@@ -434,7 +458,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
int scalestartx = (startx / 10) * 10;
FontMetrics fm = gg.getFontMetrics(av.getFont());
- int y = av.charHeight - fm.getDescent();
+ int y = avCharHeight - fm.getDescent();
if ((scalestartx % 10) == 0)
{
@@ -450,34 +474,31 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
{
string = String.valueOf(av.getColumnSelection()
.adjustForHiddenColumns(i));
- if ((i - startx - 1) * av.charWidth > maxX)
+ if ((i - startx - 1) * avCharWidth > maxX)
{
- gg.drawString(string, (i - startx - 1) * av.charWidth, y);
- maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string);
+ gg.drawString(string, (i - startx - 1) * avCharWidth, y);
+ maxX = (i - startx + 1) * avCharWidth + fm.stringWidth(string);
}
- gg.drawLine(
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
+ gg.drawLine(((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
y + 2,
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
- y + (fm.getDescent() * 2));
-
+ ((i - startx - 1) * avCharWidth) + (avCharWidth / 2), y
+ + (fm.getDescent() * 2));
}
else
{
- gg.drawLine(
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
- y + fm.getDescent(),
- (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)),
- y + (fm.getDescent() * 2));
+ gg.drawLine(((i - startx - 1) * avCharWidth) + (avCharWidth / 2), y
+ + fm.getDescent(), ((i - startx - 1) * avCharWidth)
+ + (avCharWidth / 2), y + (fm.getDescent() * 2));
}
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
gg.setColor(Color.blue);
int res;
- if (av.getShowHiddenMarkers())
+ if (av.getShowHiddenMarkers()
+ && av.getColumnSelection().getHiddenColumns() != null)
{
for (int i = 0; i < av.getColumnSelection().getHiddenColumns()
.size(); i++)
@@ -491,19 +512,18 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
continue;
}
- gg.fillPolygon(new int[]
- { res * av.charWidth - av.charHeight / 4,
- res * av.charWidth + av.charHeight / 4, res * av.charWidth },
- new int[]
- { y - av.charHeight / 2, y - av.charHeight / 2, y + 8 },
- 3);
+ gg.fillPolygon(new int[] { res * avCharWidth - avCharHeight / 4,
+ res * avCharWidth + avCharHeight / 4, res * avCharWidth },
+ new int[] { y - avCharHeight / 2, y - avCharHeight / 2,
+ y + 8 }, 3);
}
}
if (reveal != null && reveal[0] > startx && reveal[0] < endx)
{
- gg.drawString("Reveal Columns", reveal[0] * av.charWidth, 0);
+ gg.drawString(MessageManager.getString("label.reveal_columns"),
+ reveal[0] * avCharWidth, 0);
}
}
diff --git a/src/jalview/gui/ScriptWindow.java b/src/jalview/gui/ScriptWindow.java
deleted file mode 100644
index 9211d0f..0000000
--- a/src/jalview/gui/ScriptWindow.java
+++ /dev/null
@@ -1,732 +0,0 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.gui;
-
-import org.jmol.api.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.text.*;
-import java.util.Vector;
-
-import org.jmol.i18n.GT;
-import org.jmol.util.Logger;
-import org.jmol.util.CommandHistory;
-
-// TODO: this class is copied in from jmol 11.0.2 - upgrade to 12.0.2 ?
-public final class ScriptWindow extends JPanel implements ActionListener,
- EnterListener
-{
-
- private ConsoleTextPane console;
-
- private JButton closeButton;
-
- private JButton runButton;
-
- private JButton haltButton;
-
- private JButton clearButton;
-
- private JButton historyButton;
-
- private JButton stateButton;
-
- JmolViewer viewer;
-
- AppJmol appJmol;
-
- public ScriptWindow(AppJmol appJmol)
- {
- this.viewer = appJmol.jmb.viewer;
- this.appJmol = appJmol;
-
- setLayout(new BorderLayout());
-
- console = new ConsoleTextPane(this);
-
- console.setPrompt();
- add(new JScrollPane(console), BorderLayout.CENTER);
-
- JPanel buttonPanel = new JPanel();
- add(buttonPanel, BorderLayout.SOUTH);
-
- runButton = new JButton(GT._("Run"));
- haltButton = new JButton(GT._("Halt"));
- runButton.addActionListener(this);
- // buttonPanel.add(runButton);
- haltButton.addActionListener(this);
- // buttonPanel.add(haltButton);
- haltButton.setEnabled(false);
-
- clearButton = new JButton(GT._("Clear"));
- clearButton.addActionListener(this);
- buttonPanel.add(clearButton);
-
- historyButton = new JButton(GT._("History"));
- historyButton.addActionListener(this);
- buttonPanel.add(historyButton);
-
- stateButton = new JButton(GT._("State"));
- stateButton.addActionListener(this);
- buttonPanel.add(stateButton);
-
- closeButton = new JButton(GT._("Close"));
- closeButton.addActionListener(this);
- buttonPanel.add(closeButton);
-
- for (int i = 0; i < buttonPanel.getComponentCount(); i++)
- {
- // ((JButton)buttonPanel.getComponent(i))
- // .setMargin(new Insets(0, 0, 0, 0));
- }
-
- }
-
- public void sendConsoleEcho(String strEcho)
- {
- if (strEcho != null && !isError)
- {
-
- console.outputEcho(strEcho);
-
- }
- setError(false);
- }
-
- boolean isError = false;
-
- void setError(boolean TF)
- {
- isError = TF;
- // if (isError)
- // console.recallCommand(true);
- }
-
- public void sendConsoleMessage(String strStatus)
- {
- if (strStatus == null)
- {
- console.clearContent();
- console.outputStatus("");
- }
- else if (strStatus.indexOf("ERROR:") >= 0)
- {
- console.outputError(strStatus);
- isError = true;
- }
- else if (!isError)
- {
- console.outputStatus(strStatus);
- }
- }
-
- public void notifyScriptTermination(String strMsg, int msWalltime)
- {
- if (strMsg != null && strMsg.indexOf("ERROR") >= 0)
- {
- console.outputError(strMsg);
- }
- runButton.setEnabled(true);
- haltButton.setEnabled(false);
- }
-
- public void enterPressed()
- {
- runButton.doClick(100);
- // executeCommand();
- }
-
- class ExecuteCommandThread extends Thread
- {
-
- String strCommand;
-
- ExecuteCommandThread(String command)
- {
- strCommand = command;
- }
-
- public void run()
- {
- try
- {
- executeCommand(strCommand);
- } catch (Exception ie)
- {
- Logger.debug("execution command interrupted!" + ie);
- }
- }
- }
-
- ExecuteCommandThread execThread;
-
- void executeCommandAsThread()
- {
- String strCommand = console.getCommandString().trim();
- if (strCommand.length() > 0)
- {
- execThread = new ExecuteCommandThread(strCommand);
- execThread.start();
- }
- }
-
- void executeCommand(String strCommand)
- {
- boolean doWait;
- setError(false);
- console.appendNewline();
- console.setPrompt();
- if (strCommand.length() > 0)
- {
- String strErrorMessage = null;
- doWait = (strCommand.indexOf("WAIT ") == 0);
- if (doWait)
- { // for testing, mainly
- // demonstrates using the statusManager system.
- runButton.setEnabled(false);
- haltButton.setEnabled(true);
-
- Vector info = (Vector) viewer
- .scriptWaitStatus(strCommand.substring(5),
- "+fileLoaded,+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated");
- runButton.setEnabled(true);
- haltButton.setEnabled(false);
- /*
- * info = [ statusRecortSet0, statusRecortSet1, statusRecortSet2, ...]
- * statusRecordSet = [ statusRecord0, statusRecord1, statusRecord2, ...]
- * statusRecord = [int msgPtr, String statusName, int intInfo, String
- * msg]
- */
- for (int i = 0; i < info.size(); i++)
- {
- Vector statusRecordSet = (Vector) info.get(i);
- for (int j = 0; j < statusRecordSet.size(); j++)
- {
- Vector statusRecord = (Vector) statusRecordSet.get(j);
- Logger.info("msg#=" + statusRecord.get(0) + " "
- + statusRecord.get(1) + " intInfo="
- + statusRecord.get(2) + " stringInfo="
- + statusRecord.get(3));
- }
- }
- console.appendNewline();
- }
- else
- {
- boolean isScriptExecuting = viewer.isScriptExecuting();
- if (viewer.checkHalt(strCommand, true))
- strErrorMessage = (isScriptExecuting ? "string execution halted with "
- + strCommand
- : "no script was executing");
- else
- strErrorMessage = "";// viewer.scriptCheck(strCommand);
- // the problem is that scriptCheck is synchronized, so these might get
- // backed up.
- if (strErrorMessage != null && strErrorMessage.length() > 0)
- {
- console.outputError(strErrorMessage);
- }
- else
- {
- // runButton.setEnabled(false);
- haltButton.setEnabled(true);
- viewer.script(strCommand);
- }
- }
- }
- console.grabFocus();
- }
-
- public void actionPerformed(ActionEvent e)
- {
- Object source = e.getSource();
- if (source == closeButton)
- {
- // appJmol.showConsole(false);
- }
- else if (source == runButton)
- {
- executeCommandAsThread();
- }
- else if (source == clearButton)
- {
- console.clearContent();
- }
- else if (source == historyButton)
- {
- console.clearContent(viewer.getSetHistory(Integer.MAX_VALUE));
- }
- else if (source == stateButton)
- {
- console.clearContent(viewer.getStateInfo());
- }
- else if (source == haltButton)
- {
- viewer.haltScriptExecution();
- }
- console.grabFocus(); // always grab the focus (e.g., after clear)
- }
-}
-
-class ConsoleTextPane extends JTextPane
-{
-
- ConsoleDocument consoleDoc;
-
- EnterListener enterListener;
-
- JmolViewer viewer;
-
- ConsoleTextPane(ScriptWindow scriptWindow)
- {
- super(new ConsoleDocument());
- consoleDoc = (ConsoleDocument) getDocument();
- consoleDoc.setConsoleTextPane(this);
- this.enterListener = (EnterListener) scriptWindow;
- this.viewer = scriptWindow.viewer;
- }
-
- public String getCommandString()
- {
- String cmd = consoleDoc.getCommandString();
- return cmd;
- }
-
- public void setPrompt()
- {
- consoleDoc.setPrompt();
- }
-
- public void appendNewline()
- {
- consoleDoc.appendNewline();
- }
-
- public void outputError(String strError)
- {
- consoleDoc.outputError(strError);
- }
-
- public void outputErrorForeground(String strError)
- {
- consoleDoc.outputErrorForeground(strError);
- }
-
- public void outputEcho(String strEcho)
- {
- consoleDoc.outputEcho(strEcho);
- }
-
- public void outputStatus(String strStatus)
- {
- consoleDoc.outputStatus(strStatus);
- }
-
- public void enterPressed()
- {
- if (enterListener != null)
- enterListener.enterPressed();
- }
-
- public void clearContent()
- {
- clearContent(null);
- }
-
- public void clearContent(String text)
- {
- consoleDoc.clearContent();
- if (text != null)
- consoleDoc.outputEcho(text);
- setPrompt();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
- */
-
- /**
- * Custom key event processing for command 0 implementation.
- *
- * Captures key up and key down strokes to call command history and redefines
- * the same events with control down to allow caret vertical shift.
- *
- * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
- */
- protected void processKeyEvent(KeyEvent ke)
- {
- // Id Control key is down, captures events does command
- // history recall and inhibits caret vertical shift.
- if (ke.getKeyCode() == KeyEvent.VK_UP
- && ke.getID() == KeyEvent.KEY_PRESSED && !ke.isControlDown())
- {
- recallCommand(true);
- }
- else if (ke.getKeyCode() == KeyEvent.VK_DOWN
- && ke.getID() == KeyEvent.KEY_PRESSED && !ke.isControlDown())
- {
- recallCommand(false);
- }
- // If Control key is down, redefines the event as if it
- // where a key up or key down stroke without modifiers.
- // This allows to move the caret up and down
- // with no command history recall.
- else if ((ke.getKeyCode() == KeyEvent.VK_DOWN || ke.getKeyCode() == KeyEvent.VK_UP)
- && ke.getID() == KeyEvent.KEY_PRESSED && ke.isControlDown())
- {
- super.processKeyEvent(new KeyEvent((Component) ke.getSource(), ke
- .getID(), ke.getWhen(), 0, // No modifiers
- ke.getKeyCode(), ke.getKeyChar(), ke.getKeyLocation()));
- }
- // Standard processing for other events.
- else
- {
- super.processKeyEvent(ke);
- // check command for compiler-identifyable syntax issues
- // this may have to be taken out if people start complaining
- // that only some of the commands are being checked
- // that is -- that the script itself is not being fully checked
-
- // not perfect -- help here?
- if (ke.getID() == KeyEvent.KEY_RELEASED
- && (ke.getKeyCode() > KeyEvent.VK_DOWN)
- || ke.getKeyCode() == KeyEvent.VK_BACK_SPACE)
- checkCommand();
- }
- }
-
- /**
- * Recall command history.
- *
- * @param up
- * - history up or down
- */
- void recallCommand(boolean up)
- {
- String cmd = viewer.getSetHistory(up ? -1 : 1);
- if (cmd == null)
- {
- return;
- }
- try
- {
- if (cmd.endsWith(CommandHistory.ERROR_FLAG))
- {
- cmd = cmd.substring(0, cmd.indexOf(CommandHistory.ERROR_FLAG));
- consoleDoc.replaceCommand(cmd, true);
- }
- else
- {
- consoleDoc.replaceCommand(cmd, false);
- }
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- void checkCommand()
- {
- String strCommand = consoleDoc.getCommandString();
- if (strCommand.length() == 0)
- return;
- consoleDoc
- .colorCommand(viewer.scriptCheck(strCommand) == null ? consoleDoc.attUserInput
- : consoleDoc.attError);
- }
-
-}
-
-class ConsoleDocument extends DefaultStyledDocument
-{
-
- ConsoleTextPane consoleTextPane;
-
- SimpleAttributeSet attError;
-
- SimpleAttributeSet attEcho;
-
- SimpleAttributeSet attPrompt;
-
- SimpleAttributeSet attUserInput;
-
- SimpleAttributeSet attStatus;
-
- ConsoleDocument()
- {
- super();
-
- attError = new SimpleAttributeSet();
- StyleConstants.setForeground(attError, Color.red);
-
- attPrompt = new SimpleAttributeSet();
- StyleConstants.setForeground(attPrompt, Color.magenta);
-
- attUserInput = new SimpleAttributeSet();
- StyleConstants.setForeground(attUserInput, Color.black);
-
- attEcho = new SimpleAttributeSet();
- StyleConstants.setForeground(attEcho, Color.blue);
- StyleConstants.setBold(attEcho, true);
-
- attStatus = new SimpleAttributeSet();
- StyleConstants.setForeground(attStatus, Color.black);
- StyleConstants.setItalic(attStatus, true);
- }
-
- void setConsoleTextPane(ConsoleTextPane consoleTextPane)
- {
- this.consoleTextPane = consoleTextPane;
- }
-
- Position positionBeforePrompt; // starts at 0, so first time isn't tracked
-
- // (at least on Mac OS X)
-
- Position positionAfterPrompt; // immediately after $, so this will track
-
- int offsetAfterPrompt; // only still needed for the insertString override and
-
- // replaceCommand
-
- /**
- * Removes all content of the script window, and add a new prompt.
- */
- void clearContent()
- {
- try
- {
- super.remove(0, getLength());
- } catch (BadLocationException exception)
- {
- System.out.println("Could not clear script window content: "
- + exception.getMessage());
- }
- }
-
- void setPrompt()
- {
- try
- {
- super.insertString(getLength(), "$ ", attPrompt);
- setOffsetPositions();
- consoleTextPane.setCaretPosition(offsetAfterPrompt);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- void setOffsetPositions()
- {
- try
- {
- offsetAfterPrompt = getLength();
- positionBeforePrompt = createPosition(offsetAfterPrompt - 2);
- // after prompt should be immediately after $ otherwise tracks the end
- // of the line (and no command will be found) at least on Mac OS X it did.
- positionAfterPrompt = createPosition(offsetAfterPrompt - 1);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- void setNoPrompt()
- {
- try
- {
- offsetAfterPrompt = getLength();
- positionAfterPrompt = positionBeforePrompt = createPosition(offsetAfterPrompt);
- consoleTextPane.setCaretPosition(offsetAfterPrompt);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- // it looks like the positionBeforePrompt does not track when it started out
- // as 0
- // and a insertString at location 0 occurs. It may be better to track the
- // position after the prompt in stead
- void outputBeforePrompt(String str, SimpleAttributeSet attribute)
- {
- try
- {
- int pt = consoleTextPane.getCaretPosition();
- Position caretPosition = createPosition(pt);
- pt = positionBeforePrompt.getOffset();
- super.insertString(pt, str + "\n", attribute);
- setOffsetPositions();
- pt = caretPosition.getOffset();
- consoleTextPane.setCaretPosition(pt);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- void outputError(String strError)
- {
- outputBeforePrompt(strError, attError);
- }
-
- void outputErrorForeground(String strError)
- {
- try
- {
- super.insertString(getLength(), strError + "\n", attError);
- consoleTextPane.setCaretPosition(getLength());
- } catch (BadLocationException e)
- {
- e.printStackTrace();
-
- }
- }
-
- void outputEcho(String strEcho)
- {
- outputBeforePrompt(strEcho, attEcho);
- }
-
- void outputStatus(String strStatus)
- {
- outputBeforePrompt(strStatus, attStatus);
- }
-
- void appendNewline()
- {
- try
- {
- super.insertString(getLength(), "\n", attUserInput);
- consoleTextPane.setCaretPosition(getLength());
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- }
-
- // override the insertString to make sure everything typed ends up at the end
- // or in the 'command line' using the proper font, and the newline is
- // processed.
- public void insertString(int offs, String str, AttributeSet a)
- throws BadLocationException
- {
- int ichNewline = str.indexOf('\n');
- if (ichNewline > 0)
- str = str.substring(0, ichNewline);
- if (ichNewline != 0)
- {
- if (offs < offsetAfterPrompt)
- {
- offs = getLength();
- }
- super.insertString(offs, str, a == attError ? a : attUserInput);
- consoleTextPane.setCaretPosition(offs + str.length());
- }
- if (ichNewline >= 0)
- {
- consoleTextPane.enterPressed();
- }
- }
-
- String getCommandString()
- {
- String strCommand = "";
- try
- {
- int cmdStart = positionAfterPrompt.getOffset();
- strCommand = getText(cmdStart, getLength() - cmdStart);
- while (strCommand.length() > 0 && strCommand.charAt(0) == ' ')
- strCommand = strCommand.substring(1);
- } catch (BadLocationException e)
- {
- e.printStackTrace();
- }
- return strCommand;
- }
-
- public void remove(int offs, int len) throws BadLocationException
- {
- if (offs < offsetAfterPrompt)
- {
- len -= offsetAfterPrompt - offs;
- if (len <= 0)
- return;
- offs = offsetAfterPrompt;
- }
- super.remove(offs, len);
- // consoleTextPane.setCaretPosition(offs);
- }
-
- public void replace(int offs, int length, String str, AttributeSet attrs)
- throws BadLocationException
- {
- if (offs < offsetAfterPrompt)
- {
- if (offs + length < offsetAfterPrompt)
- {
- offs = getLength();
- length = 0;
- }
- else
- {
- length -= offsetAfterPrompt - offs;
- offs = offsetAfterPrompt;
- }
- }
- super.replace(offs, length, str, attrs);
- // consoleTextPane.setCaretPosition(offs + str.length());
- }
-
- /**
- * Replaces current command on script.
- *
- * @param newCommand
- * new command value
- * @param isError
- * true to set error color ends with #??
- *
- * @throws BadLocationException
- */
- void replaceCommand(String newCommand, boolean isError)
- throws BadLocationException
- {
- if (positionAfterPrompt == positionBeforePrompt)
- return;
- replace(offsetAfterPrompt, getLength() - offsetAfterPrompt, newCommand,
- isError ? attError : attUserInput);
- }
-
- void colorCommand(SimpleAttributeSet att)
- {
- if (positionAfterPrompt == positionBeforePrompt)
- return;
- setCharacterAttributes(offsetAfterPrompt, getLength()
- - offsetAfterPrompt, att, true);
- }
-}
-
-interface EnterListener
-{
- public void enterPressed();
-}
diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java
index b55e32b..76dd53a 100644
--- a/src/jalview/gui/SeqCanvas.java
+++ b/src/jalview/gui/SeqCanvas.java
@@ -1,27 +1,42 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.image.*;
-import javax.swing.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+
+import java.awt.BasicStroke;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.image.BufferedImage;
+import java.util.List;
-import jalview.datamodel.*;
+import javax.swing.JComponent;
/**
* DOCUMENT ME!
@@ -66,6 +81,7 @@ public class SeqCanvas extends JComponent
public SeqCanvas(AlignmentPanel ap)
{
this.av = ap.av;
+ updateViewport();
fr = new FeatureRenderer(ap);
sr = new SequenceRenderer(av);
setLayout(new BorderLayout());
@@ -83,6 +99,14 @@ public class SeqCanvas extends JComponent
return fr;
}
+ int charHeight = 0, charWidth = 0;
+
+ private void updateViewport()
+ {
+ charHeight = av.getCharHeight();
+ charWidth = av.getCharWidth();
+ }
+
/**
* DOCUMENT ME!
*
@@ -95,28 +119,27 @@ public class SeqCanvas extends JComponent
* @param ypos
* DOCUMENT ME!
*/
- void drawNorthScale(Graphics g, int startx, int endx, int ypos)
+ private void drawNorthScale(Graphics g, int startx, int endx, int ypos)
{
+ updateViewport();
int scalestartx = startx - (startx % 10) + 10;
g.setColor(Color.black);
-
// NORTH SCALE
for (int i = scalestartx; i < endx; i += 10)
{
int value = i;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
value = av.getColumnSelection().adjustForHiddenColumns(value);
}
- g.drawString(String.valueOf(value), (i - startx - 1) * av.charWidth,
- ypos - (av.charHeight / 2));
+ g.drawString(String.valueOf(value), (i - startx - 1) * charWidth,
+ ypos - (charHeight / 2));
- g.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
- (ypos + 2) - (av.charHeight / 2),
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
- ypos - 2);
+ g.drawLine(((i - startx - 1) * charWidth) + (charWidth / 2),
+ (ypos + 2) - (charHeight / 2), ((i - startx - 1) * charWidth)
+ + (charWidth / 2), ypos - 2);
}
}
@@ -135,24 +158,24 @@ public class SeqCanvas extends JComponent
void drawWestScale(Graphics g, int startx, int endx, int ypos)
{
FontMetrics fm = getFontMetrics(av.getFont());
- ypos += av.charHeight;
+ ypos += charHeight;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
startx = av.getColumnSelection().adjustForHiddenColumns(startx);
endx = av.getColumnSelection().adjustForHiddenColumns(endx);
}
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
// WEST SCALE
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- SequenceI seq = av.alignment.getSequenceAt(i);
+ SequenceI seq = av.getAlignment().getSequenceAt(i);
int index = startx;
int value = -1;
@@ -165,7 +188,7 @@ public class SeqCanvas extends JComponent
continue;
}
- value = av.alignment.getSequenceAt(i).findPosition(index);
+ value = av.getAlignment().getSequenceAt(i).findPosition(index);
break;
}
@@ -173,9 +196,9 @@ public class SeqCanvas extends JComponent
if (value != -1)
{
int x = LABEL_WEST - fm.stringWidth(String.valueOf(value))
- - av.charWidth / 2;
- g.drawString(value + "", x, (ypos + (i * av.charHeight))
- - (av.charHeight / 5));
+ - charWidth / 2;
+ g.drawString(value + "", x, (ypos + (i * charHeight))
+ - (charHeight / 5));
}
}
}
@@ -194,18 +217,18 @@ public class SeqCanvas extends JComponent
*/
void drawEastScale(Graphics g, int startx, int endx, int ypos)
{
- ypos += av.charHeight;
+ ypos += charHeight;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
endx = av.getColumnSelection().adjustForHiddenColumns(endx);
}
SequenceI seq;
// EAST SCALE
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- seq = av.alignment.getSequenceAt(i);
+ seq = av.getAlignment().getSequenceAt(i);
int index = endx;
int value = -1;
@@ -225,8 +248,8 @@ public class SeqCanvas extends JComponent
if (value != -1)
{
- g.drawString(String.valueOf(value), 0, (ypos + (i * av.charHeight))
- - (av.charHeight / 5));
+ g.drawString(String.valueOf(value), 0, (ypos + (i * charHeight))
+ - (charHeight / 5));
}
}
}
@@ -244,21 +267,15 @@ public class SeqCanvas extends JComponent
*/
public void fastPaint(int horizontal, int vertical)
{
- if (fastpainting)
+ if (fastpainting || gg == null)
{
return;
}
fastpainting = true;
- if (gg == null)
- {
- return;
- }
-
fastPaint = true;
-
- gg.copyArea(horizontal * av.charWidth, vertical * av.charHeight,
- imgWidth, imgHeight, -horizontal * av.charWidth, -vertical
- * av.charHeight);
+ updateViewport();
+ gg.copyArea(horizontal * charWidth, vertical * charHeight, imgWidth,
+ imgHeight, -horizontal * charWidth, -vertical * charHeight);
int sr = av.startRes;
int er = av.endRes;
@@ -270,7 +287,7 @@ public class SeqCanvas extends JComponent
if (horizontal > 0) // scrollbar pulled right, image to the left
{
er++;
- transX = (er - sr - horizontal) * av.charWidth;
+ transX = (er - sr - horizontal) * charWidth;
sr = er - horizontal;
}
else if (horizontal < 0)
@@ -287,7 +304,7 @@ public class SeqCanvas extends JComponent
}
else
{
- transY = imgHeight - (vertical * av.charHeight);
+ transY = imgHeight - (vertical * charHeight);
}
}
else if (vertical < 0)
@@ -320,6 +337,7 @@ public class SeqCanvas extends JComponent
// Set this to false to force a full panel paint
public void paintComponent(Graphics g)
{
+ updateViewport();
BufferedImage lcimg = img; // take reference since other threads may null
// img and call later.
super.paintComponent(g);
@@ -338,8 +356,8 @@ public class SeqCanvas extends JComponent
imgWidth = getWidth();
imgHeight = getHeight();
- imgWidth -= (imgWidth % av.charWidth);
- imgHeight -= (imgHeight % av.charHeight);
+ imgWidth -= (imgWidth % charWidth);
+ imgHeight -= (imgHeight % charHeight);
if ((imgWidth < 1) || (imgHeight < 1))
{
@@ -402,17 +420,17 @@ public class SeqCanvas extends JComponent
LABEL_EAST = 0;
LABEL_WEST = 0;
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
LABEL_EAST = fm.stringWidth(getMask());
}
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
LABEL_WEST = fm.stringWidth(getMask());
}
- return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
+ return (cwidth - LABEL_EAST - LABEL_WEST) / charWidth;
}
/**
@@ -425,9 +443,9 @@ public class SeqCanvas extends JComponent
String mask = "00";
int maxWidth = 0;
int tmp;
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- tmp = av.alignment.getSequenceAt(i).getEnd();
+ tmp = av.getAlignment().getSequenceAt(i).getEnd();
if (tmp > maxWidth)
{
maxWidth = tmp;
@@ -456,28 +474,29 @@ public class SeqCanvas extends JComponent
public void drawWrappedPanel(Graphics g, int canvasWidth,
int canvasHeight, int startRes)
{
+ updateViewport();
AlignmentI al = av.getAlignment();
FontMetrics fm = getFontMetrics(av.getFont());
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
LABEL_EAST = fm.stringWidth(getMask());
}
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
LABEL_WEST = fm.stringWidth(getMask());
}
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = charHeight;
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += charHeight;
}
- int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
- int cHeight = av.getAlignment().getHeight() * av.charHeight;
+ int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / charWidth;
+ int cHeight = av.getAlignment().getHeight() * charHeight;
av.setWrappedWidth(cWidth);
@@ -485,9 +504,9 @@ public class SeqCanvas extends JComponent
int endx;
int ypos = hgap;
- int maxwidth = av.alignment.getWidth() - 1;
+ int maxwidth = av.getAlignment().getWidth() - 1;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
@@ -504,12 +523,12 @@ public class SeqCanvas extends JComponent
g.setFont(av.getFont());
g.setColor(Color.black);
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
drawWestScale(g, startRes, endx, ypos);
}
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
g.translate(canvasWidth - LABEL_EAST, 0);
drawEastScale(g, startRes, endx, ypos);
@@ -518,12 +537,12 @@ public class SeqCanvas extends JComponent
g.translate(LABEL_WEST, 0);
- if (av.scaleAboveWrapped)
+ if (av.getScaleAboveWrapped())
{
drawNorthScale(g, startRes, endx, ypos);
}
- if (av.hasHiddenColumns && av.showHiddenMarkers)
+ if (av.hasHiddenColumns() && av.getShowHiddenMarkers())
{
g.setColor(Color.blue);
int res;
@@ -538,12 +557,12 @@ public class SeqCanvas extends JComponent
continue;
}
- gg.fillPolygon(new int[]
- { res * av.charWidth - av.charHeight / 4,
- res * av.charWidth + av.charHeight / 4, res * av.charWidth },
- new int[]
- { ypos - (av.charHeight / 2), ypos - (av.charHeight / 2),
- ypos - (av.charHeight / 2) + 8 }, 3);
+ gg.fillPolygon(
+ new int[] { res * charWidth - charHeight / 4,
+ res * charWidth + charHeight / 4, res * charWidth },
+ new int[] { ypos - (charHeight / 2),
+ ypos - (charHeight / 2), ypos - (charHeight / 2) + 8 },
+ 3);
}
}
@@ -554,17 +573,17 @@ public class SeqCanvas extends JComponent
if (clip == null)
{
- g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);
+ g.setClip(0, 0, cWidth * charWidth, canvasHeight);
}
else
{
- g.setClip(0, (int) clip.getBounds().getY(), cWidth * av.charWidth,
+ g.setClip(0, (int) clip.getBounds().getY(), cWidth * charWidth,
(int) clip.getBounds().getHeight());
}
drawPanel(g, startRes, endx, 0, al.getHeight(), ypos);
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
g.translate(0, cHeight + ypos + 3);
if (annotations == null)
@@ -572,7 +591,8 @@ public class SeqCanvas extends JComponent
annotations = new AnnotationPanel(av);
}
- annotations.drawComponent((Graphics2D) g, startRes, endx + 1);
+ annotations.renderer.drawComponent(annotations, av, g, -1,
+ startRes, endx + 1);
g.translate(0, -cHeight - ypos - 3);
}
g.setClip(clip);
@@ -588,7 +608,7 @@ public class SeqCanvas extends JComponent
int getAnnotationHeight()
{
- if (!av.showAnnotation)
+ if (!av.isShowAnnotation())
{
return 0;
}
@@ -617,24 +637,24 @@ public class SeqCanvas extends JComponent
* @param offset
* DOCUMENT ME!
*/
- void drawPanel(Graphics g1, int startRes, int endRes, int startSeq,
- int endSeq, int offset)
+ public void drawPanel(Graphics g1, int startRes, int endRes,
+ int startSeq, int endSeq, int offset)
{
- if (!av.hasHiddenColumns)
+ updateViewport();
+ if (!av.hasHiddenColumns())
{
draw(g1, startRes, endRes, startSeq, endSeq, offset);
}
else
{
- java.util.Vector regions = av.getColumnSelection().getHiddenColumns();
+ List<int[]> regions = av.getColumnSelection().getHiddenColumns();
int screenY = 0;
int blockStart = startRes;
int blockEnd = endRes;
- for (int i = 0; regions != null && i < regions.size(); i++)
+ for (int[] region : regions)
{
- int[] region = (int[]) regions.elementAt(i);
int hideStart = region[0];
int hideEnd = region[1];
@@ -646,7 +666,7 @@ public class SeqCanvas extends JComponent
blockEnd = hideStart - 1;
- g1.translate(screenY * av.charWidth, 0);
+ g1.translate(screenY * charWidth, 0);
draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
@@ -654,12 +674,12 @@ public class SeqCanvas extends JComponent
{
g1.setColor(Color.blue);
- g1.drawLine((blockEnd - blockStart + 1) * av.charWidth - 1,
- 0 + offset, (blockEnd - blockStart + 1) * av.charWidth
- - 1, (endSeq - startSeq) * av.charHeight + offset);
+ g1.drawLine((blockEnd - blockStart + 1) * charWidth - 1,
+ 0 + offset, (blockEnd - blockStart + 1) * charWidth - 1,
+ (endSeq - startSeq) * charHeight + offset);
}
- g1.translate(-screenY * av.charWidth, 0);
+ g1.translate(-screenY * charWidth, 0);
screenY += blockEnd - blockStart + 1;
blockStart = hideEnd + 1;
}
@@ -667,10 +687,10 @@ public class SeqCanvas extends JComponent
if (screenY <= (endRes - startRes))
{
blockEnd = blockStart + (endRes - startRes) - screenY;
- g1.translate(screenY * av.charWidth, 0);
+ g1.translate(screenY * charWidth, 0);
draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
- g1.translate(-screenY * av.charWidth, 0);
+ g1.translate(-screenY * charWidth, 0);
}
}
@@ -678,11 +698,11 @@ public class SeqCanvas extends JComponent
// int startRes, int endRes, int startSeq, int endSeq, int x, int y,
// int x1, int x2, int y1, int y2, int startx, int starty,
- void draw(Graphics g, int startRes, int endRes, int startSeq, int endSeq,
- int offset)
+ private void draw(Graphics g, int startRes, int endRes, int startSeq,
+ int endSeq, int offset)
{
g.setFont(av.getFont());
- sr.prepare(g, av.renderGaps);
+ sr.prepare(g, av.isRenderGaps());
SequenceI nextSeq;
@@ -690,20 +710,20 @@ public class SeqCanvas extends JComponent
// ///////////////////////////
for (int i = startSeq; i < endSeq; i++)
{
- nextSeq = av.alignment.getSequenceAt(i);
+ nextSeq = av.getAlignment().getSequenceAt(i);
if (nextSeq == null)
{
// occasionally, a race condition occurs such that the alignment row is
// empty
continue;
}
- sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq),
- startRes, endRes, offset + ((i - startSeq) * av.charHeight));
+ sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
+ startRes, endRes, offset + ((i - startSeq) * charHeight));
- if (av.showSequenceFeatures)
+ if (av.isShowSequenceFeatures())
{
fr.drawSequence(g, nextSeq, startRes, endRes, offset
- + ((i - startSeq) * av.charHeight));
+ + ((i - startSeq) * charHeight));
}
// / Highlight search Results once all sequences have been drawn
@@ -718,8 +738,8 @@ public class SeqCanvas extends JComponent
{
sr.drawHighlightedText(nextSeq, visibleResults[r],
visibleResults[r + 1], (visibleResults[r] - startRes)
- * av.charWidth, offset
- + ((i - startSeq) * av.charHeight));
+ * charWidth, offset
+ + ((i - startSeq) * charHeight));
}
}
}
@@ -727,14 +747,13 @@ public class SeqCanvas extends JComponent
if (av.cursorMode && cursorY == i && cursorX >= startRes
&& cursorX <= endRes)
{
- sr.drawCursor(nextSeq, cursorX,
- (cursorX - startRes) * av.charWidth, offset
- + ((i - startSeq) * av.charHeight));
+ sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * charWidth,
+ offset + ((i - startSeq) * charHeight));
}
}
if (av.getSelectionGroup() != null
- || av.alignment.getGroups().size() > 0)
+ || av.getAlignment().getGroups().size() > 0)
{
drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);
}
@@ -755,11 +774,11 @@ public class SeqCanvas extends JComponent
int sy = -1;
int ex = -1;
int groupIndex = -1;
- int visWidth = (endRes - startRes + 1) * av.charWidth;
+ int visWidth = (endRes - startRes + 1) * charWidth;
- if ((group == null) && (av.alignment.getGroups().size() > 0))
+ if ((group == null) && (av.getAlignment().getGroups().size() > 0))
{
- group = (SequenceGroup) av.alignment.getGroups().elementAt(0);
+ group = av.getAlignment().getGroups().get(0);
groupIndex = 0;
}
@@ -775,31 +794,31 @@ public class SeqCanvas extends JComponent
for (i = startSeq; i < endSeq; i++)
{
- sx = (group.getStartRes() - startRes) * av.charWidth;
- sy = offset + ((i - startSeq) * av.charHeight);
- ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) - 1;
+ sx = (group.getStartRes() - startRes) * charWidth;
+ sy = offset + ((i - startSeq) * charHeight);
+ ex = (((group.getEndRes() + 1) - group.getStartRes()) * charWidth) - 1;
if (sx + ex < 0 || sx > visWidth)
{
continue;
}
- if ((sx <= (endRes - startRes) * av.charWidth)
+ if ((sx <= (endRes - startRes) * charWidth)
&& group.getSequences(null).contains(
- av.alignment.getSequenceAt(i)))
+ av.getAlignment().getSequenceAt(i)))
{
if ((bottom == -1)
&& !group.getSequences(null).contains(
- av.alignment.getSequenceAt(i + 1)))
+ av.getAlignment().getSequenceAt(i + 1)))
{
- bottom = sy + av.charHeight;
+ bottom = sy + charHeight;
}
if (!inGroup)
{
if (((top == -1) && (i == 0))
|| !group.getSequences(null).contains(
- av.alignment.getSequenceAt(i - 1)))
+ av.getAlignment().getSequenceAt(i - 1)))
{
top = sy;
}
@@ -810,8 +829,8 @@ public class SeqCanvas extends JComponent
if (group == av.getSelectionGroup())
{
g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT,
- BasicStroke.JOIN_ROUND, 3f, new float[]
- { 5f, 3f }, 0f));
+ BasicStroke.JOIN_ROUND, 3f, new float[] { 5f, 3f },
+ 0f));
g.setColor(Color.RED);
}
else
@@ -846,9 +865,9 @@ public class SeqCanvas extends JComponent
ex = visWidth;
}
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ else if (sx + ex >= (endRes - startRes + 1) * charWidth)
{
- ex = (endRes - startRes + 1) * av.charWidth;
+ ex = (endRes - startRes + 1) * charWidth;
}
if (top != -1)
@@ -870,7 +889,7 @@ public class SeqCanvas extends JComponent
if (inGroup)
{
- sy = offset + ((i - startSeq) * av.charHeight);
+ sy = offset + ((i - startSeq) * charHeight);
if (sx >= 0 && sx < visWidth)
{
g.drawLine(sx, oldY, sx, sy);
@@ -891,9 +910,9 @@ public class SeqCanvas extends JComponent
{
ex = visWidth;
}
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ else if (sx + ex >= (endRes - startRes + 1) * charWidth)
{
- ex = (endRes - startRes + 1) * av.charWidth;
+ ex = (endRes - startRes + 1) * charWidth;
}
if (top != -1)
@@ -915,15 +934,14 @@ public class SeqCanvas extends JComponent
g.setStroke(new BasicStroke());
- if (groupIndex >= av.alignment.getGroups().size())
+ if (groupIndex >= av.getAlignment().getGroups().size())
{
break;
}
- group = (SequenceGroup) av.alignment.getGroups().elementAt(
- groupIndex);
+ group = av.getAlignment().getGroups().get(groupIndex);
- } while (groupIndex < av.alignment.getGroups().size());
+ } while (groupIndex < av.getAlignment().getGroups().size());
}
diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java
index ca5d7f7..e922a0d 100644
--- a/src/jalview/gui/SeqPanel.java
+++ b/src/jalview/gui/SeqPanel.java
@@ -1,33 +1,65 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-import jalview.commands.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import jalview.structure.*;
+import jalview.api.AlignViewportI;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.commands.EditCommand.Edit;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResults.Match;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.io.SequenceAnnotationReport;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.SelectionListener;
+import jalview.structure.SelectionSource;
+import jalview.structure.SequenceListener;
+import jalview.structure.StructureSelectionManager;
+import jalview.structure.VamsasSource;
+import jalview.util.Comparison;
+import jalview.util.MappingUtils;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.ToolTipManager;
/**
* DOCUMENT ME!
@@ -87,7 +119,9 @@ public class SeqPanel extends JPanel implements MouseListener,
java.net.URL linkImageURL;
- StringBuffer tooltipText = new StringBuffer("<html>");
+ private final SequenceAnnotationReport seqARep;
+
+ StringBuffer tooltipText = new StringBuffer();
String tmpString;
@@ -95,6 +129,8 @@ public class SeqPanel extends JPanel implements MouseListener,
StructureSelectionManager ssm;
+ SearchResults lastSearchResults;
+
/**
* Creates a new SeqPanel object.
*
@@ -106,6 +142,7 @@ public class SeqPanel extends JPanel implements MouseListener,
public SeqPanel(AlignViewport av, AlignmentPanel ap)
{
linkImageURL = getClass().getResource("/images/link.gif");
+ seqARep = new SequenceAnnotationReport(linkImageURL.toString());
ToolTipManager.sharedInstance().registerComponent(this);
ToolTipManager.sharedInstance().setInitialDelay(0);
ToolTipManager.sharedInstance().setDismissDelay(10000);
@@ -123,7 +160,7 @@ public class SeqPanel extends JPanel implements MouseListener,
addMouseMotionListener(this);
addMouseListener(this);
addMouseWheelListener(this);
- ssm = StructureSelectionManager.getStructureSelectionManager(Desktop.instance);
+ ssm = av.getStructureSelectionManager();
ssm.addStructureViewerListener(this);
ssm.addSelectionListener(this);
}
@@ -133,22 +170,29 @@ public class SeqPanel extends JPanel implements MouseListener,
int wrappedBlock = -1;
+ /**
+ * Returns the aligned sequence position (base 0) at the mouse position, or
+ * the closest visible one
+ *
+ * @param evt
+ * @return
+ */
int findRes(MouseEvent evt)
{
int res = 0;
int x = evt.getX();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
- + seqCanvas.getAnnotationHeight();
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
+ + hgap + seqCanvas.getAnnotationHeight();
int y = evt.getY();
y -= hgap;
@@ -168,15 +212,21 @@ public class SeqPanel extends JPanel implements MouseListener,
}
else
{
- if (x>seqCanvas.getWidth()+seqCanvas.getWidth())
+ if (x > seqCanvas.getX() + seqCanvas.getWidth())
{
- // make sure we calculate relative to visible alignment, rather than right-hand gutter
- x = seqCanvas.getX()+seqCanvas.getWidth();
+ // make sure we calculate relative to visible alignment, rather than
+ // right-hand gutter
+ x = seqCanvas.getX() + seqCanvas.getWidth();
}
res = (x / av.getCharWidth()) + av.getStartRes();
+ if (res > av.getEndRes())
+ {
+ // moused off right
+ res = av.getEndRes();
+ }
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
@@ -190,83 +240,58 @@ public class SeqPanel extends JPanel implements MouseListener,
int seq = 0;
int y = evt.getY();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
- + seqCanvas.getAnnotationHeight();
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
+ + hgap + seqCanvas.getAnnotationHeight();
y -= hgap;
- seq = Math.min((y % cHeight) / av.getCharHeight(),
- av.alignment.getHeight() - 1);
+ seq = Math.min((y % cHeight) / av.getCharHeight(), av.getAlignment()
+ .getHeight() - 1);
}
else
{
- seq = Math.min((y / av.getCharHeight()) + av.getStartSeq(),
- av.alignment.getHeight() - 1);
+ seq = Math.min((y / av.getCharHeight()) + av.getStartSeq(), av
+ .getAlignment().getHeight() - 1);
}
return seq;
}
- SequenceFeature[] findFeaturesAtRes(SequenceI sequence, int res)
+ /**
+ * When all of a sequence of edits are complete, put the resulting edit list
+ * on the history stack (undo list), and reset flags for editing in progress.
+ */
+ void endEditing()
{
- Vector tmp = new Vector();
- SequenceFeature[] features = sequence.getSequenceFeatures();
- if (features != null)
+ try
{
- for (int i = 0; i < features.length; i++)
+ if (editCommand != null && editCommand.getSize() > 0)
{
- if (av.featuresDisplayed == null
- || !av.featuresDisplayed.containsKey(features[i].getType()))
- {
- continue;
- }
-
- if (features[i].featureGroup != null
- && seqCanvas.fr.featureGroups != null
- && seqCanvas.fr.featureGroups
- .containsKey(features[i].featureGroup)
- && !((Boolean) seqCanvas.fr.featureGroups
- .get(features[i].featureGroup)).booleanValue())
- continue;
-
- if ((features[i].getBegin() <= res)
- && (features[i].getEnd() >= res))
- {
- tmp.addElement(features[i]);
- }
+ ap.alignFrame.addHistoryItem(editCommand);
+ av.firePropertyChange("alignment", null, av.getAlignment()
+ .getSequences());
}
- }
-
- features = new SequenceFeature[tmp.size()];
- tmp.copyInto(features);
-
- return features;
- }
-
- void endEditing()
- {
- if (editCommand != null && editCommand.getSize() > 0)
+ } finally
{
- ap.alignFrame.addHistoryItem(editCommand);
- av.firePropertyChange("alignment", null, av.getAlignment()
- .getSequences());
+ /*
+ * Tidy up come what may...
+ */
+ startseq = -1;
+ lastres = -1;
+ editingSeqs = false;
+ groupEditing = false;
+ keyboardNo1 = null;
+ keyboardNo2 = null;
+ editCommand = null;
}
-
- startseq = -1;
- lastres = -1;
- editingSeqs = false;
- groupEditing = false;
- keyboardNo1 = null;
- keyboardNo2 = null;
- editCommand = null;
}
void setCursorRow()
@@ -297,10 +322,9 @@ public class SeqPanel extends JPanel implements MouseListener,
void setCursorPosition()
{
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
- seqCanvas.cursorY);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
- seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1() - 1);
+ seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1;
scrollToVisible();
}
@@ -308,19 +332,20 @@ public class SeqPanel extends JPanel implements MouseListener,
{
seqCanvas.cursorX += dx;
seqCanvas.cursorY += dy;
- if (av.hasHiddenColumns && !av.colSel.isVisible(seqCanvas.cursorX))
+ if (av.hasHiddenColumns()
+ && !av.getColumnSelection().isVisible(seqCanvas.cursorX))
{
int original = seqCanvas.cursorX - dx;
- int maxWidth = av.alignment.getWidth();
+ int maxWidth = av.getAlignment().getWidth();
- while (!av.colSel.isVisible(seqCanvas.cursorX)
+ while (!av.getColumnSelection().isVisible(seqCanvas.cursorX)
&& seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0)
{
seqCanvas.cursorX += dx;
}
if (seqCanvas.cursorX >= maxWidth
- || !av.colSel.isVisible(seqCanvas.cursorX))
+ || !av.getColumnSelection().isVisible(seqCanvas.cursorX))
{
seqCanvas.cursorX = original;
}
@@ -335,22 +360,22 @@ public class SeqPanel extends JPanel implements MouseListener,
{
seqCanvas.cursorX = 0;
}
- else if (seqCanvas.cursorX > av.alignment.getWidth() - 1)
+ else if (seqCanvas.cursorX > av.getAlignment().getWidth() - 1)
{
- seqCanvas.cursorX = av.alignment.getWidth() - 1;
+ seqCanvas.cursorX = av.getAlignment().getWidth() - 1;
}
if (seqCanvas.cursorY < 0)
{
seqCanvas.cursorY = 0;
}
- else if (seqCanvas.cursorY > av.alignment.getHeight() - 1)
+ else if (seqCanvas.cursorY > av.getAlignment().getHeight() - 1)
{
- seqCanvas.cursorY = av.alignment.getHeight() - 1;
+ seqCanvas.cursorY = av.getAlignment().getHeight() - 1;
}
endEditing();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
ap.scrollToWrappedVisible(seqCanvas.cursorX);
}
@@ -364,9 +389,9 @@ public class SeqPanel extends JPanel implements MouseListener,
{
ap.scrollUp(false);
}
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
- while (seqCanvas.cursorX < av.colSel
+ while (seqCanvas.cursorX < av.getColumnSelection()
.adjustForHiddenColumns(av.startRes))
{
if (!ap.scrollRight(false))
@@ -374,7 +399,7 @@ public class SeqPanel extends JPanel implements MouseListener,
break;
}
}
- while (seqCanvas.cursorX > av.colSel
+ while (seqCanvas.cursorX > av.getColumnSelection()
.adjustForHiddenColumns(av.endRes))
{
if (!ap.scrollRight(true))
@@ -384,7 +409,7 @@ public class SeqPanel extends JPanel implements MouseListener,
}
}
}
- setStatusMessage(av.alignment.getSequenceAt(seqCanvas.cursorY),
+ setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY),
seqCanvas.cursorX, seqCanvas.cursorY);
seqCanvas.repaint();
@@ -392,17 +417,16 @@ public class SeqPanel extends JPanel implements MouseListener,
void setSelectionAreaAtCursor(boolean topLeft)
{
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
- seqCanvas.cursorY);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
if (av.getSelectionGroup() != null)
{
- SequenceGroup sg = av.selectionGroup;
+ SequenceGroup sg = av.getSelectionGroup();
// Find the top and bottom of this group
- int min = av.alignment.getHeight(), max = 0;
+ int min = av.getAlignment().getHeight(), max = 0;
for (int i = 0; i < sg.getSize(); i++)
{
- int index = av.alignment.findIndex(sg.getSequenceAt(i));
+ int index = av.getAlignment().findIndex(sg.getSequenceAt(i));
if (index > max)
{
max = index;
@@ -447,7 +471,7 @@ public class SeqPanel extends JPanel implements MouseListener,
sg.getSequences(null).clear();
for (int i = min; i < max; i++)
{
- sg.addSequence(av.alignment.getSequenceAt(i), false);
+ sg.addSequence(av.getAlignment().getSequenceAt(i), false);
}
}
}
@@ -470,7 +494,7 @@ public class SeqPanel extends JPanel implements MouseListener,
groupEditing = group;
startseq = seqCanvas.cursorY;
lastres = seqCanvas.cursorX;
- editSequence(true, seqCanvas.cursorX + getKeyboardNo1());
+ editSequence(true, false, seqCanvas.cursorX + getKeyboardNo1());
endEditing();
}
@@ -479,7 +503,16 @@ public class SeqPanel extends JPanel implements MouseListener,
groupEditing = group;
startseq = seqCanvas.cursorY;
lastres = seqCanvas.cursorX + getKeyboardNo1();
- editSequence(false, seqCanvas.cursorX);
+ editSequence(false, false, seqCanvas.cursorX);
+ endEditing();
+ }
+
+ void insertNucAtCursor(boolean group, String nuc)
+ {
+ groupEditing = group;
+ startseq = seqCanvas.cursorY;
+ lastres = seqCanvas.cursorX;
+ editSequence(false, true, seqCanvas.cursorX + getKeyboardNo1());
endEditing();
}
@@ -502,26 +535,36 @@ public class SeqPanel extends JPanel implements MouseListener,
int getKeyboardNo1()
{
- if (keyboardNo1 == null)
- return 1;
- else
+ try
+ {
+ if (keyboardNo1 != null)
+ {
+ int value = Integer.parseInt(keyboardNo1.toString());
+ keyboardNo1 = null;
+ return value;
+ }
+ } catch (Exception x)
{
- int value = Integer.parseInt(keyboardNo1.toString());
- keyboardNo1 = null;
- return value;
}
+ keyboardNo1 = null;
+ return 1;
}
int getKeyboardNo2()
{
- if (keyboardNo2 == null)
- return 1;
- else
+ try
+ {
+ if (keyboardNo2 != null)
+ {
+ int value = Integer.parseInt(keyboardNo2.toString());
+ keyboardNo2 = null;
+ return value;
+ }
+ } catch (Exception x)
{
- int value = Integer.parseInt(keyboardNo2.toString());
- keyboardNo2 = null;
- return value;
}
+ keyboardNo2 = null;
+ return 1;
}
/**
@@ -530,6 +573,7 @@ public class SeqPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseReleased(MouseEvent evt)
{
mouseDragging = false;
@@ -550,6 +594,7 @@ public class SeqPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mousePressed(MouseEvent evt)
{
lastMousePress = evt.getPoint();
@@ -599,6 +644,7 @@ public class SeqPanel extends JPanel implements MouseListener,
String lastMessage;
+ @Override
public void mouseOverSequence(SequenceI sequence, int index, int pos)
{
String tmp = sequence.hashCode() + " " + index + " " + pos;
@@ -611,18 +657,46 @@ public class SeqPanel extends JPanel implements MouseListener,
lastMessage = tmp;
}
+ /**
+ * Highlight the mapped region described by the search results object (unless
+ * unchanged). This supports highlight of protein while mousing over linked
+ * cDNA and vice versa. The status bar is also updated to show the location of
+ * the start of the highlighted region.
+ */
+ @Override
public void highlightSequence(SearchResults results)
{
- if (av.followHighlight)
+ if (results == null || results.equals(lastSearchResults))
{
+ return;
+ }
+ lastSearchResults = results;
+
+ if (av.isFollowHighlight())
+ {
+ /*
+ * if scrollToPosition requires a scroll adjustment, this flag prevents
+ * another scroll event being propagated back to the originator
+ *
+ * @see AlignmentPanel#adjustmentValueChanged
+ */
+ ap.setFollowingComplementScroll(true);
if (ap.scrollToPosition(results, false))
{
- seqCanvas.revalidate();
+ seqCanvas.revalidate();
}
}
+ setStatusMessage(results);
seqCanvas.highlightSearchResults(results);
}
+ @Override
+ public VamsasSource getVamsasSource()
+ {
+ return this.ap == null ? null : this.ap.av;
+ }
+
+ @Override
public void updateColours(SequenceI seq, int index)
{
System.out.println("update the seqPanel colours");
@@ -635,6 +709,7 @@ public class SeqPanel extends JPanel implements MouseListener,
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseMoved(MouseEvent evt)
{
if (editingSeqs)
@@ -661,22 +736,19 @@ public class SeqPanel extends JPanel implements MouseListener,
pos = setStatusMessage(sequence, res, seq);
if (ssm != null && pos > -1)
+ {
mouseOverSequence(sequence, res, pos);
+ }
tooltipText.setLength(6); // Cuts the buffer back to <html>
- SequenceGroup[] groups = av.alignment.findAllGroups(sequence);
+ SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence);
if (groups != null)
{
for (int g = 0; g < groups.length; g++)
{
if (groups[g].getStartRes() <= res && groups[g].getEndRes() >= res)
{
- if (tooltipText.length() > 6)
- {
- tooltipText.append("<br>");
- }
-
if (!groups[g].getName().startsWith("JTreeGroup")
&& !groups[g].getName().startsWith("JGroup"))
{
@@ -692,14 +764,14 @@ public class SeqPanel extends JPanel implements MouseListener,
}
// use aa to see if the mouse pointer is on a
- if (av.showSequenceFeatures)
+ if (av.isShowSequenceFeatures())
{
int rpos;
- SequenceFeature[] features = findFeaturesAtRes(
- sequence.getDatasetSequence(),
- rpos = sequence.findPosition(res));
- appendFeatures(tooltipText, linkImageURL.toString(), rpos, features,
- this.ap.seqPanel.seqCanvas.fr.minmax);
+ List<SequenceFeature> features = ap.getFeatureRenderer()
+ .findFeaturesAtRes(sequence.getDatasetSequence(),
+ rpos = sequence.findPosition(res));
+ seqARep.appendFeatures(tooltipText, rpos, features,
+ this.ap.getSeqPanel().seqCanvas.fr.getMinMax());
}
if (tooltipText.length() == 6) // <html></html>
{
@@ -708,11 +780,13 @@ public class SeqPanel extends JPanel implements MouseListener,
}
else
{
- tooltipText.append("</html>");
if (lastTooltip == null
|| !lastTooltip.equals(tooltipText.toString()))
{
- setToolTipText(tooltipText.toString());
+ String formatedTooltipText = JvSwingUtils.wrapTooltip(true,
+ tooltipText.toString());
+ // String formatedTooltipText = tooltipText.toString();
+ setToolTipText(formatedTooltipText);
lastTooltip = tooltipText.toString();
}
@@ -744,146 +818,6 @@ public class SeqPanel extends JPanel implements MouseListener,
return lastp = p;
}
- /**
- * appends the features at rpos to the given stringbuffer ready for display in
- * a tooltip
- *
- * @param tooltipText2
- * @param linkImageURL
- * @param rpos
- * @param features
- * TODO refactor to Jalview 'utilities' somehow.
- */
- public void appendFeatures(StringBuffer tooltipText2,
- String linkImageURL, int rpos, SequenceFeature[] features)
- {
- appendFeatures(tooltipText2, linkImageURL, rpos, features, null);
- }
-
- public void appendFeatures(StringBuffer tooltipText2, String string,
- int rpos, SequenceFeature[] features, Hashtable minmax)
- {
- String tmpString;
- if (features != null)
- {
- for (int i = 0; i < features.length; i++)
- {
- if (features[i].getType().equals("disulfide bond"))
- {
- if (features[i].getBegin() == rpos
- || features[i].getEnd() == rpos)
- {
- if (tooltipText2.length() > 6)
- {
- tooltipText2.append("<br>");
- }
- tooltipText2.append("disulfide bond " + features[i].getBegin()
- + ":" + features[i].getEnd());
- if (features[i].links != null)
- {
- tooltipText2.append(" <img src=\"" + linkImageURL + "\">");
- }
- }
- }
- else
- {
- if (tooltipText2.length() > 6)
- {
- tooltipText2.append("<br>");
- }
- // TODO: remove this hack to display link only features
- boolean linkOnly = features[i].getValue("linkonly") != null;
- if (!linkOnly)
- {
- tooltipText2.append(features[i].getType() + " ");
- if (rpos != 0)
- {
- // we are marking a positional feature
- tooltipText2.append(features[i].begin);
- }
- if (features[i].begin != features[i].end)
- {
- tooltipText2.append(" " + features[i].end);
- }
-
- if (features[i].getDescription() != null
- && !features[i].description.equals(features[i]
- .getType()))
- {
- tmpString = features[i].getDescription();
- String tmp2up=tmpString.toUpperCase();
- int startTag = tmp2up.indexOf("<HTML>");
- if (startTag > -1)
- {
- tmpString = tmpString.substring(startTag + 6);
- tmp2up = tmp2up.substring(startTag+6);
- }
- int endTag = tmp2up.indexOf("</BODY>");
- if (endTag > -1)
- {
- tmpString = tmpString.substring(0, endTag);
- tmp2up = tmp2up.substring(0, endTag);
- }
- endTag = tmp2up.indexOf("</HTML>");
- if (endTag > -1)
- {
- tmpString = tmpString.substring(0, endTag);
- }
-
- if (startTag > -1)
- {
- tooltipText2.append("; " + tmpString);
- }
- else
- {
- if (tmpString.indexOf("<") > -1
- || tmpString.indexOf(">") > -1)
- {
- // The description does not specify html is to
- // be used, so we must remove < > symbols
- tmpString = tmpString.replaceAll("<", "<");
- tmpString = tmpString.replaceAll(">", ">");
-
- tooltipText2.append("; ");
- tooltipText2.append(tmpString);
-
- }
- else
- {
- tooltipText2.append("; " + tmpString);
- }
- }
- }
- // check score should be shown
- if (features[i].getScore() != Float.NaN)
- {
- float[][] rng = (minmax == null) ? null : ((float[][]) minmax
- .get(features[i].getType()));
- if (rng != null && rng[0] != null && rng[0][0] != rng[0][1])
- {
- tooltipText2.append(" Score=" + features[i].getScore());
- }
- }
- if (features[i].getValue("status") != null)
- {
- String status = features[i].getValue("status").toString();
- if (status.length() > 0)
- {
- tooltipText2.append("; (" + features[i].getValue("status")
- + ")");
- }
- }
- }
- if (features[i].links != null)
- {
- tooltipText2.append(" <img src=\"" + linkImageURL + "\">");
- }
-
- }
- }
- }
- }
-
String lastTooltip;
/**
@@ -899,52 +833,96 @@ public class SeqPanel extends JPanel implements MouseListener,
*/
int setStatusMessage(SequenceI sequence, int res, int seq)
{
- int pos = -1;
- StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: "
- + sequence.getName());
+ StringBuilder text = new StringBuilder(32);
- Object obj = null;
- if (av.alignment.isNucleotide())
+ /*
+ * Sequence number (if known), and sequence name.
+ */
+ String seqno = seq == -1 ? "" : " " + (seq + 1);
+ text.append("Sequence" + seqno + " ID: " + sequence.getName());
+
+ String residue = null;
+ /*
+ * Try to translate the display character to residue name (null for gap).
+ */
+ final String displayChar = String.valueOf(sequence.getCharAt(res));
+ if (av.getAlignment().isNucleotide())
{
- obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
- + "");
- if (obj != null)
+ residue = ResidueProperties.nucleotideName.get(displayChar);
+ if (residue != null)
{
- text.append(" Nucleotide: ");
+ text.append(" Nucleotide: ").append(residue);
}
}
else
{
- obj = ResidueProperties.aa2Triplet.get(sequence.getCharAt(res) + "");
- if (obj != null)
+ residue = "X".equalsIgnoreCase(displayChar) ? "X" : ("*"
+ .equals(displayChar) ? "STOP" : ResidueProperties.aa2Triplet
+ .get(displayChar));
+ if (residue != null)
{
- text.append(" Residue: ");
+ text.append(" Residue: ").append(residue);
}
}
- if (obj != null)
+ int pos = -1;
+ if (residue != null)
{
pos = sequence.findPosition(res);
- if (obj != "")
- {
- text.append(obj + " (" + pos + ")");
- }
+ text.append(" (").append(Integer.toString(pos)).append(")");
}
ap.alignFrame.statusBar.setText(text.toString());
return pos;
}
/**
+ * Set the status bar message to highlight the first matched position in
+ * search results.
+ *
+ * @param results
+ */
+ private void setStatusMessage(SearchResults results)
+ {
+ AlignmentI al = this.av.getAlignment();
+ int sequenceIndex = al.findIndex(results);
+ if (sequenceIndex == -1)
+ {
+ return;
+ }
+ SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence();
+ for (Match m : results.getResults())
+ {
+ SequenceI seq = m.getSequence();
+ if (seq.getDatasetSequence() != null)
+ {
+ seq = seq.getDatasetSequence();
+ }
+
+ if (seq == ds)
+ {
+ /*
+ * Convert position in sequence (base 1) to sequence character array
+ * index (base 0)
+ */
+ int start = m.getStart() - 1;
+ setStatusMessage(seq, start, sequenceIndex);
+ return;
+ }
+ }
+ }
+
+ /**
* DOCUMENT ME!
*
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseDragged(MouseEvent evt)
{
if (mouseWheelPressed)
{
- int oldWidth = av.charWidth;
+ int oldWidth = av.getCharWidth();
// Which is bigger, left-right or up-down?
if (Math.abs(evt.getY() - lastMousePress.getY()) > Math.abs(evt
@@ -966,26 +944,28 @@ public class SeqPanel extends JPanel implements MouseListener,
fontSize = 1;
}
- av.setFont(new Font(av.font.getName(), av.font.getStyle(), fontSize));
- av.charWidth = oldWidth;
+ av.setFont(
+ new Font(av.font.getName(), av.font.getStyle(), fontSize),
+ true);
+ av.setCharWidth(oldWidth);
ap.fontChanged();
}
else
{
- if (evt.getX() < lastMousePress.getX() && av.charWidth > 1)
+ if (evt.getX() < lastMousePress.getX() && av.getCharWidth() > 1)
{
- av.charWidth--;
+ av.setCharWidth(av.getCharWidth() - 1);
}
else if (evt.getX() > lastMousePress.getX())
{
- av.charWidth++;
+ av.setCharWidth(av.getCharWidth() + 1);
}
ap.paintAlignment(false);
}
FontMetrics fm = getFontMetrics(av.getFont());
- av.validCharWidth = fm.charWidth('M') <= av.charWidth;
+ av.validCharWidth = fm.charWidth('M') <= av.getCharWidth();
lastMousePress = evt.getPoint();
@@ -1013,11 +993,11 @@ public class SeqPanel extends JPanel implements MouseListener,
if ((res < av.getAlignment().getWidth()) && (res < lastres))
{
// dragLeft, delete gap
- editSequence(false, res);
+ editSequence(false, false, res);
}
else
{
- editSequence(true, res);
+ editSequence(true, false, res);
}
mouseDragging = true;
@@ -1027,33 +1007,35 @@ public class SeqPanel extends JPanel implements MouseListener,
}
}
- synchronized void editSequence(boolean insertGap, int startres)
+ // TODO: Make it more clever than many booleans
+ synchronized void editSequence(boolean insertGap, boolean editSeq,
+ int startres)
{
int fixedLeft = -1;
int fixedRight = -1;
boolean fixedColumns = false;
SequenceGroup sg = av.getSelectionGroup();
- SequenceI seq = av.alignment.getSequenceAt(startseq);
+ SequenceI seq = av.getAlignment().getSequenceAt(startseq);
// No group, but the sequence may represent a group
- if (!groupEditing && av.hasHiddenRows)
+ if (!groupEditing && av.hasHiddenRows())
{
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(seq))
+ if (av.isHiddenRepSequence(seq))
{
- sg = (SequenceGroup) av.hiddenRepSequences.get(seq);
+ sg = av.getRepresentedSequences(seq);
groupEditing = true;
}
}
- StringBuffer message = new StringBuffer();
+ StringBuilder message = new StringBuilder(64);
if (groupEditing)
{
message.append("Edit group:");
if (editCommand == null)
{
- editCommand = new EditCommand("Edit Group");
+ editCommand = new EditCommand(
+ MessageManager.getString("action.edit_group"));
}
}
else
@@ -1066,7 +1048,8 @@ public class SeqPanel extends JPanel implements MouseListener,
}
if (editCommand == null)
{
- editCommand = new EditCommand("Edit " + label);
+ editCommand = new EditCommand(MessageManager.formatMessage(
+ "label.edit_params", new String[] { label }));
}
}
@@ -1084,7 +1067,7 @@ public class SeqPanel extends JPanel implements MouseListener,
// Are we editing within a selection group?
if (groupEditing
- || (sg != null && sg.getSequences(av.hiddenRepSequences)
+ || (sg != null && sg.getSequences(av.getHiddenRepSequences())
.contains(seq)))
{
fixedColumns = true;
@@ -1093,13 +1076,12 @@ public class SeqPanel extends JPanel implements MouseListener,
// but the sequence represents a group
if (sg == null)
{
- if (av.hiddenRepSequences == null
- || !av.hiddenRepSequences.containsKey(seq))
+ if (!av.isHiddenRepSequence(seq))
{
endEditing();
return;
}
- sg = (SequenceGroup) av.hiddenRepSequences.get(seq);
+ sg = av.getRepresentedSequences(seq);
}
fixedLeft = sg.getStartRes();
@@ -1126,7 +1108,7 @@ public class SeqPanel extends JPanel implements MouseListener,
}
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
fixedColumns = true;
int y1 = av.getColumnSelection().getHiddenBoundaryLeft(startres);
@@ -1156,12 +1138,12 @@ public class SeqPanel extends JPanel implements MouseListener,
if (groupEditing)
{
- Vector vseqs = sg.getSequences(av.hiddenRepSequences);
+ List<SequenceI> vseqs = sg.getSequences(av.getHiddenRepSequences());
int g, groupSize = vseqs.size();
SequenceI[] groupSeqs = new SequenceI[groupSize];
for (g = 0; g < groupSeqs.length; g++)
{
- groupSeqs[g] = (SequenceI) vseqs.elementAt(g);
+ groupSeqs[g] = vseqs.get(g);
}
// drag to right
@@ -1170,9 +1152,9 @@ public class SeqPanel extends JPanel implements MouseListener,
// If the user has selected the whole sequence, and is dragging to
// the right, we can still extend the alignment and selectionGroup
if (sg.getStartRes() == 0 && sg.getEndRes() == fixedRight
- && sg.getEndRes() == av.alignment.getWidth() - 1)
+ && sg.getEndRes() == av.getAlignment().getWidth() - 1)
{
- sg.setEndRes(av.alignment.getWidth() + startres - lastres);
+ sg.setEndRes(av.getAlignment().getWidth() + startres - lastres);
fixedRight = sg.getEndRes();
}
@@ -1204,19 +1186,20 @@ public class SeqPanel extends JPanel implements MouseListener,
if (!blank)
{
- if (sg.getSize() == av.alignment.getHeight())
+ if (sg.getSize() == av.getAlignment().getHeight())
{
- if ((av.hasHiddenColumns && startres < av.getColumnSelection()
- .getHiddenBoundaryRight(startres)))
+ if ((av.hasHiddenColumns() && startres < av
+ .getColumnSelection().getHiddenBoundaryRight(startres)))
{
endEditing();
return;
}
- int alWidth = av.alignment.getWidth();
- if (av.hasHiddenRows)
+ int alWidth = av.getAlignment().getWidth();
+ if (av.hasHiddenRows())
{
- int hwidth = av.alignment.getHiddenSequences().getWidth();
+ int hwidth = av.getAlignment().getHiddenSequences()
+ .getWidth();
if (hwidth > alWidth)
{
alWidth = hwidth;
@@ -1272,8 +1255,8 @@ public class SeqPanel extends JPanel implements MouseListener,
}
else
{
- editCommand.appendEdit(EditCommand.INSERT_GAP, groupSeqs,
- startres, startres - lastres, av.alignment, true);
+ appendEdit(Action.INSERT_GAP, groupSeqs, startres, startres
+ - lastres);
}
}
else
@@ -1288,8 +1271,8 @@ public class SeqPanel extends JPanel implements MouseListener,
}
else
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, groupSeqs,
- startres, lastres - startres, av.alignment, true);
+ appendEdit(Action.DELETE_GAP, groupSeqs, startres, lastres
+ - startres);
}
}
@@ -1304,49 +1287,65 @@ public class SeqPanel extends JPanel implements MouseListener,
{
for (int j = lastres; j < startres; j++)
{
- insertChar(j, new SequenceI[]
- { seq }, fixedRight);
+ insertChar(j, new SequenceI[] { seq }, fixedRight);
}
}
else
{
- editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[]
- { seq }, lastres, startres - lastres, av.alignment, true);
+ appendEdit(Action.INSERT_GAP, new SequenceI[] { seq }, lastres,
+ startres - lastres);
}
}
else
{
- // dragging to the left
- if (fixedColumns && fixedRight != -1)
+ if (!editSeq)
{
- for (int j = lastres; j > startres; j--)
+ // dragging to the left
+ if (fixedColumns && fixedRight != -1)
{
- if (!jalview.util.Comparison.isGap(seq.getCharAt(startres)))
+ for (int j = lastres; j > startres; j--)
{
- endEditing();
- break;
+ if (!Comparison.isGap(seq.getCharAt(startres)))
+ {
+ endEditing();
+ break;
+ }
+ deleteChar(startres, new SequenceI[] { seq }, fixedRight);
+ }
+ }
+ else
+ {
+ // could be a keyboard edit trying to delete none gaps
+ int max = 0;
+ for (int m = startres; m < lastres; m++)
+ {
+ if (!Comparison.isGap(seq.getCharAt(m)))
+ {
+ break;
+ }
+ max++;
+ }
+
+ if (max > 0)
+ {
+ appendEdit(Action.DELETE_GAP, new SequenceI[] { seq },
+ startres, max);
}
- deleteChar(startres, new SequenceI[]
- { seq }, fixedRight);
}
}
else
- {
- // could be a keyboard edit trying to delete none gaps
- int max = 0;
- for (int m = startres; m < lastres; m++)
+ {// insertGap==false AND editSeq==TRUE;
+ if (fixedColumns && fixedRight != -1)
{
- if (!jalview.util.Comparison.isGap(seq.getCharAt(m)))
+ for (int j = lastres; j < startres; j++)
{
- break;
+ insertChar(j, new SequenceI[] { seq }, fixedRight);
}
- max++;
}
-
- if (max > 0)
+ else
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, new SequenceI[]
- { seq }, startres, max, av.alignment, true);
+ appendEdit(Action.INSERT_NUC, new SequenceI[] { seq }, lastres,
+ startres - lastres);
}
}
}
@@ -1381,22 +1380,36 @@ public class SeqPanel extends JPanel implements MouseListener,
}
}
- editCommand.appendEdit(EditCommand.DELETE_GAP, seq, blankColumn, 1,
- av.alignment, true);
+ appendEdit(Action.DELETE_GAP, seq, blankColumn, 1);
- editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.alignment,
- true);
+ appendEdit(Action.INSERT_GAP, seq, j, 1);
}
+ /**
+ * Helper method to add and perform one edit action.
+ *
+ * @param action
+ * @param seq
+ * @param pos
+ * @param count
+ */
+ protected void appendEdit(Action action, SequenceI[] seq, int pos,
+ int count)
+ {
+
+ final Edit edit = new EditCommand().new Edit(action, seq, pos, count,
+ av.getAlignment().getGapCharacter());
+
+ editCommand.appendEdit(edit, av.getAlignment(), true, null);
+ }
+
void deleteChar(int j, SequenceI[] seq, int fixedColumn)
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1, av.alignment,
- true);
+ appendEdit(Action.DELETE_GAP, seq, j, 1);
- editCommand.appendEdit(EditCommand.INSERT_GAP, seq, fixedColumn, 1,
- av.alignment, true);
+ appendEdit(Action.INSERT_GAP, seq, fixedColumn, 1);
}
/**
@@ -1405,6 +1418,7 @@ public class SeqPanel extends JPanel implements MouseListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseEntered(MouseEvent e)
{
if (oldSeq < 0)
@@ -1425,6 +1439,7 @@ public class SeqPanel extends JPanel implements MouseListener,
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseExited(MouseEvent e)
{
if (av.getWrapAlignment())
@@ -1438,10 +1453,11 @@ public class SeqPanel extends JPanel implements MouseListener,
}
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
SequenceGroup sg = null;
- SequenceI sequence = av.alignment.getSequenceAt(findSeq(evt));
+ SequenceI sequence = av.getAlignment().getSequenceAt(findSeq(evt));
if (evt.getClickCount() > 1)
{
sg = av.getSelectionGroup();
@@ -1451,37 +1467,55 @@ public class SeqPanel extends JPanel implements MouseListener,
av.setSelectionGroup(null);
}
- SequenceFeature[] features = findFeaturesAtRes(
- sequence.getDatasetSequence(),
- sequence.findPosition(findRes(evt)));
+ List<SequenceFeature> features = seqCanvas.getFeatureRenderer()
+ .findFeaturesAtRes(sequence.getDatasetSequence(),
+ sequence.findPosition(findRes(evt)));
- if (features != null && features.length > 0)
+ if (features != null && features.size() > 0)
{
SearchResults highlight = new SearchResults();
- highlight.addResult(sequence, features[0].getBegin(),
- features[0].getEnd());
+ highlight.addResult(sequence, features.get(0).getBegin(), features
+ .get(0).getEnd());
seqCanvas.highlightSearchResults(highlight);
}
- if (features != null && features.length > 0)
+ if (features != null && features.size() > 0)
{
- seqCanvas.getFeatureRenderer().amendFeatures(new SequenceI[]
- { sequence }, features, false, ap);
+ seqCanvas.getFeatureRenderer().amendFeatures(
+ new SequenceI[] { sequence },
+ features.toArray(new SequenceFeature[features.size()]),
+ false, ap);
seqCanvas.highlightSearchResults(null);
}
}
}
+ @Override
public void mouseWheelMoved(MouseWheelEvent e)
{
e.consume();
if (e.getWheelRotation() > 0)
{
- ap.scrollUp(false);
+ if (e.isShiftDown())
+ {
+ ap.scrollRight(true);
+
+ }
+ else
+ {
+ ap.scrollUp(false);
+ }
}
else
{
- ap.scrollUp(true);
+ if (e.isShiftDown())
+ {
+ ap.scrollRight(false);
+ }
+ else
+ {
+ ap.scrollUp(true);
+ }
}
// TODO Update tooltip for new position.
}
@@ -1500,11 +1534,12 @@ public class SeqPanel extends JPanel implements MouseListener,
startWrapBlock = wrappedBlock;
- if (av.wrapAlignment && seq > av.alignment.getHeight())
+ if (av.getWrapAlignment() && seq > av.getAlignment().getHeight())
{
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Cannot edit annotations in wrapped view.",
- "Wrapped view - no edit", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
+ .getString("label.cannot_edit_annotations_in_wrapped_view"),
+ MessageManager.getString("label.wrapped_view_no_edit"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
@@ -1513,7 +1548,7 @@ public class SeqPanel extends JPanel implements MouseListener,
return;
}
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);
if ((sequence == null) || (res > sequence.getLength()))
{
@@ -1524,7 +1559,7 @@ public class SeqPanel extends JPanel implements MouseListener,
if (stretchGroup == null)
{
- stretchGroup = av.alignment.findGroup(sequence);
+ stretchGroup = av.getAlignment().findGroup(sequence);
if ((stretchGroup != null) && (res > stretchGroup.getStartRes())
&& (res < stretchGroup.getEndRes()))
@@ -1542,7 +1577,7 @@ public class SeqPanel extends JPanel implements MouseListener,
{
stretchGroup = null;
- SequenceGroup[] allGroups = av.alignment.findAllGroups(sequence);
+ SequenceGroup[] allGroups = av.getAlignment().findAllGroups(sequence);
if (allGroups != null)
{
@@ -1563,16 +1598,17 @@ public class SeqPanel extends JPanel implements MouseListener,
if (javax.swing.SwingUtilities.isRightMouseButton(evt))
{
- SequenceFeature[] allFeatures = findFeaturesAtRes(
- sequence.getDatasetSequence(), sequence.findPosition(res));
+ List<SequenceFeature> allFeatures = ap.getFeatureRenderer()
+ .findFeaturesAtRes(sequence.getDatasetSequence(),
+ sequence.findPosition(res));
Vector links = new Vector();
- for (int i = 0; i < allFeatures.length; i++)
+ for (SequenceFeature sf : allFeatures)
{
- if (allFeatures[i].links != null)
+ if (sf.links != null)
{
- for (int j = 0; j < allFeatures[i].links.size(); j++)
+ for (int j = 0; j < sf.links.size(); j++)
{
- links.addElement(allFeatures[i].links.elementAt(j));
+ links.addElement(sf.links.elementAt(j));
}
}
}
@@ -1648,12 +1684,8 @@ public class SeqPanel extends JPanel implements MouseListener,
// state
if (stretchGroup.cs != null)
{
- if (stretchGroup.cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) stretchGroup.cs).resetClustalX(
- stretchGroup.getSequences(av.hiddenRepSequences),
- stretchGroup.getWidth());
- }
+ stretchGroup.cs.alignmentChanged(stretchGroup,
+ av.getHiddenRepSequences());
if (stretchGroup.cs.conservationApplied())
{
@@ -1696,9 +1728,9 @@ public class SeqPanel extends JPanel implements MouseListener,
return;
}
- if (res >= av.alignment.getWidth())
+ if (res >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (stretchGroup.getEndRes() == res)
@@ -1743,7 +1775,8 @@ public class SeqPanel extends JPanel implements MouseListener,
dragDirection = -1;
}
- while ((y != oldSeq) && (oldSeq > -1) && (y < av.alignment.getHeight()))
+ while ((y != oldSeq) && (oldSeq > -1)
+ && (y < av.getAlignment().getHeight()))
{
// This routine ensures we don't skip any sequences, as the
// selection is quite slow.
@@ -1834,6 +1867,7 @@ public class SeqPanel extends JPanel implements MouseListener,
running = false;
}
+ @Override
public void run()
{
running = true;
@@ -1848,7 +1882,7 @@ public class SeqPanel extends JPanel implements MouseListener,
}
if (mouseDragging && (evt.getY() >= getHeight())
- && (av.alignment.getHeight() > av.getEndSeq()))
+ && (av.getAlignment().getHeight() > av.getEndSeq()))
{
running = ap.scrollUp(false);
}
@@ -1876,6 +1910,7 @@ public class SeqPanel extends JPanel implements MouseListener,
/**
* modify current selection according to a received message.
*/
+ @Override
public void selection(SequenceGroup seqsel, ColumnSelection colsel,
SelectionSource source)
{
@@ -1883,88 +1918,150 @@ public class SeqPanel extends JPanel implements MouseListener,
// handles selection messages...
// TODO: extend config options to allow user to control if selections may be
// shared between viewports.
- if (av == source
- || !av.followSelection
- || (av.isSelectionGroupChanged(false) || av.isColSelChanged(false))
- || (source instanceof AlignViewport && ((AlignViewport) source)
- .getSequenceSetId().equals(av.getSequenceSetId())))
+ boolean iSentTheSelection = (av == source || (source instanceof AlignViewport && ((AlignmentViewport) source)
+ .getSequenceSetId().equals(av.getSequenceSetId())));
+ if (iSentTheSelection || !av.followSelection)
+ {
+ return;
+ }
+
+ /*
+ * Ignore the selection if there is one of our own pending.
+ */
+ if (av.isSelectionGroupChanged(false) || av.isColSelChanged(false))
+ {
+ return;
+ }
+
+ /*
+ * Check for selection in a view of which this one is a dna/protein
+ * complement.
+ */
+ if (selectionFromTranslation(seqsel, colsel, source))
{
return;
}
+
// do we want to thread this ? (contention with seqsel and colsel locks, I
// suspect)
// rules are: colsel is copied if there is a real intersection between
// sequence selection
- boolean repaint = false, copycolsel = true;
- // if (!av.isSelectionGroupChanged(false))
+ boolean repaint = false;
+ boolean copycolsel = true;
+
+ SequenceGroup sgroup = null;
+ if (seqsel != null && seqsel.getSize() > 0)
{
- SequenceGroup sgroup = null;
- if (seqsel != null && seqsel.getSize()>0)
+ if (av.getAlignment() == null)
{
- if (av.alignment == null)
- {
- jalview.bin.Cache.log.warn("alignviewport av SeqSetId="
- + av.getSequenceSetId() + " ViewId=" + av.getViewId()
- + " 's alignment is NULL! returning immediatly.");
- return;
- }
- sgroup = seqsel.intersect(av.alignment,
- (av.hasHiddenRows) ? av.hiddenRepSequences : null);
- if ((sgroup == null || sgroup.getSize() == 0)
- || (colsel == null || colsel.size() == 0))
- {
- // don't copy columns if the region didn't intersect.
- copycolsel = false;
- }
- }
- if (sgroup != null && sgroup.getSize() > 0)
- {
- av.setSelectionGroup(sgroup);
+ jalview.bin.Cache.log.warn("alignviewport av SeqSetId="
+ + av.getSequenceSetId() + " ViewId=" + av.getViewId()
+ + " 's alignment is NULL! returning immediately.");
+ return;
}
- else
+ sgroup = seqsel.intersect(av.getAlignment(),
+ (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
+ if ((sgroup == null || sgroup.getSize() == 0)
+ || (colsel == null || colsel.size() == 0))
{
- av.setSelectionGroup(null);
+ // don't copy columns if the region didn't intersect.
+ copycolsel = false;
}
- av.isSelectionGroupChanged(true);
- repaint = true;
}
+ if (sgroup != null && sgroup.getSize() > 0)
+ {
+ av.setSelectionGroup(sgroup);
+ }
+ else
+ {
+ av.setSelectionGroup(null);
+ }
+ av.isSelectionGroupChanged(true);
+ repaint = true;
+
if (copycolsel)
{
// the current selection is unset or from a previous message
// so import the new colsel.
if (colsel == null || colsel.size() == 0)
{
- if (av.colSel != null)
+ if (av.getColumnSelection() != null)
{
- av.colSel.clear();
- repaint=true;
+ av.getColumnSelection().clear();
+ repaint = true;
}
}
else
{
// TODO: shift colSel according to the intersecting sequences
- if (av.colSel == null)
+ if (av.getColumnSelection() == null)
{
- av.colSel = new ColumnSelection(colsel);
+ av.setColumnSelection(new ColumnSelection(colsel));
}
else
{
- av.colSel.setElementsFrom(colsel);
+ av.getColumnSelection().setElementsFrom(colsel);
}
}
av.isColSelChanged(true);
repaint = true;
}
- if (copycolsel && av.hasHiddenColumns
- && (av.colSel == null || av.colSel.getHiddenColumns() == null))
+
+ if (copycolsel
+ && av.hasHiddenColumns()
+ && (av.getColumnSelection() == null || av.getColumnSelection()
+ .getHiddenColumns() == null))
{
System.err.println("Bad things");
}
- if (repaint)
+ if (repaint) // always true!
{
// probably finessing with multiple redraws here
PaintRefresher.Refresh(this, av.getSequenceSetId());
// ap.paintAlignment(false);
}
}
+
+ /**
+ * If this panel is a cdna/protein translation view of the selection source,
+ * tries to map the source selection to a local one, and returns true. Else
+ * returns false.
+ *
+ * @param seqsel
+ * @param colsel
+ * @param source
+ */
+ protected boolean selectionFromTranslation(SequenceGroup seqsel,
+ ColumnSelection colsel, SelectionSource source)
+ {
+ if (!(source instanceof AlignViewportI))
+ {
+ return false;
+ }
+ final AlignViewportI sourceAv = (AlignViewportI) source;
+ if (sourceAv.getCodingComplement() != av
+ && av.getCodingComplement() != sourceAv)
+ {
+ return false;
+ }
+
+ /*
+ * Map sequence selection
+ */
+ SequenceGroup sg = MappingUtils.mapSequenceGroup(seqsel, sourceAv, av);
+ av.setSelectionGroup(sg);
+ av.isSelectionGroupChanged(true);
+
+ /*
+ * Map column selection
+ */
+ ColumnSelection cs = MappingUtils.mapColumnSelection(colsel, sourceAv,
+ av);
+ av.setColumnSelection(cs);
+ av.isColSelChanged(true);
+
+ PaintRefresher.Refresh(this, av.getSequenceSetId());
+
+ return true;
+ }
}
diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java
index 43c9d42..9f92c42 100644
--- a/src/jalview/gui/SequenceFetcher.java
+++ b/src/jalview/gui/SequenceFetcher.java
@@ -1,47 +1,99 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.io.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-import MCview.*;
-import jalview.datamodel.*;
-import jalview.datamodel.xdb.embl.*;
-import java.io.File;
-import jalview.io.*;
-import jalview.ws.DBRefFetcher;
-import jalview.ws.ebi.EBIFetchClient;
-import jalview.ws.seqfetcher.ASequenceFetcher;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.io.FormatAdapter;
+import jalview.io.IdentifyFile;
+import jalview.util.DBRefUtils;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
import jalview.ws.seqfetcher.DbSourceProxy;
-import java.awt.Rectangle;
import java.awt.BorderLayout;
-import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingConstants;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import com.stevesoft.pat.Regex;
public class SequenceFetcher extends JPanel implements Runnable
{
- // ASequenceFetcher sfetch;
+ JLabel dbeg = new JLabel();
+
+ JDatabaseTree database;
+
+ JButton databaseButt;
+
+ JLabel jLabel1 = new JLabel();
+
+ JCheckBox replacePunctuation = new JCheckBox();
+
+ JButton ok = new JButton();
+
+ JButton clear = new JButton();
+
+ JButton example = new JButton();
+
+ JButton close = new JButton();
+
+ JPanel jPanel1 = new JPanel();
+
+ JTextArea textArea = new JTextArea();
+
+ JScrollPane jScrollPane1 = new JScrollPane();
+
+ JPanel jPanel2 = new JPanel();
+
+ JPanel jPanel3 = new JPanel();
+
+ JPanel jPanel4 = new JPanel();
+
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ BorderLayout borderLayout2 = new BorderLayout();
+
+ BorderLayout borderLayout3 = new BorderLayout();
+
JInternalFrame frame;
IProgressIndicator guiWindow;
@@ -52,16 +104,18 @@ public class SequenceFetcher extends JPanel implements Runnable
final String noDbSelected = "-- Select Database --";
- Hashtable sources = new Hashtable();
-
private static jalview.ws.SequenceFetcher sfetch = null;
- private static String dasRegistry = null;
+ private static long lastDasSourceRegistry = -3;
+
+ private static DasSourceRegistryI dasRegistry = null;
private static boolean _initingFetcher = false;
private static Thread initingThread = null;
+ int debounceTrap = 0;
+
/**
* Blocking method that initialises and returns the shared instance of the
* SequenceFetcher client
@@ -77,9 +131,11 @@ public class SequenceFetcher extends JPanel implements Runnable
{
if (guiWindow != null)
{
- guiWindow.setProgressBar(
- "Waiting for Sequence Database Fetchers to initialise",
- Thread.currentThread().hashCode());
+ guiWindow
+ .setProgressBar(
+ MessageManager
+ .getString("status.waiting_sequence_database_fetchers_init"),
+ Thread.currentThread().hashCode());
}
// initting happening on another thread - so wait around to see if it
// finishes.
@@ -96,13 +152,19 @@ public class SequenceFetcher extends JPanel implements Runnable
}
if (guiWindow != null)
{
- guiWindow.setProgressBar(
- "Waiting for Sequence Database Fetchers to initialise",
- Thread.currentThread().hashCode());
+ guiWindow
+ .setProgressBar(
+ MessageManager
+ .getString("status.waiting_sequence_database_fetchers_init"),
+ Thread.currentThread().hashCode());
}
}
if (sfetch == null
- || dasRegistry != DasSourceBrowser.getDasRegistryURL())
+ || dasRegistry != jalview.bin.Cache.getDasSourceRegistry()
+ || lastDasSourceRegistry != (jalview.bin.Cache
+ .getDasSourceRegistry().getDasRegistryURL() + jalview.bin.Cache
+ .getDasSourceRegistry().getLocalSourceString())
+ .hashCode())
{
_initingFetcher = true;
initingThread = Thread.currentThread();
@@ -111,16 +173,20 @@ public class SequenceFetcher extends JPanel implements Runnable
*/
if (guiWindow != null)
{
- guiWindow.setProgressBar("Initialising Sequence Database Fetchers",
+ guiWindow.setProgressBar(MessageManager
+ .getString("status.init_sequence_database_fetchers"),
Thread.currentThread().hashCode());
}
- dasRegistry = DasSourceBrowser.getDasRegistryURL();
+ dasRegistry = jalview.bin.Cache.getDasSourceRegistry();
+ dasRegistry.refreshSources();
+
jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher();
if (guiWindow != null)
{
- guiWindow.setProgressBar("Initialising Sequence Database Fetchers",
- Thread.currentThread().hashCode());
+ guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
}
+ lastDasSourceRegistry = (dasRegistry.getDasRegistryURL() + dasRegistry
+ .getLocalSourceString()).hashCode();
sfetch = sf;
_initingFetcher = false;
initingThread = null;
@@ -128,31 +194,37 @@ public class SequenceFetcher extends JPanel implements Runnable
return sfetch;
}
+ private IProgressIndicator progressIndicator;
+
public SequenceFetcher(IProgressIndicator guiIndic)
{
- final IProgressIndicator guiWindow = guiIndic;
+ this.progressIndicator = guiIndic;
final SequenceFetcher us = this;
// launch initialiser thread
Thread sf = new Thread(new Runnable()
{
+ @Override
public void run()
{
- if (getSequenceFetcherSingleton(guiWindow) != null)
+ if (getSequenceFetcherSingleton(progressIndicator) != null)
{
- us.initGui(guiWindow);
+ us.initGui(progressIndicator);
}
else
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
JOptionPane
.showInternalMessageDialog(
Desktop.desktop,
- "Could not create the sequence fetcher client. Check error logs for details.",
- "Couldn't create SequenceFetcher",
+ MessageManager
+ .getString("warn.couldnt_create_sequence_fetcher_client"),
+ MessageManager
+ .getString("label.couldnt_create_sequence_fetcher"),
JOptionPane.ERROR_MESSAGE);
}
});
@@ -164,6 +236,16 @@ public class SequenceFetcher extends JPanel implements Runnable
sf.start();
}
+ private class DatabaseAuthority extends DefaultMutableTreeNode
+ {
+
+ };
+
+ private class DatabaseSource extends DefaultMutableTreeNode
+ {
+
+ };
+
/**
* called by thread spawned by constructor
*
@@ -176,29 +258,7 @@ public class SequenceFetcher extends JPanel implements Runnable
{
alignFrame = (AlignFrame) guiWindow;
}
-
- database.addItem(noDbSelected);
- /*
- * Dynamically generated database list will need a translation function from
- * internal source to externally distinct names. UNIPROT and UP_NAME are
- * identical DB sources, and should be collapsed.
- */
-
- String dbs[] = sfetch.getOrderedSupportedSources();
- for (int i = 0; i < dbs.length; i++)
- {
- if (!sources.containsValue(dbs[i]))
- {
- String name = sfetch.getSourceProxy(dbs[i]).getDbName();
- // duplicate source names are thrown away, here.
- if (!sources.containsKey(name))
- {
- database.addItem(name);
- }
- // overwrite with latest version of the retriever for this source
- sources.put(name, dbs[i]);
- }
- }
+ database = new JDatabaseTree(sfetch);
try
{
jbInit();
@@ -221,8 +281,9 @@ public class SequenceFetcher extends JPanel implements Runnable
private String getFrameTitle()
{
- return ((alignFrame == null) ? "New " : "Additional ")
- + "Sequence Fetcher";
+ return ((alignFrame == null) ? MessageManager
+ .getString("label.new_sequence_fetcher") : MessageManager
+ .getString("label.additional_sequence_fetcher"));
}
private void jbInit() throws Exception
@@ -233,40 +294,46 @@ public class SequenceFetcher extends JPanel implements Runnable
dbeg.setFont(new java.awt.Font("Verdana", Font.BOLD, 11));
jLabel1.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));
jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
- jLabel1.setText("Separate multiple accession ids with semi colon \";\"");
+ jLabel1.setText(MessageManager
+ .getString("label.separate_multiple_accession_ids"));
replacePunctuation.setHorizontalAlignment(SwingConstants.CENTER);
replacePunctuation
.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));
- replacePunctuation.setText("Replace commas with semi-colons");
- ok.setText("OK");
+ replacePunctuation.setText(MessageManager
+ .getString("label.replace_commas_semicolons"));
+ ok.setText(MessageManager.getString("action.ok"));
ok.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
ok_actionPerformed();
}
});
- clear.setText("Clear");
+ clear.setText(MessageManager.getString("action.clear"));
clear.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
clear_actionPerformed();
}
});
- example.setText("Example");
+ example.setText(MessageManager.getString("label.example"));
example.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
example_actionPerformed();
}
});
- close.setText("Close");
+ close.setText(MessageManager.getString("action.close"));
close.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
close_actionPerformed(e);
@@ -276,10 +343,13 @@ public class SequenceFetcher extends JPanel implements Runnable
textArea.setLineWrap(true);
textArea.addKeyListener(new KeyAdapter()
{
+ @Override
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
+ {
ok_actionPerformed();
+ }
}
});
jPanel3.setLayout(borderLayout1);
@@ -290,30 +360,30 @@ public class SequenceFetcher extends JPanel implements Runnable
jPanel1.add(close);
jPanel3.add(jPanel2, java.awt.BorderLayout.CENTER);
jPanel2.setLayout(borderLayout3);
-
+ databaseButt = database.getDatabaseSelectorButton();
+ databaseButt.setFont(JvSwingUtils.getLabelFont());
database.addActionListener(new ActionListener()
{
-
+ @Override
public void actionPerformed(ActionEvent e)
{
- DbSourceProxy db = null;
- try
+ debounceTrap++;
+ String currentSelection = database.getSelectedItem();
+ if (!currentSelection.equalsIgnoreCase("pdb"))
{
- db = sfetch.getSourceProxy((String) sources.get(database
- .getSelectedItem()));
- String eq = db.getTestQuery();
- dbeg.setText("Example query: " + eq);
- replacePunctuation.setEnabled(!(eq != null && eq.indexOf(",") > -1));
- } catch (Exception ex)
+ otherSourceAction();
+ }
+ if (currentSelection.equalsIgnoreCase("pdb")
+ && (database.action == KeyEvent.VK_ENTER || ((debounceTrap % 2) == 0)))
{
- dbeg.setText("");
- replacePunctuation.setEnabled(true);
+ pdbSourceAction();
}
- jPanel2.repaint();
+ database.action = -1;
}
});
+
dbeg.setText("");
- jPanel2.add(database, java.awt.BorderLayout.NORTH);
+ jPanel2.add(databaseButt, java.awt.BorderLayout.NORTH);
jPanel2.add(dbeg, java.awt.BorderLayout.CENTER);
JPanel jPanel2a = new JPanel(new BorderLayout());
jPanel2a.add(jLabel1, java.awt.BorderLayout.NORTH);
@@ -328,14 +398,49 @@ public class SequenceFetcher extends JPanel implements Runnable
}
+ private void pdbSourceAction()
+ {
+ databaseButt.setText(database.getSelectedItem());
+ new PDBSearchPanel(this);
+ frame.dispose();
+ }
+
+ private void otherSourceAction()
+ {
+ try
+ {
+ databaseButt.setText(database.getSelectedItem()
+ + (database.getSelectedSources().size() > 1 ? " (and "
+ + database.getSelectedSources().size() + " others)"
+ : ""));
+ String eq = database.getExampleQueries();
+ dbeg.setText(MessageManager.formatMessage(
+ "label.example_query_param", new String[] { eq }));
+ boolean enablePunct = !(eq != null && eq.indexOf(",") > -1);
+ for (DbSourceProxy dbs : database.getSelectedSources())
+ {
+ if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
+ {
+ enablePunct = false;
+ break;
+ }
+ }
+ replacePunctuation.setEnabled(enablePunct);
+
+ } catch (Exception ex)
+ {
+ dbeg.setText("");
+ replacePunctuation.setEnabled(true);
+ }
+ jPanel2.repaint();
+ }
+
protected void example_actionPerformed()
{
DbSourceProxy db = null;
try
{
- db = sfetch.getSourceProxy((String) sources.get(database
- .getSelectedItem()));
- textArea.setText(db.getTestQuery());
+ textArea.setText(database.getExampleQueries());
} catch (Exception ex)
{
}
@@ -348,40 +453,6 @@ public class SequenceFetcher extends JPanel implements Runnable
jPanel3.repaint();
}
- JLabel dbeg = new JLabel();
-
- JComboBox database = new JComboBox();
-
- JLabel jLabel1 = new JLabel();
-
- JCheckBox replacePunctuation = new JCheckBox();
-
- JButton ok = new JButton();
-
- JButton clear = new JButton();
-
- JButton example = new JButton();
-
- JButton close = new JButton();
-
- JPanel jPanel1 = new JPanel();
-
- JTextArea textArea = new JTextArea();
-
- JScrollPane jScrollPane1 = new JScrollPane();
-
- JPanel jPanel2 = new JPanel();
-
- JPanel jPanel3 = new JPanel();
-
- JPanel jPanel4 = new JPanel();
-
- BorderLayout borderLayout1 = new BorderLayout();
-
- BorderLayout borderLayout2 = new BorderLayout();
-
- BorderLayout borderLayout3 = new BorderLayout();
-
public void close_actionPerformed(ActionEvent e)
{
try
@@ -394,7 +465,8 @@ public class SequenceFetcher extends JPanel implements Runnable
public void ok_actionPerformed()
{
- database.setEnabled(false);
+ databaseButt.setEnabled(false);
+ example.setEnabled(false);
textArea.setEnabled(false);
ok.setEnabled(false);
close.setEnabled(false);
@@ -405,16 +477,18 @@ public class SequenceFetcher extends JPanel implements Runnable
private void resetDialog()
{
- database.setEnabled(true);
+ databaseButt.setEnabled(true);
+ example.setEnabled(true);
textArea.setEnabled(true);
ok.setEnabled(true);
close.setEnabled(true);
}
+ @Override
public void run()
{
String error = "";
- if (database.getSelectedItem().equals(noDbSelected))
+ if (!database.hasSelection())
{
error += "Please select the source database\n";
}
@@ -444,278 +518,280 @@ public class SequenceFetcher extends JPanel implements Runnable
resetDialog();
return;
}
- ArrayList<String> aresultq=new ArrayList<String>();
- ArrayList<AlignmentI> aresult = new ArrayList<AlignmentI>();
- Object source = database.getSelectedItem();
- Enumeration en = new StringTokenizer(textArea.getText(), ";");
- boolean isAliSource=false;
- try
- {
- guiWindow.setProgressBar(
- "Fetching Sequences from " + database.getSelectedItem(),
- Thread.currentThread().hashCode());
- DbSourceProxy proxy = sfetch.getSourceProxy((String) sources
- .get(source));
- isAliSource = proxy.isA(DBRefSource.ALIGNMENTDB);
- if (proxy.getAccessionSeparator() == null)
+ // indicate if successive sources should be merged into one alignment.
+ boolean addToLast = false;
+ ArrayList<String> aresultq = new ArrayList<String>(), presultTitle = new ArrayList<String>();
+ ArrayList<AlignmentI> presult = new ArrayList<AlignmentI>(), aresult = new ArrayList<AlignmentI>();
+ Iterator<DbSourceProxy> proxies = database.getSelectedSources()
+ .iterator();
+ String[] qries;
+ List<String> nextfetch = Arrays.asList(qries = textArea.getText()
+ .split(";"));
+ Iterator<String> en = Arrays.asList(new String[0]).iterator();
+ int nqueries = qries.length;
+ while (proxies.hasNext() && (en.hasNext() || nextfetch.size() > 0))
+ {
+ if (!en.hasNext() && nextfetch.size() > 0)
{
- while (en.hasMoreElements())
+ en = nextfetch.iterator();
+ nqueries = nextfetch.size();
+ // save the remaining queries in the original array
+ qries = nextfetch.toArray(new String[nqueries]);
+ nextfetch = new ArrayList<String>();
+ }
+
+ DbSourceProxy proxy = proxies.next();
+ boolean isAliSource = false;
+ try
+ {
+ // update status
+ guiWindow
+ .setProgressBar(MessageManager.formatMessage(
+ "status.fetching_sequence_queries_from",
+ new String[] {
+ Integer.valueOf(nqueries).toString(),
+ proxy.getDbName() }), Thread.currentThread()
+ .hashCode());
+ isAliSource = proxy.isA(DBRefSource.ALIGNMENTDB);
+ if (proxy.getAccessionSeparator() == null)
{
- String item = (String) en.nextElement();
- try
+ while (en.hasNext())
{
- if (aresult != null)
+ String item = en.next();
+ try
{
+ if (aresult != null)
+ {
+ try
+ {
+ // give the server a chance to breathe
+ Thread.sleep(5);
+ } catch (Exception e)
+ {
+ //
+ }
+
+ }
+
+ AlignmentI indres = null;
try
{
- // give the server a chance to breathe
- Thread.sleep(5);
- } catch (Exception e)
+ indres = proxy.getSequenceRecords(item);
+ } catch (OutOfMemoryError oome)
{
- //
+ new OOMWarning("fetching " + item + " from "
+ + proxy.getDbName(), oome, this);
}
-
+ if (indres != null)
+ {
+ aresultq.add(item);
+ aresult.add(indres);
+ }
+ else
+ {
+ nextfetch.add(item);
+ }
+ } catch (Exception e)
+ {
+ jalview.bin.Cache.log.info("Error retrieving " + item
+ + " from " + proxy.getDbName(), e);
+ nextfetch.add(item);
}
-
- AlignmentI indres = null;
- try
+ }
+ }
+ else
+ {
+ StringBuffer multiacc = new StringBuffer();
+ ArrayList<String> tosend = new ArrayList<String>();
+ while (en.hasNext())
+ {
+ String nel = en.next();
+ tosend.add(nel);
+ multiacc.append(nel);
+ if (en.hasNext())
{
- indres = proxy.getSequenceRecords(item);
- } catch (OutOfMemoryError oome)
+ multiacc.append(proxy.getAccessionSeparator());
+ }
+ }
+ try
+ {
+ AlignmentI rslt;
+ SequenceI[] rs;
+ List<String> nores = new ArrayList<String>();
+ rslt = proxy.getSequenceRecords(multiacc.toString());
+ if (rslt == null || rslt.getHeight() == 0)
{
- new OOMWarning("fetching " + item + " from "
- + database.getSelectedItem(), oome, this);
+ // no results - pass on all queries to next source
+ nextfetch.addAll(tosend);
}
- if (indres != null)
+ else
{
- aresultq.add(item);
- aresult.add(indres);
+ aresultq.add(multiacc.toString());
+ aresult.add(rslt);
+
+ rs = rslt.getSequencesArray();
+ // search for each query in the dbrefs associated with each
+ // sequence
+ // returned.
+ // ones we do not find will be used to query next source (if any)
+ for (String q : tosend)
+ {
+ DBRefEntry dbr = new DBRefEntry(), found[] = null;
+ dbr.setSource(proxy.getDbSource());
+ dbr.setVersion(null);
+ if (proxy.getAccessionValidator() != null)
+ {
+ Regex vgr = proxy.getAccessionValidator();
+ vgr.search(q);
+ if (vgr.numSubs() > 0)
+ {
+ dbr.setAccessionId(vgr.stringMatched(1));
+ }
+ else
+ {
+ dbr.setAccessionId(vgr.stringMatched());
+ }
+ }
+ else
+ {
+ dbr.setAccessionId(q);
+ }
+ boolean rfound = false;
+ for (int r = 0; r < rs.length; r++)
+ {
+ if (rs[r] != null
+ && (found = DBRefUtils.searchRefs(
+ rs[r].getDBRef(), dbr)) != null
+ && found.length > 0)
+ {
+ rfound = true;
+ rs[r] = null;
+ continue;
+ }
+ }
+ if (!rfound)
+ {
+ nextfetch.add(q);
+ }
+ }
}
- } catch (Exception e)
+ } catch (OutOfMemoryError oome)
{
- jalview.bin.Cache.log.info("Error retrieving " + item
- + " from " + source, e);
+ new OOMWarning("fetching " + multiacc + " from "
+ + database.getSelectedItem(), oome, this);
}
}
+
+ } catch (Exception e)
+ {
+ showErrorMessage("Error retrieving " + textArea.getText()
+ + " from " + database.getSelectedItem());
+ // error
+ // +="Couldn't retrieve sequences from "+database.getSelectedItem();
+ System.err.println("Retrieval failed for source ='"
+ + database.getSelectedItem() + "' and query\n'"
+ + textArea.getText() + "'\n");
+ e.printStackTrace();
+ } catch (OutOfMemoryError e)
+ {
+ // resets dialog box - so we don't use OOMwarning here.
+ showErrorMessage("Out of Memory when retrieving "
+ + textArea.getText()
+ + " from "
+ + database.getSelectedItem()
+ + "\nPlease see the Jalview FAQ for instructions for increasing the memory available to Jalview.\n");
+ e.printStackTrace();
+ } catch (Error e)
+ {
+ showErrorMessage("Serious Error retrieving " + textArea.getText()
+ + " from " + database.getSelectedItem());
+ e.printStackTrace();
}
- else
+ // Stack results ready for opening in alignment windows
+ if (aresult != null && aresult.size() > 0)
{
- StringBuffer multiacc = new StringBuffer();
- while (en.hasMoreElements())
+ AlignmentI ar = null;
+ if (isAliSource)
{
- multiacc.append(en.nextElement());
- if (en.hasMoreElements())
+ addToLast = false;
+ // new window for each result
+ while (aresult.size() > 0)
{
- multiacc.append(proxy.getAccessionSeparator());
+ presult.add(aresult.remove(0));
+ presultTitle.add(aresultq.remove(0) + " "
+ + getDefaultRetrievalTitle());
}
}
- try
- {
- aresultq.add(multiacc.toString());
- aresult.add(proxy.getSequenceRecords(multiacc.toString()));
- } catch (OutOfMemoryError oome)
+ else
{
- new OOMWarning("fetching " + multiacc + " from "
- + database.getSelectedItem(), oome, this);
+ String titl = null;
+ if (addToLast && presult.size() > 0)
+ {
+ ar = presult.remove(presult.size() - 1);
+ titl = presultTitle.remove(presultTitle.size() - 1);
+ }
+ // concatenate all results in one window
+ while (aresult.size() > 0)
+ {
+ if (ar == null)
+ {
+ ar = aresult.remove(0);
+ }
+ else
+ {
+ ar.append(aresult.remove(0));
+ }
+ ;
+ }
+ addToLast = true;
+ presult.add(ar);
+ presultTitle.add(titl);
}
-
}
-
- } catch (Exception e)
- {
- showErrorMessage("Error retrieving " + textArea.getText() + " from "
- + database.getSelectedItem());
- // error +="Couldn't retrieve sequences from "+database.getSelectedItem();
- System.err.println("Retrieval failed for source ='"
- + database.getSelectedItem() + "' and query\n'"
- + textArea.getText() + "'\n");
- e.printStackTrace();
- } catch (OutOfMemoryError e)
- {
- // resets dialog box - so we don't use OOMwarning here.
- showErrorMessage("Out of Memory when retrieving "
- + textArea.getText()
- + " from "
- + database.getSelectedItem()
- + "\nPlease see the Jalview FAQ for instructions for increasing the memory available to Jalview.\n");
- e.printStackTrace();
- } catch (Error e)
- {
- showErrorMessage("Serious Error retrieving " + textArea.getText()
- + " from " + database.getSelectedItem());
- e.printStackTrace();
+ guiWindow.setProgressBar(MessageManager
+ .getString("status.finshed_querying"), Thread.currentThread()
+ .hashCode());
}
- if (aresult != null && aresult.size()>0)
- {
- AlignmentI ar=null;
- if (isAliSource) {
- // new window for each result
- while (aresult.size()>0)
+ guiWindow.setProgressBar(
+ (presult.size() > 0) ? MessageManager
+ .getString("status.parsing_results") : MessageManager
+ .getString("status.processing"), Thread.currentThread()
+ .hashCode());
+ // process results
+ while (presult.size() > 0)
+ {
+ parseResult(presult.remove(0), presultTitle.remove(0), null);
+ }
+ // only remove visual delay after we finished parsing.
+ guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
+ if (nextfetch.size() > 0)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Didn't retrieve the following "
+ + (nextfetch.size() == 1 ? "query" : nextfetch.size()
+ + " queries") + ": \n");
+ int l = sb.length(), lr = 0;
+ for (String s : nextfetch)
+ {
+ if (l != sb.length())
{
- parseResult(aresult.remove(0), aresultq.remove(0)+" "+getDefaultRetrievalTitle(), null);
+ sb.append("; ");
}
- } else {
- // concatenate all results in one window
- while (aresult.size()>0)
+ if (lr - sb.length() > 40)
{
- if (ar==null) { ar = aresult.remove(0);}
- else { ar.append(aresult.remove(0)); };
+ sb.append("\n");
}
- parseResult(ar, null, null);
- }
+ sb.append(s);
+ }
+ showErrorMessage(sb.toString());
}
- // only remove visual delay after we finished parsing.
- guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
resetDialog();
}
- /*
- * result = new StringBuffer(); if
- * (database.getSelectedItem().equals("Uniprot")) {
- * getUniprotFile(textArea.getText()); } else if
- * (database.getSelectedItem().equals("EMBL") ||
- * database.getSelectedItem().equals("EMBLCDS")) { String DBRefSource =
- * database.getSelectedItem().equals("EMBLCDS") ?
- * jalview.datamodel.DBRefSource.EMBLCDS : jalview.datamodel.DBRefSource.EMBL;
- *
- * StringTokenizer st = new StringTokenizer(textArea.getText(), ";");
- * SequenceI[] seqs = null; while(st.hasMoreTokens()) { EBIFetchClient dbFetch
- * = new EBIFetchClient(); String qry =
- * database.getSelectedItem().toString().toLowerCase( ) + ":" +
- * st.nextToken(); File reply = dbFetch.fetchDataAsFile( qry, "emblxml",null);
- *
- * jalview.datamodel.xdb.embl.EmblFile efile=null; if (reply != null &&
- * reply.exists()) { efile =
- * jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply); } if (efile!=null)
- * { for (Iterator i=efile.getEntries().iterator(); i.hasNext(); ) { EmblEntry
- * entry = (EmblEntry) i.next(); SequenceI[] seqparts =
- * entry.getSequences(false,true, DBRefSource); if (seqparts!=null) {
- * SequenceI[] newseqs = null; int si=0; if (seqs==null) { newseqs = new
- * SequenceI[seqparts.length]; } else { newseqs = new
- * SequenceI[seqs.length+seqparts.length];
- *
- * for (;si<seqs.length; si++) { newseqs[si] = seqs[si]; seqs[si] = null; } }
- * for (int j=0;j<seqparts.length; si++, j++) { newseqs[si] =
- * seqparts[j].deriveSequence(); // place DBReferences on dataset and refer }
- * seqs=newseqs; } } } else { result.append("# no response for "+qry); } } if
- * (seqs!=null && seqs.length>0) { if (parseResult(new Alignment(seqs), null,
- * null)!=null) { result.append("# Successfully parsed the
- * "+database.getSelectedItem()+" Queries into an Alignment"); } } } else if
- * (database.getSelectedItem().equals("PDB")) { StringTokenizer qset = new
- * StringTokenizer(textArea.getText(), ";"); String query; SequenceI[] seqs =
- * null; while (qset.hasMoreTokens() && ((query = qset.nextToken())!=null)) {
- * SequenceI[] seqparts = getPDBFile(query.toUpperCase()); if (seqparts !=
- * null) { if (seqs == null) { seqs = seqparts; } else { SequenceI[] newseqs =
- * new SequenceI[seqs.length+seqparts.length]; int i=0; for (; i <
- * seqs.length; i++) { newseqs[i] = seqs[i]; seqs[i] = null; } for (int
- * j=0;j<seqparts.length; i++, j++) { newseqs[i] = seqparts[j]; }
- * seqs=newseqs; } result.append("# Success for "+query.toUpperCase()+"\n"); }
- * } if (seqs != null && seqs.length > 0) { if (parseResult(new
- * Alignment(seqs), null, null)!=null) { result.append( "# Successfully parsed
- * the PDB File Queries into an
- * Alignment"); } } } else if( database.getSelectedItem().equals("PFAM")) {
- * try { result.append(new FastaFile(
- * "http://www.sanger.ac.uk/cgi-bin/Pfam/getalignment.pl?format=fal&acc=" +
- * textArea.getText().toUpperCase(), "URL").print() );
- *
- * if(result.length()>0) { parseResult( result.toString(),
- * textArea.getText().toUpperCase() ); } } catch (java.io.IOException ex) {
- * result = null; } }
- *
- * if (result == null || result.length() == 0) { showErrorMessage("Error
- * retrieving " + textArea.getText() + " from " + database.getSelectedItem());
- * }
- *
- * resetDialog(); return; }
- *
- * void getUniprotFile(String id) { EBIFetchClient ebi = new EBIFetchClient();
- * File file = ebi.fetchDataAsFile("uniprot:" + id, "xml", null);
- *
- * DBRefFetcher dbref = new DBRefFetcher(); Vector entries =
- * dbref.getUniprotEntries(file);
- *
- * if (entries != null) { //First, make the new sequences Enumeration en =
- * entries.elements(); while (en.hasMoreElements()) { UniprotEntry entry =
- * (UniprotEntry) en.nextElement();
- *
- * StringBuffer name = new StringBuffer(">UniProt/Swiss-Prot"); Enumeration
- * en2 = entry.getAccession().elements(); while (en2.hasMoreElements()) {
- * name.append("|"); name.append(en2.nextElement()); } en2 =
- * entry.getName().elements(); while (en2.hasMoreElements()) {
- * name.append("|"); name.append(en2.nextElement()); }
- *
- * if (entry.getProtein() != null) { name.append(" " +
- * entry.getProtein().getName().elementAt(0)); }
- *
- * result.append(name + "\n" + entry.getUniprotSequence().getContent() +
- * "\n"); }
- *
- * //Then read in the features and apply them to the dataset Alignment al =
- * parseResult(result.toString(), null); for (int i = 0; i < entries.size();
- * i++) { UniprotEntry entry = (UniprotEntry) entries.elementAt(i);
- * Enumeration e = entry.getDbReference().elements(); Vector onlyPdbEntries =
- * new Vector(); while (e.hasMoreElements()) { PDBEntry pdb = (PDBEntry)
- * e.nextElement(); if (!pdb.getType().equals("PDB")) { continue; }
- *
- * onlyPdbEntries.addElement(pdb); }
- *
- * Enumeration en2 = entry.getAccession().elements(); while
- * (en2.hasMoreElements()) {
- * al.getSequenceAt(i).getDatasetSequence().addDBRef(new DBRefEntry(
- * DBRefSource.UNIPROT, "0", en2.nextElement().toString())); }
- *
- *
- *
- *
- * al.getSequenceAt(i).getDatasetSequence().setPDBId(onlyPdbEntries); if
- * (entry.getFeature() != null) { e = entry.getFeature().elements(); while
- * (e.hasMoreElements()) { SequenceFeature sf = (SequenceFeature)
- * e.nextElement(); sf.setFeatureGroup("Uniprot");
- * al.getSequenceAt(i).getDatasetSequence().addSequenceFeature( sf ); } } } }
- * }
- *
- * SequenceI[] getPDBFile(String id) { Vector result = new Vector(); String
- * chain = null; if (id.indexOf(":") > -1) { chain =
- * id.substring(id.indexOf(":") + 1); id = id.substring(0, id.indexOf(":")); }
- *
- * EBIFetchClient ebi = new EBIFetchClient(); String file =
- * ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw"). getAbsolutePath(); if (file
- * == null) { return null; } try { PDBfile pdbfile = new PDBfile(file,
- * jalview.io.AppletFormatAdapter.FILE); for (int i = 0; i <
- * pdbfile.chains.size(); i++) { if (chain == null || ( (PDBChain)
- * pdbfile.chains.elementAt(i)).id. toUpperCase().equals(chain)) { PDBChain
- * pdbchain = (PDBChain) pdbfile.chains.elementAt(i); // Get the Chain's
- * Sequence - who's dataset includes any special features added from the PDB
- * file SequenceI sq = pdbchain.sequence; // Specially formatted name for the
- * PDB chain sequences retrieved from the PDB
- * sq.setName("PDB|"+id+"|"+sq.getName()); // Might need to add more metadata
- * to the PDBEntry object // like below /* PDBEntry entry = new PDBEntry(); //
- * Construct the PDBEntry entry.setId(id); if (entry.getProperty() == null)
- * entry.setProperty(new Hashtable()); entry.getProperty().put("chains",
- * pdbchain.id + "=" + sq.getStart() + "-" + sq.getEnd());
- * sq.getDatasetSequence().addPDBId(entry); // Add PDB DB Refs // We make a
- * DBRefEtntry because we have obtained the PDB file from a verifiable source
- * // JBPNote - PDB DBRefEntry should also carry the chain and mapping
- * information DBRefEntry dbentry = new
- * DBRefEntry(jalview.datamodel.DBRefSource.PDB, "0", id + pdbchain.id);
- * sq.addDBRef(dbentry); // and add seuqence to the retrieved set
- * result.addElement(sq.deriveSequence()); } }
- *
- * if (result.size() < 1) { throw new Exception("WsDBFetch for PDB id resulted
- * in zero result size"); } } catch (Exception ex) // Problem parsing PDB file
- * { jalview.bin.Cache.log.warn("Exception when retrieving " +
- * textArea.getText() + " from " + database.getSelectedItem(), ex); return
- * null; }
- *
- *
- * SequenceI[] results = new SequenceI[result.size()]; for (int i = 0, j =
- * result.size(); i < j; i++) { results[i] = (SequenceI) result.elementAt(i);
- * result.setElementAt(null,i); } return results; }
- */
AlignmentI parseResult(String result, String title)
{
String format = new IdentifyFile().Identify(result, "Paste");
- Alignment sequences = null;
+ AlignmentI sequences = null;
if (FormatAdapter.isValidFormat(format))
{
sequences = null;
@@ -743,17 +819,24 @@ public class SequenceFetcher extends JPanel implements Runnable
/**
*
- * @return a standard title for any results retrieved using the currently selected source and settings
+ * @return a standard title for any results retrieved using the currently
+ * selected source and settings
*/
- public String getDefaultRetrievalTitle() {
+ public String getDefaultRetrievalTitle()
+ {
return "Retrieved from " + database.getSelectedItem();
}
+
AlignmentI parseResult(AlignmentI al, String title,
String currentFileFormat)
{
if (al != null && al.getHeight() > 0)
{
+ if (title == null)
+ {
+ title = getDefaultRetrievalTitle();
+ }
if (alignFrame == null)
{
AlignFrame af = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
@@ -766,29 +849,28 @@ public class SequenceFetcher extends JPanel implements Runnable
// Alignments?
}
- if (title == null)
- {
- title = getDefaultRetrievalTitle();
- }
SequenceFeature[] sfs = null;
- for (Enumeration sq = al.getSequences().elements(); sq
- .hasMoreElements();)
+ List<SequenceI> alsqs;
+ synchronized (alsqs = al.getSequences())
{
- if ((sfs = ((SequenceI) sq.nextElement()).getDatasetSequence()
- .getSequenceFeatures()) != null)
+ for (SequenceI sq : alsqs)
{
- if (sfs.length > 0)
+ if ((sfs = sq.getSequenceFeatures()) != null)
{
- af.setShowSeqFeatures(true);
- break;
+ if (sfs.length > 0)
+ {
+ af.setShowSeqFeatures(true);
+ break;
+ }
}
- }
+ }
}
Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
- af.statusBar.setText("Successfully pasted alignment file");
+ af.statusBar.setText(MessageManager
+ .getString("label.successfully_pasted_alignment_file"));
try
{
@@ -800,20 +882,7 @@ public class SequenceFetcher extends JPanel implements Runnable
}
else
{
- for (int i = 0; i < al.getHeight(); i++)
- {
- alignFrame.viewport.alignment.addSequence(al.getSequenceAt(i)); // this
- // also
- // creates
- // dataset
- // sequence
- // entries
- }
- alignFrame.viewport.setEndSeq(alignFrame.viewport.alignment
- .getHeight());
- alignFrame.viewport.alignment.getWidth();
- alignFrame.viewport.firePropertyChange("alignment", null,
- alignFrame.viewport.getAlignment().getSequences());
+ alignFrame.viewport.addAlignment(al, title);
}
}
return al;
@@ -824,11 +893,23 @@ public class SequenceFetcher extends JPanel implements Runnable
resetDialog();
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
JOptionPane.showInternalMessageDialog(Desktop.desktop, error,
- "Error Retrieving Data", JOptionPane.WARNING_MESSAGE);
+ MessageManager.getString("label.error_retrieving_data"),
+ JOptionPane.WARNING_MESSAGE);
}
});
}
+
+ public IProgressIndicator getProgressIndicator()
+ {
+ return progressIndicator;
+ }
+
+ public void setProgressIndicator(IProgressIndicator progressIndicator)
+ {
+ this.progressIndicator = progressIndicator;
+ }
}
diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java
index b3dfc97..8c4ead8 100644
--- a/src/jalview/gui/SequenceRenderer.java
+++ b/src/jalview/gui/SequenceRenderer.java
@@ -1,26 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
+import jalview.api.FeatureRenderer;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
/**
* DOCUMENT ME!
@@ -30,6 +37,8 @@ import jalview.schemes.*;
*/
public class SequenceRenderer implements jalview.api.SequenceRenderer
{
+ final static int CHAR_TO_UPPER = 'A' - 'a';
+
AlignViewport av;
FontMetrics fm;
@@ -73,14 +82,16 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
// If EPS graphics, stringWidth will be a double, not an int
double dwidth = fm.getStringBounds("M", g).getWidth();
- monospacedFont = (dwidth == fm.getStringBounds("|", g).getWidth() && (float) av.charWidth == dwidth);
+ monospacedFont = (dwidth == fm.getStringBounds("|", g).getWidth() && av
+ .getCharWidth() == dwidth);
this.renderGaps = renderGaps;
}
+ @Override
public Color getResidueBoxColour(SequenceI seq, int i)
{
- allGroups = av.alignment.findAllGroups(seq);
+ allGroups = av.getAlignment().findAllGroups(seq);
if (inCurrentSequenceGroup(i))
{
@@ -91,13 +102,38 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
}
else if (av.getShowBoxes())
{
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
}
return resBoxColour;
}
/**
+ * Get the residue colour at the given sequence position - as determined by
+ * the sequence group colour (if any), else the colour scheme, possibly
+ * overridden by a feature colour.
+ *
+ * @param seq
+ * @param position
+ * @param fr
+ * @return
+ */
+ @Override
+ public Color getResidueColour(final SequenceI seq, int position,
+ FeatureRenderer fr)
+ {
+ // TODO replace 8 or so code duplications with calls to this method
+ // (refactored as needed)
+ Color col = getResidueBoxColour(seq, position);
+
+ if (fr != null)
+ {
+ col = fr.findFeatureColour(col, seq, position);
+ }
+ return col;
+ }
+
+ /**
* DOCUMENT ME!
*
* @param cs
@@ -111,7 +147,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
{
if (cs != null)
{
- resBoxColour = cs.findColour(seq.getCharAt(i), i);
+ resBoxColour = cs.findColour(seq.getCharAt(i), i, seq);
}
else if (forOverview
&& !jalview.util.Comparison.isGap(seq.getCharAt(i)))
@@ -181,12 +217,15 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
int y1)
{
if (seq == null)
+ {
return; // fix for racecondition
+ }
int i = start;
int length = seq.getLength();
int curStart = -1;
- int curWidth = av.charWidth;
+ int curWidth = av.getCharWidth(), avWidth = av.getCharWidth(), avHeight = av
+ .getCharHeight();
Color tempColour = null;
@@ -205,7 +244,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
}
else if (av.getShowBoxes())
{
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
}
}
@@ -214,26 +253,25 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
{
if (tempColour != null)
{
- graphics.fillRect(av.charWidth * (curStart - start), y1,
- curWidth, av.charHeight);
+ graphics.fillRect(avWidth * (curStart - start), y1, curWidth,
+ avHeight);
}
graphics.setColor(resBoxColour);
curStart = i;
- curWidth = av.charWidth;
+ curWidth = avWidth;
tempColour = resBoxColour;
}
else
{
- curWidth += av.charWidth;
+ curWidth += avWidth;
}
i++;
}
- graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,
- av.charHeight);
+ graphics.fillRect(avWidth * (curStart - start), y1, curWidth, avHeight);
}
@@ -257,7 +295,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
*/
public void drawText(SequenceI seq, int start, int end, int y1)
{
- y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady
+ y1 += av.getCharHeight() - av.getCharHeight() / 5; // height/5 replaces pady
int charOffset = 0;
char s;
@@ -265,12 +303,12 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
{
end = seq.getLength() - 1;
}
- graphics.setColor(av.textColour);
+ graphics.setColor(av.getTextColour());
- if (monospacedFont && av.showText && allGroups.length == 0
- && !av.getColourText() && av.thresholdTextColour == 0)
+ if (monospacedFont && av.getShowText() && allGroups.length == 0
+ && !av.getColourText() && av.getThresholdTextColour() == 0)
{
- if (av.renderGaps)
+ if (av.isRenderGaps())
{
graphics.drawString(seq.getSequenceAsString(start, end + 1), 0, y1);
}
@@ -283,12 +321,19 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
}
else
{
+ boolean srep = av.isDisplayReferenceSeq();
boolean getboxColour = false;
+ boolean isarep = av.getAlignment().getSeqrep() == seq;
+ boolean isgrep = currentSequenceGroup != null ? currentSequenceGroup
+ .getSeqrep() == seq : false;
+ char sr_c;
for (int i = start; i <= end; i++)
{
- graphics.setColor(av.textColour);
+
+ graphics.setColor(av.getTextColour());
getboxColour = false;
s = seq.getCharAt(i);
+
if (!renderGaps && jalview.util.Comparison.isGap(s))
{
continue;
@@ -325,10 +370,12 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
{
graphics.setColor(currentSequenceGroup.textColour);
}
- if (currentSequenceGroup.getShowNonconserved()) // todo optimize
+ if (!isarep && !isgrep
+ && currentSequenceGroup.getShowNonconserved()) // todo
+ // optimize
{
// todo - use sequence group consensus
- s = getDisplayChar(av.consensus, i, s, '.');
+ s = getDisplayChar(srep, i, s, '.', currentSequenceGroup);
}
@@ -343,7 +390,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
if (av.getColourText())
{
getboxColour = true;
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
if (av.getShowBoxes())
{
@@ -355,45 +402,67 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
}
}
- if (av.thresholdTextColour > 0)
+ if (av.getThresholdTextColour() > 0)
{
if (!getboxColour)
{
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
}
if (resBoxColour.getRed() + resBoxColour.getBlue()
- + resBoxColour.getGreen() < av.thresholdTextColour)
+ + resBoxColour.getGreen() < av.getThresholdTextColour())
{
- graphics.setColor(av.textColour2);
+ graphics.setColor(av.getTextColour2());
}
}
- if (av.showUnconserved)
+ if (!isarep && av.getShowUnconserved())
{
- s = getDisplayChar(av.consensus, i, s, '.');
+ s = getDisplayChar(srep, i, s, '.', currentSequenceGroup);
}
}
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
- graphics.drawString(String.valueOf(s), charOffset + av.charWidth
- * (i - start), y1);
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + av.getCharWidth() * (i - start), y1);
}
}
}
- private char getDisplayChar(AlignmentAnnotation consensus, int position,
- char s, char c)
+ /**
+ * Returns 'conservedChar' to represent the given position if the sequence
+ * character at that position is equal to the consensus (ignoring case), else
+ * returns the sequence character
+ *
+ * @param usesrep
+ * @param position
+ * @param sequenceChar
+ * @param conservedChar
+ * @return
+ */
+ private char getDisplayChar(final boolean usesrep, int position,
+ char sequenceChar, char conservedChar, SequenceGroup currentGroup)
{
- char conschar = consensus.annotations[position].displayCharacter
- .charAt(0);
- if (conschar != '-' && s == conschar)
+ // TODO - use currentSequenceGroup rather than alignment
+ // currentSequenceGroup.getConsensus()
+ char conschar = (usesrep) ? (currentGroup == null ? av.getAlignment()
+ .getSeqrep().getCharAt(position)
+ : (currentGroup.getSeqrep() != null ? currentGroup.getSeqrep()
+ .getCharAt(position) : av.getAlignment().getSeqrep()
+ .getCharAt(position)))
+ : (currentGroup != null && currentGroup.getConsensus() != null) ? currentGroup
+ .getConsensus().annotations[position].displayCharacter
+ .charAt(0)
+ : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter
+ .charAt(0);
+ if (!jalview.util.Comparison.isGap(conschar)
+ && (sequenceChar == conschar || sequenceChar + CHAR_TO_UPPER == conschar))
{
- s = c;
+ sequenceChar = conservedChar;
}
- return s;
+ return sequenceChar;
}
/**
@@ -446,17 +515,17 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
public void drawHighlightedText(SequenceI seq, int start, int end,
int x1, int y1)
{
- int pady = av.charHeight / 5;
+ int pady = av.getCharHeight() / 5;
int charOffset = 0;
graphics.setColor(Color.BLACK);
- graphics.fillRect(x1, y1, av.charWidth * (end - start + 1),
- av.charHeight);
+ graphics.fillRect(x1, y1, av.getCharWidth() * (end - start + 1),
+ av.getCharHeight());
graphics.setColor(Color.white);
char s = '~';
// Need to find the sequence position here.
- if (av.validCharWidth)
+ if (av.isValidCharWidth())
{
for (int i = start; i <= end; i++)
{
@@ -465,29 +534,30 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
s = seq.getCharAt(i);
}
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
- graphics.drawString(String.valueOf(s), charOffset + x1
- + (av.charWidth * (i - start)), (y1 + av.charHeight) - pady);
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + x1 + (av.getCharWidth() * (i - start)),
+ (y1 + av.getCharHeight()) - pady);
}
}
}
public void drawCursor(SequenceI seq, int res, int x1, int y1)
{
- int pady = av.charHeight / 5;
+ int pady = av.getCharHeight() / 5;
int charOffset = 0;
graphics.setColor(Color.black);
- graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+ graphics.fillRect(x1, y1, av.getCharWidth(), av.getCharHeight());
- if (av.validCharWidth)
+ if (av.isValidCharWidth())
{
graphics.setColor(Color.white);
char s = seq.getCharAt(res);
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
graphics.drawString(String.valueOf(s), charOffset + x1,
- (y1 + av.charHeight) - pady);
+ (y1 + av.getCharHeight()) - pady);
}
}
diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java
index 3eccf63..02a8ed7 100644
--- a/src/jalview/gui/SliderPanel.java
+++ b/src/jalview/gui/SliderPanel.java
@@ -1,31 +1,39 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
+import jalview.datamodel.SequenceGroup;
+import jalview.jbgui.GSliderPanel;
+import jalview.schemes.ColourSchemeI;
+import jalview.util.MessageManager;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Iterator;
-import jalview.datamodel.*;
-import jalview.jbgui.*;
-import jalview.schemes.*;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
/**
* DOCUMENT ME!
@@ -68,13 +76,15 @@ public class SliderPanel extends GSliderPanel
if (forConservation)
{
- label.setText("Enter value to increase conservation visibility");
+ label.setText(MessageManager
+ .getString("label.enter_value_increase_conservation_visibility"));
slider.setMinimum(0);
slider.setMaximum(100);
}
else
{
- label.setText("Enter % identity above which to colour residues");
+ label.setText(MessageManager
+ .getString("label.enter_percentage_identity_above_which_colour_residues"));
slider.setMinimum(0);
slider.setMaximum(100);
}
@@ -130,10 +140,12 @@ public class SliderPanel extends GSliderPanel
sp.cs = cs;
}
- conservationSlider.setTitle("Conservation Colour Increment (" + source
- + ")");
+ conservationSlider
+ .setTitle(MessageManager.formatMessage(
+ "label.conservation_colour_increment",
+ new String[] { source }));
- if (ap.av.alignment.getGroups() != null)
+ if (ap.av.getAlignment().getGroups() != null)
{
sp.setAllGroupsCheckEnabled(true);
}
@@ -207,9 +219,11 @@ public class SliderPanel extends GSliderPanel
pid.cs = cs;
}
- PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");
+ PIDSlider.setTitle(MessageManager
+ .formatMessage("label.percentage_identity_thereshold",
+ new String[] { source }));
- if (ap.av.alignment.getGroups() != null)
+ if (ap.av.getAlignment().getGroups() != null)
{
pid.setAllGroupsCheckEnabled(true);
}
@@ -265,50 +279,39 @@ public class SliderPanel extends GSliderPanel
return;
}
- ColourSchemeI toChange = null;
- Vector allGroups = null;
- int groupIndex = 0;
+ ColourSchemeI toChange = cs;
+ Iterator<SequenceGroup> allGroups = null;
if (allGroupsCheck.isSelected())
{
- allGroups = ap.av.alignment.getGroups();
- groupIndex = allGroups.size() - 1;
- }
- else
- {
- toChange = cs;
+ allGroups = ap.av.getAlignment().getGroups().listIterator();
}
- while (groupIndex > -1)
+ while (toChange != null)
{
- if (allGroups != null)
+ if (forConservation)
{
- toChange = ((SequenceGroup) allGroups.get(groupIndex)).cs;
-
- if (toChange == null)
- {
- groupIndex--;
-
- continue;
- }
+ toChange.setConservationInc(i);
}
-
- if (forConservation)
+ else
{
- if (toChange.conservationApplied())
+ toChange.setThreshold(i, ap.av.isIgnoreGapsConsensus());
+ }
+ if (allGroups != null && allGroups.hasNext())
+ {
+ while ((toChange = allGroups.next().cs) == null
+ && allGroups.hasNext())
{
- toChange.setConservationInc(i);
+ ;
}
}
else
{
- toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus());
+ toChange = null;
}
-
- groupIndex--;
}
- ap.seqPanel.seqCanvas.repaint();
+ ap.getSeqPanel().seqCanvas.repaint();
}
/**
diff --git a/src/jalview/gui/SplashScreen.java b/src/jalview/gui/SplashScreen.java
index cf424e8..9c810d0 100644
--- a/src/jalview/gui/SplashScreen.java
+++ b/src/jalview/gui/SplashScreen.java
@@ -1,25 +1,41 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+import javax.swing.JTextPane;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
/**
* DOCUMENT ME!
@@ -27,10 +43,15 @@ import javax.swing.*;
* @author $author$
* @version $Revision$
*/
-public class SplashScreen extends JPanel implements Runnable
+public class SplashScreen extends JPanel implements Runnable,
+ HyperlinkListener
{
boolean visible = true;
+ JPanel iconimg = new JPanel(new BorderLayout());
+
+ JTextPane authlist = new JTextPane();
+
JInternalFrame iframe;
Image image;
@@ -44,42 +65,78 @@ public class SplashScreen extends JPanel implements Runnable
*/
public SplashScreen()
{
- Thread t = new Thread(this);
- t.start();
+ this(false);
}
+ private boolean interactiveDialog = false;
+
/**
- * ping the jalview version page then create and display the jalview
- * splashscreen window.
+ *
+ * @param interactive
+ * if true - an internal dialog is opened rather than a free-floating
+ * splash screen
*/
- void initSplashScreenWindow()
+ public SplashScreen(boolean interactive)
+ {
+ this.interactiveDialog = interactive;
+ // show a splashscreen that will disapper
+ Thread t = new Thread(this);
+ t.start();
+ }
+
+ MouseAdapter closer = new MouseAdapter()
{
- addMouseListener(new MouseAdapter()
+ public void mousePressed(MouseEvent evt)
{
- public void mousePressed(MouseEvent evt)
+ try
{
- try
+ if (!interactiveDialog)
{
visible = false;
closeSplash();
- } catch (Exception ex)
- {
}
+ } catch (Exception ex)
+ {
}
- });
+ }
+ };
+ /**
+ * ping the jalview version page then create and display the jalview
+ * splashscreen window.
+ */
+ void initSplashScreenWindow()
+ {
+ addMouseListener(closer);
try
{
- java.net.URL url = getClass().getResource("/images/logo.gif");
+ java.net.URL url = getClass().getResource("/images/Jalview_Logo.png");
+ java.net.URL urllogo = getClass().getResource(
+ "/images/Jalview_Logo_small.png");
if (url != null)
{
image = java.awt.Toolkit.getDefaultToolkit().createImage(url);
-
+ Image logo = java.awt.Toolkit.getDefaultToolkit().createImage(
+ urllogo);
MediaTracker mt = new MediaTracker(this);
mt.addImage(image, 0);
- mt.waitForID(0);
- Desktop.instance.setIconImage(image);
+ mt.addImage(logo, 1);
+ do
+ {
+ try
+ {
+ mt.waitForAll();
+ } catch (InterruptedException x)
+ {
+ }
+ ;
+ if (mt.isErrorAny())
+ {
+ System.err.println("Error when loading images!");
+ }
+ } while (!mt.checkAll());
+ Desktop.instance.setIconImage(logo);
}
} catch (Exception ex)
{
@@ -87,15 +144,53 @@ public class SplashScreen extends JPanel implements Runnable
iframe = new JInternalFrame();
iframe.setFrameIcon(null);
- iframe.setClosable(false);
+ iframe.setClosable(interactiveDialog);
+ this.setLayout(new BorderLayout());
iframe.setContentPane(this);
iframe.setLayer(JLayeredPane.PALETTE_LAYER);
+ SplashImage splashimg = new SplashImage(image);
+ iconimg.add(splashimg, BorderLayout.CENTER);
+ add(iconimg, BorderLayout.NORTH);
+ add(authlist, BorderLayout.CENTER);
+ authlist.setEditable(false);
+ authlist.addMouseListener(closer);
Desktop.desktop.add(iframe);
+ refreshText();
+ }
+
+ long oldtext = -1;
+
+ /**
+ * update text in author text panel reflecting current version information
+ */
+ protected boolean refreshText()
+ {
+ String newtext = Desktop.instance.getAboutMessage(true).toString();
+ // System.err.println("Text found: \n"+newtext+"\nEnd of newtext.");
+ if (oldtext != newtext.length())
+ {
+ iframe.setVisible(false);
+ oldtext = newtext.length();
+ authlist = new JTextPane();
+ authlist.setEditable(false);
+ authlist.addMouseListener(closer);
+ authlist.addHyperlinkListener(this);
+ authlist.setContentType("text/html");
+ authlist.setText(newtext);
+ authlist.setVisible(true);
+ authlist.setSize(new Dimension(750, 375));
+ add(authlist, BorderLayout.CENTER);
+ revalidate();
+ iframe.setBounds((Desktop.instance.getWidth() - 750) / 2,
+ (Desktop.instance.getHeight() - 375) / 2, 750,
+ authlist.getHeight() + iconimg.getHeight());
+ iframe.validate();
+ iframe.setVisible(true);
- iframe.setVisible(true);
- iframe.setBounds((int) ((Desktop.instance.getWidth() - 750) / 2),
- (int) ((Desktop.instance.getHeight() - 160) / 2), 750, 190);
+ return true;
+ }
+ return false;
}
/**
@@ -104,26 +199,41 @@ public class SplashScreen extends JPanel implements Runnable
public void run()
{
initSplashScreenWindow();
+
long startTime = System.currentTimeMillis() / 1000;
while (visible)
{
+ iframe.repaint();
try
{
- Thread.sleep(1000);
+ Thread.sleep(500);
} catch (Exception ex)
{
}
- if (((System.currentTimeMillis() / 1000) - startTime) > 5)
+ if (!interactiveDialog
+ && ((System.currentTimeMillis() / 1000) - startTime) > 5)
{
visible = false;
}
- else
- repaint();
+
+ if (visible && refreshText())
+ {
+ // if (interactiveDialog) {
+ iframe.repaint();
+ // } else {
+ // iframe.repaint();
+ // };
+ }
+ if (interactiveDialog)
+ {
+ return;
+ }
}
closeSplash();
+ Desktop.instance.startDialogQueue();
}
/**
@@ -140,82 +250,82 @@ public class SplashScreen extends JPanel implements Runnable
}
}
- /**
- * DOCUMENT ME!
- *
- * @param g
- * DOCUMENT ME!
- */
- public void paintComponent(Graphics g)
+ public class SplashImage extends JPanel
{
- g.setColor(Color.white);
- g.fillRect(0, 0, getWidth(), getHeight());
- g.setColor(Color.black);
- g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));
+ Image image;
- if (image != null)
+ public SplashImage(Image todisplay)
{
- g.drawImage(image, 5, yoffset + 12, this);
+ image = todisplay;
+ setPreferredSize(new Dimension(image.getWidth(this) + 8,
+ image.getHeight(this)));
}
- int y = yoffset;
-
- g.drawString("Jalview " + jalview.bin.Cache.getProperty("VERSION"), 50,
- y);
-
- FontMetrics fm = g.getFontMetrics();
- int vwidth = fm.stringWidth("Jalview "
- + jalview.bin.Cache.getProperty("VERSION"));
- g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2));
- g.drawString(
- "Last updated: "
- + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"),
- 50 + vwidth + 5, y);
- if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals(
- "Checking"))
+ @Override
+ public Dimension getPreferredSize()
{
- // Displayed when code version and jnlp version do not match
- g.drawString("...Checking latest version...", 50, y += fontSize + 10);
- y += 5;
- g.setColor(Color.black);
+ return new Dimension(image.getWidth(this) + 8, image.getHeight(this));
}
- else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
- .equals(jalview.bin.Cache.getProperty("VERSION")))
+
+ public void paintComponent(Graphics g)
{
- if (jalview.bin.Cache.getProperty("VERSION").toLowerCase()
- .indexOf("automated build") == -1)
+ g.setColor(Color.white);
+ g.fillRect(0, 0, getWidth(), getHeight());
+ g.setColor(Color.black);
+ g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));
+
+ if (image != null)
{
- // Displayed when code version and jnlp version do not match and code
- // version is not a development build
- g.setColor(Color.red);
+ g.drawImage(image, (getWidth() - image.getWidth(this)) / 2,
+ (getHeight() - image.getHeight(this)) / 2, this);
}
- g.drawString(
- "!! Jalview version "
- + jalview.bin.Cache.getDefault("LATEST_VERSION",
- "..Checking..")
- + " is available for download from "+jalview.bin.Cache.getDefault("www.jalview.org","http://www.jalview.org")+" !!",
- 50, y += fontSize + 10);
- y += 5;
- g.setColor(Color.black);
}
+ /*
+ * int y = yoffset;
+ *
+ * g.drawString("Jalview " + jalview.bin.Cache.getProperty("VERSION"), 50,
+ * y);
+ *
+ * FontMetrics fm = g.getFontMetrics(); int vwidth =
+ * fm.stringWidth("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
+ * g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2)); g.drawString(
+ * "Last updated: " + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"),
+ * 50 + vwidth + 5, y); if (jalview.bin.Cache.getDefault("LATEST_VERSION",
+ * "Checking").equals( "Checking")) { // Displayed when code version and
+ * jnlp version do not match g.drawString("...Checking latest version...",
+ * 50, y += fontSize + 10); y += 5; g.setColor(Color.black); } else if
+ * (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
+ * .equals(jalview.bin.Cache.getProperty("VERSION"))) { if
+ * (jalview.bin.Cache.getProperty("VERSION").toLowerCase()
+ * .indexOf("automated build") == -1) { // Displayed when code version and
+ * jnlp version do not match and code // version is not a development build
+ * g.setColor(Color.red); } g.drawString( "!! Jalview version " +
+ * jalview.bin.Cache.getDefault("LATEST_VERSION", "..Checking..") +
+ * " is available for download from "
+ * +jalview.bin.Cache.getDefault("www.jalview.org"
+ * ,"http://www.jalview.org")+" !!", 50, y += fontSize + 10); y += 5;
+ * g.setColor(Color.black); }
+ *
+ * g.setFont(new Font("Verdana", Font.BOLD, fontSize)); g.drawString(
+ * "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,"
+ * , 50, y += fontSize + 4); g.drawString("David Martin & Geoff Barton.",
+ * 60, y += fontSize + 4); g.drawString(
+ * "Development managed by The Barton Group, University of Dundee.", 50, y
+ * += fontSize + 4); g.drawString("If you use Jalview, please cite: ", 50,
+ * y += fontSize + 4); g.drawString(
+ * "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
+ * , 50, y += fontSize + 4); g.drawString(
+ * "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
+ * , 50, y += fontSize + 4);
+ * g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033", 50, y
+ * += fontSize + 4); }
+ */
+ }
+
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent e)
+ {
+ Desktop.hyperlinkUpdate(e);
- g.setFont(new Font("Verdana", Font.BOLD, fontSize));
- g.drawString(
- "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,",
- 50, y += fontSize + 4);
- g.drawString("David Martin & Geoff Barton.", 60, y += fontSize + 4);
- g.drawString(
- "Development managed by The Barton Group, University of Dundee.",
- 50, y += fontSize + 4);
- g.drawString("If you use Jalview, please cite: ", 50,
- y += fontSize + 4);
- g.drawString(
- "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)",
- 50, y += fontSize + 4);
- g.drawString(
- "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench",
- 50, y += fontSize + 4);
- g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033", 50,
- y += fontSize + 4);
}
}
diff --git a/src/jalview/gui/SplitFrame.java b/src/jalview/gui/SplitFrame.java
new file mode 100644
index 0000000..4e2187e
--- /dev/null
+++ b/src/jalview/gui/SplitFrame.java
@@ -0,0 +1,661 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.api.SplitContainerI;
+import jalview.api.ViewStyleI;
+import jalview.datamodel.AlignmentI;
+import jalview.jbgui.GAlignFrame;
+import jalview.jbgui.GSplitFrame;
+import jalview.structure.StructureSelectionManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Component;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.beans.PropertyVetoException;
+import java.util.Map.Entry;
+
+import javax.swing.AbstractAction;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JMenuItem;
+import javax.swing.KeyStroke;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
+
+/**
+ * An internal frame on the desktop that hosts a horizontally split view of
+ * linked DNA and Protein alignments. Additional views can be created in linked
+ * pairs, expanded to separate split frames, or regathered into a single frame.
+ * <p>
+ * (Some) operations on each alignment are automatically mirrored on the other.
+ * These include mouseover (highlighting), sequence and column selection,
+ * sequence ordering and sorting, and grouping, colouring and sorting by tree.
+ *
+ * @author gmcarstairs
+ *
+ */
+public class SplitFrame extends GSplitFrame implements SplitContainerI
+{
+ private static final long serialVersionUID = 1L;
+
+ public SplitFrame(GAlignFrame top, GAlignFrame bottom)
+ {
+ super(top, bottom);
+ init();
+ }
+
+ /**
+ * Initialise this frame.
+ */
+ protected void init()
+ {
+ getTopFrame().setSplitFrame(this);
+ getBottomFrame().setSplitFrame(this);
+ getTopFrame().setVisible(true);
+ getBottomFrame().setVisible(true);
+
+ ((AlignFrame) getTopFrame()).getViewport().setCodingComplement(
+ ((AlignFrame) getBottomFrame()).getViewport());
+
+ int width = ((AlignFrame) getTopFrame()).getWidth();
+ // about 50 pixels for the SplitFrame's title bar etc
+ int height = ((AlignFrame) getTopFrame()).getHeight()
+ + ((AlignFrame) getBottomFrame()).getHeight() + 50;
+ // about 65 pixels for Desktop decorators on Windows
+ height = Math.min(height, Desktop.instance.getHeight() - 65);
+ setSize(width, height);
+
+ adjustLayout();
+
+ addCloseFrameListener();
+
+ addKeyListener();
+
+ addKeyBindings();
+
+ addCommandListeners();
+ }
+
+ /**
+ * Set the top and bottom frames to listen to each others Commands (e.g. Edit,
+ * Order).
+ */
+ protected void addCommandListeners()
+ {
+ // TODO if CommandListener is only ever 1:1 for complementary views,
+ // may change broadcast pattern to direct messaging (more efficient)
+ final StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
+ ssm.addCommandListener(((AlignFrame) getTopFrame()).getViewport());
+ ssm.addCommandListener(((AlignFrame) getBottomFrame()).getViewport());
+ }
+
+ /**
+ * Do any tweaking and twerking of the layout wanted.
+ */
+ public void adjustLayout()
+ {
+ /*
+ * Ensure sequence ids are the same width so sequences line up
+ */
+ int w1 = ((AlignFrame) getTopFrame()).getViewport().getIdWidth();
+ int w2 = ((AlignFrame) getBottomFrame()).getViewport().getIdWidth();
+ int w3 = Math.max(w1, w2);
+ if (w1 != w3)
+ {
+ ((AlignFrame) getTopFrame()).getViewport().setIdWidth(w3);
+ }
+ if (w2 != w3)
+ {
+ ((AlignFrame) getBottomFrame()).getViewport().setIdWidth(w3);
+ }
+
+ /*
+ * Scale protein to either 1 or 3 times character width of dna
+ */
+ final AlignViewport topViewport = ((AlignFrame) getTopFrame()).viewport;
+ final AlignViewport bottomViewport = ((AlignFrame) getBottomFrame()).viewport;
+ final AlignmentI topAlignment = topViewport.getAlignment();
+ final AlignmentI bottomAlignment = bottomViewport.getAlignment();
+ AlignmentViewport cdna = topAlignment.isNucleotide() ? topViewport
+ : (bottomAlignment.isNucleotide() ? bottomViewport : null);
+ AlignmentViewport protein = !topAlignment.isNucleotide() ? topViewport
+ : (!bottomAlignment.isNucleotide() ? bottomViewport : null);
+ if (protein != null && cdna != null)
+ {
+ ViewStyleI vs = protein.getViewStyle();
+ int scale = vs.isScaleProteinAsCdna() ? 3 : 1;
+ vs.setCharWidth(scale * cdna.getViewStyle().getCharWidth());
+ protein.setViewStyle(vs);
+ }
+ }
+
+ /**
+ * Add a listener to tidy up when the frame is closed.
+ */
+ protected void addCloseFrameListener()
+ {
+ addInternalFrameListener(new InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosed(InternalFrameEvent evt)
+ {
+ close();
+ };
+ });
+ }
+
+ /**
+ * Add a key listener that delegates to whichever split component the mouse is
+ * in (or does nothing if neither).
+ */
+ protected void addKeyListener()
+ {
+ addKeyListener(new KeyAdapter()
+ {
+
+ @Override
+ public void keyPressed(KeyEvent e)
+ {
+ AlignFrame af = (AlignFrame) getFrameAtMouse();
+
+ /*
+ * Intercept and override any keys here if wanted.
+ */
+ if (!overrideKey(e, af))
+ {
+ if (af != null)
+ {
+ for (KeyListener kl : af.getKeyListeners())
+ {
+ kl.keyPressed(e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e)
+ {
+ Component c = getFrameAtMouse();
+ if (c != null)
+ {
+ for (KeyListener kl : c.getKeyListeners())
+ {
+ kl.keyReleased(e);
+ }
+ }
+ }
+
+ });
+ }
+
+ /**
+ * Returns true if the key event is overriden and actioned (or ignored) here,
+ * else returns false, indicating it should be delegated to the AlignFrame's
+ * usual handler.
+ * <p>
+ * We can't handle Cmd-Key combinations here, instead this is done by
+ * overriding key bindings.
+ *
+ * @see addKeyOverrides
+ * @param e
+ * @param af
+ * @return
+ */
+ protected boolean overrideKey(KeyEvent e, AlignFrame af)
+ {
+ boolean actioned = false;
+ int keyCode = e.getKeyCode();
+ switch (keyCode)
+ {
+ case KeyEvent.VK_DOWN:
+ if (e.isAltDown() || !af.viewport.cursorMode)
+ {
+ /*
+ * Key down (or Alt-key-down in cursor mode) - move selected sequences
+ */
+ ((AlignFrame) getTopFrame()).moveSelectedSequences(false);
+ ((AlignFrame) getBottomFrame()).moveSelectedSequences(false);
+ actioned = true;
+ e.consume();
+ }
+ break;
+ case KeyEvent.VK_UP:
+ if (e.isAltDown() || !af.viewport.cursorMode)
+ {
+ /*
+ * Key up (or Alt-key-up in cursor mode) - move selected sequences
+ */
+ ((AlignFrame) getTopFrame()).moveSelectedSequences(true);
+ ((AlignFrame) getBottomFrame()).moveSelectedSequences(true);
+ actioned = true;
+ e.consume();
+ }
+ default:
+ }
+ return actioned;
+ }
+
+ /**
+ * Set key bindings (recommended for Swing over key accelerators).
+ */
+ private void addKeyBindings()
+ {
+ overrideDelegatedKeyBindings();
+
+ overrideImplementedKeyBindings();
+ }
+
+ /**
+ * Override key bindings with alternative action methods implemented in this
+ * class.
+ */
+ protected void overrideImplementedKeyBindings()
+ {
+ overrideFind();
+ overrideNewView();
+ overrideCloseView();
+ overrideExpandViews();
+ overrideGatherViews();
+ }
+
+ /**
+ * Replace Cmd-W close view action with our version.
+ */
+ protected void overrideCloseView()
+ {
+ AbstractAction action;
+ /*
+ * Ctrl-W / Cmd-W - close view or window
+ */
+ KeyStroke key_cmdW = KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ action = new AbstractAction()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ closeView_actionPerformed();
+ }
+ };
+ overrideKeyBinding(key_cmdW, action);
+ }
+
+ /**
+ * Replace Cmd-T new view action with our version.
+ */
+ protected void overrideNewView()
+ {
+ /*
+ * Ctrl-T / Cmd-T open new view
+ */
+ KeyStroke key_cmdT = KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ AbstractAction action = new AbstractAction()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ newView_actionPerformed();
+ }
+ };
+ overrideKeyBinding(key_cmdT, action);
+ }
+
+ /**
+ * For now, delegates key events to the corresponding key accelerator for the
+ * AlignFrame that the mouse is in. Hopefully can be simplified in future if
+ * AlignFrame is changed to use key bindings rather than accelerators.
+ */
+ protected void overrideDelegatedKeyBindings()
+ {
+ if (getTopFrame() instanceof AlignFrame)
+ {
+ /*
+ * Get all accelerator keys in the top frame (the bottom should be
+ * identical) and override each one.
+ */
+ for (Entry<KeyStroke, JMenuItem> acc : ((AlignFrame) getTopFrame())
+ .getAccelerators().entrySet())
+ {
+ overrideKeyBinding(acc);
+ }
+ }
+ }
+
+ /**
+ * Overrides an AlignFrame key accelerator with our version which delegates to
+ * the action listener in whichever frame has the mouse (and does nothing if
+ * neither has).
+ *
+ * @param acc
+ */
+ private void overrideKeyBinding(Entry<KeyStroke, JMenuItem> acc)
+ {
+ final KeyStroke ks = acc.getKey();
+ InputMap inputMap = this.getInputMap(JComponent.WHEN_FOCUSED);
+ inputMap.put(ks, ks);
+ this.getActionMap().put(ks, new AbstractAction()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ Component c = getFrameAtMouse();
+ if (c != null && c instanceof AlignFrame)
+ {
+ for (ActionListener a : ((AlignFrame) c).getAccelerators()
+ .get(ks).getActionListeners())
+ {
+ a.actionPerformed(null);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Replace an accelerator key's action with the specified action.
+ *
+ * @param ks
+ */
+ protected void overrideKeyBinding(KeyStroke ks, AbstractAction action)
+ {
+ this.getActionMap().put(ks, action);
+ overrideMenuItem(ks, action);
+ }
+
+ /**
+ * Create and link new views (with matching names) in both panes.
+ * <p>
+ * Note this is _not_ multiple tabs, each hosting a split pane view, rather it
+ * is a single split pane with each split holding multiple tabs which are
+ * linked in pairs.
+ * <p>
+ * TODO implement instead with a tabbed holder in the SplitView, each tab
+ * holding a single JSplitPane. Would avoid a duplicated tab, at the cost of
+ * some additional coding.
+ */
+ protected void newView_actionPerformed()
+ {
+ AlignFrame topFrame = (AlignFrame) getTopFrame();
+ AlignFrame bottomFrame = (AlignFrame) getBottomFrame();
+ final boolean scaleProteinAsCdna = topFrame.viewport
+ .isScaleProteinAsCdna();
+
+ AlignmentPanel newTopPanel = topFrame.newView(null, true);
+ AlignmentPanel newBottomPanel = bottomFrame.newView(null, true);
+
+ /*
+ * This currently (for the first new view only) leaves the top pane on tab 0
+ * but the bottom on tab 1. This results from 'setInitialTabVisible' echoing
+ * from the bottom back to the first frame. Next line is a fudge to work
+ * around this. TODO find a better way.
+ */
+ if (topFrame.getTabIndex() != bottomFrame.getTabIndex())
+ {
+ topFrame.setDisplayedView(newTopPanel);
+ }
+
+ newBottomPanel.av.viewName = newTopPanel.av.viewName;
+ newTopPanel.av.setCodingComplement(newBottomPanel.av);
+
+ /*
+ * These lines can be removed once scaleProteinAsCdna is added to element
+ * Viewport in jalview.xsd, as Jalview2XML.copyAlignPanel will then take
+ * care of it
+ */
+ newTopPanel.av.setScaleProteinAsCdna(scaleProteinAsCdna);
+ newBottomPanel.av.setScaleProteinAsCdna(scaleProteinAsCdna);
+
+ /*
+ * Line up id labels etc
+ */
+ adjustLayout();
+
+ final StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
+ ssm.addCommandListener(newTopPanel.av);
+ ssm.addCommandListener(newBottomPanel.av);
+ }
+
+ /**
+ * Close the currently selected view in both panes. If there is only one view,
+ * close this split frame.
+ */
+ protected void closeView_actionPerformed()
+ {
+ int viewCount = ((AlignFrame) getTopFrame()).getAlignPanels().size();
+ if (viewCount < 2)
+ {
+ close();
+ return;
+ }
+
+ AlignmentPanel topPanel = ((AlignFrame) getTopFrame()).alignPanel;
+ AlignmentPanel bottomPanel = ((AlignFrame) getBottomFrame()).alignPanel;
+
+ ((AlignFrame) getTopFrame()).closeView(topPanel);
+ ((AlignFrame) getBottomFrame()).closeView(bottomPanel);
+
+ }
+
+ /**
+ * Close child frames and this split frame.
+ */
+ public void close()
+ {
+ ((AlignFrame) getTopFrame()).closeMenuItem_actionPerformed(true);
+ ((AlignFrame) getBottomFrame()).closeMenuItem_actionPerformed(true);
+ try
+ {
+ this.setClosed(true);
+ } catch (PropertyVetoException e)
+ {
+ // ignore
+ }
+ }
+
+ /**
+ * Replace AlignFrame 'expand views' action with SplitFrame version.
+ */
+ protected void overrideExpandViews()
+ {
+ KeyStroke key_X = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false);
+ AbstractAction action = new AbstractAction()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ expandViews_actionPerformed();
+ }
+ };
+ overrideMenuItem(key_X, action);
+ }
+
+ /**
+ * Replace AlignFrame 'gather views' action with SplitFrame version.
+ */
+ protected void overrideGatherViews()
+ {
+ KeyStroke key_G = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false);
+ AbstractAction action = new AbstractAction()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ gatherViews_actionPerformed();
+ }
+ };
+ overrideMenuItem(key_G, action);
+ }
+
+ /**
+ * Override the menu action associated with the keystroke in the child frames,
+ * replacing it with the given action.
+ *
+ * @param ks
+ * @param action
+ */
+ private void overrideMenuItem(KeyStroke ks, AbstractAction action)
+ {
+ overrideMenuItem(ks, action, getTopFrame());
+ overrideMenuItem(ks, action, getBottomFrame());
+ }
+
+ /**
+ * Override the menu action associated with the keystroke in one child frame,
+ * replacing it with the given action. Mwahahahaha.
+ *
+ * @param key
+ * @param action
+ * @param comp
+ */
+ private void overrideMenuItem(KeyStroke key, final AbstractAction action,
+ JComponent comp)
+ {
+ if (comp instanceof AlignFrame)
+ {
+ JMenuItem mi = ((AlignFrame) comp).getAccelerators().get(key);
+ if (mi != null)
+ {
+ for (ActionListener al : mi.getActionListeners())
+ {
+ mi.removeActionListener(al);
+ }
+ mi.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ action.actionPerformed(e);
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Expand any multiple views (which are always in pairs) into separate split
+ * frames.
+ */
+ protected void expandViews_actionPerformed()
+ {
+ Desktop.instance.explodeViews(this);
+ }
+
+ /**
+ * Gather any other SplitFrame views of this alignment back in as multiple
+ * (pairs of) views in this SplitFrame.
+ */
+ protected void gatherViews_actionPerformed()
+ {
+ Desktop.instance.gatherViews(this);
+ }
+
+ /**
+ * Returns the alignment in the complementary frame to the one given.
+ */
+ @Override
+ public AlignmentI getComplement(Object alignFrame)
+ {
+ if (alignFrame == this.getTopFrame())
+ {
+ return ((AlignFrame) getBottomFrame()).viewport.getAlignment();
+ }
+ else if (alignFrame == this.getBottomFrame())
+ {
+ return ((AlignFrame) getTopFrame()).viewport.getAlignment();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the title of the complementary frame to the one given.
+ */
+ @Override
+ public String getComplementTitle(Object alignFrame)
+ {
+ if (alignFrame == this.getTopFrame())
+ {
+ return ((AlignFrame) getBottomFrame()).getTitle();
+ }
+ else if (alignFrame == this.getBottomFrame())
+ {
+ return ((AlignFrame) getTopFrame()).getTitle();
+ }
+ return null;
+ }
+
+ /**
+ * Set the 'other half' to hidden / revealed.
+ */
+ @Override
+ public void setComplementVisible(Object alignFrame, boolean show)
+ {
+ /*
+ * Hiding the AlignPanel suppresses unnecessary repaints
+ */
+ if (alignFrame == getTopFrame())
+ {
+ ((AlignFrame) getBottomFrame()).alignPanel.setVisible(show);
+ }
+ else if (alignFrame == getBottomFrame())
+ {
+ ((AlignFrame) getTopFrame()).alignPanel.setVisible(show);
+ }
+ super.setComplementVisible(alignFrame, show);
+ }
+
+ /**
+ * Replace Cmd-F Find action with our version. This is necessary because the
+ * 'default' Finder searches in the first AlignFrame it finds. We need it to
+ * search in the half of the SplitFrame that has the mouse.
+ */
+ protected void overrideFind()
+ {
+ /*
+ * Ctrl-F / Cmd-F open Finder dialog, 'focused' on the right alignment
+ */
+ KeyStroke key_cmdF = KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ AbstractAction action = new AbstractAction()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ Component c = getFrameAtMouse();
+ if (c != null && c instanceof AlignFrame)
+ {
+ AlignFrame af = (AlignFrame) c;
+ new Finder(af.viewport, af.alignPanel);
+ }
+ }
+ };
+ overrideKeyBinding(key_cmdF, action);
+ }
+}
diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java
new file mode 100644
index 0000000..347c1b2
--- /dev/null
+++ b/src/jalview/gui/StructureChooser.java
@@ -0,0 +1,972 @@
+/*
+
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.gui;
+
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.jbgui.GStructureChooser;
+import jalview.jbgui.PDBDocFieldPreferences;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.PDBRestClient;
+import jalview.ws.dbsources.PDBRestClient.PDBDocField;
+import jalview.ws.uimodel.PDBRestRequest;
+import jalview.ws.uimodel.PDBRestResponse;
+import jalview.ws.uimodel.PDBRestResponse.PDBResponseSummary;
+
+import java.awt.event.ItemEvent;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.table.AbstractTableModel;
+
+/**
+ * Provides the behaviors for the Structure chooser Panel
+ *
+ * @author tcnofoegbu
+ *
+ */
+ at SuppressWarnings("serial")
+public class StructureChooser extends GStructureChooser
+{
+ private boolean structuresDiscovered = false;
+
+ private SequenceI selectedSequence;
+
+ private SequenceI[] selectedSequences;
+
+ private IProgressIndicator progressIndicator;
+
+ private Collection<PDBResponseSummary> discoveredStructuresSet;
+
+ private PDBRestRequest lastPdbRequest;
+
+ private PDBRestClient pdbRestCleint;
+
+ private String selectedPdbFileName;
+
+ private boolean isValidPBDEntry;
+
+ public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
+ AlignmentPanel ap)
+ {
+ this.ap = ap;
+ this.selectedSequence = selectedSeq;
+ this.selectedSequences = selectedSeqs;
+ this.progressIndicator = (ap == null) ? null : ap.alignFrame;
+ init();
+ }
+
+ /**
+ * Initializes parameters used by the Structure Chooser Panel
+ */
+ public void init()
+ {
+ Thread discoverPDBStructuresThread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ long startTime = System.currentTimeMillis();
+ updateProgressIndicator(MessageManager
+ .getString("status.loading_cached_pdb_entries"), startTime);
+ loadLocalCachedPDBEntries();
+ updateProgressIndicator(null, startTime);
+ updateProgressIndicator(MessageManager
+ .getString("status.searching_for_pdb_structures"),
+ startTime);
+ fetchStructuresMetaData();
+ populateFilterComboBox();
+ updateProgressIndicator(null, startTime);
+ mainFrame.setVisible(true);
+ updateCurrentView();
+ }
+ });
+ discoverPDBStructuresThread.start();
+ }
+
+ /**
+ * Updates the progress indicator with the specified message
+ *
+ * @param message
+ * displayed message for the operation
+ * @param id
+ * unique handle for this indicator
+ */
+ public void updateProgressIndicator(String message, long id)
+ {
+ if (progressIndicator != null)
+ {
+ progressIndicator.setProgressBar(message, id);
+ }
+ }
+
+ /**
+ * Retrieve meta-data for all the structure(s) for a given sequence(s) in a
+ * selection group
+ */
+ public void fetchStructuresMetaData()
+ {
+ long startTime = System.currentTimeMillis();
+ Collection<PDBDocField> wantedFields = PDBDocFieldPreferences
+ .getStructureSummaryFields();
+
+ discoveredStructuresSet = new LinkedHashSet<PDBResponseSummary>();
+ HashSet<String> errors = new HashSet<String>();
+ for (SequenceI seq : selectedSequences)
+ {
+ PDBRestRequest pdbRequest = new PDBRestRequest();
+ pdbRequest.setAllowEmptySeq(false);
+ pdbRequest.setResponseSize(500);
+ pdbRequest.setFieldToSearchBy("(text:");
+ pdbRequest.setWantedFields(wantedFields);
+ pdbRequest.setSearchTerm(buildQuery(seq) + ")");
+ pdbRequest.setAssociatedSequence(seq);
+ pdbRestCleint = new PDBRestClient();
+ PDBRestResponse resultList;
+ try
+ {
+ resultList = pdbRestCleint.executeRequest(pdbRequest);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ errors.add(e.getMessage());
+ continue;
+ }
+ lastPdbRequest = pdbRequest;
+ if (resultList.getSearchSummary() != null
+ && !resultList.getSearchSummary().isEmpty())
+ {
+ discoveredStructuresSet.addAll(resultList.getSearchSummary());
+ }
+ }
+
+ int noOfStructuresFound = 0;
+ String totalTime = (System.currentTimeMillis() - startTime)
+ + " milli secs";
+ if (discoveredStructuresSet != null
+ && !discoveredStructuresSet.isEmpty())
+ {
+ tbl_summary.setModel(PDBRestResponse.getTableModel(lastPdbRequest,
+ discoveredStructuresSet));
+ structuresDiscovered = true;
+ noOfStructuresFound = discoveredStructuresSet.size();
+ mainFrame.setTitle(MessageManager.formatMessage(
+ "label.structure_chooser_no_of_structures",
+ noOfStructuresFound, totalTime));
+ }
+ else
+ {
+ mainFrame.setTitle(MessageManager
+ .getString("label.structure_chooser_manual_association"));
+ if (errors.size() > 0)
+ {
+ StringBuilder errorMsg = new StringBuilder();
+ for (String error : errors)
+ {
+ errorMsg.append(error).append("\n");
+ }
+ JOptionPane.showMessageDialog(this, errorMsg.toString(),
+ MessageManager.getString("label.pdb_web-service_error"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+
+ public void loadLocalCachedPDBEntries()
+ {
+ ArrayList<CachedPDB> entries = new ArrayList<CachedPDB>();
+ for (SequenceI seq : selectedSequences)
+ {
+ if (seq.getDatasetSequence() != null
+ && seq.getDatasetSequence().getAllPDBEntries() != null)
+ {
+ for (PDBEntry pdbEntry : seq.getDatasetSequence()
+ .getAllPDBEntries())
+ {
+ if (pdbEntry.getFile() != null)
+ {
+ entries.add(new CachedPDB(seq, pdbEntry));
+ }
+ }
+ }
+ }
+
+ PDBEntryTableModel tableModelx = new PDBEntryTableModel(entries);
+ tbl_local_pdb.setModel(tableModelx);
+ }
+
+ /**
+ * Builds a query string for a given sequences using its DBRef entries
+ *
+ * @param seq
+ * the sequences to build a query for
+ * @return the built query string
+ */
+
+ public static String buildQuery(SequenceI seq)
+ {
+ HashSet<String> seqRefs = new LinkedHashSet<String>();
+ String seqName = seq.getName();
+ String[] names = seqName.toLowerCase().split("\\|");
+ for (String name : names)
+ {
+ // System.out.println("Found name : " + name);
+ name.trim();
+ if (isValidSeqName(name))
+ {
+ seqRefs.add(name);
+ }
+ }
+
+ if (seq.getAllPDBEntries() != null)
+ {
+ for (PDBEntry entry : seq.getAllPDBEntries())
+ {
+ if (isValidSeqName(entry.getId()))
+ {
+ seqRefs.add(entry.getId());
+ }
+ }
+ }
+
+ if (seq.getDBRef() != null && seq.getDBRef().length != 0)
+ {
+ int count = 0;
+ for (DBRefEntry dbRef : seq.getDBRef())
+ {
+ if (isValidSeqName(getDBRefId(dbRef)))
+ {
+ seqRefs.add(getDBRefId(dbRef));
+ }
+ ++count;
+ if (count > 10)
+ {
+ break;
+ }
+ }
+ }
+
+ StringBuilder queryBuilder = new StringBuilder();
+ for (String seqRef : seqRefs)
+ {
+ queryBuilder.append("text:").append(seqRef).append(" OR ");
+ }
+ int endIndex = queryBuilder.lastIndexOf(" OR ");
+
+ if (queryBuilder.toString().length() < 6)
+ {
+ return null;
+ }
+ String query = queryBuilder.toString().substring(5, endIndex);
+ return query;
+ }
+
+ /**
+ * Ensures sequence ref names are not less than 3 characters and does not
+ * contain a database name
+ *
+ * @param seqName
+ * @return
+ */
+ public static boolean isValidSeqName(String seqName)
+ {
+ // System.out.println("seqName : " + seqName);
+ String ignoreList = "pdb,uniprot,swiss-prot";
+ if (seqName.length() < 3)
+ {
+ return false;
+ }
+ if (seqName.contains(":"))
+ {
+ return false;
+ }
+ seqName = seqName.toLowerCase();
+ for (String ignoredEntry : ignoreList.split(","))
+ {
+ if (seqName.contains(ignoredEntry))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static String getDBRefId(DBRefEntry dbRef)
+ {
+ String ref = dbRef.getAccessionId().replaceAll("GO:", "");
+ return ref;
+ }
+
+ /**
+ * Filters a given list of discovered structures based on supplied argument
+ *
+ * @param fieldToFilterBy
+ * the field to filter by
+ */
+ public void filterResultSet(final String fieldToFilterBy)
+ {
+ Thread filterThread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ long startTime = System.currentTimeMillis();
+ lbl_loading.setVisible(true);
+ Collection<PDBDocField> wantedFields = PDBDocFieldPreferences
+ .getStructureSummaryFields();
+ Collection<PDBResponseSummary> filteredResponse = new HashSet<PDBResponseSummary>();
+ HashSet<String> errors = new HashSet<String>();
+ for (SequenceI seq : selectedSequences)
+ {
+ PDBRestRequest pdbRequest = new PDBRestRequest();
+ pdbRequest.setAllowEmptySeq(false);
+ pdbRequest.setResponseSize(1);
+ pdbRequest.setFieldToSearchBy("(text:");
+ pdbRequest.setFieldToSortBy(fieldToFilterBy,
+ !chk_invertFilter.isSelected());
+ pdbRequest.setSearchTerm(buildQuery(seq) + ")");
+ pdbRequest.setWantedFields(wantedFields);
+ pdbRequest.setAssociatedSequence(seq);
+ pdbRestCleint = new PDBRestClient();
+ PDBRestResponse resultList;
+ try
+ {
+ resultList = pdbRestCleint.executeRequest(pdbRequest);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ errors.add(e.getMessage());
+ continue;
+ }
+ lastPdbRequest = pdbRequest;
+ if (resultList.getSearchSummary() != null
+ && !resultList.getSearchSummary().isEmpty())
+ {
+ filteredResponse.addAll(resultList.getSearchSummary());
+ }
+ }
+
+ String totalTime = (System.currentTimeMillis() - startTime)
+ + " milli secs";
+ if (!filteredResponse.isEmpty())
+ {
+ final int filterResponseCount = filteredResponse.size();
+ Collection<PDBResponseSummary> reorderedStructuresSet = new LinkedHashSet<PDBResponseSummary>();
+ reorderedStructuresSet.addAll(filteredResponse);
+ reorderedStructuresSet.addAll(discoveredStructuresSet);
+ tbl_summary.setModel(PDBRestResponse.getTableModel(
+ lastPdbRequest, reorderedStructuresSet));
+
+ // Update table selection model here
+ tbl_summary.addRowSelectionInterval(0, filterResponseCount - 1);
+ mainFrame.setTitle(MessageManager.formatMessage(
+ "label.structure_chooser_filter_time", totalTime));
+ }
+ else
+ {
+ mainFrame.setTitle(MessageManager.formatMessage(
+ "label.structure_chooser_filter_time", totalTime));
+ if (errors.size() > 0)
+ {
+ StringBuilder errorMsg = new StringBuilder();
+ for (String error : errors)
+ {
+ errorMsg.append(error).append("\n");
+ }
+ JOptionPane.showMessageDialog(
+ null,
+ errorMsg.toString(),
+ MessageManager.getString("label.pdb_web-service_error"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ lbl_loading.setVisible(false);
+
+ validateSelections();
+ }
+ });
+ filterThread.start();
+ }
+
+ /**
+ * Handles action event for btn_pdbFromFile
+ */
+ public void pdbFromFile_actionPerformed()
+ {
+ jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+ chooser.setFileView(new jalview.io.JalviewFileView());
+ chooser.setDialogTitle(MessageManager.formatMessage(
+ "label.select_pdb_file_for",
+ selectedSequence.getDisplayId(false)));
+ chooser.setToolTipText(MessageManager.formatMessage(
+ "label.load_pdb_file_associate_with_sequence",
+ selectedSequence.getDisplayId(false)));
+
+ int value = chooser.showOpenDialog(null);
+ if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
+ {
+ selectedPdbFileName = chooser.getSelectedFile().getPath();
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName);
+ validateSelections();
+ }
+ }
+
+ /**
+ * Populates the filter combo-box options dynamically depending on discovered
+ * structures
+ */
+ protected void populateFilterComboBox()
+ {
+ if (isStructuresDiscovered())
+ {
+ cmb_filterOption.addItem(new FilterOption("Best Quality",
+ PDBDocField.OVERALL_QUALITY.getCode(), VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Best UniProt Coverage",
+ PDBDocField.UNIPROT_COVERAGE.getCode(), VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Highest Resolution",
+ PDBDocField.RESOLUTION.getCode(), VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Highest Protein Chain",
+ PDBDocField.PROTEIN_CHAIN_COUNT.getCode(), VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Highest Bound Molecules",
+ PDBDocField.BOUND_MOLECULE_COUNT.getCode(), VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Highest Polymer Residues",
+ PDBDocField.POLYMER_RESIDUE_COUNT.getCode(), VIEWS_FILTER));
+ }
+ cmb_filterOption.addItem(new FilterOption("Enter PDB Id", "-",
+ VIEWS_ENTER_ID));
+ cmb_filterOption.addItem(new FilterOption("From File", "-",
+ VIEWS_FROM_FILE));
+ cmb_filterOption.addItem(new FilterOption("Cached PDB Entries", "-",
+ VIEWS_LOCAL_PDB));
+ }
+
+ /**
+ * Updates the displayed view based on the selected filter option
+ */
+ protected void updateCurrentView()
+ {
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ layout_switchableViews.show(pnl_switchableViews,
+ selectedFilterOpt.getView());
+ String filterTitle = mainFrame.getTitle();
+ mainFrame.setTitle(frameTitle);
+ chk_invertFilter.setVisible(false);
+ if (selectedFilterOpt.getView() == VIEWS_FILTER)
+ {
+ mainFrame.setTitle(filterTitle);
+ chk_invertFilter.setVisible(true);
+ filterResultSet(selectedFilterOpt.getValue());
+ }
+ else if (selectedFilterOpt.getView() == VIEWS_ENTER_ID
+ || selectedFilterOpt.getView() == VIEWS_FROM_FILE)
+ {
+ mainFrame.setTitle(MessageManager
+ .getString("label.structure_chooser_manual_association"));
+ idInputAssSeqPanel.loadCmbAssSeq();
+ fileChooserAssSeqPanel.loadCmbAssSeq();
+ }
+ validateSelections();
+ }
+
+ /**
+ * Validates user selection and activates the view button if all parameters
+ * are correct
+ */
+ public void validateSelections()
+ {
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ btn_view.setEnabled(false);
+ String currentView = selectedFilterOpt.getView();
+ if (currentView == VIEWS_FILTER)
+ {
+ if (tbl_summary.getSelectedRows().length > 0)
+ {
+ btn_view.setEnabled(true);
+ }
+ }
+ else if (currentView == VIEWS_LOCAL_PDB)
+ {
+ if (tbl_local_pdb.getSelectedRows().length > 0)
+ {
+ btn_view.setEnabled(true);
+ }
+ }
+ else if (currentView == VIEWS_ENTER_ID)
+ {
+ validateAssociationEnterPdb();
+ }
+ else if (currentView == VIEWS_FROM_FILE)
+ {
+ validateAssociationFromFile();
+ }
+ }
+
+ /**
+ * Validates inputs from the Manual PDB entry panel
+ */
+ public void validateAssociationEnterPdb()
+ {
+ AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) idInputAssSeqPanel
+ .getCmb_assSeq().getSelectedItem();
+ lbl_pdbManualFetchStatus.setIcon(errorImage);
+ lbl_pdbManualFetchStatus.setToolTipText("");
+ if (txt_search.getText().length() > 0)
+ {
+ lbl_pdbManualFetchStatus
+ .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
+ .formatMessage("info.no_pdb_entry_found_for",
+ txt_search.getText())));
+ }
+
+ if (errorWarning.length() > 0)
+ {
+ lbl_pdbManualFetchStatus.setIcon(warningImage);
+ lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip(
+ true, errorWarning.toString()));
+ }
+
+ if (selectedSequences.length == 1
+ || !assSeqOpt.getName().equalsIgnoreCase(
+ "-Select Associated Seq-"))
+ {
+ txt_search.setEnabled(true);
+ if (isValidPBDEntry)
+ {
+ btn_view.setEnabled(true);
+ lbl_pdbManualFetchStatus.setToolTipText("");
+ lbl_pdbManualFetchStatus.setIcon(goodImage);
+ }
+ }
+ else
+ {
+ txt_search.setEnabled(false);
+ lbl_pdbManualFetchStatus.setIcon(errorImage);
+ }
+ }
+
+ /**
+ * Validates inputs for the manual PDB file selection options
+ */
+ public void validateAssociationFromFile()
+ {
+ AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) fileChooserAssSeqPanel
+ .getCmb_assSeq().getSelectedItem();
+ lbl_fromFileStatus.setIcon(errorImage);
+ if (selectedSequences.length == 1
+ || (assSeqOpt != null && !assSeqOpt.getName().equalsIgnoreCase(
+ "-Select Associated Seq-")))
+ {
+ btn_pdbFromFile.setEnabled(true);
+ if (selectedPdbFileName != null && selectedPdbFileName.length() > 0)
+ {
+ btn_view.setEnabled(true);
+ lbl_fromFileStatus.setIcon(goodImage);
+ }
+ }
+ else
+ {
+ btn_pdbFromFile.setEnabled(false);
+ lbl_fromFileStatus.setIcon(errorImage);
+ }
+ }
+
+ @Override
+ public void cmbAssSeqStateChanged()
+ {
+ validateSelections();
+ }
+
+ /**
+ * Handles the state change event for the 'filter' combo-box and 'invert'
+ * check-box
+ */
+ @Override
+ protected void stateChanged(ItemEvent e)
+ {
+ if (e.getSource() instanceof JCheckBox)
+ {
+ updateCurrentView();
+ }
+ else
+ {
+ if (e.getStateChange() == ItemEvent.SELECTED)
+ {
+ updateCurrentView();
+ }
+ }
+
+ }
+
+ /**
+ * Handles action event for btn_ok
+ */
+ @Override
+ public void ok_ActionPerformed()
+ {
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ String currentView = selectedFilterOpt.getView();
+ if (currentView == VIEWS_FILTER)
+ {
+ int pdbIdColIndex = tbl_summary.getColumn(
+ PDBRestClient.PDBDocField.PDB_ID.getName()).getModelIndex();
+ int refSeqColIndex = tbl_summary.getColumn("Ref Sequence")
+ .getModelIndex();
+ int[] selectedRows = tbl_summary.getSelectedRows();
+ PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+ int count = 0;
+ ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
+ for (int row : selectedRows)
+ {
+ String pdbIdStr = tbl_summary.getValueAt(row, pdbIdColIndex)
+ .toString();
+ SequenceI selectedSeq = (SequenceI) tbl_summary.getValueAt(row,
+ refSeqColIndex);
+ selectedSeqsToView.add(selectedSeq);
+ PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
+ if (pdbEntry == null)
+ {
+ pdbEntry = new PDBEntry();
+ pdbEntry.setId(pdbIdStr);
+ pdbEntry.setType(PDBEntry.Type.PDB);
+ selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
+ }
+ pdbEntriesToView[count++] = pdbEntry;
+ }
+ SequenceI[] selectedSeqs = selectedSeqsToView
+ .toArray(new SequenceI[selectedSeqsToView.size()]);
+ launchStructureViewer(ap.getStructureSelectionManager(),
+ pdbEntriesToView, ap, selectedSeqs);
+ }
+ else if (currentView == VIEWS_LOCAL_PDB)
+ {
+ int[] selectedRows = tbl_local_pdb.getSelectedRows();
+ PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+ int count = 0;
+ int pdbIdColIndex = tbl_local_pdb.getColumn(
+ PDBRestClient.PDBDocField.PDB_ID.getName()).getModelIndex();
+ int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
+ .getModelIndex();
+ ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
+ for (int row : selectedRows)
+ {
+ PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row,
+ pdbIdColIndex);
+ pdbEntriesToView[count++] = pdbEntry;
+ SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(row,
+ refSeqColIndex);
+ selectedSeqsToView.add(selectedSeq);
+ }
+ SequenceI[] selectedSeqs = selectedSeqsToView
+ .toArray(new SequenceI[selectedSeqsToView.size()]);
+ launchStructureViewer(ap.getStructureSelectionManager(),
+ pdbEntriesToView, ap, selectedSeqs);
+ }
+ else if (currentView == VIEWS_ENTER_ID)
+ {
+ SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
+ .getCmb_assSeq().getSelectedItem()).getSequence();
+ if (userSelectedSeq != null)
+ {
+ selectedSequence = userSelectedSeq;
+ }
+
+ String pdbIdStr = txt_search.getText();
+ PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr);
+ if (pdbEntry == null)
+ {
+ pdbEntry = new PDBEntry();
+ pdbEntry.setId(pdbIdStr);
+ pdbEntry.setType(PDBEntry.Type.PDB);
+ selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
+ }
+
+ PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry };
+ launchStructureViewer(ap.getStructureSelectionManager(),
+ pdbEntriesToView, ap, new SequenceI[] { selectedSequence });
+ }
+ else if (currentView == VIEWS_FROM_FILE)
+ {
+ SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
+ .getCmb_assSeq().getSelectedItem()).getSequence();
+ if (userSelectedSeq != null)
+ {
+ selectedSequence = userSelectedSeq;
+ }
+ PDBEntry fileEntry = new AssociatePdbFileWithSeq()
+ .associatePdbWithSeq(selectedPdbFileName,
+ jalview.io.AppletFormatAdapter.FILE,
+ selectedSequence, true, Desktop.instance);
+
+ launchStructureViewer(ap.getStructureSelectionManager(),
+ new PDBEntry[] { fileEntry }, ap,
+ new SequenceI[] { selectedSequence });
+ }
+ mainFrame.dispose();
+ }
+
+ private void launchStructureViewer(final StructureSelectionManager ssm,
+ final PDBEntry[] pdbEntriesToView,
+ final AlignmentPanel alignPanel, final SequenceI[] sequences)
+ {
+ final StructureViewer sViewer = new StructureViewer(ssm);
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ if (pdbEntriesToView.length > 1)
+ {
+ ArrayList<SequenceI[]> seqsMap = new ArrayList<SequenceI[]>();
+ for (SequenceI seq : sequences)
+ {
+ seqsMap.add(new SequenceI[] { seq });
+ }
+ SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]);
+ sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel);
+ }
+ else
+ {
+ sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel);
+ }
+ }
+ }).start();
+ }
+
+ /**
+ * Populates the combo-box used in associating manually fetched structures to
+ * a unique sequence when more than one sequence selection is made.
+ */
+ public void populateCmbAssociateSeqOptions(
+ JComboBox<AssociateSeqOptions> cmb_assSeq, JLabel lbl_associateSeq)
+ {
+ cmb_assSeq.removeAllItems();
+ cmb_assSeq.addItem(new AssociateSeqOptions("-Select Associated Seq-",
+ null));
+ lbl_associateSeq.setVisible(false);
+ if (selectedSequences.length > 1)
+ {
+ for (SequenceI seq : selectedSequences)
+ {
+ cmb_assSeq.addItem(new AssociateSeqOptions(seq));
+ }
+ }
+ else
+ {
+ String seqName = selectedSequence.getDisplayId(false);
+ seqName = seqName.length() <= 40 ? seqName : seqName.substring(0, 39);
+ lbl_associateSeq.setText(seqName);
+ lbl_associateSeq.setVisible(true);
+ cmb_assSeq.setVisible(false);
+ }
+ }
+
+ public boolean isStructuresDiscovered()
+ {
+ return structuresDiscovered;
+ }
+
+ public void setStructuresDiscovered(boolean structuresDiscovered)
+ {
+ this.structuresDiscovered = structuresDiscovered;
+ }
+
+ public Collection<PDBResponseSummary> getDiscoveredStructuresSet()
+ {
+ return discoveredStructuresSet;
+ }
+
+ @Override
+ protected void txt_search_ActionPerformed()
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ errorWarning.setLength(0);
+ isValidPBDEntry = false;
+ if (txt_search.getText().length() > 0)
+ {
+ List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
+ wantedFields.add(PDBDocField.PDB_ID);
+ PDBRestRequest pdbRequest = new PDBRestRequest();
+ pdbRequest.setAllowEmptySeq(false);
+ pdbRequest.setResponseSize(1);
+ pdbRequest.setFieldToSearchBy("(pdb_id:");
+ pdbRequest.setWantedFields(wantedFields);
+ pdbRequest.setSearchTerm(txt_search.getText() + ")");
+ pdbRequest.setAssociatedSequence(selectedSequence);
+ pdbRestCleint = new PDBRestClient();
+ PDBRestResponse resultList;
+ try
+ {
+ resultList = pdbRestCleint.executeRequest(pdbRequest);
+ } catch (Exception e)
+ {
+ errorWarning.append(e.getMessage());
+ return;
+ } finally
+ {
+ validateSelections();
+ }
+ if (resultList.getSearchSummary() != null
+ && resultList.getSearchSummary().size() > 0)
+ {
+ isValidPBDEntry = true;
+ }
+ }
+ validateSelections();
+ }
+ }.start();
+ }
+
+ @Override
+ public void tabRefresh()
+ {
+ if (selectedSequences != null)
+ {
+ Thread refreshThread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ fetchStructuresMetaData();
+ filterResultSet(((FilterOption) cmb_filterOption
+ .getSelectedItem()).getValue());
+ }
+ });
+ refreshThread.start();
+ }
+ }
+
+ public class PDBEntryTableModel extends AbstractTableModel
+ {
+ String[] columns = { "Ref Sequence", "PDB Id", "Chain", "Type", "File" };
+
+ private List<CachedPDB> pdbEntries;
+
+ public PDBEntryTableModel(List<CachedPDB> pdbEntries)
+ {
+ this.pdbEntries = new ArrayList<CachedPDB>(pdbEntries);
+ }
+
+ @Override
+ public String getColumnName(int columnIndex)
+ {
+ return columns[columnIndex];
+ }
+
+ @Override
+ public int getRowCount()
+ {
+ return pdbEntries.size();
+ }
+
+ @Override
+ public int getColumnCount()
+ {
+ return columns.length;
+ }
+
+ @Override
+ public boolean isCellEditable(int row, int column)
+ {
+ return false;
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex)
+ {
+ Object value = "??";
+ CachedPDB entry = pdbEntries.get(rowIndex);
+ switch (columnIndex)
+ {
+ case 0:
+ value = entry.getSequence();
+ break;
+ case 1:
+ value = entry.getPdbEntry();
+ break;
+ case 2:
+ value = entry.getPdbEntry().getChainCode() == null ? "_" : entry
+ .getPdbEntry().getChainCode();
+ break;
+ case 3:
+ value = entry.getPdbEntry().getType();
+ break;
+ case 4:
+ value = entry.getPdbEntry().getFile();
+ break;
+ }
+ return value;
+ }
+
+ @Override
+ public Class<?> getColumnClass(int columnIndex)
+ {
+ return columnIndex == 0 ? SequenceI.class : PDBEntry.class;
+ }
+
+ public CachedPDB getPDBEntryAt(int row)
+ {
+ return pdbEntries.get(row);
+ }
+
+ }
+
+ private class CachedPDB
+ {
+ private SequenceI sequence;
+
+ private PDBEntry pdbEntry;
+
+ public CachedPDB(SequenceI sequence, PDBEntry pdbEntry)
+ {
+ this.sequence = sequence;
+ this.pdbEntry = pdbEntry;
+ }
+
+ public SequenceI getSequence()
+ {
+ return sequence;
+ }
+
+ public PDBEntry getPdbEntry()
+ {
+ return pdbEntry;
+ }
+
+ }
+}
diff --git a/src/jalview/gui/StructureViewer.java b/src/jalview/gui/StructureViewer.java
new file mode 100644
index 0000000..df5a6c4
--- /dev/null
+++ b/src/jalview/gui/StructureViewer.java
@@ -0,0 +1,216 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.api.structures.JalviewStructureDisplayI;
+import jalview.bin.Cache;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.StructureViewerModel;
+import jalview.structure.StructureSelectionManager;
+
+import java.awt.Rectangle;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * proxy for handling structure viewers.
+ *
+ * this allows new views to be created with the currently configured viewer, the
+ * preferred viewer to be set/read and existing views created previously with a
+ * particular viewer to be recovered
+ *
+ * @author jprocter
+ */
+public class StructureViewer
+{
+ StructureSelectionManager ssm;
+
+ public enum ViewerType
+ {
+ JMOL, CHIMERA
+ };
+
+ public ViewerType getViewerType()
+ {
+ String viewType = Cache.getDefault(Preferences.STRUCTURE_DISPLAY,
+ ViewerType.JMOL.name());
+ return ViewerType.valueOf(viewType);
+ }
+
+ public void setViewerType(ViewerType type)
+ {
+ Cache.setProperty(Preferences.STRUCTURE_DISPLAY, type.name());
+ }
+
+ public StructureViewer(StructureSelectionManager structureSelectionManager)
+ {
+ ssm = structureSelectionManager;
+ }
+
+ /**
+ * View multiple PDB entries, each with associated sequences
+ *
+ * @param pdbs
+ * @param seqsForPdbs
+ * @param ap
+ * @return
+ */
+ public JalviewStructureDisplayI viewStructures(PDBEntry[] pdbs,
+ SequenceI[][] seqsForPdbs, AlignmentPanel ap)
+ {
+ JalviewStructureDisplayI viewer = onlyOnePdb(pdbs, seqsForPdbs, ap);
+ if (viewer != null)
+ {
+ return viewer;
+ }
+ return viewStructures(getViewerType(), pdbs, seqsForPdbs, ap);
+ }
+
+ /**
+ * A strictly temporary method pending JAL-1761 refactoring. Determines if all
+ * the passed PDB entries are the same (this is the case if selected sequences
+ * to view structure for are chains of the same structure). If so, calls the
+ * single-pdb version of viewStructures and returns the viewer, else returns
+ * null.
+ *
+ * @param pdbs
+ * @param seqsForPdbs
+ * @param ap
+ * @return
+ */
+ private JalviewStructureDisplayI onlyOnePdb(PDBEntry[] pdbs,
+ SequenceI[][] seqsForPdbs, AlignmentPanel ap)
+ {
+ List<SequenceI> seqs = new ArrayList<SequenceI>();
+ if (pdbs == null || pdbs.length == 0)
+ {
+ return null;
+ }
+ int i = 0;
+ String firstFile = pdbs[0].getFile();
+ for (PDBEntry pdb : pdbs)
+ {
+ String pdbFile = pdb.getFile();
+ if (pdbFile == null || !pdbFile.equals(firstFile))
+ {
+ return null;
+ }
+ SequenceI[] pdbseqs = seqsForPdbs[i++];
+ if (pdbseqs != null)
+ {
+ for (SequenceI sq : pdbseqs)
+ {
+ seqs.add(sq);
+ }
+ }
+ }
+ return viewStructures(pdbs[0],
+ seqs.toArray(new SequenceI[seqs.size()]), ap);
+ }
+
+ public JalviewStructureDisplayI viewStructures(PDBEntry pdb,
+ SequenceI[] seqsForPdb, AlignmentPanel ap)
+ {
+ return viewStructures(getViewerType(), pdb, seqsForPdb, ap);
+ }
+
+ protected JalviewStructureDisplayI viewStructures(ViewerType viewerType,
+ PDBEntry[] pdbs, SequenceI[][] seqsForPdbs, AlignmentPanel ap)
+ {
+ JalviewStructureDisplayI sview = null;
+ if (viewerType.equals(ViewerType.JMOL))
+ {
+ sview = new AppJmol(ap, pdbs, ap.av.collateForPDB(pdbs));
+ }
+ else if (viewerType.equals(ViewerType.CHIMERA))
+ {
+ sview = new ChimeraViewFrame(pdbs, ap.av.collateForPDB(pdbs), ap);
+ }
+ else
+ {
+ Cache.log.error("Unknown structure viewer type "
+ + getViewerType().toString());
+ }
+ return sview;
+ }
+
+ protected JalviewStructureDisplayI viewStructures(ViewerType viewerType,
+ PDBEntry pdb, SequenceI[] seqsForPdb, AlignmentPanel ap)
+ {
+ JalviewStructureDisplayI sview = null;
+ if (viewerType.equals(ViewerType.JMOL))
+ {
+ sview = new AppJmol(pdb, seqsForPdb, null, ap);
+ }
+ else if (viewerType.equals(ViewerType.CHIMERA))
+ {
+ sview = new ChimeraViewFrame(pdb, seqsForPdb, null, ap);
+ }
+ else
+ {
+ Cache.log.error("Unknown structure viewer type "
+ + getViewerType().toString());
+ }
+ return sview;
+ }
+
+ /**
+ * Create a new panel controlling a structure viewer.
+ *
+ * @param type
+ * @param pdbf
+ * @param id
+ * @param sq
+ * @param alignPanel
+ * @param viewerData
+ * @param fileloc
+ * @param rect
+ * @param vid
+ * @return
+ */
+ public JalviewStructureDisplayI createView(ViewerType type,
+ String[] pdbf, String[] id, SequenceI[][] sq,
+ AlignmentPanel alignPanel, StructureViewerModel viewerData,
+ String fileloc, Rectangle rect, String vid)
+ {
+ final boolean useinViewerSuperpos = viewerData.isAlignWithPanel();
+ final boolean usetoColourbyseq = viewerData.isColourWithAlignPanel();
+ final boolean viewerColouring = viewerData.isColourByViewer();
+
+ JalviewStructureDisplayI sview = null;
+ switch (type)
+ {
+ case JMOL:
+ sview = new AppJmol(pdbf, id, sq, alignPanel, usetoColourbyseq,
+ useinViewerSuperpos, viewerColouring, fileloc, rect, vid);
+ break;
+ case CHIMERA:
+ Cache.log.error("Unsupported structure viewer type "
+ + type.toString());
+ break;
+ default:
+ Cache.log.error("Unknown structure viewer type " + type.toString());
+ }
+ return sview;
+ }
+
+}
diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java
new file mode 100644
index 0000000..8146237
--- /dev/null
+++ b/src/jalview/gui/StructureViewerBase.java
@@ -0,0 +1,495 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.gui.StructureViewer.ViewerType;
+import jalview.gui.ViewSelectionMenu.ViewSetProvider;
+import jalview.io.AppletFormatAdapter;
+import jalview.jbgui.GStructureViewer;
+import jalview.structures.models.AAStructureBindingModel;
+import jalview.util.MessageManager;
+
+import java.awt.Component;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+
+/**
+ * Base class with common functionality for JMol, Chimera or other structure
+ * viewers.
+ *
+ * @author gmcarstairs
+ *
+ */
+public abstract class StructureViewerBase extends GStructureViewer
+ implements Runnable, ViewSetProvider
+{
+
+ /**
+ * list of sequenceSet ids associated with the view
+ */
+ protected List<String> _aps = new ArrayList<String>();
+
+ /**
+ * list of alignment panels to use for superposition
+ */
+ protected Vector<AlignmentPanel> _alignwith = new Vector<AlignmentPanel>();
+
+ /**
+ * list of alignment panels that are used for colouring structures by aligned
+ * sequences
+ */
+ protected Vector<AlignmentPanel> _colourwith = new Vector<AlignmentPanel>();
+
+ private String viewId = null;
+
+ private AlignmentPanel ap;
+
+ protected boolean alignAddedStructures = false;
+
+ protected boolean _started = false;
+
+ protected boolean addingStructures = false;
+
+ protected Thread worker = null;
+
+ /**
+ *
+ * @param ap2
+ * @return true if this Jmol instance is linked with the given alignPanel
+ */
+ public boolean isLinkedWith(AlignmentPanel ap2)
+ {
+ return _aps.contains(ap2.av.getSequenceSetId());
+ }
+
+ public boolean isUsedforaligment(AlignmentPanel ap2)
+ {
+
+ return (_alignwith != null) && _alignwith.contains(ap2);
+ }
+
+ public boolean isUsedforcolourby(AlignmentPanel ap2)
+ {
+ return (_colourwith != null) && _colourwith.contains(ap2);
+ }
+
+ /**
+ *
+ * @return TRUE if the view is NOT being coloured by the alignment colours.
+ */
+ public boolean isColouredByViewer()
+ {
+ return !getBinding().isColourBySequence();
+ }
+
+ public String getViewId()
+ {
+ if (viewId == null)
+ {
+ viewId = System.currentTimeMillis() + "." + this.hashCode();
+ }
+ return viewId;
+ }
+
+ protected void setViewId(String viewId)
+ {
+ this.viewId = viewId;
+ }
+
+ public abstract String getStateInfo();
+
+ protected void buildActionMenu()
+ {
+ if (_alignwith == null)
+ {
+ _alignwith = new Vector<AlignmentPanel>();
+ }
+ if (_alignwith.size() == 0 && ap != null)
+ {
+ _alignwith.add(ap);
+ }
+ ;
+ for (Component c : viewerActionMenu.getMenuComponents())
+ {
+ if (c != alignStructs)
+ {
+ viewerActionMenu.remove((JMenuItem) c);
+ }
+ }
+ }
+
+ public AlignmentPanel getAlignmentPanel()
+ {
+ return ap;
+ }
+
+ protected void setAlignmentPanel(AlignmentPanel alp)
+ {
+ this.ap = alp;
+ }
+
+ public AlignmentPanel[] getAllAlignmentPanels()
+ {
+ AlignmentPanel[] t, list = new AlignmentPanel[0];
+ for (String setid : _aps)
+ {
+ AlignmentPanel[] panels = PaintRefresher.getAssociatedPanels(setid);
+ if (panels != null)
+ {
+ t = new AlignmentPanel[list.length + panels.length];
+ System.arraycopy(list, 0, t, 0, list.length);
+ System.arraycopy(panels, 0, t, list.length, panels.length);
+ list = t;
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * set the primary alignmentPanel reference and add another alignPanel to the
+ * list of ones to use for colouring and aligning
+ *
+ * @param nap
+ */
+ public void addAlignmentPanel(AlignmentPanel nap)
+ {
+ if (getAlignmentPanel() == null)
+ {
+ setAlignmentPanel(nap);
+ }
+ if (!_aps.contains(nap.av.getSequenceSetId()))
+ {
+ _aps.add(nap.av.getSequenceSetId());
+ }
+ }
+
+ /**
+ * remove any references held to the given alignment panel
+ *
+ * @param nap
+ */
+ public void removeAlignmentPanel(AlignmentPanel nap)
+ {
+ try
+ {
+ _alignwith.remove(nap);
+ _colourwith.remove(nap);
+ if (getAlignmentPanel() == nap)
+ {
+ setAlignmentPanel(null);
+ for (AlignmentPanel aps : getAllAlignmentPanels())
+ {
+ if (aps != nap)
+ {
+ setAlignmentPanel(aps);
+ break;
+ }
+ }
+ }
+ } catch (Exception ex)
+ {
+ }
+ if (getAlignmentPanel() != null)
+ {
+ buildActionMenu();
+ }
+ }
+
+ public void useAlignmentPanelForSuperposition(AlignmentPanel nap)
+ {
+ addAlignmentPanel(nap);
+ if (!_alignwith.contains(nap))
+ {
+ _alignwith.add(nap);
+ }
+ }
+
+ public void excludeAlignmentPanelForSuperposition(AlignmentPanel nap)
+ {
+ if (_alignwith.contains(nap))
+ {
+ _alignwith.remove(nap);
+ }
+ }
+
+ public void useAlignmentPanelForColourbyseq(AlignmentPanel nap,
+ boolean enableColourBySeq)
+ {
+ useAlignmentPanelForColourbyseq(nap);
+ getBinding().setColourBySequence(enableColourBySeq);
+ seqColour.setSelected(enableColourBySeq);
+ viewerColour.setSelected(!enableColourBySeq);
+ }
+
+ public void useAlignmentPanelForColourbyseq(AlignmentPanel nap)
+ {
+ addAlignmentPanel(nap);
+ if (!_colourwith.contains(nap))
+ {
+ _colourwith.add(nap);
+ }
+ }
+
+ public void excludeAlignmentPanelForColourbyseq(AlignmentPanel nap)
+ {
+ if (_colourwith.contains(nap))
+ {
+ _colourwith.remove(nap);
+ }
+ }
+
+ public abstract ViewerType getViewerType();
+
+ protected abstract AAStructureBindingModel getBindingModel();
+
+ /**
+ * add a new structure (with associated sequences and chains) to this viewer,
+ * retrieving it if necessary first.
+ *
+ * @param pdbentry
+ * @param seqs
+ * @param chains
+ * @param align
+ * if true, new structure(s) will be aligned using associated
+ * alignment
+ * @param alignFrame
+ */
+ protected void addStructure(final PDBEntry pdbentry,
+ final SequenceI[] seqs, final String[] chains,
+ final boolean align, final IProgressIndicator alignFrame)
+ {
+ if (pdbentry.getFile() == null)
+ {
+ if (worker != null && worker.isAlive())
+ {
+ // a retrieval is in progress, wait around and add ourselves to the
+ // queue.
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ while (worker != null && worker.isAlive() && _started)
+ {
+ try
+ {
+ Thread.sleep(100 + ((int) Math.random() * 100));
+
+ } catch (Exception e)
+ {
+ }
+ }
+ // and call ourselves again.
+ addStructure(pdbentry, seqs, chains, align, alignFrame);
+ }
+ }).start();
+ return;
+ }
+ }
+ // otherwise, start adding the structure.
+ getBindingModel().addSequenceAndChain(new PDBEntry[] { pdbentry },
+ new SequenceI[][] { seqs }, new String[][] { chains });
+ addingStructures = true;
+ _started = false;
+ alignAddedStructures = align;
+ worker = new Thread(this);
+ worker.start();
+ return;
+ }
+
+ /**
+ * Presents a dialog with the option to add an align a structure to an
+ * existing structure view
+ *
+ * @param pdbId
+ * @param view
+ * @return YES, NO or CANCEL JOptionPane code
+ */
+ protected int chooseAlignStructureToViewer(String pdbId,
+ StructureViewerBase view)
+ {
+ int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ MessageManager.formatMessage("label.add_pdbentry_to_view",
+ new Object[] { pdbId, view.getTitle() }),
+ MessageManager
+ .getString("label.align_to_existing_structure_view"),
+ JOptionPane.YES_NO_CANCEL_OPTION);
+ return option;
+ }
+
+ protected abstract boolean hasPdbId(String pdbId);
+
+ protected abstract List<StructureViewerBase> getViewersFor(
+ AlignmentPanel alp);
+
+ /**
+ * Check for any existing views involving this alignment and give user the
+ * option to add and align this molecule to one of them
+ *
+ * @param pdbentry
+ * @param seq
+ * @param chains
+ * @param apanel
+ * @param pdbId
+ * @return true if user adds to a view, or cancels entirely, else false
+ */
+ protected boolean addToExistingViewer(PDBEntry pdbentry, SequenceI[] seq,
+ String[] chains, final AlignmentPanel apanel, String pdbId)
+ {
+ for (StructureViewerBase view : getViewersFor(apanel))
+ {
+ // TODO: highlight the view somehow
+ /*
+ * JAL-1742 exclude view with this structure already mapped (don't offer
+ * to align chain B to chain A of the same structure)
+ */
+ if (view.hasPdbId(pdbId))
+ {
+ continue;
+ }
+ int option = chooseAlignStructureToViewer(pdbId, view);
+ if (option == JOptionPane.CANCEL_OPTION)
+ {
+ return true;
+ }
+ else if (option == JOptionPane.YES_OPTION)
+ {
+ view.useAlignmentPanelForSuperposition(apanel);
+ view.addStructure(pdbentry, seq, chains, true, apanel.alignFrame);
+ return true;
+ }
+ else
+ {
+ // NO_OPTION - offer the next viewer if any
+ }
+ }
+
+ /*
+ * nothing offered and selected
+ */
+ return false;
+ }
+
+ /**
+ * Adds mappings for the given sequences to an already opened PDB structure,
+ * and updates any viewers that have the PDB file
+ *
+ * @param seq
+ * @param chains
+ * @param apanel
+ * @param pdbFilename
+ */
+ protected void addSequenceMappingsToStructure(SequenceI[] seq,
+ String[] chains, final AlignmentPanel apanel, String pdbFilename)
+ {
+ // TODO : Fix multiple seq to one chain issue here.
+ /*
+ * create the mappings
+ */
+ apanel.getStructureSelectionManager().setMapping(seq, chains,
+ pdbFilename, AppletFormatAdapter.FILE);
+
+ /*
+ * alert the FeatureRenderer to show new (PDB RESNUM) features
+ */
+ if (apanel.getSeqPanel().seqCanvas.fr != null)
+ {
+ apanel.getSeqPanel().seqCanvas.fr.featuresAdded();
+ apanel.paintAlignment(true);
+ }
+
+ /*
+ * add the sequences to any other viewers (of the same type) for this pdb
+ * file
+ */
+ // JBPNOTE: this looks like a binding routine, rather than a gui routine
+ for (StructureViewerBase viewer : getViewersFor(null))
+ {
+ AAStructureBindingModel bindingModel = viewer.getBindingModel();
+ for (int pe = 0; pe < bindingModel.getPdbCount(); pe++)
+ {
+ if (bindingModel.getPdbEntry(pe).getFile().equals(pdbFilename))
+ {
+ bindingModel.addSequence(pe, seq);
+ viewer.addAlignmentPanel(apanel);
+ /*
+ * add it to the set of alignments used for colouring structure by
+ * sequence
+ */
+ viewer.useAlignmentPanelForColourbyseq(apanel);
+ viewer.buildActionMenu();
+ apanel.getStructureSelectionManager().sequenceColoursChanged(
+ apanel);
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Check if the PDB file is already loaded, if so offer to add it to the
+ * existing viewer
+ *
+ * @param seq
+ * @param chains
+ * @param apanel
+ * @param pdbId
+ * @return true if the user chooses to add to a viewer, or to cancel entirely
+ */
+ protected boolean addAlreadyLoadedFile(SequenceI[] seq, String[] chains,
+ final AlignmentPanel apanel, String pdbId)
+ {
+ boolean finished = false;
+ String alreadyMapped = apanel.getStructureSelectionManager()
+ .alreadyMappedToFile(pdbId);
+
+ if (alreadyMapped != null)
+ {
+ /*
+ * the PDB file is already loaded
+ */
+ int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ MessageManager.formatMessage(
+ "label.pdb_entry_is_already_displayed",
+ new Object[] { pdbId }), MessageManager
+ .formatMessage(
+ "label.map_sequences_to_visible_window",
+ new Object[] { pdbId }),
+ JOptionPane.YES_NO_CANCEL_OPTION);
+ if (option == JOptionPane.CANCEL_OPTION)
+ {
+ finished = true;
+ }
+ else if (option == JOptionPane.YES_OPTION)
+ {
+ addSequenceMappingsToStructure(seq, chains, apanel, alreadyMapped);
+ finished = true;
+ }
+ }
+ return finished;
+ }
+}
diff --git a/src/jalview/gui/TextColourChooser.java b/src/jalview/gui/TextColourChooser.java
index 804dc0b..fc01404 100644
--- a/src/jalview/gui/TextColourChooser.java
+++ b/src/jalview/gui/TextColourChooser.java
@@ -1,30 +1,42 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
+import jalview.datamodel.SequenceGroup;
+import jalview.util.MessageManager;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
-import jalview.datamodel.*;
+import javax.swing.BorderFactory;
+import javax.swing.JColorChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
public class TextColourChooser
{
@@ -40,9 +52,9 @@ public class TextColourChooser
int original1, original2, originalThreshold;
if (sg == null)
{
- original1 = ap.av.textColour.getRGB();
- original2 = ap.av.textColour2.getRGB();
- originalThreshold = ap.av.thresholdTextColour;
+ original1 = ap.av.getTextColour().getRGB();
+ original2 = ap.av.getTextColour2().getRGB();
+ originalThreshold = ap.av.getThresholdTextColour();
}
else
{
@@ -55,21 +67,22 @@ public class TextColourChooser
final JPanel col1 = new JPanel();
col1.setPreferredSize(new Dimension(40, 20));
col1.setBorder(BorderFactory.createEtchedBorder());
- col1.setToolTipText("Dark Colour");
+ col1.setToolTipText(MessageManager.getString("label.dark_colour"));
col1.setBackground(new Color(original1));
final JPanel col2 = new JPanel();
col2.setPreferredSize(new Dimension(40, 20));
col2.setBorder(BorderFactory.createEtchedBorder());
- col2.setToolTipText("Light Colour");
+ col2.setToolTipText(MessageManager.getString("label.ligth_colour"));
col2.setBackground(new Color(original2));
final JPanel bigpanel = new JPanel(new BorderLayout());
JPanel panel = new JPanel();
bigpanel.add(panel, BorderLayout.CENTER);
bigpanel.add(
new JLabel(
- "<html><i>Select a dark and light text colour, then set the threshold to"
- + "<br>switch between colours, based on background colour</i></html>"),
- BorderLayout.NORTH);
+ "<html>"
+ + MessageManager
+ .getString("label.select_dark_light_set_thereshold")
+ + "</html>"), BorderLayout.NORTH);
panel.add(col1);
panel.add(slider);
panel.add(col2);
@@ -79,7 +92,8 @@ public class TextColourChooser
public void mousePressed(MouseEvent e)
{
Color col = JColorChooser.showDialog(bigpanel,
- "Select Colour for Text", col1.getBackground());
+ MessageManager.getString("label.select_colour_for_text"),
+ col1.getBackground());
if (col != null)
{
colour1Changed(col);
@@ -93,7 +107,8 @@ public class TextColourChooser
public void mousePressed(MouseEvent e)
{
Color col = JColorChooser.showDialog(bigpanel,
- "Select Colour for Text", col2.getBackground());
+ MessageManager.getString("label.select_colour_for_text"),
+ col2.getBackground());
if (col != null)
{
colour2Changed(col);
@@ -110,18 +125,22 @@ public class TextColourChooser
}
});
- int reply = JOptionPane.showInternalOptionDialog(ap, bigpanel,
- "Adjust Foreground Text Colour Threshold",
- JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
- null, null, null);
+ int reply = JOptionPane
+ .showInternalOptionDialog(
+ ap,
+ bigpanel,
+ MessageManager
+ .getString("label.adjunst_foreground_text_colour_thereshold"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE, null, null, null);
if (reply == JOptionPane.CANCEL_OPTION)
{
if (sg == null)
{
- ap.av.textColour = new Color(original1);
- ap.av.textColour2 = new Color(original2);
- ap.av.thresholdTextColour = originalThreshold;
+ ap.av.setTextColour(new Color(original1));
+ ap.av.setTextColour2(new Color(original2));
+ ap.av.setThresholdTextColour(originalThreshold);
}
else
{
@@ -136,8 +155,8 @@ public class TextColourChooser
{
if (sg == null)
{
- ap.av.textColour = col;
- if (ap.av.colourAppliesToAllGroups)
+ ap.av.setTextColour(col);
+ if (ap.av.getColourAppliesToAllGroups())
{
setGroupTextColour();
}
@@ -154,8 +173,8 @@ public class TextColourChooser
{
if (sg == null)
{
- ap.av.textColour2 = col;
- if (ap.av.colourAppliesToAllGroups)
+ ap.av.setTextColour2(col);
+ if (ap.av.getColourAppliesToAllGroups())
{
setGroupTextColour();
}
@@ -172,8 +191,8 @@ public class TextColourChooser
{
if (sg == null)
{
- ap.av.thresholdTextColour = value;
- if (ap.av.colourAppliesToAllGroups)
+ ap.av.setThresholdTextColour(value);
+ if (ap.av.getColourAppliesToAllGroups())
{
setGroupTextColour();
}
@@ -188,19 +207,16 @@ public class TextColourChooser
void setGroupTextColour()
{
- if (ap.av.alignment.getGroups() == null)
+ if (ap.av.getAlignment().getGroups() == null)
{
return;
}
- Vector groups = ap.av.alignment.getGroups();
-
- for (int i = 0; i < groups.size(); i++)
+ for (SequenceGroup sg : ap.av.getAlignment().getGroups())
{
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
- sg.textColour = ap.av.textColour;
- sg.textColour2 = ap.av.textColour2;
- sg.thresholdTextColour = ap.av.thresholdTextColour;
+ sg.textColour = ap.av.getTextColour();
+ sg.textColour2 = ap.av.getTextColour2();
+ sg.thresholdTextColour = ap.av.getThresholdTextColour();
}
}
diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java
index 02be03f..f590c2e 100644
--- a/src/jalview/gui/TreeCanvas.java
+++ b/src/jalview/gui/TreeCanvas.java
@@ -1,33 +1,66 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.print.*;
-import javax.swing.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import jalview.util.*;
+import jalview.analysis.Conservation;
+import jalview.analysis.NJTree;
+import jalview.api.AlignViewportI;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequenceNode;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+import jalview.structure.SelectionSource;
+import jalview.util.Format;
+import jalview.util.MappingUtils;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import javax.swing.JColorChooser;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+import javax.swing.ToolTipManager;
/**
* DOCUMENT ME!
@@ -36,7 +69,7 @@ import jalview.util.*;
* @version $Revision$
*/
public class TreeCanvas extends JPanel implements MouseListener, Runnable,
- Printable, MouseMotionListener
+ Printable, MouseMotionListener, SelectionSource
{
/** DOCUMENT ME!! */
public static final String PLACEHOLDER = " * ";
@@ -125,7 +158,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
aps[a].av.setSelectionGroup(selected);
}
- selected.setEndRes(aps[a].av.alignment.getWidth() - 1);
+ selected.setEndRes(aps[a].av.getAlignment().getWidth() - 1);
selected.addOrRemove(sequence, true);
}
}
@@ -205,7 +238,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
if (node.element() instanceof SequenceI)
{
- SequenceI seq = (SequenceI) ((SequenceNode) node).element();
+ SequenceI seq = (SequenceI) node.element();
if (av.getSequenceColour(seq) == Color.white)
{
@@ -255,14 +288,13 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
Rectangle rect = new Rectangle(xend + 10, ypos - charHeight / 2,
charWidth, charHeight);
- nameHash.put((SequenceI) node.element(), rect);
+ nameHash.put(node.element(), rect);
// Colour selected leaves differently
SequenceGroup selected = av.getSelectionGroup();
if ((selected != null)
- && selected.getSequences(null).contains(
- (SequenceI) node.element()))
+ && selected.getSequences(null).contains(node.element()))
{
g.setColor(Color.gray);
@@ -287,7 +319,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
int xend = (int) (height * scale) + offx;
int ypos = (int) (node.ycount * chunk) + offy;
- g.setColor(((SequenceNode) node).color.darker());
+ g.setColor(node.color.darker());
// Draw horizontal line
g.drawLine(xstart, ypos, xend, ypos);
@@ -490,7 +522,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
{
for (int a = 0; a < aps.length; a++)
{
- aps[a].av.setSequenceColour((SequenceI) node.element(), c);
+ final SequenceI seq = (SequenceI) node.element();
+ aps[a].av.setSequenceColour(seq, c);
}
}
}
@@ -608,7 +641,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
if (tree == null)
{
- g.drawString("Calculating tree....", 20, getHeight() / 2);
+ g.drawString(MessageManager.getString("label.calculating_tree")
+ + "....", 20, getHeight() / 2);
}
else
{
@@ -666,17 +700,19 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(Color.white);
g2.fillRect(0, 0, width, height);
-
g2.setFont(font);
+ if (longestName == null || tree == null)
+ {
+ g2.drawString("Calculating tree.", 20, 20);
+ }
offy = font.getSize() + 10;
fm = g2.getFontMetrics(font);
labelLength = fm.stringWidth(longestName) + 20; // 20 allows for scrollbar
- float wscale = (float) (width - labelLength - (offx * 2))
- / tree.getMaxHeight();
+ float wscale = (width - labelLength - (offx * 2)) / tree.getMaxHeight();
SequenceNode top = tree.getTopNode();
@@ -701,7 +737,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
g2.setColor(Color.gray);
}
- int x = (int) ((threshold * (float) (getWidth() - labelLength - (2 * offx))) + offx);
+ int x = (int) ((threshold * (getWidth() - labelLength - (2 * offx))) + offx);
g2.drawLine(x, 0, x, getHeight());
}
@@ -750,7 +786,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
if (SwingUtilities.isRightMouseButton(evt))
{
Color col = JColorChooser.showDialog(this,
- "Select Sub-Tree Colour", highlightNode.color);
+ MessageManager.getString("label.select_subtree_colour"),
+ highlightNode.color);
if (col != null)
{
setColor(highlightNode, col);
@@ -790,9 +827,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
if (ob instanceof SequenceNode)
{
highlightNode = (SequenceNode) ob;
- this.setToolTipText("<html>Left click to select leaves"
- + "<br>Double-click to invert leaves"
- + "<br>Right click to change colour");
+ this.setToolTipText("<html>"
+ + MessageManager.getString("label.highlightnode"));
repaint();
}
@@ -848,11 +884,19 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
AlignmentPanel[] aps = getAssociatedPanels();
+ // TODO push calls below into a single AlignViewportI method?
+ // see also AlignViewController.deleteGroups
for (int a = 0; a < aps.length; a++)
{
aps[a].av.setSelectionGroup(null);
- aps[a].av.alignment.deleteAllGroups();
- aps[a].av.sequenceColours = null;
+ aps[a].av.getAlignment().deleteAllGroups();
+ aps[a].av.clearSequenceColours();
+ }
+ if (av.getCodingComplement() != null)
+ {
+ av.getCodingComplement().setSelectionGroup(null);
+ av.getCodingComplement().getAlignment().deleteAllGroups();
+ av.getCodingComplement().clearSequenceColours();
}
colourGroups();
}
@@ -889,6 +933,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
}
ColourSchemeI cs = null;
+ SequenceGroup sg = new SequenceGroup(sequences, null, cs, true, true,
+ false, 0, av.getAlignment().getWidth() - 1);
if (av.getGlobalColourScheme() != null)
{
@@ -901,23 +947,21 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
}
else
{
- cs = ColourSchemeProperty.getColour(sequences, av.alignment
- .getWidth(), ColourSchemeProperty.getColourName(av
- .getGlobalColourScheme()));
+ cs = ColourSchemeProperty.getColour(sg, ColourSchemeProperty
+ .getColourName(av.getGlobalColourScheme()));
}
// cs is null if shading is an annotationColourGradient
- if (cs!=null)
+ if (cs != null)
{
cs.setThreshold(av.getGlobalColourScheme().getThreshold(),
- av.getIgnoreGapsConsensus());
+ av.isIgnoreGapsConsensus());
}
}
-
- SequenceGroup sg = new SequenceGroup(sequences, null, cs, true, true,
- false, 0, av.alignment.getWidth() - 1);
-
+ sg.cs = cs;
+ // sg.recalcConservation();
sg.setName("JTreeGroup:" + sg.hashCode());
sg.setIdColour(col);
+
for (int a = 0; a < aps.length; a++)
{
if (aps[a].av.getGlobalColourScheme() != null
@@ -928,20 +972,47 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
sg.getStartRes(), sg.getEndRes());
c.calculate();
- c.verdict(false, aps[a].av.ConsPercGaps);
+ c.verdict(false, aps[a].av.getConsPercGaps());
sg.cs.setConservation(c);
}
- aps[a].av.alignment.addGroup(sg);
+ aps[a].av.getAlignment().addGroup(new SequenceGroup(sg));
+ }
+
+ // TODO can we push all of the below into AlignViewportI?
+ av.getAlignment().addGroup(sg);
+ final AlignViewportI codingComplement = av.getCodingComplement();
+ if (codingComplement != null)
+ {
+ SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, av,
+ codingComplement);
+ if (mappedGroup.getSequences().size() > 0)
+ {
+ codingComplement.getAlignment().addGroup(mappedGroup);
+ for (SequenceI seq : mappedGroup.getSequences())
+ {
+ codingComplement.setSequenceColour(seq, col.brighter());
+ }
+ }
}
}
+
// notify the panel to redo any group specific stuff.
for (int a = 0; a < aps.length; a++)
{
aps[a].updateAnnotation();
- // TODO: JAL-868 - need to ensure view colour change message is broadcast to any Jmols listening in
+ // TODO: JAL-868 - need to ensure view colour change message is broadcast
+ // to any Jmols listening in
}
+ if (av.getCodingComplement() != null)
+ {
+ ((AlignViewport) av.getCodingComplement()).getAlignPanel()
+ .updateAnnotation();
+ /*
+ * idPanel. repaint ()
+ */
+ }
}
/**
@@ -988,8 +1059,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
}
else
{
- return new AlignmentPanel[]
- { ap };
+ return new AlignmentPanel[] { ap };
}
}
}
diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java
index d8253db..c0b0c68 100644
--- a/src/jalview/gui/TreePanel.java
+++ b/src/jalview/gui/TreePanel.java
@@ -1,39 +1,66 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.beans.*;
-import java.io.*;
-import java.util.*;
-import javax.imageio.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import javax.swing.*;
-
-import org.jibble.epsgraphics.*;
-import jalview.analysis.*;
+import jalview.analysis.AlignmentSorter;
+import jalview.analysis.NJTree;
+import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.ViewBasedAnalysisI;
+import jalview.bin.Cache;
import jalview.commands.CommandI;
import jalview.commands.OrderCommand;
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.jbgui.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.BinaryNode;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.NodeTransformI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequenceNode;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.io.NewickFile;
+import jalview.jbgui.GTreePanel;
+import jalview.schemes.ResidueProperties;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.image.BufferedImage;
+import java.beans.PropertyChangeEvent;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.imageio.ImageIO;
+import javax.swing.ButtonGroup;
+import javax.swing.JMenuItem;
+import javax.swing.JRadioButtonMenuItem;
+
+import org.jibble.epsgraphics.EpsGraphics2D;
/**
* DOCUMENT ME!
@@ -112,7 +139,7 @@ public class TreePanel extends GTreePanel
return treeCanvas.av.getAlignment();
}
- public AlignViewport getViewPort()
+ public AlignmentViewport getViewPort()
{
return treeCanvas.av;
}
@@ -152,7 +179,7 @@ public class TreePanel extends GTreePanel
.println("new alignment sequences vector value is null");
}
- tree.UpdatePlaceHolders((Vector) evt.getNewValue());
+ tree.UpdatePlaceHolders((List<SequenceI>) evt.getNewValue());
treeCanvas.nameHash.clear(); // reset the mapping between canvas
// rectangles and leafnodes
repaint();
@@ -216,7 +243,8 @@ public class TreePanel extends GTreePanel
associateLeavesMenu.add(item);
}
- final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem("All Views");
+ final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem(
+ MessageManager.getString("label.all_views"));
buttonGroup.add(itemf);
itemf.setSelected(treeCanvas.applyToAllViews);
itemf.addActionListener(new ActionListener()
@@ -255,11 +283,11 @@ public class TreePanel extends GTreePanel
{
if (odata == null)
{
- tree = new NJTree(av.alignment.getSequencesArray(), newtree);
+ tree = new NJTree(av.getAlignment().getSequencesArray(), newtree);
}
else
{
- tree = new NJTree(av.alignment.getSequencesArray(), odata,
+ tree = new NJTree(av.getAlignment().getSequencesArray(), odata,
newtree);
}
if (!tree.hasOriginalSequenceData())
@@ -271,22 +299,42 @@ public class TreePanel extends GTreePanel
{
int start, end;
SequenceI[] seqs;
- AlignmentView seqStrings = av.getAlignmentView(av
- .getSelectionGroup() != null);
- if (av.getSelectionGroup() == null)
+ boolean selview = av.getSelectionGroup() != null
+ && av.getSelectionGroup().getSize() > 1;
+ AlignmentView seqStrings = av.getAlignmentView(selview);
+ if (!selview)
{
start = 0;
- end = av.alignment.getWidth();
- seqs = av.alignment.getSequencesArray();
+ end = av.getAlignment().getWidth();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
start = av.getSelectionGroup().getStartRes();
end = av.getSelectionGroup().getEndRes() + 1;
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(
+ av.getAlignment());
+ }
+ ScoreModelI sm = ResidueProperties.getScoreModel(pwtype);
+ if (sm instanceof ViewBasedAnalysisI)
+ {
+ try
+ {
+ sm = sm.getClass().newInstance();
+ ((ViewBasedAnalysisI) sm)
+ .configureFromAlignmentView(treeCanvas.ap);
+ } catch (Exception q)
+ {
+ Cache.log.error("Couldn't create a scoremodel instance for "
+ + sm.getName());
+ }
+ tree = new NJTree(seqs, seqStrings, type, pwtype, sm, start, end);
+ }
+ else
+ {
+ tree = new NJTree(seqs, seqStrings, type, pwtype, null, start,
+ end);
}
-
- tree = new NJTree(seqs, seqStrings, type, pwtype, start, end);
showDistances(true);
}
@@ -297,7 +345,7 @@ public class TreePanel extends GTreePanel
av.setCurrentTree(tree);
if (av.getSortByTree())
{
- sortByTree_actionPerformed(null);
+ sortByTree_actionPerformed();
}
}
}
@@ -391,8 +439,9 @@ public class TreePanel extends GTreePanel
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save tree as newick file");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.save_tree_as_newick"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(null);
@@ -484,8 +533,10 @@ public class TreePanel extends GTreePanel
// af.addSortByOrderMenuItem(ServiceName + " Ordering",
// msaorder);
- Desktop.addInternalFrame(af, "Original Data for " + this.title,
- AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ Desktop.addInternalFrame(af, MessageManager.formatMessage(
+ "label.original_data_for_params",
+ new Object[] { this.title }), AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
}
}
}
@@ -507,74 +558,79 @@ public class TreePanel extends GTreePanel
*
* @param e
*/
- public void sortByTree_actionPerformed(ActionEvent e)
+ @Override
+ public void sortByTree_actionPerformed()
{
-
+
if (treeCanvas.applyToAllViews)
{
final ArrayList<CommandI> commands = new ArrayList<CommandI>();
- for (AlignmentPanel ap: PaintRefresher.getAssociatedPanels(av
+ for (AlignmentPanel ap : PaintRefresher.getAssociatedPanels(av
.getSequenceSetId()))
{
commands.add(sortAlignmentIn(ap.av.getAlignPanel()));
}
av.getAlignPanel().alignFrame.addHistoryItem(new CommandI()
{
-
+
@Override
public void undoCommand(AlignmentI[] views)
{
- for (CommandI tsort:commands)
+ for (CommandI tsort : commands)
{
tsort.undoCommand(views);
- }
+ }
}
-
+
@Override
public int getSize()
{
return commands.size();
}
-
+
@Override
public String getDescription()
{
return "Tree Sort (many views)";
}
-
+
@Override
public void doCommand(AlignmentI[] views)
{
- for (CommandI tsort:commands)
+ for (CommandI tsort : commands)
{
tsort.doCommand(views);
- }
+ }
}
});
- for (AlignmentPanel ap: PaintRefresher.getAssociatedPanels(av
+ for (AlignmentPanel ap : PaintRefresher.getAssociatedPanels(av
.getSequenceSetId()))
{
// ensure all the alignFrames refresh their GI after adding an undo item
ap.alignFrame.updateEditMenuBar();
}
- } else {
- treeCanvas.ap.alignFrame.addHistoryItem(sortAlignmentIn(treeCanvas.ap));
+ }
+ else
+ {
+ treeCanvas.ap.alignFrame
+ .addHistoryItem(sortAlignmentIn(treeCanvas.ap));
}
}
+
public CommandI sortAlignmentIn(AlignmentPanel ap)
{
- AlignViewport av = ap.av;
+ AlignmentViewport av = ap.av;
SequenceI[] oldOrder = av.getAlignment().getSequencesArray();
AlignmentSorter.sortByTree(av.getAlignment(), tree);
CommandI undo;
- undo=new OrderCommand("Tree Sort", oldOrder,
- av.alignment);
+ undo = new OrderCommand("Tree Sort", oldOrder, av.getAlignment());
- ap.paintAlignment(true);
+ ap.paintAlignment(true);
return undo;
}
+
/**
* DOCUMENT ME!
*
@@ -678,11 +734,12 @@ public class TreePanel extends GTreePanel
{
jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "eps" }, new String[]
- { "Encapsulated Postscript" }, "Encapsulated Postscript");
+ { "eps" }, new String[] { "Encapsulated Postscript" },
+ "Encapsulated Postscript");
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Create EPS file from tree");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.create_eps_from_tree"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
@@ -724,12 +781,13 @@ public class TreePanel extends GTreePanel
{
jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "png" }, new String[]
- { "Portable network graphics" }, "Portable network graphics");
+ { "png" }, new String[] { "Portable network graphics" },
+ "Portable network graphics");
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Create PNG image from tree");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.create_png_from_tree"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
@@ -782,8 +840,8 @@ public class TreePanel extends GTreePanel
{
// search dbrefs, features and annotation
DBRefEntry[] refs = jalview.util.DBRefUtils.selectRefs(
- sq.getDBRef(), new String[]
- { labelClass.toUpperCase() });
+ sq.getDBRef(),
+ new String[] { labelClass.toUpperCase() });
if (refs != null)
{
for (int i = 0; i < refs.length; i++)
diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java
index 792ef7d..1e85e55 100644
--- a/src/jalview/gui/UserDefinedColours.java
+++ b/src/jalview/gui/UserDefinedColours.java
@@ -1,59 +1,86 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.io.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.jbgui.*;
-import jalview.schemes.*;
+import jalview.api.structures.JalviewStructureDisplayI;
+import jalview.datamodel.SequenceGroup;
+import jalview.io.JalviewFileChooser;
+import jalview.jbgui.GUserDefinedColours;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+import jalview.util.ColorUtils;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import javax.swing.JButton;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
/**
- * DOCUMENT ME!
+ * This panel allows the user to assign colours to Amino Acid residue codes, and
+ * save the colour scheme.
*
- * @author $author$
- * @version $Revision$
+ * @author Andrew Waterhouse
+ * @author Mungo Carstairs
*/
public class UserDefinedColours extends GUserDefinedColours implements
ChangeListener
{
+ private static final int MY_FRAME_HEIGHT = 420;
+
+ private static final int MY_FRAME_WIDTH = 810;
+
+ private static final int MY_FRAME_WIDTH_CASE_SENSITIVE = 970;
+
AlignmentPanel ap;
SequenceGroup seqGroup;
- Vector selectedButtons;
+ ArrayList<JButton> selectedButtons;
ColourSchemeI oldColourScheme;
JInternalFrame frame;
- AppJmol jmol;
+ JalviewStructureDisplayI jmol;
- Vector upperCaseButtons;
+ ArrayList<JButton> upperCaseButtons;
- Vector lowerCaseButtons;
+ ArrayList<JButton> lowerCaseButtons;
/**
* Creates a new UserDefinedColours object.
@@ -103,7 +130,8 @@ public class UserDefinedColours extends GUserDefinedColours implements
showFrame();
}
- public UserDefinedColours(AppJmol jmol, ColourSchemeI oldcs)
+ public UserDefinedColours(JalviewStructureDisplayI jmol,
+ ColourSchemeI oldcs)
{
super();
this.jmol = jmol;
@@ -128,17 +156,14 @@ public class UserDefinedColours extends GUserDefinedColours implements
colorChooser.getSelectionModel().addChangeListener(this);
frame = new JInternalFrame();
frame.setContentPane(this);
- Desktop.addInternalFrame(frame, "User Defined Colours", 720, 370, true);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("label.user_defined_colours"),
+ MY_FRAME_WIDTH, MY_FRAME_HEIGHT, true);
if (seqGroup != null)
{
frame.setTitle(frame.getTitle() + " (" + seqGroup.getName() + ")");
}
-
- if (new jalview.util.Platform().isAMac())
- {
- frame.setSize(760, 370);
- }
}
void resetButtonPanel(boolean caseSensitive)
@@ -147,7 +172,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
if (upperCaseButtons == null)
{
- upperCaseButtons = new Vector();
+ upperCaseButtons = new ArrayList<JButton>();
}
JButton button;
@@ -188,7 +213,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
if (lowerCaseButtons == null)
{
- lowerCaseButtons = new Vector();
+ lowerCaseButtons = new ArrayList<JButton>();
}
for (int i = 0; i < 20; i++)
@@ -209,6 +234,15 @@ public class UserDefinedColours extends GUserDefinedColours implements
buttonPanel.add(makeButton("x", "x", lowerCaseButtons, 22));
}
+ // JAL-1360 widen the frame dynamically to accommodate case-sensitive AA
+ // codes
+ if (this.frame != null)
+ {
+ int newWidth = caseSensitive ? MY_FRAME_WIDTH_CASE_SENSITIVE
+ : MY_FRAME_WIDTH;
+ this.frame.setSize(newWidth, this.frame.getHeight());
+ }
+
buttonPanel.validate();
validate();
}
@@ -219,42 +253,55 @@ public class UserDefinedColours extends GUserDefinedColours implements
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void stateChanged(ChangeEvent evt)
{
if (selectedButtons != null)
{
JButton button = null;
+ final Color newColour = colorChooser.getColor();
for (int i = 0; i < selectedButtons.size(); i++)
{
- button = (JButton) selectedButtons.elementAt(i);
- button.setBackground(colorChooser.getColor());
- button.setForeground(button.getBackground().brighter().brighter()
- .brighter());
+ button = selectedButtons.get(i);
+ button.setBackground(newColour);
+ button.setForeground(ColorUtils.brighterThan(newColour));
}
if (button == lcaseColour)
{
for (int i = 0; i < lowerCaseButtons.size(); i++)
{
- button = (JButton) lowerCaseButtons.elementAt(i);
- button.setBackground(colorChooser.getColor());
- button.setForeground(button.getBackground().brighter().brighter()
- .brighter());
+ button = lowerCaseButtons.get(i);
+ button.setBackground(newColour);
+ button.setForeground(ColorUtils.brighterThan(button
+ .getBackground()));
}
}
}
}
/**
- * DOCUMENT ME!
+ * Performs actions when a residue button is clicked. This manages the button
+ * selection set (highlighted by brighter foreground text).
+ * <p>
+ * On select button(s) with Ctrl/click or Shift/click: set button foreground
+ * text to brighter than background.
+ * <p>
+ * On unselect button(s) with Ctrl/click on selected, or click to release
+ * current selection: reset foreground text to darker than background.
+ * <p>
+ * Simple click: clear selection (resetting foreground to darker); set clicked
+ * button foreground to brighter
+ * <p>
+ * Finally, synchronize the colour chooser to the colour of the first button
+ * in the selected set.
*
* @param e
- * DOCUMENT ME!
*/
public void colourButtonPressed(MouseEvent e)
{
if (selectedButtons == null)
{
- selectedButtons = new Vector();
+ selectedButtons = new ArrayList<JButton>();
}
JButton pressed = (JButton) e.getSource();
@@ -264,8 +311,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
JButton start, end = (JButton) e.getSource();
if (selectedButtons.size() > 0)
{
- start = (JButton) selectedButtons
- .elementAt(selectedButtons.size() - 1);
+ start = selectedButtons.get(selectedButtons.size() - 1);
}
else
{
@@ -297,7 +343,8 @@ public class UserDefinedColours extends GUserDefinedColours implements
JButton button = (JButton) buttonPanel.getComponent(b);
if (!selectedButtons.contains(button))
{
- button.setForeground(button.getBackground().brighter().brighter());
+ button.setForeground(ColorUtils.brighterThan(button
+ .getBackground()));
selectedButtons.add(button);
}
}
@@ -306,32 +353,32 @@ public class UserDefinedColours extends GUserDefinedColours implements
{
for (int b = 0; b < selectedButtons.size(); b++)
{
- JButton button = (JButton) selectedButtons.elementAt(b);
- button.setForeground(button.getBackground().darker().darker());
+ JButton button = selectedButtons.get(b);
+ button.setForeground(ColorUtils.darkerThan(button.getBackground()));
}
selectedButtons.clear();
- pressed.setForeground(pressed.getBackground().brighter().brighter());
- selectedButtons.addElement(pressed);
+ pressed.setForeground(ColorUtils.brighterThan(pressed.getBackground()));
+ selectedButtons.add(pressed);
}
else if (e.isControlDown())
{
if (selectedButtons.contains(pressed))
{
- pressed.setForeground(pressed.getBackground().darker().darker());
+ pressed.setForeground(ColorUtils.darkerThan(pressed.getBackground()));
selectedButtons.remove(pressed);
}
else
{
- pressed.setForeground(pressed.getBackground().brighter().brighter());
- selectedButtons.addElement(pressed);
+ pressed.setForeground(ColorUtils.brighterThan(pressed
+ .getBackground()));
+ selectedButtons.add(pressed);
}
}
if (selectedButtons.size() > 0)
{
- colorChooser.setColor(((JButton) selectedButtons.elementAt(0))
- .getBackground());
+ colorChooser.setColor((selectedButtons.get(0)).getBackground());
}
}
@@ -343,15 +390,15 @@ public class UserDefinedColours extends GUserDefinedColours implements
* @param aa
* DOCUMENT ME!
*/
- JButton makeButton(String label, String aa, Vector caseSensitiveButtons,
- int buttonIndex)
+ JButton makeButton(String label, String aa,
+ ArrayList<JButton> caseSensitiveButtons, int buttonIndex)
{
final JButton button;
Color col;
if (buttonIndex < caseSensitiveButtons.size())
{
- button = (JButton) caseSensitiveButtons.elementAt(buttonIndex);
+ button = caseSensitiveButtons.get(buttonIndex);
col = button.getBackground();
}
else
@@ -359,20 +406,21 @@ public class UserDefinedColours extends GUserDefinedColours implements
button = new JButton();
button.addMouseListener(new java.awt.event.MouseAdapter()
{
+ @Override
public void mouseClicked(MouseEvent e)
{
colourButtonPressed(e);
}
});
- caseSensitiveButtons.addElement(button);
+ caseSensitiveButtons.add(button);
col = Color.white;
if (oldColourScheme != null)
{
try
{
- col = oldColourScheme.findColour(aa.charAt(0), -1);
+ col = oldColourScheme.findColour(aa.charAt(0), -1, null);
} catch (Exception ex)
{
}
@@ -388,9 +436,10 @@ public class UserDefinedColours extends GUserDefinedColours implements
button.setMargin(new java.awt.Insets(2, 14, 2, 14));
}
+ button.setOpaque(true); // required for the next line to have effect
button.setBackground(col);
button.setText(label);
- button.setForeground(col.darker().darker().darker());
+ button.setForeground(ColorUtils.darkerThan(col));
button.setFont(new java.awt.Font("Verdana", Font.BOLD, 10));
return button;
@@ -402,26 +451,63 @@ public class UserDefinedColours extends GUserDefinedColours implements
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void okButton_actionPerformed(ActionEvent e)
{
- applyButton_actionPerformed(null);
-
- try
+ if (isNoSelectionMade())
{
- frame.setClosed(true);
- } catch (Exception ex)
+ JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ .getString("label.no_colour_selection_in_scheme"),
+ MessageManager.getString("label.no_colour_selection_warn"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+ else
{
+ applyButton_actionPerformed(null);
+
+ try
+ {
+ frame.setClosed(true);
+ } catch (Exception ex)
+ {
+ }
}
}
/**
+ * Returns true if the user has not made any colour selection (including if
+ * 'case-sensitive' selected and no lower-case colour chosen).
+ *
+ * @return
+ */
+ protected boolean isNoSelectionMade()
+ {
+ final boolean noUpperCaseSelected = upperCaseButtons == null
+ || upperCaseButtons.isEmpty();
+ final boolean noLowerCaseSelected = caseSensitive.isSelected()
+ && (lowerCaseButtons == null || lowerCaseButtons.isEmpty());
+ final boolean noSelectionMade = noUpperCaseSelected
+ || noLowerCaseSelected;
+ return noSelectionMade;
+ }
+
+ /**
* DOCUMENT ME!
*
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void applyButton_actionPerformed(ActionEvent e)
{
+ if (isNoSelectionMade())
+ {
+ JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ .getString("label.no_colour_selection_in_scheme"),
+ MessageManager.getString("label.no_colour_selection_warn"),
+ JOptionPane.WARNING_MESSAGE);
+
+ }
UserColourScheme ucs = getSchemeFromButtons();
ucs.setName(schemeName.getText());
@@ -445,10 +531,23 @@ public class UserDefinedColours extends GUserDefinedColours implements
Color[] newColours = new Color[24];
- for (int i = 0; i < 24; i++)
+ int length = upperCaseButtons.size();
+ if (length < 24)
{
- JButton button = (JButton) upperCaseButtons.elementAt(i);
- newColours[i] = button.getBackground();
+ int i = 0;
+ for (JButton btn : upperCaseButtons)
+ {
+ newColours[i] = btn.getBackground();
+ i++;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < 24; i++)
+ {
+ JButton button = upperCaseButtons.get(i);
+ newColours[i] = button.getBackground();
+ }
}
UserColourScheme ucs = new UserColourScheme(newColours);
@@ -456,17 +555,30 @@ public class UserDefinedColours extends GUserDefinedColours implements
if (caseSensitive.isSelected())
{
newColours = new Color[23];
- for (int i = 0; i < 23; i++)
+ length = lowerCaseButtons.size();
+ if (length < 23)
{
- JButton button = (JButton) lowerCaseButtons.elementAt(i);
- newColours[i] = button.getBackground();
+ int i = 0;
+ for (JButton btn : lowerCaseButtons)
+ {
+ newColours[i] = btn.getBackground();
+ i++;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < 23; i++)
+ {
+ JButton button = lowerCaseButtons.get(i);
+ newColours[i] = button.getBackground();
+ }
}
ucs.setLowerCaseColours(newColours);
}
if (ap != null)
{
- ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus());
+ ucs.setThreshold(0, ap.av.isIgnoreGapsConsensus());
}
return ucs;
@@ -478,18 +590,20 @@ public class UserDefinedColours extends GUserDefinedColours implements
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void loadbutton_actionPerformed(ActionEvent e)
{
- upperCaseButtons = new Vector();
- lowerCaseButtons = new Vector();
+ upperCaseButtons = new ArrayList<JButton>();
+ lowerCaseButtons = new ArrayList<JButton>();
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "jc" }, new String[]
- { "Jalview User Colours" }, "Jalview User Colours");
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "jc" }, new String[] { "Jalview User Colours" },
+ "Jalview User Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Load colour scheme");
- chooser.setToolTipText("Load");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.load_colour_scheme"));
+ chooser.setToolTipText(MessageManager.getString("action.load"));
int value = chooser.showOpenDialog(this);
@@ -518,7 +632,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
resetButtonPanel(true);
for (int i = 0; i < lowerCaseButtons.size(); i++)
{
- JButton button = (JButton) lowerCaseButtons.elementAt(i);
+ JButton button = lowerCaseButtons.get(i);
button.setBackground(ucs.getLowerCaseColours()[i]);
}
@@ -532,7 +646,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
for (int i = 0; i < upperCaseButtons.size(); i++)
{
- JButton button = (JButton) upperCaseButtons.elementAt(i);
+ JButton button = upperCaseButtons.get(i);
button.setBackground(colors[i]);
}
@@ -608,8 +722,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
name = jucs.getColour(i).getName();
if (ResidueProperties.aa3Hash.containsKey(name))
{
- index = ((Integer) ResidueProperties.aa3Hash.get(name))
- .intValue();
+ index = ResidueProperties.aa3Hash.get(name).intValue();
}
else
{
@@ -657,7 +770,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
jalview.binding.JalviewUserColours jucs = new jalview.binding.JalviewUserColours();
- jucs = (jalview.binding.JalviewUserColours) jucs.unmarshal(in);
+ jucs = jucs.unmarshal(in);
newColours = new Color[jucs.getColourCount()];
@@ -691,25 +804,27 @@ public class UserDefinedColours extends GUserDefinedColours implements
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void savebutton_actionPerformed(ActionEvent e)
{
if (schemeName.getText().trim().length() < 1)
{
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "User colour scheme must have a name!",
- "No name for colour scheme", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
+ .getString("label.user_colour_scheme_must_have_name"),
+ MessageManager.getString("label.no_name_colour_scheme"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
if (userColourSchemes != null
&& userColourSchemes.containsKey(schemeName.getText()))
{
- int reply = JOptionPane.showInternalConfirmDialog(
- Desktop.desktop,
- "Colour scheme " + schemeName.getText() + " exists."
- + "\nContinue saving colour scheme as "
- + schemeName.getText() + "?",
- "Duplicate scheme name", JOptionPane.YES_NO_OPTION);
+ int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ MessageManager.formatMessage(
+ "label.colour_scheme_exists_overwrite", new Object[] {
+ schemeName.getText(), schemeName.getText() }),
+ MessageManager.getString("label.duplicate_scheme_name"),
+ JOptionPane.YES_NO_OPTION);
if (reply != JOptionPane.YES_OPTION)
{
return;
@@ -718,13 +833,14 @@ public class UserDefinedColours extends GUserDefinedColours implements
userColourSchemes.remove(schemeName.getText());
}
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "jc" }, new String[]
- { "Jalview User Colours" }, "Jalview User Colours");
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "jc" }, new String[] { "Jalview User Colours" },
+ "Jalview User Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Save colour scheme");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.save_colour_scheme"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
@@ -781,6 +897,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void cancelButton_actionPerformed(ActionEvent e)
{
if (ap != null)
@@ -910,17 +1027,19 @@ public class UserDefinedColours extends GUserDefinedColours implements
}
+ @Override
public void caseSensitive_actionPerformed(ActionEvent e)
{
resetButtonPanel(caseSensitive.isSelected());
lcaseColour.setEnabled(caseSensitive.isSelected());
}
+ @Override
public void lcaseColour_actionPerformed(ActionEvent e)
{
if (selectedButtons == null)
{
- selectedButtons = new Vector();
+ selectedButtons = new ArrayList<JButton>();
}
else
{
@@ -928,5 +1047,4 @@ public class UserDefinedColours extends GUserDefinedColours implements
}
selectedButtons.add(lcaseColour);
}
-
}
diff --git a/src/jalview/gui/UserQuestionnaireCheck.java b/src/jalview/gui/UserQuestionnaireCheck.java
index 182ab1c..c286935 100644
--- a/src/jalview/gui/UserQuestionnaireCheck.java
+++ b/src/jalview/gui/UserQuestionnaireCheck.java
@@ -1,26 +1,32 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.io.*;
-import java.net.*;
+import jalview.util.MessageManager;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
-import javax.swing.*;
+import javax.swing.JOptionPane;
public class UserQuestionnaireCheck implements Runnable
{
@@ -136,11 +142,13 @@ public class UserQuestionnaireCheck implements Runnable
+ qid + "&rid=" + rid;
jalview.bin.Cache.log.info("Prompting user for questionnaire at "
+ qurl);
- int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- "There is a new Questionnaire available."
- + "Would you like to complete it now ?\n",
- "Jalview User Survey", JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ int reply = JOptionPane
+ .showInternalConfirmDialog(Desktop.desktop, MessageManager
+ .getString("label.jalview_new_questionnaire"),
+ MessageManager
+ .getString("label.jalview_user_survey"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
if (reply == JOptionPane.YES_OPTION)
{
diff --git a/src/jalview/gui/VamsasApplication.java b/src/jalview/gui/VamsasApplication.java
index 03b83cd..4630fd1 100644
--- a/src/jalview/gui/VamsasApplication.java
+++ b/src/jalview/gui/VamsasApplication.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
@@ -28,12 +31,13 @@ import jalview.structure.SelectionSource;
import jalview.structure.StructureSelectionManager;
import jalview.structure.VamsasListener;
import jalview.structure.VamsasSource;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.IdentityHashMap;
import java.util.Iterator;
@@ -45,7 +49,6 @@ import uk.ac.vamsas.client.ClientHandle;
import uk.ac.vamsas.client.IClient;
import uk.ac.vamsas.client.IClientDocument;
import uk.ac.vamsas.client.InvalidSessionDocumentException;
-import uk.ac.vamsas.client.NoDefaultSessionException;
import uk.ac.vamsas.client.UserHandle;
import uk.ac.vamsas.client.VorbaId;
import uk.ac.vamsas.client.picking.IMessageHandler;
@@ -62,7 +65,7 @@ import uk.ac.vamsas.objects.core.Seg;
* @author jimp
*
*/
-public class VamsasApplication implements SelectionSource,VamsasSource
+public class VamsasApplication implements SelectionSource, VamsasSource
{
IClient vclient = null;
@@ -154,7 +157,8 @@ public class VamsasApplication implements SelectionSource,VamsasSource
if (sess != null)
{
throw new Error(
- "Implementation Error - cannot import existing vamsas document into an existing session, Yet!");
+ MessageManager
+ .getString("error.implementation_error_cannot_import_vamsas_doc"));
}
try
{
@@ -174,8 +178,10 @@ public class VamsasApplication implements SelectionSource,VamsasSource
.showInternalMessageDialog(
Desktop.desktop,
- "VAMSAS Document could not be opened as a new session - please choose another",
- "VAMSAS Document Import Failed",
+ MessageManager
+ .getString("label.vamsas_doc_couldnt_be_opened_as_new_session"),
+ MessageManager
+ .getString("label.vamsas_document_import_failed"),
JOptionPane.ERROR_MESSAGE);
}
@@ -262,7 +268,8 @@ public class VamsasApplication implements SelectionSource,VamsasSource
if (!inSession())
{
throw new Error(
- "Impementation error! Vamsas Operations when client not initialised and connected.");
+ MessageManager
+ .getString("error.implementation_error_vamsas_operation_not_init"));
}
addDocumentUpdateHandler();
addStoreDocumentHandler();
@@ -346,7 +353,11 @@ public class VamsasApplication implements SelectionSource,VamsasSource
public void end_session(boolean promptUser)
{
if (!inSession())
- throw new Error("Jalview not connected to Vamsas session.");
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.jalview_no_connected_vamsas_session"));
+ }
Cache.log.info("Jalview disconnecting from the Vamsas Session.");
try
{
@@ -715,7 +726,8 @@ public class VamsasApplication implements SelectionSource,VamsasSource
}
throw new Error(
- "IMPLEMENTATION ERROR: Cannot recover vamsas object mappings - no backup was made.");
+ MessageManager
+ .getString("error.implementation_error_cannot_recover_vamsas_object_mappings"));
}
jv2vobj.clear();
Iterator el = _backup_jv2vobj.entrySet().iterator();
@@ -958,10 +970,14 @@ public class VamsasApplication implements SelectionSource,VamsasSource
int i = -1;
- public void mouseOver(SequenceI seq, int index, VamsasSource source)
+ @Override
+ public void mouseOverSequence(SequenceI seq, int index,
+ VamsasSource source)
{
if (jv2vobj == null)
+ {
return;
+ }
if (seq != last || i != index)
{
VorbaId v = (VorbaId) jv2vobj.get(seq);
@@ -997,7 +1013,7 @@ public class VamsasApplication implements SelectionSource,VamsasSource
AlignmentI visal = null;
if (source instanceof AlignViewport)
{
- visal = ((AlignViewport) source).getAlignment();
+ visal = ((AlignmentViewport) source).getAlignment();
}
SelectionMessage sm = null;
if ((seqsel == null || seqsel.getSize() == 0)
@@ -1007,9 +1023,9 @@ public class VamsasApplication implements SelectionSource,VamsasSource
if (source instanceof AlignViewport)
{
// the empty selection.
- sm = new SelectionMessage("jalview", new String[]
- { ((AlignViewport) source).getSequenceSetId() }, null,
- true);
+ sm = new SelectionMessage("jalview",
+ new String[] { ((AlignmentViewport) source)
+ .getSequenceSetId() }, null, true);
}
else
{
@@ -1021,10 +1037,8 @@ public class VamsasApplication implements SelectionSource,VamsasSource
{
String[] vobj = new String[seqsel.getSize()];
int o = 0;
- Enumeration sels = seqsel.getSequences(null).elements();
- while (sels.hasMoreElements())
+ for (SequenceI sel : seqsel.getSequences(null))
{
- SequenceI sel = (SequenceI) sels.nextElement();
VorbaId v = (VorbaId) jv2vobj.get(sel);
if (v != null)
{
@@ -1051,10 +1065,9 @@ public class VamsasApplication implements SelectionSource,VamsasSource
{
// gather selected columns outwith the sequence positions
// too
- Enumeration cols = colsel.getSelected().elements();
- while (cols.hasMoreElements())
+ for (Object obj : colsel.getSelected())
{
- int ival = ((Integer) cols.nextElement()).intValue();
+ int ival = ((Integer) obj).intValue();
Pos p = new Pos();
p.setI(ival + 1);
range.addPos(p);
diff --git a/src/jalview/gui/ViewSelectionMenu.java b/src/jalview/gui/ViewSelectionMenu.java
index 47e96b2..d906c6d 100644
--- a/src/jalview/gui/ViewSelectionMenu.java
+++ b/src/jalview/gui/ViewSelectionMenu.java
@@ -1,29 +1,34 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
+import jalview.util.MessageManager;
+
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.util.List;
import javax.swing.JCheckBoxMenuItem;
@@ -121,12 +126,17 @@ public class ViewSelectionMenu extends JMenu
* menu selection event occurred.
*/
private boolean append = false;
+
/**
- * flag indicating if the itemStateChanged listener for view associated menu items is currently enabled
+ * flag indicating if the itemStateChanged listener for view associated menu
+ * items is currently enabled
*/
private boolean enabled = true;
+
private JMenuItem selectAll, invertSel;
- private JCheckBoxMenuItem toggleview=null;
+
+ private JCheckBoxMenuItem toggleview = null;
+
private void rebuild()
{
removeAll();
@@ -139,10 +149,13 @@ public class ViewSelectionMenu extends JMenu
if (allviews.length >= 2)
{
// ensure we update menu state to reflect external selection list state
- append = append || _selectedviews.size()>1;
- toggleview = new JCheckBoxMenuItem("Select many views",append);
- toggleview.setToolTipText("When enabled, allows many views to be selected.");
- toggleview.addItemListener(new ItemListener() {
+ append = append || _selectedviews.size() > 1;
+ toggleview = new JCheckBoxMenuItem(
+ MessageManager.getString("label.select_many_views"), append);
+ toggleview.setToolTipText(MessageManager
+ .getString("label.toggle_enabled_views"));
+ toggleview.addItemListener(new ItemListener()
+ {
@Override
public void itemStateChanged(ItemEvent arg0)
@@ -153,12 +166,13 @@ public class ViewSelectionMenu extends JMenu
selectAll.setEnabled(append);
invertSel.setEnabled(append);
}
-
+
}
-
+
});
add(toggleview);
- add(selectAll= new JMenuItem("Select all views"));
+ add(selectAll = new JMenuItem(
+ MessageManager.getString("label.select_all_views")));
selectAll.addActionListener(new ActionListener()
{
@@ -167,141 +181,118 @@ public class ViewSelectionMenu extends JMenu
{
for (Component c : getMenuComponents())
{
- boolean t=append;
- append=true;
+ boolean t = append;
+ append = true;
if (c instanceof JCheckBoxMenuItem)
{
- if (toggleview!=c && !((JCheckBoxMenuItem) c).isSelected())
+ if (toggleview != c && !((JCheckBoxMenuItem) c).isSelected())
{
((JCheckBoxMenuItem) c).doClick();
}
}
- append=t;
+ append = t;
}
}
});
- add(invertSel = new JMenuItem("Invert selection"));
+ add(invertSel = new JMenuItem(
+ MessageManager.getString("label.invert_selection")));
invertSel.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- boolean t=append;
- append=true;
+ boolean t = append;
+ append = true;
for (Component c : getMenuComponents())
{
- if (toggleview!=c && c instanceof JCheckBoxMenuItem)
+ if (toggleview != c && c instanceof JCheckBoxMenuItem)
{
((JCheckBoxMenuItem) c).doClick();
}
}
- append=t;
+ append = t;
}
});
invertSel.setEnabled(append);
selectAll.setEnabled(append);
}
- for (AlignmentPanel ap : allviews)
+ for (final AlignmentPanel ap : allviews)
{
String nm = ((ap.getViewName() == null || ap.getViewName().length() == 0) ? ""
: ap.getViewName() + " for ")
+ ap.alignFrame.getTitle();
- final JCheckBoxMenuItem a = new JCheckBoxMenuItem(nm,
+ final JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(nm,
_selectedviews.contains(ap));
- final AlignmentPanel p = ap;
- a.addItemListener(new ItemListener()
+ checkBox.addItemListener(new ItemListener()
{
@Override
public void itemStateChanged(ItemEvent e)
{
if (enabled)
{
- if (append)
- {
- enabled=false;
- // toggle the inclusion state
- if (_selectedviews.indexOf(p)==-1)
+ if (append)
{
- _selectedviews.add(p);
- a.setSelected(true);
+ enabled = false;
+ // toggle the inclusion state
+ if (_selectedviews.indexOf(ap) == -1)
+ {
+ _selectedviews.add(ap);
+ checkBox.setSelected(true);
+ }
+ else
+ {
+ _selectedviews.remove(ap);
+ checkBox.setSelected(false);
+ }
+ enabled = true;
+ _handler.itemStateChanged(e);
}
else
{
- _selectedviews.remove(p);
- a.setSelected(false);
- }
- enabled=true;
- _handler.itemStateChanged(e);
- }
- else
- {
- // Deselect everything and select this item only
- _selectedviews.clear();
- _selectedviews.add(p);
- enabled=false;
- for (Component c : getMenuComponents())
- {
- if (c instanceof JCheckBoxMenuItem)
+ // Deselect everything and select this item only
+ _selectedviews.clear();
+ _selectedviews.add(ap);
+ enabled = false;
+ for (Component c : getMenuComponents())
{
- ((JCheckBoxMenuItem) c).setSelected(a == c);
+ if (c instanceof JCheckBoxMenuItem)
+ {
+ ((JCheckBoxMenuItem) c).setSelected(checkBox == c);
+ }
}
+ enabled = true;
+ // only fire event if we weren't selected before
+ _handler.itemStateChanged(e);
}
- enabled=true;
- // only fire event if we weren't selected before
- _handler.itemStateChanged(e);
- }
}
}
});
- a.addMouseListener(new MouseListener()
+ checkBox.addMouseListener(new MouseAdapter()
{
-
- @Override
- public void mouseReleased(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void mousePressed(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
@Override
public void mouseExited(MouseEvent e)
{
try
{
- p.setSelected(false);
+ ap.setSelected(false);
} catch (Exception ex)
{
}
- ;
}
@Override
public void mouseEntered(MouseEvent e)
{
-
try
{
- p.setSelected(true);
+ ap.setSelected(true);
} catch (Exception ex)
{
}
- ;
- }
-
- @Override
- public void mouseClicked(MouseEvent e)
- {
}
});
- add(a);
+ add(checkBox);
}
}
diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java
index ba7f4f3..82257ff 100644
--- a/src/jalview/gui/WebserviceInfo.java
+++ b/src/jalview/gui/WebserviceInfo.java
@@ -1,38 +1,54 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
+import jalview.jbgui.GWebserviceInfo;
+import jalview.util.MessageManager;
+import jalview.ws.WSClientI;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import javax.swing.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GridLayout;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.event.ActionEvent;
+import java.awt.image.BufferedImage;
+import java.util.Vector;
+
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
-import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
-import jalview.bin.Cache;
-import jalview.jbgui.*;
-import jalview.ws.WSClientI;
-
/**
* Base class for web service client thread and gui TODO: create StAX parser to
* extract html body content reliably when preparing html formatted job statuses
@@ -41,7 +57,7 @@ import jalview.ws.WSClientI;
* @version $Revision$
*/
public class WebserviceInfo extends GWebserviceInfo implements
- HyperlinkListener
+ HyperlinkListener, IProgressIndicator
{
/** Job is Queued */
@@ -76,6 +92,15 @@ public class WebserviceInfo extends GWebserviceInfo implements
JInternalFrame frame;
+ private IProgressIndicator progressBar;
+
+ @Override
+ public void setVisible(boolean aFlag)
+ {
+ super.setVisible(aFlag);
+ frame.setVisible(aFlag);
+ };
+
JTabbedPane subjobs = null;
java.util.Vector jobPanes = null;
@@ -208,10 +233,13 @@ public class WebserviceInfo extends GWebserviceInfo implements
* short name and job type
* @param info
* reference or other human readable description
+ * @param makeVisible
+ * true to display the webservices window immediatly (otherwise need
+ * to call setVisible(true))
*/
- public WebserviceInfo(String title, String info)
+ public WebserviceInfo(String title, String info, boolean makeVisible)
{
- init(title, info, 520, 500);
+ init(title, info, 520, 500, makeVisible);
}
/**
@@ -226,9 +254,10 @@ public class WebserviceInfo extends GWebserviceInfo implements
* @param height
* DOCUMENT ME!
*/
- public WebserviceInfo(String title, String info, int width, int height)
+ public WebserviceInfo(String title, String info, int width, int height,
+ boolean makeVisible)
{
- init(title, info, width, height);
+ init(title, info, width, height, makeVisible);
}
/**
@@ -286,17 +315,21 @@ public class WebserviceInfo extends GWebserviceInfo implements
* @param height
* DOCUMENT ME!
*/
- void init(String title, String info, int width, int height)
+ void init(String title, String info, int width, int height,
+ boolean makeVisible)
{
frame = new JInternalFrame();
frame.setContentPane(this);
- Desktop.addInternalFrame(frame, title, width, height);
+ Desktop.addInternalFrame(frame, title, makeVisible, width, height);
frame.setClosable(false);
+ progressBar = new ProgressBar(statusPanel, statusBar);
+
this.title = title;
setInfoText(info);
- java.net.URL url = getClass().getResource("/images/logo.gif");
+ java.net.URL url = getClass().getResource(
+ "/images/Jalview_Logo_small.png");
image = java.awt.Toolkit.getDefaultToolkit().createImage(url);
MediaTracker mt = new MediaTracker(this);
@@ -353,8 +386,9 @@ public class WebserviceInfo extends GWebserviceInfo implements
{
if (jobpane < 0 || jobpane >= jobPanes.size())
{
- throw new Error("setStatus called for non-existent job pane."
- + jobpane);
+ throw new Error(MessageManager.formatMessage(
+ "error.setstatus_called_non_existent_job_pane",
+ new String[] { Integer.valueOf(jobpane).toString() }));
}
switch (status)
{
@@ -648,8 +682,10 @@ public class WebserviceInfo extends GWebserviceInfo implements
// anyhow - it has to stop threads and clean up
// JBPNote : TODO: Instead of a warning, we should have an optional 'Are
// you sure?' prompt
- warnUser("This job cannot be cancelled.\nJust close the window.",
- "Cancel job");
+ warnUser(
+ MessageManager
+ .getString("warn.job_cannot_be_cancelled_close_window"),
+ MessageManager.getString("action.cancel_job"));
}
else
{
@@ -767,41 +803,62 @@ public class WebserviceInfo extends GWebserviceInfo implements
switch (currentStatus)
{
case STATE_QUEUING:
- g.drawString(title.concat(" - queuing"), 60, 30);
+ g.drawString(
+ title.concat(" - ").concat(
+ MessageManager.getString("label.state_queueing")),
+ 60, 30);
break;
case STATE_RUNNING:
- g.drawString(title.concat(" - running"), 60, 30);
+ g.drawString(
+ title.concat(" - ").concat(
+ MessageManager.getString("label.state_running")),
+ 60, 30);
break;
case STATE_STOPPED_OK:
- g.drawString(title.concat(" - complete"), 60, 30);
+ g.drawString(
+ title.concat(" - ").concat(
+ MessageManager.getString("label.state_completed")),
+ 60, 30);
break;
case STATE_CANCELLED_OK:
- g.drawString(title.concat(" - job cancelled!"), 60, 30);
+ g.drawString(
+ title.concat(" - ").concat(
+ MessageManager
+ .getString("label.state_job_cancelled")),
+ 60, 30);
break;
case STATE_STOPPED_ERROR:
- g.drawString(title.concat(" - job error!"), 60, 30);
+ g.drawString(
+ title.concat(" - ").concat(
+ MessageManager.getString("label.state_job_error")),
+ 60, 30);
break;
case STATE_STOPPED_SERVERERROR:
- g.drawString(title.concat(" - Server Error! (try later)"), 60, 30);
+ g.drawString(
+ title.concat(" - ").concat(
+ MessageManager
+ .getString("label.server_error_try_later")),
+ 60, 30);
break;
}
if (image != null)
{
- g.rotate(Math.toRadians(angle), 28, 28);
+ int x = image.getWidth(this) / 2, y = image.getHeight(this) / 2;
+ g.rotate(Math.toRadians(angle), 10 + x, 10 + y);
g.drawImage(image, 10, 10, this);
- g.rotate(-Math.toRadians(angle), 28, 28);
+ g.rotate(-Math.toRadians(angle), 10 + x, 10 + y);
}
}
@@ -822,21 +879,34 @@ public class WebserviceInfo extends GWebserviceInfo implements
public void hyperlinkUpdate(HyperlinkEvent e)
{
- if (e.getEventType() == EventType.ACTIVATED)
- {
- String url=null;
- try
- {
- url = e.getURL().toString();
- Desktop.showUrl(url);
- } catch (Exception x)
- {
- if (url!=null) {
- Cache.log.error("Couldn't handle string "+url+" as a URL.");
- }
- // ignore any exceptions due to dud links.
- }
+ Desktop.hyperlinkUpdate(e);
+ }
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
+ */
+ @Override
+ public void setProgressBar(String message, long id)
+ {
+ progressBar.setProgressBar(message, id);
+ }
+
+ @Override
+ public void registerHandler(final long id,
+ final IProgressIndicatorHandler handler)
+ {
+ progressBar.registerHandler(id, handler);
+ }
+
+ /**
+ *
+ * @return true if any progress bars are still active
+ */
+ @Override
+ public boolean operationInProgress()
+ {
+ return progressBar.operationInProgress();
}
}
diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java
index b199489..b3e40c1 100644
--- a/src/jalview/gui/WsJobParameters.java
+++ b/src/jalview/gui/WsJobParameters.java
@@ -1,38 +1,40 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
import jalview.gui.OptsAndParamsPage.OptionBox;
import jalview.gui.OptsAndParamsPage.ParamBox;
+import jalview.util.MessageManager;
import jalview.ws.jws2.JabaParamStore;
import jalview.ws.jws2.JabaPreset;
import jalview.ws.jws2.Jws2Discoverer;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.OptionI;
import jalview.ws.params.ParamDatastoreI;
import jalview.ws.params.ParameterI;
-import jalview.ws.params.ValueConstrainI;
import jalview.ws.params.WsParamSetI;
import java.awt.BorderLayout;
import java.awt.Component;
-import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
@@ -42,50 +44,40 @@ import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.HierarchyBoundsListener;
+import java.awt.event.HierarchyEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.net.URL;
-import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Vector;
import javax.swing.JButton;
-import javax.swing.JCheckBox;
import javax.swing.JComboBox;
-import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
-import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
-import javax.swing.JSlider;
import javax.swing.JSplitPane;
-import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
-import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import net.miginfocom.swing.MigLayout;
+
import compbio.metadata.Argument;
import compbio.metadata.Option;
import compbio.metadata.Parameter;
import compbio.metadata.Preset;
import compbio.metadata.PresetManager;
import compbio.metadata.RunnerConfig;
-import compbio.metadata.ValueConstrain.Type;
/**
* job parameter editing/browsing dialog box. User can browse existing settings
@@ -126,21 +118,16 @@ public class WsJobParameters extends JPanel implements ItemListener,
*/
JPanel paramList = new JPanel();
-
-
JPanel SetNamePanel = new JPanel();
JPanel setDetails = new JPanel();
JSplitPane settingsPanel = new JSplitPane();
- JSplitPane jobPanel = new JSplitPane();
-
+ JPanel jobPanel = new JPanel();
JScrollPane jobOptionsPane = new JScrollPane();
- JPanel jobParameters = new JPanel();
-
JButton createpref = new JButton();
JButton deletepref = new JButton();
@@ -159,7 +146,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
JScrollPane paramPane = new JScrollPane();
-
+ // ScrollablePanel optsAndparams = new ScrollablePanel();
JPanel optsAndparams = new JPanel();
RunnerConfig serviceOptions;
@@ -231,25 +218,28 @@ public class WsJobParameters extends JPanel implements ItemListener,
frame = new JDialog(Desktop.instance, true);
- frame.setTitle("Edit parameters for " + service.getActionText());
+ frame.setTitle(MessageManager.formatMessage("label.edit_params_for",
+ new String[] { service.getActionText() }));
Rectangle deskr = Desktop.instance.getBounds();
Dimension pref = this.getPreferredSize();
- frame.setBounds(new Rectangle((int) (deskr.getCenterX() - pref.width/2),
- (int) (deskr.getCenterY() - pref.height/2), pref.width, pref.height));
+ frame.setBounds(new Rectangle(
+ (int) (deskr.getCenterX() - pref.width / 2), (int) (deskr
+ .getCenterY() - pref.height / 2), pref.width,
+ pref.height));
frame.setContentPane(this);
-
+
// should perhaps recover defaults from user prefs.
frame.validate();
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
- public void run()
- {
- jobPanel.setDividerLocation(0.25);
+ public void run()
+ {
+ // jobPanel.setDividerLocation(0.25);
- }
- });
- frame.setVisible(true);
+ }
+ });
+ frame.setVisible(true);
if (response > 0)
{
@@ -260,8 +250,25 @@ public class WsJobParameters extends JPanel implements ItemListener,
private void jbInit()
{
- updatepref = JvSwingUtils.makeButton("Update",
- "Update this existing user parameter set.",
+ this.addHierarchyBoundsListener(new HierarchyBoundsListener()
+ {
+
+ @Override
+ public void ancestorResized(HierarchyEvent arg0)
+ {
+ refreshParamLayout();
+ }
+
+ @Override
+ public void ancestorMoved(HierarchyEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ updatepref = JvSwingUtils.makeButton(
+ MessageManager.getString("action.update"),
+ MessageManager.getString("label.update_user_parameter_set"),
new ActionListener()
{
@@ -270,8 +277,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
update_actionPerformed(e);
}
});
- deletepref = JvSwingUtils.makeButton("Delete",
- "Delete the currently selected user parameter set.",
+ deletepref = JvSwingUtils.makeButton(
+ MessageManager.getString("action.delete"),
+ MessageManager.getString("label.delete_user_parameter_set"),
new ActionListener()
{
@@ -280,8 +288,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
delete_actionPerformed(e);
}
});
- createpref = JvSwingUtils.makeButton("Create",
- "Create a new parameter set with the current settings.",
+ createpref = JvSwingUtils.makeButton(
+ MessageManager.getString("action.create"),
+ MessageManager.getString("label.create_user_parameter_set"),
new ActionListener()
{
@@ -290,8 +299,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
create_actionPerformed(e);
}
});
- revertpref = JvSwingUtils.makeButton("Revert",
- "Undo all changes to the current parameter set",
+ revertpref = JvSwingUtils.makeButton(MessageManager
+ .getString("action.revert"), MessageManager
+ .getString("label.revert_changes_user_parameter_set"),
new ActionListener()
{
@@ -300,16 +310,20 @@ public class WsJobParameters extends JPanel implements ItemListener,
revert_actionPerformed(e);
}
});
- startjob = JvSwingUtils.makeButton("Start Job",
- "Start Job with current settings.", new ActionListener()
+ startjob = JvSwingUtils.makeButton(
+ MessageManager.getString("action.start_job"),
+ MessageManager.getString("label.start_job_current_settings"),
+ new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
startjob_actionPerformed(e);
}
});
- canceljob = JvSwingUtils.makeButton("Cancel Job",
- "Close this dialog and cancel job.", new ActionListener()
+ canceljob = JvSwingUtils.makeButton(
+ MessageManager.getString("action.cancel_job"),
+ MessageManager.getString("label.cancel_job_close_dialog"),
+ new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
@@ -317,7 +331,8 @@ public class WsJobParameters extends JPanel implements ItemListener,
}
});
- setDetails.setBorder(new TitledBorder("Details"));
+ setDetails.setBorder(new TitledBorder(MessageManager
+ .getString("label.details")));
setDetails.setLayout(new BorderLayout());
setDescr.setColumns(40);
setDescr.setWrapStyleWord(true);
@@ -325,9 +340,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
setDescr.setBackground(getBackground());
setDescr.setEditable(true);
setDescr.getDocument().addDocumentListener(this);
- setDescr.setToolTipText("Click to edit the notes for this parameter set.");
+ setDescr.setToolTipText(MessageManager
+ .getString("label.edit_notes_parameter_set"));
JScrollPane setDescrView = new JScrollPane();
- // setDescrView.setPreferredSize(new Dimension(350, 200));
setDescrView.getViewport().setView(setDescr);
setName.setEditable(true);
setName.addItemListener(this);
@@ -336,12 +351,13 @@ public class WsJobParameters extends JPanel implements ItemListener,
GridBagLayout gbl = new GridBagLayout();
SetNamePanel.setLayout(gbl);
- JLabel setNameLabel = new JLabel("Current parameter set name :");
+ JLabel setNameLabel = new JLabel(
+ MessageManager.getString("label.current_parameter_set_name"));
setNameLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
-
+
setNameInfo.add(setNameLabel);
setNameInfo.add(setName);
-
+
// initial button visibility
updatepref.setVisible(false);
deletepref.setVisible(false);
@@ -352,13 +368,13 @@ public class WsJobParameters extends JPanel implements ItemListener,
((FlowLayout) setsavebuts.getLayout()).setHgap(10);
((FlowLayout) setsavebuts.getLayout()).setVgap(0);
JPanel spacer = new JPanel();
- spacer.setPreferredSize(new Dimension(2,30));
+ spacer.setPreferredSize(new Dimension(2, 30));
setsavebuts.add(spacer);
setsavebuts.add(deletepref);
setsavebuts.add(revertpref);
setsavebuts.add(createpref);
setsavebuts.add(updatepref);
-// setsavebuts.setSize(new Dimension(150, 30));
+ // setsavebuts.setSize(new Dimension(150, 30));
JPanel buttonArea = new JPanel(new GridLayout(1, 1));
buttonArea.add(setsavebuts);
SetNamePanel.add(setNameInfo);
@@ -373,25 +389,36 @@ public class WsJobParameters extends JPanel implements ItemListener,
gbl.setConstraints(buttonArea, gbc);
setDetails.add(setDescrView, BorderLayout.CENTER);
- jobParameters.setBorder(new TitledBorder("Parameters"));
- paramPane.setPreferredSize(new Dimension(360, 400));
- jobOptions.setBorder(new TitledBorder("Options"));
-
- paramList.setBorder(new TitledBorder("Parameters"));
-
- JPanel bjo=new JPanel(new BorderLayout()),bjp=new JPanel(new BorderLayout());
+ // paramPane.setPreferredSize(new Dimension(360, 400));
+ // paramPane.setPreferredSize(null);
+ jobOptions.setBorder(new TitledBorder(MessageManager
+ .getString("label.options")));
+ jobOptions.setOpaque(true);
+ paramList.setBorder(new TitledBorder(MessageManager
+ .getString("label.parameters")));
+ paramList.setOpaque(true);
+ JPanel bjo = new JPanel(new BorderLayout()), bjp = new JPanel(
+ new BorderLayout());
bjo.add(jobOptions, BorderLayout.CENTER);
bjp.add(paramList, BorderLayout.CENTER);
- optsAndparams.setLayout(new BorderLayout());
-
- optsAndparams.add(bjo, BorderLayout.CENTER);
- optsAndparams.add(bjp, BorderLayout.SOUTH);
- paramPane.setViewportView(optsAndparams);
-
+ bjp.setOpaque(true);
+ bjo.setOpaque(true);
+ // optsAndparams.setScrollableWidth(ScrollableSizeHint.FIT);
+ // optsAndparams.setScrollableHeight(ScrollableSizeHint.NONE);
+ // optsAndparams.setLayout(new BorderLayout());
+ optsAndparams.setLayout(new BorderLayout());
+ optsAndparams.add(jobOptions, BorderLayout.NORTH);
+ optsAndparams.add(paramList, BorderLayout.CENTER);
+ JPanel jp = new JPanel(new BorderLayout());
+ jp.add(optsAndparams, BorderLayout.CENTER);
+ paramPane.getViewport().setView(jp);
+ paramPane.setBorder(null);
setLayout(new BorderLayout());
- jobPanel.setLeftComponent(setDetails);
- jobPanel.setRightComponent(paramPane);
- jobPanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
+ jobPanel.setPreferredSize(null);
+ jobPanel.setLayout(new BorderLayout());
+ jobPanel.add(setDetails, BorderLayout.NORTH);
+ jobPanel.add(paramPane, BorderLayout.CENTER);
+ // jobPanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
add(SetNamePanel, BorderLayout.NORTH);
add(jobPanel, BorderLayout.CENTER);
@@ -399,13 +426,19 @@ public class WsJobParameters extends JPanel implements ItemListener,
JPanel dialogpanel = new JPanel();
dialogpanel.add(startjob);
dialogpanel.add(canceljob);
+ // JAL-1580: setMaximumSize() doesn't work, so just size for the worst case:
+ // check for null is for JUnit usage
+ final int windowHeight = Desktop.instance == null ? 540
+ : Desktop.instance.getHeight();
+ setPreferredSize(new Dimension(540, windowHeight));
add(dialogpanel, BorderLayout.SOUTH);
+ validate();
}
protected void revert_actionPerformed(ActionEvent e)
{
reInitDialog(lastParmSet);
-
+ updateWebServiceMenus();
}
protected void update_actionPerformed(ActionEvent e)
@@ -434,6 +467,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
_deleteUserPreset(lastParmSet);
}
reInitDialog(null); // service default
+ updateWebServiceMenus();
}
protected void create_actionPerformed(ActionEvent e)
@@ -444,7 +478,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
_storeCurrentPreset(curname);
lastParmSet = curname;
isUserPreset = true;
+ reInitDialog(curname);
initArgSetModified();
+ updateWebServiceMenus();
}
else
{
@@ -499,7 +535,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
Hashtable exnames = new Hashtable();
for (int i = 0, iSize = setName.getItemCount(); i < iSize; i++)
{
- exnames.put((String) setName.getItemAt(i), setName.getItemAt(i));
+ exnames.put(setName.getItemAt(i), setName.getItemAt(i));
}
servicePresets = new Hashtable();
// Add the default entry - if not present already.
@@ -537,7 +573,10 @@ public class WsJobParameters extends JPanel implements ItemListener,
if (jobArgset != null && jobArgset.size() > 0)
{
curSetName = "Supplied Settings";
+ isUserPreset = false;
updateTable(p, jobArgset);
+ setName.setSelectedItem(curSetName);
+ updateButtonDisplay();
}
else
{
@@ -552,18 +591,32 @@ public class WsJobParameters extends JPanel implements ItemListener,
@SuppressWarnings("unchecked")
private void updateTable(WsParamSetI p, List<ArgumentI> jobArgset)
{
+ boolean setDefaultParams = false;
+ if (lastParmSet == null)
+ {
+ isUserPreset = false;
+ // First call - so provide Service default settings
+ setName.setSelectedItem(lastSetName = SVC_DEF);
+ }
+ if (p == null && SVC_DEF.equals("" + setName.getSelectedItem()))
+ {
+ // indicate that service defaults should be set if available
+ setDefaultParams = true;
+ }
// populate table from default parameter set.
List<ArgumentI> args = paramStore.getServiceParameters();
// split to params and required arguments
{
+ int cw = 0;
+ boolean optset = false;
for (ArgumentI myarg : args)
{
// Ideally, Argument would implement isRequired !
if (myarg instanceof ParameterI)
{
ParameterI parm = (ParameterI) myarg;
- paramList.add(opanp.addParameter(parm));
+ opanp.addParameter(parm).validate();
}
else
{
@@ -571,13 +624,13 @@ public class WsJobParameters extends JPanel implements ItemListener,
{
OptionI opt = (OptionI) myarg;
OptionBox ob = opanp.addOption(opt);
- jobOptions.add(ob, FlowLayout.LEFT);
- ob.resetToDefault();
+ ob.resetToDefault(setDefaultParams);
if (MAX_OPTWIDTH < ob.getPreferredSize().width)
{
MAX_OPTWIDTH = ob.getPreferredSize().width;
}
-
+ ob.validate();
+ cw += ob.getPreferredSize().width + 5;
}
else
{
@@ -605,16 +658,6 @@ public class WsJobParameters extends JPanel implements ItemListener,
// TODO: check if args should be unselected prior to resetting using the
// preset
}
- else
- {
- if (lastParmSet == null)
- {
- isUserPreset = false;
- // first call - so create a dummy name
-
- setName.setSelectedItem(lastSetName = SVC_DEF);
- }
- }
if (jobArgset != null)
{
@@ -784,62 +827,121 @@ public class WsJobParameters extends JPanel implements ItemListener,
settingDialog = stn;
}
-
public void refreshParamLayout()
{
+ // optsAndparams.setPreferredSize(null);
FlowLayout fl = new FlowLayout(FlowLayout.LEFT);
- int sep=fl.getVgap();
- int os=0,s = jobOptions.getBorder().getBorderInsets(jobOptions).bottom+jobOptions.getBorder().getBorderInsets(jobOptions).top+2 * sep;
- int w = 2 * fl.getHgap() + (MAX_OPTWIDTH > OptsAndParamsPage.PARAM_WIDTH ? MAX_OPTWIDTH : OptsAndParamsPage.PARAM_WIDTH);
- jobOptions.setLayout(fl);
+ int sep = fl.getVgap();
+ boolean fh = true;
+ int os = 0, s = jobOptions.getBorder().getBorderInsets(jobOptions).bottom
+ + jobOptions.getBorder().getBorderInsets(jobOptions).top
+ + 2
+ * sep;
+ /**
+ * final height for viewport
+ */
+ int finalh = s;
+ int panewidth = paramPane.getViewport().getSize().width - 120
+ - jobOptions.getBorder().getBorderInsets(jobOptions).left
+ + jobOptions.getBorder().getBorderInsets(jobOptions).right;
+
+ int w = 2
+ * fl.getHgap()
+ + (MAX_OPTWIDTH > OptsAndParamsPage.PARAM_WIDTH ? MAX_OPTWIDTH
+ : OptsAndParamsPage.PARAM_WIDTH);
+ int hgap = fl.getHgap(), cw = hgap;
+
if (opanp.getOptSet().size() > 0)
{
-
+
+ jobOptions.setLayout(new MigLayout("", "", ""));
+ jobOptions.removeAll();
+
for (OptionBox pbox : opanp.getOptSet().values())
{
- pbox.revalidate();
- s += sep + pbox.getPreferredSize().height;
+ pbox.validate();
+ cw += pbox.getSize().width + hgap;
+ if (cw + 120 > panewidth)
+ {
+ jobOptions.add(pbox, "wrap");
+ // System.out.println("Wrap on "+pbox.option.getName());
+ cw = hgap + pbox.getSize().width;
+ fh = true;
+ }
+ else
+ {
+ jobOptions.add(pbox);
+ }
+ if (fh)
+ {
+ finalh += pbox.getSize().height + fl.getVgap();
+ fh = false;
+ }
}
- jobOptions.setPreferredSize(new Dimension(w, s));
- jobOptions.setLayout(new GridLayout(opanp.getOptSet().size(),1));
- os=s;
+ jobOptions.revalidate();
}
else
{
jobOptions.setVisible(false);
}
- // Now layout the parameters assuming they occupy one column - to calculate total height of options+parameters
- fl = new FlowLayout(FlowLayout.CENTER);
- // helpful hint from http://stackoverflow.com/questions/2743177/top-alignment-for-flowlayout
+ // Now layout the parameters assuming they occupy one column - to calculate
+ // total height of options+parameters
+ fl = new FlowLayout(FlowLayout.LEFT);
+ // helpful hint from
+ // http://stackoverflow.com/questions/2743177/top-alignment-for-flowlayout
fl.setAlignOnBaseline(true);
if (opanp.getParamSet().size() > 0)
{
- paramList.setLayout(fl);
-
- s = 2 * sep;
+ paramList.removeAll();
+ paramList.setLayout(new MigLayout("", "", ""));
+ fh = true;
for (ParamBox pbox : opanp.getParamSet().values())
{
pbox.validate();
- s += sep + pbox.getPreferredSize().height+pbox.getBorder().getBorderInsets(pbox).bottom;
+ cw += pbox.getSize().width + hgap;
+ if (cw + 160 > panewidth)
+ {
+ paramList.add(pbox, "wrap");
+ cw = pbox.getSize().width + hgap;
+ fh = true;
+ }
+ else
+ {
+ paramList.add(pbox);
+ }
+ if (fh)
+ {
+ finalh += pbox.getSize().height + fl.getVgap();
+ fh = false;
+ }
+
}
-
- paramList.setPreferredSize(new Dimension(w, s));
- os+=s+2*sep+paramList.getBorder().getBorderInsets(paramList).bottom+paramList.getBorder().getBorderInsets(paramList).top;
+ /*
+ * s = 2 * sep; for (ParamBox pbox : opanp.getParamSet().values()) {
+ * pbox.validate(); s += sep +
+ * pbox.getPreferredSize().height+pbox.getBorder
+ * ().getBorderInsets(pbox).bottom; }
+ *
+ * // paramList.setPreferredSize(new Dimension(w, s));
+ * os+=s+2*sep+paramList
+ * .getBorder().getBorderInsets(paramList).bottom+paramList
+ * .getBorder().getBorderInsets(paramList).top;
+ */
+ paramList.revalidate();
}
else
{
paramList.setVisible(false);
}
- // TODO: waste some time trying to eliminate any unnecessary .validate calls here
- paramList.validate();
- jobOptions.validate();
+ // TODO: waste some time trying to eliminate any unnecessary .validate calls
+ // here
// System.out.println("Size will be : "+w+","+os);
- optsAndparams.validate();
- paramPane.getViewport().validate();
- paramPane.getVerticalScrollBar().setBlockIncrement(OptsAndParamsPage.PARAM_CLOSEDHEIGHT*2);
- paramPane.validate();
- validate();
+ // optsAndparams.setPreferredSize(null);
+ // paramPane.getViewport().setView(optsAndparams);
+ paramPane.getViewport().setAutoscrolls(true);
+ paramPane.revalidate();
+ revalidate();
}
/**
@@ -856,7 +958,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
{
Vector<String> services = new Vector<String>();
services.addElement(args[p++]);
- Jws2Discoverer.setServiceUrls(services);
+ Jws2Discoverer.getDiscoverer().setServiceUrls(services);
}
try
{
@@ -867,8 +969,8 @@ public class WsJobParameters extends JPanel implements ItemListener,
e.printStackTrace();
return;
}
- Jws2Discoverer.Jws2Instance lastserv = null;
- for (Jws2Discoverer.Jws2Instance service : disc.getServices())
+ Jws2Instance lastserv = null;
+ for (Jws2Instance service : disc.getServices())
{
lastserv = service;
if (p >= args.length || service.serviceType.equalsIgnoreCase(args[p]))
@@ -997,8 +1099,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
}
WsJobParameters pgui = new WsJobParameters(lastserv,
new JabaPreset(lastserv, pr));
- JFrame jf = new JFrame("Parameters for "
- + lastserv.getActionText());
+ JFrame jf = new JFrame(MessageManager.formatMessage(
+ "label.ws_parameters_for",
+ new String[] { lastserv.getActionText() }));
JPanel cont = new JPanel(new BorderLayout());
pgui.validate();
cont.setPreferredSize(pgui.getPreferredSize());
@@ -1071,6 +1174,12 @@ public class WsJobParameters extends JPanel implements ItemListener,
}
}
+ public boolean isServiceDefaults()
+ {
+ return (!isModified() && (lastParmSet != null && lastParmSet
+ .equals(SVC_DEF)));
+ }
+
public List<ArgumentI> getJobParams()
{
return opanp.getCurrentSettings();
@@ -1191,7 +1300,18 @@ public class WsJobParameters extends JPanel implements ItemListener,
SetNamePanel.validate();
validate();
settingDialog = false;
+ }
+ /**
+ * Rebuild the AlignFrame web service menus (after add/delete of a preset
+ * option).
+ */
+ protected void updateWebServiceMenus()
+ {
+ for (AlignFrame alignFrame : Desktop.getAlignFrames())
+ {
+ alignFrame.BuildWebServiceMenu();
+ }
}
String curSetName = null;
@@ -1302,7 +1422,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
if (src.getParent() == setName)
{
// rename any existing records we know about for this set.
- String newname = (String) e.getActionCommand().trim();
+ String newname = e.getActionCommand().trim();
String msg = null;
if (isServicePreset(newname))
{
@@ -1316,9 +1436,10 @@ public class WsJobParameters extends JPanel implements ItemListener,
{
public void run()
{
- JOptionPane.showMessageDialog(ourframe,
- "Invalid name - preset already exists.",
- "Invalid name", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(ourframe, MessageManager
+ .getString("label.invalid_name_preset_exists"),
+ MessageManager.getString("label.invalid_name"),
+ JOptionPane.WARNING_MESSAGE);
}
});
diff --git a/src/jalview/gui/WsParamSetManager.java b/src/jalview/gui/WsParamSetManager.java
index f7d6bc4..687c9f3 100644
--- a/src/jalview/gui/WsParamSetManager.java
+++ b/src/jalview/gui/WsParamSetManager.java
@@ -1,24 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
+import jalview.bin.Cache;
+import jalview.io.JalviewFileChooser;
+import jalview.util.MessageManager;
+import jalview.ws.params.ParamDatastoreI;
+import jalview.ws.params.ParamManager;
+import jalview.ws.params.WsParamSetI;
+
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -29,16 +38,8 @@ import java.util.Hashtable;
import java.util.List;
import java.util.StringTokenizer;
-import javax.swing.JButton;
import javax.swing.JOptionPane;
-import jalview.bin.Cache;
-import jalview.io.JalviewFileChooser;
-import jalview.ws.jws2.dm.JabaWsParamSet;
-import jalview.ws.params.ParamDatastoreI;
-import jalview.ws.params.ParamManager;
-import jalview.ws.params.WsParamSetI;
-
/**
* store and retrieve web service parameter sets.
*
@@ -158,7 +159,7 @@ public class WsParamSetManager implements ParamManager
{
if (filename != null && !((outfile = new File(filename)).canWrite()))
{
- Cache.log.info("Can't write to " + filename
+ Cache.log.warn("Can't write to " + filename
+ " - Prompting for new file to write to.");
filename = null;
}
@@ -178,18 +179,20 @@ public class WsParamSetManager implements ParamManager
if (parser == null)
{
throw new Error(
- "Implementation error: Can't find a marshaller for the parameter set");
+ MessageManager
+ .getString("error.implementation_error_cannot_find_marshaller_for_param_set"));
}
if (filename == null)
{
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "wsparams" }, new String[]
- { "Web Service Parameter File" },
+ { "wsparams" },
+ new String[] { "Web Service Parameter File" },
"Web Service Parameter File");
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Choose a filename for this parameter file");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.choose_filename_for_param_file"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(Desktop.instance);
if (value == JalviewFileChooser.APPROVE_OPTION)
{
diff --git a/src/jalview/gui/WsPreferences.java b/src/jalview/gui/WsPreferences.java
index e2482f6..fa29078 100644
--- a/src/jalview/gui/WsPreferences.java
+++ b/src/jalview/gui/WsPreferences.java
@@ -1,37 +1,48 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
+import jalview.bin.Cache;
+import jalview.jbgui.GWsPreferences;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.rest.RestServiceDescription;
+
import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
+import java.util.List;
import java.util.Vector;
-import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
+import javax.swing.JTable;
import javax.swing.JTextField;
-
-import jalview.bin.Cache;
-import jalview.jbgui.GWsPreferences;
-import jalview.ws.rest.RestServiceDescription;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellRenderer;
public class WsPreferences extends GWsPreferences
{
@@ -42,7 +53,9 @@ public class WsPreferences extends GWsPreferences
initFromPreferences();
}
- Vector<String> wsUrls, oldUrls,rsbsUrls,oldRsbsUrls;
+ List<String> wsUrls;
+
+ Vector<String> oldUrls, rsbsUrls, oldRsbsUrls;
private boolean needWsMenuUpdate;
@@ -52,8 +65,8 @@ public class WsPreferences extends GWsPreferences
private void initFromPreferences()
{
- wsUrls = jalview.ws.jws2.Jws2Discoverer.getServiceUrls();
- if (wsUrls != null)
+ wsUrls = Jws2Discoverer.getDiscoverer().getServiceUrls();
+ if (!wsUrls.isEmpty())
{
oldUrls = new Vector<String>(wsUrls);
}
@@ -62,6 +75,8 @@ public class WsPreferences extends GWsPreferences
oldUrls = null;
wsUrls = new Vector<String>();
}
+ wsList.setDefaultRenderer(Integer.class, new JabaWSStatusRenderer());
+ wsList.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
updateList();
rsbsUrls = jalview.ws.rest.RestClient.getRsbsDescriptions();
if (rsbsUrls != null)
@@ -103,7 +118,120 @@ public class WsPreferences extends GWsPreferences
private void updateList()
{
- wsList.setListData(wsUrls);
+ Object tdat[][] = new Object[wsUrls.size()][2];
+ int r = 0;
+ for (String url : wsUrls)
+ {
+ int status = Jws2Discoverer.getDiscoverer().getServerStatusFor(url);
+ tdat[r][1] = new Integer(status);
+ tdat[r++][0] = url;
+ }
+
+ wsList.setModel(new WsUrlTableModel(tdat));
+ wsList.getColumn(MessageManager.getString("label.status")).setMinWidth(
+ 10);
+ }
+
+ private class JabaWSStatusRenderer extends JPanel implements
+ TableCellRenderer
+ {
+ public JabaWSStatusRenderer()
+ {
+ setOpaque(true);
+ setMinimumSize(new Dimension(10, 10));
+ // setText(" ");
+
+ }
+
+ /**
+ * render an Integer reflecting service status as a colour and symbol
+ */
+
+ @Override
+ public Component getTableCellRendererComponent(JTable arg0,
+ Object status, boolean isSelected, boolean hasFocus, int row,
+ int column)
+ {
+ Color c;
+ String t = new String("");
+ switch (((Integer) status).intValue())
+ {
+ case 1:
+ // cb.setSelected(true);
+ // cb.setBackground(
+ c = Color.green;
+ break;
+ case 0:
+ // cb.setSelected(true);
+ // cb.setBackground(
+ c = Color.lightGray;
+ break;
+ case -1:
+ // cb.setSelected(false);
+ // cb.setBackground(
+ c = Color.red;
+ break;
+ default:
+ // cb.setSelected(false);
+ // cb.setBackground(
+ c = Color.orange;
+ }
+ setBackground(c);
+ // setText(t);
+ return this;
+
+ }
+
+ }
+
+ private class WsUrlTableModel extends AbstractTableModel
+ {
+
+ private Object[][] data;
+
+ private String[] columnNames = new String[] {
+ MessageManager.getString("label.service_url"),
+ MessageManager.getString("label.status") };
+
+ public WsUrlTableModel(Object[][] tdat)
+ {
+ this.data = tdat;
+ }
+
+ @Override
+ public int getColumnCount()
+ {
+ return 2;
+ }
+
+ @Override
+ public String getColumnName(int column)
+ {
+ return columnNames[column];
+ }
+
+ @Override
+ public int getRowCount()
+ {
+ if (data == null)
+ {
+ return 0;
+ }
+ return data.length;
+ }
+
+ @Override
+ public java.lang.Class<?> getColumnClass(int columnIndex)
+ {
+ return getValueAt(0, columnIndex).getClass();
+ };
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex)
+ {
+ return data[rowIndex][columnIndex];
+ }
+
}
private void updateRsbsList()
@@ -113,7 +241,7 @@ public class WsPreferences extends GWsPreferences
private void updateServiceList()
{
- jalview.ws.jws2.Jws2Discoverer.setServiceUrls(wsUrls);
+ Jws2Discoverer.getDiscoverer().setServiceUrls(wsUrls);
}
private void updateRsbsServiceList()
@@ -131,10 +259,10 @@ public class WsPreferences extends GWsPreferences
@Override
protected void deleteWsUrl_actionPerformed(ActionEvent e)
{
- int sel = wsList.getSelectedIndex();
+ int sel = wsList.getSelectedRow();
if (sel > -1)
{
- wsUrls.removeElementAt(sel);
+ wsUrls.remove(sel);
update++;
updateList();
}
@@ -149,61 +277,69 @@ public class WsPreferences extends GWsPreferences
@Override
protected void editWsUrl_actionPerformed(ActionEvent e)
{
- int sel = wsList.getSelectedIndex();
+ int sel = wsList.getSelectedRow();
if (sel > -1)
{
- String url = editUrl(wsUrls.elementAt(sel), "Edit JABAWS URL");
+ String url = editUrl(wsUrls.get(sel),
+ MessageManager.getString("label.edit_jabaws_url"));
if (url != null)
{
int present = wsUrls.indexOf(url);
if (present == -1)
{
update++;
- wsUrls.setElementAt(url, sel);
+ wsUrls.set(sel, url);
updateList();
}
else
{
if (present != sel)
{
- wsUrls.removeElementAt(sel);
+ wsUrls.remove(sel);
updateList();
}
}
}
}
}
+
@Override
protected void newSbrsUrl_actionPerformed(ActionEvent e)
{
RestServiceEditorPane rse = new RestServiceEditorPane();
- rse.showDialog("Add a new Simple Bioinformatics Rest Service");
+ rse.showDialog(MessageManager.getString("label.add_new_sbrs_service"));
String rservice = rse.getEditedRestService();
- if (rservice!=null && !rsbsUrls.contains(rservice))
+ if (rservice != null && !rsbsUrls.contains(rservice))
{
rsbsUrls.add(rservice);
update++;
updateRsbsList();
}
}
+
@Override
protected void editSbrsUrl_actionPerformed(ActionEvent e)
{
int sel = sbrsList.getSelectedIndex();
if (sel > -1)
{
- RestServiceEditorPane rse = new RestServiceEditorPane(new RestServiceDescription(rsbsUrls.elementAt(sel)));
- rse.showDialog("Edit Simple Bioinformatics Rest Service entry");
+ RestServiceEditorPane rse = new RestServiceEditorPane(
+ new RestServiceDescription(rsbsUrls.elementAt(sel)));
+ rse.showDialog(MessageManager.getString("label.edit_sbrs_entry"));
String rservice = rse.getEditedRestService();
- if (rservice!=null)
+ if (rservice != null)
{
int present = rsbsUrls.indexOf(rservice);
- if (present==-1) {
+ if (present == -1)
+ {
update++;
- rsbsUrls.setElementAt(rservice,sel);
+ rsbsUrls.setElementAt(rservice, sel);
updateRsbsList();
- } else {
- if (present!=sel) {
+ }
+ else
+ {
+ if (present != sel)
+ {
rsbsUrls.removeElementAt(sel);
update++;
updateRsbsList();
@@ -212,17 +348,21 @@ public class WsPreferences extends GWsPreferences
}
}
}
-
+
void updateWsMenuConfig(boolean old)
{
if (old)
{
- if (oldUrls!=wsUrls || (wsUrls!=null && oldUrls!=null && !wsUrls.equals(oldUrls)))
+ if (oldUrls != wsUrls
+ || (wsUrls != null && oldUrls != null && !wsUrls
+ .equals(oldUrls)))
{
update++;
}
wsUrls = (oldUrls == null) ? null : new Vector(oldUrls);
- if (oldRsbsUrls!=rsbsUrls || (rsbsUrls!=null && oldRsbsUrls!=null && !oldRsbsUrls.equals(rsbsUrls)))
+ if (oldRsbsUrls != rsbsUrls
+ || (rsbsUrls != null && oldRsbsUrls != null && !oldRsbsUrls
+ .equals(rsbsUrls)))
{
update++;
}
@@ -249,9 +389,12 @@ public class WsPreferences extends GWsPreferences
"WSMENU_BYTYPE",
Boolean.valueOf(old ? oldIndexByType : indexByType.isSelected())
.toString());
-
- Cache.setProperty("SHOW_WSDISCOVERY_ERRORS",
- Boolean.valueOf(old ? oldWsWarning : displayWsWarning.isSelected()).toString());
+
+ Cache.setProperty(
+ "SHOW_WSDISCOVERY_ERRORS",
+ Boolean.valueOf(
+ old ? oldWsWarning : displayWsWarning.isSelected())
+ .toString());
updateServiceList();
updateRsbsServiceList();
}
@@ -266,14 +409,14 @@ public class WsPreferences extends GWsPreferences
@Override
protected void moveWsUrlDown_actionPerformed(ActionEvent e)
{
- int p = wsList.getSelectedIndex();
+ int p = wsList.getSelectedRow();
if (p > -1 && p < wsUrls.size() - 1)
{
String t = wsUrls.get(p + 1);
- wsUrls.setElementAt(wsUrls.elementAt(p), p + 1);
- wsUrls.setElementAt(t, p);
+ wsUrls.set(p + 1, wsUrls.get(p));
+ wsUrls.set(p, t);
updateList();
- wsList.setSelectedIndex(p + 1);
+ wsList.getSelectionModel().setSelectionInterval(p + 1, p + 1);
update++;
}
}
@@ -288,14 +431,14 @@ public class WsPreferences extends GWsPreferences
@Override
protected void moveWsUrlUp_actionPerformed(ActionEvent e)
{
- int p = wsList.getSelectedIndex();
+ int p = wsList.getSelectedRow();
if (p > 0)
{
String t = wsUrls.get(p - 1);
- wsUrls.setElementAt(wsUrls.elementAt(p), p - 1);
- wsUrls.setElementAt(t, p);
+ wsUrls.set(p - 1, wsUrls.get(p));
+ wsUrls.set(p, t);
updateList();
- wsList.setSelectedIndex(p - 1);
+ wsList.getSelectionModel().setSelectionInterval(p - 1, p - 1);
update++;
}
}
@@ -311,7 +454,8 @@ public class WsPreferences extends GWsPreferences
JTextField urltf = new JTextField(url, 40);
JPanel panel = new JPanel(new BorderLayout());
JPanel pane12 = new JPanel(new BorderLayout());
- pane12.add(new JLabel("URL: "), BorderLayout.CENTER);
+ pane12.add(new JLabel(MessageManager.getString("label.url")),
+ BorderLayout.CENTER);
pane12.add(urltf, BorderLayout.EAST);
panel.add(pane12, BorderLayout.NORTH);
boolean valid = false;
@@ -326,9 +470,9 @@ public class WsPreferences extends GWsPreferences
// TODO: do a better job of checking that the url is a valid discovery
// URL for web services.
String tx = urltf.getText().trim();
- while (tx.length()>0 && tx.lastIndexOf('/')==tx.length()-1)
+ while (tx.length() > 0 && tx.lastIndexOf('/') == tx.length() - 1)
{
- tx = tx.substring(0, tx.length()-1);
+ tx = tx.substring(0, tx.length() - 1);
}
foo = new URL(tx);
valid = true;
@@ -337,28 +481,46 @@ public class WsPreferences extends GWsPreferences
{
valid = false;
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Invalid URL !");
+ MessageManager.getString("label.invalid_url"));
}
}
if (valid && resp == JOptionPane.OK_OPTION)
{
- int validate = JOptionPane
- .showInternalConfirmDialog(
- Desktop.desktop,
- "Validate JabaWS Server ?\n(Look in console output for results)",
- "Test Server?", JOptionPane.YES_NO_OPTION);
+ int validate = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ MessageManager.getString("info.validate_jabaws_server"),
+ MessageManager.getString("label.test_server"),
+ JOptionPane.YES_NO_OPTION);
+
if (validate == JOptionPane.OK_OPTION)
{
- if (jalview.ws.jws2.Jws2Discoverer.testServiceUrl(foo))
+ if (Jws2Discoverer.testServiceUrl(foo))
{
return foo.toString();
}
else
{
- JOptionPane
- .showInternalMessageDialog(
+ int opt = JOptionPane
+ .showInternalOptionDialog(
Desktop.desktop,
- "Service did not pass validation.\nCheck the Jalview Console for more details.");
+ "The Server '"
+ + foo.toString()
+ + "' failed validation,\ndo you want to add it anyway? ",
+ "Server Validation Failed",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.INFORMATION_MESSAGE, null, null, null);
+ if (opt == JOptionPane.YES_OPTION)
+ {
+ return foo.toString();
+ }
+ else
+ {
+ JOptionPane
+ .showInternalMessageDialog(
+ Desktop.desktop,
+ MessageManager
+ .getString("warn.server_didnt_pass_validation"));
+ }
+
}
}
else
@@ -379,19 +541,20 @@ public class WsPreferences extends GWsPreferences
@Override
protected void newWsUrl_actionPerformed(ActionEvent e)
{
- String url = editUrl(null, "Add new JABAWS URL");
+ String url = editUrl(null,
+ MessageManager.getString("label.add_jabaws_url"));
if (url != null)
{
if (!wsUrls.contains(url))
{
- int selind = wsList.getSelectedIndex();
+ int selind = wsList.getSelectedRow();
if (selind > -1)
{
- wsUrls.insertElementAt(url, selind);
+ wsUrls.add(selind, url);
}
else
{
- wsUrls.addElement(url);
+ wsUrls.add(url);
}
update++;
updateList();
@@ -446,6 +609,8 @@ public class WsPreferences extends GWsPreferences
lastrefresh = update;
Desktop.instance.startServiceDiscovery(true); // wait around for all
// threads to complete
+ updateList();
+
}
progressBar.setIndeterminate(false);
progressBar.setVisible(false);
@@ -462,12 +627,13 @@ public class WsPreferences extends GWsPreferences
public void run()
{
long ct = System.currentTimeMillis();
- Desktop.instance.setProgressBar("Refreshing Web Service Menus",
- ct);
+ Desktop.instance.setProgressBar(MessageManager
+ .getString("status.refreshing_web_service_menus"), ct);
if (lastrefresh != update)
{
lastrefresh = update;
Desktop.instance.startServiceDiscovery(true);
+ updateList();
}
Desktop.instance.setProgressBar(null, ct);
}
@@ -491,14 +657,15 @@ public class WsPreferences extends GWsPreferences
@Override
protected void resetWs_actionPerformed(ActionEvent e)
{
- jalview.ws.jws2.Jws2Discoverer.setServiceUrls(null);
- Vector nwsUrls = jalview.ws.jws2.Jws2Discoverer.getServiceUrls();
- if (!wsUrls.equals(nwsUrls)) {
+ Jws2Discoverer.getDiscoverer().setServiceUrls(null);
+ List<String> nwsUrls = Jws2Discoverer.getDiscoverer().getServiceUrls();
+ if (!wsUrls.equals(nwsUrls))
+ {
update++;
}
- wsUrls=nwsUrls;
+ wsUrls = nwsUrls;
updateList();
-
+
updateAndRefreshWsMenuConfig(true);
}
diff --git a/src/jalview/httpserver/AbstractRequestHandler.java b/src/jalview/httpserver/AbstractRequestHandler.java
new file mode 100644
index 0000000..64ac2d1
--- /dev/null
+++ b/src/jalview/httpserver/AbstractRequestHandler.java
@@ -0,0 +1,205 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.httpserver;
+
+import java.io.IOException;
+import java.net.BindException;
+import java.util.Collections;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.handler.AbstractHandler;
+
+/**
+ *
+ * @author gmcarstairs
+ *
+ */
+public abstract class AbstractRequestHandler extends AbstractHandler
+{
+
+ /*
+ * The relative path (below context root) of this handler (without /
+ * separators)
+ */
+ private String path;
+
+ /*
+ * The full URI on which this handler listens
+ */
+ private String uri;
+
+ /**
+ * Handle an incoming Http request.
+ */
+ @Override
+ public void handle(String target, Request baseRequest,
+ HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException
+ {
+ try
+ {
+ // dumpRequest(request); // debug
+ processRequest(request, response);
+ } catch (Throwable t)
+ {
+ /*
+ * Set server error status on response
+ */
+ System.err.println("Exception handling request "
+ + request.getRequestURI() + " : " + t.getMessage());
+ if (response.isCommitted())
+ {
+ /*
+ * Can't write an HTTP header once any response content has been written
+ */
+ System.err
+ .println("Unable to return HTTP 500 as response already committed");
+ }
+ else
+ {
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ } finally
+ {
+ response.getWriter().flush();
+ baseRequest.setHandled(true);
+ }
+ }
+
+ /**
+ * Subclasses should override this method to perform request processing
+ *
+ * @param request
+ * @param response
+ * @throws IOException
+ */
+ protected abstract void processRequest(HttpServletRequest request,
+ HttpServletResponse response) throws IOException;
+
+ /**
+ * For debug - writes HTTP request details to stdout
+ *
+ * @param request
+ */
+ protected void dumpRequest(HttpServletRequest request)
+ {
+ System.out.println(request.getMethod());
+ System.out.println(request.getRequestURL());
+ for (String hdr : Collections.list(request.getHeaderNames()))
+ {
+ for (String val : Collections.list(request.getHeaders(hdr)))
+ {
+ System.out.println(hdr + ": " + val);
+ }
+ }
+ for (String param : Collections.list(request.getParameterNames()))
+ {
+ for (String val : request.getParameterValues(param))
+ {
+ System.out.println(param + "=" + val);
+ }
+ }
+ }
+
+ /**
+ * Returns a display name for the handler
+ *
+ * @return
+ */
+ public abstract String getName();
+
+ /**
+ * Deregister this listener and close it down
+ *
+ * @throws Exception
+ */
+ public void shutdown()
+ {
+ try
+ {
+ HttpServer.getInstance().removeHandler(this);
+ stop();
+ } catch (Exception e)
+ {
+ System.err.println("Error stopping " + getName() + ": "
+ + e.getMessage());
+ }
+ }
+
+ /**
+ * Returns the URI on which we are listening
+ *
+ * @return
+ */
+ public String getUri()
+ {
+ return this.uri;
+ }
+
+ /**
+ * Set the URI to this handler
+ *
+ * @param u
+ */
+ protected void setUri(String u)
+ {
+ this.uri = u;
+ }
+
+ /**
+ * Sets the relative path to this handler - do this before registering the
+ * handler.
+ *
+ * @param p
+ */
+ protected void setPath(String p)
+ {
+ this.path = p;
+ }
+
+ /**
+ * Returns the relative path to this handler below the context root (without /
+ * separators)
+ *
+ * @return
+ */
+ public String getPath()
+ {
+ return this.path;
+ }
+
+ /**
+ * Registers the handler with the HttpServer and reports its URI on stdout
+ *
+ * @throws BindException
+ * if no port could be allocated
+ * @throws IllegalStateException
+ * if this method is called before {@link #setPath}
+ */
+ protected void registerHandler() throws BindException
+ {
+ HttpServer.getInstance().registerHandler(this);
+ }
+}
diff --git a/src/jalview/httpserver/HttpServer.java b/src/jalview/httpserver/HttpServer.java
new file mode 100644
index 0000000..1f00df4
--- /dev/null
+++ b/src/jalview/httpserver/HttpServer.java
@@ -0,0 +1,300 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.httpserver;
+
+import jalview.rest.RestHandler;
+
+import java.net.BindException;
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+
+/**
+ * An HttpServer built on Jetty. To use it
+ * <ul>
+ * <li>call getInstance() to create and start the server</li>
+ * <li>call registerHandler to add a handler for a path (below /jalview)</li>
+ * <li>when finished, call removedHandler</li>
+ * </ul>
+ *
+ * @author gmcarstairs
+ * @see http://eclipse.org/jetty/documentation/current/embedding-jetty.html
+ */
+public class HttpServer
+{
+ /*
+ * 'context root' - actually just prefixed to the path for each handler for
+ * now - see registerHandler
+ */
+ private static final String JALVIEW_PATH = "jalview";
+
+ /*
+ * Singleton instance of this server
+ */
+ private static HttpServer instance;
+
+ /*
+ * The Http server
+ */
+ private Server server;
+
+ /*
+ * Registered handlers for context paths
+ */
+ private HandlerCollection contextHandlers;
+
+ /*
+ * Lookup of ContextHandler by its wrapped handler
+ */
+ Map<Handler, ContextHandler> myHandlers = new HashMap<Handler, ContextHandler>();
+
+ /*
+ * The context root for the server
+ */
+ private URI contextRoot;
+
+ /**
+ * Returns the singleton instance of this class.
+ *
+ * @return
+ * @throws BindException
+ */
+ public static HttpServer getInstance() throws BindException
+ {
+ synchronized (HttpServer.class)
+ {
+ if (instance == null)
+ {
+ instance = new HttpServer();
+ }
+ return instance;
+ }
+ }
+
+ /**
+ * Private constructor to enforce use of singleton
+ *
+ * @throws BindException
+ * if no free port can be assigned
+ */
+ private HttpServer() throws BindException
+ {
+ startServer();
+
+ /*
+ * Provides a REST server by default; add more programmatically as required
+ */
+ registerHandler(RestHandler.getInstance());
+ }
+
+ /**
+ * Start the http server
+ *
+ * @throws BindException
+ */
+ private void startServer() throws BindException
+ {
+ try
+ {
+ /*
+ * Create a server with a small number of threads; jetty will allocate a
+ * free port
+ */
+ QueuedThreadPool tp = new QueuedThreadPool(4, 1); // max, min
+ server = new Server(tp);
+ // 2 selector threads to handle incoming connections
+ ServerConnector connector = new ServerConnector(server, 0, 2);
+ // restrict to localhost
+ connector.setHost("localhost");
+ server.addConnector(connector);
+
+ /*
+ * HttpServer shuts down with Jalview process
+ */
+ server.setStopAtShutdown(true);
+
+ /*
+ * Create a mutable set of handlers (can add handlers while the server is
+ * running). Using vanilla handlers here rather than servlets
+ */
+ // TODO how to properly configure context root "/jalview"
+ contextHandlers = new HandlerCollection(true);
+ server.setHandler(contextHandlers);
+ server.start();
+ // System.out.println(String.format(
+ // "HttpServer started with %d threads", server.getThreadPool()
+ // .getThreads()));
+ contextRoot = server.getURI();
+ } catch (Exception e)
+ {
+ System.err.println("Error trying to start HttpServer: "
+ + e.getMessage());
+ try
+ {
+ server.stop();
+ } catch (Exception e1)
+ {
+ e1.printStackTrace();
+ }
+ }
+ if (server == null)
+ {
+ throw new BindException("HttpServer failed to allocate a port");
+ }
+ }
+
+ /**
+ * Returns the URI on which we are listening
+ *
+ * @return
+ */
+ public URI getUri()
+ {
+ return server == null ? null : server.getURI();
+ }
+
+ /**
+ * For debug - write HTTP request details to stdout
+ *
+ * @param request
+ * @param response
+ */
+ protected void dumpRequest(HttpServletRequest request,
+ HttpServletResponse response)
+ {
+ for (String hdr : Collections.list(request.getHeaderNames()))
+ {
+ for (String val : Collections.list(request.getHeaders(hdr)))
+ {
+ System.out.println(hdr + ": " + val);
+ }
+ }
+ for (String param : Collections.list(request.getParameterNames()))
+ {
+ for (String val : request.getParameterValues(param))
+ {
+ System.out.println(param + "=" + val);
+ }
+ }
+ }
+
+ /**
+ * Stop the Http server.
+ */
+ public void stopServer()
+ {
+ if (server != null)
+ {
+ if (server.isStarted())
+ {
+ try
+ {
+ server.stop();
+ } catch (Exception e)
+ {
+ System.err.println("Error stopping Http Server on "
+ + server.getURI() + ": " + e.getMessage());
+ }
+ }
+ }
+ }
+
+ /**
+ * Register a handler for the given path and set its URI
+ *
+ * @param handler
+ * @return
+ * @throws IllegalStateException
+ * if handler path has not been set
+ */
+ public void registerHandler(AbstractRequestHandler handler)
+ {
+ String path = handler.getPath();
+ if (path == null)
+ {
+ throw new IllegalStateException(
+ "Must set handler path before registering handler");
+ }
+
+ // http://stackoverflow.com/questions/20043097/jetty-9-embedded-adding-handlers-during-runtime
+ ContextHandler ch = new ContextHandler();
+ ch.setAllowNullPathInfo(true);
+ ch.setContextPath("/" + JALVIEW_PATH + "/" + path);
+ ch.setResourceBase(".");
+ ch.setClassLoader(Thread.currentThread().getContextClassLoader());
+ ch.setHandler(handler);
+
+ /*
+ * Remember the association so we can remove it later
+ */
+ this.myHandlers.put(handler, ch);
+
+ /*
+ * A handler added to a running server must be started explicitly
+ */
+ contextHandlers.addHandler(ch);
+ try
+ {
+ ch.start();
+ } catch (Exception e)
+ {
+ System.err.println("Error starting handler for " + path + ": "
+ + e.getMessage());
+ }
+
+ handler.setUri(this.contextRoot + ch.getContextPath().substring(1));
+ System.out.println("Jalview " + handler.getName()
+ + " handler started on " + handler.getUri());
+ }
+
+ /**
+ * Removes the handler from the server; more precisely, remove the
+ * ContextHandler wrapping the specified handler
+ *
+ * @param handler
+ */
+ public void removeHandler(AbstractRequestHandler handler)
+ {
+ /*
+ * Have to use this cached lookup table since there is no method
+ * ContextHandler.getHandler()
+ */
+ ContextHandler ch = myHandlers.get(handler);
+ if (ch != null)
+ {
+ contextHandlers.removeHandler(ch);
+ myHandlers.remove(handler);
+ System.out.println("Stopped Jalview " + handler.getName()
+ + " handler on " + handler.getUri());
+ }
+ }
+}
diff --git a/src/jalview/io/AMSAFile.java b/src/jalview/io/AMSAFile.java
index 64f8399..d8cb64f 100644
--- a/src/jalview/io/AMSAFile.java
+++ b/src/jalview/io/AMSAFile.java
@@ -1,23 +1,27 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
public class AMSAFile extends jalview.io.FastaFile
{
diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java
index ad834be..e5c8e04 100644
--- a/src/jalview/io/AlignFile.java
+++ b/src/jalview/io/AlignFile.java
@@ -1,26 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
-import jalview.datamodel.*;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
/**
* DOCUMENT ME!
@@ -37,12 +49,17 @@ public abstract class AlignFile extends FileParse
/**
* Sequences to be added to form a new alignment.
*/
- protected Vector seqs;
+ protected Vector<SequenceI> seqs;
/**
* annotation to be added to generated alignment object
*/
- protected Vector annotations;
+ protected Vector<AlignmentAnnotation> annotations;
+
+ /**
+ * SequenceGroups to be added to the alignment object
+ */
+ protected List<SequenceGroup> seqGroups;
/**
* Properties to be added to generated alignment object
@@ -55,11 +72,17 @@ public abstract class AlignFile extends FileParse
boolean jvSuffix = true;
+ private boolean parseCalled;
+
/**
* Creates a new AlignFile object.
*/
public AlignFile()
{
+ // Shouldn't we init data structures (JBPNote: not sure - initData is for
+ // initialising the structures used for reading from a datasource, and the
+ // bare constructor hasn't got any datasource)
+ initData();
}
/**
@@ -72,11 +95,30 @@ public abstract class AlignFile extends FileParse
*/
public AlignFile(String inFile, String type) throws IOException
{
- super(inFile, type);
+ this(true, inFile, type);
+ }
+ /**
+ * Constructor which (optionally delays) parsing of data from a file of some
+ * specified type.
+ *
+ * @param parseImmediately
+ * if false, need to call 'doParse()' to begin parsing data
+ * @param inFile
+ * Filename to read from.
+ * @param type
+ * What type of file to read from (File, URL)
+ * @throws IOException
+ */
+ public AlignFile(boolean parseImmediately, String inFile, String type)
+ throws IOException
+ {
+ super(inFile, type);
initData();
-
- parse();
+ if (parseImmediately)
+ {
+ doParse();
+ }
}
/**
@@ -88,19 +130,63 @@ public abstract class AlignFile extends FileParse
*/
public AlignFile(FileParse source) throws IOException
{
+ this(true, source);
+ }
+
+ /**
+ * Construct a new parser to read from the position where some other parsing
+ * process left
+ *
+ * @param parseImmediately
+ * if false, need to call 'doParse()' to begin parsing data
+ * @param source
+ */
+ public AlignFile(boolean parseImmediately, FileParse source)
+ throws IOException
+ {
super(source);
initData();
+ if (parseImmediately)
+ {
+ doParse();
+ }
+ }
+
+ /**
+ * called if parsing was delayed till after parser was constructed
+ *
+ * @throws IOException
+ */
+ public void doParse() throws IOException
+ {
+ if (parseCalled)
+ {
+ throw new IOException(
+ "Implementation error: Parser called twice for same data.\n"
+ + "Need to call initData() again before parsing can be reattempted.");
+ }
+ parseCalled = true;
parse();
+ // sets the index of each sequence in the alignment
+ for (int i = 0, c = seqs.size(); i < c; i++)
+ {
+ seqs.get(i).setIndex(i);
+ }
}
/**
* Return the seqs Vector
*/
- public Vector getSeqs()
+ public Vector<SequenceI> getSeqs()
{
return seqs;
}
+ public List<SequenceGroup> getSeqGroups()
+ {
+ return seqGroups;
+ }
+
/**
* Return the Sequences in the seqs Vector as an array of Sequences
*/
@@ -110,7 +196,7 @@ public abstract class AlignFile extends FileParse
for (int i = 0; i < seqs.size(); i++)
{
- s[i] = (SequenceI) seqs.elementAt(i);
+ s[i] = seqs.elementAt(i);
}
return s;
@@ -122,24 +208,44 @@ public abstract class AlignFile extends FileParse
*
* @param al
*/
- public void addAnnotations(Alignment al)
+ public void addAnnotations(AlignmentI al)
{
addProperties(al);
for (int i = 0; i < annotations.size(); i++)
{
- al.addAnnotation((AlignmentAnnotation) annotations.elementAt(i));
+ // detect if annotations.elementAt(i) rna secondary structure
+ // if so then do:
+ /*
+ * SequenceFeature[] pairArray =
+ * Rna.GetBasePairsFromAlignmentAnnotation(annotations.elementAt(i));
+ * Rna.HelixMap(pairArray);
+ */
+ AlignmentAnnotation an = annotations.elementAt(i);
+ an.validateRangeAndDisplay();
+ al.addAnnotation(an);
}
}
/**
+ * register sequence groups on the alignment for **output**
+ *
+ * @param al
+ */
+ public void addSeqGroups(AlignmentI al)
+ {
+ this.seqGroups = al.getGroups();
+
+ }
+
+ /**
* Add any additional information extracted from the file to the alignment
* properties.
*
* @note implicitly called by addAnnotations()
* @param al
*/
- public void addProperties(Alignment al)
+ public void addProperties(AlignmentI al)
{
if (properties != null && properties.size() > 0)
{
@@ -167,7 +273,8 @@ public abstract class AlignFile extends FileParse
if (key == null)
{
throw new Error(
- "Implementation error: Cannot have null alignment property key.");
+ MessageManager
+ .getString("error.implementation_error_cannot_have_null_alignment"));
}
if (value == null)
{
@@ -194,8 +301,10 @@ public abstract class AlignFile extends FileParse
*/
protected void initData()
{
- seqs = new Vector();
- annotations = new Vector();
+ seqs = new Vector<SequenceI>();
+ annotations = new Vector<AlignmentAnnotation>();
+ seqGroups = new ArrayList<SequenceGroup>();
+ parseCalled = false;
}
/**
@@ -206,7 +315,7 @@ public abstract class AlignFile extends FileParse
*/
protected void setSeqs(SequenceI[] s)
{
- seqs = new Vector();
+ seqs = new Vector<SequenceI>();
for (int i = 0; i < s.length; i++)
{
@@ -266,25 +375,29 @@ public abstract class AlignFile extends FileParse
/**
* vector of String[] treeName, newickString pairs
*/
- Vector newickStrings = null;
+ Vector<String[]> newickStrings = null;
protected void addNewickTree(String treeName, String newickString)
{
if (newickStrings == null)
{
- newickStrings = new Vector();
+ newickStrings = new Vector<String[]>();
}
- newickStrings.addElement(new String[]
- { treeName, newickString });
+ newickStrings.addElement(new String[] { treeName, newickString });
}
protected int getTreeCount()
{
- if (newickStrings == null)
+ return newickStrings == null ? 0 : newickStrings.size();
+ }
+
+ public void addGroups(AlignmentI al)
+ {
+
+ for (SequenceGroup sg : getSeqGroups())
{
- return 0;
+ al.addGroup(sg);
}
- return newickStrings.size();
}
}
diff --git a/src/jalview/io/AlignmentProperties.java b/src/jalview/io/AlignmentProperties.java
index 9bb6ea9..bef3795 100644
--- a/src/jalview/io/AlignmentProperties.java
+++ b/src/jalview/io/AlignmentProperties.java
@@ -1,34 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.IOException;
-import java.io.StringWriter;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+
import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.Enumeration;
import java.util.Hashtable;
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-
/**
- * Render associated attributes of an alignment. The heart of this code was refactored from jalview.gui.AlignFrame and jalview.appletgui.AlignFrame
- * TODO: consider extending the html renderer to annotate elements with CSS ids enabling finer output format control.
+ * Render associated attributes of an alignment. The heart of this code was
+ * refactored from jalview.gui.AlignFrame and jalview.appletgui.AlignFrame TODO:
+ * consider extending the html renderer to annotate elements with CSS ids
+ * enabling finer output format control.
*
*/
public class AlignmentProperties
@@ -42,6 +46,7 @@ public class AlignmentProperties
/**
* render the alignment's properties report as text or an HTML fragment
+ *
* @param pw
* @param html
*/
@@ -56,11 +61,15 @@ public class AlignmentProperties
- alignment.getSequenceAt(i).getStart();
avg += size;
if (size > max)
+ {
max = size;
+ }
if (size < min)
+ {
min = size;
+ }
}
- avg = avg / (float) alignment.getHeight();
+ avg = avg / alignment.getHeight();
pw.print(nl);
pw.print("Sequences: " + alignment.getHeight());
pw.print(nl);
diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java
index 69926b5..2872a77 100644
--- a/src/jalview/io/AnnotationFile.java
+++ b/src/jalview/io/AnnotationFile.java
@@ -1,1487 +1,1802 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.io;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
-
-public class AnnotationFile
-{
- public AnnotationFile()
- {
- init();
- }
-
- /**
- * character used to write newlines
- */
- protected String newline = System.getProperty("line.separator");
-
- /**
- * set new line string and reset the output buffer
- *
- * @param nl
- */
- public void setNewlineString(String nl)
- {
- newline = nl;
- init();
- }
-
- public String getNewlineString()
- {
- return newline;
- }
-
- StringBuffer text;
-
- private void init()
- {
- text = new StringBuffer("JALVIEW_ANNOTATION"+newline + "# Created: "
- + new java.util.Date() + newline + newline);
- refSeq = null;
- refSeqId = null;
- }
-
- /**
- * convenience method for pre-2.4 feature files which have no view, hidden
- * columns or hidden row keywords.
- *
- * @param annotations
- * @param groups
- * @param properties
- * @return feature file as a string.
- */
- public String printAnnotations(AlignmentAnnotation[] annotations,
- Vector groups, Hashtable properties)
- {
- return printAnnotations(annotations, groups, properties, null);
-
- }
-
- /**
- * hold all the information about a particular view definition read from or
- * written out in an annotations file.
- */
- public class ViewDef
- {
- public String viewname;
-
- public HiddenSequences hidseqs;
-
- public ColumnSelection hiddencols;
-
- public Vector visibleGroups;
-
- public Hashtable hiddenRepSeqs;
-
- public ViewDef(String viewname, HiddenSequences hidseqs,
- ColumnSelection hiddencols, Hashtable hiddenRepSeqs)
- {
- this.viewname = viewname;
- this.hidseqs = hidseqs;
- this.hiddencols = hiddencols;
- this.hiddenRepSeqs = hiddenRepSeqs;
- }
- }
-
- /**
- * Prepare an annotation file given a set of annotations, groups, alignment
- * properties and views.
- *
- * @param annotations
- * @param groups
- * @param properties
- * @param views
- * @return annotation file
- */
- public String printAnnotations(AlignmentAnnotation[] annotations,
- Vector groups, Hashtable properties, ViewDef[] views)
- {
- // TODO: resolve views issue : annotationFile could contain visible region,
- // or full data + hidden region specifications for a view.
- if (annotations != null)
- {
- boolean oneColour = true;
- AlignmentAnnotation row;
- String comma;
- SequenceI refSeq = null;
- SequenceGroup refGroup = null;
-
- StringBuffer colours = new StringBuffer();
- StringBuffer graphLine = new StringBuffer();
- StringBuffer rowprops = new StringBuffer();
- Hashtable graphGroup = new Hashtable();
-
- java.awt.Color color;
-
- for (int i = 0; i < annotations.length; i++)
- {
- row = annotations[i];
-
- if (!row.visible && !row.hasScore())
- {
- continue;
- }
-
- color = null;
- oneColour = true;
-
- if (row.sequenceRef == null)
- {
- if (refSeq != null)
- {
- text.append(newline);
- text.append("SEQUENCE_REF\tALIGNMENT");
- text.append(newline);
- }
-
- refSeq = null;
- }
-
- else
- {
- if (refSeq == null || refSeq != row.sequenceRef)
- {
- refSeq = row.sequenceRef;
- text.append(newline);
- text.append("SEQUENCE_REF\t");
- text.append(refSeq.getName());
- text.append(newline);
- }
- }
- // mark any group references for the row
- if (row.groupRef == null)
- {
-
- if (refGroup != null)
- {
- text.append(newline);
- text.append("GROUP_REF\tALIGNMENT");
- text.append(newline);
- }
-
- refGroup = null;
- }
- else
- {
- if (refGroup == null || refGroup != row.groupRef)
- {
- refGroup = row.groupRef;
- text.append(newline);
- text.append("GROUP_REF\t");
- text.append(refGroup.getName());
- text.append(newline);
- }
- }
-
- boolean hasGlyphs = row.hasIcons, hasLabels = row.hasText, hasValues = row.hasScore, hasText = false;
- // lookahead to check what the annotation row object actually contains.
- for (int j = 0; row.annotations != null
- && j < row.annotations.length
- && (!hasGlyphs || !hasLabels || !hasValues); j++)
- {
- if (row.annotations[j] != null)
- {
- hasLabels |= (row.annotations[j].displayCharacter != null
- && row.annotations[j].displayCharacter.length() > 0 && !row.annotations[j].displayCharacter
- .equals(" "));
- hasGlyphs |= (row.annotations[j].secondaryStructure != 0 && row.annotations[j].secondaryStructure != ' ');
- hasValues |= (row.annotations[j].value != Float.NaN); // NaNs can't
- // be
- // rendered..
- hasText |= (row.annotations[j].description != null && row.annotations[j].description
- .length() > 0);
- }
- }
-
- if (row.graph == AlignmentAnnotation.NO_GRAPH)
- {
- text.append("NO_GRAPH\t");
- hasValues = false; // only secondary structure
- // hasLabels = false; // and annotation description string.
- }
- else
- {
- if (row.graph == AlignmentAnnotation.BAR_GRAPH)
- {
- text.append("BAR_GRAPH\t");
- hasGlyphs = false; // no secondary structure
-
- }
- else if (row.graph == AlignmentAnnotation.LINE_GRAPH)
- {
- hasGlyphs = false; // no secondary structure
- text.append("LINE_GRAPH\t");
- }
-
- if (row.getThreshold() != null)
- {
- graphLine.append("GRAPHLINE\t");
- graphLine.append(row.label);
- graphLine.append("\t");
- graphLine.append(row.getThreshold().value);
- graphLine.append("\t");
- graphLine.append(row.getThreshold().label);
- graphLine.append("\t");
- graphLine.append(jalview.util.Format.getHexString(row
- .getThreshold().colour));
- graphLine.append(newline);
- }
-
- if (row.graphGroup > -1)
- {
- String key = String.valueOf(row.graphGroup);
- if (graphGroup.containsKey(key))
- {
- graphGroup.put(key, graphGroup.get(key) + "\t" + row.label);
- }
- else
- {
- graphGroup.put(key, row.label);
- }
- }
- }
-
- text.append(row.label + "\t");
- if (row.description != null)
- {
- text.append(row.description + "\t");
- }
- for (int j = 0; row.annotations != null
- && j < row.annotations.length; j++)
- {
- if (refSeq != null
- && jalview.util.Comparison.isGap(refSeq.getCharAt(j)))
- {
- continue;
- }
-
- if (row.annotations[j] != null)
- {
- comma = "";
- if (hasGlyphs) // could be also hasGlyphs || ...
- {
-
- text.append(comma);
- if (row.annotations[j].secondaryStructure != ' ')
- {
- // only write out the field if its not whitespace.
- text.append(row.annotations[j].secondaryStructure);
- }
- comma = ",";
- }
- if (hasValues)
- {
- if (row.annotations[j].value != Float.NaN)
- {
- text.append(comma + row.annotations[j].value);
- }
- else
- {
- System.err.println("Skipping NaN - not valid value.");
- text.append(comma + 0f);// row.annotations[j].value);
- }
- comma = ",";
- }
- if (hasLabels)
- {
- // TODO: labels are emitted after values for bar graphs.
- if // empty labels are allowed, so
- (row.annotations[j].displayCharacter != null
- && row.annotations[j].displayCharacter.length() > 0
- && !row.annotations[j].displayCharacter.equals(" "))
- {
- text.append(comma + row.annotations[j].displayCharacter);
- comma = ",";
- }
- }
- if (hasText)
- {
- if (row.annotations[j].description != null
- && row.annotations[j].description.length() > 0
- && !row.annotations[j].description
- .equals(row.annotations[j].displayCharacter))
- {
- text.append(comma + row.annotations[j].description);
- comma = ",";
- }
- }
- if (color != null && !color.equals(row.annotations[j].colour))
- {
- oneColour = false;
- }
-
- color = row.annotations[j].colour;
-
- if (row.annotations[j].colour != null
- && row.annotations[j].colour != java.awt.Color.black)
- {
- text.append(comma
- + "["
- + jalview.util.Format
- .getHexString(row.annotations[j].colour)
- + "]");
- comma = ",";
- }
- }
- text.append("|");
- }
-
- if (row.hasScore())
- text.append("\t" + row.score);
-
- text.append(newline);
-
- if (color != null && color != java.awt.Color.black && oneColour)
- {
- colours.append("COLOUR\t");
- colours.append(row.label);
- colours.append("\t");
- colours.append(jalview.util.Format.getHexString(color));
- colours.append(newline);
- }
- if (row.scaleColLabel || row.showAllColLabels
- || row.centreColLabels)
- {
- rowprops.append("ROWPROPERTIES\t");
- rowprops.append(row.label);
- rowprops.append("\tscaletofit=");
- rowprops.append(row.scaleColLabel);
- rowprops.append("\tshowalllabs=");
- rowprops.append(row.showAllColLabels);
- rowprops.append("\tcentrelabs=");
- rowprops.append(row.centreColLabels);
- rowprops.append(newline);
- }
- }
-
- text.append(newline);
-
- text.append(colours.toString());
- text.append(graphLine.toString());
- if (graphGroup.size() > 0)
- {
- text.append("COMBINE\t");
- Enumeration en = graphGroup.elements();
- while (en.hasMoreElements())
- {
- text.append(en.nextElement());
- text.append(newline);
- }
- }
- text.append(rowprops.toString());
- }
-
- if (groups != null)
- {
- printGroups(groups);
- }
-
- if (properties != null)
- {
- text.append(newline);
- text.append(newline);
- text.append("ALIGNMENT");
- Enumeration en = properties.keys();
- while (en.hasMoreElements())
- {
- String key = en.nextElement().toString();
- text.append("\t");
- text.append(key);
- text.append("=");
- text.append(properties.get(key));
- }
- // TODO: output alignment visualization settings here if required
-
- }
-
- return text.toString();
- }
-
- public void printGroups(Vector sequenceGroups)
- {
- SequenceGroup sg;
- SequenceI seqrep = null;
- for (int i = 0; i < sequenceGroups.size(); i++)
- {
- sg = (SequenceGroup) sequenceGroups.elementAt(i);
- if (!sg.hasSeqrep())
- {
- text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"
- + (sg.getStartRes() + 1) + "\t" + (sg.getEndRes() + 1)
- + "\t" + "-1\t");
- seqrep = null;
- }
- else
- {
- seqrep = sg.getSeqrep();
- text.append("SEQUENCE_REF\t");
- text.append(seqrep.getName());
- text.append(newline);
- text.append("SEQUENCE_GROUP\t");
- text.append(sg.getName());
- text.append("\t");
- text.append((seqrep.findPosition(sg.getStartRes())));
- text.append("\t");
- text.append((seqrep.findPosition(sg.getEndRes())));
- text.append("\t");
- text.append("-1\t");
- }
- for (int s = 0; s < sg.getSize(); s++)
- {
- text.append(sg.getSequenceAt(s).getName());
- text.append("\t");
- }
- text.append(newline);
- text.append("PROPERTIES\t");
- text.append(sg.getName());
- text.append("\t");
-
- if (sg.getDescription() != null)
- {
- text.append("description=");
- text.append(sg.getDescription());
- text.append("\t");
- }
- if (sg.cs != null)
- {
- text.append("colour=");
- text.append(ColourSchemeProperty.getColourName(sg.cs));
- text.append("\t");
- if (sg.cs.getThreshold() != 0)
- {
- text.append("pidThreshold=");
- text.append(sg.cs.getThreshold());
- }
- if (sg.cs.conservationApplied())
- {
- text.append("consThreshold=");
- text.append(sg.cs.getConservationInc());
- text.append("\t");
- }
- }
- text.append("outlineColour=");
- text.append(jalview.util.Format.getHexString(sg.getOutlineColour()));
- text.append("\t");
-
- text.append("displayBoxes=");
- text.append(sg.getDisplayBoxes());
- text.append("\t");
- text.append("displayText=");
- text.append(sg.getDisplayText());
- text.append("\t");
- text.append("colourText=");
- text.append(sg.getColourText());
- text.append("\t");
- text.append("showUnconserved=");
- text.append(sg.getShowNonconserved());
- text.append("\t");
- if (sg.textColour != java.awt.Color.black)
- {
- text.append("textCol1=");
- text.append(jalview.util.Format.getHexString(sg.textColour));
- text.append("\t");
- }
- if (sg.textColour2 != java.awt.Color.white)
- {
- text.append("textCol2=");
- text.append(jalview.util.Format.getHexString(sg.textColour2));
- text.append("\t");
- }
- if (sg.thresholdTextColour != 0)
- {
- text.append("textColThreshold=");
- text.append(sg.thresholdTextColour);
- text.append("\t");
- }
- if (sg.idColour != null)
- {
- text.append("idColour=");
- text.append(jalview.util.Format.getHexString(sg.idColour));
- text.append("\t");
- }
- if (sg.isHidereps())
- {
- text.append("hide=true\t");
- }
- if (sg.isHideCols())
- {
- text.append("hidecols=true\t");
- }
- if (seqrep != null)
- {
- // terminate the last line and clear the sequence ref for the group
- text.append(newline);
- text.append("SEQUENCE_REF");
- }
- text.append(newline);
- text.append(newline);
-
- }
- }
-
- SequenceI refSeq = null;
-
- String refSeqId = null;
-
- public boolean readAnnotationFile(AlignmentI al, String file,
- String protocol)
- {
- BufferedReader in = null;
- try
- {
- if (protocol.equals(AppletFormatAdapter.FILE))
- {
- in = new BufferedReader(new FileReader(file));
- }
- else if (protocol.equals(AppletFormatAdapter.URL))
- {
- URL url = new URL(file);
- in = new BufferedReader(new InputStreamReader(url.openStream()));
- }
- else if (protocol.equals(AppletFormatAdapter.PASTE))
- {
- in = new BufferedReader(new StringReader(file));
- }
- else if (protocol.equals(AppletFormatAdapter.CLASSLOADER))
- {
- java.io.InputStream is = getClass().getResourceAsStream("/" + file);
- if (is != null)
- {
- in = new BufferedReader(new java.io.InputStreamReader(is));
- }
- }
- if (in != null)
- {
- return parseAnnotationFrom(al, in);
- }
-
- } catch (Exception ex)
- {
- ex.printStackTrace();
- System.out.println("Problem reading annotation file: " + ex);
- return false;
- }
- return false;
- }
-
- public boolean parseAnnotationFrom(AlignmentI al, BufferedReader in)
- throws Exception
- {
- boolean modified = false;
- String groupRef = null;
- Hashtable groupRefRows = new Hashtable();
-
- Hashtable autoAnnots = new Hashtable();
- {
- String line, label, description, token;
- int graphStyle, index;
- int refSeqIndex = 1;
- int existingAnnotations = 0;
- // when true - will add new rows regardless of whether they are duplicate
- // auto-annotation like consensus or conservation graphs
- boolean overrideAutoAnnot = false;
- if (al.getAlignmentAnnotation() != null)
- {
- existingAnnotations = al.getAlignmentAnnotation().length;
- if (existingAnnotations > 0)
- {
- AlignmentAnnotation[] aa = al.getAlignmentAnnotation();
- for (int aai = 0; aai < aa.length; aai++)
- {
- if (aa[aai].autoCalculated)
- {
- // make a note of the name and description
- autoAnnots.put(
- autoAnnotsKey(aa[aai], aa[aai].sequenceRef,
- (aa[aai].groupRef == null ? null
- : aa[aai].groupRef.getName())),
- new Integer(1));
- }
- }
- }
- }
-
- int alWidth = al.getWidth();
-
- StringTokenizer st;
- Annotation[] annotations;
- AlignmentAnnotation annotation = null;
-
- // First confirm this is an Annotation file
- boolean jvAnnotationFile = false;
- while ((line = in.readLine()) != null)
- {
- if (line.indexOf("#") == 0)
- {
- continue;
- }
-
- if (line.indexOf("JALVIEW_ANNOTATION") > -1)
- {
- jvAnnotationFile = true;
- break;
- }
- }
-
- if (!jvAnnotationFile)
- {
- in.close();
- return false;
- }
-
- while ((line = in.readLine()) != null)
- {
- if (line.indexOf("#") == 0
- || line.indexOf("JALVIEW_ANNOTATION") > -1
- || line.length() == 0)
- {
- continue;
- }
-
- st = new StringTokenizer(line, "\t");
- token = st.nextToken();
- if (token.equalsIgnoreCase("COLOUR"))
- {
- // TODO: use graduated colour def'n here too
- colourAnnotations(al, st.nextToken(), st.nextToken());
- modified = true;
- continue;
- }
-
- else if (token.equalsIgnoreCase("COMBINE"))
- {
- combineAnnotations(al, st);
- modified = true;
- continue;
- }
- else if (token.equalsIgnoreCase("ROWPROPERTIES"))
- {
- addRowProperties(al, st);
- modified = true;
- continue;
- }
- else if (token.equalsIgnoreCase("GRAPHLINE"))
- {
- addLine(al, st);
- modified = true;
- continue;
- }
-
- else if (token.equalsIgnoreCase("SEQUENCE_REF"))
- {
- if (st.hasMoreTokens())
- {
- refSeq = al.findName(refSeqId = st.nextToken());
- if (refSeq == null)
- {
- refSeqId = null;
- }
- try
- {
- refSeqIndex = Integer.parseInt(st.nextToken());
- if (refSeqIndex < 1)
- {
- refSeqIndex = 1;
- System.out
- .println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile");
- }
- } catch (Exception ex)
- {
- refSeqIndex = 1;
- }
- }
- else
- {
- refSeq = null;
- refSeqId = null;
- }
- continue;
- }
- else if (token.equalsIgnoreCase("GROUP_REF"))
- {
- // Group references could be forward or backwards, so they are
- // resolved after the whole file is read in
- groupRef = null;
- if (st.hasMoreTokens())
- {
- groupRef = st.nextToken();
- if (groupRef.length() < 1)
- {
- groupRef = null; // empty string
- }
- else
- {
- if (groupRefRows.get(groupRef) == null)
- {
- groupRefRows.put(groupRef, new Vector());
- }
- }
- }
- continue;
- }
- else if (token.equalsIgnoreCase("SEQUENCE_GROUP"))
- {
- addGroup(al, st);
- continue;
- }
-
- else if (token.equalsIgnoreCase("PROPERTIES"))
- {
- addProperties(al, st);
- modified = true;
- continue;
- }
-
- else if (token.equalsIgnoreCase("BELOW_ALIGNMENT"))
- {
- setBelowAlignment(al, st);
- modified = true;
- continue;
- }
- else if (token.equalsIgnoreCase("ALIGNMENT"))
- {
- addAlignmentDetails(al, st);
- modified = true;
- continue;
- }
-
- // Parse out the annotation row
- graphStyle = AlignmentAnnotation.getGraphValueFromString(token);
- label = st.nextToken();
-
- index = 0;
- annotations = new Annotation[alWidth];
- description = null;
- float score = Float.NaN;
-
- if (st.hasMoreTokens())
- {
- line = st.nextToken();
-
- if (line.indexOf("|") == -1)
- {
- description = line;
- if (st.hasMoreTokens())
- line = st.nextToken();
- }
-
- if (st.hasMoreTokens())
- {
- // This must be the score
- score = Float.valueOf(st.nextToken()).floatValue();
- }
-
- st = new StringTokenizer(line, "|", true);
-
- boolean emptyColumn = true;
- boolean onlyOneElement = (st.countTokens() == 1);
-
- while (st.hasMoreElements() && index < alWidth)
- {
- token = st.nextToken().trim();
-
- if (onlyOneElement)
- {
- try
- {
- score = Float.valueOf(token).floatValue();
- break;
- } catch (NumberFormatException ex)
- {
- }
- }
-
- if (token.equals("|"))
- {
- if (emptyColumn)
- {
- index++;
- }
-
- emptyColumn = true;
- }
- else
- {
- annotations[index++] = parseAnnotation(token, graphStyle);
- emptyColumn = false;
- }
- }
-
- }
-
- annotation = new AlignmentAnnotation(label, description,
- (index == 0) ? null : annotations, 0, 0, graphStyle);
-
- annotation.score = score;
- if (!overrideAutoAnnot
- && autoAnnots.containsKey(autoAnnotsKey(annotation, refSeq,
- groupRef)))
- {
- // skip - we've already got an automatic annotation of this type.
- continue;
- }
- // otherwise add it!
- if (refSeq != null)
- {
-
- annotation.belowAlignment = false;
- // make a copy of refSeq so we can find other matches in the alignment
- SequenceI referedSeq = refSeq;
- do
- {
- // copy before we do any mapping business.
- // TODO: verify that undo/redo with 1:many sequence associated
- // annotations can be undone correctly
- AlignmentAnnotation ann = new AlignmentAnnotation(annotation);
- annotation
- .createSequenceMapping(referedSeq, refSeqIndex, false);
- annotation.adjustForAlignment();
- referedSeq.addAlignmentAnnotation(annotation);
- al.addAnnotation(annotation);
- al.setAnnotationIndex(annotation,
- al.getAlignmentAnnotation().length
- - existingAnnotations - 1);
- if (groupRef != null)
- {
- ((Vector) groupRefRows.get(groupRef)).addElement(annotation);
- }
- // and recover our virgin copy to use again if necessary.
- annotation = ann;
-
- } while (refSeqId != null
- && (referedSeq = al.findName(referedSeq, refSeqId, true)) != null);
- }
- else
- {
- al.addAnnotation(annotation);
- al.setAnnotationIndex(annotation,
- al.getAlignmentAnnotation().length - existingAnnotations
- - 1);
- if (groupRef != null)
- {
- ((Vector) groupRefRows.get(groupRef)).addElement(annotation);
- }
- }
- // and set modification flag
- modified = true;
- }
- // Finally, resolve the groupRefs
- Enumeration en = groupRefRows.keys();
- SequenceGroup theGroup = null;
-
- while (en.hasMoreElements())
- {
- groupRef = (String) en.nextElement();
- boolean matched = false;
- // Resolve group: TODO: add a getGroupByName method to alignments
- Vector grps = al.getGroups();
- for (int g = 0, gSize = grps.size(); g < gSize; g++)
- {
- theGroup = (SequenceGroup) grps.elementAt(g);
- if (theGroup.getName().equals(groupRef))
- {
- if (matched)
- {
- // TODO: specify and implement duplication of alignment annotation
- // for multiple group references.
- System.err
- .println("Ignoring 1:many group reference mappings for group name '"
- + groupRef + "'");
- }
- else
- {
- matched = true;
- Vector rowset = (Vector) groupRefRows.get(groupRef);
- if (rowset != null && rowset.size() > 0)
- {
- AlignmentAnnotation alan = null;
- for (int elm = 0, elmSize = rowset.size(); elm < elmSize; elm++)
- {
- alan = (AlignmentAnnotation) rowset.elementAt(elm);
- alan.groupRef = theGroup;
- }
- }
- }
- }
- }
- ((Vector) groupRefRows.get(groupRef)).removeAllElements();
- }
- }
- return modified;
- }
-
- private Object autoAnnotsKey(AlignmentAnnotation annotation,
- SequenceI refSeq, String groupRef)
- {
- return annotation.graph + "\t" + annotation.label + "\t"
- + annotation.description + "\t"
- + (refSeq != null ? refSeq.getDisplayId(true) : "");
- }
-
- Annotation parseAnnotation(String string, int graphStyle)
- {
- boolean hasSymbols = (graphStyle == AlignmentAnnotation.NO_GRAPH); // don't
- // do the
- // glyph
- // test
- // if we
- // don't
- // want
- // secondary
- // structure
- String desc = null, displayChar = null;
- char ss = ' '; // secondaryStructure
- float value = 0;
- boolean parsedValue = false, dcset = false;
-
- // find colour here
- java.awt.Color colour = null;
- int i = string.indexOf("[");
- int j = string.indexOf("]");
- if (i > -1 && j > -1)
- {
- UserColourScheme ucs = new UserColourScheme();
-
- colour = ucs.getColourFromString(string.substring(i + 1, j));
- if (i > 0 && string.charAt(i - 1) == ',')
- {
- // clip the preceding comma as well
- i--;
- }
- string = string.substring(0, i) + string.substring(j + 1);
- }
-
- StringTokenizer st = new StringTokenizer(string, ",", true);
- String token;
- boolean seenContent = false;
- int pass = 0;
- while (st.hasMoreTokens())
- {
- pass++;
- token = st.nextToken().trim();
- if (token.equals(","))
- {
- if (!seenContent && parsedValue && !dcset)
- {
- // allow the value below the bar/line to be empty
- dcset = true;
- displayChar = " ";
- }
- seenContent = false;
- continue;
- }
- else
- {
- seenContent = true;
- }
-
- if (!parsedValue)
- {
- try
- {
- displayChar = token;
- // foo
- value = new Float(token).floatValue();
- parsedValue = true;
- continue;
- } catch (NumberFormatException ex)
- {
- }
- }
- else
- {
- if (token.length() == 1)
- {
- displayChar = token;
- }
- }
- if (hasSymbols
- && (token.equals("H") || token.equals("E") || token
- .equals(" ")))
- {
- // Either this character represents a helix or sheet
- // or an integer which can be displayed
- ss = token.charAt(0);
- if (displayChar.equals(token.substring(0, 1)))
- {
- displayChar = "";
- }
- }
- else if (desc == null || (parsedValue && pass > 2))
- {
- desc = token;
- }
-
- }
- // if (!dcset && string.charAt(string.length() - 1) == ',')
- // {
- // displayChar = " "; // empty display char symbol.
- // }
- if (displayChar != null && desc != null && desc.length() == 1)
- {
- if (displayChar.length() > 1)
- {
- // switch desc and displayChar - legacy support
- String tmp = displayChar;
- displayChar = desc;
- desc = tmp;
- }
- else
- {
- if (displayChar.equals(desc))
- {
- // duplicate label - hangover from the 'robust parser' above
- desc = null;
- }
- }
- }
- Annotation anot = new Annotation(displayChar, desc, ss, value);
-
- anot.colour = colour;
-
- return anot;
- }
-
- void colourAnnotations(AlignmentI al, String label, String colour)
- {
- UserColourScheme ucs = new UserColourScheme(colour);
- Annotation[] annotations;
- for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
- {
- if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label))
- {
- annotations = al.getAlignmentAnnotation()[i].annotations;
- for (int j = 0; j < annotations.length; j++)
- {
- if (annotations[j] != null)
- {
- annotations[j].colour = ucs.findColour('A');
- }
- }
- }
- }
- }
-
- void combineAnnotations(AlignmentI al, StringTokenizer st)
- {
- int graphGroup = -1;
- String group = st.nextToken();
- // First make sure we are not overwriting the graphIndex
- if (al.getAlignmentAnnotation() != null)
- {
- for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
- {
- if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))
- {
- graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1;
- al.getAlignmentAnnotation()[i].graphGroup = graphGroup;
- break;
- }
- }
-
- // Now update groups
- while (st.hasMoreTokens())
- {
- group = st.nextToken();
- for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
- {
- if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))
- {
- al.getAlignmentAnnotation()[i].graphGroup = graphGroup;
- break;
- }
- }
- }
- }
- else
- {
- System.err
- .println("Couldn't combine annotations. None are added to alignment yet!");
- }
- }
-
- void addLine(AlignmentI al, StringTokenizer st)
- {
- String group = st.nextToken();
- AlignmentAnnotation annotation = null, alannot[] = al
- .getAlignmentAnnotation();
- if (alannot != null)
- {
- for (int i = 0; i < alannot.length; i++)
- {
- if (alannot[i].label.equalsIgnoreCase(group))
- {
- annotation = alannot[i];
- break;
- }
- }
- }
- if (annotation == null)
- {
- return;
- }
- float value = new Float(st.nextToken()).floatValue();
- String label = st.hasMoreTokens() ? st.nextToken() : null;
- java.awt.Color colour = null;
- if (st.hasMoreTokens())
- {
- UserColourScheme ucs = new UserColourScheme(st.nextToken());
- colour = ucs.findColour('A');
- }
-
- annotation.setThreshold(new GraphLine(value, label, colour));
- }
-
- void addGroup(AlignmentI al, StringTokenizer st)
- {
- SequenceGroup sg = new SequenceGroup();
- sg.setName(st.nextToken());
- String rng = "";
- try
- {
- rng = st.nextToken();
- if (rng.length() > 0 && !rng.startsWith("*"))
- {
- sg.setStartRes(Integer.parseInt(rng) - 1);
- }
- else
- {
- sg.setStartRes(0);
- }
- rng = st.nextToken();
- if (rng.length() > 0 && !rng.startsWith("*"))
- {
- sg.setEndRes(Integer.parseInt(rng) - 1);
- }
- else
- {
- sg.setEndRes(al.getWidth() - 1);
- }
- } catch (Exception e)
- {
- System.err
- .println("Couldn't parse Group Start or End Field as '*' or a valid column or sequence index: '"
- + rng + "' - assuming alignment width for group.");
- // assume group is full width
- sg.setStartRes(0);
- sg.setEndRes(al.getWidth() - 1);
- }
-
- String index = st.nextToken();
- if (index.equals("-1"))
- {
- while (st.hasMoreElements())
- {
- sg.addSequence(al.findName(st.nextToken()), false);
- }
- }
- else
- {
- StringTokenizer st2 = new StringTokenizer(index, ",");
-
- while (st2.hasMoreTokens())
- {
- String tmp = st2.nextToken();
- if (tmp.equals("*"))
- {
- for (int i = 0; i < al.getHeight(); i++)
- {
- sg.addSequence(al.getSequenceAt(i), false);
- }
- }
- else if (tmp.indexOf("-") >= 0)
- {
- StringTokenizer st3 = new StringTokenizer(tmp, "-");
-
- int start = (Integer.parseInt(st3.nextToken()));
- int end = (Integer.parseInt(st3.nextToken()));
-
- if (end > start)
- {
- for (int i = start; i <= end; i++)
- {
- sg.addSequence(al.getSequenceAt(i - 1), false);
- }
- }
- }
- else
- {
- sg.addSequence(al.getSequenceAt(Integer.parseInt(tmp) - 1), false);
- }
- }
- }
-
- if (refSeq != null)
- {
- sg.setStartRes(refSeq.findIndex(sg.getStartRes() + 1) - 1);
- sg.setEndRes(refSeq.findIndex(sg.getEndRes() + 1) - 1);
- sg.setSeqrep(refSeq);
- }
-
- if (sg.getSize() > 0)
- {
- al.addGroup(sg);
- }
- }
-
- void addRowProperties(AlignmentI al, StringTokenizer st)
- {
- String label = st.nextToken(), keyValue, key, value;
- boolean scaletofit = false, centerlab = false, showalllabs = false;
- while (st.hasMoreTokens())
- {
- keyValue = st.nextToken();
- key = keyValue.substring(0, keyValue.indexOf("="));
- value = keyValue.substring(keyValue.indexOf("=") + 1);
- if (key.equalsIgnoreCase("scaletofit"))
- {
- scaletofit = Boolean.valueOf(value).booleanValue();
- }
- if (key.equalsIgnoreCase("showalllabs"))
- {
- showalllabs = Boolean.valueOf(value).booleanValue();
- }
- if (key.equalsIgnoreCase("centrelabs"))
- {
- centerlab = Boolean.valueOf(value).booleanValue();
- }
- AlignmentAnnotation[] alr = al.getAlignmentAnnotation();
- if (alr != null)
- {
- for (int i = 0; i < alr.length; i++)
- {
- if (alr[i].label.equalsIgnoreCase(label))
- {
- alr[i].centreColLabels = centerlab;
- alr[i].scaleColLabel = scaletofit;
- alr[i].showAllColLabels = showalllabs;
- }
- }
- }
- }
- }
-
- void addProperties(AlignmentI al, StringTokenizer st)
- {
-
- // So far we have only added groups to the annotationHash,
- // the idea is in the future properties can be added to
- // alignments, other annotations etc
- if (al.getGroups() == null)
- {
- return;
- }
- SequenceGroup sg = null;
-
- String name = st.nextToken();
-
- Vector groups = al.getGroups();
- for (int i = 0; i < groups.size(); i++)
- {
- sg = (SequenceGroup) groups.elementAt(i);
- if (sg.getName().equals(name))
- {
- break;
- }
- else
- {
- sg = null;
- }
- }
-
- if (sg != null)
- {
- String keyValue, key, value;
- ColourSchemeI def = sg.cs;
- sg.cs = null;
- while (st.hasMoreTokens())
- {
- keyValue = st.nextToken();
- key = keyValue.substring(0, keyValue.indexOf("="));
- value = keyValue.substring(keyValue.indexOf("=") + 1);
-
- if (key.equalsIgnoreCase("description"))
- {
- sg.setDescription(value);
- }
- else if (key.equalsIgnoreCase("colour"))
- {
- sg.cs = ColourSchemeProperty.getColour(al, value);
- }
- else if (key.equalsIgnoreCase("pidThreshold"))
- {
- sg.cs.setThreshold(Integer.parseInt(value), true);
-
- }
- else if (key.equalsIgnoreCase("consThreshold"))
- {
- sg.cs.setConservationInc(Integer.parseInt(value));
- Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3, sg.getSequences(null),
- sg.getStartRes(), sg.getEndRes() + 1);
-
- c.calculate();
- c.verdict(false, 25);
-
- sg.cs.setConservation(c);
-
- }
- else if (key.equalsIgnoreCase("outlineColour"))
- {
- sg.setOutlineColour(new UserColourScheme(value).findColour('A'));
- }
- else if (key.equalsIgnoreCase("displayBoxes"))
- {
- sg.setDisplayBoxes(Boolean.valueOf(value).booleanValue());
- }
- else if (key.equalsIgnoreCase("showUnconserved"))
- {
- sg.setShowNonconserved(Boolean.valueOf(value).booleanValue());
- }
- else if (key.equalsIgnoreCase("displayText"))
- {
- sg.setDisplayText(Boolean.valueOf(value).booleanValue());
- }
- else if (key.equalsIgnoreCase("colourText"))
- {
- sg.setColourText(Boolean.valueOf(value).booleanValue());
- }
- else if (key.equalsIgnoreCase("textCol1"))
- {
- sg.textColour = new UserColourScheme(value).findColour('A');
- }
- else if (key.equalsIgnoreCase("textCol2"))
- {
- sg.textColour2 = new UserColourScheme(value).findColour('A');
- }
- else if (key.equalsIgnoreCase("textColThreshold"))
- {
- sg.thresholdTextColour = Integer.parseInt(value);
- }
- else if (key.equalsIgnoreCase("idColour"))
- {
- // consider warning if colour doesn't resolve to a real colour
- sg.setIdColour((def = new UserColourScheme(value))
- .findColour('A'));
- }
- else if (key.equalsIgnoreCase("hide"))
- {
- // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847
- sg.setHidereps(true);
- }
- else if (key.equalsIgnoreCase("hidecols"))
- {
- // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847
- sg.setHideCols(true);
- }
- sg.recalcConservation();
- }
- if (sg.cs == null)
- {
- sg.cs = def;
- }
- }
- }
-
- void setBelowAlignment(AlignmentI al, StringTokenizer st)
- {
- String token;
- AlignmentAnnotation aa, ala[] = al.getAlignmentAnnotation();
- if (ala == null)
- {
- System.err
- .print("Warning - no annotation to set below for sequence associated annotation:");
- }
- while (st.hasMoreTokens())
- {
- token = st.nextToken();
- if (ala == null)
- {
- System.err.print(" " + token);
- }
- else
- {
- for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
- {
- aa = al.getAlignmentAnnotation()[i];
- if (aa.sequenceRef == refSeq && aa.label.equals(token))
- {
- aa.belowAlignment = true;
- }
- }
- }
- }
- if (ala == null)
- {
- System.err.print("\n");
- }
- }
-
- void addAlignmentDetails(AlignmentI al, StringTokenizer st)
- {
- String keyValue, key, value;
- while (st.hasMoreTokens())
- {
- keyValue = st.nextToken();
- key = keyValue.substring(0, keyValue.indexOf("="));
- value = keyValue.substring(keyValue.indexOf("=") + 1);
- al.setProperty(key, value);
- }
- }
-
- /**
- * Write annotations as a CSV file of the form 'label, value, value, ...' for
- * each row.
- *
- * @param annotations
- * @return CSV file as a string.
- */
- public String printCSVAnnotations(AlignmentAnnotation[] annotations)
- {
- StringBuffer sp = new StringBuffer();
- for (int i = 0; i < annotations.length; i++)
- {
- String atos = annotations[i].toString();
- int p = 0;
- do
- {
- int cp = atos.indexOf("\n", p);
- sp.append(annotations[i].label);
- sp.append(",");
- if (cp > p)
- {
- sp.append(atos.substring(p, cp + 1));
- }
- else
- {
- sp.append(atos.substring(p));
- sp.append(newline);
- }
- p = cp + 1;
- } while (p > 0);
- }
- return sp.toString();
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import jalview.analysis.Conservation;
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.GraphLine;
+import jalview.datamodel.HiddenSequences;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+public class AnnotationFile
+{
+ public AnnotationFile()
+ {
+ init();
+ }
+
+ /**
+ * character used to write newlines
+ */
+ protected String newline = System.getProperty("line.separator");
+
+ /**
+ * set new line string and reset the output buffer
+ *
+ * @param nl
+ */
+ public void setNewlineString(String nl)
+ {
+ newline = nl;
+ init();
+ }
+
+ public String getNewlineString()
+ {
+ return newline;
+ }
+
+ StringBuffer text;
+
+ private void init()
+ {
+ text = new StringBuffer("JALVIEW_ANNOTATION" + newline + "# Created: "
+ + new java.util.Date() + newline + newline);
+ refSeq = null;
+ refSeqId = null;
+ }
+
+ /**
+ * convenience method for pre-2.9 annotation files which have no view, hidden
+ * columns or hidden row keywords.
+ *
+ * @param annotations
+ * @param list
+ * @param properties
+ * @return annotation file as a string.
+ */
+ public String printAnnotations(AlignmentAnnotation[] annotations,
+ List<SequenceGroup> list, Hashtable properties)
+ {
+ return printAnnotations(annotations, list, properties, null, null, null);
+
+ }
+
+ /**
+ * hold all the information about a particular view definition read from or
+ * written out in an annotations file.
+ */
+ public class ViewDef
+ {
+ public String viewname;
+
+ public HiddenSequences hidseqs;
+
+ public ColumnSelection hiddencols;
+
+ public Vector visibleGroups;
+
+ public Hashtable hiddenRepSeqs;
+
+ public ViewDef(String viewname, HiddenSequences hidseqs,
+ ColumnSelection hiddencols, Hashtable hiddenRepSeqs)
+ {
+ this.viewname = viewname;
+ this.hidseqs = hidseqs;
+ this.hiddencols = hiddencols;
+ this.hiddenRepSeqs = hiddenRepSeqs;
+ }
+ }
+
+ /**
+ * Prepare an annotation file given a set of annotations, groups, alignment
+ * properties and views.
+ *
+ * @param annotations
+ * @param list
+ * @param properties
+ * @param views
+ * @return annotation file
+ */
+ public String printAnnotations(AlignmentAnnotation[] annotations,
+ List<SequenceGroup> list, Hashtable properties,
+ ColumnSelection cs, AlignmentI al, ViewDef view)
+ {
+ if (view != null)
+ {
+ if (view.viewname != null)
+ {
+ text.append("VIEW_DEF\t" + view.viewname + "\n");
+ }
+ if (list == null)
+ {
+ list = view.visibleGroups;
+ }
+ if (cs == null)
+ {
+ cs = view.hiddencols;
+ }
+ if (al == null)
+ {
+ // add hidden rep sequences.
+ }
+ }
+ // first target - store and restore all settings for a view.
+ if (al != null && al.hasSeqrep())
+ {
+ text.append("VIEW_SETREF\t" + al.getSeqrep().getName() + "\n");
+ }
+ if (cs != null && cs.hasHiddenColumns())
+ {
+ text.append("VIEW_HIDECOLS\t");
+ List<int[]> hc = cs.getHiddenColumns();
+ boolean comma = false;
+ for (int[] r : hc)
+ {
+ if (!comma)
+ {
+ comma = true;
+ }
+ else
+ {
+ text.append(",");
+ }
+ text.append(r[0]);
+ text.append("-");
+ text.append(r[1]);
+ }
+ text.append("\n");
+ }
+ // TODO: allow efficient recovery of annotation data shown in several
+ // different views
+ if (annotations != null)
+ {
+ boolean oneColour = true;
+ AlignmentAnnotation row;
+ String comma;
+ SequenceI refSeq = null;
+ SequenceGroup refGroup = null;
+
+ StringBuffer colours = new StringBuffer();
+ StringBuffer graphLine = new StringBuffer();
+ StringBuffer rowprops = new StringBuffer();
+ Hashtable<Integer, String> graphGroup = new Hashtable<Integer, String>();
+ Hashtable<Integer, Object[]> graphGroup_refs = new Hashtable<Integer, Object[]>();
+ BitSet graphGroupSeen = new BitSet();
+
+ java.awt.Color color;
+
+ for (int i = 0; i < annotations.length; i++)
+ {
+ row = annotations[i];
+
+ if (!row.visible
+ && !row.hasScore()
+ && !(row.graphGroup > -1 && graphGroupSeen
+ .get(row.graphGroup)))
+ {
+ continue;
+ }
+
+ color = null;
+ oneColour = true;
+
+ // mark any sequence references for the row
+ writeSequence_Ref(refSeq, row.sequenceRef);
+ refSeq = row.sequenceRef;
+ // mark any group references for the row
+ writeGroup_Ref(refGroup, row.groupRef);
+ refGroup = row.groupRef;
+
+ boolean hasGlyphs = row.hasIcons, hasLabels = row.hasText, hasValues = row.hasScore, hasText = false;
+ // lookahead to check what the annotation row object actually contains.
+ for (int j = 0; row.annotations != null
+ && j < row.annotations.length
+ && (!hasGlyphs || !hasLabels || !hasValues); j++)
+ {
+ if (row.annotations[j] != null)
+ {
+ hasLabels |= (row.annotations[j].displayCharacter != null
+ && row.annotations[j].displayCharacter.length() > 0 && !row.annotations[j].displayCharacter
+ .equals(" "));
+ hasGlyphs |= (row.annotations[j].secondaryStructure != 0 && row.annotations[j].secondaryStructure != ' ');
+ hasValues |= (!Float.isNaN(row.annotations[j].value)); // NaNs can't
+ // be
+ // rendered..
+ hasText |= (row.annotations[j].description != null && row.annotations[j].description
+ .length() > 0);
+ }
+ }
+
+ if (row.graph == AlignmentAnnotation.NO_GRAPH)
+ {
+ text.append("NO_GRAPH\t");
+ hasValues = false; // only secondary structure
+ // hasLabels = false; // and annotation description string.
+ }
+ else
+ {
+ if (row.graph == AlignmentAnnotation.BAR_GRAPH)
+ {
+ text.append("BAR_GRAPH\t");
+ hasGlyphs = false; // no secondary structure
+
+ }
+ else if (row.graph == AlignmentAnnotation.LINE_GRAPH)
+ {
+ hasGlyphs = false; // no secondary structure
+ text.append("LINE_GRAPH\t");
+ }
+
+ if (row.getThreshold() != null)
+ {
+ graphLine.append("GRAPHLINE\t");
+ graphLine.append(row.label);
+ graphLine.append("\t");
+ graphLine.append(row.getThreshold().value);
+ graphLine.append("\t");
+ graphLine.append(row.getThreshold().label);
+ graphLine.append("\t");
+ graphLine.append(jalview.util.Format.getHexString(row
+ .getThreshold().colour));
+ graphLine.append(newline);
+ }
+
+ if (row.graphGroup > -1)
+ {
+ graphGroupSeen.set(row.graphGroup);
+ Integer key = new Integer(row.graphGroup);
+ if (graphGroup.containsKey(key))
+ {
+ graphGroup.put(key, graphGroup.get(key) + "\t" + row.label);
+
+ }
+ else
+ {
+ graphGroup_refs.put(key, new Object[] { refSeq, refGroup });
+ graphGroup.put(key, row.label);
+ }
+ }
+ }
+
+ text.append(row.label + "\t");
+ if (row.description != null)
+ {
+ text.append(row.description + "\t");
+ }
+ for (int j = 0; row.annotations != null
+ && j < row.annotations.length; j++)
+ {
+ if (refSeq != null
+ && jalview.util.Comparison.isGap(refSeq.getCharAt(j)))
+ {
+ continue;
+ }
+
+ if (row.annotations[j] != null)
+ {
+ comma = "";
+ if (hasGlyphs) // could be also hasGlyphs || ...
+ {
+
+ text.append(comma);
+ if (row.annotations[j].secondaryStructure != ' ')
+ {
+ // only write out the field if its not whitespace.
+ text.append(row.annotations[j].secondaryStructure);
+ }
+ comma = ",";
+ }
+ if (hasValues)
+ {
+ if (!Float.isNaN(row.annotations[j].value))
+ {
+ text.append(comma + row.annotations[j].value);
+ }
+ else
+ {
+ // System.err.println("Skipping NaN - not valid value.");
+ text.append(comma + 0f);// row.annotations[j].value);
+ }
+ comma = ",";
+ }
+ if (hasLabels)
+ {
+ // TODO: labels are emitted after values for bar graphs.
+ if // empty labels are allowed, so
+ (row.annotations[j].displayCharacter != null
+ && row.annotations[j].displayCharacter.length() > 0
+ && !row.annotations[j].displayCharacter.equals(" "))
+ {
+ text.append(comma + row.annotations[j].displayCharacter);
+ comma = ",";
+ }
+ }
+ if (hasText)
+ {
+ if (row.annotations[j].description != null
+ && row.annotations[j].description.length() > 0
+ && !row.annotations[j].description
+ .equals(row.annotations[j].displayCharacter))
+ {
+ text.append(comma + row.annotations[j].description);
+ comma = ",";
+ }
+ }
+ if (color != null && !color.equals(row.annotations[j].colour))
+ {
+ oneColour = false;
+ }
+
+ color = row.annotations[j].colour;
+
+ if (row.annotations[j].colour != null
+ && row.annotations[j].colour != java.awt.Color.black)
+ {
+ text.append(comma
+ + "["
+ + jalview.util.Format
+ .getHexString(row.annotations[j].colour)
+ + "]");
+ comma = ",";
+ }
+ }
+ text.append("|");
+ }
+
+ if (row.hasScore())
+ {
+ text.append("\t" + row.score);
+ }
+
+ text.append(newline);
+
+ if (color != null && color != java.awt.Color.black && oneColour)
+ {
+ colours.append("COLOUR\t");
+ colours.append(row.label);
+ colours.append("\t");
+ colours.append(jalview.util.Format.getHexString(color));
+ colours.append(newline);
+ }
+ if (row.scaleColLabel || row.showAllColLabels
+ || row.centreColLabels)
+ {
+ rowprops.append("ROWPROPERTIES\t");
+ rowprops.append(row.label);
+ rowprops.append("\tscaletofit=");
+ rowprops.append(row.scaleColLabel);
+ rowprops.append("\tshowalllabs=");
+ rowprops.append(row.showAllColLabels);
+ rowprops.append("\tcentrelabs=");
+ rowprops.append(row.centreColLabels);
+ rowprops.append(newline);
+ }
+ if (graphLine.length() > 0)
+ {
+ text.append(graphLine.toString());
+ graphLine.setLength(0);
+ }
+ }
+
+ text.append(newline);
+
+ text.append(colours.toString());
+ if (graphGroup.size() > 0)
+ {
+ SequenceI oldRefSeq = refSeq;
+ SequenceGroup oldRefGroup = refGroup;
+ for (Map.Entry<Integer, String> combine_statement : graphGroup
+ .entrySet())
+ {
+ Object[] seqRefAndGroup = graphGroup_refs.get(combine_statement
+ .getKey());
+
+ writeSequence_Ref(refSeq, (SequenceI) seqRefAndGroup[0]);
+ refSeq = (SequenceI) seqRefAndGroup[0];
+
+ writeGroup_Ref(refGroup, (SequenceGroup) seqRefAndGroup[1]);
+ refGroup = (SequenceGroup) seqRefAndGroup[1];
+ text.append("COMBINE\t");
+ text.append(combine_statement.getValue());
+ text.append(newline);
+ }
+ writeSequence_Ref(refSeq, oldRefSeq);
+ refSeq = oldRefSeq;
+
+ writeGroup_Ref(refGroup, oldRefGroup);
+ refGroup = oldRefGroup;
+ }
+ text.append(rowprops.toString());
+ }
+
+ if (list != null)
+ {
+ printGroups(list);
+ }
+
+ if (properties != null)
+ {
+ text.append(newline);
+ text.append(newline);
+ text.append("ALIGNMENT");
+ Enumeration en = properties.keys();
+ while (en.hasMoreElements())
+ {
+ String key = en.nextElement().toString();
+ text.append("\t");
+ text.append(key);
+ text.append("=");
+ text.append(properties.get(key));
+ }
+ // TODO: output alignment visualization settings here if required
+ // iterate through one or more views, defining, marking columns and rows
+ // as visible/hidden, and emmitting view properties.
+ // View specific annotation is
+ }
+
+ return text.toString();
+ }
+
+ private Object writeGroup_Ref(SequenceGroup refGroup,
+ SequenceGroup next_refGroup)
+ {
+ if (next_refGroup == null)
+ {
+
+ if (refGroup != null)
+ {
+ text.append(newline);
+ text.append("GROUP_REF\t");
+ text.append("ALIGNMENT");
+ text.append(newline);
+ }
+ return true;
+ }
+ else
+ {
+ if (refGroup == null || refGroup != next_refGroup)
+ {
+ text.append(newline);
+ text.append("GROUP_REF\t");
+ text.append(next_refGroup.getName());
+ text.append(newline);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean writeSequence_Ref(SequenceI refSeq, SequenceI next_refSeq)
+ {
+
+ if (next_refSeq == null)
+ {
+ if (refSeq != null)
+ {
+ text.append(newline);
+ text.append("SEQUENCE_REF\t");
+ text.append("ALIGNMENT");
+ text.append(newline);
+ return true;
+ }
+ }
+ else
+ {
+ if (refSeq == null || refSeq != next_refSeq)
+ {
+ text.append(newline);
+ text.append("SEQUENCE_REF\t");
+ text.append(next_refSeq.getName());
+ text.append(newline);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void printGroups(List<SequenceGroup> list)
+ {
+ SequenceI seqrep = null;
+ for (SequenceGroup sg : list)
+ {
+ if (!sg.hasSeqrep())
+ {
+ text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"
+ + (sg.getStartRes() + 1) + "\t" + (sg.getEndRes() + 1)
+ + "\t" + "-1\t");
+ seqrep = null;
+ }
+ else
+ {
+ seqrep = sg.getSeqrep();
+ text.append("SEQUENCE_REF\t");
+ text.append(seqrep.getName());
+ text.append(newline);
+ text.append("SEQUENCE_GROUP\t");
+ text.append(sg.getName());
+ text.append("\t");
+ text.append((seqrep.findPosition(sg.getStartRes())));
+ text.append("\t");
+ text.append((seqrep.findPosition(sg.getEndRes())));
+ text.append("\t");
+ text.append("-1\t");
+ }
+ for (int s = 0; s < sg.getSize(); s++)
+ {
+ text.append(sg.getSequenceAt(s).getName());
+ text.append("\t");
+ }
+ text.append(newline);
+ text.append("PROPERTIES\t");
+ text.append(sg.getName());
+ text.append("\t");
+
+ if (sg.getDescription() != null)
+ {
+ text.append("description=");
+ text.append(sg.getDescription());
+ text.append("\t");
+ }
+ if (sg.cs != null)
+ {
+ text.append("colour=");
+ text.append(ColourSchemeProperty.getColourName(sg.cs));
+ text.append("\t");
+ if (sg.cs.getThreshold() != 0)
+ {
+ text.append("pidThreshold=");
+ text.append(sg.cs.getThreshold());
+ }
+ if (sg.cs.conservationApplied())
+ {
+ text.append("consThreshold=");
+ text.append(sg.cs.getConservationInc());
+ text.append("\t");
+ }
+ }
+ text.append("outlineColour=");
+ text.append(jalview.util.Format.getHexString(sg.getOutlineColour()));
+ text.append("\t");
+
+ text.append("displayBoxes=");
+ text.append(sg.getDisplayBoxes());
+ text.append("\t");
+ text.append("displayText=");
+ text.append(sg.getDisplayText());
+ text.append("\t");
+ text.append("colourText=");
+ text.append(sg.getColourText());
+ text.append("\t");
+ text.append("showUnconserved=");
+ text.append(sg.getShowNonconserved());
+ text.append("\t");
+ if (sg.textColour != java.awt.Color.black)
+ {
+ text.append("textCol1=");
+ text.append(jalview.util.Format.getHexString(sg.textColour));
+ text.append("\t");
+ }
+ if (sg.textColour2 != java.awt.Color.white)
+ {
+ text.append("textCol2=");
+ text.append(jalview.util.Format.getHexString(sg.textColour2));
+ text.append("\t");
+ }
+ if (sg.thresholdTextColour != 0)
+ {
+ text.append("textColThreshold=");
+ text.append(sg.thresholdTextColour);
+ text.append("\t");
+ }
+ if (sg.idColour != null)
+ {
+ text.append("idColour=");
+ text.append(jalview.util.Format.getHexString(sg.idColour));
+ text.append("\t");
+ }
+ if (sg.isHidereps())
+ {
+ text.append("hide=true\t");
+ }
+ if (sg.isHideCols())
+ {
+ text.append("hidecols=true\t");
+ }
+ if (seqrep != null)
+ {
+ // terminate the last line and clear the sequence ref for the group
+ text.append(newline);
+ text.append("SEQUENCE_REF");
+ }
+ text.append(newline);
+ text.append(newline);
+
+ }
+ }
+
+ SequenceI refSeq = null;
+
+ String refSeqId = null;
+
+ public boolean annotateAlignmentView(AlignViewportI viewport,
+ String file, String protocol)
+ {
+ ColumnSelection colSel = viewport.getColumnSelection();
+ if (colSel == null)
+ {
+ colSel = new ColumnSelection();
+ }
+ boolean rslt = readAnnotationFile(viewport.getAlignment(), colSel,
+ file, protocol);
+ if (rslt && (colSel.hasSelectedColumns() || colSel.hasHiddenColumns()))
+ {
+ viewport.setColumnSelection(colSel);
+ }
+
+ return rslt;
+ }
+
+ public boolean readAnnotationFile(AlignmentI al, String file,
+ String protocol)
+ {
+ return readAnnotationFile(al, null, file, protocol);
+ }
+
+ public boolean readAnnotationFile(AlignmentI al, ColumnSelection colSel,
+ String file, String protocol)
+ {
+ BufferedReader in = null;
+ try
+ {
+ if (protocol.equals(AppletFormatAdapter.FILE))
+ {
+ in = new BufferedReader(new FileReader(file));
+ }
+ else if (protocol.equals(AppletFormatAdapter.URL))
+ {
+ URL url = new URL(file);
+ in = new BufferedReader(new InputStreamReader(url.openStream()));
+ }
+ else if (protocol.equals(AppletFormatAdapter.PASTE))
+ {
+ in = new BufferedReader(new StringReader(file));
+ }
+ else if (protocol.equals(AppletFormatAdapter.CLASSLOADER))
+ {
+ java.io.InputStream is = getClass().getResourceAsStream("/" + file);
+ if (is != null)
+ {
+ in = new BufferedReader(new java.io.InputStreamReader(is));
+ }
+ }
+ if (in != null)
+ {
+ return parseAnnotationFrom(al, colSel, in);
+ }
+
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ System.out.println("Problem reading annotation file: " + ex);
+ if (nlinesread > 0)
+ {
+ System.out.println("Last read line " + nlinesread + ": '"
+ + lastread + "' (first 80 chars) ...");
+ }
+ return false;
+ }
+ return false;
+ }
+
+ long nlinesread = 0;
+
+ String lastread = "";
+
+ private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE";
+
+ public boolean parseAnnotationFrom(AlignmentI al, ColumnSelection colSel,
+ BufferedReader in) throws Exception
+ {
+ nlinesread = 0;
+ ArrayList<Object[]> combineAnnotation_calls = new ArrayList<Object[]>();
+ ArrayList<Object[]> deferredAnnotation_calls = new ArrayList<Object[]>();
+ boolean modified = false;
+ String groupRef = null;
+ Hashtable groupRefRows = new Hashtable();
+
+ Hashtable autoAnnots = new Hashtable();
+ {
+ String line, label, description, token;
+ int graphStyle, index;
+ int refSeqIndex = 1;
+ int existingAnnotations = 0;
+ // when true - will add new rows regardless of whether they are duplicate
+ // auto-annotation like consensus or conservation graphs
+ boolean overrideAutoAnnot = false;
+ if (al.getAlignmentAnnotation() != null)
+ {
+ existingAnnotations = al.getAlignmentAnnotation().length;
+ if (existingAnnotations > 0)
+ {
+ AlignmentAnnotation[] aa = al.getAlignmentAnnotation();
+ for (int aai = 0; aai < aa.length; aai++)
+ {
+ if (aa[aai].autoCalculated)
+ {
+ // make a note of the name and description
+ autoAnnots.put(
+ autoAnnotsKey(aa[aai], aa[aai].sequenceRef,
+ (aa[aai].groupRef == null ? null
+ : aa[aai].groupRef.getName())),
+ new Integer(1));
+ }
+ }
+ }
+ }
+
+ int alWidth = al.getWidth();
+
+ StringTokenizer st;
+ Annotation[] annotations;
+ AlignmentAnnotation annotation = null;
+
+ // First confirm this is an Annotation file
+ boolean jvAnnotationFile = false;
+ while ((line = in.readLine()) != null)
+ {
+ nlinesread++;
+ lastread = new String(line);
+ if (line.indexOf("#") == 0)
+ {
+ continue;
+ }
+
+ if (line.indexOf("JALVIEW_ANNOTATION") > -1)
+ {
+ jvAnnotationFile = true;
+ break;
+ }
+ }
+
+ if (!jvAnnotationFile)
+ {
+ in.close();
+ return false;
+ }
+
+ while ((line = in.readLine()) != null)
+ {
+ nlinesread++;
+ lastread = new String(line);
+ if (line.indexOf("#") == 0
+ || line.indexOf("JALVIEW_ANNOTATION") > -1
+ || line.length() == 0)
+ {
+ continue;
+ }
+
+ st = new StringTokenizer(line, "\t");
+ token = st.nextToken();
+ if (token.equalsIgnoreCase("COLOUR"))
+ {
+ // TODO: use graduated colour def'n here too
+ colourAnnotations(al, st.nextToken(), st.nextToken());
+ modified = true;
+ continue;
+ }
+
+ else if (token.equalsIgnoreCase(COMBINE))
+ {
+ // keep a record of current state and resolve groupRef at end
+ combineAnnotation_calls
+ .add(new Object[] { st, refSeq, groupRef });
+ modified = true;
+ continue;
+ }
+ else if (token.equalsIgnoreCase("ROWPROPERTIES"))
+ {
+ addRowProperties(al, st);
+ modified = true;
+ continue;
+ }
+ else if (token.equalsIgnoreCase(GRAPHLINE))
+ {
+ // resolve at end
+ deferredAnnotation_calls.add(new Object[] { GRAPHLINE, st,
+ refSeq, groupRef });
+ modified = true;
+ continue;
+ }
+
+ else if (token.equalsIgnoreCase("SEQUENCE_REF"))
+ {
+ if (st.hasMoreTokens())
+ {
+ refSeq = al.findName(refSeqId = st.nextToken());
+ if (refSeq == null)
+ {
+ refSeqId = null;
+ }
+ try
+ {
+ refSeqIndex = Integer.parseInt(st.nextToken());
+ if (refSeqIndex < 1)
+ {
+ refSeqIndex = 1;
+ System.out
+ .println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile");
+ }
+ } catch (Exception ex)
+ {
+ refSeqIndex = 1;
+ }
+ }
+ else
+ {
+ refSeq = null;
+ refSeqId = null;
+ }
+ continue;
+ }
+ else if (token.equalsIgnoreCase("GROUP_REF"))
+ {
+ // Group references could be forward or backwards, so they are
+ // resolved after the whole file is read in
+ groupRef = null;
+ if (st.hasMoreTokens())
+ {
+ groupRef = st.nextToken();
+ if (groupRef.length() < 1)
+ {
+ groupRef = null; // empty string
+ }
+ else
+ {
+ if (groupRefRows.get(groupRef) == null)
+ {
+ groupRefRows.put(groupRef, new Vector());
+ }
+ }
+ }
+ continue;
+ }
+ else if (token.equalsIgnoreCase("SEQUENCE_GROUP"))
+ {
+ addGroup(al, st);
+ modified = true;
+ continue;
+ }
+
+ else if (token.equalsIgnoreCase("PROPERTIES"))
+ {
+ addProperties(al, st);
+ modified = true;
+ continue;
+ }
+
+ else if (token.equalsIgnoreCase("BELOW_ALIGNMENT"))
+ {
+ setBelowAlignment(al, st);
+ modified = true;
+ continue;
+ }
+ else if (token.equalsIgnoreCase("ALIGNMENT"))
+ {
+ addAlignmentDetails(al, st);
+ modified = true;
+ continue;
+ }
+ // else if (token.equalsIgnoreCase("VIEW_DEF"))
+ // {
+ // addOrSetView(al,st);
+ // modified = true;
+ // continue;
+ // }
+ else if (token.equalsIgnoreCase("VIEW_SETREF"))
+ {
+ if (refSeq != null)
+ {
+ al.setSeqrep(refSeq);
+ }
+ modified = true;
+ continue;
+ }
+ else if (token.equalsIgnoreCase("VIEW_HIDECOLS"))
+ {
+ if (st.hasMoreTokens())
+ {
+ if (colSel == null)
+ {
+ colSel = new ColumnSelection();
+ }
+ parseHideCols(colSel, st.nextToken());
+ }
+ modified = true;
+ continue;
+ }
+ else if (token.equalsIgnoreCase("HIDE_INSERTIONS"))
+ {
+ SequenceI sr = refSeq == null ? al.getSeqrep() : refSeq;
+ if (sr == null)
+ {
+ sr = al.getSequenceAt(0);
+ }
+ if (sr != null)
+ {
+ if (colSel == null)
+ {
+ System.err
+ .println("Cannot process HIDE_INSERTIONS without an alignment view: Ignoring line: "
+ + line);
+ }
+ else
+ {
+ // consider deferring this till after the file has been parsed ?
+ colSel.hideInsertionsFor(sr);
+ }
+ }
+ modified = true;
+ continue;
+ }
+
+ // Parse out the annotation row
+ graphStyle = AlignmentAnnotation.getGraphValueFromString(token);
+ label = st.nextToken();
+
+ index = 0;
+ annotations = new Annotation[alWidth];
+ description = null;
+ float score = Float.NaN;
+
+ if (st.hasMoreTokens())
+ {
+ line = st.nextToken();
+
+ if (line.indexOf("|") == -1)
+ {
+ description = line;
+ if (st.hasMoreTokens())
+ {
+ line = st.nextToken();
+ }
+ }
+
+ if (st.hasMoreTokens())
+ {
+ // This must be the score
+ score = Float.valueOf(st.nextToken()).floatValue();
+ }
+
+ st = new StringTokenizer(line, "|", true);
+
+ boolean emptyColumn = true;
+ boolean onlyOneElement = (st.countTokens() == 1);
+
+ while (st.hasMoreElements() && index < alWidth)
+ {
+ token = st.nextToken().trim();
+
+ if (onlyOneElement)
+ {
+ try
+ {
+ score = Float.valueOf(token).floatValue();
+ break;
+ } catch (NumberFormatException ex)
+ {
+ }
+ }
+
+ if (token.equals("|"))
+ {
+ if (emptyColumn)
+ {
+ index++;
+ }
+
+ emptyColumn = true;
+ }
+ else
+ {
+ annotations[index++] = parseAnnotation(token, graphStyle);
+ emptyColumn = false;
+ }
+ }
+
+ }
+
+ annotation = new AlignmentAnnotation(label, description,
+ (index == 0) ? null : annotations, 0, 0, graphStyle);
+
+ annotation.score = score;
+ if (!overrideAutoAnnot
+ && autoAnnots.containsKey(autoAnnotsKey(annotation, refSeq,
+ groupRef)))
+ {
+ // skip - we've already got an automatic annotation of this type.
+ continue;
+ }
+ // otherwise add it!
+ if (refSeq != null)
+ {
+
+ annotation.belowAlignment = false;
+ // make a copy of refSeq so we can find other matches in the alignment
+ SequenceI referedSeq = refSeq;
+ do
+ {
+ // copy before we do any mapping business.
+ // TODO: verify that undo/redo with 1:many sequence associated
+ // annotations can be undone correctly
+ AlignmentAnnotation ann = new AlignmentAnnotation(annotation);
+ annotation
+ .createSequenceMapping(referedSeq, refSeqIndex, false);
+ annotation.adjustForAlignment();
+ referedSeq.addAlignmentAnnotation(annotation);
+ al.addAnnotation(annotation);
+ al.setAnnotationIndex(annotation,
+ al.getAlignmentAnnotation().length
+ - existingAnnotations - 1);
+ if (groupRef != null)
+ {
+ ((Vector) groupRefRows.get(groupRef)).addElement(annotation);
+ }
+ // and recover our virgin copy to use again if necessary.
+ annotation = ann;
+
+ } while (refSeqId != null
+ && (referedSeq = al.findName(referedSeq, refSeqId, true)) != null);
+ }
+ else
+ {
+ al.addAnnotation(annotation);
+ al.setAnnotationIndex(annotation,
+ al.getAlignmentAnnotation().length - existingAnnotations
+ - 1);
+ if (groupRef != null)
+ {
+ ((Vector) groupRefRows.get(groupRef)).addElement(annotation);
+ }
+ }
+ // and set modification flag
+ modified = true;
+ }
+ // Resolve the groupRefs
+ Hashtable<String, SequenceGroup> groupRefLookup = new Hashtable<String, SequenceGroup>();
+ Enumeration en = groupRefRows.keys();
+
+ while (en.hasMoreElements())
+ {
+ groupRef = (String) en.nextElement();
+ boolean matched = false;
+ // Resolve group: TODO: add a getGroupByName method to alignments
+ for (SequenceGroup theGroup : al.getGroups())
+ {
+ if (theGroup.getName().equals(groupRef))
+ {
+ if (matched)
+ {
+ // TODO: specify and implement duplication of alignment annotation
+ // for multiple group references.
+ System.err
+ .println("Ignoring 1:many group reference mappings for group name '"
+ + groupRef + "'");
+ }
+ else
+ {
+ matched = true;
+ Vector rowset = (Vector) groupRefRows.get(groupRef);
+ groupRefLookup.put(groupRef, theGroup);
+ if (rowset != null && rowset.size() > 0)
+ {
+ AlignmentAnnotation alan = null;
+ for (int elm = 0, elmSize = rowset.size(); elm < elmSize; elm++)
+ {
+ alan = (AlignmentAnnotation) rowset.elementAt(elm);
+ alan.groupRef = theGroup;
+ }
+ }
+ }
+ }
+ }
+ ((Vector) groupRefRows.get(groupRef)).removeAllElements();
+ }
+ // process any deferred attribute settings for each context
+ for (Object[] _deferred_args : deferredAnnotation_calls)
+ {
+ if (_deferred_args[0] == GRAPHLINE)
+ {
+ addLine(al,
+ (StringTokenizer) _deferred_args[1], // st
+ (SequenceI) _deferred_args[2], // refSeq
+ (_deferred_args[3] == null) ? null : groupRefLookup
+ .get(_deferred_args[3]) // the reference
+ // group, or null
+ );
+ }
+ }
+
+ // finally, combine all the annotation rows within each context.
+ /**
+ * number of combine statements in this annotation file. Used to create
+ * new groups for combined annotation graphs without disturbing existing
+ * ones
+ */
+ int combinecount = 0;
+ for (Object[] _combine_args : combineAnnotation_calls)
+ {
+ combineAnnotations(al,
+ ++combinecount,
+ (StringTokenizer) _combine_args[0], // st
+ (SequenceI) _combine_args[1], // refSeq
+ (_combine_args[2] == null) ? null : groupRefLookup
+ .get(_combine_args[2]) // the reference group,
+ // or null
+ );
+ }
+ }
+ return modified;
+ }
+
+ private void parseHideCols(ColumnSelection colSel, String nextToken)
+ {
+ StringTokenizer inval = new StringTokenizer(nextToken, ",");
+ while (inval.hasMoreTokens())
+ {
+ String range = inval.nextToken().trim();
+ int from, to = range.indexOf("-");
+ if (to == -1)
+ {
+ from = to = Integer.parseInt(range);
+ if (from >= 0)
+ {
+ colSel.hideColumns(from, to);
+ }
+ }
+ else
+ {
+ from = Integer.parseInt(range.substring(0, to));
+ if (to < range.length() - 1)
+ {
+ to = Integer.parseInt(range.substring(to + 1));
+ }
+ else
+ {
+ to = from;
+ }
+ if (from > 0 && to >= from)
+ {
+ colSel.hideColumns(from, to);
+ }
+ }
+ }
+ }
+
+ private Object autoAnnotsKey(AlignmentAnnotation annotation,
+ SequenceI refSeq, String groupRef)
+ {
+ return annotation.graph + "\t" + annotation.label + "\t"
+ + annotation.description + "\t"
+ + (refSeq != null ? refSeq.getDisplayId(true) : "");
+ }
+
+ Annotation parseAnnotation(String string, int graphStyle)
+ {
+ boolean hasSymbols = (graphStyle == AlignmentAnnotation.NO_GRAPH); // don't
+ // do the
+ // glyph
+ // test
+ // if we
+ // don't
+ // want
+ // secondary
+ // structure
+ String desc = null, displayChar = null;
+ char ss = ' '; // secondaryStructure
+ float value = 0;
+ boolean parsedValue = false, dcset = false;
+
+ // find colour here
+ java.awt.Color colour = null;
+ int i = string.indexOf("[");
+ int j = string.indexOf("]");
+ if (i > -1 && j > -1)
+ {
+ UserColourScheme ucs = new UserColourScheme();
+
+ colour = ucs.getColourFromString(string.substring(i + 1, j));
+ if (i > 0 && string.charAt(i - 1) == ',')
+ {
+ // clip the preceding comma as well
+ i--;
+ }
+ string = string.substring(0, i) + string.substring(j + 1);
+ }
+
+ StringTokenizer st = new StringTokenizer(string, ",", true);
+ String token;
+ boolean seenContent = false;
+ int pass = 0;
+ while (st.hasMoreTokens())
+ {
+ pass++;
+ token = st.nextToken().trim();
+ if (token.equals(","))
+ {
+ if (!seenContent && parsedValue && !dcset)
+ {
+ // allow the value below the bar/line to be empty
+ dcset = true;
+ displayChar = " ";
+ }
+ seenContent = false;
+ continue;
+ }
+ else
+ {
+ seenContent = true;
+ }
+
+ if (!parsedValue)
+ {
+ try
+ {
+ displayChar = token;
+ // foo
+ value = new Float(token).floatValue();
+ parsedValue = true;
+ continue;
+ } catch (NumberFormatException ex)
+ {
+ }
+ }
+ else
+ {
+ if (token.length() == 1)
+ {
+ displayChar = token;
+ }
+ }
+ if (hasSymbols
+ && (token.length() == 1 && "()<>[]{}AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
+ .contains(token)))
+ {
+ // Either this character represents a helix or sheet
+ // or an integer which can be displayed
+ ss = token.charAt(0);
+ if (displayChar.equals(token.substring(0, 1)))
+ {
+ displayChar = "";
+ }
+ }
+ else if (desc == null || (parsedValue && pass > 2))
+ {
+ desc = token;
+ }
+
+ }
+ // if (!dcset && string.charAt(string.length() - 1) == ',')
+ // {
+ // displayChar = " "; // empty display char symbol.
+ // }
+ if (displayChar != null && desc != null && desc.length() == 1)
+ {
+ if (displayChar.length() > 1)
+ {
+ // switch desc and displayChar - legacy support
+ String tmp = displayChar;
+ displayChar = desc;
+ desc = tmp;
+ }
+ else
+ {
+ if (displayChar.equals(desc))
+ {
+ // duplicate label - hangover from the 'robust parser' above
+ desc = null;
+ }
+ }
+ }
+ Annotation anot = new Annotation(displayChar, desc, ss, value);
+
+ anot.colour = colour;
+
+ return anot;
+ }
+
+ void colourAnnotations(AlignmentI al, String label, String colour)
+ {
+ UserColourScheme ucs = new UserColourScheme(colour);
+ Annotation[] annotations;
+ for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
+ {
+ if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label))
+ {
+ annotations = al.getAlignmentAnnotation()[i].annotations;
+ for (int j = 0; j < annotations.length; j++)
+ {
+ if (annotations[j] != null)
+ {
+ annotations[j].colour = ucs.findColour('A');
+ }
+ }
+ }
+ }
+ }
+
+ void combineAnnotations(AlignmentI al, int combineCount,
+ StringTokenizer st, SequenceI seqRef, SequenceGroup groupRef)
+ {
+ String group = st.nextToken();
+ // First make sure we are not overwriting the graphIndex
+ int graphGroup = 0;
+ if (al.getAlignmentAnnotation() != null)
+ {
+ for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
+ {
+ AlignmentAnnotation aa = al.getAlignmentAnnotation()[i];
+
+ if (aa.graphGroup > graphGroup)
+ {
+ // try to number graphGroups in order of occurence.
+ graphGroup = aa.graphGroup + 1;
+ }
+ if (aa.sequenceRef == seqRef && aa.groupRef == groupRef
+ && aa.label.equalsIgnoreCase(group))
+ {
+ if (aa.graphGroup > -1)
+ {
+ graphGroup = aa.graphGroup;
+ }
+ else
+ {
+ if (graphGroup <= combineCount)
+ {
+ graphGroup = combineCount + 1;
+ }
+ aa.graphGroup = graphGroup;
+ }
+ break;
+ }
+ }
+
+ // Now update groups
+ while (st.hasMoreTokens())
+ {
+ group = st.nextToken();
+ for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
+ {
+ AlignmentAnnotation aa = al.getAlignmentAnnotation()[i];
+ if (aa.sequenceRef == seqRef && aa.groupRef == groupRef
+ && aa.label.equalsIgnoreCase(group))
+ {
+ aa.graphGroup = graphGroup;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ System.err
+ .println("Couldn't combine annotations. None are added to alignment yet!");
+ }
+ }
+
+ void addLine(AlignmentI al, StringTokenizer st, SequenceI seqRef,
+ SequenceGroup groupRef)
+ {
+ String group = st.nextToken();
+ AlignmentAnnotation annotation = null, alannot[] = al
+ .getAlignmentAnnotation();
+ float value = new Float(st.nextToken()).floatValue();
+ String label = st.hasMoreTokens() ? st.nextToken() : null;
+ java.awt.Color colour = null;
+ if (st.hasMoreTokens())
+ {
+ UserColourScheme ucs = new UserColourScheme(st.nextToken());
+ colour = ucs.findColour('A');
+ }
+ if (alannot != null)
+ {
+ for (int i = 0; i < alannot.length; i++)
+ {
+ if (alannot[i].label.equalsIgnoreCase(group)
+ && (seqRef == null || alannot[i].sequenceRef == seqRef)
+ && (groupRef == null || alannot[i].groupRef == groupRef))
+ {
+ alannot[i].setThreshold(new GraphLine(value, label, colour));
+ }
+ }
+ }
+ if (annotation == null)
+ {
+ return;
+ }
+ }
+
+ void addGroup(AlignmentI al, StringTokenizer st)
+ {
+ SequenceGroup sg = new SequenceGroup();
+ sg.setName(st.nextToken());
+ String rng = "";
+ try
+ {
+ rng = st.nextToken();
+ if (rng.length() > 0 && !rng.startsWith("*"))
+ {
+ sg.setStartRes(Integer.parseInt(rng) - 1);
+ }
+ else
+ {
+ sg.setStartRes(0);
+ }
+ rng = st.nextToken();
+ if (rng.length() > 0 && !rng.startsWith("*"))
+ {
+ sg.setEndRes(Integer.parseInt(rng) - 1);
+ }
+ else
+ {
+ sg.setEndRes(al.getWidth() - 1);
+ }
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse Group Start or End Field as '*' or a valid column or sequence index: '"
+ + rng + "' - assuming alignment width for group.");
+ // assume group is full width
+ sg.setStartRes(0);
+ sg.setEndRes(al.getWidth() - 1);
+ }
+
+ String index = st.nextToken();
+ if (index.equals("-1"))
+ {
+ while (st.hasMoreElements())
+ {
+ sg.addSequence(al.findName(st.nextToken()), false);
+ }
+ }
+ else
+ {
+ StringTokenizer st2 = new StringTokenizer(index, ",");
+
+ while (st2.hasMoreTokens())
+ {
+ String tmp = st2.nextToken();
+ if (tmp.equals("*"))
+ {
+ for (int i = 0; i < al.getHeight(); i++)
+ {
+ sg.addSequence(al.getSequenceAt(i), false);
+ }
+ }
+ else if (tmp.indexOf("-") >= 0)
+ {
+ StringTokenizer st3 = new StringTokenizer(tmp, "-");
+
+ int start = (Integer.parseInt(st3.nextToken()));
+ int end = (Integer.parseInt(st3.nextToken()));
+
+ if (end > start)
+ {
+ for (int i = start; i <= end; i++)
+ {
+ sg.addSequence(al.getSequenceAt(i - 1), false);
+ }
+ }
+ }
+ else
+ {
+ sg.addSequence(al.getSequenceAt(Integer.parseInt(tmp) - 1), false);
+ }
+ }
+ }
+
+ if (refSeq != null)
+ {
+ sg.setStartRes(refSeq.findIndex(sg.getStartRes() + 1) - 1);
+ sg.setEndRes(refSeq.findIndex(sg.getEndRes() + 1) - 1);
+ sg.setSeqrep(refSeq);
+ }
+
+ if (sg.getSize() > 0)
+ {
+ al.addGroup(sg);
+ }
+ }
+
+ void addRowProperties(AlignmentI al, StringTokenizer st)
+ {
+ String label = st.nextToken(), keyValue, key, value;
+ boolean scaletofit = false, centerlab = false, showalllabs = false;
+ while (st.hasMoreTokens())
+ {
+ keyValue = st.nextToken();
+ key = keyValue.substring(0, keyValue.indexOf("="));
+ value = keyValue.substring(keyValue.indexOf("=") + 1);
+ if (key.equalsIgnoreCase("scaletofit"))
+ {
+ scaletofit = Boolean.valueOf(value).booleanValue();
+ }
+ if (key.equalsIgnoreCase("showalllabs"))
+ {
+ showalllabs = Boolean.valueOf(value).booleanValue();
+ }
+ if (key.equalsIgnoreCase("centrelabs"))
+ {
+ centerlab = Boolean.valueOf(value).booleanValue();
+ }
+ AlignmentAnnotation[] alr = al.getAlignmentAnnotation();
+ if (alr != null)
+ {
+ for (int i = 0; i < alr.length; i++)
+ {
+ if (alr[i].label.equalsIgnoreCase(label))
+ {
+ alr[i].centreColLabels = centerlab;
+ alr[i].scaleColLabel = scaletofit;
+ alr[i].showAllColLabels = showalllabs;
+ }
+ }
+ }
+ }
+ }
+
+ void addProperties(AlignmentI al, StringTokenizer st)
+ {
+
+ // So far we have only added groups to the annotationHash,
+ // the idea is in the future properties can be added to
+ // alignments, other annotations etc
+ if (al.getGroups() == null)
+ {
+ return;
+ }
+
+ String name = st.nextToken();
+ SequenceGroup sg = null;
+ for (SequenceGroup _sg : al.getGroups())
+ {
+ if ((sg = _sg).getName().equals(name))
+ {
+ break;
+ }
+ else
+ {
+ sg = null;
+ }
+ }
+
+ if (sg != null)
+ {
+ String keyValue, key, value;
+ ColourSchemeI def = sg.cs;
+ sg.cs = null;
+ while (st.hasMoreTokens())
+ {
+ keyValue = st.nextToken();
+ key = keyValue.substring(0, keyValue.indexOf("="));
+ value = keyValue.substring(keyValue.indexOf("=") + 1);
+
+ if (key.equalsIgnoreCase("description"))
+ {
+ sg.setDescription(value);
+ }
+ else if (key.equalsIgnoreCase("colour"))
+ {
+ sg.cs = ColourSchemeProperty.getColour(al, value);
+ }
+ else if (key.equalsIgnoreCase("pidThreshold"))
+ {
+ sg.cs.setThreshold(Integer.parseInt(value), true);
+
+ }
+ else if (key.equalsIgnoreCase("consThreshold"))
+ {
+ sg.cs.setConservationInc(Integer.parseInt(value));
+ Conservation c = new Conservation("Group",
+ ResidueProperties.propHash, 3, sg.getSequences(null),
+ sg.getStartRes(), sg.getEndRes() + 1);
+
+ c.calculate();
+ c.verdict(false, 25); // TODO: refer to conservation percent threshold
+
+ sg.cs.setConservation(c);
+
+ }
+ else if (key.equalsIgnoreCase("outlineColour"))
+ {
+ sg.setOutlineColour(new UserColourScheme(value).findColour('A'));
+ }
+ else if (key.equalsIgnoreCase("displayBoxes"))
+ {
+ sg.setDisplayBoxes(Boolean.valueOf(value).booleanValue());
+ }
+ else if (key.equalsIgnoreCase("showUnconserved"))
+ {
+ sg.setShowNonconserved(Boolean.valueOf(value).booleanValue());
+ }
+ else if (key.equalsIgnoreCase("displayText"))
+ {
+ sg.setDisplayText(Boolean.valueOf(value).booleanValue());
+ }
+ else if (key.equalsIgnoreCase("colourText"))
+ {
+ sg.setColourText(Boolean.valueOf(value).booleanValue());
+ }
+ else if (key.equalsIgnoreCase("textCol1"))
+ {
+ sg.textColour = new UserColourScheme(value).findColour('A');
+ }
+ else if (key.equalsIgnoreCase("textCol2"))
+ {
+ sg.textColour2 = new UserColourScheme(value).findColour('A');
+ }
+ else if (key.equalsIgnoreCase("textColThreshold"))
+ {
+ sg.thresholdTextColour = Integer.parseInt(value);
+ }
+ else if (key.equalsIgnoreCase("idColour"))
+ {
+ // consider warning if colour doesn't resolve to a real colour
+ sg.setIdColour((def = new UserColourScheme(value))
+ .findColour('A'));
+ }
+ else if (key.equalsIgnoreCase("hide"))
+ {
+ // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847
+ sg.setHidereps(true);
+ }
+ else if (key.equalsIgnoreCase("hidecols"))
+ {
+ // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847
+ sg.setHideCols(true);
+ }
+ sg.recalcConservation();
+ }
+ if (sg.cs == null)
+ {
+ sg.cs = def;
+ }
+ }
+ }
+
+ void setBelowAlignment(AlignmentI al, StringTokenizer st)
+ {
+ String token;
+ AlignmentAnnotation aa, ala[] = al.getAlignmentAnnotation();
+ if (ala == null)
+ {
+ System.err
+ .print("Warning - no annotation to set below for sequence associated annotation:");
+ }
+ while (st.hasMoreTokens())
+ {
+ token = st.nextToken();
+ if (ala == null)
+ {
+ System.err.print(" " + token);
+ }
+ else
+ {
+ for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
+ {
+ aa = al.getAlignmentAnnotation()[i];
+ if (aa.sequenceRef == refSeq && aa.label.equals(token))
+ {
+ aa.belowAlignment = true;
+ }
+ }
+ }
+ }
+ if (ala == null)
+ {
+ System.err.print("\n");
+ }
+ }
+
+ void addAlignmentDetails(AlignmentI al, StringTokenizer st)
+ {
+ String keyValue, key, value;
+ while (st.hasMoreTokens())
+ {
+ keyValue = st.nextToken();
+ key = keyValue.substring(0, keyValue.indexOf("="));
+ value = keyValue.substring(keyValue.indexOf("=") + 1);
+ al.setProperty(key, value);
+ }
+ }
+
+ /**
+ * Write annotations as a CSV file of the form 'label, value, value, ...' for
+ * each row.
+ *
+ * @param annotations
+ * @return CSV file as a string.
+ */
+ public String printCSVAnnotations(AlignmentAnnotation[] annotations)
+ {
+ StringBuffer sp = new StringBuffer();
+ for (int i = 0; i < annotations.length; i++)
+ {
+ String atos = annotations[i].toString();
+ int p = 0;
+ do
+ {
+ int cp = atos.indexOf("\n", p);
+ sp.append(annotations[i].label);
+ sp.append(",");
+ if (cp > p)
+ {
+ sp.append(atos.substring(p, cp + 1));
+ }
+ else
+ {
+ sp.append(atos.substring(p));
+ sp.append(newline);
+ }
+ p = cp + 1;
+ } while (p > 0);
+ }
+ return sp.toString();
+ }
+
+ public String printAnnotationsForView(AlignViewportI viewport)
+ {
+ return printAnnotations(viewport.isShowAnnotation() ? viewport
+ .getAlignment().getAlignmentAnnotation() : null, viewport
+ .getAlignment().getGroups(), viewport.getAlignment()
+ .getProperties(), viewport.getColumnSelection(),
+ viewport.getAlignment(), null);
+ }
+
+ public String printAnnotationsForAlignment(AlignmentI al)
+ {
+ return printAnnotations(al.getAlignmentAnnotation(), al.getGroups(),
+ al.getProperties(), null, al, null);
+ }
+}
diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java
index 635c801..00d6d2f 100644
--- a/src/jalview/io/AppletFormatAdapter.java
+++ b/src/jalview/io/AppletFormatAdapter.java
@@ -1,87 +1,134 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
+import jalview.api.AlignExportSettingI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.util.MessageManager;
+
import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
-
-import jalview.datamodel.*;
+import java.util.List;
/**
* A low level class for alignment and feature IO with alignment formatting
* methods used by both applet and application for generating flat alignment
* files. It also holds the lists of magic format names that the applet and
* application will allow the user to read or write files with.
- *
+ *
* @author $author$
* @version $Revision$
*/
public class AppletFormatAdapter
{
+ private AlignmentViewPanel viewpanel;
+
+ public static String FILE = "File";
+
+ public static String URL = "URL";
+
+ public static String PASTE = "Paste";
+
+ public static String CLASSLOADER = "ClassLoader";
+
/**
- * List of valid format strings used in the isValidFormat method
+ * add jalview-derived non-secondary structure annotation from PDB structure
*/
- public static final String[] READABLE_FORMATS = new String[]
- { "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH",
- "PDB", "JnetFile" }; // , "SimpleBLAST" };
+ boolean annotFromStructure = false;
/**
- * List of valid format strings for use by callers of the formatSequences
- * method
+ * add secondary structure from PDB data with built-in algorithms
*/
- public static final String[] WRITEABLE_FORMATS = new String[]
- { "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "AMSA" };
+ boolean localSecondaryStruct = false;
/**
- * List of extensions corresponding to file format types in WRITABLE_FNAMES
- * that are writable by the application.
+ * process PDB data with web services
+ */
+ boolean serviceSecondaryStruct = false;
+
+ private AlignFile alignFile = null;
+
+ String inFile;
+
+ /**
+ * character used to write newlines
*/
- public static final String[] WRITABLE_EXTENSIONS = new String[]
- { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar" };
+ protected String newline = System.getProperty("line.separator");
+
+ private AlignExportSettingI exportSettings;
/**
- * List of writable formats by the application. Order must correspond with the
- * WRITABLE_EXTENSIONS list of formats.
+ * List of valid format strings used in the isValidFormat method
*/
- public static final String[] WRITABLE_FNAMES = new String[]
- { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview" };
+ public static final String[] READABLE_FORMATS = new String[] { "BLC",
+ "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH", "PDB",
+ "JnetFile", "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC,
+ IdentifyFile.GFF3File, "HTML" };
/**
* List of readable format file extensions by application in order
* corresponding to READABLE_FNAMES
*/
- public static final String[] READABLE_EXTENSIONS = new String[]
- { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar",
- "sto" }; // ,
-
- // ".blast"
- // };
+ public static final String[] READABLE_EXTENSIONS = new String[] {
+ "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa",
+ "sto,stk", "xml,rnaml", PhylipFile.FILE_EXT, JSONFile.FILE_EXT,
+ ".gff2,gff3", "jar,jvp", HtmlFile.FILE_EXT };
/**
* List of readable formats by application in order corresponding to
* READABLE_EXTENSIONS
*/
- public static final String[] READABLE_FNAMES = new String[]
- { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview",
- "Stockholm" };// ,
+ public static final String[] READABLE_FNAMES = new String[] { "Fasta",
+ "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Stockholm", "RNAML",
+ PhylipFile.FILE_DESC, JSONFile.FILE_DESC, IdentifyFile.GFF3File,
+ "Jalview", HtmlFile.FILE_DESC };
- // "SimpleBLAST"
- // };
+ /**
+ * List of valid format strings for use by callers of the formatSequences
+ * method
+ */
+ public static final String[] WRITEABLE_FORMATS = new String[] { "BLC",
+ "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "AMSA", "STH",
+ PhylipFile.FILE_DESC, JSONFile.FILE_DESC };
+
+ /**
+ * List of extensions corresponding to file format types in WRITABLE_FNAMES
+ * that are writable by the application.
+ */
+ public static final String[] WRITABLE_EXTENSIONS = new String[] {
+ "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa",
+ "sto,stk", PhylipFile.FILE_EXT, JSONFile.FILE_EXT, "jvp" };
+
+ /**
+ * List of writable formats by the application. Order must correspond with the
+ * WRITABLE_EXTENSIONS list of formats.
+ */
+ public static final String[] WRITABLE_FNAMES = new String[] { "Fasta",
+ "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "STH",
+ PhylipFile.FILE_DESC, JSONFile.FILE_DESC, "Jalview" };
public static String INVALID_CHARACTERS = "Contains invalid characters";
@@ -89,8 +136,24 @@ public class AppletFormatAdapter
public static String SUPPORTED_FORMATS = "Formats currently supported are\n"
+ prettyPrint(READABLE_FORMATS);
+ public AppletFormatAdapter()
+ {
+ }
+
+ public AppletFormatAdapter(AlignmentViewPanel viewpanel)
+ {
+ this.viewpanel = viewpanel;
+ }
+
+ public AppletFormatAdapter(AlignmentViewPanel alignPanel,
+ AlignExportSettingI settings)
+ {
+ viewpanel = alignPanel;
+ exportSettings = settings;
+ }
+
/**
- *
+ *
* @param els
* @return grammatically correct(ish) list consisting of els elements.
*/
@@ -100,38 +163,25 @@ public class AppletFormatAdapter
for (int i = 0, iSize = els.length - 1; i < iSize; i++)
{
list.append(els[i]);
- list.append(",");
+ list.append(", ");
}
list.append(" and " + els[els.length - 1] + ".");
return list.toString();
}
- public static String FILE = "File";
-
- public static String URL = "URL";
-
- public static String PASTE = "Paste";
-
- public static String CLASSLOADER = "ClassLoader";
-
- AlignFile afile = null;
-
- String inFile;
- /**
- * character used to write newlines
- */
- protected String newline = System.getProperty("line.separator");
public void setNewlineString(String nl)
{
newline = nl;
}
+
public String getNewlineString()
{
return newline;
}
+
/**
* check that this format is valid for reading
- *
+ *
* @param format
* a format string to be compared with READABLE_FORMATS
* @return true if format is readable
@@ -143,7 +193,7 @@ public class AppletFormatAdapter
/**
* validate format is valid for IO
- *
+ *
* @param format
* a format string to be compared with either READABLE_FORMATS or
* WRITEABLE_FORMATS
@@ -154,12 +204,16 @@ public class AppletFormatAdapter
public static final boolean isValidFormat(String format,
boolean forwriting)
{
+ if (format == null)
+ {
+ return false;
+ }
boolean valid = false;
String[] format_list = (forwriting) ? WRITEABLE_FORMATS
: READABLE_FORMATS;
- for (int i = 0; i < format_list.length; i++)
+ for (String element : format_list)
{
- if (format_list[i].equalsIgnoreCase(format))
+ if (element.equalsIgnoreCase(format))
{
return true;
}
@@ -170,17 +224,17 @@ public class AppletFormatAdapter
/**
* Constructs the correct filetype parser for a characterised datasource
- *
+ *
* @param inFile
* data/data location
* @param type
* type of datasource
* @param format
* File format of data provided by datasource
- *
+ *
* @return DOCUMENT ME!
*/
- public Alignment readFile(String inFile, String type, String format)
+ public AlignmentI readFile(String inFile, String type, String format)
throws java.io.IOException
{
// TODO: generalise mapping between format string and io. class instances
@@ -190,55 +244,73 @@ public class AppletFormatAdapter
{
if (format.equals("FASTA"))
{
- afile = new FastaFile(inFile, type);
+ alignFile = new FastaFile(inFile, type);
}
else if (format.equals("MSF"))
{
- afile = new MSFfile(inFile, type);
+ alignFile = new MSFfile(inFile, type);
}
else if (format.equals("PileUp"))
{
- afile = new PileUpfile(inFile, type);
+ alignFile = new PileUpfile(inFile, type);
}
else if (format.equals("CLUSTAL"))
{
- afile = new ClustalFile(inFile, type);
+ alignFile = new ClustalFile(inFile, type);
}
else if (format.equals("BLC"))
{
- afile = new BLCFile(inFile, type);
+ alignFile = new BLCFile(inFile, type);
}
else if (format.equals("PIR"))
{
- afile = new PIRFile(inFile, type);
+ alignFile = new PIRFile(inFile, type);
}
else if (format.equals("PFAM"))
{
- afile = new PfamFile(inFile, type);
+ alignFile = new PfamFile(inFile, type);
}
else if (format.equals("JnetFile"))
{
- afile = new JPredFile(inFile, type);
- ((JPredFile) afile).removeNonSequences();
+ alignFile = new JPredFile(inFile, type);
+ ((JPredFile) alignFile).removeNonSequences();
}
else if (format.equals("PDB"))
{
- afile = new MCview.PDBfile(inFile, type);
+ alignFile = new MCview.PDBfile(annotFromStructure,
+ localSecondaryStruct, serviceSecondaryStruct, inFile, type);
+ // Uncomment to test Jmol data based PDB processing: JAL-1213
+ // afile = new jalview.ext.jmol.PDBFileWithJmol(inFile, type);
}
else if (format.equals("STH"))
{
- afile = new StockholmFile(inFile, type);
+ alignFile = new StockholmFile(inFile, type);
}
else if (format.equals("SimpleBLAST"))
{
- afile = new SimpleBlastFile(inFile, type);
+ alignFile = new SimpleBlastFile(inFile, type);
}
-
- Alignment al = new Alignment(afile.getSeqsAsArray());
-
- afile.addAnnotations(al);
-
- return al;
+ else if (format.equals(PhylipFile.FILE_DESC))
+ {
+ alignFile = new PhylipFile(inFile, type);
+ }
+ else if (format.equals(JSONFile.FILE_DESC))
+ {
+ alignFile = new JSONFile(inFile, type);
+ }
+ else if (format.equals(HtmlFile.FILE_DESC))
+ {
+ alignFile = new HtmlFile(inFile, type);
+ }
+ else if (format.equals("RNAML"))
+ {
+ alignFile = new RnamlFile(inFile, type);
+ }
+ else if (format.equals(IdentifyFile.GFF3File))
+ {
+ alignFile = new Gff3File(inFile, type);
+ }
+ return buildAlignmentFrom(alignFile);
} catch (Exception e)
{
e.printStackTrace();
@@ -257,10 +329,8 @@ public class AppletFormatAdapter
try
{
// Possible sequence is just residues with no label
- afile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
- Alignment al = new Alignment(afile.getSeqsAsArray());
- afile.addAnnotations(al);
- return al;
+ alignFile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
+ return buildAlignmentFrom(alignFile);
} catch (Exception ex)
{
@@ -272,7 +342,10 @@ public class AppletFormatAdapter
ex.printStackTrace();
}
}
-
+ if (format.equalsIgnoreCase("HTML"))
+ {
+ throw new IOException(e.getMessage());
+ }
// If we get to this stage, the format was not supported
throw new java.io.IOException(SUPPORTED_FORMATS);
}
@@ -280,15 +353,15 @@ public class AppletFormatAdapter
/**
* Constructs the correct filetype parser for an already open datasource
- *
+ *
* @param source
* an existing datasource
* @param format
* File format of data that will be provided by datasource
- *
+ *
* @return DOCUMENT ME!
*/
- public Alignment readFromFile(FileParse source, String format)
+ public AlignmentI readFromFile(FileParse source, String format)
throws java.io.IOException
{
// TODO: generalise mapping between format string and io. class instances
@@ -301,55 +374,73 @@ public class AppletFormatAdapter
{
if (format.equals("FASTA"))
{
- afile = new FastaFile(source);
+ alignFile = new FastaFile(source);
}
else if (format.equals("MSF"))
{
- afile = new MSFfile(source);
+ alignFile = new MSFfile(source);
}
else if (format.equals("PileUp"))
{
- afile = new PileUpfile(source);
+ alignFile = new PileUpfile(source);
}
else if (format.equals("CLUSTAL"))
{
- afile = new ClustalFile(source);
+ alignFile = new ClustalFile(source);
}
else if (format.equals("BLC"))
{
- afile = new BLCFile(source);
+ alignFile = new BLCFile(source);
}
else if (format.equals("PIR"))
{
- afile = new PIRFile(source);
+ alignFile = new PIRFile(source);
}
else if (format.equals("PFAM"))
{
- afile = new PfamFile(source);
+ alignFile = new PfamFile(source);
}
else if (format.equals("JnetFile"))
{
- afile = new JPredFile(source);
- ((JPredFile) afile).removeNonSequences();
+ alignFile = new JPredFile(source);
+ ((JPredFile) alignFile).removeNonSequences();
}
else if (format.equals("PDB"))
{
- afile = new MCview.PDBfile(source);
+ alignFile = new MCview.PDBfile(annotFromStructure,
+ localSecondaryStruct, serviceSecondaryStruct, source);
}
else if (format.equals("STH"))
{
- afile = new StockholmFile(source);
+ alignFile = new StockholmFile(source);
+ }
+ else if (format.equals("RNAML"))
+ {
+ alignFile = new RnamlFile(source);
}
else if (format.equals("SimpleBLAST"))
{
- afile = new SimpleBlastFile(source);
+ alignFile = new SimpleBlastFile(source);
+ }
+ else if (format.equals(PhylipFile.FILE_DESC))
+ {
+ alignFile = new PhylipFile(source);
+ }
+ else if (format.equals(IdentifyFile.GFF3File))
+ {
+ alignFile = new Gff3File(inFile, type);
+ }
+ else if (format.equals(JSONFile.FILE_DESC))
+ {
+ alignFile = new JSONFile(source);
+ }
+ else if (format.equals(HtmlFile.FILE_DESC))
+ {
+ alignFile = new HtmlFile(source);
}
- Alignment al = new Alignment(afile.getSeqsAsArray());
-
- afile.addAnnotations(al);
+ return buildAlignmentFrom(alignFile);
- return al;
} catch (Exception e)
{
e.printStackTrace();
@@ -368,10 +459,8 @@ public class AppletFormatAdapter
try
{
// Possible sequence is just residues with no label
- afile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
- Alignment al = new Alignment(afile.getSeqsAsArray());
- afile.addAnnotations(al);
- return al;
+ alignFile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
+ return buildAlignmentFrom(alignFile);
} catch (Exception ex)
{
@@ -390,10 +479,61 @@ public class AppletFormatAdapter
}
/**
+ * boilerplate method to handle data from an AlignFile and construct a new
+ * alignment or import to an existing alignment
+ *
+ * @param alignFile2
+ * @return AlignmentI instance ready to pass to a UI constructor
+ */
+ private AlignmentI buildAlignmentFrom(AlignFile alignFile2)
+ {
+ // Standard boilerplate for creating alignment from parser
+ // alignFile.configureForView(viewpanel);
+
+ AlignmentI al = new Alignment(alignFile.getSeqsAsArray());
+
+ alignFile.addAnnotations(al);
+
+ alignFile.addGroups(al);
+
+ return al;
+ }
+
+ /**
+ * create an alignment flatfile from a Jalview alignment view
+ *
+ * @param format
+ * @param jvsuffix
+ * @param av
+ * @param selectedOnly
+ * @return flatfile in a string
+ */
+ public String formatSequences(String format, boolean jvsuffix,
+ AlignmentViewPanel ap, boolean selectedOnly)
+ {
+
+ AlignmentView selvew = ap.getAlignViewport().getAlignmentView(
+ selectedOnly, false);
+ AlignmentI aselview = selvew.getVisibleAlignment(ap.getAlignViewport()
+ .getGapCharacter());
+ List<AlignmentAnnotation> ala = (ap.getAlignViewport()
+ .getVisibleAlignmentAnnotation(selectedOnly));
+ if (ala != null)
+ {
+ for (AlignmentAnnotation aa : ala)
+ {
+ aselview.addAnnotation(aa);
+ }
+ }
+ viewpanel = ap;
+ return formatSequences(format, aselview, jvsuffix);
+ }
+
+ /**
* Construct an output class for an alignment in a particular filetype TODO:
* allow caller to detect errors and warnings encountered when generating
* output
- *
+ *
* @param format
* string name of alignment format
* @param alignment
@@ -401,7 +541,7 @@ public class AppletFormatAdapter
* @param jvsuffix
* passed to AlnFile class controls whether /START-END is added to
* sequence names
- *
+ *
* @return alignment flat file contents
*/
public String formatSequences(String format, AlignmentI alignment,
@@ -410,7 +550,6 @@ public class AppletFormatAdapter
try
{
AlignFile afile = null;
-
if (format.equalsIgnoreCase("FASTA"))
{
afile = new FastaFile();
@@ -441,21 +580,48 @@ public class AppletFormatAdapter
}
else if (format.equalsIgnoreCase("STH"))
{
- afile = new StockholmFile();
+ afile = new StockholmFile(alignment);
}
else if (format.equalsIgnoreCase("AMSA"))
{
afile = new AMSAFile(alignment);
}
+ else if (format.equalsIgnoreCase(PhylipFile.FILE_DESC))
+ {
+ afile = new PhylipFile();
+ }
+ else if (format.equalsIgnoreCase(JSONFile.FILE_DESC))
+ {
+ afile = new JSONFile();
+ }
+ else if (format.equalsIgnoreCase("RNAML"))
+ {
+ afile = new RnamlFile();
+ }
+
else
{
throw new Exception(
- "Implementation error: Unknown file format string");
+ MessageManager
+ .getString("error.implementation_error_unknown_file_format_string"));
}
+
afile.setNewlineString(newline);
afile.addJVSuffix(jvsuffix);
+ afile.setExportSettings(exportSettings);
+ afile.configureForView(viewpanel);
- afile.setSeqs(alignment.getSequencesArray());
+ // check whether we were given a specific alignment to export, rather than
+ // the one in the viewpanel
+ if (viewpanel == null || viewpanel.getAlignment() == null
+ || viewpanel.getAlignment() != alignment)
+ {
+ afile.setSeqs(alignment.getSequencesArray());
+ }
+ else
+ {
+ afile.setSeqs(viewpanel.getAlignment().getSequencesArray());
+ }
String afileresp = afile.print();
if (afile.hasWarningMessage())
@@ -478,7 +644,8 @@ public class AppletFormatAdapter
{
String protocol = FILE;
String ft = file.toLowerCase().trim();
- if (ft.indexOf("http:") ==0 || ft.indexOf("https:") ==0 || ft.indexOf("file:") == 0)
+ if (ft.indexOf("http:") == 0 || ft.indexOf("https:") == 0
+ || ft.indexOf("file:") == 0)
{
protocol = URL;
}
@@ -501,7 +668,7 @@ public class AppletFormatAdapter
System.gc();
long memf = -r.totalMemory() + r.freeMemory();
long t1 = -System.currentTimeMillis();
- Alignment al = afa.readFile(args[i], FILE,
+ AlignmentI al = afa.readFile(args[i], FILE,
new IdentifyFile().Identify(args[i], FILE));
t1 += System.currentTimeMillis();
System.gc();
@@ -529,7 +696,6 @@ public class AppletFormatAdapter
System.out
.println("Difference between free memory now and before is "
+ (memf / (1024.0 * 1024.0) * 1.0) + " MB");
-
} catch (Exception e)
{
System.err.println("Exception when dealing with " + i
@@ -548,7 +714,7 @@ public class AppletFormatAdapter
/**
* try to discover how to access the given file as a valid datasource that
* will be identified as the given type.
- *
+ *
* @param file
* @param format
* @return protocol that yields the data parsable as the given type
@@ -715,4 +881,14 @@ public class AppletFormatAdapter
}
return null;
}
+
+ public AlignFile getAlignFile()
+ {
+ return alignFile;
+ }
+
+ public void setAlignFile(AlignFile alignFile)
+ {
+ this.alignFile = alignFile;
+ }
}
diff --git a/src/jalview/io/BLCFile.java b/src/jalview/io/BLCFile.java
index 7b080a4..071e814 100644
--- a/src/jalview/io/BLCFile.java
+++ b/src/jalview/io/BLCFile.java
@@ -1,26 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.io.IOException;
+import java.util.Vector;
/**
* DOCUMENT ME!
@@ -112,7 +116,9 @@ public class BLCFile extends AlignFile
{
line = nextLine();
if (line == null)
+ {
break;
+ }
// seek end of ids
if (line.indexOf("*") > -1)
{
@@ -147,7 +153,9 @@ public class BLCFile extends AlignFile
}
} while (!idsFound);
if (line == null)
+ {
break; // end of file.
+ }
int starCol = line.indexOf("*");
seqstrings = new StringBuffer[seqs.size()];
@@ -195,9 +203,11 @@ public class BLCFile extends AlignFile
}
if (seqs.size() > 0)
{
- if (headerLines.length() > 1 + numHeaderLines) // could see if buffer is
+ if (headerLines.length() > 1 + numHeaderLines)
+ {
// just whitespace or not.
setAlignmentProperty("Comments", headerLines.toString());
+ }
setAlignmentProperty("iteration", "" + iterationCount);
}
}
diff --git a/src/jalview/io/BioJsHTMLOutput.java b/src/jalview/io/BioJsHTMLOutput.java
new file mode 100644
index 0000000..0d4dc87
--- /dev/null
+++ b/src/jalview/io/BioJsHTMLOutput.java
@@ -0,0 +1,384 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import jalview.api.AlignExportSettingI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentExportData;
+import jalview.exceptions.NoFileSelectedException;
+import jalview.json.binding.biojs.BioJSReleasePojo;
+import jalview.json.binding.biojs.BioJSRepositoryPojo;
+import jalview.util.MessageManager;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Objects;
+import java.util.TreeMap;
+
+public class BioJsHTMLOutput
+{
+ private AlignmentViewPanel ap;
+
+ private static File currentBJSTemplateFile;
+
+ private static TreeMap<String, File> bioJsMSAVersions;
+
+ public static final String DEFAULT_DIR = System.getProperty("user.home")
+ + File.separatorChar + ".biojs_templates" + File.separatorChar;
+
+ public static final String BJS_TEMPLATES_LOCAL_DIRECTORY = jalview.bin.Cache
+ .getDefault("biojs_template_directory", DEFAULT_DIR);
+
+ public static final String BJS_TEMPLATE_GIT_REPO = jalview.bin.Cache
+ .getDefault(
+ "biojs_template_git_repo",
+ "https://raw.githubusercontent.com/jalview/exporter-templates/master/biojs/package.json");
+
+ public BioJsHTMLOutput(AlignmentViewPanel ap)
+ {
+ if (ap != null)
+ {
+ this.ap = ap;
+ }
+ }
+
+ public void exportJalviewAlignmentAsBioJsHtmlFile()
+ {
+ try
+ {
+ String outputFile = getOutputFile();
+ // String jalviewAlignmentJson = JSONFile.getJSONData(ap);
+ AlignExportSettingI exportSettings = new AlignExportSettingI()
+ {
+ @Override
+ public boolean isExportHiddenSequences()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportHiddenColumns()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportAnnotations()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportFeatures()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportGroups()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isCancelled()
+ {
+ return false;
+ }
+
+ };
+ AlignmentExportData exportData = jalview.gui.AlignFrame
+ .getAlignmentForExport(JSONFile.FILE_DESC,
+ ap.getAlignViewport(), exportSettings);
+ if (exportData.getSettings().isCancelled())
+ {
+ return;
+ }
+ String jalviewAlignmentJson = new FormatAdapter(ap,
+ exportData.getSettings()).formatSequences(JSONFile.FILE_DESC,
+ exportData.getAlignment(), exportData.getOmitHidden(),
+ exportData.getStartEndPostions(), ap.getAlignViewport()
+ .getColumnSelection());
+
+ String bioJSTemplateString = getBioJsTemplateAsString();
+ String generatedBioJsWithJalviewAlignmentAsJson = bioJSTemplateString
+ .replaceAll("#sequenceData#", jalviewAlignmentJson)
+ .toString();
+
+ PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(
+ outputFile));
+ out.print(generatedBioJsWithJalviewAlignmentAsJson);
+ out.flush();
+ out.close();
+ jalview.util.BrowserLauncher.openURL("file:///" + outputFile);
+ } catch (NoFileSelectedException ex)
+ {
+ // do noting if no file was selected
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public String getOutputFile() throws NoFileSelectedException
+ {
+ String selectedFile = null;
+ JalviewFileChooser jvFileChooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "html" }, new String[] { "HTML files" },
+ "HTML files");
+ jvFileChooser.setFileView(new JalviewFileView());
+
+ jvFileChooser.setDialogTitle(MessageManager
+ .getString("label.save_as_biojs_html"));
+ jvFileChooser.setToolTipText(MessageManager.getString("action.save"));
+
+ int fileChooserOpt = jvFileChooser.showSaveDialog(null);
+ if (fileChooserOpt == JalviewFileChooser.APPROVE_OPTION)
+ {
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", jvFileChooser
+ .getSelectedFile().getParent());
+ selectedFile = jvFileChooser.getSelectedFile().getPath();
+ }
+ else
+ {
+ throw new NoFileSelectedException("No file was selected.");
+ }
+ return selectedFile;
+ }
+
+ public static String getBioJsTemplateAsString() throws IOException
+ {
+ InputStreamReader isReader = null;
+ BufferedReader buffReader = null;
+ StringBuilder sb = new StringBuilder();
+ Objects.requireNonNull(getCurrentBJSTemplateFile(),
+ "BioJsTemplate File not initialized!");
+ @SuppressWarnings("deprecation")
+ URL url = getCurrentBJSTemplateFile().toURL();
+ if (url != null)
+ {
+ try
+ {
+ isReader = new InputStreamReader(url.openStream());
+ buffReader = new BufferedReader(isReader);
+ String line;
+ String lineSeparator = System.getProperty("line.separator");
+ while ((line = buffReader.readLine()) != null)
+ {
+ sb.append(line).append(lineSeparator);
+ }
+
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } finally
+ {
+ if (isReader != null)
+ {
+ isReader.close();
+ }
+
+ if (buffReader != null)
+ {
+ buffReader.close();
+ }
+ }
+ }
+ return sb.toString();
+ }
+
+ public static void refreshBioJSVersionsInfo(String dirName)
+ throws URISyntaxException
+ {
+ File directory = new File(BJS_TEMPLATES_LOCAL_DIRECTORY);
+ Objects.requireNonNull(dirName, "dirName MUST not be null!");
+ Objects.requireNonNull(directory, "directory MUST not be null!");
+ TreeMap<String, File> versionFileMap = new TreeMap<String, File>();
+
+ for (File file : directory.listFiles())
+ {
+ if (file.isFile())
+ {
+ String fileName = file.getName().substring(0,
+ file.getName().lastIndexOf("."));
+ String fileMeta[] = fileName.split("_");
+ if (fileMeta.length > 2)
+ {
+ setCurrentBJSTemplateFile(file);
+ versionFileMap.put(fileMeta[2], file);
+ }
+ else if (fileMeta.length > 1)
+ {
+ versionFileMap.put(fileMeta[1], file);
+ }
+ }
+ }
+ if (getCurrentBJSTemplateFile() == null && versionFileMap.size() > 0)
+ {
+ setCurrentBJSTemplateFile(versionFileMap.lastEntry().getValue());
+ }
+ setBioJsMSAVersions(versionFileMap);
+ }
+
+ public static void updateBioJS()
+ {
+ Thread updateThread = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ String gitRepoPkgJson = getURLContentAsString(BJS_TEMPLATE_GIT_REPO);
+ if (gitRepoPkgJson != null)
+ {
+ BioJSRepositoryPojo release = new BioJSRepositoryPojo(
+ gitRepoPkgJson);
+ syncUpdates(BJS_TEMPLATES_LOCAL_DIRECTORY, release);
+ refreshBioJSVersionsInfo(BJS_TEMPLATES_LOCAL_DIRECTORY);
+ }
+ } catch (URISyntaxException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ };
+ updateThread.start();
+
+ }
+
+ public static void syncUpdates(String localDir, BioJSRepositoryPojo repo)
+ {
+ for (BioJSReleasePojo bjsRelease : repo.getReleases())
+ {
+ String releaseUrl = bjsRelease.getUrl();
+ String releaseVersion = bjsRelease.getVersion();
+ String releaseFile = "BioJsMSA_" + releaseVersion + ".txt";
+ if (releaseVersion.equals(repo.getLatestReleaseVersion()))
+ {
+ releaseFile = "Latest_BioJsMSA_" + releaseVersion + ".txt";
+ }
+
+ File biojsDirectory = new File(BJS_TEMPLATES_LOCAL_DIRECTORY);
+ if (!biojsDirectory.exists())
+ {
+ if (!biojsDirectory.mkdirs())
+ {
+ System.out.println("Couldn't create local directory : "
+ + BJS_TEMPLATES_LOCAL_DIRECTORY);
+ return;
+ }
+ }
+
+ File file = new File(BJS_TEMPLATES_LOCAL_DIRECTORY + releaseFile);
+ if (!file.exists())
+ {
+
+ PrintWriter out = null;
+ try
+ {
+ out = new java.io.PrintWriter(new java.io.FileWriter(file));
+ out.print(getURLContentAsString(releaseUrl));
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ } finally
+ {
+ if (out != null)
+ {
+ out.flush();
+ out.close();
+ }
+ }
+ }
+ }
+
+ }
+
+ public static String getURLContentAsString(String url)
+ throws OutOfMemoryError
+ {
+ StringBuilder responseStrBuilder = null;
+ InputStream is = null;
+ try
+ {
+ URL resourceUrl = new URL(url);
+ is = new BufferedInputStream(resourceUrl.openStream());
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ responseStrBuilder = new StringBuilder();
+ String lineContent;
+
+ while ((lineContent = br.readLine()) != null)
+ {
+ responseStrBuilder.append(lineContent).append("\n");
+ }
+ } catch (OutOfMemoryError er)
+ {
+ er.printStackTrace();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ return responseStrBuilder == null ? null : responseStrBuilder
+ .toString();
+ }
+
+ public static File getCurrentBJSTemplateFile()
+ {
+ return currentBJSTemplateFile;
+ }
+
+ public static void setCurrentBJSTemplateFile(File currentBJSTemplateFile)
+ {
+ BioJsHTMLOutput.currentBJSTemplateFile = currentBJSTemplateFile;
+ }
+
+ public static TreeMap<String, File> getBioJsMSAVersions()
+ {
+ return bioJsMSAVersions;
+ }
+
+ public static void setBioJsMSAVersions(
+ TreeMap<String, File> bioJsMSAVersions)
+ {
+ BioJsHTMLOutput.bioJsMSAVersions = bioJsMSAVersions;
+ }
+
+}
diff --git a/src/jalview/io/ClansFile.java b/src/jalview/io/ClansFile.java
index 9f32c70..7e87c1c 100644
--- a/src/jalview/io/ClansFile.java
+++ b/src/jalview/io/ClansFile.java
@@ -1,27 +1,30 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.io;
-
-/**
- * Read or write a CLANS style score matrix file.
- */
-
-public class ClansFile extends FileParse
-{
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+/**
+ * Read or write a CLANS style score matrix file.
+ */
+
+public class ClansFile extends FileParse
+{
+
+}
diff --git a/src/jalview/io/ClustalFile.java b/src/jalview/io/ClustalFile.java
index 6a36078..5dd0e40 100644
--- a/src/jalview/io/ClustalFile.java
+++ b/src/jalview/io/ClustalFile.java
@@ -1,27 +1,34 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.util.Format;
-import jalview.datamodel.*;
-import jalview.util.*;
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
public class ClustalFile extends AlignFile
{
@@ -49,7 +56,9 @@ public class ClustalFile extends AlignFile
{
int i = 0;
boolean flag = false;
-
+ boolean rna = false;
+ boolean top = false;
+ StringBuffer pssecstr = new StringBuffer(), consstr = new StringBuffer();
Vector headers = new Vector();
Hashtable seqhash = new Hashtable();
StringBuffer tempseq;
@@ -60,6 +69,10 @@ public class ClustalFile extends AlignFile
{
while ((line = nextLine()) != null)
{
+ if (line.length() == 0)
+ {
+ top = true;
+ }
if (line.indexOf(" ") != 0)
{
str = new StringTokenizer(line, " ");
@@ -95,6 +108,7 @@ public class ClustalFile extends AlignFile
{
tempseq.append(str.nextToken());
}
+ top = false;
}
}
}
@@ -103,6 +117,20 @@ public class ClustalFile extends AlignFile
flag = true;
}
}
+ else
+ {
+ if (line.matches("\\s+(-|\\.|\\(|\\[|\\]|\\))+"))
+ {
+ if (top)
+ {
+ pssecstr.append(line.trim());
+ }
+ else
+ {
+ consstr.append(line.trim());
+ }
+ }
+ }
}
} catch (IOException e)
{
@@ -139,17 +167,41 @@ public class ClustalFile extends AlignFile
+ headers.elementAt(i));
}
}
+ AlignmentAnnotation lastssa = null;
+ if (pssecstr.length() == maxLength)
+ {
+ Vector ss = new Vector();
+ AlignmentAnnotation ssa = lastssa = StockholmFile
+ .parseAnnotationRow(ss, "secondary structure",
+ pssecstr.toString());
+ ssa.label = "Secondary Structure";
+ annotations.addElement(ssa);
+ }
+ if (consstr.length() == maxLength)
+ {
+ Vector ss = new Vector();
+ AlignmentAnnotation ssa = StockholmFile.parseAnnotationRow(ss,
+ "secondary structure", consstr.toString());
+ ssa.label = "Consensus Secondary Structure";
+ if (lastssa == null
+ || !lastssa.getRNAStruc().equals(
+ ssa.getRNAStruc().replace('-', '.')))
+ {
+ annotations.addElement(ssa);
+ }
+ }
}
}
public String print()
{
return print(getSeqsAsArray());
+ // TODO: locaRNA style aln output
}
public String print(SequenceI[] s)
{
- StringBuffer out = new StringBuffer("CLUSTAL"+newline+newline);
+ StringBuffer out = new StringBuffer("CLUSTAL" + newline + newline);
int max = 0;
int maxid = 0;
diff --git a/src/jalview/io/DBRefFile.java b/src/jalview/io/DBRefFile.java
index f2df79a..6aa5994 100644
--- a/src/jalview/io/DBRefFile.java
+++ b/src/jalview/io/DBRefFile.java
@@ -1,44 +1,47 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.io;
-
-import java.io.IOException;
-
-/**
- * jalview flatfile for io of sequence ID mapping data
- * DATABASE\t<nickname>\t<name>\t<version>... properties?jdbc, url, handler
- * DBREF
- * <seqID>\tDBID\taccno\t|seqstart,seqend,start,end...|\t|dbstart,dbend,...|
- *
- */
-public class DBRefFile extends AlignFile
-{
-
- public void parse() throws IOException
- {
- // TODO Auto-generated method stub
-
- }
-
- public String print()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import java.io.IOException;
+
+/**
+ * jalview flatfile for io of sequence ID mapping data
+ * DATABASE\t<nickname>\t<name>\t<version>... properties?jdbc, url, handler
+ * DBREF
+ * <seqID>\tDBID\taccno\t|seqstart,seqend,start,end...|\t|dbstart,dbend,...|
+ *
+ */
+public class DBRefFile extends AlignFile
+{
+
+ public void parse() throws IOException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String print()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/src/jalview/io/FastaFile.java b/src/jalview/io/FastaFile.java
index 1f51f44..2801ac4 100644
--- a/src/jalview/io/FastaFile.java
+++ b/src/jalview/io/FastaFile.java
@@ -1,25 +1,32 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.io.IOException;
/**
* DOCUMENT ME!
@@ -75,14 +82,14 @@ public class FastaFile extends AlignFile
StringBuffer sb = new StringBuffer();
boolean firstLine = true;
- String line;
+ String line, uline;
Sequence seq = null;
boolean annotation = false;
- while ((line = nextLine()) != null)
+ while ((uline = nextLine()) != null)
{
- line = line.trim();
+ line = uline.trim();
if (line.length() > 0)
{
if (line.charAt(0) == '>')
@@ -91,17 +98,7 @@ public class FastaFile extends AlignFile
{
if (annotation)
{
- Annotation[] anots = new Annotation[sb.length()];
- String anotString = sb.toString();
- for (int i = 0; i < sb.length(); i++)
- {
- anots[i] = new Annotation(anotString.substring(i, i + 1),
- null, ' ', 0);
- }
- AlignmentAnnotation aa = new AlignmentAnnotation(seq
- .getName().substring(2), seq.getDescription(), anots);
-
- annotations.addElement(aa);
+ annotations.addElement(makeAnnotation(seq, sb));
}
}
else
@@ -131,24 +128,14 @@ public class FastaFile extends AlignFile
}
else
{
- sb.append(line);
+ sb.append(annotation ? uline : line);
}
}
}
if (annotation)
{
- Annotation[] anots = new Annotation[sb.length()];
- String anotString = sb.toString();
- for (int i = 0; i < sb.length(); i++)
- {
- anots[i] = new Annotation(anotString.substring(i, i + 1), null,
- ' ', 0);
- }
- AlignmentAnnotation aa = new AlignmentAnnotation(seq.getName()
- .substring(2), seq.getDescription(), anots);
-
- annotations.addElement(aa);
+ annotations.addElement(makeAnnotation(seq, sb));
}
else if (!firstLine)
@@ -158,6 +145,23 @@ public class FastaFile extends AlignFile
}
}
+ private AlignmentAnnotation makeAnnotation(SequenceI seq, StringBuffer sb)
+ {
+ Annotation[] anots = new Annotation[sb.length()];
+ char cb;
+ for (int i = 0; i < anots.length; i++)
+ {
+ char cn = sb.charAt(i);
+ if (cn != ' ')
+ {
+ anots[i] = new Annotation("" + cn, null, ' ', Float.NaN);
+ }
+ }
+ AlignmentAnnotation aa = new AlignmentAnnotation(seq.getName()
+ .substring(2), seq.getDescription(), anots);
+ return aa;
+ }
+
/**
* called by AppletFormatAdapter to generate an annotated alignment, rather
* than bare sequences.
diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java
index 8664cba..f316c5e 100644
--- a/src/jalview/io/FeaturesFile.java
+++ b/src/jalview/io/FeaturesFile.java
@@ -1,1002 +1,1532 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.io;
-
-import java.io.*;
-import java.util.*;
-
-import jalview.analysis.SequenceIdMatcher;
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import jalview.util.Format;
-
-/**
- * Parse and create Jalview Features files Detects GFF format features files and
- * parses. Does not implement standard print() - call specific printFeatures or
- * printGFF. Uses AlignmentI.findSequence(String id) to find the sequence object
- * for the features annotation - this normally works on an exact match.
- *
- * @author AMW
- * @version $Revision$
- */
-public class FeaturesFile extends AlignFile
-{
- /**
- * work around for GFF interpretation bug where source string becomes
- * description rather than a group
- */
- private boolean doGffSource = true;
-
- /**
- * Creates a new FeaturesFile object.
- */
- public FeaturesFile()
- {
- }
-
- /**
- * Creates a new FeaturesFile object.
- *
- * @param inFile
- * DOCUMENT ME!
- * @param type
- * DOCUMENT ME!
- *
- * @throws IOException
- * DOCUMENT ME!
- */
- public FeaturesFile(String inFile, String type) throws IOException
- {
- super(inFile, type);
- }
-
- public FeaturesFile(FileParse source) throws IOException
- {
- super(source);
- }
-
- /**
- * Parse GFF or sequence features file using case-independent matching, discarding URLs
- * @param align - alignment/dataset containing sequences that are to be annotated
- * @param colours - hashtable to store feature colour definitions
- * @param removeHTML - process html strings into plain text
- * @return true if features were added
- */
- public boolean parse(AlignmentI align, Hashtable colours,
- boolean removeHTML)
- {
- return parse(align, colours, null, removeHTML, false);
- }
-
- /**
- * Parse GFF or sequence features file optionally using case-independent matching, discarding URLs
- * @param align - alignment/dataset containing sequences that are to be annotated
- * @param colours - hashtable to store feature colour definitions
- * @param removeHTML - process html strings into plain text
- * @param relaxedIdmatching - when true, ID matches to compound sequence IDs are allowed
- * @return true if features were added
- */
- public boolean parse(AlignmentI align,
- Hashtable colours, boolean removeHTML, boolean relaxedIdMatching)
- {
- return parse(align, colours, null, removeHTML, relaxedIdMatching);
- }
-
- /**
- * Parse GFF or sequence features file optionally using case-independent matching
- * @param align - alignment/dataset containing sequences that are to be annotated
- * @param colours - hashtable to store feature colour definitions
- * @param featureLink - hashtable to store associated URLs
- * @param removeHTML - process html strings into plain text
- * @return true if features were added
- */
- public boolean parse(AlignmentI align, Hashtable colours,
- Hashtable featureLink, boolean removeHTML)
- {
- return parse(align, colours, featureLink, removeHTML, false);
- }
-
- /**
- /**
- * Parse GFF or sequence features file
- * @param align - alignment/dataset containing sequences that are to be annotated
- * @param colours - hashtable to store feature colour definitions
- * @param featureLink - hashtable to store associated URLs
- * @param removeHTML - process html strings into plain text
- * @param relaxedIdmatching - when true, ID matches to compound sequence IDs are allowed
- * @return true if features were added
- */
- public boolean parse(AlignmentI align,
- Hashtable colours, Hashtable featureLink, boolean removeHTML, boolean relaxedIdmatching)
- {
-
- String line = null;
- try
- {
- SequenceI seq = null;
- String type, desc, token = null;
-
- int index, start, end;
- float score;
- StringTokenizer st;
- SequenceFeature sf;
- String featureGroup = null, groupLink = null;
- Hashtable typeLink = new Hashtable();
- /**
- * when true, assume GFF style features rather than Jalview style.
- */
- boolean GFFFile = true;
- while ((line = nextLine()) != null)
- {
- if (line.startsWith("#"))
- {
- continue;
- }
-
- st = new StringTokenizer(line, "\t");
- if (st.countTokens() == 1)
- {
- if (line.trim().equalsIgnoreCase("GFF"))
- {
- // Start parsing file as if it might be GFF again.
- GFFFile = true;
- continue;
- }
- }
- if (st.countTokens() > 1 && st.countTokens() < 4)
- {
- GFFFile = false;
- type = st.nextToken();
- if (type.equalsIgnoreCase("startgroup"))
- {
- featureGroup = st.nextToken();
- if (st.hasMoreElements())
- {
- groupLink = st.nextToken();
- featureLink.put(featureGroup, groupLink);
- }
- }
- else if (type.equalsIgnoreCase("endgroup"))
- {
- // We should check whether this is the current group,
- // but at present theres no way of showing more than 1 group
- st.nextToken();
- featureGroup = null;
- groupLink = null;
- }
- else
- {
- Object colour = null;
- String colscheme = st.nextToken();
- if (colscheme.indexOf("|") > -1
- || colscheme.trim().equalsIgnoreCase("label"))
- {
- // Parse '|' separated graduated colourscheme fields:
- // [label|][mincolour|maxcolour|[absolute|]minvalue|maxvalue|thresholdtype|thresholdvalue]
- // can either provide 'label' only, first is optional, next two
- // colors are required (but may be
- // left blank), next is optional, nxt two min/max are required.
- // first is either 'label'
- // first/second and third are both hexadecimal or word equivalent
- // colour.
- // next two are values parsed as floats.
- // fifth is either 'above','below', or 'none'.
- // sixth is a float value and only required when fifth is either
- // 'above' or 'below'.
- StringTokenizer gcol = new StringTokenizer(colscheme, "|",
- true);
- // set defaults
- int threshtype = AnnotationColourGradient.NO_THRESHOLD;
- float min = Float.MIN_VALUE, max = Float.MAX_VALUE, threshval = Float.NaN;
- boolean labelCol = false;
- // Parse spec line
- String mincol = gcol.nextToken();
- if (mincol == "|")
- {
- System.err
- .println("Expected either 'label' or a colour specification in the line: "
- + line);
- continue;
- }
- String maxcol = null;
- if (mincol.toLowerCase().indexOf("label") == 0)
- {
- labelCol = true;
- mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); // skip
- // '|'
- mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
- }
- String abso = null, minval, maxval;
- if (mincol != null)
- {
- // at least four more tokens
- if (mincol.equals("|"))
- {
- mincol = "";
- }
- else
- {
- gcol.nextToken(); // skip next '|'
- }
- // continue parsing rest of line
- maxcol = gcol.nextToken();
- if (maxcol.equals("|"))
- {
- maxcol = "";
- }
- else
- {
- gcol.nextToken(); // skip next '|'
- }
- abso = gcol.nextToken();
- gcol.nextToken(); // skip next '|'
- if (abso.toLowerCase().indexOf("abso") != 0)
- {
- minval = abso;
- abso = null;
- }
- else
- {
- minval = gcol.nextToken();
- gcol.nextToken(); // skip next '|'
- }
- maxval = gcol.nextToken();
- if (gcol.hasMoreTokens())
- {
- gcol.nextToken(); // skip next '|'
- }
- try
- {
- if (minval.length() > 0)
- {
- min = new Float(minval).floatValue();
- }
- } catch (Exception e)
- {
- System.err
- .println("Couldn't parse the minimum value for graduated colour for type ("
- + colscheme
- + ") - did you misspell 'auto' for the optional automatic colour switch ?");
- e.printStackTrace();
- }
- try
- {
- if (maxval.length() > 0)
- {
- max = new Float(maxval).floatValue();
- }
- } catch (Exception e)
- {
- System.err
- .println("Couldn't parse the maximum value for graduated colour for type ("
- + colscheme + ")");
- e.printStackTrace();
- }
- }
- else
- {
- // add in some dummy min/max colours for the label-only
- // colourscheme.
- mincol = "FFFFFF";
- maxcol = "000000";
- }
- try
- {
- colour = new jalview.schemes.GraduatedColor(
- new UserColourScheme(mincol).findColour('A'),
- new UserColourScheme(maxcol).findColour('A'), min,
- max);
- } catch (Exception e)
- {
- System.err
- .println("Couldn't parse the graduated colour scheme ("
- + colscheme + ")");
- e.printStackTrace();
- }
- if (colour != null)
- {
- ((jalview.schemes.GraduatedColor) colour)
- .setColourByLabel(labelCol);
- ((jalview.schemes.GraduatedColor) colour)
- .setAutoScaled(abso == null);
- // add in any additional parameters
- String ttype = null, tval = null;
- if (gcol.hasMoreTokens())
- {
- // threshold type and possibly a threshold value
- ttype = gcol.nextToken();
- if (ttype.toLowerCase().startsWith("below"))
- {
- ((jalview.schemes.GraduatedColor) colour)
- .setThreshType(AnnotationColourGradient.BELOW_THRESHOLD);
- }
- else if (ttype.toLowerCase().startsWith("above"))
- {
- ((jalview.schemes.GraduatedColor) colour)
- .setThreshType(AnnotationColourGradient.ABOVE_THRESHOLD);
- }
- else
- {
- ((jalview.schemes.GraduatedColor) colour)
- .setThreshType(AnnotationColourGradient.NO_THRESHOLD);
- if (!ttype.toLowerCase().startsWith("no"))
- {
- System.err
- .println("Ignoring unrecognised threshold type : "
- + ttype);
- }
- }
- }
- if (((GraduatedColor) colour).getThreshType() != AnnotationColourGradient.NO_THRESHOLD)
- {
- try
- {
- gcol.nextToken();
- tval = gcol.nextToken();
- ((jalview.schemes.GraduatedColor) colour)
- .setThresh(new Float(tval).floatValue());
- } catch (Exception e)
- {
- System.err
- .println("Couldn't parse threshold value as a float: ("
- + tval + ")");
- e.printStackTrace();
- }
- }
- // parse the thresh-is-min token ?
- if (gcol.hasMoreTokens())
- {
- System.err
- .println("Ignoring additional tokens in parameters in graduated colour specification\n");
- while (gcol.hasMoreTokens())
- {
- System.err.println("|" + gcol.nextToken());
- }
- System.err.println("\n");
- }
- }
- }
- else
- {
- UserColourScheme ucs = new UserColourScheme(colscheme);
- colour = ucs.findColour('A');
- }
- if (colour != null)
- {
- colours.put(type, colour);
- }
- if (st.hasMoreElements())
- {
- String link = st.nextToken();
- typeLink.put(type, link);
- if (featureLink == null)
- {
- featureLink = new Hashtable();
- }
- featureLink.put(type, link);
- }
- }
- continue;
- }
- String seqId = "";
- while (st.hasMoreElements())
- {
-
- if (GFFFile)
- {
- // Still possible this is an old Jalview file,
- // which does not have type colours at the beginning
- seqId = token = st.nextToken();
- seq = findName(align, seqId, relaxedIdmatching);
- if (seq != null)
- {
- desc = st.nextToken();
- String group = null;
- if (doGffSource && desc.indexOf(' ') == -1)
- {
- // could also be a source term rather than description line
- group = new String(desc);
- }
- type = st.nextToken();
- try
- {
- String stt = st.nextToken();
- if (stt.length() == 0 || stt.equals("-"))
- {
- start = 0;
- }
- else
- {
- start = Integer.parseInt(stt);
- }
- } catch (NumberFormatException ex)
- {
- start = 0;
- }
- try
- {
- String stt = st.nextToken();
- if (stt.length() == 0 || stt.equals("-"))
- {
- end = 0;
- }
- else
- {
- end = Integer.parseInt(stt);
- }
- } catch (NumberFormatException ex)
- {
- end = 0;
- }
- // TODO: decide if non positional feature assertion for input data
- // where end==0 is generally valid
- if (end == 0)
- {
- // treat as non-positional feature, regardless.
- start = 0;
- }
- try
- {
- score = new Float(st.nextToken()).floatValue();
- } catch (NumberFormatException ex)
- {
- score = 0;
- }
-
- sf = new SequenceFeature(type, desc, start, end, score, group);
-
- try
- {
- sf.setValue("STRAND", st.nextToken());
- sf.setValue("FRAME", st.nextToken());
- } catch (Exception ex)
- {
- }
-
- if (st.hasMoreTokens())
- {
- StringBuffer attributes = new StringBuffer();
- while (st.hasMoreTokens())
- {
- attributes.append("\t" + st.nextElement());
- }
- // TODO validate and split GFF2 attributes field ? parse out
- // ([A-Za-z][A-Za-z0-9_]*) <value> ; and add as
- // sf.setValue(attrib, val);
- sf.setValue("ATTRIBUTES", attributes.toString());
- }
-
- seq.addSequenceFeature(sf);
- while ((seq = align.findName(seq, seqId, true)) != null)
- {
- seq.addSequenceFeature(new SequenceFeature(sf));
- }
- break;
- }
- }
-
- if (GFFFile && seq == null)
- {
- desc = token;
- }
- else
- {
- desc = st.nextToken();
- }
- if (!st.hasMoreTokens())
- {
- System.err
- .println("DEBUG: Run out of tokens when trying to identify the destination for the feature.. giving up.");
- // in all probability, this isn't a file we understand, so bail
- // quietly.
- return false;
- }
-
- token = st.nextToken();
-
- if (!token.equals("ID_NOT_SPECIFIED"))
- {
- seq = findName(align, seqId = token, relaxedIdmatching);
- st.nextToken();
- }
- else
- {
- seqId = null;
- try
- {
- index = Integer.parseInt(st.nextToken());
- seq = align.getSequenceAt(index);
- } catch (NumberFormatException ex)
- {
- seq = null;
- }
- }
-
- if (seq == null)
- {
- System.out.println("Sequence not found: " + line);
- break;
- }
-
- start = Integer.parseInt(st.nextToken());
- end = Integer.parseInt(st.nextToken());
-
- type = st.nextToken();
-
- if (!colours.containsKey(type))
- {
- // Probably the old style groups file
- UserColourScheme ucs = new UserColourScheme(type);
- colours.put(type, ucs.findColour('A'));
- }
- sf = new SequenceFeature(type, desc, "", start, end, featureGroup);
- if (st.hasMoreTokens())
- {
- try
- {
- score = new Float(st.nextToken()).floatValue();
- // update colourgradient bounds if allowed to
- } catch (NumberFormatException ex)
- {
- score = 0;
- }
- sf.setScore(score);
- }
- if (groupLink != null && removeHTML)
- {
- sf.addLink(groupLink);
- sf.description += "%LINK%";
- }
- if (typeLink.containsKey(type) && removeHTML)
- {
- sf.addLink(typeLink.get(type).toString());
- sf.description += "%LINK%";
- }
-
- parseDescriptionHTML(sf, removeHTML);
-
- seq.addSequenceFeature(sf);
-
- while (seqId != null
- && (seq = align.findName(seq, seqId, false)) != null)
- {
- seq.addSequenceFeature(new SequenceFeature(sf));
- }
- // If we got here, its not a GFFFile
- GFFFile = false;
- }
- }
- resetMatcher();
- } catch (Exception ex)
- {
- System.out.println(line);
- System.out.println("Error parsing feature file: " + ex + "\n" + line);
- ex.printStackTrace(System.err);
- resetMatcher();
- return false;
- }
-
- return true;
- }
-
- private AlignmentI lastmatchedAl = null;
-
- private SequenceIdMatcher matcher = null;
-
- /**
- * clear any temporary handles used to speed up ID matching
- */
- private void resetMatcher()
- {
- lastmatchedAl = null;
- matcher = null;
- }
-
- private SequenceI findName(AlignmentI align, String seqId,
- boolean relaxedIdMatching)
- {
- SequenceI match = null;
- if (relaxedIdMatching)
- {
- if (lastmatchedAl != align)
- {
- matcher = new SequenceIdMatcher(
- (lastmatchedAl = align).getSequencesArray());
- }
- match = matcher.findIdMatch(seqId);
- }
- else
- {
- match = align.findName(seqId, true);
- }
- return match;
- }
-
- public void parseDescriptionHTML(SequenceFeature sf, boolean removeHTML)
- {
- if (sf.getDescription() == null)
- {
- return;
- }
- jalview.util.ParseHtmlBodyAndLinks parsed = new jalview.util.ParseHtmlBodyAndLinks(sf.getDescription(), removeHTML, newline);
-
- sf.description = (removeHTML) ? parsed.getNonHtmlContent() : sf.description;
- for (String link:parsed.getLinks())
- {
- sf.addLink(link);
- }
-
- }
-
- /**
- * generate a features file for seqs includes non-pos features by default.
- *
- * @param seqs
- * source of sequence features
- * @param visible
- * hash of feature types and colours
- * @return features file contents
- */
- public String printJalviewFormat(SequenceI[] seqs, Hashtable visible)
- {
- return printJalviewFormat(seqs, visible, true, true);
- }
-
- /**
- * generate a features file for seqs with colours from visible (if any)
- *
- * @param seqs
- * source of features
- * @param visible
- * hash of Colours for each feature type
- * @param visOnly
- * when true only feature types in 'visible' will be output
- * @param nonpos
- * indicates if non-positional features should be output (regardless
- * of group or type)
- * @return features file contents
- */
- public String printJalviewFormat(SequenceI[] seqs, Hashtable visible,
- boolean visOnly, boolean nonpos)
- {
- StringBuffer out = new StringBuffer();
- SequenceFeature[] next;
- boolean featuresGen = false;
- if (visOnly && !nonpos && (visible == null || visible.size() < 1))
- {
- // no point continuing.
- return "No Features Visible";
- }
-
- if (visible != null && visOnly)
- {
- // write feature colours only if we're given them and we are generating
- // viewed features
- // TODO: decide if feature links should also be written here ?
- Enumeration en = visible.keys();
- String type, color;
- while (en.hasMoreElements())
- {
- type = en.nextElement().toString();
-
- if (visible.get(type) instanceof GraduatedColor)
- {
- GraduatedColor gc = (GraduatedColor) visible.get(type);
- color = (gc.isColourByLabel() ? "label|" : "")
- + Format.getHexString(gc.getMinColor()) + "|"
- + Format.getHexString(gc.getMaxColor())
- + (gc.isAutoScale() ? "|" : "|abso|") + gc.getMin() + "|"
- + gc.getMax() + "|";
- if (gc.getThreshType() != AnnotationColourGradient.NO_THRESHOLD)
- {
- if (gc.getThreshType() == AnnotationColourGradient.BELOW_THRESHOLD)
- {
- color += "below";
- }
- else
- {
- if (gc.getThreshType() != AnnotationColourGradient.ABOVE_THRESHOLD)
- {
- System.err.println("WARNING: Unsupported threshold type ("
- + gc.getThreshType() + ") : Assuming 'above'");
- }
- color += "above";
- }
- // add the value
- color += "|" + gc.getThresh();
- }
- else
- {
- color += "none";
- }
- }
- else if (visible.get(type) instanceof java.awt.Color)
- {
- color = Format.getHexString((java.awt.Color) visible.get(type));
- }
- else
- {
- // legacy support for integer objects containing colour triplet values
- color = Format.getHexString(new java.awt.Color(Integer
- .parseInt(visible.get(type).toString())));
- }
- out.append(type);
- out.append("\t");
- out.append(color);
- out.append(newline);
- }
- }
- // Work out which groups are both present and visible
- Vector groups = new Vector();
- int groupIndex = 0;
- boolean isnonpos = false;
-
- for (int i = 0; i < seqs.length; i++)
- {
- next = seqs[i].getSequenceFeatures();
- if (next != null)
- {
- for (int j = 0; j < next.length; j++)
- {
- isnonpos = next[j].begin == 0 && next[j].end == 0;
- if ((!nonpos && isnonpos)
- || (!isnonpos && visOnly && !visible
- .containsKey(next[j].type)))
- {
- continue;
- }
-
- if (next[j].featureGroup != null
- && !groups.contains(next[j].featureGroup))
- {
- groups.addElement(next[j].featureGroup);
- }
- }
- }
- }
-
- String group = null;
- do
- {
-
- if (groups.size() > 0 && groupIndex < groups.size())
- {
- group = groups.elementAt(groupIndex).toString();
- out.append(newline);
- out.append("STARTGROUP\t");
- out.append(group);
- out.append(newline);
- }
- else
- {
- group = null;
- }
-
- for (int i = 0; i < seqs.length; i++)
- {
- next = seqs[i].getSequenceFeatures();
- if (next != null)
- {
- for (int j = 0; j < next.length; j++)
- {
- isnonpos = next[j].begin == 0 && next[j].end == 0;
- if ((!nonpos && isnonpos)
- || (!isnonpos && visOnly && !visible
- .containsKey(next[j].type)))
- {
- // skip if feature is nonpos and we ignore them or if we only
- // output visible and it isn't non-pos and it's not visible
- continue;
- }
-
- if (group != null
- && (next[j].featureGroup == null || !next[j].featureGroup
- .equals(group)))
- {
- continue;
- }
-
- if (group == null && next[j].featureGroup != null)
- {
- continue;
- }
- // we have features to output
- featuresGen = true;
- if (next[j].description == null
- || next[j].description.equals(""))
- {
- out.append(next[j].type + "\t");
- }
- else
- {
- if (next[j].links != null
- && next[j].getDescription().indexOf("<html>") == -1)
- {
- out.append("<html>");
- }
-
- out.append(next[j].description + " ");
- if (next[j].links != null)
- {
- for (int l = 0; l < next[j].links.size(); l++)
- {
- String label = next[j].links.elementAt(l).toString();
- String href = label.substring(label.indexOf("|") + 1);
- label = label.substring(0, label.indexOf("|"));
-
- if (next[j].description.indexOf(href) == -1)
- {
- out.append("<a href=\"" + href + "\">" + label + "</a>");
- }
- }
-
- if (next[j].getDescription().indexOf("</html>") == -1)
- {
- out.append("</html>");
- }
- }
-
- out.append("\t");
- }
- out.append(seqs[i].getName());
- out.append("\t-1\t");
- out.append(next[j].begin);
- out.append("\t");
- out.append(next[j].end);
- out.append("\t");
- out.append(next[j].type);
- if (next[j].score != Float.NaN)
- {
- out.append("\t");
- out.append(next[j].score);
- }
- out.append(newline);
- }
- }
- }
-
- if (group != null)
- {
- out.append("ENDGROUP\t");
- out.append(group);
- out.append(newline);
- groupIndex++;
- }
- else
- {
- break;
- }
-
- } while (groupIndex < groups.size() + 1);
-
- if (!featuresGen)
- {
- return "No Features Visible";
- }
-
- return out.toString();
- }
-
- /**
- * generate a gff file for sequence features includes non-pos features by
- * default.
- *
- * @param seqs
- * @param visible
- * @return
- */
- public String printGFFFormat(SequenceI[] seqs, Hashtable visible)
- {
- return printGFFFormat(seqs, visible, true, true);
- }
-
- public String printGFFFormat(SequenceI[] seqs, Hashtable visible,
- boolean visOnly, boolean nonpos)
- {
- StringBuffer out = new StringBuffer();
- SequenceFeature[] next;
- String source;
- boolean isnonpos;
- for (int i = 0; i < seqs.length; i++)
- {
- if (seqs[i].getSequenceFeatures() != null)
- {
- next = seqs[i].getSequenceFeatures();
- for (int j = 0; j < next.length; j++)
- {
- isnonpos = next[j].begin == 0 && next[j].end == 0;
- if ((!nonpos && isnonpos)
- || (!isnonpos && visOnly && !visible
- .containsKey(next[j].type)))
- {
- continue;
- }
-
- source = next[j].featureGroup;
- if (source == null)
- {
- source = next[j].getDescription();
- }
-
- out.append(seqs[i].getName());
- out.append("\t");
- out.append(source);
- out.append("\t");
- out.append(next[j].type);
- out.append("\t");
- out.append(next[j].begin);
- out.append("\t");
- out.append(next[j].end);
- out.append("\t");
- out.append(next[j].score);
- out.append("\t");
-
- if (next[j].getValue("STRAND") != null)
- {
- out.append(next[j].getValue("STRAND"));
- out.append("\t");
- }
- else
- {
- out.append(".\t");
- }
-
- if (next[j].getValue("FRAME") != null)
- {
- out.append(next[j].getValue("FRAME"));
- }
- else
- {
- out.append(".");
- }
- // TODO: verify/check GFF - should there be a /t here before attribute
- // output ?
-
- if (next[j].getValue("ATTRIBUTES") != null)
- {
- out.append(next[j].getValue("ATTRIBUTES"));
- }
-
- out.append(newline);
-
- }
- }
- }
-
- return out.toString();
- }
-
- /**
- * this is only for the benefit of object polymorphism - method does nothing.
- */
- public void parse()
- {
- // IGNORED
- }
-
- /**
- * this is only for the benefit of object polymorphism - method does nothing.
- *
- * @return error message
- */
- public String print()
- {
- return "USE printGFFFormat() or printJalviewFormat()";
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import jalview.analysis.SequenceIdMatcher;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceDummy;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.GraduatedColor;
+import jalview.schemes.UserColourScheme;
+import jalview.util.Format;
+import jalview.util.MapList;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+/**
+ * Parse and create Jalview Features files Detects GFF format features files and
+ * parses. Does not implement standard print() - call specific printFeatures or
+ * printGFF. Uses AlignmentI.findSequence(String id) to find the sequence object
+ * for the features annotation - this normally works on an exact match.
+ *
+ * @author AMW
+ * @version $Revision$
+ */
+public class FeaturesFile extends AlignFile
+{
+ /**
+ * work around for GFF interpretation bug where source string becomes
+ * description rather than a group
+ */
+ private boolean doGffSource = true;
+
+ private int gffversion;
+
+ /**
+ * Creates a new FeaturesFile object.
+ */
+ public FeaturesFile()
+ {
+ }
+
+ /**
+ * @param inFile
+ * @param type
+ * @throws IOException
+ */
+ public FeaturesFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+ }
+
+ /**
+ * @param source
+ * @throws IOException
+ */
+ public FeaturesFile(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ /**
+ * @param parseImmediately
+ * @param source
+ * @throws IOException
+ */
+ public FeaturesFile(boolean parseImmediately, FileParse source)
+ throws IOException
+ {
+ super(parseImmediately, source);
+ }
+
+ /**
+ * @param parseImmediately
+ * @param inFile
+ * @param type
+ * @throws IOException
+ */
+ public FeaturesFile(boolean parseImmediately, String inFile, String type)
+ throws IOException
+ {
+ super(parseImmediately, inFile, type);
+ }
+
+ /**
+ * Parse GFF or sequence features file using case-independent matching,
+ * discarding URLs
+ *
+ * @param align
+ * - alignment/dataset containing sequences that are to be annotated
+ * @param colours
+ * - hashtable to store feature colour definitions
+ * @param removeHTML
+ * - process html strings into plain text
+ * @return true if features were added
+ */
+ public boolean parse(AlignmentI align, Hashtable colours,
+ boolean removeHTML)
+ {
+ return parse(align, colours, null, removeHTML, false);
+ }
+
+ /**
+ * Parse GFF or sequence features file optionally using case-independent
+ * matching, discarding URLs
+ *
+ * @param align
+ * - alignment/dataset containing sequences that are to be annotated
+ * @param colours
+ * - hashtable to store feature colour definitions
+ * @param removeHTML
+ * - process html strings into plain text
+ * @param relaxedIdmatching
+ * - when true, ID matches to compound sequence IDs are allowed
+ * @return true if features were added
+ */
+ public boolean parse(AlignmentI align, Map colours, boolean removeHTML,
+ boolean relaxedIdMatching)
+ {
+ return parse(align, colours, null, removeHTML, relaxedIdMatching);
+ }
+
+ /**
+ * Parse GFF or sequence features file optionally using case-independent
+ * matching
+ *
+ * @param align
+ * - alignment/dataset containing sequences that are to be annotated
+ * @param colours
+ * - hashtable to store feature colour definitions
+ * @param featureLink
+ * - hashtable to store associated URLs
+ * @param removeHTML
+ * - process html strings into plain text
+ * @return true if features were added
+ */
+ public boolean parse(AlignmentI align, Map colours, Map featureLink,
+ boolean removeHTML)
+ {
+ return parse(align, colours, featureLink, removeHTML, false);
+ }
+
+ @Override
+ public void addAnnotations(AlignmentI al)
+ {
+ // TODO Auto-generated method stub
+ super.addAnnotations(al);
+ }
+
+ @Override
+ public void addProperties(AlignmentI al)
+ {
+ // TODO Auto-generated method stub
+ super.addProperties(al);
+ }
+
+ @Override
+ public void addSeqGroups(AlignmentI al)
+ {
+ // TODO Auto-generated method stub
+ super.addSeqGroups(al);
+ }
+
+ /**
+ * Parse GFF or sequence features file
+ *
+ * @param align
+ * - alignment/dataset containing sequences that are to be annotated
+ * @param colours
+ * - hashtable to store feature colour definitions
+ * @param featureLink
+ * - hashtable to store associated URLs
+ * @param removeHTML
+ * - process html strings into plain text
+ * @param relaxedIdmatching
+ * - when true, ID matches to compound sequence IDs are allowed
+ * @return true if features were added
+ */
+ public boolean parse(AlignmentI align, Map colours, Map featureLink,
+ boolean removeHTML, boolean relaxedIdmatching)
+ {
+
+ String line = null;
+ try
+ {
+ SequenceI seq = null;
+ /**
+ * keep track of any sequences we try to create from the data if it is a
+ * GFF3 file
+ */
+ ArrayList<SequenceI> newseqs = new ArrayList<SequenceI>();
+ String type, desc, token = null;
+
+ int index, start, end;
+ float score;
+ StringTokenizer st;
+ SequenceFeature sf;
+ String featureGroup = null, groupLink = null;
+ Map typeLink = new Hashtable();
+ /**
+ * when true, assume GFF style features rather than Jalview style.
+ */
+ boolean GFFFile = true;
+ Map<String, String> gffProps = new HashMap<String, String>();
+ while ((line = nextLine()) != null)
+ {
+ // skip comments/process pragmas
+ if (line.startsWith("#"))
+ {
+ if (line.startsWith("##"))
+ {
+ // possibly GFF2/3 version and metadata header
+ processGffPragma(line, gffProps, align, newseqs);
+ line = "";
+ }
+ continue;
+ }
+
+ st = new StringTokenizer(line, "\t");
+ if (st.countTokens() == 1)
+ {
+ if (line.trim().equalsIgnoreCase("GFF"))
+ {
+ // Start parsing file as if it might be GFF again.
+ GFFFile = true;
+ continue;
+ }
+ }
+ if (st.countTokens() > 1 && st.countTokens() < 4)
+ {
+ GFFFile = false;
+ type = st.nextToken();
+ if (type.equalsIgnoreCase("startgroup"))
+ {
+ featureGroup = st.nextToken();
+ if (st.hasMoreElements())
+ {
+ groupLink = st.nextToken();
+ featureLink.put(featureGroup, groupLink);
+ }
+ }
+ else if (type.equalsIgnoreCase("endgroup"))
+ {
+ // We should check whether this is the current group,
+ // but at present theres no way of showing more than 1 group
+ st.nextToken();
+ featureGroup = null;
+ groupLink = null;
+ }
+ else
+ {
+ Object colour = null;
+ String colscheme = st.nextToken();
+ if (colscheme.indexOf("|") > -1
+ || colscheme.trim().equalsIgnoreCase("label"))
+ {
+ // Parse '|' separated graduated colourscheme fields:
+ // [label|][mincolour|maxcolour|[absolute|]minvalue|maxvalue|thresholdtype|thresholdvalue]
+ // can either provide 'label' only, first is optional, next two
+ // colors are required (but may be
+ // left blank), next is optional, nxt two min/max are required.
+ // first is either 'label'
+ // first/second and third are both hexadecimal or word equivalent
+ // colour.
+ // next two are values parsed as floats.
+ // fifth is either 'above','below', or 'none'.
+ // sixth is a float value and only required when fifth is either
+ // 'above' or 'below'.
+ StringTokenizer gcol = new StringTokenizer(colscheme, "|",
+ true);
+ // set defaults
+ int threshtype = AnnotationColourGradient.NO_THRESHOLD;
+ float min = Float.MIN_VALUE, max = Float.MAX_VALUE, threshval = Float.NaN;
+ boolean labelCol = false;
+ // Parse spec line
+ String mincol = gcol.nextToken();
+ if (mincol == "|")
+ {
+ System.err
+ .println("Expected either 'label' or a colour specification in the line: "
+ + line);
+ continue;
+ }
+ String maxcol = null;
+ if (mincol.toLowerCase().indexOf("label") == 0)
+ {
+ labelCol = true;
+ mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); // skip
+ // '|'
+ mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
+ }
+ String abso = null, minval, maxval;
+ if (mincol != null)
+ {
+ // at least four more tokens
+ if (mincol.equals("|"))
+ {
+ mincol = "";
+ }
+ else
+ {
+ gcol.nextToken(); // skip next '|'
+ }
+ // continue parsing rest of line
+ maxcol = gcol.nextToken();
+ if (maxcol.equals("|"))
+ {
+ maxcol = "";
+ }
+ else
+ {
+ gcol.nextToken(); // skip next '|'
+ }
+ abso = gcol.nextToken();
+ gcol.nextToken(); // skip next '|'
+ if (abso.toLowerCase().indexOf("abso") != 0)
+ {
+ minval = abso;
+ abso = null;
+ }
+ else
+ {
+ minval = gcol.nextToken();
+ gcol.nextToken(); // skip next '|'
+ }
+ maxval = gcol.nextToken();
+ if (gcol.hasMoreTokens())
+ {
+ gcol.nextToken(); // skip next '|'
+ }
+ try
+ {
+ if (minval.length() > 0)
+ {
+ min = new Float(minval).floatValue();
+ }
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse the minimum value for graduated colour for type ("
+ + colscheme
+ + ") - did you misspell 'auto' for the optional automatic colour switch ?");
+ e.printStackTrace();
+ }
+ try
+ {
+ if (maxval.length() > 0)
+ {
+ max = new Float(maxval).floatValue();
+ }
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse the maximum value for graduated colour for type ("
+ + colscheme + ")");
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ // add in some dummy min/max colours for the label-only
+ // colourscheme.
+ mincol = "FFFFFF";
+ maxcol = "000000";
+ }
+ try
+ {
+ colour = new jalview.schemes.GraduatedColor(
+ new UserColourScheme(mincol).findColour('A'),
+ new UserColourScheme(maxcol).findColour('A'), min,
+ max);
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse the graduated colour scheme ("
+ + colscheme + ")");
+ e.printStackTrace();
+ }
+ if (colour != null)
+ {
+ ((jalview.schemes.GraduatedColor) colour)
+ .setColourByLabel(labelCol);
+ ((jalview.schemes.GraduatedColor) colour)
+ .setAutoScaled(abso == null);
+ // add in any additional parameters
+ String ttype = null, tval = null;
+ if (gcol.hasMoreTokens())
+ {
+ // threshold type and possibly a threshold value
+ ttype = gcol.nextToken();
+ if (ttype.toLowerCase().startsWith("below"))
+ {
+ ((jalview.schemes.GraduatedColor) colour)
+ .setThreshType(AnnotationColourGradient.BELOW_THRESHOLD);
+ }
+ else if (ttype.toLowerCase().startsWith("above"))
+ {
+ ((jalview.schemes.GraduatedColor) colour)
+ .setThreshType(AnnotationColourGradient.ABOVE_THRESHOLD);
+ }
+ else
+ {
+ ((jalview.schemes.GraduatedColor) colour)
+ .setThreshType(AnnotationColourGradient.NO_THRESHOLD);
+ if (!ttype.toLowerCase().startsWith("no"))
+ {
+ System.err
+ .println("Ignoring unrecognised threshold type : "
+ + ttype);
+ }
+ }
+ }
+ if (((GraduatedColor) colour).getThreshType() != AnnotationColourGradient.NO_THRESHOLD)
+ {
+ try
+ {
+ gcol.nextToken();
+ tval = gcol.nextToken();
+ ((jalview.schemes.GraduatedColor) colour)
+ .setThresh(new Float(tval).floatValue());
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse threshold value as a float: ("
+ + tval + ")");
+ e.printStackTrace();
+ }
+ }
+ // parse the thresh-is-min token ?
+ if (gcol.hasMoreTokens())
+ {
+ System.err
+ .println("Ignoring additional tokens in parameters in graduated colour specification\n");
+ while (gcol.hasMoreTokens())
+ {
+ System.err.println("|" + gcol.nextToken());
+ }
+ System.err.println("\n");
+ }
+ }
+ }
+ else
+ {
+ UserColourScheme ucs = new UserColourScheme(colscheme);
+ colour = ucs.findColour('A');
+ }
+ if (colour != null)
+ {
+ colours.put(type, colour);
+ }
+ if (st.hasMoreElements())
+ {
+ String link = st.nextToken();
+ typeLink.put(type, link);
+ if (featureLink == null)
+ {
+ featureLink = new Hashtable();
+ }
+ featureLink.put(type, link);
+ }
+ }
+ continue;
+ }
+ String seqId = "";
+ while (st.hasMoreElements())
+ {
+
+ if (GFFFile)
+ {
+ // Still possible this is an old Jalview file,
+ // which does not have type colours at the beginning
+ seqId = token = st.nextToken();
+ seq = findName(align, seqId, relaxedIdmatching, newseqs);
+ if (seq != null)
+ {
+ desc = st.nextToken();
+ String group = null;
+ if (doGffSource && desc.indexOf(' ') == -1)
+ {
+ // could also be a source term rather than description line
+ group = new String(desc);
+ }
+ type = st.nextToken();
+ try
+ {
+ String stt = st.nextToken();
+ if (stt.length() == 0 || stt.equals("-"))
+ {
+ start = 0;
+ }
+ else
+ {
+ start = Integer.parseInt(stt);
+ }
+ } catch (NumberFormatException ex)
+ {
+ start = 0;
+ }
+ try
+ {
+ String stt = st.nextToken();
+ if (stt.length() == 0 || stt.equals("-"))
+ {
+ end = 0;
+ }
+ else
+ {
+ end = Integer.parseInt(stt);
+ }
+ } catch (NumberFormatException ex)
+ {
+ end = 0;
+ }
+ // TODO: decide if non positional feature assertion for input data
+ // where end==0 is generally valid
+ if (end == 0)
+ {
+ // treat as non-positional feature, regardless.
+ start = 0;
+ }
+ try
+ {
+ score = new Float(st.nextToken()).floatValue();
+ } catch (NumberFormatException ex)
+ {
+ score = 0;
+ }
+
+ sf = new SequenceFeature(type, desc, start, end, score, group);
+
+ try
+ {
+ sf.setValue("STRAND", st.nextToken());
+ sf.setValue("FRAME", st.nextToken());
+ } catch (Exception ex)
+ {
+ }
+
+ if (st.hasMoreTokens())
+ {
+ StringBuffer attributes = new StringBuffer();
+ boolean sep = false;
+ while (st.hasMoreTokens())
+ {
+ attributes.append((sep ? "\t" : "") + st.nextElement());
+ sep = true;
+ }
+ // TODO validate and split GFF2 attributes field ? parse out
+ // ([A-Za-z][A-Za-z0-9_]*) <value> ; and add as
+ // sf.setValue(attrib, val);
+ sf.setValue("ATTRIBUTES", attributes.toString());
+ }
+
+ if (processOrAddSeqFeature(align, newseqs, seq, sf, GFFFile,
+ relaxedIdmatching))
+ {
+ // check whether we should add the sequence feature to any other
+ // sequences in the alignment with the same or similar
+ while ((seq = align.findName(seq, seqId, true)) != null)
+ {
+ seq.addSequenceFeature(new SequenceFeature(sf));
+ }
+ }
+ break;
+ }
+ }
+
+ if (GFFFile && seq == null)
+ {
+ desc = token;
+ }
+ else
+ {
+ desc = st.nextToken();
+ }
+ if (!st.hasMoreTokens())
+ {
+ System.err
+ .println("DEBUG: Run out of tokens when trying to identify the destination for the feature.. giving up.");
+ // in all probability, this isn't a file we understand, so bail
+ // quietly.
+ return false;
+ }
+
+ token = st.nextToken();
+
+ if (!token.equals("ID_NOT_SPECIFIED"))
+ {
+ seq = findName(align, seqId = token, relaxedIdmatching, null);
+ st.nextToken();
+ }
+ else
+ {
+ seqId = null;
+ try
+ {
+ index = Integer.parseInt(st.nextToken());
+ seq = align.getSequenceAt(index);
+ } catch (NumberFormatException ex)
+ {
+ seq = null;
+ }
+ }
+
+ if (seq == null)
+ {
+ System.out.println("Sequence not found: " + line);
+ break;
+ }
+
+ start = Integer.parseInt(st.nextToken());
+ end = Integer.parseInt(st.nextToken());
+
+ type = st.nextToken();
+
+ if (!colours.containsKey(type))
+ {
+ // Probably the old style groups file
+ UserColourScheme ucs = new UserColourScheme(type);
+ colours.put(type, ucs.findColour('A'));
+ }
+ sf = new SequenceFeature(type, desc, "", start, end, featureGroup);
+ if (st.hasMoreTokens())
+ {
+ try
+ {
+ score = new Float(st.nextToken()).floatValue();
+ // update colourgradient bounds if allowed to
+ } catch (NumberFormatException ex)
+ {
+ score = 0;
+ }
+ sf.setScore(score);
+ }
+ if (groupLink != null && removeHTML)
+ {
+ sf.addLink(groupLink);
+ sf.description += "%LINK%";
+ }
+ if (typeLink.containsKey(type) && removeHTML)
+ {
+ sf.addLink(typeLink.get(type).toString());
+ sf.description += "%LINK%";
+ }
+
+ parseDescriptionHTML(sf, removeHTML);
+
+ seq.addSequenceFeature(sf);
+
+ while (seqId != null
+ && (seq = align.findName(seq, seqId, false)) != null)
+ {
+ seq.addSequenceFeature(new SequenceFeature(sf));
+ }
+ // If we got here, its not a GFFFile
+ GFFFile = false;
+ }
+ }
+ resetMatcher();
+ } catch (Exception ex)
+ {
+ // should report somewhere useful for UI if necessary
+ warningMessage = ((warningMessage == null) ? "" : warningMessage)
+ + "Parsing error at\n" + line;
+ System.out.println("Error parsing feature file: " + ex + "\n" + line);
+ ex.printStackTrace(System.err);
+ resetMatcher();
+ return false;
+ }
+
+ return true;
+ }
+
+ private enum GffPragmas
+ {
+ gff_version, sequence_region, feature_ontology, attribute_ontology, source_ontology, species_build, fasta, hash
+ };
+
+ private static Map<String, GffPragmas> GFFPRAGMA;
+ static
+ {
+ GFFPRAGMA = new HashMap<String, GffPragmas>();
+ GFFPRAGMA.put("sequence-region", GffPragmas.sequence_region);
+ GFFPRAGMA.put("feature-ontology", GffPragmas.feature_ontology);
+ GFFPRAGMA.put("#", GffPragmas.hash);
+ GFFPRAGMA.put("fasta", GffPragmas.fasta);
+ GFFPRAGMA.put("species-build", GffPragmas.species_build);
+ GFFPRAGMA.put("source-ontology", GffPragmas.source_ontology);
+ GFFPRAGMA.put("attribute-ontology", GffPragmas.attribute_ontology);
+ }
+
+ private void processGffPragma(String line, Map<String, String> gffProps,
+ AlignmentI align, ArrayList<SequenceI> newseqs)
+ throws IOException
+ {
+ // line starts with ##
+ int spacepos = line.indexOf(' ');
+ String pragma = spacepos == -1 ? line.substring(2).trim() : line
+ .substring(2, spacepos);
+ GffPragmas gffpragma = GFFPRAGMA.get(pragma.toLowerCase());
+ if (gffpragma == null)
+ {
+ return;
+ }
+ switch (gffpragma)
+ {
+ case gff_version:
+ try
+ {
+ gffversion = Integer.parseInt(line.substring(spacepos + 1));
+ } finally
+ {
+
+ }
+ break;
+ case feature_ontology:
+ // resolve against specific feature ontology
+ break;
+ case attribute_ontology:
+ // resolve against specific attribute ontology
+ break;
+ case source_ontology:
+ // resolve against specific source ontology
+ break;
+ case species_build:
+ // resolve against specific NCBI taxon version
+ break;
+ case hash:
+ // close off any open feature hierarchies
+ break;
+ case fasta:
+ // process the rest of the file as a fasta file and replace any dummy
+ // sequence IDs
+ process_as_fasta(align, newseqs);
+ break;
+ default:
+ // we do nothing ?
+ System.err.println("Ignoring unknown pragma:\n" + line);
+ }
+ }
+
+ private void process_as_fasta(AlignmentI align, List<SequenceI> newseqs)
+ throws IOException
+ {
+ try
+ {
+ mark();
+ } catch (IOException q)
+ {
+ }
+ FastaFile parser = new FastaFile(this);
+ List<SequenceI> includedseqs = parser.getSeqs();
+ SequenceIdMatcher smatcher = new SequenceIdMatcher(newseqs);
+ // iterate over includedseqs, and replacing matching ones with newseqs
+ // sequences. Generic iterator not used here because we modify includedseqs
+ // as we go
+ for (int p = 0, pSize = includedseqs.size(); p < pSize; p++)
+ {
+ // search for any dummy seqs that this sequence can be used to update
+ SequenceI dummyseq = smatcher.findIdMatch(includedseqs.get(p));
+ if (dummyseq != null)
+ {
+ // dummyseq was created so it could be annotated and referred to in
+ // alignments/codon mappings
+
+ SequenceI mseq = includedseqs.get(p);
+ // mseq is the 'template' imported from the FASTA file which we'll use
+ // to coomplete dummyseq
+ if (dummyseq instanceof SequenceDummy)
+ {
+ // probably have the pattern wrong
+ // idea is that a flyweight proxy for a sequence ID can be created for
+ // 1. stable reference creation
+ // 2. addition of annotation
+ // 3. future replacement by a real sequence
+ // current pattern is to create SequenceDummy objects - a convenience
+ // constructor for a Sequence.
+ // problem is that when promoted to a real sequence, all references
+ // need
+ // to be updated somehow.
+ ((SequenceDummy) dummyseq).become(mseq);
+ includedseqs.set(p, dummyseq); // template is no longer needed
+ }
+ }
+ }
+ // finally add sequences to the dataset
+ for (SequenceI seq : includedseqs)
+ {
+ align.addSequence(seq);
+ }
+ }
+
+ /**
+ * take a sequence feature and examine its attributes to decide how it should
+ * be added to a sequence
+ *
+ * @param seq
+ * - the destination sequence constructed or discovered in the
+ * current context
+ * @param sf
+ * - the base feature with ATTRIBUTES property containing any
+ * additional attributes
+ * @param gFFFile
+ * - true if we are processing a GFF annotation file
+ * @return true if sf was actually added to the sequence, false if it was
+ * processed in another way
+ */
+ public boolean processOrAddSeqFeature(AlignmentI align,
+ List<SequenceI> newseqs, SequenceI seq, SequenceFeature sf,
+ boolean gFFFile, boolean relaxedIdMatching)
+ {
+ String attr = (String) sf.getValue("ATTRIBUTES");
+ boolean add = true;
+ if (gFFFile && attr != null)
+ {
+ int nattr = 8;
+
+ for (String attset : attr.split("\t"))
+ {
+ if (attset == null || attset.trim().length() == 0)
+ {
+ continue;
+ }
+ nattr++;
+ Map<String, List<String>> set = new HashMap<String, List<String>>();
+ // normally, only expect one column - 9 - in this field
+ // the attributes (Gff3) or groups (gff2) field
+ for (String pair : attset.trim().split(";"))
+ {
+ pair = pair.trim();
+ if (pair.length() == 0)
+ {
+ continue;
+ }
+
+ // expect either space seperated (gff2) or '=' separated (gff3)
+ // key/value pairs here
+
+ int eqpos = pair.indexOf('='), sppos = pair.indexOf(' ');
+ String key = null, value = null;
+
+ if (sppos > -1 && (eqpos == -1 || sppos < eqpos))
+ {
+ key = pair.substring(0, sppos);
+ value = pair.substring(sppos + 1);
+ }
+ else
+ {
+ if (eqpos > -1 && (sppos == -1 || eqpos < sppos))
+ {
+ key = pair.substring(0, eqpos);
+ value = pair.substring(eqpos + 1);
+ }
+ else
+ {
+ key = pair;
+ }
+ }
+ if (key != null)
+ {
+ List<String> vals = set.get(key);
+ if (vals == null)
+ {
+ vals = new ArrayList<String>();
+ set.put(key, vals);
+ }
+ if (value != null)
+ {
+ vals.add(value.trim());
+ }
+ }
+ }
+ try
+ {
+ add &= processGffKey(set, nattr, seq, sf, align, newseqs,
+ relaxedIdMatching); // process decides if
+ // feature is actually
+ // added
+ } catch (InvalidGFF3FieldException ivfe)
+ {
+ System.err.println(ivfe);
+ }
+ }
+ }
+ if (add)
+ {
+ seq.addSequenceFeature(sf);
+ }
+ return add;
+ }
+
+ public class InvalidGFF3FieldException extends Exception
+ {
+ String field, value;
+
+ public InvalidGFF3FieldException(String field,
+ Map<String, List<String>> set, String message)
+ {
+ super(message + " (Field was " + field + " and value was "
+ + set.get(field).toString());
+ this.field = field;
+ this.value = set.get(field).toString();
+ }
+
+ }
+
+ /**
+ * take a set of keys for a feature and interpret them
+ *
+ * @param set
+ * @param nattr
+ * @param seq
+ * @param sf
+ * @return
+ */
+ public boolean processGffKey(Map<String, List<String>> set, int nattr,
+ SequenceI seq, SequenceFeature sf, AlignmentI align,
+ List<SequenceI> newseqs, boolean relaxedIdMatching)
+ throws InvalidGFF3FieldException
+ {
+ String attr;
+ // decide how to interpret according to type
+ if (sf.getType().equals("similarity"))
+ {
+ int strand = sf.getStrand();
+ // exonerate cdna/protein map
+ // look for fields
+ List<SequenceI> querySeq = findNames(align, newseqs,
+ relaxedIdMatching, set.get(attr = "Query"));
+ if (querySeq == null || querySeq.size() != 1)
+ {
+ throw new InvalidGFF3FieldException(attr, set,
+ "Expecting exactly one sequence in Query field (got "
+ + set.get(attr) + ")");
+ }
+ if (set.containsKey(attr = "Align"))
+ {
+ // process the align maps and create cdna/protein maps
+ // ideally, the query sequences are in the alignment, but maybe not...
+
+ AlignedCodonFrame alco = new AlignedCodonFrame();
+ MapList codonmapping = constructCodonMappingFromAlign(set, attr,
+ strand);
+
+ // add codon mapping, and hope!
+ alco.addMap(seq, querySeq.get(0), codonmapping);
+ align.addCodonFrame(alco);
+ // everything that's needed to be done is done
+ // no features to create here !
+ return false;
+ }
+
+ }
+ return true;
+ }
+
+ private MapList constructCodonMappingFromAlign(
+ Map<String, List<String>> set, String attr, int strand)
+ throws InvalidGFF3FieldException
+ {
+ if (strand == 0)
+ {
+ throw new InvalidGFF3FieldException(attr, set,
+ "Invalid strand for a codon mapping (cannot be 0)");
+ }
+ List<Integer> fromrange = new ArrayList<Integer>(), torange = new ArrayList<Integer>();
+ int lastppos = 0, lastpframe = 0;
+ for (String range : set.get(attr))
+ {
+ List<Integer> ints = new ArrayList<Integer>();
+ StringTokenizer st = new StringTokenizer(range, " ");
+ while (st.hasMoreTokens())
+ {
+ String num = st.nextToken();
+ try
+ {
+ ints.add(new Integer(num));
+ } catch (NumberFormatException nfe)
+ {
+ throw new InvalidGFF3FieldException(attr, set,
+ "Invalid number in field " + num);
+ }
+ }
+ // Align positionInRef positionInQuery LengthInRef
+ // contig_1146 exonerate:protein2genome:local similarity 8534 11269
+ // 3652 - . alignment_id 0 ;
+ // Query DDB_G0269124
+ // Align 11270 143 120
+ // corresponds to : 120 bases align at pos 143 in protein to 11270 on
+ // dna in strand direction
+ // Align 11150 187 282
+ // corresponds to : 282 bases align at pos 187 in protein to 11150 on
+ // dna in strand direction
+ //
+ // Align 10865 281 888
+ // Align 9977 578 1068
+ // Align 8909 935 375
+ //
+ if (ints.size() != 3)
+ {
+ throw new InvalidGFF3FieldException(attr, set,
+ "Invalid number of fields for this attribute ("
+ + ints.size() + ")");
+ }
+ fromrange.add(new Integer(ints.get(0).intValue()));
+ fromrange.add(new Integer(ints.get(0).intValue() + strand
+ * ints.get(2).intValue()));
+ // how are intron/exon boundaries that do not align in codons
+ // represented
+ if (ints.get(1).equals(lastppos) && lastpframe > 0)
+ {
+ // extend existing to map
+ lastppos += ints.get(2) / 3;
+ lastpframe = ints.get(2) % 3;
+ torange.set(torange.size() - 1, new Integer(lastppos));
+ }
+ else
+ {
+ // new to map range
+ torange.add(ints.get(1));
+ lastppos = ints.get(1) + ints.get(2) / 3;
+ lastpframe = ints.get(2) % 3;
+ torange.add(new Integer(lastppos));
+ }
+ }
+ // from and to ranges must end up being a series of start/end intervals
+ if (fromrange.size() % 2 == 1)
+ {
+ throw new InvalidGFF3FieldException(attr, set,
+ "Couldn't parse the DNA alignment range correctly");
+ }
+ if (torange.size() % 2 == 1)
+ {
+ throw new InvalidGFF3FieldException(attr, set,
+ "Couldn't parse the protein alignment range correctly");
+ }
+ // finally, build the map
+ int[] frommap = new int[fromrange.size()], tomap = new int[torange
+ .size()];
+ int p = 0;
+ for (Integer ip : fromrange)
+ {
+ frommap[p++] = ip.intValue();
+ }
+ p = 0;
+ for (Integer ip : torange)
+ {
+ tomap[p++] = ip.intValue();
+ }
+
+ return new MapList(frommap, tomap, 3, 1);
+ }
+
+ private List<SequenceI> findNames(AlignmentI align,
+ List<SequenceI> newseqs, boolean relaxedIdMatching,
+ List<String> list)
+ {
+ List<SequenceI> found = new ArrayList<SequenceI>();
+ for (String seqId : list)
+ {
+ SequenceI seq = findName(align, seqId, relaxedIdMatching, newseqs);
+ if (seq != null)
+ {
+ found.add(seq);
+ }
+ }
+ return found;
+ }
+
+ private AlignmentI lastmatchedAl = null;
+
+ private SequenceIdMatcher matcher = null;
+
+ /**
+ * clear any temporary handles used to speed up ID matching
+ */
+ private void resetMatcher()
+ {
+ lastmatchedAl = null;
+ matcher = null;
+ }
+
+ private SequenceI findName(AlignmentI align, String seqId,
+ boolean relaxedIdMatching, List<SequenceI> newseqs)
+ {
+ SequenceI match = null;
+ if (relaxedIdMatching)
+ {
+ if (lastmatchedAl != align)
+ {
+ matcher = new SequenceIdMatcher(
+ (lastmatchedAl = align).getSequencesArray());
+ if (newseqs != null)
+ {
+ matcher.addAll(newseqs);
+ }
+ }
+ match = matcher.findIdMatch(seqId);
+ }
+ else
+ {
+ match = align.findName(seqId, true);
+ if (match == null && newseqs != null)
+ {
+ for (SequenceI m : newseqs)
+ {
+ if (seqId.equals(m.getName()))
+ {
+ return m;
+ }
+ }
+ }
+
+ }
+ if (match == null && newseqs != null)
+ {
+ match = new SequenceDummy(seqId);
+ if (relaxedIdMatching)
+ {
+ matcher.addAll(Arrays.asList(new SequenceI[] { match }));
+ }
+ // add dummy sequence to the newseqs list
+ newseqs.add(match);
+ }
+ return match;
+ }
+
+ public void parseDescriptionHTML(SequenceFeature sf, boolean removeHTML)
+ {
+ if (sf.getDescription() == null)
+ {
+ return;
+ }
+ jalview.util.ParseHtmlBodyAndLinks parsed = new jalview.util.ParseHtmlBodyAndLinks(
+ sf.getDescription(), removeHTML, newline);
+
+ sf.description = (removeHTML) ? parsed.getNonHtmlContent()
+ : sf.description;
+ for (String link : parsed.getLinks())
+ {
+ sf.addLink(link);
+ }
+
+ }
+
+ /**
+ * generate a features file for seqs includes non-pos features by default.
+ *
+ * @param seqs
+ * source of sequence features
+ * @param visible
+ * hash of feature types and colours
+ * @return features file contents
+ */
+ public String printJalviewFormat(SequenceI[] seqs,
+ Map<String, Object> visible)
+ {
+ return printJalviewFormat(seqs, visible, true, true);
+ }
+
+ /**
+ * generate a features file for seqs with colours from visible (if any)
+ *
+ * @param seqs
+ * source of features
+ * @param visible
+ * hash of Colours for each feature type
+ * @param visOnly
+ * when true only feature types in 'visible' will be output
+ * @param nonpos
+ * indicates if non-positional features should be output (regardless
+ * of group or type)
+ * @return features file contents
+ */
+ public String printJalviewFormat(SequenceI[] seqs, Map visible,
+ boolean visOnly, boolean nonpos)
+ {
+ StringBuffer out = new StringBuffer();
+ SequenceFeature[] next;
+ boolean featuresGen = false;
+ if (visOnly && !nonpos && (visible == null || visible.size() < 1))
+ {
+ // no point continuing.
+ return "No Features Visible";
+ }
+
+ if (visible != null && visOnly)
+ {
+ // write feature colours only if we're given them and we are generating
+ // viewed features
+ // TODO: decide if feature links should also be written here ?
+ Iterator en = visible.keySet().iterator();
+ String type, color;
+ while (en.hasNext())
+ {
+ type = en.next().toString();
+
+ if (visible.get(type) instanceof GraduatedColor)
+ {
+ GraduatedColor gc = (GraduatedColor) visible.get(type);
+ color = (gc.isColourByLabel() ? "label|" : "")
+ + Format.getHexString(gc.getMinColor()) + "|"
+ + Format.getHexString(gc.getMaxColor())
+ + (gc.isAutoScale() ? "|" : "|abso|") + gc.getMin() + "|"
+ + gc.getMax() + "|";
+ if (gc.getThreshType() != AnnotationColourGradient.NO_THRESHOLD)
+ {
+ if (gc.getThreshType() == AnnotationColourGradient.BELOW_THRESHOLD)
+ {
+ color += "below";
+ }
+ else
+ {
+ if (gc.getThreshType() != AnnotationColourGradient.ABOVE_THRESHOLD)
+ {
+ System.err.println("WARNING: Unsupported threshold type ("
+ + gc.getThreshType() + ") : Assuming 'above'");
+ }
+ color += "above";
+ }
+ // add the value
+ color += "|" + gc.getThresh();
+ }
+ else
+ {
+ color += "none";
+ }
+ }
+ else if (visible.get(type) instanceof java.awt.Color)
+ {
+ color = Format.getHexString((java.awt.Color) visible.get(type));
+ }
+ else
+ {
+ // legacy support for integer objects containing colour triplet values
+ color = Format.getHexString(new java.awt.Color(Integer
+ .parseInt(visible.get(type).toString())));
+ }
+ out.append(type);
+ out.append("\t");
+ out.append(color);
+ out.append(newline);
+ }
+ }
+ // Work out which groups are both present and visible
+ Vector groups = new Vector();
+ int groupIndex = 0;
+ boolean isnonpos = false;
+
+ for (int i = 0; i < seqs.length; i++)
+ {
+ next = seqs[i].getSequenceFeatures();
+ if (next != null)
+ {
+ for (int j = 0; j < next.length; j++)
+ {
+ isnonpos = next[j].begin == 0 && next[j].end == 0;
+ if ((!nonpos && isnonpos)
+ || (!isnonpos && visOnly && !visible
+ .containsKey(next[j].type)))
+ {
+ continue;
+ }
+
+ if (next[j].featureGroup != null
+ && !groups.contains(next[j].featureGroup))
+ {
+ groups.addElement(next[j].featureGroup);
+ }
+ }
+ }
+ }
+
+ String group = null;
+ do
+ {
+
+ if (groups.size() > 0 && groupIndex < groups.size())
+ {
+ group = groups.elementAt(groupIndex).toString();
+ out.append(newline);
+ out.append("STARTGROUP\t");
+ out.append(group);
+ out.append(newline);
+ }
+ else
+ {
+ group = null;
+ }
+
+ for (int i = 0; i < seqs.length; i++)
+ {
+ next = seqs[i].getSequenceFeatures();
+ if (next != null)
+ {
+ for (int j = 0; j < next.length; j++)
+ {
+ isnonpos = next[j].begin == 0 && next[j].end == 0;
+ if ((!nonpos && isnonpos)
+ || (!isnonpos && visOnly && !visible
+ .containsKey(next[j].type)))
+ {
+ // skip if feature is nonpos and we ignore them or if we only
+ // output visible and it isn't non-pos and it's not visible
+ continue;
+ }
+
+ if (group != null
+ && (next[j].featureGroup == null || !next[j].featureGroup
+ .equals(group)))
+ {
+ continue;
+ }
+
+ if (group == null && next[j].featureGroup != null)
+ {
+ continue;
+ }
+ // we have features to output
+ featuresGen = true;
+ if (next[j].description == null
+ || next[j].description.equals(""))
+ {
+ out.append(next[j].type + "\t");
+ }
+ else
+ {
+ if (next[j].links != null
+ && next[j].getDescription().indexOf("<html>") == -1)
+ {
+ out.append("<html>");
+ }
+
+ out.append(next[j].description + " ");
+ if (next[j].links != null)
+ {
+ for (int l = 0; l < next[j].links.size(); l++)
+ {
+ String label = next[j].links.elementAt(l).toString();
+ String href = label.substring(label.indexOf("|") + 1);
+ label = label.substring(0, label.indexOf("|"));
+
+ if (next[j].description.indexOf(href) == -1)
+ {
+ out.append("<a href=\"" + href + "\">" + label + "</a>");
+ }
+ }
+
+ if (next[j].getDescription().indexOf("</html>") == -1)
+ {
+ out.append("</html>");
+ }
+ }
+
+ out.append("\t");
+ }
+ out.append(seqs[i].getName());
+ out.append("\t-1\t");
+ out.append(next[j].begin);
+ out.append("\t");
+ out.append(next[j].end);
+ out.append("\t");
+ out.append(next[j].type);
+ if (!Float.isNaN(next[j].score))
+ {
+ out.append("\t");
+ out.append(next[j].score);
+ }
+ out.append(newline);
+ }
+ }
+ }
+
+ if (group != null)
+ {
+ out.append("ENDGROUP\t");
+ out.append(group);
+ out.append(newline);
+ groupIndex++;
+ }
+ else
+ {
+ break;
+ }
+
+ } while (groupIndex < groups.size() + 1);
+
+ if (!featuresGen)
+ {
+ return "No Features Visible";
+ }
+
+ return out.toString();
+ }
+
+ /**
+ * generate a gff file for sequence features includes non-pos features by
+ * default.
+ *
+ * @param seqs
+ * @param visible
+ * @return
+ */
+ public String printGFFFormat(SequenceI[] seqs, Map<String, Object> visible)
+ {
+ return printGFFFormat(seqs, visible, true, true);
+ }
+
+ public String printGFFFormat(SequenceI[] seqs,
+ Map<String, Object> visible, boolean visOnly, boolean nonpos)
+ {
+ StringBuffer out = new StringBuffer();
+ SequenceFeature[] next;
+ String source;
+ boolean isnonpos;
+ for (int i = 0; i < seqs.length; i++)
+ {
+ if (seqs[i].getSequenceFeatures() != null)
+ {
+ next = seqs[i].getSequenceFeatures();
+ for (int j = 0; j < next.length; j++)
+ {
+ isnonpos = next[j].begin == 0 && next[j].end == 0;
+ if ((!nonpos && isnonpos)
+ || (!isnonpos && visOnly && !visible
+ .containsKey(next[j].type)))
+ {
+ continue;
+ }
+
+ source = next[j].featureGroup;
+ if (source == null)
+ {
+ source = next[j].getDescription();
+ }
+
+ out.append(seqs[i].getName());
+ out.append("\t");
+ out.append(source);
+ out.append("\t");
+ out.append(next[j].type);
+ out.append("\t");
+ out.append(next[j].begin);
+ out.append("\t");
+ out.append(next[j].end);
+ out.append("\t");
+ out.append(next[j].score);
+ out.append("\t");
+
+ if (next[j].getValue("STRAND") != null)
+ {
+ out.append(next[j].getValue("STRAND"));
+ out.append("\t");
+ }
+ else
+ {
+ out.append(".\t");
+ }
+
+ if (next[j].getValue("FRAME") != null)
+ {
+ out.append(next[j].getValue("FRAME"));
+ }
+ else
+ {
+ out.append(".");
+ }
+ // TODO: verify/check GFF - should there be a /t here before attribute
+ // output ?
+
+ if (next[j].getValue("ATTRIBUTES") != null)
+ {
+ out.append(next[j].getValue("ATTRIBUTES"));
+ }
+
+ out.append(newline);
+
+ }
+ }
+ }
+
+ return out.toString();
+ }
+
+ /**
+ * this is only for the benefit of object polymorphism - method does nothing.
+ */
+ public void parse()
+ {
+ // IGNORED
+ }
+
+ /**
+ * this is only for the benefit of object polymorphism - method does nothing.
+ *
+ * @return error message
+ */
+ public String print()
+ {
+ return "USE printGFFFormat() or printJalviewFormat()";
+ }
+
+}
diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java
index cbdfc6f..9fbf9ee 100644
--- a/src/jalview/io/FileLoader.java
+++ b/src/jalview/io/FileLoader.java
@@ -1,28 +1,45 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.util.*;
-
-import javax.swing.*;
-
-import jalview.datamodel.*;
-import jalview.gui.*;
+import jalview.api.ComplexAlignFile;
+import jalview.api.FeaturesDisplayedI;
+import jalview.bin.Jalview;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
+import jalview.gui.Desktop;
+import jalview.gui.Jalview2XML;
+import jalview.schemes.ColourSchemeI;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MessageManager;
+
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
public class FileLoader implements Runnable
{
@@ -139,6 +156,7 @@ public class FileLoader implements Runnable
public AlignFrame LoadFileWaitTillLoaded(FileParse source, String format)
{
this.source = source;
+
file = source.getInFile();
protocol = source.type;
this.format = format;
@@ -240,6 +258,25 @@ public class FileLoader implements Runnable
{
format = new IdentifyFile().Identify(file, protocol);
}
+
+ }
+
+ if (format == null || format.equalsIgnoreCase("EMPTY DATA FILE"))
+ {
+ Desktop.instance.stopLoading();
+ System.err.println("The input file \"" + file
+ + "\" has null or unidentifiable data content!");
+ if (!Jalview.isHeadlessMode())
+ {
+ javax.swing.JOptionPane.showInternalMessageDialog(
+ Desktop.desktop,
+ MessageManager.getString("label.couldnt_read_data")
+ + " in " + file + "\n"
+ + AppletFormatAdapter.SUPPORTED_FORMATS,
+ MessageManager.getString("label.couldnt_read_data"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+ return;
}
// TODO: cache any stream datasources as a temporary file (eg. PDBs
// retrieved via URL)
@@ -252,7 +289,7 @@ public class FileLoader implements Runnable
// load
}
loadtime = -System.currentTimeMillis();
- Alignment al = null;
+ AlignmentI al = null;
if (format.equalsIgnoreCase("Jalview"))
{
@@ -263,7 +300,7 @@ public class FileLoader implements Runnable
.println("IMPLEMENTATION ERROR: Cannot read consecutive Jalview XML projects from a stream.");
// We read the data anyway - it might make sense.
}
- alignFrame = new Jalview2XML(raiseGUI).LoadJalviewAlign(file);
+ alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign(file);
}
else
{
@@ -283,7 +320,8 @@ public class FileLoader implements Runnable
// open a new source and read from it
FormatAdapter fa = new FormatAdapter();
al = fa.readFile(file, protocol, format);
- source = fa.afile; // keep reference for later if necessary.
+ source = fa.getAlignFile(); // keep reference for later if
+ // necessary.
}
} catch (java.io.IOException ex)
{
@@ -299,31 +337,81 @@ public class FileLoader implements Runnable
}
}
- if ((al != null) && (al.getHeight() > 0))
+ if ((al != null) && (al.getHeight() > 0) && al.hasValidSequence())
{
- if (viewport != null)
+ // construct and register dataset sequences
+ for (SequenceI sq : al.getSequences())
{
- for (int i = 0; i < al.getHeight(); i++)
+ while (sq.getDatasetSequence() != null)
+ {
+ sq = sq.getDatasetSequence();
+ }
+ if (sq.getAllPDBEntries() != null)
{
- viewport.getAlignment().addSequence(al.getSequenceAt(i));
+ for (PDBEntry pdbe : sq.getAllPDBEntries())
+ {
+ // register PDB entries with desktop's structure selection
+ // manager
+ StructureSelectionManager.getStructureSelectionManager(
+ Desktop.instance).registerPDBEntry(pdbe);
+ }
}
- viewport.firePropertyChange("alignment", null, viewport
- .getAlignment().getSequences());
+ }
+ if (viewport != null)
+ {
+ // append to existing alignment
+ viewport.addAlignment(al, title);
}
else
{
- alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
-
- alignFrame.statusBar.setText("Successfully loaded file "
- + title);
+ // otherwise construct the alignFrame
+ if (source instanceof ComplexAlignFile)
+ {
+ ColumnSelection colSel = ((ComplexAlignFile) source)
+ .getColumnSelection();
+ SequenceI[] hiddenSeqs = ((ComplexAlignFile) source)
+ .getHiddenSequences();
+ boolean showSeqFeatures = ((ComplexAlignFile) source)
+ .isShowSeqFeatures();
+ ColourSchemeI cs = ((ComplexAlignFile) source)
+ .getColourScheme();
+ FeaturesDisplayedI fd = ((ComplexAlignFile) source)
+ .getDisplayedFeatures();
+ alignFrame = new AlignFrame(al, hiddenSeqs, colSel,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+
+ alignFrame.getViewport().setShowSequenceFeatures(
+ showSeqFeatures);
+ alignFrame.getViewport().setFeaturesDisplayed(fd);
+ alignFrame.changeColour(cs);
+ }
+ else
+ {
+ alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+ }
+ // add metadata and update ui
if (!protocol.equals(AppletFormatAdapter.PASTE))
+ {
alignFrame.setFileName(file, format);
+ }
- Desktop.addInternalFrame(alignFrame, title,
- AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ alignFrame.statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_loaded_file",
+ new String[] { title }));
+
+ if (raiseGUI)
+ {
+ // add the window to the GUI
+ // note - this actually should happen regardless of raiseGUI
+ // status in Jalview 3
+ // TODO: define 'virtual desktop' for benefit of headless scripts
+ // that perform queries to find the 'current working alignment'
+ Desktop.addInternalFrame(alignFrame, title,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ }
try
{
@@ -341,16 +429,22 @@ public class FileLoader implements Runnable
Desktop.instance.stopLoading();
}
- final String errorMessage = "Couldn't load file " + title + "\n"
- + error;
- if (raiseGUI)
+ final String errorMessage = MessageManager
+ .getString("label.couldnt_load_file")
+ + " "
+ + title
+ + "\n" + error;
+ // TODO: refactor FileLoader to be independent of Desktop / Applet GUI
+ // bits ?
+ if (raiseGUI && Desktop.desktop != null)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- errorMessage, "Error loading file",
+ errorMessage, MessageManager
+ .getString("label.error_loading_file"),
JOptionPane.WARNING_MESSAGE);
}
});
@@ -375,8 +469,10 @@ public class FileLoader implements Runnable
public void run()
{
javax.swing.JOptionPane.showInternalMessageDialog(
- Desktop.desktop, "Encountered problems opening " + file
- + "!!", "File open error",
+ Desktop.desktop, MessageManager.formatMessage(
+ "label.problems_opening_file",
+ new String[] { file }), MessageManager
+ .getString("label.file_open_error"),
javax.swing.JOptionPane.WARNING_MESSAGE);
}
});
@@ -393,15 +489,12 @@ public class FileLoader implements Runnable
{
public void run()
{
- javax.swing.JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
- "Out of memory loading file "
- + file
- + "!!"
- + "\nSee help files for increasing Java Virtual Machine memory.",
- "Out of memory",
- javax.swing.JOptionPane.WARNING_MESSAGE);
+ javax.swing.JOptionPane.showInternalMessageDialog(
+ Desktop.desktop, MessageManager.formatMessage(
+ "warn.out_of_memory_loading_file", new String[]
+ { file }), MessageManager
+ .getString("label.out_of_memory"),
+ javax.swing.JOptionPane.WARNING_MESSAGE);
}
});
}
diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java
index 718eab3..4526eba 100644
--- a/src/jalview/io/FileParse.java
+++ b/src/jalview/io/FileParse.java
@@ -1,24 +1,42 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.net.*;
+import jalview.api.AlignExportSettingI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.util.MessageManager;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.zip.GZIPInputStream;
/**
* implements a random access wrapper around a particular datasource, for
@@ -33,23 +51,43 @@ public class FileParse
public File inFile = null;
- public int index = 1; // sequence counter for FileParse object created from
+ /**
+ * a viewport associated with the current file operation. May be null. May
+ * move to different object.
+ */
+ private AlignViewportI viewport;
- // same data source
+ /**
+ * specific settings for exporting data from the current context
+ */
+ private AlignExportSettingI exportSettings;
+ /**
+ * sequence counter for FileParse object created from same data source
+ */
+ public int index = 1;
+
+ /**
+ * separator for extracting specific 'frame' of a datasource for formats that
+ * support multiple records (e.g. BLC, Stockholm, etc)
+ */
protected char suffixSeparator = '#';
+
/**
- * character used to write newlines
+ * character used to write newlines
*/
protected String newline = System.getProperty("line.separator");
+
public void setNewlineString(String nl)
{
newline = nl;
}
+
public String getNewlineString()
{
return newline;
}
+
/**
* '#' separated string tagged on to end of filename or url that was clipped
* off to resolve to valid filename
@@ -60,7 +98,7 @@ public class FileParse
protected BufferedReader dataIn = null;
- protected String errormessage = "UNITIALISED SOURCE";
+ protected String errormessage = "UNINITIALISED SOURCE";
protected boolean error = true;
@@ -87,10 +125,13 @@ public class FileParse
if (from == null)
{
throw new Error(
- "Implementation error. Null FileParse in copy constructor");
+ MessageManager
+ .getString("error.implementation_error_null_fileparse"));
}
if (from == this)
+ {
return;
+ }
index = ++from.index;
inFile = from.inFile;
suffixSeparator = from.suffixSeparator;
@@ -137,18 +178,76 @@ public class FileParse
}
if (!error)
{
+ if (fileStr.toLowerCase().endsWith(".gz"))
+ {
+ try
+ {
+ dataIn = tryAsGzipSource(new FileInputStream(fileStr));
+ dataName = fileStr;
+ return error;
+ } catch (Exception x)
+ {
+ warningMessage = "Failed to resolve as a GZ stream ("
+ + x.getMessage() + ")";
+ // x.printStackTrace();
+ }
+ ;
+ }
+
dataIn = new BufferedReader(new FileReader(fileStr));
dataName = fileStr;
}
return error;
}
+ private BufferedReader tryAsGzipSource(InputStream inputStream)
+ throws Exception
+ {
+ BufferedReader inData = new BufferedReader(new InputStreamReader(
+ new GZIPInputStream(inputStream)));
+ inData.mark(2048);
+ inData.read();
+ inData.reset();
+ return inData;
+ }
+
private boolean checkURLSource(String fileStr) throws IOException,
MalformedURLException
{
errormessage = "URL NOT FOUND";
URL url = new URL(fileStr);
- dataIn = new BufferedReader(new InputStreamReader(url.openStream()));
+ //
+ // GZIPInputStream code borrowed from Aquaria (soon to be open sourced) via
+ // Kenny Sabir
+ Exception e = null;
+ if (fileStr.toLowerCase().endsWith(".gz"))
+ {
+ try
+ {
+ InputStream inputStream = url.openStream();
+ dataIn = tryAsGzipSource(inputStream);
+ dataName = fileStr;
+ return false;
+ } catch (Exception ex)
+ {
+ e = ex;
+ }
+ }
+
+ try
+ {
+ dataIn = new BufferedReader(new InputStreamReader(url.openStream()));
+ } catch (IOException q)
+ {
+ if (e != null)
+ {
+ throw new IOException(
+ MessageManager
+ .getString("exception.failed_to_resolve_gzip_stream"),
+ e);
+ }
+ throw q;
+ }
// record URL as name of datasource.
dataName = fileStr;
return false;
@@ -200,14 +299,17 @@ public class FileParse
{
if (checkFileSource(suffixLess))
{
- throw new IOException("Problem opening " + inFile
- + " (also tried " + suffixLess + ") : " + errormessage);
+ throw new IOException(MessageManager.formatMessage(
+ "exception.problem_opening_file_also_tried",
+ new String[] { inFile.getName(), suffixLess,
+ errormessage }));
}
}
else
{
- throw new IOException("Problem opening " + inFile + " : "
- + errormessage);
+ throw new IOException(MessageManager.formatMessage(
+ "exception.problem_opening_file",
+ new String[] { inFile.getName(), errormessage }));
}
}
}
@@ -219,7 +321,9 @@ public class FileParse
{
checkURLSource(fileStr);
if (suffixSeparator == '#')
+ {
extractSuffix(fileStr); // URL lref is stored for later reference.
+ }
} catch (IOException e)
{
String suffixLess = extractSuffix(fileStr);
@@ -261,7 +365,9 @@ public class FileParse
{
String suffixLess = extractSuffix(fileStr);
if (suffixLess != null)
+ {
is = getClass().getResourceAsStream("/" + suffixLess);
+ }
}
if (is != null)
{
@@ -282,8 +388,9 @@ public class FileParse
if (dataIn == null || error)
{
// pass up the reason why we have no source to read from
- throw new IOException("Failed to read data from source:\n"
- + errormessage);
+ throw new IOException(MessageManager.formatMessage(
+ "exception.failed_to_read_data_from_source",
+ new String[] { errormessage }));
}
error = false;
dataIn.mark(READAHEAD_LIMIT);
@@ -303,17 +410,35 @@ public class FileParse
}
else
{
- throw new IOException("Unitialised Source Stream");
+ throw new IOException(
+ MessageManager.getString("exception.no_init_source_stream"));
}
}
public String nextLine() throws IOException
{
if (!error)
+ {
return dataIn.readLine();
- throw new IOException("Invalid Source Stream:" + errormessage);
+ }
+ throw new IOException(MessageManager.formatMessage(
+ "exception.invalid_source_stream",
+ new String[] { errormessage }));
}
+ /**
+ *
+ * @return true if this FileParse is configured for Export only
+ */
+ public boolean isExporting()
+ {
+ return !error && dataIn == null;
+ }
+
+ /**
+ *
+ * @return true if the data source is valid
+ */
public boolean isValid()
{
return !error;
@@ -344,7 +469,8 @@ public class FileParse
else
{
throw new IOException(
- "Implementation Error: Reset called for invalid source.");
+ MessageManager
+ .getString("error.implementation_error_reset_called_for_invalid_source"));
}
}
@@ -385,26 +511,74 @@ public class FileParse
{
return dataName;
}
+
/**
* set the (human readable) name or URI for this datasource
+ *
* @param dataname
*/
- protected void setDataName(String dataname) {
+ protected void setDataName(String dataname)
+ {
dataName = dataname;
}
-
/**
* get the underlying bufferedReader for this data source.
+ *
* @return null if no reader available
* @throws IOException
*/
public Reader getReader()
{
- if (dataIn != null) // Probably don't need to test for readiness && dataIn.ready())
+ if (dataIn != null) // Probably don't need to test for readiness &&
+ // dataIn.ready())
{
return dataIn;
}
return null;
}
+
+ public AlignViewportI getViewport()
+ {
+ return viewport;
+ }
+
+ public void setViewport(AlignViewportI viewport)
+ {
+ this.viewport = viewport;
+ }
+
+ /**
+ * @return the currently configured exportSettings for writing data.
+ */
+ public AlignExportSettingI getExportSettings()
+ {
+ return exportSettings;
+ }
+
+ /**
+ * Set configuration for export of data.
+ *
+ * @param exportSettings
+ * the exportSettings to set
+ */
+ public void setExportSettings(AlignExportSettingI exportSettings)
+ {
+ this.exportSettings = exportSettings;
+ }
+
+ /**
+ * method overridden by complex file exporter/importers which support
+ * exporting visualisation and layout settings for a view
+ *
+ * @param avpanel
+ */
+ public void configureForView(AlignmentViewPanel avpanel)
+ {
+ if (avpanel != null)
+ {
+ setViewport(avpanel.getAlignViewport());
+ }
+ // could also set export/import settings
+ }
}
diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java
index 643e971..1b39d0a 100644
--- a/src/jalview/io/FormatAdapter.java
+++ b/src/jalview/io/FormatAdapter.java
@@ -1,23 +1,34 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import jalview.datamodel.*;
+import jalview.api.AlignExportSettingI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
/**
* Additional formatting methods used by the application in a number of places.
@@ -27,12 +38,50 @@ import jalview.datamodel.*;
*/
public class FormatAdapter extends AppletFormatAdapter
{
+ public FormatAdapter(AlignmentViewPanel viewpanel)
+ {
+ super(viewpanel);
+ init();
+ }
+
+ public FormatAdapter()
+ {
+ super();
+ init();
+ }
+
+ public FormatAdapter(AlignmentViewPanel alignPanel,
+ AlignExportSettingI settings)
+ {
+ super(alignPanel, settings);
+ }
+
+ private void init()
+ {
+ if (jalview.bin.Cache.getDefault("STRUCT_FROM_PDB", true))
+ {
+ annotFromStructure = jalview.bin.Cache.getDefault("ADD_TEMPFACT_ANN",
+ true);
+ localSecondaryStruct = jalview.bin.Cache.getDefault("ADD_SS_ANN",
+ true);
+ serviceSecondaryStruct = jalview.bin.Cache.getDefault("USE_RNAVIEW",
+ true);
+ }
+ else
+ {
+ // disable all PDB annotation options
+ annotFromStructure = false;
+ localSecondaryStruct = false;
+ serviceSecondaryStruct = false;
+ }
+ }
public String formatSequences(String format, SequenceI[] seqs,
- String[] omitHiddenColumns)
+ String[] omitHiddenColumns, int[] exportRange)
{
- return formatSequences(format, replaceStrings(seqs, omitHiddenColumns));
+ return formatSequences(format,
+ replaceStrings(seqs, omitHiddenColumns, exportRange));
}
/**
@@ -44,15 +93,47 @@ public class FormatAdapter extends AppletFormatAdapter
* @return new sequences
*/
public SequenceI[] replaceStrings(SequenceI[] seqs,
- String[] omitHiddenColumns)
+ String[] omitHiddenColumns, int[] startEnd)
{
if (omitHiddenColumns != null)
{
SequenceI[] tmp = new SequenceI[seqs.length];
+
+ int startRes;
+ int endRes;
+ int startIndex;
+ int endIndex;
for (int i = 0; i < seqs.length; i++)
{
+ startRes = seqs[i].getStart();
+ endRes = seqs[i].getEnd();
+
+ if (startEnd != null)
+ {
+ startIndex = startEnd[0];
+ endIndex = startEnd[1];
+ // get first non-gaped residue start position
+ while (jalview.util.Comparison.isGap(seqs[i]
+ .getCharAt(startIndex)) && startIndex < endIndex)
+ {
+ startIndex++;
+ }
+
+ // get last non-gaped residue end position
+ while (jalview.util.Comparison.isGap(seqs[i].getCharAt(endIndex))
+ && endIndex > startIndex)
+ {
+ endIndex--;
+ }
+
+ startRes = seqs[i].findPosition(startIndex);
+ startRes = seqs[i].getStart() > 1 ? startRes - seqs[i].getStart()
+ : startRes;
+ endRes = seqs[i].findPosition(endIndex) - seqs[i].getStart();
+ }
+
tmp[i] = new Sequence(seqs[i].getName(), omitHiddenColumns[i],
- seqs[i].getStart(), seqs[i].getEnd());
+ startRes, endRes);
tmp[i].setDescription(seqs[i].getDescription());
}
seqs = tmp;
@@ -150,22 +231,25 @@ public class FormatAdapter extends AppletFormatAdapter
public boolean getCacheSuffixDefault(String format)
{
if (isValidFormat(format))
+ {
return jalview.bin.Cache.getDefault(format.toUpperCase()
+ "_JVSUFFIX", true);
+ }
return false;
}
public String formatSequences(String format, AlignmentI alignment,
- String[] omitHidden, ColumnSelection colSel)
+ String[] omitHidden, int[] exportRange, ColumnSelection colSel)
{
- return formatSequences(format, alignment, omitHidden,
+ return formatSequences(format, alignment, omitHidden, exportRange,
getCacheSuffixDefault(format), colSel, null);
}
public String formatSequences(String format, AlignmentI alignment,
- String[] omitHidden, ColumnSelection colSel, SequenceGroup sgp)
+ String[] omitHidden, int[] exportRange, ColumnSelection colSel,
+ SequenceGroup sgp)
{
- return formatSequences(format, alignment, omitHidden,
+ return formatSequences(format, alignment, omitHidden, exportRange,
getCacheSuffixDefault(format), colSel, sgp);
}
@@ -182,22 +266,25 @@ public class FormatAdapter extends AppletFormatAdapter
* @return string representation of the alignment formatted as format
*/
public String formatSequences(String format, AlignmentI alignment,
- String[] omitHidden, boolean suffix, ColumnSelection colSel)
+ String[] omitHidden, int[] exportRange, boolean suffix,
+ ColumnSelection colSel)
{
- return formatSequences(format, alignment, omitHidden, suffix, colSel,
- null);
+ return formatSequences(format, alignment, omitHidden, exportRange,
+ suffix, colSel, null);
}
public String formatSequences(String format, AlignmentI alignment,
- String[] omitHidden, boolean suffix, ColumnSelection colSel,
- jalview.datamodel.SequenceGroup selgp)
+ String[] omitHidden, int[] exportRange, boolean suffix,
+ ColumnSelection colSel, jalview.datamodel.SequenceGroup selgp)
{
if (omitHidden != null)
{
// TODO consider using AlignmentView to prune to visible region
// TODO prune sequence annotation and groups to visible region
+ // TODO: JAL-1486 - set start and end for output correctly. basically,
+ // AlignmentView.getVisibleContigs does this.
Alignment alv = new Alignment(replaceStrings(
- alignment.getSequencesArray(), omitHidden));
+ alignment.getSequencesArray(), omitHidden, exportRange));
AlignmentAnnotation[] ala = alignment.getAlignmentAnnotation();
if (ala != null)
{
@@ -221,6 +308,20 @@ public class FormatAdapter extends AppletFormatAdapter
return this.formatSequences(format, alignment, suffix);
}
+ public AlignmentI readFile(String inFile, String type, String format)
+ throws java.io.IOException
+ {
+ AlignmentI al = super.readFile(inFile, type, format);
+ return al;
+ }
+
+ public AlignmentI readFromFile(FileParse source, String format)
+ throws java.io.IOException
+ {
+ AlignmentI al = super.readFromFile(source, format);
+ return al;
+ }
+
/**
* validate format is valid for IO in Application. This is basically the
* AppletFormatAdapter.isValidFormat call with additional checks for
@@ -242,4 +343,21 @@ public class FormatAdapter extends AppletFormatAdapter
}
return AppletFormatAdapter.isValidFormat(format, forwriting);
}
+
+ /**
+ * Create a flat file representation of a given view or selected region of a
+ * view
+ *
+ * @param format
+ * @param ap
+ * alignment panel originating the view
+ * @return String containing flat file
+ */
+ public String formatSequences(String format, AlignmentViewPanel ap,
+ boolean selectedOnly)
+ {
+ return formatSequences(format, getCacheSuffixDefault(format), ap,
+ selectedOnly);
+ }
+
}
diff --git a/src/jalview/io/Gff3File.java b/src/jalview/io/Gff3File.java
new file mode 100644
index 0000000..4d8ea94
--- /dev/null
+++ b/src/jalview/io/Gff3File.java
@@ -0,0 +1,174 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * A GFF3 File parsing wrapper for the tangled mess that is FeaturesFile.
+ *
+ * This class implements the methods relied on by FileLoader/FormatAdapter in
+ * order to allow them to load alignments directly from GFF2 and GFF3 files that
+ * contain sequence data and alignment information.
+ *
+ * Major issues:
+ *
+ * 1. GFF3 files commonly include mappings between DNA, RNA and Protein - so
+ * this class needs a dataset AlignmentI context to create alignment codon
+ * mappings.
+ *
+ * 2. A single GFF3 file can generate many distinct alignments. Support will be
+ * needed to allow several AlignmentI instances to be generated from a single
+ * file.
+ *
+ *
+ * @author jprocter
+ *
+ */
+public class Gff3File extends FeaturesFile
+{
+
+ /**
+ *
+ */
+ public Gff3File()
+ {
+ super();
+ }
+
+ /**
+ * @param source
+ * @throws IOException
+ */
+ public Gff3File(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ /**
+ * @param inFile
+ * @param type
+ * @throws IOException
+ */
+ public Gff3File(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+ }
+
+ /**
+ * @param parseImmediately
+ * @param source
+ * @throws IOException
+ */
+ public Gff3File(boolean parseImmediately, FileParse source)
+ throws IOException
+ {
+ super(parseImmediately, source);
+ }
+
+ /**
+ * @param parseImmediately
+ * @param inFile
+ * @param type
+ * @throws IOException
+ */
+ public Gff3File(boolean parseImmediately, String inFile, String type)
+ throws IOException
+ {
+ super(parseImmediately, inFile, type);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.io.FeaturesFile#print()
+ */
+ @Override
+ public String print()
+ {
+ // TODO GFF3 writer with sensible defaults for writing alignment data
+
+ // return super.printGFFFormat(seqs, visible);
+ return ("Not yet implemented.");
+ }
+
+ AlignmentI dataset;
+
+ List<AlignmentI> alignments;
+
+ @Override
+ public void parse()
+ {
+ AlignViewportI av = getViewport();
+ if (av != null)
+ {
+ if (av.getAlignment() != null)
+ {
+ dataset = av.getAlignment().getDataset();
+ }
+ if (dataset == null)
+ {
+ // working in the applet context ?
+ dataset = av.getAlignment();
+ }
+ }
+ else
+ {
+ dataset = new Alignment(new SequenceI[] {});
+ }
+
+ boolean parseResult = parse(dataset, null, null, false, true);
+ if (!parseResult)
+ {
+ // pass error up somehow
+ }
+ if (av != null)
+ {
+ // update viewport with the dataset data ?
+ }
+ else
+ {
+ setSeqs(dataset.getSequencesArray());
+ }
+
+ }
+
+ @Override
+ public void addProperties(AlignmentI al)
+ {
+ super.addProperties(al);
+ if (dataset.getCodonFrames() != null)
+ {
+ AlignmentI ds = (al.getDataset() == null) ? al : al.getDataset();
+ for (AlignedCodonFrame codons : dataset.getCodonFrames())
+ {
+ ds.addCodonFrame(codons);
+ }
+ }
+ }
+}
diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java
index e06acec..95864c3 100644
--- a/src/jalview/io/HTMLOutput.java
+++ b/src/jalview/io/HTMLOutput.java
@@ -1,28 +1,36 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-
-import java.awt.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignViewport;
+import jalview.gui.AlignmentPanel;
+import jalview.gui.FeatureRenderer;
+import jalview.gui.SequenceRenderer;
+import jalview.util.MessageManager;
-import jalview.datamodel.*;
-import jalview.gui.*;
+import java.awt.Color;
+import java.awt.Font;
+import java.io.PrintWriter;
public class HTMLOutput
{
@@ -30,7 +38,7 @@ public class HTMLOutput
SequenceRenderer sr;
- FeatureRenderer fr;
+ jalview.renderer.seqfeatures.FeatureRenderer fr;
Color color;
@@ -44,13 +52,13 @@ public class HTMLOutput
fr.transferSettings(fr1);
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "html" }, new String[]
- { "HTML files" }, "HTML files");
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "html" }, new String[] { "HTML files" },
+ "HTML files");
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save as HTML");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager.getString("label.save_as_html"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(null);
diff --git a/src/jalview/io/HtmlFile.java b/src/jalview/io/HtmlFile.java
new file mode 100644
index 0000000..0d0fae9
--- /dev/null
+++ b/src/jalview/io/HtmlFile.java
@@ -0,0 +1,174 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.io;
+
+import jalview.api.ComplexAlignFile;
+import jalview.api.FeaturesDisplayedI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+
+public class HtmlFile extends AlignFile implements ComplexAlignFile
+{
+ public static final String FILE_EXT = "html";
+
+ public static final String FILE_DESC = "HTML";
+
+ private ColourSchemeI colourScheme;
+
+ private boolean showSeqFeatures;
+
+ private ColumnSelection columnSelection;
+
+ private SequenceI[] hiddenSequences;
+
+ private FeaturesDisplayedI displayedFeatures;
+
+ public HtmlFile()
+ {
+ super();
+ }
+
+ public HtmlFile(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ public HtmlFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+ }
+
+ @Override
+ public void parse() throws IOException
+ {
+ Element content = null;
+ Document doc = null;
+ try
+ {
+ StringBuilder htmlData = new StringBuilder();
+ String currentLine;
+ while ((currentLine = nextLine()) != null)
+ {
+ htmlData.append(currentLine);
+ }
+ doc = Jsoup.parse(htmlData.toString());
+ } catch (OutOfMemoryError oom)
+ {
+ errormessage = "Not enough memory to process HTML document";
+ throw new IOException(errormessage);
+ }
+
+ try
+ {
+ boolean contentFromDiv = true;
+ // search for BioJSON data in div element with id seqData
+ content = doc.select("div[id=seqData]").first();
+ if (content == null)
+ {
+ contentFromDiv = false;
+ // search for BioJSON data in input element with id seqData
+ content = doc.getElementById("seqData");
+ }
+
+ if (content == null)
+ {
+ errormessage = "The html document is not embedded with BioJSON data";
+ throw new IOException(errormessage);
+ }
+ JSONFile jsonFile = new JSONFile().parse(new StringReader(
+ contentFromDiv ? content.text() : content.val()));
+ this.seqs = jsonFile.getSeqs();
+ this.seqGroups = jsonFile.getSeqGroups();
+ this.annotations = jsonFile.getAnnotations();
+ this.showSeqFeatures = jsonFile.isShowSeqFeatures();
+ this.colourScheme = jsonFile.getColourScheme();
+ this.hiddenSequences = jsonFile.getHiddenSequences();
+ this.columnSelection = jsonFile.getColumnSelection();
+ this.displayedFeatures = jsonFile.getDisplayedFeatures();
+ } catch (Exception e)
+ {
+ throw e;
+ }
+ }
+
+ @Override
+ public String print()
+ {
+ throw new UnsupportedOperationException(
+ "Print method of HtmlFile is not supported!");
+ }
+
+ public boolean isShowSeqFeatures()
+ {
+ return showSeqFeatures;
+ }
+
+ public void setShowSeqFeatures(boolean showSeqFeatures)
+ {
+ this.showSeqFeatures = showSeqFeatures;
+ }
+
+ public ColourSchemeI getColourScheme()
+ {
+ return colourScheme;
+ }
+
+ public void setColourScheme(ColourSchemeI colourScheme)
+ {
+ this.colourScheme = colourScheme;
+ }
+
+ public ColumnSelection getColumnSelection()
+ {
+ return columnSelection;
+ }
+
+ public void setColumnSelection(ColumnSelection columnSelection)
+ {
+ this.columnSelection = columnSelection;
+ }
+
+ public SequenceI[] getHiddenSequences()
+ {
+ return hiddenSequences;
+ }
+
+ public void setHiddenSequences(SequenceI[] hiddenSequences)
+ {
+ this.hiddenSequences = hiddenSequences;
+ }
+
+ @Override
+ public FeaturesDisplayedI getDisplayedFeatures()
+ {
+ return displayedFeatures;
+ }
+
+}
diff --git a/src/jalview/io/HtmlSvgOutput.java b/src/jalview/io/HtmlSvgOutput.java
new file mode 100644
index 0000000..7cbde64
--- /dev/null
+++ b/src/jalview/io/HtmlSvgOutput.java
@@ -0,0 +1,682 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import jalview.api.AlignExportSettingI;
+import jalview.api.FeatureRenderer;
+import jalview.datamodel.AlignmentExportData;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignViewport;
+import jalview.gui.AlignmentPanel;
+import jalview.gui.HTMLOptions;
+import jalview.math.AlignmentDimension;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.io.File;
+import java.io.FileOutputStream;
+
+import org.jfree.graphics2d.svg.SVGGraphics2D;
+import org.jfree.graphics2d.svg.SVGHints;
+
+public class HtmlSvgOutput
+{
+ AlignViewport av;
+
+ FeatureRenderer fr;
+
+ AlignmentPanel ap;
+
+ public HtmlSvgOutput(File file, AlignmentPanel ap)
+ {
+ this.av = ap.av;
+ this.ap = ap;
+ fr = ap.cloneFeatureRenderer();
+ generateHtmlSvgOutput(file);
+ }
+
+ public void generateHtmlSvgOutput(File file)
+ {
+ try
+ {
+ if (file == null)
+ {
+
+ JalviewFileChooser chooser = getHTMLChooser();
+ chooser.setFileView(new jalview.io.JalviewFileView());
+ chooser.setDialogTitle(ap.alignFrame.getTitle());
+ chooser.setToolTipText(MessageManager.getString("action.save"));
+ int value = chooser.showSaveDialog(ap.alignFrame);
+
+ if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
+ {
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
+ .getSelectedFile().getParent());
+ file = chooser.getSelectedFile();
+ }
+ }
+
+ AlignmentDimension aDimension = ap.getAlignmentDimension();
+ SVGGraphics2D g1 = new SVGGraphics2D(aDimension.getWidth(),
+ aDimension.getHeight());
+ SVGGraphics2D g2 = new SVGGraphics2D(aDimension.getWidth(),
+ aDimension.getHeight());
+
+ String renderStyle = jalview.bin.Cache.getDefault("HTML_RENDERING",
+ "Prompt each time");
+
+ // If we need to prompt, and if the GUI is visible then
+ // Prompt for rendering style
+ if (renderStyle.equalsIgnoreCase("Prompt each time")
+ && !(System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true")))
+ {
+ HTMLOptions svgOption = new HTMLOptions();
+ renderStyle = svgOption.getValue();
+
+ if (renderStyle == null || svgOption.cancelled)
+ {
+ return;
+ }
+ }
+
+ if (renderStyle.equalsIgnoreCase("lineart"))
+ {
+ g1.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
+ SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
+ g2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
+ SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
+ }
+ printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0, g1,
+ g2);
+
+ String titleSvgData = g1.getSVGDocument();
+ String alignSvgData = g2.getSVGDocument();
+ String jsonData = null;
+ boolean isEmbbedBioJSON = Boolean.valueOf(jalview.bin.Cache
+ .getDefault("EXPORT_EMBBED_BIOJSON", "true"));
+ if (isEmbbedBioJSON)
+ {
+ AlignExportSettingI exportSettings = new AlignExportSettingI()
+ {
+ @Override
+ public boolean isExportHiddenSequences()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportHiddenColumns()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportAnnotations()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportFeatures()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportGroups()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isCancelled()
+ {
+ return false;
+ }
+
+ };
+ AlignmentExportData exportData = jalview.gui.AlignFrame
+ .getAlignmentForExport(JSONFile.FILE_DESC, av,
+ exportSettings);
+ jsonData = new FormatAdapter(ap, exportData.getSettings())
+ .formatSequences(JSONFile.FILE_DESC,
+ exportData.getAlignment(),
+ exportData.getOmitHidden(),
+ exportData.getStartEndPostions(),
+ av.getColumnSelection());
+ }
+ String htmlData = getHtml(titleSvgData, alignSvgData, jsonData);
+ FileOutputStream out = new FileOutputStream(file);
+ out.write(htmlData.getBytes());
+ out.flush();
+ out.close();
+ if (!(System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true")))
+ {
+ jalview.util.BrowserLauncher.openURL("file:///" + file);
+ }
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ static JalviewFileChooser getHTMLChooser()
+ {
+ return new jalview.io.JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "html" },
+ new String[] { "Hypertext Markup Language" },
+ "Hypertext Markup Language");
+ }
+
+ public int printUnwrapped(int pwidth, int pheight, int pi, Graphics... pg)
+ throws PrinterException
+ {
+ int idWidth = ap.getVisibleIdWidth(false);
+ FontMetrics fm = ap.getFontMetrics(av.getFont());
+ int scaleHeight = av.getCharHeight() + fm.getDescent();
+
+ pg[0].setColor(Color.white);
+ pg[0].fillRect(0, 0, pwidth, pheight);
+ pg[0].setFont(av.getFont());
+
+ // //////////////////////////////////
+ // / How many sequences and residues can we fit on a printable page?
+ int totalRes = (pwidth - idWidth) / av.getCharWidth();
+ int totalSeq = (pheight - scaleHeight) / av.getCharHeight() - 1;
+ int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1;
+
+ // ///////////////////////////
+ // / Only print these sequences and residues on this page
+ int startRes;
+
+ // ///////////////////////////
+ // / Only print these sequences and residues on this page
+ int endRes;
+
+ // ///////////////////////////
+ // / Only print these sequences and residues on this page
+ int startSeq;
+
+ // ///////////////////////////
+ // / Only print these sequences and residues on this page
+ int endSeq;
+ startRes = (pi % pagesWide) * totalRes;
+ endRes = (startRes + totalRes) - 1;
+
+ if (endRes > (av.getAlignment().getWidth() - 1))
+ {
+ endRes = av.getAlignment().getWidth() - 1;
+ }
+ startSeq = (pi / pagesWide) * totalSeq;
+ endSeq = startSeq + totalSeq;
+ if (endSeq > av.getAlignment().getHeight())
+ {
+ endSeq = av.getAlignment().getHeight();
+ }
+ int pagesHigh = ((av.getAlignment().getHeight() / totalSeq) + 1)
+ * pheight;
+ if (av.isShowAnnotation())
+ {
+ pagesHigh += ap.getAnnotationPanel().adjustPanelHeight() + 3;
+ }
+ pagesHigh /= pheight;
+ if (pi >= (pagesWide * pagesHigh))
+ {
+ return Printable.NO_SUCH_PAGE;
+ }
+
+ // draw Scale
+ pg[1].translate(0, 0);
+ ap.getScalePanel().drawScale(pg[1], startRes, endRes, pwidth - idWidth,
+ scaleHeight);
+ pg[1].translate(-idWidth, scaleHeight);
+
+ // //////////////
+ // Draw the ids
+ Color currentColor = null;
+ Color currentTextColor = null;
+ pg[0].translate(0, scaleHeight);
+ pg[0].setFont(ap.getIdPanel().getIdCanvas().getIdfont());
+ SequenceI seq;
+ for (int i = startSeq; i < endSeq; i++)
+ {
+ seq = av.getAlignment().getSequenceAt(i);
+ if ((av.getSelectionGroup() != null)
+ && av.getSelectionGroup().getSequences(null).contains(seq))
+ {
+ currentColor = Color.gray;
+ currentTextColor = Color.black;
+ }
+ else
+ {
+ currentColor = av.getSequenceColour(seq);
+ currentTextColor = Color.black;
+ }
+ pg[0].setColor(currentColor);
+ pg[0].fillRect(0, (i - startSeq) * av.getCharHeight(), idWidth,
+ av.getCharHeight());
+ pg[0].setColor(currentTextColor);
+ int xPos = 0;
+ if (av.isRightAlignIds())
+ {
+ fm = pg[0].getFontMetrics();
+ xPos = idWidth
+ - fm.stringWidth(seq.getDisplayId(av.getShowJVSuffix()))
+ - 4;
+ }
+ pg[0].drawString(seq.getDisplayId(av.getShowJVSuffix()), xPos,
+ (((i - startSeq) * av.getCharHeight()) + av.getCharHeight())
+ - (av.getCharHeight() / 5));
+ }
+ pg[0].setFont(av.getFont());
+ pg[0].translate(idWidth, 0);
+
+ // draw main sequence panel
+ pg[1].translate(idWidth, 0);
+ ap.getSeqPanel().seqCanvas.drawPanel(pg[1], startRes, endRes, startSeq,
+ endSeq, 0);
+ if (av.isShowAnnotation() && (endSeq == av.getAlignment().getHeight()))
+ {
+ // draw annotation label - need to offset for current scroll position
+ int offset = -ap.getAlabels().getScrollOffset();
+ pg[0].translate(0, offset);
+ pg[0].translate(-idWidth - 3,
+ (endSeq - startSeq) * av.getCharHeight() + 3);
+ ap.getAlabels().drawComponent(pg[0], idWidth);
+ pg[0].translate(idWidth + 3, 0);
+ pg[0].translate(0, -offset);
+
+ // draw annotation - need to offset for current scroll position
+ pg[1].translate(0, offset);
+ pg[1].translate(-idWidth - 3,
+ (endSeq - startSeq) * av.getCharHeight() + 3);
+ pg[1].translate(idWidth + 3, 0);
+ ap.getAnnotationPanel().renderer.drawComponent(
+ ap.getAnnotationPanel(), av, pg[1], -1, startRes, endRes + 1);
+ pg[1].translate(0, -offset);
+ }
+
+ return Printable.PAGE_EXISTS;
+ }
+
+ private String getHtml(String titleSvg, String alignmentSvg,
+ String jsonData)
+ {
+ StringBuilder htmlSvg = new StringBuilder();
+ htmlSvg.append("<html>\n");
+ if (jsonData != null)
+ {
+ htmlSvg.append("<button onclick=\"javascipt:openJalviewUsingCurrentUrl();\">Launch in Jalview</button> ");
+ htmlSvg.append("<input type=\"submit\" value=\"View raw BioJSON Data\" onclick=\"jQuery.facebox({ div:'#seqData' }); return false;\" />");
+ htmlSvg.append("<div style=\"display: none;\" name=\"seqData\" id=\"seqData\" >"
+ + jsonData + "</div>");
+ htmlSvg.append("<br/> ");
+ }
+ htmlSvg.append("\n<style type=\"text/css\"> "
+ + "div.parent{ width:100%;<!-- overflow: auto; -->}\n"
+ + "div.titlex{ width:11%; float: left; }\n"
+ + "div.align{ width:89%; float: right; }\n"
+ + "div.main-container{ border: 2px solid blue; border: 2px solid blue; width: 99%; min-height: 99%; }\n"
+ + ".sub-category-container {overflow-y: scroll; overflow-x: hidden; width: 100%; height: 100%;}\n"
+ + "object {pointer-events: none;}");
+ if (jsonData != null)
+ {
+ // facebox style sheet for displaying raw BioJSON data
+ htmlSvg.append("#facebox { position: absolute; top: 0; left: 0; z-index: 100; text-align: left; }\n"
+ + "#facebox .popup{ position:relative; border:3px solid rgba(0,0,0,0); -webkit-border-radius:5px;"
+ + "-moz-border-radius:5px; border-radius:5px; -webkit-box-shadow:0 0 18px rgba(0,0,0,0.4); -moz-box-shadow:0 0 18px rgba(0,0,0,0.4);"
+ + "box-shadow:0 0 18px rgba(0,0,0,0.4); }\n"
+ + "#facebox .content { display:table; width: 98%; padding: 10px; background: #fff; -webkit-border-radius:4px; -moz-border-radius:4px;"
+ + " border-radius:4px; }\n"
+ + "#facebox .content > p:first-child{ margin-top:0; }\n"
+ + "#facebox .content > p:last-child{ margin-bottom:0; }\n"
+ + "#facebox .close{ position:absolute; top:5px; right:5px; padding:2px; background:#fff; }\n"
+ + "#facebox .close img{ opacity:0.3; }\n"
+ + "#facebox .close:hover img{ opacity:1.0; }\n"
+ + "#facebox .loading { text-align: center; }\n"
+ + "#facebox .image { text-align: center;}\n"
+ + "#facebox img { border: 0; margin: 0; }\n"
+ + "#facebox_overlay { position: fixed; top: 0px; left: 0px; height:100%; width:100%; }\n"
+ + ".facebox_hide { z-index:-100; }\n"
+ + ".facebox_overlayBG { background-color: #000; z-index: 99; }");
+ }
+
+ htmlSvg.append("</style>");
+ htmlSvg.append("<div class=\"main-container\" \n>");
+ htmlSvg.append("<div class=\"titlex\">\n");
+ htmlSvg.append("<div class=\"sub-category-container\"> \n");
+ htmlSvg.append(titleSvg);
+ htmlSvg.append("</div>");
+ htmlSvg.append("</div>\n\n<!-- ========================================================================================== -->\n\n");
+ htmlSvg.append("<div class=\"align\" >");
+ htmlSvg.append(
+ "<div class=\"sub-category-container\"> <div style=\"overflow-x: scroll;\">")
+ .append(alignmentSvg).append("</div></div>").append("</div>");
+ htmlSvg.append("</div>");
+
+ htmlSvg.append("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js\"></script>\n"
+ + "<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js\"></script>\n"
+ + "<script>\n"
+ + "var subCatContainer = $(\".sub-category-container\");\n"
+ + "subCatContainer.scroll(\nfunction() {\n"
+ + "subCatContainer.scrollTop($(this).scrollTop());\n});\n");
+
+ htmlSvg.append("</script>\n");
+
+ // javascript for launching file in Jalview
+
+ htmlSvg.append("<script language=\"JavaScript\">\n");
+ htmlSvg.append("function openJalviewUsingCurrentUrl(){\n");
+ htmlSvg.append(" var json = JSON.parse(document.getElementById(\"seqData\").innerHTML);\n");
+ htmlSvg.append(" var jalviewVersion = json['appSettings'].version;\n");
+ htmlSvg.append(" var url = json['appSettings'].webStartUrl;\n");
+ htmlSvg.append(" var myForm = document.createElement(\"form\");\n\n");
+ htmlSvg.append(" var heap = document.createElement(\"input\");\n");
+ htmlSvg.append(" heap.setAttribute(\"name\", \"jvm-max-heap\") ;\n");
+ htmlSvg.append(" heap.setAttribute(\"value\", \"2G\");\n\n");
+ htmlSvg.append(" var target = document.createElement(\"input\");\n");
+ htmlSvg.append(" target.setAttribute(\"name\", \"open\");\n");
+ htmlSvg.append(" target.setAttribute(\"value\", document.URL);\n\n");
+ htmlSvg.append(" var jvVersion = document.createElement(\"input\");\n");
+ htmlSvg.append(" jvVersion.setAttribute(\"name\", \"version\") ;\n");
+ htmlSvg.append(" jvVersion.setAttribute(\"value\", jalviewVersion);\n\n");
+ htmlSvg.append(" myForm.action = url;\n");
+ htmlSvg.append(" myForm.appendChild(heap);\n");
+ htmlSvg.append(" myForm.appendChild(target);\n");
+ htmlSvg.append(" myForm.appendChild(jvVersion);\n");
+ htmlSvg.append(" document.body.appendChild(myForm);\n");
+ htmlSvg.append(" myForm.submit() ;\n");
+ htmlSvg.append(" document.body.removeChild(myForm);\n");
+ htmlSvg.append("}\n");
+
+ // jquery facebox for displaying raw BioJSON data");
+ if (jsonData != null)
+ {
+ htmlSvg.append("/* Facebox (for jQuery)\n");
+ htmlSvg.append("* version: 1.3\n");
+ htmlSvg.append(" * @requires jQuery v1.2 or later\n");
+ htmlSvg.append(" * @homepage https://github.com/defunkt/facebox\n");
+ htmlSvg.append(" * Licensed under the MIT:\n");
+ htmlSvg.append(" * http://www.opensource.org/licenses/mit-license.php\n");
+ htmlSvg.append(" * Copyright Forever Chris Wanstrath, Kyle Neath\n");
+ htmlSvg.append(" * Usage:\n");
+ htmlSvg.append(" * jQuery(document).ready(function() {\n");
+ htmlSvg.append(" * jQuery('a[rel*=facebox]').facebox()\n");
+ htmlSvg.append(" * })\n");
+ htmlSvg.append(" * <a href=\"#terms\" rel=\"facebox\">Terms</a>\n");
+ htmlSvg.append(" * Loads the #terms div in the box\n");
+ htmlSvg.append(" * <a href=\"terms.html\" rel=\"facebox\">Terms</a>\n");
+ htmlSvg.append(" * Loads the terms.html page in the box\n");
+ htmlSvg.append(" * <a href=\"terms.png\" rel=\"facebox\">Terms</a>\n");
+ htmlSvg.append(" * Loads the terms.png image in the box\n");
+ htmlSvg.append(" * You can also use it programmatically:\n");
+ htmlSvg.append(" * jQuery.facebox('some html')\n");
+ htmlSvg.append(" * jQuery.facebox('some html', 'my-groovy-style')\n");
+ htmlSvg.append(" * The above will open a facebox with \"some html\" as the content.\n");
+ htmlSvg.append(" * jQuery.facebox(function($) {\n");
+ htmlSvg.append(" * $.get('blah.html', function(data) { $.facebox(data) })\n");
+ htmlSvg.append(" * })\n");
+ htmlSvg.append(" * The above will show a loading screen before the passed function is called,\n");
+ htmlSvg.append(" * allowing for a better ajaxy experience.\n");
+ htmlSvg.append(" * The facebox function can also display an ajax page, an image, or the contents of a div:\n");
+ htmlSvg.append(" * jQuery.facebox({ ajax: 'remote.html' })\n");
+ htmlSvg.append(" * jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style')\n");
+ htmlSvg.append(" * jQuery.facebox({ image: 'stairs.jpg' })\n");
+ htmlSvg.append(" * jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style')\n");
+ htmlSvg.append(" * jQuery.facebox({ div: '#box' })\n");
+ htmlSvg.append(" * jQuery.facebox({ div: '#box' }, 'my-groovy-style')\n");
+ htmlSvg.append(" * Want to close the facebox? Trigger the 'close.facebox' document event:\n");
+ htmlSvg.append(" * jQuery(document).trigger('close.facebox')\n");
+ htmlSvg.append(" * Facebox also has a bunch of other hooks:\n");
+ htmlSvg.append(" * loading.facebox\n");
+ htmlSvg.append(" * beforeReveal.facebox\n");
+ htmlSvg.append(" * reveal.facebox (aliased as 'afterReveal.facebox')\n");
+ htmlSvg.append(" * init.facebox\n");
+ htmlSvg.append(" * afterClose.facebox\n");
+ htmlSvg.append(" * Simply bind a function to any of these hooks:\n");
+ htmlSvg.append(" * $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })\n");
+ htmlSvg.append(" *\n");
+ htmlSvg.append(" */\n");
+ htmlSvg.append("(function($) {\n");
+ htmlSvg.append(" $.facebox = function(data, klass) {\n");
+ htmlSvg.append(" $.facebox.loading()\n");
+ htmlSvg.append(" if (data.ajax) fillFaceboxFromAjax(data.ajax, klass)\n");
+ htmlSvg.append(" else if (data.image) fillFaceboxFromImage(data.image, klass)\n");
+ htmlSvg.append(" else if (data.div) fillFaceboxFromHref(data.div, klass)\n");
+ htmlSvg.append(" else if ($.isFunction(data)) data.call($)\n");
+ htmlSvg.append(" else $.facebox.reveal(data, klass)\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" $.extend($.facebox, {\n");
+ htmlSvg.append(" settings: {\n");
+ htmlSvg.append(" opacity : 0.2,\n");
+ htmlSvg.append(" overlay : true,\n");
+ htmlSvg.append(" loadingImage : 'https://raw.githubusercontent.com/jalview/biojson/gh-pages/images/loading.gif',\n");
+ htmlSvg.append(" closeImage : 'https://raw.githubusercontent.com/jalview/biojson/gh-pages/images/cancel.png',\n");
+ htmlSvg.append(" imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],\n");
+ htmlSvg.append(" faceboxHtml : '<div id=\"facebox\" style=\"display:none; width: 95%; height: 85%; overflow: auto;\"> ");
+ htmlSvg.append(" <div class=\"popup\"> ");
+ htmlSvg.append(" <div class=\"content\"> ");
+ htmlSvg.append(" </div> ");
+ htmlSvg.append(" <a href=\"#\" class=\"close\"></a> ");
+ htmlSvg.append(" </div> ");
+ htmlSvg.append(" </div>'\n");
+ htmlSvg.append(" }, \n");
+ htmlSvg.append(" loading: function() {\n");
+ htmlSvg.append(" init()\n");
+ htmlSvg.append(" if ($('#facebox .loading').length == 1) return true\n");
+ htmlSvg.append(" showOverlay() \n");
+ htmlSvg.append(" $('#facebox .content').empty().\n");
+ htmlSvg.append(" append('<div class=\"loading\"><img src=\"'+$.facebox.settings.loadingImage+'\"/></div>')\n");
+ htmlSvg.append(" $('#facebox').show().css({\n");
+ htmlSvg.append(" top: getPageScroll()[1] + (getPageHeight() / 10),\n");
+ htmlSvg.append(" left: $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2)\n");
+ htmlSvg.append(" }) \n");
+ htmlSvg.append(" $(document).bind('keydown.facebox', function(e) {\n");
+ htmlSvg.append(" if (e.keyCode == 27) $.facebox.close()\n");
+ htmlSvg.append(" return true\n");
+ htmlSvg.append(" })\n");
+ htmlSvg.append(" $(document).trigger('loading.facebox')\n");
+ htmlSvg.append(" },\n");
+ htmlSvg.append(" reveal: function(data, klass) {\n");
+ htmlSvg.append(" $(document).trigger('beforeReveal.facebox')\n");
+ htmlSvg.append(" if (klass) $('#facebox .content').addClass(klass)\n");
+ htmlSvg.append(" $('#facebox .content').empty().append('<pre><code>'+JSON.stringify(JSON.parse(data),null,4)+'</pre></code>')\n");
+ htmlSvg.append(" $('#facebox .popup').children().fadeIn('normal')\n");
+ htmlSvg.append(" $('#facebox').css('left', $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2))\n");
+ htmlSvg.append(" $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')\n");
+ htmlSvg.append(" }, \n");
+ htmlSvg.append(" close: function() {\n");
+ htmlSvg.append(" $(document).trigger('close.facebox')\n");
+ htmlSvg.append(" return false\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" })\n");
+ htmlSvg.append(" $.fn.facebox = function(settings) {\n");
+ htmlSvg.append(" if ($(this).length == 0) return \n");
+ htmlSvg.append(" init(settings) \n");
+ htmlSvg.append(" function clickHandler() {\n");
+ htmlSvg.append(" $.facebox.loading(true) \n");
+ htmlSvg.append(" // support for rel=\"facebox.inline_popup\" syntax, to add a class\n");
+ htmlSvg.append(" // also supports deprecated \"facebox[.inline_popup]\" syntax\n");
+ htmlSvg.append(" var klass = this.rel.match(/facebox\\[?\\.(\\w+)\\]?/)\n");
+ htmlSvg.append(" if (klass) klass = klass[1]\n");
+ htmlSvg.append(" fillFaceboxFromHref(this.href, klass)\n");
+ htmlSvg.append(" return false\n");
+ htmlSvg.append(" } \n");
+ htmlSvg.append(" return this.bind('click.facebox', clickHandler)\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" // called one time to setup facebox on this page\n");
+ htmlSvg.append(" function init(settings) {\n");
+ htmlSvg.append(" if ($.facebox.settings.inited) return true\n");
+ htmlSvg.append(" else $.facebox.settings.inited = true\n");
+ htmlSvg.append(" $(document).trigger('init.facebox')\n");
+ htmlSvg.append(" makeCompatible()\n");
+ htmlSvg.append(" var imageTypes = $.facebox.settings.imageTypes.join('|')\n");
+ htmlSvg.append(" $.facebox.settings.imageTypesRegexp = new RegExp('\\\\.(' + imageTypes + ')(\\\\?.*)?$', 'i')\n");
+
+ htmlSvg.append(" if (settings) $.extend($.facebox.settings, settings)\n");
+ htmlSvg.append(" $('body').append($.facebox.settings.faceboxHtml)\n");
+
+ htmlSvg.append(" var preload = [ new Image(), new Image() ]\n");
+ htmlSvg.append(" preload[0].src = $.facebox.settings.closeImage\n");
+ htmlSvg.append(" preload[1].src = $.facebox.settings.loadingImage\n");
+
+ htmlSvg.append(" $('#facebox').find('.b:first, .bl').each(function() {\n");
+ htmlSvg.append(" preload.push(new Image())\n");
+ htmlSvg.append(" preload.slice(-1).src = $(this).css('background-image').replace(/url\\((.+)\\)/, '$1')\n");
+ htmlSvg.append(" })\n");
+
+ htmlSvg.append(" $('#facebox .close')\n");
+ htmlSvg.append(" .click($.facebox.close)\n");
+ htmlSvg.append(" .append('<img src=\"'\n");
+ htmlSvg.append(" + $.facebox.settings.closeImage\n");
+ htmlSvg.append(" + '\" class=\"close_image\" title=\"close\">')\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" // getPageScroll() by quirksmode.com\n");
+ htmlSvg.append(" function getPageScroll() {\n");
+ htmlSvg.append(" var xScroll, yScroll;\n");
+ htmlSvg.append(" if (self.pageYOffset) {\n");
+ htmlSvg.append(" yScroll = self.pageYOffset;\n");
+ htmlSvg.append(" xScroll = self.pageXOffset;\n");
+ htmlSvg.append(" } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict\n");
+ htmlSvg.append(" yScroll = document.documentElement.scrollTop;\n");
+ htmlSvg.append(" xScroll = document.documentElement.scrollLeft;\n");
+ htmlSvg.append(" } else if (document.body) {// all other Explorers\n");
+ htmlSvg.append(" yScroll = document.body.scrollTop;\n");
+ htmlSvg.append(" xScroll = document.body.scrollLeft;\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" return new Array(xScroll,yScroll)\n");
+ htmlSvg.append(" }\n");
+
+ // Adapted from getPageSize() by quirksmode.com");
+ htmlSvg.append(" function getPageHeight() {\n");
+ htmlSvg.append(" var windowHeight\n");
+ htmlSvg.append(" if (self.innerHeight) { // all except Explorer\n");
+ htmlSvg.append(" windowHeight = self.innerHeight;\n");
+ htmlSvg.append(" } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode\n");
+ htmlSvg.append(" windowHeight = document.documentElement.clientHeight;\n");
+ htmlSvg.append(" } else if (document.body) { // other Explorers\n");
+ htmlSvg.append(" windowHeight = document.body.clientHeight;\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" return windowHeight\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" // Backwards compatibility\n");
+ htmlSvg.append(" function makeCompatible() {\n");
+ htmlSvg.append(" var $s = $.facebox.settings \n");
+ htmlSvg.append(" $s.loadingImage = $s.loading_image || $s.loadingImage\n");
+ htmlSvg.append(" $s.closeImage = $s.close_image || $s.closeImage\n");
+ htmlSvg.append(" $s.imageTypes = $s.image_types || $s.imageTypes\n");
+ htmlSvg.append(" $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" // Figures out what you want to display and displays it\n");
+ htmlSvg.append(" // formats are:\n");
+ htmlSvg.append(" // div: #id\n");
+ htmlSvg.append(" // image: blah.extension\n");
+ htmlSvg.append(" // ajax: anything else\n");
+ htmlSvg.append(" function fillFaceboxFromHref(href, klass) {\n");
+ htmlSvg.append(" // div\n");
+ htmlSvg.append(" if (href.match(/#/)) {\n");
+ htmlSvg.append(" var url = window.location.href.split('#')[0]\n");
+ htmlSvg.append(" var target = href.replace(url,'')\n");
+ htmlSvg.append(" if (target == '#') return\n");
+ htmlSvg.append(" $.facebox.reveal($(target).html(), klass)\n");
+
+ htmlSvg.append(" // image\n");
+ htmlSvg.append(" } else if (href.match($.facebox.settings.imageTypesRegexp)) {\n");
+ htmlSvg.append(" fillFaceboxFromImage(href, klass)\n");
+ htmlSvg.append(" // ajax\n");
+ htmlSvg.append(" } else {\n");
+ htmlSvg.append(" fillFaceboxFromAjax(href, klass)\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function fillFaceboxFromImage(href, klass) {\n");
+ htmlSvg.append(" var image = new Image()\n");
+ htmlSvg.append(" image.onload = function() {\n");
+ htmlSvg.append(" $.facebox.reveal('<div class=\"image\"><img src=\"' + image.src + '\" /></div>', klass)\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" image.src = href\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function fillFaceboxFromAjax(href, klass) {\n");
+ htmlSvg.append(" $.facebox.jqxhr = $.get(href, function(data) { $.facebox.reveal(data, klass) })\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function skipOverlay() {\n");
+ htmlSvg.append(" return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function showOverlay() {\n");
+ htmlSvg.append(" if (skipOverlay()) return\n");
+
+ htmlSvg.append(" if ($('#facebox_overlay').length == 0)\n");
+ htmlSvg.append(" $(\"body\").append('<div id=\"facebox_overlay\" class=\"facebox_hide\"></div>')\n");
+
+ htmlSvg.append(" $('#facebox_overlay').hide().addClass(\"facebox_overlayBG\")\n");
+ htmlSvg.append(" .css('opacity', $.facebox.settings.opacity)\n");
+ htmlSvg.append(" .click(function() { $(document).trigger('close.facebox') })\n");
+ htmlSvg.append(" .fadeIn(200)\n");
+ htmlSvg.append(" return false\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function hideOverlay() {\n");
+ htmlSvg.append(" if (skipOverlay()) return \n");
+ htmlSvg.append(" $('#facebox_overlay').fadeOut(200, function(){\n");
+ htmlSvg.append(" $(\"#facebox_overlay\").removeClass(\"facebox_overlayBG\")\n");
+ htmlSvg.append(" $(\"#facebox_overlay\").addClass(\"facebox_hide\")\n");
+ htmlSvg.append(" $(\"#facebox_overlay\").remove()\n");
+ htmlSvg.append(" }) \n");
+ htmlSvg.append(" return false\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" $(document).bind('close.facebox', function() {\n");
+ htmlSvg.append(" if ($.facebox.jqxhr) {\n");
+ htmlSvg.append(" $.facebox.jqxhr.abort()\n");
+ htmlSvg.append(" $.facebox.jqxhr = null\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" $(document).unbind('keydown.facebox')\n");
+ htmlSvg.append(" $('#facebox').fadeOut(function() {\n");
+ htmlSvg.append(" $('#facebox .content').removeClass().addClass('content')\n");
+ htmlSvg.append(" $('#facebox .loading').remove()\n");
+ htmlSvg.append(" $(document).trigger('afterClose.facebox')\n");
+ htmlSvg.append(" })\n");
+ htmlSvg.append(" hideOverlay()\n");
+ htmlSvg.append(" })\n");
+
+ htmlSvg.append("})(jQuery);\n");
+
+ }
+
+ htmlSvg.append("</script>\n");
+ htmlSvg.append("</html>");
+ return htmlSvg.toString();
+ }
+}
diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java
index 7313043..a241e0e 100644
--- a/src/jalview/io/IdentifyFile.java
+++ b/src/jalview/io/IdentifyFile.java
@@ -1,39 +1,43 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.net.*;
+import java.io.IOException;
/**
* DOCUMENT ME!
- *
+ *
* @author $author$
* @version $Revision$
*/
public class IdentifyFile
{
+ public static final String GFF3File = "GFF v2 or v3";
+
/**
* Identify a datasource's file content.
- *
+ *
* @note Do not use this method for stream sources - create a FileParse object
* instead.
- *
+ *
* @param file
* DOCUMENT ME!
* @param protocol
@@ -58,7 +62,9 @@ public class IdentifyFile
emessage = e.getMessage();
}
if (parser != null)
+ {
return parser.errormessage;
+ }
return emessage;
}
@@ -71,7 +77,7 @@ public class IdentifyFile
/**
* Identify contents of source, closing it or resetting source to start
* afterwards.
- *
+ *
* @param source
* @param closeSource
* @return filetype string
@@ -92,7 +98,7 @@ public class IdentifyFile
}
while ((data = source.nextLine()) != null)
{
- length += data.length();
+ length += data.trim().length();
if (!lineswereskipped)
{
for (int i = 0; !isBinary && i < data.length(); i++)
@@ -126,44 +132,21 @@ public class IdentifyFile
}
data = data.toUpperCase();
- if ((data.indexOf("# STOCKHOLM") > -1))
- {
- reply = "STH";
-
- break;
- }
-
- if ((data.length() < 1) || (data.indexOf("#") == 0))
- {
- lineswereskipped = true;
- continue;
- }
-
- if (data.indexOf("PILEUP") > -1)
- {
- reply = "PileUp";
-
- break;
- }
-
- if ((data.indexOf("//") == 0)
- || ((data.indexOf("!!") > -1) && (data.indexOf("!!") < data
- .indexOf("_MULTIPLE_ALIGNMENT "))))
+ if (data.startsWith("##GFF-VERSION"))
{
- reply = "MSF";
-
+ reply = GFF3File;
break;
}
- else if (data.indexOf("CLUSTAL") > -1)
+ if (data.indexOf("# STOCKHOLM") > -1)
{
- reply = "CLUSTAL";
-
+ reply = "STH";
break;
}
- else if (data.indexOf(">") > -1)
+ // if (data.indexOf(">") > -1)
+ if (data.startsWith(">"))
{
// FASTA, PIR file or BLC file
- boolean checkPIR = false,starterm=false;
+ boolean checkPIR = false, starterm = false;
if ((data.indexOf(">P1;") > -1) || (data.indexOf(">DL;") > -1))
{
// watch for PIR file attributes
@@ -182,16 +165,23 @@ public class IdentifyFile
// Is this a single line BLC file?
String data1 = source.nextLine();
String data2 = source.nextLine();
+ int c1;
if (checkPIR)
{
- starterm = (data1!=null && data1.indexOf("*")>-1) || (data2!=null && data2.indexOf("*")>-1);
+ starterm = (data1 != null && data1.indexOf("*") > -1)
+ || (data2 != null && data2.indexOf("*") > -1);
}
- if (data2 != null && data.indexOf("*") > -1)
+ if (data2 != null && (c1 = data.indexOf("*")) > -1)
{
- if (data.indexOf("*") == data2.indexOf("*"))
+ if (c1 == 0 && c1 == data2.indexOf("*"))
{
reply = "BLC";
}
+ else
+ {
+ reply = "FASTA"; // possibly a bad choice - may be recognised as
+ // PIR
+ }
// otherwise can still possibly be a PIR file
}
else
@@ -200,7 +190,8 @@ public class IdentifyFile
// TODO : AMSA File is indicated if there is annotation in the
// FASTA file - but FASTA will automatically generate this at the
// mo.
- if (!checkPIR) {
+ if (!checkPIR)
+ {
break;
}
}
@@ -208,39 +199,113 @@ public class IdentifyFile
// final check for PIR content. require
// >P1;title\n<blah>\nterminated sequence to occur at least once.
- // TODO the PIR/fasta ambiguity may be the use case that is needed to have
+ // TODO the PIR/fasta ambiguity may be the use case that is needed to
+ // have
// a 'Parse as type XXX' parameter for the applet/application.
if (checkPIR)
{
- String dta=null;
+ String dta = null;
if (!starterm)
{
- do {
- try {
+ do
+ {
+ try
+ {
dta = source.nextLine();
- } catch(IOException ex) {};
- if (dta!=null && dta.indexOf("*")>-1)
+ } catch (IOException ex)
+ {
+ }
+ ;
+ if (dta != null && dta.indexOf("*") > -1)
{
starterm = true;
}
- } while (dta!=null && !starterm);
+ } while (dta != null && !starterm);
}
if (starterm)
{
- reply="PIR";
+ reply = "PIR";
break;
- } else {
- reply="FASTA"; // probably a bad choice!
+ }
+ else
+ {
+ reply = "FASTA"; // probably a bad choice!
}
}
// read as a FASTA (probably)
break;
}
+ if ((data.indexOf("<") > -1)) // possible Markup Language data i.e HTML,
+ // RNAML, XML
+ {
+ boolean identified = false;
+ do
+ {
+ if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
+ {
+ reply = HtmlFile.FILE_DESC;
+ identified = true;
+ break;
+ }
+
+ if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>"))
+ {
+ reply = "RNAML";
+ identified = true;
+ break;
+ }
+ } while ((data = source.nextLine()) != null);
+
+ if (identified)
+ {
+ break;
+ }
+ }
+
+ if (data.indexOf("{\"") > -1)
+ {
+ reply = JSONFile.FILE_DESC;
+ break;
+ }
+ if ((data.length() < 1) || (data.indexOf("#") == 0))
+ {
+ lineswereskipped = true;
+ continue;
+ }
+
+ if (data.indexOf("PILEUP") > -1)
+ {
+ reply = "PileUp";
+
+ break;
+ }
+
+ if ((data.indexOf("//") == 0)
+ || ((data.indexOf("!!") > -1) && (data.indexOf("!!") < data
+ .indexOf("_MULTIPLE_ALIGNMENT "))))
+ {
+ reply = "MSF";
+
+ break;
+ }
+ else if (data.indexOf("CLUSTAL") > -1)
+ {
+ reply = "CLUSTAL";
+
+ break;
+ }
+
else if (data.indexOf("HEADER") == 0 || data.indexOf("ATOM") == 0)
{
reply = "PDB";
break;
}
+ else if (data.matches("\\s*\\d+\\s+\\d+\\s*"))
+ {
+ reply = PhylipFile.FILE_DESC;
+ break;
+ }
+
/*
* // TODO comment out SimpleBLAST identification for Jalview 2.4.1 else
* if (!lineswereskipped && data.indexOf("BLAST")<4) { reply =
@@ -286,6 +351,7 @@ public class IdentifyFile
public static void main(String[] args)
{
+
for (int i = 0; args != null && i < args.length; i++)
{
IdentifyFile ider = new IdentifyFile();
diff --git a/src/jalview/io/InputStreamParser.java b/src/jalview/io/InputStreamParser.java
new file mode 100644
index 0000000..c12d2a3
--- /dev/null
+++ b/src/jalview/io/InputStreamParser.java
@@ -0,0 +1,57 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+public class InputStreamParser extends FileParse
+{
+
+ public InputStreamParser(InputStream is, String dataName)
+ throws IOException
+ {
+ super();
+ setDataName(dataName);
+ dataIn = new BufferedReader(new InputStreamReader(is));
+ error = false;
+ }
+
+ public InputStreamParser(Reader isreader, String dataName)
+ throws IOException
+ {
+ super();
+ setDataName(dataName);
+ dataIn = new BufferedReader(isreader);
+ error = false;
+ }
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ dataIn = null;
+ super.finalize();
+ }
+
+}
diff --git a/src/jalview/io/JPredFile.java b/src/jalview/io/JPredFile.java
index 59a010d..5bc615e 100644
--- a/src/jalview/io/JPredFile.java
+++ b/src/jalview/io/JPredFile.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
/**
* PredFile.java
@@ -22,10 +25,16 @@
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
-import jalview.datamodel.*;
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
/**
* Parser for the JPred/JNet concise format. This is a series of CSV lines, each
@@ -290,9 +299,11 @@ public class JPredFile extends AlignFile
if (maxLength != seq_entries.elementAt(i).toString().length())
{
- throw new IOException("JPredConcise: Entry ("
- + ids.elementAt(i).toString()
- + ") has an unexpected number of columns");
+ throw new IOException(
+ MessageManager
+ .formatMessage(
+ "exception.jpredconcide_entry_has_unexpected_number_of_columns",
+ new String[] { ids.elementAt(i).toString() }));
}
if ((newSeq.getName().startsWith("QUERY") || newSeq.getName()
@@ -317,8 +328,10 @@ public class JPredFile extends AlignFile
{
tal = null;
IOException ex = new IOException(
- "Couldn't parse concise annotation for prediction profile.\n"
- + e);
+ MessageManager
+ .formatMessage(
+ "exception.couldnt_parse_concise_annotation_for_prediction",
+ new String[] { e.getMessage() }));
e.printStackTrace(); // java 1.1 does not have :
// ex.setStackTrace(e.getStackTrace());
throw ex;
diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java
new file mode 100644
index 0000000..9b15eb5
--- /dev/null
+++ b/src/jalview/io/JSONFile.java
@@ -0,0 +1,787 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.io;
+
+import jalview.api.AlignExportSettingI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.ComplexAlignFile;
+import jalview.api.FeatureRenderer;
+import jalview.api.FeaturesDisplayedI;
+import jalview.bin.BuildDetails;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.HiddenSequences;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.json.binding.biojson.v1.AlignmentAnnotationPojo;
+import jalview.json.binding.biojson.v1.AlignmentPojo;
+import jalview.json.binding.biojson.v1.AnnotationPojo;
+import jalview.json.binding.biojson.v1.JalviewBioJsColorSchemeMapper;
+import jalview.json.binding.biojson.v1.SequenceFeaturesPojo;
+import jalview.json.binding.biojson.v1.SequenceGrpPojo;
+import jalview.json.binding.biojson.v1.SequencePojo;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.viewmodel.seqfeatures.FeaturesDisplayed;
+
+import java.awt.Color;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+
+public class JSONFile extends AlignFile implements ComplexAlignFile
+{
+ private ColourSchemeI colourScheme;
+
+ private static String version = new BuildDetails().getVersion();
+
+ private String webstartUrl = "http://www.jalview.org/services/launchApp";
+
+ private String application = "Jalview";
+
+ public static final String FILE_EXT = "json";
+
+ public static final String FILE_DESC = "JSON";
+
+ private String globalColorScheme;
+
+ private boolean showSeqFeatures;
+
+ private Hashtable<String, Sequence> seqMap;
+
+ private FeaturesDisplayedI displayedFeatures;
+
+ private FeatureRenderer fr;
+
+ private List<int[]> hiddenColumns;
+
+ private ColumnSelection columnSelection;
+
+ private List<String> hiddenSeqRefs;
+
+ private ArrayList<SequenceI> hiddenSequences;
+
+ public JSONFile()
+ {
+ super();
+ }
+
+ public JSONFile(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ public JSONFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+ }
+
+ @Override
+ public void parse() throws IOException
+ {
+ parse(getReader());
+
+ }
+
+ @Override
+ public String print()
+ {
+ String jsonOutput = null;
+ try
+ {
+ AlignmentPojo jsonAlignmentPojo = new AlignmentPojo();
+ AlignExportSettingI exportSettings = getExportSettings();
+
+ // if no export settings were supplied use the following with all values
+ // defaulting to true
+ if (exportSettings == null)
+ {
+ exportSettings = new AlignExportSettingI()
+ {
+ @Override
+ public boolean isExportHiddenSequences()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportHiddenColumns()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportGroups()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportFeatures()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportAnnotations()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isCancelled()
+ {
+ return false;
+ }
+ };
+ }
+
+ int count = 0;
+ for (SequenceI seq : seqs)
+ {
+ StringBuilder name = new StringBuilder();
+ name.append(seq.getName()).append("/").append(seq.getStart())
+ .append("-").append(seq.getEnd());
+ SequencePojo jsonSeqPojo = new SequencePojo();
+ jsonSeqPojo.setId(String.valueOf(seq.hashCode()));
+ jsonSeqPojo.setOrder(++count);
+ jsonSeqPojo.setEnd(seq.getEnd());
+ jsonSeqPojo.setStart(seq.getStart());
+ jsonSeqPojo.setName(name.toString());
+ jsonSeqPojo.setSeq(seq.getSequenceAsString());
+ jsonAlignmentPojo.getSeqs().add(jsonSeqPojo);
+ }
+ jsonAlignmentPojo.setGlobalColorScheme(globalColorScheme);
+ jsonAlignmentPojo.getAppSettings().put("application", application);
+ jsonAlignmentPojo.getAppSettings().put("version", version);
+ jsonAlignmentPojo.getAppSettings().put("webStartUrl", webstartUrl);
+ jsonAlignmentPojo.getAppSettings().put("showSeqFeatures",
+ String.valueOf(showSeqFeatures));
+
+ String[] hiddenSections = getHiddenSections();
+ if (hiddenSections != null)
+ {
+ if (hiddenSections[0] != null
+ && exportSettings.isExportHiddenColumns())
+ {
+ jsonAlignmentPojo.getAppSettings().put("hiddenCols",
+ String.valueOf(hiddenSections[0]));
+ }
+ if (hiddenSections[1] != null
+ && exportSettings.isExportHiddenSequences())
+ {
+ jsonAlignmentPojo.getAppSettings().put("hiddenSeqs",
+ String.valueOf(hiddenSections[1]));
+ }
+ }
+
+ if (exportSettings.isExportAnnotations())
+ {
+ jsonAlignmentPojo
+ .setAlignAnnotation(annotationToJsonPojo(annotations));
+ }
+
+ if (exportSettings.isExportFeatures())
+ {
+ jsonAlignmentPojo
+ .setSeqFeatures(sequenceFeatureToJsonPojo(seqs, fr));
+ }
+
+ if (exportSettings.isExportGroups() && seqGroups != null
+ && seqGroups.size() > 0)
+ {
+ for (SequenceGroup seqGrp : seqGroups)
+ {
+ SequenceGrpPojo seqGrpPojo = new SequenceGrpPojo();
+ seqGrpPojo.setGroupName(seqGrp.getName());
+ seqGrpPojo.setColourScheme(ColourSchemeProperty
+ .getColourName(seqGrp.cs));
+ seqGrpPojo.setColourText(seqGrp.getColourText());
+ seqGrpPojo.setDescription(seqGrp.getDescription());
+ seqGrpPojo.setDisplayBoxes(seqGrp.getDisplayBoxes());
+ seqGrpPojo.setDisplayText(seqGrp.getDisplayText());
+ seqGrpPojo.setEndRes(seqGrp.getEndRes());
+ seqGrpPojo.setStartRes(seqGrp.getStartRes());
+ seqGrpPojo.setShowNonconserved(seqGrp.getShowNonconserved());
+ for (SequenceI seq : seqGrp.getSequences())
+ {
+ seqGrpPojo.getSequenceRefs()
+ .add(String.valueOf(seq.hashCode()));
+ }
+ jsonAlignmentPojo.getSeqGroups().add(seqGrpPojo);
+ }
+ }
+ org.json.JSONObject generatedJSon = new org.json.JSONObject(
+ jsonAlignmentPojo);
+ jsonOutput = generatedJSon.toString();
+ return jsonOutput.replaceAll("xstart", "xStart").replaceAll("xend",
+ "xEnd");
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return jsonOutput;
+ }
+
+ public String[] getHiddenSections()
+ {
+ String[] hiddenSections = new String[2];
+ if (getViewport() == null)
+ {
+ return null;
+ }
+
+ // hidden column business
+ if (getViewport().hasHiddenColumns())
+ {
+ List<int[]> hiddenCols = getViewport().getColumnSelection()
+ .getHiddenColumns();
+ StringBuilder hiddenColsBuilder = new StringBuilder();
+ for (int[] range : hiddenCols)
+ {
+ hiddenColsBuilder.append(";").append(range[0]).append("-")
+ .append(range[1]);
+ }
+
+ hiddenColsBuilder.deleteCharAt(0);
+ hiddenSections[0] = hiddenColsBuilder.toString();
+ }
+
+ // hidden rows/seqs business
+ HiddenSequences hiddenSeqsObj = getViewport().getAlignment()
+ .getHiddenSequences();
+ if (hiddenSeqsObj == null || hiddenSeqsObj.hiddenSequences == null)
+ {
+ return hiddenSections;
+ }
+
+ SequenceI[] hiddenSeqs = hiddenSeqsObj.hiddenSequences;
+ StringBuilder hiddenSeqsBuilder = new StringBuilder();
+ for (SequenceI hiddenSeq : hiddenSeqs)
+ {
+ if (hiddenSeq != null)
+ {
+ hiddenSeqsBuilder.append(";").append(hiddenSeq.hashCode());
+ }
+ }
+ if (hiddenSeqsBuilder.length() > 0)
+ {
+ hiddenSeqsBuilder.deleteCharAt(0);
+ }
+ hiddenSections[1] = hiddenSeqsBuilder.toString();
+
+ return hiddenSections;
+ }
+
+ public List<SequenceFeaturesPojo> sequenceFeatureToJsonPojo(
+ List<SequenceI> seqs, FeatureRenderer fr)
+ {
+ displayedFeatures = (fr == null) ? null : fr.getFeaturesDisplayed();
+ List<SequenceFeaturesPojo> sequenceFeaturesPojo = new ArrayList<SequenceFeaturesPojo>();
+ for (SequenceI seq : seqs)
+ {
+ SequenceI dataSetSequence = seq.getDatasetSequence();
+ SequenceFeature[] seqFeatures = (dataSetSequence == null) ? null
+ : seq.getDatasetSequence().getSequenceFeatures();
+
+ seqFeatures = (seqFeatures == null) ? seq.getSequenceFeatures()
+ : seqFeatures;
+ if (seqFeatures == null)
+ {
+ continue;
+ }
+
+ for (SequenceFeature sf : seqFeatures)
+ {
+ if (displayedFeatures != null
+ && displayedFeatures.isVisible(sf.getType()))
+ {
+ SequenceFeaturesPojo jsonFeature = new SequenceFeaturesPojo(
+ String.valueOf(seq.hashCode()));
+
+ String featureColour = (fr == null) ? null : jalview.util.Format
+ .getHexString(fr.findFeatureColour(Color.white, seq,
+ seq.findIndex(sf.getBegin())));
+ jsonFeature.setXstart(seq.findIndex(sf.getBegin()) - 1);
+ jsonFeature.setXend(seq.findIndex(sf.getEnd()));
+ jsonFeature.setType(sf.getType());
+ jsonFeature.setDescription(sf.getDescription());
+ jsonFeature.setLinks(sf.links);
+ jsonFeature.setOtherDetails(sf.otherDetails);
+ jsonFeature.setScore(sf.getScore());
+ jsonFeature.setFillColor(featureColour);
+ jsonFeature.setFeatureGroup(sf.getFeatureGroup());
+ sequenceFeaturesPojo.add(jsonFeature);
+ }
+ }
+ }
+ return sequenceFeaturesPojo;
+ }
+
+ public static List<AlignmentAnnotationPojo> annotationToJsonPojo(
+ Vector<AlignmentAnnotation> annotations)
+ {
+ List<AlignmentAnnotationPojo> jsonAnnotations = new ArrayList<AlignmentAnnotationPojo>();
+ if (annotations == null)
+ {
+ return jsonAnnotations;
+ }
+ for (AlignmentAnnotation annot : annotations)
+ {
+ AlignmentAnnotationPojo alignAnnotPojo = new AlignmentAnnotationPojo();
+ alignAnnotPojo.setDescription(annot.description);
+ alignAnnotPojo.setLabel(annot.label);
+ for (Annotation annotation : annot.annotations)
+ {
+ AnnotationPojo annotationPojo = new AnnotationPojo();
+ if (annotation != null)
+ {
+ annotationPojo.setDescription(annotation.description);
+ annotationPojo.setValue(annotation.value);
+ annotationPojo
+ .setSecondaryStructure(annotation.secondaryStructure);
+ annotationPojo.setDisplayCharacter(annotation.displayCharacter);
+ alignAnnotPojo.getAnnotations().add(annotationPojo);
+ }
+ else
+ {
+ alignAnnotPojo.getAnnotations().add(annotationPojo);
+ }
+ }
+ jsonAnnotations.add(alignAnnotPojo);
+ }
+ return jsonAnnotations;
+ }
+
+ @SuppressWarnings("unchecked")
+ public JSONFile parse(Reader jsonAlignmentString)
+ {
+ try
+ {
+ JSONParser jsonParser = new JSONParser();
+ JSONObject alignmentJsonObj = (JSONObject) jsonParser
+ .parse(jsonAlignmentString);
+ JSONArray seqJsonArray = (JSONArray) alignmentJsonObj.get("seqs");
+ JSONArray alAnnotJsonArray = (JSONArray) alignmentJsonObj
+ .get("alignAnnotation");
+ JSONArray jsonSeqArray = (JSONArray) alignmentJsonObj
+ .get("seqFeatures");
+ JSONArray seqGrpJsonArray = (JSONArray) alignmentJsonObj
+ .get("seqGroups");
+ JSONObject jvSettingsJsonObj = (JSONObject) alignmentJsonObj
+ .get("appSettings");
+
+ if (jvSettingsJsonObj != null)
+ {
+ String jsColourScheme = (String) jvSettingsJsonObj
+ .get("globalColorScheme");
+ Boolean showFeatures = Boolean.valueOf(jvSettingsJsonObj.get(
+ "showSeqFeatures").toString());
+ setColourScheme(getJalviewColorScheme(jsColourScheme));
+ setShowSeqFeatures(showFeatures);
+ parseHiddenSeqRefsAsList(jvSettingsJsonObj);
+ parseHiddenCols(jvSettingsJsonObj);
+ }
+
+ hiddenSequences = new ArrayList<SequenceI>();
+ seqMap = new Hashtable<String, Sequence>();
+ for (Iterator<JSONObject> sequenceIter = seqJsonArray.iterator(); sequenceIter
+ .hasNext();)
+ {
+ JSONObject sequence = sequenceIter.next();
+ String sequcenceString = sequence.get("seq").toString();
+ String sequenceName = sequence.get("name").toString();
+ String seqUniqueId = sequence.get("id").toString();
+ int start = Integer.valueOf(sequence.get("start").toString());
+ int end = Integer.valueOf(sequence.get("end").toString());
+ Sequence seq = new Sequence(sequenceName, sequcenceString, start,
+ end);
+ if (hiddenSeqRefs != null && hiddenSeqRefs.contains(seqUniqueId))
+ {
+ hiddenSequences.add(seq);
+ }
+ seqs.add(seq);
+ seqMap.put(seqUniqueId, seq);
+ }
+ parseFeatures(jsonSeqArray);
+
+ for (Iterator<JSONObject> seqGrpIter = seqGrpJsonArray.iterator(); seqGrpIter
+ .hasNext();)
+ {
+ JSONObject seqGrpObj = seqGrpIter.next();
+ String grpName = seqGrpObj.get("groupName").toString();
+ String colourScheme = seqGrpObj.get("colourScheme").toString();
+ String description = (seqGrpObj.get("description") == null) ? null
+ : seqGrpObj.get("description").toString();
+ boolean displayBoxes = Boolean.valueOf(seqGrpObj
+ .get("displayBoxes").toString());
+ boolean displayText = Boolean.valueOf(seqGrpObj.get("displayText")
+ .toString());
+ boolean colourText = Boolean.valueOf(seqGrpObj.get("colourText")
+ .toString());
+ boolean showNonconserved = Boolean.valueOf(seqGrpObj.get(
+ "showNonconserved").toString());
+ int startRes = Integer
+ .valueOf(seqGrpObj.get("startRes").toString());
+ int endRes = Integer.valueOf(seqGrpObj.get("endRes").toString());
+ JSONArray sequenceRefs = (JSONArray) seqGrpObj.get("sequenceRefs");
+
+ ArrayList<SequenceI> grpSeqs = new ArrayList<SequenceI>();
+ if (sequenceRefs.size() > 0)
+ {
+ Iterator<String> seqHashIter = sequenceRefs.iterator();
+ while (seqHashIter.hasNext())
+ {
+ String seqHash = seqHashIter.next();
+ Sequence sequence = seqMap.get(seqHash);
+ if (sequence != null)
+ {
+ grpSeqs.add(sequence);
+ }
+ }
+ }
+ ColourSchemeI grpColourScheme = getJalviewColorScheme(colourScheme);
+ SequenceGroup seqGrp = new SequenceGroup(grpSeqs, grpName,
+ grpColourScheme, displayBoxes, displayText, colourText,
+ startRes, endRes);
+ seqGrp.setShowNonconserved(showNonconserved);
+ seqGrp.setDescription(description);
+ this.seqGroups.add(seqGrp);
+
+ }
+
+ for (Iterator<JSONObject> alAnnotIter = alAnnotJsonArray.iterator(); alAnnotIter
+ .hasNext();)
+ {
+ JSONObject alAnnot = alAnnotIter.next();
+ JSONArray annotJsonArray = (JSONArray) alAnnot.get("annotations");
+ Annotation[] annotations = new Annotation[annotJsonArray.size()];
+ int count = 0;
+ for (Iterator<JSONObject> annotIter = annotJsonArray.iterator(); annotIter
+ .hasNext();)
+ {
+ JSONObject annot = annotIter.next();
+ if (annot == null)
+ {
+ annotations[count] = null;
+ }
+ else
+ {
+ float val = annot.get("value") == null ? null : Float
+ .valueOf(annot.get("value").toString());
+ String desc = annot.get("description") == null ? null : annot
+ .get("description").toString();
+
+ char ss = annot.get("secondaryStructure") == null ? ' ' : annot
+ .get("secondaryStructure").toString().charAt(0);
+ String displayChar = annot.get("displayCharacter") == null ? ""
+ : annot.get("displayCharacter").toString();
+
+ annotations[count] = new Annotation(displayChar, desc, ss, val);
+ }
+ ++count;
+ }
+
+ AlignmentAnnotation alignAnnot = new AlignmentAnnotation(alAnnot
+ .get("label").toString(), alAnnot.get("description")
+ .toString(), annotations);
+ this.annotations.add(alignAnnot);
+ }
+
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return this;
+ }
+
+ public void parseHiddenSeqRefsAsList(JSONObject jvSettingsJson)
+ {
+ hiddenSeqRefs = new ArrayList<String>();
+ String hiddenSeqs = (String) jvSettingsJson.get("hiddenSeqs");
+ if (hiddenSeqs != null && !hiddenSeqs.isEmpty())
+ {
+ String[] seqRefs = hiddenSeqs.split(";");
+ for (String seqRef : seqRefs)
+ {
+ hiddenSeqRefs.add(seqRef);
+ }
+ }
+ }
+
+ public void parseHiddenCols(JSONObject jvSettingsJson)
+ {
+ String hiddenCols = (String) jvSettingsJson.get("hiddenCols");
+ if (hiddenCols != null && !hiddenCols.isEmpty())
+ {
+ columnSelection = new ColumnSelection();
+ String[] rangeStrings = hiddenCols.split(";");
+ for (String rangeString : rangeStrings)
+ {
+ String[] range = rangeString.split("-");
+ columnSelection.hideColumns(Integer.valueOf(range[0]),
+ Integer.valueOf(range[1]));
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void parseFeatures(JSONArray jsonSeqFeatures)
+ {
+ if (jsonSeqFeatures != null)
+ {
+ displayedFeatures = new FeaturesDisplayed();
+ for (Iterator<JSONObject> seqFeatureItr = jsonSeqFeatures.iterator(); seqFeatureItr
+ .hasNext();)
+ {
+ JSONObject jsonFeature = seqFeatureItr.next();
+ Long begin = (Long) jsonFeature.get("xStart");
+ Long end = (Long) jsonFeature.get("xEnd");
+ String type = (String) jsonFeature.get("type");
+ String featureGrp = (String) jsonFeature.get("featureGroup");
+ String descripiton = (String) jsonFeature.get("description");
+ String seqRef = (String) jsonFeature.get("sequenceRef");
+ Float score = Float.valueOf(jsonFeature.get("score").toString());
+
+ Sequence seq = seqMap.get(seqRef);
+ SequenceFeature sequenceFeature = new SequenceFeature();
+ JSONArray linksJsonArray = (JSONArray) jsonFeature.get("links");
+ if (linksJsonArray != null && linksJsonArray.size() > 0)
+ {
+ Iterator<String> linkList = linksJsonArray.iterator();
+ while (linkList.hasNext())
+ {
+ String link = linkList.next();
+ sequenceFeature.addLink(link);
+ }
+ }
+ sequenceFeature.setFeatureGroup(featureGrp);
+ sequenceFeature.setScore(score);
+ sequenceFeature.setDescription(descripiton);
+ sequenceFeature.setType(type);
+ sequenceFeature.setBegin(seq.findPosition(begin.intValue()));
+ sequenceFeature.setEnd(seq.findPosition(end.intValue()) - 1);
+ seq.addSequenceFeature(sequenceFeature);
+ displayedFeatures.setVisible(type);
+ }
+ }
+ }
+
+ public static ColourSchemeI getJalviewColorScheme(
+ String bioJsColourSchemeName)
+ {
+ ColourSchemeI jalviewColor = null;
+ for (JalviewBioJsColorSchemeMapper cs : JalviewBioJsColorSchemeMapper
+ .values())
+ {
+ if (cs.getBioJsName().equalsIgnoreCase(bioJsColourSchemeName))
+ {
+ jalviewColor = cs.getJvColourScheme();
+ break;
+ }
+ }
+ return jalviewColor;
+ }
+
+ public String getGlobalColorScheme()
+ {
+ return globalColorScheme;
+ }
+
+ public void setGlobalColorScheme(String globalColorScheme)
+ {
+ this.globalColorScheme = globalColorScheme;
+ }
+
+ public ColourSchemeI getColourScheme()
+ {
+ return colourScheme;
+ }
+
+ public void setColourScheme(ColourSchemeI colourScheme)
+ {
+ this.colourScheme = colourScheme;
+ }
+
+ @Override
+ public FeaturesDisplayedI getDisplayedFeatures()
+ {
+ return displayedFeatures;
+ }
+
+ public void setDisplayedFeatures(FeaturesDisplayedI displayedFeatures)
+ {
+ this.displayedFeatures = displayedFeatures;
+ }
+
+ public void configureForView(AlignmentViewPanel avpanel)
+ {
+ super.configureForView(avpanel);
+ AlignViewportI viewport = avpanel.getAlignViewport();
+ AlignmentI alignment = viewport.getAlignment();
+ AlignmentAnnotation[] annots = alignment.getAlignmentAnnotation();
+
+ seqGroups = alignment.getGroups();
+ fr = avpanel.cloneFeatureRenderer();
+
+ // Add non auto calculated annotation to AlignFile
+ for (AlignmentAnnotation annot : annots)
+ {
+ if (annot != null && !annot.autoCalculated)
+ {
+ if (!annot.visible)
+ {
+ continue;
+ }
+ annotations.add(annot);
+ }
+ }
+ globalColorScheme = ColourSchemeProperty.getColourName(viewport
+ .getGlobalColourScheme());
+ setDisplayedFeatures(viewport.getFeaturesDisplayed());
+ showSeqFeatures = viewport.isShowSequenceFeatures();
+
+ }
+
+ public boolean isShowSeqFeatures()
+ {
+ return showSeqFeatures;
+ }
+
+ public void setShowSeqFeatures(boolean showSeqFeatures)
+ {
+ this.showSeqFeatures = showSeqFeatures;
+ }
+
+ public Vector<AlignmentAnnotation> getAnnotations()
+ {
+ return annotations;
+ }
+
+ public List<int[]> getHiddenColumns()
+ {
+ return hiddenColumns;
+ }
+
+ public ColumnSelection getColumnSelection()
+ {
+ return columnSelection;
+ }
+
+ public void setColumnSelection(ColumnSelection columnSelection)
+ {
+ this.columnSelection = columnSelection;
+ }
+
+ public SequenceI[] getHiddenSequences()
+ {
+ if (hiddenSequences == null || hiddenSequences.isEmpty())
+ {
+ return new SequenceI[] {};
+ }
+ synchronized (hiddenSequences)
+ {
+ return hiddenSequences.toArray(new SequenceI[hiddenSequences.size()]);
+ }
+ }
+
+ public void setHiddenSequences(ArrayList<SequenceI> hiddenSequences)
+ {
+ this.hiddenSequences = hiddenSequences;
+ }
+
+ public class JSONExportSettings
+ {
+ private boolean exportSequence;
+
+ private boolean exportSequenceFeatures;
+
+ private boolean exportAnnotations;
+
+ private boolean exportGroups;
+
+ private boolean exportJalviewSettings;
+
+ public boolean isExportSequence()
+ {
+ return exportSequence;
+ }
+
+ public void setExportSequence(boolean exportSequence)
+ {
+ this.exportSequence = exportSequence;
+ }
+
+ public boolean isExportSequenceFeatures()
+ {
+ return exportSequenceFeatures;
+ }
+
+ public void setExportSequenceFeatures(boolean exportSequenceFeatures)
+ {
+ this.exportSequenceFeatures = exportSequenceFeatures;
+ }
+
+ public boolean isExportAnnotations()
+ {
+ return exportAnnotations;
+ }
+
+ public void setExportAnnotations(boolean exportAnnotations)
+ {
+ this.exportAnnotations = exportAnnotations;
+ }
+
+ public boolean isExportGroups()
+ {
+ return exportGroups;
+ }
+
+ public void setExportGroups(boolean exportGroups)
+ {
+ this.exportGroups = exportGroups;
+ }
+
+ public boolean isExportJalviewSettings()
+ {
+ return exportJalviewSettings;
+ }
+
+ public void setExportJalviewSettings(boolean exportJalviewSettings)
+ {
+ this.exportJalviewSettings = exportJalviewSettings;
+ }
+ }
+}
diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java
index 7f0bab1..951b998 100644
--- a/src/jalview/io/JalviewFileChooser.java
+++ b/src/jalview/io/JalviewFileChooser.java
@@ -1,38 +1,55 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
//////////////////////////////////////////////////////////////////
package jalview.io;
-import java.io.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.HeadlessException;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JFileChooser;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SpringLayout;
/**
* Enhanced file chooser dialog box.
- *
+ *
* NOTE: bug on Windows systems when filechooser opened on directory to view
* files with colons in title.
- *
+ *
* @author AMW
- *
+ *
*/
public class JalviewFileChooser extends JFileChooser
{
@@ -85,7 +102,6 @@ public class JalviewFileChooser extends JFileChooser
{
JalviewFileFilter jvf = new JalviewFileFilter(suffix[i], desc[i]);
addChoosableFileFilter(jvf);
-
if ((selected != null) && selected.equalsIgnoreCase(desc[i]))
{
chosen = jvf;
@@ -100,6 +116,7 @@ public class JalviewFileChooser extends JFileChooser
setAccessory(new RecentlyOpened());
}
+ @Override
public void setFileFilter(javax.swing.filechooser.FileFilter filter)
{
super.setFileFilter(filter);
@@ -118,6 +135,7 @@ public class JalviewFileChooser extends JFileChooser
EventQueue.invokeLater(new Thread()
{
+ @Override
public void run()
{
String currentName = ui.getFileName();
@@ -172,17 +190,22 @@ public class JalviewFileChooser extends JFileChooser
{
format = "PFAM";
}
+ else if (format.toUpperCase().startsWith(PhylipFile.FILE_DESC))
+ {
+ format = PhylipFile.FILE_DESC;
+ }
return format;
}
+ @Override
public int showSaveDialog(Component parent) throws HeadlessException
{
this.setAccessory(null);
setDialogType(SAVE_DIALOG);
- int ret = showDialog(parent, "Save");
+ int ret = showDialog(parent, MessageManager.getString("action.save"));
if (getFileFilter() instanceof JalviewFileFilter)
{
@@ -201,7 +224,8 @@ public class JalviewFileChooser extends JFileChooser
&& getSelectedFile().exists())
{
int confirm = JOptionPane.showConfirmDialog(parent,
- "Overwrite existing file?", "File exists",
+ MessageManager.getString("label.overwrite_existing_file"),
+ MessageManager.getString("label.file_already_exists"),
JOptionPane.YES_NO_OPTION);
if (confirm != JOptionPane.YES_OPTION)
@@ -213,22 +237,24 @@ public class JalviewFileChooser extends JFileChooser
return ret;
}
- void recentListSelectionChanged(String selection)
+ void recentListSelectionChanged(Object selection)
{
setSelectedFile(null);
-
- File file = new File(selection);
- if (getFileFilter() instanceof JalviewFileFilter)
+ if (selection != null)
{
- JalviewFileFilter jvf = (JalviewFileFilter) this.getFileFilter();
-
- if (!jvf.accept(file))
+ File file = new File((String) selection);
+ if (getFileFilter() instanceof JalviewFileFilter)
{
- setFileFilter(getChoosableFileFilters()[0]);
+ JalviewFileFilter jvf = (JalviewFileFilter) this.getFileFilter();
+
+ if (!jvf.accept(file))
+ {
+ setFileFilter(getChoosableFileFilters()[0]);
+ }
}
- }
- setSelectedFile(file);
+ setSelectedFile(file);
+ }
}
class RecentlyOpened extends JPanel
@@ -237,6 +263,7 @@ public class JalviewFileChooser extends JFileChooser
public RecentlyOpened()
{
+
String historyItems = jalview.bin.Cache.getProperty("RECENT_FILE");
StringTokenizer st;
Vector recent = new Vector();
@@ -259,20 +286,38 @@ public class JalviewFileChooser extends JFileChooser
list.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent evt)
{
- recentListSelectionChanged(list.getSelectedValue().toString());
+ recentListSelectionChanged(list.getSelectedValue());
}
});
- this.setBorder(new javax.swing.border.TitledBorder("Recently Opened"));
+ this.setBorder(new javax.swing.border.TitledBorder(MessageManager
+ .getString("label.recently_opened")));
final JScrollPane scroller = new JScrollPane(list);
- scroller.setPreferredSize(new Dimension(130, 200));
+
+ SpringLayout layout = new SpringLayout();
+ layout.putConstraint(SpringLayout.WEST, scroller, 5,
+ SpringLayout.WEST, this);
+ layout.putConstraint(SpringLayout.NORTH, scroller, 5,
+ SpringLayout.NORTH, this);
+
+ if (new Platform().isAMac())
+ {
+ scroller.setPreferredSize(new Dimension(500, 100));
+ }
+ else
+ {
+ scroller.setPreferredSize(new Dimension(130, 200));
+ }
+
this.add(scroller);
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
scroller.getHorizontalScrollBar().setValue(
diff --git a/src/jalview/io/JalviewFileFilter.java b/src/jalview/io/JalviewFileFilter.java
index 4fa2ae8..8d6038b 100644
--- a/src/jalview/io/JalviewFileFilter.java
+++ b/src/jalview/io/JalviewFileFilter.java
@@ -1,24 +1,29 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
import javax.swing.filechooser.FileFilter;
diff --git a/src/jalview/io/JalviewFileView.java b/src/jalview/io/JalviewFileView.java
index 82d0061..b7f3201 100644
--- a/src/jalview/io/JalviewFileView.java
+++ b/src/jalview/io/JalviewFileView.java
@@ -1,27 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.util.Hashtable;
-import javax.swing.*;
-import javax.swing.filechooser.*;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.filechooser.FileView;
public class JalviewFileView extends FileView
{
@@ -29,15 +33,24 @@ public class JalviewFileView extends FileView
static
{
+ // TODO: these names should come from the FormatAdapter lists for
+ // readable/writable extensions
+ alignSuffix.put("amsa", "AMSA file");
alignSuffix.put("fasta", "Fasta file");
alignSuffix.put("fa", "Fasta file");
alignSuffix.put("fastq", "Fasta file");
+ alignSuffix.put("mfa", "Fasta file");
alignSuffix.put("blc", "BLC file");
alignSuffix.put("msf", "MSF file");
alignSuffix.put("pfam", "PFAM file");
alignSuffix.put("aln", "Clustal file");
alignSuffix.put("pir", "PIR file");
- alignSuffix.put("jar", "Jalview file");
+ alignSuffix.put("jar", "Jalview Project file (old)");
+ alignSuffix.put("jvp", "Jalview Project file");
+ alignSuffix.put("amsa", "AMSA file");
+ alignSuffix.put("sto", "Stockholm File");
+ alignSuffix.put("stk", "Stockholm File");
+ alignSuffix.put("sto", "Stockholm File");
}
public String getTypeDescription(File f)
diff --git a/src/jalview/io/JnetAnnotationMaker.java b/src/jalview/io/JnetAnnotationMaker.java
index 7c6c61d..5192454 100644
--- a/src/jalview/io/JnetAnnotationMaker.java
+++ b/src/jalview/io/JnetAnnotationMaker.java
@@ -1,23 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
public class JnetAnnotationMaker
{
@@ -57,13 +64,17 @@ public class JnetAnnotationMaker
if ((delMap != null && delMap.length > width)
|| (delMap == null && gapmap.length != width))
{
- throw (new Exception("Number of residues in "
- + (delMap == null ? "" : " mapped ")
- + "supposed query sequence ('"
- + al.getSequenceAt(firstSeq).getName() + "'\n"
- + al.getSequenceAt(firstSeq).getSequenceAsString()
- + ")\ndiffer from number of prediction sites in prediction ("
- + width + ")"));
+ throw (new Exception(
+ MessageManager
+ .formatMessage(
+ "exception.number_of_residues_in_query_sequence_differ_from_prediction",
+ new String[] {
+ (delMap == null ? "" : MessageManager
+ .getString("label.mapped")),
+ al.getSequenceAt(firstSeq).getName(),
+ al.getSequenceAt(firstSeq)
+ .getSequenceAsString(),
+ Integer.valueOf(width).toString() })));
}
AlignmentAnnotation annot;
@@ -75,6 +86,9 @@ public class JnetAnnotationMaker
existingAnnotations = al.getAlignmentAnnotation().length;
}
+ Annotation[] sol = new Annotation[al.getWidth()];
+ boolean firstsol = true;
+
while (i < preds.length)
{
String id = preds[i].getName().toUpperCase();
@@ -82,98 +96,121 @@ public class JnetAnnotationMaker
if (id.startsWith("LUPAS") || id.startsWith("JNET")
|| id.startsWith("JPRED"))
{
- annotations = new Annotation[al.getWidth()];
- /*
- * if (delMap!=null) { for (int j=0; j<annotations.length; j++)
- * annotations[j] = new Annotation("","",'',0); }
- */
- if (id.equals("JNETPRED") || id.equals("JNETPSSM")
- || id.equals("JNETFREQ") || id.equals("JNETHMM")
- || id.equals("JNETALIGN") || id.equals("JPRED"))
+ if (id.startsWith("JNETSOL"))
{
- if (delMap == null)
+ float amnt = (id.endsWith("25") ? 3f : id.endsWith("5") ? 6f : 9f);
+ for (int spos = 0; spos < width; spos++)
{
- for (int j = 0; j < width; j++)
+ int sposw = (delMap == null) ? gapmap[spos]
+ : gapmap[delMap[spos]];
+ if (firstsol)
{
- annotations[gapmap[j]] = new Annotation("", "",
- preds[i].getCharAt(j), 0);
+ sol[sposw] = new Annotation(0f);
}
- }
- else
- {
- for (int j = 0; j < width; j++)
+ if (preds[i].getCharAt(spos) == 'B'
+ && (sol[sposw].value == 0f || sol[sposw].value < amnt))
{
- annotations[gapmap[delMap[j]]] = new Annotation("", "",
- preds[i].getCharAt(j), 0);
+ sol[sposw].value = amnt;
}
}
+ firstsol = false;
}
- else if (id.equals("JNETCONF"))
+ else
{
- if (delMap == null)
+ // some other kind of annotation
+ annotations = new Annotation[al.getWidth()];
+ /*
+ * if (delMap!=null) { for (int j=0; j<annotations.length; j++)
+ * annotations[j] = new Annotation("","",'',0); }
+ */
+ if (id.equals("JNETPRED") || id.equals("JNETPSSM")
+ || id.equals("JNETFREQ") || id.equals("JNETHMM")
+ || id.equals("JNETALIGN") || id.equals("JPRED"))
{
- for (int j = 0; j < width; j++)
+ if (delMap == null)
{
- float value = new Float(preds[i].getCharAt(j) + "")
- .floatValue();
- annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(j)
- + "", "", preds[i].getCharAt(j), value);
+ for (int j = 0; j < width; j++)
+ {
+ annotations[gapmap[j]] = new Annotation("", "",
+ preds[i].getCharAt(j), 0);
+ }
}
- }
- else
- {
- for (int j = 0; j < width; j++)
+ else
{
- float value = new Float(preds[i].getCharAt(j) + "")
- .floatValue();
- annotations[gapmap[delMap[j]]] = new Annotation(
- preds[i].getCharAt(j) + "", "",
- preds[i].getCharAt(j), value);
+ for (int j = 0; j < width; j++)
+ {
+ annotations[gapmap[delMap[j]]] = new Annotation("", "",
+ preds[i].getCharAt(j), 0);
+ }
}
}
- }
- else
- {
- if (delMap == null)
+ else if (id.equals("JNETCONF"))
{
- for (int j = 0; j < width; j++)
+ if (delMap == null)
{
- annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(j)
- + "", "", ' ', 0);
+ for (int j = 0; j < width; j++)
+ {
+ float value = new Float(preds[i].getCharAt(j) + "")
+ .floatValue();
+ annotations[gapmap[j]] = new Annotation(
+ preds[i].getCharAt(j) + "", "",
+ preds[i].getCharAt(j), value);
+ }
+ }
+ else
+ {
+ for (int j = 0; j < width; j++)
+ {
+ float value = new Float(preds[i].getCharAt(j) + "")
+ .floatValue();
+ annotations[gapmap[delMap[j]]] = new Annotation(
+ preds[i].getCharAt(j) + "", "",
+ preds[i].getCharAt(j), value);
+ }
}
}
else
{
- for (int j = 0; j < width; j++)
+ if (delMap == null)
{
- annotations[gapmap[delMap[j]]] = new Annotation(
- preds[i].getCharAt(j) + "", "", ' ', 0);
+ for (int j = 0; j < width; j++)
+ {
+ annotations[gapmap[j]] = new Annotation(
+ preds[i].getCharAt(j) + "", "", ' ', 0);
+ }
+ }
+ else
+ {
+ for (int j = 0; j < width; j++)
+ {
+ annotations[gapmap[delMap[j]]] = new Annotation(
+ preds[i].getCharAt(j) + "", "", ' ', 0);
+ }
}
}
- }
- if (id.equals("JNETCONF"))
- {
- annot = new AlignmentAnnotation(preds[i].getName(),
- "JNet Output", annotations, 0f, 10f,
- AlignmentAnnotation.BAR_GRAPH);
- }
- else
- {
- annot = new AlignmentAnnotation(preds[i].getName(),
- "JNet Output", annotations);
- }
-
- if (seqRef != null)
- {
- annot.createSequenceMapping(seqRef, 1, true);
- seqRef.addAlignmentAnnotation(annot);
- }
+ if (id.equals("JNETCONF"))
+ {
+ annot = new AlignmentAnnotation(preds[i].getName(),
+ "JNet Output", annotations, 0f, 10f,
+ AlignmentAnnotation.BAR_GRAPH);
+ }
+ else
+ {
+ annot = new AlignmentAnnotation(preds[i].getName(),
+ "JNet Output", annotations);
+ }
- al.addAnnotation(annot);
- al.setAnnotationIndex(annot, al.getAlignmentAnnotation().length
- - existingAnnotations - 1);
+ if (seqRef != null)
+ {
+ annot.createSequenceMapping(seqRef, 1, true);
+ seqRef.addAlignmentAnnotation(annot);
+ }
+ al.addAnnotation(annot);
+ al.setAnnotationIndex(annot, al.getAlignmentAnnotation().length
+ - existingAnnotations - 1);
+ }
if (noMsa)
{
al.deleteSequence(preds[i]);
@@ -182,7 +219,24 @@ public class JnetAnnotationMaker
i++;
}
+ if (!firstsol)
+ {
+ // add the solvent accessibility
+ annot = new AlignmentAnnotation(
+ "Jnet Burial",
+ "<html>Prediction of Solvent Accessibility<br/>levels are<ul><li>0 - Exposed</li><li>3 - 25% or more S.A. accessible</li><li>6 - 5% or more S.A. accessible</li><li>9 - Buried (<5% exposed)</li></ul>",
+ sol, 0f, 9f, AlignmentAnnotation.BAR_GRAPH);
+ annot.validateRangeAndDisplay();
+ if (seqRef != null)
+ {
+ annot.createSequenceMapping(seqRef, 1, true);
+ seqRef.addAlignmentAnnotation(annot);
+ }
+ al.addAnnotation(annot);
+ al.setAnnotationIndex(annot, al.getAlignmentAnnotation().length
+ - existingAnnotations - 1);
+ }
// Hashtable scores = prediction.getScores();
/*
diff --git a/src/jalview/io/MSFfile.java b/src/jalview/io/MSFfile.java
index 7c2e1b2..67ace7c 100644
--- a/src/jalview/io/MSFfile.java
+++ b/src/jalview/io/MSFfile.java
@@ -1,27 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.util.Format;
-import jalview.datamodel.*;
-import jalview.util.*;
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
/**
* DOCUMENT ME!
@@ -60,10 +66,6 @@ public class MSFfile extends AlignFile
super(source);
}
- {
- // TODO Auto-generated constructor stub
- }
-
/**
* DOCUMENT ME!
*/
@@ -217,7 +219,7 @@ public class MSFfile extends AlignFile
StringBuffer out = new StringBuffer("!!" + (is_NA ? "NA" : "AA")
+ "_MULTIPLE_ALIGNMENT 1.0");
- // TODO: JBPNote : Jalview doesn't remember NA or AA yet.
+ // TODO: JBPNote : Jalview doesn't remember NA or AA yet.
out.append(newline);
out.append(newline);
int max = 0;
@@ -228,7 +230,7 @@ public class MSFfile extends AlignFile
{
// Replace all internal gaps with . and external spaces with ~
s[i] = new Sequence(seqs[i].getName(), seqs[i].getSequenceAsString()
- .replace('-', '.'), seqs[i].getStart(),seqs[i].getEnd());
+ .replace('-', '.'), seqs[i].getStart(), seqs[i].getEnd());
StringBuffer sb = new StringBuffer();
sb.append(s[i].getSequence());
@@ -301,7 +303,7 @@ public class MSFfile extends AlignFile
idBlock[i] = new String("Len: "
+ maxLenpad.form(s[i].getSequence().length) + " Check: "
- + maxChkpad.form(checksums[i]) + " Weight: 1.00"+newline);
+ + maxChkpad.form(checksums[i]) + " Weight: 1.00" + newline);
if (s[i].getName().length() > maxid)
{
@@ -335,7 +337,8 @@ public class MSFfile extends AlignFile
maxid++;
out.append(newline);
- out.append(newline);out.append("//");
+ out.append(newline);
+ out.append("//");
out.append(newline);
out.append(newline);
int len = 50;
diff --git a/src/jalview/io/MatrixFile.java b/src/jalview/io/MatrixFile.java
index 11463ce..b8f46f2 100644
--- a/src/jalview/io/MatrixFile.java
+++ b/src/jalview/io/MatrixFile.java
@@ -1,34 +1,35 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.io;
-
-import java.io.IOException;
-
-/**
- * IO for asymmetric matrix with arbitrary dimension with labels, as displayed
- * by PCA viewer. Form is: tab separated entity defs header line TITLE\ttitle
- * DESC\tdesc PROPERTY\t<id or empty for whole matrix>\tname\ttype\tvalue
- * ROW\tRow i label (ID)/tPrinciple text/tprinciple description/t...
- * COLUMN\t(similar, optional).. .. <float>\t<float>...(column-wise data for row
- * i)
- */
-
-public class MatrixFile extends FileParse
-{
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+/**
+ * IO for asymmetric matrix with arbitrary dimension with labels, as displayed
+ * by PCA viewer. Form is: tab separated entity defs header line TITLE\ttitle
+ * DESC\tdesc PROPERTY\t<id or empty for whole matrix>\tname\ttype\tvalue
+ * ROW\tRow i label (ID)/tPrinciple text/tprinciple description/t...
+ * COLUMN\t(similar, optional).. .. <float>\t<float>...(column-wise data for row
+ * i)
+ */
+
+public class MatrixFile extends FileParse
+{
+
+}
diff --git a/src/jalview/io/ModellerDescription.java b/src/jalview/io/ModellerDescription.java
index 21b2aaf..a7a1efa 100644
--- a/src/jalview/io/ModellerDescription.java
+++ b/src/jalview/io/ModellerDescription.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import jalview.datamodel.*;
+import jalview.datamodel.SequenceI;
public class ModellerDescription
{
@@ -26,13 +29,12 @@ public class ModellerDescription
* single line, and sequence start/end and other properties. See PIRFile IO
* for its use.
*/
- final String[] seqTypes =
- { "sequence", "structure", "structureX", "structureN" };
+ final String[] seqTypes = { "sequence", "structure", "structureX",
+ "structureN" };
- final String[] Fields =
- { "objectType", "objectId", "startField", "startCode", "endField",
- "endCode", "description1", "description2", "resolutionField",
- "tailField" };
+ final String[] Fields = { "objectType", "objectId", "startField",
+ "startCode", "endField", "endCode", "description1", "description2",
+ "resolutionField", "tailField" };
final int TYPE = 0;
@@ -57,11 +59,9 @@ public class ModellerDescription
/**
* 0 is free text or empty 1 is something that parses to an integer, or \@
*/
- final int Types[] =
- { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 };
+ final int Types[] = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 };
- final char Padding[] =
- { ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.' };
+ final char Padding[] = { ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.' };
java.util.Hashtable fields = new java.util.Hashtable();
@@ -119,8 +119,9 @@ public class ModellerDescription
private java.util.Hashtable parseDescription(String desc)
{
java.util.Hashtable fields = new java.util.Hashtable();
- java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":",true);
-
+ java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":",
+ true);
+
String field;
int type = -1;
if (st.countTokens() > 0)
@@ -148,28 +149,31 @@ public class ModellerDescription
{
if (!field.equals(":"))
{
- // validate residue field value
- if (Types[i] == 1)
- {
- resCode val = validResidueCode(field);
- if (val != null)
+ // validate residue field value
+ if (Types[i] == 1)
{
- fields.put(new String(Fields[i] + "num"), val);
+ resCode val = validResidueCode(field);
+ if (val != null)
+ {
+ fields.put(new String(Fields[i] + "num"), val);
+ }
+ else
+ {
+ // jalview.bin.Cache.log.debug(
+ // "Ignoring non-Modeller description: invalid integer-like
+ // field '" + field + "'");
+ type = -1; /* invalid field! - throw the FieldSet away */
+ }
+ ;
}
- else
+ fields.put(Fields[i++], field);
+ if (st.hasMoreTokens())
{
- // jalview.bin.Cache.log.debug(
- // "Ignoring non-Modeller description: invalid integer-like
- // field '" + field + "'");
- type = -1; /* invalid field! - throw the FieldSet away */
+ st.nextToken(); // skip token sep.
}
- ;
}
- fields.put(Fields[i++], field);
- if (st.hasMoreTokens()) {
- st.nextToken(); // skip token sep.
- }
- } else {
+ else
+ {
i++;
}
}
@@ -180,7 +184,7 @@ public class ModellerDescription
while (st.hasMoreTokens())
{
String tl = st.nextToken(":");
- field += tl.equals(":") ? tl : (":" + tl);
+ field += tl.equals(":") ? tl : (":" + tl);
}
fields.put(Fields[TAIL], field);
}
@@ -240,13 +244,15 @@ public class ModellerDescription
{
// Set start and end before we update the type (in the case of a
// synthesized field set)
- if (getStartCode()==null || (getStartNum() != seq.getStart() && getStartCode().val != null))
+ if (getStartCode() == null
+ || (getStartNum() != seq.getStart() && getStartCode().val != null))
{
// unset or user updated sequence start position
setStartCode(seq.getStart());
}
- if (getEndCode()==null || (getEndNum() != seq.getEnd() && getStartCode()!=null && getStartCode().val != null))
+ if (getEndCode() == null
+ || (getEndNum() != seq.getEnd() && getStartCode() != null && getStartCode().val != null))
{
setEndCode(seq.getEnd());
}
@@ -349,7 +355,7 @@ public class ModellerDescription
{
int start = 0;
resCode val = getStartCode();
- if (val!=null && val.val != null)
+ if (val != null && val.val != null)
{
return val.val.intValue();
}
@@ -378,7 +384,7 @@ public class ModellerDescription
{
int end = 0;
resCode val = getEndCode();
- if (val!=null && val.val != null)
+ if (val != null && val.val != null)
{
return val.val.intValue();
}
@@ -396,8 +402,8 @@ public class ModellerDescription
{
if (isModellerFieldset())
{
- resCode rc=getStartCode();
- if (rc!=null && rc.val != null)
+ resCode rc = getStartCode();
+ if (rc != null && rc.val != null)
{
newSeq.setStart(getStartNum());
}
@@ -405,8 +411,8 @@ public class ModellerDescription
{
newSeq.setStart(1);
}
- rc=getEndCode();
- if (rc!=null && rc.val != null)
+ rc = getEndCode();
+ if (rc != null && rc.val != null)
{
newSeq.setEnd(getEndNum());
}
diff --git a/src/jalview/io/NewickFile.java b/src/jalview/io/NewickFile.java
index 5fdcc01..800d51a 100644
--- a/src/jalview/io/NewickFile.java
+++ b/src/jalview/io/NewickFile.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
// NewickFile.java
// Tree I/O
@@ -23,10 +26,14 @@
// TODO: Extended SequenceNodeI to hold parsed NHX strings
package jalview.io;
-import java.io.*;
-import java.util.StringTokenizer;
+import jalview.datamodel.SequenceNode;
+import jalview.util.MessageManager;
-import jalview.datamodel.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.StringTokenizer;
/**
* Parse a new hanpshire style tree Caveats: NHX files are NOT supported and the
@@ -292,6 +299,7 @@ public class NewickFile extends FileParse
int nextcp = 0;
int ncp = cp;
+ boolean parsednodename = false;
while (majorsyms.searchFrom(nf, cp) && (Error == null))
{
int fcp = majorsyms.matchedFrom();
@@ -349,14 +357,21 @@ public class NewickFile extends FileParse
case '\'':
com.stevesoft.pat.Regex qnodename = new com.stevesoft.pat.Regex(
- "([^']|'')+'");
+ "'([^']|'')+'");
if (qnodename.searchFrom(nf, fcp))
{
int nl = qnodename.stringMatched().length();
- nodename = new String(qnodename.stringMatched().substring(0,
+ nodename = new String(qnodename.stringMatched().substring(1,
nl - 1));
- cp = fcp + nl + 1;
+ // unpack any escaped colons
+ com.stevesoft.pat.Regex xpandquotes = com.stevesoft.pat.Regex
+ .perlCode("s/''/'/");
+ String widernodename = xpandquotes.replaceAll(nodename);
+ nodename = widernodename;
+ // jump to after end of quoted nodename
+ nextcp = fcp + nl + 1;
+ parsednodename = true;
}
else
{
@@ -425,7 +440,8 @@ public class NewickFile extends FileParse
com.stevesoft.pat.Regex ndist = new com.stevesoft.pat.Regex(
":([-0-9Ee.+]+)");
- if (uqnodename.search(fstring)
+ if (!parsednodename
+ && uqnodename.search(fstring)
&& ((uqnodename.matchedFrom(1) == 0) || (fstring
.charAt(uqnodename.matchedFrom(1) - 1) != ':'))) // JBPNote
// HACK!
@@ -584,6 +600,7 @@ public class NewickFile extends FileParse
distance = DefDistance;
bootstrap = DefBootstrap;
commentString2 = null;
+ parsednodename = false;
}
if (nextcp == 0)
{
@@ -598,11 +615,14 @@ public class NewickFile extends FileParse
if (Error != null)
{
- throw (new IOException("NewickFile: " + Error + "\n"));
+ throw (new IOException(MessageManager.formatMessage(
+ "exception.newfile", new String[] { Error.toString() })));
}
if (root == null)
{
- throw (new IOException("NewickFile: No Tree read in\n"));
+ throw (new IOException(MessageManager.formatMessage(
+ "exception.newfile", new String[] { MessageManager
+ .getString("label.no_tree_read_in") })));
}
// THe next line is failing for topali trees - not sure why yet. if
// (root.right()!=null && root.isDummy())
diff --git a/src/jalview/io/PIRFile.java b/src/jalview/io/PIRFile.java
index 571248a..4b3d02e 100644
--- a/src/jalview/io/PIRFile.java
+++ b/src/jalview/io/PIRFile.java
@@ -1,26 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.io.IOException;
+import java.util.Vector;
public class PIRFile extends AlignFile
{
diff --git a/src/jalview/io/PfamFile.java b/src/jalview/io/PfamFile.java
index b5415a3..e696609 100644
--- a/src/jalview/io/PfamFile.java
+++ b/src/jalview/io/PfamFile.java
@@ -1,27 +1,34 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.util.Format;
+import jalview.util.MessageManager;
-import jalview.datamodel.*;
-import jalview.util.*;
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
public class PfamFile extends AlignFile
{
@@ -97,7 +104,8 @@ public class PfamFile extends AlignFile
if (noSeqs < 1)
{
- throw new IOException("No sequences found (PFAM input)");
+ throw new IOException(
+ MessageManager.getString("exception.pfam_no_sequences_found"));
}
for (i = 0; i < headers.size(); i++)
diff --git a/src/jalview/io/PhylipFile.java b/src/jalview/io/PhylipFile.java
new file mode 100644
index 0000000..656e103
--- /dev/null
+++ b/src/jalview/io/PhylipFile.java
@@ -0,0 +1,329 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+
+import java.io.IOException;
+
+/**
+ * <p>
+ * Parser and exporter for PHYLIP file format, as defined <a
+ * href="http://evolution.genetics.washington.edu/phylip/doc/main.html">in the
+ * documentation</a>. The parser imports PHYLIP files in both sequential and
+ * interleaved format, and (currently) exports in interleaved format (using 60
+ * characters per matrix for the sequence).
+ * <p>
+ *
+ * <p>
+ * The following assumptions have been made for input
+ * <ul>
+ * <li>Sequences are expressed as letters, not real numbers with decimal points
+ * separated by blanks (which is a valid option according to the specification)</li>
+ * </ul>
+ *
+ * The following assumptions have been made for output
+ * <ul>
+ * <li>Interleaved format is used, with each matrix consisting of 60 characters;
+ * </li>
+ * <li>a blank line is added between each matrix;</li>
+ * <li>no spacing is added between the sequence characters.</li>
+ * </ul>
+ *
+ *
+ * </p>
+ *
+ * @author David Corsar
+ *
+ *
+ */
+public class PhylipFile extends AlignFile
+{
+
+ // Define file extension and description to save repeating it elsewhere
+ public static final String FILE_EXT = "phy";
+
+ public static final String FILE_DESC = "PHYLIP";
+
+ /**
+ *
+ * @see {@link AlignFile#AlignFile()}
+ */
+ public PhylipFile()
+ {
+ super();
+ }
+
+ /**
+ *
+ * @param source
+ * @throws IOException
+ */
+ public PhylipFile(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ /**
+ * @param inFile
+ * @param type
+ * @throws IOException
+ * @see {@link AlignFile#AlignFile(FileParse)}
+ */
+ public PhylipFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+ }
+
+ /**
+ * Parses the input source
+ *
+ * @see {@link AlignFile#parse()}
+ */
+ @Override
+ public void parse() throws IOException
+ {
+ try
+ {
+ // First line should contain number of species and number of
+ // characters, separated by blanks
+ String line = nextLine();
+ String[] lineElements = line.trim().split("\\s+");
+ if (lineElements.length < 2)
+ {
+ throw new IOException(
+ "First line must contain the number of specifies and number of characters");
+ }
+
+ int numberSpecies = Integer.parseInt(lineElements[0]), numberCharacters = Integer
+ .parseInt(lineElements[1]);
+
+ if (numberSpecies <= 0)
+ {
+ // there are no sequences in this file so exit a nothing to
+ // parse
+ return;
+ }
+
+ SequenceI[] sequenceElements = new Sequence[numberSpecies];
+ StringBuffer[] sequences = new StringBuffer[numberSpecies];
+
+ // if file is in sequential format there is only one data matrix,
+ // else there are multiple
+
+ // read the first data matrix
+ for (int i = 0; i < numberSpecies; i++)
+ {
+ line = nextLine();
+ // lines start with the name - a maximum of 10 characters
+ // if less, then padded out or terminated with a tab
+ String potentialName = line.substring(0, 10);
+ int tabIndex = potentialName.indexOf('\t');
+ if (tabIndex == -1)
+ {
+ sequenceElements[i] = parseId(validateName(potentialName));
+ sequences[i] = new StringBuffer(
+ removeWhitespace(line.substring(10)));
+ }
+ else
+ {
+ sequenceElements[i] = parseId(validateName(potentialName
+ .substring(0, tabIndex)));
+ sequences[i] = new StringBuffer(
+ removeWhitespace(line.substring(tabIndex)));
+ }
+ }
+
+ // determine if interleaved
+ if ((sequences[0]).length() != numberCharacters)
+ {
+ // interleaved file, so have to read the remainder
+ int i = 0;
+ for (line = nextLine(); line != null; line = nextLine())
+ {
+ // ignore blank lines, as defined by the specification
+ if (line.length() > 0)
+ {
+ sequences[i++].append(removeWhitespace(line));
+ }
+ // reached end of matrix, so get ready for the next one
+ if (i == sequences.length)
+ {
+ i = 0;
+ }
+ }
+ }
+
+ // file parsed completely, now store sequences
+ for (int i = 0; i < numberSpecies; i++)
+ {
+ // first check sequence is the expected length
+ if (sequences[i].length() != numberCharacters)
+ {
+ throw new IOException(sequenceElements[i].getName()
+ + " sequence is incorrect length - should be "
+ + numberCharacters + " but is " + sequences[i].length());
+ }
+ sequenceElements[i].setSequence(sequences[i].toString());
+ seqs.add(sequenceElements[i]);
+ }
+
+ } catch (IOException e)
+ {
+ System.err.println("Exception parsing PHYLIP file " + e);
+ e.printStackTrace(System.err);
+ throw e;
+ }
+
+ }
+
+ /**
+ * Removes any whitespace from txt, used to strip and spaces added to
+ * sequences to improve human readability
+ *
+ * @param txt
+ * @return
+ */
+ private String removeWhitespace(String txt)
+ {
+ return txt.replaceAll("\\s*", "");
+ }
+
+ /**
+ * According to the specification, the name cannot have parentheses, square
+ * brackets, colon, semicolon, comma
+ *
+ * @param name
+ * @return
+ * @throws IOException
+ */
+ private String validateName(String name) throws IOException
+ {
+ char[] invalidCharacters = new char[] { '(', ')', '[', ']', ':', ';',
+ ',' };
+ for (char c : invalidCharacters)
+ {
+ if (name.indexOf(c) > -1)
+ {
+ throw new IOException("Species name contains illegal character "
+ + c);
+ }
+ }
+ return name;
+ }
+
+ /**
+ * <p>
+ * Prints the seqs in interleaved format, with each matrix consisting of 60
+ * characters; a blank line is added between each matrix; no spacing is added
+ * between the sequence characters.
+ * </p>
+ *
+ *
+ * @see {@link AlignFile#print()}
+ */
+ @Override
+ public String print()
+ {
+
+ StringBuffer sb = new StringBuffer(Integer.toString(seqs.size()));
+ sb.append(" ");
+ // if there are no sequences, then define the number of characters as 0
+ sb.append(
+ (seqs.size() > 0) ? Integer
+ .toString(seqs.get(0).getSequence().length) : "0")
+ .append(newline);
+
+ // Due to how IO is handled, there doesn't appear to be a way to store
+ // if the original file was sequential or interleaved; if there is, then
+ // use that to set the value of the following variable
+ boolean sequential = false;
+
+ // maximum number of columns for each row of interleaved format
+ int numInterleavedColumns = 60;
+
+ int sequenceLength = 0;
+ for (SequenceI s : seqs)
+ {
+
+ // ensure name is only 10 characters
+ String name = s.getName();
+ if (name.length() > 10)
+ {
+ name = name.substring(0, 10);
+ }
+ else
+ {
+ // add padding 10 characters
+ name = String.format("%1$-" + 10 + "s", s.getName());
+ }
+ sb.append(name);
+
+ // sequential has the entire sequence following the name
+ if (sequential)
+ {
+ sb.append(s.getSequence());
+ }
+ else
+ {
+ // Jalview ensures all sequences are of same length so no need
+ // to keep track of min/max length
+ sequenceLength = s.getSequence().length;
+ // interleaved breaks the sequence into chunks for
+ // interleavedColumns characters
+ sb.append(s.getSequence(0,
+ Math.min(numInterleavedColumns, sequenceLength)));
+ }
+ sb.append(newline);
+ }
+
+ // add the remaining matrixes if interleaved and there is something to
+ // add
+ if (!sequential && sequenceLength > numInterleavedColumns)
+ {
+ // determine number of remaining matrixes
+ int numMatrics = sequenceLength / numInterleavedColumns;
+ if ((sequenceLength % numInterleavedColumns) > 0)
+ {
+ numMatrics++;
+ }
+
+ // start i = 1 as first matrix has already been printed
+ for (int i = 1; i < numMatrics; i++)
+ {
+ // add blank line to separate this matrix from previous
+ sb.append(newline);
+ int start = i * numInterleavedColumns;
+ for (SequenceI s : seqs)
+ {
+ sb.append(
+ s.getSequence(start, Math.min(start
+ + numInterleavedColumns, sequenceLength)))
+ .append(newline);
+ }
+ }
+
+ }
+
+ return sb.toString();
+ }
+}
diff --git a/src/jalview/io/PileUpfile.java b/src/jalview/io/PileUpfile.java
index bb55e02..e826687 100644
--- a/src/jalview/io/PileUpfile.java
+++ b/src/jalview/io/PileUpfile.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
@@ -32,10 +35,10 @@ package jalview.io;
* found in Emboss (thanks David Martin!)
*
*/
-import java.io.*;
+import jalview.datamodel.SequenceI;
+import jalview.util.Format;
-import jalview.datamodel.*;
-import jalview.util.*;
+import java.io.IOException;
public class PileUpfile extends MSFfile
{
@@ -83,7 +86,7 @@ public class PileUpfile extends MSFfile
StringBuffer out = new StringBuffer("PileUp");
out.append(newline);
out.append(newline);
-
+
int max = 0;
int maxid = 0;
@@ -98,8 +101,7 @@ public class PileUpfile extends MSFfile
}
out.append(" MSF: " + s[0].getSequence().length
- + " Type: P Check: " + bigChecksum % 10000
- + " ..");
+ + " Type: P Check: " + bigChecksum % 10000 + " ..");
out.append(newline);
out.append(newline);
out.append(newline);
@@ -131,8 +133,11 @@ public class PileUpfile extends MSFfile
}
maxid++;
- out.append(newline);out.append(newline);out.append("//");
- out.append(newline);out.append(newline);
+ out.append(newline);
+ out.append(newline);
+ out.append("//");
+ out.append(newline);
+ out.append(newline);
int len = 50;
diff --git a/src/jalview/io/RnamlFile.java b/src/jalview/io/RnamlFile.java
new file mode 100644
index 0000000..2948c92
--- /dev/null
+++ b/src/jalview/io/RnamlFile.java
@@ -0,0 +1,242 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import jalview.analysis.SecStrConsensus.SimpleBP;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import com.stevesoft.pat.Regex;
+
+import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
+import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
+import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
+import fr.orsay.lri.varna.factories.RNAFactory;
+import fr.orsay.lri.varna.models.rna.RNA;
+
+public class RnamlFile extends AlignFile
+{
+ public String id;
+
+ protected ArrayList<RNA> result;
+
+ public RnamlFile()
+ {
+ super();
+
+ }
+
+ public RnamlFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+
+ }
+
+ public RnamlFile(FileParse source) throws IOException
+ {
+ super(source);
+
+ }
+
+ public BufferedReader CreateReader() throws FileNotFoundException
+ {
+ FileReader fr = null;
+ fr = new FileReader(inFile);
+
+ BufferedReader r = new BufferedReader(fr);
+ return r;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.io.AlignFile#parse()
+ */
+ public void parse() throws IOException
+ {
+ if (System.getProperty("java.version").indexOf("1.6") > -1
+ || System.getProperty("java.version").indexOf("1.5") > -1)
+ {
+ // patch for 'This parser does not support specification "null" version
+ // "null"' error
+ // this hack ensures we get a properly updated SAXParserFactory on older
+ // JVMs
+ // thanks to Stefan Birkner over at https://coderwall.com/p/kqsrrw
+ System.setProperty("javax.xml.parsers.SAXParserFactory",
+ "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
+ }
+ // rather than lose exception semantics whilst parsing RNAML with VARNA we
+ // wrap the routine and catch all exceptions before passing them up the
+ // chain as an IOException
+ try
+ {
+ _parse();
+ } catch (ExceptionPermissionDenied pdx)
+ {
+ errormessage = MessageManager.formatMessage(
+ "exception.rnaml_couldnt_access_datasource",
+ new String[] { pdx.getMessage() });
+ throw new IOException(pdx);
+ } catch (ExceptionLoadingFailed lf)
+ {
+ errormessage = MessageManager.formatMessage(
+ "exception.ranml_couldnt_process_data",
+ new String[] { lf.getMessage() });
+ throw new IOException(lf);
+ } catch (ExceptionFileFormatOrSyntax iff)
+ {
+ errormessage = MessageManager.formatMessage(
+ "exception.ranml_invalid_file",
+ new String[] { iff.getMessage() });
+ throw new IOException(iff);
+ } catch (Exception x)
+ {
+ error = true;
+ errormessage = MessageManager.formatMessage(
+ "exception.ranml_problem_parsing_data",
+ new String[] { x.getMessage() });
+ throw new IOException(errormessage, x);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void _parse() throws FileNotFoundException,
+ ExceptionPermissionDenied, ExceptionLoadingFailed,
+ ExceptionFileFormatOrSyntax
+ {
+
+ result = RNAFactory.loadSecStrRNAML(getReader());
+
+ ArrayList<ArrayList> allarray = new ArrayList();
+ ArrayList<ArrayList<SimpleBP>> BP = new ArrayList();
+ ArrayList strucinarray = new ArrayList();
+ SequenceI[] seqs = new SequenceI[result.size()];
+
+ for (int i = 0; i < result.size(); i++)
+ {
+
+ RNA current = result.get(i);
+ String rna = current.getStructDBN(true);
+ String seq = current.getSeq();
+ int begin = 1;
+ int end = seq.length();
+
+ id = current.getName();
+ if (id == null || id.trim().length() == 0)
+ {
+ id = safeName(getDataName());
+ if (result.size() > 1)
+ {
+ id += "." + i;
+ }
+ }
+ seqs[i] = new Sequence(id, seq, begin, end);
+
+ seqs[i].setEnd(seqs[i].findPosition(seqs[i].getLength()));
+ String[] annot = new String[rna.length()];
+ Annotation[] ann = new Annotation[rna.length()];
+
+ for (int j = 0; j < rna.length(); j++)
+ {
+ annot[j] = "" + rna.charAt(j);
+
+ }
+ for (int k = 0; k < rna.length(); k++)
+ {
+ ann[k] = new Annotation(annot[k], "",
+ jalview.schemes.ResidueProperties.getRNASecStrucState(
+ annot[k]).charAt(0), 0f);
+ }
+
+ AlignmentAnnotation align = new AlignmentAnnotation(
+ "Secondary Structure",
+ current.getID().trim().length() > 0 ? "Secondary Structure for "
+ + current.getID()
+ : "", ann);
+
+ seqs[i].addAlignmentAnnotation(align);
+ seqs[i].setRNA(result.get(i));
+
+ allarray.add(strucinarray);
+
+ annotations.addElement(align);
+ BP.add(align.bps);
+
+ }
+
+ setSeqs(seqs);
+ }
+
+ public static String print(SequenceI[] s)
+ {
+ return "not yet implemented";
+ }
+
+ public String print()
+ {
+ System.out.print("print :");
+ return print(getSeqsAsArray());
+ }
+
+ public ArrayList getRNA()
+ {
+ return result;
+ }
+
+ // public static void main(String[] args) {
+ // Pattern p= Pattern.compile("(.+)[.][^.]+");
+ // Matcher m = p.matcher("toto.xml.zip");
+ // System.out.println(m.matches());
+ // System.out.println(m.group(1));
+ // }
+ /**
+ * make a friendly ID string.
+ *
+ * @param dataName
+ * @return truncated dataName to after last '/'
+ */
+ private String safeName(String dataName)
+ {
+ int b = 0;
+ if ((b = dataName.lastIndexOf(".")) > 0)
+ {
+ dataName = dataName.substring(0, b - 1);
+ }
+ b = 0;
+ Regex m = new Regex("[\\/]?([-A-Za-z0-9]+)\\.?");
+ String mm = dataName;
+ while (m.searchFrom(dataName, b))
+ {
+ mm = m.stringMatched();
+ b = m.matchedTo();
+ }
+ return mm;
+ }
+}
diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java
new file mode 100644
index 0000000..8c4a332
--- /dev/null
+++ b/src/jalview/io/SequenceAnnotationReport.java
@@ -0,0 +1,386 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.util.UrlLink;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * generate HTML reports for a sequence
+ *
+ * @author jimp
+ */
+public class SequenceAnnotationReport
+{
+ final String linkImageURL;
+
+ public SequenceAnnotationReport(String linkImageURL)
+ {
+ this.linkImageURL = linkImageURL;
+ }
+
+ /**
+ * appends the features at rpos to the given stringbuffer ready for display in
+ * a tooltip
+ *
+ * @param tooltipText2
+ * @param linkImageURL
+ * @param rpos
+ * @param features
+ * TODO refactor to Jalview 'utilities' somehow.
+ */
+ public void appendFeatures(final StringBuffer tooltipText2, int rpos,
+ List<SequenceFeature> features)
+ {
+ appendFeatures(tooltipText2, rpos, features, null);
+ }
+
+ public void appendFeatures(final StringBuffer tooltipText2, int rpos,
+ List<SequenceFeature> features, Hashtable minmax)
+ {
+ String tmpString;
+ if (features != null)
+ {
+ for (SequenceFeature feature : features)
+ {
+ if (feature.getType().equals("disulfide bond"))
+ {
+ if (feature.getBegin() == rpos || feature.getEnd() == rpos)
+ {
+ if (tooltipText2.length() > 6)
+ {
+ tooltipText2.append("<br>");
+ }
+ tooltipText2.append("disulfide bond " + feature.getBegin()
+ + ":" + feature.getEnd());
+ }
+ }
+ else
+ {
+ if (tooltipText2.length() > 6)
+ {
+ tooltipText2.append("<br>");
+ }
+ // TODO: remove this hack to display link only features
+ boolean linkOnly = feature.getValue("linkonly") != null;
+ if (!linkOnly)
+ {
+ tooltipText2.append(feature.getType() + " ");
+ if (rpos != 0)
+ {
+ // we are marking a positional feature
+ tooltipText2.append(feature.begin);
+ }
+ if (feature.begin != feature.end)
+ {
+ tooltipText2.append(" " + feature.end);
+ }
+
+ if (feature.getDescription() != null
+ && !feature.description.equals(feature.getType()))
+ {
+ tmpString = feature.getDescription();
+ String tmp2up = tmpString.toUpperCase();
+ int startTag = tmp2up.indexOf("<HTML>");
+ if (startTag > -1)
+ {
+ tmpString = tmpString.substring(startTag + 6);
+ tmp2up = tmp2up.substring(startTag + 6);
+ }
+ int endTag = tmp2up.indexOf("</BODY>");
+ if (endTag > -1)
+ {
+ tmpString = tmpString.substring(0, endTag);
+ tmp2up = tmp2up.substring(0, endTag);
+ }
+ endTag = tmp2up.indexOf("</HTML>");
+ if (endTag > -1)
+ {
+ tmpString = tmpString.substring(0, endTag);
+ }
+
+ if (startTag > -1)
+ {
+ tooltipText2.append("; " + tmpString);
+ }
+ else
+ {
+ if (tmpString.indexOf("<") > -1
+ || tmpString.indexOf(">") > -1)
+ {
+ // The description does not specify html is to
+ // be used, so we must remove < > symbols
+ tmpString = tmpString.replaceAll("<", "<");
+ tmpString = tmpString.replaceAll(">", ">");
+
+ tooltipText2.append("; ");
+ tooltipText2.append(tmpString);
+
+ }
+ else
+ {
+ tooltipText2.append("; " + tmpString);
+ }
+ }
+ }
+ // check score should be shown
+ if (!Float.isNaN(feature.getScore()))
+ {
+ float[][] rng = (minmax == null) ? null : ((float[][]) minmax
+ .get(feature.getType()));
+ if (rng != null && rng[0] != null && rng[0][0] != rng[0][1])
+ {
+ tooltipText2.append(" Score=" + feature.getScore());
+ }
+ }
+ if (feature.getValue("status") != null)
+ {
+ String status = feature.getValue("status").toString();
+ if (status.length() > 0)
+ {
+ tooltipText2.append("; (" + feature.getValue("status")
+ + ")");
+ }
+ }
+ }
+ }
+ if (feature.links != null)
+ {
+ if (linkImageURL != null)
+ {
+ tooltipText2.append(" <img src=\"" + linkImageURL + "\">");
+ }
+ else
+ {
+ for (String urlstring : feature.links)
+ {
+ try
+ {
+ for (String[] urllink : createLinksFrom(null, urlstring))
+ {
+ tooltipText2.append("<br/> <a href=\""
+ + urllink[3]
+ + "\" target=\""
+ + urllink[0]
+ + "\">"
+ + (urllink[0].toLowerCase().equals(
+ urllink[1].toLowerCase()) ? urllink[0]
+ : (urllink[0] + ":" + urllink[1]))
+ + "</a></br>");
+ }
+ } catch (Exception x)
+ {
+ System.err.println("problem when creating links from "
+ + urlstring);
+ x.printStackTrace();
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @param seq
+ * @param link
+ * @return String[][] { String[] { link target, link label, dynamic component
+ * inserted (if any), url }}
+ */
+ public String[][] createLinksFrom(SequenceI seq, String link)
+ {
+ ArrayList<String[]> urlSets = new ArrayList<String[]>();
+ ArrayList<String> uniques = new ArrayList<String>();
+ UrlLink urlLink = new UrlLink(link);
+ if (!urlLink.isValid())
+ {
+ System.err.println(urlLink.getInvalidMessage());
+ return null;
+ }
+ final String target = urlLink.getTarget(); // link.substring(0,
+ // link.indexOf("|"));
+ final String label = urlLink.getLabel();
+ if (seq != null && urlLink.isDynamic())
+ {
+
+ // collect matching db-refs
+ DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs(seq.getDBRef(),
+ new String[] { target });
+ // collect id string too
+ String id = seq.getName();
+ String descr = seq.getDescription();
+ if (descr != null && descr.length() < 1)
+ {
+ descr = null;
+ }
+ if (dbr != null)
+ {
+ for (int r = 0; r < dbr.length; r++)
+ {
+ if (id != null && dbr[r].getAccessionId().equals(id))
+ {
+ // suppress duplicate link creation for the bare sequence ID
+ // string with this link
+ id = null;
+ }
+ // create Bare ID link for this RUL
+ String[] urls = urlLink.makeUrls(dbr[r].getAccessionId(), true);
+ if (urls != null)
+ {
+ for (int u = 0; u < urls.length; u += 2)
+ {
+ String unq = urls[u] + "|" + urls[u + 1];
+ if (!uniques.contains(unq))
+ {
+ urlSets.add(new String[] { target, label, urls[u],
+ urls[u + 1] });
+ uniques.add(unq);
+ }
+ }
+ }
+ }
+ }
+ if (id != null)
+ {
+ // create Bare ID link for this RUL
+ String[] urls = urlLink.makeUrls(id, true);
+ if (urls != null)
+ {
+ for (int u = 0; u < urls.length; u += 2)
+ {
+ String unq = urls[u] + "|" + urls[u + 1];
+ if (!uniques.contains(unq))
+ {
+ urlSets.add(new String[] { target, label, urls[u],
+ urls[u + 1] });
+ uniques.add(unq);
+ }
+ }
+ }
+ }
+ if (descr != null && urlLink.getRegexReplace() != null)
+ {
+ // create link for this URL from description only if regex matches
+ String[] urls = urlLink.makeUrls(descr, true);
+ if (urls != null)
+ {
+ for (int u = 0; u < urls.length; u += 2)
+ {
+ String unq = urls[u] + "|" + urls[u + 1];
+ if (!uniques.contains(unq))
+ {
+ urlSets.add(new String[] { target, label, urls[u],
+ urls[u + 1] });
+ uniques.add(unq);
+ }
+ }
+ }
+ }
+
+ }
+ else
+ {
+ String unq = label + "|" + urlLink.getUrl_prefix();
+ if (!uniques.contains(unq))
+ {
+ uniques.add(unq);
+ // Add a non-dynamic link
+ urlSets.add(new String[] { target, label, null,
+ urlLink.getUrl_prefix() });
+ }
+ }
+
+ return urlSets.toArray(new String[][] {});
+ }
+
+ public void createSequenceAnnotationReport(final StringBuffer tip,
+ SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
+ Hashtable minmax)
+ {
+ createSequenceAnnotationReport(tip, sequence, showDbRefs, showNpFeats,
+ true, minmax);
+ }
+
+ public void createSequenceAnnotationReport(final StringBuffer tip,
+ SequenceI sequence, boolean showDbRefs, boolean showNpFeats,
+ boolean tableWrap, Hashtable minmax)
+ {
+ String tmp;
+ tip.append("<i>");
+
+ int maxWidth = 0;
+ if (sequence.getDescription() != null)
+ {
+ tmp = sequence.getDescription();
+ tip.append("<br>" + tmp);
+ maxWidth = Math.max(maxWidth, tmp.length());
+ }
+ SequenceI ds = sequence;
+ while (ds.getDatasetSequence() != null)
+ {
+ ds = ds.getDatasetSequence();
+ }
+ DBRefEntry[] dbrefs = ds.getDBRef();
+ if (showDbRefs && dbrefs != null)
+ {
+ for (int i = 0; i < dbrefs.length; i++)
+ {
+ tip.append("<br>");
+ tmp = dbrefs[i].getSource() + " " + dbrefs[i].getAccessionId();
+ tip.append(tmp);
+ maxWidth = Math.max(maxWidth, tmp.length());
+ }
+ }
+
+ // ADD NON POSITIONAL SEQUENCE INFO
+ SequenceFeature[] features = sequence.getSequenceFeatures();
+ if (showNpFeats && features != null)
+ {
+ for (int i = 0; i < features.length; i++)
+ {
+ if (features[i].begin == 0 && features[i].end == 0)
+ {
+ int sz = -tip.length();
+ List<SequenceFeature> tfeat = new ArrayList<SequenceFeature>();
+ tfeat.add(features[i]);
+ appendFeatures(tip, 0, tfeat, minmax);
+ sz += tip.length();
+ maxWidth = Math.max(maxWidth, sz);
+ }
+ }
+ }
+
+ if (tableWrap && maxWidth > 60)
+ {
+ tip.insert(0, "<table width=350 border=0><tr><td><i>");
+ tip.append("</i></td></tr></table>");
+ }
+
+ }
+}
diff --git a/src/jalview/io/SimpleBlastFile.java b/src/jalview/io/SimpleBlastFile.java
index 2f4f2e2..db5f8a9 100644
--- a/src/jalview/io/SimpleBlastFile.java
+++ b/src/jalview/io/SimpleBlastFile.java
@@ -1,27 +1,32 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
-import jalview.util.*;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
/**
* parse a simple blast report. Attempt to cope with query anchored and pairwise
@@ -195,9 +200,8 @@ public class SimpleBlastFile extends AlignFile
if (seqentry == null)
{
padseq = true; // prepend gaps to new sequences in this block
- seqentry = new Object[]
- { new StringBuffer(), new long[]
- { rstart, rend } };
+ seqentry = new Object[] { new StringBuffer(),
+ new long[] { rstart, rend } };
seqentries.addElement(seqentry);
seqhash.put(sqid, seqentry);
diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java
index 1625241..0274abc 100644
--- a/src/jalview/io/StockholmFile.java
+++ b/src/jalview/io/StockholmFile.java
@@ -1,583 +1,1197 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-/*
- * This extension was written by Benjamin Schuster-Boeckler at sanger.ac.uk
- */
-package jalview.io;
-
-import java.io.*;
-import java.util.*;
-
-import com.stevesoft.pat.*;
-import jalview.datamodel.*;
-
-// import org.apache.log4j.*;
-
-/**
- * This class is supposed to parse a Stockholm format file into Jalview There
- * are TODOs in this class: we do not know what the database source and version
- * is for the file when parsing the #GS= AC tag which associates accessions with
- * sequences. Database references are also not parsed correctly: a separate
- * reference string parser must be added to parse the database reference form
- * into Jalview's local representation.
- *
- * @author bsb at sanger.ac.uk
- * @version 0.3 + jalview mods
- *
- */
-public class StockholmFile extends AlignFile
-{
- // static Logger logger = Logger.getLogger("jalview.io.StockholmFile");
-
- public StockholmFile()
- {
- }
-
- public StockholmFile(String inFile, String type) throws IOException
- {
- super(inFile, type);
- }
-
- public StockholmFile(FileParse source) throws IOException
- {
- super(source);
- }
-
- public void initData()
- {
- super.initData();
- }
-
- /**
- * Parse a file in Stockholm format into Jalview's data model. The file has to
- * be passed at construction time
- *
- * @throws IOException
- * If there is an error with the input file
- */
- public void parse() throws IOException
- {
- StringBuffer treeString = new StringBuffer();
- String treeName = null;
- // --------------- Variable Definitions -------------------
- String line;
- String version;
- // String id;
- Hashtable seqAnn = new Hashtable(); // Sequence related annotations
- Hashtable seqs = new Hashtable();
- Regex p, r, rend, s, x;
-
- // ------------------ Parsing File ----------------------
- // First, we have to check that this file has STOCKHOLM format, i.e. the
- // first line must match
- r = new Regex("# STOCKHOLM ([\\d\\.]+)");
- if (!r.search(nextLine()))
- {
- throw new IOException(
- "This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'");
- }
- else
- {
- version = r.stringMatched(1);
- // logger.debug("Stockholm version: " + version);
- }
-
- // We define some Regexes here that will be used regularily later
- rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment
- p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in
- // id/from/to
- s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype
- r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line
- x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence
-
- rend.optimize();
- p.optimize();
- s.optimize();
- r.optimize();
- x.optimize();
-
- while ((line = nextLine()) != null)
- {
- if (line.length() == 0)
- {
- continue;
- }
- if (rend.search(line))
- {
- // End of the alignment, pass stuff back
-
- this.noSeqs = seqs.size();
- // logger.debug("Number of sequences: " + this.noSeqs);
- Enumeration accs = seqs.keys();
- while (accs.hasMoreElements())
- {
- String acc = (String) accs.nextElement();
- // logger.debug("Processing sequence " + acc);
- String seq = (String) seqs.remove(acc);
- if (maxLength < seq.length())
- {
- maxLength = seq.length();
- }
- int start = 1;
- int end = -1;
- String sid = acc;
- // Retrieve hash of annotations for this accession
- Hashtable accAnnotations = null;
-
- if (seqAnn != null && seqAnn.containsKey(acc))
- {
- accAnnotations = (Hashtable) seqAnn.remove(acc);
- }
-
- // Split accession in id and from/to
- if (p.search(acc))
- {
- sid = p.stringMatched(1);
- start = Integer.parseInt(p.stringMatched(2));
- end = Integer.parseInt(p.stringMatched(3));
- }
- // logger.debug(sid + ", " + start + ", " + end);
-
- Sequence seqO = new Sequence(sid, seq, start, end);
- // Add Description (if any)
- if (accAnnotations != null && accAnnotations.containsKey("DE"))
- {
- String desc = (String) accAnnotations.get("DE");
- seqO.setDescription((desc == null) ? "" : desc);
- }
- // Add DB References (if any)
- if (accAnnotations != null && accAnnotations.containsKey("DR"))
- {
- String dbr = (String) accAnnotations.get("DR");
- if (dbr != null && dbr.indexOf(";") > -1)
- {
- String src = dbr.substring(0, dbr.indexOf(";"));
- String acn = dbr.substring(dbr.indexOf(";") + 1);
- jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn);
- // seqO.addDBRef(dbref);
- }
- }
- Hashtable features = null;
- // We need to adjust the positions of all features to account for gaps
- try
- {
- features = (Hashtable) accAnnotations.remove("features");
- } catch (java.lang.NullPointerException e)
- {
- // loggerwarn("Getting Features for " + acc + ": " +
- // e.getMessage());
- // continue;
- }
- // if we have features
- if (features != null)
- {
- int posmap[] = seqO.findPositionMap();
- Enumeration i = features.keys();
- while (i.hasMoreElements())
- {
- // TODO: parse out secondary structure annotation as annotation
- // row
- // TODO: parse out scores as annotation row
- // TODO: map coding region to core jalview feature types
- String type = i.nextElement().toString();
- Hashtable content = (Hashtable) features.remove(type);
- Enumeration j = content.keys();
- while (j.hasMoreElements())
- {
- String desc = j.nextElement().toString();
- String ns = content.get(desc).toString();
- char[] byChar = ns.toCharArray();
- for (int k = 0; k < byChar.length; k++)
- {
- char c = byChar[k];
- if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM
- // uses
- // '.'
- // for
- // feature
- // background
- {
- int new_pos = posmap[k]; // look up nearest seqeunce
- // position to this column
- SequenceFeature feat = new SequenceFeature(type, desc,
- new_pos, new_pos, 0f, null);
-
- seqO.addSequenceFeature(feat);
- }
- }
- }
-
- }
-
- }
- // garbage collect
-
- // logger.debug("Adding seq " + acc + " from " + start + " to " + end
- // + ": " + seq);
- this.seqs.addElement(seqO);
- }
- return; // finished parsing this segment of source
- }
- else if (!r.search(line))
- {
- // System.err.println("Found sequence line: " + line);
-
- // Split sequence in sequence and accession parts
- if (!x.search(line))
- {
- // logger.error("Could not parse sequence line: " + line);
- throw new IOException("Could not parse sequence line: " + line);
- }
- String ns = (String) seqs.get(x.stringMatched(1));
- if (ns == null)
- {
- ns = "";
- }
- ns += x.stringMatched(2);
-
- seqs.put(x.stringMatched(1), ns);
- }
- else
- {
- String annType = r.stringMatched(1);
- String annContent = r.stringMatched(2);
-
- // System.err.println("type:" + annType + " content: " + annContent);
-
- if (annType.equals("GF"))
- {
- /*
- * Generic per-File annotation, free text Magic features: #=GF NH
- * <tree in New Hampshire eXtended format> #=GF TN <Unique identifier
- * for the next tree> Pfam descriptions: 7. DESCRIPTION OF FIELDS
- *
- * Compulsory fields: ------------------
- *
- * AC Accession number: Accession number in form PFxxxxx.version or
- * PBxxxxxx. ID Identification: One word name for family. DE
- * Definition: Short description of family. AU Author: Authors of the
- * entry. SE Source of seed: The source suggesting the seed members
- * belong to one family. GA Gathering method: Search threshold to
- * build the full alignment. TC Trusted Cutoff: Lowest sequence score
- * and domain score of match in the full alignment. NC Noise Cutoff:
- * Highest sequence score and domain score of match not in full
- * alignment. TP Type: Type of family -- presently Family, Domain,
- * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM
- * Alignment Method The order ls and fs hits are aligned to the model
- * to build the full align. // End of alignment.
- *
- * Optional fields: ----------------
- *
- * DC Database Comment: Comment about database reference. DR Database
- * Reference: Reference to external database. RC Reference Comment:
- * Comment about literature reference. RN Reference Number: Reference
- * Number. RM Reference Medline: Eight digit medline UI number. RT
- * Reference Title: Reference Title. RA Reference Author: Reference
- * Author RL Reference Location: Journal location. PI Previous
- * identifier: Record of all previous ID lines. KW Keywords: Keywords.
- * CC Comment: Comments. NE Pfam accession: Indicates a nested domain.
- * NL Location: Location of nested domains - sequence ID, start and
- * end of insert.
- *
- * Obsolete fields: ----------- AL Alignment method of seed: The
- * method used to align the seed members.
- */
- // Let's save the annotations, maybe we'll be able to do something
- // with them later...
- Regex an = new Regex("(\\w+)\\s*(.*)");
- if (an.search(annContent))
- {
- if (an.stringMatched(1).equals("NH"))
- {
- treeString.append(an.stringMatched(2));
- }
- else if (an.stringMatched(1).equals("TN"))
- {
- if (treeString.length() > 0)
- {
- if (treeName == null)
- {
- treeName = "Tree " + (getTreeCount() + 1);
- }
- addNewickTree(treeName, treeString.toString());
- }
- treeName = an.stringMatched(2);
- treeString = new StringBuffer();
- }
- setAlignmentProperty(an.stringMatched(1), an.stringMatched(2));
- }
- }
- else if (annType.equals("GS"))
- {
- // Generic per-Sequence annotation, free text
- /*
- * Pfam uses these features: Feature Description ---------------------
- * ----------- AC <accession> ACcession number DE <freetext>
- * DEscription DR <db>; <accession>; Database Reference OS <organism>
- * OrganiSm (species) OC <clade> Organism Classification (clade, etc.)
- * LO <look> Look (Color, etc.)
- */
- if (s.search(annContent))
- {
- String acc = s.stringMatched(1);
- String type = s.stringMatched(2);
- String content = s.stringMatched(3);
- // TODO: store DR in a vector.
- // TODO: store AC according to generic file db annotation.
- Hashtable ann;
- if (seqAnn.containsKey(acc))
- {
- ann = (Hashtable) seqAnn.get(acc);
- }
- else
- {
- ann = new Hashtable();
- }
- ann.put(type, content);
- seqAnn.put(acc, ann);
- }
- else
- {
- throw new IOException("Error parsing " + line);
- }
- }
- else if (annType.equals("GC"))
- {
- // Generic per-Column annotation, exactly 1 char per column
- // always need a label.
- if (x.search(annContent))
- {
- // parse out and create alignment annotation directly.
- parseAnnotationRow(annotations, x.stringMatched(1),
- x.stringMatched(2));
- }
- }
- else if (annType.equals("GR"))
- {
- // Generic per-Sequence AND per-Column markup, exactly 1 char per
- // column
- /*
- * Feature Description Markup letters ------- -----------
- * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface
- * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane
- * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15;
- * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in
- * or after) [0-2]
- */
- if (s.search(annContent))
- {
- String acc = s.stringMatched(1);
- String type = s.stringMatched(2);
- String seq = new String(s.stringMatched(3));
- String description = null;
- // Check for additional information about the current annotation
- // We use a simple string tokenizer here for speed
- StringTokenizer sep = new StringTokenizer(seq, " \t");
- description = sep.nextToken();
- if (sep.hasMoreTokens())
- {
- seq = sep.nextToken();
- }
- else
- {
- seq = description;
- description = new String();
- }
- // sequence id with from-to fields
-
- Hashtable ann;
- // Get an object with all the annotations for this sequence
- if (seqAnn.containsKey(acc))
- {
- // logger.debug("Found annotations for " + acc);
- ann = (Hashtable) seqAnn.get(acc);
- }
- else
- {
- // logger.debug("Creating new annotations holder for " + acc);
- ann = new Hashtable();
- seqAnn.put(acc, ann);
- }
-
- Hashtable features;
- // Get an object with all the content for an annotation
- if (ann.containsKey("features"))
- {
- // logger.debug("Found features for " + acc);
- features = (Hashtable) ann.get("features");
- }
- else
- {
- // logger.debug("Creating new features holder for " + acc);
- features = new Hashtable();
- ann.put("features", features);
- }
-
- Hashtable content;
- if (features.containsKey(this.id2type(type)))
- {
- // logger.debug("Found content for " + this.id2type(type));
- content = (Hashtable) features.get(this.id2type(type));
- }
- else
- {
- // logger.debug("Creating new content holder for " +
- // this.id2type(type));
- content = new Hashtable();
- features.put(this.id2type(type), content);
- }
- String ns = (String) content.get(description);
- if (ns == null)
- {
- ns = "";
- }
- ns += seq;
- content.put(description, ns);
- }
- else
- {
- System.err
- .println("Warning - couldn't parse sequence annotation row line:\n"
- + line);
- // throw new IOException("Error parsing " + line);
- }
- }
- else
- {
- throw new IOException("Unknown annotation detected: " + annType
- + " " + annContent);
- }
- }
- }
- if (treeString.length() > 0)
- {
- if (treeName == null)
- {
- treeName = "Tree " + (1 + getTreeCount());
- }
- addNewickTree(treeName, treeString.toString());
- }
- }
-
- private AlignmentAnnotation parseAnnotationRow(Vector annotation,
- String label, String annots)
- {
- String type = (label.indexOf("_cons") == label.length() - 5) ? label
- .substring(0, label.length() - 5) : label;
- boolean ss = false;
- type = id2type(type);
- if (type.equals("secondary structure"))
- {
- ss = true;
- }
- // decide on secondary structure or not.
- Annotation[] els = new Annotation[annots.length()];
- for (int i = 0; i < annots.length(); i++)
- {
- String pos = annots.substring(i, i + 1);
- Annotation ann;
- ann = new Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not
- // be written out
- if (ss)
- {
- ann.secondaryStructure = jalview.schemes.ResidueProperties
- .getDssp3state(pos).charAt(0);
- if (ann.secondaryStructure == pos.charAt(0) || pos.charAt(0) == 'C')
- {
- ann.displayCharacter = ""; // null; // " ";
- }
- else
- {
- ann.displayCharacter = " " + ann.displayCharacter;
- }
- }
-
- els[i] = ann;
- }
- AlignmentAnnotation annot = null;
- Enumeration e = annotation.elements();
- while (e.hasMoreElements())
- {
- annot = (AlignmentAnnotation) e.nextElement();
- if (annot.label.equals(type))
- break;
- annot = null;
- }
- if (annot == null)
- {
- annot = new AlignmentAnnotation(type, type, els);
- annotation.addElement(annot);
- }
- else
- {
- Annotation[] anns = new Annotation[annot.annotations.length
- + els.length];
- System.arraycopy(annot.annotations, 0, anns, 0,
- annot.annotations.length);
- System.arraycopy(els, 0, anns, annot.annotations.length, els.length);
- annot.annotations = anns;
- }
- return annot;
- }
-
- public static String print(SequenceI[] s)
- {
- return "not yet implemented";
- }
-
- public String print()
- {
- return print(getSeqsAsArray());
- }
-
- private static Hashtable typeIds = null;
- static
- {
- if (typeIds == null)
- {
- typeIds = new Hashtable();
- typeIds.put("SS", "secondary structure");
- typeIds.put("SA", "surface accessibility");
- typeIds.put("TM", "transmembrane");
- typeIds.put("PP", "posterior probability");
- typeIds.put("LI", "ligand binding");
- typeIds.put("AS", "active site");
- typeIds.put("IN", "intron");
- typeIds.put("IR", "interacting residue");
- typeIds.put("AC", "accession");
- typeIds.put("OS", "organism");
- typeIds.put("CL", "class");
- typeIds.put("DE", "description");
- typeIds.put("DR", "reference");
- typeIds.put("LO", "look");
- typeIds.put("RF", "reference positions");
-
- }
- }
-
- private String id2type(String id)
- {
- if (typeIds.containsKey(id))
- {
- return (String) typeIds.get(id);
- }
- System.err.println("Warning : Unknown Stockholm annotation type code "
- + id);
- return id;
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+/*
+ * This extension was written by Benjamin Schuster-Boeckler at sanger.ac.uk
+ */
+package jalview.io;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.Mapping;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.util.Format;
+import jalview.util.MessageManager;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import com.stevesoft.pat.Regex;
+
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
+import fr.orsay.lri.varna.factories.RNAFactory;
+import fr.orsay.lri.varna.models.rna.RNA;
+
+// import org.apache.log4j.*;
+
+/**
+ * This class is supposed to parse a Stockholm format file into Jalview There
+ * are TODOs in this class: we do not know what the database source and version
+ * is for the file when parsing the #GS= AC tag which associates accessions with
+ * sequences. Database references are also not parsed correctly: a separate
+ * reference string parser must be added to parse the database reference form
+ * into Jalview's local representation.
+ *
+ * @author bsb at sanger.ac.uk
+ * @author Natasha Shersnev (Dundee, UK) (Stockholm file writer)
+ * @author Lauren Lui (UCSC, USA) (RNA secondary structure annotation import as
+ * stockholm)
+ * @author Anne Menard (Paris, FR) (VARNA parsing of Stockholm file data)
+ * @version 0.3 + jalview mods
+ *
+ */
+public class StockholmFile extends AlignFile
+{
+ // static Logger logger = Logger.getLogger("jalview.io.StockholmFile");
+ protected ArrayList<RNA> result;
+
+ StringBuffer out; // output buffer
+
+ AlignmentI al;
+
+ public StockholmFile()
+ {
+ }
+
+ /**
+ * Creates a new StockholmFile object for output.
+ */
+ public StockholmFile(AlignmentI al)
+ {
+ this.al = al;
+ }
+
+ public StockholmFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+ }
+
+ public StockholmFile(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ public void initData()
+ {
+ super.initData();
+ }
+
+ /**
+ * Parse a file in Stockholm format into Jalview's data model using VARNA
+ *
+ * @throws IOException
+ * If there is an error with the input file
+ */
+ public void parse_with_VARNA(java.io.File inFile) throws IOException
+ {
+ FileReader fr = null;
+ fr = new FileReader(inFile);
+
+ BufferedReader r = new BufferedReader(fr);
+ result = null;
+ try
+ {
+ result = RNAFactory.loadSecStrStockholm(r);
+ } catch (ExceptionUnmatchedClosingParentheses umcp)
+ {
+ errormessage = "Unmatched parentheses in annotation. Aborting ("
+ + umcp.getMessage() + ")";
+ throw new IOException(umcp);
+ }
+ // DEBUG System.out.println("this is the secondary scructure:"
+ // +result.size());
+ SequenceI[] seqs = new SequenceI[result.size()];
+ String id = null;
+ for (int i = 0; i < result.size(); i++)
+ {
+ // DEBUG System.err.println("Processing i'th sequence in Stockholm file")
+ RNA current = result.get(i);
+
+ String seq = current.getSeq();
+ String rna = current.getStructDBN(true);
+ // DEBUG System.out.println(seq);
+ // DEBUG System.err.println(rna);
+ int begin = 0;
+ int end = seq.length() - 1;
+ id = safeName(getDataName());
+ seqs[i] = new Sequence(id, seq, begin, end);
+ String[] annot = new String[rna.length()];
+ Annotation[] ann = new Annotation[rna.length()];
+ for (int j = 0; j < rna.length(); j++)
+ {
+ annot[j] = rna.substring(j, j + 1);
+
+ }
+
+ for (int k = 0; k < rna.length(); k++)
+ {
+ ann[k] = new Annotation(annot[k], "",
+ jalview.schemes.ResidueProperties.getRNASecStrucState(
+ annot[k]).charAt(0), 0f);
+
+ }
+ AlignmentAnnotation align = new AlignmentAnnotation("Sec. str.",
+ current.getID(), ann);
+
+ seqs[i].addAlignmentAnnotation(align);
+ seqs[i].setRNA(result.get(i));
+ this.annotations.addElement(align);
+ }
+ this.setSeqs(seqs);
+
+ }
+
+ /**
+ * Parse a file in Stockholm format into Jalview's data model. The file has to
+ * be passed at construction time
+ *
+ * @throws IOException
+ * If there is an error with the input file
+ */
+ public void parse() throws IOException
+ {
+ StringBuffer treeString = new StringBuffer();
+ String treeName = null;
+ // --------------- Variable Definitions -------------------
+ String line;
+ String version;
+ // String id;
+ Hashtable seqAnn = new Hashtable(); // Sequence related annotations
+ LinkedHashMap<String, String> seqs = new LinkedHashMap<String, String>();
+ Regex p, r, rend, s, x;
+ // Temporary line for processing RNA annotation
+ // String RNAannot = "";
+
+ // ------------------ Parsing File ----------------------
+ // First, we have to check that this file has STOCKHOLM format, i.e. the
+ // first line must match
+
+ r = new Regex("# STOCKHOLM ([\\d\\.]+)");
+ if (!r.search(nextLine()))
+ {
+ throw new IOException(
+ MessageManager
+ .getString("exception.stockholm_invalid_format"));
+ }
+ else
+ {
+ version = r.stringMatched(1);
+
+ // logger.debug("Stockholm version: " + version);
+ }
+
+ // We define some Regexes here that will be used regularily later
+ rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment
+ p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in
+ // id/from/to
+ s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype
+ r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line
+ x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence
+
+ // Convert all bracket types to parentheses (necessary for passing to VARNA)
+ Regex openparen = new Regex("(<|\\[)", "(");
+ Regex closeparen = new Regex("(>|\\])", ")");
+
+ // Detect if file is RNA by looking for bracket types
+ Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");
+
+ rend.optimize();
+ p.optimize();
+ s.optimize();
+ r.optimize();
+ x.optimize();
+ openparen.optimize();
+ closeparen.optimize();
+
+ while ((line = nextLine()) != null)
+ {
+ if (line.length() == 0)
+ {
+ continue;
+ }
+ if (rend.search(line))
+ {
+ // End of the alignment, pass stuff back
+ this.noSeqs = seqs.size();
+
+ String seqdb, dbsource = null;
+ Regex pf = new Regex("PF[0-9]{5}(.*)"); // Finds AC for Pfam
+ Regex rf = new Regex("RF[0-9]{5}(.*)"); // Finds AC for Rfam
+ if (getAlignmentProperty("AC") != null)
+ {
+ String dbType = getAlignmentProperty("AC").toString();
+ if (pf.search(dbType))
+ {
+ // PFAM Alignment - so references are typically from Uniprot
+ dbsource = "PFAM";
+ }
+ else if (rf.search(dbType))
+ {
+ dbsource = "RFAM";
+ }
+ }
+ // logger.debug("Number of sequences: " + this.noSeqs);
+ for (Map.Entry<String, String> skey : seqs.entrySet())
+ {
+ // logger.debug("Processing sequence " + acc);
+ String acc = skey.getKey();
+ String seq = skey.getValue();
+ if (maxLength < seq.length())
+ {
+ maxLength = seq.length();
+ }
+ int start = 1;
+ int end = -1;
+ String sid = acc;
+ /*
+ * Retrieve hash of annotations for this accession Associate
+ * Annotation with accession
+ */
+ Hashtable accAnnotations = null;
+
+ if (seqAnn != null && seqAnn.containsKey(acc))
+ {
+ accAnnotations = (Hashtable) seqAnn.remove(acc);
+ // TODO: add structures to sequence
+ }
+
+ // Split accession in id and from/to
+ if (p.search(acc))
+ {
+ sid = p.stringMatched(1);
+ start = Integer.parseInt(p.stringMatched(2));
+ end = Integer.parseInt(p.stringMatched(3));
+ }
+ // logger.debug(sid + ", " + start + ", " + end);
+
+ Sequence seqO = new Sequence(sid, seq, start, end);
+ // Add Description (if any)
+ if (accAnnotations != null && accAnnotations.containsKey("DE"))
+ {
+ String desc = (String) accAnnotations.get("DE");
+ seqO.setDescription((desc == null) ? "" : desc);
+ }
+ // Add DB References (if any)
+ if (accAnnotations != null && accAnnotations.containsKey("DR"))
+ {
+ String dbr = (String) accAnnotations.get("DR");
+ if (dbr != null && dbr.indexOf(";") > -1)
+ {
+ String src = dbr.substring(0, dbr.indexOf(";"));
+ String acn = dbr.substring(dbr.indexOf(";") + 1);
+ jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn);
+ }
+ }
+
+ if (accAnnotations != null && accAnnotations.containsKey("AC"))
+ {
+ if (dbsource != null)
+ {
+ String dbr = (String) accAnnotations.get("AC");
+ if (dbr != null)
+ {
+ // we could get very clever here - but for now - just try to
+ // guess accession type from source of alignment plus structure
+ // of accession
+ guessDatabaseFor(seqO, dbr, dbsource);
+
+ }
+ }
+ // else - do what ? add the data anyway and prompt the user to
+ // specify what references these are ?
+ }
+
+ Hashtable features = null;
+ // We need to adjust the positions of all features to account for gaps
+ try
+ {
+ features = (Hashtable) accAnnotations.remove("features");
+ } catch (java.lang.NullPointerException e)
+ {
+ // loggerwarn("Getting Features for " + acc + ": " +
+ // e.getMessage());
+ // continue;
+ }
+ // if we have features
+ if (features != null)
+ {
+ int posmap[] = seqO.findPositionMap();
+ Enumeration i = features.keys();
+ while (i.hasMoreElements())
+ {
+ // TODO: parse out secondary structure annotation as annotation
+ // row
+ // TODO: parse out scores as annotation row
+ // TODO: map coding region to core jalview feature types
+ String type = i.nextElement().toString();
+ Hashtable content = (Hashtable) features.remove(type);
+
+ // add alignment annotation for this feature
+ String key = type2id(type);
+ if (key != null)
+ {
+ if (accAnnotations != null
+ && accAnnotations.containsKey(key))
+ {
+ Vector vv = (Vector) accAnnotations.get(key);
+ for (int ii = 0; ii < vv.size(); ii++)
+ {
+ AlignmentAnnotation an = (AlignmentAnnotation) vv
+ .elementAt(ii);
+ seqO.addAlignmentAnnotation(an);
+ annotations.add(an);
+ }
+ }
+ }
+
+ Enumeration j = content.keys();
+ while (j.hasMoreElements())
+ {
+ String desc = j.nextElement().toString();
+ String ns = content.get(desc).toString();
+ char[] byChar = ns.toCharArray();
+ for (int k = 0; k < byChar.length; k++)
+ {
+ char c = byChar[k];
+ if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM
+ // uses
+ // '.'
+ // for
+ // feature
+ // background
+ {
+ int new_pos = posmap[k]; // look up nearest seqeunce
+ // position to this column
+ SequenceFeature feat = new SequenceFeature(type, desc,
+ new_pos, new_pos, 0f, null);
+
+ seqO.addSequenceFeature(feat);
+ }
+ }
+ }
+
+ }
+
+ }
+ // garbage collect
+
+ // logger.debug("Adding seq " + acc + " from " + start + " to " + end
+ // + ": " + seq);
+ this.seqs.addElement(seqO);
+ }
+ return; // finished parsing this segment of source
+ }
+ else if (!r.search(line))
+ {
+ // System.err.println("Found sequence line: " + line);
+
+ // Split sequence in sequence and accession parts
+ if (!x.search(line))
+ {
+ // logger.error("Could not parse sequence line: " + line);
+ throw new IOException(MessageManager.formatMessage(
+ "exception.couldnt_parse_sequence_line",
+ new String[] { line }));
+ }
+ String ns = seqs.get(x.stringMatched(1));
+ if (ns == null)
+ {
+ ns = "";
+ }
+ ns += x.stringMatched(2);
+
+ seqs.put(x.stringMatched(1), ns);
+ }
+ else
+ {
+ String annType = r.stringMatched(1);
+ String annContent = r.stringMatched(2);
+
+ // System.err.println("type:" + annType + " content: " + annContent);
+
+ if (annType.equals("GF"))
+ {
+ /*
+ * Generic per-File annotation, free text Magic features: #=GF NH
+ * <tree in New Hampshire eXtended format> #=GF TN <Unique identifier
+ * for the next tree> Pfam descriptions: 7. DESCRIPTION OF FIELDS
+ *
+ * Compulsory fields: ------------------
+ *
+ * AC Accession number: Accession number in form PFxxxxx.version or
+ * PBxxxxxx. ID Identification: One word name for family. DE
+ * Definition: Short description of family. AU Author: Authors of the
+ * entry. SE Source of seed: The source suggesting the seed members
+ * belong to one family. GA Gathering method: Search threshold to
+ * build the full alignment. TC Trusted Cutoff: Lowest sequence score
+ * and domain score of match in the full alignment. NC Noise Cutoff:
+ * Highest sequence score and domain score of match not in full
+ * alignment. TP Type: Type of family -- presently Family, Domain,
+ * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM
+ * Alignment Method The order ls and fs hits are aligned to the model
+ * to build the full align. // End of alignment.
+ *
+ * Optional fields: ----------------
+ *
+ * DC Database Comment: Comment about database reference. DR Database
+ * Reference: Reference to external database. RC Reference Comment:
+ * Comment about literature reference. RN Reference Number: Reference
+ * Number. RM Reference Medline: Eight digit medline UI number. RT
+ * Reference Title: Reference Title. RA Reference Author: Reference
+ * Author RL Reference Location: Journal location. PI Previous
+ * identifier: Record of all previous ID lines. KW Keywords: Keywords.
+ * CC Comment: Comments. NE Pfam accession: Indicates a nested domain.
+ * NL Location: Location of nested domains - sequence ID, start and
+ * end of insert.
+ *
+ * Obsolete fields: ----------- AL Alignment method of seed: The
+ * method used to align the seed members.
+ */
+ // Let's save the annotations, maybe we'll be able to do something
+ // with them later...
+ Regex an = new Regex("(\\w+)\\s*(.*)");
+ if (an.search(annContent))
+ {
+ if (an.stringMatched(1).equals("NH"))
+ {
+ treeString.append(an.stringMatched(2));
+ }
+ else if (an.stringMatched(1).equals("TN"))
+ {
+ if (treeString.length() > 0)
+ {
+ if (treeName == null)
+ {
+ treeName = "Tree " + (getTreeCount() + 1);
+ }
+ addNewickTree(treeName, treeString.toString());
+ }
+ treeName = an.stringMatched(2);
+ treeString = new StringBuffer();
+ }
+ setAlignmentProperty(an.stringMatched(1), an.stringMatched(2));
+ }
+ }
+ else if (annType.equals("GS"))
+ {
+ // Generic per-Sequence annotation, free text
+ /*
+ * Pfam uses these features: Feature Description ---------------------
+ * ----------- AC <accession> ACcession number DE <freetext>
+ * DEscription DR <db>; <accession>; Database Reference OS <organism>
+ * OrganiSm (species) OC <clade> Organism Classification (clade, etc.)
+ * LO <look> Look (Color, etc.)
+ */
+ if (s.search(annContent))
+ {
+ String acc = s.stringMatched(1);
+ String type = s.stringMatched(2);
+ String content = s.stringMatched(3);
+ // TODO: store DR in a vector.
+ // TODO: store AC according to generic file db annotation.
+ Hashtable ann;
+ if (seqAnn.containsKey(acc))
+ {
+ ann = (Hashtable) seqAnn.get(acc);
+ }
+ else
+ {
+ ann = new Hashtable();
+ }
+ ann.put(type, content);
+ seqAnn.put(acc, ann);
+ }
+ else
+ {
+ // throw new IOException(MessageManager.formatMessage(
+ // "exception.error_parsing_line", new String[] { line }));
+ System.err.println(">> missing annotation: " + line);
+ }
+ }
+ else if (annType.equals("GC"))
+ {
+ // Generic per-Column annotation, exactly 1 char per column
+ // always need a label.
+ if (x.search(annContent))
+ {
+ // parse out and create alignment annotation directly.
+ parseAnnotationRow(annotations, x.stringMatched(1),
+ x.stringMatched(2));
+ }
+ }
+ else if (annType.equals("GR"))
+ {
+ // Generic per-Sequence AND per-Column markup, exactly 1 char per
+ // column
+ /*
+ * Feature Description Markup letters ------- -----------
+ * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface
+ * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane
+ * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15;
+ * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in
+ * or after) [0-2]
+ */
+ if (s.search(annContent))
+ {
+ String acc = s.stringMatched(1);
+ String type = s.stringMatched(2);
+ String seq = new String(s.stringMatched(3));
+ String description = null;
+ // Check for additional information about the current annotation
+ // We use a simple string tokenizer here for speed
+ StringTokenizer sep = new StringTokenizer(seq, " \t");
+ description = sep.nextToken();
+ if (sep.hasMoreTokens())
+ {
+ seq = sep.nextToken();
+ }
+ else
+ {
+ seq = description;
+ description = new String();
+ }
+ // sequence id with from-to fields
+
+ Hashtable ann;
+ // Get an object with all the annotations for this sequence
+ if (seqAnn.containsKey(acc))
+ {
+ // logger.debug("Found annotations for " + acc);
+ ann = (Hashtable) seqAnn.get(acc);
+ }
+ else
+ {
+ // logger.debug("Creating new annotations holder for " + acc);
+ ann = new Hashtable();
+ seqAnn.put(acc, ann);
+ }
+ // TODO test structure, call parseAnnotationRow with vector from
+ // hashtable for specific sequence
+ Hashtable features;
+ // Get an object with all the content for an annotation
+ if (ann.containsKey("features"))
+ {
+ // logger.debug("Found features for " + acc);
+ features = (Hashtable) ann.get("features");
+ }
+ else
+ {
+ // logger.debug("Creating new features holder for " + acc);
+ features = new Hashtable();
+ ann.put("features", features);
+ }
+
+ Hashtable content;
+ if (features.containsKey(this.id2type(type)))
+ {
+ // logger.debug("Found content for " + this.id2type(type));
+ content = (Hashtable) features.get(this.id2type(type));
+ }
+ else
+ {
+ // logger.debug("Creating new content holder for " +
+ // this.id2type(type));
+ content = new Hashtable();
+ features.put(this.id2type(type), content);
+ }
+ String ns = (String) content.get(description);
+ if (ns == null)
+ {
+ ns = "";
+ }
+ ns += seq;
+ content.put(description, ns);
+
+ // if(type.equals("SS")){
+ Hashtable strucAnn;
+ if (seqAnn.containsKey(acc))
+ {
+ strucAnn = (Hashtable) seqAnn.get(acc);
+ }
+ else
+ {
+ strucAnn = new Hashtable();
+ }
+
+ Vector<AlignmentAnnotation> newStruc = new Vector<AlignmentAnnotation>();
+ parseAnnotationRow(newStruc, type, ns);
+ for (AlignmentAnnotation alan : newStruc)
+ {
+ alan.visible = false;
+ }
+ // annotations.addAll(newStruc);
+ strucAnn.put(type, newStruc);
+ seqAnn.put(acc, strucAnn);
+ }
+ // }
+ else
+ {
+ System.err
+ .println("Warning - couldn't parse sequence annotation row line:\n"
+ + line);
+ // throw new IOException("Error parsing " + line);
+ }
+ }
+ else
+ {
+ throw new IOException(MessageManager.formatMessage(
+ "exception.unknown_annotation_detected", new String[] {
+ annType, annContent }));
+ }
+ }
+ }
+ if (treeString.length() > 0)
+ {
+ if (treeName == null)
+ {
+ treeName = "Tree " + (1 + getTreeCount());
+ }
+ addNewickTree(treeName, treeString.toString());
+ }
+ }
+
+ /**
+ * Demangle an accession string and guess the originating sequence database
+ * for a given sequence
+ *
+ * @param seqO
+ * sequence to be annotated
+ * @param dbr
+ * Accession string for sequence
+ * @param dbsource
+ * source database for alignment (PFAM or RFAM)
+ */
+ private void guessDatabaseFor(Sequence seqO, String dbr, String dbsource)
+ {
+ DBRefEntry dbrf = null;
+ List<DBRefEntry> dbrs = new ArrayList<DBRefEntry>();
+ String seqdb = "Unknown", sdbac = "" + dbr;
+ int st = -1, en = -1, p;
+ if ((st = sdbac.indexOf("/")) > -1)
+ {
+ String num, range = sdbac.substring(st + 1);
+ sdbac = sdbac.substring(0, st);
+ if ((p = range.indexOf("-")) > -1)
+ {
+ p++;
+ if (p < range.length())
+ {
+ num = range.substring(p).trim();
+ try
+ {
+ en = Integer.parseInt(num);
+ } catch (NumberFormatException x)
+ {
+ // could warn here that index is invalid
+ en = -1;
+ }
+ }
+ }
+ else
+ {
+ p = range.length();
+ }
+ num = range.substring(0, p).trim();
+ try
+ {
+ st = Integer.parseInt(num);
+ } catch (NumberFormatException x)
+ {
+ // could warn here that index is invalid
+ st = -1;
+ }
+ }
+ if (dbsource.equals("PFAM"))
+ {
+ seqdb = "UNIPROT";
+ if (sdbac.indexOf(".") > -1)
+ {
+ // strip of last subdomain
+ sdbac = sdbac.substring(0, sdbac.indexOf("."));
+ dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, seqdb, dbsource,
+ sdbac);
+ if (dbrf != null)
+ {
+ dbrs.add(dbrf);
+ }
+ }
+ dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, dbsource, dbsource,
+ dbr);
+ if (dbr != null)
+ {
+ dbrs.add(dbrf);
+ }
+ }
+ else
+ {
+ seqdb = "EMBL"; // total guess - could be ENA, or something else these
+ // days
+ if (sdbac.indexOf(".") > -1)
+ {
+ // strip off last subdomain
+ sdbac = sdbac.substring(0, sdbac.indexOf("."));
+ dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, seqdb, dbsource,
+ sdbac);
+ if (dbrf != null)
+ {
+ dbrs.add(dbrf);
+ }
+ }
+
+ dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, dbsource, dbsource,
+ dbr);
+ if (dbrf != null)
+ {
+ dbrs.add(dbrf);
+ }
+ }
+ if (st != -1 && en != -1)
+ {
+ for (DBRefEntry d : dbrs)
+ {
+ jalview.util.MapList mp = new jalview.util.MapList(new int[] {
+ seqO.getStart(), seqO.getEnd() }, new int[] { st, en }, 1, 1);
+ jalview.datamodel.Mapping mping = new Mapping(mp);
+ d.setMap(mping);
+ }
+ }
+ }
+
+ protected static AlignmentAnnotation parseAnnotationRow(
+ Vector annotation, String label, String annots)
+ {
+ String convert1, convert2 = null;
+
+ // Convert all bracket types to parentheses
+ Regex openparen = new Regex("(<|\\[)", "(");
+ Regex closeparen = new Regex("(>|\\])", ")");
+
+ // Detect if file is RNA by looking for bracket types
+ Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");
+
+ convert1 = openparen.replaceAll(annots);
+ convert2 = closeparen.replaceAll(convert1);
+ annots = convert2;
+
+ String type = label;
+ if (label.contains("_cons"))
+ {
+ type = (label.indexOf("_cons") == label.length() - 5) ? label
+ .substring(0, label.length() - 5) : label;
+ }
+ boolean ss = false;
+ type = id2type(type);
+ if (type.equals("secondary structure"))
+ {
+ ss = true;
+ }
+ // decide on secondary structure or not.
+ Annotation[] els = new Annotation[annots.length()];
+ for (int i = 0; i < annots.length(); i++)
+ {
+ String pos = annots.substring(i, i + 1);
+ Annotation ann;
+ ann = new Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not
+ // be written out
+ if (ss)
+ {
+ // if (" .-_".indexOf(pos) == -1)
+ {
+ if (detectbrackets.search(pos))
+ {
+ ann.secondaryStructure = jalview.schemes.ResidueProperties
+ .getRNASecStrucState(pos).charAt(0);
+ }
+ else
+ {
+ ann.secondaryStructure = jalview.schemes.ResidueProperties
+ .getDssp3state(pos).charAt(0);
+ }
+
+ if (ann.secondaryStructure == pos.charAt(0))
+ {
+ ann.displayCharacter = ""; // null; // " ";
+ }
+ else
+ {
+ ann.displayCharacter = " " + ann.displayCharacter;
+ }
+ }
+
+ }
+
+ els[i] = ann;
+ }
+ AlignmentAnnotation annot = null;
+ Enumeration e = annotation.elements();
+ while (e.hasMoreElements())
+ {
+ annot = (AlignmentAnnotation) e.nextElement();
+ if (annot.label.equals(type))
+ {
+ break;
+ }
+ annot = null;
+ }
+ if (annot == null)
+ {
+ annot = new AlignmentAnnotation(type, type, els);
+ annotation.addElement(annot);
+ }
+ else
+ {
+ Annotation[] anns = new Annotation[annot.annotations.length
+ + els.length];
+ System.arraycopy(annot.annotations, 0, anns, 0,
+ annot.annotations.length);
+ System.arraycopy(els, 0, anns, annot.annotations.length, els.length);
+ annot.annotations = anns;
+ // System.out.println("else: ");
+ }
+ return annot;
+ }
+
+ public String print(SequenceI[] s)
+ {
+ // find max length of id
+ int max = 0;
+ int maxid = 0;
+ int in = 0;
+ Hashtable dataRef = null;
+ while ((in < s.length) && (s[in] != null))
+ {
+ String tmp = printId(s[in]);
+ if (s[in].getSequence().length > max)
+ {
+ max = s[in].getSequence().length;
+ }
+
+ if (tmp.length() > maxid)
+ {
+ maxid = tmp.length();
+ }
+ if (s[in].getDBRef() != null)
+ {
+ for (int idb = 0; idb < s[in].getDBRef().length; idb++)
+ {
+ if (dataRef == null)
+ {
+ dataRef = new Hashtable();
+ }
+
+ String datAs1 = s[in].getDBRef()[idb].getSource().toString()
+ + " ; "
+ + s[in].getDBRef()[idb].getAccessionId().toString();
+ dataRef.put(tmp, datAs1);
+ }
+ }
+ in++;
+ }
+ maxid += 9;
+ int i = 0;
+
+ // output database type
+ if (al.getProperties() != null)
+ {
+ if (!al.getProperties().isEmpty())
+ {
+ Enumeration key = al.getProperties().keys();
+ Enumeration val = al.getProperties().elements();
+ while (key.hasMoreElements())
+ {
+ out.append("#=GF " + key.nextElement() + " " + val.nextElement());
+ out.append(newline);
+ }
+ }
+ }
+
+ // output database accessions
+ if (dataRef != null)
+ {
+ Enumeration en = dataRef.keys();
+ while (en.hasMoreElements())
+ {
+ Object idd = en.nextElement();
+ String type = (String) dataRef.remove(idd);
+ out.append(new Format("%-" + (maxid - 2) + "s").form("#=GS "
+ + idd.toString() + " "));
+ if (type.contains("PFAM") || type.contains("RFAM"))
+ {
+
+ out.append(" AC " + type.substring(type.indexOf(";") + 1));
+ }
+ else
+ {
+ out.append(" DR " + type + " ");
+ }
+ out.append(newline);
+ }
+ }
+
+ // output annotations
+ while (i < s.length && s[i] != null)
+ {
+ if (s[i].getDatasetSequence() != null)
+ {
+ SequenceI ds = s[i].getDatasetSequence();
+ AlignmentAnnotation[] alAnot;
+ Annotation[] ann;
+ Annotation annot;
+ alAnot = s[i].getAnnotation();
+ String feature = "";
+ if (alAnot != null)
+ {
+ for (int j = 0; j < alAnot.length; j++)
+ {
+ if (ds.getSequenceFeatures() != null)
+ {
+ feature = ds.getSequenceFeatures()[0].type;
+ }
+ // ?bug - feature may still have previous loop value
+ String key = type2id(feature);
+
+ if (key == null)
+ {
+ continue;
+ }
+
+ // out.append("#=GR ");
+ out.append(new Format("%-" + maxid + "s").form("#=GR "
+ + printId(s[i]) + " " + key + " "));
+ ann = alAnot[j].annotations;
+ boolean isrna = alAnot[j].isValidStruc();
+ String seq = "";
+ for (int k = 0; k < ann.length; k++)
+ {
+ seq += outputCharacter(key, k, isrna, ann, s[i]);
+ }
+ out.append(seq);
+ out.append(newline);
+ }
+ }
+ }
+
+ out.append(new Format("%-" + maxid + "s").form(printId(s[i]) + " "));
+ out.append(s[i].getSequenceAsString());
+ out.append(newline);
+ i++;
+ }
+
+ // alignment annotation
+ AlignmentAnnotation aa;
+ if (al.getAlignmentAnnotation() != null)
+ {
+ for (int ia = 0; ia < al.getAlignmentAnnotation().length; ia++)
+ {
+ aa = al.getAlignmentAnnotation()[ia];
+ if (aa.autoCalculated || !aa.visible || aa.sequenceRef != null)
+ {
+ continue;
+ }
+ String seq = "";
+ String label;
+ String key = "";
+ if (aa.label.equals("seq"))
+ {
+ label = "seq_cons";
+ }
+ else
+ {
+ key = type2id(aa.label.toLowerCase());
+ if (key == null)
+ {
+ label = aa.label;
+ }
+ else
+ {
+ label = key + "_cons";
+ }
+ }
+ if (label == null)
+ {
+ label = aa.label;
+ }
+ label = label.replace(" ", "_");
+
+ out.append(new Format("%-" + maxid + "s").form("#=GC " + label
+ + " "));
+ boolean isrna = aa.isValidStruc();
+ for (int j = 0; j < aa.annotations.length; j++)
+ {
+ seq += outputCharacter(key, j, isrna, aa.annotations, null);
+ }
+ out.append(seq);
+ out.append(newline);
+ }
+ }
+ return out.toString();
+ }
+
+ /**
+ * add an annotation character to the output row
+ *
+ * @param seq
+ * @param key
+ * @param k
+ * @param isrna
+ * @param ann
+ * @param sequenceI
+ */
+ private char outputCharacter(String key, int k, boolean isrna,
+ Annotation[] ann, SequenceI sequenceI)
+ {
+ char seq = ' ';
+ Annotation annot = ann[k];
+ String ch = (annot == null) ? ((sequenceI == null) ? "-" : Character
+ .toString(sequenceI.getCharAt(k))) : annot.displayCharacter;
+ if (key != null && key.equals("SS"))
+ {
+ if (annot == null)
+ {
+ // sensible gap character if one is available or make one up
+ return sequenceI == null ? '-' : sequenceI.getCharAt(k);
+ }
+ else
+ {
+ // valid secondary structure AND no alternative label (e.g. ' B')
+ if (annot.secondaryStructure > ' ' && ch.length() < 2)
+ {
+ return annot.secondaryStructure;
+ }
+ }
+ }
+
+ if (ch.length() == 0)
+ {
+ seq = '.';
+ }
+ else if (ch.length() == 1)
+ {
+ seq = ch.charAt(0);
+ }
+ else if (ch.length() > 1)
+ {
+ seq = ch.charAt(1);
+ }
+ return seq;
+ }
+
+ public String print()
+ {
+ out = new StringBuffer();
+ out.append("# STOCKHOLM 1.0");
+ out.append(newline);
+ print(getSeqsAsArray());
+
+ out.append("//");
+ out.append(newline);
+ return out.toString();
+ }
+
+ private static Hashtable typeIds = null;
+ static
+ {
+ if (typeIds == null)
+ {
+ typeIds = new Hashtable();
+ typeIds.put("SS", "secondary structure");
+ typeIds.put("SA", "surface accessibility");
+ typeIds.put("TM", "transmembrane");
+ typeIds.put("PP", "posterior probability");
+ typeIds.put("LI", "ligand binding");
+ typeIds.put("AS", "active site");
+ typeIds.put("IN", "intron");
+ typeIds.put("IR", "interacting residue");
+ typeIds.put("AC", "accession");
+ typeIds.put("OS", "organism");
+ typeIds.put("CL", "class");
+ typeIds.put("DE", "description");
+ typeIds.put("DR", "reference");
+ typeIds.put("LO", "look");
+ typeIds.put("RF", "reference positions");
+
+ }
+ }
+
+ protected static String id2type(String id)
+ {
+ if (typeIds.containsKey(id))
+ {
+ return (String) typeIds.get(id);
+ }
+ System.err.println("Warning : Unknown Stockholm annotation type code "
+ + id);
+ return id;
+ }
+
+ protected static String type2id(String type)
+ {
+ String key = null;
+ Enumeration e = typeIds.keys();
+ while (e.hasMoreElements())
+ {
+ Object ll = e.nextElement();
+ if (typeIds.get(ll).toString().equals(type))
+ {
+ key = (String) ll;
+ break;
+ }
+ }
+ if (key != null)
+ {
+ return key;
+ }
+ System.err.println("Warning : Unknown Stockholm annotation type: "
+ + type);
+ return key;
+ }
+
+ /**
+ * make a friendly ID string.
+ *
+ * @param dataName
+ * @return truncated dataName to after last '/'
+ */
+ private String safeName(String dataName)
+ {
+ int b = 0;
+ while ((b = dataName.indexOf("/")) > -1 && b < dataName.length())
+ {
+ dataName = dataName.substring(b + 1).trim();
+
+ }
+ int e = (dataName.length() - dataName.indexOf(".")) + 1;
+ dataName = dataName.substring(1, e).trim();
+ return dataName;
+ }
+}
diff --git a/src/jalview/io/TCoffeeScoreFile.java b/src/jalview/io/TCoffeeScoreFile.java
new file mode 100644
index 0000000..72aa99b
--- /dev/null
+++ b/src/jalview/io/TCoffeeScoreFile.java
@@ -0,0 +1,651 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io;
+
+import jalview.analysis.SequenceIdMatcher;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * A file parse for T-Coffee score ascii format. This file contains the
+ * alignment consensus for each resude in any sequence.
+ * <p>
+ * This file is procuded by <code>t_coffee</code> providing the option
+ * <code>-output=score_ascii </code> to the program command line
+ *
+ * An example file is the following
+ *
+ * <pre>
+ * T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)
+ * Cedric Notredame
+ * CPU TIME:0 sec.
+ * SCORE=90
+ * *
+ * BAD AVG GOOD
+ * *
+ * 1PHT : 89
+ * 1BB9 : 90
+ * 1UHC : 94
+ * 1YCS : 94
+ * 1OOT : 93
+ * 1ABO : 94
+ * 1FYN : 94
+ * 1QCF : 94
+ * cons : 90
+ *
+ * 1PHT 999999999999999999999999998762112222543211112134
+ * 1BB9 99999999999999999999999999987-------4322----2234
+ * 1UHC 99999999999999999999999999987-------5321----2246
+ * 1YCS 99999999999999999999999999986-------4321----1-35
+ * 1OOT 999999999999999999999999999861-------3------1135
+ * 1ABO 99999999999999999999999999986-------422-------34
+ * 1FYN 99999999999999999999999999985-------32--------35
+ * 1QCF 99999999999999999999999999974-------2---------24
+ * cons 999999999999999999999999999851000110321100001134
+ *
+ *
+ * 1PHT ----------5666642367889999999999889
+ * 1BB9 1111111111676653-355679999999999889
+ * 1UHC ----------788774--66789999999999889
+ * 1YCS ----------78777--356789999999999889
+ * 1OOT ----------78877--356789999999997-67
+ * 1ABO ----------687774--56779999999999889
+ * 1FYN ----------6888842356789999999999889
+ * 1QCF ----------6878742356789999999999889
+ * cons 00100000006877641356789999999999889
+ * </pre>
+ *
+ *
+ * @author Paolo Di Tommaso
+ *
+ */
+public class TCoffeeScoreFile extends AlignFile
+{
+ public TCoffeeScoreFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+
+ }
+
+ public TCoffeeScoreFile(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ /** The {@link Header} structure holder */
+ Header header;
+
+ /**
+ * Holds the consensues values for each sequences. It uses a LinkedHashMap to
+ * maintaint the insertion order.
+ */
+ LinkedHashMap<String, StringBuilder> scores;
+
+ Integer fWidth;
+
+ /**
+ * Parse the provided reader for the T-Coffee scores file format
+ *
+ * @param reader
+ * public static TCoffeeScoreFile load(Reader reader) {
+ *
+ * try { BufferedReader in = (BufferedReader) (reader instanceof
+ * BufferedReader ? reader : new BufferedReader(reader));
+ * TCoffeeScoreFile result = new TCoffeeScoreFile();
+ * result.doParsing(in); return result.header != null &&
+ * result.scores != null ? result : null; } catch( Exception e) {
+ * throw new RuntimeException(e); } }
+ */
+
+ /**
+ * @return The 'height' of the score matrix i.e. the numbers of score rows
+ * that should matches the number of sequences in the alignment
+ */
+ public int getHeight()
+ {
+ // the last entry will always be the 'global' alingment consensus scores, so
+ // it is removed
+ // from the 'height' count to make this value compatible with the number of
+ // sequences in the MSA
+ return scores != null && scores.size() > 0 ? scores.size() - 1 : 0;
+ }
+
+ /**
+ * @return The 'width' of the score matrix i.e. the number of columns. Since
+ * the score value are supposed to be calculated for an 'aligned' MSA,
+ * all the entries have to have the same width.
+ */
+ public int getWidth()
+ {
+ return fWidth != null ? fWidth : 0;
+ }
+
+ /**
+ * Get the string of score values for the specified seqeunce ID.
+ *
+ * @param id
+ * The sequence ID
+ * @return The scores as a string of values e.g. {@code 99999987-------432}.
+ * It return an empty string when the specified ID is missing.
+ */
+ public String getScoresFor(String id)
+ {
+ return scores != null && scores.containsKey(id) ? scores.get(id)
+ .toString() : "";
+ }
+
+ /**
+ * @return The list of score string as a {@link List} object, in the same
+ * ordeer of the insertion i.e. in the MSA
+ */
+ public List<String> getScoresList()
+ {
+ if (scores == null)
+ {
+ return null;
+ }
+ List<String> result = new ArrayList<String>(scores.size());
+ for (Map.Entry<String, StringBuilder> it : scores.entrySet())
+ {
+ result.add(it.getValue().toString());
+ }
+
+ return result;
+ }
+
+ /**
+ * @return The parsed score values a matrix of bytes
+ */
+ public byte[][] getScoresArray()
+ {
+ if (scores == null)
+ {
+ return null;
+ }
+ byte[][] result = new byte[scores.size()][];
+
+ int rowCount = 0;
+ for (Map.Entry<String, StringBuilder> it : scores.entrySet())
+ {
+ String line = it.getValue().toString();
+ byte[] seqValues = new byte[line.length()];
+ for (int j = 0, c = line.length(); j < c; j++)
+ {
+
+ byte val = (byte) (line.charAt(j) - '0');
+
+ seqValues[j] = (val >= 0 && val <= 9) ? val : -1;
+ }
+
+ result[rowCount++] = seqValues;
+ }
+
+ return result;
+ }
+
+ public void parse() throws IOException
+ {
+ /*
+ * read the header
+ */
+ header = readHeader(this);
+
+ if (header == null)
+ {
+ error = true;
+ return;
+ }
+ scores = new LinkedHashMap<String, StringBuilder>();
+
+ /*
+ * initilize the structure
+ */
+ for (Map.Entry<String, Integer> entry : header.scores.entrySet())
+ {
+ scores.put(entry.getKey(), new StringBuilder());
+ }
+
+ /*
+ * go with the reading
+ */
+ Block block;
+ while ((block = readBlock(this, header.scores.size())) != null)
+ {
+
+ /*
+ * append sequences read in the block
+ */
+ for (Map.Entry<String, String> entry : block.items.entrySet())
+ {
+ StringBuilder scoreStringBuilder = scores.get(entry.getKey());
+ if (scoreStringBuilder == null)
+ {
+ error = true;
+ errormessage = String
+ .format("Invalid T-Coffee score file: Sequence ID '%s' is not declared in header section",
+ entry.getKey());
+ return;
+ }
+
+ scoreStringBuilder.append(entry.getValue());
+ }
+ }
+
+ /*
+ * verify that all rows have the same width
+ */
+ for (StringBuilder str : scores.values())
+ {
+ if (fWidth == null)
+ {
+ fWidth = str.length();
+ }
+ else if (fWidth != str.length())
+ {
+ error = true;
+ errormessage = "Invalid T-Coffee score file: All the score sequences must have the same length";
+ return;
+ }
+ }
+
+ return;
+ }
+
+ static int parseInt(String str)
+ {
+ try
+ {
+ return Integer.parseInt(str);
+ } catch (NumberFormatException e)
+ {
+ // TODO report a warning ?
+ return 0;
+ }
+ }
+
+ /**
+ * Reaad the header section in the T-Coffee score file format
+ *
+ * @param reader
+ * The scores reader
+ * @return The parser {@link Header} instance
+ * @throws RuntimeException
+ * when the header is not in the expected format
+ */
+ static Header readHeader(FileParse reader) throws IOException
+ {
+
+ Header result = null;
+ try
+ {
+ result = new Header();
+ result.head = reader.nextLine();
+
+ String line;
+
+ while ((line = reader.nextLine()) != null)
+ {
+ if (line.startsWith("SCORE="))
+ {
+ result.score = parseInt(line.substring(6).trim());
+ break;
+ }
+ }
+
+ if ((line = reader.nextLine()) == null || !"*".equals(line.trim()))
+ {
+ error(reader,
+ "Invalid T-COFFEE score format (NO BAD/AVG/GOOD header)");
+ return null;
+ }
+ if ((line = reader.nextLine()) == null
+ || !"BAD AVG GOOD".equals(line.trim()))
+ {
+ error(reader,
+ "Invalid T-COFFEE score format (NO BAD/AVG/GOOD header)");
+ return null;
+ }
+ if ((line = reader.nextLine()) == null || !"*".equals(line.trim()))
+ {
+ error(reader,
+ "Invalid T-COFFEE score format (NO BAD/AVG/GOOD header)");
+ return null;
+ }
+
+ /*
+ * now are expected a list if sequences ID up to the first blank line
+ */
+ while ((line = reader.nextLine()) != null)
+ {
+ if ("".equals(line))
+ {
+ break;
+ }
+
+ int p = line.indexOf(":");
+ if (p == -1)
+ {
+ // TODO report a warning
+ continue;
+ }
+
+ String id = line.substring(0, p).trim();
+ int val = parseInt(line.substring(p + 1).trim());
+ if ("".equals(id))
+ {
+ // TODO report warning
+ continue;
+ }
+
+ result.scores.put(id, val);
+ }
+
+ if (result == null)
+ {
+ error(reader, "T-COFFEE score file had no per-sequence scores");
+ }
+
+ } catch (IOException e)
+ {
+ error(reader, "Unexpected problem parsing T-Coffee score ascii file");
+ throw e;
+ }
+
+ return result;
+ }
+
+ private static void error(FileParse reader, String errm)
+ {
+ reader.error = true;
+ if (reader.errormessage == null)
+ {
+ reader.errormessage = errm;
+ }
+ else
+ {
+ reader.errormessage += "\n" + errm;
+ }
+ }
+
+ static Pattern SCORES_WITH_RESIDUE_NUMS = Pattern
+ .compile("^\\d+\\s([^\\s]+)\\s+\\d+$");
+
+ /**
+ * Read a scores block ihe provided stream.
+ *
+ * @param reader
+ * The stream to parse
+ * @param size
+ * The expected number of the sequence to be read
+ * @return The {@link Block} instance read or {link null} null if the end of
+ * file has reached.
+ * @throws IOException
+ * Something went wrong on the 'wire'
+ */
+ static Block readBlock(FileParse reader, int size) throws IOException
+ {
+ Block result = new Block(size);
+ String line;
+
+ /*
+ * read blank lines (eventually)
+ */
+ while ((line = reader.nextLine()) != null && "".equals(line.trim()))
+ {
+ // consume blank lines
+ }
+
+ if (line == null)
+ {
+ return null;
+ }
+
+ /*
+ * read the scores block
+ */
+ do
+ {
+ if ("".equals(line.trim()))
+ {
+ // terminated
+ break;
+ }
+
+ // split the line on the first blank
+ // the first part have to contain the sequence id
+ // the remaining part are the scores values
+ int p = line.indexOf(" ");
+ if (p == -1)
+ {
+ if (reader.warningMessage == null)
+ {
+ reader.warningMessage = "";
+ }
+ reader.warningMessage += "Possible parsing error - expected to find a space in line: '"
+ + line + "'\n";
+ continue;
+ }
+
+ String id = line.substring(0, p).trim();
+ String val = line.substring(p + 1).trim();
+
+ Matcher m = SCORES_WITH_RESIDUE_NUMS.matcher(val);
+ if (m.matches())
+ {
+ val = m.group(1);
+ }
+
+ result.items.put(id, val);
+
+ } while ((line = reader.nextLine()) != null);
+
+ return result;
+ }
+
+ /*
+ * The score file header
+ */
+ static class Header
+ {
+ String head;
+
+ int score;
+
+ LinkedHashMap<String, Integer> scores = new LinkedHashMap<String, Integer>();
+
+ public int getScoreAvg()
+ {
+ return score;
+ }
+
+ public int getScoreFor(String ID)
+ {
+
+ return scores.containsKey(ID) ? scores.get(ID) : -1;
+
+ }
+ }
+
+ /*
+ * Hold a single block values block in the score file
+ */
+ static class Block
+ {
+ int size;
+
+ Map<String, String> items;
+
+ public Block(int size)
+ {
+ this.size = size;
+ this.items = new HashMap<String, String>(size);
+ }
+
+ String getScoresFor(String id)
+ {
+ return items.get(id);
+ }
+
+ String getConsensus()
+ {
+ return items.get("cons");
+ }
+ }
+
+ /**
+ * TCOFFEE score colourscheme
+ */
+ static final Color[] colors = { new Color(102, 102, 255), // #6666FF
+ new Color(0, 255, 0), // #00FF00
+ new Color(102, 255, 0), // #66FF00
+ new Color(204, 255, 0), // #CCFF00
+ new Color(255, 255, 0), // #FFFF00
+ new Color(255, 204, 0), // #FFCC00
+ new Color(255, 153, 0), // #FF9900
+ new Color(255, 102, 0), // #FF6600
+ new Color(255, 51, 0), // #FF3300
+ new Color(255, 34, 0) // #FF2000
+ };
+
+ public final static String TCOFFEE_SCORE = "TCoffeeScore";
+
+ /**
+ * generate annotation for this TCoffee score set on the given alignment
+ *
+ * @param al
+ * alignment to annotate
+ * @param matchids
+ * if true, annotate sequences based on matching sequence names
+ * @return true if alignment annotation was modified, false otherwise.
+ */
+ public boolean annotateAlignment(AlignmentI al, boolean matchids)
+ {
+ if (al.getHeight() != getHeight() || al.getWidth() != getWidth())
+ {
+ String info = String.format(
+ "align w: %s, h: %s; score: w: %s; h: %s ", al.getWidth(),
+ al.getHeight(), getWidth(), getHeight());
+ warningMessage = "Alignment shape does not match T-Coffee score file shape -- "
+ + info;
+ return false;
+ }
+ boolean added = false;
+ int i = 0;
+ SequenceIdMatcher sidmatcher = new SequenceIdMatcher(
+ al.getSequencesArray());
+ byte[][] scoreMatrix = getScoresArray();
+ // for 2.8 - we locate any existing TCoffee annotation and remove it first
+ // before adding this.
+ for (Map.Entry<String, StringBuilder> id : scores.entrySet())
+ {
+ byte[] srow = scoreMatrix[i];
+ SequenceI s;
+ if (matchids)
+ {
+ s = sidmatcher.findIdMatch(id.getKey());
+ }
+ else
+ {
+ s = al.getSequenceAt(i);
+ }
+ i++;
+ if (s == null && i != scores.size() && !id.getKey().equals("cons"))
+ {
+ System.err.println("No "
+ + (matchids ? "match " : " sequences left ")
+ + " for TCoffee score set : " + id.getKey());
+ continue;
+ }
+ int jSize = al.getWidth() < srow.length ? al.getWidth() : srow.length;
+ Annotation[] annotations = new Annotation[al.getWidth()];
+ for (int j = 0; j < jSize; j++)
+ {
+ byte val = srow[j];
+ if (s != null && jalview.util.Comparison.isGap(s.getCharAt(j)))
+ {
+ annotations[j] = null;
+ if (val > 0)
+ {
+ System.err
+ .println("Warning: non-zero value for positional T-COFFEE score for gap at "
+ + j + " in sequence " + s.getName());
+ }
+ }
+ else
+ {
+ annotations[j] = new Annotation(s == null ? "" + val : null,
+ s == null ? "" + val : null, '\0', val * 1f, val >= 0
+ && val < colors.length ? colors[val]
+ : Color.white);
+ }
+ }
+ // this will overwrite any existing t-coffee scores for the alignment
+ AlignmentAnnotation aa = al.findOrCreateAnnotation(TCOFFEE_SCORE,
+ TCOFFEE_SCORE, false, s, null);
+ if (s != null)
+ {
+ aa.label = "T-COFFEE";
+ aa.description = "" + id.getKey();
+ aa.annotations = annotations;
+ aa.visible = false;
+ aa.belowAlignment = false;
+ aa.setScore(header.getScoreFor(id.getKey()));
+ aa.createSequenceMapping(s, s.getStart(), true);
+ s.addAlignmentAnnotation(aa);
+ aa.adjustForAlignment();
+ }
+ else
+ {
+ aa.graph = AlignmentAnnotation.NO_GRAPH;
+ aa.label = "T-COFFEE";
+ aa.description = "TCoffee column reliability score";
+ aa.annotations = annotations;
+ aa.belowAlignment = true;
+ aa.visible = true;
+ aa.setScore(header.getScoreAvg());
+ }
+ aa.showAllColLabels = true;
+ aa.validateRangeAndDisplay();
+ added = true;
+ }
+
+ return added;
+ }
+
+ @Override
+ public String print()
+ {
+ // TODO Auto-generated method stub
+ return "Not valid.";
+ }
+}
diff --git a/src/jalview/io/VamsasAppDatastore.java b/src/jalview/io/VamsasAppDatastore.java
index 8228239..d580129 100644
--- a/src/jalview/io/VamsasAppDatastore.java
+++ b/src/jalview/io/VamsasAppDatastore.java
@@ -1,30 +1,29 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
import jalview.bin.Cache;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.AlignmentView;
-import jalview.datamodel.DBRefEntry;
import jalview.datamodel.GraphLine;
-import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
@@ -34,7 +33,8 @@ import jalview.io.vamsas.Datasetsequence;
import jalview.io.vamsas.DatastoreItem;
import jalview.io.vamsas.DatastoreRegistry;
import jalview.io.vamsas.Rangetype;
-import jalview.util.UrlLink;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
import java.io.IOException;
import java.util.Enumeration;
@@ -42,23 +42,47 @@ import java.util.HashMap;
import java.util.Hashtable;
import java.util.IdentityHashMap;
import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
import java.util.Vector;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
-import uk.ac.vamsas.client.*;
-import uk.ac.vamsas.objects.core.*;
+import uk.ac.vamsas.client.IClientAppdata;
+import uk.ac.vamsas.client.IClientDocument;
+import uk.ac.vamsas.client.Vobject;
+import uk.ac.vamsas.client.VorbaId;
+import uk.ac.vamsas.objects.core.Alignment;
+import uk.ac.vamsas.objects.core.AlignmentSequence;
+import uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation;
+import uk.ac.vamsas.objects.core.AnnotationElement;
+import uk.ac.vamsas.objects.core.DataSet;
+import uk.ac.vamsas.objects.core.DataSetAnnotations;
+import uk.ac.vamsas.objects.core.DbRef;
+import uk.ac.vamsas.objects.core.Entry;
+import uk.ac.vamsas.objects.core.Glyph;
+import uk.ac.vamsas.objects.core.Local;
+import uk.ac.vamsas.objects.core.MapType;
+import uk.ac.vamsas.objects.core.Mapped;
+import uk.ac.vamsas.objects.core.Property;
+import uk.ac.vamsas.objects.core.Provenance;
+import uk.ac.vamsas.objects.core.RangeAnnotation;
+import uk.ac.vamsas.objects.core.RangeType;
+import uk.ac.vamsas.objects.core.Seg;
+import uk.ac.vamsas.objects.core.Sequence;
+import uk.ac.vamsas.objects.core.SequenceType;
+import uk.ac.vamsas.objects.core.VAMSAS;
import uk.ac.vamsas.objects.utils.Properties;
/*
- *
+ *
* static {
* org.exolab.castor.util.LocalConfiguration.getInstance().getProperties().setProperty(
* "org.exolab.castor.serializer", "org.apache.xml.serialize.XMLSerilazizer"); }
- *
+ *
*/
/*
- * TODO: check/verify consistency for vamsas sync with group associated alignment annotation
+ * TODO: check/verify consistency for vamsas sync with group associated alignment annotation
*/
public class VamsasAppDatastore
{
@@ -127,7 +151,7 @@ public class VamsasAppDatastore
private void buildSkipList()
{
skipList = new Hashtable();
- AlignFrame[] al = Desktop.getAlignframes();
+ AlignFrame[] al = Desktop.getAlignFrames();
for (int f = 0; al != null && f < al.length; f++)
{
skipList.put(al[f].getViewport().getSequenceSetId(), al[f]);
@@ -222,10 +246,12 @@ public class VamsasAppDatastore
if (vobj2jv.containsKey(vobj.getVorbaId())
&& !((VorbaId) vobj2jv.get(vobj.getVorbaId())).equals(jvobj))
{
- Cache.log.debug(
- "Warning? Overwriting existing vamsas id binding for "
- + vobj.getVorbaId(), new Exception(
- "Overwriting vamsas id binding."));
+ Cache.log
+ .debug("Warning? Overwriting existing vamsas id binding for "
+ + vobj.getVorbaId(),
+ new Exception(
+ MessageManager
+ .getString("exception.overwriting_vamsas_id_binding")));
}
else if (jv2vobj.containsKey(jvobj)
&& !((VorbaId) jv2vobj.get(jvobj)).equals(vobj.getVorbaId()))
@@ -313,7 +339,8 @@ public class VamsasAppDatastore
&& dataset != vbound.getV_parent())
{
throw new Error(
- "IMPLEMENTATION ERROR: Cannot map an alignment of sequences from different datasets into a single alignment in the vamsas document.");
+ MessageManager
+ .getString("error.implementation_error_cannot_map_alignment_sequences"));
// This occurs because the dataset for the alignment we are
// trying to
}
@@ -546,12 +573,8 @@ public class VamsasAppDatastore
else
{
// first find the alignment sequence to associate this with.
- SequenceI jvalsq = null;
- Enumeration jval = av.getAlignment().getSequences()
- .elements();
- while (jval.hasMoreElements())
+ for (SequenceI jvalsq : av.getAlignment().getSequences())
{
- jvalsq = (SequenceI) jval.nextElement();
// saveDatasetSequenceAnnotation(AlSeqMaps,(uk.ac.vamsas.objects.core.Sequence)
// sref, aa[i]);
if (jvalsq.getDatasetSequence() == aa[i].sequenceRef)
@@ -734,12 +757,12 @@ public class VamsasAppDatastore
* @return true if alignment associated with this view will be stored in
* document.
*/
- public boolean alignmentWillBeSkipped(AlignViewport av)
+ public boolean alignmentWillBeSkipped(AlignmentViewport av)
{
return (!av.getAlignment().isAligned());
}
- private void addToSkipList(AlignViewport av)
+ private void addToSkipList(AlignmentViewport av)
{
if (skipList == null)
{
@@ -884,7 +907,7 @@ public class VamsasAppDatastore
* creates/syncs the jvalsq from the alignment sequence
*/
private boolean syncFromAlignmentSequence(AlignmentSequence valseq,
- char valGapchar, char gapChar, Vector dsseqs)
+ char valGapchar, char gapChar, List<SequenceI> dsseqs)
{
boolean modal = false;
@@ -1074,8 +1097,10 @@ public class VamsasAppDatastore
an.addProperty(Properties.newProperty(THRESHOLD,
Properties.FLOATTYPE, "" + alan.getThreshold().value));
if (alan.getThreshold().label != null)
+ {
an.addProperty(Properties.newProperty(THRESHOLD + "Name",
Properties.STRINGTYPE, "" + alan.getThreshold().label));
+ }
}
((DataSet) sref.getV_parent()).addDataSetAnnotations(an);
bindjvvobj(alan, an);
@@ -1238,8 +1263,7 @@ public class VamsasAppDatastore
end = start;
start = t;
}
- return new int[]
- { start, end, pol < 0 ? 1 : 0 };
+ return new int[] { start, end, pol < 0 ? 1 : 0 };
}
/**
@@ -1260,7 +1284,7 @@ public class VamsasAppDatastore
/**
* list of alignment views created when updating Jalview from document.
*/
- private Vector newAlignmentViews = new Vector();
+ private final Vector newAlignmentViews = new Vector();
/**
* update local jalview view settings from the stored appdata (if any)
@@ -1292,6 +1316,7 @@ public class VamsasAppDatastore
jalview.util.jarInputStreamProvider jprovider = new jalview.util.jarInputStreamProvider()
{
+ @Override
public String getFilename()
{
@@ -1299,6 +1324,7 @@ public class VamsasAppDatastore
return "Jalview Vamsas Document Client Data";
}
+ @Override
public JarInputStream getJarInputStream() throws IOException
{
jalview.bin.Cache.log
@@ -1308,7 +1334,7 @@ public class VamsasAppDatastore
};
if (dojvsync)
{
- fromxml.LoadJalviewAlign(jprovider);
+ fromxml.loadJalviewAlign(jprovider);
}
} catch (Exception e)
{
@@ -1338,6 +1364,7 @@ public class VamsasAppDatastore
jalview.util.jarInputStreamProvider jarstream = new jalview.util.jarInputStreamProvider()
{
+ @Override
public String getFilename()
{
@@ -1345,6 +1372,7 @@ public class VamsasAppDatastore
return "Jalview Vamsas Document User Data";
}
+ @Override
public JarInputStream getJarInputStream() throws IOException
{
jalview.bin.Cache.log
@@ -1354,7 +1382,7 @@ public class VamsasAppDatastore
};
if (dojvsync)
{
- fromxml.LoadJalviewAlign(jarstream);
+ fromxml.loadJalviewAlign(jarstream);
}
} catch (Exception e)
{
@@ -1383,12 +1411,12 @@ public class VamsasAppDatastore
// sync,
// and if any contain more than one view, then remove the one generated by
// document update.
- AlignViewport views[], av = null;
+ AlignmentViewport views[], av = null;
AlignFrame af = null;
Iterator newviews = newAlignmentViews.iterator();
while (newviews.hasNext())
{
- av = (AlignViewport) newviews.next();
+ av = (AlignmentViewport) newviews.next();
af = Desktop.getAlignFrameFor(av);
// TODO implement this : af.getNumberOfViews
String seqsetidobj = av.getSequenceSetId();
@@ -1405,7 +1433,8 @@ public class VamsasAppDatastore
// to the align frames.
boolean gathered = false;
String newviewid = null;
- AlignedCodonFrame[] mappings = av.getAlignment().getCodonFrames();
+ Set<AlignedCodonFrame> mappings = av.getAlignment()
+ .getCodonFrames();
for (int i = 0; i < views.length; i++)
{
if (views[i] != av)
@@ -1440,10 +1469,11 @@ public class VamsasAppDatastore
{
// ensure sequence mappings from vamsas document view still
// active
- if (mappings != null && mappings.length > 0)
+ if (mappings != null)
{
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance).addMappings(mappings);
+ .getStructureSelectionManager(Desktop.instance)
+ .registerMappings(mappings);
}
}
}
@@ -1472,9 +1502,11 @@ public class VamsasAppDatastore
Object vobject = jv2vobj.remove(oldjvobject);
if (vobject == null)
{
- throw new Error(
- "IMPLEMENTATION ERROR: old jalview object is not bound ! ("
- + oldjvobject + ")");
+ // NOTE: this happens if user deletes object in one session then updates
+ // from another client
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_old_jalview_object_not_bound",
+ new String[] { oldjvobject.toString() }));
}
if (newjvobject != null)
{
@@ -1499,7 +1531,7 @@ public class VamsasAppDatastore
jxml.setSkipList(skipList);
if (dojvsync)
{
- jxml.SaveState(new JarOutputStream(cappdata
+ jxml.saveState(new JarOutputStream(cappdata
.getClientOutputStream()));
}
@@ -1573,7 +1605,7 @@ public class VamsasAppDatastore
// ///LOAD DATASET
DataSet dataset = root.getDataSet(_ds);
int i, iSize = dataset.getSequenceCount();
- Vector dsseqs;
+ List<SequenceI> dsseqs;
jalview.datamodel.Alignment jdataset = (jalview.datamodel.Alignment) getvObj2jv(dataset);
int jremain = 0;
if (jdataset == null)
@@ -1620,8 +1652,8 @@ public class VamsasAppDatastore
SequenceI[] seqs = new SequenceI[dsseqs.size()];
for (i = 0, iSize = dsseqs.size(); i < iSize; i++)
{
- seqs[i] = (SequenceI) dsseqs.elementAt(i);
- dsseqs.setElementAt(null, i);
+ seqs[i] = dsseqs.get(i);
+ dsseqs.set(i, null);
}
jdataset = new jalview.datamodel.Alignment(seqs);
Cache.log.debug("New vamsas dataset imported into jalview.");
@@ -1683,7 +1715,7 @@ public class VamsasAppDatastore
uk.ac.vamsas.objects.core.Alignment alignment = dataset
.getAlignment(al);
// TODO check this handles multiple views properly
- AlignViewport av = findViewport(alignment);
+ AlignmentViewport av = findViewport(alignment);
jalview.datamodel.AlignmentI jal = null;
if (av != null)
@@ -1782,8 +1814,8 @@ public class VamsasAppDatastore
SequenceI[] seqs = new SequenceI[dsseqs.size()];
for (i = 0, iSize = dsseqs.size(); i < iSize; i++)
{
- seqs[i] = (SequenceI) dsseqs.elementAt(i);
- dsseqs.setElementAt(null, i);
+ seqs[i] = dsseqs.get(i);
+ dsseqs.set(i, null);
}
jal = new jalview.datamodel.Alignment(seqs);
Cache.log.debug("New vamsas alignment imported into jalview "
@@ -1957,10 +1989,10 @@ public class VamsasAppDatastore
return newAlignmentViews.size();
}
- public AlignViewport findViewport(Alignment alignment)
+ public AlignmentViewport findViewport(Alignment alignment)
{
- AlignViewport av = null;
- AlignViewport[] avs = Desktop
+ AlignmentViewport av = null;
+ AlignmentViewport[] avs = Desktop
.getViewports((String) getvObj2jv(alignment));
if (avs != null)
{
@@ -2003,8 +2035,7 @@ public class VamsasAppDatastore
// may not quite cope with this (without binding an array of annotations to
// a vamsas alignment annotation)
// summary flags saying what we found over the set of annotation rows.
- boolean[] AeContent = new boolean[]
- { false, false, false, false, false };
+ boolean[] AeContent = new boolean[] { false, false, false, false, false };
int[] rangeMap = getMapping(annotation);
jalview.datamodel.Annotation[][] anot = new jalview.datamodel.Annotation[][]
{ new jalview.datamodel.Annotation[rangeMap.length],
@@ -2139,15 +2170,13 @@ public class VamsasAppDatastore
anot[1][i].description = anot[1][i].description + " (after)";
}
}
- return new Object[]
- { AeContent, rangeMap, anot[0], anot[1] };
+ return new Object[] { AeContent, rangeMap, anot[0], anot[1] };
}
else
{
// no annotations to parse. Just return an empty annotationElement[]
// array.
- return new Object[]
- { AeContent, rangeMap, anot[0], anot[1] };
+ return new Object[] { AeContent, rangeMap, anot[0], anot[1] };
}
// return null;
}
@@ -2208,6 +2237,7 @@ public class VamsasAppDatastore
Cache.log.warn("Failed to parse threshold property");
}
if (val != null)
+ {
if (gl == null)
{
gl = new GraphLine(val.floatValue(), "", java.awt.Color.black);
@@ -2216,11 +2246,14 @@ public class VamsasAppDatastore
{
gl.value = val.floatValue();
}
+ }
}
else if (props[p].getName().equalsIgnoreCase(THRESHOLD + "Name"))
{
if (gl == null)
+ {
gl = new GraphLine(0, "", java.awt.Color.black);
+ }
gl.label = props[p].getContent();
}
}
@@ -2417,7 +2450,8 @@ public class VamsasAppDatastore
if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)
{
throw new Error(
- "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");
+ MessageManager
+ .getString("error.invalid_vamsas_rangetype_cannot_resolve_lists"));
}
if (dseta.getSegCount() > 0)
{
@@ -2440,8 +2474,7 @@ public class VamsasAppDatastore
// could do a polarity for pos range too. and pass back indication of
// discontinuities.
int pos = dseta.getPos(0).getI();
- se = new int[]
- { pos, pos };
+ se = new int[] { pos, pos };
for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)
{
pos = dseta.getPos(p).getI();
@@ -2476,7 +2509,8 @@ public class VamsasAppDatastore
if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)
{
throw new Error(
- "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");
+ MessageManager
+ .getString("error.invalid_vamsas_rangetype_cannot_resolve_lists"));
}
if (dseta.getSegCount() > 0)
{
@@ -2542,15 +2576,15 @@ public class VamsasAppDatastore
* initialise a range type object from a set of start/end inclusive intervals
*
* @param mrt
- * @param range
+ * @param ranges
*/
- private void initRangeType(RangeType mrt, int[] range)
+ private void initRangeType(RangeType mrt, List<int[]> ranges)
{
- for (int i = 0; i < range.length; i += 2)
+ for (int[] range : ranges)
{
Seg vSeg = new Seg();
- vSeg.setStart(range[i]);
- vSeg.setEnd(range[i + 1]);
+ vSeg.setStart(range[0]);
+ vSeg.setEnd(range[1]);
mrt.addSeg(vSeg);
}
}
@@ -2673,10 +2707,10 @@ public class VamsasAppDatastore
return vobj2jv;
}
- public void storeSequenceMappings(AlignViewport viewport, String title)
+ public void storeSequenceMappings(AlignmentViewport viewport, String title)
throws Exception
{
- AlignViewport av = viewport;
+ AlignmentViewport av = viewport;
try
{
jalview.datamodel.AlignmentI jal = av.getAlignment();
@@ -2698,18 +2732,15 @@ public class VamsasAppDatastore
}
// Store any sequence mappings.
- if (av.getAlignment().getCodonFrames() != null
- && av.getAlignment().getCodonFrames().length > 0)
+ Set<AlignedCodonFrame> cframes = av.getAlignment().getCodonFrames();
+ if (cframes != null)
{
- jalview.datamodel.AlignedCodonFrame[] cframes = av.getAlignment()
- .getCodonFrames();
- for (int cf = 0; cf < cframes.length; cf++)
+ for (AlignedCodonFrame acf : cframes)
{
- if (cframes[cf].getdnaSeqs() != null
- && cframes[cf].getdnaSeqs().length > 0)
+ if (acf.getdnaSeqs() != null && acf.getdnaSeqs().length > 0)
{
- jalview.datamodel.SequenceI[] dmps = cframes[cf].getdnaSeqs();
- jalview.datamodel.Mapping[] mps = cframes[cf].getProtMappings();
+ jalview.datamodel.SequenceI[] dmps = acf.getdnaSeqs();
+ jalview.datamodel.Mapping[] mps = acf.getProtMappings();
for (int smp = 0; smp < mps.length; smp++)
{
uk.ac.vamsas.objects.core.SequenceType mfrom = (SequenceType) getjv2vObj(dmps[smp]);
@@ -2732,8 +2763,9 @@ public class VamsasAppDatastore
}
} catch (Exception e)
{
- throw new Exception("Couldn't store sequence mappings for " + title,
- e);
+ throw new Exception(MessageManager.formatMessage(
+ "exception.couldnt_store_sequence_mappings",
+ new String[] { title }), e);
}
}
diff --git a/src/jalview/io/WSWUBlastClient.java b/src/jalview/io/WSWUBlastClient.java
index f4569dc..1e7cc40 100644
--- a/src/jalview/io/WSWUBlastClient.java
+++ b/src/jalview/io/WSWUBlastClient.java
@@ -1,30 +1,48 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
-import java.util.*;
-
-import javax.swing.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
-import uk.ac.ebi.www.*;
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.Sequence;
+import jalview.gui.AlignmentPanel;
+import jalview.gui.CutAndPasteTransfer;
+import jalview.gui.Desktop;
+import jalview.util.MessageManager;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.ImageIcon;
+import javax.swing.JOptionPane;
+
+import uk.ac.ebi.www.Data;
+import uk.ac.ebi.www.InputParams;
+import uk.ac.ebi.www.WSFile;
+import uk.ac.ebi.www.WSWUBlast;
+import uk.ac.ebi.www.WSWUBlastService;
+import uk.ac.ebi.www.WSWUBlastServiceLocator;
/**
* DOCUMENT ME!
@@ -56,15 +74,12 @@ public class WSWUBlastClient
{
this.ap = ap;
this.al = al;
- output.setText("To display sequence features an exact Uniprot id with 100% sequence identity match must be entered."
- + "\nIn order to display these features, try changing the names of your sequences to the ids suggested below."
- + "\n\nRunning WSWUBlast at EBI."
- + "\nPlease quote Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R."
- + "\nSOAP-based services provided by the European Bioinformatics Institute."
- + "\nNucleic Acids Res. 33(1):W25-W28 (2005));");
+ output.setText(MessageManager
+ .getString("label.wswublast_client_credits"));
- Desktop.addInternalFrame(output,
- "BLASTing for unidentified sequences ", 800, 300);
+ Desktop.addInternalFrame(output, MessageManager
+ .getString("label.blasting_for_unidentified_sequence"), 800,
+ 300);
for (int i = 0; i < ids.size(); i++)
{
@@ -121,8 +136,7 @@ public class WSWUBlastClient
{
maxFound = value;
buffer.append(" " + id2 + " " + value + "%; ");
- suggestedIds.addElement(new Object[]
- { seq, id2 });
+ suggestedIds.addElement(new Object[] { seq, id2 });
}
}
}
@@ -207,8 +221,9 @@ public class WSWUBlastClient
imageIndex++;
imageIndex %= 9;
output.setFrameIcon(imageIcon[imageIndex]);
- output.setTitle("BLASTing for unidentified sequences - "
- + jobsRunning + " jobs running.");
+ output.setTitle(MessageManager.formatMessage(
+ "label.blasting_for_unidentified_sequence_jobs_running",
+ new String[] { Integer.valueOf(jobsRunning).toString() }));
} catch (Exception ex)
{
}
diff --git a/src/jalview/io/packed/DataProvider.java b/src/jalview/io/packed/DataProvider.java
index b3e8b3d..65a796b 100644
--- a/src/jalview/io/packed/DataProvider.java
+++ b/src/jalview/io/packed/DataProvider.java
@@ -1,33 +1,39 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.io.packed;
/**
- * API for a data provider that can be used with jalview.io.packed.ParsePackedSet
+ * API for a data provider that can be used with
+ * jalview.io.packed.ParsePackedSet
+ *
* @author JimP
- *
+ *
*/
public interface DataProvider
{
/**
* class of data expected to be provided by datasource
+ *
* @author JimP
- *
+ *
*/
public enum JvDataType
{
@@ -38,9 +44,9 @@ public interface DataProvider
/**
* a jalview annotation file
*/
- ANNOTATION,
+ ANNOTATION,
/**
- * a GFF or Jalview features file
+ * a GFF or Jalview features file
*/
FEATURES,
/**
@@ -48,15 +54,16 @@ public interface DataProvider
*/
TREE,
/**
- * any file that provides data that should be associated with a specified sequence.
+ * any file that provides data that should be associated with a specified
+ * sequence.
*/
SEQASSOCATED;
}
/**
- * data to be parsed according to its type. Each call to getDataSource
- * should return a new instance of the same data stream initialised to the
- * beginning of the chunk of data that is to be parsed.
+ * data to be parsed according to its type. Each call to getDataSource should
+ * return a new instance of the same data stream initialised to the beginning
+ * of the chunk of data that is to be parsed.
*
* @return
*/
@@ -75,4 +82,4 @@ public interface DataProvider
* @return
*/
DataProvider.JvDataType getType();
-}
\ No newline at end of file
+}
diff --git a/src/jalview/io/packed/JalviewDataset.java b/src/jalview/io/packed/JalviewDataset.java
index bb70274..1906fff 100644
--- a/src/jalview/io/packed/JalviewDataset.java
+++ b/src/jalview/io/packed/JalviewDataset.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.io.packed;
import jalview.datamodel.AlignmentI;
@@ -39,13 +42,16 @@ public class JalviewDataset
{
return parentDataset;
}
+
/**
- * @param parentDataset the parentDataset to set
+ * @param parentDataset
+ * the parentDataset to set
*/
public void setParentDataset(AlignmentI parentDataset)
{
this.parentDataset = parentDataset;
}
+
/**
* @return the featureColours
*/
@@ -53,13 +59,16 @@ public class JalviewDataset
{
return featureColours;
}
+
/**
- * @param featureColours the featureColours to set
+ * @param featureColours
+ * the featureColours to set
*/
public void setFeatureColours(Hashtable featureColours)
{
this.featureColours = featureColours;
}
+
/**
* @return the seqDetails
*/
@@ -67,88 +76,106 @@ public class JalviewDataset
{
return seqDetails;
}
+
/**
- * @param seqDetails the seqDetails to set
+ * @param seqDetails
+ * the seqDetails to set
*/
public void setSeqDetails(Hashtable seqDetails)
{
this.seqDetails = seqDetails;
}
+
/**
* @return the al
*/
public List<AlignmentSet> getAl()
{
- return (al==null) ? new ArrayList<AlignmentSet>() : al;
+ return (al == null) ? new ArrayList<AlignmentSet>() : al;
}
+
/**
* current alignment being worked on.
*/
List<AlignmentSet> al;
- public class AlignmentSet {
+
+ public class AlignmentSet
+ {
public AlignmentI al;
+
public List<jalview.io.NewickFile> trees;
- AlignmentSet(AlignmentI a) {
+
+ AlignmentSet(AlignmentI a)
+ {
al = a;
trees = new ArrayList<jalview.io.NewickFile>();
}
+
/**
* deuniquify the current alignment in the context, merging any new
* annotation/features with the existing set
*
* @param context
*/
- void deuniquifyAlignment()
+ void deuniquifyAlignment()
+ {
+ if (seqDetails == null || seqDetails.size() == 0)
{
- if (seqDetails==null || seqDetails.size()==0)
- {
- // nothing to do
- return;
- }
- // 1. recover correct names and attributes for each sequence in alignment.
- /*
- * TODO: housekeeping w.r.t. recovery of dataset and annotation
- * references for input sequences, and then dataset sequence creation
- * for new sequences retrieved from service // finally, attempt to
- * de-uniquify to recover input sequence identity, and try to map back
- * onto dataset Note: this
- * jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs, true); will
- * NOT WORK - the returned alignment may contain multiple versions of
- * the input sequence, each being a subsequence of the original.
- * deuniquify also removes existing annotation and features added in the
- * previous step... al.setDataset(dataset); // add in new sequences
- * retrieved from sequence search which are not already in dataset. //
- * trigger a 'fetchDBids' to annotate sequences with database ids...
- */
- //jalview.analysis.SeqsetUtils.deuniquifyAndMerge(parentDataset, seqDetails, al,true);
-
- jalview.analysis.SeqsetUtils.deuniquify(seqDetails, al.getSequencesArray(),true);
- // 2. Update names of associated nodes in any trees
- for (NewickFile nf:trees)
- {
- // the following works because all trees are already had node/SequenceI associations created.
- jalview.analysis.NJTree njt = new jalview.analysis.NJTree(al.getSequencesArray(), nf);
- // this just updates the displayed leaf name on the tree according to the SequenceIs.
- njt.renameAssociatedNodes();
- }
-
+ // nothing to do
+ return;
}
- /**
- * set modification flag. If anything modifies the alignment in the current set, this flag should be true
+ // 1. recover correct names and attributes for each sequence in alignment.
+ /*
+ * TODO: housekeeping w.r.t. recovery of dataset and annotation references
+ * for input sequences, and then dataset sequence creation for new
+ * sequences retrieved from service // finally, attempt to de-uniquify to
+ * recover input sequence identity, and try to map back onto dataset Note:
+ * this jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs, true);
+ * will NOT WORK - the returned alignment may contain multiple versions of
+ * the input sequence, each being a subsequence of the original.
+ * deuniquify also removes existing annotation and features added in the
+ * previous step... al.setDataset(dataset); // add in new sequences
+ * retrieved from sequence search which are not already in dataset. //
+ * trigger a 'fetchDBids' to annotate sequences with database ids...
*/
- private boolean modified=false;
-
- /**
- * @return the modified
- */
- public boolean isModified()
+ // jalview.analysis.SeqsetUtils.deuniquifyAndMerge(parentDataset,
+ // seqDetails, al,true);
+
+ jalview.analysis.SeqsetUtils.deuniquify(seqDetails,
+ al.getSequencesArray(), true);
+ // 2. Update names of associated nodes in any trees
+ for (NewickFile nf : trees)
{
- return modified;
+ // the following works because all trees are already had node/SequenceI
+ // associations created.
+ jalview.analysis.NJTree njt = new jalview.analysis.NJTree(
+ al.getSequencesArray(), nf);
+ // this just updates the displayed leaf name on the tree according to
+ // the SequenceIs.
+ njt.renameAssociatedNodes();
}
- /**
- * or the modification state with the given state
- * @param modifiedFromAction
- */
+
+ }
+
+ /**
+ * set modification flag. If anything modifies the alignment in the current
+ * set, this flag should be true
+ */
+ private boolean modified = false;
+
+ /**
+ * @return the modified
+ */
+ public boolean isModified()
+ {
+ return modified;
+ }
+
+ /**
+ * or the modification state with the given state
+ *
+ * @param modifiedFromAction
+ */
public void updateSetModified(boolean modifiedFromAction)
{
modified |= modifiedFromAction;
@@ -165,7 +192,7 @@ public class JalviewDataset
*/
Hashtable seqDetails;
- public boolean relaxedIdMatching=false;
+ public boolean relaxedIdMatching = false;
public JalviewDataset()
{
@@ -174,99 +201,125 @@ public class JalviewDataset
parentDataset = null;
featureColours = new Hashtable();
}
+
/**
* context created from an existing alignment.
+ *
* @param parentAlignment
*/
- public JalviewDataset(AlignmentI aldataset, Hashtable fc, Hashtable seqDets)
+ public JalviewDataset(AlignmentI aldataset, Hashtable fc,
+ Hashtable seqDets)
{
this(aldataset, fc, seqDets, null);
}
+
/**
*
- * @param aldataset - parent dataset for any new alignment/sequence data (must not be null)
- * @param fc (may be null) feature settings for the alignment where new feature renderstyles are stored
- * @param seqDets - (may be null) anonymised sequence information created by Sequence uniquifier
- * @param parentAlignment (may be null) alignment to associate new annotation and trees with.
+ * @param aldataset
+ * - parent dataset for any new alignment/sequence data (must not be
+ * null)
+ * @param fc
+ * (may be null) feature settings for the alignment where new feature
+ * renderstyles are stored
+ * @param seqDets
+ * - (may be null) anonymised sequence information created by
+ * Sequence uniquifier
+ * @param parentAlignment
+ * (may be null) alignment to associate new annotation and trees
+ * with.
*/
- public JalviewDataset(AlignmentI aldataset, Hashtable fc, Hashtable seqDets, AlignmentI parentAlignment)
+ public JalviewDataset(AlignmentI aldataset, Hashtable fc,
+ Hashtable seqDets, AlignmentI parentAlignment)
{
this();
parentDataset = aldataset;
- if (parentAlignment!=null)
+ if (parentAlignment != null)
{
parentDataset = parentAlignment.getDataset();
- if (parentDataset==null)
+ if (parentDataset == null)
{
parentDataset = parentAlignment;
- } else {
+ }
+ else
+ {
addAlignment(parentAlignment);
}
}
- if (seqDets!=null)
+ if (seqDets != null)
{
seqDetails = seqDets;
}
- if (fc!=null)
+ if (fc != null)
{
featureColours = fc;
}
-
-
+
}
public boolean hasAlignments()
{
- return al!=null && al.size()>0;
+ return al != null && al.size() > 0;
}
public AlignmentI getLastAlignment()
{
- return (al==null || al.size()<1) ? null: al.get(al.size()-1).al;
+ return (al == null || al.size() < 1) ? null : al.get(al.size() - 1).al;
}
+
public AlignmentSet getLastAlignmentSet()
{
- return (al==null || al.size()<1) ? null: al.get(al.size()-1);
+ return (al == null || al.size() < 1) ? null : al.get(al.size() - 1);
}
/**
- * post process (deuniquify) the current alignment and its dependent data, and then add newal to the dataset.
+ * post process (deuniquify) the current alignment and its dependent data, and
+ * then add newal to the dataset.
+ *
* @param newal
*/
-public void addAlignment(AlignmentI newal) {
- if (!hasAlignments())
+ public void addAlignment(AlignmentI newal)
{
- al = new ArrayList<AlignmentSet>();
- }
- AlignmentSet last = getLastAlignmentSet();
- if (last!=null) {
- System.err.println("Deuniquifying last alignment set.");
- last.deuniquifyAlignment();
+ if (!hasAlignments())
+ {
+ al = new ArrayList<AlignmentSet>();
+ }
+ AlignmentSet last = getLastAlignmentSet();
+ if (last != null)
+ {
+ System.err.println("Deuniquifying last alignment set.");
+ last.deuniquifyAlignment();
+ }
+ al.add(new AlignmentSet(newal));
}
- al.add(new AlignmentSet(newal));
-}
-public void addTreeFromFile(NewickFile nf)
-{
- AlignmentSet lal = getLastAlignmentSet();
- lal.trees.add(nf);
-}
+ public void addTreeFromFile(NewickFile nf)
+ {
+ AlignmentSet lal = getLastAlignmentSet();
+ lal.trees.add(nf);
+ }
-public boolean hasSequenceAssoc()
-{
- // TODO: discover where sequence associated data should be put.
- return false;
-}
-public SequenceI getLastAssociatedSequence() {
- // TODO: delineate semantics for associating uniquified data with potentially de-uniquified sequence.
- return null;
-}
-/**
- * update the modified state flag for the current set with the given modification state
- * @param modified - this will be ored with current modification state
- */
-public void updateSetModified(boolean modified)
-{
- getLastAlignmentSet().updateSetModified(modified);
+ public boolean hasSequenceAssoc()
+ {
+ // TODO: discover where sequence associated data should be put.
+ return false;
+ }
+
+ public SequenceI getLastAssociatedSequence()
+ {
+ // TODO: delineate semantics for associating uniquified data with
+ // potentially de-uniquified sequence.
+ return null;
+ }
+
+ /**
+ * update the modified state flag for the current set with the given
+ * modification state
+ *
+ * @param modified
+ * - this will be ored with current modification state
+ */
+ public void updateSetModified(boolean modified)
+ {
+ getLastAlignmentSet().updateSetModified(modified);
+ }
}
-}
\ No newline at end of file
diff --git a/src/jalview/io/packed/ParsePackedSet.java b/src/jalview/io/packed/ParsePackedSet.java
index 1b760df..4de8a66 100644
--- a/src/jalview/io/packed/ParsePackedSet.java
+++ b/src/jalview/io/packed/ParsePackedSet.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.io.packed;
import jalview.datamodel.AlignmentI;
@@ -120,11 +123,14 @@ public class ParsePackedSet
{
br = new BufferedReader(src.getReader());
}
- if (new jalview.io.AnnotationFile()
- .parseAnnotationFrom(context.getLastAlignment(), br))
+ // TODO: add columnSelection to context
+ if (new jalview.io.AnnotationFile().parseAnnotationFrom(
+ context.getLastAlignment(), null, br))
{
context.updateSetModified(true);
- } else {
+ }
+ else
+ {
errmsg = "Annotation file contained no data.";
}
@@ -156,7 +162,7 @@ public class ParsePackedSet
try
{
jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile(src);
- context.updateSetModified(ff.parse(context.getLastAlignment(),
+ context.updateSetModified(ff.parse(context.getLastAlignment(),
context.featureColours, false, context.relaxedIdMatching));
} catch (Exception e)
{
@@ -189,19 +195,23 @@ public class ParsePackedSet
}
}
- if (exerror!=null)
+ if (exerror != null)
{
- if (errmsg!=null && errmsg.length()>0)
+ if (errmsg != null && errmsg.length() > 0)
{
- throw new IOException(errmsg,exerror);
- } else {
- throw new IOException(errmsg,exerror);
+ throw new IOException(errmsg, exerror);
+ }
+ else
+ {
+ throw new IOException(errmsg, exerror);
}
- } else {
- if (errmsg!=null && errmsg.length()>0)
- {
- throw new IOException(errmsg);
}
+ else
+ {
+ if (errmsg != null && errmsg.length() > 0)
+ {
+ throw new IOException(errmsg);
+ }
}
}
if (deuniquify)
@@ -287,10 +297,13 @@ public class ParsePackedSet
// to buffers.
// import with deuniquify info, and compare results to input.
- } else {
+ }
+ else
+ {
if (context.getLastAlignmentSet().isModified())
{
- System.err.println("Initial alignment set was modified and any associated views should be updated.");
+ System.err
+ .println("Initial alignment set was modified and any associated views should be updated.");
}
}
}
diff --git a/src/jalview/io/packed/SimpleDataProvider.java b/src/jalview/io/packed/SimpleDataProvider.java
index 879c64f..ac036ca 100644
--- a/src/jalview/io/packed/SimpleDataProvider.java
+++ b/src/jalview/io/packed/SimpleDataProvider.java
@@ -1,27 +1,31 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.io.packed;
import jalview.io.FileParse;
/**
- * minimal implementation of the DataProvider interface.
- * Allows a FileParse datasource to be specified as one of the DataProvider.JvDataType content types, with or without some other associated object as external reference.
+ * minimal implementation of the DataProvider interface. Allows a FileParse
+ * datasource to be specified as one of the DataProvider.JvDataType content
+ * types, with or without some other associated object as external reference.
*/
public class SimpleDataProvider implements DataProvider
{
@@ -33,9 +37,14 @@ public class SimpleDataProvider implements DataProvider
/**
* create a SimpleDataProvider
- * @param type - contents of resource accessible via fp
- * @param fp - datasource
- * @param assoc - external object that fp's content should be associated with (may be null)
+ *
+ * @param type
+ * - contents of resource accessible via fp
+ * @param fp
+ * - datasource
+ * @param assoc
+ * - external object that fp's content should be associated with (may
+ * be null)
*/
public SimpleDataProvider(DataProvider.JvDataType type, FileParse fp,
Object assoc)
@@ -63,4 +72,4 @@ public class SimpleDataProvider implements DataProvider
return jvtype;
}
-}
\ No newline at end of file
+}
diff --git a/src/jalview/io/vamsas/Datasetsequence.java b/src/jalview/io/vamsas/Datasetsequence.java
index e57942b..297b854 100644
--- a/src/jalview/io/vamsas/Datasetsequence.java
+++ b/src/jalview/io/vamsas/Datasetsequence.java
@@ -1,275 +1,278 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.io.vamsas;
-
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.SequenceI;
-import jalview.io.VamsasAppDatastore;
-import uk.ac.vamsas.objects.core.DataSet;
-import uk.ac.vamsas.objects.core.DbRef;
-import uk.ac.vamsas.objects.core.Sequence;
-
-/**
- * synchronize a vamsas dataset sequence with a jalview dataset sequence. This
- * class deals with all sequence features and database references associated
- * with the jalview sequence.
- *
- * @author JimP
- *
- */
-public class Datasetsequence extends DatastoreItem
-{
- String dict;
-
- private DataSet dataset;
-
- // private AlignmentI jvdset;
-
- public Datasetsequence(VamsasAppDatastore vamsasAppDatastore,
- SequenceI sq, String dict, DataSet dataset)
- {
- super(vamsasAppDatastore, sq, uk.ac.vamsas.objects.core.Sequence.class);
- this.dataset = dataset;
- // this.jvdset = jvdset;
- this.dict = dict;
- doSync();
- }
-
- public Datasetsequence(VamsasAppDatastore vamsasAppDatastore,
- Sequence vdseq)
- {
- super(vamsasAppDatastore, vdseq, SequenceI.class);
- doJvUpdate();
- }
-
- public void addFromDocument()
- {
- Sequence vseq = (Sequence) vobj;
- SequenceI dsseq = new jalview.datamodel.Sequence(vseq.getName(),
- vseq.getSequence(), (int) vseq.getStart(), (int) vseq.getEnd());
- dsseq.setDescription(vseq.getDescription());
- bindjvvobj(dsseq, vseq);
- dsseq.setVamsasId(vseq.getVorbaId().getId());
- jvobj = dsseq;
- modified = true;
- }
-
- public void updateFromDoc()
- {
- Sequence sq = (Sequence) vobj;
- SequenceI sequence = (SequenceI) jvobj;
- if (!sequence.getSequenceAsString().equals(sq.getSequence()))
- {
- log.warn("Potential Client Error ! - mismatch of dataset sequence: and jalview internal dataset sequence.");
- }
- else
- {
- // verify and update principal attributes.
- if (sequence.getDescription() != null
- && (sequence.getDescription() == null || !sequence
- .getDescription().equals(sq.getDescription())))
- {
- sequence.setDescription(sq.getDescription());
- modified = true;
- }
- if (sequence.getSequence() == null
- || !sequence.getSequenceAsString().equals(sq.getSequence()))
- {
- if (sequence.getStart() != sq.getStart()
- || sequence.getEnd() != sq.getEnd())
- {
- // update modified sequence.
- sequence.setSequence(sq.getSequence());
- sequence.setStart((int) sq.getStart());
- sequence.setEnd((int) sq.getEnd());
- modified = true;
- }
- }
- if (!sequence.getName().equals(sq.getName()))
- {
- sequence.setName(sq.getName());
- modified = true;
- }
- modified |= updateJvDbRefs();
- // updateJvFeatures();
- }
- }
-
- /*
- * private void updateJvFeatures() { Sequence vsq = (Sequence) vobj;
- *
- * // add or update any new features/references on dataset sequence if
- * (vsq.getgetSequenceFeatures() != null) { int sfSize =
- * sq.getSequenceFeatures().length;
- *
- * for (int sf = 0; sf < sfSize; sf++) { new
- * jalview.io.vamsas.Sequencefeature(datastore,
- * (jalview.datamodel.SequenceFeature) sq .getSequenceFeatures()[sf], dataset,
- * (Sequence) vobj); } } }
- */
- private boolean updateSqFeatures()
- {
- boolean modified = false;
- SequenceI sq = (SequenceI) jvobj;
-
- // add or update any new features/references on dataset sequence
- if (sq.getSequenceFeatures() != null)
- {
- int sfSize = sq.getSequenceFeatures().length;
-
- for (int sf = 0; sf < sfSize; sf++)
- {
- modified |= new jalview.io.vamsas.Sequencefeature(datastore,
- (jalview.datamodel.SequenceFeature) sq
- .getSequenceFeatures()[sf], dataset,
- (Sequence) vobj).docWasUpdated();
- }
- }
- return modified;
- }
-
- public void addToDocument()
- {
- SequenceI sq = (SequenceI) jvobj;
- Sequence sequence = new Sequence();
- bindjvvobj(sq, sequence);
- sq.setVamsasId(sequence.getVorbaId().getId());
- sequence.setSequence(sq.getSequenceAsString());
- sequence.setDictionary(dict);
- sequence.setName(sq.getName());
- sequence.setStart(sq.getStart());
- sequence.setEnd(sq.getEnd());
- sequence.setDescription(sq.getDescription());
- dataset.addSequence(sequence);
- vobj = sequence;
- updateSqFeatures();
- updateDbRefs();// sq,(Sequence) vobj, dataset);
- }
-
- /**
- * sync database references from jv to document
- *
- * @return true if document was modified
- */
- private boolean updateDbRefs()
- {
- boolean modifiedthedoc = false;
- SequenceI sq = (SequenceI) jvobj;
-
- if (sq.getDatasetSequence() == null && sq.getDBRef() != null)
- {
- // only sync database references for dataset sequences
- DBRefEntry[] entries = sq.getDBRef();
- // jalview.datamodel.DBRefEntry dbentry;
- for (int db = 0; db < entries.length; db++)
- {
- modifiedthedoc |= new jalview.io.vamsas.Dbref(datastore,
- // dbentry =
- entries[db], sq, (Sequence) vobj, dataset).docWasUpdated();
-
- }
-
- }
- return modifiedthedoc;
- }
-
- /**
- * sync database references from document to jv sequence
- *
- * @return true if local sequence refs were modified
- */
- private boolean updateJvDbRefs()
- {
- boolean modifiedtheseq = false;
- SequenceI sq = (SequenceI) jvobj;
- Sequence vsq = (Sequence) vobj;
- if (vsq.getDbRefCount() > 0)
- {
- // only sync database references for dataset sequences
- DbRef[] entries = vsq.getDbRef();
- // DbRef dbentry;
- for (int db = 0; db < entries.length; db++)
- {
- modifiedtheseq |= new jalview.io.vamsas.Dbref(datastore,
- // dbentry =
- entries[db], vsq, sq).jvWasUpdated();
- }
- }
- return modifiedtheseq;
- }
-
- public void conflict()
- {
- log.warn("Conflict in dataset sequence update to document. Overwriting document");
- // TODO: could try to import from document data to jalview first. and then
- updateToDoc();
- }
-
- boolean modified = false;
-
- public void updateToDoc()
- {
- SequenceI sq = (SequenceI) jvobj;
- Sequence sequence = (Sequence) vobj;
- // verify and update principal attributes.
- if (sequence.getDescription() != null
- && (sequence.getDescription() == null || !sequence
- .getDescription().equals(sq.getDescription())))
- {
- sequence.setDescription(sq.getDescription());
- modified = true;
- }
- if (sequence.getSequence() == null
- || !sequence.getSequence().equals(sq.getSequenceAsString()))
- {
- if (sequence.getStart() != sq.getStart()
- || sequence.getEnd() != sq.getEnd())
- {
- // update modified sequence.
- sequence.setSequence(sq.getSequenceAsString());
- sequence.setStart(sq.getStart());
- sequence.setEnd(sq.getEnd());
- modified = true;
- }
- }
- if (!dict.equals(sequence.getDictionary()))
- {
- sequence.setDictionary(dict);
- modified = true;
- }
- if (!sequence.getName().equals(sq.getName()))
- {
- sequence.setName(sq.getName());
- modified = true;
- }
- modified |= updateDbRefs();
- modified |= updateSqFeatures();
- }
-
- /**
- * (probably could just do vobj.isModified(), but..)
- *
- * @return true if document's dataset sequence was modified
- */
- public boolean getModified()
- {
- return modified;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io.vamsas;
+
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceI;
+import jalview.io.VamsasAppDatastore;
+
+import uk.ac.vamsas.objects.core.DataSet;
+import uk.ac.vamsas.objects.core.DbRef;
+import uk.ac.vamsas.objects.core.Sequence;
+
+/**
+ * synchronize a vamsas dataset sequence with a jalview dataset sequence. This
+ * class deals with all sequence features and database references associated
+ * with the jalview sequence.
+ *
+ * @author JimP
+ *
+ */
+public class Datasetsequence extends DatastoreItem
+{
+ String dict;
+
+ private DataSet dataset;
+
+ // private AlignmentI jvdset;
+
+ public Datasetsequence(VamsasAppDatastore vamsasAppDatastore,
+ SequenceI sq, String dict, DataSet dataset)
+ {
+ super(vamsasAppDatastore, sq, uk.ac.vamsas.objects.core.Sequence.class);
+ this.dataset = dataset;
+ // this.jvdset = jvdset;
+ this.dict = dict;
+ doSync();
+ }
+
+ public Datasetsequence(VamsasAppDatastore vamsasAppDatastore,
+ Sequence vdseq)
+ {
+ super(vamsasAppDatastore, vdseq, SequenceI.class);
+ doJvUpdate();
+ }
+
+ public void addFromDocument()
+ {
+ Sequence vseq = (Sequence) vobj;
+ SequenceI dsseq = new jalview.datamodel.Sequence(vseq.getName(),
+ vseq.getSequence(), (int) vseq.getStart(), (int) vseq.getEnd());
+ dsseq.setDescription(vseq.getDescription());
+ bindjvvobj(dsseq, vseq);
+ dsseq.setVamsasId(vseq.getVorbaId().getId());
+ jvobj = dsseq;
+ modified = true;
+ }
+
+ public void updateFromDoc()
+ {
+ Sequence sq = (Sequence) vobj;
+ SequenceI sequence = (SequenceI) jvobj;
+ if (!sequence.getSequenceAsString().equals(sq.getSequence()))
+ {
+ log.warn("Potential Client Error ! - mismatch of dataset sequence: and jalview internal dataset sequence.");
+ }
+ else
+ {
+ // verify and update principal attributes.
+ if (sequence.getDescription() != null
+ && (sequence.getDescription() == null || !sequence
+ .getDescription().equals(sq.getDescription())))
+ {
+ sequence.setDescription(sq.getDescription());
+ modified = true;
+ }
+ if (sequence.getSequence() == null
+ || !sequence.getSequenceAsString().equals(sq.getSequence()))
+ {
+ if (sequence.getStart() != sq.getStart()
+ || sequence.getEnd() != sq.getEnd())
+ {
+ // update modified sequence.
+ sequence.setSequence(sq.getSequence());
+ sequence.setStart((int) sq.getStart());
+ sequence.setEnd((int) sq.getEnd());
+ modified = true;
+ }
+ }
+ if (!sequence.getName().equals(sq.getName()))
+ {
+ sequence.setName(sq.getName());
+ modified = true;
+ }
+ modified |= updateJvDbRefs();
+ // updateJvFeatures();
+ }
+ }
+
+ /*
+ * private void updateJvFeatures() { Sequence vsq = (Sequence) vobj;
+ *
+ * // add or update any new features/references on dataset sequence if
+ * (vsq.getgetSequenceFeatures() != null) { int sfSize =
+ * sq.getSequenceFeatures().length;
+ *
+ * for (int sf = 0; sf < sfSize; sf++) { new
+ * jalview.io.vamsas.Sequencefeature(datastore,
+ * (jalview.datamodel.SequenceFeature) sq .getSequenceFeatures()[sf], dataset,
+ * (Sequence) vobj); } } }
+ */
+ private boolean updateSqFeatures()
+ {
+ boolean modified = false;
+ SequenceI sq = (SequenceI) jvobj;
+
+ // add or update any new features/references on dataset sequence
+ if (sq.getSequenceFeatures() != null)
+ {
+ int sfSize = sq.getSequenceFeatures().length;
+
+ for (int sf = 0; sf < sfSize; sf++)
+ {
+ modified |= new jalview.io.vamsas.Sequencefeature(datastore,
+ (jalview.datamodel.SequenceFeature) sq
+ .getSequenceFeatures()[sf], dataset,
+ (Sequence) vobj).docWasUpdated();
+ }
+ }
+ return modified;
+ }
+
+ public void addToDocument()
+ {
+ SequenceI sq = (SequenceI) jvobj;
+ Sequence sequence = new Sequence();
+ bindjvvobj(sq, sequence);
+ sq.setVamsasId(sequence.getVorbaId().getId());
+ sequence.setSequence(sq.getSequenceAsString());
+ sequence.setDictionary(dict);
+ sequence.setName(sq.getName());
+ sequence.setStart(sq.getStart());
+ sequence.setEnd(sq.getEnd());
+ sequence.setDescription(sq.getDescription());
+ dataset.addSequence(sequence);
+ vobj = sequence;
+ updateSqFeatures();
+ updateDbRefs();// sq,(Sequence) vobj, dataset);
+ }
+
+ /**
+ * sync database references from jv to document
+ *
+ * @return true if document was modified
+ */
+ private boolean updateDbRefs()
+ {
+ boolean modifiedthedoc = false;
+ SequenceI sq = (SequenceI) jvobj;
+
+ if (sq.getDatasetSequence() == null && sq.getDBRef() != null)
+ {
+ // only sync database references for dataset sequences
+ DBRefEntry[] entries = sq.getDBRef();
+ // jalview.datamodel.DBRefEntry dbentry;
+ for (int db = 0; db < entries.length; db++)
+ {
+ modifiedthedoc |= new jalview.io.vamsas.Dbref(datastore,
+ // dbentry =
+ entries[db], sq, (Sequence) vobj, dataset).docWasUpdated();
+
+ }
+
+ }
+ return modifiedthedoc;
+ }
+
+ /**
+ * sync database references from document to jv sequence
+ *
+ * @return true if local sequence refs were modified
+ */
+ private boolean updateJvDbRefs()
+ {
+ boolean modifiedtheseq = false;
+ SequenceI sq = (SequenceI) jvobj;
+ Sequence vsq = (Sequence) vobj;
+ if (vsq.getDbRefCount() > 0)
+ {
+ // only sync database references for dataset sequences
+ DbRef[] entries = vsq.getDbRef();
+ // DbRef dbentry;
+ for (int db = 0; db < entries.length; db++)
+ {
+ modifiedtheseq |= new jalview.io.vamsas.Dbref(datastore,
+ // dbentry =
+ entries[db], vsq, sq).jvWasUpdated();
+ }
+ }
+ return modifiedtheseq;
+ }
+
+ public void conflict()
+ {
+ log.warn("Conflict in dataset sequence update to document. Overwriting document");
+ // TODO: could try to import from document data to jalview first. and then
+ updateToDoc();
+ }
+
+ boolean modified = false;
+
+ public void updateToDoc()
+ {
+ SequenceI sq = (SequenceI) jvobj;
+ Sequence sequence = (Sequence) vobj;
+ // verify and update principal attributes.
+ if (sequence.getDescription() != null
+ && (sequence.getDescription() == null || !sequence
+ .getDescription().equals(sq.getDescription())))
+ {
+ sequence.setDescription(sq.getDescription());
+ modified = true;
+ }
+ if (sequence.getSequence() == null
+ || !sequence.getSequence().equals(sq.getSequenceAsString()))
+ {
+ if (sequence.getStart() != sq.getStart()
+ || sequence.getEnd() != sq.getEnd())
+ {
+ // update modified sequence.
+ sequence.setSequence(sq.getSequenceAsString());
+ sequence.setStart(sq.getStart());
+ sequence.setEnd(sq.getEnd());
+ modified = true;
+ }
+ }
+ if (!dict.equals(sequence.getDictionary()))
+ {
+ sequence.setDictionary(dict);
+ modified = true;
+ }
+ if (!sequence.getName().equals(sq.getName()))
+ {
+ sequence.setName(sq.getName());
+ modified = true;
+ }
+ modified |= updateDbRefs();
+ modified |= updateSqFeatures();
+ }
+
+ /**
+ * (probably could just do vobj.isModified(), but..)
+ *
+ * @return true if document's dataset sequence was modified
+ */
+ public boolean getModified()
+ {
+ return modified;
+ }
+
+}
diff --git a/src/jalview/io/vamsas/DatastoreItem.java b/src/jalview/io/vamsas/DatastoreItem.java
index 1a5a1ea..215f2d5 100644
--- a/src/jalview/io/vamsas/DatastoreItem.java
+++ b/src/jalview/io/vamsas/DatastoreItem.java
@@ -1,38 +1,37 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io.vamsas;
import jalview.bin.Cache;
-import jalview.datamodel.DBRefEntry;
-import jalview.gui.TreePanel;
import jalview.io.VamsasAppDatastore;
+import jalview.util.MessageManager;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.IdentityHashMap;
import java.util.Vector;
-import org.apache.commons.logging.Log;
-
import uk.ac.vamsas.client.IClientDocument;
import uk.ac.vamsas.client.Vobject;
import uk.ac.vamsas.client.VorbaId;
-import uk.ac.vamsas.objects.core.DbRef;
import uk.ac.vamsas.objects.core.Entry;
import uk.ac.vamsas.objects.core.Provenance;
import uk.ac.vamsas.objects.core.Seg;
@@ -131,18 +130,22 @@ public abstract class DatastoreItem
if (vobj2jv.containsKey(vobj.getVorbaId())
&& !(vobj2jv.get(vobj.getVorbaId())).equals(jvobj))
{
- Cache.log.debug(
- "Warning? Overwriting existing vamsas id binding for "
- + vobj.getVorbaId(), new Exception(
- "Overwriting vamsas id binding."));
+ Cache.log
+ .debug("Warning? Overwriting existing vamsas id binding for "
+ + vobj.getVorbaId(),
+ new Exception(
+ MessageManager
+ .getString("exception.overwriting_vamsas_id_binding")));
}
else if (jv2vobj.containsKey(jvobj)
&& !((VorbaId) jv2vobj.get(jvobj)).equals(vobj.getVorbaId()))
{
- Cache.log.debug(
- "Warning? Overwriting existing jalview object binding for "
- + jvobj, new Exception(
- "Overwriting jalview object binding."));
+ Cache.log
+ .debug("Warning? Overwriting existing jalview object binding for "
+ + jvobj,
+ new Exception(
+ MessageManager
+ .getString("exception.overwriting_jalview_id_binding")));
}
/*
* Cache.log.error("Attempt to make conflicting object binding! "+vobj+" id "
@@ -192,9 +195,9 @@ public abstract class DatastoreItem
Object vobject = jv2vobj.remove(oldjvobject);
if (vobject == null)
{
- throw new Error(
- "IMPLEMENTATION ERROR: old jalview object is not bound ! ("
- + oldjvobject + ")");
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_old_jalview_object_not_bound",
+ new String[] { oldjvobject.toString() }));
}
if (newjvobject != null)
{
@@ -233,9 +236,13 @@ public abstract class DatastoreItem
tojalview = true;
if (jvobj != null && !(boundType.isAssignableFrom(jvobj.getClass())))
{
- throw new Error("Implementation Error: Vamsas Document Class "
- + vobj.getClass() + " should bind to a " + boundType
- + " (found a " + jvobj.getClass() + ")");
+ throw new Error(
+ MessageManager
+ .formatMessage(
+ "error.implementation_error_vamsas_doc_class_should_bind_to_type",
+ new String[] { vobj.getClass().toString(),
+ boundType.toString(),
+ jvobj.getClass().toString() }));
}
dsReg.registerDsObj(this);
}
@@ -261,9 +268,13 @@ public abstract class DatastoreItem
vobj = getjv2vObj(jvobj);
if (vobj != null && !(boundToType.isAssignableFrom(vobj.getClass())))
{
- throw new Error("Implementation Error: Jalview Class "
- + jvobj2.getClass() + " should bind to a " + boundToType
- + " (found a " + vobj.getClass() + ")");
+ throw new Error(
+ MessageManager
+ .formatMessage(
+ "error.implementation_error_vamsas_doc_class_should_bind_to_type",
+ new String[] { jvobj2.getClass().toString(),
+ boundToType.toString(),
+ vobj.getClass().toString() }));
}
dsReg.registerDsObj(this);
}
@@ -436,8 +447,7 @@ public abstract class DatastoreItem
end = start;
start = t;
}
- return new int[]
- { start, end, pol < 0 ? 1 : 0 };
+ return new int[] { start, end, pol < 0 ? 1 : 0 };
}
/**
diff --git a/src/jalview/io/vamsas/DatastoreRegistry.java b/src/jalview/io/vamsas/DatastoreRegistry.java
index f00426a..9ecd36c 100644
--- a/src/jalview/io/vamsas/DatastoreRegistry.java
+++ b/src/jalview/io/vamsas/DatastoreRegistry.java
@@ -1,29 +1,29 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io.vamsas;
-import java.util.Enumeration;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
-import uk.ac.vamsas.client.Vobject;
-
public class DatastoreRegistry
{
protected static org.apache.log4j.Logger log = org.apache.log4j.Logger
@@ -83,8 +83,7 @@ public class DatastoreRegistry
if (dsregitem == null)
{
// create a new item entry
- dsregitem = new Object[]
- { dsitem.jvobj, dsitem.vobj };
+ dsregitem = new Object[] { dsitem.jvobj, dsitem.vobj };
dsItemReg.put(dsitem, dsregitem);
dsObjReg.put(dsitem.jvobj, dsitem);
dsObjReg.put(dsitem.vobj, dsitem);
diff --git a/src/jalview/io/vamsas/Dbref.java b/src/jalview/io/vamsas/Dbref.java
index 218aa5b..e7f6b3c 100644
--- a/src/jalview/io/vamsas/Dbref.java
+++ b/src/jalview/io/vamsas/Dbref.java
@@ -1,30 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io.vamsas;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.SequenceI;
+import jalview.io.VamsasAppDatastore;
+
import uk.ac.vamsas.objects.core.DataSet;
import uk.ac.vamsas.objects.core.DbRef;
import uk.ac.vamsas.objects.core.Map;
import uk.ac.vamsas.objects.core.Sequence;
-import uk.ac.vamsas.objects.core.SequenceType;
-import jalview.io.VamsasAppDatastore;
public class Dbref extends Rangetype
{
diff --git a/src/jalview/io/vamsas/LocalDocSyncObject.java b/src/jalview/io/vamsas/LocalDocSyncObject.java
index 1ff29af..67511dc 100644
--- a/src/jalview/io/vamsas/LocalDocSyncObject.java
+++ b/src/jalview/io/vamsas/LocalDocSyncObject.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io.vamsas;
diff --git a/src/jalview/io/vamsas/Rangetype.java b/src/jalview/io/vamsas/Rangetype.java
index 2fd2333..d94d86c 100644
--- a/src/jalview/io/vamsas/Rangetype.java
+++ b/src/jalview/io/vamsas/Rangetype.java
@@ -1,34 +1,37 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io.vamsas;
+import jalview.io.VamsasAppDatastore;
+import jalview.util.MessageManager;
+
+import java.util.List;
import java.util.Vector;
import uk.ac.vamsas.client.Vobject;
import uk.ac.vamsas.objects.core.Local;
-import uk.ac.vamsas.objects.core.Map;
import uk.ac.vamsas.objects.core.MapType;
import uk.ac.vamsas.objects.core.Mapped;
import uk.ac.vamsas.objects.core.RangeType;
import uk.ac.vamsas.objects.core.Seg;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.Mapping;
-import jalview.io.VamsasAppDatastore;
/**
* Enhances DatastoreItem objects with additional functions to do with RangeType
@@ -76,7 +79,8 @@ public abstract class Rangetype extends DatastoreItem
if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)
{
throw new Error(
- "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");
+ MessageManager
+ .getString("error.invalid_vamsas_rangetype_cannot_resolve_lists"));
}
if (dseta.getSegCount() > 0)
{
@@ -99,8 +103,7 @@ public abstract class Rangetype extends DatastoreItem
// could do a polarity for pos range too. and pass back indication of
// discontinuities.
int pos = dseta.getPos(0).getI();
- se = new int[]
- { pos, pos };
+ se = new int[] { pos, pos };
for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)
{
pos = dseta.getPos(p).getI();
@@ -135,7 +138,8 @@ public abstract class Rangetype extends DatastoreItem
if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)
{
throw new Error(
- "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");
+ MessageManager
+ .getString("error.invalid_vamsas_rangetype_cannot_resolve_lists"));
}
if (dseta.getSegCount() > 0)
{
@@ -183,7 +187,8 @@ public abstract class Rangetype extends DatastoreItem
if (range.getSegCount() > 0 && range.getPosCount() > 0)
{
throw new Error(
- "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");
+ MessageManager
+ .getString("error.invalid_vamsas_rangetype_cannot_resolve_lists"));
}
if (range.getSegCount() > 0)
{
@@ -223,15 +228,15 @@ public abstract class Rangetype extends DatastoreItem
* initialise a range type object from a set of start/end inclusive intervals
*
* @param mrt
- * @param range
+ * @param ranges
*/
- protected void initRangeType(RangeType mrt, int[] range)
+ protected void initRangeType(RangeType mrt, List<int[]> ranges)
{
- for (int i = 0; i < range.length; i += 2)
+ for (int[] range : ranges)
{
Seg vSeg = new Seg();
- vSeg.setStart(range[i]);
- vSeg.setEnd(range[i + 1]);
+ vSeg.setStart(range[0]);
+ vSeg.setEnd(range[1]);
vSeg.setInclusive(true);
mrt.addSeg(vSeg);
}
@@ -300,7 +305,8 @@ public abstract class Rangetype extends DatastoreItem
if (ml == null)
{
throw new Error(
- "Implementation error. MapList is null for initMapType.");
+ MessageManager
+ .getString("error.implementation_error_maplist_is_null"));
}
maprange.setLocal(new Local());
maprange.setMapped(new Mapped());
diff --git a/src/jalview/io/vamsas/Sequencefeature.java b/src/jalview/io/vamsas/Sequencefeature.java
index f69db60..0f9a664 100644
--- a/src/jalview/io/vamsas/Sequencefeature.java
+++ b/src/jalview/io/vamsas/Sequencefeature.java
@@ -1,359 +1,359 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.io.vamsas;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import uk.ac.vamsas.objects.core.DataSet;
-import uk.ac.vamsas.objects.core.DataSetAnnotations;
-import uk.ac.vamsas.objects.core.Link;
-import uk.ac.vamsas.objects.core.Property;
-import uk.ac.vamsas.objects.core.Provenance;
-import uk.ac.vamsas.objects.core.RangeAnnotation;
-import uk.ac.vamsas.objects.core.Score;
-import uk.ac.vamsas.objects.core.Seg;
-import uk.ac.vamsas.objects.core.Sequence;
-import uk.ac.vamsas.objects.utils.Properties;
-import jalview.bin.Cache;
-import jalview.datamodel.SequenceFeature;
-import jalview.datamodel.SequenceI;
-import jalview.io.VamsasAppDatastore;
-import jalview.util.UrlLink;
-
-/**
- * @author JimP
- *
- */
-public class Sequencefeature extends Rangetype
-{
-
- uk.ac.vamsas.objects.core.DataSet dataset;
-
- uk.ac.vamsas.objects.core.Sequence sequence;
-
- private SequenceI dsSeq;
-
- public Sequencefeature(VamsasAppDatastore vamsasAppDatastore,
- SequenceFeature sequenceFeature,
- uk.ac.vamsas.objects.core.DataSet dataset,
- uk.ac.vamsas.objects.core.Sequence sequence)
- {
- super(vamsasAppDatastore, sequenceFeature, DataSetAnnotations.class);
- this.dataset = dataset;
- this.sequence = sequence;
- doSync();
- }
-
- public Sequencefeature(VamsasAppDatastore vamsasAppDatastore,
- DataSetAnnotations dseta, SequenceI dsSeq)
- {
- super(vamsasAppDatastore, dseta,
- jalview.datamodel.SequenceFeature.class);
- this.dsSeq = dsSeq;
- doJvUpdate();
- }
-
- public void addToDocument()
- {
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;
- jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
- dsa = (DataSetAnnotations) getDSAnnotationFromJalview(
- new DataSetAnnotations(), feature);
- if (dsa.getProvenance() == null)
- {
- dsa.setProvenance(new Provenance());
- }
- addProvenance(dsa.getProvenance(), "created"); // JBPNote - need
- // to update
- dsa.addSeqRef(sequence); // we have just created this annotation
- // - so safe to use this
- bindjvvobj(feature, dsa);
- dataset.addDataSetAnnotations(dsa);
- }
-
- public void addFromDocument()
- {
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;
- if (dsa.getSeqRefCount() != 1)
- {
- Cache.log
- .warn("Not binding "
- + dsa.getVorbaId()
- + " to Sequence Feature - has multiple dataset sequence references.");
- return;
- }
- jalview.datamodel.SequenceFeature sf = (jalview.datamodel.SequenceFeature) jvobj;
- dsSeq.addSequenceFeature(sf = getJalviewSeqFeature(dsa));
- jvobj = sf;
- bindjvvobj(sf, dsa);
- }
-
- public void conflict()
- {
- log.warn("Untested sequencefeature conflict code");
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;
- jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
- jalview.datamodel.SequenceFeature sf = getJalviewSeqFeature(dsa);
- replaceJvObjMapping(feature, sf); // switch binding of dsa from old feature
- // to newly created feature
- dsSeq.addSequenceFeature(sf); // add new imported feature
- addToDocument(); // and create a new feature in the document
- }
-
- public void updateToDoc()
- {
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;
- jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
- if (dsa.getSeqRefCount() != 1)
- {
- replaceJvObjMapping(feature, null);
- Cache.log
- .warn("Binding of annotation to jalview feature has changed. Removing binding and recreating.");
- doSync(); // re-verify bindings.
- }
- else
- {
- // Sync the features from Jalview
- long oldref = dsa.get__last_hash();
- getDSAnnotationFromJalview(dsa, feature);
- if (oldref != dsa.hashCode())
- {
- Cache.log
- .debug("Updated dataset sequence annotation from feature.");
- addProvenance(dsa.getProvenance(), "modified");
- }
- }
-
- }
-
- public void updateFromDoc()
- {
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;
- jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
- if (dsa.getSeqRefCount() != 1)
- {
- // conflicting update from document - we cannot map this feature anymore.
- replaceJvObjMapping(feature, null);
- Cache.log
- .warn("annotation ("
- + dsa.getVorbaId()
- + " bound to jalview feature cannot be mapped. Removing binding, deleting feature, and deleting feature.");
- // - consider deleting the feature ?
- dsSeq.deleteFeature(feature);
- // doSync();
- }
- else
- {
- // Sync the features to Jalview - easiest to delete and add the feature
- // again
- jalview.datamodel.SequenceFeature newsf = getJalviewSeqFeature(dsa);
- dsSeq.deleteFeature(feature);
- replaceJvObjMapping(feature, newsf);
- dsSeq.addSequenceFeature(newsf);
- if (feature.otherDetails != null)
- {
- // TODO later: leave this to finalise method ?
- feature.otherDetails.clear();
- }
- }
- }
-
- /**
- * correctly create/update a RangeAnnotation from a jalview sequence feature
- * TODO: refactor to a method in jalview.io.vamsas.RangeAnnotation class
- *
- * @param dsa
- * (typically DataSetAnnotations or AlignmentSequenceAnnotation)
- * @param feature
- * (the feature to be mapped from)
- * @return
- */
- private RangeAnnotation getDSAnnotationFromJalview(RangeAnnotation dsa,
- jalview.datamodel.SequenceFeature feature)
- {
- dsa.setType(feature.getType());
- Seg vSeg = new Seg();
- vSeg.setStart(feature.getBegin());
- vSeg.setEnd(feature.getEnd());
- vSeg.setInclusive(true);
- if (dsa.getSegCount() > 1)
- {
- Cache.log
- .debug("About to destroy complex annotation in vamsas document mapped to sequence feature ("
- + dsa.getVorbaId() + ")");
- }
- dsa.setSeg(new Seg[]
- { vSeg });
- dsa.setDescription(feature.getDescription());
- dsa.setStatus(feature.getStatus());
- if (feature.links != null && feature.links.size() > 0)
- {
- for (int i = 0, iSize = feature.links.size(); i < iSize; i++)
- {
- String link = (String) feature.links.elementAt(i);
- UrlLink ulink = new UrlLink(link);
- if (ulink.isValid())
- {
- // We only add static links to the document.
- Link vLink = new Link();
- vLink.setContent(ulink.getLabel());
- vLink.setHref(ulink.getTarget());
- dsa.addLink(vLink);
- }
- }
- }
- dsa.setGroup(feature.getFeatureGroup());
- if (feature.getScore() != Float.NaN)
- {
- Score fscore = new Score();
- dsa.setScore(new Score[]
- { fscore });
- fscore.setContent(feature.getScore());
- fscore.setName(feature.getType());
- }
- if (feature.otherDetails != null)
- {
- Enumeration iter = feature.otherDetails.keys();
- Vector props = dsa.getPropertyAsReference();
- while (iter.hasMoreElements())
- {
- String key = (String) iter.nextElement();
- if (!key.equalsIgnoreCase("score")
- && !key.equalsIgnoreCase("status"))
- {
- Property nprop = new Property();
- nprop.setName(key);
- Object vlu = feature.getValue(key);
- nprop.setContent(feature.getValue(key).toString());
- boolean valid = false;
- if (vlu instanceof String)
- {
- nprop.setType(uk.ac.vamsas.objects.utils.Properties.STRINGTYPE);
- valid = true;
- }
- else if (vlu instanceof Integer)
- {
- valid = true;
- nprop.setType(uk.ac.vamsas.objects.utils.Properties.INTEGERTYPE);
- }
- else if (vlu instanceof Float)
- {
- nprop.setType(uk.ac.vamsas.objects.utils.Properties.FLOATTYPE);
- valid = true;
- }
- if (valid)
- {
- if (props != null)
- {
- uk.ac.vamsas.objects.utils.Properties.addOrReplace(props,
- nprop);
- }
- else
- {
- dsa.addProperty(nprop);
- }
- }
- }
- }
- }
- return dsa;
- }
-
- private SequenceFeature getJalviewSeqFeature(RangeAnnotation dseta)
- {
- int[] se = getBounds(dseta);
- SequenceFeature sf = new jalview.datamodel.SequenceFeature(
- dseta.getType(), dseta.getDescription(), dseta.getStatus(),
- se[0], se[1], dseta.getGroup());
- if (dseta.getLinkCount() > 0)
- {
- Link[] links = dseta.getLink();
- for (int i = 0; i < links.length; i++)
- {
- // TODO: use URLLink parsing/validation here.
- sf.addLink(links[i].getContent() + "|" + links[i].getHref());
- }
- }
- if (dseta.getScoreCount() > 0)
- {
- Enumeration scr = dseta.enumerateScore();
- while (scr.hasMoreElements())
- {
- Score score = (Score) scr.nextElement();
- if (score.getName().equals(sf.getType()))
- {
- sf.setScore(score.getContent());
- }
- else
- {
- sf.setValue(score.getName(), "" + score.getContent());
- }
- }
- }
- // other details
- Enumeration props = dseta.enumerateProperty();
- while (props.hasMoreElements())
- {
- Property p = (Property) props.nextElement();
- Object val = null;
- if (Properties.isValid(p))
- {
- if (Properties.isString(p))
- {
- val = p.getContent();
- }
- if (Properties.isBoolean(p))
- {
- try
- {
- val = new Boolean(p.getContent());
- } catch (Exception e)
- {
- }
- }
- if (Properties.isFloat(p))
- {
- try
- {
- val = new Float(p.getContent());
-
- } catch (Exception e)
- {
- }
- }
- if (Properties.isInteger(p))
- {
- try
- {
- val = new Integer(p.getContent());
- } catch (Exception e)
- {
- }
- }
- if (val != null)
- {
- sf.setValue(p.getName(), val);
- }
- }
- }
-
- return sf;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.io.vamsas;
+
+import jalview.bin.Cache;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.io.VamsasAppDatastore;
+import jalview.util.UrlLink;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import uk.ac.vamsas.objects.core.DataSetAnnotations;
+import uk.ac.vamsas.objects.core.Link;
+import uk.ac.vamsas.objects.core.Property;
+import uk.ac.vamsas.objects.core.Provenance;
+import uk.ac.vamsas.objects.core.RangeAnnotation;
+import uk.ac.vamsas.objects.core.Score;
+import uk.ac.vamsas.objects.core.Seg;
+import uk.ac.vamsas.objects.utils.Properties;
+
+/**
+ * @author JimP
+ *
+ */
+public class Sequencefeature extends Rangetype
+{
+
+ uk.ac.vamsas.objects.core.DataSet dataset;
+
+ uk.ac.vamsas.objects.core.Sequence sequence;
+
+ private SequenceI dsSeq;
+
+ public Sequencefeature(VamsasAppDatastore vamsasAppDatastore,
+ SequenceFeature sequenceFeature,
+ uk.ac.vamsas.objects.core.DataSet dataset,
+ uk.ac.vamsas.objects.core.Sequence sequence)
+ {
+ super(vamsasAppDatastore, sequenceFeature, DataSetAnnotations.class);
+ this.dataset = dataset;
+ this.sequence = sequence;
+ doSync();
+ }
+
+ public Sequencefeature(VamsasAppDatastore vamsasAppDatastore,
+ DataSetAnnotations dseta, SequenceI dsSeq)
+ {
+ super(vamsasAppDatastore, dseta,
+ jalview.datamodel.SequenceFeature.class);
+ this.dsSeq = dsSeq;
+ doJvUpdate();
+ }
+
+ public void addToDocument()
+ {
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
+ dsa = (DataSetAnnotations) getDSAnnotationFromJalview(
+ new DataSetAnnotations(), feature);
+ if (dsa.getProvenance() == null)
+ {
+ dsa.setProvenance(new Provenance());
+ }
+ addProvenance(dsa.getProvenance(), "created"); // JBPNote - need
+ // to update
+ dsa.addSeqRef(sequence); // we have just created this annotation
+ // - so safe to use this
+ bindjvvobj(feature, dsa);
+ dataset.addDataSetAnnotations(dsa);
+ }
+
+ public void addFromDocument()
+ {
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ if (dsa.getSeqRefCount() != 1)
+ {
+ Cache.log
+ .warn("Not binding "
+ + dsa.getVorbaId()
+ + " to Sequence Feature - has multiple dataset sequence references.");
+ return;
+ }
+ jalview.datamodel.SequenceFeature sf = (jalview.datamodel.SequenceFeature) jvobj;
+ dsSeq.addSequenceFeature(sf = getJalviewSeqFeature(dsa));
+ jvobj = sf;
+ bindjvvobj(sf, dsa);
+ }
+
+ public void conflict()
+ {
+ log.warn("Untested sequencefeature conflict code");
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
+ jalview.datamodel.SequenceFeature sf = getJalviewSeqFeature(dsa);
+ replaceJvObjMapping(feature, sf); // switch binding of dsa from old feature
+ // to newly created feature
+ dsSeq.addSequenceFeature(sf); // add new imported feature
+ addToDocument(); // and create a new feature in the document
+ }
+
+ public void updateToDoc()
+ {
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
+ if (dsa.getSeqRefCount() != 1)
+ {
+ replaceJvObjMapping(feature, null);
+ Cache.log
+ .warn("Binding of annotation to jalview feature has changed. Removing binding and recreating.");
+ doSync(); // re-verify bindings.
+ }
+ else
+ {
+ // Sync the features from Jalview
+ long oldref = dsa.get__last_hash();
+ getDSAnnotationFromJalview(dsa, feature);
+ if (oldref != dsa.hashCode())
+ {
+ Cache.log
+ .debug("Updated dataset sequence annotation from feature.");
+ addProvenance(dsa.getProvenance(), "modified");
+ }
+ }
+
+ }
+
+ public void updateFromDoc()
+ {
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
+ if (dsa.getSeqRefCount() != 1)
+ {
+ // conflicting update from document - we cannot map this feature anymore.
+ replaceJvObjMapping(feature, null);
+ Cache.log
+ .warn("annotation ("
+ + dsa.getVorbaId()
+ + " bound to jalview feature cannot be mapped. Removing binding, deleting feature, and deleting feature.");
+ // - consider deleting the feature ?
+ dsSeq.deleteFeature(feature);
+ // doSync();
+ }
+ else
+ {
+ // Sync the features to Jalview - easiest to delete and add the feature
+ // again
+ jalview.datamodel.SequenceFeature newsf = getJalviewSeqFeature(dsa);
+ dsSeq.deleteFeature(feature);
+ replaceJvObjMapping(feature, newsf);
+ dsSeq.addSequenceFeature(newsf);
+ if (feature.otherDetails != null)
+ {
+ // TODO later: leave this to finalise method ?
+ feature.otherDetails.clear();
+ }
+ }
+ }
+
+ /**
+ * correctly create/update a RangeAnnotation from a jalview sequence feature
+ * TODO: refactor to a method in jalview.io.vamsas.RangeAnnotation class
+ *
+ * @param dsa
+ * (typically DataSetAnnotations or AlignmentSequenceAnnotation)
+ * @param feature
+ * (the feature to be mapped from)
+ * @return
+ */
+ private RangeAnnotation getDSAnnotationFromJalview(RangeAnnotation dsa,
+ jalview.datamodel.SequenceFeature feature)
+ {
+ dsa.setType(feature.getType());
+ Seg vSeg = new Seg();
+ vSeg.setStart(feature.getBegin());
+ vSeg.setEnd(feature.getEnd());
+ vSeg.setInclusive(true);
+ if (dsa.getSegCount() > 1)
+ {
+ Cache.log
+ .debug("About to destroy complex annotation in vamsas document mapped to sequence feature ("
+ + dsa.getVorbaId() + ")");
+ }
+ dsa.setSeg(new Seg[] { vSeg });
+ dsa.setDescription(feature.getDescription());
+ dsa.setStatus(feature.getStatus());
+ if (feature.links != null && feature.links.size() > 0)
+ {
+ for (int i = 0, iSize = feature.links.size(); i < iSize; i++)
+ {
+ String link = feature.links.elementAt(i);
+ UrlLink ulink = new UrlLink(link);
+ if (ulink.isValid())
+ {
+ // We only add static links to the document.
+ Link vLink = new Link();
+ vLink.setContent(ulink.getLabel());
+ vLink.setHref(ulink.getTarget());
+ dsa.addLink(vLink);
+ }
+ }
+ }
+ dsa.setGroup(feature.getFeatureGroup());
+ if (!Float.isNaN(feature.getScore()))
+ {
+ Score fscore = new Score();
+ dsa.setScore(new Score[] { fscore });
+ fscore.setContent(feature.getScore());
+ fscore.setName(feature.getType());
+ }
+ if (feature.otherDetails != null)
+ {
+ Enumeration iter = feature.otherDetails.keys();
+ Vector props = dsa.getPropertyAsReference();
+ while (iter.hasMoreElements())
+ {
+ String key = (String) iter.nextElement();
+ if (!key.equalsIgnoreCase("score")
+ && !key.equalsIgnoreCase("status"))
+ {
+ Property nprop = new Property();
+ nprop.setName(key);
+ Object vlu = feature.getValue(key);
+ nprop.setContent(feature.getValue(key).toString());
+ boolean valid = false;
+ if (vlu instanceof String)
+ {
+ nprop.setType(uk.ac.vamsas.objects.utils.Properties.STRINGTYPE);
+ valid = true;
+ }
+ else if (vlu instanceof Integer)
+ {
+ valid = true;
+ nprop.setType(uk.ac.vamsas.objects.utils.Properties.INTEGERTYPE);
+ }
+ else if (vlu instanceof Float)
+ {
+ nprop.setType(uk.ac.vamsas.objects.utils.Properties.FLOATTYPE);
+ valid = true;
+ }
+ if (valid)
+ {
+ if (props != null)
+ {
+ uk.ac.vamsas.objects.utils.Properties.addOrReplace(props,
+ nprop);
+ }
+ else
+ {
+ dsa.addProperty(nprop);
+ }
+ }
+ }
+ }
+ }
+ return dsa;
+ }
+
+ private SequenceFeature getJalviewSeqFeature(RangeAnnotation dseta)
+ {
+ int[] se = getBounds(dseta);
+ SequenceFeature sf = new jalview.datamodel.SequenceFeature(
+ dseta.getType(), dseta.getDescription(), dseta.getStatus(),
+ se[0], se[1], dseta.getGroup());
+ if (dseta.getLinkCount() > 0)
+ {
+ Link[] links = dseta.getLink();
+ for (int i = 0; i < links.length; i++)
+ {
+ // TODO: use URLLink parsing/validation here.
+ sf.addLink(links[i].getContent() + "|" + links[i].getHref());
+ }
+ }
+ if (dseta.getScoreCount() > 0)
+ {
+ Enumeration scr = dseta.enumerateScore();
+ while (scr.hasMoreElements())
+ {
+ Score score = (Score) scr.nextElement();
+ if (score.getName().equals(sf.getType()))
+ {
+ sf.setScore(score.getContent());
+ }
+ else
+ {
+ sf.setValue(score.getName(), "" + score.getContent());
+ }
+ }
+ }
+ // other details
+ Enumeration props = dseta.enumerateProperty();
+ while (props.hasMoreElements())
+ {
+ Property p = (Property) props.nextElement();
+ Object val = null;
+ if (Properties.isValid(p))
+ {
+ if (Properties.isString(p))
+ {
+ val = p.getContent();
+ }
+ if (Properties.isBoolean(p))
+ {
+ try
+ {
+ val = new Boolean(p.getContent());
+ } catch (Exception e)
+ {
+ }
+ }
+ if (Properties.isFloat(p))
+ {
+ try
+ {
+ val = new Float(p.getContent());
+
+ } catch (Exception e)
+ {
+ }
+ }
+ if (Properties.isInteger(p))
+ {
+ try
+ {
+ val = new Integer(p.getContent());
+ } catch (Exception e)
+ {
+ }
+ }
+ if (val != null)
+ {
+ sf.setValue(p.getName(), val);
+ }
+ }
+ }
+
+ return sf;
+ }
+
+}
diff --git a/src/jalview/io/vamsas/Sequencemapping.java b/src/jalview/io/vamsas/Sequencemapping.java
index 2174553..6dbbd6c 100644
--- a/src/jalview/io/vamsas/Sequencemapping.java
+++ b/src/jalview/io/vamsas/Sequencemapping.java
@@ -1,35 +1,36 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io.vamsas;
-import java.util.Vector;
-
import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.Mapping;
import jalview.datamodel.SequenceI;
import jalview.gui.Desktop;
import jalview.io.VamsasAppDatastore;
-import uk.ac.vamsas.client.Vobject;
+
+import java.util.Vector;
+
import uk.ac.vamsas.objects.core.AlignmentSequence;
import uk.ac.vamsas.objects.core.DataSet;
-import uk.ac.vamsas.objects.core.Local;
-import uk.ac.vamsas.objects.core.RangeType;
-import uk.ac.vamsas.objects.core.Seg;
import uk.ac.vamsas.objects.core.Sequence;
import uk.ac.vamsas.objects.core.SequenceMapping;
import uk.ac.vamsas.objects.core.SequenceType;
@@ -283,12 +284,12 @@ public class Sequencemapping extends Rangetype
jalview.bin.Cache.log.info("Ignoring non sequence-sequence mapping");
return;
}
- mobj = this.getvObj2jv((Vobject) sdloc);
+ mobj = this.getvObj2jv(sdloc);
if (mobj instanceof SequenceI)
{
from = (SequenceI) mobj;
}
- mobj = this.getvObj2jv((Vobject) sdmap);
+ mobj = this.getvObj2jv(sdmap);
if (mobj instanceof SequenceI)
{
to = (SequenceI) mobj;
@@ -325,19 +326,17 @@ public class Sequencemapping extends Rangetype
}
// create mapping storage object and make each dataset alignment reference
// it.
- jalview.datamodel.AlignmentI dsLoc = (jalview.datamodel.AlignmentI) getvObj2jv(sdloc
- .getV_parent());
- jalview.datamodel.AlignmentI dsMap = (jalview.datamodel.AlignmentI) getvObj2jv(sdmap
- .getV_parent());
- AlignedCodonFrame afc = new AlignedCodonFrame(0);
+ AlignmentI dsLoc = (AlignmentI) getvObj2jv(sdloc.getV_parent());
+ AlignmentI dsMap = (AlignmentI) getvObj2jv(sdmap.getV_parent());
+ AlignedCodonFrame acf = new AlignedCodonFrame();
if (dsLoc != null && dsLoc != dsMap)
{
- dsLoc.addCodonFrame(afc);
+ dsLoc.addCodonFrame(acf);
}
if (dsMap != null)
{
- dsMap.addCodonFrame(afc);
+ dsMap.addCodonFrame(acf);
}
// create and add the new mapping to (each) dataset's codonFrame
@@ -350,24 +349,23 @@ public class Sequencemapping extends Rangetype
mapping = new jalview.util.MapList(mapping.getToRanges(),
mapping.getFromRanges(), mapping.getToRatio(),
mapping.getFromRatio());
- afc.addMap(to, from, mapping);
+ acf.addMap(to, from, mapping);
}
else
{
mapping = this.parsemapType(sequenceMapping, 3, 1); // correct sense
- afc.addMap(from, to, mapping);
+ acf.addMap(from, to, mapping);
}
}
else
{
mapping = this.parsemapType(sequenceMapping, 1, 1); // correct sense
- afc.addMap(from, to, mapping);
+ acf.addMap(from, to, mapping);
}
bindjvvobj(mapping, sequenceMapping);
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance).addMappings(
- new AlignedCodonFrame[]
- { afc });
+ .getStructureSelectionManager(Desktop.instance)
+ .registerMapping(acf);
// Try to link up any conjugate database references in the two sequences
// matchConjugateDBRefs(from, to, mapping);
// Try to propagate any dbrefs across this mapping.
diff --git a/src/jalview/io/vamsas/Tree.java b/src/jalview/io/vamsas/Tree.java
index eab51f0..4d232ee 100644
--- a/src/jalview/io/vamsas/Tree.java
+++ b/src/jalview/io/vamsas/Tree.java
@@ -1,29 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io.vamsas;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
import jalview.analysis.NJTree;
-import jalview.analysis.SequenceIdMatcher;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
@@ -32,11 +29,17 @@ import jalview.datamodel.SeqCigar;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
import jalview.datamodel.SequenceNode;
-import jalview.gui.AlignFrame;
-import jalview.gui.AlignViewport;
import jalview.gui.TreePanel;
import jalview.io.NewickFile;
import jalview.io.VamsasAppDatastore;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
import uk.ac.vamsas.client.Vobject;
import uk.ac.vamsas.objects.core.AlignmentSequence;
import uk.ac.vamsas.objects.core.Entry;
@@ -103,6 +106,7 @@ public class Tree extends DatastoreItem
*
* @see jalview.io.vamsas.DatastoreItem#addFromDocument()
*/
+ @Override
public void addFromDocument()
{
tree = (uk.ac.vamsas.objects.core.Tree) vobj; // vtree;
@@ -133,6 +137,7 @@ public class Tree extends DatastoreItem
*
* @see jalview.io.vamsas.DatastoreItem#conflict()
*/
+ @Override
public void conflict()
{
Cache.log
@@ -144,6 +149,7 @@ public class Tree extends DatastoreItem
*
* @see jalview.io.vamsas.DatastoreItem#update()
*/
+ @Override
public void updateToDoc()
{
if (isModifiable(tree.getModifiable()))
@@ -164,6 +170,7 @@ public class Tree extends DatastoreItem
*
* @see jalview.io.vamsas.DatastoreItem#updateFromDoc()
*/
+ @Override
public void updateFromDoc()
{
// should probably just open a new tree panel in the same place as the old
@@ -264,20 +271,22 @@ public class Tree extends DatastoreItem
SeqCigar[] tseqs = new SeqCigar[sequences.length];
System.arraycopy(sequences, 0, tseqs, 0, sequences.length);
Vector alsq = new Vector();
- Enumeration as = jal.getSequences().elements();
- while (as.hasMoreElements())
+ List<SequenceI> jalsqs;
+ synchronized (jalsqs = jal.getSequences())
{
- SequenceI asq = (SequenceI) as.nextElement();
- for (int t = 0; t < sequences.length; t++)
+ for (SequenceI asq : jalsqs)
{
- if (tseqs[t] != null
- && (tseqs[t].getRefSeq() == asq || tseqs[t].getRefSeq() == asq
- .getDatasetSequence()))
- // && tseqs[t].getStart()>=asq.getStart() &&
- // tseqs[t].getEnd()<=asq.getEnd())
+ for (int t = 0; t < sequences.length; t++)
{
- tseqs[t] = null;
- alsq.add(asq);
+ if (tseqs[t] != null
+ && (tseqs[t].getRefSeq() == asq || tseqs[t].getRefSeq() == asq
+ .getDatasetSequence()))
+ // && tseqs[t].getStart()>=asq.getStart() &&
+ // tseqs[t].getEnd()<=asq.getEnd())
+ {
+ tseqs[t] = null;
+ alsq.add(asq);
+ }
}
}
}
@@ -413,8 +422,7 @@ public class Tree extends DatastoreItem
tnv.copyInto(tn);
return tn;
}
- return new Treenode[]
- {};
+ return new Treenode[] {};
}
private String makeNodeSpec(Hashtable nodespecs,
@@ -475,6 +483,7 @@ public class Tree extends DatastoreItem
* add jalview object to vamsas document
*
*/
+ @Override
public void addToDocument()
{
tree = new uk.ac.vamsas.objects.core.Tree();
@@ -501,7 +510,7 @@ public class Tree extends DatastoreItem
*/
public Object[] recoverInputData(Provenance tp)
{
- AlignViewport javport = null;
+ AlignmentViewport javport = null;
jalview.datamodel.AlignmentI jal = null;
jalview.datamodel.CigarArray view = null;
for (int pe = 0; pe < tp.getEntryCount(); pe++)
@@ -586,8 +595,7 @@ public class Tree extends DatastoreItem
// off by
// one for to
}
- return new Object[]
- { new AlignmentView(view), jal };
+ return new Object[] { new AlignmentView(view), jal };
}
}
Cache.log
@@ -595,7 +603,7 @@ public class Tree extends DatastoreItem
return null;
}
- private AlignViewport getViewport(Vobject v_parent)
+ private AlignmentViewport getViewport(Vobject v_parent)
{
if (v_parent instanceof uk.ac.vamsas.objects.core.Alignment)
{
diff --git a/src/jalview/javascript/JSFunctionExec.java b/src/jalview/javascript/JSFunctionExec.java
index 93b35e5..6202cba 100644
--- a/src/jalview/javascript/JSFunctionExec.java
+++ b/src/jalview/javascript/JSFunctionExec.java
@@ -1,273 +1,281 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package jalview.javascript;
-
-import java.net.URL;
-import java.util.Vector;
-
-import netscape.javascript.JSException;
-import netscape.javascript.JSObject;
-import jalview.bin.JalviewLite;
-
-public class JSFunctionExec implements Runnable
-{
- public JalviewLite jvlite;
-
- public JSFunctionExec(JalviewLite applet)
- {
- jvlite = applet;
-
- jsExecQueue = jvlite.getJsExecQueue();
- jvlite.setExecutor(this);
- }
- public void finalize() {
- jvlite=null;
- executor=null;
- if (jsExecQueue!=null)
- {
- jsExecQueue.clear();
- }
- jsExecQueue=null;
- }
- private Vector jsExecQueue;
-
- private Thread executor = null;
-
- public void stopQueue()
- {
- if (jsExecQueue != null)
- {
- Vector<JSFunctionExec> q=null;
- synchronized (jsExecQueue)
- {
- q = jsExecQueue;
- jsExecQueue = null;
- }
- if (q!=null ) {
- for (JSFunctionExec jx : q)
- {
- jx.jvlite=null;
-
- }
- q.removeAllElements();
- synchronized (q)
- {
- q.notifyAll();
- }
- }
- }
- jvlite=null;
- executor = null;
- }
-
- public void run()
- {
- while (jsExecQueue != null)
- {
- if (jsExecQueue.size() > 0)
- {
- Runnable r = (Runnable) jsExecQueue.elementAt(0);
- jsExecQueue.removeElementAt(0);
- try
- {
- r.run();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- } catch (Error ex)
- {
- ex.printStackTrace();
- }
- }
- else
- {
- try
- {
- synchronized (jsExecQueue)
- {
- jsExecQueue.wait(1000);
- }
- } catch (Exception ex)
- {
- }
- ;
- }
- }
-
- }
-
- /**
- * execute a javascript callback synchronously
- *
- * @param _listener
- * @param objects
- * @throws Exception
- */
- public void executeJavascriptFunction(final String _listener,
- final Object[] objects) throws Exception
- {
- executeJavascriptFunction(false, _listener, objects);
- }
-
- /**
- * execute a javascript callback synchronously or asynchronously
- *
- * @param async
- * - true to execute asynchronously (do this for gui events)
- * @param _listener
- * - javascript function
- * @param objects
- * - arguments
- * @throws Exception
- * - only if call is synchronous
- */
- public void executeJavascriptFunction(final boolean async,
- final String _listener, Object[] arguments) throws Exception
- {
-
- executeJavascriptFunction(async, _listener, arguments, null);
-
- }
-
- public void executeJavascriptFunction(final boolean async,
- final String _listener, Object[] arguments, final String dbgMsg)
- throws Exception
- {
- final Object[] objects = new Object[arguments != null ? arguments.length
- : 0];
- if (arguments != null)
- {
- System.arraycopy(arguments, 0, objects, 0, arguments.length);
- }
- final Exception[] jsex = new Exception[1];
- Runnable exec = new Runnable()
- {
- public void run()
- {
- try
- {
- JSObject scriptObject = null;
- try
- {
- scriptObject = JSObject.getWindow(jvlite);
- } catch (Exception ex)
- {
- }
- ;
- if (scriptObject != null)
- {
- if (jvlite.debug && dbgMsg != null)
- {
- System.err.println(dbgMsg);
- }
- scriptObject.call(_listener, objects);
- }
- } catch (Exception jex)
- {
- // squash any malformedURLExceptions thrown by windows/safari
- if (!(jex instanceof java.net.MalformedURLException))
- {
- if (jvlite.debug)
- {
- System.err.println(jex);
- }
- if (jex instanceof netscape.javascript.JSException && jvlite.jsfallbackEnabled)
- {
- jsex[0] = (netscape.javascript.JSException) jex;
- if (jvlite.debug)
- {
- System.err.println("Falling back to javascript: url call");
- }
- StringBuffer sb = new StringBuffer("javascript:" + _listener
- + "(");
- for (int i = 0; objects != null && i < objects.length; i++)
- {
- if (i > 0)
- {
- sb.append(",");
- }
- sb.append("\"");
- // strip out nulls and complex objects that we can't pass this
- // way.
- if (objects[i] != null
- && !(objects[i].getClass().getName()
- .indexOf("jalview") == 0))
- {
- sb.append(objects[i].toString());
- }
- sb.append("\"");
- }
- sb.append(")");
- if (jvlite.debug)
- {
- System.err.println(sb.toString());
- }
- // alternate
- URL url = null;
- try
- {
- url = new URL(sb.toString());
- jvlite.getAppletContext().showDocument(url);
- jex = null;
- } catch (Exception uex)
- {
- jex = uex;
- }
- }
- if (jex != null)
- {
- if (async)
- {
- jex.printStackTrace();
- }
- else
- {
- jsex[0] = jex;
- }
- }
- ;
- }
-
- }
- }
- };
- if (async)
- {
- if (executor == null)
- {
- executor = new Thread(new JSFunctionExec(jvlite));
- executor.start();
- }
- synchronized (jsExecQueue)
- {
- jsExecQueue.addElement(exec);
- jsExecQueue.notify();
- }
- }
- else
- {
- // wat for executor to notify us if it's running.
- exec.run();
- if (jsex[0] != null)
- {
- throw (jsex[0]);
- }
- }
- }
-
-}
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.javascript;
+
+import jalview.bin.JalviewLite;
+
+import java.net.URL;
+import java.util.Vector;
+
+import netscape.javascript.JSObject;
+
+public class JSFunctionExec implements Runnable
+{
+ public JalviewLite jvlite;
+
+ public JSFunctionExec(JalviewLite applet)
+ {
+ jvlite = applet;
+
+ jsExecQueue = jvlite.getJsExecQueue();
+ jvlite.setExecutor(this);
+ }
+
+ public void finalize()
+ {
+ jvlite = null;
+ executor = null;
+ if (jsExecQueue != null)
+ {
+ jsExecQueue.clear();
+ }
+ jsExecQueue = null;
+ }
+
+ private Vector jsExecQueue;
+
+ private Thread executor = null;
+
+ public void stopQueue()
+ {
+ if (jsExecQueue != null)
+ {
+ Vector<JSFunctionExec> q = null;
+ synchronized (jsExecQueue)
+ {
+ q = jsExecQueue;
+ jsExecQueue = null;
+ }
+ if (q != null)
+ {
+ for (JSFunctionExec jx : q)
+ {
+ jx.jvlite = null;
+
+ }
+ q.removeAllElements();
+ synchronized (q)
+ {
+ q.notifyAll();
+ }
+ }
+ }
+ jvlite = null;
+ executor = null;
+ }
+
+ public void run()
+ {
+ while (jsExecQueue != null)
+ {
+ if (jsExecQueue.size() > 0)
+ {
+ Runnable r = (Runnable) jsExecQueue.elementAt(0);
+ jsExecQueue.removeElementAt(0);
+ try
+ {
+ r.run();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } catch (Error ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ else
+ {
+ try
+ {
+ synchronized (jsExecQueue)
+ {
+ jsExecQueue.wait(1000);
+ }
+ } catch (Exception ex)
+ {
+ }
+ ;
+ }
+ }
+
+ }
+
+ /**
+ * execute a javascript callback synchronously
+ *
+ * @param _listener
+ * @param objects
+ * @throws Exception
+ */
+ public void executeJavascriptFunction(final String _listener,
+ final Object[] objects) throws Exception
+ {
+ executeJavascriptFunction(false, _listener, objects);
+ }
+
+ /**
+ * execute a javascript callback synchronously or asynchronously
+ *
+ * @param async
+ * - true to execute asynchronously (do this for gui events)
+ * @param _listener
+ * - javascript function
+ * @param objects
+ * - arguments
+ * @throws Exception
+ * - only if call is synchronous
+ */
+ public void executeJavascriptFunction(final boolean async,
+ final String _listener, Object[] arguments) throws Exception
+ {
+
+ executeJavascriptFunction(async, _listener, arguments, null);
+
+ }
+
+ public void executeJavascriptFunction(final boolean async,
+ final String _listener, Object[] arguments, final String dbgMsg)
+ throws Exception
+ {
+ final Object[] objects = new Object[arguments != null ? arguments.length
+ : 0];
+ if (arguments != null)
+ {
+ System.arraycopy(arguments, 0, objects, 0, arguments.length);
+ }
+ final Exception[] jsex = new Exception[1];
+ Runnable exec = new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ JSObject scriptObject = null;
+ try
+ {
+ scriptObject = JSObject.getWindow(jvlite);
+ } catch (Exception ex)
+ {
+ }
+ ;
+ if (scriptObject != null)
+ {
+ if (jvlite.debug && dbgMsg != null)
+ {
+ System.err.println(dbgMsg);
+ }
+ scriptObject.call(_listener, objects);
+ }
+ } catch (Exception jex)
+ {
+ // squash any malformedURLExceptions thrown by windows/safari
+ if (!(jex instanceof java.net.MalformedURLException))
+ {
+ if (jvlite.debug)
+ {
+ System.err.println(jex);
+ }
+ if (jex instanceof netscape.javascript.JSException
+ && jvlite.jsfallbackEnabled)
+ {
+ jsex[0] = (netscape.javascript.JSException) jex;
+ if (jvlite.debug)
+ {
+ System.err.println("Falling back to javascript: url call");
+ }
+ StringBuffer sb = new StringBuffer("javascript:" + _listener
+ + "(");
+ for (int i = 0; objects != null && i < objects.length; i++)
+ {
+ if (i > 0)
+ {
+ sb.append(",");
+ }
+ sb.append("\"");
+ // strip out nulls and complex objects that we can't pass this
+ // way.
+ if (objects[i] != null
+ && !(objects[i].getClass().getName()
+ .indexOf("jalview") == 0))
+ {
+ sb.append(objects[i].toString());
+ }
+ sb.append("\"");
+ }
+ sb.append(")");
+ if (jvlite.debug)
+ {
+ System.err.println(sb.toString());
+ }
+ // alternate
+ URL url = null;
+ try
+ {
+ url = new URL(sb.toString());
+ jvlite.getAppletContext().showDocument(url);
+ jex = null;
+ } catch (Exception uex)
+ {
+ jex = uex;
+ }
+ }
+ if (jex != null)
+ {
+ if (async)
+ {
+ jex.printStackTrace();
+ }
+ else
+ {
+ jsex[0] = jex;
+ }
+ }
+ ;
+ }
+
+ }
+ }
+ };
+ if (async)
+ {
+ if (executor == null)
+ {
+ executor = new Thread(new JSFunctionExec(jvlite));
+ executor.start();
+ }
+ synchronized (jsExecQueue)
+ {
+ jsExecQueue.addElement(exec);
+ jsExecQueue.notify();
+ }
+ }
+ else
+ {
+ // wat for executor to notify us if it's running.
+ exec.run();
+ if (jsex[0] != null)
+ {
+ throw (jsex[0]);
+ }
+ }
+ }
+
+}
diff --git a/src/jalview/javascript/JalviewLiteJsApi.java b/src/jalview/javascript/JalviewLiteJsApi.java
index 103e7da..1de9303 100644
--- a/src/jalview/javascript/JalviewLiteJsApi.java
+++ b/src/jalview/javascript/JalviewLiteJsApi.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.javascript;
import jalview.appletgui.AlignFrame;
@@ -32,7 +35,7 @@ import jalview.appletgui.AlignFrame;
/**
* @author jimp
- *
+ *
*/
public interface JalviewLiteJsApi
{
@@ -176,31 +179,42 @@ public interface JalviewLiteJsApi
AlignFrame alf, String format, String suffix);
/**
- * get a separator separated list of sequence IDs reflecting the order of the current alignment
+ * get a separator separated list of sequence IDs reflecting the order of the
+ * current alignment
+ *
* @return
*/
public abstract String getAlignmentOrder();
+
/**
- * get a separator separated list of sequence IDs reflecting the order of the alignment in alf
- *
+ * get a separator separated list of sequence IDs reflecting the order of the
+ * alignment in alf
+ *
* @param alf
* @return
*/
public abstract String getAlignmentOrderFrom(AlignFrame alf);
/**
- * get a sep separated list of sequence IDs reflecting the order of the alignment in alf
+ * get a sep separated list of sequence IDs reflecting the order of the
+ * alignment in alf
*
* @param alf
- * @param sep - separator to use
+ * @param sep
+ * - separator to use
* @return
*/
public abstract String getAlignmentOrderFrom(AlignFrame alf, String sep);
+
/**
* re-order the current alignment using the given list of sequence IDs
- * @param order - sep separated list
- * @param undoName - string to use when referring to ordering action in undo buffer
- * @return 'true' if alignment was actually reordered. empty string if alignment did not contain sequences.
+ *
+ * @param order
+ * - sep separated list
+ * @param undoName
+ * - string to use when referring to ordering action in undo buffer
+ * @return 'true' if alignment was actually reordered. empty string if
+ * alignment did not contain sequences.
*/
public abstract String orderBy(String order, String undoName);
@@ -213,13 +227,14 @@ public interface JalviewLiteJsApi
* @param undoName
* - string to use when referring to ordering action in undo buffer
* @param sep
- * @return 'true' if alignment was actually reordered. empty string if alignment did not contain sequences.
+ * @return 'true' if alignment was actually reordered. empty string if
+ * alignment did not contain sequences.
*/
public abstract String orderBy(String order, String undoName, String sep);
/**
- * re-order the given alignment using the given list of sequence IDs
- * separated by sep
+ * re-order the given alignment using the given list of sequence IDs separated
+ * by sep
*
* @param alf
* @param order
@@ -227,13 +242,16 @@ public interface JalviewLiteJsApi
* @param undoName
* - string to use when referring to ordering action in undo buffer
* @param sep
- * @return 'true' if alignment was actually reordered. empty string if alignment did not contain sequences.
+ * @return 'true' if alignment was actually reordered. empty string if
+ * alignment did not contain sequences.
*/
public abstract String orderAlignmentBy(AlignFrame alf, String order,
String undoName, String sep);
/**
- * get alignment as format (format names FASTA, BLC, CLUSTAL, MSF, PILEUP, PFAM - see jalview.io.AppletFormatAdapter for full list)
+ * get alignment as format (format names FASTA, BLC, CLUSTAL, MSF, PILEUP,
+ * PFAM - see jalview.io.AppletFormatAdapter for full list)
+ *
* @param format
* @return
*/
@@ -241,6 +259,7 @@ public interface JalviewLiteJsApi
/**
* get alignment displayed in alf as format
+ *
* @param alf
* @param format
* @return
@@ -249,6 +268,7 @@ public interface JalviewLiteJsApi
/**
* get alignment as format with jalview start-end sequence suffix appended
+ *
* @param format
* @param suffix
* @return
@@ -256,8 +276,9 @@ public interface JalviewLiteJsApi
public abstract String getAlignment(String format, String suffix);
/**
- * get alignment displayed in alf as format
- * with or without the jalview start-end sequence suffix appended
+ * get alignment displayed in alf as format with or without the jalview
+ * start-end sequence suffix appended
+ *
* @param alf
* @param format
* @param suffix
@@ -268,19 +289,50 @@ public interface JalviewLiteJsApi
/**
* add the given features or annotation to the current alignment
+ *
* @param annotation
*/
public abstract void loadAnnotation(String annotation);
/**
* add the given features or annotation to the given alignment view
+ *
* @param alf
* @param annotation
*/
public abstract void loadAnnotationFrom(AlignFrame alf, String annotation);
/**
+ * parse the given string as a jalview feature or GFF annotation file and
+ * optionally enable feature display on the current alignFrame
+ *
+ * @param features
+ * - gff or features file
+ * @param autoenabledisplay
+ * - when true, feature display will be enabled if any features can
+ * be parsed from the string.
+ */
+ public abstract void loadFeatures(String features,
+ boolean autoenabledisplay);
+
+ /**
+ * parse the given string as a jalview feature or GFF annotation file and
+ * optionally enable feature display on the given alignFrame.
+ *
+ * @param alf
+ * @param features
+ * - gff or features file
+ * @param autoenabledisplay
+ * - when true, feature display will be enabled if any features can
+ * be parsed from the string.
+ * @return true if data parsed as features
+ */
+ public abstract boolean loadFeaturesFrom(AlignFrame alf, String features,
+ boolean autoenabledisplay);
+
+ /**
* get the sequence features in the given format (Jalview or GFF)
+ *
* @param format
* @return
*/
@@ -288,6 +340,7 @@ public interface JalviewLiteJsApi
/**
* get the sequence features in alf in the given format (Jalview or GFF)
+ *
* @param alf
* @param format
* @return
@@ -296,12 +349,14 @@ public interface JalviewLiteJsApi
/**
* get current alignment's annotation as an annotation file
+ *
* @return
*/
public abstract String getAnnotation();
/**
* get alignment view alf's annotation as an annotation file
+ *
* @param alf
* @return
*/
@@ -309,12 +364,14 @@ public interface JalviewLiteJsApi
/**
* create a new view and return the alignFrame instance
+ *
* @return
*/
public abstract AlignFrame newView();
/**
* create a new view named name and return the alignFrame instance
+ *
* @param name
* @return
*/
@@ -322,6 +379,7 @@ public interface JalviewLiteJsApi
/**
* create a new view on alf and return the alignFrame instance
+ *
* @param alf
* @return
*/
@@ -329,6 +387,7 @@ public interface JalviewLiteJsApi
/**
* create a new view named name on alf
+ *
* @param alf
* @param name
* @return
@@ -347,30 +406,53 @@ public interface JalviewLiteJsApi
/**
* register a javascript function to handle any alignment mouseover events
- * @param listener name of javascript function (called with arguments [jalview.appletgui.AlignFrame,String(sequence id),String(column in alignment), String(position in sequence)]
+ *
+ * @param listener
+ * name of javascript function (called with arguments
+ * [jalview.appletgui.AlignFrame,String(sequence id),String(column in
+ * alignment), String(position in sequence)]
*/
public abstract void setMouseoverListener(String listener);
/**
* register a javascript function to handle mouseover events
- * @param af (null or specific alignframe for which events are to be listened for)
- * @param listener name of javascript function
+ *
+ * @param af
+ * (null or specific alignframe for which events are to be listened
+ * for)
+ * @param listener
+ * name of javascript function
*/
public abstract void setMouseoverListener(AlignFrame af, String listener);
/**
- * register a javascript function to handle any alignment selection events. Events are generated when the user completes a selection event, or when the user deselects all selected regions.
- * @param listener name of javascript function (called with arguments [jalview.appletgui.AlignFrame, String(sequence set id), String(separator separated list of sequences which were selected), String(separator separated list of column ranges (i.e. single number or hyphenated range) that were selected)]
+ * register a javascript function to handle any alignment selection events.
+ * Events are generated when the user completes a selection event, or when the
+ * user deselects all selected regions.
+ *
+ * @param listener
+ * name of javascript function (called with arguments
+ * [jalview.appletgui.AlignFrame, String(sequence set id),
+ * String(separator separated list of sequences which were selected),
+ * String(separator separated list of column ranges (i.e. single
+ * number or hyphenated range) that were selected)]
*/
public abstract void setSelectionListener(String listener);
public abstract void setSelectionListener(AlignFrame af, String listener);
/**
- * register a javascript function to handle events normally routed to a Jmol structure viewer.
- * @param listener - javascript function (arguments are variable, see jalview.javascript.MouseOverStructureListener for full details)
- * @param modelSet - separator separated list of PDB file URIs that this viewer is handling. These files must be in the same order they appear in Jmol (e.g. first one is frame 1, second is frame 2, etc).
- @see jalview.javascript.MouseOverStructureListener
+ * register a javascript function to handle events normally routed to a Jmol
+ * structure viewer.
+ *
+ * @param listener
+ * - javascript function (arguments are variable, see
+ * jalview.javascript.MouseOverStructureListener for full details)
+ * @param modelSet
+ * - separator separated list of PDB file URIs that this viewer is
+ * handling. These files must be in the same order they appear in
+ * Jmol (e.g. first one is frame 1, second is frame 2, etc).
+ * @see jalview.javascript.MouseOverStructureListener
*/
public abstract void setStructureListener(String listener, String modelSet);
@@ -417,7 +499,8 @@ public interface JalviewLiteJsApi
String pdbEntryString, String pdbFile);
/**
- * adjust horizontal/vertical scroll to make the given location the top left hand corner for the given view
+ * adjust horizontal/vertical scroll to make the given location the top left
+ * hand corner for the given view
*
* @param alf
* @param topRow
@@ -425,6 +508,7 @@ public interface JalviewLiteJsApi
*/
public abstract void scrollViewToIn(AlignFrame alf, String topRow,
String leftHandColumn);
+
/**
* adjust vertical scroll to make the given row the top one for given view
*
@@ -432,13 +516,16 @@ public interface JalviewLiteJsApi
* @param topRow
*/
public abstract void scrollViewToRowIn(AlignFrame alf, String topRow);
+
/**
- * adjust horizontal scroll to make the given column the left one in the given view
+ * adjust horizontal scroll to make the given column the left one in the given
+ * view
*
* @param alf
* @param leftHandColumn
*/
- public abstract void scrollViewToColumnIn(AlignFrame alf, String leftHandColumn);
+ public abstract void scrollViewToColumnIn(AlignFrame alf,
+ String leftHandColumn);
/**
*
@@ -502,10 +589,11 @@ public interface JalviewLiteJsApi
/**
* Retrieve fragments of a large packet of data made available by JalviewLite.
+ *
* @param messageclass
* @param viewId
* @return next chunk of message
*/
public abstract String getJsMessage(String messageclass, String viewId);
-}
\ No newline at end of file
+}
diff --git a/src/jalview/javascript/JsCallBack.java b/src/jalview/javascript/JsCallBack.java
index b069dee..505f80d 100644
--- a/src/jalview/javascript/JsCallBack.java
+++ b/src/jalview/javascript/JsCallBack.java
@@ -1,25 +1,29 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.javascript;
public interface JsCallBack
{
public jalview.appletgui.AlignFrame getAlignFrame();
+
public String getListenerFunction();
-
+
}
diff --git a/src/jalview/javascript/JsSelectionSender.java b/src/jalview/javascript/JsSelectionSender.java
index 93731a9..cc293b1 100644
--- a/src/jalview/javascript/JsSelectionSender.java
+++ b/src/jalview/javascript/JsSelectionSender.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.javascript;
-import java.net.URL;
import jalview.appletgui.AlignFrame;
-import jalview.appletgui.AlignViewport;
import jalview.bin.JalviewLite;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SequenceGroup;
import jalview.structure.SelectionSource;
-import netscape.javascript.JSObject;
public class JsSelectionSender extends JSFunctionExec implements
jalview.structure.SelectionListener, JsCallBack
@@ -62,10 +62,8 @@ public class JsSelectionSender extends JSFunctionExec implements
}
}
- String[] seqs = new String[]
- {};
- String[] cols = new String[]
- {};
+ String[] seqs = new String[] {};
+ String[] cols = new String[] {};
int strt = 0, end = (src == null) ? -1 : src.alignPanel.av
.getAlignment().getWidth();
if (seqsel != null && seqsel.getSize() > 0)
@@ -79,7 +77,7 @@ public class JsSelectionSender extends JSFunctionExec implements
{
strt = seqsel.getStartRes();
}
- if (end==-1 || end > seqsel.getEndRes())
+ if (end == -1 || end > seqsel.getEndRes())
{
end = seqsel.getEndRes();
}
@@ -111,10 +109,9 @@ public class JsSelectionSender extends JSFunctionExec implements
}
System.err.println("Relaying selection to jsfunction:" + _listener);
- executeJavascriptFunction( _listener,
- new Object[]
- { src, setid, jvlite.arrayToSeparatorList(seqs),
- jvlite.arrayToSeparatorList(cols) });
+ executeJavascriptFunction(_listener,
+ new Object[] { src, setid, jvlite.arrayToSeparatorList(seqs),
+ jvlite.arrayToSeparatorList(cols) });
} catch (Exception ex)
{
System.err
@@ -131,7 +128,6 @@ public class JsSelectionSender extends JSFunctionExec implements
}
}
-
@Override
public AlignFrame getAlignFrame()
{
diff --git a/src/jalview/javascript/MouseOverListener.java b/src/jalview/javascript/MouseOverListener.java
index f6742b7..26d582e 100644
--- a/src/jalview/javascript/MouseOverListener.java
+++ b/src/jalview/javascript/MouseOverListener.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.javascript;
-import java.util.Vector;
-
import jalview.appletgui.AlignFrame;
import jalview.bin.JalviewLite;
import jalview.datamodel.SequenceI;
import jalview.structure.VamsasListener;
import jalview.structure.VamsasSource;
-import netscape.javascript.JSObject;
public class MouseOverListener extends JSFunctionExec implements
VamsasListener, JsCallBack
@@ -37,7 +37,9 @@ public class MouseOverListener extends JSFunctionExec implements
int i = -1;
- public void mouseOver(SequenceI seq, int index, VamsasSource source)
+ @Override
+ public void mouseOverSequence(SequenceI seq, int index,
+ VamsasSource source)
{
if (seq != last || i != index)
{
@@ -58,10 +60,13 @@ public class MouseOverListener extends JSFunctionExec implements
src = ((jalview.appletgui.AlignViewport) source).applet.currentAlignFrame;
}
- // TODO: ensure that if '_af' is specified along with a handler function, then only events from that alignFrame are sent to that function
+ // TODO: ensure that if '_af' is specified along with a handler
+ // function, then only events from that alignFrame are sent to that
+ // function
}
- executeJavascriptFunction(_listener, new Object[]
- { src, seq.getDisplayId(false), "" + (1 + i), ""+seq.findPosition(i) });
+ executeJavascriptFunction(_listener,
+ new Object[] { src, seq.getDisplayId(false), "" + (1 + i),
+ "" + seq.findPosition(i) });
} catch (Exception ex)
{
diff --git a/src/jalview/javascript/MouseOverStructureListener.java b/src/jalview/javascript/MouseOverStructureListener.java
index fbb179f..78f383a 100644
--- a/src/jalview/javascript/MouseOverStructureListener.java
+++ b/src/jalview/javascript/MouseOverStructureListener.java
@@ -1,322 +1,324 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package jalview.javascript;
-
-import java.awt.Color;
-import java.util.ArrayList;
-
-import jalview.api.AlignmentViewPanel;
-import jalview.api.FeatureRenderer;
-import jalview.api.SequenceRenderer;
-import jalview.appletgui.AlignFrame;
-import jalview.bin.JalviewLite;
-import jalview.datamodel.SequenceI;
-import jalview.ext.jmol.JmolCommands;
-import jalview.structure.StructureListener;
-import jalview.structure.StructureMapping;
-import jalview.structure.StructureMappingcommandSet;
-import jalview.structure.StructureSelectionManager;
-
-/**
- * Propagate events involving PDB structures associated with sequences to a
- * javascript function. Generally, the javascript handler is called with a
- * series of arguments like (eventname, ... ). As of Jalview 2.7, the following
- * different types of events are supported:
- * <ul>
- * <li>mouseover: javascript function called with arguments <pre>
- * ['mouseover',String(pdb file URI), String(pdb file chain ID), String(residue
- * number moused over), String(atom index corresponding to residue)]</pre></li>
- * <li>colourstruct: javascript function called with arguments <pre>
- * ['colourstruct',String(alignment view id),String(number of javascript message
- * chunks to collect),String(length of first chunk in set of messages - or zero
- * for null message)]</pre><br>
- * The message contains a series of Jmol script commands that will colour
- * structures according to their associated sequences in the current view. Use
- * jalview
- * .javascript.JalviewLiteJsApi.getJsMessage('colourstruct',String(alignment
- * view id)) to retrieve successive chunks of the message.</li>
- * </ul>
- *
- * @author Jim Procter (jprocter)
- *
- */
-public class MouseOverStructureListener extends JSFunctionExec implements
- JsCallBack, StructureListener
-{
-
- String _listenerfn;
-
- String[] modelSet;
-
- public MouseOverStructureListener(JalviewLite jalviewLite,
- String listener, String[] modelList)
- {
- super(jalviewLite);
- _listenerfn = listener;
- modelSet = modelList;
- if (modelSet != null)
- {
- for (int i = 0; i < modelSet.length; i++)
- {
- // resolve a real filename
- try
- {
- if (new java.net.URL(modelSet[i]).openConnection() != null)
- {
- continue;
- }
- } catch (Exception x)
- {
- }
- ;
- try
- {
- String db = jvlite.getDocumentBase().toString();
- db = db.substring(0, db.lastIndexOf("/"));
- if (new java.net.URL(db + "/" + modelSet[i]).openConnection() != null)
- {
- modelSet[i] = db + "/" + modelSet[i];
- continue;
- }
- } catch (Exception x)
- {
- }
- ;
- try
- {
- if (new java.net.URL(jvlite.getCodeBase() + modelSet[i])
- .openConnection() != null)
- {
- modelSet[i] = jvlite.getCodeBase() + modelSet[i];
- continue;
- }
- } catch (Exception x)
- {
- }
- ;
-
- }
- }
- }
-
- @Override
- public String[] getPdbFile()
- {
- return modelSet;
- }
-
- @Override
- public void mouseOverStructure(int atomIndex, String strInfo)
- {
-
- // StructureSelectionManager.getStructureSelectionManager().mouseOverStructure(atomIndex,
- // chain, pdbfile)
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void highlightAtom(int atomIndex, int pdbResNum, String chain,
- String pdbId)
- {
- String[] st = new String[0];
- try
- {
- executeJavascriptFunction(_listenerfn, st = new String[]
- { "mouseover", "" + pdbId, "" + chain, "" + (pdbResNum),
- "" + atomIndex });
- } catch (Exception ex)
- {
- System.err.println("Couldn't execute callback with " + _listenerfn
- + " using args { " + st[0] + ", " + st[1] + ", " + st[2]
- + "," + st[3] + "\n");
- ex.printStackTrace();
-
- }
-
- }
-
- @Override
- public synchronized void updateColours(Object srce)
- {
- final Object source = srce;
- StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(jvlite);
- // if (jvlite.debug)
- // {
- // ssm.reportMapping();
- // }
- if (source instanceof jalview.api.AlignmentViewPanel)
- {
- SequenceI[][] sequence = new SequenceI[modelSet.length][];
- for (int m = 0; m < modelSet.length; m++)
- {
- StructureMapping[] sm = ssm.getMapping(modelSet[m]);
- if (sm != null && sm.length > 0)
- {
- sequence[m] = new SequenceI[sm.length];
- for (int i = 0; i < sm.length; i++)
- {
- sequence[m][i] = sm[i].getSequence();
- }
- }
- else
- {
- sequence[m] = new SequenceI[0];
- }
- // if (jvlite.debug)
- // {
- // System.err.println("Mapped '" + modelSet[m] + "' to "
- // + sequence[m].length + " sequences.");
- // }
- }
-
- SequenceRenderer sr = ((jalview.appletgui.AlignmentPanel) source)
- .getSequenceRenderer();
- FeatureRenderer fr = ((jalview.appletgui.AlignmentPanel) source).av
- .getShowSequenceFeatures() ? new jalview.appletgui.FeatureRenderer(
- ((jalview.appletgui.AlignmentPanel) source).av) : null;
- if (fr != null)
- {
- ((jalview.appletgui.FeatureRenderer) fr)
- .transferSettings(((jalview.appletgui.AlignmentPanel) source)
- .getFeatureRenderer());
- }
- ;
-
-
- // Form a colour command from the given alignment panel for each distinct structure
- ArrayList<String[]> ccomands=new ArrayList<String[]>();
- ArrayList<String> pdbfn=new ArrayList<String>();
- StructureMappingcommandSet[] colcommands=JmolCommands.getColourBySequenceCommand(
- ssm, modelSet, sequence, sr, fr,
- ((AlignmentViewPanel) source).getAlignment());
- if (colcommands==null) {
- return;
- }
- int sz=0;
- for (jalview.structure.StructureMappingcommandSet ccset: colcommands) {
- sz+=ccset.commands.length;
- ccomands.add(ccset.commands);
- pdbfn.add(ccset.mapping);
- }
-
- String mclass,mhandle;
- String ccomandset[] = new String[sz];
- sz=0;
- for (String[] ccset: ccomands) {
- System.arraycopy(ccset, 0, ccomandset, sz, ccset.length);
- sz+=ccset.length;
- }
- if (jvlite.isJsMessageSetChanged(mclass="colourstruct",mhandle=((jalview.appletgui.AlignmentPanel) source).av
- .getViewId(), ccomandset)) {
- jvlite.setJsMessageSet(mclass, mhandle , ccomandset);
- // and notify javascript handler
- String st[] = new String[]
- {
- "colourstruct",
- ""
- + ((jalview.appletgui.AlignmentPanel) source).av
- .getViewId(), ""+ccomandset.length, jvlite.arrayToSeparatorList(pdbfn.toArray(new String[pdbfn.size()]))
- };
- try
- {
- executeJavascriptFunction(
- true,
- _listenerfn,st
-);
- } catch (Exception ex)
- {
- System.err.println("Couldn't execute callback with "
- + _listenerfn + " using args { " + st[0] + ", "
- + st[1] + ", " + st[2] + "," + st[3]+"}"); // + ","+st[4]+"\n");
- ex.printStackTrace();
-
- }
- }
-/* new Thread(new Runnable()
- {
- public void run()
- {
- // and send to javascript handler
- String st[] = new String[0];
- int i = 0;
- for (String colcommand : colcommands)
- {
- // do sync execution for each chunk
- try
- {
- executeJavascriptFunction(
- false,
- _listenerfn,
- st = new String[]
- {
- "colourstruct",
- ""
- + ((jalview.appletgui.AlignmentPanel) source).av
- .getViewId(), handle, "" });
- } catch (Exception ex)
- {
- System.err.println("Couldn't execute callback with "
- + _listenerfn + " using args { " + st[0] + ", "
- + st[1] + ", " + st[2] + "," + st[3] + "\n");
- ex.printStackTrace();
-
- }
- }
- }
- }).start();
- */
- }
-
- }
-
- @Override
- public Color getColour(int atomIndex, int pdbResNum, String chain,
- String pdbId)
- {
- return null;
- }
-
- @Override
- public AlignFrame getAlignFrame()
- {
- // associated with all alignframes, always.
- return null;
- }
-
- @Override
- public String getListenerFunction()
- {
- return _listenerfn;
- }
-
- public void finalise()
- {
- jvlite=null;
- super.finalize();
- }
- @Override
- public void releaseReferences(Object svl)
- {
-
- // TODO Auto-generated method stub
-
- }
-
-}
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.javascript;
+
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.appletgui.AlignFrame;
+import jalview.bin.JalviewLite;
+import jalview.datamodel.SequenceI;
+import jalview.ext.jmol.JmolCommands;
+import jalview.structure.AtomSpec;
+import jalview.structure.StructureListener;
+import jalview.structure.StructureMapping;
+import jalview.structure.StructureMappingcommandSet;
+import jalview.structure.StructureSelectionManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Propagate events involving PDB structures associated with sequences to a
+ * javascript function. Generally, the javascript handler is called with a
+ * series of arguments like (eventname, ... ). As of Jalview 2.7, the following
+ * different types of events are supported:
+ * <ul>
+ * <li>mouseover: javascript function called with arguments
+ *
+ * <pre>
+ * ['mouseover',String(pdb file URI), String(pdb file chain ID), String(residue
+ * number moused over), String(atom index corresponding to residue)]
+ * </pre>
+ *
+ * </li>
+ * <li>colourstruct: javascript function called with arguments
+ *
+ * <pre>
+ * ['colourstruct',String(alignment view id),String(number of javascript message
+ * chunks to collect),String(length of first chunk in set of messages - or zero
+ * for null message)]
+ * </pre>
+ *
+ * <br>
+ * The message contains a series of Jmol script commands that will colour
+ * structures according to their associated sequences in the current view. Use
+ * jalview
+ * .javascript.JalviewLiteJsApi.getJsMessage('colourstruct',String(alignment
+ * view id)) to retrieve successive chunks of the message.</li>
+ * </ul>
+ *
+ * @author Jim Procter (jprocter)
+ *
+ */
+public class MouseOverStructureListener extends JSFunctionExec implements
+ JsCallBack, StructureListener
+{
+
+ String _listenerfn;
+
+ String[] modelSet;
+
+ public MouseOverStructureListener(JalviewLite jalviewLite,
+ String listener, String[] modelList)
+ {
+ super(jalviewLite);
+ _listenerfn = listener;
+ modelSet = modelList;
+ if (modelSet != null)
+ {
+ for (int i = 0; i < modelSet.length; i++)
+ {
+ // resolve a real filename
+ try
+ {
+ if (new java.net.URL(modelSet[i]).openConnection() != null)
+ {
+ continue;
+ }
+ } catch (Exception x)
+ {
+ }
+ ;
+ try
+ {
+ String db = jvlite.getDocumentBase().toString();
+ db = db.substring(0, db.lastIndexOf("/"));
+ if (new java.net.URL(db + "/" + modelSet[i]).openConnection() != null)
+ {
+ modelSet[i] = db + "/" + modelSet[i];
+ continue;
+ }
+ } catch (Exception x)
+ {
+ }
+ ;
+ try
+ {
+ if (new java.net.URL(jvlite.getCodeBase() + modelSet[i])
+ .openConnection() != null)
+ {
+ modelSet[i] = jvlite.getCodeBase() + modelSet[i];
+ continue;
+ }
+ } catch (Exception x)
+ {
+ }
+ ;
+
+ }
+ }
+ }
+
+ @Override
+ public String[] getPdbFile()
+ {
+ return modelSet;
+ }
+
+ public void mouseOverStructure(int atomIndex, String strInfo)
+ {
+
+ // StructureSelectionManager.getStructureSelectionManager().mouseOverStructure(atomIndex,
+ // chain, pdbfile)
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void highlightAtoms(List<AtomSpec> atoms)
+ {
+ for (AtomSpec atom : atoms)
+ {
+ try
+ {
+ // TODO is this right? StructureSelectionManager passes pdbFile as the
+ // field that is interpreted (in 2.8.2) as pdbId?
+ // JBPComment: yep - this is right! the Javascript harness uses the
+ // absolute pdbFile URI to locate the PDB file in the external viewer
+ executeJavascriptFunction(_listenerfn,
+ new String[] { "mouseover", "" + atom.getPdbFile(),
+ "" + atom.getChain(), "" + (atom.getPdbResNum()),
+ "" + atom.getAtomIndex() });
+ } catch (Exception ex)
+ {
+ System.err.println("Couldn't execute callback with " + _listenerfn
+ + " for atomSpec: " + atom);
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public synchronized void updateColours(Object srce)
+ {
+ final Object source = srce;
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(jvlite);
+
+ if (JalviewLite.debug)
+ {
+ System.err.println(this.getClass().getName() + " modelSet[0]: "
+ + modelSet[0]);
+ ssm.reportMapping();
+ }
+
+ if (source instanceof jalview.api.AlignmentViewPanel)
+ {
+ SequenceI[][] sequence = new SequenceI[modelSet.length][];
+ for (int m = 0; m < modelSet.length; m++)
+ {
+ StructureMapping[] sm = ssm.getMapping(modelSet[m]);
+ if (sm != null && sm.length > 0)
+ {
+ sequence[m] = new SequenceI[sm.length];
+ for (int i = 0; i < sm.length; i++)
+ {
+ sequence[m][i] = sm[i].getSequence();
+ }
+ }
+ else
+ {
+ sequence[m] = new SequenceI[0];
+ }
+ // if (jvlite.debug)
+ // {
+ // System.err.println("Mapped '" + modelSet[m] + "' to "
+ // + sequence[m].length + " sequences.");
+ // }
+ }
+
+ SequenceRenderer sr = ((jalview.appletgui.AlignmentPanel) source)
+ .getSequenceRenderer();
+ FeatureRenderer fr = ((jalview.appletgui.AlignmentPanel) source).av
+ .isShowSequenceFeatures() ? new jalview.appletgui.FeatureRenderer(
+ ((jalview.appletgui.AlignmentPanel) source).av) : null;
+ if (fr != null)
+ {
+ ((jalview.appletgui.FeatureRenderer) fr)
+ .transferSettings(((jalview.appletgui.AlignmentPanel) source)
+ .getFeatureRenderer());
+ }
+ ;
+
+ // Form a colour command from the given alignment panel for each distinct
+ // structure
+ ArrayList<String[]> ccomands = new ArrayList<String[]>();
+ ArrayList<String> pdbfn = new ArrayList<String>();
+ StructureMappingcommandSet[] colcommands = JmolCommands
+ .getColourBySequenceCommand(ssm, modelSet, sequence, sr, fr,
+ ((AlignmentViewPanel) source).getAlignment());
+ if (colcommands == null)
+ {
+ return;
+ }
+ int sz = 0;
+ for (jalview.structure.StructureMappingcommandSet ccset : colcommands)
+ {
+ sz += ccset.commands.length;
+ ccomands.add(ccset.commands);
+ pdbfn.add(ccset.mapping);
+ }
+
+ String mclass, mhandle;
+ String ccomandset[] = new String[sz];
+ sz = 0;
+ for (String[] ccset : ccomands)
+ {
+ System.arraycopy(ccset, 0, ccomandset, sz, ccset.length);
+ sz += ccset.length;
+ }
+ if (jvlite.isJsMessageSetChanged(
+ mclass = "colourstruct",
+ mhandle = ((jalview.appletgui.AlignmentPanel) source).av
+ .getViewId(), ccomandset))
+ {
+ jvlite.setJsMessageSet(mclass, mhandle, ccomandset);
+ // and notify javascript handler
+ String st[] = new String[] {
+ "colourstruct",
+ "" + ((jalview.appletgui.AlignmentPanel) source).av.getViewId(),
+ "" + ccomandset.length,
+ jvlite.arrayToSeparatorList(pdbfn.toArray(new String[pdbfn
+ .size()])) };
+ try
+ {
+ executeJavascriptFunction(true, _listenerfn, st);
+ } catch (Exception ex)
+ {
+ System.err.println("Couldn't execute callback with "
+ + _listenerfn + " using args { " + st[0] + ", " + st[1]
+ + ", " + st[2] + "," + st[3] + "}"); // + ","+st[4]+"\n");
+ ex.printStackTrace();
+
+ }
+ }
+ /*
+ * new Thread(new Runnable() { public void run() { // and send to
+ * javascript handler String st[] = new String[0]; int i = 0; for (String
+ * colcommand : colcommands) { // do sync execution for each chunk try {
+ * executeJavascriptFunction( false, _listenerfn, st = new String[] {
+ * "colourstruct", "" + ((jalview.appletgui.AlignmentPanel) source).av
+ * .getViewId(), handle, "" }); } catch (Exception ex) {
+ * System.err.println("Couldn't execute callback with " + _listenerfn +
+ * " using args { " + st[0] + ", " + st[1] + ", " + st[2] + "," + st[3] +
+ * "\n"); ex.printStackTrace();
+ *
+ * } } } }).start();
+ */
+ }
+
+ }
+
+ @Override
+ public AlignFrame getAlignFrame()
+ {
+ // associated with all alignframes, always.
+ return null;
+ }
+
+ @Override
+ public String getListenerFunction()
+ {
+ return _listenerfn;
+ }
+
+ public void finalise()
+ {
+ jvlite = null;
+ super.finalize();
+ }
+
+ @Override
+ public void releaseReferences(Object svl)
+ {
+
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isListeningFor(SequenceI seq)
+ {
+ return true;
+ }
+
+}
diff --git a/src/jalview/jbgui/GAlignExportSettings.java b/src/jalview/jbgui/GAlignExportSettings.java
new file mode 100644
index 0000000..fcc38fb
--- /dev/null
+++ b/src/jalview/jbgui/GAlignExportSettings.java
@@ -0,0 +1,192 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.jbgui;
+
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+
+ at SuppressWarnings("serial")
+public abstract class GAlignExportSettings extends JPanel
+{
+ protected JPanel hiddenRegionConfPanel = new JPanel();
+
+ protected JPanel complexExportPanel = new JPanel();
+
+ protected JPanel optionsPanel = new JPanel();
+
+ protected JPanel actionPanel = new JPanel();
+
+ protected BorderLayout hiddenRegionLayout = new BorderLayout();
+
+ protected BorderLayout complexExportLayout = new BorderLayout();
+
+ protected BorderLayout mainLayout = new BorderLayout();
+
+ protected JCheckBox chkAll = new JCheckBox();
+
+ protected JCheckBox chkHiddenSeqs = new JCheckBox();
+
+ protected JCheckBox chkHiddenCols = new JCheckBox();
+
+ protected JCheckBox chkExportAnnots = new JCheckBox();
+
+ protected JCheckBox chkExportFeats = new JCheckBox();
+
+ protected JCheckBox chkExportGrps = new JCheckBox();
+
+ JButton btnOk = new JButton();
+
+ JButton btnCancel = new JButton();
+
+ private boolean hasHiddenSeq, hasHiddenCols, isComplexAlignFile,
+ showDialog;
+
+ public GAlignExportSettings(boolean hasHiddenSeq, boolean hasHiddenCols,
+ String alignFileFormat)
+ {
+ this.hasHiddenSeq = hasHiddenSeq;
+ this.hasHiddenCols = hasHiddenCols;
+ String[] complexFormats = { "JSON", "HTML" };
+
+ for (String format : complexFormats)
+ {
+ if (format.equalsIgnoreCase(alignFileFormat))
+ {
+ this.isComplexAlignFile = true;
+ break;
+ }
+ }
+ if (this.hasHiddenCols || this.hasHiddenSeq || this.isComplexAlignFile)
+ {
+ this.showDialog = true;
+ }
+ init();
+ }
+
+ public void init()
+ {
+ chkHiddenSeqs.setText(MessageManager
+ .getString("action.export_hidden_sequences"));
+ chkHiddenCols.setText(MessageManager
+ .getString("action.export_hidden_columns"));
+ chkExportAnnots.setText(MessageManager
+ .getString("action.export_annotations"));
+ chkExportFeats.setText(MessageManager
+ .getString("action.export_features"));
+ chkExportGrps.setText(MessageManager.getString("action.export_groups"));
+ btnOk.setText(MessageManager.getString("action.ok"));
+ btnCancel.setText(MessageManager.getString("action.cancel"));
+ chkAll.setText(MessageManager.getString("action.select_all"));
+
+ hiddenRegionConfPanel.setLayout(hiddenRegionLayout);
+ complexExportPanel.setLayout(complexExportLayout);
+ setLayout(mainLayout);
+
+ chkAll.addItemListener(new ItemListener()
+ {
+ public void itemStateChanged(ItemEvent e)
+ {
+ checkAllAction();
+ }
+ });
+
+ btnOk.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+
+ btnCancel.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+
+ // hiddenRegionConfPanel.add(chkAll, BorderLayout.NORTH);
+ hiddenRegionConfPanel.add(chkHiddenSeqs, BorderLayout.CENTER);
+ hiddenRegionConfPanel.add(chkHiddenCols, BorderLayout.SOUTH);
+ chkHiddenSeqs.setEnabled(hasHiddenSeq);
+ chkHiddenCols.setEnabled(hasHiddenCols);
+
+ complexExportPanel.add(chkExportAnnots, BorderLayout.NORTH);
+ complexExportPanel.add(chkExportFeats, BorderLayout.CENTER);
+ complexExportPanel.add(chkExportGrps, BorderLayout.SOUTH);
+
+ actionPanel.add(chkAll);
+
+ if (this.isComplexAlignFile)
+ {
+ optionsPanel.add(complexExportPanel);
+ }
+
+ if (hasHiddenSeq || hasHiddenCols)
+ {
+ optionsPanel.add(hiddenRegionConfPanel);
+ }
+
+ actionPanel.add(btnCancel);
+ actionPanel.add(btnOk);
+
+ add(optionsPanel, BorderLayout.NORTH);
+ add(actionPanel, BorderLayout.SOUTH);
+
+ }
+
+ private void checkAllAction()
+ {
+ boolean isSelected = chkAll.isSelected();
+ chkHiddenSeqs.setSelected(chkHiddenSeqs.isEnabled() && isSelected);
+ chkHiddenCols.setSelected(chkHiddenCols.isEnabled() && isSelected);
+ chkExportAnnots.setSelected(isComplexAlignFile
+ && chkExportAnnots.isEnabled() && isSelected);
+ chkExportFeats.setSelected(isComplexAlignFile
+ && chkExportFeats.isEnabled() && isSelected);
+ chkExportGrps.setSelected(isComplexAlignFile
+ && chkExportGrps.isEnabled() && isSelected);
+ }
+
+ public boolean isShowDialog()
+ {
+ return showDialog;
+ }
+
+ public void setShowDialog(boolean showDialog)
+ {
+ this.showDialog = showDialog;
+ }
+
+ public abstract void ok_actionPerformed(ActionEvent e);
+
+ public abstract void cancel_actionPerformed(ActionEvent e);
+}
diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java
index 6253e36..f2d3249 100644
--- a/src/jalview/jbgui/GAlignFrame.java
+++ b/src/jalview/jbgui/GAlignFrame.java
@@ -1,94 +1,85 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.schemes.*;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.api.SplitContainerI;
+import jalview.bin.Cache;
+import jalview.gui.JvSwingUtils;
+import jalview.gui.Preferences;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JTabbedPane;
+import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
public class GAlignFrame extends JInternalFrame
{
protected JMenuBar alignFrameMenuBar = new JMenuBar();
- protected JMenu fileMenu = new JMenu();
-
protected JMenuItem closeMenuItem = new JMenuItem();
- protected JMenu editMenu = new JMenu();
-
- protected JMenu viewMenu = new JMenu();
-
protected JMenu colourMenu = new JMenu();
- protected JMenu calculateMenu = new JMenu();
-
protected JMenu webService = new JMenu();
protected JMenuItem webServiceNoServices;
- protected JMenuItem selectAllSequenceMenuItem = new JMenuItem();
-
- protected JMenuItem deselectAllSequenceMenuItem = new JMenuItem();
-
- protected JMenuItem invertSequenceMenuItem = new JMenuItem();
-
- protected JMenuItem remove2LeftMenuItem = new JMenuItem();
-
- protected JMenuItem remove2RightMenuItem = new JMenuItem();
-
- protected JMenuItem removeGappedColumnMenuItem = new JMenuItem();
-
- protected JMenuItem removeAllGapsMenuItem = new JMenuItem();
-
public JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();
public JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();
- protected JMenuItem sortPairwiseMenuItem = new JMenuItem();
-
- protected JMenuItem sortIDMenuItem = new JMenuItem();
-
- protected JMenuItem sortLengthMenuItem = new JMenuItem();
-
- protected JMenuItem sortGroupMenuItem = new JMenuItem();
-
protected JMenu sortByAnnotScore = new JMenu();
- protected JMenuItem removeRedundancyMenuItem = new JMenuItem();
-
- protected JMenuItem pairwiseAlignmentMenuItem = new JMenuItem();
-
- protected JMenuItem PCAMenuItem = new JMenuItem();
-
- protected JMenuItem averageDistanceTreeMenuItem = new JMenuItem();
-
- protected JMenuItem neighbourTreeMenuItem = new JMenuItem();
-
- BorderLayout borderLayout1 = new BorderLayout();
-
public JLabel statusBar = new JLabel();
- protected JMenuItem saveAs = new JMenuItem();
-
protected JMenu outputTextboxMenu = new JMenu();
protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();
@@ -113,9 +104,16 @@ public class GAlignFrame extends JInternalFrame
protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
- JMenuItem njTreeBlosumMenuItem = new JMenuItem();
+ protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem();
+
+ // protected JRadioButtonMenuItem covariationColour = new
+ // JRadioButtonMenuItem();
- JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();
+ protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem();
public JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();
@@ -123,10 +121,6 @@ public class GAlignFrame extends JInternalFrame
public JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem();
- JMenuItem htmlMenuItem = new JMenuItem();
-
- JMenuItem overviewMenuItem = new JMenuItem();
-
protected JMenuItem undoMenuItem = new JMenuItem();
protected JMenuItem redoMenuItem = new JMenuItem();
@@ -137,54 +131,30 @@ public class GAlignFrame extends JInternalFrame
public JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();
- JMenuItem printMenuItem = new JMenuItem();
-
public JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();
- JMenuItem findMenuItem = new JMenuItem();
-
public JCheckBoxMenuItem abovePIDThreshold = new JCheckBoxMenuItem();
public JCheckBoxMenuItem showSeqFeatures = new JCheckBoxMenuItem();
public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
- protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
-
- JMenuItem deleteGroups = new JMenuItem();
-
- JMenuItem delete = new JMenuItem();
-
JMenuItem copy = new JMenuItem();
JMenuItem cut = new JMenuItem();
JMenu pasteMenu = new JMenu();
- JMenuItem pasteNew = new JMenuItem();
-
- JMenuItem pasteThis = new JMenuItem();
-
public JCheckBoxMenuItem applyToAllGroups = new JCheckBoxMenuItem();
- JMenuItem createPNG = new JMenuItem();
-
- protected JMenuItem font = new JMenuItem();
-
public JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem();
- JMenuItem epsFile = new JMenuItem();
-
- JMenuItem LoadtreeMenuItem = new JMenuItem();
-
public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
public JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
public JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();
- protected JMenuItem modifyPID = new JMenuItem();
-
protected JMenuItem modifyConservation = new JMenuItem();
protected JMenu sortByTreeMenu = new JMenu();
@@ -193,8 +163,6 @@ public class GAlignFrame extends JInternalFrame
protected JMenu calculateTree = new JMenu();
- JMenu jMenu2 = new JMenu();
-
protected JCheckBoxMenuItem padGapsMenuitem = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem showNpFeatsMenuitem = new JCheckBoxMenuItem();
@@ -203,21 +171,11 @@ public class GAlignFrame extends JInternalFrame
protected ButtonGroup colours = new ButtonGroup();
- JMenuItem vamsasStore = new JMenuItem();
-
protected JMenuItem showTranslation = new JMenuItem();
- protected JMenuItem extractScores = new JMenuItem();
-
protected JMenu showProducts = new JMenu();
- public JMenuItem featureSettings = new JMenuItem();
-
- JMenuItem fetchSequence = new JMenuItem();
-
- JMenuItem annotationColour = new JMenuItem();
-
- JMenuItem associatedData = new JMenuItem();
+ protected JMenuItem rnahelicesColour = new JMenuItem();
protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
@@ -225,57 +183,25 @@ public class GAlignFrame extends JInternalFrame
protected JCheckBoxMenuItem listenToViewSelections = new JCheckBoxMenuItem();
- JMenu addSequenceMenu = new JMenu();
-
- JMenuItem addFromFile = new JMenuItem();
-
- JMenuItem addFromText = new JMenuItem();
-
- JMenuItem addFromURL = new JMenuItem();
-
- JMenuItem exportAnnotations = new JMenuItem();
-
- JMenuItem exportFeatures = new JMenuItem();
-
protected JPanel statusPanel = new JPanel();
- GridLayout gridLayout1 = new GridLayout();
-
- JMenu jMenu3 = new JMenu();
+ protected JMenuItem showAllSeqAnnotations = new JMenuItem();
- JMenuItem showAllSeqs = new JMenuItem();
+ protected JMenuItem hideAllSeqAnnotations = new JMenuItem();
- JMenuItem showAllColumns = new JMenuItem();
+ protected JMenuItem showAllAlAnnotations = new JMenuItem();
- JMenu hideMenu = new JMenu();
+ protected JMenuItem hideAllAlAnnotations = new JMenuItem();
- JMenuItem hideSelSequences = new JMenuItem();
-
- JMenuItem hideSelColumns = new JMenuItem();
-
- JMenuItem hideAllButSelection = new JMenuItem();
-
- JMenuItem hideAllSelection = new JMenuItem();
-
- JMenuItem showAllhidden = new JMenuItem();
+ protected JCheckBoxMenuItem showComplementMenuItem = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem();
- JMenuItem invertColSel = new JMenuItem();
-
protected JTabbedPane tabbedPane = new JTabbedPane();
- JMenuItem save = new JMenuItem();
-
protected JMenuItem reload = new JMenuItem();
- JMenuItem newView = new JMenuItem();
-
- JMenuItem textColour = new JMenuItem();
-
- JMenu formatMenu = new JMenu();
-
- JMenu selectMenu = new JMenu();
+ protected JMenu formatMenu = new JMenu();
protected JCheckBoxMenuItem idRightAlign = new JCheckBoxMenuItem();
@@ -287,18 +213,6 @@ public class GAlignFrame extends JInternalFrame
protected JMenuItem expandViews = new JMenuItem();
- JMenuItem pageSetup = new JMenuItem();
-
- JMenuItem alignmentProperties = new JMenuItem();
-
- JMenu tooltipSettingsMenu = new JMenu();
-
- private JMenuItem justifyLeftMenuItem = new JMenuItem();
-
- private JMenuItem justifyRightMenuItem = new JMenuItem();
-
- JMenu autoAnnMenu = new JMenu();
-
protected JCheckBoxMenuItem showGroupConsensus = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem showGroupConservation = new JCheckBoxMenuItem();
@@ -307,9 +221,17 @@ public class GAlignFrame extends JInternalFrame
protected JCheckBoxMenuItem showSequenceLogo = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem normaliseSequenceLogo = new JCheckBoxMenuItem();
+
protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
- private JMenuItem grpsFromSelection = new JMenuItem();
+ private SequenceAnnotationOrder annotationSortOrder;
+
+ private boolean showAutoCalculatedAbove = false;
+
+ private Map<KeyStroke, JMenuItem> accelerators = new HashMap<KeyStroke, JMenuItem>();
+
+ private SplitContainerI splitFrame;
public GAlignFrame()
{
@@ -324,8 +246,9 @@ public class GAlignFrame extends JInternalFrame
JMenuItem item = new JMenuItem(
jalview.io.FormatAdapter.WRITEABLE_FORMATS[i]);
- item.addActionListener(new java.awt.event.ActionListener()
+ item.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
outputText_actionPerformed(e);
@@ -336,9 +259,10 @@ public class GAlignFrame extends JInternalFrame
}
} catch (Exception e)
{
+ System.err.println(e.toString());
}
- if (!new jalview.util.Platform().isAMac())
+ if (!jalview.util.Platform.isAMac())
{
closeMenuItem.setMnemonic('C');
outputTextboxMenu.setMnemonic('T');
@@ -362,6 +286,7 @@ public class GAlignFrame extends JInternalFrame
radioItem.setName("USER_DEFINED");
radioItem.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent evt)
{
if (evt.isControlDown()
@@ -371,8 +296,10 @@ public class GAlignFrame extends JInternalFrame
int option = JOptionPane.showInternalConfirmDialog(
jalview.gui.Desktop.desktop,
- "Remove from default list?",
- "Remove user defined colour",
+ MessageManager
+ .getString("label.remove_from_default_list"),
+ MessageManager
+ .getString("label.remove_user_defined_colour"),
JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION)
{
@@ -384,6 +311,7 @@ public class GAlignFrame extends JInternalFrame
{
radioItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
userDefinedColour_actionPerformed(evt);
@@ -395,6 +323,7 @@ public class GAlignFrame extends JInternalFrame
});
radioItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
userDefinedColour_actionPerformed(evt);
@@ -417,10 +346,12 @@ public class GAlignFrame extends JInternalFrame
colours.add(PIDColour);
colours.add(BLOSUM62Colour);
colours.add(nucleotideColour);
-
- setColourSelected(jalview.bin.Cache
- .getDefault("DEFAULT_COLOUR", "None"));
-
+ colours.add(purinePyrimidineColour);
+ // colours.add(covariationColour);
+ colours.add(tcoffeeColour);
+ colours.add(RNAInteractionColour);
+ setColourSelected(jalview.bin.Cache.getDefault(
+ Preferences.DEFAULT_COLOUR, "None"));
}
public void setColourSelected(String defaultColour)
@@ -487,6 +418,25 @@ public class GAlignFrame extends JInternalFrame
break;
+ case ColourSchemeProperty.TCOFFEE:
+ tcoffeeColour.setSelected(true);
+ break;
+
+ case ColourSchemeProperty.PURINEPYRIMIDINE:
+ purinePyrimidineColour.setSelected(true);
+
+ break;
+
+ case ColourSchemeProperty.RNAINTERACTION:
+ RNAInteractionColour.setSelected(true);
+
+ break;
+ /*
+ * case ColourSchemeProperty.COVARIATION:
+ * covariationColour.setSelected(true);
+ *
+ * break;
+ */
case ColourSchemeProperty.USER_DEFINED:
userDefinedColour.setSelected(true);
@@ -503,500 +453,732 @@ public class GAlignFrame extends JInternalFrame
private void jbInit() throws Exception
{
- fileMenu.setText("File");
- saveAs.setText("Save As...");
- saveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_S, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.SHIFT_MASK, false));
- saveAs.addActionListener(new ActionListener()
+ JMenuItem saveAs = new JMenuItem(
+ MessageManager.getString("action.save_as"));
+ ActionListener al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
saveAs_actionPerformed(e);
}
- });
- closeMenuItem.setText("Close");
- closeMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_W, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- closeMenuItem.addActionListener(new java.awt.event.ActionListener()
+ };
+ KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.SHIFT_MASK, false);
+ addMenuActionAndAccelerator(keyStroke, saveAs, al);
+
+ closeMenuItem.setText(MessageManager.getString("action.close"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
closeMenuItem_actionPerformed(false);
}
- });
- editMenu.setText("Edit");
- viewMenu.setText("View");
- colourMenu.setText("Colour");
- calculateMenu.setText("Calculate");
- webService.setText("Web Service");
- selectAllSequenceMenuItem.setText("Select All");
- selectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_A, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false));
- selectAllSequenceMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- selectAllSequenceMenuItem_actionPerformed(e);
- }
- });
- deselectAllSequenceMenuItem.setText("Deselect All");
- deselectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0, false));
- deselectAllSequenceMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- deselectAllSequenceMenuItem_actionPerformed(e);
- }
- });
- invertSequenceMenuItem.setText("Invert Sequence Selection");
- invertSequenceMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_I, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false));
- invertSequenceMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- invertSequenceMenuItem_actionPerformed(e);
- }
- });
- grpsFromSelection.setText("Make Groups for selection");
- grpsFromSelection.addActionListener(new java.awt.event.ActionListener()
+ };
+ addMenuActionAndAccelerator(keyStroke, closeMenuItem, al);
+
+ JMenu editMenu = new JMenu(MessageManager.getString("action.edit"));
+ JMenu viewMenu = new JMenu(MessageManager.getString("action.view"));
+ JMenu annotationsMenu = new JMenu(
+ MessageManager.getString("action.annotations"));
+ JMenu showMenu = new JMenu(MessageManager.getString("action.show"));
+ colourMenu.setText(MessageManager.getString("action.colour"));
+ JMenu calculateMenu = new JMenu(
+ MessageManager.getString("action.calculate"));
+ webService.setText(MessageManager.getString("action.web_service"));
+ JMenuItem selectAllSequenceMenuItem = new JMenuItem(
+ MessageManager.getString("action.select_all"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ selectAllSequenceMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, selectAllSequenceMenuItem, al);
+
+ JMenuItem deselectAllSequenceMenuItem = new JMenuItem(
+ MessageManager.getString("action.deselect_all"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
+ al = new ActionListener()
{
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ deselectAllSequenceMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, deselectAllSequenceMenuItem, al);
+
+ JMenuItem invertSequenceMenuItem = new JMenuItem(
+ MessageManager.getString("action.invert_sequence_selection"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ invertSequenceMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, invertSequenceMenuItem, al);
+
+ JMenuItem grpsFromSelection = new JMenuItem(
+ MessageManager.getString("action.make_groups_selection"));
+ grpsFromSelection.addActionListener(new ActionListener()
+ {
+ @Override
public void actionPerformed(ActionEvent e)
{
makeGrpsFromSelection_actionPerformed(e);
}
});
+ JMenuItem expandAlignment = new JMenuItem(
+ MessageManager.getString("action.view_flanking_regions"));
+ expandAlignment.setToolTipText(MessageManager
+ .getString("label.view_flanking_regions"));
+ expandAlignment.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ expand_newalign(e);
+ }
+ });
+ JMenuItem remove2LeftMenuItem = new JMenuItem(
+ MessageManager.getString("action.remove_left"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_L, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ remove2LeftMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, remove2LeftMenuItem, al);
- remove2LeftMenuItem.setText("Remove Left");
- remove2LeftMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_L, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- remove2LeftMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- remove2LeftMenuItem_actionPerformed(e);
- }
- });
- remove2RightMenuItem.setText("Remove Right");
- remove2RightMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_R, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- remove2RightMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- remove2RightMenuItem_actionPerformed(e);
- }
- });
- removeGappedColumnMenuItem.setText("Remove Empty Columns");
- removeGappedColumnMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_E, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false));
- removeGappedColumnMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- removeGappedColumnMenuItem_actionPerformed(e);
- }
- });
- removeAllGapsMenuItem.setText("Remove All Gaps");
- removeAllGapsMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_E, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.SHIFT_MASK, false));
- removeAllGapsMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- removeAllGapsMenuItem_actionPerformed(e);
- }
- });
- justifyLeftMenuItem.setText("Left Justify Alignment");
- justifyLeftMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- justifyLeftMenuItem_actionPerformed(e);
- }
- });
- justifyRightMenuItem.setText("Right Justify Alignment");
- justifyRightMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- justifyRightMenuItem_actionPerformed(e);
- }
- });
- viewBoxesMenuItem.setText("Boxes");
+ JMenuItem remove2RightMenuItem = new JMenuItem(
+ MessageManager.getString("action.remove_right"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ remove2RightMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, remove2RightMenuItem, al);
+
+ JMenuItem removeGappedColumnMenuItem = new JMenuItem(
+ MessageManager.getString("action.remove_empty_columns"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ removeGappedColumnMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, removeGappedColumnMenuItem, al);
+
+ JMenuItem removeAllGapsMenuItem = new JMenuItem(
+ MessageManager.getString("action.remove_all_gaps"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.SHIFT_MASK, false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ removeAllGapsMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, removeAllGapsMenuItem, al);
+
+ JMenuItem justifyLeftMenuItem = new JMenuItem(
+ MessageManager.getString("action.left_justify_alignment"));
+ justifyLeftMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ justifyLeftMenuItem_actionPerformed(e);
+ }
+ });
+ JMenuItem justifyRightMenuItem = new JMenuItem(
+ MessageManager.getString("action.right_justify_alignment"));
+ justifyRightMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ justifyRightMenuItem_actionPerformed(e);
+ }
+ });
+ viewBoxesMenuItem.setText(MessageManager.getString("action.boxes"));
viewBoxesMenuItem.setState(true);
- viewBoxesMenuItem.addActionListener(new java.awt.event.ActionListener()
+ viewBoxesMenuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
viewBoxesMenuItem_actionPerformed(e);
}
});
- viewTextMenuItem.setText("Text");
+ viewTextMenuItem.setText(MessageManager.getString("action.text"));
viewTextMenuItem.setState(true);
- viewTextMenuItem.addActionListener(new java.awt.event.ActionListener()
+ viewTextMenuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
viewTextMenuItem_actionPerformed(e);
}
});
- showNonconservedMenuItem.setText("Show nonconserved");
+ showNonconservedMenuItem.setText(MessageManager
+ .getString("label.show_non_conversed"));
showNonconservedMenuItem.setState(false);
- showNonconservedMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- showUnconservedMenuItem_actionPerformed(e);
- }
- });
- sortPairwiseMenuItem.setText("by Pairwise Identity");
- sortPairwiseMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- sortPairwiseMenuItem_actionPerformed(e);
- }
- });
- sortIDMenuItem.setText("by ID");
- sortIDMenuItem.addActionListener(new java.awt.event.ActionListener()
+ showNonconservedMenuItem.addActionListener(new ActionListener()
{
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showUnconservedMenuItem_actionPerformed(e);
+ }
+ });
+ JMenuItem sortPairwiseMenuItem = new JMenuItem(
+ MessageManager.getString("action.by_pairwise_id"));
+ sortPairwiseMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ sortPairwiseMenuItem_actionPerformed(e);
+ }
+ });
+ JMenuItem sortIDMenuItem = new JMenuItem(
+ MessageManager.getString("action.by_id"));
+ sortIDMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
public void actionPerformed(ActionEvent e)
{
sortIDMenuItem_actionPerformed(e);
}
});
- sortLengthMenuItem.setText("By Length");
- sortLengthMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- sortLengthMenuItem_actionPerformed(e);
- }
- });
- sortGroupMenuItem.setText("by Group");
- sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener()
+ JMenuItem sortLengthMenuItem = new JMenuItem(
+ MessageManager.getString("action.by_length"));
+ sortLengthMenuItem.addActionListener(new ActionListener()
{
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ sortLengthMenuItem_actionPerformed(e);
+ }
+ });
+ JMenuItem sortGroupMenuItem = new JMenuItem(
+ MessageManager.getString("action.by_group"));
+ sortGroupMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
public void actionPerformed(ActionEvent e)
{
sortGroupMenuItem_actionPerformed(e);
}
});
- removeRedundancyMenuItem.setText("Remove Redundancy...");
- removeRedundancyMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_D, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false));
- removeRedundancyMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- removeRedundancyMenuItem_actionPerformed(e);
- }
- });
- pairwiseAlignmentMenuItem.setText("Pairwise Alignments...");
- pairwiseAlignmentMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- pairwiseAlignmentMenuItem_actionPerformed(e);
- }
- });
- PCAMenuItem.setText("Principal Component Analysis");
- PCAMenuItem.addActionListener(new java.awt.event.ActionListener()
+
+ JMenuItem removeRedundancyMenuItem = new JMenuItem(
+ MessageManager.getString("action.remove_redundancy"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ removeRedundancyMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, removeRedundancyMenuItem, al);
+
+ JMenuItem pairwiseAlignmentMenuItem = new JMenuItem(
+ MessageManager.getString("action.pairwise_alignment"));
+ pairwiseAlignmentMenuItem.addActionListener(new ActionListener()
{
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ pairwiseAlignmentMenuItem_actionPerformed(e);
+ }
+ });
+ JMenuItem PCAMenuItem = new JMenuItem(
+ MessageManager.getString("label.principal_component_analysis"));
+ PCAMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
public void actionPerformed(ActionEvent e)
{
PCAMenuItem_actionPerformed(e);
}
});
- averageDistanceTreeMenuItem
- .setText("Average Distance Using % Identity");
- averageDistanceTreeMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- averageDistanceTreeMenuItem_actionPerformed(e);
- }
- });
- neighbourTreeMenuItem.setText("Neighbour Joining Using % Identity");
- neighbourTreeMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- neighbourTreeMenuItem_actionPerformed(e);
- }
- });
- this.getContentPane().setLayout(borderLayout1);
+ JMenuItem averageDistanceTreeMenuItem = new JMenuItem(
+ MessageManager.getString("label.average_distance_identity"));
+ averageDistanceTreeMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ averageDistanceTreeMenuItem_actionPerformed(e);
+ }
+ });
+ JMenuItem neighbourTreeMenuItem = new JMenuItem(
+ MessageManager.getString("label.neighbour_joining_identity"));
+ neighbourTreeMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ neighbourTreeMenuItem_actionPerformed(e);
+ }
+ });
+
+ this.getContentPane().setLayout(new BorderLayout());
alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));
statusBar.setBackground(Color.white);
statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
statusBar.setBorder(BorderFactory.createLineBorder(Color.black));
- statusBar.setText("Status bar");
- outputTextboxMenu.setText("Output to Textbox");
- clustalColour.setText("Clustalx");
-
- clustalColour.addActionListener(new java.awt.event.ActionListener()
+ statusBar.setText(MessageManager.getString("label.status_bar"));
+ outputTextboxMenu.setText(MessageManager
+ .getString("label.out_to_textbox"));
+ clustalColour.setText(MessageManager.getString("label.clustalx"));
+ clustalColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
clustalColour_actionPerformed(e);
}
});
- zappoColour.setText("Zappo");
- zappoColour.addActionListener(new java.awt.event.ActionListener()
+ zappoColour.setText(MessageManager.getString("label.zappo"));
+ zappoColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
zappoColour_actionPerformed(e);
}
});
- taylorColour.setText("Taylor");
- taylorColour.addActionListener(new java.awt.event.ActionListener()
+ taylorColour.setText(MessageManager.getString("label.taylor"));
+ taylorColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
taylorColour_actionPerformed(e);
}
});
- hydrophobicityColour.setText("Hydrophobicity");
- hydrophobicityColour
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- hydrophobicityColour_actionPerformed(e);
- }
- });
- helixColour.setText("Helix Propensity");
- helixColour.addActionListener(new java.awt.event.ActionListener()
+ hydrophobicityColour.setText(MessageManager
+ .getString("label.hydrophobicity"));
+ hydrophobicityColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ hydrophobicityColour_actionPerformed(e);
+ }
+ });
+ helixColour.setText(MessageManager.getString("label.helix_propensity"));
+ helixColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
helixColour_actionPerformed(e);
}
});
- strandColour.setText("Strand Propensity");
- strandColour.addActionListener(new java.awt.event.ActionListener()
+ strandColour.setText(MessageManager
+ .getString("label.strand_propensity"));
+ strandColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
strandColour_actionPerformed(e);
}
});
- turnColour.setText("Turn Propensity");
- turnColour.addActionListener(new java.awt.event.ActionListener()
+ turnColour.setText(MessageManager.getString("label.turn_propensity"));
+ turnColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
turnColour_actionPerformed(e);
}
});
- buriedColour.setText("Buried Index");
- buriedColour.addActionListener(new java.awt.event.ActionListener()
+ buriedColour.setText(MessageManager.getString("label.buried_index"));
+ buriedColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
buriedColour_actionPerformed(e);
}
});
- userDefinedColour.setText("User Defined...");
- userDefinedColour.addActionListener(new java.awt.event.ActionListener()
+ userDefinedColour.setText(MessageManager
+ .getString("action.user_defined"));
+ userDefinedColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
userDefinedColour_actionPerformed(e);
}
});
- PIDColour.setText("Percentage Identity");
- PIDColour.addActionListener(new java.awt.event.ActionListener()
+ PIDColour
+ .setText(MessageManager.getString("label.percentage_identity"));
+ PIDColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
PIDColour_actionPerformed(e);
}
});
- BLOSUM62Colour.setText("BLOSUM62 Score");
- BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()
+ BLOSUM62Colour
+ .setText(MessageManager.getString("label.blosum62_score"));
+ BLOSUM62Colour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
BLOSUM62Colour_actionPerformed(e);
}
});
- avDistanceTreeBlosumMenuItem.setText("Average Distance Using BLOSUM62");
- avDistanceTreeBlosumMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- avTreeBlosumMenuItem_actionPerformed(e);
- }
- });
- njTreeBlosumMenuItem.setText("Neighbour Joining using BLOSUM62");
- njTreeBlosumMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- njTreeBlosumMenuItem_actionPerformed(e);
- }
- });
+ nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
+ nucleotideColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ nucleotideColour_actionPerformed(e);
+ }
+ });
+
+ purinePyrimidineColour.setText(MessageManager
+ .getString("label.purine_pyrimidine"));
+ purinePyrimidineColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ purinePyrimidineColour_actionPerformed(e);
+ }
+ });
+
+ RNAInteractionColour.setText("RNA Interaction type");
+ RNAInteractionColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ RNAInteractionColour_actionPerformed(e);
+ }
+ });
+ /*
+ * covariationColour.setText("Covariation");
+ * covariationColour.addActionListener(new ActionListener() { public void
+ * actionPerformed(ActionEvent e) { covariationColour_actionPerformed(e); }
+ * });
+ */
+
+ JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem(
+ MessageManager.getString("label.average_distance_bloslum62"));
+ avDistanceTreeBlosumMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ avTreeBlosumMenuItem_actionPerformed(e);
+ }
+ });
+ JMenuItem njTreeBlosumMenuItem = new JMenuItem(
+ MessageManager.getString("label.neighbour_blosum62"));
+ njTreeBlosumMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ njTreeBlosumMenuItem_actionPerformed(e);
+ }
+ });
annotationPanelMenuItem.setActionCommand("");
- annotationPanelMenuItem.setText("Show Annotations");
- annotationPanelMenuItem.setState(jalview.bin.Cache.getDefault(
- "SHOW_ANNOTATIONS", true));
- annotationPanelMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- annotationPanelMenuItem_actionPerformed(e);
- }
- });
- colourTextMenuItem.setText("Colour Text");
- colourTextMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- colourTextMenuItem_actionPerformed(e);
- }
- });
- htmlMenuItem.setText("HTML");
- htmlMenuItem.addActionListener(new java.awt.event.ActionListener()
+ annotationPanelMenuItem.setText(MessageManager
+ .getString("label.show_annotations"));
+ annotationPanelMenuItem.setState(Cache.getDefault("SHOW_ANNOTATIONS",
+ true));
+ annotationPanelMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ annotationPanelMenuItem_actionPerformed(e);
+ }
+ });
+ showAllAlAnnotations.setText(MessageManager
+ .getString("label.show_all_al_annotations"));
+ final boolean isAnnotationPanelShown = annotationPanelMenuItem
+ .getState();
+ showAllAlAnnotations.setEnabled(isAnnotationPanelShown);
+ showAllAlAnnotations.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showAllAnnotations_actionPerformed(false, true);
+ }
+ });
+ hideAllAlAnnotations.setText(MessageManager
+ .getString("label.hide_all_al_annotations"));
+ hideAllAlAnnotations.setEnabled(isAnnotationPanelShown);
+ hideAllAlAnnotations.addActionListener(new ActionListener()
{
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ hideAllAnnotations_actionPerformed(false, true);
+ }
+ });
+ showAllSeqAnnotations.setText(MessageManager
+ .getString("label.show_all_seq_annotations"));
+ showAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
+ showAllSeqAnnotations.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showAllAnnotations_actionPerformed(true, false);
+ }
+ });
+ hideAllSeqAnnotations.setText(MessageManager
+ .getString("label.hide_all_seq_annotations"));
+ hideAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
+ hideAllSeqAnnotations.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ hideAllAnnotations_actionPerformed(true, false);
+ }
+ });
+ SequenceAnnotationOrder sortAnnotationsBy = SequenceAnnotationOrder
+ .valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS,
+ SequenceAnnotationOrder.NONE.name()));
+ final JCheckBoxMenuItem sortAnnBySequence = new JCheckBoxMenuItem(
+ MessageManager.getString("label.sort_annotations_by_sequence"));
+ final JCheckBoxMenuItem sortAnnByLabel = new JCheckBoxMenuItem(
+ MessageManager.getString("label.sort_annotations_by_label"));
+
+ sortAnnBySequence
+ .setSelected(sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
+ sortAnnBySequence.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ boolean newState = sortAnnBySequence.getState();
+ sortAnnByLabel.setSelected(false);
+ setAnnotationSortOrder(newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL
+ : SequenceAnnotationOrder.NONE);
+ sortAnnotations_actionPerformed();
+ }
+ });
+ sortAnnByLabel
+ .setSelected(sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
+ sortAnnByLabel.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ boolean newState = sortAnnByLabel.getState();
+ sortAnnBySequence.setSelected(false);
+ setAnnotationSortOrder(newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE
+ : SequenceAnnotationOrder.NONE);
+ sortAnnotations_actionPerformed();
+ }
+ });
+ colourTextMenuItem.setText(MessageManager
+ .getString("label.colour_text"));
+ colourTextMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ colourTextMenuItem_actionPerformed(e);
+ }
+ });
+
+ JMenuItem htmlMenuItem = new JMenuItem(
+ MessageManager.getString("label.html"));
+ htmlMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
public void actionPerformed(ActionEvent e)
{
htmlMenuItem_actionPerformed(e);
}
});
- overviewMenuItem.setText("Overview Window");
- overviewMenuItem.addActionListener(new java.awt.event.ActionListener()
+
+ JMenuItem createBioJS = new JMenuItem(
+ MessageManager.getString("label.biojs_html_export"));
+ createBioJS.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ bioJSMenuItem_actionPerformed(e);
+ }
+ });
+
+ JMenuItem overviewMenuItem = new JMenuItem(
+ MessageManager.getString("label.overview_window"));
+ overviewMenuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
overviewMenuItem_actionPerformed(e);
}
});
+
undoMenuItem.setEnabled(false);
- undoMenuItem.setText("Undo");
- undoMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_Z, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- undoMenuItem.addActionListener(new java.awt.event.ActionListener()
+ undoMenuItem.setText(MessageManager.getString("action.undo"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
undoMenuItem_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, undoMenuItem, al);
+
redoMenuItem.setEnabled(false);
- redoMenuItem.setText("Redo");
- redoMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_Y, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- redoMenuItem.addActionListener(new java.awt.event.ActionListener()
+ redoMenuItem.setText(MessageManager.getString("action.redo"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
redoMenuItem_actionPerformed(e);
}
+ };
+ addMenuActionAndAccelerator(keyStroke, redoMenuItem, al);
+
+ conservationMenuItem.setText(MessageManager
+ .getString("action.by_conservation"));
+ conservationMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ conservationMenuItem_actionPerformed(e);
+ }
});
- conservationMenuItem.setText("By Conservation");
- conservationMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- conservationMenuItem_actionPerformed(e);
- }
- });
- noColourmenuItem.setText("None");
- noColourmenuItem.addActionListener(new java.awt.event.ActionListener()
+ noColourmenuItem.setText(MessageManager.getString("label.none"));
+ noColourmenuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
noColourmenuItem_actionPerformed(e);
}
});
- wrapMenuItem.setText("Wrap");
- wrapMenuItem.addActionListener(new java.awt.event.ActionListener()
+ wrapMenuItem.setText(MessageManager.getString("label.wrap"));
+ wrapMenuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
wrapMenuItem_actionPerformed(e);
}
});
- printMenuItem.setText("Print ...");
- printMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_P, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- printMenuItem.addActionListener(new java.awt.event.ActionListener()
+
+ JMenuItem printMenuItem = new JMenuItem(
+ MessageManager.getString("action.print"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
printMenuItem_actionPerformed(e);
}
- });
- renderGapsMenuItem.setText("Show Gaps");
- renderGapsMenuItem.setState(true);
+ };
+ addMenuActionAndAccelerator(keyStroke, printMenuItem, al);
+
renderGapsMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- renderGapsMenuItem_actionPerformed(e);
- }
- });
- findMenuItem.setText("Find...");
- findMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_F, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- findMenuItem.addActionListener(new java.awt.event.ActionListener()
+ .setText(MessageManager.getString("action.show_gaps"));
+ renderGapsMenuItem.setState(true);
+ renderGapsMenuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- findMenuItem_actionPerformed(e);
+ renderGapsMenuItem_actionPerformed(e);
}
});
- abovePIDThreshold.setText("Above Identity Threshold");
- abovePIDThreshold.addActionListener(new java.awt.event.ActionListener()
+
+ JMenuItem findMenuItem = new JMenuItem(
+ MessageManager.getString("action.find"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ findMenuItem.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.find_tip")));
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ findMenuItem_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, findMenuItem, al);
+
+ abovePIDThreshold.setText(MessageManager
+ .getString("label.above_identity_threshold"));
+ abovePIDThreshold.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
abovePIDThreshold_actionPerformed(e);
}
});
- showSeqFeatures.setText("Show Sequence Features");
+ showSeqFeatures.setText(MessageManager
+ .getString("label.show_sequence_features"));
showSeqFeatures.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
showSeqFeatures_actionPerformed(actionEvent);
@@ -1008,30 +1190,36 @@ public class GAlignFrame extends JInternalFrame
* void actionPerformed(ActionEvent actionEvent) {
* showSeqFeaturesHeight_actionPerformed(actionEvent); } });
*/
- showDbRefsMenuitem.setText("Show Database Refs");
+ showDbRefsMenuitem.setText(MessageManager
+ .getString("label.show_database_refs"));
showDbRefsMenuitem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showDbRefs_actionPerformed(e);
}
});
- showNpFeatsMenuitem.setText("Show Non-Positional Features");
+ showNpFeatsMenuitem.setText(MessageManager
+ .getString("label.show_non_positional_features"));
showNpFeatsMenuitem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showNpFeats_actionPerformed(e);
}
});
- showGroupConservation.setText("Group Conservation");
+ showGroupConservation.setText(MessageManager
+ .getString("label.group_conservation"));
showGroupConservation.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showGroupConservation_actionPerformed(e);
@@ -1039,181 +1227,309 @@ public class GAlignFrame extends JInternalFrame
});
- showGroupConsensus.setText("Group Consensus");
+ showGroupConsensus.setText(MessageManager
+ .getString("label.group_consensus"));
showGroupConsensus.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showGroupConsensus_actionPerformed(e);
}
});
- showConsensusHistogram.setText("Show Consensus Histogram");
+ showConsensusHistogram.setText(MessageManager
+ .getString("label.show_consensus_histogram"));
showConsensusHistogram.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showConsensusHistogram_actionPerformed(e);
}
});
- showSequenceLogo.setText("Show Consensus Logo");
+ showSequenceLogo.setText(MessageManager
+ .getString("label.show_consensus_logo"));
showSequenceLogo.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showSequenceLogo_actionPerformed(e);
}
});
- applyAutoAnnotationSettings.setText("Apply to all groups");
+ normaliseSequenceLogo.setText(MessageManager
+ .getString("label.norm_consensus_logo"));
+ normaliseSequenceLogo.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ normaliseSequenceLogo_actionPerformed(e);
+ }
+
+ });
+ applyAutoAnnotationSettings.setText(MessageManager
+ .getString("label.apply_all_groups"));
applyAutoAnnotationSettings.setState(false);
applyAutoAnnotationSettings.setVisible(true);
applyAutoAnnotationSettings.addActionListener(new ActionListener()
{
-
+ @Override
public void actionPerformed(ActionEvent e)
{
applyAutoAnnotationSettings_actionPerformed(e);
}
+ });
+ ButtonGroup buttonGroup = new ButtonGroup();
+ final JRadioButtonMenuItem showAutoFirst = new JRadioButtonMenuItem(
+ MessageManager.getString("label.show_first"));
+ final JRadioButtonMenuItem showAutoLast = new JRadioButtonMenuItem(
+ MessageManager.getString("label.show_last"));
+ buttonGroup.add(showAutoFirst);
+ buttonGroup.add(showAutoLast);
+ showAutoFirst.setSelected(Cache.getDefault(
+ Preferences.SHOW_AUTOCALC_ABOVE, false));
+ showAutoFirst.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ setShowAutoCalculatedAbove(showAutoFirst.isSelected());
+ sortAnnotations_actionPerformed();
+ }
+ });
+ showAutoLast.setSelected(!showAutoFirst.isSelected());
+ showAutoLast.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ setShowAutoCalculatedAbove(!showAutoLast.isSelected());
+ sortAnnotations_actionPerformed();
+ }
});
- nucleotideColour.setText("Nucleotide");
- nucleotideColour.addActionListener(new java.awt.event.ActionListener()
+ nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
+ nucleotideColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
nucleotideColour_actionPerformed(e);
}
});
- deleteGroups.setText("Undefine groups");
- deleteGroups.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_U, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- deleteGroups.addActionListener(new java.awt.event.ActionListener()
+
+ tcoffeeColour.setText(MessageManager.getString("label.tcoffee_scores"));
+ tcoffeeColour.setEnabled(false);
+ tcoffeeColour.addActionListener(new ActionListener()
{
+
+ @Override
public void actionPerformed(ActionEvent e)
{
- deleteGroups_actionPerformed(e);
+ tcoffeeColorScheme_actionPerformed(e);
}
});
- copy.setText("Copy");
- copy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_C, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- copy.addActionListener(new java.awt.event.ActionListener()
+ JMenuItem deleteGroups = new JMenuItem(
+ MessageManager.getString("action.undefine_groups"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ deleteGroups_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, deleteGroups, al);
+
+ JMenuItem createGroup = new JMenuItem(
+ MessageManager.getString("action.create_groups"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ createGroup_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, createGroup, al);
+
+ JMenuItem unGroup = new JMenuItem(
+ MessageManager.getString("action.remove_group"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.SHIFT_MASK, false);
+ al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ unGroup_actionPerformed(e);
+ }
+ };
+ addMenuActionAndAccelerator(keyStroke, unGroup, al);
+
+ copy.setText(MessageManager.getString("action.copy"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
copy_actionPerformed(e);
}
- });
- cut.setText("Cut");
- cut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_X, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- cut.addActionListener(new java.awt.event.ActionListener()
+ };
+ addMenuActionAndAccelerator(keyStroke, copy, al);
+
+ cut.setText(MessageManager.getString("action.cut"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
cut_actionPerformed(e);
}
- });
- delete.setText("Delete");
- delete.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_BACK_SPACE, 0, false));
- delete.addActionListener(new java.awt.event.ActionListener()
+ };
+ addMenuActionAndAccelerator(keyStroke, cut, al);
+
+ JMenuItem delete = new JMenuItem(
+ MessageManager.getString("action.delete"));
+ delete.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
delete_actionPerformed(e);
}
});
- pasteMenu.setText("Paste");
- pasteNew.setText("To New Alignment");
- pasteNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_V, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.SHIFT_MASK, false));
- pasteNew.addActionListener(new java.awt.event.ActionListener()
+
+ pasteMenu.setText(MessageManager.getString("action.paste"));
+ JMenuItem pasteNew = new JMenuItem(
+ MessageManager.getString("label.to_new_alignment"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.SHIFT_MASK, false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
pasteNew_actionPerformed(e);
}
- });
- pasteThis.setText("Add To This Alignment");
- pasteThis.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_V, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- pasteThis.addActionListener(new java.awt.event.ActionListener()
+ };
+ addMenuActionAndAccelerator(keyStroke, pasteNew, al);
+
+ JMenuItem pasteThis = new JMenuItem(
+ MessageManager.getString("label.to_this_alignment"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
pasteThis_actionPerformed(e);
}
- });
- applyToAllGroups.setText("Apply Colour To All Groups");
- applyToAllGroups.addActionListener(new java.awt.event.ActionListener()
+ };
+ addMenuActionAndAccelerator(keyStroke, pasteThis, al);
+
+ applyToAllGroups.setText(MessageManager
+ .getString("label.apply_colour_to_all_groups"));
+ applyToAllGroups.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
applyToAllGroups_actionPerformed(e);
}
});
- createPNG.addActionListener(new java.awt.event.ActionListener()
+ JMenuItem createPNG = new JMenuItem("PNG");
+ createPNG.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
createPNG(null);
}
});
- createPNG.setActionCommand("Save As PNG Image");
- createPNG.setText("PNG");
- font.setText("Font...");
- font.addActionListener(new java.awt.event.ActionListener()
+ createPNG.setActionCommand(MessageManager
+ .getString("label.save_png_image"));
+
+ JMenuItem font = new JMenuItem(MessageManager.getString("action.font"));
+ font.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
font_actionPerformed(e);
}
});
-
- seqLimits.setText("Show Sequence Limits");
+ seqLimits.setText(MessageManager
+ .getString("label.show_sequence_limits"));
seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true));
- seqLimits.addActionListener(new java.awt.event.ActionListener()
+ seqLimits.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
seqLimit_actionPerformed(e);
}
});
- epsFile.setText("EPS");
- epsFile.addActionListener(new java.awt.event.ActionListener()
+ JMenuItem epsFile = new JMenuItem("EPS");
+ epsFile.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
createEPS(null);
}
});
- LoadtreeMenuItem.setActionCommand("Load a tree for this sequence set");
- LoadtreeMenuItem.setText("Load Associated Tree");
- LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener()
+
+ JMenuItem createSVG = new JMenuItem("SVG");
+ createSVG.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ createSVG(null);
+ }
+ });
+
+ JMenuItem loadTreeMenuItem = new JMenuItem(
+ MessageManager.getString("label.load_associated_tree"));
+ loadTreeMenuItem.setActionCommand(MessageManager
+ .getString("label.load_tree_for_sequence_set"));
+ loadTreeMenuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- LoadtreeMenuItem_actionPerformed(e);
+ loadTreeMenuItem_actionPerformed(e);
}
});
+
scaleAbove.setVisible(false);
- scaleAbove.setText("Scale Above");
- scaleAbove.addActionListener(new java.awt.event.ActionListener()
+ scaleAbove.setText(MessageManager.getString("action.scale_above"));
+ scaleAbove.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
scaleAbove_actionPerformed(e);
@@ -1221,9 +1537,10 @@ public class GAlignFrame extends JInternalFrame
});
scaleLeft.setVisible(false);
scaleLeft.setSelected(true);
- scaleLeft.setText("Scale Left");
- scaleLeft.addActionListener(new java.awt.event.ActionListener()
+ scaleLeft.setText(MessageManager.getString("action.scale_left"));
+ scaleLeft.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
scaleLeft_actionPerformed(e);
@@ -1231,9 +1548,10 @@ public class GAlignFrame extends JInternalFrame
});
scaleRight.setVisible(false);
scaleRight.setSelected(true);
- scaleRight.setText("Scale Right");
- scaleRight.addActionListener(new java.awt.event.ActionListener()
+ scaleRight.setText(MessageManager.getString("action.scale_right"));
+ scaleRight.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
scaleRight_actionPerformed(e);
@@ -1241,21 +1559,24 @@ public class GAlignFrame extends JInternalFrame
});
centreColumnLabelsMenuItem.setVisible(true);
centreColumnLabelsMenuItem.setState(false);
- centreColumnLabelsMenuItem.setText("Centre Column Labels");
- centreColumnLabelsMenuItem
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- centreColumnLabels_actionPerformed(e);
- }
- });
+ centreColumnLabelsMenuItem.setText(MessageManager
+ .getString("label.centre_column_labels"));
+ centreColumnLabelsMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ centreColumnLabels_actionPerformed(e);
+ }
+ });
followHighlightMenuItem.setVisible(true);
followHighlightMenuItem.setState(true);
- followHighlightMenuItem.setText("Automatic Scrolling");
+ followHighlightMenuItem.setText(MessageManager
+ .getString("label.automatic_scrolling"));
followHighlightMenuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
followHighlight_actionPerformed();
@@ -1263,53 +1584,64 @@ public class GAlignFrame extends JInternalFrame
});
- modifyPID.setText("Modify Identity Threshold...");
- modifyPID.addActionListener(new java.awt.event.ActionListener()
+ JMenuItem modifyPID = new JMenuItem(
+ MessageManager.getString("label.modify_identity_thereshold"));
+ modifyPID.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
modifyPID_actionPerformed(e);
}
});
- modifyConservation.setText("Modify Conservation Threshold...");
- modifyConservation
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- modifyConservation_actionPerformed(e);
- }
- });
- sortByTreeMenu.setText("By Tree Order");
- sort.setText("Sort");
+ modifyConservation.setText(MessageManager
+ .getString("label.modify_conservation_thereshold"));
+ modifyConservation.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ modifyConservation_actionPerformed(e);
+ }
+ });
+ sortByTreeMenu
+ .setText(MessageManager.getString("action.by_tree_order"));
+ sort.setText(MessageManager.getString("action.sort"));
sort.addMenuListener(new MenuListener()
{
+ @Override
public void menuSelected(MenuEvent e)
{
buildTreeMenu();
}
+ @Override
public void menuDeselected(MenuEvent e)
{
}
+ @Override
public void menuCanceled(MenuEvent e)
{
}
});
- sortByAnnotScore.setText("by Score");
+ sortByAnnotScore.setText(MessageManager
+ .getString("label.sort_by_score"));
sort.add(sortByAnnotScore);
- sortByAnnotScore.addMenuListener(new javax.swing.event.MenuListener()
+ sort.addMenuListener(new javax.swing.event.MenuListener()
{
+ @Override
public void menuCanceled(MenuEvent e)
{
}
+ @Override
public void menuDeselected(MenuEvent e)
{
}
+ @Override
public void menuSelected(MenuEvent e)
{
buildSortByAnnotationScoresMenu();
@@ -1317,249 +1649,341 @@ public class GAlignFrame extends JInternalFrame
});
sortByAnnotScore.setVisible(false);
- calculateTree.setText("Calculate Tree");
+ calculateTree
+ .setText(MessageManager.getString("action.calculate_tree"));
- jMenu2.setText("Export Image");
- padGapsMenuitem.setText("Pad Gaps");
+ padGapsMenuitem.setText(MessageManager.getString("label.pad_gaps"));
padGapsMenuitem.setState(jalview.bin.Cache
.getDefault("PAD_GAPS", false));
padGapsMenuitem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
padGapsMenuitem_actionPerformed(e);
}
});
+ JMenuItem vamsasStore = new JMenuItem(
+ MessageManager.getString("label.vamsas_store"));
vamsasStore.setVisible(false);
- vamsasStore.setText("VAMSAS store");
vamsasStore.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
vamsasStore_actionPerformed(e);
}
});
- showTranslation.setText("Translate cDNA");
+ showTranslation.setText(MessageManager
+ .getString("label.translate_cDNA"));
showTranslation.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showTranslation_actionPerformed(e);
}
});
- extractScores.setText("Extract Scores...");
+
+ JMenuItem extractScores = new JMenuItem(
+ MessageManager.getString("label.extract_scores"));
extractScores.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
extractScores_actionPerformed(e);
}
});
- extractScores.setVisible(true); // JBPNote: TODO: make gui for regex based
- // score extraction
- showProducts.setText("Get Cross References");
- /*
- * showProducts.addActionListener(new ActionListener() {
- *
- * public void actionPerformed(ActionEvent e) {
- * showProducts_actionPerformed(e); } });
- */
- featureSettings.setText("Feature Settings...");
- featureSettings.addActionListener(new ActionListener()
+ extractScores.setVisible(true);
+ // JBPNote: TODO: make gui for regex based score extraction
+
+ // for show products actions see AlignFrame.canShowProducts
+ showProducts.setText(MessageManager.getString("label.get_cross_refs"));
+
+ JMenuItem openFeatureSettings = new JMenuItem(
+ MessageManager.getString("action.feature_settings"));
+ openFeatureSettings.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
featureSettings_actionPerformed(e);
}
});
- fetchSequence.setText("Fetch Sequence(s)...");
+ JMenuItem fetchSequence = new JMenuItem(
+ MessageManager.getString("label.fetch_sequences"));
fetchSequence.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
fetchSequence_actionPerformed(e);
}
});
- annotationColour.setText("By Annotation...");
+ JMenuItem annotationColour = new JMenuItem(
+ MessageManager.getString("action.by_annotation"));
annotationColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
annotationColour_actionPerformed(e);
}
});
- associatedData.setText("Load Features / Annotations");
+
+ JMenuItem annotationColumn = new JMenuItem(
+ MessageManager.getString("action.select_by_annotation"));
+ annotationColumn.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ annotationColumn_actionPerformed(e);
+ }
+ });
+
+ rnahelicesColour.setText(MessageManager
+ .getString("action.by_rna_helixes"));
+ rnahelicesColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ rnahelicesColour_actionPerformed(e);
+ }
+ });
+
+ JMenuItem associatedData = new JMenuItem(
+ MessageManager.getString("label.load_features_annotations"));
associatedData.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
associatedData_actionPerformed(e);
}
});
- autoCalculate.setText("Autocalculate Consensus");
+ autoCalculate.setText(MessageManager
+ .getString("label.autocalculate_consensus"));
autoCalculate.setState(jalview.bin.Cache.getDefault(
"AUTO_CALC_CONSENSUS", true));
autoCalculate.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
autoCalculate_actionPerformed(e);
}
});
- sortByTree.setText("Sort Alignment With New Tree");
- sortByTree.setToolTipText("<html>Enable this to automatically sort<br>the alignment when you open<br> a new tree.");
- sortByTree.setState(jalview.bin.Cache.getDefault(
- "SORT_BY_TREE", false));
+ sortByTree.setText(MessageManager
+ .getString("label.sort_alignment_new_tree"));
+ sortByTree
+ .setToolTipText("<html>"
+ + MessageManager
+ .getString("label.enable_automatically_sort_alignment_when_open_new_tree"));
+ sortByTree
+ .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false));
sortByTree.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
sortByTreeOption_actionPerformed(e);
}
});
- listenToViewSelections.setText("Listen for selections");
- listenToViewSelections.setToolTipText("<html>When selected, selections in this view will mirror<br>selections made on the same sequences in other views.");
- listenToViewSelections.setState(false);
+ listenToViewSelections.setText(MessageManager
+ .getString("label.listen_for_selections"));
+ listenToViewSelections
+ .setToolTipText("<html>"
+ + MessageManager
+ .getString("label.selections_mirror_selections_made_same_sequences_other_views"));
+ listenToViewSelections.setState(false);
listenToViewSelections.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
listenToViewSelections_actionPerformed(e);
}
});
- addSequenceMenu.setText("Add Sequences");
- addFromFile.setText("From File");
+ JMenu addSequenceMenu = new JMenu(
+ MessageManager.getString("label.add_sequences"));
+ JMenuItem addFromFile = new JMenuItem(
+ MessageManager.getString("label.from_file"));
addFromFile.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
addFromFile_actionPerformed(e);
}
});
- addFromText.setText("From Textbox");
+ JMenuItem addFromText = new JMenuItem(
+ MessageManager.getString("label.from_textbox"));
addFromText.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
addFromText_actionPerformed(e);
}
});
- addFromURL.setText("From URL");
+ JMenuItem addFromURL = new JMenuItem(
+ MessageManager.getString("label.from_url"));
addFromURL.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
addFromURL_actionPerformed(e);
}
});
- exportFeatures.setText("Export Features...");
+ JMenuItem exportFeatures = new JMenuItem(
+ MessageManager.getString("label.export_features"));
exportFeatures.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
exportFeatures_actionPerformed(e);
}
});
- exportAnnotations.setText("Export Annotations...");
+ JMenuItem exportAnnotations = new JMenuItem(
+ MessageManager.getString("label.export_annotations"));
exportAnnotations.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
exportAnnotations_actionPerformed(e);
}
});
- statusPanel.setLayout(gridLayout1);
- jMenu3.setText("Show");
- showAllSeqs.setText("All Sequences");
- showAllSeqs.setToolTipText("Shift+H toggles sequence visiblity.");
+ statusPanel.setLayout(new GridLayout());
+ JMenuItem showAllSeqs = new JMenuItem(
+ MessageManager.getString("label.all_sequences"));
+ showAllSeqs.setToolTipText(MessageManager
+ .getString("label.toggle_sequence_visibility"));
showAllSeqs.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showAllSeqs_actionPerformed(e);
}
});
- showAllColumns.setText("All Columns");
- showAllColumns.setToolTipText("Ctrl+H toggles column visiblity.");
+ JMenuItem showAllColumns = new JMenuItem(
+ MessageManager.getString("label.all_columns"));
+ showAllColumns.setToolTipText(MessageManager
+ .getString("label.toggle_columns_visibility"));
showAllColumns.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showAllColumns_actionPerformed(e);
}
});
- hideMenu.setText("Hide");
- hideSelSequences.setText("Selected Sequences");
- hideSelSequences.setToolTipText("Shift+H toggles sequence visiblity.");
+ JMenu hideMenu = new JMenu(MessageManager.getString("action.hide"));
+ JMenuItem hideSelSequences = new JMenuItem(
+ MessageManager.getString("label.selected_sequences"));
+ hideSelSequences.setToolTipText(MessageManager
+ .getString("label.toggle_sequence_visibility"));
hideSelSequences.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
hideSelSequences_actionPerformed(e);
}
});
- hideSelColumns.setText("Selected Columns");
- hideSelColumns.setToolTipText("Ctrl+H toggles column visiblity.");
+ JMenuItem hideSelColumns = new JMenuItem(
+ MessageManager.getString("label.selected_columns"));
+ hideSelColumns.setToolTipText(MessageManager
+ .getString("label.toggle_columns_visibility"));
hideSelColumns.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
hideSelColumns_actionPerformed(e);
}
});
- hideAllSelection.setText("Selected Region");
+ JMenuItem hideAllSelection = new JMenuItem(
+ MessageManager.getString("label.selected_region"));
hideAllSelection.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
hideAllSelection_actionPerformed(e);
}
});
// TODO: should be hidden if no selection exists.
- hideAllButSelection.setText("All but Selected Region (Shift+Ctrl+H)");
+ JMenuItem hideAllButSelection = new JMenuItem(
+ MessageManager.getString("label.all_but_selected_region"));
hideAllButSelection.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
hideAllButSelection_actionPerformed(e);
}
});
- showAllhidden.setText("All Sequences and Columns");
- showAllhidden
- .setToolTipText("H toggles visibility of hidden or selected regions.");
+ JMenuItem showAllhidden = new JMenuItem(
+ MessageManager.getString("label.all_sequences_columns"));
+ showAllhidden.setToolTipText(MessageManager
+ .getString("label.toggles_visibility_hidden_selected_regions"));
showAllhidden.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showAllhidden_actionPerformed(e);
}
});
-
- hiddenMarkers.setText("Show Hidden Markers");
+ hiddenMarkers.setText(MessageManager
+ .getString("action.show_hidden_markers"));
hiddenMarkers.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
hiddenMarkers_actionPerformed(e);
}
});
- invertColSel.setText("Invert Column Selection");
- invertColSel.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_I, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask()
- | java.awt.event.KeyEvent.ALT_MASK, false));
- invertColSel.addActionListener(new ActionListener()
+
+ JMenuItem invertColSel = new JMenuItem(
+ MessageManager.getString("action.invert_column_selection"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask()
+ | KeyEvent.ALT_MASK, false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
invertColSel_actionPerformed(e);
}
+ };
+ addMenuActionAndAccelerator(keyStroke, invertColSel, al);
+
+ showComplementMenuItem.setVisible(false);
+ showComplementMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showComplement_actionPerformed(showComplementMenuItem.getState());
+ }
});
+
tabbedPane.addChangeListener(new javax.swing.event.ChangeListener()
{
+ @Override
public void stateChanged(ChangeEvent evt)
{
JTabbedPane pane = (JTabbedPane) evt.getSource();
@@ -1569,6 +1993,7 @@ public class GAlignFrame extends JInternalFrame
});
tabbedPane.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent e)
{
tabbedPane_mousePressed(e);
@@ -1576,106 +2001,136 @@ public class GAlignFrame extends JInternalFrame
});
tabbedPane.addFocusListener(new FocusAdapter()
{
+ @Override
public void focusGained(FocusEvent e)
{
tabbedPane_focusGained(e);
}
});
- save.setText("Save");
- save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_S, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- save.addActionListener(new ActionListener()
+
+ JMenuItem save = new JMenuItem(MessageManager.getString("action.save"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
save_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, save, al);
+
reload.setEnabled(false);
- reload.setText("Reload");
+ reload.setText(MessageManager.getString("action.reload"));
reload.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
reload_actionPerformed(e);
}
});
- newView.setText("New View");
- newView.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_T, Toolkit.getDefaultToolkit()
- .getMenuShortcutKeyMask(), false));
- newView.addActionListener(new ActionListener()
+
+ JMenuItem newView = new JMenuItem(
+ MessageManager.getString("action.new_view"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit
+ .getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
newView_actionPerformed(e);
}
- });
- tabbedPane.setToolTipText("<html><i> Right-click to rename tab"
- + "<br> Press X to eXpand tabs, G to reGroup.</i></html>");
- textColour.setText("Colour Text ...");
+ };
+ addMenuActionAndAccelerator(keyStroke, newView, al);
+
+ tabbedPane.setToolTipText("<html><i>"
+ + MessageManager.getString("label.rename_tab_eXpand_reGroup")
+ + "</i></html>");
+ JMenuItem textColour = new JMenuItem(
+ MessageManager.getString("action.set_text_colour"));
textColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
textColour_actionPerformed(e);
}
});
- formatMenu.setText("Format");
- selectMenu.setText("Select");
- idRightAlign.setText("Right Align Sequence Id");
+ formatMenu.setText(MessageManager.getString("action.format"));
+ JMenu selectMenu = new JMenu(MessageManager.getString("action.select"));
+ idRightAlign.setText(MessageManager
+ .getString("label.right_align_sequence_id"));
idRightAlign.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
idRightAlign_actionPerformed(e);
}
});
+
gatherViews.setEnabled(false);
- gatherViews.setText("Gather Views");
- gatherViews.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_G, 0, false));
- gatherViews.addActionListener(new ActionListener()
+ gatherViews.setText(MessageManager.getString("action.gather_views"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
gatherViews_actionPerformed(e);
}
- });
+ };
+ addMenuActionAndAccelerator(keyStroke, gatherViews, al);
+
expandViews.setEnabled(false);
- expandViews.setText("Expand Views");
- expandViews.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_X, 0, false));
- expandViews.addActionListener(new ActionListener()
+ expandViews.setText(MessageManager.getString("action.expand_views"));
+ keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false);
+ al = new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
expandViews_actionPerformed(e);
}
- });
- pageSetup.setText("Page Setup ...");
+ };
+ addMenuActionAndAccelerator(keyStroke, expandViews, al);
+
+ JMenuItem pageSetup = new JMenuItem(
+ MessageManager.getString("action.page_setup"));
pageSetup.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
pageSetup_actionPerformed(e);
}
});
- alignmentProperties.setText("Alignment Properties...");
+ JMenuItem alignmentProperties = new JMenuItem(
+ MessageManager.getString("label.alignment_props"));
alignmentProperties.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
alignmentProperties();
}
});
- tooltipSettingsMenu.setText("Sequence ID Tooltip");
- autoAnnMenu.setText("Autocalculated Annotation");
+ JMenu tooltipSettingsMenu = new JMenu(
+ MessageManager.getString("label.sequence_id_tooltip"));
+ JMenu autoAnnMenu = new JMenu(
+ MessageManager.getString("label.autocalculated_annotation"));
+
+ JMenu exportImageMenu = new JMenu(
+ MessageManager.getString("label.export_image"));
+ JMenu fileMenu = new JMenu(MessageManager.getString("action.file"));
alignFrameMenuBar.add(fileMenu);
alignFrameMenuBar.add(editMenu);
alignFrameMenuBar.add(selectMenu);
alignFrameMenuBar.add(viewMenu);
+ alignFrameMenuBar.add(annotationsMenu);
alignFrameMenuBar.add(formatMenu);
alignFrameMenuBar.add(colourMenu);
alignFrameMenuBar.add(calculateMenu);
@@ -1691,10 +2146,10 @@ public class GAlignFrame extends JInternalFrame
fileMenu.add(pageSetup);
fileMenu.add(printMenuItem);
fileMenu.addSeparator();
- fileMenu.add(jMenu2);
+ fileMenu.add(exportImageMenu);
fileMenu.add(exportFeatures);
fileMenu.add(exportAnnotations);
- fileMenu.add(LoadtreeMenuItem);
+ fileMenu.add(loadTreeMenuItem);
fileMenu.add(associatedData);
fileMenu.addSeparator();
fileMenu.add(closeMenuItem);
@@ -1717,27 +2172,20 @@ public class GAlignFrame extends JInternalFrame
// editMenu.add(justifyRightMenuItem);
// editMenu.addSeparator();
editMenu.add(padGapsMenuitem);
+
viewMenu.add(newView);
viewMenu.add(expandViews);
viewMenu.add(gatherViews);
viewMenu.addSeparator();
- viewMenu.add(jMenu3);
+ viewMenu.add(showMenu);
viewMenu.add(hideMenu);
+ viewMenu.add(showComplementMenuItem);
viewMenu.addSeparator();
viewMenu.add(followHighlightMenuItem);
- viewMenu.add(annotationPanelMenuItem);
- autoAnnMenu.add(applyAutoAnnotationSettings);
- autoAnnMenu.add(showConsensusHistogram);
- autoAnnMenu.add(showSequenceLogo);
- autoAnnMenu.addSeparator();
- autoAnnMenu.add(showGroupConservation);
- autoAnnMenu.add(showGroupConsensus);
- viewMenu.add(autoAnnMenu);
viewMenu.addSeparator();
viewMenu.add(showSeqFeatures);
// viewMenu.add(showSeqFeaturesHeight);
-
- viewMenu.add(featureSettings);
+ viewMenu.add(openFeatureSettings);
tooltipSettingsMenu.add(showDbRefsMenuitem);
tooltipSettingsMenu.add(showNpFeatsMenuitem);
viewMenu.add(tooltipSettingsMenu);
@@ -1745,6 +2193,29 @@ public class GAlignFrame extends JInternalFrame
viewMenu.add(alignmentProperties);
viewMenu.addSeparator();
viewMenu.add(overviewMenuItem);
+
+ annotationsMenu.add(annotationPanelMenuItem);
+ annotationsMenu.addSeparator();
+ annotationsMenu.add(showAllAlAnnotations);
+ annotationsMenu.add(hideAllAlAnnotations);
+ annotationsMenu.addSeparator();
+ annotationsMenu.add(showAllSeqAnnotations);
+ annotationsMenu.add(hideAllSeqAnnotations);
+ annotationsMenu.add(sortAnnBySequence);
+ annotationsMenu.add(sortAnnByLabel);
+ annotationsMenu.addSeparator();
+ autoAnnMenu.add(showAutoFirst);
+ autoAnnMenu.add(showAutoLast);
+ autoAnnMenu.addSeparator();
+ autoAnnMenu.add(applyAutoAnnotationSettings);
+ autoAnnMenu.add(showConsensusHistogram);
+ autoAnnMenu.add(showSequenceLogo);
+ autoAnnMenu.add(normaliseSequenceLogo);
+ autoAnnMenu.addSeparator();
+ autoAnnMenu.add(showGroupConservation);
+ autoAnnMenu.add(showGroupConsensus);
+ annotationsMenu.add(autoAnnMenu);
+
colourMenu.add(applyToAllGroups);
colourMenu.add(textColour);
colourMenu.addSeparator();
@@ -1760,6 +2231,10 @@ public class GAlignFrame extends JInternalFrame
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(nucleotideColour);
+ colourMenu.add(purinePyrimidineColour);
+ colourMenu.add(RNAInteractionColour);
+ // colourMenu.add(covariationColour);
+ colourMenu.add(tcoffeeColour);
colourMenu.add(userDefinedColour);
colourMenu.addSeparator();
colourMenu.add(conservationMenuItem);
@@ -1767,6 +2242,7 @@ public class GAlignFrame extends JInternalFrame
colourMenu.add(abovePIDThreshold);
colourMenu.add(modifyPID);
colourMenu.add(annotationColour);
+ colourMenu.add(rnahelicesColour);
calculateMenu.add(sort);
calculateMenu.add(calculateTree);
calculateMenu.addSeparator();
@@ -1779,7 +2255,8 @@ public class GAlignFrame extends JInternalFrame
calculateMenu.add(sortByTree);
calculateMenu.addSeparator();
calculateMenu.add(extractScores);
- webServiceNoServices = new JMenuItem("<No Services>");
+ webServiceNoServices = new JMenuItem(
+ MessageManager.getString("label.no_services"));
webService.add(webServiceNoServices);
pasteMenu.add(pasteNew);
pasteMenu.add(pasteThis);
@@ -1788,22 +2265,20 @@ public class GAlignFrame extends JInternalFrame
sort.add(sortGroupMenuItem);
sort.add(sortPairwiseMenuItem);
sort.add(sortByTreeMenu);
- calculateTree.add(averageDistanceTreeMenuItem);
- calculateTree.add(neighbourTreeMenuItem);
- calculateTree.add(avDistanceTreeBlosumMenuItem);
- calculateTree.add(njTreeBlosumMenuItem);
- jMenu2.add(htmlMenuItem);
- jMenu2.add(epsFile);
- jMenu2.add(createPNG);
+ exportImageMenu.add(htmlMenuItem);
+ exportImageMenu.add(epsFile);
+ exportImageMenu.add(createPNG);
+ exportImageMenu.add(createBioJS);
+ exportImageMenu.add(createSVG);
addSequenceMenu.add(addFromFile);
addSequenceMenu.add(addFromText);
addSequenceMenu.add(addFromURL);
this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
statusPanel.add(statusBar, null);
this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
- jMenu3.add(showAllColumns);
- jMenu3.add(showAllSeqs);
- jMenu3.add(showAllhidden);
+ showMenu.add(showAllColumns);
+ showMenu.add(showAllSeqs);
+ showMenu.add(showAllhidden);
hideMenu.add(hideSelColumns);
hideMenu.add(hideSelSequences);
hideMenu.add(hideAllSelection);
@@ -1830,17 +2305,97 @@ public class GAlignFrame extends JInternalFrame
selectMenu.add(deselectAllSequenceMenuItem);
selectMenu.add(invertSequenceMenuItem);
selectMenu.add(invertColSel);
- selectMenu.add(deleteGroups);
+ selectMenu.add(createGroup);
+ selectMenu.add(unGroup);
selectMenu.add(grpsFromSelection);
- // TODO - determine if the listenToViewSelections button is needed : see bug JAL-574
- //selectMenu.addSeparator();
- //selectMenu.add(listenToViewSelections);
+ selectMenu.add(deleteGroups);
+ selectMenu.add(annotationColumn);
+ calculateMenu.add(expandAlignment);
+ // TODO - determine if the listenToViewSelections button is needed : see bug
+ // JAL-574
+ // selectMenu.addSeparator();
+ // selectMenu.add(listenToViewSelections);
+ }
+
+ /**
+ * Adds the given action listener and key accelerator to the given menu item.
+ * Also saves in a lookup table to support lookup of action by key stroke.
+ *
+ * @param keyStroke
+ * @param menuItem
+ * @param actionListener
+ */
+ protected void addMenuActionAndAccelerator(KeyStroke keyStroke,
+ JMenuItem menuItem, ActionListener actionListener)
+ {
+ menuItem.setAccelerator(keyStroke);
+ accelerators.put(keyStroke, menuItem);
+ menuItem.addActionListener(actionListener);
+ }
+
+ /**
+ * Action on clicking sort annotations by type.
+ *
+ * @param sortOrder
+ */
+ protected void sortAnnotations_actionPerformed()
+ {
+ }
+
+ /**
+ * Action on clicking Show all annotations.
+ *
+ * @param forSequences
+ * update sequence-related annotations
+ * @param forAlignment
+ * update non-sequence-related annotations
+ */
+ protected void showAllAnnotations_actionPerformed(boolean forSequences,
+ boolean forAlignment)
+ {
+ setAnnotationsVisibility(true, forSequences, forAlignment);
+ }
+
+ /**
+ * Action on clicking Hide all annotations.
+ *
+ * @param forSequences
+ * update sequence-related annotations
+ * @param forAlignment
+ * update non-sequence-related annotations
+ */
+ protected void hideAllAnnotations_actionPerformed(boolean forSequences,
+ boolean forAlignment)
+ {
+ setAnnotationsVisibility(false, forSequences, forAlignment);
+ }
+
+ /**
+ * Set the visibility of annotations to true or false. Can act on
+ * sequence-related annotations, or alignment-related, or both.
+ *
+ * @param visible
+ * @param forSequences
+ * update sequence-related annotations
+ * @param forAlignment
+ * update non-sequence-related annotations
+ */
+ protected void setAnnotationsVisibility(boolean visible,
+ boolean forSequences, boolean forAlignment)
+ {
+
+ }
+
+ protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
}
protected void listenToViewSelections_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
-
+
}
protected void showAllhidden_actionPerformed(ActionEvent e)
@@ -1944,10 +2499,6 @@ public class GAlignFrame extends JInternalFrame
{
}
- protected void showProducts_actionPerformed(ActionEvent e)
- {
- }
-
protected void buildSortByAnnotationScoresMenu()
{
}
@@ -1989,6 +2540,11 @@ public class GAlignFrame extends JInternalFrame
{
}
+ protected void bioJSMenuItem_actionPerformed(ActionEvent e)
+ {
+
+ }
+
protected void closeMenuItem_actionPerformed(boolean b)
{
}
@@ -2141,6 +2697,18 @@ public class GAlignFrame extends JInternalFrame
{
}
+ protected void purinePyrimidineColour_actionPerformed(ActionEvent e)
+ {
+ }
+
+ protected void RNAInteractionColour_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /*
+ * protected void covariationColour_actionPerformed(ActionEvent e) { }
+ */
+
protected void noColourmenuItem_actionPerformed(ActionEvent e)
{
}
@@ -2177,6 +2745,14 @@ public class GAlignFrame extends JInternalFrame
{
}
+ protected void createGroup_actionPerformed(ActionEvent e)
+ {
+ }
+
+ protected void unGroup_actionPerformed(ActionEvent e)
+ {
+ }
+
protected void copy_actionPerformed(ActionEvent e)
{
}
@@ -2222,8 +2798,40 @@ public class GAlignFrame extends JInternalFrame
{
}
- protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
+ public void createSVG(java.io.File f)
+ {
+
+ }
+
+ protected void loadTreeMenuItem_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ /**
+ * Template method to handle the 'load T-Coffee scores' menu event.
+ * <p>
+ * Subclasses override this method to provide a custom action.
+ *
+ * @param event
+ * The raised event
+ */
+ protected void loadScores_actionPerformed(ActionEvent event)
+ {
+
+ }
+
+ /**
+ * Template method to handle the 'Color T-Coffee scores' menu event.
+ * <p>
+ * Subclasses override this method to provide a custom action.
+ *
+ * @param event
+ * The raised event
+ */
+ protected void tcoffeeColorScheme_actionPerformed(ActionEvent event)
{
+
}
protected void jpred_actionPerformed(ActionEvent e)
@@ -2293,6 +2901,16 @@ public class GAlignFrame extends JInternalFrame
}
+ public void annotationColumn_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void rnahelicesColour_actionPerformed(ActionEvent e)
+ {
+
+ }
+
public void associatedData_actionPerformed(ActionEvent e)
{
@@ -2417,4 +3035,77 @@ public class GAlignFrame extends JInternalFrame
{
}
+
+ protected void expand_newalign(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected boolean isShowAutoCalculatedAbove()
+ {
+ return showAutoCalculatedAbove;
+ }
+
+ protected void setShowAutoCalculatedAbove(boolean showAutoCalculatedAbove)
+ {
+ this.showAutoCalculatedAbove = showAutoCalculatedAbove;
+ }
+
+ protected SequenceAnnotationOrder getAnnotationSortOrder()
+ {
+ return annotationSortOrder;
+ }
+
+ protected void setAnnotationSortOrder(
+ SequenceAnnotationOrder annotationSortOrder)
+ {
+ this.annotationSortOrder = annotationSortOrder;
+ }
+
+ public Map<KeyStroke, JMenuItem> getAccelerators()
+ {
+ return this.accelerators;
+ }
+
+ /**
+ * Returns the selected index of the tabbed pane, or -1 if none selected
+ * (including the case where the tabbed pane has not been made visible).
+ *
+ * @return
+ */
+ public int getTabIndex()
+ {
+ return tabbedPane.getSelectedIndex();
+ }
+
+ public JPanel getStatusPanel()
+ {
+ return statusPanel;
+ }
+
+ /**
+ * Sets a reference to the containing split frame. Also makes the 'toggle
+ * split view' menu item visible and checked.
+ *
+ * @param sf
+ */
+ public void setSplitFrame(SplitContainerI sf)
+ {
+ this.splitFrame = sf;
+ if (sf != null)
+ {
+ this.showComplementMenuItem.setVisible(true);
+ this.showComplementMenuItem.setState(true);
+ }
+ }
+
+ public SplitContainerI getSplitViewContainer()
+ {
+ return this.splitFrame;
+ }
+
+ protected void showComplement_actionPerformed(boolean state)
+ {
+ }
}
diff --git a/src/jalview/jbgui/GAlignmentPanel.java b/src/jalview/jbgui/GAlignmentPanel.java
index bcab09f..efbc6af 100644
--- a/src/jalview/jbgui/GAlignmentPanel.java
+++ b/src/jalview/jbgui/GAlignmentPanel.java
@@ -1,25 +1,35 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.border.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JPanel;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.border.Border;
public class GAlignmentPanel extends JPanel
{
diff --git a/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java b/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java
new file mode 100644
index 0000000..ce704fe
--- /dev/null
+++ b/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java
@@ -0,0 +1,262 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.jbgui;
+
+import jalview.gui.JvSwingUtils;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JEditorPane;
+import javax.swing.JInternalFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class GCutAndPasteHtmlTransfer extends JInternalFrame
+{
+ protected JEditorPane textarea = new JEditorPane("text/html", "");
+
+ protected JScrollPane scrollPane = new JScrollPane();
+
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ JMenuBar editMenubar = new JMenuBar();
+
+ JMenu editMenu = new JMenu();
+
+ JMenuItem copyItem = new JMenuItem();
+
+ protected JCheckBoxMenuItem displaySource = new JCheckBoxMenuItem();
+
+ BorderLayout borderLayout2 = new BorderLayout();
+
+ protected JPanel inputButtonPanel = new JPanel();
+
+ protected JButton ok = new JButton();
+
+ JButton cancel = new JButton();
+
+ JMenuItem close = new JMenuItem();
+
+ JMenuItem selectAll = new JMenuItem();
+
+ JMenu jMenu1 = new JMenu();
+
+ JMenuItem save = new JMenuItem();
+
+ /**
+ * Creates a new GCutAndPasteTransfer object.
+ */
+ public GCutAndPasteHtmlTransfer()
+ {
+ try
+ {
+ setJMenuBar(editMenubar);
+ jbInit();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @throws Exception
+ * DOCUMENT ME!
+ */
+ private void jbInit() throws Exception
+ {
+ scrollPane.setBorder(null);
+ ok.setFont(JvSwingUtils.getLabelFont());
+ ok.setText(MessageManager.getString("label.new_window"));
+ ok.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+ cancel.setText(MessageManager.getString("action.close"));
+ cancel.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ textarea.setBorder(null);
+ close.setText(MessageManager.getString("action.close"));
+ close.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ close.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
+ java.awt.event.KeyEvent.VK_W, Toolkit.getDefaultToolkit()
+ .getMenuShortcutKeyMask(), false));
+ selectAll.setText(MessageManager.getString("action.select_all"));
+ selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
+ java.awt.event.KeyEvent.VK_A, Toolkit.getDefaultToolkit()
+ .getMenuShortcutKeyMask(), false));
+ selectAll.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ selectAll_actionPerformed(e);
+ }
+ });
+ jMenu1.setText(MessageManager.getString("action.file"));
+ save.setText(MessageManager.getString("action.save"));
+ save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
+ java.awt.event.KeyEvent.VK_S, Toolkit.getDefaultToolkit()
+ .getMenuShortcutKeyMask(), false));
+ save.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ save_actionPerformed(e);
+ }
+ });
+ copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
+ java.awt.event.KeyEvent.VK_C, Toolkit.getDefaultToolkit()
+ .getMenuShortcutKeyMask(), false));
+
+ editMenubar.add(jMenu1);
+ editMenubar.add(editMenu);
+ textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
+ textarea.addMouseListener(new java.awt.event.MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ textarea_mousePressed(e);
+ }
+ });
+ editMenu.setText(MessageManager.getString("action.edit"));
+ copyItem.setText(MessageManager.getString("action.copy"));
+ copyItem.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ copyItem_actionPerformed(e);
+ }
+ });
+ displaySource.setText(MessageManager
+ .getString("action.show_html_source"));
+ displaySource.setToolTipText(MessageManager
+ .getString("label.select_copy_raw_html"));
+ displaySource.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ toggleHtml_actionPerformed(arg0);
+ }
+ });
+ editMenu.add(displaySource);
+ this.getContentPane().setLayout(borderLayout2);
+ scrollPane.setBorder(null);
+ scrollPane.getViewport().add(textarea, null);
+ editMenu.add(selectAll);
+ editMenu.add(copyItem);
+ this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
+ inputButtonPanel.add(ok);
+ inputButtonPanel.add(cancel);
+ jMenu1.add(save);
+ jMenu1.add(close);
+ }
+
+ protected void toggleHtml_actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ public void textarea_mousePressed(MouseEvent e)
+ {
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ public void copyItem_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void selectAll_actionPerformed(ActionEvent e)
+ {
+ textarea.selectAll();
+ }
+
+ public void save_actionPerformed(ActionEvent e)
+ {
+
+ }
+}
diff --git a/src/jalview/jbgui/GCutAndPasteTransfer.java b/src/jalview/jbgui/GCutAndPasteTransfer.java
index 5024fc2..10f4166 100644
--- a/src/jalview/jbgui/GCutAndPasteTransfer.java
+++ b/src/jalview/jbgui/GCutAndPasteTransfer.java
@@ -1,27 +1,43 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
import jalview.gui.JvSwingUtils;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JButton;
+import javax.swing.JInternalFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
/**
* DOCUMENT ME!
@@ -84,7 +100,7 @@ public class GCutAndPasteTransfer extends JInternalFrame
{
scrollPane.setBorder(null);
ok.setFont(JvSwingUtils.getLabelFont());
- ok.setText("New Window");
+ ok.setText(MessageManager.getString("label.new_window"));
ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -92,7 +108,7 @@ public class GCutAndPasteTransfer extends JInternalFrame
ok_actionPerformed(e);
}
});
- cancel.setText("Close");
+ cancel.setText(MessageManager.getString("action.close"));
cancel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -102,7 +118,7 @@ public class GCutAndPasteTransfer extends JInternalFrame
});
textarea.setBorder(null);
- selectAll.setText("Select All");
+ selectAll.setText(MessageManager.getString("action.select_all"));
selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_A, Toolkit.getDefaultToolkit()
.getMenuShortcutKeyMask(), false));
@@ -113,8 +129,8 @@ public class GCutAndPasteTransfer extends JInternalFrame
selectAll_actionPerformed(e);
}
});
- jMenu1.setText("File");
- save.setText("Save");
+ jMenu1.setText(MessageManager.getString("action.file"));
+ save.setText(MessageManager.getString("action.save"));
save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_S, Toolkit.getDefaultToolkit()
.getMenuShortcutKeyMask(), false));
@@ -141,8 +157,8 @@ public class GCutAndPasteTransfer extends JInternalFrame
textarea_mousePressed(e);
}
});
- editMenu.setText("Edit");
- pasteMenu.setText("Paste");
+ editMenu.setText(MessageManager.getString("action.edit"));
+ pasteMenu.setText(MessageManager.getString("action.paste"));
pasteMenu.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -150,7 +166,7 @@ public class GCutAndPasteTransfer extends JInternalFrame
pasteMenu_actionPerformed(e);
}
});
- copyItem.setText("Copy");
+ copyItem.setText(MessageManager.getString("action.copy"));
copyItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
diff --git a/src/jalview/jbgui/GDasSourceBrowser.java b/src/jalview/jbgui/GDasSourceBrowser.java
index f2fc849..bbff0ab 100644
--- a/src/jalview/jbgui/GDasSourceBrowser.java
+++ b/src/jalview/jbgui/GDasSourceBrowser.java
@@ -1,221 +1,251 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.jbgui;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.border.*;
-import javax.swing.event.*;
-
-public class GDasSourceBrowser extends JPanel
-{
- public GDasSourceBrowser()
- {
- try
- {
- jbInit();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- private void jbInit() throws Exception
- {
- this.setLayout(gridBagLayout1);
- refresh.setText("Refresh Available Sources");
- refresh.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- refresh_actionPerformed(e);
- }
- });
- progressBar.setPreferredSize(new Dimension(450, 20));
- progressBar.setString("");
- scrollPane.setBorder(titledBorder1);
- scrollPane.setBorder(BorderFactory.createEtchedBorder());
- fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder());
- fullDetails.addHyperlinkListener(new HyperlinkListener()
- {
- public void hyperlinkUpdate(HyperlinkEvent e)
- {
- fullDetails_hyperlinkUpdate(e);
- }
- });
- fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- fullDetails.setEditable(false);
- registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- registryLabel.setHorizontalAlignment(SwingConstants.TRAILING);
- registryLabel.setText("Use Registry");
- addLocal.setText("Add Local Source");
- addLocal.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- amendLocal(true);
- }
- });
- jPanel1.setLayout(flowLayout1);
- jPanel1.setMinimumSize(new Dimension(596, 30));
- jPanel1.setPreferredSize(new Dimension(596, 30));
- jScrollPane2.setBorder(titledBorder3);
- jScrollPane3.setBorder(titledBorder4);
- jScrollPane4.setBorder(titledBorder5);
- titledBorder2
- .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- titledBorder3
- .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- titledBorder4
- .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- reset.setMargin(new Insets(2, 2, 2, 2));
- reset.setText("Reset");
- reset.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- reset_actionPerformed(e);
- }
- });
- jPanel2.setLayout(borderLayout1);
- borderLayout1.setHgap(5);
- registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- scrollPane.getViewport().add(table);
- fullDetailsScrollpane.getViewport().add(fullDetails);
- jScrollPane3.getViewport().add(filter2);
- jScrollPane4.getViewport().add(filter3);
- jPanel1.add(refresh, null);
- jPanel1.add(addLocal, null);
- jPanel1.add(progressBar, null);
- jScrollPane2.getViewport().add(filter1);
- this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0,
- GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
- new Insets(0, 0, 0, 0), 0, 0));
- this.add(fullDetailsScrollpane, new GridBagConstraints(1, 0, 2, 1, 1.0,
- 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(3, 0, 0, 3), 240, 130));
- this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
- 3, 2, 0, 0), 150, 130));
- jPanel2.add(registryLabel, java.awt.BorderLayout.WEST);
- jPanel2.add(registryURL, java.awt.BorderLayout.CENTER);
- jPanel2.add(reset, java.awt.BorderLayout.EAST);
- this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
- new Insets(5, 10, 0, 10), 339, 0));
- this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
- 0, 0, 0, 60), 80, 60));
- this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
- 0, -80, 0, 0), 80, 60));
- this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
- 0, -60, 0, 80), 80, 60));
- }
-
- protected JTable table = new JTable();
-
- protected JEditorPane fullDetails = new JEditorPane("text/html", "");
-
- TitledBorder titledBorder1 = new TitledBorder("Available DAS Sources");
-
- protected JButton refresh = new JButton();
-
- protected JProgressBar progressBar = new JProgressBar();
-
- protected JScrollPane scrollPane = new JScrollPane();
-
- TitledBorder titledBorder2 = new TitledBorder("Full Details");
-
- protected JScrollPane fullDetailsScrollpane = new JScrollPane();
-
- protected JList filter1 = new JList();
-
- protected JList filter2 = new JList();
-
- protected JList filter3 = new JList();
-
- JScrollPane jScrollPane2 = new JScrollPane();
-
- JScrollPane jScrollPane3 = new JScrollPane();
-
- JScrollPane jScrollPane4 = new JScrollPane();
-
- protected JTextField registryURL = new JTextField();
-
- protected JLabel registryLabel = new JLabel();
-
- protected JButton addLocal = new JButton();
-
- JPanel jPanel1 = new JPanel();
-
- FlowLayout flowLayout1 = new FlowLayout();
-
- GridBagLayout gridBagLayout1 = new GridBagLayout();
-
- TitledBorder titledBorder3 = new TitledBorder("Authority:");
-
- TitledBorder titledBorder4 = new TitledBorder("Type:");
-
- TitledBorder titledBorder5 = new TitledBorder("Label:");
-
- JButton reset = new JButton();
-
- JPanel jPanel2 = new JPanel();
-
- BorderLayout borderLayout1 = new BorderLayout();
-
- public void refresh_actionPerformed(ActionEvent e)
- {
-
- }
-
- public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)
- {
- try
- {
-
- if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
- {
- jalview.util.BrowserLauncher.openURL(e.getURL().toString());
- }
- } catch (Exception ex)
- {
- System.out.println(e.getURL());
- ex.printStackTrace();
- }
- }
-
- public void amendLocal(boolean newSource)
- {
-
- }
-
- public void reset_actionPerformed(ActionEvent e)
- {
-
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.jbgui;
+
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JEditorPane;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+
+public class GDasSourceBrowser extends JPanel
+{
+ public GDasSourceBrowser()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ private void jbInit() throws Exception
+ {
+ this.setLayout(gridBagLayout1);
+ refresh.setText(MessageManager
+ .getString("label.refresh_available_sources"));
+ refresh.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ refresh_actionPerformed(e);
+ }
+ });
+ progressBar.setPreferredSize(new Dimension(450, 20));
+ progressBar.setString("");
+ scrollPane.setBorder(titledBorder1);
+ scrollPane.setBorder(BorderFactory.createEtchedBorder());
+ fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder());
+ fullDetails.addHyperlinkListener(new HyperlinkListener()
+ {
+ public void hyperlinkUpdate(HyperlinkEvent e)
+ {
+ fullDetails_hyperlinkUpdate(e);
+ }
+ });
+ fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ fullDetails.setEditable(false);
+ registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ registryLabel.setHorizontalAlignment(SwingConstants.TRAILING);
+ registryLabel.setText(MessageManager.getString("label.use_registry"));
+ addLocal.setText(MessageManager.getString("label.add_local_source"));
+ addLocal.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ amendLocal(true);
+ }
+ });
+ jPanel1.setLayout(flowLayout1);
+ jPanel1.setMinimumSize(new Dimension(596, 30));
+ jPanel1.setPreferredSize(new Dimension(596, 30));
+ jScrollPane2.setBorder(titledBorder3);
+ jScrollPane3.setBorder(titledBorder4);
+ jScrollPane4.setBorder(titledBorder5);
+ titledBorder2
+ .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ titledBorder3
+ .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ titledBorder4
+ .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ reset.setMargin(new Insets(2, 2, 2, 2));
+ reset.setText(MessageManager.getString("action.reset"));
+ reset.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ reset_actionPerformed(e);
+ }
+ });
+ jPanel2.setLayout(borderLayout1);
+ borderLayout1.setHgap(5);
+ registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ scrollPane.getViewport().add(table);
+ fullDetailsScrollpane.getViewport().add(fullDetails);
+ jScrollPane3.getViewport().add(filter2);
+ jScrollPane4.getViewport().add(filter3);
+ jPanel1.add(refresh, null);
+ jPanel1.add(addLocal, null);
+ jPanel1.add(progressBar, null);
+ jScrollPane2.getViewport().add(filter1);
+ this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 0, 0, 0), 0, 0));
+ this.add(fullDetailsScrollpane, new GridBagConstraints(1, 0, 2, 1, 1.0,
+ 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
+ new Insets(3, 0, 0, 3), 240, 130));
+ this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 3, 2, 0, 0), 150, 130));
+ jPanel2.add(registryLabel, java.awt.BorderLayout.WEST);
+ jPanel2.add(registryURL, java.awt.BorderLayout.CENTER);
+ jPanel2.add(reset, java.awt.BorderLayout.EAST);
+ this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0,
+ GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+ new Insets(5, 10, 0, 10), 339, 0));
+ this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 0, 0, 0, 60), 80, 60));
+ this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 0, -80, 0, 0), 80, 60));
+ this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 0, -60, 0, 80), 80, 60));
+ }
+
+ protected JTable table = new JTable();
+
+ protected JEditorPane fullDetails = new JEditorPane("text/html", "");
+
+ TitledBorder titledBorder1 = new TitledBorder(
+ MessageManager.getString("label.available_das_sources"));
+
+ protected JButton refresh = new JButton();
+
+ protected JProgressBar progressBar = new JProgressBar();
+
+ protected JScrollPane scrollPane = new JScrollPane();
+
+ TitledBorder titledBorder2 = new TitledBorder(
+ MessageManager.getString("label.full_details"));
+
+ protected JScrollPane fullDetailsScrollpane = new JScrollPane();
+
+ protected JList filter1 = new JList();
+
+ protected JList filter2 = new JList();
+
+ protected JList filter3 = new JList();
+
+ JScrollPane jScrollPane2 = new JScrollPane();
+
+ JScrollPane jScrollPane3 = new JScrollPane();
+
+ JScrollPane jScrollPane4 = new JScrollPane();
+
+ protected JTextField registryURL = new JTextField();
+
+ protected JLabel registryLabel = new JLabel();
+
+ protected JButton addLocal = new JButton();
+
+ JPanel jPanel1 = new JPanel();
+
+ FlowLayout flowLayout1 = new FlowLayout();
+
+ GridBagLayout gridBagLayout1 = new GridBagLayout();
+
+ TitledBorder titledBorder3 = new TitledBorder(
+ MessageManager.getString("label.authority") + ":");
+
+ TitledBorder titledBorder4 = new TitledBorder(
+ MessageManager.getString("label.type") + ":");
+
+ TitledBorder titledBorder5 = new TitledBorder(
+ MessageManager.getString("label.label") + ":");
+
+ JButton reset = new JButton();
+
+ JPanel jPanel2 = new JPanel();
+
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ public void refresh_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)
+ {
+ try
+ {
+
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
+ {
+ jalview.util.BrowserLauncher.openURL(e.getURL().toString());
+ }
+ } catch (Exception ex)
+ {
+ System.out.println(e.getURL());
+ ex.printStackTrace();
+ }
+ }
+
+ public void amendLocal(boolean newSource)
+ {
+
+ }
+
+ public void reset_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+}
diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java
index d7e8be3..8fd5921 100644
--- a/src/jalview/jbgui/GDesktop.java
+++ b/src/jalview/jbgui/GDesktop.java
@@ -1,26 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
+import jalview.api.AlignmentViewPanel;
+import jalview.util.MessageManager;
+
+import java.awt.FlowLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
-import javax.swing.*;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
/**
* DOCUMENT ME!
@@ -90,6 +102,8 @@ public class GDesktop extends JFrame
protected JCheckBoxMenuItem showNews = new JCheckBoxMenuItem();
+ protected JMenuItem snapShotWindow = new JMenuItem();
+
/**
* Creates a new GDesktop object.
*/
@@ -126,13 +140,17 @@ public class GDesktop extends JFrame
*/
private void jbInit() throws Exception
{
- FileMenu.setText("File");
- HelpMenu.setText("Help");
+
+ FileMenu.setText(MessageManager.getString("action.file"));
+ HelpMenu.setText(MessageManager.getString("action.help"));
VamsasMenu.setText("Vamsas");
- VamsasMenu.setToolTipText("Share data with other vamsas applications.");
- VamsasStMenu.setText("Connect to");
- VamsasStMenu.setToolTipText("Join an existing vamsas session");
- inputLocalFileMenuItem.setText("from File");
+ VamsasMenu.setToolTipText(MessageManager
+ .getString("label.share_data_vamsas_applications"));
+ VamsasStMenu.setText(MessageManager.getString("label.connect_to"));
+ VamsasStMenu.setToolTipText(MessageManager
+ .getString("label.join_existing_vamsas_session"));
+ inputLocalFileMenuItem.setText(MessageManager
+ .getString("label.load_tree_from_file"));
inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
.getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
.getDefaultToolkit().getMenuShortcutKeyMask(), false));
@@ -144,7 +162,7 @@ public class GDesktop extends JFrame
inputLocalFileMenuItem_actionPerformed(null);
}
});
- inputURLMenuItem.setText("from URL");
+ inputURLMenuItem.setText(MessageManager.getString("label.from_url"));
inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -152,7 +170,8 @@ public class GDesktop extends JFrame
inputURLMenuItem_actionPerformed(null);
}
});
- inputTextboxMenuItem.setText("from Textbox");
+ inputTextboxMenuItem.setText(MessageManager
+ .getString("label.from_textbox"));
inputTextboxMenuItem
.addActionListener(new java.awt.event.ActionListener()
{
@@ -161,7 +180,7 @@ public class GDesktop extends JFrame
inputTextboxMenuItem_actionPerformed(null);
}
});
- quit.setText("Quit");
+ quit.setText(MessageManager.getString("action.quit"));
quit.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -169,7 +188,7 @@ public class GDesktop extends JFrame
quit();
}
});
- aboutMenuItem.setText("About");
+ aboutMenuItem.setText(MessageManager.getString("label.about"));
aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -177,7 +196,8 @@ public class GDesktop extends JFrame
aboutMenuItem_actionPerformed(e);
}
});
- documentationMenuItem.setText("Documentation");
+ documentationMenuItem.setText(MessageManager
+ .getString("label.documentation"));
documentationMenuItem.setAccelerator(javax.swing.KeyStroke
.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false));
documentationMenuItem
@@ -189,8 +209,8 @@ public class GDesktop extends JFrame
}
});
this.getContentPane().setLayout(flowLayout1);
- windowMenu.setText("Window");
- preferences.setText("Preferences...");
+ windowMenu.setText(MessageManager.getString("label.window"));
+ preferences.setText(MessageManager.getString("label.preferences"));
preferences.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -198,8 +218,8 @@ public class GDesktop extends JFrame
preferences_actionPerformed(e);
}
});
- toolsMenu.setText("Tools");
- saveState.setText("Save Project");
+ toolsMenu.setText(MessageManager.getString("label.tools"));
+ saveState.setText(MessageManager.getString("action.save_project"));
saveState.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -207,7 +227,7 @@ public class GDesktop extends JFrame
saveState_actionPerformed(e);
}
});
- loadState.setText("Load Project");
+ loadState.setText(MessageManager.getString("action.load_project"));
loadState.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -215,8 +235,9 @@ public class GDesktop extends JFrame
loadState_actionPerformed(e);
}
});
- inputMenu.setText("Input Alignment");
- vamsasStart.setText("New Vamsas Session...");
+ inputMenu.setText(MessageManager.getString("label.input_alignment"));
+ vamsasStart.setText(MessageManager
+ .getString("label.new_vamsas_session"));
vamsasStart.setVisible(false);
vamsasStart.addActionListener(new ActionListener()
{
@@ -225,7 +246,8 @@ public class GDesktop extends JFrame
vamsasStart_actionPerformed(e);
}
});
- vamsasImport.setText("Load Vamsas Session...");
+ vamsasImport.setText(MessageManager
+ .getString("action.load_vamsas_session"));
vamsasImport.setVisible(false);
vamsasImport.addActionListener(new ActionListener()
{
@@ -234,7 +256,8 @@ public class GDesktop extends JFrame
vamsasImport_actionPerformed(e);
}
});
- vamsasSave.setText("Save Vamsas Session...");
+ vamsasSave.setText(MessageManager
+ .getString("action.save_vamsas_session"));
vamsasSave.setVisible(false);
vamsasSave.addActionListener(new ActionListener()
{
@@ -243,7 +266,8 @@ public class GDesktop extends JFrame
vamsasSave_actionPerformed(e);
}
});
- inputSequence.setText("Fetch Sequence(s)...");
+ inputSequence.setText(MessageManager
+ .getString("action.fetch_sequences"));
inputSequence.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -251,7 +275,8 @@ public class GDesktop extends JFrame
inputSequence_actionPerformed(e);
}
});
- vamsasStop.setText("Stop Vamsas Session");
+ vamsasStop.setText(MessageManager
+ .getString("label.stop_vamsas_session"));
vamsasStop.setVisible(false);
vamsasStop.addActionListener(new ActionListener()
{
@@ -260,7 +285,7 @@ public class GDesktop extends JFrame
vamsasStop_actionPerformed(e);
}
});
- closeAll.setText("Close All");
+ closeAll.setText(MessageManager.getString("action.close_all"));
closeAll.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -268,7 +293,8 @@ public class GDesktop extends JFrame
closeAll_actionPerformed(e);
}
});
- raiseRelated.setText("Raise Associated Windows");
+ raiseRelated.setText(MessageManager
+ .getString("action.raise_associated_windows"));
raiseRelated.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -276,7 +302,8 @@ public class GDesktop extends JFrame
raiseRelated_actionPerformed(e);
}
});
- minimizeAssociated.setText("Minimize Associated Windows");
+ minimizeAssociated.setText(MessageManager
+ .getString("action.minimize_associated_windows"));
minimizeAssociated.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -284,7 +311,8 @@ public class GDesktop extends JFrame
minimizeAssociated_actionPerformed(e);
}
});
- garbageCollect.setText("Collect Garbage");
+ garbageCollect.setText(MessageManager
+ .getString("label.collect_garbage"));
garbageCollect.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -292,7 +320,8 @@ public class GDesktop extends JFrame
garbageCollect_actionPerformed(e);
}
});
- showMemusage.setText("Show Memory Usage");
+ showMemusage.setText(MessageManager
+ .getString("label.show_memory_usage"));
showMemusage.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -300,7 +329,8 @@ public class GDesktop extends JFrame
showMemusage_actionPerformed(e);
}
});
- showConsole.setText("Show Java Console");
+ showConsole
+ .setText(MessageManager.getString("label.show_java_console"));
showConsole.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -308,7 +338,7 @@ public class GDesktop extends JFrame
showConsole_actionPerformed(e);
}
});
- showNews.setText("Show Jalview News");
+ showNews.setText(MessageManager.getString("label.show_jalview_news"));
showNews.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -316,6 +346,15 @@ public class GDesktop extends JFrame
showNews_actionPerformed(e);
}
});
+ snapShotWindow.setText(MessageManager.getString("label.take_snapshot"));
+ snapShotWindow.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ snapShotWindow_actionPerformed(e);
+ }
+ });
+
desktopMenubar.add(FileMenu);
desktopMenubar.add(toolsMenu);
VamsasMenu.setVisible(false);
@@ -342,6 +381,7 @@ public class GDesktop extends JFrame
toolsMenu.add(showConsole);
toolsMenu.add(showNews);
toolsMenu.add(garbageCollect);
+ // toolsMenu.add(snapShotWindow);
inputMenu.add(inputLocalFileMenuItem);
inputMenu.add(inputURLMenuItem);
inputMenu.add(inputTextboxMenuItem);
@@ -352,16 +392,24 @@ public class GDesktop extends JFrame
// inputMenu.add(vamsasLoad);
}
+ protected void snapShotWindow_actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
protected void showConsole_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
}
+
protected void showNews_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
}
+
protected void showMemusage_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
@@ -410,8 +458,7 @@ public class GDesktop extends JFrame
* @param e
* DOCUMENT ME!
*/
- protected void inputTextboxMenuItem_actionPerformed(
- jalview.gui.AlignViewport av)
+ protected void inputTextboxMenuItem_actionPerformed(AlignmentViewPanel avp)
{
}
diff --git a/src/jalview/jbgui/GFinder.java b/src/jalview/jbgui/GFinder.java
index 78ae0a8..af1760f 100644
--- a/src/jalview/jbgui/GFinder.java
+++ b/src/jalview/jbgui/GFinder.java
@@ -1,39 +1,57 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.datamodel.*;
-import jalview.io.*;
+import jalview.datamodel.AlignmentI;
+import jalview.io.FormatAdapter;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.event.CaretEvent;
+import javax.swing.event.CaretListener;
public class GFinder extends JPanel
{
- JLabel jLabel1 = new JLabel();
+ JLabel jLabelFind = new JLabel();
protected JButton findAll = new JButton();
protected JButton findNext = new JButton();
- JPanel jPanel1 = new JPanel();
+ JPanel actionsPanel = new JPanel();
GridLayout gridLayout1 = new GridLayout();
@@ -43,7 +61,7 @@ public class GFinder extends JPanel
protected JTextArea textfield = new JTextArea();
- BorderLayout borderLayout1 = new BorderLayout();
+ BorderLayout mainBorderLayout = new BorderLayout();
JPanel jPanel2 = new JPanel();
@@ -57,6 +75,10 @@ public class GFinder extends JPanel
protected JCheckBox caseSensitive = new JCheckBox();
+ protected JCheckBox searchDescription = new JCheckBox();
+
+ GridLayout optionsGridLayout = new GridLayout();
+
public GFinder()
{
try
@@ -70,11 +92,11 @@ public class GFinder extends JPanel
private void jbInit() throws Exception
{
- jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));
- jLabel1.setText("Find");
- this.setLayout(borderLayout1);
+ jLabelFind.setFont(new java.awt.Font("Verdana", 0, 12));
+ jLabelFind.setText(MessageManager.getString("label.find"));
+ this.setLayout(mainBorderLayout);
findAll.setFont(new java.awt.Font("Verdana", 0, 12));
- findAll.setText("Find all");
+ findAll.setText(MessageManager.getString("action.find_all"));
findAll.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -83,7 +105,7 @@ public class GFinder extends JPanel
}
});
findNext.setFont(new java.awt.Font("Verdana", 0, 12));
- findNext.setText("Find Next");
+ findNext.setText(MessageManager.getString("action.find_next"));
findNext.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -91,14 +113,14 @@ public class GFinder extends JPanel
findNext_actionPerformed(e);
}
});
- jPanel1.setLayout(gridLayout1);
+ actionsPanel.setLayout(gridLayout1);
gridLayout1.setHgap(0);
gridLayout1.setRows(3);
gridLayout1.setVgap(2);
createNewGroup.setEnabled(false);
createNewGroup.setFont(new java.awt.Font("Verdana", 0, 12));
createNewGroup.setMargin(new Insets(0, 0, 0, 0));
- createNewGroup.setText("New Feature");
+ createNewGroup.setText(MessageManager.getString("label.new_feature"));
createNewGroup.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -124,25 +146,38 @@ public class GFinder extends JPanel
}
});
- borderLayout1.setHgap(5);
- borderLayout1.setVgap(5);
+ mainBorderLayout.setHgap(5);
+ mainBorderLayout.setVgap(5);
jPanel4.setLayout(borderLayout2);
jPanel2.setPreferredSize(new Dimension(10, 1));
jPanel3.setPreferredSize(new Dimension(10, 1));
caseSensitive.setHorizontalAlignment(SwingConstants.LEFT);
- caseSensitive.setText("Match Case");
- jPanel1.add(findNext, null);
- jPanel1.add(findAll, null);
- jPanel1.add(createNewGroup, null);
- this.add(jLabel1, java.awt.BorderLayout.WEST);
- this.add(jPanel1, java.awt.BorderLayout.EAST);
+ caseSensitive.setText(MessageManager.getString("label.match_case"));
+
+ searchDescription.setText(MessageManager
+ .getString("label.include_description"));
+
+ actionsPanel.add(findNext, null);
+ actionsPanel.add(findAll, null);
+ actionsPanel.add(createNewGroup, null);
+ this.add(jLabelFind, java.awt.BorderLayout.WEST);
+ this.add(actionsPanel, java.awt.BorderLayout.EAST);
this.add(jPanel2, java.awt.BorderLayout.SOUTH);
this.add(jPanel3, java.awt.BorderLayout.NORTH);
this.add(jPanel4, java.awt.BorderLayout.CENTER);
- jPanel4.add(jScrollPane1, java.awt.BorderLayout.CENTER);
+ jPanel4.add(jScrollPane1, java.awt.BorderLayout.NORTH);
jScrollPane1.getViewport().add(textfield);
- jPanel4.add(jPanel6, java.awt.BorderLayout.NORTH);
- jPanel4.add(caseSensitive, java.awt.BorderLayout.SOUTH);
+
+ JPanel optionsPanel = new JPanel();
+
+ optionsGridLayout.setHgap(0);
+ optionsGridLayout.setRows(2);
+ optionsGridLayout.setVgap(2);
+ optionsPanel.setLayout(optionsGridLayout);
+ optionsPanel.add(caseSensitive, null);
+ optionsPanel.add(searchDescription, null);
+
+ jPanel4.add(optionsPanel, java.awt.BorderLayout.WEST);
}
protected void findNext_actionPerformed(ActionEvent e)
@@ -175,7 +210,7 @@ public class GFinder extends JPanel
public void run()
{
String str = textfield.getText();
- Alignment al = null;
+ AlignmentI al = null;
try
{
al = new FormatAdapter().readFile(str, "Paste", "FASTA");
diff --git a/src/jalview/jbgui/GFontChooser.java b/src/jalview/jbgui/GFontChooser.java
index 3352e42..d4b8906 100644
--- a/src/jalview/jbgui/GFontChooser.java
+++ b/src/jalview/jbgui/GFontChooser.java
@@ -1,27 +1,42 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
import jalview.gui.JvSwingUtils;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
/**
* DOCUMENT ME!
@@ -31,43 +46,22 @@ import javax.swing.*;
*/
public class GFontChooser extends JPanel
{
- JLabel jLabel1 = new JLabel();
-
- protected JComboBox fontSize = new JComboBox();
-
- protected JComboBox fontStyle = new JComboBox();
-
- JLabel jLabel2 = new JLabel();
-
- JLabel jLabel3 = new JLabel();
-
- protected JComboBox fontName = new JComboBox();
-
- JButton ok = new JButton();
+ private static final Font VERDANA_11PT = new java.awt.Font("Verdana", 0,
+ 11);
- JButton cancel = new JButton();
+ protected JComboBox<Integer> fontSize = new JComboBox<Integer>();
- JPanel jPanel1 = new JPanel();
+ protected JComboBox<String> fontStyle = new JComboBox<String>();
- JPanel jPanel2 = new JPanel();
-
- JPanel jPanel3 = new JPanel();
-
- BorderLayout borderLayout1 = new BorderLayout();
-
- BorderLayout borderLayout2 = new BorderLayout();
-
- BorderLayout borderLayout3 = new BorderLayout();
+ protected JComboBox<String> fontName = new JComboBox<String>();
protected JButton defaultButton = new JButton();
protected JCheckBox smoothFont = new JCheckBox();
- BorderLayout borderLayout4 = new BorderLayout();
-
protected JCheckBox monospaced = new JCheckBox();
- JPanel jPanel4 = new JPanel();
+ protected JCheckBox scaleAsCdna = new JCheckBox();
/**
* Creates a new GFontChooser object.
@@ -91,12 +85,15 @@ public class GFontChooser extends JPanel
*/
private void jbInit() throws Exception
{
- jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
- jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
- jLabel1.setText("Font: ");
- jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
this.setLayout(null);
- fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
+ this.setBackground(Color.white);
+
+ JLabel fontLabel = new JLabel(MessageManager.getString("label.font"));
+ fontLabel.setFont(VERDANA_11PT);
+ fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ fontLabel.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
+
+ fontSize.setFont(VERDANA_11PT);
fontSize.setOpaque(false);
fontSize.setPreferredSize(new Dimension(50, 21));
fontSize.addActionListener(new java.awt.event.ActionListener()
@@ -106,7 +103,8 @@ public class GFontChooser extends JPanel
fontSize_actionPerformed(e);
}
});
- fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
+
+ fontStyle.setFont(VERDANA_11PT);
fontStyle.setOpaque(false);
fontStyle.setPreferredSize(new Dimension(90, 21));
fontStyle.addActionListener(new java.awt.event.ActionListener()
@@ -116,15 +114,18 @@ public class GFontChooser extends JPanel
fontStyle_actionPerformed(e);
}
});
- jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
- jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
- jLabel2.setText("Size: ");
- jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
- jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
- jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
- jLabel3.setText("Style: ");
- jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
- fontName.setFont(new java.awt.Font("Verdana", 0, 11));
+
+ JLabel sizeLabel = new JLabel(MessageManager.getString("label.size"));
+ sizeLabel.setFont(VERDANA_11PT);
+ sizeLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ sizeLabel.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
+
+ JLabel styleLabel = new JLabel(MessageManager.getString("label.style"));
+ styleLabel.setFont(VERDANA_11PT);
+ styleLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ styleLabel.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
+
+ fontName.setFont(VERDANA_11PT);
fontName.setMaximumSize(new Dimension(32767, 32767));
fontName.setMinimumSize(new Dimension(300, 21));
fontName.setOpaque(false);
@@ -136,8 +137,9 @@ public class GFontChooser extends JPanel
fontName_actionPerformed(e);
}
});
- ok.setFont(new java.awt.Font("Verdana", 0, 11));
- ok.setText("OK");
+
+ JButton ok = new JButton(MessageManager.getString("action.ok"));
+ ok.setFont(VERDANA_11PT);
ok.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -145,8 +147,9 @@ public class GFontChooser extends JPanel
ok_actionPerformed(e);
}
});
- cancel.setFont(new java.awt.Font("Verdana", 0, 11));
- cancel.setText("Cancel");
+
+ JButton cancel = new JButton(MessageManager.getString("action.cancel"));
+ cancel.setFont(VERDANA_11PT);
cancel.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -154,18 +157,9 @@ public class GFontChooser extends JPanel
cancel_actionPerformed(e);
}
});
- this.setBackground(Color.white);
- jPanel1.setOpaque(false);
- jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
- jPanel1.setLayout(borderLayout1);
- jPanel2.setOpaque(false);
- jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
- jPanel2.setLayout(borderLayout3);
- jPanel3.setOpaque(false);
- jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
- jPanel3.setLayout(borderLayout2);
+
defaultButton.setFont(JvSwingUtils.getLabelFont());
- defaultButton.setText("Set as Default");
+ defaultButton.setText(MessageManager.getString("label.set_as_default"));
defaultButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -173,10 +167,11 @@ public class GFontChooser extends JPanel
defaultButton_actionPerformed(e);
}
});
+
smoothFont.setFont(JvSwingUtils.getLabelFont());
smoothFont.setOpaque(false);
- smoothFont.setText("Anti-alias Fonts (Slower to render)");
- smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
+ smoothFont.setText(MessageManager.getString("label.anti_alias_fonts"));
+ smoothFont.setBounds(new Rectangle(41, 65, 260, 23));
smoothFont.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -184,30 +179,83 @@ public class GFontChooser extends JPanel
smoothFont_actionPerformed(e);
}
});
+
+ /*
+ * Scale protein as cDNA is only visible in SplitFrame protein alignment
+ */
+ scaleAsCdna.setVisible(false);
+ scaleAsCdna.setFont(JvSwingUtils.getLabelFont());
+ scaleAsCdna.setOpaque(false);
+ scaleAsCdna.setText(MessageManager.getString("label.scale_as_cdna"));
+ scaleAsCdna.setBounds(new Rectangle(41, 85, 260, 23));
+ scaleAsCdna.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ scaleAsCdna_actionPerformed(e);
+ }
+ });
+
monospaced.setEnabled(false);
monospaced.setFont(JvSwingUtils.getLabelFont());
monospaced.setOpaque(false);
- monospaced.setToolTipText("Monospaced fonts are faster to render");
- monospaced.setText("Monospaced");
- jPanel4.setOpaque(false);
- jPanel4.setBounds(new Rectangle(24, 92, 259, 35));
- jPanel1.add(jLabel1, BorderLayout.WEST);
+ monospaced.setToolTipText(MessageManager
+ .getString("label.monospaced_fonts_faster_to_render"));
+ monospaced.setText(MessageManager.getString("label.monospaced_font"));
+
+ /*
+ * jPanel1: Font dropdown, Monospaced checkbox
+ */
+ JPanel jPanel1 = new JPanel();
+ jPanel1.setOpaque(false);
+ jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
+ jPanel1.setLayout(new BorderLayout());
+ jPanel1.add(fontLabel, BorderLayout.WEST);
jPanel1.add(fontName, BorderLayout.CENTER);
jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
- this.add(jPanel3, null);
- this.add(jPanel2, null);
+
+ /*
+ * jPanel2: font size dropdown
+ */
+ JPanel jPanel2 = new JPanel();
+ jPanel2.setOpaque(false);
+ jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
+ jPanel2.setLayout(new BorderLayout());
jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
- jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
+ jPanel2.add(sizeLabel, java.awt.BorderLayout.WEST);
+
+ /*
+ * jPanel3: font style dropdown
+ */
+ JPanel jPanel3 = new JPanel();
+ jPanel3.setOpaque(false);
+ jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
+ jPanel3.setLayout(new BorderLayout());
+ jPanel3.add(styleLabel, java.awt.BorderLayout.WEST);
+ jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
+
+ /*
+ * jPanel4: Default and OK buttons
+ */
+ JPanel jPanel4 = new JPanel();
+ jPanel4.setOpaque(false);
+ jPanel4.setBounds(new Rectangle(24, 112, 300, 35));
jPanel4.add(defaultButton);
jPanel4.add(ok);
jPanel4.add(cancel);
+
this.add(smoothFont);
+ this.add(scaleAsCdna);
+ this.add(jPanel3, null);
+ this.add(jPanel2, null);
this.add(jPanel4);
- jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
- jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
this.add(jPanel1, null);
}
+ protected void scaleAsCdna_actionPerformed(ActionEvent e)
+ {
+ }
+
/**
* DOCUMENT ME!
*
diff --git a/src/jalview/jbgui/GPCAPanel.java b/src/jalview/jbgui/GPCAPanel.java
index 843a4ec..f57845d 100644
--- a/src/jalview/jbgui/GPCAPanel.java
+++ b/src/jalview/jbgui/GPCAPanel.java
@@ -1,27 +1,45 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JComboBox;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
public class GPCAPanel extends JInternalFrame
{
@@ -39,6 +57,8 @@ public class GPCAPanel extends JInternalFrame
protected JComboBox zCombobox = new JComboBox();
+ protected JButton resetButton = new JButton();
+
FlowLayout flowLayout1 = new FlowLayout();
BorderLayout borderLayout1 = new BorderLayout();
@@ -49,6 +69,8 @@ public class GPCAPanel extends JInternalFrame
JMenu saveMenu = new JMenu();
+ protected JMenu scoreMatrixMenu = new JMenu();
+
JMenuItem eps = new JMenuItem();
JMenuItem png = new JMenuItem();
@@ -71,6 +93,20 @@ public class GPCAPanel extends JInternalFrame
protected JMenu associateViewsMenu = new JMenu();
+ protected JMenu calcSettings = new JMenu();
+
+ protected JCheckBoxMenuItem nuclSetting = new JCheckBoxMenuItem();
+
+ protected JCheckBoxMenuItem protSetting = new JCheckBoxMenuItem();
+
+ protected JCheckBoxMenuItem jvVersionSetting = new JCheckBoxMenuItem();
+
+ protected JLabel statusBar = new JLabel();
+
+ protected GridLayout statusPanelLayout = new GridLayout();
+
+ protected JPanel statusPanel = new JPanel();
+
public GPCAPanel()
{
try
@@ -127,8 +163,18 @@ public class GPCAPanel extends JInternalFrame
xCombobox_actionPerformed(e);
}
});
- fileMenu.setText("File");
- saveMenu.setText("Save as");
+ resetButton.setFont(new java.awt.Font("Verdana", 0, 12));
+ resetButton.setText(MessageManager.getString("action.reset"));
+ resetButton.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ resetButton_actionPerformed(e);
+ }
+ });
+ fileMenu.setText(MessageManager.getString("action.file"));
+ saveMenu.setText(MessageManager.getString("action.save_as"));
eps.setText("EPS");
eps.addActionListener(new ActionListener()
{
@@ -145,7 +191,7 @@ public class GPCAPanel extends JInternalFrame
png_actionPerformed(e);
}
});
- outputValues.setText("Output Values...");
+ outputValues.setText(MessageManager.getString("label.output_values"));
outputValues.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -153,7 +199,7 @@ public class GPCAPanel extends JInternalFrame
outputValues_actionPerformed(e);
}
});
- outputPoints.setText("Output points...");
+ outputPoints.setText(MessageManager.getString("label.output_points"));
outputPoints.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -161,7 +207,8 @@ public class GPCAPanel extends JInternalFrame
outputPoints_actionPerformed(e);
}
});
- outputProjPoints.setText("Output transformed points...");
+ outputProjPoints.setText(MessageManager
+ .getString("label.output_transformed_points"));
outputProjPoints.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -176,7 +223,7 @@ public class GPCAPanel extends JInternalFrame
print_actionPerformed(e);
}
});
- viewMenu.setText("View");
+ viewMenu.setText(MessageManager.getString("action.view"));
viewMenu.addMenuListener(new MenuListener()
{
public void menuSelected(MenuEvent e)
@@ -192,7 +239,24 @@ public class GPCAPanel extends JInternalFrame
{
}
});
- showLabels.setText("Show Labels");
+ scoreMatrixMenu.setText(MessageManager
+ .getString("label.select_score_model"));
+ scoreMatrixMenu.addMenuListener(new MenuListener()
+ {
+ public void menuSelected(MenuEvent e)
+ {
+ scoreMatrix_menuSelected();
+ }
+
+ public void menuDeselected(MenuEvent e)
+ {
+ }
+
+ public void menuCanceled(MenuEvent e)
+ {
+ }
+ });
+ showLabels.setText(MessageManager.getString("label.show_labels"));
showLabels.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -200,8 +264,8 @@ public class GPCAPanel extends JInternalFrame
showLabels_actionPerformed(e);
}
});
- print.setText("Print");
- bgcolour.setText("Background Colour...");
+ print.setText(MessageManager.getString("action.print"));
+ bgcolour.setText(MessageManager.getString("action.background_colour"));
bgcolour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -209,7 +273,7 @@ public class GPCAPanel extends JInternalFrame
bgcolour_actionPerformed(e);
}
});
- originalSeqData.setText("Input Data...");
+ originalSeqData.setText(MessageManager.getString("label.input_data"));
originalSeqData.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -217,16 +281,63 @@ public class GPCAPanel extends JInternalFrame
originalSeqData_actionPerformed(e);
}
});
- associateViewsMenu.setText("Associate Nodes With");
- this.getContentPane().add(jPanel2, BorderLayout.SOUTH);
+ associateViewsMenu.setText(MessageManager
+ .getString("label.associate_nodes_with"));
+ calcSettings.setText(MessageManager.getString("action.change_params"));
+ nuclSetting
+ .setText(MessageManager.getString("label.nucleotide_matrix"));
+ protSetting.setText(MessageManager.getString("label.protein_matrix"));
+ nuclSetting.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ nuclSetting_actionPerfomed(arg0);
+ }
+ });
+ protSetting.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ protSetting_actionPerfomed(arg0);
+ }
+ });
+ jvVersionSetting.setText(MessageManager
+ .getString("label.jalview_pca_calculation"));
+ jvVersionSetting.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ jvVersionSetting_actionPerfomed(arg0);
+ }
+ });
+ calcSettings.add(jvVersionSetting);
+ calcSettings.add(nuclSetting);
+ calcSettings.add(protSetting);
+ calcSettings.add(scoreMatrixMenu);
+ statusPanel.setLayout(statusPanelLayout);
+ statusBar.setFont(new java.awt.Font("Verdana", 0, 12));
+ // statusPanel.setBackground(Color.lightGray);
+ // statusBar.setBackground(Color.lightGray);
+ // statusPanel.add(statusBar, null);
+ JPanel panelBar = new JPanel(new BorderLayout());
+ panelBar.add(jPanel2, BorderLayout.NORTH);
+ panelBar.add(statusPanel, BorderLayout.SOUTH);
+ this.getContentPane().add(panelBar, BorderLayout.SOUTH);
jPanel2.add(jLabel1, null);
jPanel2.add(xCombobox, null);
jPanel2.add(jLabel2, null);
jPanel2.add(yCombobox, null);
jPanel2.add(jLabel3, null);
jPanel2.add(zCombobox, null);
+ jPanel2.add(resetButton, null);
jMenuBar1.add(fileMenu);
jMenuBar1.add(viewMenu);
+ jMenuBar1.add(calcSettings);
fileMenu.add(saveMenu);
fileMenu.add(outputValues);
fileMenu.add(print);
@@ -240,6 +351,30 @@ public class GPCAPanel extends JInternalFrame
viewMenu.add(associateViewsMenu);
}
+ protected void scoreMatrix_menuSelected()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void resetButton_actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void protSetting_actionPerfomed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void nuclSetting_actionPerfomed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
protected void outputPoints_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
@@ -303,4 +438,10 @@ public class GPCAPanel extends JInternalFrame
{
}
+
+ protected void jvVersionSetting_actionPerfomed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/src/jalview/jbgui/GPDBSearchPanel.java b/src/jalview/jbgui/GPDBSearchPanel.java
new file mode 100644
index 0000000..64095d0
--- /dev/null
+++ b/src/jalview/jbgui/GPDBSearchPanel.java
@@ -0,0 +1,396 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.jbgui;
+
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
+import jalview.jbgui.PDBDocFieldPreferences.PreferenceSource;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.PDBRestClient.PDBDocField;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Arrays;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+/**
+ * GUI layout for PDB Fetch Panel
+ *
+ * @author tcnofoegbu
+ *
+ */
+ at SuppressWarnings("serial")
+public abstract class GPDBSearchPanel extends JPanel
+{
+ protected String frameTitle = MessageManager
+ .getString("label.pdb_sequence_getcher");
+
+ protected JInternalFrame mainFrame = new JInternalFrame(frameTitle);
+
+ protected JComboBox<PDBDocField> cmb_searchTarget = new JComboBox<PDBDocField>();
+
+ protected JButton btn_ok = new JButton();
+
+ protected JButton btn_back = new JButton();
+
+ protected JButton btn_cancel = new JButton();
+
+ protected JTextField txt_search = new JTextField(20);
+
+ protected JTable tbl_summary = new JTable()
+ {
+ public String getToolTipText(MouseEvent evt)
+ {
+ String toolTipText = null;
+ java.awt.Point pnt = evt.getPoint();
+ int rowIndex = rowAtPoint(pnt);
+ int colIndex = columnAtPoint(pnt);
+
+ try
+ {
+ toolTipText = getValueAt(rowIndex, colIndex).toString();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ toolTipText = (toolTipText == null ? null
+ : (toolTipText.length() > 500 ? JvSwingUtils.wrapTooltip(
+ true, toolTipText.subSequence(0, 500) + "...")
+ : JvSwingUtils.wrapTooltip(true, toolTipText)));
+
+ return toolTipText;
+ }
+ };
+
+ protected StringBuilder errorWarning = new StringBuilder();
+
+ protected JScrollPane scrl_searchResult = new JScrollPane(tbl_summary);
+
+ protected ImageIcon warningImage = new ImageIcon(getClass().getResource(
+ "/images/warning.gif"));
+
+ protected ImageIcon loadingImage = new ImageIcon(getClass().getResource(
+ "/images/loading.gif"));
+
+ protected JLabel lbl_warning = new JLabel(warningImage);
+
+ protected JLabel lbl_loading = new JLabel(loadingImage);
+
+ private JTabbedPane tabbedPane = new JTabbedPane();
+
+ private PDBDocFieldPreferences pdbDocFieldPrefs = new PDBDocFieldPreferences(
+ PreferenceSource.SEARCH_SUMMARY);
+
+ private JPanel pnl_actions = new JPanel();
+
+ private JPanel pnl_results = new JPanel();
+
+ private JPanel pnl_inputs = new JPanel();
+
+ private BorderLayout mainLayout = new BorderLayout();
+
+ protected PDBDocField[] previousWantedFields;
+
+ public GPDBSearchPanel()
+ {
+ try
+ {
+ jbInit();
+ mainFrame.invalidate();
+ mainFrame.pack();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Initializes the GUI default properties
+ *
+ * @throws Exception
+ */
+ private void jbInit() throws Exception
+ {
+ lbl_warning.setVisible(false);
+ lbl_warning.setFont(new java.awt.Font("Verdana", 0, 12));
+ lbl_loading.setVisible(false);
+ lbl_loading.setFont(new java.awt.Font("Verdana", 0, 12));
+
+ tbl_summary.setAutoCreateRowSorter(true);
+ tbl_summary.getTableHeader().setReorderingAllowed(false);
+ tbl_summary.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ validateSelection();
+ }
+
+ public void mouseReleased(MouseEvent e)
+ {
+ validateSelection();
+ }
+ });
+
+ btn_back.setFont(new java.awt.Font("Verdana", 0, 12));
+ btn_back.setText(MessageManager.getString("action.back"));
+ btn_back.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ btn_back_ActionPerformed();
+ }
+ });
+
+ btn_ok.setEnabled(false);
+ btn_ok.setFont(new java.awt.Font("Verdana", 0, 12));
+ btn_ok.setText(MessageManager.getString("action.ok"));
+ btn_ok.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ btn_ok_ActionPerformed();
+ }
+ });
+ btn_cancel.setFont(new java.awt.Font("Verdana", 0, 12));
+ btn_cancel.setText(MessageManager.getString("action.cancel"));
+ btn_cancel.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ btn_cancel_ActionPerformed();
+ }
+ });
+
+ scrl_searchResult.setPreferredSize(new Dimension(500, 300));
+ scrl_searchResult
+ .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+
+ cmb_searchTarget.setFont(new java.awt.Font("Verdana", 0, 12));
+ cmb_searchTarget.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ String tooltipText;
+ if ("all".equalsIgnoreCase(getCmbSearchTarget().getSelectedItem()
+ .toString()))
+ {
+ tooltipText = MessageManager.getString("label.search_all");
+ }
+ else if ("pdb id".equalsIgnoreCase(getCmbSearchTarget()
+ .getSelectedItem().toString()))
+ {
+ tooltipText = MessageManager
+ .getString("label.separate_multiple_accession_ids");
+ }
+ else
+ {
+ tooltipText = MessageManager.formatMessage(
+ "label.separate_multiple_query_values",
+ new Object[] { getCmbSearchTarget().getSelectedItem()
+ .toString() });
+ }
+ txt_search.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ tooltipText));
+ txt_search_ActionPerformed();
+ }
+ });
+
+ populateCmbSearchTargetOptions();
+
+ txt_search.setFont(new java.awt.Font("Verdana", 0, 12));
+
+ txt_search.addKeyListener(new KeyAdapter()
+ {
+ @Override
+ public void keyPressed(KeyEvent e)
+ {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER)
+ {
+ if (txt_search.getText() == null
+ || txt_search.getText().isEmpty())
+ {
+ return;
+ }
+ if ("pdb id".equalsIgnoreCase(getCmbSearchTarget()
+ .getSelectedItem().toString()))
+ {
+ transferToSequenceFetcher(txt_search.getText());
+ }
+ }
+ }
+ });
+
+ txt_search.getDocument().addDocumentListener(new DocumentListener()
+ {
+ @Override
+ public void insertUpdate(DocumentEvent e)
+ {
+ txt_search_ActionPerformed();
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e)
+ {
+ txt_search_ActionPerformed();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e)
+ {
+ txt_search_ActionPerformed();
+ }
+ });
+
+ final String searchTabTitle = MessageManager
+ .getString("label.search_result");
+ final String configureCols = MessageManager
+ .getString("label.configure_displayed_columns");
+ ChangeListener changeListener = new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent changeEvent)
+ {
+ JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent
+ .getSource();
+ int index = sourceTabbedPane.getSelectedIndex();
+ if (sourceTabbedPane.getTitleAt(index).equals(configureCols))
+ {
+ btn_back.setEnabled(false);
+ btn_cancel.setEnabled(false);
+ btn_ok.setEnabled(false);
+ previousWantedFields = PDBDocFieldPreferences
+ .getSearchSummaryFields().toArray(new PDBDocField[0]);
+ }
+ if (sourceTabbedPane.getTitleAt(index).equals(searchTabTitle))
+ {
+ btn_back.setEnabled(true);
+ btn_cancel.setEnabled(true);
+ if (wantedFieldsUpdated())
+ {
+ txt_search_ActionPerformed();
+ }
+ else
+ {
+ validateSelection();
+ }
+ }
+ }
+ };
+ tabbedPane.addChangeListener(changeListener);
+ tabbedPane.setPreferredSize(new Dimension(500, 300));
+ tabbedPane.add(searchTabTitle, scrl_searchResult);
+ tabbedPane.add(configureCols, pdbDocFieldPrefs);
+
+ pnl_actions.add(btn_back);
+ pnl_actions.add(btn_ok);
+ pnl_actions.add(btn_cancel);
+
+ pnl_results.add(tabbedPane);
+ pnl_inputs.add(cmb_searchTarget);
+ pnl_inputs.add(txt_search);
+ pnl_inputs.add(lbl_loading);
+ pnl_inputs.add(lbl_warning);
+
+ this.setLayout(mainLayout);
+ this.add(pnl_inputs, java.awt.BorderLayout.NORTH);
+ this.add(pnl_results, java.awt.BorderLayout.CENTER);
+ this.add(pnl_actions, java.awt.BorderLayout.SOUTH);
+ mainFrame.setVisible(true);
+ mainFrame.setContentPane(this);
+ mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ Desktop.addInternalFrame(mainFrame, frameTitle, 800, 400);
+ }
+
+ public boolean wantedFieldsUpdated()
+ {
+ if (previousWantedFields == null)
+ {
+ return true;
+ }
+
+ return Arrays.equals(PDBDocFieldPreferences.getSearchSummaryFields()
+ .toArray(new PDBDocField[0]), previousWantedFields) ? false
+ : true;
+
+ }
+
+ public void validateSelection()
+ {
+ if (tbl_summary.getSelectedRows().length > 0)
+ {
+ btn_ok.setEnabled(true);
+ }
+ else
+ {
+ btn_ok.setEnabled(false);
+ }
+ }
+
+ public JComboBox<PDBDocField> getCmbSearchTarget()
+ {
+ return cmb_searchTarget;
+ }
+
+ public JTextField getTxtSearch()
+ {
+ return txt_search;
+ }
+
+ public JInternalFrame getMainFrame()
+ {
+ return mainFrame;
+ }
+
+ public abstract void transferToSequenceFetcher(String ids);
+
+ public abstract void txt_search_ActionPerformed();
+
+ public abstract void btn_ok_ActionPerformed();
+
+ public abstract void btn_back_ActionPerformed();
+
+ public abstract void btn_cancel_ActionPerformed();
+
+ public abstract void populateCmbSearchTargetOptions();
+
+}
diff --git a/src/jalview/jbgui/GPairwiseAlignPanel.java b/src/jalview/jbgui/GPairwiseAlignPanel.java
index dc0d511..e23060f 100644
--- a/src/jalview/jbgui/GPairwiseAlignPanel.java
+++ b/src/jalview/jbgui/GPairwiseAlignPanel.java
@@ -1,25 +1,34 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
/**
* DOCUMENT ME!
@@ -66,7 +75,8 @@ public class GPairwiseAlignPanel extends JPanel
textarea.setText("");
textarea.setWrapStyleWord(false);
viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12));
- viewInEditorButton.setText("View in alignment editor");
+ viewInEditorButton.setText(MessageManager
+ .getString("label.view_alignment_editor"));
viewInEditorButton
.addActionListener(new java.awt.event.ActionListener()
{
diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java
index 6cad0b5..3458347 100644
--- a/src/jalview/jbgui/GPreferences.java
+++ b/src/jalview/jbgui/GPreferences.java
@@ -1,167 +1,203 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
import jalview.gui.JvSwingUtils;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.border.*;
-import javax.swing.event.*;
+import jalview.gui.StructureViewer.ViewerType;
+import jalview.jbgui.PDBDocFieldPreferences.PreferenceSource;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextField;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
/**
- * DOCUMENT ME!
+ * Base class for the Preferences panel.
*
* @author $author$
* @version $Revision$
*/
public class GPreferences extends JPanel
{
- JTabbedPane tabbedPane = new JTabbedPane();
-
- JButton ok = new JButton();
+ private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
- JButton cancel = new JButton();
+ private static final Font LABEL_FONT_ITALIC = JvSwingUtils.getLabelFont(
+ false, true);
- JPanel okCancelPanel = new JPanel();
-
- BorderLayout borderLayout1 = new BorderLayout();
-
- protected JCheckBox quality = new JCheckBox();
+ /*
+ * Visual tab components
+ */
+ protected JCheckBox fullScreen = new JCheckBox();
- JPanel visualTab = new JPanel();
- JPanel visual2Tab = new JPanel();
+ protected JCheckBox openoverv = new JCheckBox();
- protected JCheckBox fullScreen = new JCheckBox();
+ protected JCheckBox seqLimit = new JCheckBox();
- protected JCheckBox conservation = new JCheckBox();
+ protected JCheckBox rightAlign = new JCheckBox();
- protected JCheckBox identity = new JCheckBox();
+ protected JComboBox<String> fontSizeCB = new JComboBox<String>();
- protected JCheckBox annotations = new JCheckBox();
+ protected JComboBox<String> fontStyleCB = new JComboBox<String>();
- protected JPanel minColour = new JPanel();
- JLabel mincolourLabel = new JLabel();
+ protected JComboBox<String> fontNameCB = new JComboBox<String>();
- protected JPanel maxColour = new JPanel();
- JLabel maxcolourLabel = new JLabel();
+ protected JCheckBox showUnconserved = new JCheckBox();
- JLabel gapLabel = new JLabel();
+ protected JCheckBox idItalics = new JCheckBox();
- protected JComboBox colour = new JComboBox();
+ protected JCheckBox smoothFont = new JCheckBox();
- JLabel colourLabel = new JLabel();
+ protected JCheckBox scaleProteinToCdna = new JCheckBox();
- JLabel fontLabel = new JLabel();
+ protected JComboBox<String> gapSymbolCB = new JComboBox<String>();
- protected JComboBox fontSizeCB = new JComboBox();
+ protected JCheckBox wrap = new JCheckBox();
- protected JComboBox fontStyleCB = new JComboBox();
+ protected JComboBox<String> sortby = new JComboBox<String>();
- protected JComboBox fontNameCB = new JComboBox();
+ protected JComboBox<String> sortAnnBy = new JComboBox<String>();
- protected JComboBox gapSymbolCB = new JComboBox();
+ protected JComboBox<String> sortAutocalc = new JComboBox<String>();
protected JCheckBox startupCheckbox = new JCheckBox();
protected JTextField startupFileTextfield = new JTextField();
- JPanel connectTab = new JPanel();
-
- JLabel serverLabel = new JLabel();
-
- protected JList linkURLList = new JList();
-
- protected JTextField proxyServerTB = new JTextField();
-
- protected JTextField proxyPortTB = new JTextField();
-
- JLabel portLabel = new JLabel();
+ // below are in the 'second column'
+ protected JCheckBox annotations = new JCheckBox();
- JLabel browserLabel = new JLabel();
+ protected JCheckBox quality = new JCheckBox();
- protected JTextField defaultBrowser = new JTextField();
+ protected JCheckBox conservation = new JCheckBox();
- JButton newLink = new JButton();
+ protected JCheckBox identity = new JCheckBox();
- JButton editLink = new JButton();
+ protected JCheckBox showGroupConsensus = new JCheckBox();
- JButton deleteLink = new JButton();
+ protected JCheckBox showGroupConservation = new JCheckBox();
- JScrollPane linkScrollPane = new JScrollPane();
+ protected JCheckBox showConsensHistogram = new JCheckBox();
- JPanel linkPanel = new JPanel();
+ protected JCheckBox showConsensLogo = new JCheckBox();
- BorderLayout borderLayout2 = new BorderLayout();
+ protected JCheckBox showDbRefTooltip = new JCheckBox();
- JPanel editLinkButtons = new JPanel();
+ protected JCheckBox showNpTooltip = new JCheckBox();
- GridLayout gridLayout1 = new GridLayout();
+ /*
+ * Structure tab and components
+ */
+ protected JPanel structureTab;
- protected JList linkNameList = new JList();
+ protected JCheckBox structFromPdb = new JCheckBox();
- JPanel linkPanel2 = new JPanel();
+ protected JCheckBox useRnaView = new JCheckBox();
- BorderLayout borderLayout3 = new BorderLayout();
+ protected JCheckBox addSecondaryStructure = new JCheckBox();
- protected JCheckBox useProxy = new JCheckBox();
+ protected JCheckBox addTempFactor = new JCheckBox();
- JPanel jPanel1 = new JPanel();
+ protected JComboBox<String> structViewer = new JComboBox<String>();
- TitledBorder titledBorder1 = new TitledBorder("Proxy Server");
+ protected JTextField chimeraPath = new JTextField();
- TitledBorder titledBorder2 = new TitledBorder("File Output");
+ /*
+ * Colours tab components
+ */
+ protected JPanel minColour = new JPanel();
- GridBagLayout gridBagLayout2 = new GridBagLayout();
+ protected JPanel maxColour = new JPanel();
- GridBagLayout gridBagLayout1 = new GridBagLayout();
+ protected JComboBox<String> protColour = new JComboBox<String>();
- GridBagLayout gridBagLayout3 = new GridBagLayout();
+ protected JComboBox<String> nucColour = new JComboBox<String>();
- protected JComboBox sortby = new JComboBox();
+ /*
+ * Connections tab components
+ */
+ protected JList linkURLList = new JList();
- JLabel sortLabel = new JLabel();
+ protected JTextField proxyServerTB = new JTextField();
- JPanel jPanel2 = new JPanel();
- JPanel visual2panel = new JPanel();
+ protected JTextField proxyPortTB = new JTextField();
- GridLayout gridLayout2 = new GridLayout();
+ protected JTextField defaultBrowser = new JTextField();
- GridLayout gridLayout4 = new GridLayout();
+ protected JList linkNameList = new JList();
- JPanel annsettingsPanel = new JPanel();
+ protected JCheckBox useProxy = new JCheckBox();
- JPanel autoAnnotSettings1 = new JPanel();
+ protected JCheckBox usagestats = new JCheckBox();
- JPanel autoAnnotSettings2 = new JPanel();
+ protected JCheckBox questionnaire = new JCheckBox();
- JPanel autoAnnotSettings3 = new JPanel();
+ protected JCheckBox versioncheck = new JCheckBox();
- JPanel exportTab = new JPanel();
+ /*
+ * Output tab components
+ */
+ protected JComboBox<String> epsRendering = new JComboBox<String>();
- JLabel epsLabel = new JLabel();
+ protected JLabel userIdWidthlabel = new JLabel();
- protected JComboBox epsRendering = new JComboBox();
+ protected JCheckBox autoIdWidth = new JCheckBox();
- JLabel jLabel1 = new JLabel();
+ protected JTextField userIdWidth = new JTextField();
protected JCheckBox blcjv = new JCheckBox();
@@ -175,73 +211,30 @@ public class GPreferences extends JPanel
protected JCheckBox pfamjv = new JCheckBox();
- FlowLayout flowLayout1 = new FlowLayout();
-
protected JCheckBox pirjv = new JCheckBox();
- JPanel jPanel11 = new JPanel();
-
- Font verdana11 = JvSwingUtils.getLabelFont();
-
- protected JCheckBox seqLimit = new JCheckBox();
-
- GridLayout gridLayout3 = new GridLayout();
-
- protected JCheckBox smoothFont = new JCheckBox();
+ protected JCheckBox modellerOutput = new JCheckBox();
- JPanel calcTab = new JPanel();
+ protected JCheckBox embbedBioJSON = new JCheckBox();
+ /*
+ * Editing tab components
+ */
protected JCheckBox autoCalculateConsCheck = new JCheckBox();
protected JCheckBox padGaps = new JCheckBox();
- protected JCheckBox modellerOutput = new JCheckBox();
-
- protected JPanel dasPanel = new JPanel();
-
- BorderLayout borderLayout4 = new BorderLayout();
-
- protected JPanel wsPanel = new JPanel();
-
- BorderLayout borderLayout5 = new BorderLayout();
-
- protected JCheckBox wrap = new JCheckBox();
-
- protected JCheckBox rightAlign = new JCheckBox();
-
- protected JCheckBox showUnconserved = new JCheckBox();
-
- protected JCheckBox showDbRefTooltip = new JCheckBox();
-
- protected JCheckBox showNpTooltip = new JCheckBox();
-
- protected JCheckBox idItalics = new JCheckBox();
-
- protected JCheckBox openoverv = new JCheckBox();
-
- protected JCheckBox usagestats = new JCheckBox();
-
- protected JCheckBox questionnaire = new JCheckBox();
-
- protected JCheckBox versioncheck = new JCheckBox();
-
- protected JLabel showGroupbits = new JLabel();
-
- protected JLabel showConsensbits = new JLabel();
-
- protected JCheckBox showConsensLogo = new JCheckBox();
-
- protected JCheckBox showConsensHistogram = new JCheckBox();
-
- protected JCheckBox showGroupConsensus = new JCheckBox();
-
- protected JCheckBox showGroupConservation = new JCheckBox();
-
- protected JCheckBox shareSelections = new JCheckBox();
+ protected JCheckBox sortByTree = new JCheckBox();
- protected JCheckBox followHighlight = new JCheckBox();
+ /*
+ * DAS Settings tab
+ */
+ protected JPanel dasTab = new JPanel();
- protected JCheckBox sortByTree= new JCheckBox();
+ /*
+ * Web Services tab
+ */
+ protected JPanel wsTab = new JPanel();
/**
* Creates a new GPreferences object.
@@ -258,406 +251,952 @@ public class GPreferences extends JPanel
}
/**
- * DOCUMENT ME!
+ * Construct the panel and its tabbed sub-panels.
*
* @throws Exception
- * DOCUMENT ME!
*/
private void jbInit() throws Exception
{
- this.setLayout(borderLayout1);
- ok.setText("OK");
- ok.addActionListener(new ActionListener()
+ final JTabbedPane tabbedPane = new JTabbedPane();
+ this.setLayout(new BorderLayout());
+ JPanel okCancelPanel = initOkCancelPanel();
+ this.add(tabbedPane, BorderLayout.CENTER);
+ this.add(okCancelPanel, BorderLayout.SOUTH);
+
+ tabbedPane.add(initVisualTab(),
+ MessageManager.getString("label.visual"));
+
+ tabbedPane.add(initColoursTab(),
+ MessageManager.getString("label.colours"));
+
+ tabbedPane.add(initStructureTab(),
+ MessageManager.getString("label.structure"));
+
+ tabbedPane.add(initConnectionsTab(),
+ MessageManager.getString("label.connections"));
+
+ tabbedPane.add(initOutputTab(),
+ MessageManager.getString("label.output"));
+
+ tabbedPane.add(initEditingTab(),
+ MessageManager.getString("label.editing"));
+
+ /*
+ * See DasSourceBrowser for the real work of configuring this tab.
+ */
+ dasTab.setLayout(new BorderLayout());
+ tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
+
+ /*
+ * See WsPreferences for the real work of configuring this tab.
+ */
+ wsTab.setLayout(new BorderLayout());
+ tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
+
+ /*
+ * Handler to validate a tab before leaving it - currently only for
+ * Structure.
+ */
+ tabbedPane.addChangeListener(new ChangeListener()
{
- public void actionPerformed(ActionEvent e)
+ private Component lastTab;
+
+ @Override
+ public void stateChanged(ChangeEvent e)
{
- ok_actionPerformed(e);
+ if (lastTab == structureTab
+ && tabbedPane.getSelectedComponent() != structureTab)
+ {
+ if (!validateStructure())
+ {
+ tabbedPane.setSelectedComponent(structureTab);
+ return;
+ }
+ }
+ lastTab = tabbedPane.getSelectedComponent();
}
+
});
- cancel.setText("Cancel");
- cancel.addActionListener(new ActionListener()
+ }
+
+ /**
+ * Initialises the Editing tabbed panel.
+ *
+ * @return
+ */
+ private JPanel initEditingTab()
+ {
+ JPanel editingTab = new JPanel();
+ editingTab.setLayout(null);
+ autoCalculateConsCheck.setFont(LABEL_FONT);
+ autoCalculateConsCheck.setText(MessageManager
+ .getString("label.autocalculate_consensus"));
+ autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
+ padGaps.setFont(LABEL_FONT);
+ padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
+ padGaps.setBounds(new Rectangle(22, 94, 168, 23));
+ sortByTree.setFont(LABEL_FONT);
+ sortByTree
+ .setText(MessageManager.getString("label.sort_with_new_tree"));
+ sortByTree
+ .setToolTipText(MessageManager
+ .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
+ sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
+ editingTab.add(autoCalculateConsCheck);
+ editingTab.add(padGaps);
+ editingTab.add(sortByTree);
+ return editingTab;
+ }
+
+ /**
+ * Initialises the Output tabbed panel.
+ *
+ * @return
+ */
+ private JPanel initOutputTab()
+ {
+ JPanel outputTab = new JPanel();
+ outputTab.setLayout(null);
+ JLabel epsLabel = new JLabel();
+ epsLabel.setFont(LABEL_FONT);
+ epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
+ epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
+ epsRendering.setFont(LABEL_FONT);
+ epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
+ JLabel jLabel1 = new JLabel();
+ jLabel1.setFont(LABEL_FONT);
+ jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
+ jLabel1.setText(MessageManager.getString("label.append_start_end"));
+ jLabel1.setFont(LABEL_FONT);
+ fastajv.setFont(LABEL_FONT);
+ fastajv.setHorizontalAlignment(SwingConstants.LEFT);
+ clustaljv.setText(MessageManager.getString("label.clustal") + " ");
+ blcjv.setText(MessageManager.getString("label.blc") + " ");
+ fastajv.setText(MessageManager.getString("label.fasta") + " ");
+ msfjv.setText(MessageManager.getString("label.msf") + " ");
+ pfamjv.setText(MessageManager.getString("label.pfam") + " ");
+ pileupjv.setText(MessageManager.getString("label.pileup") + " ");
+ msfjv.setFont(LABEL_FONT);
+ msfjv.setHorizontalAlignment(SwingConstants.LEFT);
+ pirjv.setText(MessageManager.getString("label.pir") + " ");
+ JPanel jPanel11 = new JPanel();
+ jPanel11.setFont(LABEL_FONT);
+ TitledBorder titledBorder2 = new TitledBorder(
+ MessageManager.getString("label.file_output"));
+ jPanel11.setBorder(titledBorder2);
+ jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
+ GridLayout gridLayout3 = new GridLayout();
+ jPanel11.setLayout(gridLayout3);
+ gridLayout3.setRows(8);
+ blcjv.setFont(LABEL_FONT);
+ blcjv.setHorizontalAlignment(SwingConstants.LEFT);
+ clustaljv.setFont(LABEL_FONT);
+ clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
+ pfamjv.setFont(LABEL_FONT);
+ pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
+ pileupjv.setFont(LABEL_FONT);
+ pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
+ pirjv.setFont(LABEL_FONT);
+ pirjv.setHorizontalAlignment(SwingConstants.LEFT);
+ autoIdWidth.setFont(LABEL_FONT);
+ autoIdWidth.setText(MessageManager
+ .getString("label.automatically_set_id_width"));
+ autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager
+ .getString("label.adjusts_width_generated_eps_png")));
+ autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
+ autoIdWidth.addActionListener(new ActionListener()
{
+
+ @Override
public void actionPerformed(ActionEvent e)
{
- cancel_actionPerformed(e);
+ autoIdWidth_actionPerformed();
}
});
- quality.setEnabled(false);
- quality.setFont(verdana11);
- quality.setHorizontalAlignment(SwingConstants.RIGHT);
- quality.setHorizontalTextPosition(SwingConstants.LEFT);
- quality.setSelected(true);
- quality.setText("Quality");
- visualTab.setBorder(new TitledBorder("Open new alignment"));
- visualTab.setLayout(null);
- visual2Tab.setBorder(new TitledBorder("Open new alignment"));
- visual2Tab.setLayout(new FlowLayout());
- fullScreen.setFont(verdana11);
- fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
- fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
- fullScreen.setText("Maximise Window");
- conservation.setEnabled(false);
- conservation.setFont(verdana11);
- conservation.setHorizontalAlignment(SwingConstants.RIGHT);
- conservation.setHorizontalTextPosition(SwingConstants.LEFT);
- conservation.setSelected(true);
- conservation.setText("Conservation");
- identity.setEnabled(false);
- identity.setFont(verdana11);
- identity.setHorizontalAlignment(SwingConstants.RIGHT);
- identity.setHorizontalTextPosition(SwingConstants.LEFT);
- identity.setSelected(true);
- identity.setText("Consensus");
- showGroupbits.setFont(verdana11);
- showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
- showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
- showGroupbits.setText("Show group:");
- showConsensbits.setFont(verdana11);
- showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
- showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
- showConsensbits.setText("Consensus:");
- showConsensHistogram.setEnabled(false);
- showConsensHistogram.setFont(verdana11);
- showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
- showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
- showConsensHistogram.setSelected(true);
- showConsensHistogram.setText("Histogram");
- showConsensLogo.setEnabled(false);
- showConsensLogo.setFont(verdana11);
- showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
- showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
- showConsensLogo.setSelected(true);
- showConsensLogo.setText("Logo");
- showGroupConsensus.setEnabled(false);
- showGroupConsensus.setFont(verdana11);
- showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
- showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
- showGroupConsensus.setSelected(true);
- showGroupConsensus.setText("Consensus");
- showGroupConservation.setEnabled(false);
- showGroupConservation.setFont(verdana11);
- showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
- showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
- showGroupConservation.setSelected(true);
- showGroupConservation.setText("Conservation");
- showNpTooltip.setEnabled(true);
- showNpTooltip.setFont(verdana11);
- showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
- showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
- showNpTooltip.setSelected(true);
- showNpTooltip.setText("Non-positional Features");
- showDbRefTooltip.setEnabled(true);
- showDbRefTooltip.setFont(verdana11);
- showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
- showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
- showDbRefTooltip.setSelected(true);
- showDbRefTooltip.setText("Database References");
- annotations.setFont(verdana11);
- annotations.setHorizontalAlignment(SwingConstants.RIGHT);
- annotations.setHorizontalTextPosition(SwingConstants.LEADING);
- annotations.setSelected(true);
- annotations.setText("Show Annotations");
- annotations.setBounds(new Rectangle(169, 12, 200, 23));
- annotations.addActionListener(new ActionListener()
+ userIdWidthlabel.setFont(LABEL_FONT);
+ userIdWidthlabel.setText(MessageManager
+ .getString("label.figure_id_column_width"));
+ userIdWidth
+ .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
+ .getString("label.manually_specify_width_left_column")));
+ userIdWidthlabel
+ .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
+ .getString("label.manually_specify_width_left_column")));
+ userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
+ userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
+ userIdWidth.setText("");
+ userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
+ userIdWidth.addActionListener(new ActionListener()
{
+
+ @Override
public void actionPerformed(ActionEvent e)
{
- annotations_actionPerformed(e);
+ userIdWidth_actionPerformed();
}
});
- identity.addActionListener(new ActionListener()
+ modellerOutput.setFont(LABEL_FONT);
+ modellerOutput.setText(MessageManager
+ .getString("label.use_modeller_output"));
+ modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
+ embbedBioJSON.setFont(LABEL_FONT);
+ embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
+ embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
+
+ jPanel11.add(jLabel1);
+ jPanel11.add(blcjv);
+ jPanel11.add(clustaljv);
+ jPanel11.add(fastajv);
+ jPanel11.add(msfjv);
+ jPanel11.add(pfamjv);
+ jPanel11.add(pileupjv);
+ jPanel11.add(pirjv);
+ outputTab.add(autoIdWidth);
+ outputTab.add(userIdWidth);
+ outputTab.add(userIdWidthlabel);
+ outputTab.add(modellerOutput);
+ outputTab.add(embbedBioJSON);
+ outputTab.add(epsLabel);
+ outputTab.add(epsRendering);
+ outputTab.add(jPanel11);
+ return outputTab;
+ }
+
+ /**
+ * Initialises the Connections tabbed panel.
+ *
+ * @return
+ */
+ private JPanel initConnectionsTab()
+ {
+ JPanel connectTab = new JPanel();
+ connectTab.setLayout(new GridBagLayout());
+ JLabel serverLabel = new JLabel();
+ serverLabel.setText(MessageManager.getString("label.address"));
+ serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ serverLabel.setFont(LABEL_FONT);
+ proxyServerTB.setFont(LABEL_FONT);
+ proxyPortTB.setFont(LABEL_FONT);
+ JLabel portLabel = new JLabel();
+ portLabel.setFont(LABEL_FONT);
+ portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ portLabel.setText(MessageManager.getString("label.port"));
+ JLabel browserLabel = new JLabel();
+ browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
+ browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
+ browserLabel.setText(MessageManager
+ .getString("label.default_browser_unix"));
+ defaultBrowser.setFont(LABEL_FONT);
+ defaultBrowser.setText("");
+ usagestats.setText(MessageManager
+ .getString("label.send_usage_statistics"));
+ usagestats.setFont(LABEL_FONT);
+ usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
+ usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
+ questionnaire.setText(MessageManager
+ .getString("label.check_for_questionnaires"));
+ questionnaire.setFont(LABEL_FONT);
+ questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
+ questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
+ versioncheck.setText(MessageManager
+ .getString("label.check_for_latest_version"));
+ versioncheck.setFont(LABEL_FONT);
+ versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
+ versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
+ JButton newLink = new JButton();
+ newLink.setText(MessageManager.getString("action.new"));
+ newLink.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- annotations_actionPerformed(e);
+ newLink_actionPerformed(e);
}
});
- showGroupConsensus.addActionListener(new ActionListener()
+ JButton editLink = new JButton();
+ editLink.setText(MessageManager.getString("action.edit"));
+ editLink.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- annotations_actionPerformed(e);
+ editLink_actionPerformed(e);
}
});
- showUnconserved.setFont(verdana11);
- showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
- showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
- showUnconserved.setSelected(true);
- showUnconserved.setText("Show Unconserved");
- showUnconserved.addActionListener(new ActionListener()
+ JButton deleteLink = new JButton();
+ deleteLink.setText(MessageManager.getString("action.delete"));
+ deleteLink.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- showunconserved_actionPerformed(e);
+ deleteLink_actionPerformed(e);
}
});
- // / TODO: fit these in to preferences panel!!!!!
- shareSelections.setFont(verdana11);
- shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
- shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
- shareSelections.setSelected(true);
- shareSelections.setText("Share selection across views");
- followHighlight.setFont(verdana11);
- followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
- followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
- // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
- followHighlight.setSelected(true);
- followHighlight.setText("Scroll to highlighted regions");
-
- gapLabel.setFont(verdana11);
- gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- gapLabel.setText("Gap Symbol ");
- colour.setFont(verdana11);
- colour.setBounds(new Rectangle(172, 225, 155, 21));
- colourLabel.setFont(verdana11);
- colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- colourLabel.setText("Alignment Colour ");
- fontLabel.setFont(verdana11);
- fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- fontLabel.setText("Font ");
- fontSizeCB.setFont(verdana11);
- fontSizeCB.setBounds(new Rectangle(319, 104, 49, 23));
- fontStyleCB.setFont(verdana11);
- fontStyleCB.setBounds(new Rectangle(367, 104, 70, 23));
- fontNameCB.setFont(verdana11);
- fontNameCB.setBounds(new Rectangle(172, 104, 147, 23));
- gapSymbolCB.setFont(verdana11);
- gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 23));
- mincolourLabel.setFont(verdana11);
- mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- mincolourLabel.setText("Minimum Colour");
- minColour.setFont(verdana11);
- minColour.setBorder(BorderFactory.createEtchedBorder());
- minColour.setPreferredSize(new Dimension(40, 20));
- minColour.addMouseListener(new MouseAdapter()
+
+ linkURLList.addListSelectionListener(new ListSelectionListener()
{
- public void mousePressed(MouseEvent e)
+ public void valueChanged(ListSelectionEvent e)
{
- minColour_actionPerformed();
+ int index = linkURLList.getSelectedIndex();
+ linkNameList.setSelectedIndex(index);
}
});
- maxcolourLabel.setFont(verdana11);
- maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- maxcolourLabel.setText("Maximum Colour ");
- maxColour.setFont(verdana11);
- maxColour.setBorder(BorderFactory.createEtchedBorder());
- maxColour.setPreferredSize(new Dimension(40, 20));
- maxColour.addMouseListener(new MouseAdapter()
+
+ linkNameList.addListSelectionListener(new ListSelectionListener()
{
- public void mousePressed(MouseEvent e)
+ public void valueChanged(ListSelectionEvent e)
{
- maxColour_actionPerformed();
+ int index = linkNameList.getSelectedIndex();
+ linkURLList.setSelectedIndex(index);
}
});
-
- startupCheckbox.setText("Open file");
- startupCheckbox.setFont(verdana11);
- startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
- startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
- startupCheckbox.setSelected(true);
- startupFileTextfield.setFont(verdana11);
- startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20));
- startupFileTextfield.addMouseListener(new MouseAdapter()
+
+ JScrollPane linkScrollPane = new JScrollPane();
+ linkScrollPane.setBorder(null);
+ JPanel linkPanel = new JPanel();
+ linkPanel.setBorder(new TitledBorder(MessageManager
+ .getString("label.url_linkfrom_sequence_id")));
+ linkPanel.setLayout(new BorderLayout());
+ GridLayout gridLayout1 = new GridLayout();
+ JPanel editLinkButtons = new JPanel();
+ editLinkButtons.setLayout(gridLayout1);
+ gridLayout1.setRows(3);
+ linkNameList.setFont(LABEL_FONT);
+ linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ BorderLayout borderLayout3 = new BorderLayout();
+ JPanel linkPanel2 = new JPanel();
+ linkPanel2.setLayout(borderLayout3);
+ linkURLList.setFont(LABEL_FONT);
+ linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
+ defaultBrowser.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() > 1)
{
- startupFileTextfield_mouseClicked();
+ defaultBrowser_mouseClicked(e);
}
}
});
-
- connectTab.setLayout(gridBagLayout3);
- serverLabel.setText("Address");
- serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- serverLabel.setFont(verdana11);
- proxyServerTB.setFont(verdana11);
- proxyPortTB.setFont(verdana11);
- portLabel.setFont(verdana11);
- portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- portLabel.setText("Port");
- browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
- browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
- browserLabel.setText("Default Browser (Unix)");
- defaultBrowser.setFont(verdana11);
- defaultBrowser.setText("");
- usagestats.setText("Send usage statistics");
- usagestats.setFont(verdana11);
- usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
- usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
- questionnaire.setText("Check for questionnaires");
- questionnaire.setFont(verdana11);
- questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
- questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
- versioncheck.setText("Check for latest version");
- versioncheck.setFont(verdana11);
- versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
- versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
- newLink.setText("New");
- newLink.addActionListener(new java.awt.event.ActionListener()
+ useProxy.setFont(LABEL_FONT);
+ useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
+ useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
+ useProxy.setText(MessageManager.getString("label.use_proxy_server"));
+ useProxy.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- newLink_actionPerformed(e);
+ useProxy_actionPerformed();
}
});
- editLink.setText("Edit");
- editLink.addActionListener(new java.awt.event.ActionListener()
+ linkPanel.add(editLinkButtons, BorderLayout.EAST);
+ editLinkButtons.add(newLink, null);
+ editLinkButtons.add(editLink, null);
+ editLinkButtons.add(deleteLink, null);
+ linkPanel.add(linkScrollPane, BorderLayout.CENTER);
+ linkScrollPane.getViewport().add(linkPanel2, null);
+ linkPanel2.add(linkURLList, BorderLayout.CENTER);
+ linkPanel2.add(linkNameList, BorderLayout.WEST);
+ JPanel jPanel1 = new JPanel();
+ TitledBorder titledBorder1 = new TitledBorder(
+ MessageManager.getString("label.proxy_server"));
+ jPanel1.setBorder(titledBorder1);
+ jPanel1.setLayout(new GridBagLayout());
+ jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
+ 2, 4, 0), 5, 0));
+ jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
+ 0, 4, 0), 11, 6));
+ connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 16, 0, 0, 12), 359, -17));
+ connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 21, 0, 35, 12), 4, 6));
+ connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
+ new Insets(16, 0, 0, 0), 5, 1));
+ jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
+ 2, 5, 185), 2, -4));
+ jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 2, 4, 2), 54, 1));
+ jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 2, 4, 0), 263, 1));
+ connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(15, 0, 0, 15), 307, 1));
+ connectTab.add(usagestats, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 2, 4, 2), 70, 1));
+ connectTab.add(questionnaire, new GridBagConstraints(1, 4, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 2, 4, 2), 70, 1));
+ connectTab.add(versioncheck, new GridBagConstraints(0, 5, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 2, 4, 2), 70, 1));
+ return connectTab;
+ }
+
+ /**
+ * Initialises the parent panel which contains the tabbed sections.
+ *
+ * @return
+ */
+ private JPanel initOkCancelPanel()
+ {
+ JButton ok = new JButton();
+ ok.setText(MessageManager.getString("action.ok"));
+ ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- editLink_actionPerformed(e);
+ ok_actionPerformed(e);
}
});
- deleteLink.setText("Delete");
- deleteLink.addActionListener(new java.awt.event.ActionListener()
+ JButton cancel = new JButton();
+ cancel.setText(MessageManager.getString("action.cancel"));
+ cancel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- deleteLink_actionPerformed(e);
+ cancel_actionPerformed(e);
}
});
+ JPanel okCancelPanel = new JPanel();
+ okCancelPanel.add(ok);
+ okCancelPanel.add(cancel);
+ return okCancelPanel;
+ }
- linkURLList.addListSelectionListener(new ListSelectionListener()
+ /**
+ * Initialises the Colours tabbed panel.
+ *
+ * @return
+ */
+ private JPanel initColoursTab()
+ {
+ JPanel coloursTab = new JPanel();
+ coloursTab.setBorder(new TitledBorder(MessageManager
+ .getString("action.open_new_alignment")));
+ coloursTab.setLayout(new FlowLayout());
+ JLabel mincolourLabel = new JLabel();
+ mincolourLabel.setFont(LABEL_FONT);
+ mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ mincolourLabel.setText(MessageManager.getString("label.min_colour"));
+ minColour.setFont(LABEL_FONT);
+ minColour.setBorder(BorderFactory.createEtchedBorder());
+ minColour.setPreferredSize(new Dimension(40, 20));
+ minColour.addMouseListener(new MouseAdapter()
{
- public void valueChanged(ListSelectionEvent e)
+ public void mousePressed(MouseEvent e)
{
- int index = linkURLList.getSelectedIndex();
- linkNameList.setSelectedIndex(index);
+ minColour_actionPerformed(minColour);
}
});
-
- linkNameList.addListSelectionListener(new ListSelectionListener()
+ JLabel maxcolourLabel = new JLabel();
+ maxcolourLabel.setFont(LABEL_FONT);
+ maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
+ maxColour.setFont(LABEL_FONT);
+ maxColour.setBorder(BorderFactory.createEtchedBorder());
+ maxColour.setPreferredSize(new Dimension(40, 20));
+ maxColour.addMouseListener(new MouseAdapter()
{
- public void valueChanged(ListSelectionEvent e)
+ public void mousePressed(MouseEvent e)
{
- int index = linkNameList.getSelectedIndex();
- linkURLList.setSelectedIndex(index);
+ maxColour_actionPerformed(maxColour);
}
});
- linkScrollPane.setBorder(null);
- linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));
- linkPanel.setLayout(borderLayout2);
- editLinkButtons.setLayout(gridLayout1);
- gridLayout1.setRows(3);
- linkNameList.setFont(verdana11);
- linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- linkPanel2.setLayout(borderLayout3);
- linkURLList.setFont(verdana11);
- linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ protColour.setFont(LABEL_FONT);
+ protColour.setBounds(new Rectangle(172, 225, 155, 21));
+ JLabel protColourLabel = new JLabel();
+ protColourLabel.setFont(LABEL_FONT);
+ protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ protColourLabel.setText(MessageManager
+ .getString("label.prot_alignment_colour") + " ");
+ JvSwingUtils.addtoLayout(coloursTab, MessageManager
+ .getString("label.default_colour_scheme_for_alignment"),
+ protColourLabel, protColour);
+
+ nucColour.setFont(LABEL_FONT);
+ nucColour.setBounds(new Rectangle(172, 240, 155, 21));
+ JLabel nucColourLabel = new JLabel();
+ nucColourLabel.setFont(LABEL_FONT);
+ nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ nucColourLabel.setText(MessageManager
+ .getString("label.nuc_alignment_colour") + " ");
+ JvSwingUtils.addtoLayout(coloursTab, MessageManager
+ .getString("label.default_colour_scheme_for_alignment"),
+ nucColourLabel, nucColour);
+
+ JPanel annotationShding = new JPanel();
+ annotationShding.setBorder(new TitledBorder(MessageManager
+ .getString("label.annotation_shading_default")));
+ annotationShding.setLayout(new GridLayout(1, 2));
+ JvSwingUtils.addtoLayout(annotationShding, MessageManager
+ .getString("label.default_minimum_colour_annotation_shading"),
+ mincolourLabel, minColour);
+ JvSwingUtils.addtoLayout(annotationShding, MessageManager
+ .getString("label.default_maximum_colour_annotation_shading"),
+ maxcolourLabel, maxColour);
+ coloursTab.add(annotationShding); // , FlowLayout.LEFT);
+ return coloursTab;
+ }
- defaultBrowser.addMouseListener(new MouseAdapter()
+ /**
+ * Initialises the Structure tabbed panel.
+ *
+ * @return
+ */
+ private JPanel initStructureTab()
+ {
+ structureTab = new JPanel();
+
+ structureTab.setBorder(new TitledBorder(MessageManager
+ .getString("label.structure_options")));
+ structureTab.setLayout(null);
+ final int width = 400;
+ final int height = 22;
+ final int lineSpacing = 25;
+ int ypos = 30;
+
+ structFromPdb.setFont(LABEL_FONT);
+ structFromPdb
+ .setText(MessageManager.getString("label.struct_from_pdb"));
+ structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
+ structFromPdb.addActionListener(new ActionListener()
{
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ boolean selected = structFromPdb.isSelected();
+ // enable other options only when the first is checked
+ useRnaView.setEnabled(selected);
+ addSecondaryStructure.setEnabled(selected);
+ addTempFactor.setEnabled(selected);
+ }
+ });
+ structureTab.add(structFromPdb);
+
+ // indent checkboxes that are conditional on the first one
+ ypos += lineSpacing;
+ useRnaView.setFont(LABEL_FONT);
+ useRnaView.setText(MessageManager.getString("label.use_rnaview"));
+ useRnaView.setBounds(new Rectangle(25, ypos, width, height));
+ structureTab.add(useRnaView);
+
+ ypos += lineSpacing;
+ addSecondaryStructure.setFont(LABEL_FONT);
+ addSecondaryStructure.setText(MessageManager
+ .getString("label.autoadd_secstr"));
+ addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
+ structureTab.add(addSecondaryStructure);
+
+ ypos += lineSpacing;
+ addTempFactor.setFont(LABEL_FONT);
+ addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
+ addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
+ structureTab.add(addTempFactor);
+
+ ypos += lineSpacing;
+ JLabel viewerLabel = new JLabel();
+ viewerLabel.setFont(LABEL_FONT);
+ viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
+ viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
+ structureTab.add(viewerLabel);
+
+ structViewer.setFont(LABEL_FONT);
+ structViewer.setBounds(new Rectangle(160, ypos, 120, height));
+ structViewer.addItem(ViewerType.JMOL.name());
+ structViewer.addItem(ViewerType.CHIMERA.name());
+ structViewer.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ structureViewer_actionPerformed((String) structViewer
+ .getSelectedItem());
+ }
+ });
+ structureTab.add(structViewer);
+
+ ypos += lineSpacing;
+ JLabel pathLabel = new JLabel();
+ pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
+ pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ pathLabel.setText(MessageManager.getString("label.chimera_path"));
+ final String tooltip = JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.chimera_path_tip"));
+ pathLabel.setToolTipText(tooltip);
+ pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
+ structureTab.add(pathLabel);
+
+ chimeraPath.setFont(LABEL_FONT);
+ chimeraPath.setText("");
+ chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
+ chimeraPath.addMouseListener(new MouseAdapter()
+ {
+ @Override
public void mouseClicked(MouseEvent e)
{
- if (e.getClickCount() > 1)
+ if (e.getClickCount() == 2)
{
- defaultBrowser_mouseClicked(e);
+ String chosen = openFileChooser();
+ if (chosen != null)
+ {
+ chimeraPath.setText(chosen);
+ }
}
}
});
- useProxy.setFont(verdana11);
- useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
- useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
- useProxy.setText("Use a proxy server");
- useProxy.addActionListener(new ActionListener()
+ structureTab.add(chimeraPath);
+
+ ypos += lineSpacing;
+ // scrl_pdbDocFieldConfig.setPreferredSize(new Dimension(450, 100));
+ // scrl_pdbDocFieldConfig
+ // .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ // scrl_pdbDocFieldConfig.setBounds();
+ PDBDocFieldPreferences docFieldPref = new PDBDocFieldPreferences(
+ PreferenceSource.PREFERENCES);
+ docFieldPref.setBounds(new Rectangle(10, ypos + 5, 450, 120));
+ structureTab.add(docFieldPref);
+
+ return structureTab;
+ }
+
+ /**
+ * Action on choosing a structure viewer from combobox options.
+ *
+ * @param selectedItem
+ */
+ protected void structureViewer_actionPerformed(String selectedItem)
+ {
+ }
+
+ /**
+ * Show a dialog for the user to choose a file. Returns the chosen path, or
+ * null on Cancel.
+ *
+ * @return
+ */
+ protected String openFileChooser()
+ {
+ String choice = null;
+ JFileChooser chooser = new JFileChooser();
+
+ // chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle(MessageManager
+ .getString("label.open_local_file"));
+ chooser.setToolTipText(MessageManager.getString("action.open"));
+
+ int value = chooser.showOpenDialog(this);
+
+ if (value == JFileChooser.APPROVE_OPTION)
+ {
+ choice = chooser.getSelectedFile().getPath();
+ }
+ return choice;
+ }
+
+ /**
+ * Validate the structure tab preferences; if invalid, set focus on this tab.
+ *
+ * @param e
+ */
+ protected boolean validateStructure(FocusEvent e)
+ {
+ if (!validateStructure())
+ {
+ e.getComponent().requestFocusInWindow();
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean validateStructure()
+ {
+ return false;
+ }
+
+ /**
+ * Initialises the Visual tabbed panel.
+ *
+ * @return
+ */
+ private JPanel initVisualTab()
+ {
+ JPanel visualTab = new JPanel();
+ visualTab.setBorder(new TitledBorder(MessageManager
+ .getString("action.open_new_alignment")));
+ visualTab.setLayout(null);
+ fullScreen.setFont(LABEL_FONT);
+ fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
+ fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
+ fullScreen.setText(MessageManager.getString("label.maximize_window"));
+ quality.setEnabled(false);
+ quality.setFont(LABEL_FONT);
+ quality.setHorizontalAlignment(SwingConstants.RIGHT);
+ quality.setHorizontalTextPosition(SwingConstants.LEFT);
+ quality.setSelected(true);
+ quality.setText(MessageManager.getString("label.quality"));
+ conservation.setEnabled(false);
+ conservation.setFont(LABEL_FONT);
+ conservation.setHorizontalAlignment(SwingConstants.RIGHT);
+ conservation.setHorizontalTextPosition(SwingConstants.LEFT);
+ conservation.setSelected(true);
+ conservation.setText(MessageManager.getString("label.conservation"));
+ identity.setEnabled(false);
+ identity.setFont(LABEL_FONT);
+ identity.setHorizontalAlignment(SwingConstants.RIGHT);
+ identity.setHorizontalTextPosition(SwingConstants.LEFT);
+ identity.setSelected(true);
+ identity.setText(MessageManager.getString("label.consensus"));
+ JLabel showGroupbits = new JLabel();
+ showGroupbits.setFont(LABEL_FONT);
+ showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
+ showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
+ showGroupbits.setText(MessageManager.getString("action.show_group")
+ + ":");
+ JLabel showConsensbits = new JLabel();
+ showConsensbits.setFont(LABEL_FONT);
+ showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
+ showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
+ showConsensbits.setText(MessageManager.getString("label.consensus")
+ + ":");
+ showConsensHistogram.setEnabled(false);
+ showConsensHistogram.setFont(LABEL_FONT);
+ showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
+ showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
+ showConsensHistogram.setSelected(true);
+ showConsensHistogram.setText(MessageManager
+ .getString("label.histogram"));
+ showConsensLogo.setEnabled(false);
+ showConsensLogo.setFont(LABEL_FONT);
+ showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
+ showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
+ showConsensLogo.setSelected(true);
+ showConsensLogo.setText(MessageManager.getString("label.logo"));
+ showGroupConsensus.setEnabled(false);
+ showGroupConsensus.setFont(LABEL_FONT);
+ showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
+ showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
+ showGroupConsensus.setSelected(true);
+ showGroupConsensus.setText(MessageManager.getString("label.consensus"));
+ showGroupConservation.setEnabled(false);
+ showGroupConservation.setFont(LABEL_FONT);
+ showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
+ showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
+ showGroupConservation.setSelected(true);
+ showGroupConservation.setText(MessageManager
+ .getString("label.conservation"));
+ showNpTooltip.setEnabled(true);
+ showNpTooltip.setFont(LABEL_FONT);
+ showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
+ showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
+ showNpTooltip.setSelected(true);
+ showNpTooltip.setText(MessageManager
+ .getString("label.non_positional_features"));
+ showDbRefTooltip.setEnabled(true);
+ showDbRefTooltip.setFont(LABEL_FONT);
+ showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
+ showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
+ showDbRefTooltip.setSelected(true);
+ showDbRefTooltip.setText(MessageManager
+ .getString("label.database_references"));
+ annotations.setFont(LABEL_FONT);
+ annotations.setHorizontalAlignment(SwingConstants.RIGHT);
+ annotations.setHorizontalTextPosition(SwingConstants.LEADING);
+ annotations.setSelected(true);
+ annotations.setText(MessageManager.getString("label.show_annotations"));
+ annotations.setBounds(new Rectangle(169, 12, 200, 23));
+ annotations.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- useProxy_actionPerformed();
+ annotations_actionPerformed(e);
}
});
- jPanel1.setBorder(titledBorder1);
- jPanel1.setLayout(gridBagLayout1);
- sortby.setFont(verdana11);
- sortby.setBounds(new Rectangle(172, 249, 155, 21));
- sortLabel.setFont(verdana11);
- sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- sortLabel.setText("Sort by ");
- jPanel2.setBounds(new Rectangle(7, 17, 158, 278));
- jPanel2.setLayout(gridLayout2);
- gridLayout2.setRows(12);
- exportTab.setLayout(null);
- epsLabel.setFont(verdana11);
- epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- epsLabel.setText("EPS Rendering Style");
- epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
- epsRendering.setFont(verdana11);
- epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
- jLabel1.setFont(verdana11);
- jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
- jLabel1.setText("Append /start-end (/15-380)");
- jLabel1.setFont(verdana11);
- fastajv.setFont(verdana11);
- fastajv.setHorizontalAlignment(SwingConstants.LEFT);
- clustaljv.setText("Clustal ");
- blcjv.setText("BLC ");
- fastajv.setText("Fasta ");
- msfjv.setText("MSF ");
- pfamjv.setText("PFAM ");
- pileupjv.setText("Pileup ");
- msfjv.setFont(verdana11);
- msfjv.setHorizontalAlignment(SwingConstants.LEFT);
- pirjv.setText("PIR ");
- jPanel11.setFont(verdana11);
- jPanel11.setBorder(titledBorder2);
- jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
- jPanel11.setLayout(gridLayout3);
- blcjv.setFont(verdana11);
- blcjv.setHorizontalAlignment(SwingConstants.LEFT);
- clustaljv.setFont(verdana11);
- clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
- pfamjv.setFont(verdana11);
- pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
- pileupjv.setFont(verdana11);
- pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
- pirjv.setFont(verdana11);
- pirjv.setHorizontalAlignment(SwingConstants.LEFT);
- seqLimit.setFont(verdana11);
+ identity.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ annotations_actionPerformed(e);
+ }
+ });
+ showGroupConsensus.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ annotations_actionPerformed(e);
+ }
+ });
+ showUnconserved.setFont(LABEL_FONT);
+ showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
+ showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
+ showUnconserved.setSelected(true);
+ showUnconserved.setText(MessageManager
+ .getString("action.show_unconserved"));
+ showUnconserved.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ showunconserved_actionPerformed(e);
+ }
+ });
+
+ // TODO these are not yet added to / action from Preferences
+ // JCheckBox shareSelections = new JCheckBox();
+ // shareSelections.setFont(verdana11);
+ // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
+ // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
+ // shareSelections.setSelected(true);
+ // shareSelections.setText(MessageManager
+ // .getString("label.share_selection_across_views"));
+ // JCheckBox followHighlight = new JCheckBox();
+ // followHighlight.setFont(verdana11);
+ // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
+ // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
+ // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
+ // followHighlight.setSelected(true);
+ // followHighlight.setText(MessageManager
+ // .getString("label.scroll_highlighted_regions"));
+
+ seqLimit.setFont(LABEL_FONT);
seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
- seqLimit.setText("Full Sequence Id");
- gridLayout3.setRows(8);
- smoothFont.setFont(verdana11);
+ seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
+ smoothFont.setFont(LABEL_FONT);
smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
- smoothFont.setText("Smooth Font");
- calcTab.setLayout(null);
- autoCalculateConsCheck.setFont(JvSwingUtils.getLabelFont());
- autoCalculateConsCheck.setText("AutoCalculate Consensus");
- autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
- padGaps.setFont(JvSwingUtils.getLabelFont());
- padGaps.setText("Pad Gaps When Editing");
- padGaps.setBounds(new Rectangle(22, 94, 168, 23));
- sortByTree.setFont(JvSwingUtils.getLabelFont());
- sortByTree.setText("Sort With New Tree");
- sortByTree.setToolTipText("When selected, any trees calculated or loaded onto the alignment will automatically sort the alignment.");
- sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
- modellerOutput.setFont(JvSwingUtils.getLabelFont());
- modellerOutput.setText("Use Modeller Output");
- modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
- dasPanel.setLayout(borderLayout4);
- wsPanel.setLayout(borderLayout5);
- wrap.setFont(JvSwingUtils.getLabelFont());
+ smoothFont.setText(MessageManager.getString("label.smooth_font"));
+ scaleProteinToCdna.setFont(LABEL_FONT);
+ scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
+ scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
+ scaleProteinToCdna.setText(MessageManager
+ .getString("label.scale_protein_to_cdna"));
+ scaleProteinToCdna.setToolTipText(MessageManager
+ .getString("label.scale_protein_to_cdna_tip"));
+ JLabel gapLabel = new JLabel();
+ gapLabel.setFont(LABEL_FONT);
+ gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
+ JLabel fontLabel = new JLabel();
+ fontLabel.setFont(LABEL_FONT);
+ fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ fontLabel.setText(MessageManager.getString("label.font"));
+ fontSizeCB.setFont(LABEL_FONT);
+ fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
+ fontStyleCB.setFont(LABEL_FONT);
+ fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
+ fontNameCB.setFont(LABEL_FONT);
+ fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
+ gapSymbolCB.setFont(LABEL_FONT);
+ gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
+ DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
+ dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
+ gapSymbolCB.setRenderer(dlcr);
+
+ startupCheckbox.setText(MessageManager.getString("action.open_file"));
+ startupCheckbox.setFont(LABEL_FONT);
+ startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
+ startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
+ startupCheckbox.setSelected(true);
+ startupFileTextfield.setFont(LABEL_FONT);
+ startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
+ startupFileTextfield.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ if (e.getClickCount() > 1)
+ {
+ startupFileTextfield_mouseClicked();
+ }
+ }
+ });
+
+ sortby.setFont(LABEL_FONT);
+ sortby.setBounds(new Rectangle(172, 260, 155, 21));
+ JLabel sortLabel = new JLabel();
+ sortLabel.setFont(LABEL_FONT);
+ sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ sortLabel.setText(MessageManager.getString("label.sort_by"));
+ sortAnnBy.setFont(LABEL_FONT);
+ sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
+ JLabel sortAnnLabel = new JLabel();
+ sortAnnLabel.setFont(LABEL_FONT);
+ sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
+ sortAutocalc.setFont(LABEL_FONT);
+ sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
+
+ JPanel annsettingsPanel = new JPanel();
+ annsettingsPanel.setBounds(new Rectangle(173, 34, 320, 75));
+ annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
+ annsettingsPanel.setBorder(new EtchedBorder());
+ visualTab.add(annsettingsPanel);
+ Border jb = new EmptyBorder(1, 1, 4, 5);
+ quality.setBorder(jb);
+ conservation.setBorder(jb);
+ identity.setBorder(jb);
+ showConsensbits.setBorder(jb);
+ showGroupbits.setBorder(jb);
+ showGroupConsensus.setBorder(jb);
+ showGroupConservation.setBorder(jb);
+ showConsensHistogram.setBorder(jb);
+ showConsensLogo.setBorder(jb);
+
+ JPanel autoAnnotSettings = new JPanel();
+ autoAnnotSettings.setLayout(new GridLayout(3, 3));
+ annsettingsPanel.add(autoAnnotSettings);
+ autoAnnotSettings.add(quality);
+ autoAnnotSettings.add(conservation);
+ autoAnnotSettings.add(identity);
+ autoAnnotSettings.add(showGroupbits);
+ autoAnnotSettings.add(showGroupConservation);
+ autoAnnotSettings.add(showGroupConsensus);
+ autoAnnotSettings.add(showConsensbits);
+ autoAnnotSettings.add(showConsensHistogram);
+ autoAnnotSettings.add(showConsensLogo);
+
+ JPanel tooltipSettings = new JPanel();
+ tooltipSettings.setBorder(new TitledBorder(MessageManager
+ .getString("label.sequence_id_tooltip")));
+ tooltipSettings.setBounds(173, 140, 220, 62);
+ tooltipSettings.setLayout(new GridLayout(2, 1));
+ tooltipSettings.add(showDbRefTooltip);
+ tooltipSettings.add(showNpTooltip);
+ visualTab.add(tooltipSettings);
+
+ wrap.setFont(LABEL_FONT);
wrap.setHorizontalAlignment(SwingConstants.TRAILING);
wrap.setHorizontalTextPosition(SwingConstants.LEADING);
- wrap.setText("Wrap Alignment");
- rightAlign.setFont(JvSwingUtils.getLabelFont());
+ wrap.setText(MessageManager.getString("label.wrap_alignment"));
+ rightAlign.setFont(LABEL_FONT);
rightAlign.setForeground(Color.black);
rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
- rightAlign.setText("Right Align Ids");
- idItalics.setFont(JvSwingUtils.getLabelFont());
+ rightAlign.setText(MessageManager.getString("label.right_align_ids"));
+ idItalics.setFont(LABEL_FONT_ITALIC);
idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
- idItalics.setText("Sequence Name Italics");
- openoverv.setFont(JvSwingUtils.getLabelFont());
- openoverv.setActionCommand("Open Overview");
+ idItalics.setText(MessageManager
+ .getString("label.sequence_name_italics"));
+ openoverv.setFont(LABEL_FONT);
+ openoverv.setActionCommand(MessageManager
+ .getString("label.open_overview"));
openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
- openoverv.setText("Open Overview");
+ openoverv.setText(MessageManager.getString(("label.open_overview")));
+ JPanel jPanel2 = new JPanel();
+ jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
+ jPanel2.setLayout(new GridLayout(14, 1));
jPanel2.add(fullScreen);
jPanel2.add(openoverv);
jPanel2.add(seqLimit);
@@ -666,157 +1205,43 @@ public class GPreferences extends JPanel
jPanel2.add(showUnconserved);
jPanel2.add(idItalics);
jPanel2.add(smoothFont);
+ jPanel2.add(scaleProteinToCdna);
jPanel2.add(gapLabel);
jPanel2.add(wrap);
jPanel2.add(sortLabel);
+ jPanel2.add(sortAnnLabel);
jPanel2.add(startupCheckbox);
+ visualTab.add(jPanel2);
visualTab.add(annotations);
visualTab.add(startupFileTextfield);
visualTab.add(sortby);
+ visualTab.add(sortAnnBy);
+ visualTab.add(sortAutocalc);
visualTab.add(gapSymbolCB);
visualTab.add(fontNameCB);
visualTab.add(fontSizeCB);
visualTab.add(fontStyleCB);
- annsettingsPanel.setBounds(new Rectangle(173, 34, 300, 61));
- annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
- annsettingsPanel.add(autoAnnotSettings1);
- annsettingsPanel.add(autoAnnotSettings2);
- annsettingsPanel.add(autoAnnotSettings3);
- autoAnnotSettings1.setLayout(new GridLayout(3, 1, 0, 0));
- autoAnnotSettings2.setLayout(new GridLayout(3, 1, 0, 0));
- autoAnnotSettings3.setLayout(new GridLayout(3, 1, 0, 0));
- visualTab.add(annsettingsPanel);
- Border jb = new EmptyBorder(1, 1, 4, 5);
- quality.setBorder(jb);
- conservation.setBorder(jb);
- identity.setBorder(jb);
- showConsensbits.setBorder(jb);
- showGroupbits.setBorder(jb);
- showGroupConsensus.setBorder(jb);
- showGroupConservation.setBorder(jb);
- showConsensHistogram.setBorder(jb);
- showConsensLogo.setBorder(jb);
-
- autoAnnotSettings2.add(conservation);
- autoAnnotSettings1.add(quality);
- autoAnnotSettings3.add(identity);
- autoAnnotSettings1.add(showGroupbits);
- autoAnnotSettings3.add(showGroupConsensus);
- autoAnnotSettings2.add(showGroupConservation);
- autoAnnotSettings1.add(showConsensbits);
- autoAnnotSettings2.add(showConsensHistogram);
- autoAnnotSettings3.add(showConsensLogo);
-
- JPanel tooltipSettings = new JPanel();
- tooltipSettings.setBorder(new TitledBorder("Sequence ID Tooltip"));
- tooltipSettings.setBounds(173, 130, 200, 62);
- tooltipSettings.setLayout(new GridLayout(2, 1));
- tooltipSettings.add(showDbRefTooltip);
- tooltipSettings.add(showNpTooltip);
- visualTab.add(tooltipSettings);
- visualTab.add(jPanel2);
- JvSwingUtils.addtoLayout(visual2Tab, "Default Colourscheme for alignment", colourLabel, colour);
- JPanel annotationShding=new JPanel();
- annotationShding.setBorder(new TitledBorder("Annotation Shading Default"));
- annotationShding.setLayout(new GridLayout(1,2));
- JvSwingUtils.addtoLayout(annotationShding, "Default Minimum Colour for annotation shading", mincolourLabel,minColour);
- JvSwingUtils.addtoLayout(annotationShding,"Default Maximum Colour for annotation shading", maxcolourLabel, maxColour);
- visual2Tab.add(annotationShding); // , FlowLayout.LEFT);
-
-// visual2panel.add(minColour);
-// visual2panel.add(maxColour);
-// visual2Tab.add(visual2panel);
+ return visualTab;
+ }
- linkPanel.add(editLinkButtons, BorderLayout.EAST);
- editLinkButtons.add(newLink, null);
- editLinkButtons.add(editLink, null);
- editLinkButtons.add(deleteLink, null);
- linkPanel.add(linkScrollPane, BorderLayout.CENTER);
- linkScrollPane.getViewport().add(linkPanel2, null);
- linkPanel2.add(linkURLList, BorderLayout.CENTER);
- linkPanel2.add(linkNameList, BorderLayout.WEST);
- okCancelPanel.add(ok);
- okCancelPanel.add(cancel);
- this.add(tabbedPane, java.awt.BorderLayout.CENTER);
+ protected void autoIdWidth_actionPerformed()
+ {
+ // TODO Auto-generated method stub
- this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
- jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
- GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
- 2, 4, 0), 5, 0));
- jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
- GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
- 0, 4, 0), 11, 6));
- connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
- 16, 0, 0, 12), 359, -17));
- connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
- 21, 0, 35, 12), 4, 6));
- connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
- 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
- new Insets(16, 0, 0, 0), 5, 1));
- jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
- GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 4, 2), 54, 1));
- jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
- GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 4, 0), 263, 1));
- connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
- 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(15, 0, 0, 15), 307, 1));
- connectTab.add(usagestats, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0,
- GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 4, 2), 70, 1));
- connectTab.add(questionnaire, new GridBagConstraints(1, 4, 1, 1, 1.0,
- 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 4, 2), 70, 1));
- connectTab.add(versioncheck, new GridBagConstraints(0, 5, 1, 1, 1.0,
- 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 4, 2), 70, 1));
+ }
- jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
- GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
- 2, 5, 185), 2, -4));
- DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
- dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
- gapSymbolCB.setRenderer(dlcr);
+ protected void userIdWidth_actionPerformed()
+ {
+ // TODO Auto-generated method stub
- tabbedPane.add(visualTab, "Visual");
- tabbedPane.add(visual2Tab,"Colours");
- tabbedPane.add(connectTab, "Connections");
- tabbedPane.add(exportTab, "Output");
- jPanel11.add(jLabel1);
- jPanel11.add(blcjv);
- jPanel11.add(clustaljv);
- jPanel11.add(fastajv);
- jPanel11.add(msfjv);
- jPanel11.add(pfamjv);
- jPanel11.add(pileupjv);
- jPanel11.add(pirjv);
- exportTab.add(modellerOutput);
- tabbedPane.add(calcTab, "Editing");
- calcTab.add(autoCalculateConsCheck);
- calcTab.add(padGaps);
- calcTab.add(sortByTree);
-
- tabbedPane.add(dasPanel, "DAS Settings");
- tabbedPane.add(wsPanel, "Web Services");
-
- exportTab.add(epsLabel);
- exportTab.add(epsRendering);
- exportTab.add(jPanel11);
}
- protected void maxColour_actionPerformed()
+ protected void maxColour_actionPerformed(JPanel panel)
{
- // TODO Auto-generated method stub
-
}
- protected void minColour_actionPerformed()
+ protected void minColour_actionPerformed(JPanel panel)
{
- // TODO Auto-generated method stub
-
}
protected void showunconserved_actionPerformed(ActionEvent e)
diff --git a/src/jalview/jbgui/GRestInputParamEditDialog.java b/src/jalview/jbgui/GRestInputParamEditDialog.java
index f389430..b0f0480 100644
--- a/src/jalview/jbgui/GRestInputParamEditDialog.java
+++ b/src/jalview/jbgui/GRestInputParamEditDialog.java
@@ -1,110 +1,136 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.jbgui;
+import jalview.gui.JvSwingUtils;
+import jalview.gui.OptsAndParamsPage;
+import jalview.util.MessageManager;
+
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
-import jalview.gui.JvSwingUtils;
-import jalview.gui.OptsAndParamsPage;
-
-import javax.swing.*;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.ListSelectionModel;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import net.miginfocom.swing.MigLayout;
-
public class GRestInputParamEditDialog
{
protected JPanel dpane;
+
protected JPanel okcancel;
+
protected JList typeList;
+
protected JTextField tok;
+
protected JPanel options;
+
protected JPanel optionsPanel;
- public GRestInputParamEditDialog()
+
+ public GRestInputParamEditDialog()
{
jbInit();
}
- protected void jbInit() {
- dpane = new JPanel(new MigLayout("","[][][fill]","[][fill][]"));
- dpane.setPreferredSize(new Dimension(110+100+OptsAndParamsPage.PARAM_WIDTH,400));
+
+ protected void jbInit()
+ {
+ dpane = new JPanel(new MigLayout("", "[][][fill]", "[][fill][]"));
+ dpane.setPreferredSize(new Dimension(
+ 110 + 100 + OptsAndParamsPage.PARAM_WIDTH, 400));
typeList = new JList();
typeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- typeList.getSelectionModel().addListSelectionListener(new ListSelectionListener()
- {
-
- @Override
- public void valueChanged(ListSelectionEvent e)
- {
- type_SelectionChangedActionPerformed(e);
- };
- });
-
+ typeList.getSelectionModel().addListSelectionListener(
+ new ListSelectionListener()
+ {
+
+ @Override
+ public void valueChanged(ListSelectionEvent e)
+ {
+ type_SelectionChangedActionPerformed(e);
+ };
+ });
+
tok = new JTextField();
tok.addKeyListener(new KeyListener()
{
-
+
@Override
public void keyTyped(KeyEvent e)
{
}
-
+
@Override
public void keyReleased(KeyEvent e)
{
tokChanged_actionPerformed();
}
-
+
@Override
public void keyPressed(KeyEvent e)
{
-
+
}
});
- options = new JPanel(new MigLayout("","[grow 100,fill]",""));
- optionsPanel = new JPanel(new MigLayout("","[fill]","[fill]"));
+ options = new JPanel(new MigLayout("", "[grow 100,fill]", ""));
+ optionsPanel = new JPanel(new MigLayout("", "[fill]", "[fill]"));
JScrollPane optionView = new JScrollPane();
optionView.setViewportView(options);
- JvSwingUtils.mgAddtoLayout(dpane, "Input Parameter name", new JLabel("Name"), tok, "grow,spanx 3,wrap");
- JPanel paramsType = new JPanel(new MigLayout("","[grow 100,fill]","[grow 100,fill]"));
- paramsType.setBorder(new TitledBorder("Select input type"));
- JScrollPane jlistScroller=new JScrollPane();
+ JvSwingUtils.mgAddtoLayout(dpane,
+ MessageManager.getString("label.input_parameter_name"),
+ new JLabel(MessageManager.getString("label.name")), tok,
+ "grow,spanx 3,wrap");
+ JPanel paramsType = new JPanel(new MigLayout("", "[grow 100,fill]",
+ "[grow 100,fill]"));
+ paramsType.setBorder(new TitledBorder(MessageManager
+ .getString("label.select_input_type")));
+ JScrollPane jlistScroller = new JScrollPane();
jlistScroller.setViewportView(typeList);
- paramsType.add(jlistScroller,"spanx 2,spany 2");
+ paramsType.add(jlistScroller, "spanx 2,spany 2");
dpane.add(paramsType);
- optionsPanel.setBorder(new TitledBorder("Set options for type"));
+ optionsPanel.setBorder(new TitledBorder(MessageManager
+ .getString("label.set_options_for_type")));
optionsPanel.add(optionView);
- dpane.add(optionsPanel,"wrap");
- okcancel = new JPanel(new MigLayout("","[center][center]","[]"));
- dpane.add(okcancel,"spanx 3,wrap");
+ dpane.add(optionsPanel, "wrap");
+ okcancel = new JPanel(new MigLayout("", "[center][center]", "[]"));
+ dpane.add(okcancel, "spanx 3,wrap");
}
+
protected void tokChanged_actionPerformed()
{
-
+
}
+
protected void type_SelectionChangedActionPerformed(ListSelectionEvent e)
{
}
-
+
}
diff --git a/src/jalview/jbgui/GRestServiceEditorPane.java b/src/jalview/jbgui/GRestServiceEditorPane.java
index de35733..c233f63 100644
--- a/src/jalview/jbgui/GRestServiceEditorPane.java
+++ b/src/jalview/jbgui/GRestServiceEditorPane.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.jbgui;
import jalview.gui.JvSwingUtils;
+import jalview.util.MessageManager;
import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
@@ -38,19 +38,13 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
-import javax.swing.JViewport;
import javax.swing.ListSelectionModel;
-import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
-import javax.swing.event.CaretEvent;
-import javax.swing.event.CaretListener;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.event.ListSelectionListener;
import net.miginfocom.swing.MigLayout;
-public class GRestServiceEditorPane extends JPanel {
+public class GRestServiceEditorPane extends JPanel
+{
protected JTabbedPane panels;
@@ -94,14 +88,15 @@ public class GRestServiceEditorPane extends JPanel {
protected void jbInit()
{
details = new JPanel();
- details.setName("Details");
+ details.setName(MessageManager.getString("label.details"));
details.setLayout(new MigLayout());
inputs = new JPanel();
- inputs.setName("Input/Output");
- inputs.setLayout(new MigLayout("","[grow 85,fill][]",""));
+ inputs.setName(MessageManager.getString("label.input_output"));
+ inputs.setLayout(new MigLayout("", "[grow 85,fill][]", ""));
paste = new JPanel();
- paste.setName("Cut'n'Paste");
- paste.setLayout(new MigLayout("","[grow 100, fill]","[][grow 100,fill]"));
+ paste.setName(MessageManager.getString("label.cut_paste"));
+ paste.setLayout(new MigLayout("", "[grow 100, fill]",
+ "[][grow 100,fill]"));
panels = new JTabbedPane();
panels.addTab(details.getName(), details);
@@ -114,48 +109,45 @@ public class GRestServiceEditorPane extends JPanel {
cpanel = details;
name = new JTextArea(1, 12);
- JvSwingUtils
- .mgAddtoLayout(cpanel, "Short descriptive name for service",
- new JLabel("Name:"), name,"wrap");
+ JvSwingUtils.mgAddtoLayout(cpanel, MessageManager
+ .getString("label.short_descriptive_name_for_service"),
+ new JLabel(MessageManager.getString("label.name")), name,
+ "wrap");
action = new JComboBox();
- JvSwingUtils
- .mgAddtoLayout(
- cpanel,
- "What kind of function the service performs (e.g. alignment, analysis, search, etc).",
- new JLabel("Service Action:"), action,"wrap");
+ JvSwingUtils.mgAddtoLayout(cpanel,
+ MessageManager.getString("label.function_service_performs"),
+ new JLabel(MessageManager.getString("label.service_action")),
+ action, "wrap");
descr = new JTextArea(4, 60);
descrVp = new JScrollPane();
descrVp.setViewportView(descr);
- JvSwingUtils.mgAddtoLayout(cpanel, "Brief description of service",
- new JLabel("Description:"), descrVp,"wrap");
+ JvSwingUtils.mgAddtoLayout(cpanel,
+ MessageManager.getString("label.brief_description_service"),
+ new JLabel(MessageManager.getString("label.description")),
+ descrVp, "wrap");
url = new JTextArea(2, 60);
urlVp = new JScrollPane();
urlVp.setViewportView(url);
- JvSwingUtils
- .mgAddtoLayout(
- cpanel,
- "URL to post data to service. Include any special parameters needed here",
- new JLabel("POST URL:"), urlVp,"wrap");
+ JvSwingUtils.mgAddtoLayout(cpanel,
+ MessageManager.getString("label.url_post_data_service"),
+ new JLabel(MessageManager.getString("label.post_url")), urlVp,
+ "wrap");
urlsuff = new JTextArea();
urlsuff.setColumns(60);
- JvSwingUtils
- .mgAddtoLayout(
- cpanel,
- "Optional suffix added to URL when retrieving results from service",
- new JLabel("URL Suffix:"), urlsuff,"wrap");
+ JvSwingUtils.mgAddtoLayout(cpanel, MessageManager
+ .getString("label.optional_suffix"),
+ new JLabel(MessageManager.getString("label.url_suffix")),
+ urlsuff, "wrap");
// input options
// details.add(cpanel = new JPanel(), BorderLayout.CENTER);
// cpanel.setLayout(new FlowLayout());
- hSeparable = new JCheckBox("per Sequence");
- hSeparable
- .setToolTipText("<html>"
- + JvSwingUtils
- .wrapTooltip("When checked, a job is created for every sequence in the current selection.")
- + "<html>");
+ hSeparable = new JCheckBox(MessageManager.getString("label.per_seq"));
+ hSeparable.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.job_created_when_checked")));
hSeparable.addActionListener(new ActionListener()
{
@@ -166,15 +158,13 @@ public class GRestServiceEditorPane extends JPanel {
}
});
- vSeparable = new JCheckBox("Results are vertically separable");
+ vSeparable = new JCheckBox(
+ MessageManager.getString("label.result_vertically_separable"));
vSeparable
- .setToolTipText("<html>"
- + JvSwingUtils
- .wrapTooltip("When checked, a single job is created for the visible region and results"
- + " mapped back onto their location in the alignment. Otherwise, a job would be"
- + " created for every contiguous region visible in the alignment or current"
- + " selection (e.g. a multiple alignment).")
- + "</html>");
+ .setToolTipText(JvSwingUtils.wrapTooltip(
+ true,
+ MessageManager
+ .getString("label.when_checked_job_visible_region_and_results")));
vSeparable.addActionListener(new ActionListener()
{
@@ -186,12 +176,10 @@ public class GRestServiceEditorPane extends JPanel {
}
});
gapChar = new JComboBox();
- JvSwingUtils
- .mgAddtoLayout(
- cpanel,
- "Which gap character does this service prefer ?",
- new JLabel("Gap Character:"), gapChar,"wrap");
-
+ JvSwingUtils.mgAddtoLayout(cpanel,
+ MessageManager.getString("label.preferred_gap_character"),
+ new JLabel(MessageManager.getString("label.gap_character")
+ + ":"), gapChar, "wrap");
cpanel.add(hSeparable);
cpanel.add(vSeparable);
@@ -199,56 +187,59 @@ public class GRestServiceEditorPane extends JPanel {
// Input and Output lists
// Inputparams
JPanel iprmsList = new JPanel();
- iprmsList.setBorder(new TitledBorder("Data input parameters"));
- iprmsList.setLayout(new MigLayout("","[grow 90, fill][]"));
+ iprmsList.setBorder(new TitledBorder(MessageManager
+ .getString("label.data_input_parameters")));
+ iprmsList.setLayout(new MigLayout("", "[grow 90, fill][]"));
iprmVp = new JScrollPane();
iprmVp.getViewport().setView(iprms = new JList());
iprmsList.add(iprmVp);
iprms.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
iprms.addMouseListener(new MouseListener()
{
-
+
@Override
public void mouseReleased(MouseEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void mousePressed(MouseEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void mouseExited(MouseEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void mouseEntered(MouseEvent e)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void mouseClicked(MouseEvent e)
{
- if (e.getClickCount()>1) {
+ if (e.getClickCount() > 1)
+ {
iprmListSelection_doubleClicked();
}
-
+
}
});
JPanel iprmButs = new JPanel();
iprmButs.setLayout(new MigLayout());
- iprmsAdd = JvSwingUtils.makeButton("+", "Add input parameter",
+ iprmsAdd = JvSwingUtils.makeButton("+",
+ MessageManager.getString("action.add_input_parameter"),
new ActionListener()
{
@@ -260,7 +251,8 @@ public class GRestServiceEditorPane extends JPanel {
}
});
iprmsRem = JvSwingUtils.makeButton("-",
- "Remove selected input parameter", new ActionListener()
+ MessageManager.getString("action.remove_input_parameter"),
+ new ActionListener()
{
@Override
@@ -271,14 +263,15 @@ public class GRestServiceEditorPane extends JPanel {
}
});
- iprmButs.add(iprmsAdd,"wrap");
- iprmButs.add(iprmsRem,"wrap");
+ iprmButs.add(iprmsAdd, "wrap");
+ iprmButs.add(iprmsRem, "wrap");
iprmsList.add(iprmButs, "wrap");
inputs.add(iprmsList, "wrap");
// Return Parameters
-
- rdataAdd = JvSwingUtils.makeButton("+", "Add return datatype",
+
+ rdataAdd = JvSwingUtils.makeButton("+",
+ MessageManager.getString("action.add_return_datatype"),
new ActionListener()
{
@@ -289,7 +282,8 @@ public class GRestServiceEditorPane extends JPanel {
}
});
- rdataRem = JvSwingUtils.makeButton("-", "Remove return datatype",
+ rdataRem = JvSwingUtils.makeButton("-",
+ MessageManager.getString("action.remove_return_datatype"),
new ActionListener()
{
@@ -300,8 +294,10 @@ public class GRestServiceEditorPane extends JPanel {
}
});
- rdataNup = JvSwingUtils.makeButton("Move Up",
- "Move return type up order", new ActionListener()
+ rdataNup = JvSwingUtils.makeButton(
+ MessageManager.getString("action.move_up"),
+ MessageManager.getString("label.move_return_type_up_order"),
+ new ActionListener()
{
@Override
@@ -311,8 +307,10 @@ public class GRestServiceEditorPane extends JPanel {
}
});
- rdataNdown = JvSwingUtils.makeButton("Move Down",
- "Move return type down order", new ActionListener()
+ rdataNdown = JvSwingUtils.makeButton(
+ MessageManager.getString("action.move_down"),
+ MessageManager.getString("label.move_return_type_down_order"),
+ new ActionListener()
{
@Override
@@ -324,48 +322,50 @@ public class GRestServiceEditorPane extends JPanel {
});
JPanel rparamList = new JPanel();
- rparamList.setBorder(new TitledBorder("Data returned by service"));
- rparamList.setLayout(new MigLayout("","[grow 90, fill][]"));
+ rparamList.setBorder(new TitledBorder(MessageManager
+ .getString("label.data_returned_by_service")));
+ rparamList.setLayout(new MigLayout("", "[grow 90, fill][]"));
rdata = new JList();
- rdata.setToolTipText("Right click to edit currently selected parameter.");
+ rdata.setToolTipText(MessageManager
+ .getString("label.right_click_to_edit_currently_selected_parameter"));
rdata.addMouseListener(new MouseListener()
{
-
+
@Override
public void mouseReleased(MouseEvent arg0)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void mousePressed(MouseEvent arg0)
{
-
+
}
-
+
@Override
public void mouseExited(MouseEvent arg0)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void mouseEntered(MouseEvent arg0)
{
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void mouseClicked(MouseEvent arg0)
{
- if (arg0.getButton()==MouseEvent.BUTTON3)
+ if (arg0.getButton() == MouseEvent.BUTTON3)
{
rdata_rightClicked(arg0);
}
-
+
}
});
rdataVp = new JScrollPane();
@@ -373,51 +373,58 @@ public class GRestServiceEditorPane extends JPanel {
rparamList.add(rdataVp);
JPanel rparamButs = new JPanel();
rparamButs.setLayout(new MigLayout());
- rparamButs.add(rdataAdd,"wrap");
- rparamButs.add(rdataRem,"wrap");
- rparamButs.add(rdataNup,"wrap");
- rparamButs.add(rdataNdown,"wrap");
- rparamList.add(rparamButs,"wrap");
- inputs.add(rparamList,"wrap");
-
+ rparamButs.add(rdataAdd, "wrap");
+ rparamButs.add(rdataRem, "wrap");
+ rparamButs.add(rdataNup, "wrap");
+ rparamButs.add(rdataNdown, "wrap");
+ rparamList.add(rparamButs, "wrap");
+ inputs.add(rparamList, "wrap");
+
// Parse flat-text to a service
-
- urldesc = new JTextArea(4,60);
+ urldesc = new JTextArea(4, 60);
urldesc.setEditable(true);
urldesc.setWrapStyleWord(true);
urldescVp = new JScrollPane();
urldescVp.setViewportView(urldesc);
JPanel urldescPane = new JPanel();
- urldescPane.setLayout(new MigLayout("","[grow 100, fill]", "[grow 100, fill]"));
- urldescPane.setBorder(new TitledBorder("RSBS Encoded Service"));
+ urldescPane.setLayout(new MigLayout("", "[grow 100, fill]",
+ "[grow 100, fill]"));
+ urldescPane.setBorder(new TitledBorder(MessageManager
+ .getString("label.rsbs_encoded_service")));
urldescPane.add(urldescVp, "span");
- paste.add(urldescPane,"span");
- urldescPane.setToolTipText("<html>"+JvSwingUtils.wrapTooltip("Flat file representation of this rest service using the Really Simple Bioinformatics Service formalism"));
-
+ paste.add(urldescPane, "span");
+ urldescPane.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.flat_file_representation")));
+
parseRes = new JTextArea();
parseResVp = new JScrollPane();
parseResVp.setViewportView(parseRes);
parseRes.setWrapStyleWord(true);
parseRes.setColumns(60);
- parseWarnings = new JPanel(new MigLayout("","[grow 100, fill]", "[grow 100, fill]"));
- parseWarnings.setBorder(new TitledBorder("Parsing errors"));
- parseWarnings.setToolTipText("<html>"+JvSwingUtils.wrapTooltip("Results of parsing the RSBS representation")+"</html>");
+ parseWarnings = new JPanel(new MigLayout("", "[grow 100, fill]",
+ "[grow 100, fill]"));
+ parseWarnings.setBorder(new TitledBorder(MessageManager
+ .getString("label.parsing_errors")));
+ parseWarnings.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.result_of_parsing_rsbs")));
parseWarnings.add(parseResVp, "center");
parseRes.setEditable(false);
paste.add(parseWarnings, "span");
setLayout(new BorderLayout());
add(panels, BorderLayout.CENTER);
- okButton = JvSwingUtils.makeButton("OK", "", new ActionListener()
- {
+ okButton = JvSwingUtils.makeButton(
+ MessageManager.getString("action.ok"), "", new ActionListener()
+ {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- ok_actionPerformed();
- }
- });
- cancelButton = JvSwingUtils.makeButton("Cancel", "",
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed();
+ }
+ });
+ cancelButton = JvSwingUtils.makeButton(
+ MessageManager.getString("action.cancel"), "",
new ActionListener()
{
@@ -433,13 +440,13 @@ public class GRestServiceEditorPane extends JPanel {
protected void rdata_rightClicked(MouseEvent arg0)
{
// TODO Auto-generated method stub
-
+
}
protected void iprmListSelection_doubleClicked()
{
// TODO Auto-generated method stub
-
+
}
protected void hSeparable_actionPerformed(ActionEvent arg0)
diff --git a/src/jalview/jbgui/GRnaStructureViewer.java b/src/jalview/jbgui/GRnaStructureViewer.java
new file mode 100644
index 0000000..ad84901
--- /dev/null
+++ b/src/jalview/jbgui/GRnaStructureViewer.java
@@ -0,0 +1,43 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.jbgui;
+
+import javax.swing.JInternalFrame;
+
+public class GRnaStructureViewer extends JInternalFrame
+{
+ public GRnaStructureViewer()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ private void jbInit() throws Exception
+ {
+
+ }
+
+}
diff --git a/src/jalview/jbgui/GSequenceLink.java b/src/jalview/jbgui/GSequenceLink.java
index c8c5a5d..bdd9908 100644
--- a/src/jalview/jbgui/GSequenceLink.java
+++ b/src/jalview/jbgui/GSequenceLink.java
@@ -1,28 +1,44 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
import jalview.gui.JvSwingUtils;
+import jalview.util.MessageManager;
import jalview.util.UrlLink;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
public class GSequenceLink extends Panel
{
@@ -61,17 +77,17 @@ public class GSequenceLink extends Panel
});
jLabel1.setFont(JvSwingUtils.getLabelFont());
jLabel1.setHorizontalAlignment(SwingConstants.TRAILING);
- jLabel1.setText("Link Name");
+ jLabel1.setText(MessageManager.getString("label.link_name"));
jLabel1.setBounds(new Rectangle(4, 10, 71, 24));
jLabel2.setFont(JvSwingUtils.getLabelFont());
jLabel2.setHorizontalAlignment(SwingConstants.TRAILING);
- jLabel2.setText("URL");
+ jLabel2.setText(MessageManager.getString("label.url"));
jLabel2.setBounds(new Rectangle(17, 37, 54, 27));
jLabel3.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));
- jLabel3.setText("Use $SEQUENCE_ID$ or $SEQUENCE_ID=/<regex>/=$");
+ jLabel3.setText(MessageManager.getString("label.use_sequence_id_1"));
jLabel3.setBounds(new Rectangle(21, 72, 351, 15));
jLabel4.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));
- jLabel4.setText("\nto embed sequence id in URL");
+ jLabel4.setText(MessageManager.getString("label.use_sequence_id_2"));
jLabel4.setBounds(new Rectangle(21, 93, 351, 15));
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setLayout(null);
@@ -114,11 +130,10 @@ public class GSequenceLink extends Panel
return true;
}
- JOptionPane
- .showInternalMessageDialog(
- jalview.gui.Desktop.desktop,
- "Sequence URL must contain $SEQUENCE_ID$ or a regex $SEQUENCE_ID=/<regex>/=$",
- "URL not valid", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showInternalMessageDialog(jalview.gui.Desktop.desktop,
+ MessageManager.getString("warn.url_must_contain"),
+ MessageManager.getString("label.invalid_url"),
+ JOptionPane.WARNING_MESSAGE);
return false;
}
diff --git a/src/jalview/jbgui/GSliderPanel.java b/src/jalview/jbgui/GSliderPanel.java
index 8cd67db..588f0cf 100644
--- a/src/jalview/jbgui/GSliderPanel.java
+++ b/src/jalview/jbgui/GSliderPanel.java
@@ -1,25 +1,43 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
/**
* DOCUMENT ME!
@@ -107,13 +125,13 @@ public class GSliderPanel extends JPanel
label.setFont(new java.awt.Font("Verdana", 0, 11));
label.setOpaque(false);
label.setHorizontalAlignment(SwingConstants.CENTER);
- label.setText("set this label text");
+ label.setText(MessageManager.getString("label.set_this_label_text"));
southPanel.setLayout(borderLayout1);
gridLayout1.setRows(2);
jPanel2.setLayout(flowLayout1);
applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
applyButton.setOpaque(false);
- applyButton.setText("Apply");
+ applyButton.setText(MessageManager.getString("action.apply"));
applyButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -124,7 +142,7 @@ public class GSliderPanel extends JPanel
undoButton.setEnabled(false);
undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
undoButton.setOpaque(false);
- undoButton.setText("Undo");
+ undoButton.setText(MessageManager.getString("action.undo"));
undoButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -135,7 +153,8 @@ public class GSliderPanel extends JPanel
allGroupsCheck.setEnabled(false);
allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
allGroupsCheck.setOpaque(false);
- allGroupsCheck.setText("Apply to all Groups");
+ allGroupsCheck.setText(MessageManager
+ .getString("action.apply_all_groups"));
allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
diff --git a/src/jalview/jbgui/GSplitFrame.java b/src/jalview/jbgui/GSplitFrame.java
new file mode 100644
index 0000000..39b47ff
--- /dev/null
+++ b/src/jalview/jbgui/GSplitFrame.java
@@ -0,0 +1,163 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.jbgui;
+
+import jalview.util.Platform;
+
+import java.awt.Component;
+import java.awt.MouseInfo;
+import java.awt.Point;
+import java.awt.Rectangle;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JSplitPane;
+import javax.swing.plaf.basic.BasicInternalFrameUI;
+
+public class GSplitFrame extends JInternalFrame
+{
+ private static final long serialVersionUID = 1L;
+
+ private GAlignFrame topFrame;
+
+ private GAlignFrame bottomFrame;
+
+ private JSplitPane splitPane;
+
+ /**
+ * Constructor
+ *
+ * @param top
+ * @param bottom
+ */
+ public GSplitFrame(GAlignFrame top, GAlignFrame bottom)
+ {
+ this.topFrame = top;
+ this.bottomFrame = bottom;
+
+ hideTitleBars();
+
+ addSplitPane();
+ }
+
+ /**
+ * Create and add the split pane containing the top and bottom components.
+ */
+ protected void addSplitPane()
+ {
+ splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topFrame,
+ bottomFrame);
+ splitPane.setVisible(true);
+ final double ratio = bottomFrame.getHeight() == 0 ? 0.5d : topFrame
+ .getHeight()
+ / (double) (topFrame.getHeight() + bottomFrame.getHeight());
+ splitPane.setDividerLocation(ratio);
+ splitPane.setResizeWeight(ratio);
+ splitPane.setDividerSize(5);
+ add(splitPane);
+ }
+
+ /**
+ * Try to hide the title bars as a waste of precious space.
+ *
+ * @see http
+ * ://stackoverflow.com/questions/7218971/java-method-works-on-windows
+ * -but-not-macintosh -java
+ */
+ protected void hideTitleBars()
+ {
+ if (new Platform().isAMac())
+ {
+ // this saves some space - but doesn't hide the title bar
+ topFrame.putClientProperty("JInternalFrame.isPalette", true);
+ // topFrame.getRootPane().putClientProperty("Window.style", "small");
+ bottomFrame.putClientProperty("JInternalFrame.isPalette", true);
+ }
+ else
+ {
+ ((BasicInternalFrameUI) topFrame.getUI()).setNorthPane(null);
+ ((BasicInternalFrameUI) bottomFrame.getUI()).setNorthPane(null);
+ }
+ }
+
+ public GAlignFrame getTopFrame()
+ {
+ return topFrame;
+ }
+
+ public GAlignFrame getBottomFrame()
+ {
+ return bottomFrame;
+ }
+
+ /**
+ * Returns the split pane component the mouse is in, or null if neither.
+ *
+ * @return
+ */
+ protected GAlignFrame getFrameAtMouse()
+ {
+ Point loc = MouseInfo.getPointerInfo().getLocation();
+
+ if (isIn(loc, splitPane.getTopComponent()))
+ {
+ return getTopFrame();
+ }
+ else if (isIn(loc, splitPane.getBottomComponent()))
+ {
+ return getBottomFrame();
+ }
+ return null;
+ }
+
+ private boolean isIn(Point loc, Component comp)
+ {
+ if (!comp.isVisible())
+ {
+ return false;
+ }
+ Point p = comp.getLocationOnScreen();
+ Rectangle r = new Rectangle(p.x, p.y, comp.getWidth(), comp.getHeight());
+ return r.contains(loc);
+ }
+
+ /**
+ * Make the complement of the specified split component visible or hidden,
+ * adjusting the position of the split divide.
+ */
+ public void setComplementVisible(Object alignFrame, boolean show)
+ {
+ if (alignFrame == this.topFrame)
+ {
+ this.bottomFrame.setVisible(show);
+ }
+ else if (alignFrame == this.bottomFrame)
+ {
+ this.topFrame.setVisible(show);
+ }
+ if (show)
+ {
+ // SplitPane needs nudging to restore 50-50 split
+ // TODO save/restore other ratios
+ splitPane.setDividerLocation(0.5d);
+ }
+ validate();
+ }
+}
diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java
new file mode 100644
index 0000000..c4043c4
--- /dev/null
+++ b/src/jalview/jbgui/GStructureChooser.java
@@ -0,0 +1,581 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.jbgui;
+
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignmentPanel;
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
+import jalview.jbgui.PDBDocFieldPreferences.PreferenceSource;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.PDBRestClient;
+import jalview.ws.dbsources.PDBRestClient.PDBDocField;
+
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Arrays;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+ at SuppressWarnings("serial")
+/**
+ * GUI layout for structure chooser
+ * @author tcnofoegbu
+ *
+ */
+public abstract class GStructureChooser extends JPanel implements
+ ItemListener
+{
+ protected String frameTitle = MessageManager
+ .getString("label.structure_chooser");
+
+ protected JInternalFrame mainFrame = new JInternalFrame(frameTitle);
+
+ protected JComboBox<FilterOption> cmb_filterOption = new JComboBox<FilterOption>();
+
+ protected AlignmentPanel ap;
+
+ protected StringBuilder errorWarning = new StringBuilder();
+
+ protected JLabel lbl_result = new JLabel(
+ MessageManager.getString("label.select"));
+
+ protected JButton btn_view = new JButton();
+
+ protected JButton btn_cancel = new JButton();
+
+ protected JButton btn_pdbFromFile = new JButton();
+
+ protected JTextField txt_search = new JTextField(14);
+
+ private JPanel pnl_actions = new JPanel();
+
+ private JPanel pnl_main = new JPanel();
+
+ private JPanel pnl_idInput = new JPanel(new FlowLayout());
+
+ private JPanel pnl_fileChooser = new JPanel(new FlowLayout());
+
+ private JPanel pnl_idInputBL = new JPanel(new BorderLayout());
+
+ private JPanel pnl_fileChooserBL = new JPanel(new BorderLayout());
+
+ private JPanel pnl_locPDB = new JPanel(new BorderLayout());
+
+ protected JPanel pnl_switchableViews = new JPanel(new CardLayout());
+
+ protected CardLayout layout_switchableViews = (CardLayout) (pnl_switchableViews
+ .getLayout());
+
+ private BorderLayout mainLayout = new BorderLayout();
+
+ protected JCheckBox chk_rememberSettings = new JCheckBox(
+ MessageManager.getString("label.dont_ask_me_again"));
+
+ protected JCheckBox chk_invertFilter = new JCheckBox(
+ MessageManager.getString("label.invert"));
+
+ protected ImageIcon loadingImage = new ImageIcon(getClass().getResource(
+ "/images/loading.gif"));
+
+ protected ImageIcon goodImage = new ImageIcon(getClass().getResource(
+ "/images/good.png"));
+
+ protected ImageIcon errorImage = new ImageIcon(getClass().getResource(
+ "/images/error.png"));
+
+ protected ImageIcon warningImage = new ImageIcon(getClass().getResource(
+ "/images/warning.gif"));
+
+ protected JLabel lbl_warning = new JLabel(warningImage);
+
+ protected JLabel lbl_loading = new JLabel(loadingImage);
+
+ protected JLabel lbl_pdbManualFetchStatus = new JLabel(errorImage);
+
+ protected JLabel lbl_fromFileStatus = new JLabel(errorImage);
+
+ protected AssciateSeqPanel idInputAssSeqPanel = new AssciateSeqPanel();
+
+ protected AssciateSeqPanel fileChooserAssSeqPanel = new AssciateSeqPanel();
+
+ protected static final String VIEWS_FILTER = "VIEWS_FILTER";
+
+ protected static final String VIEWS_FROM_FILE = "VIEWS_FROM_FILE";
+
+ protected static final String VIEWS_ENTER_ID = "VIEWS_ENTER_ID";
+
+ protected static final String VIEWS_LOCAL_PDB = "VIEWS_LOCAL_PDB";
+
+ protected JTable tbl_summary = new JTable()
+ {
+ public String getToolTipText(MouseEvent evt)
+ {
+ String toolTipText = null;
+ java.awt.Point pnt = evt.getPoint();
+ int rowIndex = rowAtPoint(pnt);
+ int colIndex = columnAtPoint(pnt);
+
+ try
+ {
+ toolTipText = getValueAt(rowIndex, colIndex).toString();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ toolTipText = (toolTipText == null ? null
+ : (toolTipText.length() > 500 ? JvSwingUtils.wrapTooltip(
+ true, "\"" + toolTipText.subSequence(0, 500)
+ + "...\"") : JvSwingUtils.wrapTooltip(true,
+ toolTipText)));
+ return toolTipText;
+ }
+ };
+
+ protected JScrollPane scrl_foundStructures = new JScrollPane(tbl_summary);
+
+ protected JTable tbl_local_pdb = new JTable();
+
+ protected JScrollPane scrl_localPDB = new JScrollPane(tbl_local_pdb);
+
+ private JTabbedPane pnl_filter = new JTabbedPane();
+
+ private PDBDocFieldPreferences pdbDocFieldPrefs = new PDBDocFieldPreferences(
+ PreferenceSource.STRUCTURE_CHOOSER);
+
+ protected PDBDocField[] previousWantedFields;
+
+ public GStructureChooser()
+ {
+ try
+ {
+ jbInit();
+ mainFrame.setVisible(false);
+ mainFrame.invalidate();
+ mainFrame.pack();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Initializes the GUI default properties
+ *
+ * @throws Exception
+ */
+ private void jbInit() throws Exception
+ {
+ tbl_summary.setAutoCreateRowSorter(true);
+ tbl_summary.getTableHeader().setReorderingAllowed(false);
+ tbl_local_pdb.setAutoCreateRowSorter(true);
+ tbl_local_pdb.getTableHeader().setReorderingAllowed(false);
+ tbl_local_pdb.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ updateCurrentView();
+ }
+
+ public void mouseReleased(MouseEvent e)
+ {
+ updateCurrentView();
+ }
+ });
+
+ btn_view.setFont(new java.awt.Font("Verdana", 0, 12));
+ btn_view.setText(MessageManager.getString("action.view"));
+ btn_view.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_ActionPerformed();
+ }
+ });
+ btn_cancel.setFont(new java.awt.Font("Verdana", 0, 12));
+ btn_cancel.setText(MessageManager.getString("action.cancel"));
+ btn_cancel.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ mainFrame.dispose();
+ }
+ });
+
+ btn_pdbFromFile.setFont(new java.awt.Font("Verdana", 0, 12));
+ String btn_title = MessageManager.getString("label.select_pdb_file");
+ btn_pdbFromFile.setText(btn_title + " ");
+ btn_pdbFromFile.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ pdbFromFile_actionPerformed();
+ }
+ });
+
+ scrl_foundStructures.setPreferredSize(new Dimension(500, 300));
+ scrl_foundStructures
+ .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+
+ scrl_localPDB.setPreferredSize(new Dimension(500, 300));
+ scrl_localPDB
+ .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+
+ cmb_filterOption.setFont(new java.awt.Font("Verdana", 0, 12));
+ chk_invertFilter.setFont(new java.awt.Font("Verdana", 0, 12));
+ chk_rememberSettings.setFont(new java.awt.Font("Verdana", 0, 12));
+ chk_rememberSettings.setVisible(false);
+
+ txt_search.setToolTipText(MessageManager
+ .getString("label.enter_pdb_id"));
+ cmb_filterOption.setToolTipText(MessageManager
+ .getString("info.select_filter_option"));
+ txt_search.getDocument().addDocumentListener(new DocumentListener()
+ {
+ @Override
+ public void insertUpdate(DocumentEvent e)
+ {
+ txt_search_ActionPerformed();
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e)
+ {
+ txt_search_ActionPerformed();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e)
+ {
+ txt_search_ActionPerformed();
+ }
+ });
+
+ cmb_filterOption.addItemListener(this);
+ chk_invertFilter.addItemListener(this);
+
+ pnl_actions.add(chk_rememberSettings);
+ pnl_actions.add(btn_view);
+ pnl_actions.add(btn_cancel);
+
+ // pnl_filter.add(lbl_result);
+ pnl_main.add(cmb_filterOption);
+ pnl_main.add(lbl_loading);
+ pnl_main.add(chk_invertFilter);
+ lbl_loading.setVisible(false);
+
+ pnl_fileChooser.add(btn_pdbFromFile);
+ pnl_fileChooser.add(lbl_fromFileStatus);
+ pnl_fileChooserBL.add(fileChooserAssSeqPanel, BorderLayout.NORTH);
+ pnl_fileChooserBL.add(pnl_fileChooser, BorderLayout.CENTER);
+
+ pnl_idInput.add(txt_search);
+ pnl_idInput.add(lbl_pdbManualFetchStatus);
+ pnl_idInputBL.add(idInputAssSeqPanel, BorderLayout.NORTH);
+ pnl_idInputBL.add(pnl_idInput, BorderLayout.CENTER);
+
+ final String foundStructureSummary = MessageManager
+ .getString("label.found_structures_summary");
+ final String configureCols = MessageManager
+ .getString("label.configure_displayed_columns");
+ ChangeListener changeListener = new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent changeEvent)
+ {
+ JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent
+ .getSource();
+ int index = sourceTabbedPane.getSelectedIndex();
+ if (sourceTabbedPane.getTitleAt(index).equals(configureCols))
+ {
+ btn_view.setEnabled(false);
+ btn_cancel.setEnabled(false);
+ previousWantedFields = PDBDocFieldPreferences
+ .getStructureSummaryFields().toArray(
+ new PDBRestClient.PDBDocField[0]);
+ }
+ if (sourceTabbedPane.getTitleAt(index)
+ .equals(foundStructureSummary))
+ {
+ btn_cancel.setEnabled(true);
+ if (wantedFieldsUpdated())
+ {
+ tabRefresh();
+ }
+ else
+ {
+ validateSelections();
+ }
+ }
+ }
+ };
+ pnl_filter.addChangeListener(changeListener);
+ pnl_filter.setPreferredSize(new Dimension(500, 300));
+ pnl_filter.add(foundStructureSummary, scrl_foundStructures);
+ pnl_filter.add(configureCols, pdbDocFieldPrefs);
+
+ pnl_locPDB.add(scrl_localPDB);
+
+ pnl_switchableViews.add(pnl_fileChooserBL, VIEWS_FROM_FILE);
+ pnl_switchableViews.add(pnl_idInputBL, VIEWS_ENTER_ID);
+ pnl_switchableViews.add(pnl_filter, VIEWS_FILTER);
+ pnl_switchableViews.add(pnl_locPDB, VIEWS_LOCAL_PDB);
+
+ this.setLayout(mainLayout);
+ this.add(pnl_main, java.awt.BorderLayout.NORTH);
+ this.add(pnl_switchableViews, java.awt.BorderLayout.CENTER);
+ this.add(pnl_actions, java.awt.BorderLayout.SOUTH);
+
+ mainFrame.setVisible(true);
+ mainFrame.setContentPane(this);
+ mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ Desktop.addInternalFrame(mainFrame, frameTitle, 800, 400);
+ }
+
+ public boolean wantedFieldsUpdated()
+ {
+ if (previousWantedFields == null)
+ {
+ return true;
+ }
+
+ return Arrays.equals(PDBDocFieldPreferences.getStructureSummaryFields()
+ .toArray(new PDBRestClient.PDBDocField[0]),
+ previousWantedFields) ? false : true;
+
+ }
+
+ @Override
+ /**
+ * Event listener for the 'filter' combo-box and 'invert' check-box
+ */
+ public void itemStateChanged(ItemEvent e)
+ {
+ stateChanged(e);
+ }
+
+ /**
+ * This inner class provides the data model for the structure filter combo-box
+ *
+ * @author tcnofoegbu
+ *
+ */
+ public class FilterOption
+ {
+ private String name;
+
+ private String value;
+
+ private String view;
+
+ public FilterOption(String name, String value, String view)
+ {
+ this.name = name;
+ this.value = value;
+ this.view = view;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public String getView()
+ {
+ return view;
+ }
+
+ public void setView(String view)
+ {
+ this.view = view;
+ }
+
+ public String toString()
+ {
+ return this.name;
+ }
+ }
+
+ /**
+ * This inner class provides the provides the data model for associate
+ * sequence combo-box - cmb_assSeq
+ *
+ * @author tcnofoegbu
+ *
+ */
+ public class AssociateSeqOptions
+ {
+ private SequenceI sequence;
+
+ private String name;
+
+ public AssociateSeqOptions(SequenceI seq)
+ {
+ this.sequence = seq;
+ this.name = (seq.getName().length() >= 23) ? seq.getName().substring(
+ 0, 23) : seq.getName();
+ }
+
+ public AssociateSeqOptions(String name, SequenceI seq)
+ {
+ this.name = name;
+ this.sequence = seq;
+ }
+
+ public String toString()
+ {
+ return name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public SequenceI getSequence()
+ {
+ return sequence;
+ }
+
+ public void setSequence(SequenceI sequence)
+ {
+ this.sequence = sequence;
+ }
+
+ }
+
+ /**
+ * This inner class holds the Layout and configuration of the panel which
+ * handles association of manually fetched structures to a unique sequence
+ * when more than one sequence selection is made
+ *
+ * @author tcnofoegbu
+ *
+ */
+ public class AssciateSeqPanel extends JPanel implements ItemListener
+ {
+ private JComboBox<AssociateSeqOptions> cmb_assSeq = new JComboBox<AssociateSeqOptions>();
+
+ private JLabel lbl_associateSeq = new JLabel();
+
+ public AssciateSeqPanel()
+ {
+ this.setLayout(new FlowLayout());
+ this.add(cmb_assSeq);
+ this.add(lbl_associateSeq);
+ cmb_assSeq.setToolTipText(MessageManager
+ .getString("info.associate_wit_sequence"));
+ cmb_assSeq.addItemListener(this);
+ }
+
+ public void loadCmbAssSeq()
+ {
+ populateCmbAssociateSeqOptions(cmb_assSeq, lbl_associateSeq);
+ }
+
+ public JComboBox<AssociateSeqOptions> getCmb_assSeq()
+ {
+ return cmb_assSeq;
+ }
+
+ public void setCmb_assSeq(JComboBox<AssociateSeqOptions> cmb_assSeq)
+ {
+ this.cmb_assSeq = cmb_assSeq;
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ if (e.getStateChange() == ItemEvent.SELECTED)
+ {
+ cmbAssSeqStateChanged();
+ }
+ }
+ }
+
+ public JComboBox<FilterOption> getCmbFilterOption()
+ {
+ return cmb_filterOption;
+ }
+
+ protected abstract void stateChanged(ItemEvent e);
+
+ protected abstract void updateCurrentView();
+
+ protected abstract void populateFilterComboBox();
+
+ protected abstract void ok_ActionPerformed();
+
+ protected abstract void pdbFromFile_actionPerformed();
+
+ protected abstract void txt_search_ActionPerformed();
+
+ public abstract void populateCmbAssociateSeqOptions(
+ JComboBox<AssociateSeqOptions> cmb_assSeq, JLabel lbl_associateSeq);
+
+ public abstract void cmbAssSeqStateChanged();
+
+ public abstract void tabRefresh();
+
+ public abstract void validateSelections();
+}
diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java
index 28d2c7a..ac2202c 100644
--- a/src/jalview/jbgui/GStructureViewer.java
+++ b/src/jalview/jbgui/GStructureViewer.java
@@ -1,28 +1,93 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import javax.swing.*;
-import java.awt.event.ActionListener;
+import jalview.api.structures.JalviewStructureDisplayI;
+import jalview.util.MessageManager;
+
+import java.awt.GridLayout;
import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
-public class GStructureViewer extends JInternalFrame
+import javax.swing.ButtonGroup;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JRadioButtonMenuItem;
+
+public abstract class GStructureViewer extends JInternalFrame implements
+ JalviewStructureDisplayI
{
+ // private AAStructureBindingModel bindingModel;
+
+ protected JMenu savemenu = new JMenu();
+
+ protected JMenu viewMenu = new JMenu();
+
+ protected JMenu chainMenu = new JMenu();
+
+ protected JMenu viewerActionMenu = new JMenu();
+
+ protected JMenuItem alignStructs = new JMenuItem();
+
+ protected JMenuItem fitToWindow = new JMenuItem();
+
+ protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem viewerColour = new JRadioButtonMenuItem();
+
+ protected JMenuItem helpItem = new JMenuItem();
+
+ protected JLabel statusBar = new JLabel();
+
+ protected JPanel statusPanel = new JPanel();
+
+ /**
+ * Constructor
+ */
public GStructureViewer()
{
try
@@ -36,11 +101,17 @@ public class GStructureViewer extends JInternalFrame
private void jbInit() throws Exception
{
+ JMenuBar menuBar = new JMenuBar();
this.setJMenuBar(menuBar);
- fileMenu.setText("File");
- savemenu.setActionCommand("Save Image");
- savemenu.setText("Save As");
- pdbFile.setText("PDB File");
+
+ JMenu fileMenu = new JMenu();
+ fileMenu.setText(MessageManager.getString("action.file"));
+
+ savemenu.setActionCommand(MessageManager.getString("action.save_image"));
+ savemenu.setText(MessageManager.getString("action.save_as"));
+
+ JMenuItem pdbFile = new JMenuItem();
+ pdbFile.setText(MessageManager.getString("label.pdb_file"));
pdbFile.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -48,6 +119,8 @@ public class GStructureViewer extends JInternalFrame
pdbFile_actionPerformed(actionEvent);
}
});
+
+ JMenuItem png = new JMenuItem();
png.setText("PNG");
png.addActionListener(new ActionListener()
{
@@ -56,6 +129,8 @@ public class GStructureViewer extends JInternalFrame
png_actionPerformed(actionEvent);
}
});
+
+ JMenuItem eps = new JMenuItem();
eps.setText("EPS");
eps.addActionListener(new ActionListener()
{
@@ -64,7 +139,9 @@ public class GStructureViewer extends JInternalFrame
eps_actionPerformed(actionEvent);
}
});
- viewMapping.setText("View Mapping");
+
+ JMenuItem viewMapping = new JMenuItem();
+ viewMapping.setText(MessageManager.getString("label.view_mapping"));
viewMapping.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -72,10 +149,25 @@ public class GStructureViewer extends JInternalFrame
viewMapping_actionPerformed(actionEvent);
}
});
- viewMenu.setText("View");
- chainMenu.setText("Show Chain");
- colourMenu.setText("Colours");
- backGround.setText("Background Colour...");
+ viewMenu.setText(MessageManager.getString("action.view"));
+
+ chainMenu.setText(MessageManager.getString("action.show_chain"));
+
+ fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
+ fitToWindow.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ fitToWindow_actionPerformed();
+ }
+ });
+
+ JMenu colourMenu = new JMenu();
+ colourMenu.setText(MessageManager.getString("label.colours"));
+
+ JMenuItem backGround = new JMenuItem();
+ backGround
+ .setText(MessageManager.getString("action.background_colour"));
backGround.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -84,7 +176,7 @@ public class GStructureViewer extends JInternalFrame
}
});
seqColour.setSelected(false);
- seqColour.setText("By Sequence");
+ seqColour.setText(MessageManager.getString("action.by_sequence"));
seqColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -92,7 +184,7 @@ public class GStructureViewer extends JInternalFrame
seqColour_actionPerformed(actionEvent);
}
});
- chainColour.setText("By Chain");
+ chainColour.setText(MessageManager.getString("action.by_chain"));
chainColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -100,7 +192,7 @@ public class GStructureViewer extends JInternalFrame
chainColour_actionPerformed(actionEvent);
}
});
- chargeColour.setText("Charge & Cysteine");
+ chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
chargeColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -108,7 +200,7 @@ public class GStructureViewer extends JInternalFrame
chargeColour_actionPerformed(actionEvent);
}
});
- zappoColour.setText("Zappo");
+ zappoColour.setText(MessageManager.getString("label.zappo"));
zappoColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -116,7 +208,7 @@ public class GStructureViewer extends JInternalFrame
zappoColour_actionPerformed(actionEvent);
}
});
- taylorColour.setText("Taylor");
+ taylorColour.setText(MessageManager.getString("label.taylor"));
taylorColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -124,7 +216,7 @@ public class GStructureViewer extends JInternalFrame
taylorColour_actionPerformed(actionEvent);
}
});
- hydroColour.setText("Hydro");
+ hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
hydroColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -132,7 +224,8 @@ public class GStructureViewer extends JInternalFrame
hydroColour_actionPerformed(actionEvent);
}
});
- strandColour.setText("Strand");
+ strandColour.setText(MessageManager
+ .getString("label.strand_propensity"));
strandColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -140,7 +233,7 @@ public class GStructureViewer extends JInternalFrame
strandColour_actionPerformed(actionEvent);
}
});
- helixColour.setText("Helix Propensity");
+ helixColour.setText(MessageManager.getString("label.helix_propensity"));
helixColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -148,7 +241,7 @@ public class GStructureViewer extends JInternalFrame
helixColour_actionPerformed(actionEvent);
}
});
- turnColour.setText("Turn Propensity");
+ turnColour.setText(MessageManager.getString("label.turn_propensity"));
turnColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -156,7 +249,7 @@ public class GStructureViewer extends JInternalFrame
turnColour_actionPerformed(actionEvent);
}
});
- buriedColour.setText("Buried Index");
+ buriedColour.setText(MessageManager.getString("label.buried_index"));
buriedColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -164,7 +257,17 @@ public class GStructureViewer extends JInternalFrame
buriedColour_actionPerformed(actionEvent);
}
});
- userColour.setText("User Defined ...");
+ purinePyrimidineColour.setText(MessageManager
+ .getString("label.purine_pyrimidine"));
+ purinePyrimidineColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ purinePyrimidineColour_actionPerformed(actionEvent);
+ }
+ });
+
+ userColour.setText(MessageManager.getString("action.user_defined"));
userColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -172,27 +275,31 @@ public class GStructureViewer extends JInternalFrame
userColour_actionPerformed(actionEvent);
}
});
- jmolColour.setSelected(false);
- jmolColour.setText("Colour with Jmol");
- jmolColour.setToolTipText("Let Jmol manage structure colours.");
- jmolColour.addActionListener(new ActionListener()
+ viewerColour.setSelected(false);
+ viewerColour
+ .setText(MessageManager.getString("label.colour_with_jmol"));
+ viewerColour.setToolTipText(MessageManager
+ .getString("label.let_jmol_manage_structure_colours"));
+ viewerColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
- jmolColour_actionPerformed(actionEvent);
+ viewerColour_actionPerformed(actionEvent);
}
- }
- );
- helpMenu.setText("Help");
- jmolHelp.setText("Jmol Help");
- jmolHelp.addActionListener(new ActionListener()
+ });
+
+ JMenu helpMenu = new JMenu();
+ helpMenu.setText(MessageManager.getString("action.help"));
+ helpItem.setText(MessageManager.getString("label.jmol_help"));
+ helpItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
- jmolHelp_actionPerformed(actionEvent);
+ showHelp_actionPerformed(actionEvent);
}
});
- alignStructs.setText("Align structures");
+ alignStructs
+ .setText(MessageManager.getString("label.align_structures"));
alignStructs.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -200,12 +307,12 @@ public class GStructureViewer extends JInternalFrame
alignStructs_actionPerformed(actionEvent);
}
});
- jmolActionMenu.setText("Jmol");
+ viewerActionMenu.setText(MessageManager.getString("label.jmol"));
menuBar.add(fileMenu);
menuBar.add(viewMenu);
menuBar.add(colourMenu);
- menuBar.add(jmolActionMenu);
- jmolActionMenu.setVisible(false);
+ menuBar.add(viewerActionMenu);
+ viewerActionMenu.setVisible(false);
menuBar.add(helpMenu);
fileMenu.add(savemenu);
fileMenu.add(viewMapping);
@@ -224,10 +331,13 @@ public class GStructureViewer extends JInternalFrame
colourMenu.add(strandColour);
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
+ colourMenu.add(purinePyrimidineColour);
colourMenu.add(userColour);
- colourMenu.add(jmolColour);
+ colourMenu.add(viewerColour);
colourMenu.add(backGround);
+ ButtonGroup colourButtons = new ButtonGroup();
+
colourButtons.add(seqColour);
colourButtons.add(chainColour);
colourButtons.add(chargeColour);
@@ -238,78 +348,29 @@ public class GStructureViewer extends JInternalFrame
colourButtons.add(strandColour);
colourButtons.add(turnColour);
colourButtons.add(buriedColour);
+ colourButtons.add(purinePyrimidineColour);
colourButtons.add(userColour);
- colourButtons.add(jmolColour);
+ colourButtons.add(viewerColour);
- helpMenu.add(jmolHelp);
- jmolActionMenu.add(alignStructs);
+ helpMenu.add(helpItem);
+ viewerActionMenu.add(alignStructs);
+
+ statusPanel.setLayout(new GridLayout());
+ this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
+ statusPanel.add(statusBar, null);
}
- protected void jmolColour_actionPerformed(ActionEvent actionEvent)
+ protected void fitToWindow_actionPerformed()
{
}
- protected void alignStructs_actionPerformed(ActionEvent actionEvent)
+ protected void viewerColour_actionPerformed(ActionEvent actionEvent)
{
}
- JMenuBar menuBar = new JMenuBar();
-
- JMenu fileMenu = new JMenu();
-
- JMenu savemenu = new JMenu();
-
- JMenuItem pdbFile = new JMenuItem();
-
- JMenuItem png = new JMenuItem();
-
- JMenuItem eps = new JMenuItem();
-
- JMenuItem viewMapping = new JMenuItem();
-
- protected JMenu viewMenu = new JMenu();
-
- protected JMenu chainMenu = new JMenu();
-
- JMenu jMenu1 = new JMenu();
-
- protected JMenu colourMenu = new JMenu();
-
- protected JMenu jmolActionMenu = new JMenu();
-
- protected JMenuItem alignStructs = new JMenuItem();
-
- JMenuItem backGround = new JMenuItem();
-
- protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem jmolColour = new JRadioButtonMenuItem();
-
- protected ButtonGroup colourButtons = new ButtonGroup();
-
- JMenu helpMenu = new JMenu();
-
- JMenuItem jmolHelp = new JMenuItem();
+ protected void alignStructs_actionPerformed(ActionEvent actionEvent)
+ {
+ }
public void pdbFile_actionPerformed(ActionEvent actionEvent)
{
@@ -381,6 +442,11 @@ public class GStructureViewer extends JInternalFrame
}
+ public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
public void userColour_actionPerformed(ActionEvent actionEvent)
{
@@ -391,8 +457,18 @@ public class GStructureViewer extends JInternalFrame
}
- public void jmolHelp_actionPerformed(ActionEvent actionEvent)
+ public void showHelp_actionPerformed(ActionEvent actionEvent)
{
}
+
+ // {
+ // return bindingModel;
+ // }
+
+ // public void setBindingModel(AAStructureBindingModel bindingModel)
+ // {
+ // this.bindingModel = bindingModel;
+ // }
+
}
diff --git a/src/jalview/jbgui/GTreePanel.java b/src/jalview/jbgui/GTreePanel.java
index 53c1248..6130204 100644
--- a/src/jalview/jbgui/GTreePanel.java
+++ b/src/jalview/jbgui/GTreePanel.java
@@ -1,26 +1,40 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JScrollPane;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
public class GTreePanel extends JInternalFrame
{
@@ -80,8 +94,8 @@ public class GTreePanel extends JInternalFrame
this.setBackground(Color.white);
this.setFont(new java.awt.Font("Verdana", 0, 12));
scrollPane.setOpaque(false);
- fileMenu.setText("File");
- saveAsNewick.setText("Newick Format");
+ fileMenu.setText(MessageManager.getString("action.file"));
+ saveAsNewick.setText(MessageManager.getString("label.newick_format"));
saveAsNewick.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -89,7 +103,7 @@ public class GTreePanel extends JInternalFrame
saveAsNewick_actionPerformed(e);
}
});
- printMenu.setText("Print");
+ printMenu.setText(MessageManager.getString("action.print"));
printMenu.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -97,7 +111,7 @@ public class GTreePanel extends JInternalFrame
printMenu_actionPerformed(e);
}
});
- viewMenu.setText("View");
+ viewMenu.setText(MessageManager.getString("action.view"));
viewMenu.addMenuListener(new MenuListener()
{
public void menuSelected(MenuEvent e)
@@ -113,15 +127,16 @@ public class GTreePanel extends JInternalFrame
{
}
});
- sortAssocViews.setText("Sort Alignment By Tree");
+ sortAssocViews.setText(MessageManager
+ .getString("label.sort_alignment_by_tree"));
sortAssocViews.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- sortByTree_actionPerformed(e);
+ sortByTree_actionPerformed();
}
});
- font.setText("Font...");
+ font.setText(MessageManager.getString("action.font"));
font.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -129,7 +144,8 @@ public class GTreePanel extends JInternalFrame
font_actionPerformed(e);
}
});
- bootstrapMenu.setText("Show Bootstrap Values");
+ bootstrapMenu.setText(MessageManager
+ .getString("label.show_bootstrap_values"));
bootstrapMenu.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -137,7 +153,7 @@ public class GTreePanel extends JInternalFrame
bootstrapMenu_actionPerformed(e);
}
});
- distanceMenu.setText("Show Distances");
+ distanceMenu.setText(MessageManager.getString("label.show_distances"));
distanceMenu.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -146,7 +162,7 @@ public class GTreePanel extends JInternalFrame
}
});
fitToWindow.setSelected(true);
- fitToWindow.setText("Fit To Window");
+ fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
fitToWindow.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -170,10 +186,12 @@ public class GTreePanel extends JInternalFrame
pngTree_actionPerformed(e);
}
});
- saveAsMenu.setText("Save as");
+ saveAsMenu.setText(MessageManager.getString("action.save_as"));
placeholdersMenu
- .setToolTipText("Marks leaves of tree not associated with a sequence");
- placeholdersMenu.setText("Mark Unlinked Leaves");
+ .setToolTipText(MessageManager
+ .getString("label.marks_leaves_tree_not_associated_with_sequence"));
+ placeholdersMenu.setText(MessageManager
+ .getString("label.mark_unlinked_leaves"));
placeholdersMenu.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -181,7 +199,7 @@ public class GTreePanel extends JInternalFrame
placeholdersMenu_actionPerformed(e);
}
});
- textbox.setText("Output to Textbox...");
+ textbox.setText(MessageManager.getString("label.out_to_textbox"));
textbox.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -189,7 +207,7 @@ public class GTreePanel extends JInternalFrame
textbox_actionPerformed(e);
}
});
- originalSeqData.setText("Input Data...");
+ originalSeqData.setText(MessageManager.getString("label.input_data"));
originalSeqData.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -197,7 +215,8 @@ public class GTreePanel extends JInternalFrame
originalSeqData_actionPerformed(e);
}
});
- associateLeavesMenu.setText("Associate Leaves With");
+ associateLeavesMenu.setText(MessageManager
+ .getString("label.associate_leaves_with"));
this.getContentPane().add(scrollPane, BorderLayout.CENTER);
jMenuBar1.add(fileMenu);
jMenuBar1.add(viewMenu);
@@ -270,7 +289,8 @@ public class GTreePanel extends JInternalFrame
public void viewMenu_menuSelected()
{
}
- public void sortByTree_actionPerformed(ActionEvent e)
+
+ public void sortByTree_actionPerformed()
{
}
diff --git a/src/jalview/jbgui/GUserDefinedColours.java b/src/jalview/jbgui/GUserDefinedColours.java
index 06b57db..d54e98a 100644
--- a/src/jalview/jbgui/GUserDefinedColours.java
+++ b/src/jalview/jbgui/GUserDefinedColours.java
@@ -1,27 +1,46 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
import jalview.gui.JvSwingUtils;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JColorChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.colorchooser.AbstractColorChooserPanel;
/**
* DOCUMENT ME!
@@ -113,7 +132,7 @@ public class GUserDefinedColours extends JPanel
gridLayout.setColumns(4);
gridLayout.setRows(5);
okButton.setFont(new java.awt.Font("Verdana", 0, 11));
- okButton.setText("OK");
+ okButton.setText(MessageManager.getString("action.ok"));
okButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -122,7 +141,7 @@ public class GUserDefinedColours extends JPanel
}
});
applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
- applyButton.setText("Apply");
+ applyButton.setText(MessageManager.getString("action.apply"));
applyButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -131,7 +150,7 @@ public class GUserDefinedColours extends JPanel
}
});
loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
- loadbutton.setText("Load scheme");
+ loadbutton.setText(MessageManager.getString("action.load_scheme"));
loadbutton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -140,7 +159,7 @@ public class GUserDefinedColours extends JPanel
}
});
savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
- savebutton.setText("Save scheme");
+ savebutton.setText(MessageManager.getString("action.save_scheme"));
savebutton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -149,7 +168,7 @@ public class GUserDefinedColours extends JPanel
}
});
cancelButton.setFont(JvSwingUtils.getLabelFont());
- cancelButton.setText("Cancel");
+ cancelButton.setText(MessageManager.getString("action.cancel"));
cancelButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -162,7 +181,7 @@ public class GUserDefinedColours extends JPanel
lowerPanel.setLayout(borderLayout3);
colorChooser.setOpaque(false);
jLabel1.setFont(JvSwingUtils.getLabelFont());
- jLabel1.setText("Name");
+ jLabel1.setText(MessageManager.getString("label.name"));
namePanel.setMinimumSize(new Dimension(300, 31));
namePanel.setOpaque(false);
namePanel.setPreferredSize(new Dimension(240, 25));
@@ -179,9 +198,12 @@ public class GUserDefinedColours extends JPanel
label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
label.setOpaque(false);
label.setPreferredSize(new Dimension(260, 34));
- label.setText("<html>Save your colour scheme with a unique name and it will be added "
- + "to the Colour menu.</html>");
- caseSensitive.setText("Case Sensitive");
+ label.setText(MessageManager
+ .formatMessage(
+ "label.html_content",
+ new String[] { MessageManager
+ .getString("label.save_colour_scheme_with_unique_name_added_to_colour_menu") }));
+ caseSensitive.setText(MessageManager.getString("label.case_sensitive"));
caseSensitive.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -189,7 +211,8 @@ public class GUserDefinedColours extends JPanel
caseSensitive_actionPerformed(e);
}
});
- lcaseColour.setText("Lower Case Colour");
+ lcaseColour
+ .setText(MessageManager.getString("label.lower_case_colour"));
lcaseColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -219,6 +242,17 @@ public class GUserDefinedColours extends JPanel
jPanel4.add(panel1, java.awt.BorderLayout.CENTER);
this.add(jPanel4, java.awt.BorderLayout.CENTER);
this.add(colorChooser, java.awt.BorderLayout.EAST);
+
+ AbstractColorChooserPanel[] choosers = colorChooser.getChooserPanels();
+ // JAL-1360 larger JColorChooser in Java 7 overwrites AA panel; restrict to
+ // swatch picker only
+ if (choosers.length > 3)
+ {
+ // Java 7 default has 5 options rather than 3 for choosing colours; keep
+ // the first only
+ colorChooser
+ .setChooserPanels(new AbstractColorChooserPanel[] { choosers[0] });
+ }
}
/**
diff --git a/src/jalview/jbgui/GWebserviceInfo.java b/src/jalview/jbgui/GWebserviceInfo.java
index b76e48e..f64568a 100644
--- a/src/jalview/jbgui/GWebserviceInfo.java
+++ b/src/jalview/jbgui/GWebserviceInfo.java
@@ -1,25 +1,41 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
/**
* DOCUMENT ME!
@@ -53,6 +69,10 @@ public class GWebserviceInfo extends JPanel
GridBagLayout gridBagLayout1 = new GridBagLayout();
+ public JPanel statusPanel = new JPanel(new GridLayout());
+
+ public JLabel statusBar = new JLabel();
+
/**
* Creates a new GWebserviceInfo object.
*/
@@ -89,7 +109,7 @@ public class GWebserviceInfo extends JPanel
jScrollPane1.setBorder(null);
jScrollPane1.setPreferredSize(new Dimension(400, 70));
cancel.setFont(new java.awt.Font("Verdana", 0, 11));
- cancel.setText("Cancel");
+ cancel.setText(MessageManager.getString("action.cancel"));
cancel.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -99,8 +119,9 @@ public class GWebserviceInfo extends JPanel
});
buttonPanel.setLayout(gridBagLayout1);
buttonPanel.setOpaque(false);
- showResultsNewFrame.setText("New Window");
- mergeResults.setText("Merge Results");
+ showResultsNewFrame.setText(MessageManager
+ .getString("label.new_window"));
+ mergeResults.setText(MessageManager.getString("action.merge_results"));
this.setBackground(Color.white);
this.add(jPanel1, BorderLayout.NORTH);
jPanel1.add(jScrollPane1, BorderLayout.CENTER);
@@ -110,6 +131,8 @@ public class GWebserviceInfo extends JPanel
buttonPanel.add(cancel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
19, 6, 16, 4), 0, 0));
+ this.add(statusPanel, java.awt.BorderLayout.SOUTH);
+ statusPanel.add(statusBar, null);
}
/**
diff --git a/src/jalview/jbgui/GWsPreferences.java b/src/jalview/jbgui/GWsPreferences.java
index d94b047..98b6c73 100644
--- a/src/jalview/jbgui/GWsPreferences.java
+++ b/src/jalview/jbgui/GWsPreferences.java
@@ -1,22 +1,27 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
+import jalview.util.MessageManager;
+
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
@@ -36,8 +41,8 @@ import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
+import javax.swing.JTable;
import javax.swing.ListSelectionModel;
-import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;
/**
@@ -50,7 +55,8 @@ public class GWsPreferences extends JPanel
protected JList sbrsList = new JList();
protected TitledBorder sbrsListTitleBorder = new TitledBorder(
- "Simple Bioinformatics Rest Services");
+ MessageManager
+ .getString("label.simple_bioinformatics_rest_services"));
protected JButton newSbrsUrl = new JButton();
@@ -58,10 +64,11 @@ public class GWsPreferences extends JPanel
protected JButton deleteSbrsUrl = new JButton();
- protected JList wsList = new JList();
+ // Web service status and url table
+ protected JTable wsList = new JTable();
protected TitledBorder wsListTitleBorder = new TitledBorder(
- "Web Service Discovery URLS");
+ MessageManager.getString("label.web_service_discovery_urls"));
protected JButton newWsUrl = new JButton();
@@ -112,7 +119,7 @@ public class GWsPreferences extends JPanel
BorderLayout myBorderlayout = new BorderLayout();
BorderLayout wsListBorderlayout = new BorderLayout();
-
+
BorderLayout srbsListBorderlayout = new BorderLayout();
GridBagLayout wsPrefLayout = new GridBagLayout();
@@ -136,7 +143,7 @@ public class GWsPreferences extends JPanel
{
refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- refreshWs.setText("Refresh Services");
+ refreshWs.setText(MessageManager.getString("action.refresh_services"));
refreshWs.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -145,7 +152,7 @@ public class GWsPreferences extends JPanel
}
});
resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- resetWs.setText("Reset Services");
+ resetWs.setText(MessageManager.getString("action.reset_services"));
resetWs.addActionListener(new ActionListener()
{
@@ -155,9 +162,9 @@ public class GWsPreferences extends JPanel
}
});
indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- indexByHost.setText("Index by host");
- indexByHost
- .setToolTipText("Index web services in menu by the host site.");
+ indexByHost.setText(MessageManager.getString("label.index_by_host"));
+ indexByHost.setToolTipText(MessageManager
+ .getString("label.index_web_services_menu_by_host_site"));
indexByHost.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -166,7 +173,7 @@ public class GWsPreferences extends JPanel
}
});
indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- indexByType.setText("Index by type");
+ indexByType.setText(MessageManager.getString("label.index_by_type"));
indexByType.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -174,19 +181,10 @@ public class GWsPreferences extends JPanel
indexByType_actionPerformed(e);
}
});
- enableEnfinServices
- .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- enableEnfinServices.setText("Enable Enfin Services");
- enableEnfinServices.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- enableEnfinServices_actionPerformed(e);
- }
- });
enableJws2Services
.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- enableJws2Services.setText("Enable JABAWS Services");
+ enableJws2Services.setText(MessageManager
+ .getString("label.enable_jabaws_services"));
enableJws2Services.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -195,9 +193,12 @@ public class GWsPreferences extends JPanel
}
});
displayWsWarning.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- displayWsWarning.setText("Display warnings");
+ displayWsWarning.setText(MessageManager
+ .getString("label.display_warnings"));
displayWsWarning
- .setToolTipText("<html>Check this option if you want to be informed<br>when a web service URL cannot be accessed by Jalview<br>when it starts up");
+ .setToolTipText("<html>"
+ + MessageManager
+ .getString("label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up"));
displayWsWarning.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -206,7 +207,7 @@ public class GWsPreferences extends JPanel
}
});
newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- newWsUrl.setText("New Service URL");
+ newWsUrl.setText(MessageManager.getString("label.new_service_url"));
newWsUrl.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -215,7 +216,7 @@ public class GWsPreferences extends JPanel
}
});
editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- editWsUrl.setText("Edit Service URL");
+ editWsUrl.setText(MessageManager.getString("label.edit_service_url"));
editWsUrl.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -225,7 +226,8 @@ public class GWsPreferences extends JPanel
});
deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- deleteWsUrl.setText("Delete Service URL");
+ deleteWsUrl.setText(MessageManager
+ .getString("label.delete_service_url"));
deleteWsUrl.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -234,8 +236,9 @@ public class GWsPreferences extends JPanel
}
});
moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- moveWsUrlUp.setText("Up");
- moveWsUrlUp.setToolTipText("Move URL up");
+ moveWsUrlUp.setText(MessageManager.getString("action.move_up"));
+ moveWsUrlUp.setToolTipText(MessageManager
+ .getString("label.move_url_up"));
moveWsUrlUp.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -244,8 +247,9 @@ public class GWsPreferences extends JPanel
}
});
moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- moveWsUrlDown.setText("Down");
- moveWsUrlDown.setToolTipText("Move URL Down");
+ moveWsUrlDown.setText(MessageManager.getString("action.move_down"));
+ moveWsUrlDown.setToolTipText(MessageManager
+ .getString("label.move_url_down"));
moveWsUrlDown.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -254,7 +258,8 @@ public class GWsPreferences extends JPanel
}
});
newSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- newSbrsUrl.setText("Add a SBRS definition");
+ newSbrsUrl.setText(MessageManager
+ .getString("label.add_sbrs_definition"));
newSbrsUrl.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -263,7 +268,8 @@ public class GWsPreferences extends JPanel
}
});
editSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- editSbrsUrl.setText("Edit SBRS definition");
+ editSbrsUrl.setText(MessageManager
+ .getString("label.edit_sbrs_definition"));
editSbrsUrl.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -273,7 +279,8 @@ public class GWsPreferences extends JPanel
});
deleteSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- deleteSbrsUrl.setText("Delete SBRS definition");
+ deleteSbrsUrl.setText(MessageManager
+ .getString("label.delete_sbrs_definition"));
deleteSbrsUrl.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -288,11 +295,12 @@ public class GWsPreferences extends JPanel
progressBar.setString("");
wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
wsListUrlPanel.setLayout(new BorderLayout());
- // wsListUrlPanel.setPreferredSize(new Dimension(482,202));
wsListPane.setBorder(BorderFactory.createEtchedBorder());
wsListPane.getViewport().add(wsList);
- // wsListPane.setPreferredSize(new Dimension(380, 80));
+ wsList.setPreferredSize(new Dimension(482, 202));
+ wsListPane.setPreferredSize(new Dimension(380, 80));
wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ wsList.setColumnSelectionAllowed(false);
wsList.addMouseListener(new MouseListener()
{
@@ -325,13 +333,11 @@ public class GWsPreferences extends JPanel
}
});
- // wsListButtons.setPreferredSize(new Dimension(480, 60));
wsListButtons.setLayout(new FlowLayout());
- // wsListButtons.add(moveWsUrlUp);
- // wsListButtons.add(moveWsUrlDown);
wsListButtons.add(newWsUrl);
wsListButtons.add(editWsUrl);
wsListButtons.add(deleteWsUrl);
+ wsListButtons.setMinimumSize(new Dimension(350, 80));
wsListNavButs.setSize(new Dimension(80, 80));
wsListNavButs.setPreferredSize(new Dimension(80, 80));
wsListNavButs.setLayout(new FlowLayout());
@@ -348,7 +354,6 @@ public class GWsPreferences extends JPanel
srbsListUrlPanel.setLayout(new BorderLayout());
srbsListPane.setBorder(BorderFactory.createEtchedBorder());
srbsListPane.getViewport().add(sbrsList);
- //srbsListPane.setMinimumSize(new Dimension(380, 80));
sbrsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
sbrsList.addMouseListener(new MouseListener()
{
@@ -396,7 +401,6 @@ public class GWsPreferences extends JPanel
wsMenuButtons.add(indexByHost);
wsMenuButtons.add(indexByType);
wsMenuButtons.add(enableJws2Services);
- wsMenuButtons.add(enableEnfinServices);
wsMenuButtons.add(displayWsWarning);
wsMenuRefreshButs.setLayout(new FlowLayout());
wsMenuRefreshButs.setPreferredSize(new Dimension(480, 30));
@@ -405,13 +409,16 @@ public class GWsPreferences extends JPanel
wsMenuRefreshButs.add(resetWs, null);
wsMenuRefreshButs.add(progressBar, null);
myBorderlayout.setHgap(3);
- if (jalview.bin.Cache.getDefault("ENABLE_RSBS_EDITOR",false)) {
- JTabbedPane listPanels=new JTabbedPane();
- listPanels.addTab("JABAWS Servers",wsListPanel);
- listPanels.addTab("RSB Services", srbsListPanel);
- add(listPanels, BorderLayout.NORTH);
- } else {
- add(wsListPanel, BorderLayout.NORTH);
+ if (jalview.bin.Cache.getDefault("ENABLE_RSBS_EDITOR", false))
+ {
+ JTabbedPane listPanels = new JTabbedPane();
+ listPanels.addTab("JABAWS Servers", wsListPanel);
+ listPanels.addTab("RSB Services", srbsListPanel);
+ add(listPanels, BorderLayout.NORTH);
+ }
+ else
+ {
+ add(wsListPanel, BorderLayout.NORTH);
}
add(wsMenuButtons, BorderLayout.CENTER);
add(wsMenuRefreshButs, BorderLayout.SOUTH);
@@ -420,25 +427,25 @@ public class GWsPreferences extends JPanel
protected void deleteSbrsUrl_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
-
+
}
protected void editSbrsUrl_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
-
+
}
protected void newSbrsUrl_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
-
+
}
protected void displayWsWarning_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
-
+
}
protected void resetWs_actionPerformed(ActionEvent e)
diff --git a/src/jalview/jbgui/PDBDocFieldPreferences.java b/src/jalview/jbgui/PDBDocFieldPreferences.java
new file mode 100644
index 0000000..8c3aab6
--- /dev/null
+++ b/src/jalview/jbgui/PDBDocFieldPreferences.java
@@ -0,0 +1,267 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.jbgui;
+
+import jalview.ws.dbsources.PDBRestClient.PDBDocField;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.table.AbstractTableModel;
+
+ at SuppressWarnings("serial")
+public class PDBDocFieldPreferences extends JScrollPane
+{
+ protected JTable tbl_pdbDocFieldConfig = new JTable();
+
+ protected JScrollPane scrl_pdbDocFieldConfig = new JScrollPane(
+ tbl_pdbDocFieldConfig);
+
+ private HashMap<String, PDBDocField> map = new HashMap<String, PDBDocField>();
+
+ private static Collection<PDBDocField> searchSummaryFields = new LinkedHashSet<PDBDocField>();
+
+ private static Collection<PDBDocField> structureSummaryFields = new LinkedHashSet<PDBDocField>();
+
+ public enum PreferenceSource
+ {
+ SEARCH_SUMMARY, STRUCTURE_CHOOSER, PREFERENCES;
+ }
+
+ private PreferenceSource currentSource;
+
+ static
+ {
+ searchSummaryFields.add(PDBDocField.PDB_ID);
+ searchSummaryFields.add(PDBDocField.TITLE);
+
+ structureSummaryFields.add(PDBDocField.PDB_ID);
+ structureSummaryFields.add(PDBDocField.TITLE);
+ }
+
+ public PDBDocFieldPreferences(PreferenceSource source)
+ {
+ tbl_pdbDocFieldConfig.setAutoCreateRowSorter(true);
+ this.getViewport().add(tbl_pdbDocFieldConfig);
+ this.currentSource = source;
+
+ String[] columnNames = null;
+ switch (source)
+ {
+ case SEARCH_SUMMARY:
+ columnNames = new String[] { "PDB Field", "Show in search summary" };
+ break;
+ case STRUCTURE_CHOOSER:
+ columnNames = new String[] { "PDB Field", "Show in structure summary" };
+ break;
+ case PREFERENCES:
+ columnNames = new String[] { "PDB Field", "Show in search summary",
+ "Show in structure summary" };
+ break;
+ default:
+ break;
+ }
+
+ Object[][] data = new Object[PDBDocField.values().length - 1][3];
+ int x = 0;
+ for (PDBDocField field : PDBDocField.values())
+ {
+ if (field.getName().equalsIgnoreCase("all"))
+ {
+ continue;
+ }
+
+ switch (source)
+ {
+ case SEARCH_SUMMARY:
+ data[x++] = new Object[] { field.getName(),
+ searchSummaryFields.contains(field) };
+ break;
+ case STRUCTURE_CHOOSER:
+ data[x++] = new Object[] { field.getName(),
+ structureSummaryFields.contains(field) };
+ break;
+ case PREFERENCES:
+ data[x++] = new Object[] { field.getName(),
+ searchSummaryFields.contains(field),
+ structureSummaryFields.contains(field) };
+ break;
+ default:
+ break;
+ }
+ map.put(field.getName(), field);
+ }
+
+ PDBFieldTableModel model = new PDBFieldTableModel(columnNames, data);
+ tbl_pdbDocFieldConfig.setModel(model);
+ }
+
+ public static Collection<PDBDocField> getSearchSummaryFields()
+ {
+ return searchSummaryFields;
+ }
+
+ public static void setSearchSummaryFields(
+ Collection<PDBDocField> searchSummaryFields)
+ {
+ PDBDocFieldPreferences.searchSummaryFields = searchSummaryFields;
+ }
+
+ public static Collection<PDBDocField> getStructureSummaryFields()
+ {
+ return structureSummaryFields;
+ }
+
+ public static void setStructureSummaryFields(
+ Collection<PDBDocField> structureSummaryFields)
+ {
+ PDBDocFieldPreferences.structureSummaryFields = structureSummaryFields;
+ }
+
+ class PDBFieldTableModel extends AbstractTableModel
+ {
+
+ public PDBFieldTableModel(String[] columnNames, Object[][] data)
+ {
+ this.data = data;
+ this.columnNames = columnNames;
+ }
+
+ private Object[][] data;
+
+ private String[] columnNames;
+
+ public int getColumnCount()
+ {
+ return columnNames.length;
+ }
+
+ public int getRowCount()
+ {
+ return data.length;
+ }
+
+ public String getColumnName(int col)
+ {
+ return columnNames[col];
+ }
+
+ public Object getValueAt(int row, int col)
+ {
+ return data[row][col];
+ }
+
+ /*
+ * JTable uses this method to determine the default renderer/ editor for
+ * each cell. If we didn't implement this method, then the last column would
+ * contain text ("true"/"false"), rather than a check box.
+ */
+ public Class getColumnClass(int c)
+ {
+ return getValueAt(0, c).getClass();
+ }
+
+ /*
+ * Don't need to implement this method unless your table's editable.
+ */
+ public boolean isCellEditable(int row, int col)
+ {
+ // Note that the data/cell address is constant,
+ // no matter where the cell appears onscreen.
+ // !isPDBID(row, col) ensures the PDB_Id cell is never editable as it
+ // serves as a unique id for each row.
+ return (col == 1 || col == 2) && !isPDBID(row, col);
+
+ }
+
+ /**
+ * Determines whether the data in a given cell is a PDB ID.
+ *
+ * @param row
+ * @param col
+ * @return
+ */
+
+ public boolean isPDBID(int row, int col)
+ {
+ boolean matched = false;
+ String name = getValueAt(row, 0).toString();
+ PDBDocField pdbField = map.get(name);
+ if (pdbField == PDBDocField.PDB_ID)
+ {
+ matched = true;
+ }
+ return matched;
+ }
+
+ /*
+ * Don't need to implement this method unless your table's data can change.
+ */
+ public void setValueAt(Object value, int row, int col)
+ {
+ data[row][col] = value;
+ fireTableCellUpdated(row, col);
+
+ String name = getValueAt(row, 0).toString();
+ boolean selected = ((Boolean) value).booleanValue();
+
+ PDBDocField pdbField = map.get(name);
+
+ if (currentSource == PreferenceSource.SEARCH_SUMMARY)
+ {
+ updatePrefs(searchSummaryFields, pdbField, selected);
+ }
+ else if (currentSource == PreferenceSource.STRUCTURE_CHOOSER)
+ {
+ updatePrefs(structureSummaryFields, pdbField, selected);
+ }
+ else if (currentSource == PreferenceSource.PREFERENCES)
+ {
+ if (col == 1)
+ {
+ updatePrefs(searchSummaryFields, pdbField, selected);
+ }
+ else if (col == 2)
+ {
+ updatePrefs(structureSummaryFields, pdbField, selected);
+ }
+ }
+ }
+
+ private void updatePrefs(Collection<PDBDocField> prefConfig,
+ PDBDocField pdbField, boolean selected)
+ {
+ if (prefConfig.contains(pdbField) && !selected)
+ {
+ prefConfig.remove(pdbField);
+ }
+
+ if (!prefConfig.contains(pdbField) && selected)
+ {
+ prefConfig.add(pdbField);
+ }
+ }
+
+ }
+}
diff --git a/src/jalview/json/binding/biojs/BioJSReleasePojo.java b/src/jalview/json/binding/biojs/BioJSReleasePojo.java
new file mode 100644
index 0000000..c60cea2
--- /dev/null
+++ b/src/jalview/json/binding/biojs/BioJSReleasePojo.java
@@ -0,0 +1,66 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.json.binding.biojs;
+
+public class BioJSReleasePojo
+{
+
+ private String url;
+
+ private String version;
+
+ private String type;
+
+ public BioJSReleasePojo()
+ {
+
+ }
+
+ public String getUrl()
+ {
+ return url;
+ }
+
+ public void setUrl(String url)
+ {
+ this.url = url;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(String version)
+ {
+ this.version = version;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+}
diff --git a/src/jalview/json/binding/biojs/BioJSRepositoryPojo.java b/src/jalview/json/binding/biojs/BioJSRepositoryPojo.java
new file mode 100644
index 0000000..cafe762
--- /dev/null
+++ b/src/jalview/json/binding/biojs/BioJSRepositoryPojo.java
@@ -0,0 +1,111 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.json.binding.biojs;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Objects;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+public class BioJSRepositoryPojo
+{
+
+ private String description;
+
+ private String latestReleaseVersion;
+
+ private Collection<BioJSReleasePojo> releases = new ArrayList<BioJSReleasePojo>();
+
+ public BioJSRepositoryPojo()
+ {
+ }
+
+ public BioJSRepositoryPojo(String jsonString)
+ {
+ try
+ {
+ parse(jsonString);
+ } catch (ParseException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void parse(String jsonString) throws ParseException
+ {
+ Objects.requireNonNull(jsonString,
+ "Supplied jsonString must not be null");
+ JSONParser jsonParser = new JSONParser();
+ JSONObject JsonObj = (JSONObject) jsonParser.parse(jsonString);
+ this.description = (String) JsonObj.get("description");
+ this.latestReleaseVersion = (String) JsonObj
+ .get("latestReleaseVersion");
+
+ JSONArray repositoriesJsonArray = (JSONArray) JsonObj.get("releases");
+ for (Iterator<JSONObject> repoIter = repositoriesJsonArray.iterator(); repoIter
+ .hasNext();)
+ {
+ JSONObject repoObj = repoIter.next();
+ BioJSReleasePojo repo = new BioJSReleasePojo();
+ repo.setType((String) repoObj.get("type"));
+ repo.setUrl((String) repoObj.get("url"));
+ repo.setVersion((String) repoObj.get("version"));
+ this.getReleases().add(repo);
+ }
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getLatestReleaseVersion()
+ {
+ return latestReleaseVersion;
+ }
+
+ public void setLatestReleaseVersion(String latestReleaseVersion)
+ {
+ this.latestReleaseVersion = latestReleaseVersion;
+ }
+
+ public Collection<BioJSReleasePojo> getReleases()
+ {
+ return releases;
+ }
+
+ public void setReleases(Collection<BioJSReleasePojo> releases)
+ {
+ this.releases = releases;
+ }
+
+}
diff --git a/src/jalview/json/binding/biojson/v1/AlignmentAnnotationPojo.java b/src/jalview/json/binding/biojson/v1/AlignmentAnnotationPojo.java
new file mode 100644
index 0000000..ab350eb
--- /dev/null
+++ b/src/jalview/json/binding/biojson/v1/AlignmentAnnotationPojo.java
@@ -0,0 +1,74 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.json.binding.biojson.v1;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.github.reinert.jjschema.Attributes;
+
+public class AlignmentAnnotationPojo
+{
+
+ @Attributes(
+ required = false,
+ description = "Label for the Alignment Annotation")
+ private String label;
+
+ @Attributes(
+ required = false,
+ description = "Description for the Alignment Annotation")
+ private String description;
+
+ @Attributes(required = false)
+ private List<AnnotationPojo> annotations = new ArrayList<AnnotationPojo>();
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public void setLabel(String label)
+ {
+ this.label = label;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String annotationId)
+ {
+ this.description = annotationId;
+ }
+
+ public List<AnnotationPojo> getAnnotations()
+ {
+ return annotations;
+ }
+
+ public void setAnnotations(List<AnnotationPojo> annotations)
+ {
+ this.annotations = annotations;
+ }
+
+}
diff --git a/src/jalview/json/binding/biojson/v1/AlignmentPojo.java b/src/jalview/json/binding/biojson/v1/AlignmentPojo.java
new file mode 100644
index 0000000..7b78313
--- /dev/null
+++ b/src/jalview/json/binding/biojson/v1/AlignmentPojo.java
@@ -0,0 +1,158 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.json.binding.biojson.v1;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.github.reinert.jjschema.Attributes;
+
+ at Attributes(
+ title = "BioJSON",
+ description = "A specification for the representation and exchange of bioinformatics data")
+public class AlignmentPojo
+{
+ @Attributes(
+ required = true,
+ description = "Serial version identifier for <b>BioJSON</b> schema")
+ private String svid = "1.0";
+
+ @Attributes(
+ required = true,
+ minItems = 1,
+ description = "An array of Sequences which makes up the Alignment")
+ private List<SequencePojo> seqs = new ArrayList<SequencePojo>();
+
+ @Attributes(
+ required = false,
+ minItems = 0,
+ exclusiveMaximum = true,
+ description = "Alignment annotations stores symbols and graphs usually rendered </br>"
+ + "below the alignment and often reflect properties of the alignment </br>as a whole.")
+ private List<AlignmentAnnotationPojo> alignAnnotation = new ArrayList<AlignmentAnnotationPojo>();
+
+ @Attributes(
+ required = false,
+ minItems = 0,
+ description = "A sequence group is a rectangular region of an alignment <br>bounded by startRes and endRes positions in the alignment <br>coordinate system for a set of sequences")
+ private List<SequenceGrpPojo> seqGroups = new ArrayList<SequenceGrpPojo>();
+
+ @Attributes(
+ required = false,
+ minItems = 0,
+ description = "Sequence features are properties of the individual sequences, <br>they do not change with the alignment, but are shown mapped<br> on to specific residues within the alignment")
+ private List<SequenceFeaturesPojo> seqFeatures = new ArrayList<SequenceFeaturesPojo>();
+
+ @Attributes(
+ required = false,
+ enums = { "None", "User Defined", "Clustal", "Zappo", "Taylor",
+ "Nucleotide", "Pyrimidine", "Purine", "Turn", "Helix", "Strand",
+ "Buried", "Hydro", "T-Coffee Scores", "RNA Interaction type",
+ "Blosum62", "RNA Helices", "% Identity" },
+ description = "The <a href=\"#colourScheme\">Colour Scheme</a> applied to the alignment")
+ private String colourScheme;
+
+ @Attributes(
+ required = true,
+ maxItems = 0,
+ description = "AppSettings stores key=value pairs of custom application specific <br>"
+ + "settings (i.e visualisation settings, etc) for different applications<br>"
+ + "that consume or generate BioJSON")
+ Map<String, Object> appSettings = new HashMap<String, Object>();
+
+ public AlignmentPojo()
+ {
+ }
+
+ public List<SequencePojo> getSeqs()
+ {
+ return seqs;
+ }
+
+ public void setSeqs(ArrayList<SequencePojo> seqs)
+ {
+ this.seqs = seqs;
+ }
+
+ public Map<String, Object> getAppSettings()
+ {
+ return appSettings;
+ }
+
+ public void setAppSettings(Map<String, Object> appSettings)
+ {
+ this.appSettings = appSettings;
+ }
+
+ public List<AlignmentAnnotationPojo> getAlignAnnotation()
+ {
+ return alignAnnotation;
+ }
+
+ public void setAlignAnnotation(
+ List<AlignmentAnnotationPojo> alignAnnotation)
+ {
+ this.alignAnnotation = alignAnnotation;
+ }
+
+ public List<SequenceGrpPojo> getSeqGroups()
+ {
+ return seqGroups;
+ }
+
+ public void setSeqGroups(List<SequenceGrpPojo> seqGroups)
+ {
+ this.seqGroups = seqGroups;
+ }
+
+ public List<SequenceFeaturesPojo> getSeqFeatures()
+ {
+ return seqFeatures;
+ }
+
+ public void setSeqFeatures(List<SequenceFeaturesPojo> seqFeatures)
+ {
+ this.seqFeatures = seqFeatures;
+ }
+
+ public String getSvid()
+ {
+ return svid;
+ }
+
+ public void setGlobalColorScheme(String globalColorScheme)
+ {
+ this.appSettings.put("globalColorScheme", globalColorScheme);
+ }
+
+ public String getColourScheme()
+ {
+ return colourScheme;
+ }
+
+ public void setColourScheme(String colourScheme)
+ {
+ this.colourScheme = colourScheme;
+ }
+
+}
diff --git a/src/jalview/json/binding/biojson/v1/AnnotationPojo.java b/src/jalview/json/binding/biojson/v1/AnnotationPojo.java
new file mode 100644
index 0000000..d1cb71c
--- /dev/null
+++ b/src/jalview/json/binding/biojson/v1/AnnotationPojo.java
@@ -0,0 +1,86 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.json.binding.biojson.v1;
+
+import com.github.reinert.jjschema.Attributes;
+
+public class AnnotationPojo
+{
+ @Attributes(
+ required = false,
+ description = "Display character for the given annotation")
+ private String displayCharacter;
+
+ @Attributes(
+ required = false,
+ description = "Description for the annotation")
+ private String description;
+
+ @Attributes(
+ required = true,
+ enums = { "E", "H", "\u0000", ")", "(" },
+ description = "Determines what is rendered for the secondary </br>structure <ul><li>’E’ - indicates Beta Sheet/Strand <li>’H’ - indicates alpha helix </li><li> ‘\\u0000’ - indicates blank</li></ul></br>For RNA Helix (only shown when working with</br> nucleotide sequences): <ul><li> ‘(’ - indicates bases pair with columns upstream</br> (to right) </li><li> ’(’ - indicate region pairs with bases to the left</li></ul>")
+ private char secondaryStructure;
+
+ @Attributes(required = false, description = "Value of the annotation")
+ private float value;
+
+ public String getDisplayCharacter()
+ {
+ return displayCharacter;
+ }
+
+ public void setDisplayCharacter(String displayCharacter)
+ {
+ this.displayCharacter = displayCharacter;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public char getSecondaryStructure()
+ {
+ return secondaryStructure;
+ }
+
+ public void setSecondaryStructure(char secondaryStructure)
+ {
+ this.secondaryStructure = secondaryStructure;
+ }
+
+ public float getValue()
+ {
+ return value;
+ }
+
+ public void setValue(float value)
+ {
+ this.value = value;
+ }
+
+}
diff --git a/src/jalview/json/binding/biojson/v1/JalviewBioJsColorSchemeMapper.java b/src/jalview/json/binding/biojson/v1/JalviewBioJsColorSchemeMapper.java
new file mode 100644
index 0000000..4d9f8ec
--- /dev/null
+++ b/src/jalview/json/binding/biojson/v1/JalviewBioJsColorSchemeMapper.java
@@ -0,0 +1,94 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.json.binding.biojson.v1;
+
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.NucleotideColourScheme;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.RNAInteractionColourScheme;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.ZappoColourScheme;
+
+public enum JalviewBioJsColorSchemeMapper
+{
+
+ USER_DEFINED("User Defined", "user defined", null), NONE("None", "foo",
+ null), CLUSTAL("Clustal", "clustal", null), ZAPPO("Zappo",
+ "zappo", new ZappoColourScheme()), TAYLOR("Taylor", "taylor",
+ new TaylorColourScheme()), NUCLEOTIDE("Nucleotide", "nucleotide",
+ new NucleotideColourScheme()), PURINE_PYRIMIDINE(
+ "Purine/Pyrimidine", "purine", new PurinePyrimidineColourScheme()), HELIX_PROPENSITY(
+ "Helix Propensity", "helix", new HelixColourScheme()), TURN_PROPENSITY(
+ "Turn Propensity", "turn", new TurnColourScheme()), STRAND_PROPENSITY(
+ "Strand Propensity", "strand", new StrandColourScheme()), BURIED_INDEX(
+ "Buried Index", "buried", new BuriedColourScheme()), HYDROPHOBIC(
+ "Hydrophobic", "hydro", new HydrophobicColourScheme()),
+
+ // The color types below are not yet supported by BioJs MSA viewer
+ T_COFFE_SCORES("T-Coffee Scores", "T-Coffee Scores", null), RNA_INT_TYPE(
+ "RNA Interaction type", "RNA Interaction type",
+ new RNAInteractionColourScheme()), BLOSUM62("Blosum62",
+ "Blosum62", new Blosum62ColourScheme()), RNA_HELICES(
+ "RNA Helices", "RNA Helices", null), PERCENTAGE_IDENTITY(
+ "% Identity", "pid", new PIDColourScheme());
+
+ private String jalviewName;
+
+ private String bioJsName;
+
+ private ColourSchemeI jvColourScheme;
+
+ private JalviewBioJsColorSchemeMapper(String jalviewName,
+ String bioJsName, ColourSchemeI jvColourScheme)
+ {
+ this.jalviewName = jalviewName;
+ this.bioJsName = bioJsName;
+ this.setJvColourScheme(jvColourScheme);
+ }
+
+ public String getJalviewName()
+ {
+ return jalviewName;
+ }
+
+ public String getBioJsName()
+ {
+ return bioJsName;
+ }
+
+ public ColourSchemeI getJvColourScheme()
+ {
+ return jvColourScheme;
+ }
+
+ public void setJvColourScheme(ColourSchemeI jvColourScheme)
+ {
+ this.jvColourScheme = jvColourScheme;
+ }
+
+}
diff --git a/src/jalview/json/binding/biojson/v1/SequenceFeaturesPojo.java b/src/jalview/json/binding/biojson/v1/SequenceFeaturesPojo.java
new file mode 100644
index 0000000..318eeac
--- /dev/null
+++ b/src/jalview/json/binding/biojson/v1/SequenceFeaturesPojo.java
@@ -0,0 +1,183 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.json.binding.biojson.v1;
+
+import java.util.Map;
+import java.util.Vector;
+
+import com.github.reinert.jjschema.Attributes;
+
+public class SequenceFeaturesPojo
+{
+ @Attributes(
+ required = true,
+ description = "Start residue position for the sequence feature")
+ private int xStart;
+
+ @Attributes(
+ required = true,
+ description = "End residue position for the sequence feature")
+ private int xEnd;
+
+ @Attributes(
+ required = true,
+ minItems = 1,
+ maxItems = 2147483647,
+ description = "Reference to the sequence in the alignment<br> (more like a foreign key)")
+ private String sequenceRef;
+
+ @Attributes(
+ required = true,
+ description = "The name or type of the SequenceFeature")
+ private String type;
+
+ @Attributes(required = false, description = "Score")
+ private Float score;
+
+ @Attributes(required = false, description = "Description for the feature")
+ private String description;
+
+ @Attributes(
+ required = false,
+ description = "Additional metadata for the feature")
+ private Map<String, Object> otherDetails;
+
+ @Attributes(required = false, description = "Fill colour")
+ private String fillColor;
+
+ @Attributes(required = true, description = "Feature group")
+ private String featureGroup;
+
+ @Attributes(
+ required = false,
+ description = "URL links associated to the feature")
+ private Vector<String> links;
+
+ public SequenceFeaturesPojo()
+ {
+ }
+
+ public SequenceFeaturesPojo(String sequenceRef)
+ {
+ this.sequenceRef = sequenceRef;
+ }
+
+ public String getFillColor()
+ {
+ return "#" + fillColor;
+ }
+
+ public void setFillColor(String fillColor)
+ {
+ this.fillColor = fillColor;
+ }
+
+ public int getXstart()
+ {
+ return xStart;
+ }
+
+ public void setXstart(int xStart)
+ {
+ this.xStart = xStart;
+ }
+
+ public int getXend()
+ {
+ return xEnd;
+ }
+
+ public void setXend(int xend)
+ {
+ this.xEnd = xend;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public Float getScore()
+ {
+ return score;
+ }
+
+ public void setScore(Float score)
+ {
+ this.score = score;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public Map<String, Object> getOtherDetails()
+ {
+ return otherDetails;
+ }
+
+ public void setOtherDetails(Map<String, Object> otherDetails)
+ {
+ this.otherDetails = otherDetails;
+ }
+
+ public Vector<String> getLinks()
+ {
+ return links;
+ }
+
+ public void setLinks(Vector<String> links)
+ {
+ this.links = links;
+ }
+
+ public String getFeatureGroup()
+ {
+ return featureGroup;
+ }
+
+ public void setFeatureGroup(String featureGroup)
+ {
+ this.featureGroup = featureGroup;
+ }
+
+ public String getSequenceRef()
+ {
+ return sequenceRef;
+ }
+
+ public void setSequenceRef(String sequenceRef)
+ {
+ this.sequenceRef = sequenceRef;
+ }
+
+}
diff --git a/src/jalview/json/binding/biojson/v1/SequenceGrpPojo.java b/src/jalview/json/binding/biojson/v1/SequenceGrpPojo.java
new file mode 100644
index 0000000..f64ec92
--- /dev/null
+++ b/src/jalview/json/binding/biojson/v1/SequenceGrpPojo.java
@@ -0,0 +1,181 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.json.binding.biojson.v1;
+
+import java.util.ArrayList;
+
+import com.github.reinert.jjschema.Attributes;
+
+public class SequenceGrpPojo
+{
+ @Attributes(
+ required = false,
+ description = "The <a href=\"#colourScheme\">Colour Scheme</a> applied to the Sequence Group")
+ private String colourScheme;
+
+ @Attributes(
+ required = true,
+ description = "The name assigned to the seqGroup")
+ private String groupName;
+
+ @Attributes(
+ required = false,
+ description = "Serial version identifier for the <b>seqGroup</b> object model")
+ private String description;
+
+ @Attributes(
+ required = false,
+ description = "Determines if the seqGroup border should be visible or not")
+ private boolean displayBoxes;
+
+ @Attributes(
+ required = false,
+ description = "Determines if the texts of the group is displayed or not")
+ private boolean displayText;
+
+ @Attributes(
+ required = false,
+ description = "Determines if the residues text for the group is coloured")
+ private boolean colourText;
+
+ @Attributes(
+ required = false,
+ description = "Boolean value indicating whether residues should only be shown <br/>that are different from current reference or consensus sequence")
+ private boolean showNonconserved;
+
+ @Attributes(
+ required = true,
+ description = "The index of the group’s first residue in the alignment space")
+ private int startRes;
+
+ @Attributes(
+ required = true,
+ description = "The index of the group’s last residue in the alignment space")
+ private int endRes;
+
+ @Attributes(
+ required = true,
+ minItems = 1,
+ uniqueItems = true,
+ description = "An array of the unique id's for the sequences belonging to the group")
+ private ArrayList<String> sequenceRefs = new ArrayList<String>();
+
+ public String getColourScheme()
+ {
+ return colourScheme;
+ }
+
+ public void setColourScheme(String colourScheme)
+ {
+ this.colourScheme = colourScheme;
+ }
+
+ public String getGroupName()
+ {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName)
+ {
+ this.groupName = groupName;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public boolean isDisplayBoxes()
+ {
+ return displayBoxes;
+ }
+
+ public void setDisplayBoxes(boolean displayBoxes)
+ {
+ this.displayBoxes = displayBoxes;
+ }
+
+ public boolean isDisplayText()
+ {
+ return displayText;
+ }
+
+ public void setDisplayText(boolean displayText)
+ {
+ this.displayText = displayText;
+ }
+
+ public boolean isColourText()
+ {
+ return colourText;
+ }
+
+ public void setColourText(boolean colourText)
+ {
+ this.colourText = colourText;
+ }
+
+ public boolean isShowNonconserved()
+ {
+ return showNonconserved;
+ }
+
+ public void setShowNonconserved(boolean showNonconserved)
+ {
+ this.showNonconserved = showNonconserved;
+ }
+
+ public int getStartRes()
+ {
+ return startRes;
+ }
+
+ public void setStartRes(int startRes)
+ {
+ this.startRes = startRes;
+ }
+
+ public int getEndRes()
+ {
+ return endRes;
+ }
+
+ public void setEndRes(int endRes)
+ {
+ this.endRes = endRes;
+ }
+
+ public ArrayList<String> getSequenceRefs()
+ {
+ return sequenceRefs;
+ }
+
+ public void setSequenceRefs(ArrayList<String> sequenceRefs)
+ {
+ this.sequenceRefs = sequenceRefs;
+ }
+
+}
diff --git a/src/jalview/json/binding/biojson/v1/SequencePojo.java b/src/jalview/json/binding/biojson/v1/SequencePojo.java
new file mode 100644
index 0000000..112a54b
--- /dev/null
+++ b/src/jalview/json/binding/biojson/v1/SequencePojo.java
@@ -0,0 +1,143 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.json.binding.biojson.v1;
+
+import com.github.reinert.jjschema.Attributes;
+
+public class SequencePojo
+{
+ @Attributes(
+ required = true,
+ minLength = 3,
+ maxLength = 2147483647,
+ description = "Sequence residue characters. An aligned sequence may contain <br>one of the following gap characters “.�?, “-�? or “ �?")
+ private String seq;
+
+ @Attributes(required = true, description = "Sequence name")
+ private String name;
+
+ @Attributes(required = false, description = "Sequence type", enums = {
+ "DNA", "RNA", "Protein" })
+ private String type;
+
+ @Attributes(
+ required = true,
+ description = "Unique identifier for a given Sequence")
+ private String id;
+
+ @Attributes(
+ required = false,
+ description = "The order/position of a sequence in the alignment space")
+ private int order;
+
+ @Attributes(
+ required = true,
+ description = "The index of the sequence’s first residue in its source database, <br>using a one-based numbering index system")
+ private int start;
+
+ @Attributes(
+ required = true,
+ description = "The index of the sequence’s last residue in its source database, <br>using a one-based numbering index system")
+ private int end;
+
+ public SequencePojo()
+ {
+ }
+
+ public SequencePojo(int start, int end, String id, String name, String seq)
+ {
+ this.id = id;
+ this.name = name;
+ this.seq = seq;
+ }
+
+ public String getSeq()
+ {
+ return seq;
+ }
+
+ public void setSeq(String seq)
+ {
+ this.seq = seq;
+ }
+
+ public String getName()
+ {
+
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public int getStart()
+ {
+ return start;
+ }
+
+ public void setStart(int start)
+ {
+ this.start = start;
+ }
+
+ public int getEnd()
+ {
+ return end;
+ }
+
+ public void setEnd(int end)
+ {
+ this.end = end;
+ }
+
+ public int getOrder()
+ {
+ return order;
+ }
+
+ public void setOrder(int order)
+ {
+ this.order = order;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+}
diff --git a/src/jalview/math/AlignmentDimension.java b/src/jalview/math/AlignmentDimension.java
new file mode 100644
index 0000000..f6198b4
--- /dev/null
+++ b/src/jalview/math/AlignmentDimension.java
@@ -0,0 +1,55 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.math;
+
+public class AlignmentDimension
+{
+ private int width;
+
+ private int height;
+
+ public AlignmentDimension(int width, int height)
+ {
+ this.width = width;
+ this.height = height;
+ }
+
+ public int getWidth()
+ {
+ return width;
+ }
+
+ public void setWidth(int width)
+ {
+ this.width = width;
+ }
+
+ public int getHeight()
+ {
+ return height;
+ }
+
+ public void setHeight(int height)
+ {
+ this.height = height;
+ }
+
+}
diff --git a/src/jalview/math/Matrix.java b/src/jalview/math/Matrix.java
index bb55ed6..189ec51 100644
--- a/src/jalview/math/Matrix.java
+++ b/src/jalview/math/Matrix.java
@@ -1,25 +1,29 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.math;
-import java.io.*;
+import jalview.util.Format;
+import jalview.util.MessageManager;
-import jalview.util.*;
+import java.io.PrintStream;
/**
* DOCUMENT ME!
@@ -47,6 +51,12 @@ public class Matrix
public double[] e; // off diagonal
/**
+ * maximum number of iterations for tqli
+ *
+ */
+ int maxIter = 45; // fudge - add 15 iterations, just in case
+
+ /**
* Creates a new Matrix object.
*
* @param value
@@ -345,7 +355,7 @@ public class Matrix
/**
* DOCUMENT ME!
*/
- public void tqli()
+ public void tqli() throws Exception
{
int n = rows;
@@ -392,10 +402,11 @@ public class Matrix
{
iter++;
- if (iter == 30)
+ if (iter == maxIter)
{
- System.err.print("Too many iterations in tqli");
- System.exit(0); // JBPNote - should this really be here ???
+ throw new Exception(MessageManager.formatMessage(
+ "exception.matrix_too_many_iteration", new String[] {
+ "tqli", Integer.valueOf(maxIter).toString() }));
}
else
{
@@ -595,7 +606,7 @@ public class Matrix
/**
* DOCUMENT ME!
*/
- public void tqli2()
+ public void tqli2() throws Exception
{
int n = rows;
@@ -642,10 +653,11 @@ public class Matrix
{
iter++;
- if (iter == 30)
+ if (iter == maxIter)
{
- System.err.print("Too many iterations in tqli");
- System.exit(0); // JBPNote - same as above - not a graceful exit!
+ throw new Exception(MessageManager.formatMessage(
+ "exception.matrix_too_many_iteration", new String[] {
+ "tqli2", Integer.valueOf(maxIter).toString() }));
}
else
{
@@ -779,7 +791,7 @@ public class Matrix
* @param args
* DOCUMENT ME!
*/
- public static void main(String[] args)
+ public static void main(String[] args) throws Exception
{
int n = Integer.parseInt(args[0]);
double[][] in = new double[n][n];
diff --git a/src/jalview/math/RotatableMatrix.java b/src/jalview/math/RotatableMatrix.java
index 1af539b..075ac0e 100644
--- a/src/jalview/math/RotatableMatrix.java
+++ b/src/jalview/math/RotatableMatrix.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.math;
diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java
new file mode 100644
index 0000000..9610a79
--- /dev/null
+++ b/src/jalview/renderer/AnnotationRenderer.java
@@ -0,0 +1,1608 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.renderer;
+
+import jalview.analysis.AAFrequency;
+import jalview.analysis.CodingUtils;
+import jalview.analysis.StructureFrequency;
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.font.LineMetrics;
+import java.awt.geom.AffineTransform;
+import java.awt.image.ImageObserver;
+import java.util.BitSet;
+import java.util.Hashtable;
+
+import com.stevesoft.pat.Regex;
+
+public class AnnotationRenderer
+{
+ private static final int UPPER_TO_LOWER = 'a' - 'A'; // 32
+
+ private static final int CHAR_A = 'A'; // 65
+
+ private static final int CHAR_Z = 'Z'; // 90
+
+ /**
+ * flag indicating if timing and redraw parameter info should be output
+ */
+ private final boolean debugRedraw;
+
+ public AnnotationRenderer()
+ {
+ this(false);
+ }
+
+ /**
+ * Create a new annotation Renderer
+ *
+ * @param debugRedraw
+ * flag indicating if timing and redraw parameter info should be
+ * output
+ */
+ public AnnotationRenderer(boolean debugRedraw)
+ {
+ this.debugRedraw = debugRedraw;
+ }
+
+ public void drawStemAnnot(Graphics g, Annotation[] row_annotations,
+ int lastSSX, int x, int y, int iconOffset, int startRes,
+ int column, boolean validRes, boolean validEnd)
+ {
+ g.setColor(STEM_COLOUR);
+ int sCol = (lastSSX / charWidth) + startRes;
+ int x1 = lastSSX;
+ int x2 = (x * charWidth);
+ Regex closeparen = new Regex("(\\))");
+
+ char dc = (column == 0 || row_annotations[column - 1] == null) ? ' '
+ : row_annotations[column - 1].secondaryStructure;
+
+ boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
+ || dc != row_annotations[sCol - 1].secondaryStructure;
+ boolean diffdownstream = !validRes || !validEnd
+ || row_annotations[column] == null
+ || dc != row_annotations[column].secondaryStructure;
+ // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
+ // If a closing base pair half of the stem, display a backward arrow
+ if (column > 0 && ResidueProperties.isCloseParenRNA(dc))
+ {
+
+ if (diffupstream)
+ // if (validRes && column>1 && row_annotations[column-2]!=null &&
+ // dc.equals(row_annotations[column-2].displayCharacter))
+ {
+ g.fillPolygon(new int[] { lastSSX + 5, lastSSX + 5, lastSSX },
+ new int[] { y + iconOffset, y + 14 + iconOffset,
+ y + 8 + iconOffset }, 3);
+ x1 += 5;
+ }
+ if (diffdownstream)
+ {
+ x2 -= 1;
+ }
+ }
+ else
+ {
+
+ // display a forward arrow
+ if (diffdownstream)
+ {
+ g.fillPolygon(new int[] { x2 - 5, x2 - 5, x2 }, new int[] {
+ y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+ x2 -= 5;
+ }
+ if (diffupstream)
+ {
+ x1 += 1;
+ }
+ }
+ // draw arrow body
+ g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
+ }
+
+ private int charWidth, endRes, charHeight;
+
+ private boolean validCharWidth, hasHiddenColumns;
+
+ private FontMetrics fm;
+
+ private final boolean MAC = jalview.util.Platform.isAMac();
+
+ boolean av_renderHistogram = true, av_renderProfile = true,
+ av_normaliseProfile = false;
+
+ ColourSchemeI profcolour = null;
+
+ private ColumnSelection columnSelection;
+
+ private Hashtable[] hconsensus;
+
+ private Hashtable[] complementConsensus;
+
+ private Hashtable[] hStrucConsensus;
+
+ private boolean av_ignoreGapsConsensus;
+
+ /**
+ * attributes set from AwtRenderPanelI
+ */
+ /**
+ * old image used when data is currently being calculated and cannot be
+ * rendered
+ */
+ private Image fadedImage;
+
+ /**
+ * panel being rendered into
+ */
+ private ImageObserver annotationPanel;
+
+ /**
+ * width of image to render in panel
+ */
+ private int imgWidth;
+
+ /**
+ * offset to beginning of visible area
+ */
+ private int sOffset;
+
+ /**
+ * offset to end of visible area
+ */
+ private int visHeight;
+
+ /**
+ * indicate if the renderer should only render the visible portion of the
+ * annotation given the current view settings
+ */
+ private boolean useClip = true;
+
+ /**
+ * master flag indicating if renderer should ever try to clip. not enabled for
+ * jalview 2.8.1
+ */
+ private boolean canClip = false;
+
+ public void drawNotCanonicalAnnot(Graphics g, Color nonCanColor,
+ Annotation[] row_annotations, int lastSSX, int x, int y,
+ int iconOffset, int startRes, int column, boolean validRes,
+ boolean validEnd)
+ {
+ // System.out.println(nonCanColor);
+
+ g.setColor(nonCanColor);
+ int sCol = (lastSSX / charWidth) + startRes;
+ int x1 = lastSSX;
+ int x2 = (x * charWidth);
+ Regex closeparen = new Regex("}|]|<|[a-z]");
+
+ String dc = (column == 0 || row_annotations[column - 1] == null) ? ""
+ : row_annotations[column - 1].displayCharacter;
+
+ boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
+ || !dc.equals(row_annotations[sCol - 1].displayCharacter);
+ boolean diffdownstream = !validRes || !validEnd
+ || row_annotations[column] == null
+ || !dc.equals(row_annotations[column].displayCharacter);
+ // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
+ // If a closing base pair half of the stem, display a backward arrow
+ if (column > 0 && closeparen.search(dc))// closeletter_b.search(dc)||closeletter_c.search(dc)||closeletter_d.search(dc)||closecrochet.search(dc))
+ // )
+ {
+
+ if (diffupstream)
+ // if (validRes && column>1 && row_annotations[column-2]!=null &&
+ // dc.equals(row_annotations[column-2].displayCharacter))
+ {
+ g.fillPolygon(new int[] { lastSSX + 5, lastSSX + 5, lastSSX },
+ new int[] { y + iconOffset, y + 14 + iconOffset,
+ y + 8 + iconOffset }, 3);
+ x1 += 5;
+ }
+ if (diffdownstream)
+ {
+ x2 -= 1;
+ }
+ }
+ else
+ {
+
+ // display a forward arrow
+ if (diffdownstream)
+ {
+ g.fillPolygon(new int[] { x2 - 5, x2 - 5, x2 }, new int[] {
+ y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+ x2 -= 5;
+ }
+ if (diffupstream)
+ {
+ x1 += 1;
+ }
+ }
+ // draw arrow body
+ g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
+ }
+
+ // public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI
+ // av)
+ public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,
+ AlignViewportI av)
+ {
+ fm = annotPanel.getFontMetrics();
+ annotationPanel = annotPanel;
+ fadedImage = annotPanel.getFadedImage();
+ imgWidth = annotPanel.getFadedImageWidth();
+ // visible area for rendering
+ int[] bounds = annotPanel.getVisibleVRange();
+ if (bounds != null)
+ {
+ sOffset = bounds[0];
+ visHeight = bounds[1];
+ if (visHeight == 0)
+ {
+ useClip = false;
+ }
+ else
+ {
+ useClip = canClip;
+ }
+ }
+ else
+ {
+ useClip = false;
+ }
+
+ updateFromAlignViewport(av);
+ }
+
+ public void updateFromAlignViewport(AlignViewportI av)
+ {
+ charWidth = av.getCharWidth();
+ endRes = av.getEndRes();
+ charHeight = av.getCharHeight();
+ hasHiddenColumns = av.hasHiddenColumns();
+ validCharWidth = av.isValidCharWidth();
+ av_renderHistogram = av.isShowConsensusHistogram();
+ av_renderProfile = av.isShowSequenceLogo();
+ av_normaliseProfile = av.isNormaliseSequenceLogo();
+ profcolour = av.getGlobalColourScheme();
+ if (profcolour == null)
+ {
+ // Set the default colour for sequence logo if the alignnent has no
+ // colourscheme set
+ profcolour = av.getAlignment().isNucleotide() ? new jalview.schemes.NucleotideColourScheme()
+ : new jalview.schemes.ZappoColourScheme();
+ }
+ columnSelection = av.getColumnSelection();
+ hconsensus = av.getSequenceConsensusHash();
+ complementConsensus = av.getComplementConsensusHash();
+ hStrucConsensus = av.getRnaStructureConsensusHash();
+ av_ignoreGapsConsensus = av.isIgnoreGapsConsensus();
+ }
+
+ /**
+ * Returns profile data; the first element is the profile type, the second is
+ * the number of distinct values, the third the total count, and the remainder
+ * depend on the profile type.
+ *
+ * @param aa
+ * @param column
+ * @return
+ */
+ public int[] getProfileFor(AlignmentAnnotation aa, int column)
+ {
+ // TODO : consider refactoring the global alignment calculation
+ // properties/rendering attributes as a global 'alignment group' which holds
+ // all vis settings for the alignment as a whole rather than a subset
+ //
+ if (aa.autoCalculated
+ && (aa.label.startsWith("Consensus") || aa.label
+ .startsWith("cDNA Consensus")))
+ {
+ boolean forComplement = aa.label.startsWith("cDNA Consensus");
+ if (aa.groupRef != null && aa.groupRef.consensusData != null
+ && aa.groupRef.isShowSequenceLogo())
+ {
+ // TODO? group consensus for cDNA complement
+ return AAFrequency.extractProfile(
+ aa.groupRef.consensusData[column],
+ aa.groupRef.getIgnoreGapsConsensus());
+ }
+ // TODO extend annotation row to enable dynamic and static profile data to
+ // be stored
+ if (aa.groupRef == null && aa.sequenceRef == null)
+ {
+ if (forComplement)
+ {
+ return AAFrequency.extractCdnaProfile(
+ complementConsensus[column], av_ignoreGapsConsensus);
+ }
+ else
+ {
+ return AAFrequency.extractProfile(hconsensus[column],
+ av_ignoreGapsConsensus);
+ }
+ }
+ }
+ else
+ {
+ if (aa.autoCalculated && aa.label.startsWith("StrucConsensus"))
+ {
+ // TODO implement group structure consensus
+ /*
+ * if (aa.groupRef != null && aa.groupRef.consensusData != null &&
+ * aa.groupRef.isShowSequenceLogo()) { //TODO check what happens for
+ * group selections return StructureFrequency.extractProfile(
+ * aa.groupRef.consensusData[column], aa.groupRef
+ * .getIgnoreGapsConsensus()); }
+ */
+ // TODO extend annotation row to enable dynamic and static profile data
+ // to
+ // be stored
+ if (aa.groupRef == null && aa.sequenceRef == null
+ && hStrucConsensus != null
+ && hStrucConsensus.length > column)
+ {
+ return StructureFrequency.extractProfile(hStrucConsensus[column],
+ av_ignoreGapsConsensus);
+ }
+ }
+ }
+ return null;
+ }
+
+ boolean rna = false;
+
+ /**
+ * Render the annotation rows associated with an alignment.
+ *
+ * @param annotPanel
+ * container frame
+ * @param av
+ * data and view settings to render
+ * @param g
+ * destination for graphics
+ * @param activeRow
+ * row where a mouse event occured (or -1)
+ * @param startRes
+ * first column that will be drawn
+ * @param endRes
+ * last column that will be drawn
+ * @return true if the fadedImage was used for any alignment annotation rows
+ * currently being calculated
+ */
+ public boolean drawComponent(AwtRenderPanelI annotPanel,
+ AlignViewportI av, Graphics g, int activeRow, int startRes,
+ int endRes)
+ {
+ long stime = System.currentTimeMillis();
+ boolean usedFaded = false;
+ // NOTES:
+ // AnnotationPanel needs to implement: ImageObserver, access to
+ // AlignViewport
+ updateFromAwtRenderPanel(annotPanel, av);
+ fm = g.getFontMetrics();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
+ int temp = 0;
+ if (aa == null)
+ {
+ return false;
+ }
+ int x = 0, y = 0;
+ int column = 0;
+ char lastSS;
+ int lastSSX;
+ int iconOffset = 0;
+ boolean validRes = false;
+ boolean validEnd = false;
+ boolean labelAllCols = false;
+ boolean centreColLabels;
+ boolean centreColLabelsDef = av.isCentreColumnLabels();
+ boolean scaleColLabel = false;
+ final AlignmentAnnotation consensusAnnot = av
+ .getAlignmentConsensusAnnotation();
+ final AlignmentAnnotation structConsensusAnnot = av
+ .getAlignmentStrucConsensusAnnotation();
+ final AlignmentAnnotation complementConsensusAnnot = av
+ .getComplementConsensusAnnotation();
+ boolean renderHistogram = true, renderProfile = true, normaliseProfile = false, isRNA = rna;
+
+ BitSet graphGroupDrawn = new BitSet();
+ int charOffset = 0; // offset for a label
+ float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
+ // column.
+ Font ofont = g.getFont();
+ // \u03B2 \u03B1
+ // debug ints
+ int yfrom = 0, f_i = 0, yto = 0, f_to = 0;
+ boolean clipst = false, clipend = false;
+ for (int i = 0; i < aa.length; i++)
+ {
+ AlignmentAnnotation row = aa[i];
+ isRNA = row.isRNA();
+ {
+ // check if this is a consensus annotation row and set the display
+ // settings appropriately
+ // TODO: generalise this to have render styles for consensus/profile
+ // data
+ if (row.groupRef != null && row == row.groupRef.getConsensus())
+ {
+ renderHistogram = row.groupRef.isShowConsensusHistogram();
+ renderProfile = row.groupRef.isShowSequenceLogo();
+ normaliseProfile = row.groupRef.isNormaliseSequenceLogo();
+ }
+ else if (row == consensusAnnot || row == structConsensusAnnot
+ || row == complementConsensusAnnot)
+ {
+ renderHistogram = av_renderHistogram;
+ renderProfile = av_renderProfile;
+ normaliseProfile = av_normaliseProfile;
+ }
+ else
+ {
+ renderHistogram = true;
+ // don't need to set render/normaliseProfile since they are not
+ // currently used in any other annotation track renderer
+ }
+ }
+ Annotation[] row_annotations = row.annotations;
+ if (!row.visible)
+ {
+ continue;
+ }
+ centreColLabels = row.centreColLabels || centreColLabelsDef;
+ labelAllCols = row.showAllColLabels;
+ scaleColLabel = row.scaleColLabel;
+ lastSS = ' ';
+ lastSSX = 0;
+
+ if (!useClip
+ || ((y - charHeight) < visHeight && (y + row.height + charHeight * 2) >= sOffset))
+ {// if_in_visible_region
+ if (!clipst)
+ {
+ clipst = true;
+ yfrom = y;
+ f_i = i;
+ }
+ yto = y;
+ f_to = i;
+ if (row.graph > 0)
+ {
+ if (row.graphGroup > -1 && graphGroupDrawn.get(row.graphGroup))
+ {
+ continue;
+ }
+
+ // this is so that we draw the characters below the graph
+ y += row.height;
+
+ if (row.hasText)
+ {
+ iconOffset = charHeight - fm.getDescent();
+ y -= charHeight;
+ }
+ }
+ else if (row.hasText)
+ {
+ iconOffset = charHeight - fm.getDescent();
+
+ }
+ else
+ {
+ iconOffset = 0;
+ }
+
+ if (row.autoCalculated && av.isCalculationInProgress(row))
+ {
+ y += charHeight;
+ usedFaded = true;
+ g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
+ - row.height, imgWidth, y, annotationPanel);
+ g.setColor(Color.black);
+ // g.drawString("Calculating "+aa[i].label+"....",20, y-row.height/2);
+
+ continue;
+ }
+
+ /*
+ * else if (annotationPanel.av.updatingConservation &&
+ * aa[i].label.equals("Conservation")) {
+ *
+ * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
+ * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
+ * annotationPanel.imgWidth, y, annotationPanel);
+ *
+ * g.setColor(Color.black); //
+ * g.drawString("Calculating Conservation.....",20, y-row.height/2);
+ *
+ * continue; } else if (annotationPanel.av.updatingConservation &&
+ * aa[i].label.equals("Quality")) {
+ *
+ * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
+ * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
+ * annotationPanel.imgWidth, y, annotationPanel);
+ * g.setColor(Color.black); // /
+ * g.drawString("Calculating Quality....",20, y-row.height/2);
+ *
+ * continue; }
+ */
+ // first pass sets up state for drawing continuation from left-hand
+ // column
+ // of startRes
+ x = (startRes == 0) ? 0 : -1;
+ while (x < endRes - startRes)
+ {
+ if (hasHiddenColumns)
+ {
+ column = columnSelection.adjustForHiddenColumns(startRes + x);
+ if (column > row_annotations.length - 1)
+ {
+ break;
+ }
+ }
+ else
+ {
+ column = startRes + x;
+ }
+
+ if ((row_annotations == null)
+ || (row_annotations.length <= column)
+ || (row_annotations[column] == null))
+ {
+ validRes = false;
+ }
+ else
+ {
+ validRes = true;
+ }
+ final String displayChar = validRes ? row_annotations[column].displayCharacter
+ : null;
+ if (x > -1)
+ {
+ if (activeRow == i)
+ {
+ g.setColor(Color.red);
+
+ if (columnSelection != null)
+ {
+ for (int n = 0; n < columnSelection.size(); n++)
+ {
+ int v = columnSelection.columnAt(n);
+
+ if (v == column)
+ {
+ g.fillRect(x * charWidth, y, charWidth, charHeight);
+ }
+ }
+ }
+ }
+ if (row.getInvalidStrucPos() > x)
+ {
+ g.setColor(Color.orange);
+ g.fillRect(x * charWidth, y, charWidth, charHeight);
+ }
+ else if (row.getInvalidStrucPos() == x)
+ {
+ g.setColor(Color.orange.darker());
+ g.fillRect(x * charWidth, y, charWidth, charHeight);
+ }
+ if (validCharWidth && validRes && displayChar != null
+ && (displayChar.length() > 0))
+ {
+
+ fmWidth = fm.charsWidth(displayChar.toCharArray(), 0,
+ displayChar.length());
+ if (/* centreColLabels || */scaleColLabel)
+ {
+ // fmWidth = fm.charsWidth(displayChar.toCharArray(), 0,
+ // displayChar.length());
+ //
+ // if (scaleColLabel)
+ // {
+ // justify the label and scale to fit in column
+ if (fmWidth > charWidth)
+ {
+ // scale only if the current font isn't already small enough
+ fmScaling = charWidth;
+ fmScaling /= fmWidth;
+ g.setFont(ofont.deriveFont(AffineTransform
+ .getScaleInstance(fmScaling, 1.0)));
+ // and update the label's width to reflect the scaling.
+ fmWidth = charWidth;
+ }
+ // }
+ }
+ // TODO is it ok to use width of / show all characters here?
+ // else
+ // {
+ // fmWidth = fm.charWidth(displayChar.charAt(0));
+ // }
+ charOffset = (int) ((charWidth - fmWidth) / 2f);
+
+ if (row_annotations[column].colour == null)
+ {
+ g.setColor(Color.black);
+ }
+ else
+ {
+ g.setColor(row_annotations[column].colour);
+ }
+
+ if (column == 0 || row.graph > 0)
+ {
+ g.drawString(displayChar, (x * charWidth) + charOffset, y
+ + iconOffset);
+ }
+ else if (row_annotations[column - 1] == null
+ || (labelAllCols
+ || !displayChar
+ .equals(row_annotations[column - 1].displayCharacter) || (displayChar
+ .length() < 2 && row_annotations[column].secondaryStructure == ' ')))
+ {
+ g.drawString(displayChar, x * charWidth + charOffset, y
+ + iconOffset);
+ }
+ g.setFont(ofont);
+ }
+ }
+ if (row.hasIcons)
+ {
+ char ss = validRes ? row_annotations[column].secondaryStructure
+ : '-';
+
+ if (ss == '(')
+ {
+ // distinguish between forward/backward base-pairing
+ if (displayChar.indexOf(')') > -1)
+ {
+
+ ss = ')';
+
+ }
+ }
+ if (ss == '[')
+ {
+ if ((displayChar.indexOf(']') > -1))
+ {
+ ss = ']';
+
+ }
+ }
+ if (ss == '{')
+ {
+ // distinguish between forward/backward base-pairing
+ if (displayChar.indexOf('}') > -1)
+ {
+ ss = '}';
+
+ }
+ }
+ if (ss == '<')
+ {
+ // distinguish between forward/backward base-pairing
+ if (displayChar.indexOf('<') > -1)
+ {
+ ss = '>';
+
+ }
+ }
+ if (isRNA && (ss >= CHAR_A) && (ss <= CHAR_Z))
+ {
+ // distinguish between forward/backward base-pairing
+ int ssLowerCase = ss + UPPER_TO_LOWER;
+ // TODO would .equals() be safer here? or charAt(0)?
+ if (displayChar.indexOf(ssLowerCase) > -1)
+ {
+ ss = (char) ssLowerCase;
+ }
+ }
+
+ if (!validRes || (ss != lastSS))
+ {
+
+ if (x > -1)
+ {
+
+ int nb_annot = x - temp;
+ // System.out.println("\t type :"+lastSS+"\t x :"+x+"\t nbre annot :"+nb_annot);
+ switch (lastSS)
+ {
+ case '(': // Stem case for RNA secondary structure
+ case ')': // and opposite direction
+ drawStemAnnot(g, row_annotations, lastSSX, x, y,
+ iconOffset, startRes, column, validRes, validEnd);
+ temp = x;
+ break;
+
+ case 'H':
+ if (!isRNA)
+ {
+ drawHelixAnnot(g, row_annotations, lastSSX, x, y,
+ iconOffset, startRes, column, validRes,
+ validEnd);
+ break;
+ }
+
+ case 'E':
+ if (!isRNA)
+ {
+ drawSheetAnnot(g, row_annotations, lastSSX, x, y,
+ iconOffset, startRes, column, validRes,
+ validEnd);
+ break;
+ }
+
+ case '{':
+ case '}':
+ case '[':
+ case ']':
+ case '>':
+ case '<':
+ case 'A':
+ case 'a':
+ case 'B':
+ case 'b':
+ case 'C':
+ case 'c':
+ case 'D':
+ case 'd':
+ case 'e':
+ case 'F':
+ case 'f':
+ case 'G':
+ case 'g':
+ case 'h':
+ case 'I':
+ case 'i':
+ case 'J':
+ case 'j':
+ case 'K':
+ case 'k':
+ case 'L':
+ case 'l':
+ case 'M':
+ case 'm':
+ case 'N':
+ case 'n':
+ case 'O':
+ case 'o':
+ case 'P':
+ case 'p':
+ case 'Q':
+ case 'q':
+ case 'R':
+ case 'r':
+ case 'S':
+ case 's':
+ case 'T':
+ case 't':
+ case 'U':
+ case 'u':
+ case 'V':
+ case 'v':
+ case 'W':
+ case 'w':
+ case 'X':
+ case 'x':
+ case 'Y':
+ case 'y':
+ case 'Z':
+ case 'z':
+
+ Color nonCanColor = getNotCanonicalColor(lastSS);
+ drawNotCanonicalAnnot(g, nonCanColor, row_annotations,
+ lastSSX, x, y, iconOffset, startRes, column,
+ validRes, validEnd);
+ temp = x;
+ break;
+ default:
+ g.setColor(Color.gray);
+ g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth)
+ - lastSSX, 2);
+ temp = x;
+ break;
+ }
+ }
+ if (validRes)
+ {
+ lastSS = ss;
+ }
+ else
+ {
+ lastSS = ' ';
+ }
+ if (x > -1)
+ {
+ lastSSX = (x * charWidth);
+ }
+ }
+ }
+ column++;
+ x++;
+ }
+ if (column >= row_annotations.length)
+ {
+ column = row_annotations.length - 1;
+ validEnd = false;
+ }
+ else
+ {
+ validEnd = true;
+ }
+ if ((row_annotations == null) || (row_annotations.length <= column)
+ || (row_annotations[column] == null))
+ {
+ validRes = false;
+ }
+ else
+ {
+ validRes = true;
+ }
+
+ // x ++;
+
+ if (row.hasIcons)
+ {
+ switch (lastSS)
+ {
+
+ case 'H':
+ if (!isRNA)
+ {
+ drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
+ startRes, column, validRes, validEnd);
+ break;
+ }
+
+ case 'E':
+ if (!isRNA)
+ {
+ drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
+ startRes, column, validRes, validEnd);
+ break;
+ }
+
+ case '(':
+ case ')': // Stem case for RNA secondary structure
+
+ drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
+ startRes, column, validRes, validEnd);
+
+ break;
+ case '{':
+ case '}':
+ case '[':
+ case ']':
+ case '>':
+ case '<':
+ case 'A':
+ case 'a':
+ case 'B':
+ case 'b':
+ case 'C':
+ case 'c':
+ case 'D':
+ case 'd':
+ case 'e':
+ case 'F':
+ case 'f':
+ case 'G':
+ case 'g':
+ case 'h':
+ case 'I':
+ case 'i':
+ case 'J':
+ case 'j':
+ case 'K':
+ case 'k':
+ case 'L':
+ case 'l':
+ case 'M':
+ case 'm':
+ case 'N':
+ case 'n':
+ case 'O':
+ case 'o':
+ case 'P':
+ case 'p':
+ case 'Q':
+ case 'q':
+ case 'R':
+ case 'r':
+ case 'T':
+ case 't':
+ case 'U':
+ case 'u':
+ case 'V':
+ case 'v':
+ case 'W':
+ case 'w':
+ case 'X':
+ case 'x':
+ case 'Y':
+ case 'y':
+ case 'Z':
+ case 'z':
+ // System.out.println(lastSS);
+ Color nonCanColor = getNotCanonicalColor(lastSS);
+ drawNotCanonicalAnnot(g, nonCanColor, row_annotations, lastSSX,
+ x, y, iconOffset, startRes, column, validRes, validEnd);
+ break;
+ default:
+ drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset,
+ startRes, column, validRes, validEnd);
+ break;
+ }
+ }
+
+ if (row.graph > 0 && row.graphHeight > 0)
+ {
+ if (row.graph == AlignmentAnnotation.LINE_GRAPH)
+ {
+ if (row.graphGroup > -1 && !graphGroupDrawn.get(row.graphGroup))
+ {
+ // TODO: JAL-1291 revise rendering model so the graphGroup map is
+ // computed efficiently for all visible labels
+ float groupmax = -999999, groupmin = 9999999;
+ for (int gg = 0; gg < aa.length; gg++)
+ {
+ if (aa[gg].graphGroup != row.graphGroup)
+ {
+ continue;
+ }
+
+ if (aa[gg] != row)
+ {
+ aa[gg].visible = false;
+ }
+ if (aa[gg].graphMax > groupmax)
+ {
+ groupmax = aa[gg].graphMax;
+ }
+ if (aa[gg].graphMin < groupmin)
+ {
+ groupmin = aa[gg].graphMin;
+ }
+ }
+
+ for (int gg = 0; gg < aa.length; gg++)
+ {
+ if (aa[gg].graphGroup == row.graphGroup)
+ {
+ drawLineGraph(g, aa[gg], aa[gg].annotations, startRes,
+ endRes, y, groupmin, groupmax, row.graphHeight);
+ }
+ }
+
+ graphGroupDrawn.set(row.graphGroup);
+ }
+ else
+ {
+ drawLineGraph(g, row, row_annotations, startRes, endRes, y,
+ row.graphMin, row.graphMax, row.graphHeight);
+ }
+ }
+ else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
+ {
+ drawBarGraph(g, row, row_annotations, startRes, endRes,
+ row.graphMin, row.graphMax, y, renderHistogram,
+ renderProfile, normaliseProfile);
+ }
+ }
+ }
+ else
+ {
+ if (clipst && !clipend)
+ {
+ clipend = true;
+ }
+ }// end if_in_visible_region
+ if (row.graph > 0 && row.hasText)
+ {
+ y += charHeight;
+ }
+
+ if (row.graph == 0)
+ {
+ y += aa[i].height;
+ }
+ }
+ if (debugRedraw)
+ {
+ if (canClip)
+ {
+ if (clipst)
+ {
+ System.err.println("Start clip at : " + yfrom + " (index " + f_i
+ + ")");
+ }
+ if (clipend)
+ {
+ System.err.println("End clip at : " + yto + " (index " + f_to
+ + ")");
+ }
+ }
+ ;
+ System.err.println("Annotation Rendering time:"
+ + (System.currentTimeMillis() - stime));
+ }
+ ;
+
+ return !usedFaded;
+ }
+
+ public static final Color GLYPHLINE_COLOR = Color.gray;
+
+ public static final Color SHEET_COLOUR = Color.green;
+
+ public static final Color HELIX_COLOUR = Color.red;
+
+ public static final Color STEM_COLOUR = Color.blue;
+
+ private Color sdNOTCANONICAL_COLOUR;
+
+ public void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX,
+ int x, int y, int iconOffset, int startRes, int column,
+ boolean validRes, boolean validEnd)
+ {
+ g.setColor(GLYPHLINE_COLOR);
+ g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2);
+ }
+
+ public void drawSheetAnnot(Graphics g, Annotation[] row,
+
+ int lastSSX, int x, int y, int iconOffset, int startRes, int column,
+ boolean validRes, boolean validEnd)
+ {
+ g.setColor(SHEET_COLOUR);
+
+ if (!validEnd || !validRes || row == null || row[column] == null
+ || row[column].secondaryStructure != 'E')
+ {
+ g.fillRect(lastSSX, y + 4 + iconOffset,
+ (x * charWidth) - lastSSX - 4, 7);
+ g.fillPolygon(new int[] { (x * charWidth) - 4, (x * charWidth) - 4,
+ (x * charWidth) }, new int[] { y + iconOffset,
+ y + 14 + iconOffset, y + 7 + iconOffset }, 3);
+ }
+ else
+ {
+ g.fillRect(lastSSX, y + 4 + iconOffset,
+ (x + 1) * charWidth - lastSSX, 7);
+ }
+
+ }
+
+ public void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX,
+ int x, int y, int iconOffset, int startRes, int column,
+ boolean validRes, boolean validEnd)
+ {
+ g.setColor(HELIX_COLOUR);
+
+ int sCol = (lastSSX / charWidth) + startRes;
+ int x1 = lastSSX;
+ int x2 = (x * charWidth);
+
+ if (MAC)
+ {
+ int ofs = charWidth / 2;
+ // Off by 1 offset when drawing rects and ovals
+ // to offscreen image on the MAC
+ g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1, 8, 8, 8);
+ if (sCol == 0 || row[sCol - 1] == null
+ || row[sCol - 1].secondaryStructure != 'H')
+ {
+ }
+ else
+ {
+ // g.setColor(Color.orange);
+ g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1 - ofs + 1, 8,
+ 0, 0);
+ }
+ if (!validRes || row[column] == null
+ || row[column].secondaryStructure != 'H')
+ {
+
+ }
+ else
+ {
+ // g.setColor(Color.magenta);
+ g.fillRoundRect(lastSSX + ofs, y + 4 + iconOffset, x2 - x1 - ofs
+ + 1, 8, 0, 0);
+
+ }
+
+ return;
+ }
+
+ if (sCol == 0 || row[sCol - 1] == null
+ || row[sCol - 1].secondaryStructure != 'H')
+ {
+ g.fillArc(lastSSX, y + 4 + iconOffset, charWidth, 8, 90, 180);
+ x1 += charWidth / 2;
+ }
+
+ if (!validRes || row[column] == null
+ || row[column].secondaryStructure != 'H')
+ {
+ g.fillArc((x * charWidth) - charWidth, y + 4 + iconOffset, charWidth,
+ 8, 270, 180);
+ x2 -= charWidth / 2;
+ }
+
+ g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
+ }
+
+ public void drawLineGraph(Graphics g, AlignmentAnnotation _aa,
+ Annotation[] aa_annotations, int sRes, int eRes, int y,
+ float min, float max, int graphHeight)
+ {
+ if (sRes > aa_annotations.length)
+ {
+ return;
+ }
+
+ int x = 0;
+
+ // Adjustment for fastpaint to left
+ if (eRes < endRes)
+ {
+ eRes++;
+ }
+
+ eRes = Math.min(eRes, aa_annotations.length);
+
+ if (sRes == 0)
+ {
+ x++;
+ }
+
+ int y1 = y, y2 = y;
+ float range = max - min;
+
+ // //Draw origin
+ if (min < 0)
+ {
+ y2 = y - (int) ((0 - min / range) * graphHeight);
+ }
+
+ g.setColor(Color.gray);
+ g.drawLine(x - charWidth, y2, (eRes - sRes + 1) * charWidth, y2);
+
+ eRes = Math.min(eRes, aa_annotations.length);
+
+ int column;
+ int aaMax = aa_annotations.length - 1;
+
+ while (x < eRes - sRes)
+ {
+ column = sRes + x;
+ if (hasHiddenColumns)
+ {
+ column = columnSelection.adjustForHiddenColumns(column);
+ }
+
+ if (column > aaMax)
+ {
+ break;
+ }
+
+ if (aa_annotations[column] == null
+ || aa_annotations[column - 1] == null)
+ {
+ x++;
+ continue;
+ }
+
+ if (aa_annotations[column].colour == null)
+ {
+ g.setColor(Color.black);
+ }
+ else
+ {
+ g.setColor(aa_annotations[column].colour);
+ }
+
+ y1 = y
+ - (int) (((aa_annotations[column - 1].value - min) / range) * graphHeight);
+ y2 = y
+ - (int) (((aa_annotations[column].value - min) / range) * graphHeight);
+
+ g.drawLine(x * charWidth - charWidth / 2, y1, x * charWidth
+ + charWidth / 2, y2);
+ x++;
+ }
+
+ if (_aa.threshold != null)
+ {
+ g.setColor(_aa.threshold.colour);
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
+ BasicStroke.JOIN_ROUND, 3f, new float[] { 5f, 3f }, 0f));
+
+ y2 = (int) (y - ((_aa.threshold.value - min) / range) * graphHeight);
+ g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
+ g2.setStroke(new BasicStroke());
+ }
+ }
+
+ public void drawBarGraph(Graphics g, AlignmentAnnotation _aa,
+ Annotation[] aa_annotations, int sRes, int eRes, float min,
+ float max, int y, boolean renderHistogram, boolean renderProfile,
+ boolean normaliseProfile)
+ {
+ if (sRes > aa_annotations.length)
+ {
+ return;
+ }
+ Font ofont = g.getFont();
+ eRes = Math.min(eRes, aa_annotations.length);
+
+ int x = 0, y1 = y, y2 = y;
+
+ float range = max - min;
+
+ if (min < 0)
+ {
+ y2 = y - (int) ((0 - min / (range)) * _aa.graphHeight);
+ }
+
+ g.setColor(Color.gray);
+
+ g.drawLine(x, y2, (eRes - sRes) * charWidth, y2);
+
+ int column;
+ int aaMax = aa_annotations.length - 1;
+ while (x < eRes - sRes)
+ {
+ column = sRes + x;
+ if (hasHiddenColumns)
+ {
+ column = columnSelection.adjustForHiddenColumns(column);
+ }
+
+ if (column > aaMax)
+ {
+ break;
+ }
+
+ if (aa_annotations[column] == null)
+ {
+ x++;
+ continue;
+ }
+ if (aa_annotations[column].colour == null)
+ {
+ g.setColor(Color.black);
+ }
+ else
+ {
+ g.setColor(aa_annotations[column].colour);
+ }
+
+ y1 = y
+ - (int) (((aa_annotations[column].value - min) / (range)) * _aa.graphHeight);
+
+ if (renderHistogram)
+ {
+ if (y1 - y2 > 0)
+ {
+ g.fillRect(x * charWidth, y2, charWidth, y1 - y2);
+ }
+ else
+ {
+ g.fillRect(x * charWidth, y1, charWidth, y2 - y1);
+ }
+ }
+ // draw profile if available
+ if (renderProfile)
+ {
+
+ /*
+ * {profile type, #values, total count, char1, pct1, char2, pct2...}
+ */
+ int profl[] = getProfileFor(_aa, column);
+
+ // just try to draw the logo if profl is not null
+ if (profl != null && profl[2] != 0)
+ {
+ boolean isStructureProfile = profl[0] == AlignmentAnnotation.STRUCTURE_PROFILE;
+ boolean isCdnaProfile = profl[0] == AlignmentAnnotation.CDNA_PROFILE;
+ float ht = normaliseProfile ? y - _aa.graphHeight : y1;
+ double htn = normaliseProfile ? _aa.graphHeight : (y2 - y1);// aa.graphHeight;
+ double hght;
+ float wdth;
+ double ht2 = 0;
+ char[] dc;
+
+ /**
+ * Render a single base for a sequence profile, a base pair for
+ * structure profile, and a triplet for a cdna profile
+ */
+ dc = new char[isStructureProfile ? 2 : (isCdnaProfile ? 3 : 1)];
+
+ LineMetrics lm = g.getFontMetrics(ofont).getLineMetrics("Q", g);
+ double scale = 1f / (normaliseProfile ? profl[2] : 100f);
+ float ofontHeight = 1f / lm.getAscent();// magnify to fill box
+ double scl = 0.0;
+
+ /*
+ * Traverse the character(s)/percentage data in the array
+ */
+ int c = 3;
+ int valuesProcessed = 0;
+ // profl[1] is the number of values in the profile
+ while (valuesProcessed < profl[1])
+ {
+ if (isStructureProfile)
+ {
+ // todo can we encode a structure pair as an int, like codons?
+ dc[0] = (char) profl[c++];
+ dc[1] = (char) profl[c++];
+ }
+ else if (isCdnaProfile)
+ {
+ dc = CodingUtils.decodeCodon(profl[c++]);
+ }
+ else
+ {
+ dc[0] = (char) profl[c++];
+ }
+
+ wdth = charWidth;
+ wdth /= fm.charsWidth(dc, 0, dc.length);
+
+ ht += scl;
+ // next profl[] position is profile % for the character(s)
+ scl = htn * scale * profl[c++];
+ lm = ofont.getLineMetrics(dc, 0, 1, g.getFontMetrics()
+ .getFontRenderContext());
+ g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
+ wdth, scl / lm.getAscent())));
+ lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
+
+ // Debug - render boxes around characters
+ // g.setColor(Color.red);
+ // g.drawRect(x*av.charWidth, (int)ht, av.charWidth,
+ // (int)(scl));
+ // g.setColor(profcolour.findColour(dc[0]).darker());
+
+ /*
+ * Set character colour as per alignment colour scheme; use the
+ * codon translation if a cDNA profile
+ */
+ Color colour = null;
+ if (isCdnaProfile)
+ {
+ final String codonTranslation = ResidueProperties
+ .codonTranslate(new String(dc));
+ colour = profcolour.findColour(codonTranslation.charAt(0),
+ column, null);
+ }
+ else
+ {
+ colour = profcolour.findColour(dc[0], column, null);
+ }
+ g.setColor(colour == Color.white ? Color.lightGray : colour);
+
+ hght = (ht + (scl - lm.getDescent() - lm.getBaselineOffsets()[lm
+ .getBaselineIndex()]));
+
+ g.drawChars(dc, 0, dc.length, x * charWidth, (int) hght);
+ valuesProcessed++;
+ }
+ g.setFont(ofont);
+ }
+ }
+ x++;
+ }
+ if (_aa.threshold != null)
+ {
+ g.setColor(_aa.threshold.colour);
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
+ BasicStroke.JOIN_ROUND, 3f, new float[] { 5f, 3f }, 0f));
+
+ y2 = (int) (y - ((_aa.threshold.value - min) / range)
+ * _aa.graphHeight);
+ g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
+ g2.setStroke(new BasicStroke());
+ }
+ }
+
+ // used by overview window
+ public void drawGraph(Graphics g, AlignmentAnnotation _aa,
+ Annotation[] aa_annotations, int width, int y, int sRes, int eRes)
+ {
+ eRes = Math.min(eRes, aa_annotations.length);
+ g.setColor(Color.white);
+ g.fillRect(0, 0, width, y);
+ g.setColor(new Color(0, 0, 180));
+
+ int x = 0, height;
+
+ for (int j = sRes; j < eRes; j++)
+ {
+ if (aa_annotations[j] != null)
+ {
+ if (aa_annotations[j].colour == null)
+ {
+ g.setColor(Color.black);
+ }
+ else
+ {
+ g.setColor(aa_annotations[j].colour);
+ }
+
+ height = (int) ((aa_annotations[j].value / _aa.graphMax) * y);
+ if (height > y)
+ {
+ height = y;
+ }
+
+ g.fillRect(x, y - height, charWidth, height);
+ }
+ x += charWidth;
+ }
+ }
+
+ Color getNotCanonicalColor(char lastss)
+ {
+ switch (lastss)
+ {
+ case '{':
+ case '}':
+ return new Color(255, 125, 5);
+
+ case '[':
+ case ']':
+ return new Color(245, 115, 10);
+
+ case '>':
+ case '<':
+ return new Color(235, 135, 15);
+
+ case 'A':
+ case 'a':
+ return new Color(225, 105, 20);
+
+ case 'B':
+ case 'b':
+ return new Color(215, 145, 30);
+
+ case 'C':
+ case 'c':
+ return new Color(205, 95, 35);
+
+ case 'D':
+ case 'd':
+ return new Color(195, 155, 45);
+
+ case 'E':
+ case 'e':
+ return new Color(185, 85, 55);
+
+ case 'F':
+ case 'f':
+ return new Color(175, 165, 65);
+
+ case 'G':
+ case 'g':
+ return new Color(170, 75, 75);
+
+ case 'H':
+ case 'h':
+ return new Color(160, 175, 85);
+
+ case 'I':
+ case 'i':
+ return new Color(150, 65, 95);
+
+ case 'J':
+ case 'j':
+ return new Color(140, 185, 105);
+
+ case 'K':
+ case 'k':
+ return new Color(130, 55, 110);
+
+ case 'L':
+ case 'l':
+ return new Color(120, 195, 120);
+
+ case 'M':
+ case 'm':
+ return new Color(110, 45, 130);
+
+ case 'N':
+ case 'n':
+ return new Color(100, 205, 140);
+
+ case 'O':
+ case 'o':
+ return new Color(90, 35, 150);
+
+ case 'P':
+ case 'p':
+ return new Color(85, 215, 160);
+
+ case 'Q':
+ case 'q':
+ return new Color(75, 25, 170);
+
+ case 'R':
+ case 'r':
+ return new Color(65, 225, 180);
+
+ case 'S':
+ case 's':
+ return new Color(55, 15, 185);
+
+ case 'T':
+ case 't':
+ return new Color(45, 235, 195);
+
+ case 'U':
+ case 'u':
+ return new Color(35, 5, 205);
+
+ case 'V':
+ case 'v':
+ return new Color(25, 245, 215);
+
+ case 'W':
+ case 'w':
+ return new Color(15, 0, 225);
+
+ case 'X':
+ case 'x':
+ return new Color(10, 255, 235);
+
+ case 'Y':
+ case 'y':
+ return new Color(5, 150, 245);
+
+ case 'Z':
+ case 'z':
+ return new Color(0, 80, 255);
+
+ default:
+ System.out.println("This is not a interaction : " + lastss);
+ return null;
+
+ }
+ }
+}
diff --git a/src/jalview/renderer/AwtRenderPanelI.java b/src/jalview/renderer/AwtRenderPanelI.java
new file mode 100644
index 0000000..dd18bd6
--- /dev/null
+++ b/src/jalview/renderer/AwtRenderPanelI.java
@@ -0,0 +1,62 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.renderer;
+
+import java.awt.FontMetrics;
+import java.awt.Image;
+import java.awt.image.ImageObserver;
+
+/**
+ * semi-insulated interface for rendering a faded image whilst a calculation is
+ * in progress on annotation panel. Will need to remove java.awt dependencies
+ * for Android/etc
+ *
+ * @author jprocter
+ *
+ */
+public interface AwtRenderPanelI extends ImageObserver
+{
+ /**
+ * old image used when data is currently being calculated and cannot be
+ * rendered
+ */
+ Image getFadedImage();
+
+ /**
+ * FontMetrics to use for rendering into Panel
+ *
+ * @return
+ */
+ FontMetrics getFontMetrics();
+
+ /**
+ * width of image to render in panel
+ */
+ int getFadedImageWidth();
+
+ /**
+ * height of visible area on to the image - used to draw only what is visible.
+ *
+ * @return [start, end of visible region]
+ */
+ int[] getVisibleVRange();
+
+}
diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java
new file mode 100644
index 0000000..d05d158
--- /dev/null
+++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java
@@ -0,0 +1,423 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.renderer.seqfeatures;
+
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+public class FeatureRenderer extends
+ jalview.viewmodel.seqfeatures.FeatureRendererModel
+{
+
+ FontMetrics fm;
+
+ int charOffset;
+
+ boolean offscreenRender = false;
+
+ protected SequenceI lastSeq;
+
+ char s;
+
+ int i;
+
+ int av_charHeight, av_charWidth;
+
+ boolean av_validCharWidth, av_isShowSeqFeatureHeight;
+
+ protected void updateAvConfig()
+ {
+ av_charHeight = av.getCharHeight();
+ av_charWidth = av.getCharWidth();
+ av_validCharWidth = av.isValidCharWidth();
+ av_isShowSeqFeatureHeight = av.isShowSequenceFeaturesHeight();
+ }
+
+ void renderFeature(Graphics g, SequenceI seq, int fstart, int fend,
+ Color featureColour, int start, int end, int y1)
+ {
+ updateAvConfig();
+ if (((fstart <= end) && (fend >= start)))
+ {
+ if (fstart < start)
+ { // fix for if the feature we have starts before the sequence start,
+ fstart = start; // but the feature end is still valid!!
+ }
+
+ if (fend >= end)
+ {
+ fend = end;
+ }
+ int pady = (y1 + av_charHeight) - av_charHeight / 5;
+ for (i = fstart; i <= fend; i++)
+ {
+ s = seq.getCharAt(i);
+
+ if (jalview.util.Comparison.isGap(s))
+ {
+ continue;
+ }
+
+ g.setColor(featureColour);
+
+ g.fillRect((i - start) * av_charWidth, y1, av_charWidth,
+ av_charHeight);
+
+ if (offscreenRender || !av_validCharWidth)
+ {
+ continue;
+ }
+
+ g.setColor(Color.white);
+ charOffset = (av_charWidth - fm.charWidth(s)) / 2;
+ g.drawString(String.valueOf(s), charOffset
+ + (av_charWidth * (i - start)), pady);
+
+ }
+ }
+ }
+
+ void renderScoreFeature(Graphics g, SequenceI seq, int fstart, int fend,
+ Color featureColour, int start, int end, int y1, byte[] bs)
+ {
+ updateAvConfig();
+ if (((fstart <= end) && (fend >= start)))
+ {
+ if (fstart < start)
+ { // fix for if the feature we have starts before the sequence start,
+ fstart = start; // but the feature end is still valid!!
+ }
+
+ if (fend >= end)
+ {
+ fend = end;
+ }
+ int pady = (y1 + av_charHeight) - av_charHeight / 5;
+ int ystrt = 0, yend = av_charHeight;
+ if (bs[0] != 0)
+ {
+ // signed - zero is always middle of residue line.
+ if (bs[1] < 128)
+ {
+ yend = av_charHeight * (128 - bs[1]) / 512;
+ ystrt = av_charHeight - yend / 2;
+ }
+ else
+ {
+ ystrt = av_charHeight / 2;
+ yend = av_charHeight * (bs[1] - 128) / 512;
+ }
+ }
+ else
+ {
+ yend = av_charHeight * bs[1] / 255;
+ ystrt = av_charHeight - yend;
+
+ }
+ for (i = fstart; i <= fend; i++)
+ {
+ s = seq.getCharAt(i);
+
+ if (jalview.util.Comparison.isGap(s))
+ {
+ continue;
+ }
+
+ g.setColor(featureColour);
+ int x = (i - start) * av_charWidth;
+ g.drawRect(x, y1, av_charWidth, av_charHeight);
+ g.fillRect(x, y1 + ystrt, av_charWidth, yend);
+
+ if (offscreenRender || !av_validCharWidth)
+ {
+ continue;
+ }
+
+ g.setColor(Color.black);
+ charOffset = (av_charWidth - fm.charWidth(s)) / 2;
+ g.drawString(String.valueOf(s), charOffset
+ + (av_charWidth * (i - start)), pady);
+ }
+ }
+ }
+
+ BufferedImage offscreenImage;
+
+ public Color findFeatureColour(Color initialCol, SequenceI seq, int res)
+ {
+ return new Color(findFeatureColour(initialCol.getRGB(), seq, res));
+ }
+
+ /**
+ * This is used by the Molecule Viewer and Overview to get the accurate
+ * colourof the rendered sequence
+ */
+ public synchronized int findFeatureColour(int initialCol,
+ final SequenceI seq, int column)
+ {
+ if (!av.isShowSequenceFeatures())
+ {
+ return initialCol;
+ }
+
+ SequenceFeature[] sequenceFeatures = seq.getSequenceFeatures();
+ if (seq != lastSeq)
+ {
+ lastSeq = seq;
+ lastSequenceFeatures = sequenceFeatures;
+ if (lastSequenceFeatures != null)
+ {
+ sfSize = lastSequenceFeatures.length;
+ }
+ }
+ else
+ {
+ if (lastSequenceFeatures != sequenceFeatures)
+ {
+ lastSequenceFeatures = sequenceFeatures;
+ if (lastSequenceFeatures != null)
+ {
+ sfSize = lastSequenceFeatures.length;
+ }
+ }
+ }
+
+ if (lastSequenceFeatures == null || sfSize == 0)
+ {
+ return initialCol;
+ }
+
+ if (jalview.util.Comparison.isGap(lastSeq.getCharAt(column)))
+ {
+ return Color.white.getRGB();
+ }
+
+ // Only bother making an offscreen image if transparency is applied
+ if (transparency != 1.0f && offscreenImage == null)
+ {
+ offscreenImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
+ }
+
+ currentColour = null;
+ // TODO: non-threadsafe - each rendering thread needs its own instance of
+ // the feature renderer - or this should be synchronized.
+ offscreenRender = true;
+
+ if (offscreenImage != null)
+ {
+ offscreenImage.setRGB(0, 0, initialCol);
+ drawSequence(offscreenImage.getGraphics(), lastSeq, column, column, 0);
+
+ return offscreenImage.getRGB(0, 0);
+ }
+ else
+ {
+ drawSequence(null, lastSeq, lastSeq.findPosition(column), -1, -1);
+
+ if (currentColour == null)
+ {
+ return initialCol;
+ }
+ else
+ {
+ return ((Integer) currentColour).intValue();
+ }
+ }
+
+ }
+
+ private volatile SequenceFeature[] lastSequenceFeatures;
+
+ int sfSize;
+
+ int sfindex;
+
+ int spos;
+
+ int epos;
+
+ public synchronized void drawSequence(Graphics g, final SequenceI seq,
+ int start, int end, int y1)
+ {
+ SequenceFeature[] sequenceFeatures = seq.getSequenceFeatures();
+ if (sequenceFeatures == null || sequenceFeatures.length == 0)
+ {
+ return;
+ }
+
+ if (g != null)
+ {
+ fm = g.getFontMetrics();
+ }
+
+ updateFeatures();
+
+ if (lastSeq == null || seq != lastSeq
+ || sequenceFeatures != lastSequenceFeatures)
+ {
+ lastSeq = seq;
+ lastSequenceFeatures = sequenceFeatures;
+ }
+
+ if (transparency != 1 && g != null)
+ {
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
+ transparency));
+ }
+
+ if (!offscreenRender)
+ {
+ spos = lastSeq.findPosition(start);
+ epos = lastSeq.findPosition(end);
+ }
+
+ sfSize = lastSequenceFeatures.length;
+ String type;
+ for (int renderIndex = 0; renderIndex < renderOrder.length; renderIndex++)
+ {
+ type = renderOrder[renderIndex];
+
+ if (type == null || !showFeatureOfType(type))
+ {
+ continue;
+ }
+
+ // loop through all features in sequence to find
+ // current feature to render
+ for (sfindex = 0; sfindex < sfSize; sfindex++)
+ {
+ final SequenceFeature sequenceFeature = lastSequenceFeatures[sfindex];
+ if (!sequenceFeature.type.equals(type))
+ {
+ continue;
+ }
+
+ if (featureGroups != null
+ && sequenceFeature.featureGroup != null
+ && sequenceFeature.featureGroup.length() != 0
+ && featureGroups.containsKey(sequenceFeature.featureGroup)
+ && !featureGroups.get(sequenceFeature.featureGroup)
+ .booleanValue())
+ {
+ continue;
+ }
+
+ if (!offscreenRender
+ && (sequenceFeature.getBegin() > epos || sequenceFeature
+ .getEnd() < spos))
+ {
+ continue;
+ }
+
+ if (offscreenRender && offscreenImage == null)
+ {
+ if (sequenceFeature.begin <= start
+ && sequenceFeature.end >= start)
+ {
+ // this is passed out to the overview and other sequence renderers
+ // (e.g. molecule viewer) to get displayed colour for rendered
+ // sequence
+ currentColour = new Integer(getColour(sequenceFeature).getRGB());
+ // used to be retreived from av.featuresDisplayed
+ // currentColour = av.featuresDisplayed
+ // .get(sequenceFeatures[sfindex].type);
+
+ }
+ }
+ else if (sequenceFeature.type.equals("disulfide bond"))
+ {
+ renderFeature(g, seq, seq.findIndex(sequenceFeature.begin) - 1,
+ seq.findIndex(sequenceFeature.begin) - 1,
+ getColour(sequenceFeature)
+ // new Color(((Integer) av.featuresDisplayed
+ // .get(sequenceFeatures[sfindex].type)).intValue())
+ , start, end, y1);
+ renderFeature(g, seq, seq.findIndex(sequenceFeature.end) - 1,
+ seq.findIndex(sequenceFeature.end) - 1,
+ getColour(sequenceFeature)
+ // new Color(((Integer) av.featuresDisplayed
+ // .get(sequenceFeatures[sfindex].type)).intValue())
+ , start, end, y1);
+
+ }
+ else if (showFeature(sequenceFeature))
+ {
+ if (av_isShowSeqFeatureHeight
+ && !Float.isNaN(sequenceFeature.score))
+ {
+ renderScoreFeature(g, seq,
+ seq.findIndex(sequenceFeature.begin) - 1,
+ seq.findIndex(sequenceFeature.end) - 1,
+ getColour(sequenceFeature), start, end, y1,
+ normaliseScore(sequenceFeature));
+ }
+ else
+ {
+ renderFeature(g, seq, seq.findIndex(sequenceFeature.begin) - 1,
+ seq.findIndex(sequenceFeature.end) - 1,
+ getColour(sequenceFeature), start, end, y1);
+ }
+ }
+
+ }
+
+ }
+
+ if (transparency != 1.0f && g != null && transparencyAvailable)
+ {
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
+ 1.0f));
+ }
+ }
+
+ boolean transparencyAvailable = true;
+
+ protected void setTransparencyAvailable(boolean isTransparencyAvailable)
+ {
+ transparencyAvailable = isTransparencyAvailable;
+ }
+
+ @Override
+ public boolean isTransparencyAvailable()
+ {
+ return transparencyAvailable;
+ }
+
+ /**
+ * Called when alignment in associated view has new/modified features to
+ * discover and display.
+ *
+ */
+ public void featuresAdded()
+ {
+ lastSeq = null;
+ findAllFeatures();
+ }
+}
diff --git a/src/jalview/rest/RestHandler.java b/src/jalview/rest/RestHandler.java
new file mode 100644
index 0000000..76cf184
--- /dev/null
+++ b/src/jalview/rest/RestHandler.java
@@ -0,0 +1,115 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.rest;
+
+import jalview.httpserver.AbstractRequestHandler;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.BindException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * A simple handler to process (or delegate) HTTP requests on /jalview/rest
+ */
+public class RestHandler extends AbstractRequestHandler
+{
+ private static final String MY_PATH = "rest";
+
+ private static final String MY_NAME = "Rest";
+
+ /**
+ * Singleton instance of this class
+ */
+ private static RestHandler instance = null;
+
+ /**
+ * Returns the singleton instance of this class
+ *
+ * @return
+ * @throws BindException
+ */
+ public static RestHandler getInstance() throws BindException
+ {
+ synchronized (RestHandler.class)
+ {
+ if (instance == null)
+ {
+ instance = new RestHandler();
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Private constructor enforces use of singleton
+ *
+ * @throws BindException
+ */
+ private RestHandler() throws BindException
+ {
+ setPath(MY_PATH);
+
+ /*
+ * We don't register the handler here - this is done as a special case in
+ * HttpServer initialisation; to do it here would invite an infinite loop of
+ * RestHandler/HttpServer constructor
+ */
+ }
+
+ /**
+ * Handle a jalview/rest request
+ *
+ * @throws IOException
+ */
+ @Override
+ protected void processRequest(HttpServletRequest request,
+ HttpServletResponse response) throws IOException
+ {
+ /*
+ * Currently just echoes the request; add helper classes as required to
+ * process requests
+ */
+ final String queryString = request.getQueryString();
+ final String reply = "REST not yet implemented; received "
+ + request.getMethod() + ": " + request.getRequestURL()
+ + (queryString == null ? "" : "?" + queryString);
+ System.out.println(reply);
+
+ response.setHeader("Cache-Control", "no-cache/no-store");
+ response.setHeader("Content-type", "text/plain");
+ final PrintWriter writer = response.getWriter();
+ writer.write(reply);
+ writer.close();
+ }
+
+ /**
+ * Returns a display name for this service
+ */
+ @Override
+ public String getName()
+ {
+ return MY_NAME;
+ }
+
+}
diff --git a/src/jalview/schemabinding/version2/.castor.cdr b/src/jalview/schemabinding/version2/.castor.cdr
index cd0b1e7..361fb7c 100644
--- a/src/jalview/schemabinding/version2/.castor.cdr
+++ b/src/jalview/schemabinding/version2/.castor.cdr
@@ -1,7 +1,8 @@
-#Wed Aug 03 09:15:24 BST 2011
+#Thu Sep 03 10:55:37 BST 2015
jalview.schemabinding.version2.ThresholdLine=jalview.schemabinding.version2.descriptors.ThresholdLineDescriptor
jalview.schemabinding.version2.SequenceSetProperties=jalview.schemabinding.version2.descriptors.SequenceSetPropertiesDescriptor
jalview.schemabinding.version2.StructureState=jalview.schemabinding.version2.descriptors.StructureStateDescriptor
+jalview.schemabinding.version2.CalcIdParam=jalview.schemabinding.version2.descriptors.CalcIdParamDescriptor
jalview.schemabinding.version2.Tree=jalview.schemabinding.version2.descriptors.TreeDescriptor
jalview.schemabinding.version2.JalviewModel=jalview.schemabinding.version2.descriptors.JalviewModelDescriptor
jalview.schemabinding.version2.SequenceType=jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor
@@ -9,20 +10,24 @@ jalview.schemabinding.version2.OtherData=jalview.schemabinding.version2.descript
jalview.schemabinding.version2.Setting=jalview.schemabinding.version2.descriptors.SettingDescriptor
jalview.schemabinding.version2.AlcodonFrame=jalview.schemabinding.version2.descriptors.AlcodonFrameDescriptor
jalview.schemabinding.version2.AnnotationElement=jalview.schemabinding.version2.descriptors.AnnotationElementDescriptor
+jalview.schemabinding.version2.SecondaryStructure=jalview.schemabinding.version2.descriptors.SecondaryStructureDescriptor
jalview.schemabinding.version2.SequenceSet=jalview.schemabinding.version2.descriptors.SequenceSetDescriptor
jalview.schemabinding.version2.Viewport=jalview.schemabinding.version2.descriptors.ViewportDescriptor
+jalview.schemabinding.version2.RnaViewer=jalview.schemabinding.version2.descriptors.RnaViewerDescriptor
jalview.schemabinding.version2.MapListType=jalview.schemabinding.version2.descriptors.MapListTypeDescriptor
jalview.schemabinding.version2.Property=jalview.schemabinding.version2.descriptors.PropertyDescriptor
jalview.schemabinding.version2.UserColourScheme=jalview.schemabinding.version2.descriptors.UserColourSchemeDescriptor
jalview.schemabinding.version2.DBRef=jalview.schemabinding.version2.descriptors.DBRefDescriptor
jalview.schemabinding.version2.AlcodMap=jalview.schemabinding.version2.descriptors.AlcodMapDescriptor
jalview.schemabinding.version2.Annotation=jalview.schemabinding.version2.descriptors.AnnotationDescriptor
+jalview.schemabinding.version2.Wsparameters=jalview.schemabinding.version2.descriptors.WsparametersDescriptor
jalview.schemabinding.version2.JSeq=jalview.schemabinding.version2.descriptors.JSeqDescriptor
jalview.schemabinding.version2.Sequence=jalview.schemabinding.version2.descriptors.SequenceDescriptor
jalview.schemabinding.version2.WebServiceParameterSet=jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor
jalview.schemabinding.version2.Alcodon=jalview.schemabinding.version2.descriptors.AlcodonDescriptor
jalview.schemabinding.version2.AnnotationColours=jalview.schemabinding.version2.descriptors.AnnotationColoursDescriptor
jalview.schemabinding.version2.Pdbids=jalview.schemabinding.version2.descriptors.PdbidsDescriptor
+jalview.schemabinding.version2.AnnotationColourScheme=jalview.schemabinding.version2.descriptors.AnnotationColourSchemeDescriptor
jalview.schemabinding.version2.Mapping=jalview.schemabinding.version2.descriptors.MappingDescriptor
jalview.schemabinding.version2.MappingChoice=jalview.schemabinding.version2.descriptors.MappingChoiceDescriptor
jalview.schemabinding.version2.Group=jalview.schemabinding.version2.descriptors.GroupDescriptor
@@ -32,14 +37,14 @@ jalview.schemabinding.version2.UserColours=jalview.schemabinding.version2.descri
jalview.schemabinding.version2.Colour=jalview.schemabinding.version2.descriptors.ColourDescriptor
jalview.schemabinding.version2.MapListFrom=jalview.schemabinding.version2.descriptors.MapListFromDescriptor
jalview.schemabinding.version2.PdbentryItem=jalview.schemabinding.version2.descriptors.PdbentryItemDescriptor
-jalview.schemabinding.version2.FeatureSettings=jalview.schemabinding.version2.descriptors.FeatureSettingsDescriptor
jalview.schemabinding.version2.JGroup=jalview.schemabinding.version2.descriptors.JGroupDescriptor
-jalview.schemabinding.version2.MapListTo=jalview.schemabinding.version2.descriptors.MapListToDescriptor
-jalview.schemabinding.version2.JalviewUserColours=jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor
+jalview.schemabinding.version2.FeatureSettings=jalview.schemabinding.version2.descriptors.FeatureSettingsDescriptor
jalview.schemabinding.version2.VamsasModel=jalview.schemabinding.version2.descriptors.VamsasModelDescriptor
+jalview.schemabinding.version2.JalviewUserColours=jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor
+jalview.schemabinding.version2.MapListTo=jalview.schemabinding.version2.descriptors.MapListToDescriptor
jalview.schemabinding.version2.Pdbentry=jalview.schemabinding.version2.descriptors.PdbentryDescriptor
jalview.schemabinding.version2.HiddenColumns=jalview.schemabinding.version2.descriptors.HiddenColumnsDescriptor
-jalview.schemabinding.version2.DseqFor=jalview.schemabinding.version2.descriptors.DseqForDescriptor
jalview.schemabinding.version2.Features=jalview.schemabinding.version2.descriptors.FeaturesDescriptor
+jalview.schemabinding.version2.DseqFor=jalview.schemabinding.version2.descriptors.DseqForDescriptor
jalview.schemabinding.version2.VAMSAS=jalview.schemabinding.version2.descriptors.VAMSASDescriptor
jalview.schemabinding.version2.MappingChoiceItem=jalview.schemabinding.version2.descriptors.MappingChoiceItemDescriptor
diff --git a/src/jalview/schemabinding/version2/AlcodMap.java b/src/jalview/schemabinding/version2/AlcodMap.java
index a98ab62..e2522a1 100644
--- a/src/jalview/schemabinding/version2/AlcodMap.java
+++ b/src/jalview/schemabinding/version2/AlcodMap.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,166 +19,174 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class AlcodMap implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * internal jalview id for the dnasq for this mapping.
- *
- */
- private java.lang.String _dnasq;
-
- /**
- * a Mapping entry and an associated protein sequence
- *
- */
- private jalview.schemabinding.version2.Mapping _mapping;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AlcodMap() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'dnasq'. The field 'dnasq' has
- * the following description: internal jalview id for the dnasq
- * for this mapping.
- *
- *
- * @return the value of field 'Dnasq'.
- */
- public java.lang.String getDnasq(
- ) {
- return this._dnasq;
- }
-
- /**
- * Returns the value of field 'mapping'. The field 'mapping'
- * has the following description: a Mapping entry and an
- * associated protein sequence
- *
- *
- * @return the value of field 'Mapping'.
- */
- public jalview.schemabinding.version2.Mapping getMapping(
- ) {
- return this._mapping;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'dnasq'. The field 'dnasq' has the
- * following description: internal jalview id for the dnasq for
- * this mapping.
- *
- *
- * @param dnasq the value of field 'dnasq'.
- */
- public void setDnasq(
- final java.lang.String dnasq) {
- this._dnasq = dnasq;
- }
-
- /**
- * Sets the value of field 'mapping'. The field 'mapping' has
- * the following description: a Mapping entry and an associated
- * protein sequence
- *
- *
- * @param mapping the value of field 'mapping'.
- */
- public void setMapping(
- final jalview.schemabinding.version2.Mapping mapping) {
- this._mapping = mapping;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.AlcodMap
- */
- public static jalview.schemabinding.version2.AlcodMap unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.AlcodMap) Unmarshaller.unmarshal(jalview.schemabinding.version2.AlcodMap.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class AlcodMap implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * internal jalview id for the dnasq for this mapping.
+ *
+ */
+ private java.lang.String _dnasq;
+
+ /**
+ * a Mapping entry and an associated protein sequence
+ *
+ */
+ private jalview.schemabinding.version2.Mapping _mapping;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AlcodMap()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'dnasq'. The field 'dnasq' has the following
+ * description: internal jalview id for the dnasq for this mapping.
+ *
+ *
+ * @return the value of field 'Dnasq'.
+ */
+ public java.lang.String getDnasq()
+ {
+ return this._dnasq;
+ }
+
+ /**
+ * Returns the value of field 'mapping'. The field 'mapping' has the following
+ * description: a Mapping entry and an associated protein sequence
+ *
+ *
+ * @return the value of field 'Mapping'.
+ */
+ public jalview.schemabinding.version2.Mapping getMapping()
+ {
+ return this._mapping;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'dnasq'. The field 'dnasq' has the following
+ * description: internal jalview id for the dnasq for this mapping.
+ *
+ *
+ * @param dnasq
+ * the value of field 'dnasq'.
+ */
+ public void setDnasq(final java.lang.String dnasq)
+ {
+ this._dnasq = dnasq;
+ }
+
+ /**
+ * Sets the value of field 'mapping'. The field 'mapping' has the following
+ * description: a Mapping entry and an associated protein sequence
+ *
+ *
+ * @param mapping
+ * the value of field 'mapping'.
+ */
+ public void setMapping(
+ final jalview.schemabinding.version2.Mapping mapping)
+ {
+ this._mapping = mapping;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.AlcodMap
+ */
+ public static jalview.schemabinding.version2.AlcodMap unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.AlcodMap) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.AlcodMap.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Alcodon.java b/src/jalview/schemabinding/version2/Alcodon.java
index 0ed8292..3bd1cbb 100644
--- a/src/jalview/schemabinding/version2/Alcodon.java
+++ b/src/jalview/schemabinding/version2/Alcodon.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,245 +19,257 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Alcodon implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _pos1.
- */
- private long _pos1;
-
- /**
- * keeps track of state for field: _pos1
- */
- private boolean _has_pos1;
-
- /**
- * Field _pos2.
- */
- private long _pos2;
-
- /**
- * keeps track of state for field: _pos2
- */
- private boolean _has_pos2;
-
- /**
- * Field _pos3.
- */
- private long _pos3;
-
- /**
- * keeps track of state for field: _pos3
- */
- private boolean _has_pos3;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Alcodon() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deletePos1(
- ) {
- this._has_pos1= false;
- }
-
- /**
- */
- public void deletePos2(
- ) {
- this._has_pos2= false;
- }
-
- /**
- */
- public void deletePos3(
- ) {
- this._has_pos3= false;
- }
-
- /**
- * Returns the value of field 'pos1'.
- *
- * @return the value of field 'Pos1'.
- */
- public long getPos1(
- ) {
- return this._pos1;
- }
-
- /**
- * Returns the value of field 'pos2'.
- *
- * @return the value of field 'Pos2'.
+public class Alcodon implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _pos1.
+ */
+ private long _pos1;
+
+ /**
+ * keeps track of state for field: _pos1
+ */
+ private boolean _has_pos1;
+
+ /**
+ * Field _pos2.
+ */
+ private long _pos2;
+
+ /**
+ * keeps track of state for field: _pos2
+ */
+ private boolean _has_pos2;
+
+ /**
+ * Field _pos3.
+ */
+ private long _pos3;
+
+ /**
+ * keeps track of state for field: _pos3
+ */
+ private boolean _has_pos3;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Alcodon()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
*/
- public long getPos2(
- ) {
- return this._pos2;
- }
-
- /**
- * Returns the value of field 'pos3'.
- *
- * @return the value of field 'Pos3'.
- */
- public long getPos3(
- ) {
- return this._pos3;
- }
-
- /**
- * Method hasPos1.
- *
- * @return true if at least one Pos1 has been added
- */
- public boolean hasPos1(
- ) {
- return this._has_pos1;
- }
-
- /**
- * Method hasPos2.
- *
- * @return true if at least one Pos2 has been added
- */
- public boolean hasPos2(
- ) {
- return this._has_pos2;
- }
-
- /**
- * Method hasPos3.
- *
- * @return true if at least one Pos3 has been added
- */
- public boolean hasPos3(
- ) {
- return this._has_pos3;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
+ public void deletePos1()
+ {
+ this._has_pos1 = false;
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
+ /**
*/
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'pos1'.
- *
- * @param pos1 the value of field 'pos1'.
- */
- public void setPos1(
- final long pos1) {
- this._pos1 = pos1;
- this._has_pos1 = true;
- }
-
- /**
- * Sets the value of field 'pos2'.
- *
- * @param pos2 the value of field 'pos2'.
- */
- public void setPos2(
- final long pos2) {
- this._pos2 = pos2;
- this._has_pos2 = true;
- }
-
- /**
- * Sets the value of field 'pos3'.
- *
- * @param pos3 the value of field 'pos3'.
- */
- public void setPos3(
- final long pos3) {
- this._pos3 = pos3;
- this._has_pos3 = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.Alcodo
- */
- public static jalview.schemabinding.version2.Alcodon unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Alcodon) Unmarshaller.unmarshal(jalview.schemabinding.version2.Alcodon.class, reader);
- }
+ public void deletePos2()
+ {
+ this._has_pos2 = false;
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
+ /**
*/
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ public void deletePos3()
+ {
+ this._has_pos3 = false;
+ }
+
+ /**
+ * Returns the value of field 'pos1'.
+ *
+ * @return the value of field 'Pos1'.
+ */
+ public long getPos1()
+ {
+ return this._pos1;
+ }
+
+ /**
+ * Returns the value of field 'pos2'.
+ *
+ * @return the value of field 'Pos2'.
+ */
+ public long getPos2()
+ {
+ return this._pos2;
+ }
+
+ /**
+ * Returns the value of field 'pos3'.
+ *
+ * @return the value of field 'Pos3'.
+ */
+ public long getPos3()
+ {
+ return this._pos3;
+ }
+
+ /**
+ * Method hasPos1.
+ *
+ * @return true if at least one Pos1 has been added
+ */
+ public boolean hasPos1()
+ {
+ return this._has_pos1;
+ }
+
+ /**
+ * Method hasPos2.
+ *
+ * @return true if at least one Pos2 has been added
+ */
+ public boolean hasPos2()
+ {
+ return this._has_pos2;
+ }
+
+ /**
+ * Method hasPos3.
+ *
+ * @return true if at least one Pos3 has been added
+ */
+ public boolean hasPos3()
+ {
+ return this._has_pos3;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'pos1'.
+ *
+ * @param pos1
+ * the value of field 'pos1'.
+ */
+ public void setPos1(final long pos1)
+ {
+ this._pos1 = pos1;
+ this._has_pos1 = true;
+ }
+
+ /**
+ * Sets the value of field 'pos2'.
+ *
+ * @param pos2
+ * the value of field 'pos2'.
+ */
+ public void setPos2(final long pos2)
+ {
+ this._pos2 = pos2;
+ this._has_pos2 = true;
+ }
+
+ /**
+ * Sets the value of field 'pos3'.
+ *
+ * @param pos3
+ * the value of field 'pos3'.
+ */
+ public void setPos3(final long pos3)
+ {
+ this._pos3 = pos3;
+ this._has_pos3 = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Alcodo
+ */
+ public static jalview.schemabinding.version2.Alcodon unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Alcodon) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.Alcodon.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/AlcodonFrame.java b/src/jalview/schemabinding/version2/AlcodonFrame.java
index 33fdf99..218e07e 100644
--- a/src/jalview/schemabinding/version2/AlcodonFrame.java
+++ b/src/jalview/schemabinding/version2/AlcodonFrame.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,414 +19,448 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class AlcodonFrame implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _alcodonList.
- */
- private java.util.Vector _alcodonList;
-
- /**
- * Field _alcodMapList.
- */
- private java.util.Vector _alcodMapList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AlcodonFrame() {
- super();
- this._alcodonList = new java.util.Vector();
- this._alcodMapList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vAlcodMap
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlcodMap(
- final jalview.schemabinding.version2.AlcodMap vAlcodMap)
- throws java.lang.IndexOutOfBoundsException {
- this._alcodMapList.addElement(vAlcodMap);
- }
-
- /**
- *
- *
- * @param index
- * @param vAlcodMap
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlcodMap(
- final int index,
- final jalview.schemabinding.version2.AlcodMap vAlcodMap)
- throws java.lang.IndexOutOfBoundsException {
- this._alcodMapList.add(index, vAlcodMap);
- }
-
- /**
- *
- *
- * @param vAlcodon
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlcodon(
- final jalview.schemabinding.version2.Alcodon vAlcodon)
- throws java.lang.IndexOutOfBoundsException {
- this._alcodonList.addElement(vAlcodon);
- }
-
- /**
- *
- *
- * @param index
- * @param vAlcodon
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlcodon(
- final int index,
- final jalview.schemabinding.version2.Alcodon vAlcodon)
- throws java.lang.IndexOutOfBoundsException {
- this._alcodonList.add(index, vAlcodon);
- }
-
- /**
- * Method enumerateAlcodMap.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.AlcodMap elements
- */
- public java.util.Enumeration enumerateAlcodMap(
- ) {
- return this._alcodMapList.elements();
- }
-
- /**
- * Method enumerateAlcodon.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Alcodon elements
- */
- public java.util.Enumeration enumerateAlcodon(
- ) {
- return this._alcodonList.elements();
- }
-
- /**
- * Method getAlcodMap.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.AlcodMap at the given index
- */
- public jalview.schemabinding.version2.AlcodMap getAlcodMap(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alcodMapList.size()) {
- throw new IndexOutOfBoundsException("getAlcodMap: Index value '" + index + "' not in range [0.." + (this._alcodMapList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.AlcodMap) _alcodMapList.get(index);
- }
-
- /**
- * Method getAlcodMap.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.AlcodMap[] getAlcodMap(
- ) {
- jalview.schemabinding.version2.AlcodMap[] array = new jalview.schemabinding.version2.AlcodMap[0];
- return (jalview.schemabinding.version2.AlcodMap[]) this._alcodMapList.toArray(array);
- }
-
- /**
- * Method getAlcodMapCount.
- *
- * @return the size of this collection
- */
- public int getAlcodMapCount(
- ) {
- return this._alcodMapList.size();
- }
-
- /**
- * Method getAlcodon.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Alcodon at the given index
- */
- public jalview.schemabinding.version2.Alcodon getAlcodon(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alcodonList.size()) {
- throw new IndexOutOfBoundsException("getAlcodon: Index value '" + index + "' not in range [0.." + (this._alcodonList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Alcodon) _alcodonList.get(index);
- }
-
- /**
- * Method getAlcodon.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Alcodon[] getAlcodon(
- ) {
- jalview.schemabinding.version2.Alcodon[] array = new jalview.schemabinding.version2.Alcodon[0];
- return (jalview.schemabinding.version2.Alcodon[]) this._alcodonList.toArray(array);
- }
-
- /**
- * Method getAlcodonCount.
- *
- * @return the size of this collection
- */
- public int getAlcodonCount(
- ) {
- return this._alcodonList.size();
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Method removeAlcodMap.
- *
- * @param vAlcodMap
- * @return true if the object was removed from the collection.
- */
- public boolean removeAlcodMap(
- final jalview.schemabinding.version2.AlcodMap vAlcodMap) {
- boolean removed = _alcodMapList.remove(vAlcodMap);
- return removed;
+public class AlcodonFrame implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _alcodonList.
+ */
+ private java.util.Vector _alcodonList;
+
+ /**
+ * Field _alcodMapList.
+ */
+ private java.util.Vector _alcodMapList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AlcodonFrame()
+ {
+ super();
+ this._alcodonList = new java.util.Vector();
+ this._alcodMapList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vAlcodMap
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlcodMap(
+ final jalview.schemabinding.version2.AlcodMap vAlcodMap)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._alcodMapList.addElement(vAlcodMap);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlcodMap
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlcodMap(final int index,
+ final jalview.schemabinding.version2.AlcodMap vAlcodMap)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._alcodMapList.add(index, vAlcodMap);
+ }
+
+ /**
+ *
+ *
+ * @param vAlcodon
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlcodon(
+ final jalview.schemabinding.version2.Alcodon vAlcodon)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._alcodonList.addElement(vAlcodon);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlcodon
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlcodon(final int index,
+ final jalview.schemabinding.version2.Alcodon vAlcodon)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._alcodonList.add(index, vAlcodon);
+ }
+
+ /**
+ * Method enumerateAlcodMap.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.AlcodMap
+ * elements
+ */
+ public java.util.Enumeration enumerateAlcodMap()
+ {
+ return this._alcodMapList.elements();
+ }
+
+ /**
+ * Method enumerateAlcodon.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Alcodon
+ * elements
+ */
+ public java.util.Enumeration enumerateAlcodon()
+ {
+ return this._alcodonList.elements();
+ }
+
+ /**
+ * Method getAlcodMap.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.AlcodMap at the
+ * given index
+ */
+ public jalview.schemabinding.version2.AlcodMap getAlcodMap(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._alcodMapList.size())
+ {
+ throw new IndexOutOfBoundsException("getAlcodMap: Index value '"
+ + index + "' not in range [0.."
+ + (this._alcodMapList.size() - 1) + "]");
}
- /**
- * Method removeAlcodMapAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.AlcodMap removeAlcodMapAt(
- final int index) {
- java.lang.Object obj = this._alcodMapList.remove(index);
- return (jalview.schemabinding.version2.AlcodMap) obj;
- }
-
- /**
- * Method removeAlcodon.
- *
- * @param vAlcodon
- * @return true if the object was removed from the collection.
- */
- public boolean removeAlcodon(
- final jalview.schemabinding.version2.Alcodon vAlcodon) {
- boolean removed = _alcodonList.remove(vAlcodon);
- return removed;
- }
-
- /**
- * Method removeAlcodonAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Alcodon removeAlcodonAt(
- final int index) {
- java.lang.Object obj = this._alcodonList.remove(index);
- return (jalview.schemabinding.version2.Alcodon) obj;
- }
-
- /**
- */
- public void removeAllAlcodMap(
- ) {
- this._alcodMapList.clear();
+ return (jalview.schemabinding.version2.AlcodMap) _alcodMapList
+ .get(index);
+ }
+
+ /**
+ * Method getAlcodMap.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.AlcodMap[] getAlcodMap()
+ {
+ jalview.schemabinding.version2.AlcodMap[] array = new jalview.schemabinding.version2.AlcodMap[0];
+ return (jalview.schemabinding.version2.AlcodMap[]) this._alcodMapList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAlcodMapCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAlcodMapCount()
+ {
+ return this._alcodMapList.size();
+ }
+
+ /**
+ * Method getAlcodon.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Alcodon at the
+ * given index
+ */
+ public jalview.schemabinding.version2.Alcodon getAlcodon(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._alcodonList.size())
+ {
+ throw new IndexOutOfBoundsException("getAlcodon: Index value '"
+ + index + "' not in range [0.."
+ + (this._alcodonList.size() - 1) + "]");
}
- /**
- */
- public void removeAllAlcodon(
- ) {
- this._alcodonList.clear();
+ return (jalview.schemabinding.version2.Alcodon) _alcodonList.get(index);
+ }
+
+ /**
+ * Method getAlcodon.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Alcodon[] getAlcodon()
+ {
+ jalview.schemabinding.version2.Alcodon[] array = new jalview.schemabinding.version2.Alcodon[0];
+ return (jalview.schemabinding.version2.Alcodon[]) this._alcodonList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAlcodonCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAlcodonCount()
+ {
+ return this._alcodonList.size();
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- *
- *
- * @param index
- * @param vAlcodMap
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAlcodMap(
- final int index,
- final jalview.schemabinding.version2.AlcodMap vAlcodMap)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alcodMapList.size()) {
- throw new IndexOutOfBoundsException("setAlcodMap: Index value '" + index + "' not in range [0.." + (this._alcodMapList.size() - 1) + "]");
- }
-
- this._alcodMapList.set(index, vAlcodMap);
- }
-
- /**
- *
- *
- * @param vAlcodMapArray
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Method removeAlcodMap.
+ *
+ * @param vAlcodMap
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAlcodMap(
+ final jalview.schemabinding.version2.AlcodMap vAlcodMap)
+ {
+ boolean removed = _alcodMapList.remove(vAlcodMap);
+ return removed;
+ }
+
+ /**
+ * Method removeAlcodMapAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.AlcodMap removeAlcodMapAt(
+ final int index)
+ {
+ java.lang.Object obj = this._alcodMapList.remove(index);
+ return (jalview.schemabinding.version2.AlcodMap) obj;
+ }
+
+ /**
+ * Method removeAlcodon.
+ *
+ * @param vAlcodon
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAlcodon(
+ final jalview.schemabinding.version2.Alcodon vAlcodon)
+ {
+ boolean removed = _alcodonList.remove(vAlcodon);
+ return removed;
+ }
+
+ /**
+ * Method removeAlcodonAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Alcodon removeAlcodonAt(
+ final int index)
+ {
+ java.lang.Object obj = this._alcodonList.remove(index);
+ return (jalview.schemabinding.version2.Alcodon) obj;
+ }
+
+ /**
*/
- public void setAlcodMap(
- final jalview.schemabinding.version2.AlcodMap[] vAlcodMapArray) {
- //-- copy array
- _alcodMapList.clear();
-
- for (int i = 0; i < vAlcodMapArray.length; i++) {
- this._alcodMapList.add(vAlcodMapArray[i]);
- }
- }
+ public void removeAllAlcodMap()
+ {
+ this._alcodMapList.clear();
+ }
- /**
- *
- *
- * @param index
- * @param vAlcodon
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
+ /**
*/
- public void setAlcodon(
- final int index,
- final jalview.schemabinding.version2.Alcodon vAlcodon)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alcodonList.size()) {
- throw new IndexOutOfBoundsException("setAlcodon: Index value '" + index + "' not in range [0.." + (this._alcodonList.size() - 1) + "]");
- }
-
- this._alcodonList.set(index, vAlcodon);
+ public void removeAllAlcodon()
+ {
+ this._alcodonList.clear();
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlcodMap
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAlcodMap(final int index,
+ final jalview.schemabinding.version2.AlcodMap vAlcodMap)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._alcodMapList.size())
+ {
+ throw new IndexOutOfBoundsException("setAlcodMap: Index value '"
+ + index + "' not in range [0.."
+ + (this._alcodMapList.size() - 1) + "]");
}
- /**
- *
- *
- * @param vAlcodonArray
- */
- public void setAlcodon(
- final jalview.schemabinding.version2.Alcodon[] vAlcodonArray) {
- //-- copy array
- _alcodonList.clear();
-
- for (int i = 0; i < vAlcodonArray.length; i++) {
- this._alcodonList.add(vAlcodonArray[i]);
- }
+ this._alcodMapList.set(index, vAlcodMap);
+ }
+
+ /**
+ *
+ *
+ * @param vAlcodMapArray
+ */
+ public void setAlcodMap(
+ final jalview.schemabinding.version2.AlcodMap[] vAlcodMapArray)
+ {
+ // -- copy array
+ _alcodMapList.clear();
+
+ for (int i = 0; i < vAlcodMapArray.length; i++)
+ {
+ this._alcodMapList.add(vAlcodMapArray[i]);
}
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.AlcodonFrame
- */
- public static jalview.schemabinding.version2.AlcodonFrame unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.AlcodonFrame) Unmarshaller.unmarshal(jalview.schemabinding.version2.AlcodonFrame.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlcodon
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAlcodon(final int index,
+ final jalview.schemabinding.version2.Alcodon vAlcodon)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._alcodonList.size())
+ {
+ throw new IndexOutOfBoundsException("setAlcodon: Index value '"
+ + index + "' not in range [0.."
+ + (this._alcodonList.size() - 1) + "]");
}
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._alcodonList.set(index, vAlcodon);
+ }
+
+ /**
+ *
+ *
+ * @param vAlcodonArray
+ */
+ public void setAlcodon(
+ final jalview.schemabinding.version2.Alcodon[] vAlcodonArray)
+ {
+ // -- copy array
+ _alcodonList.clear();
+
+ for (int i = 0; i < vAlcodonArray.length; i++)
+ {
+ this._alcodonList.add(vAlcodonArray[i]);
}
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.AlcodonFrame
+ */
+ public static jalview.schemabinding.version2.AlcodonFrame unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.AlcodonFrame) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.AlcodonFrame.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Annotation.java b/src/jalview/schemabinding/version2/Annotation.java
index 9fd0802..2fead37 100644
--- a/src/jalview/schemabinding/version2/Annotation.java
+++ b/src/jalview/schemabinding/version2/Annotation.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,1067 +19,1378 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Annotation implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _graph.
- */
- private boolean _graph;
-
- /**
- * keeps track of state for field: _graph
- */
- private boolean _has_graph;
-
- /**
- * Field _graphType.
- */
- private int _graphType;
-
- /**
- * keeps track of state for field: _graphType
- */
- private boolean _has_graphType;
-
- /**
- * Field _sequenceRef.
- */
- private java.lang.String _sequenceRef;
-
- /**
- * Field _groupRef.
- */
- private java.lang.String _groupRef;
-
- /**
- * Field _graphColour.
- */
- private int _graphColour;
-
- /**
- * keeps track of state for field: _graphColour
- */
- private boolean _has_graphColour;
-
- /**
- * Field _graphGroup.
- */
- private int _graphGroup;
-
- /**
- * keeps track of state for field: _graphGroup
- */
- private boolean _has_graphGroup;
-
- /**
- * height in pixels for the graph if this is a graph-type
- * annotation.
- */
- private int _graphHeight;
-
- /**
- * keeps track of state for field: _graphHeight
- */
- private boolean _has_graphHeight;
-
- /**
- * Field _id.
- */
- private java.lang.String _id;
-
- /**
- * Field _scoreOnly.
- */
- private boolean _scoreOnly = false;
-
- /**
- * keeps track of state for field: _scoreOnly
- */
- private boolean _has_scoreOnly;
-
- /**
- * Field _score.
- */
- private double _score;
-
- /**
- * keeps track of state for field: _score
- */
- private boolean _has_score;
-
- /**
- * Field _visible.
- */
- private boolean _visible;
-
- /**
- * keeps track of state for field: _visible
- */
- private boolean _has_visible;
-
- /**
- * Field _centreColLabels.
- */
- private boolean _centreColLabels;
-
- /**
- * keeps track of state for field: _centreColLabels
- */
- private boolean _has_centreColLabels;
-
- /**
- * Field _scaleColLabels.
- */
- private boolean _scaleColLabels;
-
- /**
- * keeps track of state for field: _scaleColLabels
- */
- private boolean _has_scaleColLabels;
-
- /**
- * Field _showAllColLabels.
- */
- private boolean _showAllColLabels;
-
- /**
- * keeps track of state for field: _showAllColLabels
- */
- private boolean _has_showAllColLabels;
-
- /**
- * is an autocalculated annotation row
- */
- private boolean _autoCalculated = false;
-
- /**
- * keeps track of state for field: _autoCalculated
- */
- private boolean _has_autoCalculated;
-
- /**
- * Field _annotationElementList.
- */
- private java.util.Vector _annotationElementList;
-
- /**
- * Field _label.
- */
- private java.lang.String _label;
-
- /**
- * Field _description.
- */
- private java.lang.String _description;
-
- /**
- * Field _thresholdLine.
- */
- private jalview.schemabinding.version2.ThresholdLine _thresholdLine;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Annotation() {
- super();
- this._annotationElementList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vAnnotationElement
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAnnotationElement(
- final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
- throws java.lang.IndexOutOfBoundsException {
- this._annotationElementList.addElement(vAnnotationElement);
- }
-
- /**
- *
- *
- * @param index
- * @param vAnnotationElement
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAnnotationElement(
- final int index,
- final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
- throws java.lang.IndexOutOfBoundsException {
- this._annotationElementList.add(index, vAnnotationElement);
- }
-
- /**
- */
- public void deleteAutoCalculated(
- ) {
- this._has_autoCalculated= false;
- }
-
- /**
- */
- public void deleteCentreColLabels(
- ) {
- this._has_centreColLabels= false;
- }
-
- /**
- */
- public void deleteGraph(
- ) {
- this._has_graph= false;
- }
-
- /**
- */
- public void deleteGraphColour(
- ) {
- this._has_graphColour= false;
- }
-
- /**
- */
- public void deleteGraphGroup(
- ) {
- this._has_graphGroup= false;
- }
-
- /**
- */
- public void deleteGraphHeight(
- ) {
- this._has_graphHeight= false;
- }
-
- /**
- */
- public void deleteGraphType(
- ) {
- this._has_graphType= false;
- }
-
- /**
- */
- public void deleteScaleColLabels(
- ) {
- this._has_scaleColLabels= false;
- }
-
- /**
- */
- public void deleteScore(
- ) {
- this._has_score= false;
- }
-
- /**
- */
- public void deleteScoreOnly(
- ) {
- this._has_scoreOnly= false;
- }
-
- /**
- */
- public void deleteShowAllColLabels(
- ) {
- this._has_showAllColLabels= false;
- }
-
- /**
- */
- public void deleteVisible(
- ) {
- this._has_visible= false;
- }
-
- /**
- * Method enumerateAnnotationElement.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.AnnotationElement elements
- */
- public java.util.Enumeration enumerateAnnotationElement(
- ) {
- return this._annotationElementList.elements();
- }
-
- /**
- * Method getAnnotationElement.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.AnnotationElement at the
- * given index
- */
- public jalview.schemabinding.version2.AnnotationElement getAnnotationElement(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._annotationElementList.size()) {
- throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.AnnotationElement) _annotationElementList.get(index);
- }
-
- /**
- * Method getAnnotationElement.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.AnnotationElement[] getAnnotationElement(
- ) {
- jalview.schemabinding.version2.AnnotationElement[] array = new jalview.schemabinding.version2.AnnotationElement[0];
- return (jalview.schemabinding.version2.AnnotationElement[]) this._annotationElementList.toArray(array);
- }
-
- /**
- * Method getAnnotationElementCount.
- *
- * @return the size of this collection
- */
- public int getAnnotationElementCount(
- ) {
- return this._annotationElementList.size();
- }
-
- /**
- * Returns the value of field 'autoCalculated'. The field
- * 'autoCalculated' has the following description: is an
- * autocalculated annotation row
- *
- * @return the value of field 'AutoCalculated'.
- */
- public boolean getAutoCalculated(
- ) {
- return this._autoCalculated;
- }
-
- /**
- * Returns the value of field 'centreColLabels'.
- *
- * @return the value of field 'CentreColLabels'.
- */
- public boolean getCentreColLabels(
- ) {
- return this._centreColLabels;
- }
-
- /**
- * Returns the value of field 'description'.
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Returns the value of field 'graph'.
- *
- * @return the value of field 'Graph'.
- */
- public boolean getGraph(
- ) {
- return this._graph;
- }
-
- /**
- * Returns the value of field 'graphColour'.
- *
- * @return the value of field 'GraphColour'.
- */
- public int getGraphColour(
- ) {
- return this._graphColour;
- }
-
- /**
- * Returns the value of field 'graphGroup'.
- *
- * @return the value of field 'GraphGroup'.
- */
- public int getGraphGroup(
- ) {
- return this._graphGroup;
- }
-
- /**
- * Returns the value of field 'graphHeight'. The field
- * 'graphHeight' has the following description: height in
- * pixels for the graph if this is a graph-type annotation.
- *
- * @return the value of field 'GraphHeight'.
- */
- public int getGraphHeight(
- ) {
- return this._graphHeight;
- }
-
- /**
- * Returns the value of field 'graphType'.
- *
- * @return the value of field 'GraphType'.
- */
- public int getGraphType(
- ) {
- return this._graphType;
- }
-
- /**
- * Returns the value of field 'groupRef'.
- *
- * @return the value of field 'GroupRef'.
- */
- public java.lang.String getGroupRef(
- ) {
- return this._groupRef;
- }
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'label'.
- *
- * @return the value of field 'Label'.
- */
- public java.lang.String getLabel(
- ) {
- return this._label;
- }
-
- /**
- * Returns the value of field 'scaleColLabels'.
- *
- * @return the value of field 'ScaleColLabels'.
- */
- public boolean getScaleColLabels(
- ) {
- return this._scaleColLabels;
- }
-
- /**
- * Returns the value of field 'score'.
- *
- * @return the value of field 'Score'.
- */
- public double getScore(
- ) {
- return this._score;
- }
-
- /**
- * Returns the value of field 'scoreOnly'.
- *
- * @return the value of field 'ScoreOnly'.
- */
- public boolean getScoreOnly(
- ) {
- return this._scoreOnly;
- }
-
- /**
- * Returns the value of field 'sequenceRef'.
- *
- * @return the value of field 'SequenceRef'.
- */
- public java.lang.String getSequenceRef(
- ) {
- return this._sequenceRef;
- }
-
- /**
- * Returns the value of field 'showAllColLabels'.
- *
- * @return the value of field 'ShowAllColLabels'.
- */
- public boolean getShowAllColLabels(
- ) {
- return this._showAllColLabels;
- }
-
- /**
- * Returns the value of field 'thresholdLine'.
- *
- * @return the value of field 'ThresholdLine'.
- */
- public jalview.schemabinding.version2.ThresholdLine getThresholdLine(
- ) {
- return this._thresholdLine;
- }
-
- /**
- * Returns the value of field 'visible'.
- *
- * @return the value of field 'Visible'.
- */
- public boolean getVisible(
- ) {
- return this._visible;
- }
-
- /**
- * Method hasAutoCalculated.
- *
- * @return true if at least one AutoCalculated has been added
- */
- public boolean hasAutoCalculated(
- ) {
- return this._has_autoCalculated;
- }
-
- /**
- * Method hasCentreColLabels.
- *
- * @return true if at least one CentreColLabels has been added
- */
- public boolean hasCentreColLabels(
- ) {
- return this._has_centreColLabels;
- }
-
- /**
- * Method hasGraph.
- *
- * @return true if at least one Graph has been added
- */
- public boolean hasGraph(
- ) {
- return this._has_graph;
- }
-
- /**
- * Method hasGraphColour.
- *
- * @return true if at least one GraphColour has been added
- */
- public boolean hasGraphColour(
- ) {
- return this._has_graphColour;
- }
-
- /**
- * Method hasGraphGroup.
- *
- * @return true if at least one GraphGroup has been added
- */
- public boolean hasGraphGroup(
- ) {
- return this._has_graphGroup;
- }
-
- /**
- * Method hasGraphHeight.
- *
- * @return true if at least one GraphHeight has been added
- */
- public boolean hasGraphHeight(
- ) {
- return this._has_graphHeight;
- }
-
- /**
- * Method hasGraphType.
- *
- * @return true if at least one GraphType has been added
- */
- public boolean hasGraphType(
- ) {
- return this._has_graphType;
- }
-
- /**
- * Method hasScaleColLabels.
- *
- * @return true if at least one ScaleColLabels has been added
- */
- public boolean hasScaleColLabels(
- ) {
- return this._has_scaleColLabels;
- }
-
- /**
- * Method hasScore.
- *
- * @return true if at least one Score has been added
- */
- public boolean hasScore(
- ) {
- return this._has_score;
- }
-
- /**
- * Method hasScoreOnly.
- *
- * @return true if at least one ScoreOnly has been added
- */
- public boolean hasScoreOnly(
- ) {
- return this._has_scoreOnly;
- }
-
- /**
- * Method hasShowAllColLabels.
- *
- * @return true if at least one ShowAllColLabels has been added
- */
- public boolean hasShowAllColLabels(
- ) {
- return this._has_showAllColLabels;
- }
-
- /**
- * Method hasVisible.
- *
- * @return true if at least one Visible has been added
- */
- public boolean hasVisible(
- ) {
- return this._has_visible;
- }
-
- /**
- * Returns the value of field 'autoCalculated'. The field
- * 'autoCalculated' has the following description: is an
- * autocalculated annotation row
- *
- * @return the value of field 'AutoCalculated'.
- */
- public boolean isAutoCalculated(
- ) {
- return this._autoCalculated;
- }
-
- /**
- * Returns the value of field 'centreColLabels'.
- *
- * @return the value of field 'CentreColLabels'.
- */
- public boolean isCentreColLabels(
- ) {
- return this._centreColLabels;
- }
-
- /**
- * Returns the value of field 'graph'.
- *
- * @return the value of field 'Graph'.
- */
- public boolean isGraph(
- ) {
- return this._graph;
- }
-
- /**
- * Returns the value of field 'scaleColLabels'.
- *
- * @return the value of field 'ScaleColLabels'.
- */
- public boolean isScaleColLabels(
- ) {
- return this._scaleColLabels;
- }
-
- /**
- * Returns the value of field 'scoreOnly'.
- *
- * @return the value of field 'ScoreOnly'.
- */
- public boolean isScoreOnly(
- ) {
- return this._scoreOnly;
- }
-
- /**
- * Returns the value of field 'showAllColLabels'.
- *
- * @return the value of field 'ShowAllColLabels'.
- */
- public boolean isShowAllColLabels(
- ) {
- return this._showAllColLabels;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- * Returns the value of field 'visible'.
- *
- * @return the value of field 'Visible'.
- */
- public boolean isVisible(
- ) {
- return this._visible;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllAnnotationElement(
- ) {
- this._annotationElementList.clear();
- }
-
- /**
- * Method removeAnnotationElement.
- *
- * @param vAnnotationElement
- * @return true if the object was removed from the collection.
- */
- public boolean removeAnnotationElement(
- final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) {
- boolean removed = _annotationElementList.remove(vAnnotationElement);
- return removed;
- }
-
- /**
- * Method removeAnnotationElementAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.AnnotationElement removeAnnotationElementAt(
- final int index) {
- java.lang.Object obj = this._annotationElementList.remove(index);
- return (jalview.schemabinding.version2.AnnotationElement) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vAnnotationElement
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAnnotationElement(
- final int index,
- final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._annotationElementList.size()) {
- throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
- }
-
- this._annotationElementList.set(index, vAnnotationElement);
- }
-
- /**
- *
- *
- * @param vAnnotationElementArray
- */
- public void setAnnotationElement(
- final jalview.schemabinding.version2.AnnotationElement[] vAnnotationElementArray) {
- //-- copy array
- _annotationElementList.clear();
-
- for (int i = 0; i < vAnnotationElementArray.length; i++) {
- this._annotationElementList.add(vAnnotationElementArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'autoCalculated'. The field
- * 'autoCalculated' has the following description: is an
- * autocalculated annotation row
- *
- * @param autoCalculated the value of field 'autoCalculated'.
- */
- public void setAutoCalculated(
- final boolean autoCalculated) {
- this._autoCalculated = autoCalculated;
- this._has_autoCalculated = true;
- }
-
- /**
- * Sets the value of field 'centreColLabels'.
- *
- * @param centreColLabels the value of field 'centreColLabels'.
- */
- public void setCentreColLabels(
- final boolean centreColLabels) {
- this._centreColLabels = centreColLabels;
- this._has_centreColLabels = true;
- }
-
- /**
- * Sets the value of field 'description'.
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
- }
-
- /**
- * Sets the value of field 'graph'.
- *
- * @param graph the value of field 'graph'.
- */
- public void setGraph(
- final boolean graph) {
- this._graph = graph;
- this._has_graph = true;
- }
-
- /**
- * Sets the value of field 'graphColour'.
- *
- * @param graphColour the value of field 'graphColour'.
- */
- public void setGraphColour(
- final int graphColour) {
- this._graphColour = graphColour;
- this._has_graphColour = true;
- }
-
- /**
- * Sets the value of field 'graphGroup'.
- *
- * @param graphGroup the value of field 'graphGroup'.
- */
- public void setGraphGroup(
- final int graphGroup) {
- this._graphGroup = graphGroup;
- this._has_graphGroup = true;
- }
-
- /**
- * Sets the value of field 'graphHeight'. The field
- * 'graphHeight' has the following description: height in
- * pixels for the graph if this is a graph-type annotation.
- *
- * @param graphHeight the value of field 'graphHeight'.
- */
- public void setGraphHeight(
- final int graphHeight) {
- this._graphHeight = graphHeight;
- this._has_graphHeight = true;
- }
-
- /**
- * Sets the value of field 'graphType'.
- *
- * @param graphType the value of field 'graphType'.
- */
- public void setGraphType(
- final int graphType) {
- this._graphType = graphType;
- this._has_graphType = true;
- }
-
- /**
- * Sets the value of field 'groupRef'.
- *
- * @param groupRef the value of field 'groupRef'.
- */
- public void setGroupRef(
- final java.lang.String groupRef) {
- this._groupRef = groupRef;
- }
-
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'label'.
- *
- * @param label the value of field 'label'.
- */
- public void setLabel(
- final java.lang.String label) {
- this._label = label;
- }
-
- /**
- * Sets the value of field 'scaleColLabels'.
- *
- * @param scaleColLabels the value of field 'scaleColLabels'.
- */
- public void setScaleColLabels(
- final boolean scaleColLabels) {
- this._scaleColLabels = scaleColLabels;
- this._has_scaleColLabels = true;
- }
-
- /**
- * Sets the value of field 'score'.
- *
- * @param score the value of field 'score'.
- */
- public void setScore(
- final double score) {
- this._score = score;
- this._has_score = true;
- }
-
- /**
- * Sets the value of field 'scoreOnly'.
- *
- * @param scoreOnly the value of field 'scoreOnly'.
- */
- public void setScoreOnly(
- final boolean scoreOnly) {
- this._scoreOnly = scoreOnly;
- this._has_scoreOnly = true;
- }
-
- /**
- * Sets the value of field 'sequenceRef'.
- *
- * @param sequenceRef the value of field 'sequenceRef'.
- */
- public void setSequenceRef(
- final java.lang.String sequenceRef) {
- this._sequenceRef = sequenceRef;
- }
-
- /**
- * Sets the value of field 'showAllColLabels'.
- *
- * @param showAllColLabels the value of field 'showAllColLabels'
- */
- public void setShowAllColLabels(
- final boolean showAllColLabels) {
- this._showAllColLabels = showAllColLabels;
- this._has_showAllColLabels = true;
- }
-
- /**
- * Sets the value of field 'thresholdLine'.
- *
- * @param thresholdLine the value of field 'thresholdLine'.
- */
- public void setThresholdLine(
- final jalview.schemabinding.version2.ThresholdLine thresholdLine) {
- this._thresholdLine = thresholdLine;
- }
-
- /**
- * Sets the value of field 'visible'.
- *
- * @param visible the value of field 'visible'.
- */
- public void setVisible(
- final boolean visible) {
- this._visible = visible;
- this._has_visible = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.Annotation
- */
- public static jalview.schemabinding.version2.Annotation unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Annotation) Unmarshaller.unmarshal(jalview.schemabinding.version2.Annotation.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class Annotation implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _graph.
+ */
+ private boolean _graph;
+
+ /**
+ * keeps track of state for field: _graph
+ */
+ private boolean _has_graph;
+
+ /**
+ * Field _graphType.
+ */
+ private int _graphType;
+
+ /**
+ * keeps track of state for field: _graphType
+ */
+ private boolean _has_graphType;
+
+ /**
+ * Field _sequenceRef.
+ */
+ private java.lang.String _sequenceRef;
+
+ /**
+ * Field _groupRef.
+ */
+ private java.lang.String _groupRef;
+
+ /**
+ * Field _graphColour.
+ */
+ private int _graphColour;
+
+ /**
+ * keeps track of state for field: _graphColour
+ */
+ private boolean _has_graphColour;
+
+ /**
+ * Field _graphGroup.
+ */
+ private int _graphGroup;
+
+ /**
+ * keeps track of state for field: _graphGroup
+ */
+ private boolean _has_graphGroup;
+
+ /**
+ * height in pixels for the graph if this is a graph-type annotation.
+ */
+ private int _graphHeight;
+
+ /**
+ * keeps track of state for field: _graphHeight
+ */
+ private boolean _has_graphHeight;
+
+ /**
+ * Field _id.
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _scoreOnly.
+ */
+ private boolean _scoreOnly = false;
+
+ /**
+ * keeps track of state for field: _scoreOnly
+ */
+ private boolean _has_scoreOnly;
+
+ /**
+ * Field _score.
+ */
+ private double _score;
+
+ /**
+ * keeps track of state for field: _score
+ */
+ private boolean _has_score;
+
+ /**
+ * Field _visible.
+ */
+ private boolean _visible;
+
+ /**
+ * keeps track of state for field: _visible
+ */
+ private boolean _has_visible;
+
+ /**
+ * Field _centreColLabels.
+ */
+ private boolean _centreColLabels;
+
+ /**
+ * keeps track of state for field: _centreColLabels
+ */
+ private boolean _has_centreColLabels;
+
+ /**
+ * Field _scaleColLabels.
+ */
+ private boolean _scaleColLabels;
+
+ /**
+ * keeps track of state for field: _scaleColLabels
+ */
+ private boolean _has_scaleColLabels;
+
+ /**
+ * Field _showAllColLabels.
+ */
+ private boolean _showAllColLabels;
+
+ /**
+ * keeps track of state for field: _showAllColLabels
+ */
+ private boolean _has_showAllColLabels;
+
+ /**
+ * is an autocalculated annotation row
+ */
+ private boolean _autoCalculated = false;
+
+ /**
+ * keeps track of state for field: _autoCalculated
+ */
+ private boolean _has_autoCalculated;
+
+ /**
+ * is to be shown below the alignment - introduced in Jalview 2.8 for
+ * visualizing T-COFFEE alignment scores
+ */
+ private boolean _belowAlignment = true;
+
+ /**
+ * keeps track of state for field: _belowAlignment
+ */
+ private boolean _has_belowAlignment;
+
+ /**
+ * Optional string identifier used to group sets of annotation produced by a
+ * particular calculation. Values are opaque strings but have semantic meaning
+ * to Jalview's renderer, data importer and calculation system.
+ */
+ private java.lang.String _calcId;
+
+ /**
+ * Field _annotationElementList.
+ */
+ private java.util.Vector _annotationElementList;
+
+ /**
+ * Field _label.
+ */
+ private java.lang.String _label;
+
+ /**
+ * Field _description.
+ */
+ private java.lang.String _description;
+
+ /**
+ * Field _thresholdLine.
+ */
+ private jalview.schemabinding.version2.ThresholdLine _thresholdLine;
+
+ /**
+ * Field _propertyList.
+ */
+ private java.util.Vector _propertyList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Annotation()
+ {
+ super();
+ this._annotationElementList = new java.util.Vector();
+ this._propertyList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vAnnotationElement
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAnnotationElement(
+ final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._annotationElementList.addElement(vAnnotationElement);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAnnotationElement
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAnnotationElement(
+ final int index,
+ final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._annotationElementList.add(index, vAnnotationElement);
+ }
+
+ /**
+ *
+ *
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(
+ final jalview.schemabinding.version2.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._propertyList.addElement(vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final int index,
+ final jalview.schemabinding.version2.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._propertyList.add(index, vProperty);
+ }
+
+ /**
+ */
+ public void deleteAutoCalculated()
+ {
+ this._has_autoCalculated = false;
+ }
+
+ /**
+ */
+ public void deleteBelowAlignment()
+ {
+ this._has_belowAlignment = false;
+ }
+
+ /**
+ */
+ public void deleteCentreColLabels()
+ {
+ this._has_centreColLabels = false;
+ }
+
+ /**
+ */
+ public void deleteGraph()
+ {
+ this._has_graph = false;
+ }
+
+ /**
+ */
+ public void deleteGraphColour()
+ {
+ this._has_graphColour = false;
+ }
+
+ /**
+ */
+ public void deleteGraphGroup()
+ {
+ this._has_graphGroup = false;
+ }
+
+ /**
+ */
+ public void deleteGraphHeight()
+ {
+ this._has_graphHeight = false;
+ }
+
+ /**
+ */
+ public void deleteGraphType()
+ {
+ this._has_graphType = false;
+ }
+
+ /**
+ */
+ public void deleteScaleColLabels()
+ {
+ this._has_scaleColLabels = false;
+ }
+
+ /**
+ */
+ public void deleteScore()
+ {
+ this._has_score = false;
+ }
+
+ /**
+ */
+ public void deleteScoreOnly()
+ {
+ this._has_scoreOnly = false;
+ }
+
+ /**
+ */
+ public void deleteShowAllColLabels()
+ {
+ this._has_showAllColLabels = false;
+ }
+
+ /**
+ */
+ public void deleteVisible()
+ {
+ this._has_visible = false;
+ }
+
+ /**
+ * Method enumerateAnnotationElement.
+ *
+ * @return an Enumeration over all
+ * jalview.schemabinding.version2.AnnotationElement elements
+ */
+ public java.util.Enumeration enumerateAnnotationElement()
+ {
+ return this._annotationElementList.elements();
+ }
+
+ /**
+ * Method enumerateProperty.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Property
+ * elements
+ */
+ public java.util.Enumeration enumerateProperty()
+ {
+ return this._propertyList.elements();
+ }
+
+ /**
+ * Method getAnnotationElement.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.AnnotationElement
+ * at the given index
+ */
+ public jalview.schemabinding.version2.AnnotationElement getAnnotationElement(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._annotationElementList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "getAnnotationElement: Index value '" + index
+ + "' not in range [0.."
+ + (this._annotationElementList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.AnnotationElement) _annotationElementList
+ .get(index);
+ }
+
+ /**
+ * Method getAnnotationElement.Returns the contents of the collection in an
+ * Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.AnnotationElement[] getAnnotationElement()
+ {
+ jalview.schemabinding.version2.AnnotationElement[] array = new jalview.schemabinding.version2.AnnotationElement[0];
+ return (jalview.schemabinding.version2.AnnotationElement[]) this._annotationElementList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAnnotationElementCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAnnotationElementCount()
+ {
+ return this._annotationElementList.size();
+ }
+
+ /**
+ * Returns the value of field 'autoCalculated'. The field 'autoCalculated' has
+ * the following description: is an autocalculated annotation row
+ *
+ * @return the value of field 'AutoCalculated'.
+ */
+ public boolean getAutoCalculated()
+ {
+ return this._autoCalculated;
+ }
+
+ /**
+ * Returns the value of field 'belowAlignment'. The field 'belowAlignment' has
+ * the following description: is to be shown below the alignment - introduced
+ * in Jalview 2.8 for visualizing T-COFFEE alignment scores
+ *
+ * @return the value of field 'BelowAlignment'.
+ */
+ public boolean getBelowAlignment()
+ {
+ return this._belowAlignment;
+ }
+
+ /**
+ * Returns the value of field 'calcId'. The field 'calcId' has the following
+ * description: Optional string identifier used to group sets of annotation
+ * produced by a particular calculation. Values are opaque strings but have
+ * semantic meaning to Jalview's renderer, data importer and calculation
+ * system.
+ *
+ * @return the value of field 'CalcId'.
+ */
+ public java.lang.String getCalcId()
+ {
+ return this._calcId;
+ }
+
+ /**
+ * Returns the value of field 'centreColLabels'.
+ *
+ * @return the value of field 'CentreColLabels'.
+ */
+ public boolean getCentreColLabels()
+ {
+ return this._centreColLabels;
+ }
+
+ /**
+ * Returns the value of field 'description'.
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription()
+ {
+ return this._description;
+ }
+
+ /**
+ * Returns the value of field 'graph'.
+ *
+ * @return the value of field 'Graph'.
+ */
+ public boolean getGraph()
+ {
+ return this._graph;
+ }
+
+ /**
+ * Returns the value of field 'graphColour'.
+ *
+ * @return the value of field 'GraphColour'.
+ */
+ public int getGraphColour()
+ {
+ return this._graphColour;
+ }
+
+ /**
+ * Returns the value of field 'graphGroup'.
+ *
+ * @return the value of field 'GraphGroup'.
+ */
+ public int getGraphGroup()
+ {
+ return this._graphGroup;
+ }
+
+ /**
+ * Returns the value of field 'graphHeight'. The field 'graphHeight' has the
+ * following description: height in pixels for the graph if this is a
+ * graph-type annotation.
+ *
+ * @return the value of field 'GraphHeight'.
+ */
+ public int getGraphHeight()
+ {
+ return this._graphHeight;
+ }
+
+ /**
+ * Returns the value of field 'graphType'.
+ *
+ * @return the value of field 'GraphType'.
+ */
+ public int getGraphType()
+ {
+ return this._graphType;
+ }
+
+ /**
+ * Returns the value of field 'groupRef'.
+ *
+ * @return the value of field 'GroupRef'.
+ */
+ public java.lang.String getGroupRef()
+ {
+ return this._groupRef;
+ }
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'label'.
+ *
+ * @return the value of field 'Label'.
+ */
+ public java.lang.String getLabel()
+ {
+ return this._label;
+ }
+
+ /**
+ * Method getProperty.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Property at the
+ * given index
+ */
+ public jalview.schemabinding.version2.Property getProperty(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size())
+ {
+ throw new IndexOutOfBoundsException("getProperty: Index value '"
+ + index + "' not in range [0.."
+ + (this._propertyList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.Property) _propertyList
+ .get(index);
+ }
+
+ /**
+ * Method getProperty.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Property[] getProperty()
+ {
+ jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0];
+ return (jalview.schemabinding.version2.Property[]) this._propertyList
+ .toArray(array);
+ }
+
+ /**
+ * Method getPropertyCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPropertyCount()
+ {
+ return this._propertyList.size();
+ }
+
+ /**
+ * Returns the value of field 'scaleColLabels'.
+ *
+ * @return the value of field 'ScaleColLabels'.
+ */
+ public boolean getScaleColLabels()
+ {
+ return this._scaleColLabels;
+ }
+
+ /**
+ * Returns the value of field 'score'.
+ *
+ * @return the value of field 'Score'.
+ */
+ public double getScore()
+ {
+ return this._score;
+ }
+
+ /**
+ * Returns the value of field 'scoreOnly'.
+ *
+ * @return the value of field 'ScoreOnly'.
+ */
+ public boolean getScoreOnly()
+ {
+ return this._scoreOnly;
+ }
+
+ /**
+ * Returns the value of field 'sequenceRef'.
+ *
+ * @return the value of field 'SequenceRef'.
+ */
+ public java.lang.String getSequenceRef()
+ {
+ return this._sequenceRef;
+ }
+
+ /**
+ * Returns the value of field 'showAllColLabels'.
+ *
+ * @return the value of field 'ShowAllColLabels'.
+ */
+ public boolean getShowAllColLabels()
+ {
+ return this._showAllColLabels;
+ }
+
+ /**
+ * Returns the value of field 'thresholdLine'.
+ *
+ * @return the value of field 'ThresholdLine'.
+ */
+ public jalview.schemabinding.version2.ThresholdLine getThresholdLine()
+ {
+ return this._thresholdLine;
+ }
+
+ /**
+ * Returns the value of field 'visible'.
+ *
+ * @return the value of field 'Visible'.
+ */
+ public boolean getVisible()
+ {
+ return this._visible;
+ }
+
+ /**
+ * Method hasAutoCalculated.
+ *
+ * @return true if at least one AutoCalculated has been added
+ */
+ public boolean hasAutoCalculated()
+ {
+ return this._has_autoCalculated;
+ }
+
+ /**
+ * Method hasBelowAlignment.
+ *
+ * @return true if at least one BelowAlignment has been added
+ */
+ public boolean hasBelowAlignment()
+ {
+ return this._has_belowAlignment;
+ }
+
+ /**
+ * Method hasCentreColLabels.
+ *
+ * @return true if at least one CentreColLabels has been added
+ */
+ public boolean hasCentreColLabels()
+ {
+ return this._has_centreColLabels;
+ }
+
+ /**
+ * Method hasGraph.
+ *
+ * @return true if at least one Graph has been added
+ */
+ public boolean hasGraph()
+ {
+ return this._has_graph;
+ }
+
+ /**
+ * Method hasGraphColour.
+ *
+ * @return true if at least one GraphColour has been added
+ */
+ public boolean hasGraphColour()
+ {
+ return this._has_graphColour;
+ }
+
+ /**
+ * Method hasGraphGroup.
+ *
+ * @return true if at least one GraphGroup has been added
+ */
+ public boolean hasGraphGroup()
+ {
+ return this._has_graphGroup;
+ }
+
+ /**
+ * Method hasGraphHeight.
+ *
+ * @return true if at least one GraphHeight has been added
+ */
+ public boolean hasGraphHeight()
+ {
+ return this._has_graphHeight;
+ }
+
+ /**
+ * Method hasGraphType.
+ *
+ * @return true if at least one GraphType has been added
+ */
+ public boolean hasGraphType()
+ {
+ return this._has_graphType;
+ }
+
+ /**
+ * Method hasScaleColLabels.
+ *
+ * @return true if at least one ScaleColLabels has been added
+ */
+ public boolean hasScaleColLabels()
+ {
+ return this._has_scaleColLabels;
+ }
+
+ /**
+ * Method hasScore.
+ *
+ * @return true if at least one Score has been added
+ */
+ public boolean hasScore()
+ {
+ return this._has_score;
+ }
+
+ /**
+ * Method hasScoreOnly.
+ *
+ * @return true if at least one ScoreOnly has been added
+ */
+ public boolean hasScoreOnly()
+ {
+ return this._has_scoreOnly;
+ }
+
+ /**
+ * Method hasShowAllColLabels.
+ *
+ * @return true if at least one ShowAllColLabels has been added
+ */
+ public boolean hasShowAllColLabels()
+ {
+ return this._has_showAllColLabels;
+ }
+
+ /**
+ * Method hasVisible.
+ *
+ * @return true if at least one Visible has been added
+ */
+ public boolean hasVisible()
+ {
+ return this._has_visible;
+ }
+
+ /**
+ * Returns the value of field 'autoCalculated'. The field 'autoCalculated' has
+ * the following description: is an autocalculated annotation row
+ *
+ * @return the value of field 'AutoCalculated'.
+ */
+ public boolean isAutoCalculated()
+ {
+ return this._autoCalculated;
+ }
+
+ /**
+ * Returns the value of field 'belowAlignment'. The field 'belowAlignment' has
+ * the following description: is to be shown below the alignment - introduced
+ * in Jalview 2.8 for visualizing T-COFFEE alignment scores
+ *
+ * @return the value of field 'BelowAlignment'.
+ */
+ public boolean isBelowAlignment()
+ {
+ return this._belowAlignment;
+ }
+
+ /**
+ * Returns the value of field 'centreColLabels'.
+ *
+ * @return the value of field 'CentreColLabels'.
+ */
+ public boolean isCentreColLabels()
+ {
+ return this._centreColLabels;
+ }
+
+ /**
+ * Returns the value of field 'graph'.
+ *
+ * @return the value of field 'Graph'.
+ */
+ public boolean isGraph()
+ {
+ return this._graph;
+ }
+
+ /**
+ * Returns the value of field 'scaleColLabels'.
+ *
+ * @return the value of field 'ScaleColLabels'.
+ */
+ public boolean isScaleColLabels()
+ {
+ return this._scaleColLabels;
+ }
+
+ /**
+ * Returns the value of field 'scoreOnly'.
+ *
+ * @return the value of field 'ScoreOnly'.
+ */
+ public boolean isScoreOnly()
+ {
+ return this._scoreOnly;
+ }
+
+ /**
+ * Returns the value of field 'showAllColLabels'.
+ *
+ * @return the value of field 'ShowAllColLabels'.
+ */
+ public boolean isShowAllColLabels()
+ {
+ return this._showAllColLabels;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the value of field 'visible'.
+ *
+ * @return the value of field 'Visible'.
+ */
+ public boolean isVisible()
+ {
+ return this._visible;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllAnnotationElement()
+ {
+ this._annotationElementList.clear();
+ }
+
+ /**
+ */
+ public void removeAllProperty()
+ {
+ this._propertyList.clear();
+ }
+
+ /**
+ * Method removeAnnotationElement.
+ *
+ * @param vAnnotationElement
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAnnotationElement(
+ final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
+ {
+ boolean removed = _annotationElementList.remove(vAnnotationElement);
+ return removed;
+ }
+
+ /**
+ * Method removeAnnotationElementAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.AnnotationElement removeAnnotationElementAt(
+ final int index)
+ {
+ java.lang.Object obj = this._annotationElementList.remove(index);
+ return (jalview.schemabinding.version2.AnnotationElement) obj;
+ }
+
+ /**
+ * Method removeProperty.
+ *
+ * @param vProperty
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeProperty(
+ final jalview.schemabinding.version2.Property vProperty)
+ {
+ boolean removed = _propertyList.remove(vProperty);
+ return removed;
+ }
+
+ /**
+ * Method removePropertyAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Property removePropertyAt(
+ final int index)
+ {
+ java.lang.Object obj = this._propertyList.remove(index);
+ return (jalview.schemabinding.version2.Property) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAnnotationElement
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAnnotationElement(
+ final int index,
+ final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._annotationElementList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "setAnnotationElement: Index value '" + index
+ + "' not in range [0.."
+ + (this._annotationElementList.size() - 1) + "]");
+ }
+
+ this._annotationElementList.set(index, vAnnotationElement);
+ }
+
+ /**
+ *
+ *
+ * @param vAnnotationElementArray
+ */
+ public void setAnnotationElement(
+ final jalview.schemabinding.version2.AnnotationElement[] vAnnotationElementArray)
+ {
+ // -- copy array
+ _annotationElementList.clear();
+
+ for (int i = 0; i < vAnnotationElementArray.length; i++)
+ {
+ this._annotationElementList.add(vAnnotationElementArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'autoCalculated'. The field 'autoCalculated' has
+ * the following description: is an autocalculated annotation row
+ *
+ * @param autoCalculated
+ * the value of field 'autoCalculated'.
+ */
+ public void setAutoCalculated(final boolean autoCalculated)
+ {
+ this._autoCalculated = autoCalculated;
+ this._has_autoCalculated = true;
+ }
+
+ /**
+ * Sets the value of field 'belowAlignment'. The field 'belowAlignment' has
+ * the following description: is to be shown below the alignment - introduced
+ * in Jalview 2.8 for visualizing T-COFFEE alignment scores
+ *
+ * @param belowAlignment
+ * the value of field 'belowAlignment'.
+ */
+ public void setBelowAlignment(final boolean belowAlignment)
+ {
+ this._belowAlignment = belowAlignment;
+ this._has_belowAlignment = true;
+ }
+
+ /**
+ * Sets the value of field 'calcId'. The field 'calcId' has the following
+ * description: Optional string identifier used to group sets of annotation
+ * produced by a particular calculation. Values are opaque strings but have
+ * semantic meaning to Jalview's renderer, data importer and calculation
+ * system.
+ *
+ * @param calcId
+ * the value of field 'calcId'.
+ */
+ public void setCalcId(final java.lang.String calcId)
+ {
+ this._calcId = calcId;
+ }
+
+ /**
+ * Sets the value of field 'centreColLabels'.
+ *
+ * @param centreColLabels
+ * the value of field 'centreColLabels'.
+ */
+ public void setCentreColLabels(final boolean centreColLabels)
+ {
+ this._centreColLabels = centreColLabels;
+ this._has_centreColLabels = true;
+ }
+
+ /**
+ * Sets the value of field 'description'.
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description)
+ {
+ this._description = description;
+ }
+
+ /**
+ * Sets the value of field 'graph'.
+ *
+ * @param graph
+ * the value of field 'graph'.
+ */
+ public void setGraph(final boolean graph)
+ {
+ this._graph = graph;
+ this._has_graph = true;
+ }
+
+ /**
+ * Sets the value of field 'graphColour'.
+ *
+ * @param graphColour
+ * the value of field 'graphColour'.
+ */
+ public void setGraphColour(final int graphColour)
+ {
+ this._graphColour = graphColour;
+ this._has_graphColour = true;
+ }
+
+ /**
+ * Sets the value of field 'graphGroup'.
+ *
+ * @param graphGroup
+ * the value of field 'graphGroup'.
+ */
+ public void setGraphGroup(final int graphGroup)
+ {
+ this._graphGroup = graphGroup;
+ this._has_graphGroup = true;
+ }
+
+ /**
+ * Sets the value of field 'graphHeight'. The field 'graphHeight' has the
+ * following description: height in pixels for the graph if this is a
+ * graph-type annotation.
+ *
+ * @param graphHeight
+ * the value of field 'graphHeight'.
+ */
+ public void setGraphHeight(final int graphHeight)
+ {
+ this._graphHeight = graphHeight;
+ this._has_graphHeight = true;
+ }
+
+ /**
+ * Sets the value of field 'graphType'.
+ *
+ * @param graphType
+ * the value of field 'graphType'.
+ */
+ public void setGraphType(final int graphType)
+ {
+ this._graphType = graphType;
+ this._has_graphType = true;
+ }
+
+ /**
+ * Sets the value of field 'groupRef'.
+ *
+ * @param groupRef
+ * the value of field 'groupRef'.
+ */
+ public void setGroupRef(final java.lang.String groupRef)
+ {
+ this._groupRef = groupRef;
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'label'.
+ *
+ * @param label
+ * the value of field 'label'.
+ */
+ public void setLabel(final java.lang.String label)
+ {
+ this._label = label;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setProperty(final int index,
+ final jalview.schemabinding.version2.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size())
+ {
+ throw new IndexOutOfBoundsException("setProperty: Index value '"
+ + index + "' not in range [0.."
+ + (this._propertyList.size() - 1) + "]");
+ }
+
+ this._propertyList.set(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vPropertyArray
+ */
+ public void setProperty(
+ final jalview.schemabinding.version2.Property[] vPropertyArray)
+ {
+ // -- copy array
+ _propertyList.clear();
+
+ for (int i = 0; i < vPropertyArray.length; i++)
+ {
+ this._propertyList.add(vPropertyArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'scaleColLabels'.
+ *
+ * @param scaleColLabels
+ * the value of field 'scaleColLabels'.
+ */
+ public void setScaleColLabels(final boolean scaleColLabels)
+ {
+ this._scaleColLabels = scaleColLabels;
+ this._has_scaleColLabels = true;
+ }
+
+ /**
+ * Sets the value of field 'score'.
+ *
+ * @param score
+ * the value of field 'score'.
+ */
+ public void setScore(final double score)
+ {
+ this._score = score;
+ this._has_score = true;
+ }
+
+ /**
+ * Sets the value of field 'scoreOnly'.
+ *
+ * @param scoreOnly
+ * the value of field 'scoreOnly'.
+ */
+ public void setScoreOnly(final boolean scoreOnly)
+ {
+ this._scoreOnly = scoreOnly;
+ this._has_scoreOnly = true;
+ }
+
+ /**
+ * Sets the value of field 'sequenceRef'.
+ *
+ * @param sequenceRef
+ * the value of field 'sequenceRef'.
+ */
+ public void setSequenceRef(final java.lang.String sequenceRef)
+ {
+ this._sequenceRef = sequenceRef;
+ }
+
+ /**
+ * Sets the value of field 'showAllColLabels'.
+ *
+ * @param showAllColLabels
+ * the value of field 'showAllColLabels'
+ */
+ public void setShowAllColLabels(final boolean showAllColLabels)
+ {
+ this._showAllColLabels = showAllColLabels;
+ this._has_showAllColLabels = true;
+ }
+
+ /**
+ * Sets the value of field 'thresholdLine'.
+ *
+ * @param thresholdLine
+ * the value of field 'thresholdLine'.
+ */
+ public void setThresholdLine(
+ final jalview.schemabinding.version2.ThresholdLine thresholdLine)
+ {
+ this._thresholdLine = thresholdLine;
+ }
+
+ /**
+ * Sets the value of field 'visible'.
+ *
+ * @param visible
+ * the value of field 'visible'.
+ */
+ public void setVisible(final boolean visible)
+ {
+ this._visible = visible;
+ this._has_visible = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Annotation
+ */
+ public static jalview.schemabinding.version2.Annotation unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Annotation) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.Annotation.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/AnnotationColourScheme.java b/src/jalview/schemabinding/version2/AnnotationColourScheme.java
new file mode 100644
index 0000000..2f76e76
--- /dev/null
+++ b/src/jalview/schemabinding/version2/AnnotationColourScheme.java
@@ -0,0 +1,497 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class AnnotationColourScheme.
+ *
+ * @version $Revision$ $Date$
+ */
+public class AnnotationColourScheme implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _aboveThreshold.
+ */
+ private int _aboveThreshold;
+
+ /**
+ * keeps track of state for field: _aboveThreshold
+ */
+ private boolean _has_aboveThreshold;
+
+ /**
+ * Field _annotation.
+ */
+ private java.lang.String _annotation;
+
+ /**
+ * Field _minColour.
+ */
+ private int _minColour;
+
+ /**
+ * keeps track of state for field: _minColour
+ */
+ private boolean _has_minColour;
+
+ /**
+ * Field _maxColour.
+ */
+ private int _maxColour;
+
+ /**
+ * keeps track of state for field: _maxColour
+ */
+ private boolean _has_maxColour;
+
+ /**
+ * Field _colourScheme.
+ */
+ private java.lang.String _colourScheme;
+
+ /**
+ * Field _threshold.
+ */
+ private float _threshold;
+
+ /**
+ * keeps track of state for field: _threshold
+ */
+ private boolean _has_threshold;
+
+ /**
+ * Field _perSequence.
+ */
+ private boolean _perSequence;
+
+ /**
+ * keeps track of state for field: _perSequence
+ */
+ private boolean _has_perSequence;
+
+ /**
+ * Field _predefinedColours.
+ */
+ private boolean _predefinedColours;
+
+ /**
+ * keeps track of state for field: _predefinedColours
+ */
+ private boolean _has_predefinedColours;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AnnotationColourScheme()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteAboveThreshold()
+ {
+ this._has_aboveThreshold = false;
+ }
+
+ /**
+ */
+ public void deleteMaxColour()
+ {
+ this._has_maxColour = false;
+ }
+
+ /**
+ */
+ public void deleteMinColour()
+ {
+ this._has_minColour = false;
+ }
+
+ /**
+ */
+ public void deletePerSequence()
+ {
+ this._has_perSequence = false;
+ }
+
+ /**
+ */
+ public void deletePredefinedColours()
+ {
+ this._has_predefinedColours = false;
+ }
+
+ /**
+ */
+ public void deleteThreshold()
+ {
+ this._has_threshold = false;
+ }
+
+ /**
+ * Returns the value of field 'aboveThreshold'.
+ *
+ * @return the value of field 'AboveThreshold'.
+ */
+ public int getAboveThreshold()
+ {
+ return this._aboveThreshold;
+ }
+
+ /**
+ * Returns the value of field 'annotation'.
+ *
+ * @return the value of field 'Annotation'.
+ */
+ public java.lang.String getAnnotation()
+ {
+ return this._annotation;
+ }
+
+ /**
+ * Returns the value of field 'colourScheme'.
+ *
+ * @return the value of field 'ColourScheme'.
+ */
+ public java.lang.String getColourScheme()
+ {
+ return this._colourScheme;
+ }
+
+ /**
+ * Returns the value of field 'maxColour'.
+ *
+ * @return the value of field 'MaxColour'.
+ */
+ public int getMaxColour()
+ {
+ return this._maxColour;
+ }
+
+ /**
+ * Returns the value of field 'minColour'.
+ *
+ * @return the value of field 'MinColour'.
+ */
+ public int getMinColour()
+ {
+ return this._minColour;
+ }
+
+ /**
+ * Returns the value of field 'perSequence'.
+ *
+ * @return the value of field 'PerSequence'.
+ */
+ public boolean getPerSequence()
+ {
+ return this._perSequence;
+ }
+
+ /**
+ * Returns the value of field 'predefinedColours'.
+ *
+ * @return the value of field 'PredefinedColours'.
+ */
+ public boolean getPredefinedColours()
+ {
+ return this._predefinedColours;
+ }
+
+ /**
+ * Returns the value of field 'threshold'.
+ *
+ * @return the value of field 'Threshold'.
+ */
+ public float getThreshold()
+ {
+ return this._threshold;
+ }
+
+ /**
+ * Method hasAboveThreshold.
+ *
+ * @return true if at least one AboveThreshold has been added
+ */
+ public boolean hasAboveThreshold()
+ {
+ return this._has_aboveThreshold;
+ }
+
+ /**
+ * Method hasMaxColour.
+ *
+ * @return true if at least one MaxColour has been added
+ */
+ public boolean hasMaxColour()
+ {
+ return this._has_maxColour;
+ }
+
+ /**
+ * Method hasMinColour.
+ *
+ * @return true if at least one MinColour has been added
+ */
+ public boolean hasMinColour()
+ {
+ return this._has_minColour;
+ }
+
+ /**
+ * Method hasPerSequence.
+ *
+ * @return true if at least one PerSequence has been added
+ */
+ public boolean hasPerSequence()
+ {
+ return this._has_perSequence;
+ }
+
+ /**
+ * Method hasPredefinedColours.
+ *
+ * @return true if at least one PredefinedColours has been added
+ */
+ public boolean hasPredefinedColours()
+ {
+ return this._has_predefinedColours;
+ }
+
+ /**
+ * Method hasThreshold.
+ *
+ * @return true if at least one Threshold has been added
+ */
+ public boolean hasThreshold()
+ {
+ return this._has_threshold;
+ }
+
+ /**
+ * Returns the value of field 'perSequence'.
+ *
+ * @return the value of field 'PerSequence'.
+ */
+ public boolean isPerSequence()
+ {
+ return this._perSequence;
+ }
+
+ /**
+ * Returns the value of field 'predefinedColours'.
+ *
+ * @return the value of field 'PredefinedColours'.
+ */
+ public boolean isPredefinedColours()
+ {
+ return this._predefinedColours;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'aboveThreshold'.
+ *
+ * @param aboveThreshold
+ * the value of field 'aboveThreshold'.
+ */
+ public void setAboveThreshold(final int aboveThreshold)
+ {
+ this._aboveThreshold = aboveThreshold;
+ this._has_aboveThreshold = true;
+ }
+
+ /**
+ * Sets the value of field 'annotation'.
+ *
+ * @param annotation
+ * the value of field 'annotation'.
+ */
+ public void setAnnotation(final java.lang.String annotation)
+ {
+ this._annotation = annotation;
+ }
+
+ /**
+ * Sets the value of field 'colourScheme'.
+ *
+ * @param colourScheme
+ * the value of field 'colourScheme'.
+ */
+ public void setColourScheme(final java.lang.String colourScheme)
+ {
+ this._colourScheme = colourScheme;
+ }
+
+ /**
+ * Sets the value of field 'maxColour'.
+ *
+ * @param maxColour
+ * the value of field 'maxColour'.
+ */
+ public void setMaxColour(final int maxColour)
+ {
+ this._maxColour = maxColour;
+ this._has_maxColour = true;
+ }
+
+ /**
+ * Sets the value of field 'minColour'.
+ *
+ * @param minColour
+ * the value of field 'minColour'.
+ */
+ public void setMinColour(final int minColour)
+ {
+ this._minColour = minColour;
+ this._has_minColour = true;
+ }
+
+ /**
+ * Sets the value of field 'perSequence'.
+ *
+ * @param perSequence
+ * the value of field 'perSequence'.
+ */
+ public void setPerSequence(final boolean perSequence)
+ {
+ this._perSequence = perSequence;
+ this._has_perSequence = true;
+ }
+
+ /**
+ * Sets the value of field 'predefinedColours'.
+ *
+ * @param predefinedColours
+ * the value of field 'predefinedColours'.
+ */
+ public void setPredefinedColours(final boolean predefinedColours)
+ {
+ this._predefinedColours = predefinedColours;
+ this._has_predefinedColours = true;
+ }
+
+ /**
+ * Sets the value of field 'threshold'.
+ *
+ * @param threshold
+ * the value of field 'threshold'.
+ */
+ public void setThreshold(final float threshold)
+ {
+ this._threshold = threshold;
+ this._has_threshold = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled
+ * jalview.schemabinding.version2.AnnotationColourScheme
+ */
+ public static jalview.schemabinding.version2.AnnotationColourScheme unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.AnnotationColourScheme) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.AnnotationColourScheme.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
+
+}
diff --git a/src/jalview/schemabinding/version2/AnnotationColours.java b/src/jalview/schemabinding/version2/AnnotationColours.java
index 223c652..350ebce 100644
--- a/src/jalview/schemabinding/version2/AnnotationColours.java
+++ b/src/jalview/schemabinding/version2/AnnotationColours.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,344 +19,110 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class AnnotationColours implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _aboveThreshold.
- */
- private int _aboveThreshold;
-
- /**
- * keeps track of state for field: _aboveThreshold
- */
- private boolean _has_aboveThreshold;
-
- /**
- * Field _annotation.
- */
- private java.lang.String _annotation;
-
- /**
- * Field _minColour.
- */
- private int _minColour;
-
- /**
- * keeps track of state for field: _minColour
- */
- private boolean _has_minColour;
-
- /**
- * Field _maxColour.
- */
- private int _maxColour;
-
- /**
- * keeps track of state for field: _maxColour
- */
- private boolean _has_maxColour;
-
- /**
- * Field _colourScheme.
- */
- private java.lang.String _colourScheme;
-
- /**
- * Field _threshold.
- */
- private float _threshold;
-
- /**
- * keeps track of state for field: _threshold
- */
- private boolean _has_threshold;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AnnotationColours() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteAboveThreshold(
- ) {
- this._has_aboveThreshold= false;
- }
-
- /**
- */
- public void deleteMaxColour(
- ) {
- this._has_maxColour= false;
- }
-
- /**
- */
- public void deleteMinColour(
- ) {
- this._has_minColour= false;
- }
-
- /**
- */
- public void deleteThreshold(
- ) {
- this._has_threshold= false;
- }
-
- /**
- * Returns the value of field 'aboveThreshold'.
- *
- * @return the value of field 'AboveThreshold'.
- */
- public int getAboveThreshold(
- ) {
- return this._aboveThreshold;
- }
-
- /**
- * Returns the value of field 'annotation'.
- *
- * @return the value of field 'Annotation'.
- */
- public java.lang.String getAnnotation(
- ) {
- return this._annotation;
- }
-
- /**
- * Returns the value of field 'colourScheme'.
- *
- * @return the value of field 'ColourScheme'.
- */
- public java.lang.String getColourScheme(
- ) {
- return this._colourScheme;
- }
-
- /**
- * Returns the value of field 'maxColour'.
- *
- * @return the value of field 'MaxColour'.
- */
- public int getMaxColour(
- ) {
- return this._maxColour;
- }
-
- /**
- * Returns the value of field 'minColour'.
- *
- * @return the value of field 'MinColour'.
- */
- public int getMinColour(
- ) {
- return this._minColour;
- }
-
- /**
- * Returns the value of field 'threshold'.
- *
- * @return the value of field 'Threshold'.
- */
- public float getThreshold(
- ) {
- return this._threshold;
- }
-
- /**
- * Method hasAboveThreshold.
- *
- * @return true if at least one AboveThreshold has been added
- */
- public boolean hasAboveThreshold(
- ) {
- return this._has_aboveThreshold;
- }
-
- /**
- * Method hasMaxColour.
- *
- * @return true if at least one MaxColour has been added
- */
- public boolean hasMaxColour(
- ) {
- return this._has_maxColour;
- }
-
- /**
- * Method hasMinColour.
- *
- * @return true if at least one MinColour has been added
- */
- public boolean hasMinColour(
- ) {
- return this._has_minColour;
- }
-
- /**
- * Method hasThreshold.
- *
- * @return true if at least one Threshold has been added
- */
- public boolean hasThreshold(
- ) {
- return this._has_threshold;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'aboveThreshold'.
- *
- * @param aboveThreshold the value of field 'aboveThreshold'.
- */
- public void setAboveThreshold(
- final int aboveThreshold) {
- this._aboveThreshold = aboveThreshold;
- this._has_aboveThreshold = true;
- }
-
- /**
- * Sets the value of field 'annotation'.
- *
- * @param annotation the value of field 'annotation'.
- */
- public void setAnnotation(
- final java.lang.String annotation) {
- this._annotation = annotation;
- }
-
- /**
- * Sets the value of field 'colourScheme'.
- *
- * @param colourScheme the value of field 'colourScheme'.
- */
- public void setColourScheme(
- final java.lang.String colourScheme) {
- this._colourScheme = colourScheme;
- }
-
- /**
- * Sets the value of field 'maxColour'.
- *
- * @param maxColour the value of field 'maxColour'.
- */
- public void setMaxColour(
- final int maxColour) {
- this._maxColour = maxColour;
- this._has_maxColour = true;
- }
-
- /**
- * Sets the value of field 'minColour'.
- *
- * @param minColour the value of field 'minColour'.
- */
- public void setMinColour(
- final int minColour) {
- this._minColour = minColour;
- this._has_minColour = true;
- }
-
- /**
- * Sets the value of field 'threshold'.
- *
- * @param threshold the value of field 'threshold'.
- */
- public void setThreshold(
- final float threshold) {
- this._threshold = threshold;
- this._has_threshold = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.AnnotationColours
- */
- public static jalview.schemabinding.version2.AnnotationColours unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.AnnotationColours) Unmarshaller.unmarshal(jalview.schemabinding.version2.AnnotationColours.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class AnnotationColours extends AnnotationColourScheme implements
+ java.io.Serializable
+{
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AnnotationColours()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled
+ * jalview.schemabinding.version2.AnnotationColourScheme
+ */
+ public static jalview.schemabinding.version2.AnnotationColourScheme unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.AnnotationColourScheme) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.AnnotationColours.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/AnnotationElement.java b/src/jalview/schemabinding/version2/AnnotationElement.java
index 7e17396..2a765ea 100644
--- a/src/jalview/schemabinding/version2/AnnotationElement.java
+++ b/src/jalview/schemabinding/version2/AnnotationElement.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,322 +19,338 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class AnnotationElement implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _position.
- */
- private int _position;
-
- /**
- * keeps track of state for field: _position
- */
- private boolean _has_position;
-
- /**
- * Field _colour.
- */
- private int _colour;
-
- /**
- * keeps track of state for field: _colour
- */
- private boolean _has_colour;
-
- /**
- * Field _displayCharacter.
- */
- private java.lang.String _displayCharacter;
-
- /**
- * Field _description.
- */
- private java.lang.String _description;
-
- /**
- * Field _secondaryStructure.
- */
- private java.lang.String _secondaryStructure;
-
- /**
- * Field _value.
- */
- private float _value;
-
- /**
- * keeps track of state for field: _value
- */
- private boolean _has_value;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AnnotationElement() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteColour(
- ) {
- this._has_colour= false;
- }
-
- /**
- */
- public void deletePosition(
- ) {
- this._has_position= false;
- }
-
- /**
- */
- public void deleteValue(
- ) {
- this._has_value= false;
- }
-
- /**
- * Returns the value of field 'colour'.
- *
- * @return the value of field 'Colour'.
- */
- public int getColour(
- ) {
- return this._colour;
- }
-
- /**
- * Returns the value of field 'description'.
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Returns the value of field 'displayCharacter'.
- *
- * @return the value of field 'DisplayCharacter'.
- */
- public java.lang.String getDisplayCharacter(
- ) {
- return this._displayCharacter;
- }
-
- /**
- * Returns the value of field 'position'.
- *
- * @return the value of field 'Position'.
- */
- public int getPosition(
- ) {
- return this._position;
- }
-
- /**
- * Returns the value of field 'secondaryStructure'.
- *
- * @return the value of field 'SecondaryStructure'.
- */
- public java.lang.String getSecondaryStructure(
- ) {
- return this._secondaryStructure;
- }
-
- /**
- * Returns the value of field 'value'.
- *
- * @return the value of field 'Value'.
- */
- public float getValue(
- ) {
- return this._value;
- }
-
- /**
- * Method hasColour.
- *
- * @return true if at least one Colour has been added
- */
- public boolean hasColour(
- ) {
- return this._has_colour;
- }
-
- /**
- * Method hasPosition.
- *
- * @return true if at least one Position has been added
- */
- public boolean hasPosition(
- ) {
- return this._has_position;
- }
-
- /**
- * Method hasValue.
- *
- * @return true if at least one Value has been added
- */
- public boolean hasValue(
- ) {
- return this._has_value;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'colour'.
- *
- * @param colour the value of field 'colour'.
- */
- public void setColour(
- final int colour) {
- this._colour = colour;
- this._has_colour = true;
- }
-
- /**
- * Sets the value of field 'description'.
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
- }
-
- /**
- * Sets the value of field 'displayCharacter'.
- *
- * @param displayCharacter the value of field 'displayCharacter'
- */
- public void setDisplayCharacter(
- final java.lang.String displayCharacter) {
- this._displayCharacter = displayCharacter;
- }
-
- /**
- * Sets the value of field 'position'.
- *
- * @param position the value of field 'position'.
- */
- public void setPosition(
- final int position) {
- this._position = position;
- this._has_position = true;
- }
-
- /**
- * Sets the value of field 'secondaryStructure'.
- *
- * @param secondaryStructure the value of field
- * 'secondaryStructure'.
- */
- public void setSecondaryStructure(
- final java.lang.String secondaryStructure) {
- this._secondaryStructure = secondaryStructure;
- }
-
- /**
- * Sets the value of field 'value'.
- *
- * @param value the value of field 'value'.
- */
- public void setValue(
- final float value) {
- this._value = value;
- this._has_value = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.AnnotationElement
- */
- public static jalview.schemabinding.version2.AnnotationElement unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.AnnotationElement) Unmarshaller.unmarshal(jalview.schemabinding.version2.AnnotationElement.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class AnnotationElement implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _position.
+ */
+ private int _position;
+
+ /**
+ * keeps track of state for field: _position
+ */
+ private boolean _has_position;
+
+ /**
+ * Field _colour.
+ */
+ private int _colour;
+
+ /**
+ * keeps track of state for field: _colour
+ */
+ private boolean _has_colour;
+
+ /**
+ * Field _displayCharacter.
+ */
+ private java.lang.String _displayCharacter;
+
+ /**
+ * Field _description.
+ */
+ private java.lang.String _description;
+
+ /**
+ * Field _secondaryStructure.
+ */
+ private java.lang.String _secondaryStructure;
+
+ /**
+ * Field _value.
+ */
+ private float _value;
+
+ /**
+ * keeps track of state for field: _value
+ */
+ private boolean _has_value;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AnnotationElement()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteColour()
+ {
+ this._has_colour = false;
+ }
+
+ /**
+ */
+ public void deletePosition()
+ {
+ this._has_position = false;
+ }
+
+ /**
+ */
+ public void deleteValue()
+ {
+ this._has_value = false;
+ }
+
+ /**
+ * Returns the value of field 'colour'.
+ *
+ * @return the value of field 'Colour'.
+ */
+ public int getColour()
+ {
+ return this._colour;
+ }
+
+ /**
+ * Returns the value of field 'description'.
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription()
+ {
+ return this._description;
+ }
+
+ /**
+ * Returns the value of field 'displayCharacter'.
+ *
+ * @return the value of field 'DisplayCharacter'.
+ */
+ public java.lang.String getDisplayCharacter()
+ {
+ return this._displayCharacter;
+ }
+
+ /**
+ * Returns the value of field 'position'.
+ *
+ * @return the value of field 'Position'.
+ */
+ public int getPosition()
+ {
+ return this._position;
+ }
+
+ /**
+ * Returns the value of field 'secondaryStructure'.
+ *
+ * @return the value of field 'SecondaryStructure'.
+ */
+ public java.lang.String getSecondaryStructure()
+ {
+ return this._secondaryStructure;
+ }
+
+ /**
+ * Returns the value of field 'value'.
+ *
+ * @return the value of field 'Value'.
+ */
+ public float getValue()
+ {
+ return this._value;
+ }
+
+ /**
+ * Method hasColour.
+ *
+ * @return true if at least one Colour has been added
+ */
+ public boolean hasColour()
+ {
+ return this._has_colour;
+ }
+
+ /**
+ * Method hasPosition.
+ *
+ * @return true if at least one Position has been added
+ */
+ public boolean hasPosition()
+ {
+ return this._has_position;
+ }
+
+ /**
+ * Method hasValue.
+ *
+ * @return true if at least one Value has been added
+ */
+ public boolean hasValue()
+ {
+ return this._has_value;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'colour'.
+ *
+ * @param colour
+ * the value of field 'colour'.
+ */
+ public void setColour(final int colour)
+ {
+ this._colour = colour;
+ this._has_colour = true;
+ }
+
+ /**
+ * Sets the value of field 'description'.
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description)
+ {
+ this._description = description;
+ }
+
+ /**
+ * Sets the value of field 'displayCharacter'.
+ *
+ * @param displayCharacter
+ * the value of field 'displayCharacter'
+ */
+ public void setDisplayCharacter(final java.lang.String displayCharacter)
+ {
+ this._displayCharacter = displayCharacter;
+ }
+
+ /**
+ * Sets the value of field 'position'.
+ *
+ * @param position
+ * the value of field 'position'.
+ */
+ public void setPosition(final int position)
+ {
+ this._position = position;
+ this._has_position = true;
+ }
+
+ /**
+ * Sets the value of field 'secondaryStructure'.
+ *
+ * @param secondaryStructure
+ * the value of field 'secondaryStructure'.
+ */
+ public void setSecondaryStructure(
+ final java.lang.String secondaryStructure)
+ {
+ this._secondaryStructure = secondaryStructure;
+ }
+
+ /**
+ * Sets the value of field 'value'.
+ *
+ * @param value
+ * the value of field 'value'.
+ */
+ public void setValue(final float value)
+ {
+ this._value = value;
+ this._has_value = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.AnnotationElement
+ */
+ public static jalview.schemabinding.version2.AnnotationElement unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.AnnotationElement) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.AnnotationElement.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/CalcIdParam.java b/src/jalview/schemabinding/version2/CalcIdParam.java
new file mode 100644
index 0000000..57d6986
--- /dev/null
+++ b/src/jalview/schemabinding/version2/CalcIdParam.java
@@ -0,0 +1,300 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class CalcIdParam.
+ *
+ * @version $Revision$ $Date$
+ */
+public class CalcIdParam extends WebServiceParameterSet implements
+ java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * handle for the calculation which uses this parameter set
+ *
+ */
+ private java.lang.String _calcId;
+
+ /**
+ * should the calculation be performed immediately after loading in order to
+ * refresh results
+ *
+ */
+ private boolean _needsUpdate = false;
+
+ /**
+ * keeps track of state for field: _needsUpdate
+ */
+ private boolean _has_needsUpdate;
+
+ /**
+ * should the calculation be automatically performed on edits
+ *
+ */
+ private boolean _autoUpdate;
+
+ /**
+ * keeps track of state for field: _autoUpdate
+ */
+ private boolean _has_autoUpdate;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public CalcIdParam()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteAutoUpdate()
+ {
+ this._has_autoUpdate = false;
+ }
+
+ /**
+ */
+ public void deleteNeedsUpdate()
+ {
+ this._has_needsUpdate = false;
+ }
+
+ /**
+ * Returns the value of field 'autoUpdate'. The field 'autoUpdate' has the
+ * following description: should the calculation be automatically performed on
+ * edits
+ *
+ *
+ * @return the value of field 'AutoUpdate'.
+ */
+ public boolean getAutoUpdate()
+ {
+ return this._autoUpdate;
+ }
+
+ /**
+ * Returns the value of field 'calcId'. The field 'calcId' has the following
+ * description: handle for the calculation which uses this parameter set
+ *
+ *
+ * @return the value of field 'CalcId'.
+ */
+ public java.lang.String getCalcId()
+ {
+ return this._calcId;
+ }
+
+ /**
+ * Returns the value of field 'needsUpdate'. The field 'needsUpdate' has the
+ * following description: should the calculation be performed immediately
+ * after loading in order to refresh results
+ *
+ *
+ * @return the value of field 'NeedsUpdate'.
+ */
+ public boolean getNeedsUpdate()
+ {
+ return this._needsUpdate;
+ }
+
+ /**
+ * Method hasAutoUpdate.
+ *
+ * @return true if at least one AutoUpdate has been added
+ */
+ public boolean hasAutoUpdate()
+ {
+ return this._has_autoUpdate;
+ }
+
+ /**
+ * Method hasNeedsUpdate.
+ *
+ * @return true if at least one NeedsUpdate has been added
+ */
+ public boolean hasNeedsUpdate()
+ {
+ return this._has_needsUpdate;
+ }
+
+ /**
+ * Returns the value of field 'autoUpdate'. The field 'autoUpdate' has the
+ * following description: should the calculation be automatically performed on
+ * edits
+ *
+ *
+ * @return the value of field 'AutoUpdate'.
+ */
+ public boolean isAutoUpdate()
+ {
+ return this._autoUpdate;
+ }
+
+ /**
+ * Returns the value of field 'needsUpdate'. The field 'needsUpdate' has the
+ * following description: should the calculation be performed immediately
+ * after loading in order to refresh results
+ *
+ *
+ * @return the value of field 'NeedsUpdate'.
+ */
+ public boolean isNeedsUpdate()
+ {
+ return this._needsUpdate;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'autoUpdate'. The field 'autoUpdate' has the
+ * following description: should the calculation be automatically performed on
+ * edits
+ *
+ *
+ * @param autoUpdate
+ * the value of field 'autoUpdate'.
+ */
+ public void setAutoUpdate(final boolean autoUpdate)
+ {
+ this._autoUpdate = autoUpdate;
+ this._has_autoUpdate = true;
+ }
+
+ /**
+ * Sets the value of field 'calcId'. The field 'calcId' has the following
+ * description: handle for the calculation which uses this parameter set
+ *
+ *
+ * @param calcId
+ * the value of field 'calcId'.
+ */
+ public void setCalcId(final java.lang.String calcId)
+ {
+ this._calcId = calcId;
+ }
+
+ /**
+ * Sets the value of field 'needsUpdate'. The field 'needsUpdate' has the
+ * following description: should the calculation be performed immediately
+ * after loading in order to refresh results
+ *
+ *
+ * @param needsUpdate
+ * the value of field 'needsUpdate'.
+ */
+ public void setNeedsUpdate(final boolean needsUpdate)
+ {
+ this._needsUpdate = needsUpdate;
+ this._has_needsUpdate = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.CalcIdParam
+ */
+ public static jalview.schemabinding.version2.CalcIdParam unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.CalcIdParam) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.CalcIdParam.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
+
+}
diff --git a/src/jalview/schemabinding/version2/Colour.java b/src/jalview/schemabinding/version2/Colour.java
index a5fc601..9d5a916 100644
--- a/src/jalview/schemabinding/version2/Colour.java
+++ b/src/jalview/schemabinding/version2/Colour.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,465 +19,481 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Colour implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
- /**
- * Field _RGB.
- */
- private java.lang.String _RGB;
-
- /**
- * Field _minRGB.
- */
- private java.lang.String _minRGB;
-
- /**
- * loosely specified enumeration: NONE,ABOVE, or BELOW
- */
- private java.lang.String _threshType;
-
- /**
- * Field _threshold.
- */
- private float _threshold;
-
- /**
- * keeps track of state for field: _threshold
- */
- private boolean _has_threshold;
-
- /**
- * Field _max.
- */
- private float _max;
-
- /**
- * keeps track of state for field: _max
- */
- private boolean _has_max;
-
- /**
- * Field _min.
- */
- private float _min;
-
- /**
- * keeps track of state for field: _min
- */
- private boolean _has_min;
-
- /**
- * Field _colourByLabel.
- */
- private boolean _colourByLabel;
-
- /**
- * keeps track of state for field: _colourByLabel
- */
- private boolean _has_colourByLabel;
-
- /**
- * Field _autoScale.
- */
- private boolean _autoScale;
-
- /**
- * keeps track of state for field: _autoScale
- */
- private boolean _has_autoScale;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Colour() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteAutoScale(
- ) {
- this._has_autoScale= false;
- }
-
- /**
- */
- public void deleteColourByLabel(
- ) {
- this._has_colourByLabel= false;
- }
-
- /**
- */
- public void deleteMax(
- ) {
- this._has_max= false;
- }
-
- /**
- */
- public void deleteMin(
- ) {
- this._has_min= false;
- }
-
- /**
- */
- public void deleteThreshold(
- ) {
- this._has_threshold= false;
- }
-
- /**
- * Returns the value of field 'autoScale'.
- *
- * @return the value of field 'AutoScale'.
- */
- public boolean getAutoScale(
- ) {
- return this._autoScale;
- }
-
- /**
- * Returns the value of field 'colourByLabel'.
- *
- * @return the value of field 'ColourByLabel'.
- */
- public boolean getColourByLabel(
- ) {
- return this._colourByLabel;
- }
-
- /**
- * Returns the value of field 'max'.
- *
- * @return the value of field 'Max'.
- */
- public float getMax(
- ) {
- return this._max;
- }
-
- /**
- * Returns the value of field 'min'.
- *
- * @return the value of field 'Min'.
- */
- public float getMin(
- ) {
- return this._min;
- }
-
- /**
- * Returns the value of field 'minRGB'.
- *
- * @return the value of field 'MinRGB'.
- */
- public java.lang.String getMinRGB(
- ) {
- return this._minRGB;
- }
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Returns the value of field 'RGB'.
- *
- * @return the value of field 'RGB'.
- */
- public java.lang.String getRGB(
- ) {
- return this._RGB;
- }
-
- /**
- * Returns the value of field 'threshType'. The field
- * 'threshType' has the following description: loosely
- * specified enumeration: NONE,ABOVE, or BELOW
- *
- * @return the value of field 'ThreshType'.
- */
- public java.lang.String getThreshType(
- ) {
- return this._threshType;
- }
-
- /**
- * Returns the value of field 'threshold'.
- *
- * @return the value of field 'Threshold'.
- */
- public float getThreshold(
- ) {
- return this._threshold;
- }
-
- /**
- * Method hasAutoScale.
- *
- * @return true if at least one AutoScale has been added
- */
- public boolean hasAutoScale(
- ) {
- return this._has_autoScale;
- }
-
- /**
- * Method hasColourByLabel.
- *
- * @return true if at least one ColourByLabel has been added
- */
- public boolean hasColourByLabel(
- ) {
- return this._has_colourByLabel;
- }
-
- /**
- * Method hasMax.
- *
- * @return true if at least one Max has been added
- */
- public boolean hasMax(
- ) {
- return this._has_max;
- }
-
- /**
- * Method hasMin.
- *
- * @return true if at least one Min has been added
- */
- public boolean hasMin(
- ) {
- return this._has_min;
- }
-
- /**
- * Method hasThreshold.
- *
- * @return true if at least one Threshold has been added
- */
- public boolean hasThreshold(
- ) {
- return this._has_threshold;
- }
-
- /**
- * Returns the value of field 'autoScale'.
- *
- * @return the value of field 'AutoScale'.
- */
- public boolean isAutoScale(
- ) {
- return this._autoScale;
- }
-
- /**
- * Returns the value of field 'colourByLabel'.
- *
- * @return the value of field 'ColourByLabel'.
- */
- public boolean isColourByLabel(
- ) {
- return this._colourByLabel;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'autoScale'.
- *
- * @param autoScale the value of field 'autoScale'.
- */
- public void setAutoScale(
- final boolean autoScale) {
- this._autoScale = autoScale;
- this._has_autoScale = true;
- }
-
- /**
- * Sets the value of field 'colourByLabel'.
- *
- * @param colourByLabel the value of field 'colourByLabel'.
- */
- public void setColourByLabel(
- final boolean colourByLabel) {
- this._colourByLabel = colourByLabel;
- this._has_colourByLabel = true;
- }
-
- /**
- * Sets the value of field 'max'.
- *
- * @param max the value of field 'max'.
- */
- public void setMax(
- final float max) {
- this._max = max;
- this._has_max = true;
- }
-
- /**
- * Sets the value of field 'min'.
- *
- * @param min the value of field 'min'.
- */
- public void setMin(
- final float min) {
- this._min = min;
- this._has_min = true;
- }
-
- /**
- * Sets the value of field 'minRGB'.
- *
- * @param minRGB the value of field 'minRGB'.
- */
- public void setMinRGB(
- final java.lang.String minRGB) {
- this._minRGB = minRGB;
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Sets the value of field 'RGB'.
- *
- * @param RGB the value of field 'RGB'.
- */
- public void setRGB(
- final java.lang.String RGB) {
- this._RGB = RGB;
- }
-
- /**
- * Sets the value of field 'threshType'. The field 'threshType'
- * has the following description: loosely specified
- * enumeration: NONE,ABOVE, or BELOW
- *
- * @param threshType the value of field 'threshType'.
- */
- public void setThreshType(
- final java.lang.String threshType) {
- this._threshType = threshType;
- }
-
- /**
- * Sets the value of field 'threshold'.
- *
- * @param threshold the value of field 'threshold'.
- */
- public void setThreshold(
- final float threshold) {
- this._threshold = threshold;
- this._has_threshold = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.Colour
- */
- public static jalview.schemabinding.version2.Colour unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Colour) Unmarshaller.unmarshal(jalview.schemabinding.version2.Colour.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class Colour implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _RGB.
+ */
+ private java.lang.String _RGB;
+
+ /**
+ * Field _minRGB.
+ */
+ private java.lang.String _minRGB;
+
+ /**
+ * loosely specified enumeration: NONE,ABOVE, or BELOW
+ */
+ private java.lang.String _threshType;
+
+ /**
+ * Field _threshold.
+ */
+ private float _threshold;
+
+ /**
+ * keeps track of state for field: _threshold
+ */
+ private boolean _has_threshold;
+
+ /**
+ * Field _max.
+ */
+ private float _max;
+
+ /**
+ * keeps track of state for field: _max
+ */
+ private boolean _has_max;
+
+ /**
+ * Field _min.
+ */
+ private float _min;
+
+ /**
+ * keeps track of state for field: _min
+ */
+ private boolean _has_min;
+
+ /**
+ * Field _colourByLabel.
+ */
+ private boolean _colourByLabel;
+
+ /**
+ * keeps track of state for field: _colourByLabel
+ */
+ private boolean _has_colourByLabel;
+
+ /**
+ * Field _autoScale.
+ */
+ private boolean _autoScale;
+
+ /**
+ * keeps track of state for field: _autoScale
+ */
+ private boolean _has_autoScale;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Colour()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteAutoScale()
+ {
+ this._has_autoScale = false;
+ }
+
+ /**
+ */
+ public void deleteColourByLabel()
+ {
+ this._has_colourByLabel = false;
+ }
+
+ /**
+ */
+ public void deleteMax()
+ {
+ this._has_max = false;
+ }
+
+ /**
+ */
+ public void deleteMin()
+ {
+ this._has_min = false;
+ }
+
+ /**
+ */
+ public void deleteThreshold()
+ {
+ this._has_threshold = false;
+ }
+
+ /**
+ * Returns the value of field 'autoScale'.
+ *
+ * @return the value of field 'AutoScale'.
+ */
+ public boolean getAutoScale()
+ {
+ return this._autoScale;
+ }
+
+ /**
+ * Returns the value of field 'colourByLabel'.
+ *
+ * @return the value of field 'ColourByLabel'.
+ */
+ public boolean getColourByLabel()
+ {
+ return this._colourByLabel;
+ }
+
+ /**
+ * Returns the value of field 'max'.
+ *
+ * @return the value of field 'Max'.
+ */
+ public float getMax()
+ {
+ return this._max;
+ }
+
+ /**
+ * Returns the value of field 'min'.
+ *
+ * @return the value of field 'Min'.
+ */
+ public float getMin()
+ {
+ return this._min;
+ }
+
+ /**
+ * Returns the value of field 'minRGB'.
+ *
+ * @return the value of field 'MinRGB'.
+ */
+ public java.lang.String getMinRGB()
+ {
+ return this._minRGB;
+ }
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Returns the value of field 'RGB'.
+ *
+ * @return the value of field 'RGB'.
+ */
+ public java.lang.String getRGB()
+ {
+ return this._RGB;
+ }
+
+ /**
+ * Returns the value of field 'threshType'. The field 'threshType' has the
+ * following description: loosely specified enumeration: NONE,ABOVE, or BELOW
+ *
+ * @return the value of field 'ThreshType'.
+ */
+ public java.lang.String getThreshType()
+ {
+ return this._threshType;
+ }
+
+ /**
+ * Returns the value of field 'threshold'.
+ *
+ * @return the value of field 'Threshold'.
+ */
+ public float getThreshold()
+ {
+ return this._threshold;
+ }
+
+ /**
+ * Method hasAutoScale.
+ *
+ * @return true if at least one AutoScale has been added
+ */
+ public boolean hasAutoScale()
+ {
+ return this._has_autoScale;
+ }
+
+ /**
+ * Method hasColourByLabel.
+ *
+ * @return true if at least one ColourByLabel has been added
+ */
+ public boolean hasColourByLabel()
+ {
+ return this._has_colourByLabel;
+ }
+
+ /**
+ * Method hasMax.
+ *
+ * @return true if at least one Max has been added
+ */
+ public boolean hasMax()
+ {
+ return this._has_max;
+ }
+
+ /**
+ * Method hasMin.
+ *
+ * @return true if at least one Min has been added
+ */
+ public boolean hasMin()
+ {
+ return this._has_min;
+ }
+
+ /**
+ * Method hasThreshold.
+ *
+ * @return true if at least one Threshold has been added
+ */
+ public boolean hasThreshold()
+ {
+ return this._has_threshold;
+ }
+
+ /**
+ * Returns the value of field 'autoScale'.
+ *
+ * @return the value of field 'AutoScale'.
+ */
+ public boolean isAutoScale()
+ {
+ return this._autoScale;
+ }
+
+ /**
+ * Returns the value of field 'colourByLabel'.
+ *
+ * @return the value of field 'ColourByLabel'.
+ */
+ public boolean isColourByLabel()
+ {
+ return this._colourByLabel;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'autoScale'.
+ *
+ * @param autoScale
+ * the value of field 'autoScale'.
+ */
+ public void setAutoScale(final boolean autoScale)
+ {
+ this._autoScale = autoScale;
+ this._has_autoScale = true;
+ }
+
+ /**
+ * Sets the value of field 'colourByLabel'.
+ *
+ * @param colourByLabel
+ * the value of field 'colourByLabel'.
+ */
+ public void setColourByLabel(final boolean colourByLabel)
+ {
+ this._colourByLabel = colourByLabel;
+ this._has_colourByLabel = true;
+ }
+
+ /**
+ * Sets the value of field 'max'.
+ *
+ * @param max
+ * the value of field 'max'.
+ */
+ public void setMax(final float max)
+ {
+ this._max = max;
+ this._has_max = true;
+ }
+
+ /**
+ * Sets the value of field 'min'.
+ *
+ * @param min
+ * the value of field 'min'.
+ */
+ public void setMin(final float min)
+ {
+ this._min = min;
+ this._has_min = true;
+ }
+
+ /**
+ * Sets the value of field 'minRGB'.
+ *
+ * @param minRGB
+ * the value of field 'minRGB'.
+ */
+ public void setMinRGB(final java.lang.String minRGB)
+ {
+ this._minRGB = minRGB;
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Sets the value of field 'RGB'.
+ *
+ * @param RGB
+ * the value of field 'RGB'.
+ */
+ public void setRGB(final java.lang.String RGB)
+ {
+ this._RGB = RGB;
+ }
+
+ /**
+ * Sets the value of field 'threshType'. The field 'threshType' has the
+ * following description: loosely specified enumeration: NONE,ABOVE, or BELOW
+ *
+ * @param threshType
+ * the value of field 'threshType'.
+ */
+ public void setThreshType(final java.lang.String threshType)
+ {
+ this._threshType = threshType;
+ }
+
+ /**
+ * Sets the value of field 'threshold'.
+ *
+ * @param threshold
+ * the value of field 'threshold'.
+ */
+ public void setThreshold(final float threshold)
+ {
+ this._threshold = threshold;
+ this._has_threshold = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Colour
+ */
+ public static jalview.schemabinding.version2.Colour unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Colour) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.Colour.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/DBRef.java b/src/jalview/schemabinding/version2/DBRef.java
index b93ca1f..85997ff 100644
--- a/src/jalview/schemabinding/version2/DBRef.java
+++ b/src/jalview/schemabinding/version2/DBRef.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,201 +19,215 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class DBRef implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _source.
- */
- private java.lang.String _source;
-
- /**
- * Field _version.
- */
- private java.lang.String _version;
-
- /**
- * Field _accessionId.
- */
- private java.lang.String _accessionId;
-
- /**
- * Field _mapping.
- */
- private jalview.schemabinding.version2.Mapping _mapping;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public DBRef() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'accessionId'.
- *
- * @return the value of field 'AccessionId'.
- */
- public java.lang.String getAccessionId(
- ) {
- return this._accessionId;
- }
-
- /**
- * Returns the value of field 'mapping'.
- *
- * @return the value of field 'Mapping'.
- */
- public jalview.schemabinding.version2.Mapping getMapping(
- ) {
- return this._mapping;
- }
-
- /**
- * Returns the value of field 'source'.
- *
- * @return the value of field 'Source'.
- */
- public java.lang.String getSource(
- ) {
- return this._source;
- }
-
- /**
- * Returns the value of field 'version'.
- *
- * @return the value of field 'Version'.
- */
- public java.lang.String getVersion(
- ) {
- return this._version;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'accessionId'.
- *
- * @param accessionId the value of field 'accessionId'.
- */
- public void setAccessionId(
- final java.lang.String accessionId) {
- this._accessionId = accessionId;
- }
-
- /**
- * Sets the value of field 'mapping'.
- *
- * @param mapping the value of field 'mapping'.
- */
- public void setMapping(
- final jalview.schemabinding.version2.Mapping mapping) {
- this._mapping = mapping;
- }
-
- /**
- * Sets the value of field 'source'.
- *
- * @param source the value of field 'source'.
- */
- public void setSource(
- final java.lang.String source) {
- this._source = source;
- }
-
- /**
- * Sets the value of field 'version'.
- *
- * @param version the value of field 'version'.
- */
- public void setVersion(
- final java.lang.String version) {
- this._version = version;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.DBRef
- */
- public static jalview.schemabinding.version2.DBRef unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.DBRef) Unmarshaller.unmarshal(jalview.schemabinding.version2.DBRef.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class DBRef implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _source.
+ */
+ private java.lang.String _source;
+
+ /**
+ * Field _version.
+ */
+ private java.lang.String _version;
+
+ /**
+ * Field _accessionId.
+ */
+ private java.lang.String _accessionId;
+
+ /**
+ * Field _mapping.
+ */
+ private jalview.schemabinding.version2.Mapping _mapping;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public DBRef()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'accessionId'.
+ *
+ * @return the value of field 'AccessionId'.
+ */
+ public java.lang.String getAccessionId()
+ {
+ return this._accessionId;
+ }
+
+ /**
+ * Returns the value of field 'mapping'.
+ *
+ * @return the value of field 'Mapping'.
+ */
+ public jalview.schemabinding.version2.Mapping getMapping()
+ {
+ return this._mapping;
+ }
+
+ /**
+ * Returns the value of field 'source'.
+ *
+ * @return the value of field 'Source'.
+ */
+ public java.lang.String getSource()
+ {
+ return this._source;
+ }
+
+ /**
+ * Returns the value of field 'version'.
+ *
+ * @return the value of field 'Version'.
+ */
+ public java.lang.String getVersion()
+ {
+ return this._version;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'accessionId'.
+ *
+ * @param accessionId
+ * the value of field 'accessionId'.
+ */
+ public void setAccessionId(final java.lang.String accessionId)
+ {
+ this._accessionId = accessionId;
+ }
+
+ /**
+ * Sets the value of field 'mapping'.
+ *
+ * @param mapping
+ * the value of field 'mapping'.
+ */
+ public void setMapping(
+ final jalview.schemabinding.version2.Mapping mapping)
+ {
+ this._mapping = mapping;
+ }
+
+ /**
+ * Sets the value of field 'source'.
+ *
+ * @param source
+ * the value of field 'source'.
+ */
+ public void setSource(final java.lang.String source)
+ {
+ this._source = source;
+ }
+
+ /**
+ * Sets the value of field 'version'.
+ *
+ * @param version
+ * the value of field 'version'.
+ */
+ public void setVersion(final java.lang.String version)
+ {
+ this._version = version;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.DBRef
+ */
+ public static jalview.schemabinding.version2.DBRef unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.DBRef) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.DBRef.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Feature.java b/src/jalview/schemabinding/version2/Feature.java
index 55ac992..9e484d5 100644
--- a/src/jalview/schemabinding/version2/Feature.java
+++ b/src/jalview/schemabinding/version2/Feature.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,501 +19,530 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Feature implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _begin.
- */
- private int _begin;
-
- /**
- * keeps track of state for field: _begin
- */
- private boolean _has_begin;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
- /**
- * Field _type.
- */
- private java.lang.String _type;
-
- /**
- * Field _description.
- */
- private java.lang.String _description;
-
- /**
- * Field _status.
- */
- private java.lang.String _status;
-
- /**
- * Field _featureGroup.
- */
- private java.lang.String _featureGroup;
-
- /**
- * Field _score.
- */
- private float _score;
-
- /**
- * keeps track of state for field: _score
- */
- private boolean _has_score;
-
- /**
- * Field _otherDataList.
- */
- private java.util.Vector _otherDataList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Feature() {
- super();
- this._otherDataList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vOtherData
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addOtherData(
- final jalview.schemabinding.version2.OtherData vOtherData)
- throws java.lang.IndexOutOfBoundsException {
- this._otherDataList.addElement(vOtherData);
- }
-
- /**
- *
- *
- * @param index
- * @param vOtherData
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addOtherData(
- final int index,
- final jalview.schemabinding.version2.OtherData vOtherData)
- throws java.lang.IndexOutOfBoundsException {
- this._otherDataList.add(index, vOtherData);
- }
-
- /**
- */
- public void deleteBegin(
- ) {
- this._has_begin= false;
- }
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteScore(
- ) {
- this._has_score= false;
- }
-
- /**
- * Method enumerateOtherData.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.OtherData elements
- */
- public java.util.Enumeration enumerateOtherData(
- ) {
- return this._otherDataList.elements();
- }
-
- /**
- * Returns the value of field 'begin'.
- *
- * @return the value of field 'Begin'.
- */
- public int getBegin(
- ) {
- return this._begin;
- }
-
- /**
- * Returns the value of field 'description'.
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Returns the value of field 'featureGroup'.
- *
- * @return the value of field 'FeatureGroup'.
- */
- public java.lang.String getFeatureGroup(
- ) {
- return this._featureGroup;
- }
-
- /**
- * Method getOtherData.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.OtherData at the given index
- */
- public jalview.schemabinding.version2.OtherData getOtherData(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._otherDataList.size()) {
- throw new IndexOutOfBoundsException("getOtherData: Index value '" + index + "' not in range [0.." + (this._otherDataList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.OtherData) _otherDataList.get(index);
- }
-
- /**
- * Method getOtherData.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.OtherData[] getOtherData(
- ) {
- jalview.schemabinding.version2.OtherData[] array = new jalview.schemabinding.version2.OtherData[0];
- return (jalview.schemabinding.version2.OtherData[]) this._otherDataList.toArray(array);
- }
-
- /**
- * Method getOtherDataCount.
- *
- * @return the size of this collection
- */
- public int getOtherDataCount(
- ) {
- return this._otherDataList.size();
- }
-
- /**
- * Returns the value of field 'score'.
- *
- * @return the value of field 'Score'.
- */
- public float getScore(
- ) {
- return this._score;
- }
-
- /**
- * Returns the value of field 'status'.
- *
- * @return the value of field 'Status'.
- */
- public java.lang.String getStatus(
- ) {
- return this._status;
- }
-
- /**
- * Returns the value of field 'type'.
- *
- * @return the value of field 'Type'.
- */
- public java.lang.String getType(
- ) {
- return this._type;
- }
-
- /**
- * Method hasBegin.
- *
- * @return true if at least one Begin has been added
- */
- public boolean hasBegin(
- ) {
- return this._has_begin;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method hasScore.
- *
- * @return true if at least one Score has been added
- */
- public boolean hasScore(
- ) {
- return this._has_score;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllOtherData(
- ) {
- this._otherDataList.clear();
- }
-
- /**
- * Method removeOtherData.
- *
- * @param vOtherData
- * @return true if the object was removed from the collection.
- */
- public boolean removeOtherData(
- final jalview.schemabinding.version2.OtherData vOtherData) {
- boolean removed = _otherDataList.remove(vOtherData);
- return removed;
- }
-
- /**
- * Method removeOtherDataAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.OtherData removeOtherDataAt(
- final int index) {
- java.lang.Object obj = this._otherDataList.remove(index);
- return (jalview.schemabinding.version2.OtherData) obj;
- }
-
- /**
- * Sets the value of field 'begin'.
- *
- * @param begin the value of field 'begin'.
- */
- public void setBegin(
- final int begin) {
- this._begin = begin;
- this._has_begin = true;
- }
-
- /**
- * Sets the value of field 'description'.
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- * Sets the value of field 'featureGroup'.
- *
- * @param featureGroup the value of field 'featureGroup'.
- */
- public void setFeatureGroup(
- final java.lang.String featureGroup) {
- this._featureGroup = featureGroup;
- }
-
- /**
- *
- *
- * @param index
- * @param vOtherData
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setOtherData(
- final int index,
- final jalview.schemabinding.version2.OtherData vOtherData)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._otherDataList.size()) {
- throw new IndexOutOfBoundsException("setOtherData: Index value '" + index + "' not in range [0.." + (this._otherDataList.size() - 1) + "]");
- }
-
- this._otherDataList.set(index, vOtherData);
- }
-
- /**
- *
- *
- * @param vOtherDataArray
- */
- public void setOtherData(
- final jalview.schemabinding.version2.OtherData[] vOtherDataArray) {
- //-- copy array
- _otherDataList.clear();
-
- for (int i = 0; i < vOtherDataArray.length; i++) {
- this._otherDataList.add(vOtherDataArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'score'.
- *
- * @param score the value of field 'score'.
- */
- public void setScore(
- final float score) {
- this._score = score;
- this._has_score = true;
- }
-
- /**
- * Sets the value of field 'status'.
- *
- * @param status the value of field 'status'.
- */
- public void setStatus(
- final java.lang.String status) {
- this._status = status;
- }
-
- /**
- * Sets the value of field 'type'.
- *
- * @param type the value of field 'type'.
- */
- public void setType(
- final java.lang.String type) {
- this._type = type;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.Featur
- */
- public static jalview.schemabinding.version2.Feature unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(jalview.schemabinding.version2.Feature.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class Feature implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _begin.
+ */
+ private int _begin;
+
+ /**
+ * keeps track of state for field: _begin
+ */
+ private boolean _has_begin;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ /**
+ * Field _type.
+ */
+ private java.lang.String _type;
+
+ /**
+ * Field _description.
+ */
+ private java.lang.String _description;
+
+ /**
+ * Field _status.
+ */
+ private java.lang.String _status;
+
+ /**
+ * Field _featureGroup.
+ */
+ private java.lang.String _featureGroup;
+
+ /**
+ * Field _score.
+ */
+ private float _score;
+
+ /**
+ * keeps track of state for field: _score
+ */
+ private boolean _has_score;
+
+ /**
+ * Field _otherDataList.
+ */
+ private java.util.Vector _otherDataList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Feature()
+ {
+ super();
+ this._otherDataList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vOtherData
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addOtherData(
+ final jalview.schemabinding.version2.OtherData vOtherData)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._otherDataList.addElement(vOtherData);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vOtherData
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addOtherData(final int index,
+ final jalview.schemabinding.version2.OtherData vOtherData)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._otherDataList.add(index, vOtherData);
+ }
+
+ /**
+ */
+ public void deleteBegin()
+ {
+ this._has_begin = false;
+ }
+
+ /**
+ */
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteScore()
+ {
+ this._has_score = false;
+ }
+
+ /**
+ * Method enumerateOtherData.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.OtherData
+ * elements
+ */
+ public java.util.Enumeration enumerateOtherData()
+ {
+ return this._otherDataList.elements();
+ }
+
+ /**
+ * Returns the value of field 'begin'.
+ *
+ * @return the value of field 'Begin'.
+ */
+ public int getBegin()
+ {
+ return this._begin;
+ }
+
+ /**
+ * Returns the value of field 'description'.
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription()
+ {
+ return this._description;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Returns the value of field 'featureGroup'.
+ *
+ * @return the value of field 'FeatureGroup'.
+ */
+ public java.lang.String getFeatureGroup()
+ {
+ return this._featureGroup;
+ }
+
+ /**
+ * Method getOtherData.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.OtherData at the
+ * given index
+ */
+ public jalview.schemabinding.version2.OtherData getOtherData(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._otherDataList.size())
+ {
+ throw new IndexOutOfBoundsException("getOtherData: Index value '"
+ + index + "' not in range [0.."
+ + (this._otherDataList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.OtherData) _otherDataList
+ .get(index);
+ }
+
+ /**
+ * Method getOtherData.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.OtherData[] getOtherData()
+ {
+ jalview.schemabinding.version2.OtherData[] array = new jalview.schemabinding.version2.OtherData[0];
+ return (jalview.schemabinding.version2.OtherData[]) this._otherDataList
+ .toArray(array);
+ }
+
+ /**
+ * Method getOtherDataCount.
+ *
+ * @return the size of this collection
+ */
+ public int getOtherDataCount()
+ {
+ return this._otherDataList.size();
+ }
+
+ /**
+ * Returns the value of field 'score'.
+ *
+ * @return the value of field 'Score'.
+ */
+ public float getScore()
+ {
+ return this._score;
+ }
+
+ /**
+ * Returns the value of field 'status'.
+ *
+ * @return the value of field 'Status'.
+ */
+ public java.lang.String getStatus()
+ {
+ return this._status;
+ }
+
+ /**
+ * Returns the value of field 'type'.
+ *
+ * @return the value of field 'Type'.
+ */
+ public java.lang.String getType()
+ {
+ return this._type;
+ }
+
+ /**
+ * Method hasBegin.
+ *
+ * @return true if at least one Begin has been added
+ */
+ public boolean hasBegin()
+ {
+ return this._has_begin;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasScore.
+ *
+ * @return true if at least one Score has been added
+ */
+ public boolean hasScore()
+ {
+ return this._has_score;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllOtherData()
+ {
+ this._otherDataList.clear();
+ }
+
+ /**
+ * Method removeOtherData.
+ *
+ * @param vOtherData
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeOtherData(
+ final jalview.schemabinding.version2.OtherData vOtherData)
+ {
+ boolean removed = _otherDataList.remove(vOtherData);
+ return removed;
+ }
+
+ /**
+ * Method removeOtherDataAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.OtherData removeOtherDataAt(
+ final int index)
+ {
+ java.lang.Object obj = this._otherDataList.remove(index);
+ return (jalview.schemabinding.version2.OtherData) obj;
+ }
+
+ /**
+ * Sets the value of field 'begin'.
+ *
+ * @param begin
+ * the value of field 'begin'.
+ */
+ public void setBegin(final int begin)
+ {
+ this._begin = begin;
+ this._has_begin = true;
+ }
+
+ /**
+ * Sets the value of field 'description'.
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description)
+ {
+ this._description = description;
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ * Sets the value of field 'featureGroup'.
+ *
+ * @param featureGroup
+ * the value of field 'featureGroup'.
+ */
+ public void setFeatureGroup(final java.lang.String featureGroup)
+ {
+ this._featureGroup = featureGroup;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vOtherData
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setOtherData(final int index,
+ final jalview.schemabinding.version2.OtherData vOtherData)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._otherDataList.size())
+ {
+ throw new IndexOutOfBoundsException("setOtherData: Index value '"
+ + index + "' not in range [0.."
+ + (this._otherDataList.size() - 1) + "]");
+ }
+
+ this._otherDataList.set(index, vOtherData);
+ }
+
+ /**
+ *
+ *
+ * @param vOtherDataArray
+ */
+ public void setOtherData(
+ final jalview.schemabinding.version2.OtherData[] vOtherDataArray)
+ {
+ // -- copy array
+ _otherDataList.clear();
+
+ for (int i = 0; i < vOtherDataArray.length; i++)
+ {
+ this._otherDataList.add(vOtherDataArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'score'.
+ *
+ * @param score
+ * the value of field 'score'.
+ */
+ public void setScore(final float score)
+ {
+ this._score = score;
+ this._has_score = true;
+ }
+
+ /**
+ * Sets the value of field 'status'.
+ *
+ * @param status
+ * the value of field 'status'.
+ */
+ public void setStatus(final java.lang.String status)
+ {
+ this._status = status;
+ }
+
+ /**
+ * Sets the value of field 'type'.
+ *
+ * @param type
+ * the value of field 'type'.
+ */
+ public void setType(final java.lang.String type)
+ {
+ this._type = type;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Featur
+ */
+ public static jalview.schemabinding.version2.Feature unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.Feature.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/FeatureSettings.java b/src/jalview/schemabinding/version2/FeatureSettings.java
index fb2c04e..fa75e76 100644
--- a/src/jalview/schemabinding/version2/FeatureSettings.java
+++ b/src/jalview/schemabinding/version2/FeatureSettings.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,414 +19,444 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class FeatureSettings implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _settingList.
- */
- private java.util.Vector _settingList;
-
- /**
- * Field _groupList.
- */
- private java.util.Vector _groupList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public FeatureSettings() {
- super();
- this._settingList = new java.util.Vector();
- this._groupList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vGroup
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addGroup(
- final jalview.schemabinding.version2.Group vGroup)
- throws java.lang.IndexOutOfBoundsException {
- this._groupList.addElement(vGroup);
- }
-
- /**
- *
- *
- * @param index
- * @param vGroup
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addGroup(
- final int index,
- final jalview.schemabinding.version2.Group vGroup)
- throws java.lang.IndexOutOfBoundsException {
- this._groupList.add(index, vGroup);
- }
-
- /**
- *
- *
- * @param vSetting
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSetting(
- final jalview.schemabinding.version2.Setting vSetting)
- throws java.lang.IndexOutOfBoundsException {
- this._settingList.addElement(vSetting);
- }
-
- /**
- *
- *
- * @param index
- * @param vSetting
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSetting(
- final int index,
- final jalview.schemabinding.version2.Setting vSetting)
- throws java.lang.IndexOutOfBoundsException {
- this._settingList.add(index, vSetting);
- }
-
- /**
- * Method enumerateGroup.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Group elements
- */
- public java.util.Enumeration enumerateGroup(
- ) {
- return this._groupList.elements();
- }
-
- /**
- * Method enumerateSetting.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Setting elements
- */
- public java.util.Enumeration enumerateSetting(
- ) {
- return this._settingList.elements();
- }
-
- /**
- * Method getGroup.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Group at the given index
- */
- public jalview.schemabinding.version2.Group getGroup(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._groupList.size()) {
- throw new IndexOutOfBoundsException("getGroup: Index value '" + index + "' not in range [0.." + (this._groupList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Group) _groupList.get(index);
- }
-
- /**
- * Method getGroup.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Group[] getGroup(
- ) {
- jalview.schemabinding.version2.Group[] array = new jalview.schemabinding.version2.Group[0];
- return (jalview.schemabinding.version2.Group[]) this._groupList.toArray(array);
- }
-
- /**
- * Method getGroupCount.
- *
- * @return the size of this collection
- */
- public int getGroupCount(
- ) {
- return this._groupList.size();
- }
-
- /**
- * Method getSetting.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Setting at the given index
- */
- public jalview.schemabinding.version2.Setting getSetting(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._settingList.size()) {
- throw new IndexOutOfBoundsException("getSetting: Index value '" + index + "' not in range [0.." + (this._settingList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Setting) _settingList.get(index);
- }
-
- /**
- * Method getSetting.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Setting[] getSetting(
- ) {
- jalview.schemabinding.version2.Setting[] array = new jalview.schemabinding.version2.Setting[0];
- return (jalview.schemabinding.version2.Setting[]) this._settingList.toArray(array);
- }
-
- /**
- * Method getSettingCount.
- *
- * @return the size of this collection
- */
- public int getSettingCount(
- ) {
- return this._settingList.size();
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllGroup(
- ) {
- this._groupList.clear();
+public class FeatureSettings implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _settingList.
+ */
+ private java.util.Vector _settingList;
+
+ /**
+ * Field _groupList.
+ */
+ private java.util.Vector _groupList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public FeatureSettings()
+ {
+ super();
+ this._settingList = new java.util.Vector();
+ this._groupList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vGroup
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addGroup(final jalview.schemabinding.version2.Group vGroup)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._groupList.addElement(vGroup);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vGroup
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addGroup(final int index,
+ final jalview.schemabinding.version2.Group vGroup)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._groupList.add(index, vGroup);
+ }
+
+ /**
+ *
+ *
+ * @param vSetting
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSetting(
+ final jalview.schemabinding.version2.Setting vSetting)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._settingList.addElement(vSetting);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSetting
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSetting(final int index,
+ final jalview.schemabinding.version2.Setting vSetting)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._settingList.add(index, vSetting);
+ }
+
+ /**
+ * Method enumerateGroup.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Group
+ * elements
+ */
+ public java.util.Enumeration enumerateGroup()
+ {
+ return this._groupList.elements();
+ }
+
+ /**
+ * Method enumerateSetting.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Setting
+ * elements
+ */
+ public java.util.Enumeration enumerateSetting()
+ {
+ return this._settingList.elements();
+ }
+
+ /**
+ * Method getGroup.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Group at the given
+ * index
+ */
+ public jalview.schemabinding.version2.Group getGroup(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._groupList.size())
+ {
+ throw new IndexOutOfBoundsException("getGroup: Index value '" + index
+ + "' not in range [0.." + (this._groupList.size() - 1) + "]");
}
- /**
- */
- public void removeAllSetting(
- ) {
- this._settingList.clear();
- }
-
- /**
- * Method removeGroup.
- *
- * @param vGroup
- * @return true if the object was removed from the collection.
- */
- public boolean removeGroup(
- final jalview.schemabinding.version2.Group vGroup) {
- boolean removed = _groupList.remove(vGroup);
- return removed;
- }
-
- /**
- * Method removeGroupAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Group removeGroupAt(
- final int index) {
- java.lang.Object obj = this._groupList.remove(index);
- return (jalview.schemabinding.version2.Group) obj;
- }
-
- /**
- * Method removeSetting.
- *
- * @param vSetting
- * @return true if the object was removed from the collection.
- */
- public boolean removeSetting(
- final jalview.schemabinding.version2.Setting vSetting) {
- boolean removed = _settingList.remove(vSetting);
- return removed;
+ return (jalview.schemabinding.version2.Group) _groupList.get(index);
+ }
+
+ /**
+ * Method getGroup.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Group[] getGroup()
+ {
+ jalview.schemabinding.version2.Group[] array = new jalview.schemabinding.version2.Group[0];
+ return (jalview.schemabinding.version2.Group[]) this._groupList
+ .toArray(array);
+ }
+
+ /**
+ * Method getGroupCount.
+ *
+ * @return the size of this collection
+ */
+ public int getGroupCount()
+ {
+ return this._groupList.size();
+ }
+
+ /**
+ * Method getSetting.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Setting at the
+ * given index
+ */
+ public jalview.schemabinding.version2.Setting getSetting(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._settingList.size())
+ {
+ throw new IndexOutOfBoundsException("getSetting: Index value '"
+ + index + "' not in range [0.."
+ + (this._settingList.size() - 1) + "]");
}
- /**
- * Method removeSettingAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Setting removeSettingAt(
- final int index) {
- java.lang.Object obj = this._settingList.remove(index);
- return (jalview.schemabinding.version2.Setting) obj;
+ return (jalview.schemabinding.version2.Setting) _settingList.get(index);
+ }
+
+ /**
+ * Method getSetting.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Setting[] getSetting()
+ {
+ jalview.schemabinding.version2.Setting[] array = new jalview.schemabinding.version2.Setting[0];
+ return (jalview.schemabinding.version2.Setting[]) this._settingList
+ .toArray(array);
+ }
+
+ /**
+ * Method getSettingCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSettingCount()
+ {
+ return this._settingList.size();
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- *
- *
- * @param index
- * @param vGroup
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setGroup(
- final int index,
- final jalview.schemabinding.version2.Group vGroup)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._groupList.size()) {
- throw new IndexOutOfBoundsException("setGroup: Index value '" + index + "' not in range [0.." + (this._groupList.size() - 1) + "]");
- }
-
- this._groupList.set(index, vGroup);
- }
-
- /**
- *
- *
- * @param vGroupArray
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public void setGroup(
- final jalview.schemabinding.version2.Group[] vGroupArray) {
- //-- copy array
- _groupList.clear();
-
- for (int i = 0; i < vGroupArray.length; i++) {
- this._groupList.add(vGroupArray[i]);
- }
- }
+ public void removeAllGroup()
+ {
+ this._groupList.clear();
+ }
- /**
- *
- *
- * @param index
- * @param vSetting
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
+ /**
*/
- public void setSetting(
- final int index,
- final jalview.schemabinding.version2.Setting vSetting)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._settingList.size()) {
- throw new IndexOutOfBoundsException("setSetting: Index value '" + index + "' not in range [0.." + (this._settingList.size() - 1) + "]");
- }
-
- this._settingList.set(index, vSetting);
+ public void removeAllSetting()
+ {
+ this._settingList.clear();
+ }
+
+ /**
+ * Method removeGroup.
+ *
+ * @param vGroup
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeGroup(
+ final jalview.schemabinding.version2.Group vGroup)
+ {
+ boolean removed = _groupList.remove(vGroup);
+ return removed;
+ }
+
+ /**
+ * Method removeGroupAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Group removeGroupAt(final int index)
+ {
+ java.lang.Object obj = this._groupList.remove(index);
+ return (jalview.schemabinding.version2.Group) obj;
+ }
+
+ /**
+ * Method removeSetting.
+ *
+ * @param vSetting
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSetting(
+ final jalview.schemabinding.version2.Setting vSetting)
+ {
+ boolean removed = _settingList.remove(vSetting);
+ return removed;
+ }
+
+ /**
+ * Method removeSettingAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Setting removeSettingAt(
+ final int index)
+ {
+ java.lang.Object obj = this._settingList.remove(index);
+ return (jalview.schemabinding.version2.Setting) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vGroup
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setGroup(final int index,
+ final jalview.schemabinding.version2.Group vGroup)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._groupList.size())
+ {
+ throw new IndexOutOfBoundsException("setGroup: Index value '" + index
+ + "' not in range [0.." + (this._groupList.size() - 1) + "]");
}
- /**
- *
- *
- * @param vSettingArray
- */
- public void setSetting(
- final jalview.schemabinding.version2.Setting[] vSettingArray) {
- //-- copy array
- _settingList.clear();
-
- for (int i = 0; i < vSettingArray.length; i++) {
- this._settingList.add(vSettingArray[i]);
- }
+ this._groupList.set(index, vGroup);
+ }
+
+ /**
+ *
+ *
+ * @param vGroupArray
+ */
+ public void setGroup(
+ final jalview.schemabinding.version2.Group[] vGroupArray)
+ {
+ // -- copy array
+ _groupList.clear();
+
+ for (int i = 0; i < vGroupArray.length; i++)
+ {
+ this._groupList.add(vGroupArray[i]);
}
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.FeatureSettings
- */
- public static jalview.schemabinding.version2.FeatureSettings unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.FeatureSettings) Unmarshaller.unmarshal(jalview.schemabinding.version2.FeatureSettings.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSetting
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSetting(final int index,
+ final jalview.schemabinding.version2.Setting vSetting)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._settingList.size())
+ {
+ throw new IndexOutOfBoundsException("setSetting: Index value '"
+ + index + "' not in range [0.."
+ + (this._settingList.size() - 1) + "]");
}
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._settingList.set(index, vSetting);
+ }
+
+ /**
+ *
+ *
+ * @param vSettingArray
+ */
+ public void setSetting(
+ final jalview.schemabinding.version2.Setting[] vSettingArray)
+ {
+ // -- copy array
+ _settingList.clear();
+
+ for (int i = 0; i < vSettingArray.length; i++)
+ {
+ this._settingList.add(vSettingArray[i]);
}
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.FeatureSettings
+ */
+ public static jalview.schemabinding.version2.FeatureSettings unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.FeatureSettings) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.FeatureSettings.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Features.java b/src/jalview/schemabinding/version2/Features.java
index f109523..5d17512 100644
--- a/src/jalview/schemabinding/version2/Features.java
+++ b/src/jalview/schemabinding/version2/Features.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,98 +19,106 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Features extends Feature
-implements java.io.Serializable
+public class Features extends Feature implements java.io.Serializable
{
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Features() {
- super();
- }
-
+ public Features()
+ {
+ super();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.Featur
- */
- public static jalview.schemabinding.version2.Feature unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(jalview.schemabinding.version2.Features.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Featur
+ */
+ public static jalview.schemabinding.version2.Feature unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.Features.class, reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Group.java b/src/jalview/schemabinding/version2/Group.java
index 3ade8c4..ec1af95 100644
--- a/src/jalview/schemabinding/version2/Group.java
+++ b/src/jalview/schemabinding/version2/Group.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,184 +19,195 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Group implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
- /**
- * Field _display.
- */
- private boolean _display;
-
- /**
- * keeps track of state for field: _display
- */
- private boolean _has_display;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Group() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteDisplay(
- ) {
- this._has_display= false;
- }
-
- /**
- * Returns the value of field 'display'.
- *
- * @return the value of field 'Display'.
- */
- public boolean getDisplay(
- ) {
- return this._display;
- }
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Method hasDisplay.
- *
- * @return true if at least one Display has been added
- */
- public boolean hasDisplay(
- ) {
- return this._has_display;
- }
-
- /**
- * Returns the value of field 'display'.
- *
- * @return the value of field 'Display'.
- */
- public boolean isDisplay(
- ) {
- return this._display;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'display'.
- *
- * @param display the value of field 'display'.
- */
- public void setDisplay(
- final boolean display) {
- this._display = display;
- this._has_display = true;
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.Group
- */
- public static jalview.schemabinding.version2.Group unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Group) Unmarshaller.unmarshal(jalview.schemabinding.version2.Group.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
+public class Group implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _display.
+ */
+ private boolean _display;
+
+ /**
+ * keeps track of state for field: _display
+ */
+ private boolean _has_display;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Group()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
*/
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ public void deleteDisplay()
+ {
+ this._has_display = false;
+ }
+
+ /**
+ * Returns the value of field 'display'.
+ *
+ * @return the value of field 'Display'.
+ */
+ public boolean getDisplay()
+ {
+ return this._display;
+ }
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Method hasDisplay.
+ *
+ * @return true if at least one Display has been added
+ */
+ public boolean hasDisplay()
+ {
+ return this._has_display;
+ }
+
+ /**
+ * Returns the value of field 'display'.
+ *
+ * @return the value of field 'Display'.
+ */
+ public boolean isDisplay()
+ {
+ return this._display;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'display'.
+ *
+ * @param display
+ * the value of field 'display'.
+ */
+ public void setDisplay(final boolean display)
+ {
+ this._display = display;
+ this._has_display = true;
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Group
+ */
+ public static jalview.schemabinding.version2.Group unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Group) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.Group.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/HiddenColumns.java b/src/jalview/schemabinding/version2/HiddenColumns.java
index e25182f..beac4e0 100644
--- a/src/jalview/schemabinding/version2/HiddenColumns.java
+++ b/src/jalview/schemabinding/version2/HiddenColumns.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,198 +19,209 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class HiddenColumns implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _start.
- */
- private int _start;
-
- /**
- * keeps track of state for field: _start
- */
- private boolean _has_start;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public HiddenColumns() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteStart(
- ) {
- this._has_start= false;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Returns the value of field 'start'.
- *
- * @return the value of field 'Start'.
- */
- public int getStart(
- ) {
- return this._start;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method hasStart.
- *
- * @return true if at least one Start has been added
- */
- public boolean hasStart(
- ) {
- return this._has_start;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- * Sets the value of field 'start'.
- *
- * @param start the value of field 'start'.
- */
- public void setStart(
- final int start) {
- this._start = start;
- this._has_start = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.HiddenColumns
- */
- public static jalview.schemabinding.version2.HiddenColumns unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.HiddenColumns) Unmarshaller.unmarshal(jalview.schemabinding.version2.HiddenColumns.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class HiddenColumns implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _start.
+ */
+ private int _start;
+
+ /**
+ * keeps track of state for field: _start
+ */
+ private boolean _has_start;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public HiddenColumns()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteStart()
+ {
+ this._has_start = false;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Returns the value of field 'start'.
+ *
+ * @return the value of field 'Start'.
+ */
+ public int getStart()
+ {
+ return this._start;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasStart.
+ *
+ * @return true if at least one Start has been added
+ */
+ public boolean hasStart()
+ {
+ return this._has_start;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ * Sets the value of field 'start'.
+ *
+ * @param start
+ * the value of field 'start'.
+ */
+ public void setStart(final int start)
+ {
+ this._start = start;
+ this._has_start = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.HiddenColumns
+ */
+ public static jalview.schemabinding.version2.HiddenColumns unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.HiddenColumns) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.HiddenColumns.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/JGroup.java b/src/jalview/schemabinding/version2/JGroup.java
index cb83036..962569f 100644
--- a/src/jalview/schemabinding/version2/JGroup.java
+++ b/src/jalview/schemabinding/version2/JGroup.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,1132 +19,1242 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JGroup implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _start.
- */
- private int _start;
-
- /**
- * keeps track of state for field: _start
- */
- private boolean _has_start;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
- /**
- * Field _colour.
- */
- private java.lang.String _colour;
-
- /**
- * Field _consThreshold.
- */
- private int _consThreshold;
-
- /**
- * keeps track of state for field: _consThreshold
- */
- private boolean _has_consThreshold;
-
- /**
- * Field _pidThreshold.
- */
- private int _pidThreshold;
-
- /**
- * keeps track of state for field: _pidThreshold
- */
- private boolean _has_pidThreshold;
-
- /**
- * Field _outlineColour.
- */
- private int _outlineColour;
-
- /**
- * keeps track of state for field: _outlineColour
- */
- private boolean _has_outlineColour;
-
- /**
- * Field _displayBoxes.
- */
- private boolean _displayBoxes;
-
- /**
- * keeps track of state for field: _displayBoxes
- */
- private boolean _has_displayBoxes;
-
- /**
- * Field _displayText.
- */
- private boolean _displayText;
-
- /**
- * keeps track of state for field: _displayText
- */
- private boolean _has_displayText;
-
- /**
- * Field _colourText.
- */
- private boolean _colourText;
-
- /**
- * keeps track of state for field: _colourText
- */
- private boolean _has_colourText;
-
- /**
- * Field _textCol1.
- */
- private int _textCol1;
-
- /**
- * keeps track of state for field: _textCol1
- */
- private boolean _has_textCol1;
-
- /**
- * Field _textCol2.
- */
- private int _textCol2;
-
- /**
- * keeps track of state for field: _textCol2
- */
- private boolean _has_textCol2;
-
- /**
- * Field _textColThreshold.
- */
- private int _textColThreshold;
-
- /**
- * keeps track of state for field: _textColThreshold
- */
- private boolean _has_textColThreshold;
-
- /**
- * Field _showUnconserved.
- */
- private boolean _showUnconserved;
-
- /**
- * keeps track of state for field: _showUnconserved
- */
- private boolean _has_showUnconserved;
-
- /**
- * Field _ignoreGapsinConsensus.
- */
- private boolean _ignoreGapsinConsensus = true;
-
- /**
- * keeps track of state for field: _ignoreGapsinConsensus
- */
- private boolean _has_ignoreGapsinConsensus;
-
- /**
- * Field _showConsensusHistogram.
- */
- private boolean _showConsensusHistogram = true;
-
- /**
- * keeps track of state for field: _showConsensusHistogram
- */
- private boolean _has_showConsensusHistogram;
-
- /**
- * Field _showSequenceLogo.
- */
- private boolean _showSequenceLogo = false;
-
- /**
- * keeps track of state for field: _showSequenceLogo
- */
- private boolean _has_showSequenceLogo;
-
- /**
- * Optional sequence group ID (only needs to be unique for this
- * alignment)
- *
- */
- private java.lang.String _id;
-
- /**
- * Field _seqList.
- */
- private java.util.Vector _seqList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JGroup() {
- super();
- this._seqList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSeq(
- final java.lang.String vSeq)
- throws java.lang.IndexOutOfBoundsException {
- this._seqList.addElement(vSeq);
- }
-
- /**
- *
- *
- * @param index
- * @param vSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSeq(
- final int index,
- final java.lang.String vSeq)
- throws java.lang.IndexOutOfBoundsException {
- this._seqList.add(index, vSeq);
- }
-
- /**
- */
- public void deleteColourText(
- ) {
- this._has_colourText= false;
- }
-
- /**
- */
- public void deleteConsThreshold(
- ) {
- this._has_consThreshold= false;
- }
-
- /**
- */
- public void deleteDisplayBoxes(
- ) {
- this._has_displayBoxes= false;
- }
-
- /**
- */
- public void deleteDisplayText(
- ) {
- this._has_displayText= false;
- }
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteIgnoreGapsinConsensus(
- ) {
- this._has_ignoreGapsinConsensus= false;
- }
-
- /**
- */
- public void deleteOutlineColour(
- ) {
- this._has_outlineColour= false;
- }
-
- /**
- */
- public void deletePidThreshold(
- ) {
- this._has_pidThreshold= false;
- }
-
- /**
- */
- public void deleteShowConsensusHistogram(
- ) {
- this._has_showConsensusHistogram= false;
- }
-
- /**
- */
- public void deleteShowSequenceLogo(
- ) {
- this._has_showSequenceLogo= false;
- }
-
- /**
- */
- public void deleteShowUnconserved(
- ) {
- this._has_showUnconserved= false;
- }
-
- /**
- */
- public void deleteStart(
- ) {
- this._has_start= false;
- }
-
- /**
- */
- public void deleteTextCol1(
- ) {
- this._has_textCol1= false;
- }
-
- /**
- */
- public void deleteTextCol2(
- ) {
- this._has_textCol2= false;
- }
-
- /**
- */
- public void deleteTextColThreshold(
- ) {
- this._has_textColThreshold= false;
- }
-
- /**
- * Method enumerateSeq.
- *
- * @return an Enumeration over all java.lang.String elements
- */
- public java.util.Enumeration enumerateSeq(
- ) {
- return this._seqList.elements();
- }
-
- /**
- * Returns the value of field 'colour'.
- *
- * @return the value of field 'Colour'.
- */
- public java.lang.String getColour(
- ) {
- return this._colour;
- }
-
- /**
- * Returns the value of field 'colourText'.
- *
- * @return the value of field 'ColourText'.
- */
- public boolean getColourText(
- ) {
- return this._colourText;
- }
-
- /**
- * Returns the value of field 'consThreshold'.
- *
- * @return the value of field 'ConsThreshold'.
- */
- public int getConsThreshold(
- ) {
- return this._consThreshold;
- }
-
- /**
- * Returns the value of field 'displayBoxes'.
- *
- * @return the value of field 'DisplayBoxes'.
- */
- public boolean getDisplayBoxes(
- ) {
- return this._displayBoxes;
- }
-
- /**
- * Returns the value of field 'displayText'.
- *
- * @return the value of field 'DisplayText'.
- */
- public boolean getDisplayText(
- ) {
- return this._displayText;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Optional sequence group ID (only
- * needs to be unique for this alignment)
- *
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'ignoreGapsinConsensus'.
- *
- * @return the value of field 'IgnoreGapsinConsensus'.
- */
- public boolean getIgnoreGapsinConsensus(
- ) {
- return this._ignoreGapsinConsensus;
- }
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Returns the value of field 'outlineColour'.
- *
- * @return the value of field 'OutlineColour'.
- */
- public int getOutlineColour(
- ) {
- return this._outlineColour;
- }
-
- /**
- * Returns the value of field 'pidThreshold'.
- *
- * @return the value of field 'PidThreshold'.
- */
- public int getPidThreshold(
- ) {
- return this._pidThreshold;
- }
-
- /**
- * Method getSeq.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the java.lang.String at the given index
- */
- public java.lang.String getSeq(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._seqList.size()) {
- throw new IndexOutOfBoundsException("getSeq: Index value '" + index + "' not in range [0.." + (this._seqList.size() - 1) + "]");
- }
-
- return (java.lang.String) _seqList.get(index);
- }
-
- /**
- * Method getSeq.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public java.lang.String[] getSeq(
- ) {
- java.lang.String[] array = new java.lang.String[0];
- return (java.lang.String[]) this._seqList.toArray(array);
- }
-
- /**
- * Method getSeqCount.
- *
- * @return the size of this collection
- */
- public int getSeqCount(
- ) {
- return this._seqList.size();
- }
-
- /**
- * Returns the value of field 'showConsensusHistogram'.
- *
- * @return the value of field 'ShowConsensusHistogram'.
- */
- public boolean getShowConsensusHistogram(
- ) {
- return this._showConsensusHistogram;
- }
-
- /**
- * Returns the value of field 'showSequenceLogo'.
- *
- * @return the value of field 'ShowSequenceLogo'.
- */
- public boolean getShowSequenceLogo(
- ) {
- return this._showSequenceLogo;
- }
-
- /**
- * Returns the value of field 'showUnconserved'.
- *
- * @return the value of field 'ShowUnconserved'.
- */
- public boolean getShowUnconserved(
- ) {
- return this._showUnconserved;
- }
-
- /**
- * Returns the value of field 'start'.
- *
- * @return the value of field 'Start'.
- */
- public int getStart(
- ) {
- return this._start;
- }
-
- /**
- * Returns the value of field 'textCol1'.
- *
- * @return the value of field 'TextCol1'.
- */
- public int getTextCol1(
- ) {
- return this._textCol1;
- }
-
- /**
- * Returns the value of field 'textCol2'.
- *
- * @return the value of field 'TextCol2'.
- */
- public int getTextCol2(
- ) {
- return this._textCol2;
- }
-
- /**
- * Returns the value of field 'textColThreshold'.
- *
- * @return the value of field 'TextColThreshold'.
- */
- public int getTextColThreshold(
- ) {
- return this._textColThreshold;
- }
-
- /**
- * Method hasColourText.
- *
- * @return true if at least one ColourText has been added
- */
- public boolean hasColourText(
- ) {
- return this._has_colourText;
- }
-
- /**
- * Method hasConsThreshold.
- *
- * @return true if at least one ConsThreshold has been added
- */
- public boolean hasConsThreshold(
- ) {
- return this._has_consThreshold;
- }
-
- /**
- * Method hasDisplayBoxes.
- *
- * @return true if at least one DisplayBoxes has been added
- */
- public boolean hasDisplayBoxes(
- ) {
- return this._has_displayBoxes;
- }
-
- /**
- * Method hasDisplayText.
- *
- * @return true if at least one DisplayText has been added
- */
- public boolean hasDisplayText(
- ) {
- return this._has_displayText;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method hasIgnoreGapsinConsensus.
- *
- * @return true if at least one IgnoreGapsinConsensus has been
- * added
- */
- public boolean hasIgnoreGapsinConsensus(
- ) {
- return this._has_ignoreGapsinConsensus;
- }
-
- /**
- * Method hasOutlineColour.
- *
- * @return true if at least one OutlineColour has been added
- */
- public boolean hasOutlineColour(
- ) {
- return this._has_outlineColour;
- }
-
- /**
- * Method hasPidThreshold.
- *
- * @return true if at least one PidThreshold has been added
- */
- public boolean hasPidThreshold(
- ) {
- return this._has_pidThreshold;
- }
-
- /**
- * Method hasShowConsensusHistogram.
- *
- * @return true if at least one ShowConsensusHistogram has been
- * added
- */
- public boolean hasShowConsensusHistogram(
- ) {
- return this._has_showConsensusHistogram;
- }
-
- /**
- * Method hasShowSequenceLogo.
- *
- * @return true if at least one ShowSequenceLogo has been added
- */
- public boolean hasShowSequenceLogo(
- ) {
- return this._has_showSequenceLogo;
- }
-
- /**
- * Method hasShowUnconserved.
- *
- * @return true if at least one ShowUnconserved has been added
- */
- public boolean hasShowUnconserved(
- ) {
- return this._has_showUnconserved;
- }
-
- /**
- * Method hasStart.
- *
- * @return true if at least one Start has been added
- */
- public boolean hasStart(
- ) {
- return this._has_start;
- }
-
- /**
- * Method hasTextCol1.
- *
- * @return true if at least one TextCol1 has been added
- */
- public boolean hasTextCol1(
- ) {
- return this._has_textCol1;
- }
-
- /**
- * Method hasTextCol2.
- *
- * @return true if at least one TextCol2 has been added
- */
- public boolean hasTextCol2(
- ) {
- return this._has_textCol2;
- }
-
- /**
- * Method hasTextColThreshold.
- *
- * @return true if at least one TextColThreshold has been added
- */
- public boolean hasTextColThreshold(
- ) {
- return this._has_textColThreshold;
- }
-
- /**
- * Returns the value of field 'colourText'.
- *
- * @return the value of field 'ColourText'.
- */
- public boolean isColourText(
- ) {
- return this._colourText;
- }
-
- /**
- * Returns the value of field 'displayBoxes'.
- *
- * @return the value of field 'DisplayBoxes'.
- */
- public boolean isDisplayBoxes(
- ) {
- return this._displayBoxes;
- }
-
- /**
- * Returns the value of field 'displayText'.
- *
- * @return the value of field 'DisplayText'.
- */
- public boolean isDisplayText(
- ) {
- return this._displayText;
- }
-
- /**
- * Returns the value of field 'ignoreGapsinConsensus'.
- *
- * @return the value of field 'IgnoreGapsinConsensus'.
- */
- public boolean isIgnoreGapsinConsensus(
- ) {
- return this._ignoreGapsinConsensus;
- }
-
- /**
- * Returns the value of field 'showConsensusHistogram'.
- *
- * @return the value of field 'ShowConsensusHistogram'.
- */
- public boolean isShowConsensusHistogram(
- ) {
- return this._showConsensusHistogram;
- }
-
- /**
- * Returns the value of field 'showSequenceLogo'.
- *
- * @return the value of field 'ShowSequenceLogo'.
- */
- public boolean isShowSequenceLogo(
- ) {
- return this._showSequenceLogo;
- }
-
- /**
- * Returns the value of field 'showUnconserved'.
- *
- * @return the value of field 'ShowUnconserved'.
- */
- public boolean isShowUnconserved(
- ) {
- return this._showUnconserved;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllSeq(
- ) {
- this._seqList.clear();
- }
-
- /**
- * Method removeSeq.
- *
- * @param vSeq
- * @return true if the object was removed from the collection.
- */
- public boolean removeSeq(
- final java.lang.String vSeq) {
- boolean removed = _seqList.remove(vSeq);
- return removed;
- }
-
- /**
- * Method removeSeqAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public java.lang.String removeSeqAt(
- final int index) {
- java.lang.Object obj = this._seqList.remove(index);
- return (java.lang.String) obj;
- }
-
- /**
- * Sets the value of field 'colour'.
- *
- * @param colour the value of field 'colour'.
- */
- public void setColour(
- final java.lang.String colour) {
- this._colour = colour;
- }
-
- /**
- * Sets the value of field 'colourText'.
- *
- * @param colourText the value of field 'colourText'.
- */
- public void setColourText(
- final boolean colourText) {
- this._colourText = colourText;
- this._has_colourText = true;
- }
-
- /**
- * Sets the value of field 'consThreshold'.
- *
- * @param consThreshold the value of field 'consThreshold'.
- */
- public void setConsThreshold(
- final int consThreshold) {
- this._consThreshold = consThreshold;
- this._has_consThreshold = true;
- }
-
- /**
- * Sets the value of field 'displayBoxes'.
- *
- * @param displayBoxes the value of field 'displayBoxes'.
- */
- public void setDisplayBoxes(
- final boolean displayBoxes) {
- this._displayBoxes = displayBoxes;
- this._has_displayBoxes = true;
- }
-
- /**
- * Sets the value of field 'displayText'.
- *
- * @param displayText the value of field 'displayText'.
- */
- public void setDisplayText(
- final boolean displayText) {
- this._displayText = displayText;
- this._has_displayText = true;
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Optional sequence group ID (only
- * needs to be unique for this alignment)
- *
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'ignoreGapsinConsensus'.
- *
- * @param ignoreGapsinConsensus the value of field
- * 'ignoreGapsinConsensus'.
- */
- public void setIgnoreGapsinConsensus(
- final boolean ignoreGapsinConsensus) {
- this._ignoreGapsinConsensus = ignoreGapsinConsensus;
- this._has_ignoreGapsinConsensus = true;
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Sets the value of field 'outlineColour'.
- *
- * @param outlineColour the value of field 'outlineColour'.
- */
- public void setOutlineColour(
- final int outlineColour) {
- this._outlineColour = outlineColour;
- this._has_outlineColour = true;
- }
-
- /**
- * Sets the value of field 'pidThreshold'.
- *
- * @param pidThreshold the value of field 'pidThreshold'.
- */
- public void setPidThreshold(
- final int pidThreshold) {
- this._pidThreshold = pidThreshold;
- this._has_pidThreshold = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSeq(
- final int index,
- final java.lang.String vSeq)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._seqList.size()) {
- throw new IndexOutOfBoundsException("setSeq: Index value '" + index + "' not in range [0.." + (this._seqList.size() - 1) + "]");
- }
-
- this._seqList.set(index, vSeq);
- }
-
- /**
- *
- *
- * @param vSeqArray
- */
- public void setSeq(
- final java.lang.String[] vSeqArray) {
- //-- copy array
- _seqList.clear();
-
- for (int i = 0; i < vSeqArray.length; i++) {
- this._seqList.add(vSeqArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'showConsensusHistogram'.
- *
- * @param showConsensusHistogram the value of field
- * 'showConsensusHistogram'.
- */
- public void setShowConsensusHistogram(
- final boolean showConsensusHistogram) {
- this._showConsensusHistogram = showConsensusHistogram;
- this._has_showConsensusHistogram = true;
- }
-
- /**
- * Sets the value of field 'showSequenceLogo'.
- *
- * @param showSequenceLogo the value of field 'showSequenceLogo'
- */
- public void setShowSequenceLogo(
- final boolean showSequenceLogo) {
- this._showSequenceLogo = showSequenceLogo;
- this._has_showSequenceLogo = true;
- }
-
- /**
- * Sets the value of field 'showUnconserved'.
- *
- * @param showUnconserved the value of field 'showUnconserved'.
- */
- public void setShowUnconserved(
- final boolean showUnconserved) {
- this._showUnconserved = showUnconserved;
- this._has_showUnconserved = true;
- }
-
- /**
- * Sets the value of field 'start'.
- *
- * @param start the value of field 'start'.
- */
- public void setStart(
- final int start) {
- this._start = start;
- this._has_start = true;
- }
-
- /**
- * Sets the value of field 'textCol1'.
- *
- * @param textCol1 the value of field 'textCol1'.
- */
- public void setTextCol1(
- final int textCol1) {
- this._textCol1 = textCol1;
- this._has_textCol1 = true;
- }
-
- /**
- * Sets the value of field 'textCol2'.
- *
- * @param textCol2 the value of field 'textCol2'.
- */
- public void setTextCol2(
- final int textCol2) {
- this._textCol2 = textCol2;
- this._has_textCol2 = true;
- }
-
- /**
- * Sets the value of field 'textColThreshold'.
- *
- * @param textColThreshold the value of field 'textColThreshold'
- */
- public void setTextColThreshold(
- final int textColThreshold) {
- this._textColThreshold = textColThreshold;
- this._has_textColThreshold = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.JGroup
- */
- public static jalview.schemabinding.version2.JGroup unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.JGroup) Unmarshaller.unmarshal(jalview.schemabinding.version2.JGroup.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class JGroup implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _start.
+ */
+ private int _start;
+
+ /**
+ * keeps track of state for field: _start
+ */
+ private boolean _has_start;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _colour.
+ */
+ private java.lang.String _colour;
+
+ /**
+ * Field _consThreshold.
+ */
+ private int _consThreshold;
+
+ /**
+ * keeps track of state for field: _consThreshold
+ */
+ private boolean _has_consThreshold;
+
+ /**
+ * Field _pidThreshold.
+ */
+ private int _pidThreshold;
+
+ /**
+ * keeps track of state for field: _pidThreshold
+ */
+ private boolean _has_pidThreshold;
+
+ /**
+ * Field _outlineColour.
+ */
+ private int _outlineColour;
+
+ /**
+ * keeps track of state for field: _outlineColour
+ */
+ private boolean _has_outlineColour;
+
+ /**
+ * Field _displayBoxes.
+ */
+ private boolean _displayBoxes;
+
+ /**
+ * keeps track of state for field: _displayBoxes
+ */
+ private boolean _has_displayBoxes;
+
+ /**
+ * Field _displayText.
+ */
+ private boolean _displayText;
+
+ /**
+ * keeps track of state for field: _displayText
+ */
+ private boolean _has_displayText;
+
+ /**
+ * Field _colourText.
+ */
+ private boolean _colourText;
+
+ /**
+ * keeps track of state for field: _colourText
+ */
+ private boolean _has_colourText;
+
+ /**
+ * Field _textCol1.
+ */
+ private int _textCol1;
+
+ /**
+ * keeps track of state for field: _textCol1
+ */
+ private boolean _has_textCol1;
+
+ /**
+ * Field _textCol2.
+ */
+ private int _textCol2;
+
+ /**
+ * keeps track of state for field: _textCol2
+ */
+ private boolean _has_textCol2;
+
+ /**
+ * Field _textColThreshold.
+ */
+ private int _textColThreshold;
+
+ /**
+ * keeps track of state for field: _textColThreshold
+ */
+ private boolean _has_textColThreshold;
+
+ /**
+ * Field _showUnconserved.
+ */
+ private boolean _showUnconserved;
+
+ /**
+ * keeps track of state for field: _showUnconserved
+ */
+ private boolean _has_showUnconserved;
+
+ /**
+ * Field _ignoreGapsinConsensus.
+ */
+ private boolean _ignoreGapsinConsensus = true;
+
+ /**
+ * keeps track of state for field: _ignoreGapsinConsensus
+ */
+ private boolean _has_ignoreGapsinConsensus;
+
+ /**
+ * Field _showConsensusHistogram.
+ */
+ private boolean _showConsensusHistogram = true;
+
+ /**
+ * keeps track of state for field: _showConsensusHistogram
+ */
+ private boolean _has_showConsensusHistogram;
+
+ /**
+ * Field _showSequenceLogo.
+ */
+ private boolean _showSequenceLogo = false;
+
+ /**
+ * keeps track of state for field: _showSequenceLogo
+ */
+ private boolean _has_showSequenceLogo;
+
+ /**
+ * Field _normaliseSequenceLogo.
+ */
+ private boolean _normaliseSequenceLogo = false;
+
+ /**
+ * keeps track of state for field: _normaliseSequenceLogo
+ */
+ private boolean _has_normaliseSequenceLogo;
+
+ /**
+ * Optional sequence group ID (only needs to be unique for this alignment)
+ *
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _seqList.
+ */
+ private java.util.Vector _seqList;
+
+ /**
+ * Field _annotationColours.
+ */
+ private jalview.schemabinding.version2.AnnotationColours _annotationColours;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JGroup()
+ {
+ super();
+ this._seqList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSeq(final java.lang.String vSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._seqList.addElement(vSeq);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSeq(final int index, final java.lang.String vSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._seqList.add(index, vSeq);
+ }
+
+ /**
+ */
+ public void deleteColourText()
+ {
+ this._has_colourText = false;
+ }
+
+ /**
+ */
+ public void deleteConsThreshold()
+ {
+ this._has_consThreshold = false;
+ }
+
+ /**
+ */
+ public void deleteDisplayBoxes()
+ {
+ this._has_displayBoxes = false;
+ }
+
+ /**
+ */
+ public void deleteDisplayText()
+ {
+ this._has_displayText = false;
+ }
+
+ /**
+ */
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteIgnoreGapsinConsensus()
+ {
+ this._has_ignoreGapsinConsensus = false;
+ }
+
+ /**
+ */
+ public void deleteNormaliseSequenceLogo()
+ {
+ this._has_normaliseSequenceLogo = false;
+ }
+
+ /**
+ */
+ public void deleteOutlineColour()
+ {
+ this._has_outlineColour = false;
+ }
+
+ /**
+ */
+ public void deletePidThreshold()
+ {
+ this._has_pidThreshold = false;
+ }
+
+ /**
+ */
+ public void deleteShowConsensusHistogram()
+ {
+ this._has_showConsensusHistogram = false;
+ }
+
+ /**
+ */
+ public void deleteShowSequenceLogo()
+ {
+ this._has_showSequenceLogo = false;
+ }
+
+ /**
+ */
+ public void deleteShowUnconserved()
+ {
+ this._has_showUnconserved = false;
+ }
+
+ /**
+ */
+ public void deleteStart()
+ {
+ this._has_start = false;
+ }
+
+ /**
+ */
+ public void deleteTextCol1()
+ {
+ this._has_textCol1 = false;
+ }
+
+ /**
+ */
+ public void deleteTextCol2()
+ {
+ this._has_textCol2 = false;
+ }
+
+ /**
+ */
+ public void deleteTextColThreshold()
+ {
+ this._has_textColThreshold = false;
+ }
+
+ /**
+ * Method enumerateSeq.
+ *
+ * @return an Enumeration over all java.lang.String elements
+ */
+ public java.util.Enumeration enumerateSeq()
+ {
+ return this._seqList.elements();
+ }
+
+ /**
+ * Returns the value of field 'annotationColours'.
+ *
+ * @return the value of field 'AnnotationColours'.
+ */
+ public jalview.schemabinding.version2.AnnotationColours getAnnotationColours()
+ {
+ return this._annotationColours;
+ }
+
+ /**
+ * Returns the value of field 'colour'.
+ *
+ * @return the value of field 'Colour'.
+ */
+ public java.lang.String getColour()
+ {
+ return this._colour;
+ }
+
+ /**
+ * Returns the value of field 'colourText'.
+ *
+ * @return the value of field 'ColourText'.
+ */
+ public boolean getColourText()
+ {
+ return this._colourText;
+ }
+
+ /**
+ * Returns the value of field 'consThreshold'.
+ *
+ * @return the value of field 'ConsThreshold'.
+ */
+ public int getConsThreshold()
+ {
+ return this._consThreshold;
+ }
+
+ /**
+ * Returns the value of field 'displayBoxes'.
+ *
+ * @return the value of field 'DisplayBoxes'.
+ */
+ public boolean getDisplayBoxes()
+ {
+ return this._displayBoxes;
+ }
+
+ /**
+ * Returns the value of field 'displayText'.
+ *
+ * @return the value of field 'DisplayText'.
+ */
+ public boolean getDisplayText()
+ {
+ return this._displayText;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Optional sequence group ID (only needs to be unique for this
+ * alignment)
+ *
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'ignoreGapsinConsensus'.
+ *
+ * @return the value of field 'IgnoreGapsinConsensus'.
+ */
+ public boolean getIgnoreGapsinConsensus()
+ {
+ return this._ignoreGapsinConsensus;
+ }
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Returns the value of field 'normaliseSequenceLogo'.
+ *
+ * @return the value of field 'NormaliseSequenceLogo'.
+ */
+ public boolean getNormaliseSequenceLogo()
+ {
+ return this._normaliseSequenceLogo;
+ }
+
+ /**
+ * Returns the value of field 'outlineColour'.
+ *
+ * @return the value of field 'OutlineColour'.
+ */
+ public int getOutlineColour()
+ {
+ return this._outlineColour;
+ }
+
+ /**
+ * Returns the value of field 'pidThreshold'.
+ *
+ * @return the value of field 'PidThreshold'.
+ */
+ public int getPidThreshold()
+ {
+ return this._pidThreshold;
+ }
+
+ /**
+ * Method getSeq.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the java.lang.String at the given index
+ */
+ public java.lang.String getSeq(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._seqList.size())
+ {
+ throw new IndexOutOfBoundsException("getSeq: Index value '" + index
+ + "' not in range [0.." + (this._seqList.size() - 1) + "]");
+ }
+
+ return (java.lang.String) _seqList.get(index);
+ }
+
+ /**
+ * Method getSeq.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public java.lang.String[] getSeq()
+ {
+ java.lang.String[] array = new java.lang.String[0];
+ return (java.lang.String[]) this._seqList.toArray(array);
+ }
+
+ /**
+ * Method getSeqCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSeqCount()
+ {
+ return this._seqList.size();
+ }
+
+ /**
+ * Returns the value of field 'showConsensusHistogram'.
+ *
+ * @return the value of field 'ShowConsensusHistogram'.
+ */
+ public boolean getShowConsensusHistogram()
+ {
+ return this._showConsensusHistogram;
+ }
+
+ /**
+ * Returns the value of field 'showSequenceLogo'.
+ *
+ * @return the value of field 'ShowSequenceLogo'.
+ */
+ public boolean getShowSequenceLogo()
+ {
+ return this._showSequenceLogo;
+ }
+
+ /**
+ * Returns the value of field 'showUnconserved'.
+ *
+ * @return the value of field 'ShowUnconserved'.
+ */
+ public boolean getShowUnconserved()
+ {
+ return this._showUnconserved;
+ }
+
+ /**
+ * Returns the value of field 'start'.
+ *
+ * @return the value of field 'Start'.
+ */
+ public int getStart()
+ {
+ return this._start;
+ }
+
+ /**
+ * Returns the value of field 'textCol1'.
+ *
+ * @return the value of field 'TextCol1'.
+ */
+ public int getTextCol1()
+ {
+ return this._textCol1;
+ }
+
+ /**
+ * Returns the value of field 'textCol2'.
+ *
+ * @return the value of field 'TextCol2'.
+ */
+ public int getTextCol2()
+ {
+ return this._textCol2;
+ }
+
+ /**
+ * Returns the value of field 'textColThreshold'.
+ *
+ * @return the value of field 'TextColThreshold'.
+ */
+ public int getTextColThreshold()
+ {
+ return this._textColThreshold;
+ }
+
+ /**
+ * Method hasColourText.
+ *
+ * @return true if at least one ColourText has been added
+ */
+ public boolean hasColourText()
+ {
+ return this._has_colourText;
+ }
+
+ /**
+ * Method hasConsThreshold.
+ *
+ * @return true if at least one ConsThreshold has been added
+ */
+ public boolean hasConsThreshold()
+ {
+ return this._has_consThreshold;
+ }
+
+ /**
+ * Method hasDisplayBoxes.
+ *
+ * @return true if at least one DisplayBoxes has been added
+ */
+ public boolean hasDisplayBoxes()
+ {
+ return this._has_displayBoxes;
+ }
+
+ /**
+ * Method hasDisplayText.
+ *
+ * @return true if at least one DisplayText has been added
+ */
+ public boolean hasDisplayText()
+ {
+ return this._has_displayText;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasIgnoreGapsinConsensus.
+ *
+ * @return true if at least one IgnoreGapsinConsensus has been added
+ */
+ public boolean hasIgnoreGapsinConsensus()
+ {
+ return this._has_ignoreGapsinConsensus;
+ }
+
+ /**
+ * Method hasNormaliseSequenceLogo.
+ *
+ * @return true if at least one NormaliseSequenceLogo has been added
+ */
+ public boolean hasNormaliseSequenceLogo()
+ {
+ return this._has_normaliseSequenceLogo;
+ }
+
+ /**
+ * Method hasOutlineColour.
+ *
+ * @return true if at least one OutlineColour has been added
+ */
+ public boolean hasOutlineColour()
+ {
+ return this._has_outlineColour;
+ }
+
+ /**
+ * Method hasPidThreshold.
+ *
+ * @return true if at least one PidThreshold has been added
+ */
+ public boolean hasPidThreshold()
+ {
+ return this._has_pidThreshold;
+ }
+
+ /**
+ * Method hasShowConsensusHistogram.
+ *
+ * @return true if at least one ShowConsensusHistogram has been added
+ */
+ public boolean hasShowConsensusHistogram()
+ {
+ return this._has_showConsensusHistogram;
+ }
+
+ /**
+ * Method hasShowSequenceLogo.
+ *
+ * @return true if at least one ShowSequenceLogo has been added
+ */
+ public boolean hasShowSequenceLogo()
+ {
+ return this._has_showSequenceLogo;
+ }
+
+ /**
+ * Method hasShowUnconserved.
+ *
+ * @return true if at least one ShowUnconserved has been added
+ */
+ public boolean hasShowUnconserved()
+ {
+ return this._has_showUnconserved;
+ }
+
+ /**
+ * Method hasStart.
+ *
+ * @return true if at least one Start has been added
+ */
+ public boolean hasStart()
+ {
+ return this._has_start;
+ }
+
+ /**
+ * Method hasTextCol1.
+ *
+ * @return true if at least one TextCol1 has been added
+ */
+ public boolean hasTextCol1()
+ {
+ return this._has_textCol1;
+ }
+
+ /**
+ * Method hasTextCol2.
+ *
+ * @return true if at least one TextCol2 has been added
+ */
+ public boolean hasTextCol2()
+ {
+ return this._has_textCol2;
+ }
+
+ /**
+ * Method hasTextColThreshold.
+ *
+ * @return true if at least one TextColThreshold has been added
+ */
+ public boolean hasTextColThreshold()
+ {
+ return this._has_textColThreshold;
+ }
+
+ /**
+ * Returns the value of field 'colourText'.
+ *
+ * @return the value of field 'ColourText'.
+ */
+ public boolean isColourText()
+ {
+ return this._colourText;
+ }
+
+ /**
+ * Returns the value of field 'displayBoxes'.
+ *
+ * @return the value of field 'DisplayBoxes'.
+ */
+ public boolean isDisplayBoxes()
+ {
+ return this._displayBoxes;
+ }
+
+ /**
+ * Returns the value of field 'displayText'.
+ *
+ * @return the value of field 'DisplayText'.
+ */
+ public boolean isDisplayText()
+ {
+ return this._displayText;
+ }
+
+ /**
+ * Returns the value of field 'ignoreGapsinConsensus'.
+ *
+ * @return the value of field 'IgnoreGapsinConsensus'.
+ */
+ public boolean isIgnoreGapsinConsensus()
+ {
+ return this._ignoreGapsinConsensus;
+ }
+
+ /**
+ * Returns the value of field 'normaliseSequenceLogo'.
+ *
+ * @return the value of field 'NormaliseSequenceLogo'.
+ */
+ public boolean isNormaliseSequenceLogo()
+ {
+ return this._normaliseSequenceLogo;
+ }
+
+ /**
+ * Returns the value of field 'showConsensusHistogram'.
+ *
+ * @return the value of field 'ShowConsensusHistogram'.
+ */
+ public boolean isShowConsensusHistogram()
+ {
+ return this._showConsensusHistogram;
+ }
+
+ /**
+ * Returns the value of field 'showSequenceLogo'.
+ *
+ * @return the value of field 'ShowSequenceLogo'.
+ */
+ public boolean isShowSequenceLogo()
+ {
+ return this._showSequenceLogo;
+ }
+
+ /**
+ * Returns the value of field 'showUnconserved'.
+ *
+ * @return the value of field 'ShowUnconserved'.
+ */
+ public boolean isShowUnconserved()
+ {
+ return this._showUnconserved;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllSeq()
+ {
+ this._seqList.clear();
+ }
+
+ /**
+ * Method removeSeq.
+ *
+ * @param vSeq
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSeq(final java.lang.String vSeq)
+ {
+ boolean removed = _seqList.remove(vSeq);
+ return removed;
+ }
+
+ /**
+ * Method removeSeqAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public java.lang.String removeSeqAt(final int index)
+ {
+ java.lang.Object obj = this._seqList.remove(index);
+ return (java.lang.String) obj;
+ }
+
+ /**
+ * Sets the value of field 'annotationColours'.
+ *
+ * @param annotationColours
+ * the value of field 'annotationColours'.
+ */
+ public void setAnnotationColours(
+ final jalview.schemabinding.version2.AnnotationColours annotationColours)
+ {
+ this._annotationColours = annotationColours;
+ }
+
+ /**
+ * Sets the value of field 'colour'.
+ *
+ * @param colour
+ * the value of field 'colour'.
+ */
+ public void setColour(final java.lang.String colour)
+ {
+ this._colour = colour;
+ }
+
+ /**
+ * Sets the value of field 'colourText'.
+ *
+ * @param colourText
+ * the value of field 'colourText'.
+ */
+ public void setColourText(final boolean colourText)
+ {
+ this._colourText = colourText;
+ this._has_colourText = true;
+ }
+
+ /**
+ * Sets the value of field 'consThreshold'.
+ *
+ * @param consThreshold
+ * the value of field 'consThreshold'.
+ */
+ public void setConsThreshold(final int consThreshold)
+ {
+ this._consThreshold = consThreshold;
+ this._has_consThreshold = true;
+ }
+
+ /**
+ * Sets the value of field 'displayBoxes'.
+ *
+ * @param displayBoxes
+ * the value of field 'displayBoxes'.
+ */
+ public void setDisplayBoxes(final boolean displayBoxes)
+ {
+ this._displayBoxes = displayBoxes;
+ this._has_displayBoxes = true;
+ }
+
+ /**
+ * Sets the value of field 'displayText'.
+ *
+ * @param displayText
+ * the value of field 'displayText'.
+ */
+ public void setDisplayText(final boolean displayText)
+ {
+ this._displayText = displayText;
+ this._has_displayText = true;
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Optional sequence group ID (only needs to be unique for this alignment)
+ *
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'ignoreGapsinConsensus'.
+ *
+ * @param ignoreGapsinConsensus
+ * the value of field 'ignoreGapsinConsensus'.
+ */
+ public void setIgnoreGapsinConsensus(final boolean ignoreGapsinConsensus)
+ {
+ this._ignoreGapsinConsensus = ignoreGapsinConsensus;
+ this._has_ignoreGapsinConsensus = true;
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Sets the value of field 'normaliseSequenceLogo'.
+ *
+ * @param normaliseSequenceLogo
+ * the value of field 'normaliseSequenceLogo'.
+ */
+ public void setNormaliseSequenceLogo(final boolean normaliseSequenceLogo)
+ {
+ this._normaliseSequenceLogo = normaliseSequenceLogo;
+ this._has_normaliseSequenceLogo = true;
+ }
+
+ /**
+ * Sets the value of field 'outlineColour'.
+ *
+ * @param outlineColour
+ * the value of field 'outlineColour'.
+ */
+ public void setOutlineColour(final int outlineColour)
+ {
+ this._outlineColour = outlineColour;
+ this._has_outlineColour = true;
+ }
+
+ /**
+ * Sets the value of field 'pidThreshold'.
+ *
+ * @param pidThreshold
+ * the value of field 'pidThreshold'.
+ */
+ public void setPidThreshold(final int pidThreshold)
+ {
+ this._pidThreshold = pidThreshold;
+ this._has_pidThreshold = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSeq(final int index, final java.lang.String vSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._seqList.size())
+ {
+ throw new IndexOutOfBoundsException("setSeq: Index value '" + index
+ + "' not in range [0.." + (this._seqList.size() - 1) + "]");
+ }
+
+ this._seqList.set(index, vSeq);
+ }
+
+ /**
+ *
+ *
+ * @param vSeqArray
+ */
+ public void setSeq(final java.lang.String[] vSeqArray)
+ {
+ // -- copy array
+ _seqList.clear();
+
+ for (int i = 0; i < vSeqArray.length; i++)
+ {
+ this._seqList.add(vSeqArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'showConsensusHistogram'.
+ *
+ * @param showConsensusHistogram
+ * the value of field 'showConsensusHistogram'.
+ */
+ public void setShowConsensusHistogram(final boolean showConsensusHistogram)
+ {
+ this._showConsensusHistogram = showConsensusHistogram;
+ this._has_showConsensusHistogram = true;
+ }
+
+ /**
+ * Sets the value of field 'showSequenceLogo'.
+ *
+ * @param showSequenceLogo
+ * the value of field 'showSequenceLogo'
+ */
+ public void setShowSequenceLogo(final boolean showSequenceLogo)
+ {
+ this._showSequenceLogo = showSequenceLogo;
+ this._has_showSequenceLogo = true;
+ }
+
+ /**
+ * Sets the value of field 'showUnconserved'.
+ *
+ * @param showUnconserved
+ * the value of field 'showUnconserved'.
+ */
+ public void setShowUnconserved(final boolean showUnconserved)
+ {
+ this._showUnconserved = showUnconserved;
+ this._has_showUnconserved = true;
+ }
+
+ /**
+ * Sets the value of field 'start'.
+ *
+ * @param start
+ * the value of field 'start'.
+ */
+ public void setStart(final int start)
+ {
+ this._start = start;
+ this._has_start = true;
+ }
+
+ /**
+ * Sets the value of field 'textCol1'.
+ *
+ * @param textCol1
+ * the value of field 'textCol1'.
+ */
+ public void setTextCol1(final int textCol1)
+ {
+ this._textCol1 = textCol1;
+ this._has_textCol1 = true;
+ }
+
+ /**
+ * Sets the value of field 'textCol2'.
+ *
+ * @param textCol2
+ * the value of field 'textCol2'.
+ */
+ public void setTextCol2(final int textCol2)
+ {
+ this._textCol2 = textCol2;
+ this._has_textCol2 = true;
+ }
+
+ /**
+ * Sets the value of field 'textColThreshold'.
+ *
+ * @param textColThreshold
+ * the value of field 'textColThreshold'
+ */
+ public void setTextColThreshold(final int textColThreshold)
+ {
+ this._textColThreshold = textColThreshold;
+ this._has_textColThreshold = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.JGroup
+ */
+ public static jalview.schemabinding.version2.JGroup unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.JGroup) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.JGroup.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/JSeq.java b/src/jalview/schemabinding/version2/JSeq.java
index d6d0192..9ca6708 100644
--- a/src/jalview/schemabinding/version2/JSeq.java
+++ b/src/jalview/schemabinding/version2/JSeq.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,796 +19,1020 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JSeq implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _colour.
- */
- private int _colour;
-
- /**
- * keeps track of state for field: _colour
- */
- private boolean _has_colour;
-
- /**
- * Field _start.
- */
- private int _start;
-
- /**
- * keeps track of state for field: _start
- */
- private boolean _has_start;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
- /**
- * Field _id.
- */
- private java.lang.String _id;
-
- /**
- * Field _hidden.
- */
- private boolean _hidden;
-
- /**
- * keeps track of state for field: _hidden
- */
- private boolean _has_hidden;
-
- /**
- * Field _featuresList.
- */
- private java.util.Vector _featuresList;
-
- /**
- * Field _pdbidsList.
- */
- private java.util.Vector _pdbidsList;
-
- /**
- * Field _hiddenSequencesList.
- */
- private java.util.Vector _hiddenSequencesList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JSeq() {
- super();
- this._featuresList = new java.util.Vector();
- this._pdbidsList = new java.util.Vector();
- this._hiddenSequencesList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vFeatures
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addFeatures(
- final jalview.schemabinding.version2.Features vFeatures)
- throws java.lang.IndexOutOfBoundsException {
- this._featuresList.addElement(vFeatures);
- }
-
- /**
- *
- *
- * @param index
- * @param vFeatures
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addFeatures(
- final int index,
- final jalview.schemabinding.version2.Features vFeatures)
- throws java.lang.IndexOutOfBoundsException {
- this._featuresList.add(index, vFeatures);
- }
-
- /**
- *
- *
- * @param vHiddenSequences
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addHiddenSequences(
- final int vHiddenSequences)
- throws java.lang.IndexOutOfBoundsException {
- this._hiddenSequencesList.addElement(new java.lang.Integer(vHiddenSequences));
- }
-
- /**
- *
- *
- * @param index
- * @param vHiddenSequences
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addHiddenSequences(
- final int index,
- final int vHiddenSequences)
- throws java.lang.IndexOutOfBoundsException {
- this._hiddenSequencesList.add(index, new java.lang.Integer(vHiddenSequences));
- }
-
- /**
- *
- *
- * @param vPdbids
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbids(
- final jalview.schemabinding.version2.Pdbids vPdbids)
- throws java.lang.IndexOutOfBoundsException {
- this._pdbidsList.addElement(vPdbids);
- }
-
- /**
- *
- *
- * @param index
- * @param vPdbids
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbids(
- final int index,
- final jalview.schemabinding.version2.Pdbids vPdbids)
- throws java.lang.IndexOutOfBoundsException {
- this._pdbidsList.add(index, vPdbids);
- }
-
- /**
- */
- public void deleteColour(
- ) {
- this._has_colour= false;
- }
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteHidden(
- ) {
- this._has_hidden= false;
- }
-
- /**
- */
- public void deleteStart(
- ) {
- this._has_start= false;
- }
-
- /**
- * Method enumerateFeatures.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Features elements
- */
- public java.util.Enumeration enumerateFeatures(
- ) {
- return this._featuresList.elements();
- }
-
- /**
- * Method enumerateHiddenSequences.
- *
- * @return an Enumeration over all int elements
- */
- public java.util.Enumeration enumerateHiddenSequences(
- ) {
- return this._hiddenSequencesList.elements();
- }
-
- /**
- * Method enumeratePdbids.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Pdbids elements
- */
- public java.util.Enumeration enumeratePdbids(
- ) {
- return this._pdbidsList.elements();
- }
-
- /**
- * Returns the value of field 'colour'.
- *
- * @return the value of field 'Colour'.
- */
- public int getColour(
- ) {
- return this._colour;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Method getFeatures.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Features at the given index
- */
- public jalview.schemabinding.version2.Features getFeatures(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._featuresList.size()) {
- throw new IndexOutOfBoundsException("getFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Features) _featuresList.get(index);
- }
-
- /**
- * Method getFeatures.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Features[] getFeatures(
- ) {
- jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
- return (jalview.schemabinding.version2.Features[]) this._featuresList.toArray(array);
- }
-
- /**
- * Method getFeaturesCount.
- *
- * @return the size of this collection
- */
- public int getFeaturesCount(
- ) {
- return this._featuresList.size();
- }
-
- /**
- * Returns the value of field 'hidden'.
- *
- * @return the value of field 'Hidden'.
- */
- public boolean getHidden(
- ) {
- return this._hidden;
- }
-
- /**
- * Method getHiddenSequences.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the int at the given index
- */
- public int getHiddenSequences(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._hiddenSequencesList.size()) {
- throw new IndexOutOfBoundsException("getHiddenSequences: Index value '" + index + "' not in range [0.." + (this._hiddenSequencesList.size() - 1) + "]");
- }
-
- return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
- }
-
- /**
- * Method getHiddenSequences.Returns the contents of the
- * collection in an Array.
- *
- * @return this collection as an Array
- */
- public int[] getHiddenSequences(
- ) {
- int size = this._hiddenSequencesList.size();
- int[] array = new int[size];
- java.util.Iterator iter = _hiddenSequencesList.iterator();
- for (int index = 0; index < size; index++) {
- array[index] = ((java.lang.Integer) iter.next()).intValue();
- }
- return array;
- }
-
- /**
- * Method getHiddenSequencesCount.
- *
- * @return the size of this collection
- */
- public int getHiddenSequencesCount(
- ) {
- return this._hiddenSequencesList.size();
- }
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Method getPdbids.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Pdbids at the given index
- */
- public jalview.schemabinding.version2.Pdbids getPdbids(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._pdbidsList.size()) {
- throw new IndexOutOfBoundsException("getPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
- }
-
- /**
- * Method getPdbids.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Pdbids[] getPdbids(
- ) {
- jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
- return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList.toArray(array);
- }
-
- /**
- * Method getPdbidsCount.
- *
- * @return the size of this collection
- */
- public int getPdbidsCount(
- ) {
- return this._pdbidsList.size();
- }
-
- /**
- * Returns the value of field 'start'.
- *
- * @return the value of field 'Start'.
- */
- public int getStart(
- ) {
- return this._start;
- }
-
- /**
- * Method hasColour.
- *
- * @return true if at least one Colour has been added
- */
- public boolean hasColour(
- ) {
- return this._has_colour;
+public class JSeq implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _colour.
+ */
+ private int _colour;
+
+ /**
+ * keeps track of state for field: _colour
+ */
+ private boolean _has_colour;
+
+ /**
+ * Field _start.
+ */
+ private int _start;
+
+ /**
+ * keeps track of state for field: _start
+ */
+ private boolean _has_start;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ /**
+ * Field _id.
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _hidden.
+ */
+ private boolean _hidden;
+
+ /**
+ * keeps track of state for field: _hidden
+ */
+ private boolean _has_hidden;
+
+ /**
+ * Field _featuresList.
+ */
+ private java.util.Vector _featuresList;
+
+ /**
+ * Field _pdbidsList.
+ */
+ private java.util.Vector _pdbidsList;
+
+ /**
+ * Field _hiddenSequencesList.
+ */
+ private java.util.Vector _hiddenSequencesList;
+
+ /**
+ * Reference to a viewer showing RNA structure for this sequence. Schema
+ * supports one viewer showing multiple annotations for multiple sequences,
+ * though currently only one annotation for one sequence (gapped or trimmed)
+ * is used
+ *
+ */
+ private java.util.Vector _rnaViewerList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JSeq()
+ {
+ super();
+ this._featuresList = new java.util.Vector();
+ this._pdbidsList = new java.util.Vector();
+ this._hiddenSequencesList = new java.util.Vector();
+ this._rnaViewerList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vFeatures
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addFeatures(
+ final jalview.schemabinding.version2.Features vFeatures)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._featuresList.addElement(vFeatures);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vFeatures
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addFeatures(final int index,
+ final jalview.schemabinding.version2.Features vFeatures)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._featuresList.add(index, vFeatures);
+ }
+
+ /**
+ *
+ *
+ * @param vHiddenSequences
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addHiddenSequences(final int vHiddenSequences)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._hiddenSequencesList.addElement(new java.lang.Integer(
+ vHiddenSequences));
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vHiddenSequences
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addHiddenSequences(final int index, final int vHiddenSequences)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._hiddenSequencesList.add(index, new java.lang.Integer(
+ vHiddenSequences));
+ }
+
+ /**
+ *
+ *
+ * @param vPdbids
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbids(final jalview.schemabinding.version2.Pdbids vPdbids)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._pdbidsList.addElement(vPdbids);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbids
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbids(final int index,
+ final jalview.schemabinding.version2.Pdbids vPdbids)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._pdbidsList.add(index, vPdbids);
+ }
+
+ /**
+ *
+ *
+ * @param vRnaViewer
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addRnaViewer(
+ final jalview.schemabinding.version2.RnaViewer vRnaViewer)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._rnaViewerList.addElement(vRnaViewer);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vRnaViewer
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addRnaViewer(final int index,
+ final jalview.schemabinding.version2.RnaViewer vRnaViewer)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._rnaViewerList.add(index, vRnaViewer);
+ }
+
+ /**
+ */
+ public void deleteColour()
+ {
+ this._has_colour = false;
+ }
+
+ /**
+ */
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteHidden()
+ {
+ this._has_hidden = false;
+ }
+
+ /**
+ */
+ public void deleteStart()
+ {
+ this._has_start = false;
+ }
+
+ /**
+ * Method enumerateFeatures.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Features
+ * elements
+ */
+ public java.util.Enumeration enumerateFeatures()
+ {
+ return this._featuresList.elements();
+ }
+
+ /**
+ * Method enumerateHiddenSequences.
+ *
+ * @return an Enumeration over all int elements
+ */
+ public java.util.Enumeration enumerateHiddenSequences()
+ {
+ return this._hiddenSequencesList.elements();
+ }
+
+ /**
+ * Method enumeratePdbids.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Pdbids
+ * elements
+ */
+ public java.util.Enumeration enumeratePdbids()
+ {
+ return this._pdbidsList.elements();
+ }
+
+ /**
+ * Method enumerateRnaViewer.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.RnaViewer
+ * elements
+ */
+ public java.util.Enumeration enumerateRnaViewer()
+ {
+ return this._rnaViewerList.elements();
+ }
+
+ /**
+ * Returns the value of field 'colour'.
+ *
+ * @return the value of field 'Colour'.
+ */
+ public int getColour()
+ {
+ return this._colour;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Method getFeatures.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Features at the
+ * given index
+ */
+ public jalview.schemabinding.version2.Features getFeatures(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._featuresList.size())
+ {
+ throw new IndexOutOfBoundsException("getFeatures: Index value '"
+ + index + "' not in range [0.."
+ + (this._featuresList.size() - 1) + "]");
}
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
+ return (jalview.schemabinding.version2.Features) _featuresList
+ .get(index);
+ }
+
+ /**
+ * Method getFeatures.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Features[] getFeatures()
+ {
+ jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
+ return (jalview.schemabinding.version2.Features[]) this._featuresList
+ .toArray(array);
+ }
+
+ /**
+ * Method getFeaturesCount.
+ *
+ * @return the size of this collection
+ */
+ public int getFeaturesCount()
+ {
+ return this._featuresList.size();
+ }
+
+ /**
+ * Returns the value of field 'hidden'.
+ *
+ * @return the value of field 'Hidden'.
+ */
+ public boolean getHidden()
+ {
+ return this._hidden;
+ }
+
+ /**
+ * Method getHiddenSequences.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the int at the given index
+ */
+ public int getHiddenSequences(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._hiddenSequencesList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "getHiddenSequences: Index value '" + index
+ + "' not in range [0.."
+ + (this._hiddenSequencesList.size() - 1) + "]");
}
- /**
- * Method hasHidden.
- *
- * @return true if at least one Hidden has been added
- */
- public boolean hasHidden(
- ) {
- return this._has_hidden;
+ return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
+ }
+
+ /**
+ * Method getHiddenSequences.Returns the contents of the collection in an
+ * Array.
+ *
+ * @return this collection as an Array
+ */
+ public int[] getHiddenSequences()
+ {
+ int size = this._hiddenSequencesList.size();
+ int[] array = new int[size];
+ java.util.Iterator iter = _hiddenSequencesList.iterator();
+ for (int index = 0; index < size; index++)
+ {
+ array[index] = ((java.lang.Integer) iter.next()).intValue();
}
-
- /**
- * Method hasStart.
- *
- * @return true if at least one Start has been added
- */
- public boolean hasStart(
- ) {
- return this._has_start;
+ return array;
+ }
+
+ /**
+ * Method getHiddenSequencesCount.
+ *
+ * @return the size of this collection
+ */
+ public int getHiddenSequencesCount()
+ {
+ return this._hiddenSequencesList.size();
+ }
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Method getPdbids.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Pdbids at the given
+ * index
+ */
+ public jalview.schemabinding.version2.Pdbids getPdbids(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._pdbidsList.size())
+ {
+ throw new IndexOutOfBoundsException("getPdbids: Index value '"
+ + index + "' not in range [0.."
+ + (this._pdbidsList.size() - 1) + "]");
}
- /**
- * Returns the value of field 'hidden'.
- *
- * @return the value of field 'Hidden'.
- */
- public boolean isHidden(
- ) {
- return this._hidden;
+ return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
+ }
+
+ /**
+ * Method getPdbids.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Pdbids[] getPdbids()
+ {
+ jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
+ return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList
+ .toArray(array);
+ }
+
+ /**
+ * Method getPdbidsCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPdbidsCount()
+ {
+ return this._pdbidsList.size();
+ }
+
+ /**
+ * Method getRnaViewer.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.RnaViewer at the
+ * given index
+ */
+ public jalview.schemabinding.version2.RnaViewer getRnaViewer(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._rnaViewerList.size())
+ {
+ throw new IndexOutOfBoundsException("getRnaViewer: Index value '"
+ + index + "' not in range [0.."
+ + (this._rnaViewerList.size() - 1) + "]");
}
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ return (jalview.schemabinding.version2.RnaViewer) _rnaViewerList
+ .get(index);
+ }
+
+ /**
+ * Method getRnaViewer.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.RnaViewer[] getRnaViewer()
+ {
+ jalview.schemabinding.version2.RnaViewer[] array = new jalview.schemabinding.version2.RnaViewer[0];
+ return (jalview.schemabinding.version2.RnaViewer[]) this._rnaViewerList
+ .toArray(array);
+ }
+
+ /**
+ * Method getRnaViewerCount.
+ *
+ * @return the size of this collection
+ */
+ public int getRnaViewerCount()
+ {
+ return this._rnaViewerList.size();
+ }
+
+ /**
+ * Returns the value of field 'start'.
+ *
+ * @return the value of field 'Start'.
+ */
+ public int getStart()
+ {
+ return this._start;
+ }
+
+ /**
+ * Method hasColour.
+ *
+ * @return true if at least one Colour has been added
+ */
+ public boolean hasColour()
+ {
+ return this._has_colour;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasHidden.
+ *
+ * @return true if at least one Hidden has been added
+ */
+ public boolean hasHidden()
+ {
+ return this._has_hidden;
+ }
+
+ /**
+ * Method hasStart.
+ *
+ * @return true if at least one Start has been added
+ */
+ public boolean hasStart()
+ {
+ return this._has_start;
+ }
+
+ /**
+ * Returns the value of field 'hidden'.
+ *
+ * @return the value of field 'Hidden'.
+ */
+ public boolean isHidden()
+ {
+ return this._hidden;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllFeatures()
+ {
+ this._featuresList.clear();
+ }
+
+ /**
+ */
+ public void removeAllHiddenSequences()
+ {
+ this._hiddenSequencesList.clear();
+ }
+
+ /**
+ */
+ public void removeAllPdbids()
+ {
+ this._pdbidsList.clear();
+ }
+
+ /**
+ */
+ public void removeAllRnaViewer()
+ {
+ this._rnaViewerList.clear();
+ }
+
+ /**
+ * Method removeFeatures.
+ *
+ * @param vFeatures
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeFeatures(
+ final jalview.schemabinding.version2.Features vFeatures)
+ {
+ boolean removed = _featuresList.remove(vFeatures);
+ return removed;
+ }
+
+ /**
+ * Method removeFeaturesAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Features removeFeaturesAt(
+ final int index)
+ {
+ java.lang.Object obj = this._featuresList.remove(index);
+ return (jalview.schemabinding.version2.Features) obj;
+ }
+
+ /**
+ * Method removeHiddenSequences.
+ *
+ * @param vHiddenSequences
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeHiddenSequences(final int vHiddenSequences)
+ {
+ boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(
+ vHiddenSequences));
+ return removed;
+ }
+
+ /**
+ * Method removeHiddenSequencesAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public int removeHiddenSequencesAt(final int index)
+ {
+ java.lang.Object obj = this._hiddenSequencesList.remove(index);
+ return ((java.lang.Integer) obj).intValue();
+ }
+
+ /**
+ * Method removePdbids.
+ *
+ * @param vPdbids
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removePdbids(
+ final jalview.schemabinding.version2.Pdbids vPdbids)
+ {
+ boolean removed = _pdbidsList.remove(vPdbids);
+ return removed;
+ }
+
+ /**
+ * Method removePdbidsAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Pdbids removePdbidsAt(
+ final int index)
+ {
+ java.lang.Object obj = this._pdbidsList.remove(index);
+ return (jalview.schemabinding.version2.Pdbids) obj;
+ }
+
+ /**
+ * Method removeRnaViewer.
+ *
+ * @param vRnaViewer
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeRnaViewer(
+ final jalview.schemabinding.version2.RnaViewer vRnaViewer)
+ {
+ boolean removed = _rnaViewerList.remove(vRnaViewer);
+ return removed;
+ }
+
+ /**
+ * Method removeRnaViewerAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.RnaViewer removeRnaViewerAt(
+ final int index)
+ {
+ java.lang.Object obj = this._rnaViewerList.remove(index);
+ return (jalview.schemabinding.version2.RnaViewer) obj;
+ }
+
+ /**
+ * Sets the value of field 'colour'.
+ *
+ * @param colour
+ * the value of field 'colour'.
+ */
+ public void setColour(final int colour)
+ {
+ this._colour = colour;
+ this._has_colour = true;
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vFeatures
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setFeatures(final int index,
+ final jalview.schemabinding.version2.Features vFeatures)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._featuresList.size())
+ {
+ throw new IndexOutOfBoundsException("setFeatures: Index value '"
+ + index + "' not in range [0.."
+ + (this._featuresList.size() - 1) + "]");
}
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
+ this._featuresList.set(index, vFeatures);
+ }
+
+ /**
+ *
+ *
+ * @param vFeaturesArray
+ */
+ public void setFeatures(
+ final jalview.schemabinding.version2.Features[] vFeaturesArray)
+ {
+ // -- copy array
+ _featuresList.clear();
+
+ for (int i = 0; i < vFeaturesArray.length; i++)
+ {
+ this._featuresList.add(vFeaturesArray[i]);
}
-
- /**
- */
- public void removeAllFeatures(
- ) {
- this._featuresList.clear();
+ }
+
+ /**
+ * Sets the value of field 'hidden'.
+ *
+ * @param hidden
+ * the value of field 'hidden'.
+ */
+ public void setHidden(final boolean hidden)
+ {
+ this._hidden = hidden;
+ this._has_hidden = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vHiddenSequences
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setHiddenSequences(final int index, final int vHiddenSequences)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._hiddenSequencesList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "setHiddenSequences: Index value '" + index
+ + "' not in range [0.."
+ + (this._hiddenSequencesList.size() - 1) + "]");
}
- /**
- */
- public void removeAllHiddenSequences(
- ) {
- this._hiddenSequencesList.clear();
+ this._hiddenSequencesList.set(index, new java.lang.Integer(
+ vHiddenSequences));
+ }
+
+ /**
+ *
+ *
+ * @param vHiddenSequencesArray
+ */
+ public void setHiddenSequences(final int[] vHiddenSequencesArray)
+ {
+ // -- copy array
+ _hiddenSequencesList.clear();
+
+ for (int i = 0; i < vHiddenSequencesArray.length; i++)
+ {
+ this._hiddenSequencesList.add(new java.lang.Integer(
+ vHiddenSequencesArray[i]));
}
-
- /**
- */
- public void removeAllPdbids(
- ) {
- this._pdbidsList.clear();
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbids
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setPdbids(final int index,
+ final jalview.schemabinding.version2.Pdbids vPdbids)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._pdbidsList.size())
+ {
+ throw new IndexOutOfBoundsException("setPdbids: Index value '"
+ + index + "' not in range [0.."
+ + (this._pdbidsList.size() - 1) + "]");
}
- /**
- * Method removeFeatures.
- *
- * @param vFeatures
- * @return true if the object was removed from the collection.
- */
- public boolean removeFeatures(
- final jalview.schemabinding.version2.Features vFeatures) {
- boolean removed = _featuresList.remove(vFeatures);
- return removed;
+ this._pdbidsList.set(index, vPdbids);
+ }
+
+ /**
+ *
+ *
+ * @param vPdbidsArray
+ */
+ public void setPdbids(
+ final jalview.schemabinding.version2.Pdbids[] vPdbidsArray)
+ {
+ // -- copy array
+ _pdbidsList.clear();
+
+ for (int i = 0; i < vPdbidsArray.length; i++)
+ {
+ this._pdbidsList.add(vPdbidsArray[i]);
}
-
- /**
- * Method removeFeaturesAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Features removeFeaturesAt(
- final int index) {
- java.lang.Object obj = this._featuresList.remove(index);
- return (jalview.schemabinding.version2.Features) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vRnaViewer
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setRnaViewer(final int index,
+ final jalview.schemabinding.version2.RnaViewer vRnaViewer)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._rnaViewerList.size())
+ {
+ throw new IndexOutOfBoundsException("setRnaViewer: Index value '"
+ + index + "' not in range [0.."
+ + (this._rnaViewerList.size() - 1) + "]");
}
- /**
- * Method removeHiddenSequences.
- *
- * @param vHiddenSequences
- * @return true if the object was removed from the collection.
- */
- public boolean removeHiddenSequences(
- final int vHiddenSequences) {
- boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(vHiddenSequences));
- return removed;
- }
-
- /**
- * Method removeHiddenSequencesAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public int removeHiddenSequencesAt(
- final int index) {
- java.lang.Object obj = this._hiddenSequencesList.remove(index);
- return ((java.lang.Integer) obj).intValue();
- }
-
- /**
- * Method removePdbids.
- *
- * @param vPdbids
- * @return true if the object was removed from the collection.
- */
- public boolean removePdbids(
- final jalview.schemabinding.version2.Pdbids vPdbids) {
- boolean removed = _pdbidsList.remove(vPdbids);
- return removed;
- }
-
- /**
- * Method removePdbidsAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Pdbids removePdbidsAt(
- final int index) {
- java.lang.Object obj = this._pdbidsList.remove(index);
- return (jalview.schemabinding.version2.Pdbids) obj;
- }
-
- /**
- * Sets the value of field 'colour'.
- *
- * @param colour the value of field 'colour'.
- */
- public void setColour(
- final int colour) {
- this._colour = colour;
- this._has_colour = true;
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vFeatures
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setFeatures(
- final int index,
- final jalview.schemabinding.version2.Features vFeatures)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._featuresList.size()) {
- throw new IndexOutOfBoundsException("setFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
- }
-
- this._featuresList.set(index, vFeatures);
- }
-
- /**
- *
- *
- * @param vFeaturesArray
- */
- public void setFeatures(
- final jalview.schemabinding.version2.Features[] vFeaturesArray) {
- //-- copy array
- _featuresList.clear();
-
- for (int i = 0; i < vFeaturesArray.length; i++) {
- this._featuresList.add(vFeaturesArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'hidden'.
- *
- * @param hidden the value of field 'hidden'.
- */
- public void setHidden(
- final boolean hidden) {
- this._hidden = hidden;
- this._has_hidden = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vHiddenSequences
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setHiddenSequences(
- final int index,
- final int vHiddenSequences)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._hiddenSequencesList.size()) {
- throw new IndexOutOfBoundsException("setHiddenSequences: Index value '" + index + "' not in range [0.." + (this._hiddenSequencesList.size() - 1) + "]");
- }
-
- this._hiddenSequencesList.set(index, new java.lang.Integer(vHiddenSequences));
- }
-
- /**
- *
- *
- * @param vHiddenSequencesArray
- */
- public void setHiddenSequences(
- final int[] vHiddenSequencesArray) {
- //-- copy array
- _hiddenSequencesList.clear();
-
- for (int i = 0; i < vHiddenSequencesArray.length; i++) {
- this._hiddenSequencesList.add(new java.lang.Integer(vHiddenSequencesArray[i]));
- }
- }
-
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- *
- *
- * @param index
- * @param vPdbids
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setPdbids(
- final int index,
- final jalview.schemabinding.version2.Pdbids vPdbids)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._pdbidsList.size()) {
- throw new IndexOutOfBoundsException("setPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
- }
-
- this._pdbidsList.set(index, vPdbids);
- }
-
- /**
- *
- *
- * @param vPdbidsArray
- */
- public void setPdbids(
- final jalview.schemabinding.version2.Pdbids[] vPdbidsArray) {
- //-- copy array
- _pdbidsList.clear();
-
- for (int i = 0; i < vPdbidsArray.length; i++) {
- this._pdbidsList.add(vPdbidsArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'start'.
- *
- * @param start the value of field 'start'.
- */
- public void setStart(
- final int start) {
- this._start = start;
- this._has_start = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.JSeq
- */
- public static jalview.schemabinding.version2.JSeq unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(jalview.schemabinding.version2.JSeq.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._rnaViewerList.set(index, vRnaViewer);
+ }
+
+ /**
+ *
+ *
+ * @param vRnaViewerArray
+ */
+ public void setRnaViewer(
+ final jalview.schemabinding.version2.RnaViewer[] vRnaViewerArray)
+ {
+ // -- copy array
+ _rnaViewerList.clear();
+
+ for (int i = 0; i < vRnaViewerArray.length; i++)
+ {
+ this._rnaViewerList.add(vRnaViewerArray[i]);
}
+ }
+
+ /**
+ * Sets the value of field 'start'.
+ *
+ * @param start
+ * the value of field 'start'.
+ */
+ public void setStart(final int start)
+ {
+ this._start = start;
+ this._has_start = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.JSeq
+ */
+ public static jalview.schemabinding.version2.JSeq unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.JSeq.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/JalviewModel.java b/src/jalview/schemabinding/version2/JalviewModel.java
index 6e6b46c..c13ef64 100644
--- a/src/jalview/schemabinding/version2/JalviewModel.java
+++ b/src/jalview/schemabinding/version2/JalviewModel.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,203 +19,217 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JalviewModel implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _creationDate.
- */
- private java.util.Date _creationDate;
-
- /**
- * Field _version.
- */
- private java.lang.String _version;
-
- /**
- * Field _vamsasModel.
- */
- private jalview.schemabinding.version2.VamsasModel _vamsasModel;
-
- /**
- * Field _jalviewModelSequence.
- */
- private jalview.schemabinding.version2.JalviewModelSequence _jalviewModelSequence;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JalviewModel() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'creationDate'.
- *
- * @return the value of field 'CreationDate'.
- */
- public java.util.Date getCreationDate(
- ) {
- return this._creationDate;
- }
-
- /**
- * Returns the value of field 'jalviewModelSequence'.
- *
- * @return the value of field 'JalviewModelSequence'.
- */
- public jalview.schemabinding.version2.JalviewModelSequence getJalviewModelSequence(
- ) {
- return this._jalviewModelSequence;
- }
-
- /**
- * Returns the value of field 'vamsasModel'.
- *
- * @return the value of field 'VamsasModel'.
- */
- public jalview.schemabinding.version2.VamsasModel getVamsasModel(
- ) {
- return this._vamsasModel;
- }
-
- /**
- * Returns the value of field 'version'.
- *
- * @return the value of field 'Version'.
- */
- public java.lang.String getVersion(
- ) {
- return this._version;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'creationDate'.
- *
- * @param creationDate the value of field 'creationDate'.
- */
- public void setCreationDate(
- final java.util.Date creationDate) {
- this._creationDate = creationDate;
- }
-
- /**
- * Sets the value of field 'jalviewModelSequence'.
- *
- * @param jalviewModelSequence the value of field
- * 'jalviewModelSequence'.
- */
- public void setJalviewModelSequence(
- final jalview.schemabinding.version2.JalviewModelSequence jalviewModelSequence) {
- this._jalviewModelSequence = jalviewModelSequence;
- }
-
- /**
- * Sets the value of field 'vamsasModel'.
- *
- * @param vamsasModel the value of field 'vamsasModel'.
- */
- public void setVamsasModel(
- final jalview.schemabinding.version2.VamsasModel vamsasModel) {
- this._vamsasModel = vamsasModel;
- }
-
- /**
- * Sets the value of field 'version'.
- *
- * @param version the value of field 'version'.
- */
- public void setVersion(
- final java.lang.String version) {
- this._version = version;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.JalviewModel
- */
- public static jalview.schemabinding.version2.JalviewModel unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.JalviewModel) Unmarshaller.unmarshal(jalview.schemabinding.version2.JalviewModel.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class JalviewModel implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _creationDate.
+ */
+ private java.util.Date _creationDate;
+
+ /**
+ * Field _version.
+ */
+ private java.lang.String _version;
+
+ /**
+ * Field _vamsasModel.
+ */
+ private jalview.schemabinding.version2.VamsasModel _vamsasModel;
+
+ /**
+ * Field _jalviewModelSequence.
+ */
+ private jalview.schemabinding.version2.JalviewModelSequence _jalviewModelSequence;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JalviewModel()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'creationDate'.
+ *
+ * @return the value of field 'CreationDate'.
+ */
+ public java.util.Date getCreationDate()
+ {
+ return this._creationDate;
+ }
+
+ /**
+ * Returns the value of field 'jalviewModelSequence'.
+ *
+ * @return the value of field 'JalviewModelSequence'.
+ */
+ public jalview.schemabinding.version2.JalviewModelSequence getJalviewModelSequence()
+ {
+ return this._jalviewModelSequence;
+ }
+
+ /**
+ * Returns the value of field 'vamsasModel'.
+ *
+ * @return the value of field 'VamsasModel'.
+ */
+ public jalview.schemabinding.version2.VamsasModel getVamsasModel()
+ {
+ return this._vamsasModel;
+ }
+
+ /**
+ * Returns the value of field 'version'.
+ *
+ * @return the value of field 'Version'.
+ */
+ public java.lang.String getVersion()
+ {
+ return this._version;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'creationDate'.
+ *
+ * @param creationDate
+ * the value of field 'creationDate'.
+ */
+ public void setCreationDate(final java.util.Date creationDate)
+ {
+ this._creationDate = creationDate;
+ }
+
+ /**
+ * Sets the value of field 'jalviewModelSequence'.
+ *
+ * @param jalviewModelSequence
+ * the value of field 'jalviewModelSequence'.
+ */
+ public void setJalviewModelSequence(
+ final jalview.schemabinding.version2.JalviewModelSequence jalviewModelSequence)
+ {
+ this._jalviewModelSequence = jalviewModelSequence;
+ }
+
+ /**
+ * Sets the value of field 'vamsasModel'.
+ *
+ * @param vamsasModel
+ * the value of field 'vamsasModel'.
+ */
+ public void setVamsasModel(
+ final jalview.schemabinding.version2.VamsasModel vamsasModel)
+ {
+ this._vamsasModel = vamsasModel;
+ }
+
+ /**
+ * Sets the value of field 'version'.
+ *
+ * @param version
+ * the value of field 'version'.
+ */
+ public void setVersion(final java.lang.String version)
+ {
+ this._version = version;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.JalviewModel
+ */
+ public static jalview.schemabinding.version2.JalviewModel unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.JalviewModel) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.JalviewModel.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/JalviewModelSequence.java b/src/jalview/schemabinding/version2/JalviewModelSequence.java
index 927f447..c7c02c5 100644
--- a/src/jalview/schemabinding/version2/JalviewModelSequence.java
+++ b/src/jalview/schemabinding/version2/JalviewModelSequence.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,907 +19,968 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JalviewModelSequence implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _JSeqList.
- */
- private java.util.Vector _JSeqList;
-
- /**
- * Field _JGroupList.
- */
- private java.util.Vector _JGroupList;
-
- /**
- * Field _viewportList.
- */
- private java.util.Vector _viewportList;
-
- /**
- * Field _userColoursList.
- */
- private java.util.Vector _userColoursList;
-
- /**
- * Field _treeList.
- */
- private java.util.Vector _treeList;
-
- /**
- * Field _featureSettings.
- */
- private jalview.schemabinding.version2.FeatureSettings _featureSettings;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JalviewModelSequence() {
- super();
- this._JSeqList = new java.util.Vector();
- this._JGroupList = new java.util.Vector();
- this._viewportList = new java.util.Vector();
- this._userColoursList = new java.util.Vector();
- this._treeList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vJGroup
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addJGroup(
- final jalview.schemabinding.version2.JGroup vJGroup)
- throws java.lang.IndexOutOfBoundsException {
- this._JGroupList.addElement(vJGroup);
- }
-
- /**
- *
- *
- * @param index
- * @param vJGroup
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addJGroup(
- final int index,
- final jalview.schemabinding.version2.JGroup vJGroup)
- throws java.lang.IndexOutOfBoundsException {
- this._JGroupList.add(index, vJGroup);
- }
-
- /**
- *
- *
- * @param vJSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addJSeq(
- final jalview.schemabinding.version2.JSeq vJSeq)
- throws java.lang.IndexOutOfBoundsException {
- this._JSeqList.addElement(vJSeq);
- }
-
- /**
- *
- *
- * @param index
- * @param vJSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addJSeq(
- final int index,
- final jalview.schemabinding.version2.JSeq vJSeq)
- throws java.lang.IndexOutOfBoundsException {
- this._JSeqList.add(index, vJSeq);
- }
-
- /**
- *
- *
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final jalview.schemabinding.version2.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.addElement(vTree);
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final int index,
- final jalview.schemabinding.version2.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.add(index, vTree);
- }
-
- /**
- *
- *
- * @param vUserColours
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addUserColours(
- final jalview.schemabinding.version2.UserColours vUserColours)
- throws java.lang.IndexOutOfBoundsException {
- this._userColoursList.addElement(vUserColours);
- }
-
- /**
- *
- *
- * @param index
- * @param vUserColours
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addUserColours(
- final int index,
- final jalview.schemabinding.version2.UserColours vUserColours)
- throws java.lang.IndexOutOfBoundsException {
- this._userColoursList.add(index, vUserColours);
- }
-
- /**
- *
- *
- * @param vViewport
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addViewport(
- final jalview.schemabinding.version2.Viewport vViewport)
- throws java.lang.IndexOutOfBoundsException {
- this._viewportList.addElement(vViewport);
- }
-
- /**
- *
- *
- * @param index
- * @param vViewport
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addViewport(
- final int index,
- final jalview.schemabinding.version2.Viewport vViewport)
- throws java.lang.IndexOutOfBoundsException {
- this._viewportList.add(index, vViewport);
- }
-
- /**
- * Method enumerateJGroup.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.JGroup elements
- */
- public java.util.Enumeration enumerateJGroup(
- ) {
- return this._JGroupList.elements();
- }
-
- /**
- * Method enumerateJSeq.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.JSeq elements
- */
- public java.util.Enumeration enumerateJSeq(
- ) {
- return this._JSeqList.elements();
- }
-
- /**
- * Method enumerateTree.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Tree elements
- */
- public java.util.Enumeration enumerateTree(
- ) {
- return this._treeList.elements();
- }
-
- /**
- * Method enumerateUserColours.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.UserColours elements
- */
- public java.util.Enumeration enumerateUserColours(
- ) {
- return this._userColoursList.elements();
- }
-
- /**
- * Method enumerateViewport.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Viewport elements
- */
- public java.util.Enumeration enumerateViewport(
- ) {
- return this._viewportList.elements();
- }
-
- /**
- * Returns the value of field 'featureSettings'.
- *
- * @return the value of field 'FeatureSettings'.
- */
- public jalview.schemabinding.version2.FeatureSettings getFeatureSettings(
- ) {
- return this._featureSettings;
- }
-
- /**
- * Method getJGroup.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.JGroup at the given index
- */
- public jalview.schemabinding.version2.JGroup getJGroup(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._JGroupList.size()) {
- throw new IndexOutOfBoundsException("getJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.JGroup) _JGroupList.get(index);
- }
-
- /**
- * Method getJGroup.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.JGroup[] getJGroup(
- ) {
- jalview.schemabinding.version2.JGroup[] array = new jalview.schemabinding.version2.JGroup[0];
- return (jalview.schemabinding.version2.JGroup[]) this._JGroupList.toArray(array);
- }
-
- /**
- * Method getJGroupCount.
- *
- * @return the size of this collection
- */
- public int getJGroupCount(
- ) {
- return this._JGroupList.size();
- }
-
- /**
- * Method getJSeq.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.schemabinding.version2.JSeq
- * at the given index
- */
- public jalview.schemabinding.version2.JSeq getJSeq(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._JSeqList.size()) {
- throw new IndexOutOfBoundsException("getJSeq: Index value '" + index + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.JSeq) _JSeqList.get(index);
- }
-
- /**
- * Method getJSeq.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.JSeq[] getJSeq(
- ) {
- jalview.schemabinding.version2.JSeq[] array = new jalview.schemabinding.version2.JSeq[0];
- return (jalview.schemabinding.version2.JSeq[]) this._JSeqList.toArray(array);
- }
-
- /**
- * Method getJSeqCount.
- *
- * @return the size of this collection
- */
- public int getJSeqCount(
- ) {
- return this._JSeqList.size();
- }
-
- /**
- * Method getTree.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the jalview.schemabinding.version2.Tree
- * at the given index
- */
- public jalview.schemabinding.version2.Tree getTree(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Tree) _treeList.get(index);
- }
-
- /**
- * Method getTree.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Tree[] getTree(
- ) {
- jalview.schemabinding.version2.Tree[] array = new jalview.schemabinding.version2.Tree[0];
- return (jalview.schemabinding.version2.Tree[]) this._treeList.toArray(array);
- }
-
- /**
- * Method getTreeCount.
- *
- * @return the size of this collection
- */
- public int getTreeCount(
- ) {
- return this._treeList.size();
- }
-
- /**
- * Method getUserColours.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.UserColours at the given index
- */
- public jalview.schemabinding.version2.UserColours getUserColours(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._userColoursList.size()) {
- throw new IndexOutOfBoundsException("getUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.UserColours) _userColoursList.get(index);
- }
-
- /**
- * Method getUserColours.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.UserColours[] getUserColours(
- ) {
- jalview.schemabinding.version2.UserColours[] array = new jalview.schemabinding.version2.UserColours[0];
- return (jalview.schemabinding.version2.UserColours[]) this._userColoursList.toArray(array);
- }
-
- /**
- * Method getUserColoursCount.
- *
- * @return the size of this collection
- */
- public int getUserColoursCount(
- ) {
- return this._userColoursList.size();
- }
-
- /**
- * Method getViewport.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Viewport at the given index
- */
- public jalview.schemabinding.version2.Viewport getViewport(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._viewportList.size()) {
- throw new IndexOutOfBoundsException("getViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Viewport) _viewportList.get(index);
- }
-
- /**
- * Method getViewport.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Viewport[] getViewport(
- ) {
- jalview.schemabinding.version2.Viewport[] array = new jalview.schemabinding.version2.Viewport[0];
- return (jalview.schemabinding.version2.Viewport[]) this._viewportList.toArray(array);
- }
-
- /**
- * Method getViewportCount.
- *
- * @return the size of this collection
- */
- public int getViewportCount(
- ) {
- return this._viewportList.size();
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllJGroup(
- ) {
- this._JGroupList.clear();
- }
-
- /**
- */
- public void removeAllJSeq(
- ) {
- this._JSeqList.clear();
- }
-
- /**
- */
- public void removeAllTree(
- ) {
- this._treeList.clear();
- }
-
- /**
- */
- public void removeAllUserColours(
- ) {
- this._userColoursList.clear();
- }
-
- /**
- */
- public void removeAllViewport(
- ) {
- this._viewportList.clear();
- }
-
- /**
- * Method removeJGroup.
- *
- * @param vJGroup
- * @return true if the object was removed from the collection.
- */
- public boolean removeJGroup(
- final jalview.schemabinding.version2.JGroup vJGroup) {
- boolean removed = _JGroupList.remove(vJGroup);
- return removed;
- }
-
- /**
- * Method removeJGroupAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.JGroup removeJGroupAt(
- final int index) {
- java.lang.Object obj = this._JGroupList.remove(index);
- return (jalview.schemabinding.version2.JGroup) obj;
- }
-
- /**
- * Method removeJSeq.
- *
- * @param vJSeq
- * @return true if the object was removed from the collection.
- */
- public boolean removeJSeq(
- final jalview.schemabinding.version2.JSeq vJSeq) {
- boolean removed = _JSeqList.remove(vJSeq);
- return removed;
- }
-
- /**
- * Method removeJSeqAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.JSeq removeJSeqAt(
- final int index) {
- java.lang.Object obj = this._JSeqList.remove(index);
- return (jalview.schemabinding.version2.JSeq) obj;
- }
-
- /**
- * Method removeTree.
- *
- * @param vTree
- * @return true if the object was removed from the collection.
- */
- public boolean removeTree(
- final jalview.schemabinding.version2.Tree vTree) {
- boolean removed = _treeList.remove(vTree);
- return removed;
- }
-
- /**
- * Method removeTreeAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Tree removeTreeAt(
- final int index) {
- java.lang.Object obj = this._treeList.remove(index);
- return (jalview.schemabinding.version2.Tree) obj;
- }
-
- /**
- * Method removeUserColours.
- *
- * @param vUserColours
- * @return true if the object was removed from the collection.
- */
- public boolean removeUserColours(
- final jalview.schemabinding.version2.UserColours vUserColours) {
- boolean removed = _userColoursList.remove(vUserColours);
- return removed;
- }
-
- /**
- * Method removeUserColoursAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.UserColours removeUserColoursAt(
- final int index) {
- java.lang.Object obj = this._userColoursList.remove(index);
- return (jalview.schemabinding.version2.UserColours) obj;
- }
-
- /**
- * Method removeViewport.
- *
- * @param vViewport
- * @return true if the object was removed from the collection.
- */
- public boolean removeViewport(
- final jalview.schemabinding.version2.Viewport vViewport) {
- boolean removed = _viewportList.remove(vViewport);
- return removed;
- }
-
- /**
- * Method removeViewportAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Viewport removeViewportAt(
- final int index) {
- java.lang.Object obj = this._viewportList.remove(index);
- return (jalview.schemabinding.version2.Viewport) obj;
- }
-
- /**
- * Sets the value of field 'featureSettings'.
- *
- * @param featureSettings the value of field 'featureSettings'.
- */
- public void setFeatureSettings(
- final jalview.schemabinding.version2.FeatureSettings featureSettings) {
- this._featureSettings = featureSettings;
- }
-
- /**
- *
- *
- * @param index
- * @param vJGroup
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setJGroup(
- final int index,
- final jalview.schemabinding.version2.JGroup vJGroup)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._JGroupList.size()) {
- throw new IndexOutOfBoundsException("setJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]");
- }
-
- this._JGroupList.set(index, vJGroup);
- }
-
- /**
- *
- *
- * @param vJGroupArray
- */
- public void setJGroup(
- final jalview.schemabinding.version2.JGroup[] vJGroupArray) {
- //-- copy array
- _JGroupList.clear();
-
- for (int i = 0; i < vJGroupArray.length; i++) {
- this._JGroupList.add(vJGroupArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vJSeq
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setJSeq(
- final int index,
- final jalview.schemabinding.version2.JSeq vJSeq)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._JSeqList.size()) {
- throw new IndexOutOfBoundsException("setJSeq: Index value '" + index + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
- }
-
- this._JSeqList.set(index, vJSeq);
- }
-
- /**
- *
- *
- * @param vJSeqArray
- */
- public void setJSeq(
- final jalview.schemabinding.version2.JSeq[] vJSeqArray) {
- //-- copy array
- _JSeqList.clear();
-
- for (int i = 0; i < vJSeqArray.length; i++) {
- this._JSeqList.add(vJSeqArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setTree(
- final int index,
- final jalview.schemabinding.version2.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- this._treeList.set(index, vTree);
- }
-
- /**
- *
- *
- * @param vTreeArray
- */
- public void setTree(
- final jalview.schemabinding.version2.Tree[] vTreeArray) {
- //-- copy array
- _treeList.clear();
-
- for (int i = 0; i < vTreeArray.length; i++) {
- this._treeList.add(vTreeArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vUserColours
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setUserColours(
- final int index,
- final jalview.schemabinding.version2.UserColours vUserColours)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._userColoursList.size()) {
- throw new IndexOutOfBoundsException("setUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]");
- }
-
- this._userColoursList.set(index, vUserColours);
- }
-
- /**
- *
- *
- * @param vUserColoursArray
- */
- public void setUserColours(
- final jalview.schemabinding.version2.UserColours[] vUserColoursArray) {
- //-- copy array
- _userColoursList.clear();
-
- for (int i = 0; i < vUserColoursArray.length; i++) {
- this._userColoursList.add(vUserColoursArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vViewport
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setViewport(
- final int index,
- final jalview.schemabinding.version2.Viewport vViewport)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._viewportList.size()) {
- throw new IndexOutOfBoundsException("setViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]");
- }
-
- this._viewportList.set(index, vViewport);
- }
-
- /**
- *
- *
- * @param vViewportArray
- */
- public void setViewport(
- final jalview.schemabinding.version2.Viewport[] vViewportArray) {
- //-- copy array
- _viewportList.clear();
-
- for (int i = 0; i < vViewportArray.length; i++) {
- this._viewportList.add(vViewportArray[i]);
- }
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.JalviewModelSequence
- */
- public static jalview.schemabinding.version2.JalviewModelSequence unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.JalviewModelSequence) Unmarshaller.unmarshal(jalview.schemabinding.version2.JalviewModelSequence.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class JalviewModelSequence implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _JSeqList.
+ */
+ private java.util.Vector _JSeqList;
+
+ /**
+ * Field _JGroupList.
+ */
+ private java.util.Vector _JGroupList;
+
+ /**
+ * Field _viewportList.
+ */
+ private java.util.Vector _viewportList;
+
+ /**
+ * Field _userColoursList.
+ */
+ private java.util.Vector _userColoursList;
+
+ /**
+ * Field _treeList.
+ */
+ private java.util.Vector _treeList;
+
+ /**
+ * Field _featureSettings.
+ */
+ private jalview.schemabinding.version2.FeatureSettings _featureSettings;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JalviewModelSequence()
+ {
+ super();
+ this._JSeqList = new java.util.Vector();
+ this._JGroupList = new java.util.Vector();
+ this._viewportList = new java.util.Vector();
+ this._userColoursList = new java.util.Vector();
+ this._treeList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vJGroup
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addJGroup(final jalview.schemabinding.version2.JGroup vJGroup)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._JGroupList.addElement(vJGroup);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vJGroup
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addJGroup(final int index,
+ final jalview.schemabinding.version2.JGroup vJGroup)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._JGroupList.add(index, vJGroup);
+ }
+
+ /**
+ *
+ *
+ * @param vJSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addJSeq(final jalview.schemabinding.version2.JSeq vJSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._JSeqList.addElement(vJSeq);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vJSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addJSeq(final int index,
+ final jalview.schemabinding.version2.JSeq vJSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._JSeqList.add(index, vJSeq);
+ }
+
+ /**
+ *
+ *
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final jalview.schemabinding.version2.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._treeList.addElement(vTree);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final int index,
+ final jalview.schemabinding.version2.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._treeList.add(index, vTree);
+ }
+
+ /**
+ *
+ *
+ * @param vUserColours
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addUserColours(
+ final jalview.schemabinding.version2.UserColours vUserColours)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._userColoursList.addElement(vUserColours);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vUserColours
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addUserColours(final int index,
+ final jalview.schemabinding.version2.UserColours vUserColours)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._userColoursList.add(index, vUserColours);
+ }
+
+ /**
+ *
+ *
+ * @param vViewport
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addViewport(
+ final jalview.schemabinding.version2.Viewport vViewport)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._viewportList.addElement(vViewport);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vViewport
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addViewport(final int index,
+ final jalview.schemabinding.version2.Viewport vViewport)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._viewportList.add(index, vViewport);
+ }
+
+ /**
+ * Method enumerateJGroup.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.JGroup
+ * elements
+ */
+ public java.util.Enumeration enumerateJGroup()
+ {
+ return this._JGroupList.elements();
+ }
+
+ /**
+ * Method enumerateJSeq.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.JSeq
+ * elements
+ */
+ public java.util.Enumeration enumerateJSeq()
+ {
+ return this._JSeqList.elements();
+ }
+
+ /**
+ * Method enumerateTree.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Tree
+ * elements
+ */
+ public java.util.Enumeration enumerateTree()
+ {
+ return this._treeList.elements();
+ }
+
+ /**
+ * Method enumerateUserColours.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.UserColours
+ * elements
+ */
+ public java.util.Enumeration enumerateUserColours()
+ {
+ return this._userColoursList.elements();
+ }
+
+ /**
+ * Method enumerateViewport.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Viewport
+ * elements
+ */
+ public java.util.Enumeration enumerateViewport()
+ {
+ return this._viewportList.elements();
+ }
+
+ /**
+ * Returns the value of field 'featureSettings'.
+ *
+ * @return the value of field 'FeatureSettings'.
+ */
+ public jalview.schemabinding.version2.FeatureSettings getFeatureSettings()
+ {
+ return this._featureSettings;
+ }
+
+ /**
+ * Method getJGroup.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.JGroup at the given
+ * index
+ */
+ public jalview.schemabinding.version2.JGroup getJGroup(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._JGroupList.size())
+ {
+ throw new IndexOutOfBoundsException("getJGroup: Index value '"
+ + index + "' not in range [0.."
+ + (this._JGroupList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.JGroup) _JGroupList.get(index);
+ }
+
+ /**
+ * Method getJGroup.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.JGroup[] getJGroup()
+ {
+ jalview.schemabinding.version2.JGroup[] array = new jalview.schemabinding.version2.JGroup[0];
+ return (jalview.schemabinding.version2.JGroup[]) this._JGroupList
+ .toArray(array);
+ }
+
+ /**
+ * Method getJGroupCount.
+ *
+ * @return the size of this collection
+ */
+ public int getJGroupCount()
+ {
+ return this._JGroupList.size();
+ }
+
+ /**
+ * Method getJSeq.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.JSeq at the given
+ * index
+ */
+ public jalview.schemabinding.version2.JSeq getJSeq(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._JSeqList.size())
+ {
+ throw new IndexOutOfBoundsException("getJSeq: Index value '" + index
+ + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.JSeq) _JSeqList.get(index);
+ }
+
+ /**
+ * Method getJSeq.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.JSeq[] getJSeq()
+ {
+ jalview.schemabinding.version2.JSeq[] array = new jalview.schemabinding.version2.JSeq[0];
+ return (jalview.schemabinding.version2.JSeq[]) this._JSeqList
+ .toArray(array);
+ }
+
+ /**
+ * Method getJSeqCount.
+ *
+ * @return the size of this collection
+ */
+ public int getJSeqCount()
+ {
+ return this._JSeqList.size();
+ }
+
+ /**
+ * Method getTree.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Tree at the given
+ * index
+ */
+ public jalview.schemabinding.version2.Tree getTree(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size())
+ {
+ throw new IndexOutOfBoundsException("getTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.Tree) _treeList.get(index);
+ }
+
+ /**
+ * Method getTree.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Tree[] getTree()
+ {
+ jalview.schemabinding.version2.Tree[] array = new jalview.schemabinding.version2.Tree[0];
+ return (jalview.schemabinding.version2.Tree[]) this._treeList
+ .toArray(array);
+ }
+
+ /**
+ * Method getTreeCount.
+ *
+ * @return the size of this collection
+ */
+ public int getTreeCount()
+ {
+ return this._treeList.size();
+ }
+
+ /**
+ * Method getUserColours.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.UserColours at the
+ * given index
+ */
+ public jalview.schemabinding.version2.UserColours getUserColours(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._userColoursList.size())
+ {
+ throw new IndexOutOfBoundsException("getUserColours: Index value '"
+ + index + "' not in range [0.."
+ + (this._userColoursList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.UserColours) _userColoursList
+ .get(index);
+ }
+
+ /**
+ * Method getUserColours.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.UserColours[] getUserColours()
+ {
+ jalview.schemabinding.version2.UserColours[] array = new jalview.schemabinding.version2.UserColours[0];
+ return (jalview.schemabinding.version2.UserColours[]) this._userColoursList
+ .toArray(array);
+ }
+
+ /**
+ * Method getUserColoursCount.
+ *
+ * @return the size of this collection
+ */
+ public int getUserColoursCount()
+ {
+ return this._userColoursList.size();
+ }
+
+ /**
+ * Method getViewport.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Viewport at the
+ * given index
+ */
+ public jalview.schemabinding.version2.Viewport getViewport(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._viewportList.size())
+ {
+ throw new IndexOutOfBoundsException("getViewport: Index value '"
+ + index + "' not in range [0.."
+ + (this._viewportList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.Viewport) _viewportList
+ .get(index);
+ }
+
+ /**
+ * Method getViewport.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Viewport[] getViewport()
+ {
+ jalview.schemabinding.version2.Viewport[] array = new jalview.schemabinding.version2.Viewport[0];
+ return (jalview.schemabinding.version2.Viewport[]) this._viewportList
+ .toArray(array);
+ }
+
+ /**
+ * Method getViewportCount.
+ *
+ * @return the size of this collection
+ */
+ public int getViewportCount()
+ {
+ return this._viewportList.size();
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllJGroup()
+ {
+ this._JGroupList.clear();
+ }
+
+ /**
+ */
+ public void removeAllJSeq()
+ {
+ this._JSeqList.clear();
+ }
+
+ /**
+ */
+ public void removeAllTree()
+ {
+ this._treeList.clear();
+ }
+
+ /**
+ */
+ public void removeAllUserColours()
+ {
+ this._userColoursList.clear();
+ }
+
+ /**
+ */
+ public void removeAllViewport()
+ {
+ this._viewportList.clear();
+ }
+
+ /**
+ * Method removeJGroup.
+ *
+ * @param vJGroup
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeJGroup(
+ final jalview.schemabinding.version2.JGroup vJGroup)
+ {
+ boolean removed = _JGroupList.remove(vJGroup);
+ return removed;
+ }
+
+ /**
+ * Method removeJGroupAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.JGroup removeJGroupAt(
+ final int index)
+ {
+ java.lang.Object obj = this._JGroupList.remove(index);
+ return (jalview.schemabinding.version2.JGroup) obj;
+ }
+
+ /**
+ * Method removeJSeq.
+ *
+ * @param vJSeq
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeJSeq(final jalview.schemabinding.version2.JSeq vJSeq)
+ {
+ boolean removed = _JSeqList.remove(vJSeq);
+ return removed;
+ }
+
+ /**
+ * Method removeJSeqAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.JSeq removeJSeqAt(final int index)
+ {
+ java.lang.Object obj = this._JSeqList.remove(index);
+ return (jalview.schemabinding.version2.JSeq) obj;
+ }
+
+ /**
+ * Method removeTree.
+ *
+ * @param vTree
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeTree(final jalview.schemabinding.version2.Tree vTree)
+ {
+ boolean removed = _treeList.remove(vTree);
+ return removed;
+ }
+
+ /**
+ * Method removeTreeAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Tree removeTreeAt(final int index)
+ {
+ java.lang.Object obj = this._treeList.remove(index);
+ return (jalview.schemabinding.version2.Tree) obj;
+ }
+
+ /**
+ * Method removeUserColours.
+ *
+ * @param vUserColours
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeUserColours(
+ final jalview.schemabinding.version2.UserColours vUserColours)
+ {
+ boolean removed = _userColoursList.remove(vUserColours);
+ return removed;
+ }
+
+ /**
+ * Method removeUserColoursAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.UserColours removeUserColoursAt(
+ final int index)
+ {
+ java.lang.Object obj = this._userColoursList.remove(index);
+ return (jalview.schemabinding.version2.UserColours) obj;
+ }
+
+ /**
+ * Method removeViewport.
+ *
+ * @param vViewport
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeViewport(
+ final jalview.schemabinding.version2.Viewport vViewport)
+ {
+ boolean removed = _viewportList.remove(vViewport);
+ return removed;
+ }
+
+ /**
+ * Method removeViewportAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Viewport removeViewportAt(
+ final int index)
+ {
+ java.lang.Object obj = this._viewportList.remove(index);
+ return (jalview.schemabinding.version2.Viewport) obj;
+ }
+
+ /**
+ * Sets the value of field 'featureSettings'.
+ *
+ * @param featureSettings
+ * the value of field 'featureSettings'.
+ */
+ public void setFeatureSettings(
+ final jalview.schemabinding.version2.FeatureSettings featureSettings)
+ {
+ this._featureSettings = featureSettings;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vJGroup
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setJGroup(final int index,
+ final jalview.schemabinding.version2.JGroup vJGroup)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._JGroupList.size())
+ {
+ throw new IndexOutOfBoundsException("setJGroup: Index value '"
+ + index + "' not in range [0.."
+ + (this._JGroupList.size() - 1) + "]");
+ }
+
+ this._JGroupList.set(index, vJGroup);
+ }
+
+ /**
+ *
+ *
+ * @param vJGroupArray
+ */
+ public void setJGroup(
+ final jalview.schemabinding.version2.JGroup[] vJGroupArray)
+ {
+ // -- copy array
+ _JGroupList.clear();
+
+ for (int i = 0; i < vJGroupArray.length; i++)
+ {
+ this._JGroupList.add(vJGroupArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vJSeq
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setJSeq(final int index,
+ final jalview.schemabinding.version2.JSeq vJSeq)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._JSeqList.size())
+ {
+ throw new IndexOutOfBoundsException("setJSeq: Index value '" + index
+ + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
+ }
+
+ this._JSeqList.set(index, vJSeq);
+ }
+
+ /**
+ *
+ *
+ * @param vJSeqArray
+ */
+ public void setJSeq(final jalview.schemabinding.version2.JSeq[] vJSeqArray)
+ {
+ // -- copy array
+ _JSeqList.clear();
+
+ for (int i = 0; i < vJSeqArray.length; i++)
+ {
+ this._JSeqList.add(vJSeqArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setTree(final int index,
+ final jalview.schemabinding.version2.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size())
+ {
+ throw new IndexOutOfBoundsException("setTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ this._treeList.set(index, vTree);
+ }
+
+ /**
+ *
+ *
+ * @param vTreeArray
+ */
+ public void setTree(final jalview.schemabinding.version2.Tree[] vTreeArray)
+ {
+ // -- copy array
+ _treeList.clear();
+
+ for (int i = 0; i < vTreeArray.length; i++)
+ {
+ this._treeList.add(vTreeArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vUserColours
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setUserColours(final int index,
+ final jalview.schemabinding.version2.UserColours vUserColours)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._userColoursList.size())
+ {
+ throw new IndexOutOfBoundsException("setUserColours: Index value '"
+ + index + "' not in range [0.."
+ + (this._userColoursList.size() - 1) + "]");
+ }
+
+ this._userColoursList.set(index, vUserColours);
+ }
+
+ /**
+ *
+ *
+ * @param vUserColoursArray
+ */
+ public void setUserColours(
+ final jalview.schemabinding.version2.UserColours[] vUserColoursArray)
+ {
+ // -- copy array
+ _userColoursList.clear();
+
+ for (int i = 0; i < vUserColoursArray.length; i++)
+ {
+ this._userColoursList.add(vUserColoursArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vViewport
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setViewport(final int index,
+ final jalview.schemabinding.version2.Viewport vViewport)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._viewportList.size())
+ {
+ throw new IndexOutOfBoundsException("setViewport: Index value '"
+ + index + "' not in range [0.."
+ + (this._viewportList.size() - 1) + "]");
+ }
+
+ this._viewportList.set(index, vViewport);
+ }
+
+ /**
+ *
+ *
+ * @param vViewportArray
+ */
+ public void setViewport(
+ final jalview.schemabinding.version2.Viewport[] vViewportArray)
+ {
+ // -- copy array
+ _viewportList.clear();
+
+ for (int i = 0; i < vViewportArray.length; i++)
+ {
+ this._viewportList.add(vViewportArray[i]);
+ }
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.JalviewModelSequence
+ */
+ public static jalview.schemabinding.version2.JalviewModelSequence unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.JalviewModelSequence) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.JalviewModelSequence.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/JalviewUserColours.java b/src/jalview/schemabinding/version2/JalviewUserColours.java
index 5aa62f8..042f092 100644
--- a/src/jalview/schemabinding/version2/JalviewUserColours.java
+++ b/src/jalview/schemabinding/version2/JalviewUserColours.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,313 +19,328 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class JalviewUserColours implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _schemeName.
- */
- private java.lang.String _schemeName;
-
- /**
- * Jalview colour scheme document version.
- *
- */
- private java.lang.String _version;
-
- /**
- * Field _colourList.
- */
- private java.util.Vector _colourList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JalviewUserColours() {
- super();
- this._colourList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vColour
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addColour(
- final Colour vColour)
- throws java.lang.IndexOutOfBoundsException {
- this._colourList.addElement(vColour);
- }
-
- /**
- *
- *
- * @param index
- * @param vColour
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addColour(
- final int index,
- final Colour vColour)
- throws java.lang.IndexOutOfBoundsException {
- this._colourList.add(index, vColour);
- }
-
- /**
- * Method enumerateColour.
- *
- * @return an Enumeration over all Colour elements
- */
- public java.util.Enumeration enumerateColour(
- ) {
- return this._colourList.elements();
- }
-
- /**
- * Method getColour.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the Colour at the given index
- */
- public Colour getColour(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._colourList.size()) {
- throw new IndexOutOfBoundsException("getColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]");
- }
-
- return (Colour) _colourList.get(index);
- }
-
- /**
- * Method getColour.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public Colour[] getColour(
- ) {
- Colour[] array = new Colour[0];
- return (Colour[]) this._colourList.toArray(array);
- }
-
- /**
- * Method getColourCount.
- *
- * @return the size of this collection
- */
- public int getColourCount(
- ) {
- return this._colourList.size();
- }
-
- /**
- * Returns the value of field 'schemeName'.
- *
- * @return the value of field 'SchemeName'.
- */
- public java.lang.String getSchemeName(
- ) {
- return this._schemeName;
- }
-
- /**
- * Returns the value of field 'version'. The field 'version'
- * has the following description: Jalview colour scheme
- * document version.
- *
- *
- * @return the value of field 'Version'.
- */
- public java.lang.String getVersion(
- ) {
- return this._version;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllColour(
- ) {
- this._colourList.clear();
- }
-
- /**
- * Method removeColour.
- *
- * @param vColour
- * @return true if the object was removed from the collection.
- */
- public boolean removeColour(
- final Colour vColour) {
- boolean removed = _colourList.remove(vColour);
- return removed;
+public class JalviewUserColours implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _schemeName.
+ */
+ private java.lang.String _schemeName;
+
+ /**
+ * Jalview colour scheme document version.
+ *
+ */
+ private java.lang.String _version;
+
+ /**
+ * Field _colourList.
+ */
+ private java.util.Vector _colourList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JalviewUserColours()
+ {
+ super();
+ this._colourList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vColour
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addColour(final Colour vColour)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._colourList.addElement(vColour);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vColour
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addColour(final int index, final Colour vColour)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._colourList.add(index, vColour);
+ }
+
+ /**
+ * Method enumerateColour.
+ *
+ * @return an Enumeration over all Colour elements
+ */
+ public java.util.Enumeration enumerateColour()
+ {
+ return this._colourList.elements();
+ }
+
+ /**
+ * Method getColour.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the Colour at the given index
+ */
+ public Colour getColour(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._colourList.size())
+ {
+ throw new IndexOutOfBoundsException("getColour: Index value '"
+ + index + "' not in range [0.."
+ + (this._colourList.size() - 1) + "]");
}
- /**
- * Method removeColourAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public Colour removeColourAt(
- final int index) {
- java.lang.Object obj = this._colourList.remove(index);
- return (Colour) obj;
+ return (Colour) _colourList.get(index);
+ }
+
+ /**
+ * Method getColour.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public Colour[] getColour()
+ {
+ Colour[] array = new Colour[0];
+ return (Colour[]) this._colourList.toArray(array);
+ }
+
+ /**
+ * Method getColourCount.
+ *
+ * @return the size of this collection
+ */
+ public int getColourCount()
+ {
+ return this._colourList.size();
+ }
+
+ /**
+ * Returns the value of field 'schemeName'.
+ *
+ * @return the value of field 'SchemeName'.
+ */
+ public java.lang.String getSchemeName()
+ {
+ return this._schemeName;
+ }
+
+ /**
+ * Returns the value of field 'version'. The field 'version' has the following
+ * description: Jalview colour scheme document version.
+ *
+ *
+ * @return the value of field 'Version'.
+ */
+ public java.lang.String getVersion()
+ {
+ return this._version;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- *
- *
- * @param index
- * @param vColour
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public void setColour(
- final int index,
- final Colour vColour)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._colourList.size()) {
- throw new IndexOutOfBoundsException("setColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]");
- }
-
- this._colourList.set(index, vColour);
+ public void removeAllColour()
+ {
+ this._colourList.clear();
+ }
+
+ /**
+ * Method removeColour.
+ *
+ * @param vColour
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeColour(final Colour vColour)
+ {
+ boolean removed = _colourList.remove(vColour);
+ return removed;
+ }
+
+ /**
+ * Method removeColourAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public Colour removeColourAt(final int index)
+ {
+ java.lang.Object obj = this._colourList.remove(index);
+ return (Colour) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vColour
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setColour(final int index, final Colour vColour)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._colourList.size())
+ {
+ throw new IndexOutOfBoundsException("setColour: Index value '"
+ + index + "' not in range [0.."
+ + (this._colourList.size() - 1) + "]");
}
- /**
- *
- *
- * @param vColourArray
- */
- public void setColour(
- final Colour[] vColourArray) {
- //-- copy array
- _colourList.clear();
-
- for (int i = 0; i < vColourArray.length; i++) {
- this._colourList.add(vColourArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'schemeName'.
- *
- * @param schemeName the value of field 'schemeName'.
- */
- public void setSchemeName(
- final java.lang.String schemeName) {
- this._schemeName = schemeName;
- }
-
- /**
- * Sets the value of field 'version'. The field 'version' has
- * the following description: Jalview colour scheme document
- * version.
- *
- *
- * @param version the value of field 'version'.
- */
- public void setVersion(
- final java.lang.String version) {
- this._version = version;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.JalviewUserColours
- */
- public static jalview.schemabinding.version2.JalviewUserColours unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.JalviewUserColours) Unmarshaller.unmarshal(jalview.schemabinding.version2.JalviewUserColours.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._colourList.set(index, vColour);
+ }
+
+ /**
+ *
+ *
+ * @param vColourArray
+ */
+ public void setColour(final Colour[] vColourArray)
+ {
+ // -- copy array
+ _colourList.clear();
+
+ for (int i = 0; i < vColourArray.length; i++)
+ {
+ this._colourList.add(vColourArray[i]);
}
+ }
+
+ /**
+ * Sets the value of field 'schemeName'.
+ *
+ * @param schemeName
+ * the value of field 'schemeName'.
+ */
+ public void setSchemeName(final java.lang.String schemeName)
+ {
+ this._schemeName = schemeName;
+ }
+
+ /**
+ * Sets the value of field 'version'. The field 'version' has the following
+ * description: Jalview colour scheme document version.
+ *
+ *
+ * @param version
+ * the value of field 'version'.
+ */
+ public void setVersion(final java.lang.String version)
+ {
+ this._version = version;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.JalviewUserColours
+ */
+ public static jalview.schemabinding.version2.JalviewUserColours unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.JalviewUserColours) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.JalviewUserColours.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/MapListFrom.java b/src/jalview/schemabinding/version2/MapListFrom.java
index aba37ec..67bf1dc 100644
--- a/src/jalview/schemabinding/version2/MapListFrom.java
+++ b/src/jalview/schemabinding/version2/MapListFrom.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,198 +19,209 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class MapListFrom implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _start.
- */
- private int _start;
-
- /**
- * keeps track of state for field: _start
- */
- private boolean _has_start;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public MapListFrom() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteStart(
- ) {
- this._has_start= false;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Returns the value of field 'start'.
- *
- * @return the value of field 'Start'.
- */
- public int getStart(
- ) {
- return this._start;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method hasStart.
- *
- * @return true if at least one Start has been added
- */
- public boolean hasStart(
- ) {
- return this._has_start;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- * Sets the value of field 'start'.
- *
- * @param start the value of field 'start'.
- */
- public void setStart(
- final int start) {
- this._start = start;
- this._has_start = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.MapListFrom
- */
- public static jalview.schemabinding.version2.MapListFrom unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.MapListFrom) Unmarshaller.unmarshal(jalview.schemabinding.version2.MapListFrom.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class MapListFrom implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _start.
+ */
+ private int _start;
+
+ /**
+ * keeps track of state for field: _start
+ */
+ private boolean _has_start;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public MapListFrom()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteStart()
+ {
+ this._has_start = false;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Returns the value of field 'start'.
+ *
+ * @return the value of field 'Start'.
+ */
+ public int getStart()
+ {
+ return this._start;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasStart.
+ *
+ * @return true if at least one Start has been added
+ */
+ public boolean hasStart()
+ {
+ return this._has_start;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ * Sets the value of field 'start'.
+ *
+ * @param start
+ * the value of field 'start'.
+ */
+ public void setStart(final int start)
+ {
+ this._start = start;
+ this._has_start = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.MapListFrom
+ */
+ public static jalview.schemabinding.version2.MapListFrom unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.MapListFrom) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.MapListFrom.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/MapListTo.java b/src/jalview/schemabinding/version2/MapListTo.java
index 6cb7e0d..e59baf8 100644
--- a/src/jalview/schemabinding/version2/MapListTo.java
+++ b/src/jalview/schemabinding/version2/MapListTo.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,198 +19,209 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class MapListTo implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _start.
- */
- private int _start;
-
- /**
- * keeps track of state for field: _start
- */
- private boolean _has_start;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public MapListTo() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteStart(
- ) {
- this._has_start= false;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Returns the value of field 'start'.
- *
- * @return the value of field 'Start'.
- */
- public int getStart(
- ) {
- return this._start;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method hasStart.
- *
- * @return true if at least one Start has been added
- */
- public boolean hasStart(
- ) {
- return this._has_start;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- * Sets the value of field 'start'.
- *
- * @param start the value of field 'start'.
- */
- public void setStart(
- final int start) {
- this._start = start;
- this._has_start = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.MapListTo
- */
- public static jalview.schemabinding.version2.MapListTo unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.MapListTo) Unmarshaller.unmarshal(jalview.schemabinding.version2.MapListTo.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class MapListTo implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _start.
+ */
+ private int _start;
+
+ /**
+ * keeps track of state for field: _start
+ */
+ private boolean _has_start;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public MapListTo()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteStart()
+ {
+ this._has_start = false;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Returns the value of field 'start'.
+ *
+ * @return the value of field 'Start'.
+ */
+ public int getStart()
+ {
+ return this._start;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasStart.
+ *
+ * @return true if at least one Start has been added
+ */
+ public boolean hasStart()
+ {
+ return this._has_start;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ * Sets the value of field 'start'.
+ *
+ * @param start
+ * the value of field 'start'.
+ */
+ public void setStart(final int start)
+ {
+ this._start = start;
+ this._has_start = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.MapListTo
+ */
+ public static jalview.schemabinding.version2.MapListTo unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.MapListTo) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.MapListTo.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/MapListType.java b/src/jalview/schemabinding/version2/MapListType.java
index e4240f4..cfb0752 100644
--- a/src/jalview/schemabinding/version2/MapListType.java
+++ b/src/jalview/schemabinding/version2/MapListType.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -34,566 +17,581 @@ import org.exolab.castor.xml.Unmarshaller;
/**
* developed after mapRangeType from
* http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes
- *
- * This effectively represents a java.util.MapList object
- *
+ *
+ * This effectively represents a java.util.MapList object
+ *
*
* @version $Revision$ $Date$
*/
-public class MapListType implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * number of dictionary symbol widths involved in each
- * mapped position on this sequence (for example, 3 for a dna
- * sequence exon
- * region that is being mapped to a protein sequence). This is
- * optional,
- * since the unit can be usually be inferred from the
- * dictionary type of
- * each sequence involved in the mapping.
- */
- private long _mapFromUnit;
-
- /**
- * keeps track of state for field: _mapFromUnit
- */
- private boolean _has_mapFromUnit;
-
- /**
- * number of dictionary symbol widths involved in each
- * mapped position on this sequence (for example, 3 for a dna
- * sequence exon
- * region that is being mapped to a protein sequence). This is
- * optional,
- * since the unit can be usually be inferred from the
- * dictionary type of
- * each sequence involved in the mapping.
- */
- private long _mapToUnit;
-
- /**
- * keeps track of state for field: _mapToUnit
- */
- private boolean _has_mapToUnit;
-
- /**
- * a region from start to end inclusive
- */
- private java.util.Vector _mapListFromList;
-
- /**
- * a region from start to end inclusive
- */
- private java.util.Vector _mapListToList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public MapListType() {
- super();
- this._mapListFromList = new java.util.Vector();
- this._mapListToList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vMapListFrom
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addMapListFrom(
- final jalview.schemabinding.version2.MapListFrom vMapListFrom)
- throws java.lang.IndexOutOfBoundsException {
- this._mapListFromList.addElement(vMapListFrom);
- }
-
- /**
- *
- *
- * @param index
- * @param vMapListFrom
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addMapListFrom(
- final int index,
- final jalview.schemabinding.version2.MapListFrom vMapListFrom)
- throws java.lang.IndexOutOfBoundsException {
- this._mapListFromList.add(index, vMapListFrom);
- }
-
- /**
- *
- *
- * @param vMapListTo
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addMapListTo(
- final jalview.schemabinding.version2.MapListTo vMapListTo)
- throws java.lang.IndexOutOfBoundsException {
- this._mapListToList.addElement(vMapListTo);
- }
-
- /**
- *
- *
- * @param index
- * @param vMapListTo
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addMapListTo(
- final int index,
- final jalview.schemabinding.version2.MapListTo vMapListTo)
- throws java.lang.IndexOutOfBoundsException {
- this._mapListToList.add(index, vMapListTo);
- }
-
- /**
- */
- public void deleteMapFromUnit(
- ) {
- this._has_mapFromUnit= false;
- }
-
- /**
- */
- public void deleteMapToUnit(
- ) {
- this._has_mapToUnit= false;
- }
-
- /**
- * Method enumerateMapListFrom.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.MapListFrom elements
- */
- public java.util.Enumeration enumerateMapListFrom(
- ) {
- return this._mapListFromList.elements();
- }
-
- /**
- * Method enumerateMapListTo.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.MapListTo elements
- */
- public java.util.Enumeration enumerateMapListTo(
- ) {
- return this._mapListToList.elements();
- }
-
- /**
- * Returns the value of field 'mapFromUnit'. The field
- * 'mapFromUnit' has the following description: number of
- * dictionary symbol widths involved in each
- * mapped position on this sequence (for example, 3 for a dna
- * sequence exon
- * region that is being mapped to a protein sequence). This is
- * optional,
- * since the unit can be usually be inferred from the
- * dictionary type of
- * each sequence involved in the mapping.
- *
- * @return the value of field 'MapFromUnit'.
- */
- public long getMapFromUnit(
- ) {
- return this._mapFromUnit;
- }
-
- /**
- * Method getMapListFrom.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.MapListFrom at the given index
- */
- public jalview.schemabinding.version2.MapListFrom getMapListFrom(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._mapListFromList.size()) {
- throw new IndexOutOfBoundsException("getMapListFrom: Index value '" + index + "' not in range [0.." + (this._mapListFromList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.MapListFrom) _mapListFromList.get(index);
- }
-
- /**
- * Method getMapListFrom.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.MapListFrom[] getMapListFrom(
- ) {
- jalview.schemabinding.version2.MapListFrom[] array = new jalview.schemabinding.version2.MapListFrom[0];
- return (jalview.schemabinding.version2.MapListFrom[]) this._mapListFromList.toArray(array);
- }
-
- /**
- * Method getMapListFromCount.
- *
- * @return the size of this collection
- */
- public int getMapListFromCount(
- ) {
- return this._mapListFromList.size();
- }
-
- /**
- * Method getMapListTo.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.MapListTo at the given index
- */
- public jalview.schemabinding.version2.MapListTo getMapListTo(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._mapListToList.size()) {
- throw new IndexOutOfBoundsException("getMapListTo: Index value '" + index + "' not in range [0.." + (this._mapListToList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.MapListTo) _mapListToList.get(index);
- }
-
- /**
- * Method getMapListTo.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.MapListTo[] getMapListTo(
- ) {
- jalview.schemabinding.version2.MapListTo[] array = new jalview.schemabinding.version2.MapListTo[0];
- return (jalview.schemabinding.version2.MapListTo[]) this._mapListToList.toArray(array);
- }
-
- /**
- * Method getMapListToCount.
- *
- * @return the size of this collection
- */
- public int getMapListToCount(
- ) {
- return this._mapListToList.size();
- }
-
- /**
- * Returns the value of field 'mapToUnit'. The field
- * 'mapToUnit' has the following description: number of
- * dictionary symbol widths involved in each
- * mapped position on this sequence (for example, 3 for a dna
- * sequence exon
- * region that is being mapped to a protein sequence). This is
- * optional,
- * since the unit can be usually be inferred from the
- * dictionary type of
- * each sequence involved in the mapping.
- *
- * @return the value of field 'MapToUnit'.
- */
- public long getMapToUnit(
- ) {
- return this._mapToUnit;
- }
-
- /**
- * Method hasMapFromUnit.
- *
- * @return true if at least one MapFromUnit has been added
- */
- public boolean hasMapFromUnit(
- ) {
- return this._has_mapFromUnit;
- }
-
- /**
- * Method hasMapToUnit.
- *
- * @return true if at least one MapToUnit has been added
- */
- public boolean hasMapToUnit(
- ) {
- return this._has_mapToUnit;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllMapListFrom(
- ) {
- this._mapListFromList.clear();
- }
-
- /**
- */
- public void removeAllMapListTo(
- ) {
- this._mapListToList.clear();
- }
-
- /**
- * Method removeMapListFrom.
- *
- * @param vMapListFrom
- * @return true if the object was removed from the collection.
- */
- public boolean removeMapListFrom(
- final jalview.schemabinding.version2.MapListFrom vMapListFrom) {
- boolean removed = _mapListFromList.remove(vMapListFrom);
- return removed;
- }
-
- /**
- * Method removeMapListFromAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.MapListFrom removeMapListFromAt(
- final int index) {
- java.lang.Object obj = this._mapListFromList.remove(index);
- return (jalview.schemabinding.version2.MapListFrom) obj;
- }
-
- /**
- * Method removeMapListTo.
- *
- * @param vMapListTo
- * @return true if the object was removed from the collection.
- */
- public boolean removeMapListTo(
- final jalview.schemabinding.version2.MapListTo vMapListTo) {
- boolean removed = _mapListToList.remove(vMapListTo);
- return removed;
- }
-
- /**
- * Method removeMapListToAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.MapListTo removeMapListToAt(
- final int index) {
- java.lang.Object obj = this._mapListToList.remove(index);
- return (jalview.schemabinding.version2.MapListTo) obj;
- }
-
- /**
- * Sets the value of field 'mapFromUnit'. The field
- * 'mapFromUnit' has the following description: number of
- * dictionary symbol widths involved in each
- * mapped position on this sequence (for example, 3 for a dna
- * sequence exon
- * region that is being mapped to a protein sequence). This is
- * optional,
- * since the unit can be usually be inferred from the
- * dictionary type of
- * each sequence involved in the mapping.
- *
- * @param mapFromUnit the value of field 'mapFromUnit'.
- */
- public void setMapFromUnit(
- final long mapFromUnit) {
- this._mapFromUnit = mapFromUnit;
- this._has_mapFromUnit = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vMapListFrom
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setMapListFrom(
- final int index,
- final jalview.schemabinding.version2.MapListFrom vMapListFrom)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._mapListFromList.size()) {
- throw new IndexOutOfBoundsException("setMapListFrom: Index value '" + index + "' not in range [0.." + (this._mapListFromList.size() - 1) + "]");
- }
-
- this._mapListFromList.set(index, vMapListFrom);
- }
-
- /**
- *
- *
- * @param vMapListFromArray
- */
- public void setMapListFrom(
- final jalview.schemabinding.version2.MapListFrom[] vMapListFromArray) {
- //-- copy array
- _mapListFromList.clear();
-
- for (int i = 0; i < vMapListFromArray.length; i++) {
- this._mapListFromList.add(vMapListFromArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vMapListTo
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setMapListTo(
- final int index,
- final jalview.schemabinding.version2.MapListTo vMapListTo)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._mapListToList.size()) {
- throw new IndexOutOfBoundsException("setMapListTo: Index value '" + index + "' not in range [0.." + (this._mapListToList.size() - 1) + "]");
- }
-
- this._mapListToList.set(index, vMapListTo);
- }
-
- /**
- *
- *
- * @param vMapListToArray
- */
- public void setMapListTo(
- final jalview.schemabinding.version2.MapListTo[] vMapListToArray) {
- //-- copy array
- _mapListToList.clear();
-
- for (int i = 0; i < vMapListToArray.length; i++) {
- this._mapListToList.add(vMapListToArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'mapToUnit'. The field 'mapToUnit'
- * has the following description: number of dictionary symbol
- * widths involved in each
- * mapped position on this sequence (for example, 3 for a dna
- * sequence exon
- * region that is being mapped to a protein sequence). This is
- * optional,
- * since the unit can be usually be inferred from the
- * dictionary type of
- * each sequence involved in the mapping.
- *
- * @param mapToUnit the value of field 'mapToUnit'.
- */
- public void setMapToUnit(
- final long mapToUnit) {
- this._mapToUnit = mapToUnit;
- this._has_mapToUnit = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.MapListType
- */
- public static jalview.schemabinding.version2.MapListType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.MapListType) Unmarshaller.unmarshal(jalview.schemabinding.version2.MapListType.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class MapListType implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * number of dictionary symbol widths involved in each mapped position on this
+ * sequence (for example, 3 for a dna sequence exon region that is being
+ * mapped to a protein sequence). This is optional, since the unit can be
+ * usually be inferred from the dictionary type of each sequence involved in
+ * the mapping.
+ */
+ private long _mapFromUnit;
+
+ /**
+ * keeps track of state for field: _mapFromUnit
+ */
+ private boolean _has_mapFromUnit;
+
+ /**
+ * number of dictionary symbol widths involved in each mapped position on this
+ * sequence (for example, 3 for a dna sequence exon region that is being
+ * mapped to a protein sequence). This is optional, since the unit can be
+ * usually be inferred from the dictionary type of each sequence involved in
+ * the mapping.
+ */
+ private long _mapToUnit;
+
+ /**
+ * keeps track of state for field: _mapToUnit
+ */
+ private boolean _has_mapToUnit;
+
+ /**
+ * a region from start to end inclusive
+ */
+ private java.util.Vector _mapListFromList;
+
+ /**
+ * a region from start to end inclusive
+ */
+ private java.util.Vector _mapListToList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public MapListType()
+ {
+ super();
+ this._mapListFromList = new java.util.Vector();
+ this._mapListToList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vMapListFrom
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMapListFrom(
+ final jalview.schemabinding.version2.MapListFrom vMapListFrom)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._mapListFromList.addElement(vMapListFrom);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMapListFrom
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMapListFrom(final int index,
+ final jalview.schemabinding.version2.MapListFrom vMapListFrom)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._mapListFromList.add(index, vMapListFrom);
+ }
+
+ /**
+ *
+ *
+ * @param vMapListTo
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMapListTo(
+ final jalview.schemabinding.version2.MapListTo vMapListTo)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._mapListToList.addElement(vMapListTo);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMapListTo
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMapListTo(final int index,
+ final jalview.schemabinding.version2.MapListTo vMapListTo)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._mapListToList.add(index, vMapListTo);
+ }
+
+ /**
+ */
+ public void deleteMapFromUnit()
+ {
+ this._has_mapFromUnit = false;
+ }
+
+ /**
+ */
+ public void deleteMapToUnit()
+ {
+ this._has_mapToUnit = false;
+ }
+
+ /**
+ * Method enumerateMapListFrom.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.MapListFrom
+ * elements
+ */
+ public java.util.Enumeration enumerateMapListFrom()
+ {
+ return this._mapListFromList.elements();
+ }
+
+ /**
+ * Method enumerateMapListTo.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.MapListTo
+ * elements
+ */
+ public java.util.Enumeration enumerateMapListTo()
+ {
+ return this._mapListToList.elements();
+ }
+
+ /**
+ * Returns the value of field 'mapFromUnit'. The field 'mapFromUnit' has the
+ * following description: number of dictionary symbol widths involved in each
+ * mapped position on this sequence (for example, 3 for a dna sequence exon
+ * region that is being mapped to a protein sequence). This is optional, since
+ * the unit can be usually be inferred from the dictionary type of each
+ * sequence involved in the mapping.
+ *
+ * @return the value of field 'MapFromUnit'.
+ */
+ public long getMapFromUnit()
+ {
+ return this._mapFromUnit;
+ }
+
+ /**
+ * Method getMapListFrom.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.MapListFrom at the
+ * given index
+ */
+ public jalview.schemabinding.version2.MapListFrom getMapListFrom(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._mapListFromList.size())
+ {
+ throw new IndexOutOfBoundsException("getMapListFrom: Index value '"
+ + index + "' not in range [0.."
+ + (this._mapListFromList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.MapListFrom) _mapListFromList
+ .get(index);
+ }
+
+ /**
+ * Method getMapListFrom.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.MapListFrom[] getMapListFrom()
+ {
+ jalview.schemabinding.version2.MapListFrom[] array = new jalview.schemabinding.version2.MapListFrom[0];
+ return (jalview.schemabinding.version2.MapListFrom[]) this._mapListFromList
+ .toArray(array);
+ }
+
+ /**
+ * Method getMapListFromCount.
+ *
+ * @return the size of this collection
+ */
+ public int getMapListFromCount()
+ {
+ return this._mapListFromList.size();
+ }
+
+ /**
+ * Method getMapListTo.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.MapListTo at the
+ * given index
+ */
+ public jalview.schemabinding.version2.MapListTo getMapListTo(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._mapListToList.size())
+ {
+ throw new IndexOutOfBoundsException("getMapListTo: Index value '"
+ + index + "' not in range [0.."
+ + (this._mapListToList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.MapListTo) _mapListToList
+ .get(index);
+ }
+
+ /**
+ * Method getMapListTo.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.MapListTo[] getMapListTo()
+ {
+ jalview.schemabinding.version2.MapListTo[] array = new jalview.schemabinding.version2.MapListTo[0];
+ return (jalview.schemabinding.version2.MapListTo[]) this._mapListToList
+ .toArray(array);
+ }
+
+ /**
+ * Method getMapListToCount.
+ *
+ * @return the size of this collection
+ */
+ public int getMapListToCount()
+ {
+ return this._mapListToList.size();
+ }
+
+ /**
+ * Returns the value of field 'mapToUnit'. The field 'mapToUnit' has the
+ * following description: number of dictionary symbol widths involved in each
+ * mapped position on this sequence (for example, 3 for a dna sequence exon
+ * region that is being mapped to a protein sequence). This is optional, since
+ * the unit can be usually be inferred from the dictionary type of each
+ * sequence involved in the mapping.
+ *
+ * @return the value of field 'MapToUnit'.
+ */
+ public long getMapToUnit()
+ {
+ return this._mapToUnit;
+ }
+
+ /**
+ * Method hasMapFromUnit.
+ *
+ * @return true if at least one MapFromUnit has been added
+ */
+ public boolean hasMapFromUnit()
+ {
+ return this._has_mapFromUnit;
+ }
+
+ /**
+ * Method hasMapToUnit.
+ *
+ * @return true if at least one MapToUnit has been added
+ */
+ public boolean hasMapToUnit()
+ {
+ return this._has_mapToUnit;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllMapListFrom()
+ {
+ this._mapListFromList.clear();
+ }
+
+ /**
+ */
+ public void removeAllMapListTo()
+ {
+ this._mapListToList.clear();
+ }
+
+ /**
+ * Method removeMapListFrom.
+ *
+ * @param vMapListFrom
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeMapListFrom(
+ final jalview.schemabinding.version2.MapListFrom vMapListFrom)
+ {
+ boolean removed = _mapListFromList.remove(vMapListFrom);
+ return removed;
+ }
+
+ /**
+ * Method removeMapListFromAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.MapListFrom removeMapListFromAt(
+ final int index)
+ {
+ java.lang.Object obj = this._mapListFromList.remove(index);
+ return (jalview.schemabinding.version2.MapListFrom) obj;
+ }
+
+ /**
+ * Method removeMapListTo.
+ *
+ * @param vMapListTo
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeMapListTo(
+ final jalview.schemabinding.version2.MapListTo vMapListTo)
+ {
+ boolean removed = _mapListToList.remove(vMapListTo);
+ return removed;
+ }
+
+ /**
+ * Method removeMapListToAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.MapListTo removeMapListToAt(
+ final int index)
+ {
+ java.lang.Object obj = this._mapListToList.remove(index);
+ return (jalview.schemabinding.version2.MapListTo) obj;
+ }
+
+ /**
+ * Sets the value of field 'mapFromUnit'. The field 'mapFromUnit' has the
+ * following description: number of dictionary symbol widths involved in each
+ * mapped position on this sequence (for example, 3 for a dna sequence exon
+ * region that is being mapped to a protein sequence). This is optional, since
+ * the unit can be usually be inferred from the dictionary type of each
+ * sequence involved in the mapping.
+ *
+ * @param mapFromUnit
+ * the value of field 'mapFromUnit'.
+ */
+ public void setMapFromUnit(final long mapFromUnit)
+ {
+ this._mapFromUnit = mapFromUnit;
+ this._has_mapFromUnit = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMapListFrom
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setMapListFrom(final int index,
+ final jalview.schemabinding.version2.MapListFrom vMapListFrom)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._mapListFromList.size())
+ {
+ throw new IndexOutOfBoundsException("setMapListFrom: Index value '"
+ + index + "' not in range [0.."
+ + (this._mapListFromList.size() - 1) + "]");
+ }
+
+ this._mapListFromList.set(index, vMapListFrom);
+ }
+
+ /**
+ *
+ *
+ * @param vMapListFromArray
+ */
+ public void setMapListFrom(
+ final jalview.schemabinding.version2.MapListFrom[] vMapListFromArray)
+ {
+ // -- copy array
+ _mapListFromList.clear();
+
+ for (int i = 0; i < vMapListFromArray.length; i++)
+ {
+ this._mapListFromList.add(vMapListFromArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMapListTo
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setMapListTo(final int index,
+ final jalview.schemabinding.version2.MapListTo vMapListTo)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._mapListToList.size())
+ {
+ throw new IndexOutOfBoundsException("setMapListTo: Index value '"
+ + index + "' not in range [0.."
+ + (this._mapListToList.size() - 1) + "]");
+ }
+
+ this._mapListToList.set(index, vMapListTo);
+ }
+
+ /**
+ *
+ *
+ * @param vMapListToArray
+ */
+ public void setMapListTo(
+ final jalview.schemabinding.version2.MapListTo[] vMapListToArray)
+ {
+ // -- copy array
+ _mapListToList.clear();
+
+ for (int i = 0; i < vMapListToArray.length; i++)
+ {
+ this._mapListToList.add(vMapListToArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'mapToUnit'. The field 'mapToUnit' has the
+ * following description: number of dictionary symbol widths involved in each
+ * mapped position on this sequence (for example, 3 for a dna sequence exon
+ * region that is being mapped to a protein sequence). This is optional, since
+ * the unit can be usually be inferred from the dictionary type of each
+ * sequence involved in the mapping.
+ *
+ * @param mapToUnit
+ * the value of field 'mapToUnit'.
+ */
+ public void setMapToUnit(final long mapToUnit)
+ {
+ this._mapToUnit = mapToUnit;
+ this._has_mapToUnit = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.MapListType
+ */
+ public static jalview.schemabinding.version2.MapListType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.MapListType) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.MapListType.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Mapping.java b/src/jalview/schemabinding/version2/Mapping.java
index 6fbc00c..9d71e1d 100644
--- a/src/jalview/schemabinding/version2/Mapping.java
+++ b/src/jalview/schemabinding/version2/Mapping.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,147 +19,155 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Mapping extends jalview.schemabinding.version2.MapListType
-implements java.io.Serializable
+public class Mapping extends jalview.schemabinding.version2.MapListType
+ implements java.io.Serializable
{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Internal choice value storage
- */
- private java.lang.Object _choiceValue;
-
- /**
- * Field _mappingChoice.
- */
- private jalview.schemabinding.version2.MappingChoice _mappingChoice;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Mapping() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'choiceValue'. The field
- * 'choiceValue' has the following description: Internal choice
- * value storage
- *
- * @return the value of field 'ChoiceValue'.
- */
- public java.lang.Object getChoiceValue(
- ) {
- return this._choiceValue;
- }
-
- /**
- * Returns the value of field 'mappingChoice'.
- *
- * @return the value of field 'MappingChoice'.
- */
- public jalview.schemabinding.version2.MappingChoice getMappingChoice(
- ) {
- return this._mappingChoice;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'mappingChoice'.
- *
- * @param mappingChoice the value of field 'mappingChoice'.
- */
- public void setMappingChoice(
- final jalview.schemabinding.version2.MappingChoice mappingChoice) {
- this._mappingChoice = mappingChoice;
- this._choiceValue = mappingChoice;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.MapListType
- */
- public static jalview.schemabinding.version2.MapListType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.MapListType) Unmarshaller.unmarshal(jalview.schemabinding.version2.Mapping.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Internal choice value storage
+ */
+ private java.lang.Object _choiceValue;
+
+ /**
+ * Field _mappingChoice.
+ */
+ private jalview.schemabinding.version2.MappingChoice _mappingChoice;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Mapping()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'choiceValue'. The field 'choiceValue' has the
+ * following description: Internal choice value storage
+ *
+ * @return the value of field 'ChoiceValue'.
+ */
+ public java.lang.Object getChoiceValue()
+ {
+ return this._choiceValue;
+ }
+
+ /**
+ * Returns the value of field 'mappingChoice'.
+ *
+ * @return the value of field 'MappingChoice'.
+ */
+ public jalview.schemabinding.version2.MappingChoice getMappingChoice()
+ {
+ return this._mappingChoice;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'mappingChoice'.
+ *
+ * @param mappingChoice
+ * the value of field 'mappingChoice'.
+ */
+ public void setMappingChoice(
+ final jalview.schemabinding.version2.MappingChoice mappingChoice)
+ {
+ this._mappingChoice = mappingChoice;
+ this._choiceValue = mappingChoice;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.MapListType
+ */
+ public static jalview.schemabinding.version2.MapListType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.MapListType) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.Mapping.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/MappingChoice.java b/src/jalview/schemabinding/version2/MappingChoice.java
index 6ea0e09..e50efa7 100644
--- a/src/jalview/schemabinding/version2/MappingChoice.java
+++ b/src/jalview/schemabinding/version2/MappingChoice.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,152 +19,164 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class MappingChoice implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _sequence.
- */
- private jalview.schemabinding.version2.Sequence _sequence;
-
- /**
- * Field _dseqFor.
- */
- private java.lang.String _dseqFor;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public MappingChoice() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'dseqFor'.
- *
- * @return the value of field 'DseqFor'.
- */
- public java.lang.String getDseqFor(
- ) {
- return this._dseqFor;
- }
-
- /**
- * Returns the value of field 'sequence'.
- *
- * @return the value of field 'Sequence'.
- */
- public jalview.schemabinding.version2.Sequence getSequence(
- ) {
- return this._sequence;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'dseqFor'.
- *
- * @param dseqFor the value of field 'dseqFor'.
- */
- public void setDseqFor(
- final java.lang.String dseqFor) {
- this._dseqFor = dseqFor;
- }
-
- /**
- * Sets the value of field 'sequence'.
- *
- * @param sequence the value of field 'sequence'.
- */
- public void setSequence(
- final jalview.schemabinding.version2.Sequence sequence) {
- this._sequence = sequence;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.MappingChoice
- */
- public static jalview.schemabinding.version2.MappingChoice unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.MappingChoice) Unmarshaller.unmarshal(jalview.schemabinding.version2.MappingChoice.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class MappingChoice implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _sequence.
+ */
+ private jalview.schemabinding.version2.Sequence _sequence;
+
+ /**
+ * Field _dseqFor.
+ */
+ private java.lang.String _dseqFor;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public MappingChoice()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'dseqFor'.
+ *
+ * @return the value of field 'DseqFor'.
+ */
+ public java.lang.String getDseqFor()
+ {
+ return this._dseqFor;
+ }
+
+ /**
+ * Returns the value of field 'sequence'.
+ *
+ * @return the value of field 'Sequence'.
+ */
+ public jalview.schemabinding.version2.Sequence getSequence()
+ {
+ return this._sequence;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'dseqFor'.
+ *
+ * @param dseqFor
+ * the value of field 'dseqFor'.
+ */
+ public void setDseqFor(final java.lang.String dseqFor)
+ {
+ this._dseqFor = dseqFor;
+ }
+
+ /**
+ * Sets the value of field 'sequence'.
+ *
+ * @param sequence
+ * the value of field 'sequence'.
+ */
+ public void setSequence(
+ final jalview.schemabinding.version2.Sequence sequence)
+ {
+ this._sequence = sequence;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.MappingChoice
+ */
+ public static jalview.schemabinding.version2.MappingChoice unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.MappingChoice) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.MappingChoice.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/OtherData.java b/src/jalview/schemabinding/version2/OtherData.java
index 69046dc..fb6b276 100644
--- a/src/jalview/schemabinding/version2/OtherData.java
+++ b/src/jalview/schemabinding/version2/OtherData.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,152 +19,163 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class OtherData implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _key.
- */
- private java.lang.String _key;
-
- /**
- * Field _value.
- */
- private java.lang.String _value;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public OtherData() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'key'.
- *
- * @return the value of field 'Key'.
- */
- public java.lang.String getKey(
- ) {
- return this._key;
- }
-
- /**
- * Returns the value of field 'value'.
- *
- * @return the value of field 'Value'.
- */
- public java.lang.String getValue(
- ) {
- return this._value;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'key'.
- *
- * @param key the value of field 'key'.
- */
- public void setKey(
- final java.lang.String key) {
- this._key = key;
- }
-
- /**
- * Sets the value of field 'value'.
- *
- * @param value the value of field 'value'.
- */
- public void setValue(
- final java.lang.String value) {
- this._value = value;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.OtherData
- */
- public static jalview.schemabinding.version2.OtherData unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.OtherData) Unmarshaller.unmarshal(jalview.schemabinding.version2.OtherData.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class OtherData implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _key.
+ */
+ private java.lang.String _key;
+
+ /**
+ * Field _value.
+ */
+ private java.lang.String _value;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public OtherData()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'key'.
+ *
+ * @return the value of field 'Key'.
+ */
+ public java.lang.String getKey()
+ {
+ return this._key;
+ }
+
+ /**
+ * Returns the value of field 'value'.
+ *
+ * @return the value of field 'Value'.
+ */
+ public java.lang.String getValue()
+ {
+ return this._value;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'key'.
+ *
+ * @param key
+ * the value of field 'key'.
+ */
+ public void setKey(final java.lang.String key)
+ {
+ this._key = key;
+ }
+
+ /**
+ * Sets the value of field 'value'.
+ *
+ * @param value
+ * the value of field 'value'.
+ */
+ public void setValue(final java.lang.String value)
+ {
+ this._value = value;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.OtherData
+ */
+ public static jalview.schemabinding.version2.OtherData unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.OtherData) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.OtherData.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Pdbentry.java b/src/jalview/schemabinding/version2/Pdbentry.java
index 32eae8d..65de364 100644
--- a/src/jalview/schemabinding/version2/Pdbentry.java
+++ b/src/jalview/schemabinding/version2/Pdbentry.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,334 +19,357 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Pdbentry implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _id.
- */
- private java.lang.String _id;
-
- /**
- * Field _type.
- */
- private java.lang.String _type;
-
- /**
- * Field _file.
- */
- private java.lang.String _file;
-
- /**
- * Field _items.
- */
- private java.util.Vector _items;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Pdbentry() {
- super();
- this._items = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vPdbentryItem
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbentryItem(
- final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
- throws java.lang.IndexOutOfBoundsException {
- this._items.addElement(vPdbentryItem);
- }
-
- /**
- *
- *
- * @param index
- * @param vPdbentryItem
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbentryItem(
- final int index,
- final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
- throws java.lang.IndexOutOfBoundsException {
- this._items.add(index, vPdbentryItem);
- }
-
- /**
- * Method enumeratePdbentryItem.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.PdbentryItem elements
- */
- public java.util.Enumeration enumeratePdbentryItem(
- ) {
- return this._items.elements();
- }
-
- /**
- * Returns the value of field 'file'.
- *
- * @return the value of field 'File'.
- */
- public java.lang.String getFile(
- ) {
- return this._file;
- }
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Method getPdbentryItem.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.PdbentryItem at the given inde
- */
- public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._items.size()) {
- throw new IndexOutOfBoundsException("getPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);
- }
-
- /**
- * Method getPdbentryItem.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem(
- ) {
- jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];
- return (jalview.schemabinding.version2.PdbentryItem[]) this._items.toArray(array);
- }
-
- /**
- * Method getPdbentryItemCount.
- *
- * @return the size of this collection
- */
- public int getPdbentryItemCount(
- ) {
- return this._items.size();
- }
-
- /**
- * Returns the value of field 'type'.
- *
- * @return the value of field 'Type'.
- */
- public java.lang.String getType(
- ) {
- return this._type;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllPdbentryItem(
- ) {
- this._items.clear();
- }
-
- /**
- * Method removePdbentryItem.
- *
- * @param vPdbentryItem
- * @return true if the object was removed from the collection.
- */
- public boolean removePdbentryItem(
- final jalview.schemabinding.version2.PdbentryItem vPdbentryItem) {
- boolean removed = _items.remove(vPdbentryItem);
- return removed;
- }
-
- /**
- * Method removePdbentryItemAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(
- final int index) {
- java.lang.Object obj = this._items.remove(index);
- return (jalview.schemabinding.version2.PdbentryItem) obj;
- }
-
- /**
- * Sets the value of field 'file'.
- *
- * @param file the value of field 'file'.
- */
- public void setFile(
- final java.lang.String file) {
- this._file = file;
+public class Pdbentry implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _id.
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _type.
+ */
+ private java.lang.String _type;
+
+ /**
+ * Field _file.
+ */
+ private java.lang.String _file;
+
+ /**
+ * Field _items.
+ */
+ private java.util.Vector _items;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Pdbentry()
+ {
+ super();
+ this._items = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vPdbentryItem
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbentryItem(
+ final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._items.addElement(vPdbentryItem);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbentryItem
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbentryItem(final int index,
+ final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._items.add(index, vPdbentryItem);
+ }
+
+ /**
+ * Method enumeratePdbentryItem.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.PdbentryItem
+ * elements
+ */
+ public java.util.Enumeration enumeratePdbentryItem()
+ {
+ return this._items.elements();
+ }
+
+ /**
+ * Returns the value of field 'file'.
+ *
+ * @return the value of field 'File'.
+ */
+ public java.lang.String getFile()
+ {
+ return this._file;
+ }
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Method getPdbentryItem.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.PdbentryItem at the
+ * given inde
+ */
+ public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._items.size())
+ {
+ throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
+ + index + "' not in range [0.." + (this._items.size() - 1)
+ + "]");
}
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
+ return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);
+ }
+
+ /**
+ * Method getPdbentryItem.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem()
+ {
+ jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];
+ return (jalview.schemabinding.version2.PdbentryItem[]) this._items
+ .toArray(array);
+ }
+
+ /**
+ * Method getPdbentryItemCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPdbentryItemCount()
+ {
+ return this._items.size();
+ }
+
+ /**
+ * Returns the value of field 'type'.
+ *
+ * @return the value of field 'Type'.
+ */
+ public java.lang.String getType()
+ {
+ return this._type;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- *
- *
- * @param index
- * @param vPdbentryItem
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public void setPdbentryItem(
- final int index,
- final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._items.size()) {
- throw new IndexOutOfBoundsException("setPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]");
- }
-
- this._items.set(index, vPdbentryItem);
+ public void removeAllPdbentryItem()
+ {
+ this._items.clear();
+ }
+
+ /**
+ * Method removePdbentryItem.
+ *
+ * @param vPdbentryItem
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removePdbentryItem(
+ final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
+ {
+ boolean removed = _items.remove(vPdbentryItem);
+ return removed;
+ }
+
+ /**
+ * Method removePdbentryItemAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(
+ final int index)
+ {
+ java.lang.Object obj = this._items.remove(index);
+ return (jalview.schemabinding.version2.PdbentryItem) obj;
+ }
+
+ /**
+ * Sets the value of field 'file'.
+ *
+ * @param file
+ * the value of field 'file'.
+ */
+ public void setFile(final java.lang.String file)
+ {
+ this._file = file;
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbentryItem
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setPdbentryItem(final int index,
+ final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._items.size())
+ {
+ throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
+ + index + "' not in range [0.." + (this._items.size() - 1)
+ + "]");
}
- /**
- *
- *
- * @param vPdbentryItemArray
- */
- public void setPdbentryItem(
- final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray) {
- //-- copy array
- _items.clear();
-
- for (int i = 0; i < vPdbentryItemArray.length; i++) {
- this._items.add(vPdbentryItemArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'type'.
- *
- * @param type the value of field 'type'.
- */
- public void setType(
- final java.lang.String type) {
- this._type = type;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.Pdbentry
- */
- public static jalview.schemabinding.version2.Pdbentry unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Pdbentry) Unmarshaller.unmarshal(jalview.schemabinding.version2.Pdbentry.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._items.set(index, vPdbentryItem);
+ }
+
+ /**
+ *
+ *
+ * @param vPdbentryItemArray
+ */
+ public void setPdbentryItem(
+ final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray)
+ {
+ // -- copy array
+ _items.clear();
+
+ for (int i = 0; i < vPdbentryItemArray.length; i++)
+ {
+ this._items.add(vPdbentryItemArray[i]);
}
+ }
+
+ /**
+ * Sets the value of field 'type'.
+ *
+ * @param type
+ * the value of field 'type'.
+ */
+ public void setType(final java.lang.String type)
+ {
+ this._type = type;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
+ */
+ public static jalview.schemabinding.version2.Pdbentry unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.Pdbentry.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/PdbentryItem.java b/src/jalview/schemabinding/version2/PdbentryItem.java
index ab879e4..5554b49 100644
--- a/src/jalview/schemabinding/version2/PdbentryItem.java
+++ b/src/jalview/schemabinding/version2/PdbentryItem.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -29,181 +12,193 @@ package jalview.schemabinding.version2;
*
* @version $Revision$ $Date$
*/
-public class PdbentryItem implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _propertyList.
- */
- private java.util.Vector _propertyList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public PdbentryItem() {
- super();
- this._propertyList = new java.util.Vector();
+public class PdbentryItem implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _propertyList.
+ */
+ private java.util.Vector _propertyList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public PdbentryItem()
+ {
+ super();
+ this._propertyList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(
+ final jalview.schemabinding.version2.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._propertyList.addElement(vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final int index,
+ final jalview.schemabinding.version2.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._propertyList.add(index, vProperty);
+ }
+
+ /**
+ * Method enumerateProperty.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Property
+ * elements
+ */
+ public java.util.Enumeration enumerateProperty()
+ {
+ return this._propertyList.elements();
+ }
+
+ /**
+ * Method getProperty.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Property at the
+ * given index
+ */
+ public jalview.schemabinding.version2.Property getProperty(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size())
+ {
+ throw new IndexOutOfBoundsException("getProperty: Index value '"
+ + index + "' not in range [0.."
+ + (this._propertyList.size() - 1) + "]");
}
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
+ return (jalview.schemabinding.version2.Property) _propertyList
+ .get(index);
+ }
+
+ /**
+ * Method getProperty.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Property[] getProperty()
+ {
+ jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0];
+ return (jalview.schemabinding.version2.Property[]) this._propertyList
+ .toArray(array);
+ }
+
+ /**
+ * Method getPropertyCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPropertyCount()
+ {
+ return this._propertyList.size();
+ }
+
+ /**
*/
- public void addProperty(
- final jalview.schemabinding.version2.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.addElement(vProperty);
+ public void removeAllProperty()
+ {
+ this._propertyList.clear();
+ }
+
+ /**
+ * Method removeProperty.
+ *
+ * @param vProperty
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeProperty(
+ final jalview.schemabinding.version2.Property vProperty)
+ {
+ boolean removed = _propertyList.remove(vProperty);
+ return removed;
+ }
+
+ /**
+ * Method removePropertyAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Property removePropertyAt(
+ final int index)
+ {
+ java.lang.Object obj = this._propertyList.remove(index);
+ return (jalview.schemabinding.version2.Property) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setProperty(final int index,
+ final jalview.schemabinding.version2.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size())
+ {
+ throw new IndexOutOfBoundsException("setProperty: Index value '"
+ + index + "' not in range [0.."
+ + (this._propertyList.size() - 1) + "]");
}
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final int index,
- final jalview.schemabinding.version2.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.add(index, vProperty);
- }
-
- /**
- * Method enumerateProperty.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Property elements
- */
- public java.util.Enumeration enumerateProperty(
- ) {
- return this._propertyList.elements();
- }
-
- /**
- * Method getProperty.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Property at the given index
- */
- public jalview.schemabinding.version2.Property getProperty(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Property) _propertyList.get(index);
- }
-
- /**
- * Method getProperty.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Property[] getProperty(
- ) {
- jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0];
- return (jalview.schemabinding.version2.Property[]) this._propertyList.toArray(array);
- }
-
- /**
- * Method getPropertyCount.
- *
- * @return the size of this collection
- */
- public int getPropertyCount(
- ) {
- return this._propertyList.size();
- }
-
- /**
- */
- public void removeAllProperty(
- ) {
- this._propertyList.clear();
- }
-
- /**
- * Method removeProperty.
- *
- * @param vProperty
- * @return true if the object was removed from the collection.
- */
- public boolean removeProperty(
- final jalview.schemabinding.version2.Property vProperty) {
- boolean removed = _propertyList.remove(vProperty);
- return removed;
- }
-
- /**
- * Method removePropertyAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Property removePropertyAt(
- final int index) {
- java.lang.Object obj = this._propertyList.remove(index);
- return (jalview.schemabinding.version2.Property) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setProperty(
- final int index,
- final jalview.schemabinding.version2.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- this._propertyList.set(index, vProperty);
- }
-
- /**
- *
- *
- * @param vPropertyArray
- */
- public void setProperty(
- final jalview.schemabinding.version2.Property[] vPropertyArray) {
- //-- copy array
- _propertyList.clear();
-
- for (int i = 0; i < vPropertyArray.length; i++) {
- this._propertyList.add(vPropertyArray[i]);
- }
+ this._propertyList.set(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vPropertyArray
+ */
+ public void setProperty(
+ final jalview.schemabinding.version2.Property[] vPropertyArray)
+ {
+ // -- copy array
+ _propertyList.clear();
+
+ for (int i = 0; i < vPropertyArray.length; i++)
+ {
+ this._propertyList.add(vPropertyArray[i]);
}
+ }
}
diff --git a/src/jalview/schemabinding/version2/Pdbids.java b/src/jalview/schemabinding/version2/Pdbids.java
index 5432b30..978df5b 100644
--- a/src/jalview/schemabinding/version2/Pdbids.java
+++ b/src/jalview/schemabinding/version2/Pdbids.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,262 +19,285 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Pdbids extends jalview.schemabinding.version2.Pdbentry
-implements java.io.Serializable
+public class Pdbids extends jalview.schemabinding.version2.Pdbentry
+ implements java.io.Serializable
{
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
+ /**
+ * Field _structureStateList.
+ */
+ private java.util.Vector _structureStateList;
- /**
- * Field _structureStateList.
- */
- private java.util.Vector _structureStateList;
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+ public Pdbids()
+ {
+ super();
+ this._structureStateList = new java.util.Vector();
+ }
- //----------------/
- //- Constructors -/
- //----------------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- public Pdbids() {
- super();
- this._structureStateList = new java.util.Vector();
- }
+ /**
+ *
+ *
+ * @param vStructureState
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addStructureState(
+ final jalview.schemabinding.version2.StructureState vStructureState)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._structureStateList.addElement(vStructureState);
+ }
+ /**
+ *
+ *
+ * @param index
+ * @param vStructureState
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addStructureState(
+ final int index,
+ final jalview.schemabinding.version2.StructureState vStructureState)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._structureStateList.add(index, vStructureState);
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ /**
+ * Method enumerateStructureState.
+ *
+ * @return an Enumeration over all
+ * jalview.schemabinding.version2.StructureState elements
+ */
+ public java.util.Enumeration enumerateStructureState()
+ {
+ return this._structureStateList.elements();
+ }
- /**
- *
- *
- * @param vStructureState
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addStructureState(
- final jalview.schemabinding.version2.StructureState vStructureState)
- throws java.lang.IndexOutOfBoundsException {
- this._structureStateList.addElement(vStructureState);
+ /**
+ * Method getStructureState.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.StructureState at
+ * the given index
+ */
+ public jalview.schemabinding.version2.StructureState getStructureState(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._structureStateList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "getStructureState: Index value '" + index
+ + "' not in range [0.."
+ + (this._structureStateList.size() - 1) + "]");
}
- /**
- *
- *
- * @param index
- * @param vStructureState
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addStructureState(
- final int index,
- final jalview.schemabinding.version2.StructureState vStructureState)
- throws java.lang.IndexOutOfBoundsException {
- this._structureStateList.add(index, vStructureState);
- }
+ return (jalview.schemabinding.version2.StructureState) _structureStateList
+ .get(index);
+ }
- /**
- * Method enumerateStructureState.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.StructureState elements
- */
- public java.util.Enumeration enumerateStructureState(
- ) {
- return this._structureStateList.elements();
- }
+ /**
+ * Method getStructureState.Returns the contents of the collection in an
+ * Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.StructureState[] getStructureState()
+ {
+ jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
+ return (jalview.schemabinding.version2.StructureState[]) this._structureStateList
+ .toArray(array);
+ }
- /**
- * Method getStructureState.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.StructureState at the given
- * index
- */
- public jalview.schemabinding.version2.StructureState getStructureState(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._structureStateList.size()) {
- throw new IndexOutOfBoundsException("getStructureState: Index value '" + index + "' not in range [0.." + (this._structureStateList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.StructureState) _structureStateList.get(index);
- }
+ /**
+ * Method getStructureStateCount.
+ *
+ * @return the size of this collection
+ */
+ public int getStructureStateCount()
+ {
+ return this._structureStateList.size();
+ }
- /**
- * Method getStructureState.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.StructureState[] getStructureState(
- ) {
- jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
- return (jalview.schemabinding.version2.StructureState[]) this._structureStateList.toArray(array);
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- * Method getStructureStateCount.
- *
- * @return the size of this collection
- */
- public int getStructureStateCount(
- ) {
- return this._structureStateList.size();
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
+ /**
*/
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ public void removeAllStructureState()
+ {
+ this._structureStateList.clear();
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ * Method removeStructureState.
+ *
+ * @param vStructureState
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeStructureState(
+ final jalview.schemabinding.version2.StructureState vStructureState)
+ {
+ boolean removed = _structureStateList.remove(vStructureState);
+ return removed;
+ }
- /**
- */
- public void removeAllStructureState(
- ) {
- this._structureStateList.clear();
- }
+ /**
+ * Method removeStructureStateAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.StructureState removeStructureStateAt(
+ final int index)
+ {
+ java.lang.Object obj = this._structureStateList.remove(index);
+ return (jalview.schemabinding.version2.StructureState) obj;
+ }
- /**
- * Method removeStructureState.
- *
- * @param vStructureState
- * @return true if the object was removed from the collection.
- */
- public boolean removeStructureState(
- final jalview.schemabinding.version2.StructureState vStructureState) {
- boolean removed = _structureStateList.remove(vStructureState);
- return removed;
+ /**
+ *
+ *
+ * @param index
+ * @param vStructureState
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setStructureState(
+ final int index,
+ final jalview.schemabinding.version2.StructureState vStructureState)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._structureStateList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "setStructureState: Index value '" + index
+ + "' not in range [0.."
+ + (this._structureStateList.size() - 1) + "]");
}
- /**
- * Method removeStructureStateAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.StructureState removeStructureStateAt(
- final int index) {
- java.lang.Object obj = this._structureStateList.remove(index);
- return (jalview.schemabinding.version2.StructureState) obj;
- }
+ this._structureStateList.set(index, vStructureState);
+ }
- /**
- *
- *
- * @param index
- * @param vStructureState
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setStructureState(
- final int index,
- final jalview.schemabinding.version2.StructureState vStructureState)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._structureStateList.size()) {
- throw new IndexOutOfBoundsException("setStructureState: Index value '" + index + "' not in range [0.." + (this._structureStateList.size() - 1) + "]");
- }
-
- this._structureStateList.set(index, vStructureState);
- }
+ /**
+ *
+ *
+ * @param vStructureStateArray
+ */
+ public void setStructureState(
+ final jalview.schemabinding.version2.StructureState[] vStructureStateArray)
+ {
+ // -- copy array
+ _structureStateList.clear();
- /**
- *
- *
- * @param vStructureStateArray
- */
- public void setStructureState(
- final jalview.schemabinding.version2.StructureState[] vStructureStateArray) {
- //-- copy array
- _structureStateList.clear();
-
- for (int i = 0; i < vStructureStateArray.length; i++) {
- this._structureStateList.add(vStructureStateArray[i]);
- }
+ for (int i = 0; i < vStructureStateArray.length; i++)
+ {
+ this._structureStateList.add(vStructureStateArray[i]);
}
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.Pdbentry
- */
- public static jalview.schemabinding.version2.Pdbentry unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Pdbentry) Unmarshaller.unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
+ */
+ public static jalview.schemabinding.version2.Pdbentry unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Property.java b/src/jalview/schemabinding/version2/Property.java
index 20d36bf..dbf96bf 100644
--- a/src/jalview/schemabinding/version2/Property.java
+++ b/src/jalview/schemabinding/version2/Property.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,152 +19,163 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Property implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
- /**
- * Field _value.
- */
- private java.lang.String _value;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Property() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Returns the value of field 'value'.
- *
- * @return the value of field 'Value'.
- */
- public java.lang.String getValue(
- ) {
- return this._value;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Sets the value of field 'value'.
- *
- * @param value the value of field 'value'.
- */
- public void setValue(
- final java.lang.String value) {
- this._value = value;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.Property
- */
- public static jalview.schemabinding.version2.Property unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Property) Unmarshaller.unmarshal(jalview.schemabinding.version2.Property.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class Property implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _value.
+ */
+ private java.lang.String _value;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Property()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Returns the value of field 'value'.
+ *
+ * @return the value of field 'Value'.
+ */
+ public java.lang.String getValue()
+ {
+ return this._value;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Sets the value of field 'value'.
+ *
+ * @param value
+ * the value of field 'value'.
+ */
+ public void setValue(final java.lang.String value)
+ {
+ this._value = value;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Property
+ */
+ public static jalview.schemabinding.version2.Property unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Property) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.Property.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/RnaViewer.java b/src/jalview/schemabinding/version2/RnaViewer.java
new file mode 100644
index 0000000..543d053
--- /dev/null
+++ b/src/jalview/schemabinding/version2/RnaViewer.java
@@ -0,0 +1,668 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Reference to a viewer showing RNA structure for this sequence. Schema
+ * supports one viewer showing multiple annotations for multiple sequences,
+ * though currently only one annotation for one sequence (gapped or trimmed) is
+ * used
+ *
+ *
+ * @version $Revision$ $Date$
+ */
+public class RnaViewer implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _title.
+ */
+ private java.lang.String _title;
+
+ /**
+ * An id unique to the RNA viewer panel
+ *
+ */
+ private java.lang.String _viewId;
+
+ /**
+ * horizontal position of split pane divider
+ *
+ */
+ private int _dividerLocation;
+
+ /**
+ * keeps track of state for field: _dividerLocation
+ */
+ private boolean _has_dividerLocation;
+
+ /**
+ * Index of the selected structure in the viewer panel
+ *
+ */
+ private int _selectedRna;
+
+ /**
+ * keeps track of state for field: _selectedRna
+ */
+ private boolean _has_selectedRna;
+
+ /**
+ * Field _width.
+ */
+ private int _width;
+
+ /**
+ * keeps track of state for field: _width
+ */
+ private boolean _has_width;
+
+ /**
+ * Field _height.
+ */
+ private int _height;
+
+ /**
+ * keeps track of state for field: _height
+ */
+ private boolean _has_height;
+
+ /**
+ * Field _xpos.
+ */
+ private int _xpos;
+
+ /**
+ * keeps track of state for field: _xpos
+ */
+ private boolean _has_xpos;
+
+ /**
+ * Field _ypos.
+ */
+ private int _ypos;
+
+ /**
+ * keeps track of state for field: _ypos
+ */
+ private boolean _has_ypos;
+
+ /**
+ * Field _secondaryStructureList.
+ */
+ private java.util.Vector _secondaryStructureList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public RnaViewer()
+ {
+ super();
+ this._secondaryStructureList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vSecondaryStructure
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSecondaryStructure(
+ final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._secondaryStructureList.addElement(vSecondaryStructure);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSecondaryStructure
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSecondaryStructure(
+ final int index,
+ final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._secondaryStructureList.add(index, vSecondaryStructure);
+ }
+
+ /**
+ */
+ public void deleteDividerLocation()
+ {
+ this._has_dividerLocation = false;
+ }
+
+ /**
+ */
+ public void deleteHeight()
+ {
+ this._has_height = false;
+ }
+
+ /**
+ */
+ public void deleteSelectedRna()
+ {
+ this._has_selectedRna = false;
+ }
+
+ /**
+ */
+ public void deleteWidth()
+ {
+ this._has_width = false;
+ }
+
+ /**
+ */
+ public void deleteXpos()
+ {
+ this._has_xpos = false;
+ }
+
+ /**
+ */
+ public void deleteYpos()
+ {
+ this._has_ypos = false;
+ }
+
+ /**
+ * Method enumerateSecondaryStructure.
+ *
+ * @return an Enumeration over all
+ * jalview.schemabinding.version2.SecondaryStructure elements
+ */
+ public java.util.Enumeration enumerateSecondaryStructure()
+ {
+ return this._secondaryStructureList.elements();
+ }
+
+ /**
+ * Returns the value of field 'dividerLocation'. The field 'dividerLocation'
+ * has the following description: horizontal position of split pane divider
+ *
+ *
+ * @return the value of field 'DividerLocation'.
+ */
+ public int getDividerLocation()
+ {
+ return this._dividerLocation;
+ }
+
+ /**
+ * Returns the value of field 'height'.
+ *
+ * @return the value of field 'Height'.
+ */
+ public int getHeight()
+ {
+ return this._height;
+ }
+
+ /**
+ * Method getSecondaryStructure.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.SecondaryStructure
+ * at the given index
+ */
+ public jalview.schemabinding.version2.SecondaryStructure getSecondaryStructure(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._secondaryStructureList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "getSecondaryStructure: Index value '" + index
+ + "' not in range [0.."
+ + (this._secondaryStructureList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.SecondaryStructure) _secondaryStructureList
+ .get(index);
+ }
+
+ /**
+ * Method getSecondaryStructure.Returns the contents of the collection in an
+ * Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.SecondaryStructure[] getSecondaryStructure()
+ {
+ jalview.schemabinding.version2.SecondaryStructure[] array = new jalview.schemabinding.version2.SecondaryStructure[0];
+ return (jalview.schemabinding.version2.SecondaryStructure[]) this._secondaryStructureList
+ .toArray(array);
+ }
+
+ /**
+ * Method getSecondaryStructureCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSecondaryStructureCount()
+ {
+ return this._secondaryStructureList.size();
+ }
+
+ /**
+ * Returns the value of field 'selectedRna'. The field 'selectedRna' has the
+ * following description: Index of the selected structure in the viewer panel
+ *
+ *
+ * @return the value of field 'SelectedRna'.
+ */
+ public int getSelectedRna()
+ {
+ return this._selectedRna;
+ }
+
+ /**
+ * Returns the value of field 'title'.
+ *
+ * @return the value of field 'Title'.
+ */
+ public java.lang.String getTitle()
+ {
+ return this._title;
+ }
+
+ /**
+ * Returns the value of field 'viewId'. The field 'viewId' has the following
+ * description: An id unique to the RNA viewer panel
+ *
+ *
+ * @return the value of field 'ViewId'.
+ */
+ public java.lang.String getViewId()
+ {
+ return this._viewId;
+ }
+
+ /**
+ * Returns the value of field 'width'.
+ *
+ * @return the value of field 'Width'.
+ */
+ public int getWidth()
+ {
+ return this._width;
+ }
+
+ /**
+ * Returns the value of field 'xpos'.
+ *
+ * @return the value of field 'Xpos'.
+ */
+ public int getXpos()
+ {
+ return this._xpos;
+ }
+
+ /**
+ * Returns the value of field 'ypos'.
+ *
+ * @return the value of field 'Ypos'.
+ */
+ public int getYpos()
+ {
+ return this._ypos;
+ }
+
+ /**
+ * Method hasDividerLocation.
+ *
+ * @return true if at least one DividerLocation has been added
+ */
+ public boolean hasDividerLocation()
+ {
+ return this._has_dividerLocation;
+ }
+
+ /**
+ * Method hasHeight.
+ *
+ * @return true if at least one Height has been added
+ */
+ public boolean hasHeight()
+ {
+ return this._has_height;
+ }
+
+ /**
+ * Method hasSelectedRna.
+ *
+ * @return true if at least one SelectedRna has been added
+ */
+ public boolean hasSelectedRna()
+ {
+ return this._has_selectedRna;
+ }
+
+ /**
+ * Method hasWidth.
+ *
+ * @return true if at least one Width has been added
+ */
+ public boolean hasWidth()
+ {
+ return this._has_width;
+ }
+
+ /**
+ * Method hasXpos.
+ *
+ * @return true if at least one Xpos has been added
+ */
+ public boolean hasXpos()
+ {
+ return this._has_xpos;
+ }
+
+ /**
+ * Method hasYpos.
+ *
+ * @return true if at least one Ypos has been added
+ */
+ public boolean hasYpos()
+ {
+ return this._has_ypos;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllSecondaryStructure()
+ {
+ this._secondaryStructureList.clear();
+ }
+
+ /**
+ * Method removeSecondaryStructure.
+ *
+ * @param vSecondaryStructure
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSecondaryStructure(
+ final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure)
+ {
+ boolean removed = _secondaryStructureList.remove(vSecondaryStructure);
+ return removed;
+ }
+
+ /**
+ * Method removeSecondaryStructureAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.SecondaryStructure removeSecondaryStructureAt(
+ final int index)
+ {
+ java.lang.Object obj = this._secondaryStructureList.remove(index);
+ return (jalview.schemabinding.version2.SecondaryStructure) obj;
+ }
+
+ /**
+ * Sets the value of field 'dividerLocation'. The field 'dividerLocation' has
+ * the following description: horizontal position of split pane divider
+ *
+ *
+ * @param dividerLocation
+ * the value of field 'dividerLocation'.
+ */
+ public void setDividerLocation(final int dividerLocation)
+ {
+ this._dividerLocation = dividerLocation;
+ this._has_dividerLocation = true;
+ }
+
+ /**
+ * Sets the value of field 'height'.
+ *
+ * @param height
+ * the value of field 'height'.
+ */
+ public void setHeight(final int height)
+ {
+ this._height = height;
+ this._has_height = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSecondaryStructure
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSecondaryStructure(
+ final int index,
+ final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._secondaryStructureList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "setSecondaryStructure: Index value '" + index
+ + "' not in range [0.."
+ + (this._secondaryStructureList.size() - 1) + "]");
+ }
+
+ this._secondaryStructureList.set(index, vSecondaryStructure);
+ }
+
+ /**
+ *
+ *
+ * @param vSecondaryStructureArray
+ */
+ public void setSecondaryStructure(
+ final jalview.schemabinding.version2.SecondaryStructure[] vSecondaryStructureArray)
+ {
+ // -- copy array
+ _secondaryStructureList.clear();
+
+ for (int i = 0; i < vSecondaryStructureArray.length; i++)
+ {
+ this._secondaryStructureList.add(vSecondaryStructureArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'selectedRna'. The field 'selectedRna' has the
+ * following description: Index of the selected structure in the viewer panel
+ *
+ *
+ * @param selectedRna
+ * the value of field 'selectedRna'.
+ */
+ public void setSelectedRna(final int selectedRna)
+ {
+ this._selectedRna = selectedRna;
+ this._has_selectedRna = true;
+ }
+
+ /**
+ * Sets the value of field 'title'.
+ *
+ * @param title
+ * the value of field 'title'.
+ */
+ public void setTitle(final java.lang.String title)
+ {
+ this._title = title;
+ }
+
+ /**
+ * Sets the value of field 'viewId'. The field 'viewId' has the following
+ * description: An id unique to the RNA viewer panel
+ *
+ *
+ * @param viewId
+ * the value of field 'viewId'.
+ */
+ public void setViewId(final java.lang.String viewId)
+ {
+ this._viewId = viewId;
+ }
+
+ /**
+ * Sets the value of field 'width'.
+ *
+ * @param width
+ * the value of field 'width'.
+ */
+ public void setWidth(final int width)
+ {
+ this._width = width;
+ this._has_width = true;
+ }
+
+ /**
+ * Sets the value of field 'xpos'.
+ *
+ * @param xpos
+ * the value of field 'xpos'.
+ */
+ public void setXpos(final int xpos)
+ {
+ this._xpos = xpos;
+ this._has_xpos = true;
+ }
+
+ /**
+ * Sets the value of field 'ypos'.
+ *
+ * @param ypos
+ * the value of field 'ypos'.
+ */
+ public void setYpos(final int ypos)
+ {
+ this._ypos = ypos;
+ this._has_ypos = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.RnaViewer
+ */
+ public static jalview.schemabinding.version2.RnaViewer unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.RnaViewer) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.RnaViewer.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
+
+}
diff --git a/src/jalview/schemabinding/version2/SecondaryStructure.java b/src/jalview/schemabinding/version2/SecondaryStructure.java
new file mode 100644
index 0000000..eb88fc4
--- /dev/null
+++ b/src/jalview/schemabinding/version2/SecondaryStructure.java
@@ -0,0 +1,290 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class SecondaryStructure.
+ *
+ * @version $Revision$ $Date$
+ */
+public class SecondaryStructure implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _title.
+ */
+ private java.lang.String _title;
+
+ /**
+ * id attribute of Annotation in vamsasModel for the secondary structure
+ * annotation shown in the viewer
+ *
+ */
+ private java.lang.String _annotationId;
+
+ /**
+ * if true the RNA structure is shown with gaps, if false without
+ *
+ */
+ private boolean _gapped;
+
+ /**
+ * keeps track of state for field: _gapped
+ */
+ private boolean _has_gapped;
+
+ /**
+ * name of the project jar entry that holds the VARNA viewer state for the
+ * structure
+ *
+ */
+ private java.lang.String _viewerState;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SecondaryStructure()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteGapped()
+ {
+ this._has_gapped = false;
+ }
+
+ /**
+ * Returns the value of field 'annotationId'. The field 'annotationId' has the
+ * following description: id attribute of Annotation in vamsasModel for the
+ * secondary structure annotation shown in the viewer
+ *
+ *
+ * @return the value of field 'AnnotationId'.
+ */
+ public java.lang.String getAnnotationId()
+ {
+ return this._annotationId;
+ }
+
+ /**
+ * Returns the value of field 'gapped'. The field 'gapped' has the following
+ * description: if true the RNA structure is shown with gaps, if false without
+ *
+ *
+ * @return the value of field 'Gapped'.
+ */
+ public boolean getGapped()
+ {
+ return this._gapped;
+ }
+
+ /**
+ * Returns the value of field 'title'.
+ *
+ * @return the value of field 'Title'.
+ */
+ public java.lang.String getTitle()
+ {
+ return this._title;
+ }
+
+ /**
+ * Returns the value of field 'viewerState'. The field 'viewerState' has the
+ * following description: name of the project jar entry that holds the VARNA
+ * viewer state for the structure
+ *
+ *
+ * @return the value of field 'ViewerState'.
+ */
+ public java.lang.String getViewerState()
+ {
+ return this._viewerState;
+ }
+
+ /**
+ * Method hasGapped.
+ *
+ * @return true if at least one Gapped has been added
+ */
+ public boolean hasGapped()
+ {
+ return this._has_gapped;
+ }
+
+ /**
+ * Returns the value of field 'gapped'. The field 'gapped' has the following
+ * description: if true the RNA structure is shown with gaps, if false without
+ *
+ *
+ * @return the value of field 'Gapped'.
+ */
+ public boolean isGapped()
+ {
+ return this._gapped;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'annotationId'. The field 'annotationId' has the
+ * following description: id attribute of Annotation in vamsasModel for the
+ * secondary structure annotation shown in the viewer
+ *
+ *
+ * @param annotationId
+ * the value of field 'annotationId'.
+ */
+ public void setAnnotationId(final java.lang.String annotationId)
+ {
+ this._annotationId = annotationId;
+ }
+
+ /**
+ * Sets the value of field 'gapped'. The field 'gapped' has the following
+ * description: if true the RNA structure is shown with gaps, if false without
+ *
+ *
+ * @param gapped
+ * the value of field 'gapped'.
+ */
+ public void setGapped(final boolean gapped)
+ {
+ this._gapped = gapped;
+ this._has_gapped = true;
+ }
+
+ /**
+ * Sets the value of field 'title'.
+ *
+ * @param title
+ * the value of field 'title'.
+ */
+ public void setTitle(final java.lang.String title)
+ {
+ this._title = title;
+ }
+
+ /**
+ * Sets the value of field 'viewerState'. The field 'viewerState' has the
+ * following description: name of the project jar entry that holds the VARNA
+ * viewer state for the structure
+ *
+ *
+ * @param viewerState
+ * the value of field 'viewerState'.
+ */
+ public void setViewerState(final java.lang.String viewerState)
+ {
+ this._viewerState = viewerState;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.SecondaryStructure
+ */
+ public static jalview.schemabinding.version2.SecondaryStructure unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.SecondaryStructure) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.SecondaryStructure.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
+
+}
diff --git a/src/jalview/schemabinding/version2/Sequence.java b/src/jalview/schemabinding/version2/Sequence.java
index b8c1d19..531ca66 100644
--- a/src/jalview/schemabinding/version2/Sequence.java
+++ b/src/jalview/schemabinding/version2/Sequence.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,293 +19,310 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Sequence extends jalview.schemabinding.version2.SequenceType
-implements java.io.Serializable
+public class Sequence extends jalview.schemabinding.version2.SequenceType
+ implements java.io.Serializable
{
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * dataset sequence id for this sequence. Will be created as
- * union of sequences.
- *
- */
- private java.lang.String _dsseqid;
-
- /**
- * Field _DBRefList.
- */
- private java.util.Vector _DBRefList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Sequence() {
- super();
- this._DBRefList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vDBRef
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addDBRef(
- final jalview.schemabinding.version2.DBRef vDBRef)
- throws java.lang.IndexOutOfBoundsException {
- this._DBRefList.addElement(vDBRef);
- }
-
- /**
- *
- *
- * @param index
- * @param vDBRef
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addDBRef(
- final int index,
- final jalview.schemabinding.version2.DBRef vDBRef)
- throws java.lang.IndexOutOfBoundsException {
- this._DBRefList.add(index, vDBRef);
- }
-
- /**
- * Method enumerateDBRef.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.DBRef elements
- */
- public java.util.Enumeration enumerateDBRef(
- ) {
- return this._DBRefList.elements();
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * dataset sequence id for this sequence. Will be created as union of
+ * sequences.
+ *
+ */
+ private java.lang.String _dsseqid;
+
+ /**
+ * Field _DBRefList.
+ */
+ private java.util.Vector _DBRefList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Sequence()
+ {
+ super();
+ this._DBRefList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vDBRef
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addDBRef(final jalview.schemabinding.version2.DBRef vDBRef)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._DBRefList.addElement(vDBRef);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vDBRef
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addDBRef(final int index,
+ final jalview.schemabinding.version2.DBRef vDBRef)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._DBRefList.add(index, vDBRef);
+ }
+
+ /**
+ * Method enumerateDBRef.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.DBRef
+ * elements
+ */
+ public java.util.Enumeration enumerateDBRef()
+ {
+ return this._DBRefList.elements();
+ }
+
+ /**
+ * Method getDBRef.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.DBRef at the given
+ * index
+ */
+ public jalview.schemabinding.version2.DBRef getDBRef(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._DBRefList.size())
+ {
+ throw new IndexOutOfBoundsException("getDBRef: Index value '" + index
+ + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
}
- /**
- * Method getDBRef.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.DBRef at the given index
- */
- public jalview.schemabinding.version2.DBRef getDBRef(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._DBRefList.size()) {
- throw new IndexOutOfBoundsException("getDBRef: Index value '" + index + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.DBRef) _DBRefList.get(index);
+ return (jalview.schemabinding.version2.DBRef) _DBRefList.get(index);
+ }
+
+ /**
+ * Method getDBRef.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.DBRef[] getDBRef()
+ {
+ jalview.schemabinding.version2.DBRef[] array = new jalview.schemabinding.version2.DBRef[0];
+ return (jalview.schemabinding.version2.DBRef[]) this._DBRefList
+ .toArray(array);
+ }
+
+ /**
+ * Method getDBRefCount.
+ *
+ * @return the size of this collection
+ */
+ public int getDBRefCount()
+ {
+ return this._DBRefList.size();
+ }
+
+ /**
+ * Returns the value of field 'dsseqid'. The field 'dsseqid' has the following
+ * description: dataset sequence id for this sequence. Will be created as
+ * union of sequences.
+ *
+ *
+ * @return the value of field 'Dsseqid'.
+ */
+ public java.lang.String getDsseqid()
+ {
+ return this._dsseqid;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- * Method getDBRef.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public jalview.schemabinding.version2.DBRef[] getDBRef(
- ) {
- jalview.schemabinding.version2.DBRef[] array = new jalview.schemabinding.version2.DBRef[0];
- return (jalview.schemabinding.version2.DBRef[]) this._DBRefList.toArray(array);
+ public void removeAllDBRef()
+ {
+ this._DBRefList.clear();
+ }
+
+ /**
+ * Method removeDBRef.
+ *
+ * @param vDBRef
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeDBRef(
+ final jalview.schemabinding.version2.DBRef vDBRef)
+ {
+ boolean removed = _DBRefList.remove(vDBRef);
+ return removed;
+ }
+
+ /**
+ * Method removeDBRefAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.DBRef removeDBRefAt(final int index)
+ {
+ java.lang.Object obj = this._DBRefList.remove(index);
+ return (jalview.schemabinding.version2.DBRef) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vDBRef
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setDBRef(final int index,
+ final jalview.schemabinding.version2.DBRef vDBRef)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._DBRefList.size())
+ {
+ throw new IndexOutOfBoundsException("setDBRef: Index value '" + index
+ + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
}
- /**
- * Method getDBRefCount.
- *
- * @return the size of this collection
- */
- public int getDBRefCount(
- ) {
- return this._DBRefList.size();
- }
-
- /**
- * Returns the value of field 'dsseqid'. The field 'dsseqid'
- * has the following description: dataset sequence id for this
- * sequence. Will be created as union of sequences.
- *
- *
- * @return the value of field 'Dsseqid'.
- */
- public java.lang.String getDsseqid(
- ) {
- return this._dsseqid;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllDBRef(
- ) {
- this._DBRefList.clear();
- }
-
- /**
- * Method removeDBRef.
- *
- * @param vDBRef
- * @return true if the object was removed from the collection.
- */
- public boolean removeDBRef(
- final jalview.schemabinding.version2.DBRef vDBRef) {
- boolean removed = _DBRefList.remove(vDBRef);
- return removed;
- }
-
- /**
- * Method removeDBRefAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.DBRef removeDBRefAt(
- final int index) {
- java.lang.Object obj = this._DBRefList.remove(index);
- return (jalview.schemabinding.version2.DBRef) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vDBRef
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setDBRef(
- final int index,
- final jalview.schemabinding.version2.DBRef vDBRef)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._DBRefList.size()) {
- throw new IndexOutOfBoundsException("setDBRef: Index value '" + index + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
- }
-
- this._DBRefList.set(index, vDBRef);
- }
-
- /**
- *
- *
- * @param vDBRefArray
- */
- public void setDBRef(
- final jalview.schemabinding.version2.DBRef[] vDBRefArray) {
- //-- copy array
- _DBRefList.clear();
-
- for (int i = 0; i < vDBRefArray.length; i++) {
- this._DBRefList.add(vDBRefArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'dsseqid'. The field 'dsseqid' has
- * the following description: dataset sequence id for this
- * sequence. Will be created as union of sequences.
- *
- *
- * @param dsseqid the value of field 'dsseqid'.
- */
- public void setDsseqid(
- final java.lang.String dsseqid) {
- this._dsseqid = dsseqid;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.SequenceType
- */
- public static jalview.schemabinding.version2.SequenceType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.SequenceType) Unmarshaller.unmarshal(jalview.schemabinding.version2.Sequence.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._DBRefList.set(index, vDBRef);
+ }
+
+ /**
+ *
+ *
+ * @param vDBRefArray
+ */
+ public void setDBRef(
+ final jalview.schemabinding.version2.DBRef[] vDBRefArray)
+ {
+ // -- copy array
+ _DBRefList.clear();
+
+ for (int i = 0; i < vDBRefArray.length; i++)
+ {
+ this._DBRefList.add(vDBRefArray[i]);
}
+ }
+
+ /**
+ * Sets the value of field 'dsseqid'. The field 'dsseqid' has the following
+ * description: dataset sequence id for this sequence. Will be created as
+ * union of sequences.
+ *
+ *
+ * @param dsseqid
+ * the value of field 'dsseqid'.
+ */
+ public void setDsseqid(final java.lang.String dsseqid)
+ {
+ this._dsseqid = dsseqid;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.SequenceType
+ */
+ public static jalview.schemabinding.version2.SequenceType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.SequenceType) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.Sequence.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/SequenceSet.java b/src/jalview/schemabinding/version2/SequenceSet.java
index c9e124e..8be8022 100644
--- a/src/jalview/schemabinding/version2/SequenceSet.java
+++ b/src/jalview/schemabinding/version2/SequenceSet.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,789 +19,854 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class SequenceSet implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _gapChar.
- */
- private java.lang.String _gapChar;
-
- /**
- * reference to set where jalview will gather the dataset
- * sequences for all sequences in the set.
- *
- */
- private java.lang.String _datasetId;
-
- /**
- * Field _sequenceList.
- */
- private java.util.Vector _sequenceList;
-
- /**
- * Field _annotationList.
- */
- private java.util.Vector _annotationList;
-
- /**
- * Field _sequenceSetPropertiesList.
- */
- private java.util.Vector _sequenceSetPropertiesList;
-
- /**
- * Field _alcodonFrameList.
- */
- private java.util.Vector _alcodonFrameList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SequenceSet() {
- super();
- this._sequenceList = new java.util.Vector();
- this._annotationList = new java.util.Vector();
- this._sequenceSetPropertiesList = new java.util.Vector();
- this._alcodonFrameList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vAlcodonFrame
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlcodonFrame(
- final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
- throws java.lang.IndexOutOfBoundsException {
- this._alcodonFrameList.addElement(vAlcodonFrame);
- }
-
- /**
- *
- *
- * @param index
- * @param vAlcodonFrame
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlcodonFrame(
- final int index,
- final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
- throws java.lang.IndexOutOfBoundsException {
- this._alcodonFrameList.add(index, vAlcodonFrame);
- }
-
- /**
- *
- *
- * @param vAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAnnotation(
- final jalview.schemabinding.version2.Annotation vAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- this._annotationList.addElement(vAnnotation);
- }
-
- /**
- *
- *
- * @param index
- * @param vAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAnnotation(
- final int index,
- final jalview.schemabinding.version2.Annotation vAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- this._annotationList.add(index, vAnnotation);
- }
-
- /**
- *
- *
- * @param vSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequence(
- final jalview.schemabinding.version2.Sequence vSequence)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceList.addElement(vSequence);
- }
-
- /**
- *
- *
- * @param index
- * @param vSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequence(
- final int index,
- final jalview.schemabinding.version2.Sequence vSequence)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceList.add(index, vSequence);
- }
-
- /**
- *
- *
- * @param vSequenceSetProperties
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequenceSetProperties(
- final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceSetPropertiesList.addElement(vSequenceSetProperties);
- }
-
- /**
- *
- *
- * @param index
- * @param vSequenceSetProperties
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequenceSetProperties(
- final int index,
- final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceSetPropertiesList.add(index, vSequenceSetProperties);
- }
-
- /**
- * Method enumerateAlcodonFrame.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.AlcodonFrame elements
- */
- public java.util.Enumeration enumerateAlcodonFrame(
- ) {
- return this._alcodonFrameList.elements();
- }
-
- /**
- * Method enumerateAnnotation.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Annotation elements
- */
- public java.util.Enumeration enumerateAnnotation(
- ) {
- return this._annotationList.elements();
- }
-
- /**
- * Method enumerateSequence.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Sequence elements
- */
- public java.util.Enumeration enumerateSequence(
- ) {
- return this._sequenceList.elements();
- }
-
- /**
- * Method enumerateSequenceSetProperties.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.SequenceSetProperties elements
- */
- public java.util.Enumeration enumerateSequenceSetProperties(
- ) {
- return this._sequenceSetPropertiesList.elements();
- }
-
- /**
- * Method getAlcodonFrame.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.AlcodonFrame at the given inde
- */
- public jalview.schemabinding.version2.AlcodonFrame getAlcodonFrame(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alcodonFrameList.size()) {
- throw new IndexOutOfBoundsException("getAlcodonFrame: Index value '" + index + "' not in range [0.." + (this._alcodonFrameList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.AlcodonFrame) _alcodonFrameList.get(index);
- }
-
- /**
- * Method getAlcodonFrame.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.AlcodonFrame[] getAlcodonFrame(
- ) {
- jalview.schemabinding.version2.AlcodonFrame[] array = new jalview.schemabinding.version2.AlcodonFrame[0];
- return (jalview.schemabinding.version2.AlcodonFrame[]) this._alcodonFrameList.toArray(array);
- }
-
- /**
- * Method getAlcodonFrameCount.
- *
- * @return the size of this collection
- */
- public int getAlcodonFrameCount(
- ) {
- return this._alcodonFrameList.size();
- }
-
- /**
- * Method getAnnotation.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Annotation at the given index
- */
- public jalview.schemabinding.version2.Annotation getAnnotation(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._annotationList.size()) {
- throw new IndexOutOfBoundsException("getAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Annotation) _annotationList.get(index);
- }
-
- /**
- * Method getAnnotation.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Annotation[] getAnnotation(
- ) {
- jalview.schemabinding.version2.Annotation[] array = new jalview.schemabinding.version2.Annotation[0];
- return (jalview.schemabinding.version2.Annotation[]) this._annotationList.toArray(array);
- }
-
- /**
- * Method getAnnotationCount.
- *
- * @return the size of this collection
- */
- public int getAnnotationCount(
- ) {
- return this._annotationList.size();
- }
-
- /**
- * Returns the value of field 'datasetId'. The field
- * 'datasetId' has the following description: reference to set
- * where jalview will gather the dataset sequences for all
- * sequences in the set.
- *
- *
- * @return the value of field 'DatasetId'.
- */
- public java.lang.String getDatasetId(
- ) {
- return this._datasetId;
- }
-
- /**
- * Returns the value of field 'gapChar'.
- *
- * @return the value of field 'GapChar'.
- */
- public java.lang.String getGapChar(
- ) {
- return this._gapChar;
- }
-
- /**
- * Method getSequence.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Sequence at the given index
- */
- public jalview.schemabinding.version2.Sequence getSequence(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceList.size()) {
- throw new IndexOutOfBoundsException("getSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Sequence) _sequenceList.get(index);
- }
-
- /**
- * Method getSequence.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Sequence[] getSequence(
- ) {
- jalview.schemabinding.version2.Sequence[] array = new jalview.schemabinding.version2.Sequence[0];
- return (jalview.schemabinding.version2.Sequence[]) this._sequenceList.toArray(array);
- }
-
- /**
- * Method getSequenceCount.
- *
- * @return the size of this collection
- */
- public int getSequenceCount(
- ) {
- return this._sequenceList.size();
- }
-
- /**
- * Method getSequenceSetProperties.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.SequenceSetProperties at the
- * given index
- */
- public jalview.schemabinding.version2.SequenceSetProperties getSequenceSetProperties(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceSetPropertiesList.size()) {
- throw new IndexOutOfBoundsException("getSequenceSetProperties: Index value '" + index + "' not in range [0.." + (this._sequenceSetPropertiesList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.SequenceSetProperties) _sequenceSetPropertiesList.get(index);
- }
-
- /**
- * Method getSequenceSetProperties.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.SequenceSetProperties[] getSequenceSetProperties(
- ) {
- jalview.schemabinding.version2.SequenceSetProperties[] array = new jalview.schemabinding.version2.SequenceSetProperties[0];
- return (jalview.schemabinding.version2.SequenceSetProperties[]) this._sequenceSetPropertiesList.toArray(array);
- }
-
- /**
- * Method getSequenceSetPropertiesCount.
- *
- * @return the size of this collection
- */
- public int getSequenceSetPropertiesCount(
- ) {
- return this._sequenceSetPropertiesList.size();
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Method removeAlcodonFrame.
- *
- * @param vAlcodonFrame
- * @return true if the object was removed from the collection.
- */
- public boolean removeAlcodonFrame(
- final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame) {
- boolean removed = _alcodonFrameList.remove(vAlcodonFrame);
- return removed;
- }
-
- /**
- * Method removeAlcodonFrameAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.AlcodonFrame removeAlcodonFrameAt(
- final int index) {
- java.lang.Object obj = this._alcodonFrameList.remove(index);
- return (jalview.schemabinding.version2.AlcodonFrame) obj;
- }
-
- /**
- */
- public void removeAllAlcodonFrame(
- ) {
- this._alcodonFrameList.clear();
- }
-
- /**
- */
- public void removeAllAnnotation(
- ) {
- this._annotationList.clear();
- }
-
- /**
- */
- public void removeAllSequence(
- ) {
- this._sequenceList.clear();
- }
-
- /**
- */
- public void removeAllSequenceSetProperties(
- ) {
- this._sequenceSetPropertiesList.clear();
- }
-
- /**
- * Method removeAnnotation.
- *
- * @param vAnnotation
- * @return true if the object was removed from the collection.
- */
- public boolean removeAnnotation(
- final jalview.schemabinding.version2.Annotation vAnnotation) {
- boolean removed = _annotationList.remove(vAnnotation);
- return removed;
- }
-
- /**
- * Method removeAnnotationAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Annotation removeAnnotationAt(
- final int index) {
- java.lang.Object obj = this._annotationList.remove(index);
- return (jalview.schemabinding.version2.Annotation) obj;
- }
-
- /**
- * Method removeSequence.
- *
- * @param vSequence
- * @return true if the object was removed from the collection.
- */
- public boolean removeSequence(
- final jalview.schemabinding.version2.Sequence vSequence) {
- boolean removed = _sequenceList.remove(vSequence);
- return removed;
- }
-
- /**
- * Method removeSequenceAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Sequence removeSequenceAt(
- final int index) {
- java.lang.Object obj = this._sequenceList.remove(index);
- return (jalview.schemabinding.version2.Sequence) obj;
- }
-
- /**
- * Method removeSequenceSetProperties.
- *
- * @param vSequenceSetProperties
- * @return true if the object was removed from the collection.
- */
- public boolean removeSequenceSetProperties(
- final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties) {
- boolean removed = _sequenceSetPropertiesList.remove(vSequenceSetProperties);
- return removed;
- }
-
- /**
- * Method removeSequenceSetPropertiesAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.SequenceSetProperties removeSequenceSetPropertiesAt(
- final int index) {
- java.lang.Object obj = this._sequenceSetPropertiesList.remove(index);
- return (jalview.schemabinding.version2.SequenceSetProperties) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vAlcodonFrame
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAlcodonFrame(
- final int index,
- final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alcodonFrameList.size()) {
- throw new IndexOutOfBoundsException("setAlcodonFrame: Index value '" + index + "' not in range [0.." + (this._alcodonFrameList.size() - 1) + "]");
- }
-
- this._alcodonFrameList.set(index, vAlcodonFrame);
- }
-
- /**
- *
- *
- * @param vAlcodonFrameArray
- */
- public void setAlcodonFrame(
- final jalview.schemabinding.version2.AlcodonFrame[] vAlcodonFrameArray) {
- //-- copy array
- _alcodonFrameList.clear();
-
- for (int i = 0; i < vAlcodonFrameArray.length; i++) {
- this._alcodonFrameList.add(vAlcodonFrameArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAnnotation(
- final int index,
- final jalview.schemabinding.version2.Annotation vAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._annotationList.size()) {
- throw new IndexOutOfBoundsException("setAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");
- }
-
- this._annotationList.set(index, vAnnotation);
- }
-
- /**
- *
- *
- * @param vAnnotationArray
- */
- public void setAnnotation(
- final jalview.schemabinding.version2.Annotation[] vAnnotationArray) {
- //-- copy array
- _annotationList.clear();
-
- for (int i = 0; i < vAnnotationArray.length; i++) {
- this._annotationList.add(vAnnotationArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'datasetId'. The field 'datasetId'
- * has the following description: reference to set where
- * jalview will gather the dataset sequences for all sequences
- * in the set.
- *
- *
- * @param datasetId the value of field 'datasetId'.
- */
- public void setDatasetId(
- final java.lang.String datasetId) {
- this._datasetId = datasetId;
- }
-
- /**
- * Sets the value of field 'gapChar'.
- *
- * @param gapChar the value of field 'gapChar'.
- */
- public void setGapChar(
- final java.lang.String gapChar) {
- this._gapChar = gapChar;
- }
-
- /**
- *
- *
- * @param index
- * @param vSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSequence(
- final int index,
- final jalview.schemabinding.version2.Sequence vSequence)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceList.size()) {
- throw new IndexOutOfBoundsException("setSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
- }
-
- this._sequenceList.set(index, vSequence);
- }
-
- /**
- *
- *
- * @param vSequenceArray
- */
- public void setSequence(
- final jalview.schemabinding.version2.Sequence[] vSequenceArray) {
- //-- copy array
- _sequenceList.clear();
-
- for (int i = 0; i < vSequenceArray.length; i++) {
- this._sequenceList.add(vSequenceArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vSequenceSetProperties
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSequenceSetProperties(
- final int index,
- final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceSetPropertiesList.size()) {
- throw new IndexOutOfBoundsException("setSequenceSetProperties: Index value '" + index + "' not in range [0.." + (this._sequenceSetPropertiesList.size() - 1) + "]");
- }
-
- this._sequenceSetPropertiesList.set(index, vSequenceSetProperties);
- }
-
- /**
- *
- *
- * @param vSequenceSetPropertiesArray
- */
- public void setSequenceSetProperties(
- final jalview.schemabinding.version2.SequenceSetProperties[] vSequenceSetPropertiesArray) {
- //-- copy array
- _sequenceSetPropertiesList.clear();
-
- for (int i = 0; i < vSequenceSetPropertiesArray.length; i++) {
- this._sequenceSetPropertiesList.add(vSequenceSetPropertiesArray[i]);
- }
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.SequenceSet
- */
- public static jalview.schemabinding.version2.SequenceSet unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.SequenceSet) Unmarshaller.unmarshal(jalview.schemabinding.version2.SequenceSet.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class SequenceSet implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _gapChar.
+ */
+ private java.lang.String _gapChar;
+
+ /**
+ * reference to set where jalview will gather the dataset sequences for all
+ * sequences in the set.
+ *
+ */
+ private java.lang.String _datasetId;
+
+ /**
+ * Field _sequenceList.
+ */
+ private java.util.Vector _sequenceList;
+
+ /**
+ * Field _annotationList.
+ */
+ private java.util.Vector _annotationList;
+
+ /**
+ * Field _sequenceSetPropertiesList.
+ */
+ private java.util.Vector _sequenceSetPropertiesList;
+
+ /**
+ * Field _alcodonFrameList.
+ */
+ private java.util.Vector _alcodonFrameList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SequenceSet()
+ {
+ super();
+ this._sequenceList = new java.util.Vector();
+ this._annotationList = new java.util.Vector();
+ this._sequenceSetPropertiesList = new java.util.Vector();
+ this._alcodonFrameList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vAlcodonFrame
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlcodonFrame(
+ final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._alcodonFrameList.addElement(vAlcodonFrame);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlcodonFrame
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlcodonFrame(final int index,
+ final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._alcodonFrameList.add(index, vAlcodonFrame);
+ }
+
+ /**
+ *
+ *
+ * @param vAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAnnotation(
+ final jalview.schemabinding.version2.Annotation vAnnotation)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._annotationList.addElement(vAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAnnotation(final int index,
+ final jalview.schemabinding.version2.Annotation vAnnotation)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._annotationList.add(index, vAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param vSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequence(
+ final jalview.schemabinding.version2.Sequence vSequence)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceList.addElement(vSequence);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequence(final int index,
+ final jalview.schemabinding.version2.Sequence vSequence)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceList.add(index, vSequence);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceSetProperties
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequenceSetProperties(
+ final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceSetPropertiesList.addElement(vSequenceSetProperties);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequenceSetProperties
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequenceSetProperties(
+ final int index,
+ final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceSetPropertiesList.add(index, vSequenceSetProperties);
+ }
+
+ /**
+ * Method enumerateAlcodonFrame.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.AlcodonFrame
+ * elements
+ */
+ public java.util.Enumeration enumerateAlcodonFrame()
+ {
+ return this._alcodonFrameList.elements();
+ }
+
+ /**
+ * Method enumerateAnnotation.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Annotation
+ * elements
+ */
+ public java.util.Enumeration enumerateAnnotation()
+ {
+ return this._annotationList.elements();
+ }
+
+ /**
+ * Method enumerateSequence.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Sequence
+ * elements
+ */
+ public java.util.Enumeration enumerateSequence()
+ {
+ return this._sequenceList.elements();
+ }
+
+ /**
+ * Method enumerateSequenceSetProperties.
+ *
+ * @return an Enumeration over all
+ * jalview.schemabinding.version2.SequenceSetProperties elements
+ */
+ public java.util.Enumeration enumerateSequenceSetProperties()
+ {
+ return this._sequenceSetPropertiesList.elements();
+ }
+
+ /**
+ * Method getAlcodonFrame.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.AlcodonFrame at the
+ * given inde
+ */
+ public jalview.schemabinding.version2.AlcodonFrame getAlcodonFrame(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._alcodonFrameList.size())
+ {
+ throw new IndexOutOfBoundsException("getAlcodonFrame: Index value '"
+ + index + "' not in range [0.."
+ + (this._alcodonFrameList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.AlcodonFrame) _alcodonFrameList
+ .get(index);
+ }
+
+ /**
+ * Method getAlcodonFrame.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.AlcodonFrame[] getAlcodonFrame()
+ {
+ jalview.schemabinding.version2.AlcodonFrame[] array = new jalview.schemabinding.version2.AlcodonFrame[0];
+ return (jalview.schemabinding.version2.AlcodonFrame[]) this._alcodonFrameList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAlcodonFrameCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAlcodonFrameCount()
+ {
+ return this._alcodonFrameList.size();
+ }
+
+ /**
+ * Method getAnnotation.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Annotation at the
+ * given index
+ */
+ public jalview.schemabinding.version2.Annotation getAnnotation(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._annotationList.size())
+ {
+ throw new IndexOutOfBoundsException("getAnnotation: Index value '"
+ + index + "' not in range [0.."
+ + (this._annotationList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.Annotation) _annotationList
+ .get(index);
+ }
+
+ /**
+ * Method getAnnotation.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Annotation[] getAnnotation()
+ {
+ jalview.schemabinding.version2.Annotation[] array = new jalview.schemabinding.version2.Annotation[0];
+ return (jalview.schemabinding.version2.Annotation[]) this._annotationList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAnnotationCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAnnotationCount()
+ {
+ return this._annotationList.size();
+ }
+
+ /**
+ * Returns the value of field 'datasetId'. The field 'datasetId' has the
+ * following description: reference to set where jalview will gather the
+ * dataset sequences for all sequences in the set.
+ *
+ *
+ * @return the value of field 'DatasetId'.
+ */
+ public java.lang.String getDatasetId()
+ {
+ return this._datasetId;
+ }
+
+ /**
+ * Returns the value of field 'gapChar'.
+ *
+ * @return the value of field 'GapChar'.
+ */
+ public java.lang.String getGapChar()
+ {
+ return this._gapChar;
+ }
+
+ /**
+ * Method getSequence.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Sequence at the
+ * given index
+ */
+ public jalview.schemabinding.version2.Sequence getSequence(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceList.size())
+ {
+ throw new IndexOutOfBoundsException("getSequence: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.Sequence) _sequenceList
+ .get(index);
+ }
+
+ /**
+ * Method getSequence.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Sequence[] getSequence()
+ {
+ jalview.schemabinding.version2.Sequence[] array = new jalview.schemabinding.version2.Sequence[0];
+ return (jalview.schemabinding.version2.Sequence[]) this._sequenceList
+ .toArray(array);
+ }
+
+ /**
+ * Method getSequenceCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSequenceCount()
+ {
+ return this._sequenceList.size();
+ }
+
+ /**
+ * Method getSequenceSetProperties.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the
+ * jalview.schemabinding.version2.SequenceSetProperties at the given
+ * index
+ */
+ public jalview.schemabinding.version2.SequenceSetProperties getSequenceSetProperties(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceSetPropertiesList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "getSequenceSetProperties: Index value '" + index
+ + "' not in range [0.."
+ + (this._sequenceSetPropertiesList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.SequenceSetProperties) _sequenceSetPropertiesList
+ .get(index);
+ }
+
+ /**
+ * Method getSequenceSetProperties.Returns the contents of the collection in
+ * an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.SequenceSetProperties[] getSequenceSetProperties()
+ {
+ jalview.schemabinding.version2.SequenceSetProperties[] array = new jalview.schemabinding.version2.SequenceSetProperties[0];
+ return (jalview.schemabinding.version2.SequenceSetProperties[]) this._sequenceSetPropertiesList
+ .toArray(array);
+ }
+
+ /**
+ * Method getSequenceSetPropertiesCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSequenceSetPropertiesCount()
+ {
+ return this._sequenceSetPropertiesList.size();
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Method removeAlcodonFrame.
+ *
+ * @param vAlcodonFrame
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAlcodonFrame(
+ final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
+ {
+ boolean removed = _alcodonFrameList.remove(vAlcodonFrame);
+ return removed;
+ }
+
+ /**
+ * Method removeAlcodonFrameAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.AlcodonFrame removeAlcodonFrameAt(
+ final int index)
+ {
+ java.lang.Object obj = this._alcodonFrameList.remove(index);
+ return (jalview.schemabinding.version2.AlcodonFrame) obj;
+ }
+
+ /**
+ */
+ public void removeAllAlcodonFrame()
+ {
+ this._alcodonFrameList.clear();
+ }
+
+ /**
+ */
+ public void removeAllAnnotation()
+ {
+ this._annotationList.clear();
+ }
+
+ /**
+ */
+ public void removeAllSequence()
+ {
+ this._sequenceList.clear();
+ }
+
+ /**
+ */
+ public void removeAllSequenceSetProperties()
+ {
+ this._sequenceSetPropertiesList.clear();
+ }
+
+ /**
+ * Method removeAnnotation.
+ *
+ * @param vAnnotation
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAnnotation(
+ final jalview.schemabinding.version2.Annotation vAnnotation)
+ {
+ boolean removed = _annotationList.remove(vAnnotation);
+ return removed;
+ }
+
+ /**
+ * Method removeAnnotationAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Annotation removeAnnotationAt(
+ final int index)
+ {
+ java.lang.Object obj = this._annotationList.remove(index);
+ return (jalview.schemabinding.version2.Annotation) obj;
+ }
+
+ /**
+ * Method removeSequence.
+ *
+ * @param vSequence
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSequence(
+ final jalview.schemabinding.version2.Sequence vSequence)
+ {
+ boolean removed = _sequenceList.remove(vSequence);
+ return removed;
+ }
+
+ /**
+ * Method removeSequenceAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Sequence removeSequenceAt(
+ final int index)
+ {
+ java.lang.Object obj = this._sequenceList.remove(index);
+ return (jalview.schemabinding.version2.Sequence) obj;
+ }
+
+ /**
+ * Method removeSequenceSetProperties.
+ *
+ * @param vSequenceSetProperties
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSequenceSetProperties(
+ final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
+ {
+ boolean removed = _sequenceSetPropertiesList
+ .remove(vSequenceSetProperties);
+ return removed;
+ }
+
+ /**
+ * Method removeSequenceSetPropertiesAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.SequenceSetProperties removeSequenceSetPropertiesAt(
+ final int index)
+ {
+ java.lang.Object obj = this._sequenceSetPropertiesList.remove(index);
+ return (jalview.schemabinding.version2.SequenceSetProperties) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlcodonFrame
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAlcodonFrame(final int index,
+ final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._alcodonFrameList.size())
+ {
+ throw new IndexOutOfBoundsException("setAlcodonFrame: Index value '"
+ + index + "' not in range [0.."
+ + (this._alcodonFrameList.size() - 1) + "]");
+ }
+
+ this._alcodonFrameList.set(index, vAlcodonFrame);
+ }
+
+ /**
+ *
+ *
+ * @param vAlcodonFrameArray
+ */
+ public void setAlcodonFrame(
+ final jalview.schemabinding.version2.AlcodonFrame[] vAlcodonFrameArray)
+ {
+ // -- copy array
+ _alcodonFrameList.clear();
+
+ for (int i = 0; i < vAlcodonFrameArray.length; i++)
+ {
+ this._alcodonFrameList.add(vAlcodonFrameArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAnnotation(final int index,
+ final jalview.schemabinding.version2.Annotation vAnnotation)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._annotationList.size())
+ {
+ throw new IndexOutOfBoundsException("setAnnotation: Index value '"
+ + index + "' not in range [0.."
+ + (this._annotationList.size() - 1) + "]");
+ }
+
+ this._annotationList.set(index, vAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param vAnnotationArray
+ */
+ public void setAnnotation(
+ final jalview.schemabinding.version2.Annotation[] vAnnotationArray)
+ {
+ // -- copy array
+ _annotationList.clear();
+
+ for (int i = 0; i < vAnnotationArray.length; i++)
+ {
+ this._annotationList.add(vAnnotationArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'datasetId'. The field 'datasetId' has the
+ * following description: reference to set where jalview will gather the
+ * dataset sequences for all sequences in the set.
+ *
+ *
+ * @param datasetId
+ * the value of field 'datasetId'.
+ */
+ public void setDatasetId(final java.lang.String datasetId)
+ {
+ this._datasetId = datasetId;
+ }
+
+ /**
+ * Sets the value of field 'gapChar'.
+ *
+ * @param gapChar
+ * the value of field 'gapChar'.
+ */
+ public void setGapChar(final java.lang.String gapChar)
+ {
+ this._gapChar = gapChar;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSequence(final int index,
+ final jalview.schemabinding.version2.Sequence vSequence)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceList.size())
+ {
+ throw new IndexOutOfBoundsException("setSequence: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceList.size() - 1) + "]");
+ }
+
+ this._sequenceList.set(index, vSequence);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceArray
+ */
+ public void setSequence(
+ final jalview.schemabinding.version2.Sequence[] vSequenceArray)
+ {
+ // -- copy array
+ _sequenceList.clear();
+
+ for (int i = 0; i < vSequenceArray.length; i++)
+ {
+ this._sequenceList.add(vSequenceArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequenceSetProperties
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSequenceSetProperties(
+ final int index,
+ final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceSetPropertiesList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "setSequenceSetProperties: Index value '" + index
+ + "' not in range [0.."
+ + (this._sequenceSetPropertiesList.size() - 1) + "]");
+ }
+
+ this._sequenceSetPropertiesList.set(index, vSequenceSetProperties);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceSetPropertiesArray
+ */
+ public void setSequenceSetProperties(
+ final jalview.schemabinding.version2.SequenceSetProperties[] vSequenceSetPropertiesArray)
+ {
+ // -- copy array
+ _sequenceSetPropertiesList.clear();
+
+ for (int i = 0; i < vSequenceSetPropertiesArray.length; i++)
+ {
+ this._sequenceSetPropertiesList.add(vSequenceSetPropertiesArray[i]);
+ }
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.SequenceSet
+ */
+ public static jalview.schemabinding.version2.SequenceSet unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.SequenceSet) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.SequenceSet.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/SequenceSetProperties.java b/src/jalview/schemabinding/version2/SequenceSetProperties.java
index 4288229..3a7d172 100644
--- a/src/jalview/schemabinding/version2/SequenceSetProperties.java
+++ b/src/jalview/schemabinding/version2/SequenceSetProperties.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,152 +19,165 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class SequenceSetProperties implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _key.
- */
- private java.lang.String _key;
-
- /**
- * Field _value.
- */
- private java.lang.String _value;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SequenceSetProperties() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'key'.
- *
- * @return the value of field 'Key'.
- */
- public java.lang.String getKey(
- ) {
- return this._key;
- }
-
- /**
- * Returns the value of field 'value'.
- *
- * @return the value of field 'Value'.
- */
- public java.lang.String getValue(
- ) {
- return this._value;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'key'.
- *
- * @param key the value of field 'key'.
- */
- public void setKey(
- final java.lang.String key) {
- this._key = key;
- }
-
- /**
- * Sets the value of field 'value'.
- *
- * @param value the value of field 'value'.
- */
- public void setValue(
- final java.lang.String value) {
- this._value = value;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.SequenceSetProperties
- */
- public static jalview.schemabinding.version2.SequenceSetProperties unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.SequenceSetProperties) Unmarshaller.unmarshal(jalview.schemabinding.version2.SequenceSetProperties.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class SequenceSetProperties implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _key.
+ */
+ private java.lang.String _key;
+
+ /**
+ * Field _value.
+ */
+ private java.lang.String _value;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SequenceSetProperties()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'key'.
+ *
+ * @return the value of field 'Key'.
+ */
+ public java.lang.String getKey()
+ {
+ return this._key;
+ }
+
+ /**
+ * Returns the value of field 'value'.
+ *
+ * @return the value of field 'Value'.
+ */
+ public java.lang.String getValue()
+ {
+ return this._value;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'key'.
+ *
+ * @param key
+ * the value of field 'key'.
+ */
+ public void setKey(final java.lang.String key)
+ {
+ this._key = key;
+ }
+
+ /**
+ * Sets the value of field 'value'.
+ *
+ * @param value
+ * the value of field 'value'.
+ */
+ public void setValue(final java.lang.String value)
+ {
+ this._value = value;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled
+ * jalview.schemabinding.version2.SequenceSetProperties
+ */
+ public static jalview.schemabinding.version2.SequenceSetProperties unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.SequenceSetProperties) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.SequenceSetProperties.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/SequenceType.java b/src/jalview/schemabinding/version2/SequenceType.java
index df0f1da..f213ebb 100644
--- a/src/jalview/schemabinding/version2/SequenceType.java
+++ b/src/jalview/schemabinding/version2/SequenceType.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,202 +19,215 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class SequenceType implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _id.
- */
- private java.lang.String _id;
-
- /**
- * Field _description.
- */
- private java.lang.String _description;
-
- /**
- * Field _sequence.
- */
- private java.lang.String _sequence;
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SequenceType() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'description'.
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Returns the value of field 'sequence'.
- *
- * @return the value of field 'Sequence'.
- */
- public java.lang.String getSequence(
- ) {
- return this._sequence;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'description'.
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
- }
-
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Sets the value of field 'sequence'.
- *
- * @param sequence the value of field 'sequence'.
- */
- public void setSequence(
- final java.lang.String sequence) {
- this._sequence = sequence;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.SequenceType
- */
- public static jalview.schemabinding.version2.SequenceType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.SequenceType) Unmarshaller.unmarshal(jalview.schemabinding.version2.SequenceType.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class SequenceType implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _id.
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _description.
+ */
+ private java.lang.String _description;
+
+ /**
+ * Field _sequence.
+ */
+ private java.lang.String _sequence;
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SequenceType()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'description'.
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription()
+ {
+ return this._description;
+ }
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Returns the value of field 'sequence'.
+ *
+ * @return the value of field 'Sequence'.
+ */
+ public java.lang.String getSequence()
+ {
+ return this._sequence;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'description'.
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description)
+ {
+ this._description = description;
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Sets the value of field 'sequence'.
+ *
+ * @param sequence
+ * the value of field 'sequence'.
+ */
+ public void setSequence(final java.lang.String sequence)
+ {
+ this._sequence = sequence;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.SequenceType
+ */
+ public static jalview.schemabinding.version2.SequenceType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.SequenceType) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.SequenceType.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Setting.java b/src/jalview/schemabinding/version2/Setting.java
index 9b052e1..c458971 100644
--- a/src/jalview/schemabinding/version2/Setting.java
+++ b/src/jalview/schemabinding/version2/Setting.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,648 +19,671 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Setting implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _type.
- */
- private java.lang.String _type;
-
- /**
- * Field _colour.
- */
- private int _colour;
-
- /**
- * keeps track of state for field: _colour
- */
- private boolean _has_colour;
-
- /**
- * Field _display.
- */
- private boolean _display;
-
- /**
- * keeps track of state for field: _display
- */
- private boolean _has_display;
-
- /**
- * Field _order.
- */
- private float _order;
-
- /**
- * keeps track of state for field: _order
- */
- private boolean _has_order;
-
- /**
- * Optional minimum colour for graduated feature colour
- */
- private int _mincolour;
-
- /**
- * keeps track of state for field: _mincolour
- */
- private boolean _has_mincolour;
-
- /**
- * threshold value for graduated feature colour
- */
- private float _threshold;
-
- /**
- * keeps track of state for field: _threshold
- */
- private boolean _has_threshold;
-
- /**
- * threshold type for graduated feature colour
- */
- private int _threshstate;
-
- /**
- * keeps track of state for field: _threshstate
- */
- private boolean _has_threshstate;
-
- /**
- * Field _max.
- */
- private float _max;
-
- /**
- * keeps track of state for field: _max
- */
- private boolean _has_max;
-
- /**
- * Field _min.
- */
- private float _min;
-
- /**
- * keeps track of state for field: _min
- */
- private boolean _has_min;
-
- /**
- * Field _colourByLabel.
- */
- private boolean _colourByLabel;
-
- /**
- * keeps track of state for field: _colourByLabel
- */
- private boolean _has_colourByLabel;
-
- /**
- * Field _autoScale.
- */
- private boolean _autoScale;
-
- /**
- * keeps track of state for field: _autoScale
- */
- private boolean _has_autoScale;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Setting() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteAutoScale(
- ) {
- this._has_autoScale= false;
- }
-
- /**
- */
- public void deleteColour(
- ) {
- this._has_colour= false;
- }
-
- /**
- */
- public void deleteColourByLabel(
- ) {
- this._has_colourByLabel= false;
- }
-
- /**
- */
- public void deleteDisplay(
- ) {
- this._has_display= false;
- }
-
- /**
- */
- public void deleteMax(
- ) {
- this._has_max= false;
- }
-
- /**
- */
- public void deleteMin(
- ) {
- this._has_min= false;
- }
-
- /**
- */
- public void deleteMincolour(
- ) {
- this._has_mincolour= false;
- }
-
- /**
- */
- public void deleteOrder(
- ) {
- this._has_order= false;
- }
-
- /**
- */
- public void deleteThreshold(
- ) {
- this._has_threshold= false;
- }
-
- /**
- */
- public void deleteThreshstate(
- ) {
- this._has_threshstate= false;
- }
-
- /**
- * Returns the value of field 'autoScale'.
- *
- * @return the value of field 'AutoScale'.
- */
- public boolean getAutoScale(
- ) {
- return this._autoScale;
- }
-
- /**
- * Returns the value of field 'colour'.
- *
- * @return the value of field 'Colour'.
- */
- public int getColour(
- ) {
- return this._colour;
- }
-
- /**
- * Returns the value of field 'colourByLabel'.
- *
- * @return the value of field 'ColourByLabel'.
- */
- public boolean getColourByLabel(
- ) {
- return this._colourByLabel;
- }
-
- /**
- * Returns the value of field 'display'.
- *
- * @return the value of field 'Display'.
- */
- public boolean getDisplay(
- ) {
- return this._display;
- }
-
- /**
- * Returns the value of field 'max'.
- *
- * @return the value of field 'Max'.
- */
- public float getMax(
- ) {
- return this._max;
- }
-
- /**
- * Returns the value of field 'min'.
- *
- * @return the value of field 'Min'.
- */
- public float getMin(
- ) {
- return this._min;
- }
-
- /**
- * Returns the value of field 'mincolour'. The field
- * 'mincolour' has the following description: Optional minimum
- * colour for graduated feature colour
- *
- * @return the value of field 'Mincolour'.
- */
- public int getMincolour(
- ) {
- return this._mincolour;
- }
-
- /**
- * Returns the value of field 'order'.
- *
- * @return the value of field 'Order'.
- */
- public float getOrder(
- ) {
- return this._order;
- }
-
- /**
- * Returns the value of field 'threshold'. The field
- * 'threshold' has the following description: threshold value
- * for graduated feature colour
- *
- * @return the value of field 'Threshold'.
- */
- public float getThreshold(
- ) {
- return this._threshold;
- }
-
- /**
- * Returns the value of field 'threshstate'. The field
- * 'threshstate' has the following description: threshold type
- * for graduated feature colour
- *
- * @return the value of field 'Threshstate'.
- */
- public int getThreshstate(
- ) {
- return this._threshstate;
- }
-
- /**
- * Returns the value of field 'type'.
- *
- * @return the value of field 'Type'.
- */
- public java.lang.String getType(
- ) {
- return this._type;
- }
-
- /**
- * Method hasAutoScale.
- *
- * @return true if at least one AutoScale has been added
- */
- public boolean hasAutoScale(
- ) {
- return this._has_autoScale;
- }
-
- /**
- * Method hasColour.
- *
- * @return true if at least one Colour has been added
- */
- public boolean hasColour(
- ) {
- return this._has_colour;
- }
-
- /**
- * Method hasColourByLabel.
- *
- * @return true if at least one ColourByLabel has been added
- */
- public boolean hasColourByLabel(
- ) {
- return this._has_colourByLabel;
- }
-
- /**
- * Method hasDisplay.
- *
- * @return true if at least one Display has been added
- */
- public boolean hasDisplay(
- ) {
- return this._has_display;
- }
-
- /**
- * Method hasMax.
- *
- * @return true if at least one Max has been added
- */
- public boolean hasMax(
- ) {
- return this._has_max;
- }
-
- /**
- * Method hasMin.
- *
- * @return true if at least one Min has been added
- */
- public boolean hasMin(
- ) {
- return this._has_min;
- }
-
- /**
- * Method hasMincolour.
- *
- * @return true if at least one Mincolour has been added
- */
- public boolean hasMincolour(
- ) {
- return this._has_mincolour;
- }
-
- /**
- * Method hasOrder.
- *
- * @return true if at least one Order has been added
- */
- public boolean hasOrder(
- ) {
- return this._has_order;
- }
-
- /**
- * Method hasThreshold.
- *
- * @return true if at least one Threshold has been added
- */
- public boolean hasThreshold(
- ) {
- return this._has_threshold;
- }
-
- /**
- * Method hasThreshstate.
- *
- * @return true if at least one Threshstate has been added
- */
- public boolean hasThreshstate(
- ) {
- return this._has_threshstate;
- }
-
- /**
- * Returns the value of field 'autoScale'.
- *
- * @return the value of field 'AutoScale'.
- */
- public boolean isAutoScale(
- ) {
- return this._autoScale;
- }
-
- /**
- * Returns the value of field 'colourByLabel'.
- *
- * @return the value of field 'ColourByLabel'.
- */
- public boolean isColourByLabel(
- ) {
- return this._colourByLabel;
- }
-
- /**
- * Returns the value of field 'display'.
- *
- * @return the value of field 'Display'.
- */
- public boolean isDisplay(
- ) {
- return this._display;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'autoScale'.
- *
- * @param autoScale the value of field 'autoScale'.
- */
- public void setAutoScale(
- final boolean autoScale) {
- this._autoScale = autoScale;
- this._has_autoScale = true;
- }
-
- /**
- * Sets the value of field 'colour'.
- *
- * @param colour the value of field 'colour'.
- */
- public void setColour(
- final int colour) {
- this._colour = colour;
- this._has_colour = true;
- }
-
- /**
- * Sets the value of field 'colourByLabel'.
- *
- * @param colourByLabel the value of field 'colourByLabel'.
- */
- public void setColourByLabel(
- final boolean colourByLabel) {
- this._colourByLabel = colourByLabel;
- this._has_colourByLabel = true;
- }
-
- /**
- * Sets the value of field 'display'.
- *
- * @param display the value of field 'display'.
- */
- public void setDisplay(
- final boolean display) {
- this._display = display;
- this._has_display = true;
- }
-
- /**
- * Sets the value of field 'max'.
- *
- * @param max the value of field 'max'.
- */
- public void setMax(
- final float max) {
- this._max = max;
- this._has_max = true;
- }
-
- /**
- * Sets the value of field 'min'.
- *
- * @param min the value of field 'min'.
- */
- public void setMin(
- final float min) {
- this._min = min;
- this._has_min = true;
- }
-
- /**
- * Sets the value of field 'mincolour'. The field 'mincolour'
- * has the following description: Optional minimum colour for
- * graduated feature colour
- *
- * @param mincolour the value of field 'mincolour'.
- */
- public void setMincolour(
- final int mincolour) {
- this._mincolour = mincolour;
- this._has_mincolour = true;
- }
-
- /**
- * Sets the value of field 'order'.
- *
- * @param order the value of field 'order'.
- */
- public void setOrder(
- final float order) {
- this._order = order;
- this._has_order = true;
- }
-
- /**
- * Sets the value of field 'threshold'. The field 'threshold'
- * has the following description: threshold value for graduated
- * feature colour
- *
- * @param threshold the value of field 'threshold'.
- */
- public void setThreshold(
- final float threshold) {
- this._threshold = threshold;
- this._has_threshold = true;
- }
-
- /**
- * Sets the value of field 'threshstate'. The field
- * 'threshstate' has the following description: threshold type
- * for graduated feature colour
- *
- * @param threshstate the value of field 'threshstate'.
- */
- public void setThreshstate(
- final int threshstate) {
- this._threshstate = threshstate;
- this._has_threshstate = true;
- }
-
- /**
- * Sets the value of field 'type'.
- *
- * @param type the value of field 'type'.
- */
- public void setType(
- final java.lang.String type) {
- this._type = type;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.Settin
- */
- public static jalview.schemabinding.version2.Setting unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Setting) Unmarshaller.unmarshal(jalview.schemabinding.version2.Setting.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class Setting implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _type.
+ */
+ private java.lang.String _type;
+
+ /**
+ * Field _colour.
+ */
+ private int _colour;
+
+ /**
+ * keeps track of state for field: _colour
+ */
+ private boolean _has_colour;
+
+ /**
+ * Field _display.
+ */
+ private boolean _display;
+
+ /**
+ * keeps track of state for field: _display
+ */
+ private boolean _has_display;
+
+ /**
+ * Field _order.
+ */
+ private float _order;
+
+ /**
+ * keeps track of state for field: _order
+ */
+ private boolean _has_order;
+
+ /**
+ * Optional minimum colour for graduated feature colour
+ *
+ */
+ private int _mincolour;
+
+ /**
+ * keeps track of state for field: _mincolour
+ */
+ private boolean _has_mincolour;
+
+ /**
+ * threshold value for graduated feature colour
+ *
+ */
+ private float _threshold;
+
+ /**
+ * keeps track of state for field: _threshold
+ */
+ private boolean _has_threshold;
+
+ /**
+ * threshold type for graduated feature colour
+ *
+ */
+ private int _threshstate;
+
+ /**
+ * keeps track of state for field: _threshstate
+ */
+ private boolean _has_threshstate;
+
+ /**
+ * Field _max.
+ */
+ private float _max;
+
+ /**
+ * keeps track of state for field: _max
+ */
+ private boolean _has_max;
+
+ /**
+ * Field _min.
+ */
+ private float _min;
+
+ /**
+ * keeps track of state for field: _min
+ */
+ private boolean _has_min;
+
+ /**
+ * Field _colourByLabel.
+ */
+ private boolean _colourByLabel;
+
+ /**
+ * keeps track of state for field: _colourByLabel
+ */
+ private boolean _has_colourByLabel;
+
+ /**
+ * Field _autoScale.
+ */
+ private boolean _autoScale;
+
+ /**
+ * keeps track of state for field: _autoScale
+ */
+ private boolean _has_autoScale;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Setting()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteAutoScale()
+ {
+ this._has_autoScale = false;
+ }
+
+ /**
+ */
+ public void deleteColour()
+ {
+ this._has_colour = false;
+ }
+
+ /**
+ */
+ public void deleteColourByLabel()
+ {
+ this._has_colourByLabel = false;
+ }
+
+ /**
+ */
+ public void deleteDisplay()
+ {
+ this._has_display = false;
+ }
+
+ /**
+ */
+ public void deleteMax()
+ {
+ this._has_max = false;
+ }
+
+ /**
+ */
+ public void deleteMin()
+ {
+ this._has_min = false;
+ }
+
+ /**
+ */
+ public void deleteMincolour()
+ {
+ this._has_mincolour = false;
+ }
+
+ /**
+ */
+ public void deleteOrder()
+ {
+ this._has_order = false;
+ }
+
+ /**
+ */
+ public void deleteThreshold()
+ {
+ this._has_threshold = false;
+ }
+
+ /**
+ */
+ public void deleteThreshstate()
+ {
+ this._has_threshstate = false;
+ }
+
+ /**
+ * Returns the value of field 'autoScale'.
+ *
+ * @return the value of field 'AutoScale'.
+ */
+ public boolean getAutoScale()
+ {
+ return this._autoScale;
+ }
+
+ /**
+ * Returns the value of field 'colour'.
+ *
+ * @return the value of field 'Colour'.
+ */
+ public int getColour()
+ {
+ return this._colour;
+ }
+
+ /**
+ * Returns the value of field 'colourByLabel'.
+ *
+ * @return the value of field 'ColourByLabel'.
+ */
+ public boolean getColourByLabel()
+ {
+ return this._colourByLabel;
+ }
+
+ /**
+ * Returns the value of field 'display'.
+ *
+ * @return the value of field 'Display'.
+ */
+ public boolean getDisplay()
+ {
+ return this._display;
+ }
+
+ /**
+ * Returns the value of field 'max'.
+ *
+ * @return the value of field 'Max'.
+ */
+ public float getMax()
+ {
+ return this._max;
+ }
+
+ /**
+ * Returns the value of field 'min'.
+ *
+ * @return the value of field 'Min'.
+ */
+ public float getMin()
+ {
+ return this._min;
+ }
+
+ /**
+ * Returns the value of field 'mincolour'. The field 'mincolour' has the
+ * following description: Optional minimum colour for graduated feature colour
+ *
+ *
+ * @return the value of field 'Mincolour'.
+ */
+ public int getMincolour()
+ {
+ return this._mincolour;
+ }
+
+ /**
+ * Returns the value of field 'order'.
+ *
+ * @return the value of field 'Order'.
+ */
+ public float getOrder()
+ {
+ return this._order;
+ }
+
+ /**
+ * Returns the value of field 'threshold'. The field 'threshold' has the
+ * following description: threshold value for graduated feature colour
+ *
+ *
+ * @return the value of field 'Threshold'.
+ */
+ public float getThreshold()
+ {
+ return this._threshold;
+ }
+
+ /**
+ * Returns the value of field 'threshstate'. The field 'threshstate' has the
+ * following description: threshold type for graduated feature colour
+ *
+ *
+ * @return the value of field 'Threshstate'.
+ */
+ public int getThreshstate()
+ {
+ return this._threshstate;
+ }
+
+ /**
+ * Returns the value of field 'type'.
+ *
+ * @return the value of field 'Type'.
+ */
+ public java.lang.String getType()
+ {
+ return this._type;
+ }
+
+ /**
+ * Method hasAutoScale.
+ *
+ * @return true if at least one AutoScale has been added
+ */
+ public boolean hasAutoScale()
+ {
+ return this._has_autoScale;
+ }
+
+ /**
+ * Method hasColour.
+ *
+ * @return true if at least one Colour has been added
+ */
+ public boolean hasColour()
+ {
+ return this._has_colour;
+ }
+
+ /**
+ * Method hasColourByLabel.
+ *
+ * @return true if at least one ColourByLabel has been added
+ */
+ public boolean hasColourByLabel()
+ {
+ return this._has_colourByLabel;
+ }
+
+ /**
+ * Method hasDisplay.
+ *
+ * @return true if at least one Display has been added
+ */
+ public boolean hasDisplay()
+ {
+ return this._has_display;
+ }
+
+ /**
+ * Method hasMax.
+ *
+ * @return true if at least one Max has been added
+ */
+ public boolean hasMax()
+ {
+ return this._has_max;
+ }
+
+ /**
+ * Method hasMin.
+ *
+ * @return true if at least one Min has been added
+ */
+ public boolean hasMin()
+ {
+ return this._has_min;
+ }
+
+ /**
+ * Method hasMincolour.
+ *
+ * @return true if at least one Mincolour has been added
+ */
+ public boolean hasMincolour()
+ {
+ return this._has_mincolour;
+ }
+
+ /**
+ * Method hasOrder.
+ *
+ * @return true if at least one Order has been added
+ */
+ public boolean hasOrder()
+ {
+ return this._has_order;
+ }
+
+ /**
+ * Method hasThreshold.
+ *
+ * @return true if at least one Threshold has been added
+ */
+ public boolean hasThreshold()
+ {
+ return this._has_threshold;
+ }
+
+ /**
+ * Method hasThreshstate.
+ *
+ * @return true if at least one Threshstate has been added
+ */
+ public boolean hasThreshstate()
+ {
+ return this._has_threshstate;
+ }
+
+ /**
+ * Returns the value of field 'autoScale'.
+ *
+ * @return the value of field 'AutoScale'.
+ */
+ public boolean isAutoScale()
+ {
+ return this._autoScale;
+ }
+
+ /**
+ * Returns the value of field 'colourByLabel'.
+ *
+ * @return the value of field 'ColourByLabel'.
+ */
+ public boolean isColourByLabel()
+ {
+ return this._colourByLabel;
+ }
+
+ /**
+ * Returns the value of field 'display'.
+ *
+ * @return the value of field 'Display'.
+ */
+ public boolean isDisplay()
+ {
+ return this._display;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'autoScale'.
+ *
+ * @param autoScale
+ * the value of field 'autoScale'.
+ */
+ public void setAutoScale(final boolean autoScale)
+ {
+ this._autoScale = autoScale;
+ this._has_autoScale = true;
+ }
+
+ /**
+ * Sets the value of field 'colour'.
+ *
+ * @param colour
+ * the value of field 'colour'.
+ */
+ public void setColour(final int colour)
+ {
+ this._colour = colour;
+ this._has_colour = true;
+ }
+
+ /**
+ * Sets the value of field 'colourByLabel'.
+ *
+ * @param colourByLabel
+ * the value of field 'colourByLabel'.
+ */
+ public void setColourByLabel(final boolean colourByLabel)
+ {
+ this._colourByLabel = colourByLabel;
+ this._has_colourByLabel = true;
+ }
+
+ /**
+ * Sets the value of field 'display'.
+ *
+ * @param display
+ * the value of field 'display'.
+ */
+ public void setDisplay(final boolean display)
+ {
+ this._display = display;
+ this._has_display = true;
+ }
+
+ /**
+ * Sets the value of field 'max'.
+ *
+ * @param max
+ * the value of field 'max'.
+ */
+ public void setMax(final float max)
+ {
+ this._max = max;
+ this._has_max = true;
+ }
+
+ /**
+ * Sets the value of field 'min'.
+ *
+ * @param min
+ * the value of field 'min'.
+ */
+ public void setMin(final float min)
+ {
+ this._min = min;
+ this._has_min = true;
+ }
+
+ /**
+ * Sets the value of field 'mincolour'. The field 'mincolour' has the
+ * following description: Optional minimum colour for graduated feature colour
+ *
+ *
+ * @param mincolour
+ * the value of field 'mincolour'.
+ */
+ public void setMincolour(final int mincolour)
+ {
+ this._mincolour = mincolour;
+ this._has_mincolour = true;
+ }
+
+ /**
+ * Sets the value of field 'order'.
+ *
+ * @param order
+ * the value of field 'order'.
+ */
+ public void setOrder(final float order)
+ {
+ this._order = order;
+ this._has_order = true;
+ }
+
+ /**
+ * Sets the value of field 'threshold'. The field 'threshold' has the
+ * following description: threshold value for graduated feature colour
+ *
+ *
+ * @param threshold
+ * the value of field 'threshold'.
+ */
+ public void setThreshold(final float threshold)
+ {
+ this._threshold = threshold;
+ this._has_threshold = true;
+ }
+
+ /**
+ * Sets the value of field 'threshstate'. The field 'threshstate' has the
+ * following description: threshold type for graduated feature colour
+ *
+ *
+ * @param threshstate
+ * the value of field 'threshstate'.
+ */
+ public void setThreshstate(final int threshstate)
+ {
+ this._threshstate = threshstate;
+ this._has_threshstate = true;
+ }
+
+ /**
+ * Sets the value of field 'type'.
+ *
+ * @param type
+ * the value of field 'type'.
+ */
+ public void setType(final java.lang.String type)
+ {
+ this._type = type;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Settin
+ */
+ public static jalview.schemabinding.version2.Setting unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Setting) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.Setting.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/StructureState.java b/src/jalview/schemabinding/version2/StructureState.java
index 39fea56..186e4e6 100644
--- a/src/jalview/schemabinding/version2/StructureState.java
+++ b/src/jalview/schemabinding/version2/StructureState.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,658 +19,688 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class StructureState implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * internal content storage
- */
- private java.lang.String _content = "";
-
- /**
- * Field _visible.
- */
- private boolean _visible;
-
- /**
- * keeps track of state for field: _visible
- */
- private boolean _has_visible;
-
- /**
- * additional identifier which properly disambiguates
- * the structure view from any other view with the same
- * attributes. This is not an ID,
- * because it is possible to have many references to the same
- * physical structure view
- * from different sequences in an alignment. A structureState
- * element citing the same
- * viewId will appear for each instance.
- */
- private java.lang.String _viewId;
-
- /**
- * Flag set if the alignment panel containing this JSeq should
- * be included in those used to perform a structure
- * superposition (since Jalview 2.7).
- *
- */
- private boolean _alignwithAlignPanel = true;
-
- /**
- * keeps track of state for field: _alignwithAlignPanel
- */
- private boolean _has_alignwithAlignPanel;
-
- /**
- * Flag set if the alignment panel containing this JSeq should
- * be included in those used to colour its associated sequences
- * in this structureState(since Jalview 2.7).
- *
- */
- private boolean _colourwithAlignPanel = false;
-
- /**
- * keeps track of state for field: _colourwithAlignPanel
- */
- private boolean _has_colourwithAlignPanel;
-
- /**
- * Flag set if the structure display is coloured by the Jmol
- * state, rather than by one or more linked alignment views.
- *
- */
- private boolean _colourByJmol = true;
-
- /**
- * keeps track of state for field: _colourByJmol
- */
- private boolean _has_colourByJmol;
-
- /**
- * Field _width.
- */
- private int _width;
-
- /**
- * keeps track of state for field: _width
- */
- private boolean _has_width;
-
- /**
- * Field _height.
- */
- private int _height;
-
- /**
- * keeps track of state for field: _height
- */
- private boolean _has_height;
-
- /**
- * Field _xpos.
- */
- private int _xpos;
-
- /**
- * keeps track of state for field: _xpos
- */
- private boolean _has_xpos;
-
- /**
- * Field _ypos.
- */
- private int _ypos;
-
- /**
- * keeps track of state for field: _ypos
- */
- private boolean _has_ypos;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public StructureState() {
- super();
- setContent("");
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteAlignwithAlignPanel(
- ) {
- this._has_alignwithAlignPanel= false;
- }
-
- /**
- */
- public void deleteColourByJmol(
- ) {
- this._has_colourByJmol= false;
- }
-
- /**
- */
- public void deleteColourwithAlignPanel(
- ) {
- this._has_colourwithAlignPanel= false;
- }
-
- /**
- */
- public void deleteHeight(
- ) {
- this._has_height= false;
- }
-
- /**
- */
- public void deleteVisible(
- ) {
- this._has_visible= false;
- }
-
- /**
- */
- public void deleteWidth(
- ) {
- this._has_width= false;
- }
-
- /**
- */
- public void deleteXpos(
- ) {
- this._has_xpos= false;
- }
-
- /**
- */
- public void deleteYpos(
- ) {
- this._has_ypos= false;
- }
-
- /**
- * Returns the value of field 'alignwithAlignPanel'. The field
- * 'alignwithAlignPanel' has the following description: Flag
- * set if the alignment panel containing this JSeq should be
- * included in those used to perform a structure superposition
- * (since Jalview 2.7).
- *
- *
- * @return the value of field 'AlignwithAlignPanel'.
- */
- public boolean getAlignwithAlignPanel(
- ) {
- return this._alignwithAlignPanel;
- }
-
- /**
- * Returns the value of field 'colourByJmol'. The field
- * 'colourByJmol' has the following description: Flag set if
- * the structure display is coloured by the Jmol state, rather
- * than by one or more linked alignment views.
- *
- *
- * @return the value of field 'ColourByJmol'.
- */
- public boolean getColourByJmol(
- ) {
- return this._colourByJmol;
- }
-
- /**
- * Returns the value of field 'colourwithAlignPanel'. The field
- * 'colourwithAlignPanel' has the following description: Flag
- * set if the alignment panel containing this JSeq should be
- * included in those used to colour its associated sequences in
- * this structureState(since Jalview 2.7).
- *
- *
- * @return the value of field 'ColourwithAlignPanel'.
- */
- public boolean getColourwithAlignPanel(
- ) {
- return this._colourwithAlignPanel;
- }
-
- /**
- * Returns the value of field 'content'. The field 'content'
- * has the following description: internal content storage
- *
- * @return the value of field 'Content'.
- */
- public java.lang.String getContent(
- ) {
- return this._content;
- }
-
- /**
- * Returns the value of field 'height'.
- *
- * @return the value of field 'Height'.
- */
- public int getHeight(
- ) {
- return this._height;
- }
-
- /**
- * Returns the value of field 'viewId'. The field 'viewId' has
- * the following description: additional identifier which
- * properly disambiguates
- * the structure view from any other view with the same
- * attributes. This is not an ID,
- * because it is possible to have many references to the same
- * physical structure view
- * from different sequences in an alignment. A structureState
- * element citing the same
- * viewId will appear for each instance.
- *
- * @return the value of field 'ViewId'.
- */
- public java.lang.String getViewId(
- ) {
- return this._viewId;
- }
-
- /**
- * Returns the value of field 'visible'.
- *
- * @return the value of field 'Visible'.
- */
- public boolean getVisible(
- ) {
- return this._visible;
- }
-
- /**
- * Returns the value of field 'width'.
- *
- * @return the value of field 'Width'.
- */
- public int getWidth(
- ) {
- return this._width;
- }
-
- /**
- * Returns the value of field 'xpos'.
- *
- * @return the value of field 'Xpos'.
- */
- public int getXpos(
- ) {
- return this._xpos;
- }
-
- /**
- * Returns the value of field 'ypos'.
- *
- * @return the value of field 'Ypos'.
- */
- public int getYpos(
- ) {
- return this._ypos;
- }
-
- /**
- * Method hasAlignwithAlignPanel.
- *
- * @return true if at least one AlignwithAlignPanel has been
- * added
- */
- public boolean hasAlignwithAlignPanel(
- ) {
- return this._has_alignwithAlignPanel;
- }
-
- /**
- * Method hasColourByJmol.
- *
- * @return true if at least one ColourByJmol has been added
- */
- public boolean hasColourByJmol(
- ) {
- return this._has_colourByJmol;
- }
-
- /**
- * Method hasColourwithAlignPanel.
- *
- * @return true if at least one ColourwithAlignPanel has been
- * added
- */
- public boolean hasColourwithAlignPanel(
- ) {
- return this._has_colourwithAlignPanel;
- }
-
- /**
- * Method hasHeight.
- *
- * @return true if at least one Height has been added
- */
- public boolean hasHeight(
- ) {
- return this._has_height;
- }
-
- /**
- * Method hasVisible.
- *
- * @return true if at least one Visible has been added
- */
- public boolean hasVisible(
- ) {
- return this._has_visible;
- }
-
- /**
- * Method hasWidth.
- *
- * @return true if at least one Width has been added
- */
- public boolean hasWidth(
- ) {
- return this._has_width;
- }
-
- /**
- * Method hasXpos.
- *
- * @return true if at least one Xpos has been added
- */
- public boolean hasXpos(
- ) {
- return this._has_xpos;
- }
-
- /**
- * Method hasYpos.
- *
- * @return true if at least one Ypos has been added
- */
- public boolean hasYpos(
- ) {
- return this._has_ypos;
- }
-
- /**
- * Returns the value of field 'alignwithAlignPanel'. The field
- * 'alignwithAlignPanel' has the following description: Flag
- * set if the alignment panel containing this JSeq should be
- * included in those used to perform a structure superposition
- * (since Jalview 2.7).
- *
- *
- * @return the value of field 'AlignwithAlignPanel'.
- */
- public boolean isAlignwithAlignPanel(
- ) {
- return this._alignwithAlignPanel;
- }
-
- /**
- * Returns the value of field 'colourByJmol'. The field
- * 'colourByJmol' has the following description: Flag set if
- * the structure display is coloured by the Jmol state, rather
- * than by one or more linked alignment views.
- *
- *
- * @return the value of field 'ColourByJmol'.
- */
- public boolean isColourByJmol(
- ) {
- return this._colourByJmol;
- }
-
- /**
- * Returns the value of field 'colourwithAlignPanel'. The field
- * 'colourwithAlignPanel' has the following description: Flag
- * set if the alignment panel containing this JSeq should be
- * included in those used to colour its associated sequences in
- * this structureState(since Jalview 2.7).
- *
- *
- * @return the value of field 'ColourwithAlignPanel'.
- */
- public boolean isColourwithAlignPanel(
- ) {
- return this._colourwithAlignPanel;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- * Returns the value of field 'visible'.
- *
- * @return the value of field 'Visible'.
- */
- public boolean isVisible(
- ) {
- return this._visible;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'alignwithAlignPanel'. The field
- * 'alignwithAlignPanel' has the following description: Flag
- * set if the alignment panel containing this JSeq should be
- * included in those used to perform a structure superposition
- * (since Jalview 2.7).
- *
- *
- * @param alignwithAlignPanel the value of field
- * 'alignwithAlignPanel'.
- */
- public void setAlignwithAlignPanel(
- final boolean alignwithAlignPanel) {
- this._alignwithAlignPanel = alignwithAlignPanel;
- this._has_alignwithAlignPanel = true;
- }
-
- /**
- * Sets the value of field 'colourByJmol'. The field
- * 'colourByJmol' has the following description: Flag set if
- * the structure display is coloured by the Jmol state, rather
- * than by one or more linked alignment views.
- *
- *
- * @param colourByJmol the value of field 'colourByJmol'.
- */
- public void setColourByJmol(
- final boolean colourByJmol) {
- this._colourByJmol = colourByJmol;
- this._has_colourByJmol = true;
- }
-
- /**
- * Sets the value of field 'colourwithAlignPanel'. The field
- * 'colourwithAlignPanel' has the following description: Flag
- * set if the alignment panel containing this JSeq should be
- * included in those used to colour its associated sequences in
- * this structureState(since Jalview 2.7).
- *
- *
- * @param colourwithAlignPanel the value of field
- * 'colourwithAlignPanel'.
- */
- public void setColourwithAlignPanel(
- final boolean colourwithAlignPanel) {
- this._colourwithAlignPanel = colourwithAlignPanel;
- this._has_colourwithAlignPanel = true;
- }
-
- /**
- * Sets the value of field 'content'. The field 'content' has
- * the following description: internal content storage
- *
- * @param content the value of field 'content'.
- */
- public void setContent(
- final java.lang.String content) {
- this._content = content;
- }
-
- /**
- * Sets the value of field 'height'.
- *
- * @param height the value of field 'height'.
- */
- public void setHeight(
- final int height) {
- this._height = height;
- this._has_height = true;
- }
-
- /**
- * Sets the value of field 'viewId'. The field 'viewId' has the
- * following description: additional identifier which properly
- * disambiguates
- * the structure view from any other view with the same
- * attributes. This is not an ID,
- * because it is possible to have many references to the same
- * physical structure view
- * from different sequences in an alignment. A structureState
- * element citing the same
- * viewId will appear for each instance.
- *
- * @param viewId the value of field 'viewId'.
- */
- public void setViewId(
- final java.lang.String viewId) {
- this._viewId = viewId;
- }
-
- /**
- * Sets the value of field 'visible'.
- *
- * @param visible the value of field 'visible'.
- */
- public void setVisible(
- final boolean visible) {
- this._visible = visible;
- this._has_visible = true;
- }
-
- /**
- * Sets the value of field 'width'.
- *
- * @param width the value of field 'width'.
- */
- public void setWidth(
- final int width) {
- this._width = width;
- this._has_width = true;
- }
-
- /**
- * Sets the value of field 'xpos'.
- *
- * @param xpos the value of field 'xpos'.
- */
- public void setXpos(
- final int xpos) {
- this._xpos = xpos;
- this._has_xpos = true;
- }
-
- /**
- * Sets the value of field 'ypos'.
- *
- * @param ypos the value of field 'ypos'.
- */
- public void setYpos(
- final int ypos) {
- this._ypos = ypos;
- this._has_ypos = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.StructureState
- */
- public static jalview.schemabinding.version2.StructureState unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.StructureState) Unmarshaller.unmarshal(jalview.schemabinding.version2.StructureState.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class StructureState implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * internal content storage
+ */
+ private java.lang.String _content = "";
+
+ /**
+ * Field _visible.
+ */
+ private boolean _visible;
+
+ /**
+ * keeps track of state for field: _visible
+ */
+ private boolean _has_visible;
+
+ /**
+ * additional identifier which properly disambiguates the structure view from
+ * any other view with the same attributes. This is not an ID, because it is
+ * possible to have many references to the same physical structure view from
+ * different sequences in an alignment. A structureState element citing the
+ * same viewId will appear for each instance.
+ *
+ */
+ private java.lang.String _viewId;
+
+ /**
+ * Flag set if the alignment panel containing this JSeq should be included in
+ * those used to perform a structure superposition (since Jalview 2.7).
+ *
+ */
+ private boolean _alignwithAlignPanel = true;
+
+ /**
+ * keeps track of state for field: _alignwithAlignPanel
+ */
+ private boolean _has_alignwithAlignPanel;
+
+ /**
+ * Flag set if the alignment panel containing this JSeq should be included in
+ * those used to colour its associated sequences in this structureState(since
+ * Jalview 2.7).
+ *
+ */
+ private boolean _colourwithAlignPanel = false;
+
+ /**
+ * keeps track of state for field: _colourwithAlignPanel
+ */
+ private boolean _has_colourwithAlignPanel;
+
+ /**
+ * Flag set if the structure display is coloured by the Jmol state, rather
+ * than by one or more linked alignment views.
+ *
+ */
+ private boolean _colourByJmol = true;
+
+ /**
+ * keeps track of state for field: _colourByJmol
+ */
+ private boolean _has_colourByJmol;
+
+ /**
+ * An identifier for the viewer type, currently either JMOL or CHIMERA
+ *
+ */
+ private java.lang.String _type;
+
+ /**
+ * Field _width.
+ */
+ private int _width;
+
+ /**
+ * keeps track of state for field: _width
+ */
+ private boolean _has_width;
+
+ /**
+ * Field _height.
+ */
+ private int _height;
+
+ /**
+ * keeps track of state for field: _height
+ */
+ private boolean _has_height;
+
+ /**
+ * Field _xpos.
+ */
+ private int _xpos;
+
+ /**
+ * keeps track of state for field: _xpos
+ */
+ private boolean _has_xpos;
+
+ /**
+ * Field _ypos.
+ */
+ private int _ypos;
+
+ /**
+ * keeps track of state for field: _ypos
+ */
+ private boolean _has_ypos;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public StructureState()
+ {
+ super();
+ setContent("");
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteAlignwithAlignPanel()
+ {
+ this._has_alignwithAlignPanel = false;
+ }
+
+ /**
+ */
+ public void deleteColourByJmol()
+ {
+ this._has_colourByJmol = false;
+ }
+
+ /**
+ */
+ public void deleteColourwithAlignPanel()
+ {
+ this._has_colourwithAlignPanel = false;
+ }
+
+ /**
+ */
+ public void deleteHeight()
+ {
+ this._has_height = false;
+ }
+
+ /**
+ */
+ public void deleteVisible()
+ {
+ this._has_visible = false;
+ }
+
+ /**
+ */
+ public void deleteWidth()
+ {
+ this._has_width = false;
+ }
+
+ /**
+ */
+ public void deleteXpos()
+ {
+ this._has_xpos = false;
+ }
+
+ /**
+ */
+ public void deleteYpos()
+ {
+ this._has_ypos = false;
+ }
+
+ /**
+ * Returns the value of field 'alignwithAlignPanel'. The field
+ * 'alignwithAlignPanel' has the following description: Flag set if the
+ * alignment panel containing this JSeq should be included in those used to
+ * perform a structure superposition (since Jalview 2.7).
+ *
+ *
+ * @return the value of field 'AlignwithAlignPanel'.
+ */
+ public boolean getAlignwithAlignPanel()
+ {
+ return this._alignwithAlignPanel;
+ }
+
+ /**
+ * Returns the value of field 'colourByJmol'. The field 'colourByJmol' has the
+ * following description: Flag set if the structure display is coloured by the
+ * Jmol state, rather than by one or more linked alignment views.
+ *
+ *
+ * @return the value of field 'ColourByJmol'.
+ */
+ public boolean getColourByJmol()
+ {
+ return this._colourByJmol;
+ }
+
+ /**
+ * Returns the value of field 'colourwithAlignPanel'. The field
+ * 'colourwithAlignPanel' has the following description: Flag set if the
+ * alignment panel containing this JSeq should be included in those used to
+ * colour its associated sequences in this structureState(since Jalview 2.7).
+ *
+ *
+ * @return the value of field 'ColourwithAlignPanel'.
+ */
+ public boolean getColourwithAlignPanel()
+ {
+ return this._colourwithAlignPanel;
+ }
+
+ /**
+ * Returns the value of field 'content'. The field 'content' has the following
+ * description: internal content storage
+ *
+ * @return the value of field 'Content'.
+ */
+ public java.lang.String getContent()
+ {
+ return this._content;
+ }
+
+ /**
+ * Returns the value of field 'height'.
+ *
+ * @return the value of field 'Height'.
+ */
+ public int getHeight()
+ {
+ return this._height;
+ }
+
+ /**
+ * Returns the value of field 'type'. The field 'type' has the following
+ * description: An identifier for the viewer type, currently either JMOL or
+ * CHIMERA
+ *
+ *
+ * @return the value of field 'Type'.
+ */
+ public java.lang.String getType()
+ {
+ return this._type;
+ }
+
+ /**
+ * Returns the value of field 'viewId'. The field 'viewId' has the following
+ * description: additional identifier which properly disambiguates the
+ * structure view from any other view with the same attributes. This is not an
+ * ID, because it is possible to have many references to the same physical
+ * structure view from different sequences in an alignment. A structureState
+ * element citing the same viewId will appear for each instance.
+ *
+ *
+ * @return the value of field 'ViewId'.
+ */
+ public java.lang.String getViewId()
+ {
+ return this._viewId;
+ }
+
+ /**
+ * Returns the value of field 'visible'.
+ *
+ * @return the value of field 'Visible'.
+ */
+ public boolean getVisible()
+ {
+ return this._visible;
+ }
+
+ /**
+ * Returns the value of field 'width'.
+ *
+ * @return the value of field 'Width'.
+ */
+ public int getWidth()
+ {
+ return this._width;
+ }
+
+ /**
+ * Returns the value of field 'xpos'.
+ *
+ * @return the value of field 'Xpos'.
+ */
+ public int getXpos()
+ {
+ return this._xpos;
+ }
+
+ /**
+ * Returns the value of field 'ypos'.
+ *
+ * @return the value of field 'Ypos'.
+ */
+ public int getYpos()
+ {
+ return this._ypos;
+ }
+
+ /**
+ * Method hasAlignwithAlignPanel.
+ *
+ * @return true if at least one AlignwithAlignPanel has been added
+ */
+ public boolean hasAlignwithAlignPanel()
+ {
+ return this._has_alignwithAlignPanel;
+ }
+
+ /**
+ * Method hasColourByJmol.
+ *
+ * @return true if at least one ColourByJmol has been added
+ */
+ public boolean hasColourByJmol()
+ {
+ return this._has_colourByJmol;
+ }
+
+ /**
+ * Method hasColourwithAlignPanel.
+ *
+ * @return true if at least one ColourwithAlignPanel has been added
+ */
+ public boolean hasColourwithAlignPanel()
+ {
+ return this._has_colourwithAlignPanel;
+ }
+
+ /**
+ * Method hasHeight.
+ *
+ * @return true if at least one Height has been added
+ */
+ public boolean hasHeight()
+ {
+ return this._has_height;
+ }
+
+ /**
+ * Method hasVisible.
+ *
+ * @return true if at least one Visible has been added
+ */
+ public boolean hasVisible()
+ {
+ return this._has_visible;
+ }
+
+ /**
+ * Method hasWidth.
+ *
+ * @return true if at least one Width has been added
+ */
+ public boolean hasWidth()
+ {
+ return this._has_width;
+ }
+
+ /**
+ * Method hasXpos.
+ *
+ * @return true if at least one Xpos has been added
+ */
+ public boolean hasXpos()
+ {
+ return this._has_xpos;
+ }
+
+ /**
+ * Method hasYpos.
+ *
+ * @return true if at least one Ypos has been added
+ */
+ public boolean hasYpos()
+ {
+ return this._has_ypos;
+ }
+
+ /**
+ * Returns the value of field 'alignwithAlignPanel'. The field
+ * 'alignwithAlignPanel' has the following description: Flag set if the
+ * alignment panel containing this JSeq should be included in those used to
+ * perform a structure superposition (since Jalview 2.7).
+ *
+ *
+ * @return the value of field 'AlignwithAlignPanel'.
+ */
+ public boolean isAlignwithAlignPanel()
+ {
+ return this._alignwithAlignPanel;
+ }
+
+ /**
+ * Returns the value of field 'colourByJmol'. The field 'colourByJmol' has the
+ * following description: Flag set if the structure display is coloured by the
+ * Jmol state, rather than by one or more linked alignment views.
+ *
+ *
+ * @return the value of field 'ColourByJmol'.
+ */
+ public boolean isColourByJmol()
+ {
+ return this._colourByJmol;
+ }
+
+ /**
+ * Returns the value of field 'colourwithAlignPanel'. The field
+ * 'colourwithAlignPanel' has the following description: Flag set if the
+ * alignment panel containing this JSeq should be included in those used to
+ * colour its associated sequences in this structureState(since Jalview 2.7).
+ *
+ *
+ * @return the value of field 'ColourwithAlignPanel'.
+ */
+ public boolean isColourwithAlignPanel()
+ {
+ return this._colourwithAlignPanel;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the value of field 'visible'.
+ *
+ * @return the value of field 'Visible'.
+ */
+ public boolean isVisible()
+ {
+ return this._visible;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'alignwithAlignPanel'. The field
+ * 'alignwithAlignPanel' has the following description: Flag set if the
+ * alignment panel containing this JSeq should be included in those used to
+ * perform a structure superposition (since Jalview 2.7).
+ *
+ *
+ * @param alignwithAlignPanel
+ * the value of field 'alignwithAlignPanel'.
+ */
+ public void setAlignwithAlignPanel(final boolean alignwithAlignPanel)
+ {
+ this._alignwithAlignPanel = alignwithAlignPanel;
+ this._has_alignwithAlignPanel = true;
+ }
+
+ /**
+ * Sets the value of field 'colourByJmol'. The field 'colourByJmol' has the
+ * following description: Flag set if the structure display is coloured by the
+ * Jmol state, rather than by one or more linked alignment views.
+ *
+ *
+ * @param colourByJmol
+ * the value of field 'colourByJmol'.
+ */
+ public void setColourByJmol(final boolean colourByJmol)
+ {
+ this._colourByJmol = colourByJmol;
+ this._has_colourByJmol = true;
+ }
+
+ /**
+ * Sets the value of field 'colourwithAlignPanel'. The field
+ * 'colourwithAlignPanel' has the following description: Flag set if the
+ * alignment panel containing this JSeq should be included in those used to
+ * colour its associated sequences in this structureState(since Jalview 2.7).
+ *
+ *
+ * @param colourwithAlignPanel
+ * the value of field 'colourwithAlignPanel'.
+ */
+ public void setColourwithAlignPanel(final boolean colourwithAlignPanel)
+ {
+ this._colourwithAlignPanel = colourwithAlignPanel;
+ this._has_colourwithAlignPanel = true;
+ }
+
+ /**
+ * Sets the value of field 'content'. The field 'content' has the following
+ * description: internal content storage
+ *
+ * @param content
+ * the value of field 'content'.
+ */
+ public void setContent(final java.lang.String content)
+ {
+ this._content = content;
+ }
+
+ /**
+ * Sets the value of field 'height'.
+ *
+ * @param height
+ * the value of field 'height'.
+ */
+ public void setHeight(final int height)
+ {
+ this._height = height;
+ this._has_height = true;
+ }
+
+ /**
+ * Sets the value of field 'type'. The field 'type' has the following
+ * description: An identifier for the viewer type, currently either JMOL or
+ * CHIMERA
+ *
+ *
+ * @param type
+ * the value of field 'type'.
+ */
+ public void setType(final java.lang.String type)
+ {
+ this._type = type;
+ }
+
+ /**
+ * Sets the value of field 'viewId'. The field 'viewId' has the following
+ * description: additional identifier which properly disambiguates the
+ * structure view from any other view with the same attributes. This is not an
+ * ID, because it is possible to have many references to the same physical
+ * structure view from different sequences in an alignment. A structureState
+ * element citing the same viewId will appear for each instance.
+ *
+ *
+ * @param viewId
+ * the value of field 'viewId'.
+ */
+ public void setViewId(final java.lang.String viewId)
+ {
+ this._viewId = viewId;
+ }
+
+ /**
+ * Sets the value of field 'visible'.
+ *
+ * @param visible
+ * the value of field 'visible'.
+ */
+ public void setVisible(final boolean visible)
+ {
+ this._visible = visible;
+ this._has_visible = true;
+ }
+
+ /**
+ * Sets the value of field 'width'.
+ *
+ * @param width
+ * the value of field 'width'.
+ */
+ public void setWidth(final int width)
+ {
+ this._width = width;
+ this._has_width = true;
+ }
+
+ /**
+ * Sets the value of field 'xpos'.
+ *
+ * @param xpos
+ * the value of field 'xpos'.
+ */
+ public void setXpos(final int xpos)
+ {
+ this._xpos = xpos;
+ this._has_xpos = true;
+ }
+
+ /**
+ * Sets the value of field 'ypos'.
+ *
+ * @param ypos
+ * the value of field 'ypos'.
+ */
+ public void setYpos(final int ypos)
+ {
+ this._ypos = ypos;
+ this._has_ypos = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.StructureState
+ */
+ public static jalview.schemabinding.version2.StructureState unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.StructureState) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.StructureState.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/ThresholdLine.java b/src/jalview/schemabinding/version2/ThresholdLine.java
index 653ea68..d70d855 100644
--- a/src/jalview/schemabinding/version2/ThresholdLine.java
+++ b/src/jalview/schemabinding/version2/ThresholdLine.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,223 +19,235 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class ThresholdLine implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _label.
- */
- private java.lang.String _label;
-
- /**
- * Field _value.
- */
- private float _value;
-
- /**
- * keeps track of state for field: _value
- */
- private boolean _has_value;
-
- /**
- * Field _colour.
- */
- private int _colour;
-
- /**
- * keeps track of state for field: _colour
- */
- private boolean _has_colour;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public ThresholdLine() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteColour(
- ) {
- this._has_colour= false;
- }
-
- /**
- */
- public void deleteValue(
- ) {
- this._has_value= false;
- }
-
- /**
- * Returns the value of field 'colour'.
- *
- * @return the value of field 'Colour'.
- */
- public int getColour(
- ) {
- return this._colour;
- }
-
- /**
- * Returns the value of field 'label'.
- *
- * @return the value of field 'Label'.
- */
- public java.lang.String getLabel(
- ) {
- return this._label;
- }
-
- /**
- * Returns the value of field 'value'.
- *
- * @return the value of field 'Value'.
- */
- public float getValue(
- ) {
- return this._value;
- }
-
- /**
- * Method hasColour.
- *
- * @return true if at least one Colour has been added
- */
- public boolean hasColour(
- ) {
- return this._has_colour;
- }
-
- /**
- * Method hasValue.
- *
- * @return true if at least one Value has been added
- */
- public boolean hasValue(
- ) {
- return this._has_value;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'colour'.
- *
- * @param colour the value of field 'colour'.
- */
- public void setColour(
- final int colour) {
- this._colour = colour;
- this._has_colour = true;
- }
-
- /**
- * Sets the value of field 'label'.
- *
- * @param label the value of field 'label'.
- */
- public void setLabel(
- final java.lang.String label) {
- this._label = label;
- }
-
- /**
- * Sets the value of field 'value'.
- *
- * @param value the value of field 'value'.
- */
- public void setValue(
- final float value) {
- this._value = value;
- this._has_value = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.ThresholdLine
- */
- public static jalview.schemabinding.version2.ThresholdLine unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.ThresholdLine) Unmarshaller.unmarshal(jalview.schemabinding.version2.ThresholdLine.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class ThresholdLine implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _label.
+ */
+ private java.lang.String _label;
+
+ /**
+ * Field _value.
+ */
+ private float _value;
+
+ /**
+ * keeps track of state for field: _value
+ */
+ private boolean _has_value;
+
+ /**
+ * Field _colour.
+ */
+ private int _colour;
+
+ /**
+ * keeps track of state for field: _colour
+ */
+ private boolean _has_colour;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public ThresholdLine()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteColour()
+ {
+ this._has_colour = false;
+ }
+
+ /**
+ */
+ public void deleteValue()
+ {
+ this._has_value = false;
+ }
+
+ /**
+ * Returns the value of field 'colour'.
+ *
+ * @return the value of field 'Colour'.
+ */
+ public int getColour()
+ {
+ return this._colour;
+ }
+
+ /**
+ * Returns the value of field 'label'.
+ *
+ * @return the value of field 'Label'.
+ */
+ public java.lang.String getLabel()
+ {
+ return this._label;
+ }
+
+ /**
+ * Returns the value of field 'value'.
+ *
+ * @return the value of field 'Value'.
+ */
+ public float getValue()
+ {
+ return this._value;
+ }
+
+ /**
+ * Method hasColour.
+ *
+ * @return true if at least one Colour has been added
+ */
+ public boolean hasColour()
+ {
+ return this._has_colour;
+ }
+
+ /**
+ * Method hasValue.
+ *
+ * @return true if at least one Value has been added
+ */
+ public boolean hasValue()
+ {
+ return this._has_value;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'colour'.
+ *
+ * @param colour
+ * the value of field 'colour'.
+ */
+ public void setColour(final int colour)
+ {
+ this._colour = colour;
+ this._has_colour = true;
+ }
+
+ /**
+ * Sets the value of field 'label'.
+ *
+ * @param label
+ * the value of field 'label'.
+ */
+ public void setLabel(final java.lang.String label)
+ {
+ this._label = label;
+ }
+
+ /**
+ * Sets the value of field 'value'.
+ *
+ * @param value
+ * the value of field 'value'.
+ */
+ public void setValue(final float value)
+ {
+ this._value = value;
+ this._has_value = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.ThresholdLine
+ */
+ public static jalview.schemabinding.version2.ThresholdLine unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.ThresholdLine) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.ThresholdLine.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Tree.java b/src/jalview/schemabinding/version2/Tree.java
index 8d24990..19b3eb1 100644
--- a/src/jalview/schemabinding/version2/Tree.java
+++ b/src/jalview/schemabinding/version2/Tree.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,834 +19,860 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Tree implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _fontName.
- */
- private java.lang.String _fontName;
-
- /**
- * Field _fontSize.
- */
- private int _fontSize;
-
- /**
- * keeps track of state for field: _fontSize
- */
- private boolean _has_fontSize;
-
- /**
- * Field _fontStyle.
- */
- private int _fontStyle;
-
- /**
- * keeps track of state for field: _fontStyle
- */
- private boolean _has_fontStyle;
-
- /**
- * Field _threshold.
- */
- private float _threshold;
-
- /**
- * keeps track of state for field: _threshold
- */
- private boolean _has_threshold;
-
- /**
- * Field _showBootstrap.
- */
- private boolean _showBootstrap;
-
- /**
- * keeps track of state for field: _showBootstrap
- */
- private boolean _has_showBootstrap;
-
- /**
- * Field _showDistances.
- */
- private boolean _showDistances;
-
- /**
- * keeps track of state for field: _showDistances
- */
- private boolean _has_showDistances;
-
- /**
- * Field _markUnlinked.
- */
- private boolean _markUnlinked;
-
- /**
- * keeps track of state for field: _markUnlinked
- */
- private boolean _has_markUnlinked;
-
- /**
- * Field _fitToWindow.
- */
- private boolean _fitToWindow;
-
- /**
- * keeps track of state for field: _fitToWindow
- */
- private boolean _has_fitToWindow;
-
- /**
- * Field _currentTree.
- */
- private boolean _currentTree;
-
- /**
- * keeps track of state for field: _currentTree
- */
- private boolean _has_currentTree;
-
- /**
- * Tree ID added for binding tree visualization settings to
- * vamsas document trees in jalview 2.4.1
- */
- private java.lang.String _id;
-
- /**
- * Field _width.
- */
- private int _width;
-
- /**
- * keeps track of state for field: _width
- */
- private boolean _has_width;
-
- /**
- * Field _height.
- */
- private int _height;
-
- /**
- * keeps track of state for field: _height
- */
- private boolean _has_height;
-
- /**
- * Field _xpos.
- */
- private int _xpos;
-
- /**
- * keeps track of state for field: _xpos
- */
- private boolean _has_xpos;
-
- /**
- * Field _ypos.
- */
- private int _ypos;
-
- /**
- * keeps track of state for field: _ypos
- */
- private boolean _has_ypos;
-
- /**
- * Field _title.
- */
- private java.lang.String _title;
-
- /**
- * Field _newick.
- */
- private java.lang.String _newick;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Tree() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- */
- public void deleteCurrentTree(
- ) {
- this._has_currentTree= false;
- }
-
- /**
- */
- public void deleteFitToWindow(
- ) {
- this._has_fitToWindow= false;
- }
-
- /**
- */
- public void deleteFontSize(
- ) {
- this._has_fontSize= false;
- }
-
- /**
- */
- public void deleteFontStyle(
- ) {
- this._has_fontStyle= false;
- }
-
- /**
- */
- public void deleteHeight(
- ) {
- this._has_height= false;
- }
-
- /**
- */
- public void deleteMarkUnlinked(
- ) {
- this._has_markUnlinked= false;
- }
-
- /**
- */
- public void deleteShowBootstrap(
- ) {
- this._has_showBootstrap= false;
- }
-
- /**
- */
- public void deleteShowDistances(
- ) {
- this._has_showDistances= false;
- }
-
- /**
- */
- public void deleteThreshold(
- ) {
- this._has_threshold= false;
- }
-
- /**
- */
- public void deleteWidth(
- ) {
- this._has_width= false;
- }
-
- /**
- */
- public void deleteXpos(
- ) {
- this._has_xpos= false;
- }
-
- /**
- */
- public void deleteYpos(
- ) {
- this._has_ypos= false;
- }
-
- /**
- * Returns the value of field 'currentTree'.
- *
- * @return the value of field 'CurrentTree'.
- */
- public boolean getCurrentTree(
- ) {
- return this._currentTree;
- }
-
- /**
- * Returns the value of field 'fitToWindow'.
- *
- * @return the value of field 'FitToWindow'.
- */
- public boolean getFitToWindow(
- ) {
- return this._fitToWindow;
- }
-
- /**
- * Returns the value of field 'fontName'.
- *
- * @return the value of field 'FontName'.
- */
- public java.lang.String getFontName(
- ) {
- return this._fontName;
- }
-
- /**
- * Returns the value of field 'fontSize'.
- *
- * @return the value of field 'FontSize'.
- */
- public int getFontSize(
- ) {
- return this._fontSize;
- }
-
- /**
- * Returns the value of field 'fontStyle'.
- *
- * @return the value of field 'FontStyle'.
- */
- public int getFontStyle(
- ) {
- return this._fontStyle;
- }
-
- /**
- * Returns the value of field 'height'.
- *
- * @return the value of field 'Height'.
- */
- public int getHeight(
- ) {
- return this._height;
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Tree ID added for binding tree
- * visualization settings to vamsas document trees in jalview
- * 2.4.1
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'markUnlinked'.
- *
- * @return the value of field 'MarkUnlinked'.
- */
- public boolean getMarkUnlinked(
- ) {
- return this._markUnlinked;
- }
-
- /**
- * Returns the value of field 'newick'.
- *
- * @return the value of field 'Newick'.
- */
- public java.lang.String getNewick(
- ) {
- return this._newick;
- }
-
- /**
- * Returns the value of field 'showBootstrap'.
- *
- * @return the value of field 'ShowBootstrap'.
- */
- public boolean getShowBootstrap(
- ) {
- return this._showBootstrap;
- }
-
- /**
- * Returns the value of field 'showDistances'.
- *
- * @return the value of field 'ShowDistances'.
- */
- public boolean getShowDistances(
- ) {
- return this._showDistances;
- }
-
- /**
- * Returns the value of field 'threshold'.
- *
- * @return the value of field 'Threshold'.
- */
- public float getThreshold(
- ) {
- return this._threshold;
- }
-
- /**
- * Returns the value of field 'title'.
- *
- * @return the value of field 'Title'.
- */
- public java.lang.String getTitle(
- ) {
- return this._title;
- }
-
- /**
- * Returns the value of field 'width'.
- *
- * @return the value of field 'Width'.
- */
- public int getWidth(
- ) {
- return this._width;
- }
-
- /**
- * Returns the value of field 'xpos'.
- *
- * @return the value of field 'Xpos'.
- */
- public int getXpos(
- ) {
- return this._xpos;
- }
-
- /**
- * Returns the value of field 'ypos'.
- *
- * @return the value of field 'Ypos'.
- */
- public int getYpos(
- ) {
- return this._ypos;
- }
-
- /**
- * Method hasCurrentTree.
- *
- * @return true if at least one CurrentTree has been added
- */
- public boolean hasCurrentTree(
- ) {
- return this._has_currentTree;
- }
-
- /**
- * Method hasFitToWindow.
- *
- * @return true if at least one FitToWindow has been added
- */
- public boolean hasFitToWindow(
- ) {
- return this._has_fitToWindow;
- }
-
- /**
- * Method hasFontSize.
- *
- * @return true if at least one FontSize has been added
- */
- public boolean hasFontSize(
- ) {
- return this._has_fontSize;
- }
-
- /**
- * Method hasFontStyle.
- *
- * @return true if at least one FontStyle has been added
- */
- public boolean hasFontStyle(
- ) {
- return this._has_fontStyle;
- }
-
- /**
- * Method hasHeight.
- *
- * @return true if at least one Height has been added
- */
- public boolean hasHeight(
- ) {
- return this._has_height;
- }
-
- /**
- * Method hasMarkUnlinked.
- *
- * @return true if at least one MarkUnlinked has been added
- */
- public boolean hasMarkUnlinked(
- ) {
- return this._has_markUnlinked;
- }
-
- /**
- * Method hasShowBootstrap.
- *
- * @return true if at least one ShowBootstrap has been added
- */
- public boolean hasShowBootstrap(
- ) {
- return this._has_showBootstrap;
- }
-
- /**
- * Method hasShowDistances.
- *
- * @return true if at least one ShowDistances has been added
- */
- public boolean hasShowDistances(
- ) {
- return this._has_showDistances;
- }
-
- /**
- * Method hasThreshold.
- *
- * @return true if at least one Threshold has been added
- */
- public boolean hasThreshold(
- ) {
- return this._has_threshold;
- }
-
- /**
- * Method hasWidth.
- *
- * @return true if at least one Width has been added
- */
- public boolean hasWidth(
- ) {
- return this._has_width;
- }
-
- /**
- * Method hasXpos.
- *
- * @return true if at least one Xpos has been added
- */
- public boolean hasXpos(
- ) {
- return this._has_xpos;
- }
-
- /**
- * Method hasYpos.
- *
- * @return true if at least one Ypos has been added
- */
- public boolean hasYpos(
- ) {
- return this._has_ypos;
- }
-
- /**
- * Returns the value of field 'currentTree'.
- *
- * @return the value of field 'CurrentTree'.
- */
- public boolean isCurrentTree(
- ) {
- return this._currentTree;
- }
-
- /**
- * Returns the value of field 'fitToWindow'.
- *
- * @return the value of field 'FitToWindow'.
- */
- public boolean isFitToWindow(
- ) {
- return this._fitToWindow;
- }
-
- /**
- * Returns the value of field 'markUnlinked'.
- *
- * @return the value of field 'MarkUnlinked'.
- */
- public boolean isMarkUnlinked(
- ) {
- return this._markUnlinked;
- }
-
- /**
- * Returns the value of field 'showBootstrap'.
- *
- * @return the value of field 'ShowBootstrap'.
- */
- public boolean isShowBootstrap(
- ) {
- return this._showBootstrap;
- }
-
- /**
- * Returns the value of field 'showDistances'.
- *
- * @return the value of field 'ShowDistances'.
- */
- public boolean isShowDistances(
- ) {
- return this._showDistances;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'currentTree'.
- *
- * @param currentTree the value of field 'currentTree'.
- */
- public void setCurrentTree(
- final boolean currentTree) {
- this._currentTree = currentTree;
- this._has_currentTree = true;
- }
-
- /**
- * Sets the value of field 'fitToWindow'.
- *
- * @param fitToWindow the value of field 'fitToWindow'.
- */
- public void setFitToWindow(
- final boolean fitToWindow) {
- this._fitToWindow = fitToWindow;
- this._has_fitToWindow = true;
- }
-
- /**
- * Sets the value of field 'fontName'.
- *
- * @param fontName the value of field 'fontName'.
- */
- public void setFontName(
- final java.lang.String fontName) {
- this._fontName = fontName;
- }
-
- /**
- * Sets the value of field 'fontSize'.
- *
- * @param fontSize the value of field 'fontSize'.
- */
- public void setFontSize(
- final int fontSize) {
- this._fontSize = fontSize;
- this._has_fontSize = true;
- }
-
- /**
- * Sets the value of field 'fontStyle'.
- *
- * @param fontStyle the value of field 'fontStyle'.
- */
- public void setFontStyle(
- final int fontStyle) {
- this._fontStyle = fontStyle;
- this._has_fontStyle = true;
- }
-
- /**
- * Sets the value of field 'height'.
- *
- * @param height the value of field 'height'.
- */
- public void setHeight(
- final int height) {
- this._height = height;
- this._has_height = true;
- }
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Tree ID added for binding tree
- * visualization settings to vamsas document trees in jalview
- * 2.4.1
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'markUnlinked'.
- *
- * @param markUnlinked the value of field 'markUnlinked'.
- */
- public void setMarkUnlinked(
- final boolean markUnlinked) {
- this._markUnlinked = markUnlinked;
- this._has_markUnlinked = true;
- }
-
- /**
- * Sets the value of field 'newick'.
- *
- * @param newick the value of field 'newick'.
- */
- public void setNewick(
- final java.lang.String newick) {
- this._newick = newick;
- }
-
- /**
- * Sets the value of field 'showBootstrap'.
- *
- * @param showBootstrap the value of field 'showBootstrap'.
- */
- public void setShowBootstrap(
- final boolean showBootstrap) {
- this._showBootstrap = showBootstrap;
- this._has_showBootstrap = true;
- }
-
- /**
- * Sets the value of field 'showDistances'.
- *
- * @param showDistances the value of field 'showDistances'.
- */
- public void setShowDistances(
- final boolean showDistances) {
- this._showDistances = showDistances;
- this._has_showDistances = true;
- }
-
- /**
- * Sets the value of field 'threshold'.
- *
- * @param threshold the value of field 'threshold'.
- */
- public void setThreshold(
- final float threshold) {
- this._threshold = threshold;
- this._has_threshold = true;
- }
-
- /**
- * Sets the value of field 'title'.
- *
- * @param title the value of field 'title'.
- */
- public void setTitle(
- final java.lang.String title) {
- this._title = title;
- }
-
- /**
- * Sets the value of field 'width'.
- *
- * @param width the value of field 'width'.
- */
- public void setWidth(
- final int width) {
- this._width = width;
- this._has_width = true;
- }
-
- /**
- * Sets the value of field 'xpos'.
- *
- * @param xpos the value of field 'xpos'.
- */
- public void setXpos(
- final int xpos) {
- this._xpos = xpos;
- this._has_xpos = true;
- }
-
- /**
- * Sets the value of field 'ypos'.
- *
- * @param ypos the value of field 'ypos'.
- */
- public void setYpos(
- final int ypos) {
- this._ypos = ypos;
- this._has_ypos = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.Tree
- */
- public static jalview.schemabinding.version2.Tree unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Tree) Unmarshaller.unmarshal(jalview.schemabinding.version2.Tree.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class Tree implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _fontName.
+ */
+ private java.lang.String _fontName;
+
+ /**
+ * Field _fontSize.
+ */
+ private int _fontSize;
+
+ /**
+ * keeps track of state for field: _fontSize
+ */
+ private boolean _has_fontSize;
+
+ /**
+ * Field _fontStyle.
+ */
+ private int _fontStyle;
+
+ /**
+ * keeps track of state for field: _fontStyle
+ */
+ private boolean _has_fontStyle;
+
+ /**
+ * Field _threshold.
+ */
+ private float _threshold;
+
+ /**
+ * keeps track of state for field: _threshold
+ */
+ private boolean _has_threshold;
+
+ /**
+ * Field _showBootstrap.
+ */
+ private boolean _showBootstrap;
+
+ /**
+ * keeps track of state for field: _showBootstrap
+ */
+ private boolean _has_showBootstrap;
+
+ /**
+ * Field _showDistances.
+ */
+ private boolean _showDistances;
+
+ /**
+ * keeps track of state for field: _showDistances
+ */
+ private boolean _has_showDistances;
+
+ /**
+ * Field _markUnlinked.
+ */
+ private boolean _markUnlinked;
+
+ /**
+ * keeps track of state for field: _markUnlinked
+ */
+ private boolean _has_markUnlinked;
+
+ /**
+ * Field _fitToWindow.
+ */
+ private boolean _fitToWindow;
+
+ /**
+ * keeps track of state for field: _fitToWindow
+ */
+ private boolean _has_fitToWindow;
+
+ /**
+ * Field _currentTree.
+ */
+ private boolean _currentTree;
+
+ /**
+ * keeps track of state for field: _currentTree
+ */
+ private boolean _has_currentTree;
+
+ /**
+ * Tree ID added for binding tree visualization settings to vamsas document
+ * trees in jalview 2.4.1
+ *
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _width.
+ */
+ private int _width;
+
+ /**
+ * keeps track of state for field: _width
+ */
+ private boolean _has_width;
+
+ /**
+ * Field _height.
+ */
+ private int _height;
+
+ /**
+ * keeps track of state for field: _height
+ */
+ private boolean _has_height;
+
+ /**
+ * Field _xpos.
+ */
+ private int _xpos;
+
+ /**
+ * keeps track of state for field: _xpos
+ */
+ private boolean _has_xpos;
+
+ /**
+ * Field _ypos.
+ */
+ private int _ypos;
+
+ /**
+ * keeps track of state for field: _ypos
+ */
+ private boolean _has_ypos;
+
+ /**
+ * Field _title.
+ */
+ private java.lang.String _title;
+
+ /**
+ * Field _newick.
+ */
+ private java.lang.String _newick;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Tree()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ */
+ public void deleteCurrentTree()
+ {
+ this._has_currentTree = false;
+ }
+
+ /**
+ */
+ public void deleteFitToWindow()
+ {
+ this._has_fitToWindow = false;
+ }
+
+ /**
+ */
+ public void deleteFontSize()
+ {
+ this._has_fontSize = false;
+ }
+
+ /**
+ */
+ public void deleteFontStyle()
+ {
+ this._has_fontStyle = false;
+ }
+
+ /**
+ */
+ public void deleteHeight()
+ {
+ this._has_height = false;
+ }
+
+ /**
+ */
+ public void deleteMarkUnlinked()
+ {
+ this._has_markUnlinked = false;
+ }
+
+ /**
+ */
+ public void deleteShowBootstrap()
+ {
+ this._has_showBootstrap = false;
+ }
+
+ /**
+ */
+ public void deleteShowDistances()
+ {
+ this._has_showDistances = false;
+ }
+
+ /**
+ */
+ public void deleteThreshold()
+ {
+ this._has_threshold = false;
+ }
+
+ /**
+ */
+ public void deleteWidth()
+ {
+ this._has_width = false;
+ }
+
+ /**
+ */
+ public void deleteXpos()
+ {
+ this._has_xpos = false;
+ }
+
+ /**
+ */
+ public void deleteYpos()
+ {
+ this._has_ypos = false;
+ }
+
+ /**
+ * Returns the value of field 'currentTree'.
+ *
+ * @return the value of field 'CurrentTree'.
+ */
+ public boolean getCurrentTree()
+ {
+ return this._currentTree;
+ }
+
+ /**
+ * Returns the value of field 'fitToWindow'.
+ *
+ * @return the value of field 'FitToWindow'.
+ */
+ public boolean getFitToWindow()
+ {
+ return this._fitToWindow;
+ }
+
+ /**
+ * Returns the value of field 'fontName'.
+ *
+ * @return the value of field 'FontName'.
+ */
+ public java.lang.String getFontName()
+ {
+ return this._fontName;
+ }
+
+ /**
+ * Returns the value of field 'fontSize'.
+ *
+ * @return the value of field 'FontSize'.
+ */
+ public int getFontSize()
+ {
+ return this._fontSize;
+ }
+
+ /**
+ * Returns the value of field 'fontStyle'.
+ *
+ * @return the value of field 'FontStyle'.
+ */
+ public int getFontStyle()
+ {
+ return this._fontStyle;
+ }
+
+ /**
+ * Returns the value of field 'height'.
+ *
+ * @return the value of field 'Height'.
+ */
+ public int getHeight()
+ {
+ return this._height;
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Tree ID added for binding tree visualization settings to
+ * vamsas document trees in jalview 2.4.1
+ *
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'markUnlinked'.
+ *
+ * @return the value of field 'MarkUnlinked'.
+ */
+ public boolean getMarkUnlinked()
+ {
+ return this._markUnlinked;
+ }
+
+ /**
+ * Returns the value of field 'newick'.
+ *
+ * @return the value of field 'Newick'.
+ */
+ public java.lang.String getNewick()
+ {
+ return this._newick;
+ }
+
+ /**
+ * Returns the value of field 'showBootstrap'.
+ *
+ * @return the value of field 'ShowBootstrap'.
+ */
+ public boolean getShowBootstrap()
+ {
+ return this._showBootstrap;
+ }
+
+ /**
+ * Returns the value of field 'showDistances'.
+ *
+ * @return the value of field 'ShowDistances'.
+ */
+ public boolean getShowDistances()
+ {
+ return this._showDistances;
+ }
+
+ /**
+ * Returns the value of field 'threshold'.
+ *
+ * @return the value of field 'Threshold'.
+ */
+ public float getThreshold()
+ {
+ return this._threshold;
+ }
+
+ /**
+ * Returns the value of field 'title'.
+ *
+ * @return the value of field 'Title'.
+ */
+ public java.lang.String getTitle()
+ {
+ return this._title;
+ }
+
+ /**
+ * Returns the value of field 'width'.
+ *
+ * @return the value of field 'Width'.
+ */
+ public int getWidth()
+ {
+ return this._width;
+ }
+
+ /**
+ * Returns the value of field 'xpos'.
+ *
+ * @return the value of field 'Xpos'.
+ */
+ public int getXpos()
+ {
+ return this._xpos;
+ }
+
+ /**
+ * Returns the value of field 'ypos'.
+ *
+ * @return the value of field 'Ypos'.
+ */
+ public int getYpos()
+ {
+ return this._ypos;
+ }
+
+ /**
+ * Method hasCurrentTree.
+ *
+ * @return true if at least one CurrentTree has been added
+ */
+ public boolean hasCurrentTree()
+ {
+ return this._has_currentTree;
+ }
+
+ /**
+ * Method hasFitToWindow.
+ *
+ * @return true if at least one FitToWindow has been added
+ */
+ public boolean hasFitToWindow()
+ {
+ return this._has_fitToWindow;
+ }
+
+ /**
+ * Method hasFontSize.
+ *
+ * @return true if at least one FontSize has been added
+ */
+ public boolean hasFontSize()
+ {
+ return this._has_fontSize;
+ }
+
+ /**
+ * Method hasFontStyle.
+ *
+ * @return true if at least one FontStyle has been added
+ */
+ public boolean hasFontStyle()
+ {
+ return this._has_fontStyle;
+ }
+
+ /**
+ * Method hasHeight.
+ *
+ * @return true if at least one Height has been added
+ */
+ public boolean hasHeight()
+ {
+ return this._has_height;
+ }
+
+ /**
+ * Method hasMarkUnlinked.
+ *
+ * @return true if at least one MarkUnlinked has been added
+ */
+ public boolean hasMarkUnlinked()
+ {
+ return this._has_markUnlinked;
+ }
+
+ /**
+ * Method hasShowBootstrap.
+ *
+ * @return true if at least one ShowBootstrap has been added
+ */
+ public boolean hasShowBootstrap()
+ {
+ return this._has_showBootstrap;
+ }
+
+ /**
+ * Method hasShowDistances.
+ *
+ * @return true if at least one ShowDistances has been added
+ */
+ public boolean hasShowDistances()
+ {
+ return this._has_showDistances;
+ }
+
+ /**
+ * Method hasThreshold.
+ *
+ * @return true if at least one Threshold has been added
+ */
+ public boolean hasThreshold()
+ {
+ return this._has_threshold;
+ }
+
+ /**
+ * Method hasWidth.
+ *
+ * @return true if at least one Width has been added
+ */
+ public boolean hasWidth()
+ {
+ return this._has_width;
+ }
+
+ /**
+ * Method hasXpos.
+ *
+ * @return true if at least one Xpos has been added
+ */
+ public boolean hasXpos()
+ {
+ return this._has_xpos;
+ }
+
+ /**
+ * Method hasYpos.
+ *
+ * @return true if at least one Ypos has been added
+ */
+ public boolean hasYpos()
+ {
+ return this._has_ypos;
+ }
+
+ /**
+ * Returns the value of field 'currentTree'.
+ *
+ * @return the value of field 'CurrentTree'.
+ */
+ public boolean isCurrentTree()
+ {
+ return this._currentTree;
+ }
+
+ /**
+ * Returns the value of field 'fitToWindow'.
+ *
+ * @return the value of field 'FitToWindow'.
+ */
+ public boolean isFitToWindow()
+ {
+ return this._fitToWindow;
+ }
+
+ /**
+ * Returns the value of field 'markUnlinked'.
+ *
+ * @return the value of field 'MarkUnlinked'.
+ */
+ public boolean isMarkUnlinked()
+ {
+ return this._markUnlinked;
+ }
+
+ /**
+ * Returns the value of field 'showBootstrap'.
+ *
+ * @return the value of field 'ShowBootstrap'.
+ */
+ public boolean isShowBootstrap()
+ {
+ return this._showBootstrap;
+ }
+
+ /**
+ * Returns the value of field 'showDistances'.
+ *
+ * @return the value of field 'ShowDistances'.
+ */
+ public boolean isShowDistances()
+ {
+ return this._showDistances;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'currentTree'.
+ *
+ * @param currentTree
+ * the value of field 'currentTree'.
+ */
+ public void setCurrentTree(final boolean currentTree)
+ {
+ this._currentTree = currentTree;
+ this._has_currentTree = true;
+ }
+
+ /**
+ * Sets the value of field 'fitToWindow'.
+ *
+ * @param fitToWindow
+ * the value of field 'fitToWindow'.
+ */
+ public void setFitToWindow(final boolean fitToWindow)
+ {
+ this._fitToWindow = fitToWindow;
+ this._has_fitToWindow = true;
+ }
+
+ /**
+ * Sets the value of field 'fontName'.
+ *
+ * @param fontName
+ * the value of field 'fontName'.
+ */
+ public void setFontName(final java.lang.String fontName)
+ {
+ this._fontName = fontName;
+ }
+
+ /**
+ * Sets the value of field 'fontSize'.
+ *
+ * @param fontSize
+ * the value of field 'fontSize'.
+ */
+ public void setFontSize(final int fontSize)
+ {
+ this._fontSize = fontSize;
+ this._has_fontSize = true;
+ }
+
+ /**
+ * Sets the value of field 'fontStyle'.
+ *
+ * @param fontStyle
+ * the value of field 'fontStyle'.
+ */
+ public void setFontStyle(final int fontStyle)
+ {
+ this._fontStyle = fontStyle;
+ this._has_fontStyle = true;
+ }
+
+ /**
+ * Sets the value of field 'height'.
+ *
+ * @param height
+ * the value of field 'height'.
+ */
+ public void setHeight(final int height)
+ {
+ this._height = height;
+ this._has_height = true;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Tree ID added for binding tree visualization settings to vamsas document
+ * trees in jalview 2.4.1
+ *
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'markUnlinked'.
+ *
+ * @param markUnlinked
+ * the value of field 'markUnlinked'.
+ */
+ public void setMarkUnlinked(final boolean markUnlinked)
+ {
+ this._markUnlinked = markUnlinked;
+ this._has_markUnlinked = true;
+ }
+
+ /**
+ * Sets the value of field 'newick'.
+ *
+ * @param newick
+ * the value of field 'newick'.
+ */
+ public void setNewick(final java.lang.String newick)
+ {
+ this._newick = newick;
+ }
+
+ /**
+ * Sets the value of field 'showBootstrap'.
+ *
+ * @param showBootstrap
+ * the value of field 'showBootstrap'.
+ */
+ public void setShowBootstrap(final boolean showBootstrap)
+ {
+ this._showBootstrap = showBootstrap;
+ this._has_showBootstrap = true;
+ }
+
+ /**
+ * Sets the value of field 'showDistances'.
+ *
+ * @param showDistances
+ * the value of field 'showDistances'.
+ */
+ public void setShowDistances(final boolean showDistances)
+ {
+ this._showDistances = showDistances;
+ this._has_showDistances = true;
+ }
+
+ /**
+ * Sets the value of field 'threshold'.
+ *
+ * @param threshold
+ * the value of field 'threshold'.
+ */
+ public void setThreshold(final float threshold)
+ {
+ this._threshold = threshold;
+ this._has_threshold = true;
+ }
+
+ /**
+ * Sets the value of field 'title'.
+ *
+ * @param title
+ * the value of field 'title'.
+ */
+ public void setTitle(final java.lang.String title)
+ {
+ this._title = title;
+ }
+
+ /**
+ * Sets the value of field 'width'.
+ *
+ * @param width
+ * the value of field 'width'.
+ */
+ public void setWidth(final int width)
+ {
+ this._width = width;
+ this._has_width = true;
+ }
+
+ /**
+ * Sets the value of field 'xpos'.
+ *
+ * @param xpos
+ * the value of field 'xpos'.
+ */
+ public void setXpos(final int xpos)
+ {
+ this._xpos = xpos;
+ this._has_xpos = true;
+ }
+
+ /**
+ * Sets the value of field 'ypos'.
+ *
+ * @param ypos
+ * the value of field 'ypos'.
+ */
+ public void setYpos(final int ypos)
+ {
+ this._ypos = ypos;
+ this._has_ypos = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Tree
+ */
+ public static jalview.schemabinding.version2.Tree unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Tree) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.Tree.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/UserColourScheme.java b/src/jalview/schemabinding/version2/UserColourScheme.java
index b8c7608..e4983bd 100644
--- a/src/jalview/schemabinding/version2/UserColourScheme.java
+++ b/src/jalview/schemabinding/version2/UserColourScheme.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,99 +19,109 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class UserColourScheme extends JalviewUserColours
-implements java.io.Serializable
+public class UserColourScheme extends JalviewUserColours implements
+ java.io.Serializable
{
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
-
- public UserColourScheme() {
- super();
- }
-
+ public UserColourScheme()
+ {
+ super();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.JalviewUserColours
- */
- public static jalview.schemabinding.version2.JalviewUserColours unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.JalviewUserColours) Unmarshaller.unmarshal(jalview.schemabinding.version2.UserColourScheme.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.JalviewUserColours
+ */
+ public static jalview.schemabinding.version2.JalviewUserColours unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.JalviewUserColours) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.UserColourScheme.class,
+ reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/UserColours.java b/src/jalview/schemabinding/version2/UserColours.java
index 0a0753e..b02d0cd 100644
--- a/src/jalview/schemabinding/version2/UserColours.java
+++ b/src/jalview/schemabinding/version2/UserColours.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,152 +19,164 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class UserColours implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _id.
- */
- private java.lang.String _id;
-
- /**
- * Field _userColourScheme.
- */
- private jalview.schemabinding.version2.UserColourScheme _userColourScheme;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public UserColours() {
- super();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'userColourScheme'.
- *
- * @return the value of field 'UserColourScheme'.
- */
- public jalview.schemabinding.version2.UserColourScheme getUserColourScheme(
- ) {
- return this._userColourScheme;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'userColourScheme'.
- *
- * @param userColourScheme the value of field 'userColourScheme'
- */
- public void setUserColourScheme(
- final jalview.schemabinding.version2.UserColourScheme userColourScheme) {
- this._userColourScheme = userColourScheme;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.UserColours
- */
- public static jalview.schemabinding.version2.UserColours unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.UserColours) Unmarshaller.unmarshal(jalview.schemabinding.version2.UserColours.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+public class UserColours implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _id.
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _userColourScheme.
+ */
+ private jalview.schemabinding.version2.UserColourScheme _userColourScheme;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public UserColours()
+ {
+ super();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'userColourScheme'.
+ *
+ * @return the value of field 'UserColourScheme'.
+ */
+ public jalview.schemabinding.version2.UserColourScheme getUserColourScheme()
+ {
+ return this._userColourScheme;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'userColourScheme'.
+ *
+ * @param userColourScheme
+ * the value of field 'userColourScheme'
+ */
+ public void setUserColourScheme(
+ final jalview.schemabinding.version2.UserColourScheme userColourScheme)
+ {
+ this._userColourScheme = userColourScheme;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.UserColours
+ */
+ public static jalview.schemabinding.version2.UserColours unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.UserColours) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.UserColours.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/VAMSAS.java b/src/jalview/schemabinding/version2/VAMSAS.java
index 3bb565f..d025824 100644
--- a/src/jalview/schemabinding/version2/VAMSAS.java
+++ b/src/jalview/schemabinding/version2/VAMSAS.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,411 +19,436 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class VAMSAS implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _treeList.
- */
- private java.util.Vector _treeList;
-
- /**
- * Field _sequenceSetList.
- */
- private java.util.Vector _sequenceSetList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public VAMSAS() {
- super();
- this._treeList = new java.util.Vector();
- this._sequenceSetList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vSequenceSet
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequenceSet(
- final jalview.schemabinding.version2.SequenceSet vSequenceSet)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceSetList.addElement(vSequenceSet);
- }
-
- /**
- *
- *
- * @param index
- * @param vSequenceSet
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequenceSet(
- final int index,
- final jalview.schemabinding.version2.SequenceSet vSequenceSet)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceSetList.add(index, vSequenceSet);
- }
-
- /**
- *
- *
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final java.lang.String vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.addElement(vTree);
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final int index,
- final java.lang.String vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.add(index, vTree);
- }
-
- /**
- * Method enumerateSequenceSet.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.SequenceSet elements
- */
- public java.util.Enumeration enumerateSequenceSet(
- ) {
- return this._sequenceSetList.elements();
- }
-
- /**
- * Method enumerateTree.
- *
- * @return an Enumeration over all java.lang.String elements
- */
- public java.util.Enumeration enumerateTree(
- ) {
- return this._treeList.elements();
- }
-
- /**
- * Method getSequenceSet.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.SequenceSet at the given index
- */
- public jalview.schemabinding.version2.SequenceSet getSequenceSet(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceSetList.size()) {
- throw new IndexOutOfBoundsException("getSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.SequenceSet) _sequenceSetList.get(index);
- }
-
- /**
- * Method getSequenceSet.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.SequenceSet[] getSequenceSet(
- ) {
- jalview.schemabinding.version2.SequenceSet[] array = new jalview.schemabinding.version2.SequenceSet[0];
- return (jalview.schemabinding.version2.SequenceSet[]) this._sequenceSetList.toArray(array);
- }
-
- /**
- * Method getSequenceSetCount.
- *
- * @return the size of this collection
- */
- public int getSequenceSetCount(
- ) {
- return this._sequenceSetList.size();
- }
-
- /**
- * Method getTree.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the java.lang.String at the given index
- */
- public java.lang.String getTree(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- return (java.lang.String) _treeList.get(index);
- }
-
- /**
- * Method getTree.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public java.lang.String[] getTree(
- ) {
- java.lang.String[] array = new java.lang.String[0];
- return (java.lang.String[]) this._treeList.toArray(array);
- }
-
- /**
- * Method getTreeCount.
- *
- * @return the size of this collection
- */
- public int getTreeCount(
- ) {
- return this._treeList.size();
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllSequenceSet(
- ) {
- this._sequenceSetList.clear();
+public class VAMSAS implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _treeList.
+ */
+ private java.util.Vector _treeList;
+
+ /**
+ * Field _sequenceSetList.
+ */
+ private java.util.Vector _sequenceSetList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public VAMSAS()
+ {
+ super();
+ this._treeList = new java.util.Vector();
+ this._sequenceSetList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vSequenceSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequenceSet(
+ final jalview.schemabinding.version2.SequenceSet vSequenceSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceSetList.addElement(vSequenceSet);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequenceSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequenceSet(final int index,
+ final jalview.schemabinding.version2.SequenceSet vSequenceSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._sequenceSetList.add(index, vSequenceSet);
+ }
+
+ /**
+ *
+ *
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final java.lang.String vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._treeList.addElement(vTree);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final int index, final java.lang.String vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._treeList.add(index, vTree);
+ }
+
+ /**
+ * Method enumerateSequenceSet.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.SequenceSet
+ * elements
+ */
+ public java.util.Enumeration enumerateSequenceSet()
+ {
+ return this._sequenceSetList.elements();
+ }
+
+ /**
+ * Method enumerateTree.
+ *
+ * @return an Enumeration over all java.lang.String elements
+ */
+ public java.util.Enumeration enumerateTree()
+ {
+ return this._treeList.elements();
+ }
+
+ /**
+ * Method getSequenceSet.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.SequenceSet at the
+ * given index
+ */
+ public jalview.schemabinding.version2.SequenceSet getSequenceSet(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceSetList.size())
+ {
+ throw new IndexOutOfBoundsException("getSequenceSet: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceSetList.size() - 1) + "]");
}
- /**
- */
- public void removeAllTree(
- ) {
- this._treeList.clear();
- }
-
- /**
- * Method removeSequenceSet.
- *
- * @param vSequenceSet
- * @return true if the object was removed from the collection.
- */
- public boolean removeSequenceSet(
- final jalview.schemabinding.version2.SequenceSet vSequenceSet) {
- boolean removed = _sequenceSetList.remove(vSequenceSet);
- return removed;
- }
-
- /**
- * Method removeSequenceSetAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.SequenceSet removeSequenceSetAt(
- final int index) {
- java.lang.Object obj = this._sequenceSetList.remove(index);
- return (jalview.schemabinding.version2.SequenceSet) obj;
- }
-
- /**
- * Method removeTree.
- *
- * @param vTree
- * @return true if the object was removed from the collection.
- */
- public boolean removeTree(
- final java.lang.String vTree) {
- boolean removed = _treeList.remove(vTree);
- return removed;
+ return (jalview.schemabinding.version2.SequenceSet) _sequenceSetList
+ .get(index);
+ }
+
+ /**
+ * Method getSequenceSet.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.SequenceSet[] getSequenceSet()
+ {
+ jalview.schemabinding.version2.SequenceSet[] array = new jalview.schemabinding.version2.SequenceSet[0];
+ return (jalview.schemabinding.version2.SequenceSet[]) this._sequenceSetList
+ .toArray(array);
+ }
+
+ /**
+ * Method getSequenceSetCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSequenceSetCount()
+ {
+ return this._sequenceSetList.size();
+ }
+
+ /**
+ * Method getTree.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the java.lang.String at the given index
+ */
+ public java.lang.String getTree(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size())
+ {
+ throw new IndexOutOfBoundsException("getTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
}
- /**
- * Method removeTreeAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public java.lang.String removeTreeAt(
- final int index) {
- java.lang.Object obj = this._treeList.remove(index);
- return (java.lang.String) obj;
+ return (java.lang.String) _treeList.get(index);
+ }
+
+ /**
+ * Method getTree.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public java.lang.String[] getTree()
+ {
+ java.lang.String[] array = new java.lang.String[0];
+ return (java.lang.String[]) this._treeList.toArray(array);
+ }
+
+ /**
+ * Method getTreeCount.
+ *
+ * @return the size of this collection
+ */
+ public int getTreeCount()
+ {
+ return this._treeList.size();
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- *
- *
- * @param index
- * @param vSequenceSet
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSequenceSet(
- final int index,
- final jalview.schemabinding.version2.SequenceSet vSequenceSet)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceSetList.size()) {
- throw new IndexOutOfBoundsException("setSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]");
- }
-
- this._sequenceSetList.set(index, vSequenceSet);
- }
-
- /**
- *
- *
- * @param vSequenceSetArray
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public void setSequenceSet(
- final jalview.schemabinding.version2.SequenceSet[] vSequenceSetArray) {
- //-- copy array
- _sequenceSetList.clear();
-
- for (int i = 0; i < vSequenceSetArray.length; i++) {
- this._sequenceSetList.add(vSequenceSetArray[i]);
- }
- }
+ public void removeAllSequenceSet()
+ {
+ this._sequenceSetList.clear();
+ }
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
+ /**
*/
- public void setTree(
- final int index,
- final java.lang.String vTree)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- this._treeList.set(index, vTree);
+ public void removeAllTree()
+ {
+ this._treeList.clear();
+ }
+
+ /**
+ * Method removeSequenceSet.
+ *
+ * @param vSequenceSet
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSequenceSet(
+ final jalview.schemabinding.version2.SequenceSet vSequenceSet)
+ {
+ boolean removed = _sequenceSetList.remove(vSequenceSet);
+ return removed;
+ }
+
+ /**
+ * Method removeSequenceSetAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.SequenceSet removeSequenceSetAt(
+ final int index)
+ {
+ java.lang.Object obj = this._sequenceSetList.remove(index);
+ return (jalview.schemabinding.version2.SequenceSet) obj;
+ }
+
+ /**
+ * Method removeTree.
+ *
+ * @param vTree
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeTree(final java.lang.String vTree)
+ {
+ boolean removed = _treeList.remove(vTree);
+ return removed;
+ }
+
+ /**
+ * Method removeTreeAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public java.lang.String removeTreeAt(final int index)
+ {
+ java.lang.Object obj = this._treeList.remove(index);
+ return (java.lang.String) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequenceSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSequenceSet(final int index,
+ final jalview.schemabinding.version2.SequenceSet vSequenceSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceSetList.size())
+ {
+ throw new IndexOutOfBoundsException("setSequenceSet: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceSetList.size() - 1) + "]");
}
- /**
- *
- *
- * @param vTreeArray
- */
- public void setTree(
- final java.lang.String[] vTreeArray) {
- //-- copy array
- _treeList.clear();
-
- for (int i = 0; i < vTreeArray.length; i++) {
- this._treeList.add(vTreeArray[i]);
- }
+ this._sequenceSetList.set(index, vSequenceSet);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceSetArray
+ */
+ public void setSequenceSet(
+ final jalview.schemabinding.version2.SequenceSet[] vSequenceSetArray)
+ {
+ // -- copy array
+ _sequenceSetList.clear();
+
+ for (int i = 0; i < vSequenceSetArray.length; i++)
+ {
+ this._sequenceSetList.add(vSequenceSetArray[i]);
}
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.VAMSAS
- */
- public static jalview.schemabinding.version2.VAMSAS unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(jalview.schemabinding.version2.VAMSAS.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setTree(final int index, final java.lang.String vTree)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size())
+ {
+ throw new IndexOutOfBoundsException("setTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
}
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._treeList.set(index, vTree);
+ }
+
+ /**
+ *
+ *
+ * @param vTreeArray
+ */
+ public void setTree(final java.lang.String[] vTreeArray)
+ {
+ // -- copy array
+ _treeList.clear();
+
+ for (int i = 0; i < vTreeArray.length; i++)
+ {
+ this._treeList.add(vTreeArray[i]);
}
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.VAMSAS
+ */
+ public static jalview.schemabinding.version2.VAMSAS unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.VAMSAS.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/VamsasModel.java b/src/jalview/schemabinding/version2/VamsasModel.java
index 2b1499f..d3fe796 100644
--- a/src/jalview/schemabinding/version2/VamsasModel.java
+++ b/src/jalview/schemabinding/version2/VamsasModel.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,98 +19,106 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class VamsasModel extends VAMSAS
-implements java.io.Serializable
+public class VamsasModel extends VAMSAS implements java.io.Serializable
{
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
-
- public VamsasModel() {
- super();
- }
-
+ public VamsasModel()
+ {
+ super();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
+ return true;
+ }
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.VAMSAS
- */
- public static jalview.schemabinding.version2.VAMSAS unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(jalview.schemabinding.version2.VamsasModel.class, reader);
- }
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.VAMSAS
+ */
+ public static jalview.schemabinding.version2.VAMSAS unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.VamsasModel.class, reader);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/Viewport.java b/src/jalview/schemabinding/version2/Viewport.java
index 0db130f..159f7ae 100644
--- a/src/jalview/schemabinding/version2/Viewport.java
+++ b/src/jalview/schemabinding/version2/Viewport.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,2416 +19,2785 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class Viewport implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _conservationSelected.
- */
- private boolean _conservationSelected;
-
- /**
- * keeps track of state for field: _conservationSelected
- */
- private boolean _has_conservationSelected;
-
- /**
- * Field _pidSelected.
- */
- private boolean _pidSelected;
-
- /**
- * keeps track of state for field: _pidSelected
- */
- private boolean _has_pidSelected;
-
- /**
- * Field _bgColour.
- */
- private java.lang.String _bgColour;
-
- /**
- * Field _consThreshold.
- */
- private int _consThreshold;
-
- /**
- * keeps track of state for field: _consThreshold
- */
- private boolean _has_consThreshold;
-
- /**
- * Field _pidThreshold.
- */
- private int _pidThreshold;
-
- /**
- * keeps track of state for field: _pidThreshold
- */
- private boolean _has_pidThreshold;
-
- /**
- * Field _title.
- */
- private java.lang.String _title;
-
- /**
- * Field _showFullId.
- */
- private boolean _showFullId;
-
- /**
- * keeps track of state for field: _showFullId
- */
- private boolean _has_showFullId;
-
- /**
- * Field _rightAlignIds.
- */
- private boolean _rightAlignIds;
-
- /**
- * keeps track of state for field: _rightAlignIds
- */
- private boolean _has_rightAlignIds;
-
- /**
- * Field _showText.
- */
- private boolean _showText;
-
- /**
- * keeps track of state for field: _showText
- */
- private boolean _has_showText;
-
- /**
- * Field _showColourText.
- */
- private boolean _showColourText;
-
- /**
- * keeps track of state for field: _showColourText
- */
- private boolean _has_showColourText;
-
- /**
- * Field _showUnconserved.
- */
- private boolean _showUnconserved = false;
-
- /**
- * keeps track of state for field: _showUnconserved
- */
- private boolean _has_showUnconserved;
-
- /**
- * Field _showBoxes.
- */
- private boolean _showBoxes;
-
- /**
- * keeps track of state for field: _showBoxes
- */
- private boolean _has_showBoxes;
-
- /**
- * Field _wrapAlignment.
- */
- private boolean _wrapAlignment;
-
- /**
- * keeps track of state for field: _wrapAlignment
- */
- private boolean _has_wrapAlignment;
-
- /**
- * Field _renderGaps.
- */
- private boolean _renderGaps;
-
- /**
- * keeps track of state for field: _renderGaps
- */
- private boolean _has_renderGaps;
-
- /**
- * Field _showSequenceFeatures.
- */
- private boolean _showSequenceFeatures;
-
- /**
- * keeps track of state for field: _showSequenceFeatures
- */
- private boolean _has_showSequenceFeatures;
-
- /**
- * Field _showNPfeatureTooltip.
- */
- private boolean _showNPfeatureTooltip;
-
- /**
- * keeps track of state for field: _showNPfeatureTooltip
- */
- private boolean _has_showNPfeatureTooltip;
-
- /**
- * Field _showDbRefTooltip.
- */
- private boolean _showDbRefTooltip;
-
- /**
- * keeps track of state for field: _showDbRefTooltip
- */
- private boolean _has_showDbRefTooltip;
-
- /**
- * Field _followHighlight.
- */
- private boolean _followHighlight = true;
-
- /**
- * keeps track of state for field: _followHighlight
- */
- private boolean _has_followHighlight;
-
- /**
- * Field _followSelection.
- */
- private boolean _followSelection = true;
-
- /**
- * keeps track of state for field: _followSelection
- */
- private boolean _has_followSelection;
-
- /**
- * Field _showAnnotation.
- */
- private boolean _showAnnotation;
-
- /**
- * keeps track of state for field: _showAnnotation
- */
- private boolean _has_showAnnotation;
-
- /**
- * Field _centreColumnLabels.
- */
- private boolean _centreColumnLabels = false;
-
- /**
- * keeps track of state for field: _centreColumnLabels
- */
- private boolean _has_centreColumnLabels;
-
- /**
- * Field _showGroupConservation.
- */
- private boolean _showGroupConservation = false;
-
- /**
- * keeps track of state for field: _showGroupConservation
- */
- private boolean _has_showGroupConservation;
-
- /**
- * Field _showGroupConsensus.
- */
- private boolean _showGroupConsensus = false;
-
- /**
- * keeps track of state for field: _showGroupConsensus
- */
- private boolean _has_showGroupConsensus;
-
- /**
- * Field _showConsensusHistogram.
- */
- private boolean _showConsensusHistogram = true;
-
- /**
- * keeps track of state for field: _showConsensusHistogram
- */
- private boolean _has_showConsensusHistogram;
-
- /**
- * Field _showSequenceLogo.
- */
- private boolean _showSequenceLogo = false;
-
- /**
- * keeps track of state for field: _showSequenceLogo
- */
- private boolean _has_showSequenceLogo;
-
- /**
- * Field _ignoreGapsinConsensus.
- */
- private boolean _ignoreGapsinConsensus = true;
-
- /**
- * keeps track of state for field: _ignoreGapsinConsensus
- */
- private boolean _has_ignoreGapsinConsensus;
-
- /**
- * Field _startRes.
- */
- private int _startRes;
-
- /**
- * keeps track of state for field: _startRes
- */
- private boolean _has_startRes;
-
- /**
- * Field _startSeq.
- */
- private int _startSeq;
-
- /**
- * keeps track of state for field: _startSeq
- */
- private boolean _has_startSeq;
-
- /**
- * Field _fontName.
- */
- private java.lang.String _fontName;
-
- /**
- * Field _fontSize.
- */
- private int _fontSize;
-
- /**
- * keeps track of state for field: _fontSize
- */
- private boolean _has_fontSize;
-
- /**
- * Field _fontStyle.
- */
- private int _fontStyle;
-
- /**
- * keeps track of state for field: _fontStyle
- */
- private boolean _has_fontStyle;
-
- /**
- * Field _viewName.
- */
- private java.lang.String _viewName;
-
- /**
- * Field _sequenceSetId.
- */
- private java.lang.String _sequenceSetId;
-
- /**
- * Field _gatheredViews.
- */
- private boolean _gatheredViews;
-
- /**
- * keeps track of state for field: _gatheredViews
- */
- private boolean _has_gatheredViews;
-
- /**
- * Field _textCol1.
- */
- private int _textCol1;
-
- /**
- * keeps track of state for field: _textCol1
- */
- private boolean _has_textCol1;
-
- /**
- * Field _textCol2.
- */
- private int _textCol2;
-
- /**
- * keeps track of state for field: _textCol2
- */
- private boolean _has_textCol2;
-
- /**
- * Field _textColThreshold.
- */
- private int _textColThreshold;
-
- /**
- * keeps track of state for field: _textColThreshold
- */
- private boolean _has_textColThreshold;
-
- /**
- * unique id used by jalview to synchronize between stored and
- * instantiated views
- *
- */
- private java.lang.String _id;
-
- /**
- * Field _width.
- */
- private int _width;
-
- /**
- * keeps track of state for field: _width
- */
- private boolean _has_width;
-
- /**
- * Field _height.
- */
- private int _height;
-
- /**
- * keeps track of state for field: _height
- */
- private boolean _has_height;
-
- /**
- * Field _xpos.
- */
- private int _xpos;
-
- /**
- * keeps track of state for field: _xpos
- */
- private boolean _has_xpos;
-
- /**
- * Field _ypos.
- */
- private int _ypos;
-
- /**
- * keeps track of state for field: _ypos
- */
- private boolean _has_ypos;
-
- /**
- * Field _annotationColours.
- */
- private jalview.schemabinding.version2.AnnotationColours _annotationColours;
-
- /**
- * Field _hiddenColumnsList.
- */
- private java.util.Vector _hiddenColumnsList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Viewport() {
- super();
- this._hiddenColumnsList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vHiddenColumns
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addHiddenColumns(
- final jalview.schemabinding.version2.HiddenColumns vHiddenColumns)
- throws java.lang.IndexOutOfBoundsException {
- this._hiddenColumnsList.addElement(vHiddenColumns);
- }
-
- /**
- *
- *
- * @param index
- * @param vHiddenColumns
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addHiddenColumns(
- final int index,
- final jalview.schemabinding.version2.HiddenColumns vHiddenColumns)
- throws java.lang.IndexOutOfBoundsException {
- this._hiddenColumnsList.add(index, vHiddenColumns);
- }
-
- /**
- */
- public void deleteCentreColumnLabels(
- ) {
- this._has_centreColumnLabels= false;
- }
-
- /**
- */
- public void deleteConsThreshold(
- ) {
- this._has_consThreshold= false;
- }
-
- /**
- */
- public void deleteConservationSelected(
- ) {
- this._has_conservationSelected= false;
- }
-
- /**
- */
- public void deleteFollowHighlight(
- ) {
- this._has_followHighlight= false;
- }
-
- /**
- */
- public void deleteFollowSelection(
- ) {
- this._has_followSelection= false;
- }
-
- /**
- */
- public void deleteFontSize(
- ) {
- this._has_fontSize= false;
- }
-
- /**
- */
- public void deleteFontStyle(
- ) {
- this._has_fontStyle= false;
- }
-
- /**
- */
- public void deleteGatheredViews(
- ) {
- this._has_gatheredViews= false;
- }
-
- /**
- */
- public void deleteHeight(
- ) {
- this._has_height= false;
- }
-
- /**
- */
- public void deleteIgnoreGapsinConsensus(
- ) {
- this._has_ignoreGapsinConsensus= false;
- }
-
- /**
- */
- public void deletePidSelected(
- ) {
- this._has_pidSelected= false;
- }
-
- /**
- */
- public void deletePidThreshold(
- ) {
- this._has_pidThreshold= false;
- }
-
- /**
- */
- public void deleteRenderGaps(
- ) {
- this._has_renderGaps= false;
- }
-
- /**
- */
- public void deleteRightAlignIds(
- ) {
- this._has_rightAlignIds= false;
- }
-
- /**
- */
- public void deleteShowAnnotation(
- ) {
- this._has_showAnnotation= false;
- }
-
- /**
- */
- public void deleteShowBoxes(
- ) {
- this._has_showBoxes= false;
- }
-
- /**
- */
- public void deleteShowColourText(
- ) {
- this._has_showColourText= false;
- }
-
- /**
- */
- public void deleteShowConsensusHistogram(
- ) {
- this._has_showConsensusHistogram= false;
- }
-
- /**
- */
- public void deleteShowDbRefTooltip(
- ) {
- this._has_showDbRefTooltip= false;
- }
+public class Viewport implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _conservationSelected.
+ */
+ private boolean _conservationSelected;
+
+ /**
+ * keeps track of state for field: _conservationSelected
+ */
+ private boolean _has_conservationSelected;
+
+ /**
+ * Field _pidSelected.
+ */
+ private boolean _pidSelected;
+
+ /**
+ * keeps track of state for field: _pidSelected
+ */
+ private boolean _has_pidSelected;
+
+ /**
+ * Field _bgColour.
+ */
+ private java.lang.String _bgColour;
+
+ /**
+ * Field _consThreshold.
+ */
+ private int _consThreshold;
+
+ /**
+ * keeps track of state for field: _consThreshold
+ */
+ private boolean _has_consThreshold;
+
+ /**
+ * Field _pidThreshold.
+ */
+ private int _pidThreshold;
+
+ /**
+ * keeps track of state for field: _pidThreshold
+ */
+ private boolean _has_pidThreshold;
+
+ /**
+ * Field _title.
+ */
+ private java.lang.String _title;
+
+ /**
+ * Field _showFullId.
+ */
+ private boolean _showFullId;
+
+ /**
+ * keeps track of state for field: _showFullId
+ */
+ private boolean _has_showFullId;
+
+ /**
+ * Field _rightAlignIds.
+ */
+ private boolean _rightAlignIds;
+
+ /**
+ * keeps track of state for field: _rightAlignIds
+ */
+ private boolean _has_rightAlignIds;
+
+ /**
+ * Field _showText.
+ */
+ private boolean _showText;
+
+ /**
+ * keeps track of state for field: _showText
+ */
+ private boolean _has_showText;
+
+ /**
+ * Field _showColourText.
+ */
+ private boolean _showColourText;
+
+ /**
+ * keeps track of state for field: _showColourText
+ */
+ private boolean _has_showColourText;
+
+ /**
+ * Field _showUnconserved.
+ */
+ private boolean _showUnconserved = false;
+
+ /**
+ * keeps track of state for field: _showUnconserved
+ */
+ private boolean _has_showUnconserved;
+
+ /**
+ * Field _showBoxes.
+ */
+ private boolean _showBoxes;
+
+ /**
+ * keeps track of state for field: _showBoxes
+ */
+ private boolean _has_showBoxes;
+
+ /**
+ * Field _wrapAlignment.
+ */
+ private boolean _wrapAlignment;
+
+ /**
+ * keeps track of state for field: _wrapAlignment
+ */
+ private boolean _has_wrapAlignment;
+
+ /**
+ * Field _renderGaps.
+ */
+ private boolean _renderGaps;
+
+ /**
+ * keeps track of state for field: _renderGaps
+ */
+ private boolean _has_renderGaps;
+
+ /**
+ * Field _showSequenceFeatures.
+ */
+ private boolean _showSequenceFeatures;
+
+ /**
+ * keeps track of state for field: _showSequenceFeatures
+ */
+ private boolean _has_showSequenceFeatures;
+
+ /**
+ * Field _showNPfeatureTooltip.
+ */
+ private boolean _showNPfeatureTooltip;
+
+ /**
+ * keeps track of state for field: _showNPfeatureTooltip
+ */
+ private boolean _has_showNPfeatureTooltip;
+
+ /**
+ * Field _showDbRefTooltip.
+ */
+ private boolean _showDbRefTooltip;
+
+ /**
+ * keeps track of state for field: _showDbRefTooltip
+ */
+ private boolean _has_showDbRefTooltip;
+
+ /**
+ * Field _followHighlight.
+ */
+ private boolean _followHighlight = true;
+
+ /**
+ * keeps track of state for field: _followHighlight
+ */
+ private boolean _has_followHighlight;
+
+ /**
+ * Field _followSelection.
+ */
+ private boolean _followSelection = true;
+
+ /**
+ * keeps track of state for field: _followSelection
+ */
+ private boolean _has_followSelection;
+
+ /**
+ * Field _showAnnotation.
+ */
+ private boolean _showAnnotation;
+
+ /**
+ * keeps track of state for field: _showAnnotation
+ */
+ private boolean _has_showAnnotation;
+
+ /**
+ * Field _centreColumnLabels.
+ */
+ private boolean _centreColumnLabels = false;
+
+ /**
+ * keeps track of state for field: _centreColumnLabels
+ */
+ private boolean _has_centreColumnLabels;
+
+ /**
+ * Field _showGroupConservation.
+ */
+ private boolean _showGroupConservation = false;
+
+ /**
+ * keeps track of state for field: _showGroupConservation
+ */
+ private boolean _has_showGroupConservation;
+
+ /**
+ * Field _showGroupConsensus.
+ */
+ private boolean _showGroupConsensus = false;
+
+ /**
+ * keeps track of state for field: _showGroupConsensus
+ */
+ private boolean _has_showGroupConsensus;
+
+ /**
+ * Field _showConsensusHistogram.
+ */
+ private boolean _showConsensusHistogram = true;
+
+ /**
+ * keeps track of state for field: _showConsensusHistogram
+ */
+ private boolean _has_showConsensusHistogram;
+
+ /**
+ * Field _showSequenceLogo.
+ */
+ private boolean _showSequenceLogo = false;
+
+ /**
+ * keeps track of state for field: _showSequenceLogo
+ */
+ private boolean _has_showSequenceLogo;
+
+ /**
+ * Field _normaliseSequenceLogo.
+ */
+ private boolean _normaliseSequenceLogo = false;
+
+ /**
+ * keeps track of state for field: _normaliseSequenceLogo
+ */
+ private boolean _has_normaliseSequenceLogo;
+
+ /**
+ * Field _ignoreGapsinConsensus.
+ */
+ private boolean _ignoreGapsinConsensus = true;
+
+ /**
+ * keeps track of state for field: _ignoreGapsinConsensus
+ */
+ private boolean _has_ignoreGapsinConsensus;
+
+ /**
+ * Field _startRes.
+ */
+ private int _startRes;
+
+ /**
+ * keeps track of state for field: _startRes
+ */
+ private boolean _has_startRes;
+
+ /**
+ * Field _startSeq.
+ */
+ private int _startSeq;
+
+ /**
+ * keeps track of state for field: _startSeq
+ */
+ private boolean _has_startSeq;
+
+ /**
+ * Field _fontName.
+ */
+ private java.lang.String _fontName;
+
+ /**
+ * Field _fontSize.
+ */
+ private int _fontSize;
+
+ /**
+ * keeps track of state for field: _fontSize
+ */
+ private boolean _has_fontSize;
+
+ /**
+ * Field _fontStyle.
+ */
+ private int _fontStyle;
+
+ /**
+ * keeps track of state for field: _fontStyle
+ */
+ private boolean _has_fontStyle;
+
+ /**
+ * Field _scaleProteinAsCdna.
+ */
+ private boolean _scaleProteinAsCdna = true;
+
+ /**
+ * keeps track of state for field: _scaleProteinAsCdna
+ */
+ private boolean _has_scaleProteinAsCdna;
+
+ /**
+ * Field _viewName.
+ */
+ private java.lang.String _viewName;
+
+ /**
+ * Field _sequenceSetId.
+ */
+ private java.lang.String _sequenceSetId;
+
+ /**
+ * Field _gatheredViews.
+ */
+ private boolean _gatheredViews;
+
+ /**
+ * keeps track of state for field: _gatheredViews
+ */
+ private boolean _has_gatheredViews;
+
+ /**
+ * Field _textCol1.
+ */
+ private int _textCol1;
+
+ /**
+ * keeps track of state for field: _textCol1
+ */
+ private boolean _has_textCol1;
+
+ /**
+ * Field _textCol2.
+ */
+ private int _textCol2;
+
+ /**
+ * keeps track of state for field: _textCol2
+ */
+ private boolean _has_textCol2;
+
+ /**
+ * Field _textColThreshold.
+ */
+ private int _textColThreshold;
+
+ /**
+ * keeps track of state for field: _textColThreshold
+ */
+ private boolean _has_textColThreshold;
+
+ /**
+ * unique id used by jalview to synchronize between stored and instantiated
+ * views
+ *
+ */
+ private java.lang.String _id;
+
+ /**
+ * The viewport id of this viewport's (cdna/protein) coding complement, if any
+ *
+ */
+ private java.lang.String _complementId;
+
+ /**
+ * Field _width.
+ */
+ private int _width;
+
+ /**
+ * keeps track of state for field: _width
+ */
+ private boolean _has_width;
+
+ /**
+ * Field _height.
+ */
+ private int _height;
+
+ /**
+ * keeps track of state for field: _height
+ */
+ private boolean _has_height;
+
+ /**
+ * Field _xpos.
+ */
+ private int _xpos;
+
+ /**
+ * keeps track of state for field: _xpos
+ */
+ private boolean _has_xpos;
+
+ /**
+ * Field _ypos.
+ */
+ private int _ypos;
+
+ /**
+ * keeps track of state for field: _ypos
+ */
+ private boolean _has_ypos;
+
+ /**
+ * Field _annotationColours.
+ */
+ private jalview.schemabinding.version2.AnnotationColours _annotationColours;
+
+ /**
+ * Field _hiddenColumnsList.
+ */
+ private java.util.Vector _hiddenColumnsList;
+
+ /**
+ * Field _calcIdParamList.
+ */
+ private java.util.Vector _calcIdParamList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Viewport()
+ {
+ super();
+ this._hiddenColumnsList = new java.util.Vector();
+ this._calcIdParamList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vCalcIdParam
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addCalcIdParam(
+ final jalview.schemabinding.version2.CalcIdParam vCalcIdParam)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._calcIdParamList.addElement(vCalcIdParam);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vCalcIdParam
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addCalcIdParam(final int index,
+ final jalview.schemabinding.version2.CalcIdParam vCalcIdParam)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._calcIdParamList.add(index, vCalcIdParam);
+ }
+
+ /**
+ *
+ *
+ * @param vHiddenColumns
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addHiddenColumns(
+ final jalview.schemabinding.version2.HiddenColumns vHiddenColumns)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._hiddenColumnsList.addElement(vHiddenColumns);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vHiddenColumns
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addHiddenColumns(final int index,
+ final jalview.schemabinding.version2.HiddenColumns vHiddenColumns)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._hiddenColumnsList.add(index, vHiddenColumns);
+ }
+
+ /**
+ */
+ public void deleteCentreColumnLabels()
+ {
+ this._has_centreColumnLabels = false;
+ }
+
+ /**
+ */
+ public void deleteConsThreshold()
+ {
+ this._has_consThreshold = false;
+ }
+
+ /**
+ */
+ public void deleteConservationSelected()
+ {
+ this._has_conservationSelected = false;
+ }
+
+ /**
+ */
+ public void deleteFollowHighlight()
+ {
+ this._has_followHighlight = false;
+ }
+
+ /**
+ */
+ public void deleteFollowSelection()
+ {
+ this._has_followSelection = false;
+ }
+
+ /**
+ */
+ public void deleteFontSize()
+ {
+ this._has_fontSize = false;
+ }
+
+ /**
+ */
+ public void deleteFontStyle()
+ {
+ this._has_fontStyle = false;
+ }
+
+ /**
+ */
+ public void deleteGatheredViews()
+ {
+ this._has_gatheredViews = false;
+ }
+
+ /**
+ */
+ public void deleteHeight()
+ {
+ this._has_height = false;
+ }
- /**
+ /**
*/
- public void deleteShowFullId(
- ) {
- this._has_showFullId= false;
- }
-
- /**
- */
- public void deleteShowGroupConsensus(
- ) {
- this._has_showGroupConsensus= false;
- }
+ public void deleteIgnoreGapsinConsensus()
+ {
+ this._has_ignoreGapsinConsensus = false;
+ }
- /**
+ /**
*/
- public void deleteShowGroupConservation(
- ) {
- this._has_showGroupConservation= false;
- }
+ public void deleteNormaliseSequenceLogo()
+ {
+ this._has_normaliseSequenceLogo = false;
+ }
- /**
+ /**
*/
- public void deleteShowNPfeatureTooltip(
- ) {
- this._has_showNPfeatureTooltip= false;
- }
+ public void deletePidSelected()
+ {
+ this._has_pidSelected = false;
+ }
- /**
+ /**
*/
- public void deleteShowSequenceFeatures(
- ) {
- this._has_showSequenceFeatures= false;
- }
+ public void deletePidThreshold()
+ {
+ this._has_pidThreshold = false;
+ }
- /**
+ /**
*/
- public void deleteShowSequenceLogo(
- ) {
- this._has_showSequenceLogo= false;
- }
+ public void deleteRenderGaps()
+ {
+ this._has_renderGaps = false;
+ }
- /**
+ /**
*/
- public void deleteShowText(
- ) {
- this._has_showText= false;
- }
+ public void deleteRightAlignIds()
+ {
+ this._has_rightAlignIds = false;
+ }
- /**
+ /**
*/
- public void deleteShowUnconserved(
- ) {
- this._has_showUnconserved= false;
- }
+ public void deleteScaleProteinAsCdna()
+ {
+ this._has_scaleProteinAsCdna = false;
+ }
- /**
+ /**
*/
- public void deleteStartRes(
- ) {
- this._has_startRes= false;
- }
+ public void deleteShowAnnotation()
+ {
+ this._has_showAnnotation = false;
+ }
- /**
+ /**
*/
- public void deleteStartSeq(
- ) {
- this._has_startSeq= false;
- }
+ public void deleteShowBoxes()
+ {
+ this._has_showBoxes = false;
+ }
- /**
+ /**
*/
- public void deleteTextCol1(
- ) {
- this._has_textCol1= false;
- }
+ public void deleteShowColourText()
+ {
+ this._has_showColourText = false;
+ }
- /**
+ /**
*/
- public void deleteTextCol2(
- ) {
- this._has_textCol2= false;
- }
+ public void deleteShowConsensusHistogram()
+ {
+ this._has_showConsensusHistogram = false;
+ }
- /**
+ /**
*/
- public void deleteTextColThreshold(
- ) {
- this._has_textColThreshold= false;
- }
+ public void deleteShowDbRefTooltip()
+ {
+ this._has_showDbRefTooltip = false;
+ }
- /**
+ /**
*/
- public void deleteWidth(
- ) {
- this._has_width= false;
- }
+ public void deleteShowFullId()
+ {
+ this._has_showFullId = false;
+ }
- /**
+ /**
*/
- public void deleteWrapAlignment(
- ) {
- this._has_wrapAlignment= false;
- }
+ public void deleteShowGroupConsensus()
+ {
+ this._has_showGroupConsensus = false;
+ }
- /**
+ /**
*/
- public void deleteXpos(
- ) {
- this._has_xpos= false;
- }
+ public void deleteShowGroupConservation()
+ {
+ this._has_showGroupConservation = false;
+ }
- /**
+ /**
*/
- public void deleteYpos(
- ) {
- this._has_ypos= false;
- }
+ public void deleteShowNPfeatureTooltip()
+ {
+ this._has_showNPfeatureTooltip = false;
+ }
- /**
- * Method enumerateHiddenColumns.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.HiddenColumns elements
+ /**
*/
- public java.util.Enumeration enumerateHiddenColumns(
- ) {
- return this._hiddenColumnsList.elements();
- }
+ public void deleteShowSequenceFeatures()
+ {
+ this._has_showSequenceFeatures = false;
+ }
- /**
- * Returns the value of field 'annotationColours'.
- *
- * @return the value of field 'AnnotationColours'.
+ /**
*/
- public jalview.schemabinding.version2.AnnotationColours getAnnotationColours(
- ) {
- return this._annotationColours;
- }
+ public void deleteShowSequenceLogo()
+ {
+ this._has_showSequenceLogo = false;
+ }
- /**
- * Returns the value of field 'bgColour'.
- *
- * @return the value of field 'BgColour'.
+ /**
*/
- public java.lang.String getBgColour(
- ) {
- return this._bgColour;
- }
+ public void deleteShowText()
+ {
+ this._has_showText = false;
+ }
- /**
- * Returns the value of field 'centreColumnLabels'.
- *
- * @return the value of field 'CentreColumnLabels'.
+ /**
*/
- public boolean getCentreColumnLabels(
- ) {
- return this._centreColumnLabels;
- }
+ public void deleteShowUnconserved()
+ {
+ this._has_showUnconserved = false;
+ }
- /**
- * Returns the value of field 'consThreshold'.
- *
- * @return the value of field 'ConsThreshold'.
+ /**
*/
- public int getConsThreshold(
- ) {
- return this._consThreshold;
- }
-
- /**
- * Returns the value of field 'conservationSelected'.
- *
- * @return the value of field 'ConservationSelected'.
- */
- public boolean getConservationSelected(
- ) {
- return this._conservationSelected;
- }
-
- /**
- * Returns the value of field 'followHighlight'.
- *
- * @return the value of field 'FollowHighlight'.
- */
- public boolean getFollowHighlight(
- ) {
- return this._followHighlight;
- }
-
- /**
- * Returns the value of field 'followSelection'.
- *
- * @return the value of field 'FollowSelection'.
- */
- public boolean getFollowSelection(
- ) {
- return this._followSelection;
- }
-
- /**
- * Returns the value of field 'fontName'.
- *
- * @return the value of field 'FontName'.
- */
- public java.lang.String getFontName(
- ) {
- return this._fontName;
- }
-
- /**
- * Returns the value of field 'fontSize'.
- *
- * @return the value of field 'FontSize'.
- */
- public int getFontSize(
- ) {
- return this._fontSize;
- }
-
- /**
- * Returns the value of field 'fontStyle'.
- *
- * @return the value of field 'FontStyle'.
- */
- public int getFontStyle(
- ) {
- return this._fontStyle;
- }
-
- /**
- * Returns the value of field 'gatheredViews'.
- *
- * @return the value of field 'GatheredViews'.
- */
- public boolean getGatheredViews(
- ) {
- return this._gatheredViews;
- }
-
- /**
- * Returns the value of field 'height'.
- *
- * @return the value of field 'Height'.
- */
- public int getHeight(
- ) {
- return this._height;
- }
-
- /**
- * Method getHiddenColumns.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.HiddenColumns at the given
- * index
- */
- public jalview.schemabinding.version2.HiddenColumns getHiddenColumns(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._hiddenColumnsList.size()) {
- throw new IndexOutOfBoundsException("getHiddenColumns: Index value '" + index + "' not in range [0.." + (this._hiddenColumnsList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.HiddenColumns) _hiddenColumnsList.get(index);
- }
-
- /**
- * Method getHiddenColumns.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.HiddenColumns[] getHiddenColumns(
- ) {
- jalview.schemabinding.version2.HiddenColumns[] array = new jalview.schemabinding.version2.HiddenColumns[0];
- return (jalview.schemabinding.version2.HiddenColumns[]) this._hiddenColumnsList.toArray(array);
- }
-
- /**
- * Method getHiddenColumnsCount.
- *
- * @return the size of this collection
- */
- public int getHiddenColumnsCount(
- ) {
- return this._hiddenColumnsList.size();
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: unique id used by jalview to
- * synchronize between stored and instantiated views
- *
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'ignoreGapsinConsensus'.
- *
- * @return the value of field 'IgnoreGapsinConsensus'.
- */
- public boolean getIgnoreGapsinConsensus(
- ) {
- return this._ignoreGapsinConsensus;
- }
-
- /**
- * Returns the value of field 'pidSelected'.
- *
- * @return the value of field 'PidSelected'.
- */
- public boolean getPidSelected(
- ) {
- return this._pidSelected;
- }
-
- /**
- * Returns the value of field 'pidThreshold'.
- *
- * @return the value of field 'PidThreshold'.
- */
- public int getPidThreshold(
- ) {
- return this._pidThreshold;
- }
-
- /**
- * Returns the value of field 'renderGaps'.
- *
- * @return the value of field 'RenderGaps'.
- */
- public boolean getRenderGaps(
- ) {
- return this._renderGaps;
- }
-
- /**
- * Returns the value of field 'rightAlignIds'.
- *
- * @return the value of field 'RightAlignIds'.
- */
- public boolean getRightAlignIds(
- ) {
- return this._rightAlignIds;
- }
-
- /**
- * Returns the value of field 'sequenceSetId'.
- *
- * @return the value of field 'SequenceSetId'.
- */
- public java.lang.String getSequenceSetId(
- ) {
- return this._sequenceSetId;
- }
-
- /**
- * Returns the value of field 'showAnnotation'.
- *
- * @return the value of field 'ShowAnnotation'.
- */
- public boolean getShowAnnotation(
- ) {
- return this._showAnnotation;
- }
-
- /**
- * Returns the value of field 'showBoxes'.
- *
- * @return the value of field 'ShowBoxes'.
- */
- public boolean getShowBoxes(
- ) {
- return this._showBoxes;
- }
-
- /**
- * Returns the value of field 'showColourText'.
- *
- * @return the value of field 'ShowColourText'.
- */
- public boolean getShowColourText(
- ) {
- return this._showColourText;
- }
-
- /**
- * Returns the value of field 'showConsensusHistogram'.
- *
- * @return the value of field 'ShowConsensusHistogram'.
- */
- public boolean getShowConsensusHistogram(
- ) {
- return this._showConsensusHistogram;
- }
-
- /**
- * Returns the value of field 'showDbRefTooltip'.
- *
- * @return the value of field 'ShowDbRefTooltip'.
- */
- public boolean getShowDbRefTooltip(
- ) {
- return this._showDbRefTooltip;
- }
-
- /**
- * Returns the value of field 'showFullId'.
- *
- * @return the value of field 'ShowFullId'.
- */
- public boolean getShowFullId(
- ) {
- return this._showFullId;
- }
-
- /**
- * Returns the value of field 'showGroupConsensus'.
- *
- * @return the value of field 'ShowGroupConsensus'.
- */
- public boolean getShowGroupConsensus(
- ) {
- return this._showGroupConsensus;
- }
-
- /**
- * Returns the value of field 'showGroupConservation'.
- *
- * @return the value of field 'ShowGroupConservation'.
- */
- public boolean getShowGroupConservation(
- ) {
- return this._showGroupConservation;
- }
-
- /**
- * Returns the value of field 'showNPfeatureTooltip'.
- *
- * @return the value of field 'ShowNPfeatureTooltip'.
- */
- public boolean getShowNPfeatureTooltip(
- ) {
- return this._showNPfeatureTooltip;
- }
-
- /**
- * Returns the value of field 'showSequenceFeatures'.
- *
- * @return the value of field 'ShowSequenceFeatures'.
- */
- public boolean getShowSequenceFeatures(
- ) {
- return this._showSequenceFeatures;
- }
-
- /**
- * Returns the value of field 'showSequenceLogo'.
- *
- * @return the value of field 'ShowSequenceLogo'.
- */
- public boolean getShowSequenceLogo(
- ) {
- return this._showSequenceLogo;
- }
-
- /**
- * Returns the value of field 'showText'.
- *
- * @return the value of field 'ShowText'.
- */
- public boolean getShowText(
- ) {
- return this._showText;
- }
-
- /**
- * Returns the value of field 'showUnconserved'.
- *
- * @return the value of field 'ShowUnconserved'.
- */
- public boolean getShowUnconserved(
- ) {
- return this._showUnconserved;
- }
-
- /**
- * Returns the value of field 'startRes'.
- *
- * @return the value of field 'StartRes'.
- */
- public int getStartRes(
- ) {
- return this._startRes;
- }
-
- /**
- * Returns the value of field 'startSeq'.
- *
- * @return the value of field 'StartSeq'.
- */
- public int getStartSeq(
- ) {
- return this._startSeq;
- }
-
- /**
- * Returns the value of field 'textCol1'.
- *
- * @return the value of field 'TextCol1'.
- */
- public int getTextCol1(
- ) {
- return this._textCol1;
- }
-
- /**
- * Returns the value of field 'textCol2'.
- *
- * @return the value of field 'TextCol2'.
- */
- public int getTextCol2(
- ) {
- return this._textCol2;
- }
-
- /**
- * Returns the value of field 'textColThreshold'.
- *
- * @return the value of field 'TextColThreshold'.
- */
- public int getTextColThreshold(
- ) {
- return this._textColThreshold;
- }
-
- /**
- * Returns the value of field 'title'.
- *
- * @return the value of field 'Title'.
- */
- public java.lang.String getTitle(
- ) {
- return this._title;
- }
-
- /**
- * Returns the value of field 'viewName'.
- *
- * @return the value of field 'ViewName'.
- */
- public java.lang.String getViewName(
- ) {
- return this._viewName;
- }
-
- /**
- * Returns the value of field 'width'.
- *
- * @return the value of field 'Width'.
- */
- public int getWidth(
- ) {
- return this._width;
- }
-
- /**
- * Returns the value of field 'wrapAlignment'.
- *
- * @return the value of field 'WrapAlignment'.
- */
- public boolean getWrapAlignment(
- ) {
- return this._wrapAlignment;
- }
-
- /**
- * Returns the value of field 'xpos'.
- *
- * @return the value of field 'Xpos'.
- */
- public int getXpos(
- ) {
- return this._xpos;
- }
-
- /**
- * Returns the value of field 'ypos'.
- *
- * @return the value of field 'Ypos'.
- */
- public int getYpos(
- ) {
- return this._ypos;
- }
-
- /**
- * Method hasCentreColumnLabels.
- *
- * @return true if at least one CentreColumnLabels has been adde
- */
- public boolean hasCentreColumnLabels(
- ) {
- return this._has_centreColumnLabels;
- }
-
- /**
- * Method hasConsThreshold.
- *
- * @return true if at least one ConsThreshold has been added
- */
- public boolean hasConsThreshold(
- ) {
- return this._has_consThreshold;
- }
-
- /**
- * Method hasConservationSelected.
- *
- * @return true if at least one ConservationSelected has been
- * added
- */
- public boolean hasConservationSelected(
- ) {
- return this._has_conservationSelected;
- }
-
- /**
- * Method hasFollowHighlight.
- *
- * @return true if at least one FollowHighlight has been added
- */
- public boolean hasFollowHighlight(
- ) {
- return this._has_followHighlight;
- }
-
- /**
- * Method hasFollowSelection.
- *
- * @return true if at least one FollowSelection has been added
- */
- public boolean hasFollowSelection(
- ) {
- return this._has_followSelection;
- }
-
- /**
- * Method hasFontSize.
- *
- * @return true if at least one FontSize has been added
- */
- public boolean hasFontSize(
- ) {
- return this._has_fontSize;
- }
-
- /**
- * Method hasFontStyle.
- *
- * @return true if at least one FontStyle has been added
- */
- public boolean hasFontStyle(
- ) {
- return this._has_fontStyle;
- }
-
- /**
- * Method hasGatheredViews.
- *
- * @return true if at least one GatheredViews has been added
- */
- public boolean hasGatheredViews(
- ) {
- return this._has_gatheredViews;
- }
-
- /**
- * Method hasHeight.
- *
- * @return true if at least one Height has been added
- */
- public boolean hasHeight(
- ) {
- return this._has_height;
- }
-
- /**
- * Method hasIgnoreGapsinConsensus.
- *
- * @return true if at least one IgnoreGapsinConsensus has been
- * added
- */
- public boolean hasIgnoreGapsinConsensus(
- ) {
- return this._has_ignoreGapsinConsensus;
- }
-
- /**
- * Method hasPidSelected.
- *
- * @return true if at least one PidSelected has been added
- */
- public boolean hasPidSelected(
- ) {
- return this._has_pidSelected;
- }
-
- /**
- * Method hasPidThreshold.
- *
- * @return true if at least one PidThreshold has been added
- */
- public boolean hasPidThreshold(
- ) {
- return this._has_pidThreshold;
- }
-
- /**
- * Method hasRenderGaps.
- *
- * @return true if at least one RenderGaps has been added
- */
- public boolean hasRenderGaps(
- ) {
- return this._has_renderGaps;
- }
-
- /**
- * Method hasRightAlignIds.
- *
- * @return true if at least one RightAlignIds has been added
- */
- public boolean hasRightAlignIds(
- ) {
- return this._has_rightAlignIds;
- }
-
- /**
- * Method hasShowAnnotation.
- *
- * @return true if at least one ShowAnnotation has been added
- */
- public boolean hasShowAnnotation(
- ) {
- return this._has_showAnnotation;
- }
-
- /**
- * Method hasShowBoxes.
- *
- * @return true if at least one ShowBoxes has been added
- */
- public boolean hasShowBoxes(
- ) {
- return this._has_showBoxes;
- }
-
- /**
- * Method hasShowColourText.
- *
- * @return true if at least one ShowColourText has been added
- */
- public boolean hasShowColourText(
- ) {
- return this._has_showColourText;
- }
-
- /**
- * Method hasShowConsensusHistogram.
- *
- * @return true if at least one ShowConsensusHistogram has been
- * added
- */
- public boolean hasShowConsensusHistogram(
- ) {
- return this._has_showConsensusHistogram;
- }
-
- /**
- * Method hasShowDbRefTooltip.
- *
- * @return true if at least one ShowDbRefTooltip has been added
- */
- public boolean hasShowDbRefTooltip(
- ) {
- return this._has_showDbRefTooltip;
- }
-
- /**
- * Method hasShowFullId.
- *
- * @return true if at least one ShowFullId has been added
- */
- public boolean hasShowFullId(
- ) {
- return this._has_showFullId;
- }
-
- /**
- * Method hasShowGroupConsensus.
- *
- * @return true if at least one ShowGroupConsensus has been adde
- */
- public boolean hasShowGroupConsensus(
- ) {
- return this._has_showGroupConsensus;
- }
-
- /**
- * Method hasShowGroupConservation.
- *
- * @return true if at least one ShowGroupConservation has been
- * added
- */
- public boolean hasShowGroupConservation(
- ) {
- return this._has_showGroupConservation;
- }
-
- /**
- * Method hasShowNPfeatureTooltip.
- *
- * @return true if at least one ShowNPfeatureTooltip has been
- * added
- */
- public boolean hasShowNPfeatureTooltip(
- ) {
- return this._has_showNPfeatureTooltip;
- }
-
- /**
- * Method hasShowSequenceFeatures.
- *
- * @return true if at least one ShowSequenceFeatures has been
- * added
- */
- public boolean hasShowSequenceFeatures(
- ) {
- return this._has_showSequenceFeatures;
- }
-
- /**
- * Method hasShowSequenceLogo.
- *
- * @return true if at least one ShowSequenceLogo has been added
- */
- public boolean hasShowSequenceLogo(
- ) {
- return this._has_showSequenceLogo;
- }
-
- /**
- * Method hasShowText.
- *
- * @return true if at least one ShowText has been added
- */
- public boolean hasShowText(
- ) {
- return this._has_showText;
- }
-
- /**
- * Method hasShowUnconserved.
- *
- * @return true if at least one ShowUnconserved has been added
- */
- public boolean hasShowUnconserved(
- ) {
- return this._has_showUnconserved;
- }
-
- /**
- * Method hasStartRes.
- *
- * @return true if at least one StartRes has been added
- */
- public boolean hasStartRes(
- ) {
- return this._has_startRes;
- }
-
- /**
- * Method hasStartSeq.
- *
- * @return true if at least one StartSeq has been added
- */
- public boolean hasStartSeq(
- ) {
- return this._has_startSeq;
- }
-
- /**
- * Method hasTextCol1.
- *
- * @return true if at least one TextCol1 has been added
- */
- public boolean hasTextCol1(
- ) {
- return this._has_textCol1;
- }
-
- /**
- * Method hasTextCol2.
- *
- * @return true if at least one TextCol2 has been added
- */
- public boolean hasTextCol2(
- ) {
- return this._has_textCol2;
- }
-
- /**
- * Method hasTextColThreshold.
- *
- * @return true if at least one TextColThreshold has been added
- */
- public boolean hasTextColThreshold(
- ) {
- return this._has_textColThreshold;
- }
-
- /**
- * Method hasWidth.
- *
- * @return true if at least one Width has been added
- */
- public boolean hasWidth(
- ) {
- return this._has_width;
- }
-
- /**
- * Method hasWrapAlignment.
- *
- * @return true if at least one WrapAlignment has been added
- */
- public boolean hasWrapAlignment(
- ) {
- return this._has_wrapAlignment;
- }
-
- /**
- * Method hasXpos.
- *
- * @return true if at least one Xpos has been added
- */
- public boolean hasXpos(
- ) {
- return this._has_xpos;
- }
-
- /**
- * Method hasYpos.
- *
- * @return true if at least one Ypos has been added
- */
- public boolean hasYpos(
- ) {
- return this._has_ypos;
- }
-
- /**
- * Returns the value of field 'centreColumnLabels'.
- *
- * @return the value of field 'CentreColumnLabels'.
- */
- public boolean isCentreColumnLabels(
- ) {
- return this._centreColumnLabels;
- }
-
- /**
- * Returns the value of field 'conservationSelected'.
- *
- * @return the value of field 'ConservationSelected'.
- */
- public boolean isConservationSelected(
- ) {
- return this._conservationSelected;
- }
-
- /**
- * Returns the value of field 'followHighlight'.
- *
- * @return the value of field 'FollowHighlight'.
- */
- public boolean isFollowHighlight(
- ) {
- return this._followHighlight;
- }
-
- /**
- * Returns the value of field 'followSelection'.
- *
- * @return the value of field 'FollowSelection'.
- */
- public boolean isFollowSelection(
- ) {
- return this._followSelection;
- }
-
- /**
- * Returns the value of field 'gatheredViews'.
- *
- * @return the value of field 'GatheredViews'.
- */
- public boolean isGatheredViews(
- ) {
- return this._gatheredViews;
- }
-
- /**
- * Returns the value of field 'ignoreGapsinConsensus'.
- *
- * @return the value of field 'IgnoreGapsinConsensus'.
- */
- public boolean isIgnoreGapsinConsensus(
- ) {
- return this._ignoreGapsinConsensus;
- }
-
- /**
- * Returns the value of field 'pidSelected'.
- *
- * @return the value of field 'PidSelected'.
- */
- public boolean isPidSelected(
- ) {
- return this._pidSelected;
- }
-
- /**
- * Returns the value of field 'renderGaps'.
- *
- * @return the value of field 'RenderGaps'.
- */
- public boolean isRenderGaps(
- ) {
- return this._renderGaps;
- }
-
- /**
- * Returns the value of field 'rightAlignIds'.
- *
- * @return the value of field 'RightAlignIds'.
- */
- public boolean isRightAlignIds(
- ) {
- return this._rightAlignIds;
- }
-
- /**
- * Returns the value of field 'showAnnotation'.
- *
- * @return the value of field 'ShowAnnotation'.
- */
- public boolean isShowAnnotation(
- ) {
- return this._showAnnotation;
- }
-
- /**
- * Returns the value of field 'showBoxes'.
- *
- * @return the value of field 'ShowBoxes'.
- */
- public boolean isShowBoxes(
- ) {
- return this._showBoxes;
- }
-
- /**
- * Returns the value of field 'showColourText'.
- *
- * @return the value of field 'ShowColourText'.
- */
- public boolean isShowColourText(
- ) {
- return this._showColourText;
- }
-
- /**
- * Returns the value of field 'showConsensusHistogram'.
- *
- * @return the value of field 'ShowConsensusHistogram'.
- */
- public boolean isShowConsensusHistogram(
- ) {
- return this._showConsensusHistogram;
- }
-
- /**
- * Returns the value of field 'showDbRefTooltip'.
- *
- * @return the value of field 'ShowDbRefTooltip'.
- */
- public boolean isShowDbRefTooltip(
- ) {
- return this._showDbRefTooltip;
- }
-
- /**
- * Returns the value of field 'showFullId'.
- *
- * @return the value of field 'ShowFullId'.
- */
- public boolean isShowFullId(
- ) {
- return this._showFullId;
- }
-
- /**
- * Returns the value of field 'showGroupConsensus'.
- *
- * @return the value of field 'ShowGroupConsensus'.
- */
- public boolean isShowGroupConsensus(
- ) {
- return this._showGroupConsensus;
- }
-
- /**
- * Returns the value of field 'showGroupConservation'.
- *
- * @return the value of field 'ShowGroupConservation'.
- */
- public boolean isShowGroupConservation(
- ) {
- return this._showGroupConservation;
- }
-
- /**
- * Returns the value of field 'showNPfeatureTooltip'.
- *
- * @return the value of field 'ShowNPfeatureTooltip'.
- */
- public boolean isShowNPfeatureTooltip(
- ) {
- return this._showNPfeatureTooltip;
- }
-
- /**
- * Returns the value of field 'showSequenceFeatures'.
- *
- * @return the value of field 'ShowSequenceFeatures'.
- */
- public boolean isShowSequenceFeatures(
- ) {
- return this._showSequenceFeatures;
- }
-
- /**
- * Returns the value of field 'showSequenceLogo'.
- *
- * @return the value of field 'ShowSequenceLogo'.
- */
- public boolean isShowSequenceLogo(
- ) {
- return this._showSequenceLogo;
- }
-
- /**
- * Returns the value of field 'showText'.
- *
- * @return the value of field 'ShowText'.
- */
- public boolean isShowText(
- ) {
- return this._showText;
- }
-
- /**
- * Returns the value of field 'showUnconserved'.
- *
- * @return the value of field 'ShowUnconserved'.
- */
- public boolean isShowUnconserved(
- ) {
- return this._showUnconserved;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- * Returns the value of field 'wrapAlignment'.
- *
- * @return the value of field 'WrapAlignment'.
- */
- public boolean isWrapAlignment(
- ) {
- return this._wrapAlignment;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllHiddenColumns(
- ) {
- this._hiddenColumnsList.clear();
- }
-
- /**
- * Method removeHiddenColumns.
- *
- * @param vHiddenColumns
- * @return true if the object was removed from the collection.
- */
- public boolean removeHiddenColumns(
- final jalview.schemabinding.version2.HiddenColumns vHiddenColumns) {
- boolean removed = _hiddenColumnsList.remove(vHiddenColumns);
- return removed;
- }
-
- /**
- * Method removeHiddenColumnsAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.HiddenColumns removeHiddenColumnsAt(
- final int index) {
- java.lang.Object obj = this._hiddenColumnsList.remove(index);
- return (jalview.schemabinding.version2.HiddenColumns) obj;
- }
-
- /**
- * Sets the value of field 'annotationColours'.
- *
- * @param annotationColours the value of field
- * 'annotationColours'.
- */
- public void setAnnotationColours(
- final jalview.schemabinding.version2.AnnotationColours annotationColours) {
- this._annotationColours = annotationColours;
- }
-
- /**
- * Sets the value of field 'bgColour'.
- *
- * @param bgColour the value of field 'bgColour'.
- */
- public void setBgColour(
- final java.lang.String bgColour) {
- this._bgColour = bgColour;
- }
-
- /**
- * Sets the value of field 'centreColumnLabels'.
- *
- * @param centreColumnLabels the value of field
- * 'centreColumnLabels'.
- */
- public void setCentreColumnLabels(
- final boolean centreColumnLabels) {
- this._centreColumnLabels = centreColumnLabels;
- this._has_centreColumnLabels = true;
- }
-
- /**
- * Sets the value of field 'consThreshold'.
- *
- * @param consThreshold the value of field 'consThreshold'.
- */
- public void setConsThreshold(
- final int consThreshold) {
- this._consThreshold = consThreshold;
- this._has_consThreshold = true;
- }
-
- /**
- * Sets the value of field 'conservationSelected'.
- *
- * @param conservationSelected the value of field
- * 'conservationSelected'.
- */
- public void setConservationSelected(
- final boolean conservationSelected) {
- this._conservationSelected = conservationSelected;
- this._has_conservationSelected = true;
- }
-
- /**
- * Sets the value of field 'followHighlight'.
- *
- * @param followHighlight the value of field 'followHighlight'.
- */
- public void setFollowHighlight(
- final boolean followHighlight) {
- this._followHighlight = followHighlight;
- this._has_followHighlight = true;
- }
-
- /**
- * Sets the value of field 'followSelection'.
- *
- * @param followSelection the value of field 'followSelection'.
- */
- public void setFollowSelection(
- final boolean followSelection) {
- this._followSelection = followSelection;
- this._has_followSelection = true;
- }
-
- /**
- * Sets the value of field 'fontName'.
- *
- * @param fontName the value of field 'fontName'.
- */
- public void setFontName(
- final java.lang.String fontName) {
- this._fontName = fontName;
- }
-
- /**
- * Sets the value of field 'fontSize'.
- *
- * @param fontSize the value of field 'fontSize'.
- */
- public void setFontSize(
- final int fontSize) {
- this._fontSize = fontSize;
- this._has_fontSize = true;
- }
-
- /**
- * Sets the value of field 'fontStyle'.
- *
- * @param fontStyle the value of field 'fontStyle'.
- */
- public void setFontStyle(
- final int fontStyle) {
- this._fontStyle = fontStyle;
- this._has_fontStyle = true;
- }
-
- /**
- * Sets the value of field 'gatheredViews'.
- *
- * @param gatheredViews the value of field 'gatheredViews'.
- */
- public void setGatheredViews(
- final boolean gatheredViews) {
- this._gatheredViews = gatheredViews;
- this._has_gatheredViews = true;
- }
-
- /**
- * Sets the value of field 'height'.
- *
- * @param height the value of field 'height'.
- */
- public void setHeight(
- final int height) {
- this._height = height;
- this._has_height = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vHiddenColumns
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setHiddenColumns(
- final int index,
- final jalview.schemabinding.version2.HiddenColumns vHiddenColumns)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._hiddenColumnsList.size()) {
- throw new IndexOutOfBoundsException("setHiddenColumns: Index value '" + index + "' not in range [0.." + (this._hiddenColumnsList.size() - 1) + "]");
- }
-
- this._hiddenColumnsList.set(index, vHiddenColumns);
- }
-
- /**
- *
- *
- * @param vHiddenColumnsArray
- */
- public void setHiddenColumns(
- final jalview.schemabinding.version2.HiddenColumns[] vHiddenColumnsArray) {
- //-- copy array
- _hiddenColumnsList.clear();
-
- for (int i = 0; i < vHiddenColumnsArray.length; i++) {
- this._hiddenColumnsList.add(vHiddenColumnsArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: unique id used by jalview to
- * synchronize between stored and instantiated views
- *
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'ignoreGapsinConsensus'.
- *
- * @param ignoreGapsinConsensus the value of field
- * 'ignoreGapsinConsensus'.
- */
- public void setIgnoreGapsinConsensus(
- final boolean ignoreGapsinConsensus) {
- this._ignoreGapsinConsensus = ignoreGapsinConsensus;
- this._has_ignoreGapsinConsensus = true;
- }
-
- /**
- * Sets the value of field 'pidSelected'.
- *
- * @param pidSelected the value of field 'pidSelected'.
- */
- public void setPidSelected(
- final boolean pidSelected) {
- this._pidSelected = pidSelected;
- this._has_pidSelected = true;
- }
-
- /**
- * Sets the value of field 'pidThreshold'.
- *
- * @param pidThreshold the value of field 'pidThreshold'.
- */
- public void setPidThreshold(
- final int pidThreshold) {
- this._pidThreshold = pidThreshold;
- this._has_pidThreshold = true;
- }
-
- /**
- * Sets the value of field 'renderGaps'.
- *
- * @param renderGaps the value of field 'renderGaps'.
- */
- public void setRenderGaps(
- final boolean renderGaps) {
- this._renderGaps = renderGaps;
- this._has_renderGaps = true;
- }
-
- /**
- * Sets the value of field 'rightAlignIds'.
- *
- * @param rightAlignIds the value of field 'rightAlignIds'.
- */
- public void setRightAlignIds(
- final boolean rightAlignIds) {
- this._rightAlignIds = rightAlignIds;
- this._has_rightAlignIds = true;
- }
-
- /**
- * Sets the value of field 'sequenceSetId'.
- *
- * @param sequenceSetId the value of field 'sequenceSetId'.
- */
- public void setSequenceSetId(
- final java.lang.String sequenceSetId) {
- this._sequenceSetId = sequenceSetId;
- }
-
- /**
- * Sets the value of field 'showAnnotation'.
- *
- * @param showAnnotation the value of field 'showAnnotation'.
- */
- public void setShowAnnotation(
- final boolean showAnnotation) {
- this._showAnnotation = showAnnotation;
- this._has_showAnnotation = true;
- }
-
- /**
- * Sets the value of field 'showBoxes'.
- *
- * @param showBoxes the value of field 'showBoxes'.
- */
- public void setShowBoxes(
- final boolean showBoxes) {
- this._showBoxes = showBoxes;
- this._has_showBoxes = true;
- }
-
- /**
- * Sets the value of field 'showColourText'.
- *
- * @param showColourText the value of field 'showColourText'.
- */
- public void setShowColourText(
- final boolean showColourText) {
- this._showColourText = showColourText;
- this._has_showColourText = true;
- }
-
- /**
- * Sets the value of field 'showConsensusHistogram'.
- *
- * @param showConsensusHistogram the value of field
- * 'showConsensusHistogram'.
- */
- public void setShowConsensusHistogram(
- final boolean showConsensusHistogram) {
- this._showConsensusHistogram = showConsensusHistogram;
- this._has_showConsensusHistogram = true;
- }
-
- /**
- * Sets the value of field 'showDbRefTooltip'.
- *
- * @param showDbRefTooltip the value of field 'showDbRefTooltip'
- */
- public void setShowDbRefTooltip(
- final boolean showDbRefTooltip) {
- this._showDbRefTooltip = showDbRefTooltip;
- this._has_showDbRefTooltip = true;
- }
-
- /**
- * Sets the value of field 'showFullId'.
- *
- * @param showFullId the value of field 'showFullId'.
- */
- public void setShowFullId(
- final boolean showFullId) {
- this._showFullId = showFullId;
- this._has_showFullId = true;
- }
-
- /**
- * Sets the value of field 'showGroupConsensus'.
- *
- * @param showGroupConsensus the value of field
- * 'showGroupConsensus'.
- */
- public void setShowGroupConsensus(
- final boolean showGroupConsensus) {
- this._showGroupConsensus = showGroupConsensus;
- this._has_showGroupConsensus = true;
- }
-
- /**
- * Sets the value of field 'showGroupConservation'.
- *
- * @param showGroupConservation the value of field
- * 'showGroupConservation'.
- */
- public void setShowGroupConservation(
- final boolean showGroupConservation) {
- this._showGroupConservation = showGroupConservation;
- this._has_showGroupConservation = true;
- }
-
- /**
- * Sets the value of field 'showNPfeatureTooltip'.
- *
- * @param showNPfeatureTooltip the value of field
- * 'showNPfeatureTooltip'.
- */
- public void setShowNPfeatureTooltip(
- final boolean showNPfeatureTooltip) {
- this._showNPfeatureTooltip = showNPfeatureTooltip;
- this._has_showNPfeatureTooltip = true;
- }
-
- /**
- * Sets the value of field 'showSequenceFeatures'.
- *
- * @param showSequenceFeatures the value of field
- * 'showSequenceFeatures'.
- */
- public void setShowSequenceFeatures(
- final boolean showSequenceFeatures) {
- this._showSequenceFeatures = showSequenceFeatures;
- this._has_showSequenceFeatures = true;
- }
-
- /**
- * Sets the value of field 'showSequenceLogo'.
- *
- * @param showSequenceLogo the value of field 'showSequenceLogo'
- */
- public void setShowSequenceLogo(
- final boolean showSequenceLogo) {
- this._showSequenceLogo = showSequenceLogo;
- this._has_showSequenceLogo = true;
- }
-
- /**
- * Sets the value of field 'showText'.
- *
- * @param showText the value of field 'showText'.
- */
- public void setShowText(
- final boolean showText) {
- this._showText = showText;
- this._has_showText = true;
- }
-
- /**
- * Sets the value of field 'showUnconserved'.
- *
- * @param showUnconserved the value of field 'showUnconserved'.
- */
- public void setShowUnconserved(
- final boolean showUnconserved) {
- this._showUnconserved = showUnconserved;
- this._has_showUnconserved = true;
- }
-
- /**
- * Sets the value of field 'startRes'.
- *
- * @param startRes the value of field 'startRes'.
- */
- public void setStartRes(
- final int startRes) {
- this._startRes = startRes;
- this._has_startRes = true;
- }
-
- /**
- * Sets the value of field 'startSeq'.
- *
- * @param startSeq the value of field 'startSeq'.
- */
- public void setStartSeq(
- final int startSeq) {
- this._startSeq = startSeq;
- this._has_startSeq = true;
- }
-
- /**
- * Sets the value of field 'textCol1'.
- *
- * @param textCol1 the value of field 'textCol1'.
- */
- public void setTextCol1(
- final int textCol1) {
- this._textCol1 = textCol1;
- this._has_textCol1 = true;
- }
-
- /**
- * Sets the value of field 'textCol2'.
- *
- * @param textCol2 the value of field 'textCol2'.
- */
- public void setTextCol2(
- final int textCol2) {
- this._textCol2 = textCol2;
- this._has_textCol2 = true;
- }
-
- /**
- * Sets the value of field 'textColThreshold'.
- *
- * @param textColThreshold the value of field 'textColThreshold'
- */
- public void setTextColThreshold(
- final int textColThreshold) {
- this._textColThreshold = textColThreshold;
- this._has_textColThreshold = true;
- }
-
- /**
- * Sets the value of field 'title'.
- *
- * @param title the value of field 'title'.
- */
- public void setTitle(
- final java.lang.String title) {
- this._title = title;
- }
-
- /**
- * Sets the value of field 'viewName'.
- *
- * @param viewName the value of field 'viewName'.
- */
- public void setViewName(
- final java.lang.String viewName) {
- this._viewName = viewName;
- }
-
- /**
- * Sets the value of field 'width'.
- *
- * @param width the value of field 'width'.
- */
- public void setWidth(
- final int width) {
- this._width = width;
- this._has_width = true;
- }
-
- /**
- * Sets the value of field 'wrapAlignment'.
- *
- * @param wrapAlignment the value of field 'wrapAlignment'.
- */
- public void setWrapAlignment(
- final boolean wrapAlignment) {
- this._wrapAlignment = wrapAlignment;
- this._has_wrapAlignment = true;
- }
-
- /**
- * Sets the value of field 'xpos'.
- *
- * @param xpos the value of field 'xpos'.
- */
- public void setXpos(
- final int xpos) {
- this._xpos = xpos;
- this._has_xpos = true;
- }
-
- /**
- * Sets the value of field 'ypos'.
- *
- * @param ypos the value of field 'ypos'.
- */
- public void setYpos(
- final int ypos) {
- this._ypos = ypos;
- this._has_ypos = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.Viewport
- */
- public static jalview.schemabinding.version2.Viewport unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.Viewport) Unmarshaller.unmarshal(jalview.schemabinding.version2.Viewport.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ public void deleteStartRes()
+ {
+ this._has_startRes = false;
+ }
+
+ /**
+ */
+ public void deleteStartSeq()
+ {
+ this._has_startSeq = false;
+ }
+
+ /**
+ */
+ public void deleteTextCol1()
+ {
+ this._has_textCol1 = false;
+ }
+
+ /**
+ */
+ public void deleteTextCol2()
+ {
+ this._has_textCol2 = false;
+ }
+
+ /**
+ */
+ public void deleteTextColThreshold()
+ {
+ this._has_textColThreshold = false;
+ }
+
+ /**
+ */
+ public void deleteWidth()
+ {
+ this._has_width = false;
+ }
+
+ /**
+ */
+ public void deleteWrapAlignment()
+ {
+ this._has_wrapAlignment = false;
+ }
+
+ /**
+ */
+ public void deleteXpos()
+ {
+ this._has_xpos = false;
+ }
+
+ /**
+ */
+ public void deleteYpos()
+ {
+ this._has_ypos = false;
+ }
+
+ /**
+ * Method enumerateCalcIdParam.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.CalcIdParam
+ * elements
+ */
+ public java.util.Enumeration enumerateCalcIdParam()
+ {
+ return this._calcIdParamList.elements();
+ }
+
+ /**
+ * Method enumerateHiddenColumns.
+ *
+ * @return an Enumeration over all
+ * jalview.schemabinding.version2.HiddenColumns elements
+ */
+ public java.util.Enumeration enumerateHiddenColumns()
+ {
+ return this._hiddenColumnsList.elements();
+ }
+
+ /**
+ * Returns the value of field 'annotationColours'.
+ *
+ * @return the value of field 'AnnotationColours'.
+ */
+ public jalview.schemabinding.version2.AnnotationColours getAnnotationColours()
+ {
+ return this._annotationColours;
+ }
+
+ /**
+ * Returns the value of field 'bgColour'.
+ *
+ * @return the value of field 'BgColour'.
+ */
+ public java.lang.String getBgColour()
+ {
+ return this._bgColour;
+ }
+
+ /**
+ * Method getCalcIdParam.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.CalcIdParam at the
+ * given index
+ */
+ public jalview.schemabinding.version2.CalcIdParam getCalcIdParam(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._calcIdParamList.size())
+ {
+ throw new IndexOutOfBoundsException("getCalcIdParam: Index value '"
+ + index + "' not in range [0.."
+ + (this._calcIdParamList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.CalcIdParam) _calcIdParamList
+ .get(index);
+ }
+
+ /**
+ * Method getCalcIdParam.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.CalcIdParam[] getCalcIdParam()
+ {
+ jalview.schemabinding.version2.CalcIdParam[] array = new jalview.schemabinding.version2.CalcIdParam[0];
+ return (jalview.schemabinding.version2.CalcIdParam[]) this._calcIdParamList
+ .toArray(array);
+ }
+
+ /**
+ * Method getCalcIdParamCount.
+ *
+ * @return the size of this collection
+ */
+ public int getCalcIdParamCount()
+ {
+ return this._calcIdParamList.size();
+ }
+
+ /**
+ * Returns the value of field 'centreColumnLabels'.
+ *
+ * @return the value of field 'CentreColumnLabels'.
+ */
+ public boolean getCentreColumnLabels()
+ {
+ return this._centreColumnLabels;
+ }
+
+ /**
+ * Returns the value of field 'complementId'. The field 'complementId' has the
+ * following description: The viewport id of this viewport's (cdna/protein)
+ * coding complement, if any
+ *
+ *
+ * @return the value of field 'ComplementId'.
+ */
+ public java.lang.String getComplementId()
+ {
+ return this._complementId;
+ }
+
+ /**
+ * Returns the value of field 'consThreshold'.
+ *
+ * @return the value of field 'ConsThreshold'.
+ */
+ public int getConsThreshold()
+ {
+ return this._consThreshold;
+ }
+
+ /**
+ * Returns the value of field 'conservationSelected'.
+ *
+ * @return the value of field 'ConservationSelected'.
+ */
+ public boolean getConservationSelected()
+ {
+ return this._conservationSelected;
+ }
+
+ /**
+ * Returns the value of field 'followHighlight'.
+ *
+ * @return the value of field 'FollowHighlight'.
+ */
+ public boolean getFollowHighlight()
+ {
+ return this._followHighlight;
+ }
+
+ /**
+ * Returns the value of field 'followSelection'.
+ *
+ * @return the value of field 'FollowSelection'.
+ */
+ public boolean getFollowSelection()
+ {
+ return this._followSelection;
+ }
+
+ /**
+ * Returns the value of field 'fontName'.
+ *
+ * @return the value of field 'FontName'.
+ */
+ public java.lang.String getFontName()
+ {
+ return this._fontName;
+ }
+
+ /**
+ * Returns the value of field 'fontSize'.
+ *
+ * @return the value of field 'FontSize'.
+ */
+ public int getFontSize()
+ {
+ return this._fontSize;
+ }
+
+ /**
+ * Returns the value of field 'fontStyle'.
+ *
+ * @return the value of field 'FontStyle'.
+ */
+ public int getFontStyle()
+ {
+ return this._fontStyle;
+ }
+
+ /**
+ * Returns the value of field 'gatheredViews'.
+ *
+ * @return the value of field 'GatheredViews'.
+ */
+ public boolean getGatheredViews()
+ {
+ return this._gatheredViews;
+ }
+
+ /**
+ * Returns the value of field 'height'.
+ *
+ * @return the value of field 'Height'.
+ */
+ public int getHeight()
+ {
+ return this._height;
+ }
+
+ /**
+ * Method getHiddenColumns.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.HiddenColumns at
+ * the given index
+ */
+ public jalview.schemabinding.version2.HiddenColumns getHiddenColumns(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._hiddenColumnsList.size())
+ {
+ throw new IndexOutOfBoundsException("getHiddenColumns: Index value '"
+ + index + "' not in range [0.."
+ + (this._hiddenColumnsList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.HiddenColumns) _hiddenColumnsList
+ .get(index);
+ }
+
+ /**
+ * Method getHiddenColumns.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.HiddenColumns[] getHiddenColumns()
+ {
+ jalview.schemabinding.version2.HiddenColumns[] array = new jalview.schemabinding.version2.HiddenColumns[0];
+ return (jalview.schemabinding.version2.HiddenColumns[]) this._hiddenColumnsList
+ .toArray(array);
+ }
+
+ /**
+ * Method getHiddenColumnsCount.
+ *
+ * @return the size of this collection
+ */
+ public int getHiddenColumnsCount()
+ {
+ return this._hiddenColumnsList.size();
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: unique id used by jalview to synchronize between stored and
+ * instantiated views
+ *
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'ignoreGapsinConsensus'.
+ *
+ * @return the value of field 'IgnoreGapsinConsensus'.
+ */
+ public boolean getIgnoreGapsinConsensus()
+ {
+ return this._ignoreGapsinConsensus;
+ }
+
+ /**
+ * Returns the value of field 'normaliseSequenceLogo'.
+ *
+ * @return the value of field 'NormaliseSequenceLogo'.
+ */
+ public boolean getNormaliseSequenceLogo()
+ {
+ return this._normaliseSequenceLogo;
+ }
+
+ /**
+ * Returns the value of field 'pidSelected'.
+ *
+ * @return the value of field 'PidSelected'.
+ */
+ public boolean getPidSelected()
+ {
+ return this._pidSelected;
+ }
+
+ /**
+ * Returns the value of field 'pidThreshold'.
+ *
+ * @return the value of field 'PidThreshold'.
+ */
+ public int getPidThreshold()
+ {
+ return this._pidThreshold;
+ }
+
+ /**
+ * Returns the value of field 'renderGaps'.
+ *
+ * @return the value of field 'RenderGaps'.
+ */
+ public boolean getRenderGaps()
+ {
+ return this._renderGaps;
+ }
+
+ /**
+ * Returns the value of field 'rightAlignIds'.
+ *
+ * @return the value of field 'RightAlignIds'.
+ */
+ public boolean getRightAlignIds()
+ {
+ return this._rightAlignIds;
+ }
+
+ /**
+ * Returns the value of field 'scaleProteinAsCdna'.
+ *
+ * @return the value of field 'ScaleProteinAsCdna'.
+ */
+ public boolean getScaleProteinAsCdna()
+ {
+ return this._scaleProteinAsCdna;
+ }
+
+ /**
+ * Returns the value of field 'sequenceSetId'.
+ *
+ * @return the value of field 'SequenceSetId'.
+ */
+ public java.lang.String getSequenceSetId()
+ {
+ return this._sequenceSetId;
+ }
+
+ /**
+ * Returns the value of field 'showAnnotation'.
+ *
+ * @return the value of field 'ShowAnnotation'.
+ */
+ public boolean getShowAnnotation()
+ {
+ return this._showAnnotation;
+ }
+
+ /**
+ * Returns the value of field 'showBoxes'.
+ *
+ * @return the value of field 'ShowBoxes'.
+ */
+ public boolean getShowBoxes()
+ {
+ return this._showBoxes;
+ }
+
+ /**
+ * Returns the value of field 'showColourText'.
+ *
+ * @return the value of field 'ShowColourText'.
+ */
+ public boolean getShowColourText()
+ {
+ return this._showColourText;
+ }
+
+ /**
+ * Returns the value of field 'showConsensusHistogram'.
+ *
+ * @return the value of field 'ShowConsensusHistogram'.
+ */
+ public boolean getShowConsensusHistogram()
+ {
+ return this._showConsensusHistogram;
+ }
+
+ /**
+ * Returns the value of field 'showDbRefTooltip'.
+ *
+ * @return the value of field 'ShowDbRefTooltip'.
+ */
+ public boolean getShowDbRefTooltip()
+ {
+ return this._showDbRefTooltip;
+ }
+
+ /**
+ * Returns the value of field 'showFullId'.
+ *
+ * @return the value of field 'ShowFullId'.
+ */
+ public boolean getShowFullId()
+ {
+ return this._showFullId;
+ }
+
+ /**
+ * Returns the value of field 'showGroupConsensus'.
+ *
+ * @return the value of field 'ShowGroupConsensus'.
+ */
+ public boolean getShowGroupConsensus()
+ {
+ return this._showGroupConsensus;
+ }
+
+ /**
+ * Returns the value of field 'showGroupConservation'.
+ *
+ * @return the value of field 'ShowGroupConservation'.
+ */
+ public boolean getShowGroupConservation()
+ {
+ return this._showGroupConservation;
+ }
+
+ /**
+ * Returns the value of field 'showNPfeatureTooltip'.
+ *
+ * @return the value of field 'ShowNPfeatureTooltip'.
+ */
+ public boolean getShowNPfeatureTooltip()
+ {
+ return this._showNPfeatureTooltip;
+ }
+
+ /**
+ * Returns the value of field 'showSequenceFeatures'.
+ *
+ * @return the value of field 'ShowSequenceFeatures'.
+ */
+ public boolean getShowSequenceFeatures()
+ {
+ return this._showSequenceFeatures;
+ }
+
+ /**
+ * Returns the value of field 'showSequenceLogo'.
+ *
+ * @return the value of field 'ShowSequenceLogo'.
+ */
+ public boolean getShowSequenceLogo()
+ {
+ return this._showSequenceLogo;
+ }
+
+ /**
+ * Returns the value of field 'showText'.
+ *
+ * @return the value of field 'ShowText'.
+ */
+ public boolean getShowText()
+ {
+ return this._showText;
+ }
+
+ /**
+ * Returns the value of field 'showUnconserved'.
+ *
+ * @return the value of field 'ShowUnconserved'.
+ */
+ public boolean getShowUnconserved()
+ {
+ return this._showUnconserved;
+ }
+
+ /**
+ * Returns the value of field 'startRes'.
+ *
+ * @return the value of field 'StartRes'.
+ */
+ public int getStartRes()
+ {
+ return this._startRes;
+ }
+
+ /**
+ * Returns the value of field 'startSeq'.
+ *
+ * @return the value of field 'StartSeq'.
+ */
+ public int getStartSeq()
+ {
+ return this._startSeq;
+ }
+
+ /**
+ * Returns the value of field 'textCol1'.
+ *
+ * @return the value of field 'TextCol1'.
+ */
+ public int getTextCol1()
+ {
+ return this._textCol1;
+ }
+
+ /**
+ * Returns the value of field 'textCol2'.
+ *
+ * @return the value of field 'TextCol2'.
+ */
+ public int getTextCol2()
+ {
+ return this._textCol2;
+ }
+
+ /**
+ * Returns the value of field 'textColThreshold'.
+ *
+ * @return the value of field 'TextColThreshold'.
+ */
+ public int getTextColThreshold()
+ {
+ return this._textColThreshold;
+ }
+
+ /**
+ * Returns the value of field 'title'.
+ *
+ * @return the value of field 'Title'.
+ */
+ public java.lang.String getTitle()
+ {
+ return this._title;
+ }
+
+ /**
+ * Returns the value of field 'viewName'.
+ *
+ * @return the value of field 'ViewName'.
+ */
+ public java.lang.String getViewName()
+ {
+ return this._viewName;
+ }
+
+ /**
+ * Returns the value of field 'width'.
+ *
+ * @return the value of field 'Width'.
+ */
+ public int getWidth()
+ {
+ return this._width;
+ }
+
+ /**
+ * Returns the value of field 'wrapAlignment'.
+ *
+ * @return the value of field 'WrapAlignment'.
+ */
+ public boolean getWrapAlignment()
+ {
+ return this._wrapAlignment;
+ }
+
+ /**
+ * Returns the value of field 'xpos'.
+ *
+ * @return the value of field 'Xpos'.
+ */
+ public int getXpos()
+ {
+ return this._xpos;
+ }
+
+ /**
+ * Returns the value of field 'ypos'.
+ *
+ * @return the value of field 'Ypos'.
+ */
+ public int getYpos()
+ {
+ return this._ypos;
+ }
+
+ /**
+ * Method hasCentreColumnLabels.
+ *
+ * @return true if at least one CentreColumnLabels has been adde
+ */
+ public boolean hasCentreColumnLabels()
+ {
+ return this._has_centreColumnLabels;
+ }
+
+ /**
+ * Method hasConsThreshold.
+ *
+ * @return true if at least one ConsThreshold has been added
+ */
+ public boolean hasConsThreshold()
+ {
+ return this._has_consThreshold;
+ }
+
+ /**
+ * Method hasConservationSelected.
+ *
+ * @return true if at least one ConservationSelected has been added
+ */
+ public boolean hasConservationSelected()
+ {
+ return this._has_conservationSelected;
+ }
+
+ /**
+ * Method hasFollowHighlight.
+ *
+ * @return true if at least one FollowHighlight has been added
+ */
+ public boolean hasFollowHighlight()
+ {
+ return this._has_followHighlight;
+ }
+
+ /**
+ * Method hasFollowSelection.
+ *
+ * @return true if at least one FollowSelection has been added
+ */
+ public boolean hasFollowSelection()
+ {
+ return this._has_followSelection;
+ }
+
+ /**
+ * Method hasFontSize.
+ *
+ * @return true if at least one FontSize has been added
+ */
+ public boolean hasFontSize()
+ {
+ return this._has_fontSize;
+ }
+
+ /**
+ * Method hasFontStyle.
+ *
+ * @return true if at least one FontStyle has been added
+ */
+ public boolean hasFontStyle()
+ {
+ return this._has_fontStyle;
+ }
+
+ /**
+ * Method hasGatheredViews.
+ *
+ * @return true if at least one GatheredViews has been added
+ */
+ public boolean hasGatheredViews()
+ {
+ return this._has_gatheredViews;
+ }
+
+ /**
+ * Method hasHeight.
+ *
+ * @return true if at least one Height has been added
+ */
+ public boolean hasHeight()
+ {
+ return this._has_height;
+ }
+
+ /**
+ * Method hasIgnoreGapsinConsensus.
+ *
+ * @return true if at least one IgnoreGapsinConsensus has been added
+ */
+ public boolean hasIgnoreGapsinConsensus()
+ {
+ return this._has_ignoreGapsinConsensus;
+ }
+
+ /**
+ * Method hasNormaliseSequenceLogo.
+ *
+ * @return true if at least one NormaliseSequenceLogo has been added
+ */
+ public boolean hasNormaliseSequenceLogo()
+ {
+ return this._has_normaliseSequenceLogo;
+ }
+
+ /**
+ * Method hasPidSelected.
+ *
+ * @return true if at least one PidSelected has been added
+ */
+ public boolean hasPidSelected()
+ {
+ return this._has_pidSelected;
+ }
+
+ /**
+ * Method hasPidThreshold.
+ *
+ * @return true if at least one PidThreshold has been added
+ */
+ public boolean hasPidThreshold()
+ {
+ return this._has_pidThreshold;
+ }
+
+ /**
+ * Method hasRenderGaps.
+ *
+ * @return true if at least one RenderGaps has been added
+ */
+ public boolean hasRenderGaps()
+ {
+ return this._has_renderGaps;
+ }
+
+ /**
+ * Method hasRightAlignIds.
+ *
+ * @return true if at least one RightAlignIds has been added
+ */
+ public boolean hasRightAlignIds()
+ {
+ return this._has_rightAlignIds;
+ }
+
+ /**
+ * Method hasScaleProteinAsCdna.
+ *
+ * @return true if at least one ScaleProteinAsCdna has been adde
+ */
+ public boolean hasScaleProteinAsCdna()
+ {
+ return this._has_scaleProteinAsCdna;
+ }
+
+ /**
+ * Method hasShowAnnotation.
+ *
+ * @return true if at least one ShowAnnotation has been added
+ */
+ public boolean hasShowAnnotation()
+ {
+ return this._has_showAnnotation;
+ }
+
+ /**
+ * Method hasShowBoxes.
+ *
+ * @return true if at least one ShowBoxes has been added
+ */
+ public boolean hasShowBoxes()
+ {
+ return this._has_showBoxes;
+ }
+
+ /**
+ * Method hasShowColourText.
+ *
+ * @return true if at least one ShowColourText has been added
+ */
+ public boolean hasShowColourText()
+ {
+ return this._has_showColourText;
+ }
+
+ /**
+ * Method hasShowConsensusHistogram.
+ *
+ * @return true if at least one ShowConsensusHistogram has been added
+ */
+ public boolean hasShowConsensusHistogram()
+ {
+ return this._has_showConsensusHistogram;
+ }
+
+ /**
+ * Method hasShowDbRefTooltip.
+ *
+ * @return true if at least one ShowDbRefTooltip has been added
+ */
+ public boolean hasShowDbRefTooltip()
+ {
+ return this._has_showDbRefTooltip;
+ }
+
+ /**
+ * Method hasShowFullId.
+ *
+ * @return true if at least one ShowFullId has been added
+ */
+ public boolean hasShowFullId()
+ {
+ return this._has_showFullId;
+ }
+
+ /**
+ * Method hasShowGroupConsensus.
+ *
+ * @return true if at least one ShowGroupConsensus has been adde
+ */
+ public boolean hasShowGroupConsensus()
+ {
+ return this._has_showGroupConsensus;
+ }
+
+ /**
+ * Method hasShowGroupConservation.
+ *
+ * @return true if at least one ShowGroupConservation has been added
+ */
+ public boolean hasShowGroupConservation()
+ {
+ return this._has_showGroupConservation;
+ }
+
+ /**
+ * Method hasShowNPfeatureTooltip.
+ *
+ * @return true if at least one ShowNPfeatureTooltip has been added
+ */
+ public boolean hasShowNPfeatureTooltip()
+ {
+ return this._has_showNPfeatureTooltip;
+ }
+
+ /**
+ * Method hasShowSequenceFeatures.
+ *
+ * @return true if at least one ShowSequenceFeatures has been added
+ */
+ public boolean hasShowSequenceFeatures()
+ {
+ return this._has_showSequenceFeatures;
+ }
+
+ /**
+ * Method hasShowSequenceLogo.
+ *
+ * @return true if at least one ShowSequenceLogo has been added
+ */
+ public boolean hasShowSequenceLogo()
+ {
+ return this._has_showSequenceLogo;
+ }
+
+ /**
+ * Method hasShowText.
+ *
+ * @return true if at least one ShowText has been added
+ */
+ public boolean hasShowText()
+ {
+ return this._has_showText;
+ }
+
+ /**
+ * Method hasShowUnconserved.
+ *
+ * @return true if at least one ShowUnconserved has been added
+ */
+ public boolean hasShowUnconserved()
+ {
+ return this._has_showUnconserved;
+ }
+
+ /**
+ * Method hasStartRes.
+ *
+ * @return true if at least one StartRes has been added
+ */
+ public boolean hasStartRes()
+ {
+ return this._has_startRes;
+ }
+
+ /**
+ * Method hasStartSeq.
+ *
+ * @return true if at least one StartSeq has been added
+ */
+ public boolean hasStartSeq()
+ {
+ return this._has_startSeq;
+ }
+
+ /**
+ * Method hasTextCol1.
+ *
+ * @return true if at least one TextCol1 has been added
+ */
+ public boolean hasTextCol1()
+ {
+ return this._has_textCol1;
+ }
+
+ /**
+ * Method hasTextCol2.
+ *
+ * @return true if at least one TextCol2 has been added
+ */
+ public boolean hasTextCol2()
+ {
+ return this._has_textCol2;
+ }
+
+ /**
+ * Method hasTextColThreshold.
+ *
+ * @return true if at least one TextColThreshold has been added
+ */
+ public boolean hasTextColThreshold()
+ {
+ return this._has_textColThreshold;
+ }
+
+ /**
+ * Method hasWidth.
+ *
+ * @return true if at least one Width has been added
+ */
+ public boolean hasWidth()
+ {
+ return this._has_width;
+ }
+
+ /**
+ * Method hasWrapAlignment.
+ *
+ * @return true if at least one WrapAlignment has been added
+ */
+ public boolean hasWrapAlignment()
+ {
+ return this._has_wrapAlignment;
+ }
+
+ /**
+ * Method hasXpos.
+ *
+ * @return true if at least one Xpos has been added
+ */
+ public boolean hasXpos()
+ {
+ return this._has_xpos;
+ }
+
+ /**
+ * Method hasYpos.
+ *
+ * @return true if at least one Ypos has been added
+ */
+ public boolean hasYpos()
+ {
+ return this._has_ypos;
+ }
+
+ /**
+ * Returns the value of field 'centreColumnLabels'.
+ *
+ * @return the value of field 'CentreColumnLabels'.
+ */
+ public boolean isCentreColumnLabels()
+ {
+ return this._centreColumnLabels;
+ }
+
+ /**
+ * Returns the value of field 'conservationSelected'.
+ *
+ * @return the value of field 'ConservationSelected'.
+ */
+ public boolean isConservationSelected()
+ {
+ return this._conservationSelected;
+ }
+
+ /**
+ * Returns the value of field 'followHighlight'.
+ *
+ * @return the value of field 'FollowHighlight'.
+ */
+ public boolean isFollowHighlight()
+ {
+ return this._followHighlight;
+ }
+
+ /**
+ * Returns the value of field 'followSelection'.
+ *
+ * @return the value of field 'FollowSelection'.
+ */
+ public boolean isFollowSelection()
+ {
+ return this._followSelection;
+ }
+
+ /**
+ * Returns the value of field 'gatheredViews'.
+ *
+ * @return the value of field 'GatheredViews'.
+ */
+ public boolean isGatheredViews()
+ {
+ return this._gatheredViews;
+ }
+
+ /**
+ * Returns the value of field 'ignoreGapsinConsensus'.
+ *
+ * @return the value of field 'IgnoreGapsinConsensus'.
+ */
+ public boolean isIgnoreGapsinConsensus()
+ {
+ return this._ignoreGapsinConsensus;
+ }
+
+ /**
+ * Returns the value of field 'normaliseSequenceLogo'.
+ *
+ * @return the value of field 'NormaliseSequenceLogo'.
+ */
+ public boolean isNormaliseSequenceLogo()
+ {
+ return this._normaliseSequenceLogo;
+ }
+
+ /**
+ * Returns the value of field 'pidSelected'.
+ *
+ * @return the value of field 'PidSelected'.
+ */
+ public boolean isPidSelected()
+ {
+ return this._pidSelected;
+ }
+
+ /**
+ * Returns the value of field 'renderGaps'.
+ *
+ * @return the value of field 'RenderGaps'.
+ */
+ public boolean isRenderGaps()
+ {
+ return this._renderGaps;
+ }
+
+ /**
+ * Returns the value of field 'rightAlignIds'.
+ *
+ * @return the value of field 'RightAlignIds'.
+ */
+ public boolean isRightAlignIds()
+ {
+ return this._rightAlignIds;
+ }
+
+ /**
+ * Returns the value of field 'scaleProteinAsCdna'.
+ *
+ * @return the value of field 'ScaleProteinAsCdna'.
+ */
+ public boolean isScaleProteinAsCdna()
+ {
+ return this._scaleProteinAsCdna;
+ }
+
+ /**
+ * Returns the value of field 'showAnnotation'.
+ *
+ * @return the value of field 'ShowAnnotation'.
+ */
+ public boolean isShowAnnotation()
+ {
+ return this._showAnnotation;
+ }
+
+ /**
+ * Returns the value of field 'showBoxes'.
+ *
+ * @return the value of field 'ShowBoxes'.
+ */
+ public boolean isShowBoxes()
+ {
+ return this._showBoxes;
+ }
+
+ /**
+ * Returns the value of field 'showColourText'.
+ *
+ * @return the value of field 'ShowColourText'.
+ */
+ public boolean isShowColourText()
+ {
+ return this._showColourText;
+ }
+
+ /**
+ * Returns the value of field 'showConsensusHistogram'.
+ *
+ * @return the value of field 'ShowConsensusHistogram'.
+ */
+ public boolean isShowConsensusHistogram()
+ {
+ return this._showConsensusHistogram;
+ }
+
+ /**
+ * Returns the value of field 'showDbRefTooltip'.
+ *
+ * @return the value of field 'ShowDbRefTooltip'.
+ */
+ public boolean isShowDbRefTooltip()
+ {
+ return this._showDbRefTooltip;
+ }
+
+ /**
+ * Returns the value of field 'showFullId'.
+ *
+ * @return the value of field 'ShowFullId'.
+ */
+ public boolean isShowFullId()
+ {
+ return this._showFullId;
+ }
+
+ /**
+ * Returns the value of field 'showGroupConsensus'.
+ *
+ * @return the value of field 'ShowGroupConsensus'.
+ */
+ public boolean isShowGroupConsensus()
+ {
+ return this._showGroupConsensus;
+ }
+
+ /**
+ * Returns the value of field 'showGroupConservation'.
+ *
+ * @return the value of field 'ShowGroupConservation'.
+ */
+ public boolean isShowGroupConservation()
+ {
+ return this._showGroupConservation;
+ }
+
+ /**
+ * Returns the value of field 'showNPfeatureTooltip'.
+ *
+ * @return the value of field 'ShowNPfeatureTooltip'.
+ */
+ public boolean isShowNPfeatureTooltip()
+ {
+ return this._showNPfeatureTooltip;
+ }
+
+ /**
+ * Returns the value of field 'showSequenceFeatures'.
+ *
+ * @return the value of field 'ShowSequenceFeatures'.
+ */
+ public boolean isShowSequenceFeatures()
+ {
+ return this._showSequenceFeatures;
+ }
+
+ /**
+ * Returns the value of field 'showSequenceLogo'.
+ *
+ * @return the value of field 'ShowSequenceLogo'.
+ */
+ public boolean isShowSequenceLogo()
+ {
+ return this._showSequenceLogo;
+ }
+
+ /**
+ * Returns the value of field 'showText'.
+ *
+ * @return the value of field 'ShowText'.
+ */
+ public boolean isShowText()
+ {
+ return this._showText;
+ }
+
+ /**
+ * Returns the value of field 'showUnconserved'.
+ *
+ * @return the value of field 'ShowUnconserved'.
+ */
+ public boolean isShowUnconserved()
+ {
+ return this._showUnconserved;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the value of field 'wrapAlignment'.
+ *
+ * @return the value of field 'WrapAlignment'.
+ */
+ public boolean isWrapAlignment()
+ {
+ return this._wrapAlignment;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllCalcIdParam()
+ {
+ this._calcIdParamList.clear();
+ }
+
+ /**
+ */
+ public void removeAllHiddenColumns()
+ {
+ this._hiddenColumnsList.clear();
+ }
+
+ /**
+ * Method removeCalcIdParam.
+ *
+ * @param vCalcIdParam
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeCalcIdParam(
+ final jalview.schemabinding.version2.CalcIdParam vCalcIdParam)
+ {
+ boolean removed = _calcIdParamList.remove(vCalcIdParam);
+ return removed;
+ }
+
+ /**
+ * Method removeCalcIdParamAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.CalcIdParam removeCalcIdParamAt(
+ final int index)
+ {
+ java.lang.Object obj = this._calcIdParamList.remove(index);
+ return (jalview.schemabinding.version2.CalcIdParam) obj;
+ }
+
+ /**
+ * Method removeHiddenColumns.
+ *
+ * @param vHiddenColumns
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeHiddenColumns(
+ final jalview.schemabinding.version2.HiddenColumns vHiddenColumns)
+ {
+ boolean removed = _hiddenColumnsList.remove(vHiddenColumns);
+ return removed;
+ }
+
+ /**
+ * Method removeHiddenColumnsAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.HiddenColumns removeHiddenColumnsAt(
+ final int index)
+ {
+ java.lang.Object obj = this._hiddenColumnsList.remove(index);
+ return (jalview.schemabinding.version2.HiddenColumns) obj;
+ }
+
+ /**
+ * Sets the value of field 'annotationColours'.
+ *
+ * @param annotationColours
+ * the value of field 'annotationColours'.
+ */
+ public void setAnnotationColours(
+ final jalview.schemabinding.version2.AnnotationColours annotationColours)
+ {
+ this._annotationColours = annotationColours;
+ }
+
+ /**
+ * Sets the value of field 'bgColour'.
+ *
+ * @param bgColour
+ * the value of field 'bgColour'.
+ */
+ public void setBgColour(final java.lang.String bgColour)
+ {
+ this._bgColour = bgColour;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vCalcIdParam
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setCalcIdParam(final int index,
+ final jalview.schemabinding.version2.CalcIdParam vCalcIdParam)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._calcIdParamList.size())
+ {
+ throw new IndexOutOfBoundsException("setCalcIdParam: Index value '"
+ + index + "' not in range [0.."
+ + (this._calcIdParamList.size() - 1) + "]");
+ }
+
+ this._calcIdParamList.set(index, vCalcIdParam);
+ }
+
+ /**
+ *
+ *
+ * @param vCalcIdParamArray
+ */
+ public void setCalcIdParam(
+ final jalview.schemabinding.version2.CalcIdParam[] vCalcIdParamArray)
+ {
+ // -- copy array
+ _calcIdParamList.clear();
+
+ for (int i = 0; i < vCalcIdParamArray.length; i++)
+ {
+ this._calcIdParamList.add(vCalcIdParamArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'centreColumnLabels'.
+ *
+ * @param centreColumnLabels
+ * the value of field 'centreColumnLabels'.
+ */
+ public void setCentreColumnLabels(final boolean centreColumnLabels)
+ {
+ this._centreColumnLabels = centreColumnLabels;
+ this._has_centreColumnLabels = true;
+ }
+
+ /**
+ * Sets the value of field 'complementId'. The field 'complementId' has the
+ * following description: The viewport id of this viewport's (cdna/protein)
+ * coding complement, if any
+ *
+ *
+ * @param complementId
+ * the value of field 'complementId'.
+ */
+ public void setComplementId(final java.lang.String complementId)
+ {
+ this._complementId = complementId;
+ }
+
+ /**
+ * Sets the value of field 'consThreshold'.
+ *
+ * @param consThreshold
+ * the value of field 'consThreshold'.
+ */
+ public void setConsThreshold(final int consThreshold)
+ {
+ this._consThreshold = consThreshold;
+ this._has_consThreshold = true;
+ }
+
+ /**
+ * Sets the value of field 'conservationSelected'.
+ *
+ * @param conservationSelected
+ * the value of field 'conservationSelected'.
+ */
+ public void setConservationSelected(final boolean conservationSelected)
+ {
+ this._conservationSelected = conservationSelected;
+ this._has_conservationSelected = true;
+ }
+
+ /**
+ * Sets the value of field 'followHighlight'.
+ *
+ * @param followHighlight
+ * the value of field 'followHighlight'.
+ */
+ public void setFollowHighlight(final boolean followHighlight)
+ {
+ this._followHighlight = followHighlight;
+ this._has_followHighlight = true;
+ }
+
+ /**
+ * Sets the value of field 'followSelection'.
+ *
+ * @param followSelection
+ * the value of field 'followSelection'.
+ */
+ public void setFollowSelection(final boolean followSelection)
+ {
+ this._followSelection = followSelection;
+ this._has_followSelection = true;
+ }
+
+ /**
+ * Sets the value of field 'fontName'.
+ *
+ * @param fontName
+ * the value of field 'fontName'.
+ */
+ public void setFontName(final java.lang.String fontName)
+ {
+ this._fontName = fontName;
+ }
+
+ /**
+ * Sets the value of field 'fontSize'.
+ *
+ * @param fontSize
+ * the value of field 'fontSize'.
+ */
+ public void setFontSize(final int fontSize)
+ {
+ this._fontSize = fontSize;
+ this._has_fontSize = true;
+ }
+
+ /**
+ * Sets the value of field 'fontStyle'.
+ *
+ * @param fontStyle
+ * the value of field 'fontStyle'.
+ */
+ public void setFontStyle(final int fontStyle)
+ {
+ this._fontStyle = fontStyle;
+ this._has_fontStyle = true;
+ }
+
+ /**
+ * Sets the value of field 'gatheredViews'.
+ *
+ * @param gatheredViews
+ * the value of field 'gatheredViews'.
+ */
+ public void setGatheredViews(final boolean gatheredViews)
+ {
+ this._gatheredViews = gatheredViews;
+ this._has_gatheredViews = true;
+ }
+
+ /**
+ * Sets the value of field 'height'.
+ *
+ * @param height
+ * the value of field 'height'.
+ */
+ public void setHeight(final int height)
+ {
+ this._height = height;
+ this._has_height = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vHiddenColumns
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setHiddenColumns(final int index,
+ final jalview.schemabinding.version2.HiddenColumns vHiddenColumns)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._hiddenColumnsList.size())
+ {
+ throw new IndexOutOfBoundsException("setHiddenColumns: Index value '"
+ + index + "' not in range [0.."
+ + (this._hiddenColumnsList.size() - 1) + "]");
+ }
+
+ this._hiddenColumnsList.set(index, vHiddenColumns);
+ }
+
+ /**
+ *
+ *
+ * @param vHiddenColumnsArray
+ */
+ public void setHiddenColumns(
+ final jalview.schemabinding.version2.HiddenColumns[] vHiddenColumnsArray)
+ {
+ // -- copy array
+ _hiddenColumnsList.clear();
+
+ for (int i = 0; i < vHiddenColumnsArray.length; i++)
+ {
+ this._hiddenColumnsList.add(vHiddenColumnsArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * unique id used by jalview to synchronize between stored and instantiated
+ * views
+ *
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'ignoreGapsinConsensus'.
+ *
+ * @param ignoreGapsinConsensus
+ * the value of field 'ignoreGapsinConsensus'.
+ */
+ public void setIgnoreGapsinConsensus(final boolean ignoreGapsinConsensus)
+ {
+ this._ignoreGapsinConsensus = ignoreGapsinConsensus;
+ this._has_ignoreGapsinConsensus = true;
+ }
+
+ /**
+ * Sets the value of field 'normaliseSequenceLogo'.
+ *
+ * @param normaliseSequenceLogo
+ * the value of field 'normaliseSequenceLogo'.
+ */
+ public void setNormaliseSequenceLogo(final boolean normaliseSequenceLogo)
+ {
+ this._normaliseSequenceLogo = normaliseSequenceLogo;
+ this._has_normaliseSequenceLogo = true;
+ }
+
+ /**
+ * Sets the value of field 'pidSelected'.
+ *
+ * @param pidSelected
+ * the value of field 'pidSelected'.
+ */
+ public void setPidSelected(final boolean pidSelected)
+ {
+ this._pidSelected = pidSelected;
+ this._has_pidSelected = true;
+ }
+
+ /**
+ * Sets the value of field 'pidThreshold'.
+ *
+ * @param pidThreshold
+ * the value of field 'pidThreshold'.
+ */
+ public void setPidThreshold(final int pidThreshold)
+ {
+ this._pidThreshold = pidThreshold;
+ this._has_pidThreshold = true;
+ }
+
+ /**
+ * Sets the value of field 'renderGaps'.
+ *
+ * @param renderGaps
+ * the value of field 'renderGaps'.
+ */
+ public void setRenderGaps(final boolean renderGaps)
+ {
+ this._renderGaps = renderGaps;
+ this._has_renderGaps = true;
+ }
+
+ /**
+ * Sets the value of field 'rightAlignIds'.
+ *
+ * @param rightAlignIds
+ * the value of field 'rightAlignIds'.
+ */
+ public void setRightAlignIds(final boolean rightAlignIds)
+ {
+ this._rightAlignIds = rightAlignIds;
+ this._has_rightAlignIds = true;
+ }
+
+ /**
+ * Sets the value of field 'scaleProteinAsCdna'.
+ *
+ * @param scaleProteinAsCdna
+ * the value of field 'scaleProteinAsCdna'.
+ */
+ public void setScaleProteinAsCdna(final boolean scaleProteinAsCdna)
+ {
+ this._scaleProteinAsCdna = scaleProteinAsCdna;
+ this._has_scaleProteinAsCdna = true;
+ }
+
+ /**
+ * Sets the value of field 'sequenceSetId'.
+ *
+ * @param sequenceSetId
+ * the value of field 'sequenceSetId'.
+ */
+ public void setSequenceSetId(final java.lang.String sequenceSetId)
+ {
+ this._sequenceSetId = sequenceSetId;
+ }
+
+ /**
+ * Sets the value of field 'showAnnotation'.
+ *
+ * @param showAnnotation
+ * the value of field 'showAnnotation'.
+ */
+ public void setShowAnnotation(final boolean showAnnotation)
+ {
+ this._showAnnotation = showAnnotation;
+ this._has_showAnnotation = true;
+ }
+
+ /**
+ * Sets the value of field 'showBoxes'.
+ *
+ * @param showBoxes
+ * the value of field 'showBoxes'.
+ */
+ public void setShowBoxes(final boolean showBoxes)
+ {
+ this._showBoxes = showBoxes;
+ this._has_showBoxes = true;
+ }
+
+ /**
+ * Sets the value of field 'showColourText'.
+ *
+ * @param showColourText
+ * the value of field 'showColourText'.
+ */
+ public void setShowColourText(final boolean showColourText)
+ {
+ this._showColourText = showColourText;
+ this._has_showColourText = true;
+ }
+
+ /**
+ * Sets the value of field 'showConsensusHistogram'.
+ *
+ * @param showConsensusHistogram
+ * the value of field 'showConsensusHistogram'.
+ */
+ public void setShowConsensusHistogram(final boolean showConsensusHistogram)
+ {
+ this._showConsensusHistogram = showConsensusHistogram;
+ this._has_showConsensusHistogram = true;
+ }
+
+ /**
+ * Sets the value of field 'showDbRefTooltip'.
+ *
+ * @param showDbRefTooltip
+ * the value of field 'showDbRefTooltip'
+ */
+ public void setShowDbRefTooltip(final boolean showDbRefTooltip)
+ {
+ this._showDbRefTooltip = showDbRefTooltip;
+ this._has_showDbRefTooltip = true;
+ }
+
+ /**
+ * Sets the value of field 'showFullId'.
+ *
+ * @param showFullId
+ * the value of field 'showFullId'.
+ */
+ public void setShowFullId(final boolean showFullId)
+ {
+ this._showFullId = showFullId;
+ this._has_showFullId = true;
+ }
+
+ /**
+ * Sets the value of field 'showGroupConsensus'.
+ *
+ * @param showGroupConsensus
+ * the value of field 'showGroupConsensus'.
+ */
+ public void setShowGroupConsensus(final boolean showGroupConsensus)
+ {
+ this._showGroupConsensus = showGroupConsensus;
+ this._has_showGroupConsensus = true;
+ }
+
+ /**
+ * Sets the value of field 'showGroupConservation'.
+ *
+ * @param showGroupConservation
+ * the value of field 'showGroupConservation'.
+ */
+ public void setShowGroupConservation(final boolean showGroupConservation)
+ {
+ this._showGroupConservation = showGroupConservation;
+ this._has_showGroupConservation = true;
+ }
+
+ /**
+ * Sets the value of field 'showNPfeatureTooltip'.
+ *
+ * @param showNPfeatureTooltip
+ * the value of field 'showNPfeatureTooltip'.
+ */
+ public void setShowNPfeatureTooltip(final boolean showNPfeatureTooltip)
+ {
+ this._showNPfeatureTooltip = showNPfeatureTooltip;
+ this._has_showNPfeatureTooltip = true;
+ }
+
+ /**
+ * Sets the value of field 'showSequenceFeatures'.
+ *
+ * @param showSequenceFeatures
+ * the value of field 'showSequenceFeatures'.
+ */
+ public void setShowSequenceFeatures(final boolean showSequenceFeatures)
+ {
+ this._showSequenceFeatures = showSequenceFeatures;
+ this._has_showSequenceFeatures = true;
+ }
+
+ /**
+ * Sets the value of field 'showSequenceLogo'.
+ *
+ * @param showSequenceLogo
+ * the value of field 'showSequenceLogo'
+ */
+ public void setShowSequenceLogo(final boolean showSequenceLogo)
+ {
+ this._showSequenceLogo = showSequenceLogo;
+ this._has_showSequenceLogo = true;
+ }
+
+ /**
+ * Sets the value of field 'showText'.
+ *
+ * @param showText
+ * the value of field 'showText'.
+ */
+ public void setShowText(final boolean showText)
+ {
+ this._showText = showText;
+ this._has_showText = true;
+ }
+
+ /**
+ * Sets the value of field 'showUnconserved'.
+ *
+ * @param showUnconserved
+ * the value of field 'showUnconserved'.
+ */
+ public void setShowUnconserved(final boolean showUnconserved)
+ {
+ this._showUnconserved = showUnconserved;
+ this._has_showUnconserved = true;
+ }
+
+ /**
+ * Sets the value of field 'startRes'.
+ *
+ * @param startRes
+ * the value of field 'startRes'.
+ */
+ public void setStartRes(final int startRes)
+ {
+ this._startRes = startRes;
+ this._has_startRes = true;
+ }
+
+ /**
+ * Sets the value of field 'startSeq'.
+ *
+ * @param startSeq
+ * the value of field 'startSeq'.
+ */
+ public void setStartSeq(final int startSeq)
+ {
+ this._startSeq = startSeq;
+ this._has_startSeq = true;
+ }
+
+ /**
+ * Sets the value of field 'textCol1'.
+ *
+ * @param textCol1
+ * the value of field 'textCol1'.
+ */
+ public void setTextCol1(final int textCol1)
+ {
+ this._textCol1 = textCol1;
+ this._has_textCol1 = true;
+ }
+
+ /**
+ * Sets the value of field 'textCol2'.
+ *
+ * @param textCol2
+ * the value of field 'textCol2'.
+ */
+ public void setTextCol2(final int textCol2)
+ {
+ this._textCol2 = textCol2;
+ this._has_textCol2 = true;
+ }
+
+ /**
+ * Sets the value of field 'textColThreshold'.
+ *
+ * @param textColThreshold
+ * the value of field 'textColThreshold'
+ */
+ public void setTextColThreshold(final int textColThreshold)
+ {
+ this._textColThreshold = textColThreshold;
+ this._has_textColThreshold = true;
+ }
+
+ /**
+ * Sets the value of field 'title'.
+ *
+ * @param title
+ * the value of field 'title'.
+ */
+ public void setTitle(final java.lang.String title)
+ {
+ this._title = title;
+ }
+
+ /**
+ * Sets the value of field 'viewName'.
+ *
+ * @param viewName
+ * the value of field 'viewName'.
+ */
+ public void setViewName(final java.lang.String viewName)
+ {
+ this._viewName = viewName;
+ }
+
+ /**
+ * Sets the value of field 'width'.
+ *
+ * @param width
+ * the value of field 'width'.
+ */
+ public void setWidth(final int width)
+ {
+ this._width = width;
+ this._has_width = true;
+ }
+
+ /**
+ * Sets the value of field 'wrapAlignment'.
+ *
+ * @param wrapAlignment
+ * the value of field 'wrapAlignment'.
+ */
+ public void setWrapAlignment(final boolean wrapAlignment)
+ {
+ this._wrapAlignment = wrapAlignment;
+ this._has_wrapAlignment = true;
+ }
+
+ /**
+ * Sets the value of field 'xpos'.
+ *
+ * @param xpos
+ * the value of field 'xpos'.
+ */
+ public void setXpos(final int xpos)
+ {
+ this._xpos = xpos;
+ this._has_xpos = true;
+ }
+
+ /**
+ * Sets the value of field 'ypos'.
+ *
+ * @param ypos
+ * the value of field 'ypos'.
+ */
+ public void setYpos(final int ypos)
+ {
+ this._ypos = ypos;
+ this._has_ypos = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.Viewport
+ */
+ public static jalview.schemabinding.version2.Viewport unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.Viewport) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.Viewport.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/WebServiceParameterSet.java b/src/jalview/schemabinding/version2/WebServiceParameterSet.java
index ba7f6a1..72d2f82 100644
--- a/src/jalview/schemabinding/version2/WebServiceParameterSet.java
+++ b/src/jalview/schemabinding/version2/WebServiceParameterSet.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
@@ -36,421 +19,418 @@ import org.exolab.castor.xml.Unmarshaller;
*
* @version $Revision$ $Date$
*/
-public class WebServiceParameterSet implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * The short name for the parameter set. This will be shown
- * amongst the
- * other presets for the web service.
- *
- */
- private java.lang.String _name;
-
- /**
- * A Jalview Web Service Parameter Set container
- * version number.
- * Version 1 created for storing Jaba user presets.
- *
- */
- private java.lang.String _version;
-
- /**
- * Short description - as utf8 encoded text. This is
- * usually displayed
- * in the body of an HTML capable tooltip, so HTML tags may be
- * embedded
- * using standard UTF8 encoding.
- *
- */
- private java.lang.String _description;
-
- /**
- * URL for which the parameter set is valid. Jalview will use
- * it to
- * match up parameter sets to service instances that can parse
- * the
- * parameter set payload.
- *
- */
- private java.util.Vector _serviceURLList;
-
- /**
- * UTF8 encoded string to be processed into a specific web
- * services'
- * parameter set. Note - newlines may be important to the
- * structure
- * of this file.
- *
- */
- private java.lang.String _parameters;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public WebServiceParameterSet() {
- super();
- this._serviceURLList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vServiceURL
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addServiceURL(
- final java.lang.String vServiceURL)
- throws java.lang.IndexOutOfBoundsException {
- this._serviceURLList.addElement(vServiceURL);
+public class WebServiceParameterSet implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * The short name for the parameter set. This will be shown amongst the other
+ * presets for the web service.
+ *
+ */
+ private java.lang.String _name;
+
+ /**
+ * A Jalview Web Service Parameter Set container version number. Version 1
+ * created for storing Jaba user presets.
+ *
+ */
+ private java.lang.String _version;
+
+ /**
+ * Short description - as utf8 encoded text. This is usually displayed in the
+ * body of an HTML capable tooltip, so HTML tags may be embedded using
+ * standard UTF8 encoding.
+ *
+ */
+ private java.lang.String _description;
+
+ /**
+ * URL for which the parameter set is valid. Jalview will use it to match up
+ * parameter sets to service instances that can parse the parameter set
+ * payload.
+ *
+ */
+ private java.util.Vector _serviceURLList;
+
+ /**
+ * UTF8 encoded string to be processed into a specific web services' parameter
+ * set. Note - newlines may be important to the structure of this file.
+ *
+ */
+ private java.lang.String _parameters;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public WebServiceParameterSet()
+ {
+ super();
+ this._serviceURLList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vServiceURL
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addServiceURL(final java.lang.String vServiceURL)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._serviceURLList.addElement(vServiceURL);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vServiceURL
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addServiceURL(final int index,
+ final java.lang.String vServiceURL)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._serviceURLList.add(index, vServiceURL);
+ }
+
+ /**
+ * Method enumerateServiceURL.
+ *
+ * @return an Enumeration over all java.lang.String elements
+ */
+ public java.util.Enumeration enumerateServiceURL()
+ {
+ return this._serviceURLList.elements();
+ }
+
+ /**
+ * Returns the value of field 'description'. The field 'description' has the
+ * following description: Short description - as utf8 encoded text. This is
+ * usually displayed in the body of an HTML capable tooltip, so HTML tags may
+ * be embedded using standard UTF8 encoding.
+ *
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription()
+ {
+ return this._description;
+ }
+
+ /**
+ * Returns the value of field 'name'. The field 'name' has the following
+ * description: The short name for the parameter set. This will be shown
+ * amongst the other presets for the web service.
+ *
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ }
+
+ /**
+ * Returns the value of field 'parameters'. The field 'parameters' has the
+ * following description: UTF8 encoded string to be processed into a specific
+ * web services' parameter set. Note - newlines may be important to the
+ * structure of this file.
+ *
+ *
+ * @return the value of field 'Parameters'.
+ */
+ public java.lang.String getParameters()
+ {
+ return this._parameters;
+ }
+
+ /**
+ * Method getServiceURL.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the java.lang.String at the given index
+ */
+ public java.lang.String getServiceURL(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._serviceURLList.size())
+ {
+ throw new IndexOutOfBoundsException("getServiceURL: Index value '"
+ + index + "' not in range [0.."
+ + (this._serviceURLList.size() - 1) + "]");
}
- /**
- *
- *
- * @param index
- * @param vServiceURL
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addServiceURL(
- final int index,
- final java.lang.String vServiceURL)
- throws java.lang.IndexOutOfBoundsException {
- this._serviceURLList.add(index, vServiceURL);
+ return (java.lang.String) _serviceURLList.get(index);
+ }
+
+ /**
+ * Method getServiceURL.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public java.lang.String[] getServiceURL()
+ {
+ java.lang.String[] array = new java.lang.String[0];
+ return (java.lang.String[]) this._serviceURLList.toArray(array);
+ }
+
+ /**
+ * Method getServiceURLCount.
+ *
+ * @return the size of this collection
+ */
+ public int getServiceURLCount()
+ {
+ return this._serviceURLList.size();
+ }
+
+ /**
+ * Returns the value of field 'version'. The field 'version' has the following
+ * description: A Jalview Web Service Parameter Set container version number.
+ * Version 1 created for storing Jaba user presets.
+ *
+ *
+ * @return the value of field 'Version'.
+ */
+ public java.lang.String getVersion()
+ {
+ return this._version;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
}
-
- /**
- * Method enumerateServiceURL.
- *
- * @return an Enumeration over all java.lang.String elements
- */
- public java.util.Enumeration enumerateServiceURL(
- ) {
- return this._serviceURLList.elements();
- }
-
- /**
- * Returns the value of field 'description'. The field
- * 'description' has the following description: Short
- * description - as utf8 encoded text. This is
- * usually displayed
- * in the body of an HTML capable tooltip, so HTML tags may be
- * embedded
- * using standard UTF8 encoding.
- *
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Returns the value of field 'name'. The field 'name' has the
- * following description: The short name for the parameter set.
- * This will be shown amongst the
- * other presets for the web service.
- *
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Returns the value of field 'parameters'. The field
- * 'parameters' has the following description: UTF8 encoded
- * string to be processed into a specific web services'
- * parameter set. Note - newlines may be important to the
- * structure
- * of this file.
- *
- *
- * @return the value of field 'Parameters'.
- */
- public java.lang.String getParameters(
- ) {
- return this._parameters;
- }
-
- /**
- * Method getServiceURL.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the java.lang.String at the given index
- */
- public java.lang.String getServiceURL(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._serviceURLList.size()) {
- throw new IndexOutOfBoundsException("getServiceURL: Index value '" + index + "' not in range [0.." + (this._serviceURLList.size() - 1) + "]");
- }
-
- return (java.lang.String) _serviceURLList.get(index);
- }
-
- /**
- * Method getServiceURL.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public java.lang.String[] getServiceURL(
- ) {
- java.lang.String[] array = new java.lang.String[0];
- return (java.lang.String[]) this._serviceURLList.toArray(array);
- }
-
- /**
- * Method getServiceURLCount.
- *
- * @return the size of this collection
- */
- public int getServiceURLCount(
- ) {
- return this._serviceURLList.size();
- }
-
- /**
- * Returns the value of field 'version'. The field 'version'
- * has the following description: A Jalview Web Service
- * Parameter Set container
- * version number.
- * Version 1 created for storing Jaba user presets.
- *
- *
- * @return the value of field 'Version'.
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public java.lang.String getVersion(
- ) {
- return this._version;
+ public void removeAllServiceURL()
+ {
+ this._serviceURLList.clear();
+ }
+
+ /**
+ * Method removeServiceURL.
+ *
+ * @param vServiceURL
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeServiceURL(final java.lang.String vServiceURL)
+ {
+ boolean removed = _serviceURLList.remove(vServiceURL);
+ return removed;
+ }
+
+ /**
+ * Method removeServiceURLAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public java.lang.String removeServiceURLAt(final int index)
+ {
+ java.lang.Object obj = this._serviceURLList.remove(index);
+ return (java.lang.String) obj;
+ }
+
+ /**
+ * Sets the value of field 'description'. The field 'description' has the
+ * following description: Short description - as utf8 encoded text. This is
+ * usually displayed in the body of an HTML capable tooltip, so HTML tags may
+ * be embedded using standard UTF8 encoding.
+ *
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description)
+ {
+ this._description = description;
+ }
+
+ /**
+ * Sets the value of field 'name'. The field 'name' has the following
+ * description: The short name for the parameter set. This will be shown
+ * amongst the other presets for the web service.
+ *
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name)
+ {
+ this._name = name;
+ }
+
+ /**
+ * Sets the value of field 'parameters'. The field 'parameters' has the
+ * following description: UTF8 encoded string to be processed into a specific
+ * web services' parameter set. Note - newlines may be important to the
+ * structure of this file.
+ *
+ *
+ * @param parameters
+ * the value of field 'parameters'.
+ */
+ public void setParameters(final java.lang.String parameters)
+ {
+ this._parameters = parameters;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vServiceURL
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setServiceURL(final int index,
+ final java.lang.String vServiceURL)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._serviceURLList.size())
+ {
+ throw new IndexOutOfBoundsException("setServiceURL: Index value '"
+ + index + "' not in range [0.."
+ + (this._serviceURLList.size() - 1) + "]");
}
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllServiceURL(
- ) {
- this._serviceURLList.clear();
- }
-
- /**
- * Method removeServiceURL.
- *
- * @param vServiceURL
- * @return true if the object was removed from the collection.
- */
- public boolean removeServiceURL(
- final java.lang.String vServiceURL) {
- boolean removed = _serviceURLList.remove(vServiceURL);
- return removed;
- }
-
- /**
- * Method removeServiceURLAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public java.lang.String removeServiceURLAt(
- final int index) {
- java.lang.Object obj = this._serviceURLList.remove(index);
- return (java.lang.String) obj;
- }
-
- /**
- * Sets the value of field 'description'. The field
- * 'description' has the following description: Short
- * description - as utf8 encoded text. This is
- * usually displayed
- * in the body of an HTML capable tooltip, so HTML tags may be
- * embedded
- * using standard UTF8 encoding.
- *
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
- }
-
- /**
- * Sets the value of field 'name'. The field 'name' has the
- * following description: The short name for the parameter set.
- * This will be shown amongst the
- * other presets for the web service.
- *
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- * Sets the value of field 'parameters'. The field 'parameters'
- * has the following description: UTF8 encoded string to be
- * processed into a specific web services'
- * parameter set. Note - newlines may be important to the
- * structure
- * of this file.
- *
- *
- * @param parameters the value of field 'parameters'.
- */
- public void setParameters(
- final java.lang.String parameters) {
- this._parameters = parameters;
- }
-
- /**
- *
- *
- * @param index
- * @param vServiceURL
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setServiceURL(
- final int index,
- final java.lang.String vServiceURL)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._serviceURLList.size()) {
- throw new IndexOutOfBoundsException("setServiceURL: Index value '" + index + "' not in range [0.." + (this._serviceURLList.size() - 1) + "]");
- }
-
- this._serviceURLList.set(index, vServiceURL);
- }
-
- /**
- *
- *
- * @param vServiceURLArray
- */
- public void setServiceURL(
- final java.lang.String[] vServiceURLArray) {
- //-- copy array
- _serviceURLList.clear();
-
- for (int i = 0; i < vServiceURLArray.length; i++) {
- this._serviceURLList.add(vServiceURLArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'version'. The field 'version' has
- * the following description: A Jalview Web Service Parameter
- * Set container
- * version number.
- * Version 1 created for storing Jaba user presets.
- *
- *
- * @param version the value of field 'version'.
- */
- public void setVersion(
- final java.lang.String version) {
- this._version = version;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * jalview.schemabinding.version2.WebServiceParameterSet
- */
- public static jalview.schemabinding.version2.WebServiceParameterSet unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.WebServiceParameterSet) Unmarshaller.unmarshal(jalview.schemabinding.version2.WebServiceParameterSet.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._serviceURLList.set(index, vServiceURL);
+ }
+
+ /**
+ *
+ *
+ * @param vServiceURLArray
+ */
+ public void setServiceURL(final java.lang.String[] vServiceURLArray)
+ {
+ // -- copy array
+ _serviceURLList.clear();
+
+ for (int i = 0; i < vServiceURLArray.length; i++)
+ {
+ this._serviceURLList.add(vServiceURLArray[i]);
}
+ }
+
+ /**
+ * Sets the value of field 'version'. The field 'version' has the following
+ * description: A Jalview Web Service Parameter Set container version number.
+ * Version 1 created for storing Jaba user presets.
+ *
+ *
+ * @param version
+ * the value of field 'version'.
+ */
+ public void setVersion(final java.lang.String version)
+ {
+ this._version = version;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled
+ * jalview.schemabinding.version2.WebServiceParameterSet
+ */
+ public static jalview.schemabinding.version2.WebServiceParameterSet unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.WebServiceParameterSet) Unmarshaller
+ .unmarshal(
+ jalview.schemabinding.version2.WebServiceParameterSet.class,
+ reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java
index edfba43..1447978 100644
--- a/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.AlcodMap;
@@ -35,217 +18,230 @@ import jalview.schemabinding.version2.AlcodMap;
*
* @version $Revision$ $Date$
*/
-public class AlcodMapDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AlcodMapDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "alcodMap";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _dnasq
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_dnasq", "dnasq", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AlcodMap target = (AlcodMap) object;
- return target.getDnasq();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AlcodMap target = (AlcodMap) object;
- target.setDnasq( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _dnasq
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _mapping
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Mapping.class, "_mapping", "Mapping", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AlcodMap target = (AlcodMap) object;
- return target.getMapping();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AlcodMap target = (AlcodMap) object;
- target.setMapping( (jalview.schemabinding.version2.Mapping) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Mapping();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _mapping
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
+public class AlcodMapDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AlcodMapDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "alcodMap";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _dnasq
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_dnasq", "dnasq",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AlcodMap target = (AlcodMap) object;
+ return target.getDnasq();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AlcodMap target = (AlcodMap) object;
+ target.setDnasq((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _dnasq
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.AlcodMap.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _mapping
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Mapping.class, "_mapping",
+ "Mapping", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AlcodMap target = (AlcodMap) object;
+ return target.getMapping();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AlcodMap target = (AlcodMap) object;
+ target.setMapping((jalview.schemabinding.version2.Mapping) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Mapping();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _mapping
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.AlcodMap.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java
index 998bc98..c1a0eab 100644
--- a/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Alcodon;
@@ -35,263 +18,296 @@ import jalview.schemabinding.version2.Alcodon;
*
* @version $Revision$ $Date$
*/
-public class AlcodonDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AlcodonDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "alcodon";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _pos1
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_pos1", "pos1", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Alcodon target = (Alcodon) object;
- if (!target.hasPos1()) { return null; }
- return new java.lang.Long(target.getPos1());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Alcodon target = (Alcodon) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deletePos1();
- return;
- }
- target.setPos1( ((java.lang.Long) value).longValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _pos1
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.LongValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _pos2
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_pos2", "pos2", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Alcodon target = (Alcodon) object;
- if (!target.hasPos2()) { return null; }
- return new java.lang.Long(target.getPos2());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Alcodon target = (Alcodon) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deletePos2();
- return;
- }
- target.setPos2( ((java.lang.Long) value).longValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _pos2
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.LongValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();
- fieldValidator.setValidator(typeValidator);
+public class AlcodonDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AlcodonDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "alcodon";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _pos1
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Long.TYPE, "_pos1", "pos1",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Alcodon target = (Alcodon) object;
+ if (!target.hasPos1())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _pos3
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_pos3", "pos3", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Alcodon target = (Alcodon) object;
- if (!target.hasPos3()) { return null; }
- return new java.lang.Long(target.getPos3());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Alcodon target = (Alcodon) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deletePos3();
- return;
- }
- target.setPos3( ((java.lang.Long) value).longValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _pos3
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.LongValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();
- fieldValidator.setValidator(typeValidator);
+ return new java.lang.Long(target.getPos1());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Alcodon target = (Alcodon) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deletePos1();
+ return;
+ }
+ target.setPos1(((java.lang.Long) value).longValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+ // -- validation code for: _pos1
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.LongValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _pos2
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Long.TYPE, "_pos2", "pos2",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Alcodon target = (Alcodon) object;
+ if (!target.hasPos2())
+ {
+ return null;
+ }
+ return new java.lang.Long(target.getPos2());
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Alcodon target = (Alcodon) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deletePos2();
+ return;
+ }
+ target.setPos2(((java.lang.Long) value).longValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _pos2
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.LongValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _pos3
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Long.TYPE, "_pos3", "pos3",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Alcodon target = (Alcodon) object;
+ if (!target.hasPos3())
+ {
+ return null;
+ }
+ return new java.lang.Long(target.getPos3());
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Alcodon.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Alcodon target = (Alcodon) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deletePos3();
+ return;
+ }
+ target.setPos3(((java.lang.Long) value).longValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _pos3
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.LongValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Alcodon.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java
index 30d9c98..919941e 100644
--- a/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.AlcodonFrame;
@@ -35,227 +18,250 @@ import jalview.schemabinding.version2.AlcodonFrame;
*
* @version $Revision$ $Date$
*/
-public class AlcodonFrameDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AlcodonFrameDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "AlcodonFrame";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- initialize element descriptors
-
- //-- _alcodonList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Alcodon.class, "_alcodonList", "alcodon", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AlcodonFrame target = (AlcodonFrame) object;
- return target.getAlcodon();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AlcodonFrame target = (AlcodonFrame) object;
- target.addAlcodon( (jalview.schemabinding.version2.Alcodon) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- AlcodonFrame target = (AlcodonFrame) object;
- target.removeAllAlcodon();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Alcodon();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _alcodonList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+public class AlcodonFrameDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AlcodonFrameDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "AlcodonFrame";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- initialize element descriptors
+
+ // -- _alcodonList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Alcodon.class, "_alcodonList",
+ "alcodon", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AlcodonFrame target = (AlcodonFrame) object;
+ return target.getAlcodon();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AlcodonFrame target = (AlcodonFrame) object;
+ target.addAlcodon((jalview.schemabinding.version2.Alcodon) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _alcodMapList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.AlcodMap.class, "_alcodMapList", "alcodMap", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AlcodonFrame target = (AlcodonFrame) object;
- return target.getAlcodMap();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AlcodonFrame target = (AlcodonFrame) object;
- target.addAlcodMap( (jalview.schemabinding.version2.AlcodMap) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- AlcodonFrame target = (AlcodonFrame) object;
- target.removeAllAlcodMap();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.AlcodMap();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _alcodMapList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ AlcodonFrame target = (AlcodonFrame) object;
+ target.removeAllAlcodon();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Alcodon();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _alcodonList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _alcodMapList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.AlcodMap.class, "_alcodMapList",
+ "alcodMap", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AlcodonFrame target = (AlcodonFrame) object;
+ return target.getAlcodMap();
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AlcodonFrame target = (AlcodonFrame) object;
+ target.addAlcodMap((jalview.schemabinding.version2.AlcodMap) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ AlcodonFrame target = (AlcodonFrame) object;
+ target.removeAllAlcodMap();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.AlcodMap();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _alcodMapList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.AlcodonFrame.class;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.AlcodonFrame.class;
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationColourSchemeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationColourSchemeDescriptor.java
new file mode 100644
index 0000000..804b49e
--- /dev/null
+++ b/src/jalview/schemabinding/version2/descriptors/AnnotationColourSchemeDescriptor.java
@@ -0,0 +1,573 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2.descriptors;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import jalview.schemabinding.version2.AnnotationColourScheme;
+
+/**
+ * Class AnnotationColourSchemeDescriptor.
+ *
+ * @version $Revision$ $Date$
+ */
+public class AnnotationColourSchemeDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AnnotationColourSchemeDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "AnnotationColourScheme";
+ _elementDefinition = false;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _aboveThreshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_aboveThreshold", "aboveThreshold",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ if (!target.hasAboveThreshold())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getAboveThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteAboveThreshold();
+ return;
+ }
+ target.setAboveThreshold(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _aboveThreshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _annotation
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_annotation", "annotation",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ return target.getAnnotation();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ target.setAnnotation((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _annotation
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _minColour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_minColour", "minColour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ if (!target.hasMinColour())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getMinColour());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteMinColour();
+ return;
+ }
+ target.setMinColour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _minColour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _maxColour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_maxColour", "maxColour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ if (!target.hasMaxColour())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getMaxColour());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteMaxColour();
+ return;
+ }
+ target.setMaxColour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _maxColour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _colourScheme
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_colourScheme", "colourScheme",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ return target.getColourScheme();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ target.setColourScheme((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _colourScheme
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _threshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_threshold", "threshold",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ if (!target.hasThreshold())
+ {
+ return null;
+ }
+ return new java.lang.Float(target.getThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteThreshold();
+ return;
+ }
+ target.setThreshold(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _threshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _perSequence
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_perSequence", "perSequence",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ if (!target.hasPerSequence())
+ {
+ return null;
+ }
+ return (target.getPerSequence() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deletePerSequence();
+ return;
+ }
+ target.setPerSequence(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _perSequence
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _predefinedColours
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_predefinedColours",
+ "predefinedColours", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ if (!target.hasPredefinedColours())
+ {
+ return null;
+ }
+ return (target.getPredefinedColours() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationColourScheme target = (AnnotationColourScheme) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deletePredefinedColours();
+ return;
+ }
+ target.setPredefinedColours(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _predefinedColours
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.AnnotationColourScheme.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
+
+}
diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java
index c0e7e8f..f269bdf 100644
--- a/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,397 +7,142 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
-import jalview.schemabinding.version2.AnnotationColours;
/**
* Class AnnotationColoursDescriptor.
*
* @version $Revision$ $Date$
*/
-public class AnnotationColoursDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AnnotationColoursDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "AnnotationColours";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _aboveThreshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_aboveThreshold", "aboveThreshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationColours target = (AnnotationColours) object;
- if (!target.hasAboveThreshold()) { return null; }
- return new java.lang.Integer(target.getAboveThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationColours target = (AnnotationColours) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteAboveThreshold();
- return;
- }
- target.setAboveThreshold( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _aboveThreshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _annotation
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_annotation", "annotation", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationColours target = (AnnotationColours) object;
- return target.getAnnotation();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationColours target = (AnnotationColours) object;
- target.setAnnotation( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _annotation
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _minColour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_minColour", "minColour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationColours target = (AnnotationColours) object;
- if (!target.hasMinColour()) { return null; }
- return new java.lang.Integer(target.getMinColour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationColours target = (AnnotationColours) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteMinColour();
- return;
- }
- target.setMinColour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _minColour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _maxColour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_maxColour", "maxColour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationColours target = (AnnotationColours) object;
- if (!target.hasMaxColour()) { return null; }
- return new java.lang.Integer(target.getMaxColour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationColours target = (AnnotationColours) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteMaxColour();
- return;
- }
- target.setMaxColour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _maxColour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _colourScheme
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_colourScheme", "colourScheme", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationColours target = (AnnotationColours) object;
- return target.getColourScheme();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationColours target = (AnnotationColours) object;
- target.setColourScheme( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colourScheme
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _threshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationColours target = (AnnotationColours) object;
- if (!target.hasThreshold()) { return null; }
- return new java.lang.Float(target.getThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationColours target = (AnnotationColours) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteThreshold();
- return;
- }
- target.setThreshold( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _threshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.AnnotationColours.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+public class AnnotationColoursDescriptor
+ extends
+ jalview.schemabinding.version2.descriptors.AnnotationColourSchemeDescriptor
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AnnotationColoursDescriptor()
+ {
+ super();
+ setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.AnnotationColourSchemeDescriptor());
+ _nsURI = "www.jalview.org";
+ _xmlName = "AnnotationColours";
+ _elementDefinition = true;
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.AnnotationColours.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java
index 968c661..e2331f4 100644
--- a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Annotation;
@@ -35,909 +18,1281 @@ import jalview.schemabinding.version2.Annotation;
*
* @version $Revision$ $Date$
*/
-public class AnnotationDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AnnotationDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "Annotation";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _graph
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_graph", "graph", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasGraph()) { return null; }
- return (target.getGraph() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setGraph( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _graph
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _graphType
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphType", "graphType", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasGraphType()) { return null; }
- return new java.lang.Integer(target.getGraphType());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteGraphType();
- return;
- }
- target.setGraphType( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _graphType
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _sequenceRef
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_sequenceRef", "sequenceRef", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- return target.getSequenceRef();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- target.setSequenceRef( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _sequenceRef
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _groupRef
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_groupRef", "groupRef", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- return target.getGroupRef();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- target.setGroupRef( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _groupRef
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _graphColour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphColour", "graphColour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasGraphColour()) { return null; }
- return new java.lang.Integer(target.getGraphColour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteGraphColour();
- return;
- }
- target.setGraphColour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _graphColour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _graphGroup
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphGroup", "graphGroup", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasGraphGroup()) { return null; }
- return new java.lang.Integer(target.getGraphGroup());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteGraphGroup();
- return;
- }
- target.setGraphGroup( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _graphGroup
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _graphHeight
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphHeight", "graphHeight", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasGraphHeight()) { return null; }
- return new java.lang.Integer(target.getGraphHeight());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteGraphHeight();
- return;
- }
- target.setGraphHeight( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _graphHeight
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _id
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- return target.getId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- target.setId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _id
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _scoreOnly
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_scoreOnly", "scoreOnly", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasScoreOnly()) { return null; }
- return (target.getScoreOnly() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteScoreOnly();
- return;
- }
- target.setScoreOnly( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _scoreOnly
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _score
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Double.TYPE, "_score", "score", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasScore()) { return null; }
- return new java.lang.Double(target.getScore());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteScore();
- return;
- }
- target.setScore( ((java.lang.Double) value).doubleValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _score
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.DoubleValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.DoubleValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-1.7976931348623157E308);
- typeValidator.setMaxInclusive(1.7976931348623157E308);
- }
- desc.setValidator(fieldValidator);
- //-- _visible
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_visible", "visible", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasVisible()) { return null; }
- return (target.getVisible() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteVisible();
- return;
- }
- target.setVisible( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _visible
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _centreColLabels
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_centreColLabels", "centreColLabels", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasCentreColLabels()) { return null; }
- return (target.getCentreColLabels() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteCentreColLabels();
- return;
- }
- target.setCentreColLabels( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _centreColLabels
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _scaleColLabels
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_scaleColLabels", "scaleColLabels", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasScaleColLabels()) { return null; }
- return (target.getScaleColLabels() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteScaleColLabels();
- return;
- }
- target.setScaleColLabels( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _scaleColLabels
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showAllColLabels
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showAllColLabels", "showAllColLabels", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasShowAllColLabels()) { return null; }
- return (target.getShowAllColLabels() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowAllColLabels();
- return;
- }
- target.setShowAllColLabels( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showAllColLabels
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _autoCalculated
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_autoCalculated", "autoCalculated", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- if (!target.hasAutoCalculated()) { return null; }
- return (target.getAutoCalculated() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteAutoCalculated();
- return;
- }
- target.setAutoCalculated( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _autoCalculated
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _annotationElementList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.AnnotationElement.class, "_annotationElementList", "annotationElement", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- return target.getAnnotationElement();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- target.addAnnotationElement( (jalview.schemabinding.version2.AnnotationElement) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- Annotation target = (Annotation) object;
- target.removeAllAnnotationElement();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.AnnotationElement();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _annotationElementList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
- }
- desc.setValidator(fieldValidator);
- //-- _label
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_label", "label", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- return target.getLabel();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- target.setLabel( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _label
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _description
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- return target.getDescription();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- target.setDescription( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _description
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _thresholdLine
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.ThresholdLine.class, "_thresholdLine", "thresholdLine", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Annotation target = (Annotation) object;
- return target.getThresholdLine();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Annotation target = (Annotation) object;
- target.setThresholdLine( (jalview.schemabinding.version2.ThresholdLine) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.ThresholdLine();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _thresholdLine
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- }
- desc.setValidator(fieldValidator);
+public class AnnotationDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AnnotationDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "Annotation";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _graph
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_graph", "graph",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasGraph())
+ {
+ return null;
+ }
+ return (target.getGraph() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setGraph(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _graph
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _graphType
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_graphType", "graphType",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasGraphType())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getGraphType());
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteGraphType();
+ return;
+ }
+ target.setGraphType(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _graphType
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _sequenceRef
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_sequenceRef", "sequenceRef",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getSequenceRef();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.setSequenceRef((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _sequenceRef
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _groupRef
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_groupRef", "groupRef",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getGroupRef();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.setGroupRef((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _groupRef
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _graphColour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_graphColour", "graphColour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasGraphColour())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getGraphColour());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteGraphColour();
+ return;
+ }
+ target.setGraphColour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _graphColour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _graphGroup
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_graphGroup", "graphGroup",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasGraphGroup())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getGraphGroup());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteGraphGroup();
+ return;
+ }
+ target.setGraphGroup(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _graphGroup
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _graphHeight
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_graphHeight", "graphHeight",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasGraphHeight())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getGraphHeight());
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Annotation.class;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteGraphHeight();
+ return;
+ }
+ target.setGraphHeight(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _graphHeight
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _id
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_id", "id",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.setId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
+ // -- validation code for: _id
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _scoreOnly
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_scoreOnly", "scoreOnly",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasScoreOnly())
+ {
+ return null;
+ }
+ return (target.getScoreOnly() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteScoreOnly();
+ return;
+ }
+ target.setScoreOnly(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _scoreOnly
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _score
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Double.TYPE, "_score", "score",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasScore())
+ {
+ return null;
+ }
+ return new java.lang.Double(target.getScore());
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteScore();
+ return;
+ }
+ target.setScore(((java.lang.Double) value).doubleValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _score
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.DoubleValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.DoubleValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-1.7976931348623157E308);
+ typeValidator.setMaxInclusive(1.7976931348623157E308);
}
+ desc.setValidator(fieldValidator);
+ // -- _visible
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_visible", "visible",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasVisible())
+ {
+ return null;
+ }
+ return (target.getVisible() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteVisible();
+ return;
+ }
+ target.setVisible(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _visible
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _centreColLabels
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_centreColLabels", "centreColLabels",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasCentreColLabels())
+ {
+ return null;
+ }
+ return (target.getCentreColLabels() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteCentreColLabels();
+ return;
+ }
+ target.setCentreColLabels(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _centreColLabels
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _scaleColLabels
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_scaleColLabels", "scaleColLabels",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasScaleColLabels())
+ {
+ return null;
+ }
+ return (target.getScaleColLabels() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteScaleColLabels();
+ return;
+ }
+ target.setScaleColLabels(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _scaleColLabels
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showAllColLabels
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showAllColLabels",
+ "showAllColLabels", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasShowAllColLabels())
+ {
+ return null;
+ }
+ return (target.getShowAllColLabels() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowAllColLabels();
+ return;
+ }
+ target.setShowAllColLabels(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showAllColLabels
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _autoCalculated
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_autoCalculated", "autoCalculated",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasAutoCalculated())
+ {
+ return null;
+ }
+ return (target.getAutoCalculated() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteAutoCalculated();
+ return;
+ }
+ target.setAutoCalculated(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _autoCalculated
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _belowAlignment
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_belowAlignment", "belowAlignment",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasBelowAlignment())
+ {
+ return null;
+ }
+ return (target.getBelowAlignment() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteBelowAlignment();
+ return;
+ }
+ target.setBelowAlignment(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _belowAlignment
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _calcId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_calcId", "calcId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getCalcId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.setCalcId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _calcId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _annotationElementList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.AnnotationElement.class,
+ "_annotationElementList", "annotationElement",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getAnnotationElement();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.addAnnotationElement((jalview.schemabinding.version2.AnnotationElement) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.removeAllAnnotationElement();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.AnnotationElement();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _annotationElementList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ // -- _label
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_label", "label",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getLabel();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.setLabel((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _label
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _description
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_description", "description",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getDescription();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.setDescription((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _description
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _thresholdLine
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.ThresholdLine.class,
+ "_thresholdLine", "thresholdLine",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getThresholdLine();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.setThresholdLine((jalview.schemabinding.version2.ThresholdLine) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.ThresholdLine();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _thresholdLine
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ // -- _propertyList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Property.class, "_propertyList",
+ "property", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getProperty();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.addProperty((jalview.schemabinding.version2.Property) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ Annotation target = (Annotation) object;
+ target.removeAllProperty();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Property();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _propertyList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Annotation.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java
index 644e8af..4416bbf 100644
--- a/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.AnnotationElement;
@@ -35,388 +18,447 @@ import jalview.schemabinding.version2.AnnotationElement;
*
* @version $Revision$ $Date$
*/
-public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AnnotationElementDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "annotationElement";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _position
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_position", "position", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationElement target = (AnnotationElement) object;
- if (!target.hasPosition()) { return null; }
- return new java.lang.Integer(target.getPosition());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationElement target = (AnnotationElement) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setPosition( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _position
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _colour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationElement target = (AnnotationElement) object;
- if (!target.hasColour()) { return null; }
- return new java.lang.Integer(target.getColour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationElement target = (AnnotationElement) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteColour();
- return;
- }
- target.setColour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _displayCharacter
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_displayCharacter", "displayCharacter", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationElement target = (AnnotationElement) object;
- return target.getDisplayCharacter();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationElement target = (AnnotationElement) object;
- target.setDisplayCharacter( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _displayCharacter
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class AnnotationElementDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AnnotationElementDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "annotationElement";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _position
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_position", "position",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ if (!target.hasPosition())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _description
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationElement target = (AnnotationElement) object;
- return target.getDescription();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationElement target = (AnnotationElement) object;
- target.setDescription( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _description
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ return new java.lang.Integer(target.getPosition());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setPosition(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _secondaryStructure
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_secondaryStructure", "secondaryStructure", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationElement target = (AnnotationElement) object;
- return target.getSecondaryStructure();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationElement target = (AnnotationElement) object;
- target.setSecondaryStructure( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _secondaryStructure
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- typeValidator.setLength(1);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _position
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _colour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_colour", "colour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ if (!target.hasColour())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _value
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_value", "value", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- AnnotationElement target = (AnnotationElement) object;
- if (!target.hasValue()) { return null; }
- return new java.lang.Float(target.getValue());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- AnnotationElement target = (AnnotationElement) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteValue();
- return;
- }
- target.setValue( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _value
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ return new java.lang.Integer(target.getColour());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteColour();
+ return;
+ }
+ target.setColour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _colour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+ // -- _displayCharacter
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_displayCharacter",
+ "displayCharacter", org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ return target.getDisplayCharacter();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ target.setDisplayCharacter((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _displayCharacter
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _description
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_description", "description",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ return target.getDescription();
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.AnnotationElement.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ target.setDescription((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _description
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _secondaryStructure
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_secondaryStructure",
+ "secondaryStructure", org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ return target.getSecondaryStructure();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ target.setSecondaryStructure((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ // -- validation code for: _secondaryStructure
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ typeValidator.setLength(1);
}
+ desc.setValidator(fieldValidator);
+ // -- _value
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_value", "value",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ if (!target.hasValue())
+ {
+ return null;
+ }
+ return new java.lang.Float(target.getValue());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ AnnotationElement target = (AnnotationElement) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteValue();
+ return;
+ }
+ target.setValue(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _value
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.AnnotationElement.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java b/src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java
new file mode 100644
index 0000000..6dbea24
--- /dev/null
+++ b/src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java
@@ -0,0 +1,313 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2.descriptors;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import jalview.schemabinding.version2.CalcIdParam;
+
+/**
+ * Class CalcIdParamDescriptor.
+ *
+ * @version $Revision$ $Date$
+ */
+public class CalcIdParamDescriptor
+ extends
+ jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public CalcIdParamDescriptor()
+ {
+ super();
+ setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor());
+ _nsURI = "www.jalview.org";
+ _xmlName = "calcIdParam";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _calcId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_calcId", "calcId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ CalcIdParam target = (CalcIdParam) object;
+ return target.getCalcId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ CalcIdParam target = (CalcIdParam) object;
+ target.setCalcId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _calcId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _needsUpdate
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_needsUpdate", "needsUpdate",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ CalcIdParam target = (CalcIdParam) object;
+ if (!target.hasNeedsUpdate())
+ {
+ return null;
+ }
+ return (target.getNeedsUpdate() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ CalcIdParam target = (CalcIdParam) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteNeedsUpdate();
+ return;
+ }
+ target.setNeedsUpdate(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _needsUpdate
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _autoUpdate
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_autoUpdate", "autoUpdate",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ CalcIdParam target = (CalcIdParam) object;
+ if (!target.hasAutoUpdate())
+ {
+ return null;
+ }
+ return (target.getAutoUpdate() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ CalcIdParam target = (CalcIdParam) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setAutoUpdate(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _autoUpdate
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.CalcIdParam.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
+
+}
diff --git a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java
index 38d8159..8b1ae9e 100644
--- a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Colour;
@@ -35,500 +18,592 @@ import jalview.schemabinding.version2.Colour;
*
* @version $Revision$ $Date$
*/
-public class ColourDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public ColourDescriptor() {
- super();
- _xmlName = "colour";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _name
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "Name", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Colour target = (Colour) object;
- return target.getName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Colour target = (Colour) object;
- target.setName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _name
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _RGB
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_RGB", "RGB", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Colour target = (Colour) object;
- return target.getRGB();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Colour target = (Colour) object;
- target.setRGB( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _RGB
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class ColourDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public ColourDescriptor()
+ {
+ super();
+ _xmlName = "colour";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _name
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_name", "Name",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Colour target = (Colour) object;
+ return target.getName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Colour target = (Colour) object;
+ target.setName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _minRGB
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_minRGB", "minRGB", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Colour target = (Colour) object;
- return target.getMinRGB();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Colour target = (Colour) object;
- target.setMinRGB( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _minRGB
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _name
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _RGB
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_RGB", "RGB",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Colour target = (Colour) object;
+ return target.getRGB();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Colour target = (Colour) object;
+ target.setRGB((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _threshType
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_threshType", "threshType", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Colour target = (Colour) object;
- return target.getThreshType();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Colour target = (Colour) object;
- target.setThreshType( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _threshType
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _RGB
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _minRGB
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_minRGB", "minRGB",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Colour target = (Colour) object;
+ return target.getMinRGB();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Colour target = (Colour) object;
+ target.setMinRGB((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _threshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Colour target = (Colour) object;
- if (!target.hasThreshold()) { return null; }
- return new java.lang.Float(target.getThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Colour target = (Colour) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteThreshold();
- return;
- }
- target.setThreshold( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _threshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _minRGB
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _threshType
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_threshType", "threshType",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Colour target = (Colour) object;
+ return target.getThreshType();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Colour target = (Colour) object;
+ target.setThreshType((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _max
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_max", "max", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Colour target = (Colour) object;
- if (!target.hasMax()) { return null; }
- return new java.lang.Float(target.getMax());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Colour target = (Colour) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteMax();
- return;
- }
- target.setMax( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _max
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _threshType
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _threshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_threshold", "threshold",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Colour target = (Colour) object;
+ if (!target.hasThreshold())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _min
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_min", "min", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Colour target = (Colour) object;
- if (!target.hasMin()) { return null; }
- return new java.lang.Float(target.getMin());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Colour target = (Colour) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteMin();
- return;
- }
- target.setMin( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _min
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ return new java.lang.Float(target.getThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Colour target = (Colour) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteThreshold();
+ return;
+ }
+ target.setThreshold(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _colourByLabel
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Colour target = (Colour) object;
- if (!target.hasColourByLabel()) { return null; }
- return (target.getColourByLabel() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Colour target = (Colour) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteColourByLabel();
- return;
- }
- target.setColourByLabel( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colourByLabel
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _threshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _max
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_max", "max",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Colour target = (Colour) object;
+ if (!target.hasMax())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _autoScale
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_autoScale", "autoScale", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Colour target = (Colour) object;
- if (!target.hasAutoScale()) { return null; }
- return (target.getAutoScale() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Colour target = (Colour) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteAutoScale();
- return;
- }
- target.setAutoScale( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _autoScale
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ return new java.lang.Float(target.getMax());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Colour target = (Colour) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteMax();
+ return;
+ }
+ target.setMax(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+ // -- validation code for: _max
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _min
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_min", "min",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Colour target = (Colour) object;
+ if (!target.hasMin())
+ {
+ return null;
+ }
+ return new java.lang.Float(target.getMin());
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Colour target = (Colour) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteMin();
+ return;
+ }
+ target.setMin(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _min
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
}
+ desc.setValidator(fieldValidator);
+ // -- _colourByLabel
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Colour target = (Colour) object;
+ if (!target.hasColourByLabel())
+ {
+ return null;
+ }
+ return (target.getColourByLabel() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Colour.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Colour target = (Colour) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteColourByLabel();
+ return;
+ }
+ target.setColourByLabel(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _colourByLabel
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _autoScale
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_autoScale", "autoScale",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Colour target = (Colour) object;
+ if (!target.hasAutoScale())
+ {
+ return null;
+ }
+ return (target.getAutoScale() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Colour target = (Colour) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteAutoScale();
+ return;
+ }
+ target.setAutoScale(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ // -- validation code for: _autoScale
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Colour.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java b/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java
index 3618b65..e896d7a 100644
--- a/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.DBRef;
@@ -35,287 +18,316 @@ import jalview.schemabinding.version2.DBRef;
*
* @version $Revision$ $Date$
*/
-public class DBRefDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public DBRefDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "DBRef";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _source
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_source", "source", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- DBRef target = (DBRef) object;
- return target.getSource();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- DBRef target = (DBRef) object;
- target.setSource( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _source
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _version
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "version", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- DBRef target = (DBRef) object;
- return target.getVersion();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- DBRef target = (DBRef) object;
- target.setVersion( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _version
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _accessionId
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_accessionId", "accessionId", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- DBRef target = (DBRef) object;
- return target.getAccessionId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- DBRef target = (DBRef) object;
- target.setAccessionId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _accessionId
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _mapping
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Mapping.class, "_mapping", "Mapping", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- DBRef target = (DBRef) object;
- return target.getMapping();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- DBRef target = (DBRef) object;
- target.setMapping( (jalview.schemabinding.version2.Mapping) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Mapping();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _mapping
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- }
- desc.setValidator(fieldValidator);
- }
+public class DBRefDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
- //-----------/
- //- Methods -/
- //-----------/
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public DBRefDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "DBRef";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _source
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_source", "source",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ DBRef target = (DBRef) object;
+ return target.getSource();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ DBRef target = (DBRef) object;
+ target.setSource((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _source
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _version
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_version", "version",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ DBRef target = (DBRef) object;
+ return target.getVersion();
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.DBRef.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ DBRef target = (DBRef) object;
+ target.setVersion((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _version
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _accessionId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_accessionId", "accessionId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ DBRef target = (DBRef) object;
+ return target.getAccessionId();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ DBRef target = (DBRef) object;
+ target.setAccessionId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ // -- validation code for: _accessionId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _mapping
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Mapping.class, "_mapping",
+ "Mapping", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ DBRef target = (DBRef) object;
+ return target.getMapping();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ DBRef target = (DBRef) object;
+ target.setMapping((jalview.schemabinding.version2.Mapping) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Mapping();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ // -- validation code for: _mapping
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.DBRef.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java
index f10d1d7..64ed3a5 100644
--- a/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Feature;
@@ -35,464 +18,547 @@ import jalview.schemabinding.version2.Feature;
*
* @version $Revision$ $Date$
*/
-public class FeatureDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public FeatureDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "feature";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _begin
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_begin", "begin", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Feature target = (Feature) object;
- if (!target.hasBegin()) { return null; }
- return new java.lang.Integer(target.getBegin());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Feature target = (Feature) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setBegin( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _begin
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _end
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Feature target = (Feature) object;
- if (!target.hasEnd()) { return null; }
- return new java.lang.Integer(target.getEnd());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Feature target = (Feature) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setEnd( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _end
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _type
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Feature target = (Feature) object;
- return target.getType();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Feature target = (Feature) object;
- target.setType( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _type
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _description
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Feature target = (Feature) object;
- return target.getDescription();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Feature target = (Feature) object;
- target.setDescription( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _description
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _status
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_status", "status", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Feature target = (Feature) object;
- return target.getStatus();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Feature target = (Feature) object;
- target.setStatus( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _status
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _featureGroup
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_featureGroup", "featureGroup", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Feature target = (Feature) object;
- return target.getFeatureGroup();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Feature target = (Feature) object;
- target.setFeatureGroup( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _featureGroup
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _score
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_score", "score", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Feature target = (Feature) object;
- if (!target.hasScore()) { return null; }
- return new java.lang.Float(target.getScore());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Feature target = (Feature) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteScore();
- return;
- }
- target.setScore( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _score
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+public class FeatureDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public FeatureDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "feature";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _begin
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_begin", "begin",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Feature target = (Feature) object;
+ if (!target.hasBegin())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _otherDataList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.OtherData.class, "_otherDataList", "otherData", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Feature target = (Feature) object;
- return target.getOtherData();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Feature target = (Feature) object;
- target.addOtherData( (jalview.schemabinding.version2.OtherData) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- Feature target = (Feature) object;
- target.removeAllOtherData();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.OtherData();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _otherDataList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ return new java.lang.Integer(target.getBegin());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Feature target = (Feature) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setBegin(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _begin
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _end
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_end", "end",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Feature target = (Feature) object;
+ if (!target.hasEnd())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getEnd());
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Feature target = (Feature) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ target.setEnd(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _end
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _type
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_type", "type",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Feature target = (Feature) object;
+ return target.getType();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Feature target = (Feature) object;
+ target.setType((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Feature.class;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _type
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _description
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_description", "description",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Feature target = (Feature) object;
+ return target.getDescription();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Feature target = (Feature) object;
+ target.setDescription((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _description
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _status
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_status", "status",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Feature target = (Feature) object;
+ return target.getStatus();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Feature target = (Feature) object;
+ target.setStatus((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _status
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _featureGroup
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_featureGroup", "featureGroup",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Feature target = (Feature) object;
+ return target.getFeatureGroup();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Feature target = (Feature) object;
+ target.setFeatureGroup((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _featureGroup
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _score
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_score", "score",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Feature target = (Feature) object;
+ if (!target.hasScore())
+ {
+ return null;
+ }
+ return new java.lang.Float(target.getScore());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Feature target = (Feature) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteScore();
+ return;
+ }
+ target.setScore(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ // -- validation code for: _score
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ // -- _otherDataList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.OtherData.class,
+ "_otherDataList", "otherData",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Feature target = (Feature) object;
+ return target.getOtherData();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Feature target = (Feature) object;
+ target.addOtherData((jalview.schemabinding.version2.OtherData) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ Feature target = (Feature) object;
+ target.removeAllOtherData();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.OtherData();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _otherDataList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Feature.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java
index b15bad4..44bc256 100644
--- a/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.FeatureSettings;
@@ -35,227 +18,250 @@ import jalview.schemabinding.version2.FeatureSettings;
*
* @version $Revision$ $Date$
*/
-public class FeatureSettingsDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public FeatureSettingsDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "FeatureSettings";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- initialize element descriptors
-
- //-- _settingList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Setting.class, "_settingList", "setting", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- FeatureSettings target = (FeatureSettings) object;
- return target.getSetting();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- FeatureSettings target = (FeatureSettings) object;
- target.addSetting( (jalview.schemabinding.version2.Setting) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- FeatureSettings target = (FeatureSettings) object;
- target.removeAllSetting();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Setting();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _settingList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+public class FeatureSettingsDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public FeatureSettingsDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "FeatureSettings";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- initialize element descriptors
+
+ // -- _settingList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Setting.class, "_settingList",
+ "setting", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ FeatureSettings target = (FeatureSettings) object;
+ return target.getSetting();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ FeatureSettings target = (FeatureSettings) object;
+ target.addSetting((jalview.schemabinding.version2.Setting) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _groupList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Group.class, "_groupList", "group", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- FeatureSettings target = (FeatureSettings) object;
- return target.getGroup();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- FeatureSettings target = (FeatureSettings) object;
- target.addGroup( (jalview.schemabinding.version2.Group) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- FeatureSettings target = (FeatureSettings) object;
- target.removeAllGroup();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Group();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _groupList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ FeatureSettings target = (FeatureSettings) object;
+ target.removeAllSetting();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Setting();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _settingList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _groupList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Group.class, "_groupList",
+ "group", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ FeatureSettings target = (FeatureSettings) object;
+ return target.getGroup();
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ FeatureSettings target = (FeatureSettings) object;
+ target.addGroup((jalview.schemabinding.version2.Group) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ FeatureSettings target = (FeatureSettings) object;
+ target.removeAllGroup();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Group();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _groupList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.FeatureSettings.class;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.FeatureSettings.class;
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java
index 29d3f16..5a5b4a9 100644
--- a/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,145 +7,141 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
-import jalview.schemabinding.version2.Features;
/**
* Class FeaturesDescriptor.
*
* @version $Revision$ $Date$
*/
-public class FeaturesDescriptor extends jalview.schemabinding.version2.descriptors.FeatureDescriptor {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public FeaturesDescriptor() {
- super();
- setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.FeatureDescriptor());
- _nsURI = "www.jalview.org";
- _xmlName = "features";
- _elementDefinition = true;
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Features.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+public class FeaturesDescriptor extends
+ jalview.schemabinding.version2.descriptors.FeatureDescriptor
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public FeaturesDescriptor()
+ {
+ super();
+ setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.FeatureDescriptor());
+ _nsURI = "www.jalview.org";
+ _xmlName = "features";
+ _elementDefinition = true;
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Features.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java b/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java
index 531a24a..7aa6203 100644
--- a/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Group;
@@ -35,220 +18,240 @@ import jalview.schemabinding.version2.Group;
*
* @version $Revision$ $Date$
*/
-public class GroupDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public GroupDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "group";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _name
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Group target = (Group) object;
- return target.getName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Group target = (Group) object;
- target.setName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _name
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _display
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_display", "display", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Group target = (Group) object;
- if (!target.hasDisplay()) { return null; }
- return (target.getDisplay() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Group target = (Group) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setDisplay( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _display
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+public class GroupDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public GroupDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "group";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _name
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_name", "name",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Group target = (Group) object;
+ return target.getName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Group target = (Group) object;
+ target.setName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _name
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _display
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_display", "display",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Group target = (Group) object;
+ if (!target.hasDisplay())
+ {
+ return null;
+ }
+ return (target.getDisplay() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Group target = (Group) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ target.setDisplay(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _display
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Group.class;
- }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Group.class;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java b/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java
index 944c9e9..a5607b7 100644
--- a/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.HiddenColumns;
@@ -35,226 +18,247 @@ import jalview.schemabinding.version2.HiddenColumns;
*
* @version $Revision$ $Date$
*/
-public class HiddenColumnsDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
+public class HiddenColumnsDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
+ public HiddenColumnsDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "hiddenColumns";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
- public HiddenColumnsDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "hiddenColumns";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _start
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- HiddenColumns target = (HiddenColumns) object;
- if (!target.hasStart()) { return null; }
- return new java.lang.Integer(target.getStart());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- HiddenColumns target = (HiddenColumns) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteStart();
- return;
- }
- target.setStart( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _start
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ // -- _start
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_start", "start",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ HiddenColumns target = (HiddenColumns) object;
+ if (!target.hasStart())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _end
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- HiddenColumns target = (HiddenColumns) object;
- if (!target.hasEnd()) { return null; }
- return new java.lang.Integer(target.getEnd());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- HiddenColumns target = (HiddenColumns) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteEnd();
- return;
- }
- target.setEnd( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _end
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return new java.lang.Integer(target.getStart());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ HiddenColumns target = (HiddenColumns) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteStart();
+ return;
+ }
+ target.setStart(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+ // -- validation code for: _start
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _end
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_end", "end",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ HiddenColumns target = (HiddenColumns) object;
+ if (!target.hasEnd())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getEnd());
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ HiddenColumns target = (HiddenColumns) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteEnd();
+ return;
+ }
+ target.setEnd(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _end
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.HiddenColumns.class;
- }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.HiddenColumns.class;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java
index d87439d..620432f 100644
--- a/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.JGroup;
@@ -35,933 +18,1258 @@ import jalview.schemabinding.version2.JGroup;
*
* @version $Revision$ $Date$
*/
-public class JGroupDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JGroupDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "JGroup";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _start
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasStart()) { return null; }
- return new java.lang.Integer(target.getStart());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteStart();
- return;
- }
- target.setStart( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _start
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _end
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasEnd()) { return null; }
- return new java.lang.Integer(target.getEnd());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteEnd();
- return;
- }
- target.setEnd( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _end
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _name
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- return target.getName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- target.setName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _name
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _colour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- return target.getColour();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- target.setColour( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _consThreshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_consThreshold", "consThreshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasConsThreshold()) { return null; }
- return new java.lang.Integer(target.getConsThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteConsThreshold();
- return;
- }
- target.setConsThreshold( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _consThreshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _pidThreshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_pidThreshold", "pidThreshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasPidThreshold()) { return null; }
- return new java.lang.Integer(target.getPidThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deletePidThreshold();
- return;
- }
- target.setPidThreshold( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _pidThreshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _outlineColour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_outlineColour", "outlineColour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasOutlineColour()) { return null; }
- return new java.lang.Integer(target.getOutlineColour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteOutlineColour();
- return;
- }
- target.setOutlineColour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _outlineColour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _displayBoxes
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_displayBoxes", "displayBoxes", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasDisplayBoxes()) { return null; }
- return (target.getDisplayBoxes() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteDisplayBoxes();
- return;
- }
- target.setDisplayBoxes( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _displayBoxes
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _displayText
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_displayText", "displayText", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasDisplayText()) { return null; }
- return (target.getDisplayText() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteDisplayText();
- return;
- }
- target.setDisplayText( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _displayText
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _colourText
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_colourText", "colourText", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasColourText()) { return null; }
- return (target.getColourText() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteColourText();
- return;
- }
- target.setColourText( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colourText
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _textCol1
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_textCol1", "textCol1", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasTextCol1()) { return null; }
- return new java.lang.Integer(target.getTextCol1());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteTextCol1();
- return;
- }
- target.setTextCol1( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _textCol1
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _textCol2
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_textCol2", "textCol2", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasTextCol2()) { return null; }
- return new java.lang.Integer(target.getTextCol2());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteTextCol2();
- return;
- }
- target.setTextCol2( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _textCol2
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _textColThreshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_textColThreshold", "textColThreshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasTextColThreshold()) { return null; }
- return new java.lang.Integer(target.getTextColThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteTextColThreshold();
- return;
- }
- target.setTextColThreshold( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _textColThreshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _showUnconserved
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showUnconserved", "showUnconserved", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasShowUnconserved()) { return null; }
- return (target.getShowUnconserved() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowUnconserved();
- return;
- }
- target.setShowUnconserved( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showUnconserved
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _ignoreGapsinConsensus
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_ignoreGapsinConsensus", "ignoreGapsinConsensus", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasIgnoreGapsinConsensus()) { return null; }
- return (target.getIgnoreGapsinConsensus() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteIgnoreGapsinConsensus();
- return;
- }
- target.setIgnoreGapsinConsensus( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _ignoreGapsinConsensus
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showConsensusHistogram
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showConsensusHistogram", "showConsensusHistogram", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasShowConsensusHistogram()) { return null; }
- return (target.getShowConsensusHistogram() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowConsensusHistogram();
- return;
- }
- target.setShowConsensusHistogram( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showConsensusHistogram
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showSequenceLogo
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showSequenceLogo", "showSequenceLogo", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- if (!target.hasShowSequenceLogo()) { return null; }
- return (target.getShowSequenceLogo() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowSequenceLogo();
- return;
- }
- target.setShowSequenceLogo( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showSequenceLogo
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _id
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- return target.getId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- target.setId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _id
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _seqList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_seqList", "seq", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JGroup target = (JGroup) object;
- return target.getSeq();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JGroup target = (JGroup) object;
- target.addSeq( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JGroup target = (JGroup) object;
- target.removeAllSeq();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setRequired(true);
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _seqList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
+public class JGroupDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JGroupDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "JGroup";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _start
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_start", "start",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasStart())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getStart());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteStart();
+ return;
+ }
+ target.setStart(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _start
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _end
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_end", "end",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasEnd())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getEnd());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteEnd();
+ return;
+ }
+ target.setEnd(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _end
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _name
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_name", "name",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ return target.getName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ target.setName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _name
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _colour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_colour", "colour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ return target.getColour();
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ target.setColour((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- //-----------/
- //- Methods -/
- //-----------/
+ // -- validation code for: _colour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _consThreshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_consThreshold", "consThreshold",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasConsThreshold())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getConsThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteConsThreshold();
+ return;
+ }
+ target.setConsThreshold(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _consThreshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _pidThreshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_pidThreshold", "pidThreshold",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasPidThreshold())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getPidThreshold());
+ }
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deletePidThreshold();
+ return;
+ }
+ target.setPidThreshold(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _pidThreshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _outlineColour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_outlineColour", "outlineColour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasOutlineColour())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getOutlineColour());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteOutlineColour();
+ return;
+ }
+ target.setOutlineColour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.JGroup.class;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _outlineColour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _displayBoxes
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_displayBoxes", "displayBoxes",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasDisplayBoxes())
+ {
+ return null;
+ }
+ return (target.getDisplayBoxes() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteDisplayBoxes();
+ return;
+ }
+ target.setDisplayBoxes(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _displayBoxes
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _displayText
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_displayText", "displayText",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasDisplayText())
+ {
+ return null;
+ }
+ return (target.getDisplayText() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteDisplayText();
+ return;
+ }
+ target.setDisplayText(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _displayText
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _colourText
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_colourText", "colourText",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasColourText())
+ {
+ return null;
+ }
+ return (target.getColourText() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteColourText();
+ return;
+ }
+ target.setColourText(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _colourText
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _textCol1
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_textCol1", "textCol1",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasTextCol1())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getTextCol1());
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteTextCol1();
+ return;
+ }
+ target.setTextCol1(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _textCol1
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _textCol2
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_textCol2", "textCol2",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasTextCol2())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getTextCol2());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteTextCol2();
+ return;
+ }
+ target.setTextCol2(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ // -- validation code for: _textCol2
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _textColThreshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_textColThreshold",
+ "textColThreshold", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasTextColThreshold())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getTextColThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteTextColThreshold();
+ return;
+ }
+ target.setTextColThreshold(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _textColThreshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showUnconserved
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showUnconserved", "showUnconserved",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasShowUnconserved())
+ {
+ return null;
+ }
+ return (target.getShowUnconserved() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowUnconserved();
+ return;
+ }
+ target.setShowUnconserved(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showUnconserved
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _ignoreGapsinConsensus
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_ignoreGapsinConsensus",
+ "ignoreGapsinConsensus",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasIgnoreGapsinConsensus())
+ {
+ return null;
+ }
+ return (target.getIgnoreGapsinConsensus() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteIgnoreGapsinConsensus();
+ return;
+ }
+ target.setIgnoreGapsinConsensus(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _ignoreGapsinConsensus
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showConsensusHistogram
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showConsensusHistogram",
+ "showConsensusHistogram",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasShowConsensusHistogram())
+ {
+ return null;
+ }
+ return (target.getShowConsensusHistogram() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowConsensusHistogram();
+ return;
+ }
+ target.setShowConsensusHistogram(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showConsensusHistogram
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showSequenceLogo
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showSequenceLogo",
+ "showSequenceLogo", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasShowSequenceLogo())
+ {
+ return null;
+ }
+ return (target.getShowSequenceLogo() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowSequenceLogo();
+ return;
+ }
+ target.setShowSequenceLogo(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showSequenceLogo
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _normaliseSequenceLogo
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_normaliseSequenceLogo",
+ "normaliseSequenceLogo",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ if (!target.hasNormaliseSequenceLogo())
+ {
+ return null;
+ }
+ return (target.getNormaliseSequenceLogo() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteNormaliseSequenceLogo();
+ return;
+ }
+ target.setNormaliseSequenceLogo(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _normaliseSequenceLogo
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _id
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_id", "id",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ return target.getId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ target.setId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _id
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _seqList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_seqList", "seq",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ return target.getSeq();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ target.addSeq((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ target.removeAllSeq();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setRequired(true);
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _seqList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _annotationColours
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.AnnotationColours.class,
+ "_annotationColours", "annotationColours",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JGroup target = (JGroup) object;
+ return target.getAnnotationColours();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JGroup target = (JGroup) object;
+ target.setAnnotationColours((jalview.schemabinding.version2.AnnotationColours) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.AnnotationColours();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _annotationColours
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.JGroup.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java
index b99687c..0f000bb 100644
--- a/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.JSeq;
@@ -35,486 +18,642 @@ import jalview.schemabinding.version2.JSeq;
*
* @version $Revision$ $Date$
*/
-public class JSeqDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JSeqDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "JSeq";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _colour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- if (!target.hasColour()) { return null; }
- return new java.lang.Integer(target.getColour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteColour();
- return;
- }
- target.setColour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _start
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- if (!target.hasStart()) { return null; }
- return new java.lang.Integer(target.getStart());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setStart( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _start
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _end
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- if (!target.hasEnd()) { return null; }
- return new java.lang.Integer(target.getEnd());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setEnd( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _end
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _id
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- target.setId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _id
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _hidden
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_hidden", "hidden", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- if (!target.hasHidden()) { return null; }
- return (target.getHidden() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteHidden();
- return;
- }
- target.setHidden( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _hidden
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+public class JSeqDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JSeqDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "JSeq";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _colour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_colour", "colour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasColour())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _featuresList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Features.class, "_featuresList", "features", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getFeatures();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- target.addFeatures( (jalview.schemabinding.version2.Features) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JSeq target = (JSeq) object;
- target.removeAllFeatures();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Features();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _featuresList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ return new java.lang.Integer(target.getColour());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteColour();
+ return;
+ }
+ target.setColour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _pdbidsList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Pdbids.class, "_pdbidsList", "pdbids", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getPdbids();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- target.addPdbids( (jalview.schemabinding.version2.Pdbids) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JSeq target = (JSeq) object;
- target.removeAllPdbids();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Pdbids();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _pdbidsList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _colour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _start
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_start", "start",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasStart())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _hiddenSequencesList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_hiddenSequencesList", "hiddenSequences", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getHiddenSequences();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.addHiddenSequences( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JSeq target = (JSeq) object;
- target.removeAllHiddenSequences();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _hiddenSequencesList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return new java.lang.Integer(target.getStart());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setStart(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _start
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _end
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_end", "end",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasEnd())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getEnd());
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ target.setEnd(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _end
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _id
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_id", "id",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.setId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.JSeq.class;
+ // -- validation code for: _id
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _hidden
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_hidden", "hidden",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasHidden())
+ {
+ return null;
+ }
+ return (target.getHidden() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteHidden();
+ return;
+ }
+ target.setHidden(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _hidden
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _featuresList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Features.class, "_featuresList",
+ "features", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getFeatures();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.addFeatures((jalview.schemabinding.version2.Features) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.removeAllFeatures();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Features();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _featuresList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _pdbidsList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Pdbids.class, "_pdbidsList",
+ "pdbids", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getPdbids();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.addPdbids((jalview.schemabinding.version2.Pdbids) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.removeAllPdbids();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Pdbids();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _pdbidsList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _hiddenSequencesList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_hiddenSequencesList",
+ "hiddenSequences", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getHiddenSequences();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.addHiddenSequences(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.removeAllHiddenSequences();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ // -- validation code for: _hiddenSequencesList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _rnaViewerList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.RnaViewer.class,
+ "_rnaViewerList", "rnaViewer",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getRnaViewer();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.addRnaViewer((jalview.schemabinding.version2.RnaViewer) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.removeAllRnaViewer();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.RnaViewer();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _rnaViewerList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.JSeq.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java
index 2b5e02a..f400c2c 100644
--- a/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.JalviewModel;
@@ -35,295 +18,324 @@ import jalview.schemabinding.version2.JalviewModel;
*
* @version $Revision$ $Date$
*/
-public class JalviewModelDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JalviewModelDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "JalviewModel";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- initialize element descriptors
-
- //-- _creationDate
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.util.Date.class, "_creationDate", "creationDate", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModel target = (JalviewModel) object;
- return target.getCreationDate();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModel target = (JalviewModel) object;
- target.setCreationDate( (java.util.Date) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new java.util.Date();
- }
- };
- handler = new org.exolab.castor.xml.handlers.DateFieldHandler(handler);
- desc.setImmutable(true);
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _creationDate
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.DateTimeValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.DateTimeValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _version
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "version", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModel target = (JalviewModel) object;
- return target.getVersion();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModel target = (JalviewModel) object;
- target.setVersion( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _version
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _vamsasModel
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.VamsasModel.class, "_vamsasModel", "vamsasModel", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModel target = (JalviewModel) object;
- return target.getVamsasModel();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModel target = (JalviewModel) object;
- target.setVamsasModel( (jalview.schemabinding.version2.VamsasModel) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.VamsasModel();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _vamsasModel
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- }
- desc.setValidator(fieldValidator);
- //-- _jalviewModelSequence
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.JalviewModelSequence.class, "_jalviewModelSequence", "-error-if-this-is-used-", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModel target = (JalviewModel) object;
- return target.getJalviewModelSequence();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModel target = (JalviewModel) object;
- target.setJalviewModelSequence( (jalview.schemabinding.version2.JalviewModelSequence) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.JalviewModelSequence();
- }
- };
- desc.setHandler(handler);
- desc.setContainer(true);
- desc.setClassDescriptor(new jalview.schemabinding.version2.descriptors.JalviewModelSequenceDescriptor());
- desc.setNameSpaceURI("www.jalview.org");
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _jalviewModelSequence
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
+public class JalviewModelDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JalviewModelDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "JalviewModel";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- initialize element descriptors
+
+ // -- _creationDate
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.util.Date.class, "_creationDate", "creationDate",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModel target = (JalviewModel) object;
+ return target.getCreationDate();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModel target = (JalviewModel) object;
+ target.setCreationDate((java.util.Date) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- }
+ }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new java.util.Date();
+ }
+ };
+ handler = new org.exolab.castor.xml.handlers.DateFieldHandler(handler);
+ desc.setImmutable(true);
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- //-----------/
- //- Methods -/
- //-----------/
+ // -- validation code for: _creationDate
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.DateTimeValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.DateTimeValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _version
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_version", "version",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModel target = (JalviewModel) object;
+ return target.getVersion();
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModel target = (JalviewModel) object;
+ target.setVersion((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _version
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _vamsasModel
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.VamsasModel.class,
+ "_vamsasModel", "vamsasModel",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModel target = (JalviewModel) object;
+ return target.getVamsasModel();
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.JalviewModel.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModel target = (JalviewModel) object;
+ target.setVamsasModel((jalview.schemabinding.version2.VamsasModel) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.VamsasModel();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _vamsasModel
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _jalviewModelSequence
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.JalviewModelSequence.class,
+ "_jalviewModelSequence", "-error-if-this-is-used-",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModel target = (JalviewModel) object;
+ return target.getJalviewModelSequence();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModel target = (JalviewModel) object;
+ target.setJalviewModelSequence((jalview.schemabinding.version2.JalviewModelSequence) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.JalviewModelSequence();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setContainer(true);
+ desc.setClassDescriptor(new jalview.schemabinding.version2.descriptors.JalviewModelSequenceDescriptor());
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ // -- validation code for: _jalviewModelSequence
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.JalviewModel.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java
index e33e6c5..e8c4ef4 100644
--- a/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.JalviewModelSequence;
@@ -35,387 +18,457 @@ import jalview.schemabinding.version2.JalviewModelSequence;
*
* @version $Revision$ $Date$
*/
-public class JalviewModelSequenceDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JalviewModelSequenceDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- initialize element descriptors
-
- //-- _JSeqList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.JSeq.class, "_JSeqList", "JSeq", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModelSequence target = (JalviewModelSequence) object;
- return target.getJSeq();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.addJSeq( (jalview.schemabinding.version2.JSeq) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.removeAllJSeq();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.JSeq();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setRequired(true);
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _JSeqList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
+public class JalviewModelSequenceDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JalviewModelSequenceDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- initialize element descriptors
+
+ // -- _JSeqList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.JSeq.class, "_JSeqList", "JSeq",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ return target.getJSeq();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.addJSeq((jalview.schemabinding.version2.JSeq) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _JGroupList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.JGroup.class, "_JGroupList", "JGroup", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModelSequence target = (JalviewModelSequence) object;
- return target.getJGroup();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.addJGroup( (jalview.schemabinding.version2.JGroup) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.removeAllJGroup();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.JGroup();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _JGroupList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.removeAllJSeq();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _viewportList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Viewport.class, "_viewportList", "Viewport", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModelSequence target = (JalviewModelSequence) object;
- return target.getViewport();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.addViewport( (jalview.schemabinding.version2.Viewport) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.removeAllViewport();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Viewport();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setRequired(true);
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _viewportList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.JSeq();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _JSeqList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ // -- _JGroupList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.JGroup.class, "_JGroupList",
+ "JGroup", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ return target.getJGroup();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.addJGroup((jalview.schemabinding.version2.JGroup) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _userColoursList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.UserColours.class, "_userColoursList", "UserColours", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModelSequence target = (JalviewModelSequence) object;
- return target.getUserColours();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.addUserColours( (jalview.schemabinding.version2.UserColours) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.removeAllUserColours();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.UserColours();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _userColoursList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.removeAllJGroup();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _treeList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Tree.class, "_treeList", "tree", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModelSequence target = (JalviewModelSequence) object;
- return target.getTree();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.addTree( (jalview.schemabinding.version2.Tree) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.removeAllTree();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Tree();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _treeList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.JGroup();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _JGroupList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ // -- _viewportList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Viewport.class, "_viewportList",
+ "Viewport", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ return target.getViewport();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.addViewport((jalview.schemabinding.version2.Viewport) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _featureSettings
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.FeatureSettings.class, "_featureSettings", "FeatureSettings", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewModelSequence target = (JalviewModelSequence) object;
- return target.getFeatureSettings();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewModelSequence target = (JalviewModelSequence) object;
- target.setFeatureSettings( (jalview.schemabinding.version2.FeatureSettings) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.FeatureSettings();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _featureSettings
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.removeAllViewport();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Viewport();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _viewportList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _userColoursList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.UserColours.class,
+ "_userColoursList", "UserColours",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ return target.getUserColours();
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.addUserColours((jalview.schemabinding.version2.UserColours) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.removeAllUserColours();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.UserColours();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _userColoursList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _treeList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Tree.class, "_treeList", "tree",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ return target.getTree();
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.JalviewModelSequence.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.addTree((jalview.schemabinding.version2.Tree) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.removeAllTree();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Tree();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ // -- validation code for: _treeList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _featureSettings
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.FeatureSettings.class,
+ "_featureSettings", "FeatureSettings",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ return target.getFeatureSettings();
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewModelSequence target = (JalviewModelSequence) object;
+ target.setFeatureSettings((jalview.schemabinding.version2.FeatureSettings) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.FeatureSettings();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ // -- validation code for: _featureSettings
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.JalviewModelSequence.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java
index bcc6801..77efa7e 100644
--- a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Colour;
@@ -36,258 +19,284 @@ import jalview.schemabinding.version2.JalviewUserColours;
*
* @version $Revision$ $Date$
*/
-public class JalviewUserColoursDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JalviewUserColoursDescriptor() {
- super();
- _nsURI = "www.jalview.org/colours";
- _xmlName = "JalviewUserColours";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _schemeName
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_schemeName", "schemeName", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewUserColours target = (JalviewUserColours) object;
- return target.getSchemeName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewUserColours target = (JalviewUserColours) object;
- target.setSchemeName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _schemeName
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _version
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "Version", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewUserColours target = (JalviewUserColours) object;
- return target.getVersion();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewUserColours target = (JalviewUserColours) object;
- target.setVersion( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _version
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _colourList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(Colour.class, "_colourList", "colour", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JalviewUserColours target = (JalviewUserColours) object;
- return target.getColour();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JalviewUserColours target = (JalviewUserColours) object;
- target.addColour( (Colour) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JalviewUserColours target = (JalviewUserColours) object;
- target.removeAllColour();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new Colour();
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colourList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+public class JalviewUserColoursDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JalviewUserColoursDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org/colours";
+ _xmlName = "JalviewUserColours";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _schemeName
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_schemeName", "schemeName",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewUserColours target = (JalviewUserColours) object;
+ return target.getSchemeName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewUserColours target = (JalviewUserColours) object;
+ target.setSchemeName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _schemeName
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+ // -- _version
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_version", "Version",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewUserColours target = (JalviewUserColours) object;
+ return target.getVersion();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewUserColours target = (JalviewUserColours) object;
+ target.setVersion((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _version
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _colourList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ Colour.class, "_colourList", "colour",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JalviewUserColours target = (JalviewUserColours) object;
+ return target.getColour();
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.JalviewUserColours.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JalviewUserColours target = (JalviewUserColours) object;
+ target.addColour((Colour) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JalviewUserColours target = (JalviewUserColours) object;
+ target.removeAllColour();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new Colour();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ // -- validation code for: _colourList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.JalviewUserColours.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java
index 1c30225..529f477 100644
--- a/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.MapListFrom;
@@ -35,226 +18,251 @@ import jalview.schemabinding.version2.MapListFrom;
*
* @version $Revision$ $Date$
*/
-public class MapListFromDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
+public class MapListFromDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
+ public MapListFromDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "mapListFrom";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
- public MapListFromDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "mapListFrom";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _start
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MapListFrom target = (MapListFrom) object;
- if (!target.hasStart()) { return null; }
- return new java.lang.Integer(target.getStart());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MapListFrom target = (MapListFrom) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setStart( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _start
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ // -- _start
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_start", "start",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MapListFrom target = (MapListFrom) object;
+ if (!target.hasStart())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _end
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MapListFrom target = (MapListFrom) object;
- if (!target.hasEnd()) { return null; }
- return new java.lang.Integer(target.getEnd());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MapListFrom target = (MapListFrom) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setEnd( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _end
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return new java.lang.Integer(target.getStart());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MapListFrom target = (MapListFrom) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setStart(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _start
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _end
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_end", "end",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MapListFrom target = (MapListFrom) object;
+ if (!target.hasEnd())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getEnd());
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MapListFrom target = (MapListFrom) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ target.setEnd(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _end
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.MapListFrom.class;
- }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.MapListFrom.class;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java
index 393eb3f..bed082a 100644
--- a/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.MapListTo;
@@ -35,226 +18,251 @@ import jalview.schemabinding.version2.MapListTo;
*
* @version $Revision$ $Date$
*/
-public class MapListToDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
+public class MapListToDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- //----------------/
- //- Constructors -/
- //----------------/
+ public MapListToDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "mapListTo";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
- public MapListToDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "mapListTo";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _start
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MapListTo target = (MapListTo) object;
- if (!target.hasStart()) { return null; }
- return new java.lang.Integer(target.getStart());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MapListTo target = (MapListTo) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setStart( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _start
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ // -- _start
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_start", "start",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MapListTo target = (MapListTo) object;
+ if (!target.hasStart())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _end
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MapListTo target = (MapListTo) object;
- if (!target.hasEnd()) { return null; }
- return new java.lang.Integer(target.getEnd());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MapListTo target = (MapListTo) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setEnd( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _end
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return new java.lang.Integer(target.getStart());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MapListTo target = (MapListTo) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setStart(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _start
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _end
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_end", "end",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MapListTo target = (MapListTo) object;
+ if (!target.hasEnd())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getEnd());
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MapListTo target = (MapListTo) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ target.setEnd(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _end
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.MapListTo.class;
- }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.MapListTo.class;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java
index c7b217f..fc24a78 100644
--- a/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.MapListType;
@@ -35,311 +18,364 @@ import jalview.schemabinding.version2.MapListType;
*
* @version $Revision$ $Date$
*/
-public class MapListTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public MapListTypeDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "mapListType";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _mapFromUnit
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_mapFromUnit", "mapFromUnit", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MapListType target = (MapListType) object;
- if (!target.hasMapFromUnit()) { return null; }
- return new java.lang.Long(target.getMapFromUnit());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MapListType target = (MapListType) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setMapFromUnit( ((java.lang.Long) value).longValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _mapFromUnit
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.LongValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(1L);
- }
- desc.setValidator(fieldValidator);
- //-- _mapToUnit
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_mapToUnit", "mapToUnit", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MapListType target = (MapListType) object;
- if (!target.hasMapToUnit()) { return null; }
- return new java.lang.Long(target.getMapToUnit());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MapListType target = (MapListType) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setMapToUnit( ((java.lang.Long) value).longValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _mapToUnit
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.LongValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(1L);
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _mapListFromList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.MapListFrom.class, "_mapListFromList", "mapListFrom", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MapListType target = (MapListType) object;
- return target.getMapListFrom();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MapListType target = (MapListType) object;
- target.addMapListFrom( (jalview.schemabinding.version2.MapListFrom) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- MapListType target = (MapListType) object;
- target.removeAllMapListFrom();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.MapListFrom();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _mapListFromList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+public class MapListTypeDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public MapListTypeDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "mapListType";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _mapFromUnit
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Long.TYPE, "_mapFromUnit", "mapFromUnit",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MapListType target = (MapListType) object;
+ if (!target.hasMapFromUnit())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _mapListToList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.MapListTo.class, "_mapListToList", "mapListTo", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MapListType target = (MapListType) object;
- return target.getMapListTo();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MapListType target = (MapListType) object;
- target.addMapListTo( (jalview.schemabinding.version2.MapListTo) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- MapListType target = (MapListType) object;
- target.removeAllMapListTo();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.MapListTo();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _mapListToList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ return new java.lang.Long(target.getMapFromUnit());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MapListType target = (MapListType) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setMapFromUnit(((java.lang.Long) value).longValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _mapFromUnit
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.LongValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(1L);
}
+ desc.setValidator(fieldValidator);
+ // -- _mapToUnit
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Long.TYPE, "_mapToUnit", "mapToUnit",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MapListType target = (MapListType) object;
+ if (!target.hasMapToUnit())
+ {
+ return null;
+ }
+ return new java.lang.Long(target.getMapToUnit());
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MapListType target = (MapListType) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ target.setMapToUnit(((java.lang.Long) value).longValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _mapToUnit
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.LongValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(1L);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.MapListType.class;
- }
+ // -- _mapListFromList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.MapListFrom.class,
+ "_mapListFromList", "mapListFrom",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MapListType target = (MapListType) object;
+ return target.getMapListFrom();
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MapListType target = (MapListType) object;
+ target.addMapListFrom((jalview.schemabinding.version2.MapListFrom) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ MapListType target = (MapListType) object;
+ target.removeAllMapListFrom();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.MapListFrom();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ // -- validation code for: _mapListFromList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _mapListToList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.MapListTo.class,
+ "_mapListToList", "mapListTo",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MapListType target = (MapListType) object;
+ return target.getMapListTo();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MapListType target = (MapListType) object;
+ target.addMapListTo((jalview.schemabinding.version2.MapListTo) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ MapListType target = (MapListType) object;
+ target.removeAllMapListTo();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.MapListTo();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _mapListToList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.MapListType.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java
index 6edaa47..ae460af 100644
--- a/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.MappingChoice;
@@ -35,213 +18,226 @@ import jalview.schemabinding.version2.MappingChoice;
*
* @version $Revision$ $Date$
*/
-public class MappingChoiceDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public MappingChoiceDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsChoice();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- initialize element descriptors
-
- //-- _sequence
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Sequence.class, "_sequence", "Sequence", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MappingChoice target = (MappingChoice) object;
- return target.getSequence();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MappingChoice target = (MappingChoice) object;
- target.setSequence( (jalview.schemabinding.version2.Sequence) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Sequence();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _sequence
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- }
- desc.setValidator(fieldValidator);
- //-- _dseqFor
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_dseqFor", "dseqFor", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- MappingChoice target = (MappingChoice) object;
- return target.getDseqFor();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- MappingChoice target = (MappingChoice) object;
- target.setDseqFor( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _dseqFor
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class MappingChoiceDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public MappingChoiceDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsChoice();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- initialize element descriptors
+
+ // -- _sequence
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Sequence.class, "_sequence",
+ "Sequence", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MappingChoice target = (MappingChoice) object;
+ return target.getSequence();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MappingChoice target = (MappingChoice) object;
+ target.setSequence((jalview.schemabinding.version2.Sequence) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Sequence();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _sequence
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _dseqFor
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_dseqFor", "dseqFor",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ MappingChoice target = (MappingChoice) object;
+ return target.getDseqFor();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ MappingChoice target = (MappingChoice) object;
+ target.setDseqFor((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _dseqFor
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.MappingChoice.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.MappingChoice.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java
index 937b298..fab0d2e 100644
--- a/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Mapping;
@@ -35,179 +18,185 @@ import jalview.schemabinding.version2.Mapping;
*
* @version $Revision$ $Date$
*/
-public class MappingDescriptor extends jalview.schemabinding.version2.descriptors.MapListTypeDescriptor {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public MappingDescriptor() {
- super();
- setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.MapListTypeDescriptor());
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "Mapping";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsChoice();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- initialize element descriptors
-
- //-- _mappingChoice
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.MappingChoice.class, "_mappingChoice", "-error-if-this-is-used-", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Mapping target = (Mapping) object;
- return target.getMappingChoice();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Mapping target = (Mapping) object;
- target.setMappingChoice( (jalview.schemabinding.version2.MappingChoice) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.MappingChoice();
- }
- };
- desc.setHandler(handler);
- desc.setContainer(true);
- desc.setClassDescriptor(new jalview.schemabinding.version2.descriptors.MappingChoiceDescriptor());
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _mappingChoice
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
+public class MappingDescriptor extends
+ jalview.schemabinding.version2.descriptors.MapListTypeDescriptor
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public MappingDescriptor()
+ {
+ super();
+ setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.MapListTypeDescriptor());
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "Mapping";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsChoice();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- initialize element descriptors
+
+ // -- _mappingChoice
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.MappingChoice.class,
+ "_mappingChoice", "-error-if-this-is-used-",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Mapping target = (Mapping) object;
+ return target.getMappingChoice();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Mapping target = (Mapping) object;
+ target.setMappingChoice((jalview.schemabinding.version2.MappingChoice) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Mapping.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.MappingChoice();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setContainer(true);
+ desc.setClassDescriptor(new jalview.schemabinding.version2.descriptors.MappingChoiceDescriptor());
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _mappingChoice
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Mapping.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java b/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java
index 516d841..f582311 100644
--- a/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.OtherData;
@@ -35,218 +18,231 @@ import jalview.schemabinding.version2.OtherData;
*
* @version $Revision$ $Date$
*/
-public class OtherDataDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public OtherDataDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "otherData";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _key
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_key", "key", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- OtherData target = (OtherData) object;
- return target.getKey();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- OtherData target = (OtherData) object;
- target.setKey( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _key
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _value
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- OtherData target = (OtherData) object;
- return target.getValue();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- OtherData target = (OtherData) object;
- target.setValue( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _value
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class OtherDataDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public OtherDataDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "otherData";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _key
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_key", "key",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ OtherData target = (OtherData) object;
+ return target.getKey();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ OtherData target = (OtherData) object;
+ target.setKey((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _key
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _value
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_value", "value",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ OtherData target = (OtherData) object;
+ return target.getValue();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ OtherData target = (OtherData) object;
+ target.setValue((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.OtherData.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _value
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.OtherData.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java
index f5f95a7..f19703a 100644
--- a/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Pdbentry;
@@ -35,295 +18,329 @@ import jalview.schemabinding.version2.Pdbentry;
*
* @version $Revision$ $Date$
*/
-public class PdbentryDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public PdbentryDescriptor() {
- super();
- _xmlName = "pdbentry";
- _elementDefinition = false;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _id
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Pdbentry target = (Pdbentry) object;
- return target.getId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Pdbentry target = (Pdbentry) object;
- target.setId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _id
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _type
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Pdbentry target = (Pdbentry) object;
- return target.getType();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Pdbentry target = (Pdbentry) object;
- target.setType( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _type
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _file
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_file", "file", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Pdbentry target = (Pdbentry) object;
- return target.getFile();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Pdbentry target = (Pdbentry) object;
- target.setFile( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _file
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _items
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.PdbentryItem.class, "_items", (java.lang.String) null, org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Pdbentry target = (Pdbentry) object;
- return target.getPdbentryItem();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Pdbentry target = (Pdbentry) object;
- target.addPdbentryItem( (jalview.schemabinding.version2.PdbentryItem) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- Pdbentry target = (Pdbentry) object;
- target.removeAllPdbentryItem();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.PdbentryItem();
- }
- };
- desc.setHandler(handler);
- desc.setContainer(true);
- desc.setClassDescriptor(new jalview.schemabinding.version2.descriptors.PdbentryItemDescriptor());
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _items
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
- }
- desc.setValidator(fieldValidator);
- }
+public class PdbentryDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
- //-----------/
- //- Methods -/
- //-----------/
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public PdbentryDescriptor()
+ {
+ super();
+ _xmlName = "pdbentry";
+ _elementDefinition = false;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _id
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_id", "id",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Pdbentry target = (Pdbentry) object;
+ return target.getId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Pdbentry target = (Pdbentry) object;
+ target.setId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _id
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _type
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_type", "type",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Pdbentry target = (Pdbentry) object;
+ return target.getType();
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Pdbentry.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Pdbentry target = (Pdbentry) object;
+ target.setType((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _type
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _file
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_file", "file",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Pdbentry target = (Pdbentry) object;
+ return target.getFile();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Pdbentry target = (Pdbentry) object;
+ target.setFile((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _file
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _items
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.PdbentryItem.class, "_items",
+ (java.lang.String) null, org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Pdbentry target = (Pdbentry) object;
+ return target.getPdbentryItem();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Pdbentry target = (Pdbentry) object;
+ target.addPdbentryItem((jalview.schemabinding.version2.PdbentryItem) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ Pdbentry target = (Pdbentry) object;
+ target.removeAllPdbentryItem();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.PdbentryItem();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setContainer(true);
+ desc.setClassDescriptor(new jalview.schemabinding.version2.descriptors.PdbentryItemDescriptor());
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ // -- validation code for: _items
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Pdbentry.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java
index 1800aa8..4e2fc87 100644
--- a/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.PdbentryItem;
@@ -35,185 +18,195 @@ import jalview.schemabinding.version2.PdbentryItem;
*
* @version $Revision$ $Date$
*/
-public class PdbentryItemDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public PdbentryItemDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "pdbentry";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- initialize element descriptors
-
- //-- _propertyList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- PdbentryItem target = (PdbentryItem) object;
- return target.getProperty();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- PdbentryItem target = (PdbentryItem) object;
- target.addProperty( (jalview.schemabinding.version2.Property) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- PdbentryItem target = (PdbentryItem) object;
- target.removeAllProperty();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Property();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _propertyList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+public class PdbentryItemDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public PdbentryItemDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "pdbentry";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- initialize element descriptors
+
+ // -- _propertyList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Property.class, "_propertyList",
+ "property", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ PdbentryItem target = (PdbentryItem) object;
+ return target.getProperty();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ PdbentryItem target = (PdbentryItem) object;
+ target.addProperty((jalview.schemabinding.version2.Property) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.PdbentryItem.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ PdbentryItem target = (PdbentryItem) object;
+ target.removeAllProperty();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Property();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _propertyList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.PdbentryItem.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java
index 9728465..584607d 100644
--- a/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Pdbids;
@@ -35,186 +18,197 @@ import jalview.schemabinding.version2.Pdbids;
*
* @version $Revision$ $Date$
*/
-public class PdbidsDescriptor extends jalview.schemabinding.version2.descriptors.PdbentryDescriptor {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public PdbidsDescriptor() {
- super();
- setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.PdbentryDescriptor());
- _nsURI = "www.jalview.org";
- _xmlName = "pdbids";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- initialize element descriptors
-
- //-- _structureStateList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.StructureState.class, "_structureStateList", "structureState", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Pdbids target = (Pdbids) object;
- return target.getStructureState();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Pdbids target = (Pdbids) object;
- target.addStructureState( (jalview.schemabinding.version2.StructureState) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- Pdbids target = (Pdbids) object;
- target.removeAllStructureState();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.StructureState();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _structureStateList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+public class PdbidsDescriptor extends
+ jalview.schemabinding.version2.descriptors.PdbentryDescriptor
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public PdbidsDescriptor()
+ {
+ super();
+ setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.PdbentryDescriptor());
+ _nsURI = "www.jalview.org";
+ _xmlName = "pdbids";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- initialize element descriptors
+
+ // -- _structureStateList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.StructureState.class,
+ "_structureStateList", "structureState",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Pdbids target = (Pdbids) object;
+ return target.getStructureState();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Pdbids target = (Pdbids) object;
+ target.addStructureState((jalview.schemabinding.version2.StructureState) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Pdbids.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ Pdbids target = (Pdbids) object;
+ target.removeAllStructureState();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.StructureState();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _structureStateList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Pdbids.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java
index 8960603..60d09b4 100644
--- a/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Property;
@@ -35,218 +18,231 @@ import jalview.schemabinding.version2.Property;
*
* @version $Revision$ $Date$
*/
-public class PropertyDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public PropertyDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "property";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _name
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Property target = (Property) object;
- return target.getName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Property target = (Property) object;
- target.setName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _name
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _value
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Property target = (Property) object;
- return target.getValue();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Property target = (Property) object;
- target.setValue( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _value
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class PropertyDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public PropertyDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "property";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _name
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_name", "name",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Property target = (Property) object;
+ return target.getName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Property target = (Property) object;
+ target.setName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _name
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _value
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_value", "value",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Property target = (Property) object;
+ return target.getValue();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Property target = (Property) object;
+ target.setValue((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Property.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _value
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Property.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/RnaViewerDescriptor.java b/src/jalview/schemabinding/version2/descriptors/RnaViewerDescriptor.java
new file mode 100644
index 0000000..3344050
--- /dev/null
+++ b/src/jalview/schemabinding/version2/descriptors/RnaViewerDescriptor.java
@@ -0,0 +1,634 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2.descriptors;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import jalview.schemabinding.version2.RnaViewer;
+
+/**
+ * Class RnaViewerDescriptor.
+ *
+ * @version $Revision$ $Date$
+ */
+public class RnaViewerDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public RnaViewerDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "rnaViewer";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _title
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_title", "title",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ RnaViewer target = (RnaViewer) object;
+ return target.getTitle();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ target.setTitle((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _title
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _viewId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_viewId", "viewId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ RnaViewer target = (RnaViewer) object;
+ return target.getViewId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ target.setViewId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _viewId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _dividerLocation
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_dividerLocation", "dividerLocation",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ RnaViewer target = (RnaViewer) object;
+ if (!target.hasDividerLocation())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getDividerLocation());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteDividerLocation();
+ return;
+ }
+ target.setDividerLocation(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _dividerLocation
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _selectedRna
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_selectedRna", "selectedRna",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ RnaViewer target = (RnaViewer) object;
+ if (!target.hasSelectedRna())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getSelectedRna());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteSelectedRna();
+ return;
+ }
+ target.setSelectedRna(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _selectedRna
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _width
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_width", "width",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ RnaViewer target = (RnaViewer) object;
+ if (!target.hasWidth())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getWidth());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteWidth();
+ return;
+ }
+ target.setWidth(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _width
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _height
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_height", "height",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ RnaViewer target = (RnaViewer) object;
+ if (!target.hasHeight())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getHeight());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteHeight();
+ return;
+ }
+ target.setHeight(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _height
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _xpos
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_xpos", "xpos",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ RnaViewer target = (RnaViewer) object;
+ if (!target.hasXpos())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getXpos());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteXpos();
+ return;
+ }
+ target.setXpos(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _xpos
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _ypos
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_ypos", "ypos",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ RnaViewer target = (RnaViewer) object;
+ if (!target.hasYpos())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getYpos());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteYpos();
+ return;
+ }
+ target.setYpos(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _ypos
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _secondaryStructureList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.SecondaryStructure.class,
+ "_secondaryStructureList", "secondaryStructure",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ RnaViewer target = (RnaViewer) object;
+ return target.getSecondaryStructure();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ target.addSecondaryStructure((jalview.schemabinding.version2.SecondaryStructure) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ RnaViewer target = (RnaViewer) object;
+ target.removeAllSecondaryStructure();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.SecondaryStructure();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setRequired(true);
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _secondaryStructureList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.RnaViewer.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
+
+}
diff --git a/src/jalview/schemabinding/version2/descriptors/SecondaryStructureDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SecondaryStructureDescriptor.java
new file mode 100644
index 0000000..c1e46b8
--- /dev/null
+++ b/src/jalview/schemabinding/version2/descriptors/SecondaryStructureDescriptor.java
@@ -0,0 +1,345 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2.descriptors;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import jalview.schemabinding.version2.SecondaryStructure;
+
+/**
+ * Class SecondaryStructureDescriptor.
+ *
+ * @version $Revision$ $Date$
+ */
+public class SecondaryStructureDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SecondaryStructureDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "secondaryStructure";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _title
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_title", "title",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SecondaryStructure target = (SecondaryStructure) object;
+ return target.getTitle();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SecondaryStructure target = (SecondaryStructure) object;
+ target.setTitle((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _title
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _annotationId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_annotationId", "annotationId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SecondaryStructure target = (SecondaryStructure) object;
+ return target.getAnnotationId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SecondaryStructure target = (SecondaryStructure) object;
+ target.setAnnotationId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _annotationId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _gapped
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_gapped", "gapped",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SecondaryStructure target = (SecondaryStructure) object;
+ if (!target.hasGapped())
+ {
+ return null;
+ }
+ return (target.getGapped() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SecondaryStructure target = (SecondaryStructure) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteGapped();
+ return;
+ }
+ target.setGapped(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _gapped
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _viewerState
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_viewerState", "viewerState",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SecondaryStructure target = (SecondaryStructure) object;
+ return target.getViewerState();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SecondaryStructure target = (SecondaryStructure) object;
+ target.setViewerState((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _viewerState
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.SecondaryStructure.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
+
+}
diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java
index 2798c1a..2303e1b 100644
--- a/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Sequence;
@@ -35,223 +18,241 @@ import jalview.schemabinding.version2.Sequence;
*
* @version $Revision$ $Date$
*/
-public class SequenceDescriptor extends jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor {
+public class SequenceDescriptor extends
+ jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor
+{
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+ public SequenceDescriptor()
+ {
+ super();
+ setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor());
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "Sequence";
+ _elementDefinition = true;
- //----------------/
- //- Constructors -/
- //----------------/
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
- public SequenceDescriptor() {
- super();
- setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor());
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "Sequence";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _dsseqid
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_dsseqid", "dsseqid", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Sequence target = (Sequence) object;
- return target.getDsseqid();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Sequence target = (Sequence) object;
- target.setDsseqid( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _dsseqid
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _DBRefList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.DBRef.class, "_DBRefList", "DBRef", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Sequence target = (Sequence) object;
- return target.getDBRef();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Sequence target = (Sequence) object;
- target.addDBRef( (jalview.schemabinding.version2.DBRef) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- Sequence target = (Sequence) object;
- target.removeAllDBRef();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.DBRef();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _DBRefList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ // -- _dsseqid
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_dsseqid", "dsseqid",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Sequence target = (Sequence) object;
+ return target.getDsseqid();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Sequence target = (Sequence) object;
+ target.setDsseqid((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _dsseqid
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+ // -- _DBRefList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.DBRef.class, "_DBRefList",
+ "DBRef", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Sequence target = (Sequence) object;
+ return target.getDBRef();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Sequence target = (Sequence) object;
+ target.addDBRef((jalview.schemabinding.version2.DBRef) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ Sequence target = (Sequence) object;
+ target.removeAllDBRef();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.DBRef();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Sequence.class;
+ // -- validation code for: _DBRefList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Sequence.class;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java
index 4d7daca..cd74c6e 100644
--- a/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.SequenceSet;
@@ -35,387 +18,455 @@ import jalview.schemabinding.version2.SequenceSet;
*
* @version $Revision$ $Date$
*/
-public class SequenceSetDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SequenceSetDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "SequenceSet";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _gapChar
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_gapChar", "gapChar", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceSet target = (SequenceSet) object;
- return target.getGapChar();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceSet target = (SequenceSet) object;
- target.setGapChar( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _gapChar
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class SequenceSetDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SequenceSetDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "SequenceSet";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _gapChar
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_gapChar", "gapChar",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceSet target = (SequenceSet) object;
+ return target.getGapChar();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.setGapChar((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _datasetId
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_datasetId", "datasetId", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceSet target = (SequenceSet) object;
- return target.getDatasetId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceSet target = (SequenceSet) object;
- target.setDatasetId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _datasetId
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _gapChar
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _datasetId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_datasetId", "datasetId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceSet target = (SequenceSet) object;
+ return target.getDatasetId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.setDatasetId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _sequenceList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Sequence.class, "_sequenceList", "Sequence", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceSet target = (SequenceSet) object;
- return target.getSequence();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceSet target = (SequenceSet) object;
- target.addSequence( (jalview.schemabinding.version2.Sequence) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- SequenceSet target = (SequenceSet) object;
- target.removeAllSequence();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Sequence();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _sequenceList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _datasetId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _sequenceList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Sequence.class, "_sequenceList",
+ "Sequence", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceSet target = (SequenceSet) object;
+ return target.getSequence();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.addSequence((jalview.schemabinding.version2.Sequence) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _annotationList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Annotation.class, "_annotationList", "Annotation", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceSet target = (SequenceSet) object;
- return target.getAnnotation();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceSet target = (SequenceSet) object;
- target.addAnnotation( (jalview.schemabinding.version2.Annotation) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- SequenceSet target = (SequenceSet) object;
- target.removeAllAnnotation();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Annotation();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _annotationList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.removeAllSequence();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _sequenceSetPropertiesList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.SequenceSetProperties.class, "_sequenceSetPropertiesList", "sequenceSetProperties", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceSet target = (SequenceSet) object;
- return target.getSequenceSetProperties();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceSet target = (SequenceSet) object;
- target.addSequenceSetProperties( (jalview.schemabinding.version2.SequenceSetProperties) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- SequenceSet target = (SequenceSet) object;
- target.removeAllSequenceSetProperties();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.SequenceSetProperties();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _sequenceSetPropertiesList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Sequence();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _sequenceList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ // -- _annotationList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Annotation.class,
+ "_annotationList", "Annotation",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceSet target = (SequenceSet) object;
+ return target.getAnnotation();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.addAnnotation((jalview.schemabinding.version2.Annotation) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _alcodonFrameList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.AlcodonFrame.class, "_alcodonFrameList", "AlcodonFrame", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceSet target = (SequenceSet) object;
- return target.getAlcodonFrame();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceSet target = (SequenceSet) object;
- target.addAlcodonFrame( (jalview.schemabinding.version2.AlcodonFrame) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- SequenceSet target = (SequenceSet) object;
- target.removeAllAlcodonFrame();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.AlcodonFrame();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _alcodonFrameList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.removeAllAnnotation();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Annotation();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _annotationList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _sequenceSetPropertiesList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.SequenceSetProperties.class,
+ "_sequenceSetPropertiesList", "sequenceSetProperties",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceSet target = (SequenceSet) object;
+ return target.getSequenceSetProperties();
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.addSequenceSetProperties((jalview.schemabinding.version2.SequenceSetProperties) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.removeAllSequenceSetProperties();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.SequenceSetProperties();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _sequenceSetPropertiesList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _alcodonFrameList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.AlcodonFrame.class,
+ "_alcodonFrameList", "AlcodonFrame",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceSet target = (SequenceSet) object;
+ return target.getAlcodonFrame();
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.SequenceSet.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.addAlcodonFrame((jalview.schemabinding.version2.AlcodonFrame) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ SequenceSet target = (SequenceSet) object;
+ target.removeAllAlcodonFrame();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.AlcodonFrame();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ // -- validation code for: _alcodonFrameList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.SequenceSet.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java
index e90908f..409abdd 100644
--- a/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.SequenceSetProperties;
@@ -35,214 +18,227 @@ import jalview.schemabinding.version2.SequenceSetProperties;
*
* @version $Revision$ $Date$
*/
-public class SequenceSetPropertiesDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SequenceSetPropertiesDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "sequenceSetProperties";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _key
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_key", "key", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceSetProperties target = (SequenceSetProperties) object;
- return target.getKey();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceSetProperties target = (SequenceSetProperties) object;
- target.setKey( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _key
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _value
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceSetProperties target = (SequenceSetProperties) object;
- return target.getValue();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceSetProperties target = (SequenceSetProperties) object;
- target.setValue( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _value
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class SequenceSetPropertiesDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SequenceSetPropertiesDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "sequenceSetProperties";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _key
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_key", "key",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceSetProperties target = (SequenceSetProperties) object;
+ return target.getKey();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceSetProperties target = (SequenceSetProperties) object;
+ target.setKey((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _key
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _value
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_value", "value",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceSetProperties target = (SequenceSetProperties) object;
+ return target.getValue();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceSetProperties target = (SequenceSetProperties) object;
+ target.setValue((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.SequenceSetProperties.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _value
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.SequenceSetProperties.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java
index 9638913..3ee3fa9 100644
--- a/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.SequenceType;
@@ -35,293 +18,322 @@ import jalview.schemabinding.version2.SequenceType;
*
* @version $Revision$ $Date$
*/
-public class SequenceTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SequenceTypeDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "SequenceType";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _id
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceType target = (SequenceType) object;
- return target.getId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceType target = (SequenceType) object;
- target.setId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _id
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _description
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceType target = (SequenceType) object;
- return target.getDescription();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceType target = (SequenceType) object;
- target.setDescription( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _description
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _sequence
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_sequence", "sequence", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceType target = (SequenceType) object;
- return target.getSequence();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceType target = (SequenceType) object;
- target.setSequence( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _sequence
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class SequenceTypeDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SequenceTypeDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "SequenceType";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _id
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_id", "id",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceType target = (SequenceType) object;
+ return target.getId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceType target = (SequenceType) object;
+ target.setId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _name
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- SequenceType target = (SequenceType) object;
- return target.getName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- SequenceType target = (SequenceType) object;
- target.setName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _name
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _id
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _description
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_description", "description",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceType target = (SequenceType) object;
+ return target.getDescription();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceType target = (SequenceType) object;
+ target.setDescription((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _description
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+ // -- _sequence
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_sequence", "sequence",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceType target = (SequenceType) object;
+ return target.getSequence();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceType target = (SequenceType) object;
+ target.setSequence((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _sequence
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _name
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_name", "name",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ SequenceType target = (SequenceType) object;
+ return target.getName();
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.SequenceType.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ SequenceType target = (SequenceType) object;
+ target.setName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _name
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.SequenceType.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java
index 44ea42c..4703f46 100644
--- a/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Setting;
@@ -35,603 +18,736 @@ import jalview.schemabinding.version2.Setting;
*
* @version $Revision$ $Date$
*/
-public class SettingDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SettingDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "setting";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _type
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- return target.getType();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- target.setType( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _type
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class SettingDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SettingDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "setting";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _type
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_type", "type",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ return target.getType();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ target.setType((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _colour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasColour()) { return null; }
- return new java.lang.Integer(target.getColour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setColour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _type
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _colour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_colour", "colour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasColour())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _display
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_display", "display", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasDisplay()) { return null; }
- return (target.getDisplay() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setDisplay( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _display
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ return new java.lang.Integer(target.getColour());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setColour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _order
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_order", "order", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasOrder()) { return null; }
- return new java.lang.Float(target.getOrder());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteOrder();
- return;
- }
- target.setOrder( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _order
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _colour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _display
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_display", "display",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasDisplay())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _mincolour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_mincolour", "mincolour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasMincolour()) { return null; }
- return new java.lang.Integer(target.getMincolour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteMincolour();
- return;
- }
- target.setMincolour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _mincolour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return (target.getDisplay() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setDisplay(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _threshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasThreshold()) { return null; }
- return new java.lang.Float(target.getThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteThreshold();
- return;
- }
- target.setThreshold( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _threshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _display
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _order
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_order", "order",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasOrder())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _threshstate
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_threshstate", "threshstate", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasThreshstate()) { return null; }
- return new java.lang.Integer(target.getThreshstate());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteThreshstate();
- return;
- }
- target.setThreshstate( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _threshstate
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return new java.lang.Float(target.getOrder());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteOrder();
+ return;
+ }
+ target.setOrder(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _max
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_max", "max", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasMax()) { return null; }
- return new java.lang.Float(target.getMax());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteMax();
- return;
- }
- target.setMax( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _max
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _order
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _mincolour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_mincolour", "mincolour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasMincolour())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _min
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_min", "min", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasMin()) { return null; }
- return new java.lang.Float(target.getMin());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteMin();
- return;
- }
- target.setMin( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _min
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ return new java.lang.Integer(target.getMincolour());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteMincolour();
+ return;
+ }
+ target.setMincolour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _colourByLabel
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasColourByLabel()) { return null; }
- return (target.getColourByLabel() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteColourByLabel();
- return;
- }
- target.setColourByLabel( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colourByLabel
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _mincolour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _threshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_threshold", "threshold",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasThreshold())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _autoScale
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_autoScale", "autoScale", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Setting target = (Setting) object;
- if (!target.hasAutoScale()) { return null; }
- return (target.getAutoScale() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Setting target = (Setting) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteAutoScale();
- return;
- }
- target.setAutoScale( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _autoScale
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ return new java.lang.Float(target.getThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteThreshold();
+ return;
+ }
+ target.setThreshold(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+ // -- validation code for: _threshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _threshstate
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_threshstate", "threshstate",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasThreshstate())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getThreshstate());
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteThreshstate();
+ return;
+ }
+ target.setThreshstate(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _threshstate
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _max
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_max", "max",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasMax())
+ {
+ return null;
+ }
+ return new java.lang.Float(target.getMax());
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Setting.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteMax();
+ return;
+ }
+ target.setMax(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _max
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
}
+ desc.setValidator(fieldValidator);
+ // -- _min
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_min", "min",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasMin())
+ {
+ return null;
+ }
+ return new java.lang.Float(target.getMin());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteMin();
+ return;
+ }
+ target.setMin(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _min
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
}
+ desc.setValidator(fieldValidator);
+ // -- _colourByLabel
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasColourByLabel())
+ {
+ return null;
+ }
+ return (target.getColourByLabel() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteColourByLabel();
+ return;
+ }
+ target.setColourByLabel(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _colourByLabel
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _autoScale
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_autoScale", "autoScale",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Setting target = (Setting) object;
+ if (!target.hasAutoScale())
+ {
+ return null;
+ }
+ return (target.getAutoScale() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteAutoScale();
+ return;
+ }
+ target.setAutoScale(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _autoScale
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Setting.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java b/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java
index a01f2f5..16d091b 100644
--- a/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.StructureState;
@@ -35,549 +18,710 @@ import jalview.schemabinding.version2.StructureState;
*
* @version $Revision$ $Date$
*/
-public class StructureStateDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public StructureStateDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "structureState";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- _content
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- return target.getContent();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- target.setContent( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- addFieldDescriptor(desc);
-
- //-- validation code for: _content
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class StructureStateDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public StructureStateDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "structureState";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- _content
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_content", "PCDATA",
+ org.exolab.castor.xml.NodeType.Text);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ return target.getContent();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ target.setContent((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize attribute descriptors
-
- //-- _visible
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_visible", "visible", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- if (!target.hasVisible()) { return null; }
- return (target.getVisible() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteVisible();
- return;
- }
- target.setVisible( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _visible
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _content
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- initialize attribute descriptors
+
+ // -- _visible
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_visible", "visible",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ if (!target.hasVisible())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _viewId
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_viewId", "viewId", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- return target.getViewId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- target.setViewId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _viewId
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ return (target.getVisible() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteVisible();
+ return;
+ }
+ target.setVisible(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _alignwithAlignPanel
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_alignwithAlignPanel", "alignwithAlignPanel", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- if (!target.hasAlignwithAlignPanel()) { return null; }
- return (target.getAlignwithAlignPanel() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteAlignwithAlignPanel();
- return;
- }
- target.setAlignwithAlignPanel( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _alignwithAlignPanel
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _visible
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _viewId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_viewId", "viewId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ return target.getViewId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ target.setViewId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _colourwithAlignPanel
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_colourwithAlignPanel", "colourwithAlignPanel", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- if (!target.hasColourwithAlignPanel()) { return null; }
- return (target.getColourwithAlignPanel() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteColourwithAlignPanel();
- return;
- }
- target.setColourwithAlignPanel( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colourwithAlignPanel
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _viewId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _alignwithAlignPanel
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_alignwithAlignPanel",
+ "alignwithAlignPanel", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ if (!target.hasAlignwithAlignPanel())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _colourByJmol
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_colourByJmol", "colourByJmol", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- if (!target.hasColourByJmol()) { return null; }
- return (target.getColourByJmol() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteColourByJmol();
- return;
- }
- target.setColourByJmol( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colourByJmol
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ return (target.getAlignwithAlignPanel() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteAlignwithAlignPanel();
+ return;
+ }
+ target.setAlignwithAlignPanel(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _width
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_width", "width", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- if (!target.hasWidth()) { return null; }
- return new java.lang.Integer(target.getWidth());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteWidth();
- return;
- }
- target.setWidth( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _width
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _alignwithAlignPanel
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _colourwithAlignPanel
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_colourwithAlignPanel",
+ "colourwithAlignPanel",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ if (!target.hasColourwithAlignPanel())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _height
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_height", "height", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- if (!target.hasHeight()) { return null; }
- return new java.lang.Integer(target.getHeight());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteHeight();
- return;
- }
- target.setHeight( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _height
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return (target.getColourwithAlignPanel() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteColourwithAlignPanel();
+ return;
+ }
+ target.setColourwithAlignPanel(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _xpos
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_xpos", "xpos", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- if (!target.hasXpos()) { return null; }
- return new java.lang.Integer(target.getXpos());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteXpos();
- return;
- }
- target.setXpos( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _xpos
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _colourwithAlignPanel
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _colourByJmol
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_colourByJmol", "colourByJmol",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ if (!target.hasColourByJmol())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _ypos
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_ypos", "ypos", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- StructureState target = (StructureState) object;
- if (!target.hasYpos()) { return null; }
- return new java.lang.Integer(target.getYpos());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- StructureState target = (StructureState) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteYpos();
- return;
- }
- target.setYpos( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _ypos
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return (target.getColourByJmol() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteColourByJmol();
+ return;
+ }
+ target.setColourByJmol(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
+ }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- //-----------/
- //- Methods -/
- //-----------/
+ // -- validation code for: _colourByJmol
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _type
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_type", "type",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ return target.getType();
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ target.setType((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _type
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _width
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_width", "width",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ if (!target.hasWidth())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getWidth());
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.StructureState.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteWidth();
+ return;
+ }
+ target.setWidth(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _width
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _height
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_height", "height",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ if (!target.hasHeight())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getHeight());
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteHeight();
+ return;
+ }
+ target.setHeight(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _height
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _xpos
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_xpos", "xpos",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ if (!target.hasXpos())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getXpos());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteXpos();
+ return;
+ }
+ target.setXpos(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _xpos
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _ypos
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_ypos", "ypos",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ StructureState target = (StructureState) object;
+ if (!target.hasYpos())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getYpos());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ StructureState target = (StructureState) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteYpos();
+ return;
+ }
+ target.setYpos(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _ypos
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.StructureState.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java
index 4d8f645..8a863d8 100644
--- a/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.ThresholdLine;
@@ -35,263 +18,292 @@ import jalview.schemabinding.version2.ThresholdLine;
*
* @version $Revision$ $Date$
*/
-public class ThresholdLineDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public ThresholdLineDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "thresholdLine";
- _elementDefinition = true;
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _label
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_label", "label", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- ThresholdLine target = (ThresholdLine) object;
- return target.getLabel();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- ThresholdLine target = (ThresholdLine) object;
- target.setLabel( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _label
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class ThresholdLineDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public ThresholdLineDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "thresholdLine";
+ _elementDefinition = true;
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _label
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_label", "label",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ ThresholdLine target = (ThresholdLine) object;
+ return target.getLabel();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ ThresholdLine target = (ThresholdLine) object;
+ target.setLabel((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _value
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_value", "value", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- ThresholdLine target = (ThresholdLine) object;
- if (!target.hasValue()) { return null; }
- return new java.lang.Float(target.getValue());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- ThresholdLine target = (ThresholdLine) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteValue();
- return;
- }
- target.setValue( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _value
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _label
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _value
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_value", "value",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ ThresholdLine target = (ThresholdLine) object;
+ if (!target.hasValue())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _colour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- ThresholdLine target = (ThresholdLine) object;
- if (!target.hasColour()) { return null; }
- return new java.lang.Integer(target.getColour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- ThresholdLine target = (ThresholdLine) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteColour();
- return;
- }
- target.setColour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return new java.lang.Float(target.getValue());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ ThresholdLine target = (ThresholdLine) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteValue();
+ return;
+ }
+ target.setValue(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- }
+ }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _value
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _colour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_colour", "colour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ ThresholdLine target = (ThresholdLine) object;
+ if (!target.hasColour())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getColour());
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ ThresholdLine target = (ThresholdLine) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteColour();
+ return;
+ }
+ target.setColour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _colour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.ThresholdLine.class;
- }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.ThresholdLine.class;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java
index 6b46c5b..8e675f3 100644
--- a/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Tree;
@@ -35,798 +18,978 @@ import jalview.schemabinding.version2.Tree;
*
* @version $Revision$ $Date$
*/
-public class TreeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public TreeDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "tree";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _fontName
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_fontName", "fontName", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- return target.getFontName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- target.setFontName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _fontName
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _fontSize
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_fontSize", "fontSize", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasFontSize()) { return null; }
- return new java.lang.Integer(target.getFontSize());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteFontSize();
- return;
- }
- target.setFontSize( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _fontSize
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+public class TreeDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public TreeDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "tree";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _fontName
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_fontName", "fontName",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ return target.getFontName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ target.setFontName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _fontStyle
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_fontStyle", "fontStyle", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasFontStyle()) { return null; }
- return new java.lang.Integer(target.getFontStyle());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteFontStyle();
- return;
- }
- target.setFontStyle( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _fontStyle
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _fontName
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _fontSize
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_fontSize", "fontSize",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasFontSize())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _threshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasThreshold()) { return null; }
- return new java.lang.Float(target.getThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteThreshold();
- return;
- }
- target.setThreshold( ((java.lang.Float) value).floatValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _threshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.FloatValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive((float) -3.4028235E38);
- typeValidator.setMaxInclusive((float) 3.4028235E38);
+ return new java.lang.Integer(target.getFontSize());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteFontSize();
+ return;
+ }
+ target.setFontSize(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _showBootstrap
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showBootstrap", "showBootstrap", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasShowBootstrap()) { return null; }
- return (target.getShowBootstrap() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowBootstrap();
- return;
- }
- target.setShowBootstrap( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showBootstrap
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _fontSize
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _fontStyle
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_fontStyle", "fontStyle",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasFontStyle())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _showDistances
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showDistances", "showDistances", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasShowDistances()) { return null; }
- return (target.getShowDistances() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowDistances();
- return;
- }
- target.setShowDistances( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showDistances
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ return new java.lang.Integer(target.getFontStyle());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteFontStyle();
+ return;
+ }
+ target.setFontStyle(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _markUnlinked
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_markUnlinked", "markUnlinked", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasMarkUnlinked()) { return null; }
- return (target.getMarkUnlinked() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteMarkUnlinked();
- return;
- }
- target.setMarkUnlinked( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _markUnlinked
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _fontStyle
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _threshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Float.TYPE, "_threshold", "threshold",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasThreshold())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _fitToWindow
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_fitToWindow", "fitToWindow", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasFitToWindow()) { return null; }
- return (target.getFitToWindow() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteFitToWindow();
- return;
- }
- target.setFitToWindow( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _fitToWindow
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ return new java.lang.Float(target.getThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteThreshold();
+ return;
+ }
+ target.setThreshold(((java.lang.Float) value).floatValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _currentTree
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_currentTree", "currentTree", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasCurrentTree()) { return null; }
- return (target.getCurrentTree() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteCurrentTree();
- return;
- }
- target.setCurrentTree( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _currentTree
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _threshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive((float) -3.4028235E38);
+ typeValidator.setMaxInclusive((float) 3.4028235E38);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showBootstrap
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showBootstrap", "showBootstrap",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasShowBootstrap())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _id
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
- super.setIdentity(desc);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- return target.getId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- target.setId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new java.lang.String();
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _id
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IdValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();
- fieldValidator.setValidator(typeValidator);
+ return (target.getShowBootstrap() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowBootstrap();
+ return;
+ }
+ target.setShowBootstrap(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _width
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_width", "width", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasWidth()) { return null; }
- return new java.lang.Integer(target.getWidth());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteWidth();
- return;
- }
- target.setWidth( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _width
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showBootstrap
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showDistances
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showDistances", "showDistances",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasShowDistances())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _height
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_height", "height", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasHeight()) { return null; }
- return new java.lang.Integer(target.getHeight());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteHeight();
- return;
- }
- target.setHeight( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _height
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return (target.getShowDistances() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowDistances();
+ return;
+ }
+ target.setShowDistances(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _xpos
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_xpos", "xpos", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasXpos()) { return null; }
- return new java.lang.Integer(target.getXpos());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteXpos();
- return;
- }
- target.setXpos( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _xpos
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showDistances
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _markUnlinked
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_markUnlinked", "markUnlinked",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasMarkUnlinked())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _ypos
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_ypos", "ypos", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- if (!target.hasYpos()) { return null; }
- return new java.lang.Integer(target.getYpos());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteYpos();
- return;
- }
- target.setYpos( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _ypos
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return (target.getMarkUnlinked() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteMarkUnlinked();
+ return;
+ }
+ target.setMarkUnlinked(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _title
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- return target.getTitle();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- target.setTitle( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _title
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _markUnlinked
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _fitToWindow
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_fitToWindow", "fitToWindow",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasFitToWindow())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _newick
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_newick", "newick", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Tree target = (Tree) object;
- return target.getNewick();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Tree target = (Tree) object;
- target.setNewick( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _newick
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ return (target.getFitToWindow() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteFitToWindow();
+ return;
+ }
+ target.setFitToWindow(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- }
+ }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _fitToWindow
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _currentTree
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_currentTree", "currentTree",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasCurrentTree())
+ {
+ return null;
+ }
+ return (target.getCurrentTree() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteCurrentTree();
+ return;
+ }
+ target.setCurrentTree(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _currentTree
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _id
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_id", "id",
+ org.exolab.castor.xml.NodeType.Attribute);
+ super.setIdentity(desc);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ return target.getId();
+ }
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ target.setId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new java.lang.String();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _id
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IdValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _width
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_width", "width",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasWidth())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getWidth());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteWidth();
+ return;
+ }
+ target.setWidth(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Tree.class;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _width
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _height
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_height", "height",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasHeight())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getHeight());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteHeight();
+ return;
+ }
+ target.setHeight(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
+ // -- validation code for: _height
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _xpos
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_xpos", "xpos",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasXpos())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getXpos());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteXpos();
+ return;
+ }
+ target.setXpos(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _xpos
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _ypos
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_ypos", "ypos",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ if (!target.hasYpos())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getYpos());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteYpos();
+ return;
+ }
+ target.setYpos(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _ypos
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _title
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_title", "title",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ return target.getTitle();
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ target.setTitle((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _title
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _newick
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_newick", "newick",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Tree target = (Tree) object;
+ return target.getNewick();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Tree target = (Tree) object;
+ target.setNewick((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _newick
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Tree.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java
index 6c71d87..527b16b 100644
--- a/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,145 +7,142 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
-import jalview.schemabinding.version2.UserColourScheme;
/**
* Class UserColourSchemeDescriptor.
*
* @version $Revision$ $Date$
*/
-public class UserColourSchemeDescriptor extends jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public UserColourSchemeDescriptor() {
- super();
- setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor());
- _nsURI = "www.jalview.org";
- _xmlName = "UserColourScheme";
- _elementDefinition = true;
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.UserColourScheme.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+public class UserColourSchemeDescriptor
+ extends
+ jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public UserColourSchemeDescriptor()
+ {
+ super();
+ setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor());
+ _nsURI = "www.jalview.org";
+ _xmlName = "UserColourScheme";
+ _elementDefinition = true;
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.UserColourScheme.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java
index 1fb1b50..53dfde4 100644
--- a/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.UserColours;
@@ -35,215 +18,229 @@ import jalview.schemabinding.version2.UserColours;
*
* @version $Revision$ $Date$
*/
-public class UserColoursDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public UserColoursDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "UserColours";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _id
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- UserColours target = (UserColours) object;
- return target.getId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- UserColours target = (UserColours) object;
- target.setId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _id
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _userColourScheme
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.UserColourScheme.class, "_userColourScheme", "UserColourScheme", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- UserColours target = (UserColours) object;
- return target.getUserColourScheme();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- UserColours target = (UserColours) object;
- target.setUserColourScheme( (jalview.schemabinding.version2.UserColourScheme) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.UserColourScheme();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _userColourScheme
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
+public class UserColoursDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public UserColoursDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "UserColours";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _id
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_id", "id",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ UserColours target = (UserColours) object;
+ return target.getId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ UserColours target = (UserColours) object;
+ target.setId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _id
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.UserColours.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _userColourScheme
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.UserColourScheme.class,
+ "_userColourScheme", "UserColourScheme",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ UserColours target = (UserColours) object;
+ return target.getUserColourScheme();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ UserColours target = (UserColours) object;
+ target.setUserColourScheme((jalview.schemabinding.version2.UserColourScheme) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.UserColourScheme();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _userColourScheme
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.UserColours.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java b/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java
index 506e479..e3470ee 100644
--- a/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.VAMSAS;
@@ -35,232 +18,256 @@ import jalview.schemabinding.version2.VAMSAS;
*
* @version $Revision$ $Date$
*/
-public class VAMSASDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public VAMSASDescriptor() {
- super();
- _nsURI = "www.vamsas.ac.uk/jalview/version2";
- _xmlName = "VAMSAS";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- initialize element descriptors
-
- //-- _treeList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- VAMSAS target = (VAMSAS) object;
- return target.getTree();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- VAMSAS target = (VAMSAS) object;
- target.addTree( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- VAMSAS target = (VAMSAS) object;
- target.removeAllTree();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _treeList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class VAMSASDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public VAMSASDescriptor()
+ {
+ super();
+ _nsURI = "www.vamsas.ac.uk/jalview/version2";
+ _xmlName = "VAMSAS";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- initialize element descriptors
+
+ // -- _treeList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_treeList", "Tree",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ VAMSAS target = (VAMSAS) object;
+ return target.getTree();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ VAMSAS target = (VAMSAS) object;
+ target.addTree((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _sequenceSetList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.SequenceSet.class, "_sequenceSetList", "SequenceSet", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- VAMSAS target = (VAMSAS) object;
- return target.getSequenceSet();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- VAMSAS target = (VAMSAS) object;
- target.addSequenceSet( (jalview.schemabinding.version2.SequenceSet) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- VAMSAS target = (VAMSAS) object;
- target.removeAllSequenceSet();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.SequenceSet();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _sequenceSetList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ VAMSAS target = (VAMSAS) object;
+ target.removeAllTree();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _treeList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _sequenceSetList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.SequenceSet.class,
+ "_sequenceSetList", "SequenceSet",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ VAMSAS target = (VAMSAS) object;
+ return target.getSequenceSet();
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ VAMSAS target = (VAMSAS) object;
+ target.addSequenceSet((jalview.schemabinding.version2.SequenceSet) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ VAMSAS target = (VAMSAS) object;
+ target.removeAllSequenceSet();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.SequenceSet();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _sequenceSetList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.VAMSAS.class;
- }
+ // -----------/
+ // - Methods -/
+ // -----------/
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.VAMSAS.class;
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java b/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java
index 72f0b41..fc7f9ba 100644
--- a/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,145 +7,141 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
-import jalview.schemabinding.version2.VamsasModel;
/**
* Class VamsasModelDescriptor.
*
* @version $Revision$ $Date$
*/
-public class VamsasModelDescriptor extends jalview.schemabinding.version2.descriptors.VAMSASDescriptor {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public VamsasModelDescriptor() {
- super();
- setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.VAMSASDescriptor());
- _nsURI = "www.jalview.org";
- _xmlName = "vamsasModel";
- _elementDefinition = true;
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
-
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
-
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.VamsasModel.class;
- }
-
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
-
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
-
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
-
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
- }
-
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
- }
+public class VamsasModelDescriptor extends
+ jalview.schemabinding.version2.descriptors.VAMSASDescriptor
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public VamsasModelDescriptor()
+ {
+ super();
+ setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.VAMSASDescriptor());
+ _nsURI = "www.jalview.org";
+ _xmlName = "vamsasModel";
+ _elementDefinition = true;
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.VamsasModel.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java
index 13ad9f7..1df3988 100644
--- a/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.Viewport;
@@ -35,1941 +18,2700 @@ import jalview.schemabinding.version2.Viewport;
*
* @version $Revision$ $Date$
*/
-public class ViewportDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public ViewportDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "Viewport";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _conservationSelected
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_conservationSelected", "conservationSelected", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasConservationSelected()) { return null; }
- return (target.getConservationSelected() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteConservationSelected();
- return;
- }
- target.setConservationSelected( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _conservationSelected
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _pidSelected
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_pidSelected", "pidSelected", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasPidSelected()) { return null; }
- return (target.getPidSelected() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deletePidSelected();
- return;
- }
- target.setPidSelected( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _pidSelected
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _bgColour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_bgColour", "bgColour", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- return target.getBgColour();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- target.setBgColour( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _bgColour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _consThreshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_consThreshold", "consThreshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasConsThreshold()) { return null; }
- return new java.lang.Integer(target.getConsThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteConsThreshold();
- return;
- }
- target.setConsThreshold( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _consThreshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _pidThreshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_pidThreshold", "pidThreshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasPidThreshold()) { return null; }
- return new java.lang.Integer(target.getPidThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deletePidThreshold();
- return;
- }
- target.setPidThreshold( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _pidThreshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _title
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- return target.getTitle();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- target.setTitle( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _title
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _showFullId
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showFullId", "showFullId", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowFullId()) { return null; }
- return (target.getShowFullId() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowFullId();
- return;
- }
- target.setShowFullId( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showFullId
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _rightAlignIds
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_rightAlignIds", "rightAlignIds", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasRightAlignIds()) { return null; }
- return (target.getRightAlignIds() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteRightAlignIds();
- return;
- }
- target.setRightAlignIds( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _rightAlignIds
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showText
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showText", "showText", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowText()) { return null; }
- return (target.getShowText() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowText();
- return;
- }
- target.setShowText( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showText
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showColourText
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showColourText", "showColourText", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowColourText()) { return null; }
- return (target.getShowColourText() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowColourText();
- return;
- }
- target.setShowColourText( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showColourText
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showUnconserved
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showUnconserved", "showUnconserved", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowUnconserved()) { return null; }
- return (target.getShowUnconserved() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowUnconserved();
- return;
- }
- target.setShowUnconserved( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showUnconserved
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showBoxes
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showBoxes", "showBoxes", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowBoxes()) { return null; }
- return (target.getShowBoxes() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowBoxes();
- return;
- }
- target.setShowBoxes( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showBoxes
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _wrapAlignment
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_wrapAlignment", "wrapAlignment", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasWrapAlignment()) { return null; }
- return (target.getWrapAlignment() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteWrapAlignment();
- return;
- }
- target.setWrapAlignment( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _wrapAlignment
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _renderGaps
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_renderGaps", "renderGaps", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasRenderGaps()) { return null; }
- return (target.getRenderGaps() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteRenderGaps();
- return;
- }
- target.setRenderGaps( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _renderGaps
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showSequenceFeatures
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showSequenceFeatures", "showSequenceFeatures", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowSequenceFeatures()) { return null; }
- return (target.getShowSequenceFeatures() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowSequenceFeatures();
- return;
- }
- target.setShowSequenceFeatures( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showSequenceFeatures
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showNPfeatureTooltip
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showNPfeatureTooltip", "showNPfeatureTooltip", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowNPfeatureTooltip()) { return null; }
- return (target.getShowNPfeatureTooltip() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowNPfeatureTooltip();
- return;
- }
- target.setShowNPfeatureTooltip( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showNPfeatureTooltip
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showDbRefTooltip
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showDbRefTooltip", "showDbRefTooltip", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowDbRefTooltip()) { return null; }
- return (target.getShowDbRefTooltip() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowDbRefTooltip();
- return;
- }
- target.setShowDbRefTooltip( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showDbRefTooltip
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _followHighlight
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_followHighlight", "followHighlight", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasFollowHighlight()) { return null; }
- return (target.getFollowHighlight() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteFollowHighlight();
- return;
- }
- target.setFollowHighlight( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _followHighlight
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _followSelection
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_followSelection", "followSelection", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasFollowSelection()) { return null; }
- return (target.getFollowSelection() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteFollowSelection();
- return;
- }
- target.setFollowSelection( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _followSelection
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showAnnotation
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showAnnotation", "showAnnotation", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowAnnotation()) { return null; }
- return (target.getShowAnnotation() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowAnnotation();
- return;
- }
- target.setShowAnnotation( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showAnnotation
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _centreColumnLabels
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_centreColumnLabels", "centreColumnLabels", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasCentreColumnLabels()) { return null; }
- return (target.getCentreColumnLabels() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteCentreColumnLabels();
- return;
- }
- target.setCentreColumnLabels( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _centreColumnLabels
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showGroupConservation
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showGroupConservation", "showGroupConservation", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowGroupConservation()) { return null; }
- return (target.getShowGroupConservation() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowGroupConservation();
- return;
- }
- target.setShowGroupConservation( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showGroupConservation
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showGroupConsensus
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showGroupConsensus", "showGroupConsensus", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowGroupConsensus()) { return null; }
- return (target.getShowGroupConsensus() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowGroupConsensus();
- return;
- }
- target.setShowGroupConsensus( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showGroupConsensus
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showConsensusHistogram
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showConsensusHistogram", "showConsensusHistogram", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowConsensusHistogram()) { return null; }
- return (target.getShowConsensusHistogram() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowConsensusHistogram();
- return;
- }
- target.setShowConsensusHistogram( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showConsensusHistogram
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _showSequenceLogo
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showSequenceLogo", "showSequenceLogo", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasShowSequenceLogo()) { return null; }
- return (target.getShowSequenceLogo() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteShowSequenceLogo();
- return;
- }
- target.setShowSequenceLogo( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _showSequenceLogo
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _ignoreGapsinConsensus
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_ignoreGapsinConsensus", "ignoreGapsinConsensus", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasIgnoreGapsinConsensus()) { return null; }
- return (target.getIgnoreGapsinConsensus() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteIgnoreGapsinConsensus();
- return;
- }
- target.setIgnoreGapsinConsensus( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _ignoreGapsinConsensus
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _startRes
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_startRes", "startRes", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasStartRes()) { return null; }
- return new java.lang.Integer(target.getStartRes());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteStartRes();
- return;
- }
- target.setStartRes( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _startRes
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _startSeq
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_startSeq", "startSeq", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasStartSeq()) { return null; }
- return new java.lang.Integer(target.getStartSeq());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteStartSeq();
- return;
- }
- target.setStartSeq( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _startSeq
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _fontName
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_fontName", "fontName", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- return target.getFontName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- target.setFontName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _fontName
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _fontSize
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_fontSize", "fontSize", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasFontSize()) { return null; }
- return new java.lang.Integer(target.getFontSize());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteFontSize();
- return;
- }
- target.setFontSize( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _fontSize
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _fontStyle
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_fontStyle", "fontStyle", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasFontStyle()) { return null; }
- return new java.lang.Integer(target.getFontStyle());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteFontStyle();
- return;
- }
- target.setFontStyle( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _fontStyle
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _viewName
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_viewName", "viewName", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- return target.getViewName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- target.setViewName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _viewName
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _sequenceSetId
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_sequenceSetId", "sequenceSetId", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- return target.getSequenceSetId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- target.setSequenceSetId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _sequenceSetId
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _gatheredViews
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_gatheredViews", "gatheredViews", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasGatheredViews()) { return null; }
- return (target.getGatheredViews() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteGatheredViews();
- return;
- }
- target.setGatheredViews( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _gatheredViews
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _textCol1
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_textCol1", "textCol1", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasTextCol1()) { return null; }
- return new java.lang.Integer(target.getTextCol1());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteTextCol1();
- return;
- }
- target.setTextCol1( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _textCol1
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _textCol2
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_textCol2", "textCol2", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasTextCol2()) { return null; }
- return new java.lang.Integer(target.getTextCol2());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteTextCol2();
- return;
- }
- target.setTextCol2( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _textCol2
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _textColThreshold
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_textColThreshold", "textColThreshold", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasTextColThreshold()) { return null; }
- return new java.lang.Integer(target.getTextColThreshold());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteTextColThreshold();
- return;
- }
- target.setTextColThreshold( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _textColThreshold
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _id
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
- super.setIdentity(desc);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- return target.getId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- target.setId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new java.lang.String();
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _id
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IdValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();
- fieldValidator.setValidator(typeValidator);
- }
- desc.setValidator(fieldValidator);
- //-- _width
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_width", "width", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasWidth()) { return null; }
- return new java.lang.Integer(target.getWidth());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteWidth();
- return;
- }
- target.setWidth( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _width
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _height
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_height", "height", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasHeight()) { return null; }
- return new java.lang.Integer(target.getHeight());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteHeight();
- return;
- }
- target.setHeight( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _height
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _xpos
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_xpos", "xpos", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasXpos()) { return null; }
- return new java.lang.Integer(target.getXpos());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteXpos();
- return;
- }
- target.setXpos( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _xpos
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- _ypos
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_ypos", "ypos", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- if (!target.hasYpos()) { return null; }
- return new java.lang.Integer(target.getYpos());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteYpos();
- return;
- }
- target.setYpos( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _ypos
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _annotationColours
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.AnnotationColours.class, "_annotationColours", "AnnotationColours", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- return target.getAnnotationColours();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- target.setAnnotationColours( (jalview.schemabinding.version2.AnnotationColours) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.AnnotationColours();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _annotationColours
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- }
- desc.setValidator(fieldValidator);
- //-- _hiddenColumnsList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.HiddenColumns.class, "_hiddenColumnsList", "hiddenColumns", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- Viewport target = (Viewport) object;
- return target.getHiddenColumns();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- Viewport target = (Viewport) object;
- target.addHiddenColumns( (jalview.schemabinding.version2.HiddenColumns) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- Viewport target = (Viewport) object;
- target.removeAllHiddenColumns();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.HiddenColumns();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _hiddenColumnsList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
- }
- desc.setValidator(fieldValidator);
+public class ViewportDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public ViewportDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "Viewport";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _conservationSelected
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_conservationSelected",
+ "conservationSelected",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasConservationSelected())
+ {
+ return null;
+ }
+ return (target.getConservationSelected() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteConservationSelected();
+ return;
+ }
+ target.setConservationSelected(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _conservationSelected
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _pidSelected
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_pidSelected", "pidSelected",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasPidSelected())
+ {
+ return null;
+ }
+ return (target.getPidSelected() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deletePidSelected();
+ return;
+ }
+ target.setPidSelected(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _pidSelected
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _bgColour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_bgColour", "bgColour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getBgColour();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.setBgColour((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _bgColour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _consThreshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_consThreshold", "consThreshold",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasConsThreshold())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getConsThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteConsThreshold();
+ return;
+ }
+ target.setConsThreshold(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _consThreshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _pidThreshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_pidThreshold", "pidThreshold",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasPidThreshold())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getPidThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deletePidThreshold();
+ return;
+ }
+ target.setPidThreshold(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _pidThreshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _title
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_title", "title",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getTitle();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.setTitle((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _title
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showFullId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showFullId", "showFullId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowFullId())
+ {
+ return null;
+ }
+ return (target.getShowFullId() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowFullId();
+ return;
+ }
+ target.setShowFullId(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showFullId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _rightAlignIds
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_rightAlignIds", "rightAlignIds",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasRightAlignIds())
+ {
+ return null;
+ }
+ return (target.getRightAlignIds() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteRightAlignIds();
+ return;
+ }
+ target.setRightAlignIds(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _rightAlignIds
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showText
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showText", "showText",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowText())
+ {
+ return null;
+ }
+ return (target.getShowText() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowText();
+ return;
+ }
+ target.setShowText(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showText
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showColourText
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showColourText", "showColourText",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowColourText())
+ {
+ return null;
+ }
+ return (target.getShowColourText() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowColourText();
+ return;
+ }
+ target.setShowColourText(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showColourText
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showUnconserved
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showUnconserved", "showUnconserved",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowUnconserved())
+ {
+ return null;
+ }
+ return (target.getShowUnconserved() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowUnconserved();
+ return;
+ }
+ target.setShowUnconserved(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showUnconserved
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showBoxes
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showBoxes", "showBoxes",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowBoxes())
+ {
+ return null;
+ }
+ return (target.getShowBoxes() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowBoxes();
+ return;
+ }
+ target.setShowBoxes(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showBoxes
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _wrapAlignment
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_wrapAlignment", "wrapAlignment",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasWrapAlignment())
+ {
+ return null;
+ }
+ return (target.getWrapAlignment() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteWrapAlignment();
+ return;
+ }
+ target.setWrapAlignment(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _wrapAlignment
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _renderGaps
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_renderGaps", "renderGaps",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasRenderGaps())
+ {
+ return null;
+ }
+ return (target.getRenderGaps() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteRenderGaps();
+ return;
+ }
+ target.setRenderGaps(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _renderGaps
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showSequenceFeatures
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showSequenceFeatures",
+ "showSequenceFeatures",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowSequenceFeatures())
+ {
+ return null;
+ }
+ return (target.getShowSequenceFeatures() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowSequenceFeatures();
+ return;
+ }
+ target.setShowSequenceFeatures(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showSequenceFeatures
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showNPfeatureTooltip
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showNPfeatureTooltip",
+ "showNPfeatureTooltip",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowNPfeatureTooltip())
+ {
+ return null;
+ }
+ return (target.getShowNPfeatureTooltip() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowNPfeatureTooltip();
+ return;
+ }
+ target.setShowNPfeatureTooltip(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showNPfeatureTooltip
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showDbRefTooltip
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showDbRefTooltip",
+ "showDbRefTooltip", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowDbRefTooltip())
+ {
+ return null;
+ }
+ return (target.getShowDbRefTooltip() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowDbRefTooltip();
+ return;
+ }
+ target.setShowDbRefTooltip(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showDbRefTooltip
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _followHighlight
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_followHighlight", "followHighlight",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasFollowHighlight())
+ {
+ return null;
+ }
+ return (target.getFollowHighlight() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteFollowHighlight();
+ return;
+ }
+ target.setFollowHighlight(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _followHighlight
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _followSelection
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_followSelection", "followSelection",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasFollowSelection())
+ {
+ return null;
+ }
+ return (target.getFollowSelection() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteFollowSelection();
+ return;
+ }
+ target.setFollowSelection(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _followSelection
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showAnnotation
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showAnnotation", "showAnnotation",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowAnnotation())
+ {
+ return null;
+ }
+ return (target.getShowAnnotation() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowAnnotation();
+ return;
+ }
+ target.setShowAnnotation(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showAnnotation
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _centreColumnLabels
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_centreColumnLabels",
+ "centreColumnLabels", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasCentreColumnLabels())
+ {
+ return null;
+ }
+ return (target.getCentreColumnLabels() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteCentreColumnLabels();
+ return;
+ }
+ target.setCentreColumnLabels(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _centreColumnLabels
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showGroupConservation
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showGroupConservation",
+ "showGroupConservation",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowGroupConservation())
+ {
+ return null;
+ }
+ return (target.getShowGroupConservation() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowGroupConservation();
+ return;
+ }
+ target.setShowGroupConservation(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showGroupConservation
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showGroupConsensus
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showGroupConsensus",
+ "showGroupConsensus", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowGroupConsensus())
+ {
+ return null;
+ }
+ return (target.getShowGroupConsensus() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowGroupConsensus();
+ return;
+ }
+ target.setShowGroupConsensus(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showGroupConsensus
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _showConsensusHistogram
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showConsensusHistogram",
+ "showConsensusHistogram",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowConsensusHistogram())
+ {
+ return null;
+ }
+ return (target.getShowConsensusHistogram() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowConsensusHistogram();
+ return;
+ }
+ target.setShowConsensusHistogram(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showConsensusHistogram
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _showSequenceLogo
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_showSequenceLogo",
+ "showSequenceLogo", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasShowSequenceLogo())
+ {
+ return null;
+ }
+ return (target.getShowSequenceLogo() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteShowSequenceLogo();
+ return;
+ }
+ target.setShowSequenceLogo(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _showSequenceLogo
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _normaliseSequenceLogo
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_normaliseSequenceLogo",
+ "normaliseSequenceLogo",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasNormaliseSequenceLogo())
+ {
+ return null;
+ }
+ return (target.getNormaliseSequenceLogo() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteNormaliseSequenceLogo();
+ return;
+ }
+ target.setNormaliseSequenceLogo(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _normaliseSequenceLogo
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _ignoreGapsinConsensus
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_ignoreGapsinConsensus",
+ "ignoreGapsinConsensus",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasIgnoreGapsinConsensus())
+ {
+ return null;
+ }
+ return (target.getIgnoreGapsinConsensus() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteIgnoreGapsinConsensus();
+ return;
+ }
+ target.setIgnoreGapsinConsensus(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _ignoreGapsinConsensus
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _startRes
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_startRes", "startRes",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasStartRes())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getStartRes());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteStartRes();
+ return;
+ }
+ target.setStartRes(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _startRes
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _startSeq
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_startSeq", "startSeq",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasStartSeq())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getStartSeq());
+ }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteStartSeq();
+ return;
+ }
+ target.setStartSeq(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- //-----------/
- //- Methods -/
- //-----------/
+ // -- validation code for: _startSeq
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _fontName
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_fontName", "fontName",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getFontName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.setFontName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _fontName
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _fontSize
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_fontSize", "fontSize",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasFontSize())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getFontSize());
+ }
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteFontSize();
+ return;
+ }
+ target.setFontSize(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _fontSize
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _fontStyle
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_fontStyle", "fontStyle",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasFontStyle())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getFontStyle());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteFontStyle();
+ return;
+ }
+ target.setFontStyle(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.Viewport.class;
+ // -- validation code for: _fontStyle
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _scaleProteinAsCdna
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_scaleProteinAsCdna",
+ "scaleProteinAsCdna", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasScaleProteinAsCdna())
+ {
+ return null;
+ }
+ return (target.getScaleProteinAsCdna() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteScaleProteinAsCdna();
+ return;
+ }
+ target.setScaleProteinAsCdna(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _scaleProteinAsCdna
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _viewName
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_viewName", "viewName",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getViewName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.setViewName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _viewName
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _sequenceSetId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_sequenceSetId", "sequenceSetId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getSequenceSetId();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.setSequenceSetId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _sequenceSetId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _gatheredViews
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_gatheredViews", "gatheredViews",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasGatheredViews())
+ {
+ return null;
+ }
+ return (target.getGatheredViews() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteGatheredViews();
+ return;
+ }
+ target.setGatheredViews(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _gatheredViews
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- _textCol1
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_textCol1", "textCol1",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasTextCol1())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getTextCol1());
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteTextCol1();
+ return;
+ }
+ target.setTextCol1(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _textCol1
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _textCol2
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_textCol2", "textCol2",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasTextCol2())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getTextCol2());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteTextCol2();
+ return;
+ }
+ target.setTextCol2(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _textCol2
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _textColThreshold
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_textColThreshold",
+ "textColThreshold", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasTextColThreshold())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getTextColThreshold());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteTextColThreshold();
+ return;
+ }
+ target.setTextColThreshold(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _textColThreshold
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _id
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_id", "id",
+ org.exolab.castor.xml.NodeType.Attribute);
+ super.setIdentity(desc);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.setId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new java.lang.String();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _id
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IdValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _complementId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_complementId", "complementId",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getComplementId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.setComplementId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _complementId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _width
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_width", "width",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasWidth())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getWidth());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteWidth();
+ return;
+ }
+ target.setWidth(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _width
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _height
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_height", "height",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasHeight())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getHeight());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteHeight();
+ return;
+ }
+ target.setHeight(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _height
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _xpos
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_xpos", "xpos",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasXpos())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getXpos());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteXpos();
+ return;
+ }
+ target.setXpos(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _xpos
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _ypos
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_ypos", "ypos",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ if (!target.hasYpos())
+ {
+ return null;
+ }
+ return new java.lang.Integer(target.getYpos());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteYpos();
+ return;
+ }
+ target.setYpos(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _ypos
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+
+ // -- _annotationColours
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.AnnotationColours.class,
+ "_annotationColours", "AnnotationColours",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getAnnotationColours();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.setAnnotationColours((jalview.schemabinding.version2.AnnotationColours) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.AnnotationColours();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _annotationColours
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ // -- _hiddenColumnsList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.HiddenColumns.class,
+ "_hiddenColumnsList", "hiddenColumns",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getHiddenColumns();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.addHiddenColumns((jalview.schemabinding.version2.HiddenColumns) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.removeAllHiddenColumns();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.HiddenColumns();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _hiddenColumnsList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ // -- _calcIdParamList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.CalcIdParam.class,
+ "_calcIdParamList", "calcIdParam",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ Viewport target = (Viewport) object;
+ return target.getCalcIdParam();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.addCalcIdParam((jalview.schemabinding.version2.CalcIdParam) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ Viewport target = (Viewport) object;
+ target.removeAllCalcIdParam();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.CalcIdParam();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _calcIdParamList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.Viewport.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java b/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java
index 005a71f..beb5b50 100644
--- a/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java
+++ b/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -24,8 +7,8 @@
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.WebServiceParameterSet;
@@ -35,337 +18,379 @@ import jalview.schemabinding.version2.WebServiceParameterSet;
*
* @version $Revision$ $Date$
*/
-public class WebServiceParameterSetDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public WebServiceParameterSetDescriptor() {
- super();
- _nsURI = "www.jalview.org/xml/wsparamset";
- _xmlName = "WebServiceParameterSet";
- _elementDefinition = false;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _name
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- return target.getName();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- target.setName( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _name
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _version
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "Version", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- return target.getVersion();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- target.setVersion( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _version
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _description
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- return target.getDescription();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- target.setDescription( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _description
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
- }
- desc.setValidator(fieldValidator);
- //-- _serviceURLList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_serviceURLList", "serviceURL", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- return target.getServiceURL();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- target.addServiceURL( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- target.removeAllServiceURL();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new java.lang.String();
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _serviceURLList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- }
- desc.setValidator(fieldValidator);
- //-- _parameters
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_parameters", "parameters", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- return target.getParameters();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- WebServiceParameterSet target = (WebServiceParameterSet) object;
- target.setParameters( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _parameters
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+public class WebServiceParameterSetDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public WebServiceParameterSetDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org/xml/wsparamset";
+ _xmlName = "WebServiceParameterSet";
+ _elementDefinition = false;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _name
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_name", "name",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ return target.getName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ target.setName((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _name
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+ // -- _version
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_version", "Version",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ return target.getVersion();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ target.setVersion((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
return null;
- }
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
+ // -- validation code for: _version
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _description
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_description", "description",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ return target.getDescription();
+ }
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.WebServiceParameterSet.class;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ target.setDescription((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
+ // -- validation code for: _description
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ // -- _serviceURLList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_serviceURLList", "serviceURL",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ return target.getServiceURL();
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ target.addServiceURL((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ target.removeAllServiceURL();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new java.lang.String();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _serviceURLList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _parameters
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_parameters", "parameters",
+ org.exolab.castor.xml.NodeType.Element);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ return target.getParameters();
+ }
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ WebServiceParameterSet target = (WebServiceParameterSet) object;
+ target.setParameters((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _parameters
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.WebServiceParameterSet.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java
index e265598..ed8077f 100644
--- a/src/jalview/schemes/AnnotationColourGradient.java
+++ b/src/jalview/schemes/AnnotationColourGradient.java
@@ -1,27 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.GraphLine;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.awt.Color;
+import java.util.IdentityHashMap;
+import java.util.Map;
-public class AnnotationColourGradient extends ResidueColourScheme
+public class AnnotationColourGradient extends FollowerColourScheme
{
public static final int NO_THRESHOLD = -1;
@@ -37,11 +48,41 @@ public class AnnotationColourGradient extends ResidueColourScheme
GraphLine annotationThreshold;
- float r1, g1, b1, rr, gg, bb, dr, dg, db;
+ float r1, g1, b1, rr, gg, bb;
- ColourSchemeI colourScheme;
+ private boolean predefinedColours = false;
- public boolean predefinedColours = false;
+ private boolean seqAssociated = false;
+
+ /**
+ * false if the scheme was constructed without a minColour and maxColour used
+ * to decide if existing colours should be taken from annotation elements when
+ * they exist
+ */
+ private boolean noGradient = false;
+
+ IdentityHashMap<SequenceI, AlignmentAnnotation> seqannot = null;
+
+ @Override
+ public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ {
+ AnnotationColourGradient acg = new AnnotationColourGradient(annotation,
+ colourScheme, aboveAnnotationThreshold);
+ acg.thresholdIsMinMax = thresholdIsMinMax;
+ acg.annotationThreshold = (annotationThreshold == null) ? null
+ : new GraphLine(annotationThreshold);
+ acg.r1 = r1;
+ acg.g1 = g1;
+ acg.b1 = b1;
+ acg.rr = rr;
+ acg.gg = gg;
+ acg.bb = bb;
+ acg.predefinedColours = predefinedColours;
+ acg.seqAssociated = seqAssociated;
+ acg.noGradient = noGradient;
+ return acg;
+ }
/**
* Creates a new AnnotationColourGradient object.
@@ -66,6 +107,16 @@ public class AnnotationColourGradient extends ResidueColourScheme
{
annotationThreshold = annotation.threshold;
}
+ // clear values so we don't get weird black bands...
+ r1 = 254;
+ g1 = 254;
+ b1 = 254;
+ rr = 0;
+ gg = 0;
+ bb = 0;
+
+ noGradient = true;
+ checkLimits();
}
/**
@@ -90,8 +141,75 @@ public class AnnotationColourGradient extends ResidueColourScheme
rr = maxColour.getRed() - r1;
gg = maxColour.getGreen() - g1;
bb = maxColour.getBlue() - b1;
+
+ noGradient = false;
+ checkLimits();
+ }
+
+ private void checkLimits()
+ {
+ aamax = annotation.graphMax;
+ aamin = annotation.graphMin;
+ if (annotation.isRNA())
+ {
+ // reset colour palette
+ ColourSchemeProperty.resetRnaHelicesShading();
+ ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax);
+ }
+ }
+
+ @Override
+ public void alignmentChanged(AnnotatedCollectionI alignment,
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
+ {
+ super.alignmentChanged(alignment, hiddenReps);
+
+ if (seqAssociated && annotation.getCalcId() != null)
+ {
+ if (seqannot != null)
+ {
+ seqannot.clear();
+ }
+ else
+ {
+ seqannot = new IdentityHashMap<SequenceI, AlignmentAnnotation>();
+ }
+ // resolve the context containing all the annotation for the sequence
+ AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment
+ : alignment.getContext();
+ boolean f = true, rna = false;
+ for (AlignmentAnnotation alan : alcontext.findAnnotation(annotation
+ .getCalcId()))
+ {
+ if (alan.sequenceRef != null
+ && (alan.label != null && annotation != null && alan.label
+ .equals(annotation.label)))
+ {
+ if (!rna && alan.isRNA())
+ {
+ rna = true;
+ }
+ seqannot.put(alan.sequenceRef, alan);
+ if (f || alan.graphMax > aamax)
+ {
+ aamax = alan.graphMax;
+ }
+ if (f || alan.graphMin < aamin)
+ {
+ aamin = alan.graphMin;
+ }
+ f = false;
+ }
+ }
+ if (rna)
+ {
+ ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax);
+ }
+ }
}
+ float aamin = 0f, aamax = 0f;
+
public String getAnnotation()
{
return annotation.label;
@@ -114,11 +232,6 @@ public class AnnotationColourGradient extends ResidueColourScheme
}
}
- public ColourSchemeI getBaseColour()
- {
- return colourScheme;
- }
-
public Color getMinColour()
{
return new Color((int) r1, (int) g1, (int) b1);
@@ -152,75 +265,158 @@ public class AnnotationColourGradient extends ResidueColourScheme
*
* @return DOCUMENT ME!
*/
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour = Color.white;
-
+ AlignmentAnnotation annotation = (seqAssociated && seqannot != null ? seqannot
+ .get(seq) : this.annotation);
+ if (annotation == null)
+ {
+ return currentColour;
+ }
if ((threshold == 0) || aboveThreshold(c, j))
{
- if (j < annotation.annotations.length
+ if (annotation.annotations != null
+ && j < annotation.annotations.length
&& annotation.annotations[j] != null
&& !jalview.util.Comparison.isGap(c))
{
-
- if (predefinedColours)
- {
- if (annotation.annotations[j].colour != null)
- return annotation.annotations[j].colour;
- else
- return currentColour;
- }
+ Annotation aj = annotation.annotations[j];
+ // 'use original colours' => colourScheme != null
+ // -> look up colour to be used
+ // predefined colours => preconfigured shading
+ // -> only use original colours reference if thresholding enabled &
+ // minmax exists
+ // annotation.hasIcons => null or black colours replaced with glyph
+ // colours
+ // -> reuse original colours if present
+ // -> if thresholding enabled then return colour on non-whitespace glyph
if (aboveAnnotationThreshold == NO_THRESHOLD
- || (annotationThreshold != null
- && aboveAnnotationThreshold == ABOVE_THRESHOLD && annotation.annotations[j].value >= annotationThreshold.value)
- || (annotationThreshold != null
- && aboveAnnotationThreshold == BELOW_THRESHOLD && annotation.annotations[j].value <= annotationThreshold.value))
+ || (annotationThreshold != null && (aboveAnnotationThreshold == ABOVE_THRESHOLD ? aj.value >= annotationThreshold.value
+ : aj.value <= annotationThreshold.value)))
{
-
- float range = 1f;
- if (thresholdIsMinMax
- && annotation.threshold != null
- && aboveAnnotationThreshold == ABOVE_THRESHOLD
- && annotation.annotations[j].value > annotation.threshold.value)
+ if (predefinedColours && aj.colour != null
+ && !aj.colour.equals(Color.black))
{
- range = (annotation.annotations[j].value - annotation.threshold.value)
- / (annotation.graphMax - annotation.threshold.value);
+ currentColour = aj.colour;
}
- else if (thresholdIsMinMax && annotation.threshold != null
- && aboveAnnotationThreshold == BELOW_THRESHOLD
- && annotation.annotations[j].value > annotation.graphMin)
+ else if (annotation.hasIcons
+ && annotation.graph == AlignmentAnnotation.NO_GRAPH)
{
- range = (annotation.annotations[j].value - annotation.graphMin)
- / (annotation.threshold.value - annotation.graphMin);
+ if (aj.secondaryStructure > ' ' && aj.secondaryStructure != '.'
+ && aj.secondaryStructure != '-')
+ {
+ if (colourScheme != null)
+ {
+ currentColour = colourScheme.findColour(c, j, seq);
+ }
+ else
+ {
+ if (annotation.isRNA())
+ {
+ currentColour = ColourSchemeProperty.rnaHelices[(int) aj.value];
+ }
+ else
+ {
+ currentColour = annotation.annotations[j].secondaryStructure == 'H' ? jalview.renderer.AnnotationRenderer.HELIX_COLOUR
+ : annotation.annotations[j].secondaryStructure == 'E' ? jalview.renderer.AnnotationRenderer.SHEET_COLOUR
+ : jalview.renderer.AnnotationRenderer.STEM_COLOUR;
+ }
+ }
+ }
+ else
+ {
+ //
+ return Color.white;
+ }
}
- else
+ else if (noGradient)
{
- range = (annotation.annotations[j].value - annotation.graphMin)
- / (annotation.graphMax - annotation.graphMin);
+ if (colourScheme != null)
+ {
+ currentColour = colourScheme.findColour(c, j, seq);
+ }
+ else
+ {
+ if (aj.colour != null)
+ {
+ currentColour = aj.colour;
+ }
+ }
}
-
- if (colourScheme != null)
+ else
{
- currentColour = colourScheme.findColour(c, j);
- }
- else if (range != 0)
- {
- dr = rr * range + r1;
- dg = gg * range + g1;
- db = bb * range + b1;
-
- currentColour = new Color((int) dr, (int) dg, (int) db);
+ currentColour = shadeCalculation(annotation, j);
}
}
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
}
}
+ return currentColour;
+ }
- if (conservationColouring)
+ private Color shadeCalculation(AlignmentAnnotation annotation, int j)
+ {
+
+ // calculate a shade
+ float range = 1f;
+ if (thresholdIsMinMax
+ && annotation.threshold != null
+ && aboveAnnotationThreshold == ABOVE_THRESHOLD
+ && annotation.annotations[j].value >= annotation.threshold.value)
+ {
+ range = (annotation.annotations[j].value - annotation.threshold.value)
+ / (annotation.graphMax - annotation.threshold.value);
+ }
+ else if (thresholdIsMinMax && annotation.threshold != null
+ && aboveAnnotationThreshold == BELOW_THRESHOLD
+ && annotation.annotations[j].value >= annotation.graphMin)
+ {
+ range = (annotation.annotations[j].value - annotation.graphMin)
+ / (annotation.threshold.value - annotation.graphMin);
+ }
+ else
{
- currentColour = applyConservation(currentColour, j);
+ if (annotation.graphMax != annotation.graphMin)
+ {
+ range = (annotation.annotations[j].value - annotation.graphMin)
+ / (annotation.graphMax - annotation.graphMin);
+ }
+ else
+ {
+ range = 0f;
+ }
}
- return currentColour;
+ int dr = (int) (rr * range + r1), dg = (int) (gg * range + g1), db = (int) (bb
+ * range + b1);
+
+ return new Color(dr, dg, db);
+
+ }
+
+ public boolean isPredefinedColours()
+ {
+ return predefinedColours;
+ }
+
+ public void setPredefinedColours(boolean predefinedColours)
+ {
+ this.predefinedColours = predefinedColours;
+ }
+
+ public boolean isSeqAssociated()
+ {
+ return seqAssociated;
+ }
+
+ public void setSeqAssociated(boolean sassoc)
+ {
+ seqAssociated = sassoc;
}
}
diff --git a/src/jalview/schemes/Blosum62ColourScheme.java b/src/jalview/schemes/Blosum62ColourScheme.java
index 3236b55..9e226de 100644
--- a/src/jalview/schemes/Blosum62ColourScheme.java
+++ b/src/jalview/schemes/Blosum62ColourScheme.java
@@ -1,25 +1,32 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.analysis.AAFrequency;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
-import jalview.analysis.*;
+import java.awt.Color;
+import java.util.Map;
public class Blosum62ColourScheme extends ResidueColourScheme
{
@@ -28,7 +35,8 @@ public class Blosum62ColourScheme extends ResidueColourScheme
super();
}
- public Color findColour(char res, int j)
+ @Override
+ public Color findColour(char res, int j, SequenceI seq)
{
if ('a' <= res && res <= 'z')
{
@@ -50,6 +58,7 @@ public class Blosum62ColourScheme extends ResidueColourScheme
if (max.indexOf(res) > -1)
{
+ // TODO use a constant here?
currentColour = new Color(154, 154, 255);
}
else
@@ -65,6 +74,7 @@ public class Blosum62ColourScheme extends ResidueColourScheme
if (c > 0)
{
+ // TODO use a constant here?
currentColour = new Color(204, 204, 255);
}
else
@@ -85,4 +95,12 @@ public class Blosum62ColourScheme extends ResidueColourScheme
return currentColour;
}
+
+ @Override
+ public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ {
+ ColourSchemeI newcs = super.applyTo(sg, hiddenRepSequences);
+ return newcs;
+ }
}
diff --git a/src/jalview/schemes/BuriedColourScheme.java b/src/jalview/schemes/BuriedColourScheme.java
index af85e08..f2859d3 100644
--- a/src/jalview/schemes/BuriedColourScheme.java
+++ b/src/jalview/schemes/BuriedColourScheme.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import java.awt.Color;
/**
* DOCUMENT ME!
@@ -32,8 +35,8 @@ public class BuriedColourScheme extends ScoreColourScheme
*/
public BuriedColourScheme()
{
- super(ResidueProperties.buried, ResidueProperties.buriedmin,
- ResidueProperties.buriedmax);
+ super(ResidueProperties.aaIndex, ResidueProperties.buried,
+ ResidueProperties.buriedmin, ResidueProperties.buriedmax);
}
/**
diff --git a/src/jalview/schemes/ClustalxColourScheme.java b/src/jalview/schemes/ClustalxColourScheme.java
index 309bdc2..2ba06dc 100644
--- a/src/jalview/schemes/ClustalxColourScheme.java
+++ b/src/jalview/schemes/ClustalxColourScheme.java
@@ -1,67 +1,84 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.util.*;
-
-import java.awt.*;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.awt.Color;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
-public class ClustalxColourScheme extends ResidueColourScheme // implements
-// IParameterizable
+public class ClustalxColourScheme extends ResidueColourScheme
{
- public static Hashtable colhash = new Hashtable();
+ private static final int EIGHTY_FIVE = 85;
+
+ private static final int FIFTY = 50;
+
+ private static final int EIGHTY = 80;
- Hashtable[] cons;
+ private static final int SIXTY = 60;
- int[][] cons2;
+ /*
+ * Map from conventional colour names to Clustal version of the same
+ */
+ private static Map<Color, Color> colhash = new HashMap<Color, Color>();
- ConsensusColour[] colours;
+ private int[][] cons2;
- ConsensusColour[] ResidueColour;
+ private ConsensusColour[] colours;
- int size;
+ private ConsensusColour[] residueColour;
- Consensus[] conses = new Consensus[32];
+ private int size;
- Vector colourTable = new Vector();
+ private Consensus[] conses = new Consensus[32];
private boolean includeGaps = true;
+ static
{
- colhash.put("RED", new Color((float) 0.9, (float) 0.2, (float) 0.1));
- colhash.put("BLUE", new Color((float) 0.5, (float) 0.7, (float) 0.9));
- colhash.put("GREEN", new Color((float) 0.1, (float) 0.8, (float) 0.1));
- colhash.put("ORANGE", new Color((float) 0.9, (float) 0.6, (float) 0.3));
- colhash.put("CYAN", new Color((float) 0.1, (float) 0.7, (float) 0.7));
- colhash.put("PINK", new Color((float) 0.9, (float) 0.5, (float) 0.5));
- colhash.put("MAGENTA", new Color((float) 0.8, (float) 0.3, (float) 0.8));
- colhash.put("YELLOW", new Color((float) 0.8, (float) 0.8, (float) 0.0));
+ colhash.put(Color.RED, new Color(0.9f, 0.2f, 0.1f));
+ colhash.put(Color.BLUE, new Color(0.5f, 0.7f, 0.9f));
+ colhash.put(Color.GREEN, new Color(0.1f, 0.8f, 0.1f));
+ colhash.put(Color.ORANGE, new Color(0.9f, 0.6f, 0.3f));
+ colhash.put(Color.CYAN, new Color(0.1f, 0.7f, 0.7f));
+ colhash.put(Color.PINK, new Color(0.9f, 0.5f, 0.5f));
+ colhash.put(Color.MAGENTA, new Color(0.8f, 0.3f, 0.8f));
+ colhash.put(Color.YELLOW, new Color(0.8f, 0.8f, 0.0f));
}
- public ClustalxColourScheme(Vector seqs, int maxWidth)
+ public ClustalxColourScheme(AnnotatedCollectionI alignment,
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
{
- resetClustalX(seqs, maxWidth);
+ alignmentChanged(alignment, hiddenReps);
}
- public void resetClustalX(Vector seqs, int maxWidth)
+ public void alignmentChanged(AnnotatedCollectionI alignment,
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
{
+ int maxWidth = alignment.getWidth();
+ List<SequenceI> seqs = alignment.getSequences(hiddenReps);
cons2 = new int[maxWidth][24];
includeGaps = isIncludeGaps(); // does nothing - TODO replace with call to
// get the current setting of the
@@ -82,9 +99,9 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
int j = 0;
char[] seq;
- while (j < seqs.size())
+ for (SequenceI sq : seqs)
{
- seq = ((SequenceI) seqs.elementAt(j)).getSequence();
+ seq = sq.getSequence();
int end_j = seq.length - 1;
@@ -111,36 +128,36 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
public void makeColours()
{
- conses[0] = new Consensus("WLVIMAFCYHP", 60);
- conses[1] = new Consensus("WLVIMAFCYHP", 80);
- conses[2] = new Consensus("ED", 50);
- conses[3] = new Consensus("KR", 60);
- conses[4] = new Consensus("G", 50);
- conses[5] = new Consensus("N", 50);
- conses[6] = new Consensus("QE", 50);
- conses[7] = new Consensus("P", 50);
- conses[8] = new Consensus("TS", 50);
-
- conses[26] = new Consensus("A", 85);
- conses[27] = new Consensus("C", 85);
- conses[10] = new Consensus("E", 85);
- conses[11] = new Consensus("F", 85);
- conses[12] = new Consensus("G", 85);
- conses[13] = new Consensus("H", 85);
- conses[14] = new Consensus("I", 85);
- conses[15] = new Consensus("L", 85);
- conses[16] = new Consensus("M", 85);
- conses[17] = new Consensus("N", 85);
- conses[18] = new Consensus("P", 85);
- conses[19] = new Consensus("Q", 85);
- conses[20] = new Consensus("R", 85);
- conses[21] = new Consensus("S", 85);
- conses[22] = new Consensus("T", 85);
- conses[23] = new Consensus("V", 85);
- conses[24] = new Consensus("W", 85);
- conses[25] = new Consensus("Y", 85);
- conses[28] = new Consensus("K", 85);
- conses[29] = new Consensus("D", 85);
+ conses[0] = new Consensus("WLVIMAFCYHP", SIXTY);
+ conses[1] = new Consensus("WLVIMAFCYHP", EIGHTY);
+ conses[2] = new Consensus("ED", FIFTY);
+ conses[3] = new Consensus("KR", SIXTY);
+ conses[4] = new Consensus("G", FIFTY);
+ conses[5] = new Consensus("N", FIFTY);
+ conses[6] = new Consensus("QE", FIFTY);
+ conses[7] = new Consensus("P", FIFTY);
+ conses[8] = new Consensus("TS", FIFTY);
+
+ conses[26] = new Consensus("A", EIGHTY_FIVE);
+ conses[27] = new Consensus("C", EIGHTY_FIVE);
+ conses[10] = new Consensus("E", EIGHTY_FIVE);
+ conses[11] = new Consensus("F", EIGHTY_FIVE);
+ conses[12] = new Consensus("G", EIGHTY_FIVE);
+ conses[13] = new Consensus("H", EIGHTY_FIVE);
+ conses[14] = new Consensus("I", EIGHTY_FIVE);
+ conses[15] = new Consensus("L", EIGHTY_FIVE);
+ conses[16] = new Consensus("M", EIGHTY_FIVE);
+ conses[17] = new Consensus("N", EIGHTY_FIVE);
+ conses[18] = new Consensus("P", EIGHTY_FIVE);
+ conses[19] = new Consensus("Q", EIGHTY_FIVE);
+ conses[20] = new Consensus("R", EIGHTY_FIVE);
+ conses[21] = new Consensus("S", EIGHTY_FIVE);
+ conses[22] = new Consensus("T", EIGHTY_FIVE);
+ conses[23] = new Consensus("V", EIGHTY_FIVE);
+ conses[24] = new Consensus("W", EIGHTY_FIVE);
+ conses[25] = new Consensus("Y", EIGHTY_FIVE);
+ conses[28] = new Consensus("K", EIGHTY_FIVE);
+ conses[29] = new Consensus("D", EIGHTY_FIVE);
conses[30] = new Consensus("G", 0);
conses[31] = new Consensus("P", 0);
@@ -150,15 +167,15 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
Consensus[] tmp8 = new Consensus[1];
tmp8[0] = conses[30]; // G
- colours[7] = new ConsensusColour((Color) colhash.get("ORANGE"), tmp8);
+ colours[7] = new ConsensusColour(colhash.get(Color.ORANGE), tmp8);
Consensus[] tmp9 = new Consensus[1];
tmp9[0] = conses[31]; // P
- colours[8] = new ConsensusColour((Color) colhash.get("YELLOW"), tmp9);
+ colours[8] = new ConsensusColour(colhash.get(Color.YELLOW), tmp9);
Consensus[] tmp10 = new Consensus[1];
tmp10[0] = conses[27]; // C
- colours[9] = new ConsensusColour((Color) colhash.get("PINK"), tmp8);
+ colours[9] = new ConsensusColour(colhash.get(Color.PINK), tmp8);
Consensus[] tmp1 = new Consensus[14];
tmp1[0] = conses[0]; // %
@@ -175,9 +192,9 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
tmp1[11] = conses[25]; // Y
tmp1[12] = conses[18]; // P
tmp1[13] = conses[19]; // p
- colours[0] = new ConsensusColour((Color) colhash.get("BLUE"), tmp1);
+ colours[0] = new ConsensusColour(colhash.get(Color.BLUE), tmp1);
- colours[10] = new ConsensusColour((Color) colhash.get("CYAN"), tmp1);
+ colours[10] = new ConsensusColour(colhash.get(Color.CYAN), tmp1);
Consensus[] tmp2 = new Consensus[5];
tmp2[0] = conses[8]; // t
@@ -185,14 +202,14 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
tmp2[2] = conses[22]; // T
tmp2[3] = conses[0]; // %
tmp2[4] = conses[1]; // #
- colours[1] = new ConsensusColour((Color) colhash.get("GREEN"), tmp2);
+ colours[1] = new ConsensusColour(colhash.get(Color.GREEN), tmp2);
Consensus[] tmp3 = new Consensus[3];
tmp3[0] = conses[17]; // N
tmp3[1] = conses[29]; // D
tmp3[2] = conses[5]; // n
- colours[2] = new ConsensusColour((Color) colhash.get("GREEN"), tmp3);
+ colours[2] = new ConsensusColour(colhash.get(Color.GREEN), tmp3);
Consensus[] tmp4 = new Consensus[6];
tmp4[0] = conses[6]; // q = QE
@@ -201,14 +218,14 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
tmp4[3] = conses[3]; // +
tmp4[4] = conses[28]; // K
tmp4[5] = conses[20]; // R
- colours[3] = new ConsensusColour((Color) colhash.get("GREEN"), tmp4);
+ colours[3] = new ConsensusColour(colhash.get(Color.GREEN), tmp4);
Consensus[] tmp5 = new Consensus[4];
tmp5[0] = conses[3]; // +
tmp5[1] = conses[28]; // K
tmp5[2] = conses[20]; // R
tmp5[3] = conses[19]; // Q
- colours[4] = new ConsensusColour((Color) colhash.get("RED"), tmp5);
+ colours[4] = new ConsensusColour(colhash.get(Color.RED), tmp5);
Consensus[] tmp6 = new Consensus[6];
tmp6[0] = conses[3]; // -
@@ -217,7 +234,7 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
tmp6[3] = conses[6]; // QE
tmp6[4] = conses[19]; // Q
tmp6[5] = conses[2]; // DE
- colours[5] = new ConsensusColour((Color) colhash.get("MAGENTA"), tmp6);
+ colours[5] = new ConsensusColour(colhash.get(Color.MAGENTA), tmp6);
Consensus[] tmp7 = new Consensus[5];
tmp7[0] = conses[3]; // -
@@ -225,38 +242,40 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
tmp7[2] = conses[10]; // E
tmp7[3] = conses[17]; // N
tmp7[4] = conses[2]; // DE
- colours[6] = new ConsensusColour((Color) colhash.get("MAGENTA"), tmp7);
+ colours[6] = new ConsensusColour(colhash.get(Color.MAGENTA), tmp7);
// Now attach the ConsensusColours to the residue letters
- ResidueColour = new ConsensusColour[20];
- ResidueColour[0] = colours[0]; // A
- ResidueColour[1] = colours[4]; // R
- ResidueColour[2] = colours[2]; // N
- ResidueColour[3] = colours[6]; // D
- ResidueColour[4] = colours[0]; // C
- ResidueColour[5] = colours[3]; // Q
- ResidueColour[6] = colours[5]; // E
- ResidueColour[7] = colours[7]; // G
- ResidueColour[8] = colours[10]; // H
- ResidueColour[9] = colours[0]; // I
- ResidueColour[10] = colours[0]; // L
- ResidueColour[11] = colours[4]; // K
- ResidueColour[12] = colours[0]; // M
- ResidueColour[13] = colours[0]; // F
- ResidueColour[14] = colours[8]; // P
- ResidueColour[15] = colours[1]; // S
- ResidueColour[16] = colours[1]; // T
- ResidueColour[17] = colours[0]; // W
- ResidueColour[18] = colours[10]; // Y
- ResidueColour[19] = colours[0]; // V
+ residueColour = new ConsensusColour[20];
+ residueColour[0] = colours[0]; // A
+ residueColour[1] = colours[4]; // R
+ residueColour[2] = colours[2]; // N
+ residueColour[3] = colours[6]; // D
+ residueColour[4] = colours[0]; // C
+ residueColour[5] = colours[3]; // Q
+ residueColour[6] = colours[5]; // E
+ residueColour[7] = colours[7]; // G
+ residueColour[8] = colours[10]; // H
+ residueColour[9] = colours[0]; // I
+ residueColour[10] = colours[0]; // L
+ residueColour[11] = colours[4]; // K
+ residueColour[12] = colours[0]; // M
+ residueColour[13] = colours[0]; // F
+ residueColour[14] = colours[8]; // P
+ residueColour[15] = colours[1]; // S
+ residueColour[16] = colours[1]; // T
+ residueColour[17] = colours[0]; // W
+ residueColour[18] = colours[10]; // Y
+ residueColour[19] = colours[0]; // V
}
+ @Override
public Color findColour(char c)
{
return Color.pink;
}
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour;
@@ -275,12 +294,12 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
return currentColour;
}
- for (int k = 0; k < ResidueColour[i].conses.length; k++)
+ for (int k = 0; k < residueColour[i].conses.length; k++)
{
- if (ResidueColour[i].conses[k].isConserved(cons2, j, size,
+ if (residueColour[i].conses[k].isConserved(cons2, j, size,
includeGaps))
{
- currentColour = ResidueColour[i].c;
+ currentColour = residueColour[i].c;
}
}
@@ -288,7 +307,7 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
{
if (conses[27].isConserved(cons2, j, size, includeGaps))
{
- currentColour = (Color) colhash.get("PINK");
+ currentColour = colhash.get(Color.PINK);
}
}
@@ -316,6 +335,16 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
{
this.includeGaps = includeGaps;
}
+
+ @Override
+ public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ {
+ ClustalxColourScheme css = new ClustalxColourScheme(sg,
+ hiddenRepSequences);
+ css.includeGaps = includeGaps;
+ return css;
+ }
}
class ConsensusColour
diff --git a/src/jalview/schemes/ColourSchemeI.java b/src/jalview/schemes/ColourSchemeI.java
index fdda463..0c393cd 100644
--- a/src/jalview/schemes/ColourSchemeI.java
+++ b/src/jalview/schemes/ColourSchemeI.java
@@ -1,42 +1,128 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
+import java.util.Map;
public interface ColourSchemeI
{
+ /**
+ *
+ * @param c
+ * @return the colour for the given character
+ */
public Color findColour(char c);
- public Color findColour(char c, int j);
+ /**
+ *
+ * @param c
+ * - sequence symbol or gap
+ * @param j
+ * - position in seq
+ * @param seq
+ * - sequence being coloured
+ * @return context dependent colour for the given symbol at the position in
+ * the given sequence
+ */
+ public Color findColour(char c, int j, SequenceI seq);
+ /**
+ * assign the given consensus profile for the colourscheme
+ */
public void setConsensus(java.util.Hashtable[] h);
+ /**
+ * assign the given conservation to the colourscheme
+ *
+ * @param c
+ */
public void setConservation(jalview.analysis.Conservation c);
+ /**
+ * enable or disable conservation shading for this colourscheme
+ *
+ * @param conservationApplied
+ */
+ public void setConservationApplied(boolean conservationApplied);
+
+ /**
+ *
+ * @return true if conservation shading is enabled for this colourscheme
+ */
public boolean conservationApplied();
+ /**
+ * set scale factor for bleaching of colour in unconserved regions
+ *
+ * @param i
+ */
public void setConservationInc(int i);
+ /**
+ *
+ * @return scale factor for bleaching colour in unconserved regions
+ */
public int getConservationInc();
+ /**
+ *
+ * @return percentage identity threshold for applying colourscheme
+ */
public int getThreshold();
+ /**
+ * set percentage identity threshold and type of %age identity calculation for
+ * shading
+ *
+ * @param ct
+ * 0..100 percentage identity for applying this colourscheme
+ * @param ignoreGaps
+ * when true, calculate PID without including gapped positions
+ */
public void setThreshold(int ct, boolean ignoreGaps);
+ /**
+ * recalculate dependent data using the given sequence collection, taking
+ * account of hidden rows
+ *
+ * @param alignment
+ * @param hiddenReps
+ */
+ public void alignmentChanged(AnnotatedCollectionI alignment,
+ Map<SequenceI, SequenceCollectionI> hiddenReps);
+
+ /**
+ * create a new instance of the colourscheme configured to colour the given
+ * connection
+ *
+ * @param sg
+ * @param hiddenRepSequences
+ * @return copy of current scheme with any inherited settings transfered
+ */
+ public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
+
}
diff --git a/src/jalview/schemes/ColourSchemeProperty.java b/src/jalview/schemes/ColourSchemeProperty.java
index 0f758e0..500047b 100644
--- a/src/jalview/schemes/ColourSchemeProperty.java
+++ b/src/jalview/schemes/ColourSchemeProperty.java
@@ -1,26 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.datamodel.AnnotatedCollectionI;
+
+import java.awt.Color;
/**
- * ColourSchemeProperty Binds names to hardwired colourschemes and tries to deal
+ * ColourSchemeProperty binds names to hardwired colourschemes and tries to deal
* intelligently with mapping unknown names to user defined colourschemes (that
* exist or can be created from the string representation of the colourscheme
* name - either a hex RGB triplet or a named colour under java.awt.color ). The
@@ -82,12 +87,18 @@ public class ColourSchemeProperty
public static final int COVARIATION = 14;
+ public static final int TCOFFEE = 15;
+
+ public static final int RNAHELIX = 16;
+
+ public static final int RNAINTERACTION = 17;
+
/**
* index of first colourscheme (includes 'None')
*/
public static final int FIRST_COLOUR = NONE;
- public static final int LAST_COLOUR = NUCLEOTIDE;
+ public static final int LAST_COLOUR = RNAINTERACTION;
/**
* DOCUMENT ME!
@@ -145,6 +156,11 @@ public class ColourSchemeProperty
{
ret = NUCLEOTIDE;
}
+ else if (name.equalsIgnoreCase("T-Coffee Scores"))
+ {
+ ret = TCOFFEE;
+ }
+
else if (name.equalsIgnoreCase("User Defined"))
{
ret = USER_DEFINED;
@@ -153,6 +169,22 @@ public class ColourSchemeProperty
{
ret = NONE;
}
+ else if (name.equalsIgnoreCase("Purine/Pyrimidine"))
+ {
+ ret = PURINEPYRIMIDINE;
+ }
+ else if (name.equalsIgnoreCase("RNA Interaction type"))
+ {
+ ret = RNAINTERACTION;
+ }
+ else if (name.equalsIgnoreCase("RNA Helices"))
+ {
+ ret = RNAHELIX;
+ }
+ // else if (name.equalsIgnoreCase("Covariation"))
+ // {
+ // ret = COVARIATION;
+ // }
return ret;
}
@@ -214,6 +246,21 @@ public class ColourSchemeProperty
{
index = NUCLEOTIDE;
}
+ else if (cs instanceof PurinePyrimidineColourScheme)
+ {
+ index = PURINEPYRIMIDINE;
+ }
+ else if (cs instanceof TCoffeeColourScheme)
+ {
+ index = TCOFFEE;
+ }
+ else if (cs instanceof RNAHelicesColour)
+ {
+ index = RNAHELIX;
+ }
+ /*
+ * else if (cs instanceof CovariationColourScheme) { index = COVARIATION; }
+ */
else if (cs instanceof UserColourScheme)
{
if ((((UserColourScheme) cs).getName() != null)
@@ -296,6 +343,29 @@ public class ColourSchemeProperty
break;
+ case PURINEPYRIMIDINE:
+ ret = "Purine/Pyrimidine";
+
+ break;
+
+ case TCOFFEE:
+ ret = "T-Coffee Scores";
+
+ break;
+
+ case RNAINTERACTION:
+ ret = "RNA Interaction type";
+
+ break;
+ case RNAHELIX:
+ ret = "RNA Helices";
+
+ break;
+ /*
+ * case COVARIATION: ret = "Covariation";
+ *
+ * break;
+ */
case USER_DEFINED:
ret = "User Defined";
@@ -311,22 +381,6 @@ public class ColourSchemeProperty
}
/**
- * DOCUMENT ME!
- *
- * @param al
- * DOCUMENT ME!
- * @param name
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al,
- String name)
- {
- return getColour(al.getSequences(), al.getWidth(), name);
- }
-
- /**
* retrieve or create colourscheme associated with name
*
* @param seqs
@@ -338,7 +392,7 @@ public class ColourSchemeProperty
* string to parse as colour for new coloursheme
* @return Valid Colourscheme
*/
- public static ColourSchemeI getColour(java.util.Vector seqs, int width,
+ public static ColourSchemeI getColour(AnnotatedCollectionI alignment,
String name)
{
int colindex = getColourIndexFromName(name);
@@ -371,30 +425,34 @@ public class ColourSchemeProperty
}
}
}
- return getColour(seqs, width, getColourIndexFromName(name));
+ return getColour(alignment, getColourIndexFromName(name));
}
/**
- * DOCUMENT ME!
+ * Construct an instance of ColourSchemeI corresponding to the given
+ * colourscheme index
*
* @param seqs
- * DOCUMENT ME!
+ * sequences to be coloured by colourscheme
* @param width
- * DOCUMENT ME!
+ * geometry of alignment
* @param index
- * DOCUMENT ME!
+ * colourscheme number
*
- * @return DOCUMENT ME!
+ * @return null or an instance of the colourscheme configured to colour given
+ * sequence set
*/
- public static ColourSchemeI getColour(java.util.Vector seqs, int width,
- int index)
+ public static ColourSchemeI getColour(
+ jalview.datamodel.AnnotatedCollectionI coll, int index)
{
+ // TODO 3.0 2.8 refactor signature to take an alignmentI like container so
+ // colourschemes based on annotation can be initialised
ColourSchemeI cs = null;
switch (index)
{
case CLUSTAL:
- cs = new ClustalxColourScheme(seqs, width);
+ cs = new ClustalxColourScheme(coll, null);
break;
@@ -447,6 +505,23 @@ public class ColourSchemeProperty
break;
+ case PURINEPYRIMIDINE:
+ cs = new PurinePyrimidineColourScheme();
+
+ break;
+
+ case TCOFFEE:
+ cs = new TCoffeeColourScheme(coll);
+ break;
+
+ case RNAHELIX:
+ cs = new RNAHelicesColour(coll);
+ break;
+
+ // case COVARIATION:
+ // cs = new CovariationColourScheme(annotation);
+ // break;
+
case USER_DEFINED:
Color[] col = new Color[24];
for (int i = 0; i < 24; i++)
@@ -522,4 +597,41 @@ public class ColourSchemeProperty
return col;
}
+
+ public static Color rnaHelices[] = null;
+
+ public static void initRnaHelicesShading(int n)
+ {
+ int j = 0;
+ if (rnaHelices == null)
+ {
+ rnaHelices = new Color[n + 1];
+ }
+ else if (rnaHelices != null && rnaHelices.length <= n)
+ {
+ Color[] t = new Color[n + 1];
+ System.arraycopy(rnaHelices, 0, t, 0, rnaHelices.length);
+ j = rnaHelices.length;
+ rnaHelices = t;
+ }
+ else
+ {
+ return;
+ }
+ // Generate random colors and store
+ for (; j <= n; j++)
+ {
+ rnaHelices[j] = jalview.util.ColorUtils
+ .generateRandomColor(Color.white);
+ }
+ }
+
+ /**
+ * delete the existing cached RNA helces colours
+ */
+ public static void resetRnaHelicesShading()
+ {
+ rnaHelices = null;
+ }
+
}
diff --git a/src/jalview/schemes/Consensus.java b/src/jalview/schemes/Consensus.java
index 0c010d5..337672c 100644
--- a/src/jalview/schemes/Consensus.java
+++ b/src/jalview/schemes/Consensus.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
diff --git a/src/jalview/schemes/CovariationColourScheme.java b/src/jalview/schemes/CovariationColourScheme.java
new file mode 100644
index 0000000..c88393a
--- /dev/null
+++ b/src/jalview/schemes/CovariationColourScheme.java
@@ -0,0 +1,124 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.schemes;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+import java.awt.Color;
+import java.util.Hashtable;
+
+/**
+ * Became RNAHelicesColour.java. Placeholder for true covariation color scheme
+ *
+ * @author Lauren Michelle Lui
+ * @version 2.5
+ */
+public class CovariationColourScheme extends ResidueColourScheme
+{
+ public Hashtable helixcolorhash = new Hashtable();
+
+ public Hashtable positionsToHelix = new Hashtable();
+
+ int numHelix = 0;
+
+ public AlignmentAnnotation annotation;
+
+ /**
+ * Creates a new CovariationColourScheme object.
+ */
+ public CovariationColourScheme(AlignmentAnnotation annotation)
+ {
+ this.annotation = annotation;
+
+ for (int x = 0; x < this.annotation._rnasecstr.length; x++)
+ {
+ // System.out.println(this.annotation._rnasecstr[x] + " Begin" +
+ // this.annotation._rnasecstr[x].getBegin());
+ // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
+ // pairs.put(this.annotation._rnasecstr[x].getBegin(),
+ // this.annotation._rnasecstr[x].getEnd());
+
+ positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+ positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+
+ if (Integer.parseInt(this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix)
+ {
+ numHelix = Integer.parseInt(this.annotation._rnasecstr[x]
+ .getFeatureGroup());
+ }
+
+ }
+
+ for (int j = 0; j <= numHelix; j++)
+ {
+ helixcolorhash.put(Integer.toString(j),
+ jalview.util.ColorUtils.generateRandomColor(Color.white));
+ }
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c)
+ {
+ // System.out.println("called"); log.debug
+ // Generate a random pastel color
+
+ return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]];// jalview.util.ColorUtils.generateRandomColor(Color.white);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n
+ * DOCUMENT ME!
+ * @param j
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c, int j)
+ {
+ Color currentColour = Color.white;
+ String currentHelix = null;
+ // System.out.println(c + " " + j);
+ currentHelix = (String) positionsToHelix.get(j);
+ // System.out.println(positionsToHelix.get(j));
+
+ if (currentHelix != null)
+ {
+ currentColour = (Color) helixcolorhash.get(currentHelix);
+ }
+
+ // System.out.println(c + " " + j + " helix " + currentHelix + " " +
+ // currentColour);
+ return currentColour;
+ }
+
+}
diff --git a/src/jalview/schemes/FollowerColourScheme.java b/src/jalview/schemes/FollowerColourScheme.java
new file mode 100644
index 0000000..163bcff
--- /dev/null
+++ b/src/jalview/schemes/FollowerColourScheme.java
@@ -0,0 +1,70 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.schemes;
+
+import jalview.analysis.Conservation;
+
+import java.util.Hashtable;
+
+/**
+ * Colourscheme that takes its colours from some other colourscheme
+ *
+ * @author jimp
+ *
+ */
+public class FollowerColourScheme extends ResidueColourScheme
+{
+
+ protected ColourSchemeI colourScheme;
+
+ public ColourSchemeI getBaseColour()
+ {
+ return colourScheme;
+ }
+
+ @Override
+ public void setConsensus(Hashtable[] consensus)
+ {
+ if (colourScheme != null)
+ {
+ colourScheme.setConsensus(consensus);
+ }
+ }
+
+ @Override
+ public void setConservation(Conservation cons)
+ {
+ if (colourScheme != null)
+ {
+ colourScheme.setConservation(cons);
+ }
+ }
+
+ @Override
+ public void setConservationInc(int i)
+ {
+ if (colourScheme != null)
+ {
+ colourScheme.setConservationInc(i);
+ }
+ }
+
+}
diff --git a/src/jalview/schemes/GraduatedColor.java b/src/jalview/schemes/GraduatedColor.java
index 037b6ca..3de2ab5 100644
--- a/src/jalview/schemes/GraduatedColor.java
+++ b/src/jalview/schemes/GraduatedColor.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
@@ -142,7 +145,7 @@ public class GraduatedColor
public boolean isColored(SequenceFeature feature)
{
float val = feature.getScore();
- if (val == Float.NaN)
+ if (Float.isNaN(val))
{
return true;
}
@@ -150,7 +153,7 @@ public class GraduatedColor
{
return true;
}
- if (this.thrsh == Float.NaN)
+ if (Float.isNaN(this.thrsh))
{
return true;
}
@@ -208,7 +211,7 @@ public class GraduatedColor
return getMaxColor();
}
float scr = feature.getScore();
- if (scr == Float.NaN)
+ if (Float.isNaN(scr))
{
return getMinColor();
}
diff --git a/src/jalview/schemes/HelixColourScheme.java b/src/jalview/schemes/HelixColourScheme.java
index 32dd06e..a89bc47 100644
--- a/src/jalview/schemes/HelixColourScheme.java
+++ b/src/jalview/schemes/HelixColourScheme.java
@@ -1,30 +1,33 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import java.awt.Color;
public class HelixColourScheme extends ScoreColourScheme
{
public HelixColourScheme()
{
- super(ResidueProperties.helix, ResidueProperties.helixmin,
- ResidueProperties.helixmax);
+ super(ResidueProperties.aaIndex, ResidueProperties.helix,
+ ResidueProperties.helixmin, ResidueProperties.helixmax);
}
public Color makeColour(float c)
diff --git a/src/jalview/schemes/HydrophobicColourScheme.java b/src/jalview/schemes/HydrophobicColourScheme.java
index 5714a28..56e0106 100644
--- a/src/jalview/schemes/HydrophobicColourScheme.java
+++ b/src/jalview/schemes/HydrophobicColourScheme.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import java.awt.Color;
/**
* DOCUMENT ME!
@@ -32,8 +35,8 @@ public class HydrophobicColourScheme extends ScoreColourScheme
*/
public HydrophobicColourScheme()
{
- super(ResidueProperties.hyd, ResidueProperties.hydmin,
- ResidueProperties.hydmax);
+ super(ResidueProperties.aaIndex, ResidueProperties.hyd,
+ ResidueProperties.hydmin, ResidueProperties.hydmax);
}
/**
diff --git a/src/jalview/schemes/NucleotideColourScheme.java b/src/jalview/schemes/NucleotideColourScheme.java
index 249d87d..dd99f8a 100644
--- a/src/jalview/schemes/NucleotideColourScheme.java
+++ b/src/jalview/schemes/NucleotideColourScheme.java
@@ -1,23 +1,28 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
/**
* DOCUMENT ME!
@@ -32,7 +37,8 @@ public class NucleotideColourScheme extends ResidueColourScheme
*/
public NucleotideColourScheme()
{
- super(ResidueProperties.nucleotide, 0);
+ super(ResidueProperties.nucleotideIndex, ResidueProperties.nucleotide,
+ 0);
}
/**
@@ -43,6 +49,7 @@ public class NucleotideColourScheme extends ResidueColourScheme
*
* @return DOCUMENT ME!
*/
+ @Override
public Color findColour(char c)
{
// System.out.println("called"); log.debug
@@ -59,7 +66,8 @@ public class NucleotideColourScheme extends ResidueColourScheme
*
* @return DOCUMENT ME!
*/
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour;
if ((threshold == 0) || aboveThreshold(c, j))
diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java
index 23a2ee2..d21c30f 100644
--- a/src/jalview/schemes/PIDColourScheme.java
+++ b/src/jalview/schemes/PIDColourScheme.java
@@ -1,26 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.analysis.AAFrequency;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
-import jalview.analysis.*;
-import jalview.datamodel.*;
+import java.awt.Color;
public class PIDColourScheme extends ResidueColourScheme
{
@@ -36,7 +40,8 @@ public class PIDColourScheme extends ResidueColourScheme
this.thresholds = ResidueProperties.pidThresholds;
}
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
if ('a' <= c && c <= 'z')
{
diff --git a/src/jalview/schemes/PurinePyrimidineColourScheme.java b/src/jalview/schemes/PurinePyrimidineColourScheme.java
new file mode 100644
index 0000000..441a117
--- /dev/null
+++ b/src/jalview/schemes/PurinePyrimidineColourScheme.java
@@ -0,0 +1,90 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.schemes;
+
+import java.awt.Color;
+
+/**
+ * Class is based off of NucleotideColourScheme
+ *
+ * @author Lauren Michelle Lui
+ */
+public class PurinePyrimidineColourScheme extends ResidueColourScheme
+{
+ /**
+ * Creates a new PurinePyrimidineColourScheme object.
+ */
+ public PurinePyrimidineColourScheme()
+ {
+ super(ResidueProperties.purinepyrimidineIndex,
+ ResidueProperties.purinepyrimidine, 0);
+ }
+
+ /**
+ * Finds the corresponding color for the type of character inputed
+ *
+ * @param c
+ * Character in sequence
+ *
+ * @return Color from purinepyrimidineIndex in
+ * jalview.schemes.ResidueProperties
+ */
+ public Color findColour(char c)
+ {
+ return colors[ResidueProperties.purinepyrimidineIndex[c]];
+ }
+
+ /**
+ * Returns color based on conservation
+ *
+ * @param c
+ * Character in sequence
+ * @param j
+ * Threshold
+ *
+ * @return Color in RGB
+ */
+ public Color findColour(char c, int j)
+ {
+ Color currentColour;
+ if ((threshold == 0) || aboveThreshold(c, j))
+ {
+ try
+ {
+ currentColour = colors[ResidueProperties.purinepyrimidineIndex[c]];
+ } catch (Exception ex)
+ {
+ return Color.white;
+ }
+ }
+ else
+ {
+ return Color.white;
+ }
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+
+ return currentColour;
+ }
+}
diff --git a/src/jalview/schemes/RNAHelicesColour.java b/src/jalview/schemes/RNAHelicesColour.java
new file mode 100644
index 0000000..9c2ec3e
--- /dev/null
+++ b/src/jalview/schemes/RNAHelicesColour.java
@@ -0,0 +1,201 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.schemes;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
+import java.util.Hashtable;
+import java.util.Map;
+
+/**
+ * Looks at the information computed from an RNA Stockholm format file on the
+ * secondary structure of the alignment. Extracts the information on the
+ * positions of the helices present and assigns colors.
+ *
+ * @author Lauren Michelle Lui
+ * @version 2.5
+ */
+public class RNAHelicesColour extends ResidueColourScheme
+{
+
+ /**
+ * Maps sequence positions to the RNA helix they belong to. Key: position,
+ * Value: helix TODO: Revise or drop in favour of annotation position numbers
+ */
+ public Hashtable<Integer, String> positionsToHelix = new Hashtable<Integer, String>();
+
+ /**
+ * Number of helices in the RNA secondary structure
+ */
+ int numHelix = 0;
+
+ public AlignmentAnnotation annotation;
+
+ /**
+ * Creates a new RNAHelicesColour object.
+ */
+ public RNAHelicesColour(AlignmentAnnotation annotation)
+ {
+ super(ResidueProperties.nucleotideIndex);
+ this.annotation = annotation;
+ ColourSchemeProperty.resetRnaHelicesShading();
+ refresh();
+ }
+
+ public RNAHelicesColour(AnnotatedCollectionI alignment)
+ {
+ super(ResidueProperties.nucleotideIndex);
+ ColourSchemeProperty.resetRnaHelicesShading();
+ alignmentChanged(alignment, null);
+ }
+
+ /**
+ * clones colour settings and annotation row data
+ *
+ * @param rnaHelicesColour
+ */
+ public RNAHelicesColour(RNAHelicesColour rnaHelicesColour)
+ {
+ super(ResidueProperties.nucleotideIndex);
+ annotation = rnaHelicesColour.annotation;
+ refresh();
+ }
+
+ @Override
+ public void alignmentChanged(AnnotatedCollectionI alignment,
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
+ {
+
+ // This loop will find the first rna structure annotation by which to colour
+ // the sequences.
+ AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation();
+ for (int i = 0; i < annotations.length; i++)
+ {
+
+ // is this a sensible way of determining type of annotation?
+ if (annotations[i].visible && annotations[i].isRNA()
+ && annotations[i].isValidStruc())
+ {
+ annotation = annotations[i];
+ break;
+ }
+ }
+
+ refresh();
+
+ }
+
+ private long lastrefresh = -1;
+
+ public void refresh()
+ {
+
+ if (annotation != null
+ && ((annotation._rnasecstr == null || lastrefresh != annotation._rnasecstr
+ .hashCode()) && annotation.isValidStruc()))
+ {
+ annotation.getRNAStruc();
+ lastrefresh = annotation._rnasecstr.hashCode();
+ numHelix = 0;
+ positionsToHelix = new Hashtable<Integer, String>();
+
+ // Figure out number of helices
+ // Length of rnasecstr is the number of pairs of positions that base pair
+ // with each other in the secondary structure
+ for (int x = 0; x < this.annotation._rnasecstr.length; x++)
+ {
+
+ /*
+ * System.out.println(this.annotation._rnasecstr[x] + " Begin" +
+ * this.annotation._rnasecstr[x].getBegin());
+ */
+ // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
+
+ positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+ positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+
+ if (Integer.parseInt(this.annotation._rnasecstr[x]
+ .getFeatureGroup()) > numHelix)
+ {
+ numHelix = Integer.parseInt(this.annotation._rnasecstr[x]
+ .getFeatureGroup());
+ }
+
+ }
+ ColourSchemeProperty.initRnaHelicesShading(numHelix);
+ }
+ }
+
+ /**
+ * Returns default color base on purinepyrimidineIndex in
+ * jalview.schemes.ResidueProperties (Allows coloring in sequence logo)
+ *
+ * @param c
+ * Character in sequence
+ *
+ * @return color in RGB
+ */
+ @Override
+ public Color findColour(char c)
+ {
+ return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]];
+ // random colors for all positions
+ // jalview.util.ColorUtils.generateRandomColor(Color.white); If you want
+ }
+
+ /**
+ * Returns color based on helices
+ *
+ * @param c
+ * Character in sequence
+ * @param j
+ * position in sequence - used to locate helix
+ *
+ * @return Color in RGB
+ */
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
+ {
+ refresh();
+ Color currentColour = Color.white;
+ String currentHelix = null;
+ currentHelix = positionsToHelix.get(j);
+ if (currentHelix != null)
+ {
+ currentColour = ColourSchemeProperty.rnaHelices[Integer
+ .parseInt(currentHelix)];
+ }
+ return currentColour;
+ }
+
+ @Override
+ public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ {
+ return new RNAHelicesColour(this);
+ }
+}
\ No newline at end of file
diff --git a/src/jalview/schemes/RNAHelicesColourChooser.java b/src/jalview/schemes/RNAHelicesColourChooser.java
new file mode 100644
index 0000000..5a09a34
--- /dev/null
+++ b/src/jalview/schemes/RNAHelicesColourChooser.java
@@ -0,0 +1,132 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.schemes;
+
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.SequenceGroup;
+
+import java.awt.event.ActionEvent;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * Helps generate the colors for RNA secondary structure. Future: add option to
+ * change colors based on covariation.
+ *
+ * @author Lauren Michelle Lui
+ *
+ */
+public class RNAHelicesColourChooser
+{
+
+ AlignViewportI av;
+
+ AlignmentViewPanel ap;
+
+ ColourSchemeI oldcs;
+
+ Hashtable oldgroupColours;
+
+ jalview.datamodel.AlignmentAnnotation currentAnnotation;
+
+ boolean adjusting = false;
+
+ public RNAHelicesColourChooser(AlignViewportI av,
+ final AlignmentViewPanel ap)
+ {
+ oldcs = av.getGlobalColourScheme();
+ if (av.getAlignment().getGroups() != null)
+ {
+ oldgroupColours = new Hashtable();
+ for (SequenceGroup sg : ap.getAlignment().getGroups())
+ {
+ if (sg.cs != null)
+ {
+ oldgroupColours.put(sg, sg.cs);
+ }
+ }
+ }
+ this.av = av;
+ this.ap = ap;
+
+ if (oldcs instanceof RNAHelicesColour)
+ {
+ RNAHelicesColour rhc = (RNAHelicesColour) oldcs;
+
+ }
+
+ adjusting = true;
+ Vector list = new Vector();
+ int index = 1;
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ {
+ String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+ if (!list.contains(label))
+ {
+ list.addElement(label);
+ }
+ else
+ {
+ list.addElement(label + "_" + (index++));
+ }
+ }
+
+ adjusting = false;
+
+ changeColour();
+
+ }
+
+ void changeColour()
+ {
+ // Check if combobox is still adjusting
+ if (adjusting)
+ {
+ return;
+ }
+ RNAHelicesColour rhc = null;
+
+ rhc = new RNAHelicesColour(av.getAlignment());
+
+ av.setGlobalColourScheme(rhc);
+
+ ap.paintAlignment(true);
+ }
+
+ void reset()
+ {
+ av.setGlobalColourScheme(oldcs);
+ if (av.getAlignment().getGroups() != null)
+ {
+ for (SequenceGroup sg : ap.getAlignment().getGroups())
+ {
+ sg.cs = (ColourSchemeI) oldgroupColours.get(sg);
+ }
+ }
+ }
+
+ public void annotations_actionPerformed(ActionEvent e)
+ {
+ changeColour();
+ }
+
+}
diff --git a/src/jalview/schemes/RNAInteractionColourScheme.java b/src/jalview/schemes/RNAInteractionColourScheme.java
new file mode 100644
index 0000000..e23a497
--- /dev/null
+++ b/src/jalview/schemes/RNAInteractionColourScheme.java
@@ -0,0 +1,85 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.schemes;
+
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
+
+public class RNAInteractionColourScheme extends ResidueColourScheme
+{
+ public RNAInteractionColourScheme()
+ {
+ super();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public Color findColour(char c)
+ {
+ // System.out.println("called"); log.debug
+ return colors[ResidueProperties.nucleotideIndex[c]];
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n
+ * DOCUMENT ME!
+ * @param j
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
+ {
+ Color currentColour;
+ if ((threshold == 0) || aboveThreshold(c, j))
+ {
+ try
+ {
+ currentColour = colors[ResidueProperties.nucleotideIndex[c]];
+ } catch (Exception ex)
+ {
+ return Color.white;
+ }
+ }
+ else
+ {
+ return Color.white;
+ }
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+
+ return currentColour;
+ }
+}
diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java
index 5402d75..3164748 100644
--- a/src/jalview/schemes/ResidueColourScheme.java
+++ b/src/jalview/schemes/ResidueColourScheme.java
@@ -1,27 +1,35 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.util.*;
-
-import java.awt.*;
+import jalview.analysis.AAFrequency;
+import jalview.analysis.Conservation;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
-import jalview.analysis.*;
+import java.awt.Color;
+import java.util.Hashtable;
+import java.util.Map;
/**
* DOCUMENT ME!
@@ -31,6 +39,7 @@ import jalview.analysis.*;
*/
public class ResidueColourScheme implements ColourSchemeI
{
+ final int[] symbolIndex;
boolean conservationColouring = false;
@@ -55,22 +64,37 @@ public class ResidueColourScheme implements ColourSchemeI
/**
* Creates a new ResidueColourScheme object.
*
+ * @param final int[] index table into colors (ResidueProperties.naIndex or
+ * ResidueProperties.aaIndex)
* @param colors
- * DOCUMENT ME!
+ * colours for symbols in sequences
* @param threshold
- * DOCUMENT ME!
+ * threshold for conservation shading
*/
- public ResidueColourScheme(Color[] colours, int threshold)
+ public ResidueColourScheme(int[] aaOrnaIndex, Color[] colours,
+ int threshold)
{
+ symbolIndex = aaOrnaIndex;
this.colors = colours;
this.threshold = threshold;
}
/**
- * Creates a new ResidueColourScheme object.
+ * Creates a new ResidueColourScheme object with a lookup table for indexing
+ * the colour map
+ */
+ public ResidueColourScheme(int[] aaOrNaIndex)
+ {
+ symbolIndex = aaOrNaIndex;
+ }
+
+ /**
+ * Creates a new ResidueColourScheme object - default constructor for
+ * non-sequence dependent colourschemes
*/
public ResidueColourScheme()
{
+ symbolIndex = null;
}
/**
@@ -78,17 +102,18 @@ public class ResidueColourScheme implements ColourSchemeI
*/
public Color findColour(char c)
{
- return colors == null ? Color.white
- : colors[ResidueProperties.aaIndex[c]];
+ return colors == null ? Color.white : colors[symbolIndex[c]];
}
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour;
- if ((threshold == 0) || aboveThreshold(c, j))
+ if (colors != null && symbolIndex != null && (threshold == 0)
+ || aboveThreshold(c, j))
{
- currentColour = colors[ResidueProperties.aaIndex[c]];
+ currentColour = colors[symbolIndex[c]];
}
else
{
@@ -173,6 +198,12 @@ public class ResidueColourScheme implements ColourSchemeI
return conservationColouring;
}
+ @Override
+ public void setConservationApplied(boolean conservationApplied)
+ {
+ conservationColouring = conservationApplied;
+ }
+
public void setConservationInc(int i)
{
inc = i;
@@ -278,4 +309,24 @@ public class ResidueColourScheme implements ColourSchemeI
return currentColour;
}
+ @Override
+ public void alignmentChanged(AnnotatedCollectionI alignment,
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
+ {
+ }
+
+ @Override
+ public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ {
+ try
+ {
+ return getClass().newInstance();
+ } catch (Exception q)
+ {
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_cannot_duplicate_colour_scheme",
+ new String[] { getClass().getName() }), q);
+ }
+ }
}
diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java
index c46c07d..092971d 100644
--- a/src/jalview/schemes/ResidueProperties.java
+++ b/src/jalview/schemes/ResidueProperties.java
@@ -1,40 +1,57 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.util.*;
+import jalview.analysis.scoremodels.FeatureScoreModel;
+import jalview.analysis.scoremodels.PIDScoreModel;
+import jalview.api.analysis.ScoreModelI;
-import java.awt.*;
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
public class ResidueProperties
{
- public static Hashtable scoreMatrices = new Hashtable();
+ public static Hashtable<String, ScoreModelI> scoreMatrices = new Hashtable();
// Stores residue codes/names and colours and other things
public static final int[] aaIndex; // aaHash version 2.1.1 and below
public static final int[] nucleotideIndex;
- public static final Hashtable aa3Hash = new Hashtable();
+ public static final int[] purinepyrimidineIndex;
+
+ public static final Map<String, Integer> aa3Hash = new HashMap<String, Integer>();
- public static final Hashtable aa2Triplet = new Hashtable();
+ public static final Map<String, String> aa2Triplet = new HashMap<String, String>();
- public static final Hashtable nucleotideName = new Hashtable();
+ public static final Map<String, String> nucleotideName = new HashMap<String, String>();
+
+ // lookup from modified amino acid (e.g. MSE) to canonical form (e.g. MET)
+ public static final Map<String, String> modifications = new HashMap<String, String>();
static
{
@@ -95,6 +112,16 @@ public class ResidueProperties
// extend subt. matrices
}
+ /**
+ * maximum (gap) index for matrices involving protein alphabet
+ */
+ public final static int maxProteinIndex = 23;
+
+ /**
+ * maximum (gap) index for matrices involving nucleotide alphabet
+ */
+ public final static int maxNucleotideIndex = 10;
+
static
{
nucleotideIndex = new int[255];
@@ -144,6 +171,54 @@ public class ResidueProperties
nucleotideName.put("y", "Unknown Pyrimidine");
nucleotideName.put("N", "Unknown");
nucleotideName.put("n", "Unknown");
+ nucleotideName.put("W", "Weak nucleotide (A or T)");
+ nucleotideName.put("w", "Weak nucleotide (A or T)");
+ nucleotideName.put("S", "Strong nucleotide (G or C)");
+ nucleotideName.put("s", "Strong nucleotide (G or C)");
+ nucleotideName.put("M", "Amino (A or C)");
+ nucleotideName.put("m", "Amino (A or C)");
+ nucleotideName.put("K", "Keto (G or T)");
+ nucleotideName.put("k", "Keto (G or T)");
+ nucleotideName.put("B", "Not A (G or C or T)");
+ nucleotideName.put("b", "Not A (G or C or T)");
+ nucleotideName.put("H", "Not G (A or C or T)");
+ nucleotideName.put("h", "Not G (A or C or T)");
+ nucleotideName.put("D", "Not C (A or G or T)");
+ nucleotideName.put("d", "Not C (A or G or T)");
+ nucleotideName.put("V", "Not T (A or G or C");
+ nucleotideName.put("v", "Not T (A or G or C");
+
+ }
+
+ static
+ {
+ purinepyrimidineIndex = new int[255];
+ for (int i = 0; i < 255; i++)
+ {
+ purinepyrimidineIndex[i] = 3; // non-nucleotide symbols are all non-gap
+ // gaps.
+ }
+
+ purinepyrimidineIndex['A'] = 0;
+ purinepyrimidineIndex['a'] = 0;
+ purinepyrimidineIndex['C'] = 1;
+ purinepyrimidineIndex['c'] = 1;
+ purinepyrimidineIndex['G'] = 0;
+ purinepyrimidineIndex['g'] = 0;
+ purinepyrimidineIndex['T'] = 1;
+ purinepyrimidineIndex['t'] = 1;
+ purinepyrimidineIndex['U'] = 1;
+ purinepyrimidineIndex['u'] = 1;
+ purinepyrimidineIndex['I'] = 2;
+ purinepyrimidineIndex['i'] = 2;
+ purinepyrimidineIndex['X'] = 2;
+ purinepyrimidineIndex['x'] = 2;
+ purinepyrimidineIndex['R'] = 0;
+ purinepyrimidineIndex['r'] = 0;
+ purinepyrimidineIndex['Y'] = 1;
+ purinepyrimidineIndex['y'] = 1;
+ purinepyrimidineIndex['N'] = 2;
+ purinepyrimidineIndex['n'] = 2;
}
static
@@ -223,9 +298,9 @@ public class ResidueProperties
aa2Triplet.put("v", "VAL");
}
- public static final String[] aa =
- { "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",
- "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "_", "*", ".", " " };
+ public static final String[] aa = { "A", "R", "N", "D", "C", "Q", "E",
+ "G", "H", "I", "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V", "B",
+ "Z", "X", "_", "*", ".", " " };
public static final Color midBlue = new Color(100, 100, 255);
@@ -245,8 +320,8 @@ public class ResidueProperties
scaleColours.addElement(Color.white);
}
- public static final Color[] taylor =
- { new Color(204, 255, 0), // A Greenish-yellowy-yellow
+ public static final Color[] taylor = { new Color(204, 255, 0), // A
+ // Greenish-yellowy-yellow
new Color(0, 0, 255), // R Blueish-bluey-blue
new Color(204, 0, 255), // N Blueish-reddy-blue
new Color(255, 0, 0), // D Reddish-reddy-red
@@ -274,23 +349,29 @@ public class ResidueProperties
Color.white // .
};
- public static final Color[] nucleotide =
- { new Color(100, 247, 63), // A
+ public static final Color[] nucleotide = { new Color(100, 247, 63), // A
new Color(255, 179, 64), // C
new Color(235, 65, 60), // G
new Color(60, 136, 238), // T
new Color(60, 136, 238), // U
- Color.white, // I
- Color.white, // X
+ Color.white, // I (inosine)
+ Color.white, // X (xanthine)
Color.white, // R
Color.white, // Y
Color.white, // N
Color.white, // Gap
};
+ // Added for PurinePyrimidineColourScheme
+ public static final Color[] purinepyrimidine = {
+ new Color(255, 131, 250), // A, G, R purines purplish/orchid
+ new Color(64, 224, 208), // C,U, T, Y pyrimidines turquoise
+ Color.white, // all other nucleotides
+ Color.white // Gap
+ };
+
// Zappo
- public static final Color[] zappo =
- { Color.pink, // A
+ public static final Color[] zappo = { Color.pink, // A
midBlue, // R
Color.green, // N
Color.red, // D
@@ -320,8 +401,7 @@ public class ResidueProperties
};
// Dunno where I got these numbers from
- public static final double[] hyd2 =
- { 0.62, // A
+ public static final double[] hyd2 = { 0.62, // A
0.29, // R
-0.90, // N
-0.74, // D
@@ -346,34 +426,33 @@ public class ResidueProperties
0.0 // X
};
- public static final double[] helix =
- { 1.42, 0.98, 0.67, 1.01, 0.70, 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16,
- 1.45, 1.13, 0.57, 0.77, 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0 };
+ public static final double[] helix = { 1.42, 0.98, 0.67, 1.01, 0.70,
+ 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16, 1.45, 1.13, 0.57, 0.77,
+ 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0 };
public static final double helixmin = 0.57;
public static final double helixmax = 1.51;
- public static final double[] strand =
- { 0.83, 0.93, 0.89, 0.54, 1.19, 1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74,
- 1.05, 1.38, 0.55, 0.75, 1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0 };
+ public static final double[] strand = { 0.83, 0.93, 0.89, 0.54, 1.19,
+ 1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74, 1.05, 1.38, 0.55, 0.75,
+ 1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0 };
public static final double strandmin = 0.37;
public static final double strandmax = 1.7;
- public static final double[] turn =
- { 0.66, 0.95, 1.56, 1.46, 1.19, 0.98, 0.74, 1.56, 0.95, 0.47, 0.59, 1.01,
- 0.60, 0.60, 1.52, 1.43, 0.96, 0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0,
- 0 };
+ public static final double[] turn = { 0.66, 0.95, 1.56, 1.46, 1.19, 0.98,
+ 0.74, 1.56, 0.95, 0.47, 0.59, 1.01, 0.60, 0.60, 1.52, 1.43, 0.96,
+ 0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0, 0 };
public static final double turnmin = 0.47;
public static final double turnmax = 1.56;
- public static final double[] buried =
- { 1.7, 0.1, 0.4, 0.4, 4.6, 0.3, 0.3, 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2,
- 0.6, 0.8, 0.7, 1.6, 0.5, 2.9, 0.4, 0.3, 1.358, 0.00 };
+ public static final double[] buried = { 1.7, 0.1, 0.4, 0.4, 4.6, 0.3,
+ 0.3, 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2, 0.6, 0.8, 0.7, 1.6, 0.5,
+ 2.9, 0.4, 0.3, 1.358, 0.00 };
public static final double buriedmin = 0.05;
@@ -382,9 +461,9 @@ public class ResidueProperties
// This is hydropathy index
// Kyte, J., and Doolittle, R.F., J. Mol. Biol.
// 1157, 105-132, 1982
- public static final double[] hyd =
- { 1.8, -4.5, -3.5, -3.5, 2.5, -3.5, -3.5, -0.4, -3.2, 4.5, 3.8, -3.9,
- 1.9, 2.8, -1.6, -0.8, -0.7, -0.9, -1.3, 4.2, -3.5, -3.5, -0.49, 0.0 };
+ public static final double[] hyd = { 1.8, -4.5, -3.5, -3.5, 2.5, -3.5,
+ -3.5, -0.4, -3.2, 4.5, 3.8, -3.9, 1.9, 2.8, -1.6, -0.8, -0.7, -0.9,
+ -1.3, 4.2, -3.5, -3.5, -0.49, 0.0 };
public static final double hydmax = 4.5;
@@ -392,8 +471,7 @@ public class ResidueProperties
// public static final double hydmax = 1.38;
// public static final double hydmin = -2.53;
- private static final int[][] BLOSUM62 =
- {
+ private static final int[][] BLOSUM62 = {
{ 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3,
-2, 0, -2, -1, 0, -4 },
{ -1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3,
@@ -443,8 +521,7 @@ public class ResidueProperties
{ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
-4, -4, -4, -4, -4, -4, 1 }, };
- static final int[][] PAM250 =
- {
+ static final int[][] PAM250 = {
{ 2, -2, 0, 0, -2, 0, 0, 1, -1, -1, -2, -1, -1, -3, 1, 1, 1, -6, -3,
0, 0, 0, 0, -8 },
{ -2, 6, 0, -1, -4, 1, -1, -3, 2, -2, -3, 3, 0, -4, 0, 0, -1, 2, -4,
@@ -514,18 +591,22 @@ public class ResidueProperties
* new Color(60, 136, 238), // U Color.white, // I Color.white, // X
* Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap
*/
- static final int[][] DNA =
- {
- { 10, -8, -8, -8, 1, 0, 0, 0, 0, 0, 1 }, // C
- { -8, 10, -8, -8, 1, 0, 0, 0, 0, 0, 1 }, // T
- { -8, -8, 10, -8, 1, 0, 0, 0, 0, 0, 1 }, // A
- { -8, -8, -8, 10, 1, 0, 0, 0, 0, 0, 1 }, // G
- { 1, 1, 1, 1, 10, 0, 0, 0, 0, 0, 1 }, // -
- { 1, 1, 1, 1, 1, 10, 0, 0, 0, 0, 1 }, // -
- { 1, 1, 1, 1, 1, 0, 10, 0, 0, 0, 1 }, // -
- { 1, 1, 1, 1, 1, 0, 0, 10, 0, 0, 1 }, // -
- { 1, 1, 1, 1, 1, 0, 0, 0, 10, 0, 1 }, // -
- { 1, 1, 1, 1, 1, 0, 0, 0, 0, 10, 1 }, // -
+
+ // JBPNote: patch matrix for T/U equivalence when working with DNA or RNA.
+ // Will equate sequences if working with mixed nucleotide sets.
+ // treats T and U identically. R and Y weak equivalence with AG and CTU.
+ // N matches any other base weakly
+ //
+ static final int[][] DNA = { { 10, -8, -8, -8, -8, 1, 1, 1, -8, 1, 1 }, // A
+ { -8, 10, -8, -8, -8, 1, 1, -8, 1, 1, 1 }, // C
+ { -8, -8, 10, -8, -8, 1, 1, 1, -8, 1, 1 }, // G
+ { -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // T
+ { -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // U
+ { 1, 1, 1, 1, 1, 10, 0, 0, 0, 1, 1 }, // I
+ { 1, 1, 1, 1, 1, 0, 10, 0, 0, 1, 1 }, // X
+ { 1, -8, 1, -8, -8, 0, 0, 10, -8, 1, 1 }, // R
+ { -8, 1, -8, 1, 1, 0, 0, -8, 10, 1, 1 }, // Y
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1 }, // N
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // -
};
/**
@@ -536,59 +617,61 @@ public class ResidueProperties
scoreMatrices.put("BLOSUM62", new ScoreMatrix("BLOSUM62", BLOSUM62, 0));
scoreMatrices.put("PAM250", new ScoreMatrix("PAM250", PAM250, 0));
scoreMatrices.put("DNA", new ScoreMatrix("DNA", DNA, 1));
+
}
- public static final Color[] pidColours =
- { midBlue, new Color(153, 153, 255),
+ public static final Color[] pidColours = { midBlue,
+ new Color(153, 153, 255),
// Color.lightGray,
new Color(204, 204, 255), };
- public static final float[] pidThresholds =
- { 80, 60, 40, };
+ public static final float[] pidThresholds = { 80, 60, 40, };
+
+ public static Map<String, List<String>> codonHash = new HashMap<String, List<String>>();
- public static Hashtable codonHash = new Hashtable();
+ private static List<String> Lys = new ArrayList<String>();
- public static Vector Lys = new Vector();
+ private static List<String> Asn = new ArrayList<String>();
- public static Vector Asn = new Vector();
+ private static List<String> Gln = new ArrayList<String>();
- public static Vector Gln = new Vector();
+ private static List<String> His = new ArrayList<String>();
- public static Vector His = new Vector();
+ private static List<String> Glu = new ArrayList<String>();
- public static Vector Glu = new Vector();
+ private static List<String> Asp = new ArrayList<String>();
- public static Vector Asp = new Vector();
+ private static List<String> Tyr = new ArrayList<String>();
- public static Vector Tyr = new Vector();
+ private static List<String> Thr = new ArrayList<String>();
- public static Vector Thr = new Vector();
+ private static List<String> Pro = new ArrayList<String>();
- public static Vector Pro = new Vector();
+ private static List<String> Ala = new ArrayList<String>();
- public static Vector Ala = new Vector();
+ private static List<String> Ser = new ArrayList<String>();
- public static Vector Ser = new Vector();
+ private static List<String> Arg = new ArrayList<String>();
- public static Vector Arg = new Vector();
+ private static List<String> Gly = new ArrayList<String>();
- public static Vector Gly = new Vector();
+ private static List<String> Trp = new ArrayList<String>();
- public static Vector Trp = new Vector();
+ private static List<String> Cys = new ArrayList<String>();
- public static Vector Cys = new Vector();
+ private static List<String> Ile = new ArrayList<String>();
- public static Vector Ile = new Vector();
+ private static List<String> Met = new ArrayList<String>();
- public static Vector Met = new Vector();
+ private static List<String> Leu = new ArrayList<String>();
- public static Vector Leu = new Vector();
+ private static List<String> Val = new ArrayList<String>();
- public static Vector Val = new Vector();
+ private static List<String> Phe = new ArrayList<String>();
- public static Vector Phe = new Vector();
+ public static List<String> STOP = new ArrayList<String>();
- public static Vector STOP = new Vector();
+ public static String START = "ATG";
static
{
@@ -615,22 +698,52 @@ public class ResidueProperties
codonHash.put("STOP", STOP);
}
- public static Hashtable codonHash2 = new Hashtable();
+ /**
+ * Nucleotide Ambiguity Codes
+ */
+ public static final Map<String, String[]> ambiguityCodes = new Hashtable<String, String[]>();
+
+ /**
+ * Codon triplets with additional symbols for unambiguous codons that include
+ * ambiguity codes
+ */
+ public static final Hashtable<String, String> codonHash2 = new Hashtable<String, String>();
+
+ /**
+ * all ambiguity codes for a given base
+ */
+ public final static Hashtable<String, List<String>> _ambiguityCodes = new Hashtable<String, List<String>>();
static
{
+ /*
+ * Ambiguity codes as per http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html
+ */
+ ambiguityCodes.put("R", new String[] { "A", "G" });
+ ambiguityCodes.put("Y", new String[] { "T", "C" });
+ ambiguityCodes.put("W", new String[] { "A", "T" });
+ ambiguityCodes.put("S", new String[] { "G", "C" });
+ ambiguityCodes.put("M", new String[] { "A", "C" });
+ ambiguityCodes.put("K", new String[] { "G", "T" });
+ ambiguityCodes.put("H", new String[] { "A", "T", "C" });
+ ambiguityCodes.put("B", new String[] { "G", "T", "C" });
+ ambiguityCodes.put("V", new String[] { "G", "A", "C" });
+ ambiguityCodes.put("D", new String[] { "G", "A", "T" });
+ ambiguityCodes.put("N", new String[] { "G", "A", "T", "C" });
+
+ // Now build codon translation table
codonHash2.put("AAA", "K");
codonHash2.put("AAG", "K");
codonHash2.put("AAC", "N");
codonHash2.put("AAT", "N");
- codonHash2.put("CAA", "E");
- codonHash2.put("CAG", "E");
+ codonHash2.put("CAA", "Q");
+ codonHash2.put("CAG", "Q");
codonHash2.put("CAC", "H");
codonHash2.put("CAT", "H");
- codonHash2.put("GAA", "Q");
- codonHash2.put("GAG", "Q");
+ codonHash2.put("GAA", "E");
+ codonHash2.put("GAG", "E");
codonHash2.put("GAC", "D");
codonHash2.put("GAT", "D");
@@ -638,9 +751,9 @@ public class ResidueProperties
codonHash2.put("TAT", "Y");
codonHash2.put("ACA", "T");
- codonHash2.put("AAG", "T");
codonHash2.put("ACC", "T");
codonHash2.put("ACT", "T");
+ codonHash2.put("ACG", "T");
codonHash2.put("CCA", "P");
codonHash2.put("CCG", "P");
@@ -700,91 +813,229 @@ public class ResidueProperties
codonHash2.put("TTC", "F");
codonHash2.put("TTT", "F");
+
+ buildAmbiguityCodonSet();
+ }
+
+ /**
+ * programmatic generation of codons including ambiguity codes
+ */
+ public static void buildAmbiguityCodonSet()
+ {
+ if (_ambiguityCodes.size() > 0)
+ {
+ System.err
+ .println("Ignoring multiple calls to buildAmbiguityCodonSet");
+ return;
+ }
+ // Invert the ambiguity code set
+ for (Map.Entry<String, String[]> acode : ambiguityCodes.entrySet())
+ {
+ for (String r : acode.getValue())
+ {
+ List<String> codesfor = _ambiguityCodes.get(r);
+ if (codesfor == null)
+ {
+ _ambiguityCodes.put(r, codesfor = new ArrayList<String>());
+ }
+ if (!codesfor.contains(acode.getKey()))
+ {
+ codesfor.add(acode.getKey());
+ }
+ else
+ {
+ System.err
+ .println("Inconsistency in the IUBMB ambiguity code nomenclature table: collision for "
+ + acode.getKey() + " in residue " + r);
+ }
+ }
+ }
+ // and programmatically add in the ambiguity codes that yield the same amino
+ // acid
+ String[] unambcodons = codonHash2.keySet().toArray(
+ new String[codonHash2.size()]);
+ for (String codon : unambcodons)
+ {
+ String residue = codonHash2.get(codon);
+ String acodon[][] = new String[codon.length()][];
+ for (int i = 0, iSize = codon.length(); i < iSize; i++)
+ {
+ String _ac = "" + codon.charAt(i);
+ List<String> acodes = _ambiguityCodes.get(_ac);
+ if (acodes != null)
+ {
+ acodon[i] = acodes.toArray(new String[acodes.size()]);
+ }
+ else
+ {
+ acodon[i] = new String[] {};
+ }
+ }
+ // enumerate all combinations and test for veracity of translation
+ int tpos[] = new int[codon.length()], cpos[] = new int[codon.length()];
+ for (int i = 0; i < tpos.length; i++)
+ {
+ tpos[i] = -1;
+ }
+ tpos[acodon.length - 1] = 0;
+ int ipos, j;
+ while (tpos[0] < acodon[0].length)
+ {
+ // make all codons for this combination
+ char allres[][] = new char[tpos.length][];
+ String _acodon = "";
+ char _anuc;
+ for (ipos = 0; ipos < tpos.length; ipos++)
+ {
+ if (acodon[ipos].length == 0 || tpos[ipos] < 0)
+ {
+ _acodon += codon.charAt(ipos);
+ allres[ipos] = new char[] { codon.charAt(ipos) };
+ }
+ else
+ {
+ _acodon += acodon[ipos][tpos[ipos]];
+ String[] altbase = ambiguityCodes.get(acodon[ipos][tpos[ipos]]);
+ allres[ipos] = new char[altbase.length];
+ j = 0;
+ for (String ab : altbase)
+ {
+ allres[ipos][j++] = ab.charAt(0);
+ }
+ }
+ }
+ // test all codons for this combination
+ for (ipos = 0; ipos < cpos.length; ipos++)
+ {
+ cpos[ipos] = 0;
+ }
+ boolean valid = true;
+ do
+ {
+ String _codon = "";
+ for (j = 0; j < cpos.length; j++)
+ {
+ _codon += allres[j][cpos[j]];
+ }
+ String tr = codonHash2.get(_codon);
+ if (valid = (tr != null && tr.equals(residue)))
+ {
+ // advance to next combination
+ ipos = acodon.length - 1;
+ while (++cpos[ipos] >= allres[ipos].length && ipos > 0)
+ {
+ cpos[ipos] = 0;
+ ipos--;
+ }
+ }
+ } while (valid && cpos[0] < allres[0].length);
+ if (valid)
+ {
+ // Add this to the set of codons we will translate
+ // System.out.println("Adding ambiguity codon: " + _acodon + " for "
+ // + residue);
+ codonHash2.put(_acodon, residue);
+ }
+ else
+ {
+ // System.err.println("Rejecting ambiguity codon: " + _acodon
+ // + " for " + residue);
+ }
+ // next combination
+ ipos = acodon.length - 1;
+ while (++tpos[ipos] >= acodon[ipos].length && ipos > 0)
+ {
+ tpos[ipos] = -1;
+ ipos--;
+ }
+ }
+ }
+
}
static
{
- Lys.addElement("AAA");
- Lys.addElement("AAG");
- Asn.addElement("AAC");
- Asn.addElement("AAT");
-
- Gln.addElement("CAA");
- Gln.addElement("CAG");
- His.addElement("CAC");
- His.addElement("CAT");
-
- Glu.addElement("GAA");
- Glu.addElement("GAG");
- Asp.addElement("GAC");
- Asp.addElement("GAT");
-
- Tyr.addElement("TAC");
- Tyr.addElement("TAT");
-
- Thr.addElement("ACA");
- Thr.addElement("ACG");
- Thr.addElement("ACC");
- Thr.addElement("ACT");
-
- Pro.addElement("CCA");
- Pro.addElement("CCG");
- Pro.addElement("CCC");
- Pro.addElement("CCT");
-
- Ala.addElement("GCA");
- Ala.addElement("GCG");
- Ala.addElement("GCC");
- Ala.addElement("GCT");
-
- Ser.addElement("TCA");
- Ser.addElement("TCG");
- Ser.addElement("TCC");
- Ser.addElement("TCT");
- Ser.addElement("AGC");
- Ser.addElement("AGT");
-
- Arg.addElement("AGA");
- Arg.addElement("AGG");
- Arg.addElement("CGA");
- Arg.addElement("CGG");
- Arg.addElement("CGC");
- Arg.addElement("CGT");
-
- Gly.addElement("GGA");
- Gly.addElement("GGG");
- Gly.addElement("GGC");
- Gly.addElement("GGT");
-
- STOP.addElement("TGA");
- STOP.addElement("TAA");
- STOP.addElement("TAG");
-
- Trp.addElement("TGG");
-
- Cys.addElement("TGC");
- Cys.addElement("TGT");
-
- Ile.addElement("ATA");
- Ile.addElement("ATC");
- Ile.addElement("ATT");
-
- Met.addElement("ATG");
-
- Leu.addElement("CTA");
- Leu.addElement("CTG");
- Leu.addElement("CTC");
- Leu.addElement("CTT");
- Leu.addElement("TTA");
- Leu.addElement("TTG");
-
- Val.addElement("GTA");
- Val.addElement("GTG");
- Val.addElement("GTC");
- Val.addElement("GTT");
-
- Phe.addElement("TTC");
- Phe.addElement("TTT");
+ Lys.add("AAA");
+ Lys.add("AAG");
+ Asn.add("AAC");
+ Asn.add("AAT");
+
+ Gln.add("CAA");
+ Gln.add("CAG");
+ His.add("CAC");
+ His.add("CAT");
+
+ Glu.add("GAA");
+ Glu.add("GAG");
+ Asp.add("GAC");
+ Asp.add("GAT");
+
+ Tyr.add("TAC");
+ Tyr.add("TAT");
+
+ Thr.add("ACA");
+ Thr.add("ACG");
+ Thr.add("ACC");
+ Thr.add("ACT");
+
+ Pro.add("CCA");
+ Pro.add("CCG");
+ Pro.add("CCC");
+ Pro.add("CCT");
+
+ Ala.add("GCA");
+ Ala.add("GCG");
+ Ala.add("GCC");
+ Ala.add("GCT");
+
+ Ser.add("TCA");
+ Ser.add("TCG");
+ Ser.add("TCC");
+ Ser.add("TCT");
+ Ser.add("AGC");
+ Ser.add("AGT");
+
+ Arg.add("AGA");
+ Arg.add("AGG");
+ Arg.add("CGA");
+ Arg.add("CGG");
+ Arg.add("CGC");
+ Arg.add("CGT");
+
+ Gly.add("GGA");
+ Gly.add("GGG");
+ Gly.add("GGC");
+ Gly.add("GGT");
+
+ STOP.add("TGA");
+ STOP.add("TAA");
+ STOP.add("TAG");
+
+ Trp.add("TGG");
+
+ Cys.add("TGC");
+ Cys.add("TGT");
+
+ Ile.add("ATA");
+ Ile.add("ATC");
+ Ile.add("ATT");
+
+ Met.add("ATG");
+
+ Leu.add("CTA");
+ Leu.add("CTG");
+ Leu.add("CTC");
+ Leu.add("CTT");
+ Leu.add("TTA");
+ Leu.add("TTG");
+
+ Val.add("GTA");
+ Val.add("GTG");
+ Val.add("GTC");
+ Val.add("GTT");
+
+ Phe.add("TTC");
+ Phe.add("TTT");
}
// Stores residue codes/names and colours and other things
@@ -1087,6 +1338,79 @@ public class ResidueProperties
propHash.put("proline", proline);
propHash.put("polar", polar);
}
+ static
+ {
+ int[][] propMatrixF = new int[maxProteinIndex][maxProteinIndex], propMatrixPos = new int[maxProteinIndex][maxProteinIndex], propMatrixEpos = new int[maxProteinIndex][maxProteinIndex];
+ for (int i = 0; i < maxProteinIndex; i++)
+ {
+ int maxF = 0, maxP = 0, maxEP = 0;
+ String ic = "";
+ if (aa.length > i)
+ {
+ ic += aa[i];
+ }
+ else
+ {
+ ic = "-";
+ }
+ for (int j = i + 1; j < maxProteinIndex; j++)
+ {
+ String jc = "";
+ if (aa.length > j)
+ {
+ jc += aa[j];
+ }
+ else
+ {
+ jc = "-";
+ }
+ propMatrixF[i][j] = 0;
+ propMatrixPos[i][j] = 0;
+ propMatrixEpos[i][j] = 0;
+ for (Enumeration<String> en = propHash.keys(); en.hasMoreElements();)
+ {
+ String ph = en.nextElement();
+ Map<String, Integer> pph = (Map<String, Integer>) propHash
+ .get(ph);
+ if (pph.get(ic) != null && pph.get(jc) != null)
+ {
+ int icp = pph.get(ic).intValue(), jcp = pph.get(jc).intValue();
+ // Still working on these definitions.
+ propMatrixPos[i][j] += icp == jcp && icp > 0 ? 2 : 0;
+ propMatrixPos[j][i] += icp == jcp && icp > 0 ? 2 : 0;
+ propMatrixF[i][j] += icp == jcp ? 2 : 0;
+ propMatrixF[j][i] += icp == jcp ? 2 : 0;
+ propMatrixEpos[i][j] += icp == jcp ? (1 + icp * 2) : 0;
+ propMatrixEpos[j][i] += icp == jcp ? (1 + icp * 2) : 0;
+ }
+ }
+ if (maxF < propMatrixF[i][j])
+ {
+ maxF = propMatrixF[i][j];
+ }
+ if (maxP < propMatrixPos[i][j])
+ {
+ maxP = propMatrixPos[i][j];
+ }
+ if (maxEP < propMatrixEpos[i][j])
+ {
+ maxEP = propMatrixEpos[i][j];
+ }
+ }
+ propMatrixF[i][i] = maxF;
+ propMatrixPos[i][i] = maxP;
+ propMatrixEpos[i][i] = maxEP;
+ }
+ // JAL-1512 comment out physicochemical score matrices for 2.8.1 release
+ // scoreMatrices.put("Conservation Pos", new
+ // ScoreMatrix("Conservation Pos",propMatrixPos,0));
+ // scoreMatrices.put("Conservation Both", new
+ // ScoreMatrix("Conservation Both",propMatrixF,0));
+ // scoreMatrices.put("Conservation EnhPos", new
+ // ScoreMatrix("Conservation EnhPos",propMatrixEpos,0));
+ scoreMatrices.put("PID", new PIDScoreModel());
+ scoreMatrices.put("Displayed Features", new FeatureScoreModel());
+ }
private ResidueProperties()
{
@@ -1107,7 +1431,7 @@ public class ResidueProperties
return hyd;
}
- public static Hashtable getAA3Hash()
+ public static Map<String, Integer> getAA3Hash()
{
return aa3Hash;
}
@@ -1157,20 +1481,29 @@ public class ResidueProperties
public static String codonTranslate(String lccodon)
{
+ if (false)
+ {
+ return _codonTranslate(lccodon);
+ }
+ String cdn = codonHash2.get(lccodon.toUpperCase());
+ if ("*".equals(cdn))
+ {
+ return "STOP";
+ }
+ return cdn;
+ }
+
+ public static String _codonTranslate(String lccodon)
+ {
String codon = lccodon.toUpperCase();
// all base ambiguity codes yield an 'X' amino acid residue
if (codon.indexOf('X') > -1 || codon.indexOf('N') > -1)
{
return "X";
}
- Enumeration e = codonHash.keys();
-
- while (e.hasMoreElements())
+ for (String key : codonHash.keySet())
{
- String key = (String) e.nextElement();
- Vector tmp = (Vector) codonHash.get(key);
-
- if (tmp.contains(codon))
+ if (codonHash.get(key).contains(codon))
{
return key;
}
@@ -1198,13 +1531,24 @@ public class ResidueProperties
public static ScoreMatrix getScoreMatrix(String pwtype)
{
Object val = scoreMatrices.get(pwtype);
- if (val != null)
+ if (val != null && val instanceof ScoreMatrix)
{
return (ScoreMatrix) val;
}
return null;
}
+ /**
+ * get a ScoreModel based on its string name
+ *
+ * @param pwtype
+ * @return scoremodel of type pwtype or null
+ */
+ public static ScoreModelI getScoreModel(String pwtype)
+ {
+ return scoreMatrices.get(pwtype);
+ }
+
public static int getPAM250(char c, char d)
{
int a = aaIndex[c];
@@ -1258,6 +1602,141 @@ public class ResidueProperties
return ss.toString();
}
+ /**
+ * Used by getRNASecStrucState
+ *
+ */
+ public static Hashtable<String, String> toRNAssState;
+
+ public static boolean RNAcloseParen[] = new boolean[255];
+ static
+ {
+ toRNAssState = new Hashtable<String, String>();
+ toRNAssState.put(")", "(");
+ toRNAssState.put("(", "(");
+ toRNAssState.put("]", "[");
+ toRNAssState.put("[", "[");
+ toRNAssState.put("{", "{");
+ toRNAssState.put("}", "{");
+ toRNAssState.put(">", ">");
+ toRNAssState.put("<", ">");
+ toRNAssState.put("A", "A");
+ toRNAssState.put("a", "A");
+ toRNAssState.put("B", "B");
+ toRNAssState.put("b", "B");
+ toRNAssState.put("C", "C");
+ toRNAssState.put("c", "C");
+ toRNAssState.put("D", "D");
+ toRNAssState.put("d", "D");
+ toRNAssState.put("E", "E");
+ toRNAssState.put("e", "E");
+ toRNAssState.put("F", "F");
+ toRNAssState.put("f", "F");
+ toRNAssState.put("G", "G");
+ toRNAssState.put("g", "G");
+ toRNAssState.put("H", "H");
+ toRNAssState.put("h", "H");
+ toRNAssState.put("I", "I");
+ toRNAssState.put("i", "I");
+ toRNAssState.put("J", "J");
+ toRNAssState.put("j", "J");
+ toRNAssState.put("K", "K");
+ toRNAssState.put("k", "K");
+ toRNAssState.put("L", "L");
+ toRNAssState.put("l", "L");
+ toRNAssState.put("M", "M");
+ toRNAssState.put("m", "M");
+ toRNAssState.put("N", "N");
+ toRNAssState.put("n", "N");
+ toRNAssState.put("O", "O");
+ toRNAssState.put("o", "O");
+ toRNAssState.put("P", "P");
+ toRNAssState.put("p", "P");
+ toRNAssState.put("Q", "Q");
+ toRNAssState.put("q", "Q");
+ toRNAssState.put("R", "R");
+ toRNAssState.put("r", "R");
+ toRNAssState.put("S", "S");
+ toRNAssState.put("s", "S");
+ toRNAssState.put("T", "T");
+ toRNAssState.put("t", "T");
+ toRNAssState.put("U", "U");
+ toRNAssState.put("u", "U");
+ toRNAssState.put("V", "V");
+ toRNAssState.put("v", "V");
+ toRNAssState.put("W", "W");
+ toRNAssState.put("w", "W");
+ toRNAssState.put("X", "X");
+ toRNAssState.put("x", "X");
+ toRNAssState.put("Y", "Y");
+ toRNAssState.put("y", "Y");
+ toRNAssState.put("Z", "Z");
+ toRNAssState.put("z", "Z");
+ for (int p = 0; p < RNAcloseParen.length; p++)
+ {
+ RNAcloseParen[p] = false;
+ }
+ for (String k : toRNAssState.keySet())
+ {
+ RNAcloseParen[k.charAt(0)] = k.charAt(0) != toRNAssState.get(k)
+ .charAt(0);
+ }
+ }
+
+ static
+ {
+ modifications.put("MSE", "MET"); // Selenomethionine
+ // the rest tbc; from
+ // http://sourceforge.net/p/jmol/mailman/message/12833570/
+ // modifications.put("CSE", "CYS"); // Selenocysteine
+ // modifications.put("PTR", "TYR"); // Phosphotyrosine
+ // modifications.put("SEP", "SER"); // Phosphoserine
+ // modifications.put("HYP", "PRO"); // 4-hydroxyproline
+ // modifications.put("5HP", "GLU"); // Pyroglutamic acid; 5-hydroxyproline
+ // modifications.put("PCA", "GLU"); // Pyroglutamic acid
+ // modifications.put("LYZ", "LYS"); // 5-hydroxylysine
+ }
+
+ public static String getCanonicalAminoAcid(String aa)
+ {
+ String canonical = modifications.get(aa);
+ return canonical == null ? aa : canonical;
+ }
+
+ /**
+ * translate to RNA secondary structure representation
+ *
+ * @param ssstring
+ * @return ssstring as a RNA-state secondary structure assignment.
+ */
+ public static String getRNASecStrucState(String ssstring)
+ {
+ if (ssstring == null)
+ {
+ return null;
+ }
+ StringBuffer ss = new StringBuffer();
+ for (int i = 0; i < ssstring.length(); i++)
+ {
+ String ssc = ssstring.substring(i, i + 1);
+ if (toRNAssState.containsKey(ssc))
+ {
+ // valid ss character - so return it
+ ss.append(ssc); // (String) toRNAssState.get(ssc));
+ }
+ else
+ {
+ ss.append(" ");
+ }
+ }
+ return ss.toString();
+ }
+
+ public static boolean isCloseParenRNA(char dc)
+ {
+ return RNAcloseParen[dc];
+ }
+
// main method generates perl representation of residue property hash
// / cut here
public static void main(String[] args)
@@ -1306,5 +1785,74 @@ public class ResidueProperties
}
System.out.println("};");
}
+
// to here
+
+ /**
+ * Returns a list of residue characters for the specified inputs
+ *
+ * @param nucleotide
+ * @param includeAmbiguous
+ * @return
+ */
+ public static List<String> getResidues(boolean nucleotide,
+ boolean includeAmbiguous)
+ {
+ List<String> result = new ArrayList<String>();
+ if (nucleotide)
+ {
+ for (String nuc : nucleotideName.keySet())
+ {
+ int val = nucleotideIndex[nuc.charAt(0)];
+ if ((!includeAmbiguous && val > 4) || (val >= maxNucleotideIndex))
+ {
+ continue;
+ }
+ nuc = nuc.toUpperCase();
+ if (!result.contains(nuc))
+ {
+ result.add(nuc);
+ }
+ }
+ }
+ else
+ {
+ /*
+ * Peptide
+ */
+ for (String res : aa3Hash.keySet())
+ {
+ int index = aa3Hash.get(res).intValue();
+ if ((!includeAmbiguous && index >= 20) || index >= maxProteinIndex)
+ {
+ continue;
+ }
+ res = res.toUpperCase();
+ if (!result.contains(res))
+ {
+ result.add(res);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the single letter code for a three letter code, or '0' if not known
+ *
+ * @param threeLetterCode
+ * not case sensitive
+ * @return
+ */
+ public static char getSingleCharacterCode(String threeLetterCode)
+ {
+ if (threeLetterCode == null)
+ {
+ return '0';
+ }
+ Integer index = ResidueProperties.aa3Hash.get(threeLetterCode
+ .toUpperCase());
+ return index == null ? '0' : aa[index].charAt(0);
+ }
}
diff --git a/src/jalview/schemes/ScoreColourScheme.java b/src/jalview/schemes/ScoreColourScheme.java
index 37dd9e5..fba1188 100644
--- a/src/jalview/schemes/ScoreColourScheme.java
+++ b/src/jalview/schemes/ScoreColourScheme.java
@@ -1,23 +1,28 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
/**
* DOCUMENT ME!
@@ -46,9 +51,10 @@ public class ScoreColourScheme extends ResidueColourScheme
* @param max
* DOCUMENT ME!
*/
- public ScoreColourScheme(double[] scores, double min, double max)
+ public ScoreColourScheme(int symbolIndex[], double[] scores, double min,
+ double max)
{
- super();
+ super(symbolIndex);
this.scores = scores;
this.min = min;
@@ -85,7 +91,8 @@ public class ScoreColourScheme extends ResidueColourScheme
*
* @return DOCUMENT ME!
*/
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
if (threshold > 0)
{
diff --git a/src/jalview/schemes/ScoreMatrix.java b/src/jalview/schemes/ScoreMatrix.java
index 6a4ceec..e2aa232 100644
--- a/src/jalview/schemes/ScoreMatrix.java
+++ b/src/jalview/schemes/ScoreMatrix.java
@@ -1,86 +1,173 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.schemes;
-
-public class ScoreMatrix
-{
- String name;
-
- /**
- * reference to integer score matrix
- */
- int[][] matrix;
-
- /**
- * 0 for Protein Score matrix. 1 for dna score matrix
- */
- int type;
-
- ScoreMatrix(String name, int[][] matrix, int type)
- {
- this.matrix = matrix;
- this.type = type;
- }
-
- public boolean isDNA()
- {
- return type == 1;
- }
-
- public boolean isProtein()
- {
- return type == 0;
- }
-
- public int[][] getMatrix()
- {
- return matrix;
- }
-
- /**
- *
- * @param A1
- * @param A2
- * @return score for substituting first char in A1 with first char in A2
- */
- public int getPairwiseScore(String A1, String A2)
- {
- return getPairwiseScore(A1.charAt(0), A2.charAt(0));
- }
-
- public int getPairwiseScore(char c, char d)
- {
- int pog = 0;
-
- try
- {
- int a = (type == 0) ? ResidueProperties.aaIndex[c]
- : ResidueProperties.nucleotideIndex[c];
- int b = (type == 0) ? ResidueProperties.aaIndex[d]
- : ResidueProperties.nucleotideIndex[d];
-
- pog = matrix[a][b];
- } catch (Exception e)
- {
- // System.out.println("Unknown residue in " + A1 + " " + A2);
- }
-
- return pog;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.schemes;
+
+import jalview.analysis.scoremodels.PairwiseSeqScoreModel;
+import jalview.api.analysis.ScoreModelI;
+
+public class ScoreMatrix extends PairwiseSeqScoreModel implements
+ ScoreModelI
+{
+ String name;
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * reference to integer score matrix
+ */
+ int[][] matrix;
+
+ /**
+ * 0 for Protein Score matrix. 1 for dna score matrix
+ */
+ int type;
+
+ /**
+ *
+ * @param name
+ * Unique, human readable name for the matrix
+ * @param matrix
+ * Pairwise scores indexed according to appropriate symbol alphabet
+ * @param type
+ * 0 for Protein, 1 for NA
+ */
+ ScoreMatrix(String name, int[][] matrix, int type)
+ {
+ this.matrix = matrix;
+ this.type = type;
+ this.name = name;
+ }
+
+ @Override
+ public boolean isDNA()
+ {
+ return type == 1;
+ }
+
+ @Override
+ public boolean isProtein()
+ {
+ return type == 0;
+ }
+
+ @Override
+ public int[][] getMatrix()
+ {
+ return matrix;
+ }
+
+ /**
+ *
+ * @param A1
+ * @param A2
+ * @return score for substituting first char in A1 with first char in A2
+ */
+ public int getPairwiseScore(String A1, String A2)
+ {
+ return getPairwiseScore(A1.charAt(0), A2.charAt(0));
+ }
+
+ public int getPairwiseScore(char c, char d)
+ {
+ int pog = 0;
+
+ try
+ {
+ int a = (type == 0) ? ResidueProperties.aaIndex[c]
+ : ResidueProperties.nucleotideIndex[c];
+ int b = (type == 0) ? ResidueProperties.aaIndex[d]
+ : ResidueProperties.nucleotideIndex[d];
+
+ pog = matrix[a][b];
+ } catch (Exception e)
+ {
+ // System.out.println("Unknown residue in " + A1 + " " + A2);
+ }
+
+ return pog;
+ }
+
+ /**
+ * pretty print the matrix
+ */
+ public String toString()
+ {
+ return outputMatrix(false);
+ }
+
+ public String outputMatrix(boolean html)
+ {
+ StringBuffer sb = new StringBuffer();
+ int[] symbols = (type == 0) ? ResidueProperties.aaIndex
+ : ResidueProperties.nucleotideIndex;
+ int symMax = (type == 0) ? ResidueProperties.maxProteinIndex
+ : ResidueProperties.maxNucleotideIndex;
+ boolean header = true;
+ if (html)
+ {
+ sb.append("<table border=\"1\">");
+ }
+ for (char sym = 'A'; sym <= 'Z'; sym++)
+ {
+ if (symbols[sym] >= 0 && symbols[sym] < symMax)
+ {
+ if (header)
+ {
+ sb.append(html ? "<tr><td></td>" : "");
+ for (char sym2 = 'A'; sym2 <= 'Z'; sym2++)
+ {
+ if (symbols[sym2] >= 0 && symbols[sym2] < symMax)
+ {
+ sb.append((html ? "<td> " : "\t") + sym2
+ + (html ? " </td>" : ""));
+ }
+ }
+ header = false;
+ sb.append(html ? "</tr>\n" : "\n");
+ }
+ if (html)
+ {
+ sb.append("<tr>");
+ }
+ sb.append((html ? "<td>" : "") + sym + (html ? "</td>" : ""));
+ for (char sym2 = 'A'; sym2 <= 'Z'; sym2++)
+ {
+ if (symbols[sym2] >= 0 && symbols[sym2] < symMax)
+ {
+ sb.append((html ? "<td>" : "\t")
+ + matrix[symbols[sym]][symbols[sym2]]
+ + (html ? "</td>" : ""));
+ }
+ }
+ sb.append(html ? "</tr>\n" : "\n");
+ }
+ }
+ if (html)
+ {
+ sb.append("</table>");
+ }
+ return sb.toString();
+ }
+}
diff --git a/src/jalview/schemes/StrandColourScheme.java b/src/jalview/schemes/StrandColourScheme.java
index 5de9cdb..6fe4013 100644
--- a/src/jalview/schemes/StrandColourScheme.java
+++ b/src/jalview/schemes/StrandColourScheme.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import java.awt.Color;
/**
* DOCUMENT ME!
@@ -32,8 +35,8 @@ public class StrandColourScheme extends ScoreColourScheme
*/
public StrandColourScheme()
{
- super(ResidueProperties.strand, ResidueProperties.strandmin,
- ResidueProperties.strandmax);
+ super(ResidueProperties.aaIndex, ResidueProperties.strand,
+ ResidueProperties.strandmin, ResidueProperties.strandmax);
}
/**
diff --git a/src/jalview/schemes/TCoffeeColourScheme.java b/src/jalview/schemes/TCoffeeColourScheme.java
new file mode 100644
index 0000000..bc56281
--- /dev/null
+++ b/src/jalview/schemes/TCoffeeColourScheme.java
@@ -0,0 +1,140 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.schemes;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+import jalview.io.TCoffeeScoreFile;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+/**
+ * Defines the color score for T-Coffee MSA
+ * <p>
+ * See http://tcoffee.org
+ *
+ *
+ * @author Paolo Di Tommaso
+ *
+ */
+public class TCoffeeColourScheme extends ResidueColourScheme
+{
+
+ static final Color[] colors = { new Color(102, 102, 255), // #6666FF
+ new Color(0, 255, 0), // #00FF00
+ new Color(102, 255, 0), // #66FF00
+ new Color(204, 255, 0), // #CCFF00
+ new Color(255, 255, 0), // #FFFF00
+ new Color(255, 204, 0), // #FFCC00
+ new Color(255, 153, 0), // #FF9900
+ new Color(255, 102, 0), // #FF6600
+ new Color(255, 51, 0), // #FF3300
+ new Color(255, 34, 0) // #FF2000
+ };
+
+ IdentityHashMap<SequenceI, Color[]> seqMap;
+
+ /**
+ * the color scheme needs to look at the alignment to get and cache T-COFFEE
+ * scores
+ *
+ * @param alignment
+ * - annotated sequences to be searched
+ */
+ public TCoffeeColourScheme(AnnotatedCollectionI alignment)
+ {
+ alignmentChanged(alignment, null);
+ }
+
+ @Override
+ public void alignmentChanged(AnnotatedCollectionI alignment,
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
+ {
+ // TODO: if sequences have been represented and they have scores, could
+ // compute an average sequence score for the representative
+
+ // assume only one set of TCOFFEE scores - but could have more than one
+ // potentially.
+ ArrayList<AlignmentAnnotation> annots = new ArrayList<AlignmentAnnotation>();
+ // Search alignment to get all tcoffee annotation and pick one set of
+ // annotation to use to colour seqs.
+ seqMap = new IdentityHashMap<SequenceI, Color[]>();
+ AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment
+ : alignment.getContext();
+ int w = 0;
+ for (AlignmentAnnotation al : alcontext
+ .findAnnotation(TCoffeeScoreFile.TCOFFEE_SCORE))
+ {
+ if (al.sequenceRef != null && !al.belowAlignment)
+ {
+ annots.add(al);
+ if (w < al.annotations.length)
+ {
+ w = al.annotations.length;
+ }
+ Color[] scores = new Color[al.annotations.length];
+ int i = 0;
+ for (Annotation an : al.annotations)
+ {
+ scores[i++] = (an != null) ? an.colour : Color.white;
+ }
+ seqMap.put(al.sequenceRef, scores);
+ }
+ }
+ // TODO: compute average colour for each symbol type in each column - gives
+ // a second order colourscheme for colouring a sequence logo derived from
+ // the alignment (colour reflects quality of alignment for each residue
+ // class)
+ }
+
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
+ {
+ Color[] cols;
+
+ if (seqMap == null || (cols = seqMap.get(seq)) == null)
+ {
+ // see above TODO about computing a colour for each residue in each
+ // column: cc = _rcols[i][indexFor[c]];
+ return Color.white;
+ }
+
+ if (j < 0 || j >= cols.length)
+ {
+ return Color.white;
+ }
+ return cols[j];
+ }
+
+ @Override
+ public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ {
+ return new TCoffeeColourScheme(sg);
+ }
+}
diff --git a/src/jalview/schemes/TaylorColourScheme.java b/src/jalview/schemes/TaylorColourScheme.java
index 3416a51..da7d265 100644
--- a/src/jalview/schemes/TaylorColourScheme.java
+++ b/src/jalview/schemes/TaylorColourScheme.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
@@ -21,6 +24,6 @@ public class TaylorColourScheme extends ResidueColourScheme
{
public TaylorColourScheme()
{
- super(ResidueProperties.taylor, 0);
+ super(ResidueProperties.aaIndex, ResidueProperties.taylor, 0);
}
}
diff --git a/src/jalview/schemes/TurnColourScheme.java b/src/jalview/schemes/TurnColourScheme.java
index 208db8d..c0a4e3c 100644
--- a/src/jalview/schemes/TurnColourScheme.java
+++ b/src/jalview/schemes/TurnColourScheme.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.awt.*;
+import java.awt.Color;
/**
* DOCUMENT ME!
@@ -32,8 +35,8 @@ public class TurnColourScheme extends ScoreColourScheme
*/
public TurnColourScheme()
{
- super(ResidueProperties.turn, ResidueProperties.turnmin,
- ResidueProperties.turnmax);
+ super(ResidueProperties.aaIndex, ResidueProperties.turn,
+ ResidueProperties.turnmin, ResidueProperties.turnmax);
}
/**
diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java
index b6602ea..89f3eed 100644
--- a/src/jalview/schemes/UserColourScheme.java
+++ b/src/jalview/schemes/UserColourScheme.java
@@ -1,25 +1,32 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
-import java.util.*;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
-import java.awt.*;
+import java.awt.Color;
+import java.util.Map;
+import java.util.StringTokenizer;
public class UserColourScheme extends ResidueColourScheme
{
@@ -29,15 +36,33 @@ public class UserColourScheme extends ResidueColourScheme
public UserColourScheme()
{
+ super(ResidueProperties.aaIndex);
}
public UserColourScheme(Color[] newColors)
{
+ super(ResidueProperties.aaIndex);
colors = newColors;
}
+ @Override
+ public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ {
+ UserColourScheme usc = new UserColourScheme(colors);
+ if (lowerCaseColours != null)
+ {
+ usc.schemeName = new String(schemeName);
+ usc.lowerCaseColours = new Color[lowerCaseColours.length];
+ System.arraycopy(lowerCaseColours, 0, usc.lowerCaseColours, 0,
+ lowerCaseColours.length);
+ }
+ return usc;
+ }
+
public UserColourScheme(String colour)
{
+ super(ResidueProperties.aaIndex);
Color col = getColourFromString(colour);
if (col == null)
@@ -139,6 +164,8 @@ public class UserColourScheme extends ResidueColourScheme
public void parseAppletParameter(String paramValue)
{
+ // TODO: need a function to generate appletParameter colour string from a
+ // UCS
StringTokenizer st = new StringTokenizer(paramValue, ";");
StringTokenizer st2;
String token = null, colour, residues;
@@ -201,7 +228,8 @@ public class UserColourScheme extends ResidueColourScheme
}
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour;
int index = ResidueProperties.aaIndex[c];
diff --git a/src/jalview/schemes/ZappoColourScheme.java b/src/jalview/schemes/ZappoColourScheme.java
index bc193fd..a313767 100644
--- a/src/jalview/schemes/ZappoColourScheme.java
+++ b/src/jalview/schemes/ZappoColourScheme.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.schemes;
@@ -30,6 +33,6 @@ public class ZappoColourScheme extends ResidueColourScheme
*/
public ZappoColourScheme()
{
- super(ResidueProperties.zappo, 0);
+ super(ResidueProperties.aaIndex, ResidueProperties.zappo, 0);
}
}
diff --git a/src/jalview/structure/AlignmentViewPanelListener.java b/src/jalview/structure/AlignmentViewPanelListener.java
index 5794a42..1c4babd 100644
--- a/src/jalview/structure/AlignmentViewPanelListener.java
+++ b/src/jalview/structure/AlignmentViewPanelListener.java
@@ -1,28 +1,32 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.structure;
import jalview.api.AlignmentViewPanel;
/**
* handler for alignmentViewPanel events
+ *
* @author jimp
- *
+ *
*/
public interface AlignmentViewPanelListener
{
diff --git a/src/jalview/structure/AtomSpec.java b/src/jalview/structure/AtomSpec.java
new file mode 100644
index 0000000..6dbc557
--- /dev/null
+++ b/src/jalview/structure/AtomSpec.java
@@ -0,0 +1,85 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.structure;
+
+/**
+ * Java bean representing an atom in a PDB (or similar) structure model or
+ * viewer
+ *
+ * @author gmcarstairs
+ *
+ */
+public class AtomSpec
+{
+ // TODO clarify do we want pdbFile here, or pdbId?
+ // compare highlightAtom in 2.8.2 for JalviewJmolBinding and
+ // javascript.MouseOverStructureListener
+ private String pdbFile;
+
+ private String chain;
+
+ private int pdbResNum;
+
+ private int atomIndex;
+
+ /**
+ * Constructor
+ *
+ * @param pdbFile
+ * @param chain
+ * @param resNo
+ * @param atomNo
+ */
+ public AtomSpec(String pdbFile, String chain, int resNo, int atomNo)
+ {
+ this.pdbFile = pdbFile;
+ this.chain = chain;
+ this.pdbResNum = resNo;
+ this.atomIndex = atomNo;
+ }
+
+ public String getPdbFile()
+ {
+ return pdbFile;
+ }
+
+ public String getChain()
+ {
+ return chain;
+ }
+
+ public int getPdbResNum()
+ {
+ return pdbResNum;
+ }
+
+ public int getAtomIndex()
+ {
+ return atomIndex;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "pdbFile: " + pdbFile + ", chain: " + chain + ", res: "
+ + pdbResNum + ", atom: " + atomIndex;
+ }
+}
diff --git a/src/jalview/structure/CommandListener.java b/src/jalview/structure/CommandListener.java
new file mode 100644
index 0000000..a8df3c8
--- /dev/null
+++ b/src/jalview/structure/CommandListener.java
@@ -0,0 +1,55 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.structure;
+
+import jalview.commands.CommandI;
+
+/**
+ * Defines a listener for commands performed on another alignment. This is to
+ * support linked editing of two alternative representations of an alignment (in
+ * particular, cDNA and protein).
+ *
+ * @author gmcarstairs
+ *
+ */
+public interface CommandListener
+{
+ /**
+ * The listener may attempt to perform the specified command; the region acted
+ * on is determined by a callback to the StructureSelectionManager (which
+ * holds mappings between alignments).
+ *
+ * @param command
+ * @param undo
+ * @param ssm
+ * @param source
+ * the originator of the command
+ */
+ public void mirrorCommand(CommandI command, boolean undo,
+ StructureSelectionManager ssm, VamsasSource source);
+
+ /**
+ * Temporary workaround to make check for source == listener work.
+ *
+ * @return
+ */
+ public VamsasSource getVamsasSource();
+}
diff --git a/src/jalview/structure/SecondaryStructureListener.java b/src/jalview/structure/SecondaryStructureListener.java
new file mode 100644
index 0000000..c8be34c
--- /dev/null
+++ b/src/jalview/structure/SecondaryStructureListener.java
@@ -0,0 +1,39 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.structure;
+
+import jalview.datamodel.SequenceI;
+
+public interface SecondaryStructureListener
+{
+ // TODO - redefine to allow RNA mouseovers to be passed back correctly to
+ // listeners
+ /**
+ * act on a mouseover event
+ *
+ * @param sequence
+ * @param index
+ * the aligned sequence position (base 0)
+ * @param position
+ * the dataset sequence position (base 1)
+ */
+ public void mouseOverSequence(SequenceI sequence, int index, int position);
+}
diff --git a/src/jalview/structure/SelectionListener.java b/src/jalview/structure/SelectionListener.java
index c4bb355..582cfd8 100644
--- a/src/jalview/structure/SelectionListener.java
+++ b/src/jalview/structure/SelectionListener.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.structure;
diff --git a/src/jalview/structure/SelectionSource.java b/src/jalview/structure/SelectionSource.java
index 1cf7007..b1bf009 100644
--- a/src/jalview/structure/SelectionSource.java
+++ b/src/jalview/structure/SelectionSource.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.structure;
diff --git a/src/jalview/structure/SequenceListener.java b/src/jalview/structure/SequenceListener.java
index f7ba696..c44aa0b 100644
--- a/src/jalview/structure/SequenceListener.java
+++ b/src/jalview/structure/SequenceListener.java
@@ -1,29 +1,37 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.structure;
-import jalview.datamodel.*;
+import jalview.datamodel.SequenceI;
public interface SequenceListener
{
+ // TODO remove this? never called on SequenceListener type
public void mouseOverSequence(SequenceI sequence, int index, int pos);
public void highlightSequence(jalview.datamodel.SearchResults results);
+ // TODO remove this? never called
public void updateColours(SequenceI sequence, int index);
+
+ public VamsasSource getVamsasSource();
+
}
diff --git a/src/jalview/structure/StructureListener.java b/src/jalview/structure/StructureListener.java
index c2d1ecb..755fd0c 100644
--- a/src/jalview/structure/StructureListener.java
+++ b/src/jalview/structure/StructureListener.java
@@ -1,68 +1,69 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.structure;
+import jalview.datamodel.SequenceI;
+
+import java.util.List;
+
public interface StructureListener
{
/**
- *
- * @return list of structure files (unique IDs/filenames) that this listener handles messages for, or null if generic listener (only used by removeListener method)
+ * Returns a list of structure files (unique IDs/filenames) that this listener
+ * handles messages for, or null if generic listener (only used by
+ * removeListener method)
*/
public String[] getPdbFile();
/**
- * NOT A LISTENER METHOD!
- * called by structure viewer when the given atom/structure has been moused over. Typically, implementors call StructureSelectionManager.mouseOverStructure
- * @param atomIndex
- * @param strInfo
- */
- public void mouseOverStructure(int atomIndex, String strInfo);
-
- /**
- * called by StructureSelectionManager to inform viewer to highlight given atomspec
- * @param atomIndex
- * @param pdbResNum
- * @param chain
- * @param pdbId
+ * Called by StructureSelectionManager to inform viewer to highlight given
+ * atom positions
+ *
+ * @param atoms
*/
- public void highlightAtom(int atomIndex, int pdbResNum, String chain,
- String pdbId);
+ public void highlightAtoms(List<AtomSpec> atoms);
/**
- * called by StructureSelectionManager when the colours of a sequence associated with a structure have changed.
- * @param source (untyped) usually an alignPanel
+ * Called by StructureSelectionManager when the colours of a sequence
+ * associated with a structure have changed.
+ *
+ * @param source
+ * (untyped) usually an alignPanel
*/
public void updateColours(Object source);
/**
- * called by Jalview to get the colour for the given atomspec
- * @param atomIndex
- * @param pdbResNum
- * @param chain
- * @param pdbId
- * @return
+ * Called by structureSelectionManager to instruct implementor to release any
+ * direct references it may hold to the given object (typically, these are
+ * Jalview alignment panels).
+ *
+ * @param svl
*/
- public java.awt.Color getColour(int atomIndex, int pdbResNum,
- String chain, String pdbId);
+ public void releaseReferences(Object svl);
/**
- * called by structureSelectionManager to instruct implementor to release any direct references it may hold to the given object (typically, these are Jalview alignment panels).
- * @param svl
+ * Answers true if this listener is interested in the given sequence
+ *
+ * @param seq
+ * @return
*/
- public void releaseReferences(Object svl);
+ public boolean isListeningFor(SequenceI seq);
}
diff --git a/src/jalview/structure/StructureMapping.java b/src/jalview/structure/StructureMapping.java
index 84e25ba..147cc07 100644
--- a/src/jalview/structure/StructureMapping.java
+++ b/src/jalview/structure/StructureMapping.java
@@ -1,23 +1,27 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.structure;
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceI;
public class StructureMapping
{
@@ -60,6 +64,11 @@ public class StructureMapping
return pdbid;
}
+ /**
+ *
+ * @param seqpos
+ * @return 0 or corresponding atom number for the sequence position
+ */
public int getAtomNum(int seqpos)
{
if (mapping.length > seqpos)
@@ -72,6 +81,11 @@ public class StructureMapping
}
}
+ /**
+ *
+ * @param seqpos
+ * @return 0 or the corresponding residue number for the sequence position
+ */
public int getPDBResNum(int seqpos)
{
if (mapping.length > seqpos)
@@ -84,6 +98,11 @@ public class StructureMapping
}
}
+ /**
+ *
+ * @param pdbResNum
+ * @return -1 or the corresponding sequence position for a pdb residue number
+ */
public int getSeqPos(int pdbResNum)
{
for (int i = 0; i < mapping.length; i++)
@@ -95,4 +114,37 @@ public class StructureMapping
}
return -1;
}
+
+ /**
+ * transfer a copy of an alignment annotation row in the PDB chain coordinate
+ * system onto the mapped sequence
+ *
+ * @param ana
+ * @return the copy that was remapped to the mapped sequence
+ * @note this method will create a copy and add it to the dataset sequence for
+ * the mapped sequence as well as the mapped sequence (if it is not a
+ * dataset sequence).
+ */
+ public AlignmentAnnotation transfer(AlignmentAnnotation ana)
+ {
+ AlignmentAnnotation ala_copy = new AlignmentAnnotation(ana);
+ SequenceI ds = sequence;
+ while (ds.getDatasetSequence() != null)
+ {
+ ds = ds.getDatasetSequence();
+ }
+ // need to relocate annotation from pdb coordinates to local sequence
+ // -1,-1 doesn't look at pdbresnum but fails to remap sequence positions...
+
+ ala_copy.remap(ds, mapping, -1, -1, 0);
+ ds.addAlignmentAnnotation(ala_copy);
+ if (ds != sequence)
+ {
+ // mapping wasn't to an original dataset sequence, so we make a copy on
+ // the mapped sequence too
+ ala_copy = new AlignmentAnnotation(ala_copy);
+ sequence.addAlignmentAnnotation(ala_copy);
+ }
+ return ala_copy;
+ }
}
diff --git a/src/jalview/structure/StructureMappingcommandSet.java b/src/jalview/structure/StructureMappingcommandSet.java
index 44631a8..c61d90a 100644
--- a/src/jalview/structure/StructureMappingcommandSet.java
+++ b/src/jalview/structure/StructureMappingcommandSet.java
@@ -1,51 +1,62 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.structure;
-
/**
* holder for script commands generated for a particular structure mapping
+ *
* @author jimp
- *
+ *
*/
-public class StructureMappingcommandSet {
+public class StructureMappingcommandSet
+{
/**
* structure file for which these commands were generated
*/
public String mapping;
+
/**
* set of commands
*/
public String[] commands;
+
/**
- * some object that indicates what the commands can be parsed by (eg JmolCommands.class implies these are Jmol commands)
+ * some object that indicates what the commands can be parsed by (eg
+ * JmolCommands.class implies these are Jmol commands)
*/
public Object handledBy;
+
/**
- * record the originating command generator, the structure mapping involved, and the set of commands to be passed.
+ * record the originating command generator, the structure mapping involved,
+ * and the set of commands to be passed.
+ *
* @param handledBy
* @param files
* @param commands
*/
- public StructureMappingcommandSet(Object handledBy, String files, String[] commands)
+ public StructureMappingcommandSet(Object handledBy, String files,
+ String[] commands)
{
- this.mapping=files;
- this.handledBy=handledBy;
- this.commands=commands;
+ this.mapping = files;
+ this.handledBy = handledBy;
+ this.commands = commands;
}
}
diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java
index f9e8fdb..c30908c 100644
--- a/src/jalview/structure/StructureSelectionManager.java
+++ b/src/jalview/structure/StructureSelectionManager.java
@@ -1,64 +1,235 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.structure;
-import java.io.*;
-import java.util.*;
-
-import MCview.*;
-import jalview.analysis.*;
-import jalview.api.AlignmentViewPanel;
+import jalview.analysis.AlignSeq;
import jalview.api.StructureSelectionManagerProvider;
-import jalview.datamodel.*;
+import jalview.commands.CommandI;
+import jalview.commands.EditCommand;
+import jalview.commands.OrderCommand;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceI;
+import jalview.io.AppletFormatAdapter;
+import jalview.util.MappingUtils;
+import jalview.util.MessageManager;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import MCview.Atom;
+import MCview.PDBChain;
+import MCview.PDBfile;
public class StructureSelectionManager
{
- static IdentityHashMap<StructureSelectionManagerProvider,StructureSelectionManager> instances;
+ public final static String NEWLINE = System.lineSeparator();
+
+ static IdentityHashMap<StructureSelectionManagerProvider, StructureSelectionManager> instances;
+
+ private List<StructureMapping> mappings = new ArrayList<StructureMapping>();
+
+ private boolean processSecondaryStructure = false;
+
+ private boolean secStructServices = false;
+
+ private boolean addTempFacAnnot = false;
+
+ /*
+ * Set of any registered mappings between (dataset) sequences.
+ */
+ public Set<AlignedCodonFrame> seqmappings = new LinkedHashSet<AlignedCodonFrame>();
+
+ private List<CommandListener> commandListeners = new ArrayList<CommandListener>();
+
+ private List<SelectionListener> sel_listeners = new ArrayList<SelectionListener>();
+
+ /**
+ * @return true if will try to use external services for processing secondary
+ * structure
+ */
+ public boolean isSecStructServices()
+ {
+ return secStructServices;
+ }
+
+ /**
+ * control use of external services for processing secondary structure
+ *
+ * @param secStructServices
+ */
+ public void setSecStructServices(boolean secStructServices)
+ {
+ this.secStructServices = secStructServices;
+ }
- StructureMapping[] mappings;
+ /**
+ * flag controlling addition of any kind of structural annotation
+ *
+ * @return true if temperature factor annotation will be added
+ */
+ public boolean isAddTempFacAnnot()
+ {
+ return addTempFacAnnot;
+ }
+
+ /**
+ * set flag controlling addition of structural annotation
+ *
+ * @param addTempFacAnnot
+ */
+ public void setAddTempFacAnnot(boolean addTempFacAnnot)
+ {
+ this.addTempFacAnnot = addTempFacAnnot;
+ }
+
+ /**
+ *
+ * @return if true, the structure manager will attempt to add secondary
+ * structure lines for unannotated sequences
+ */
+
+ public boolean isProcessSecondaryStructure()
+ {
+ return processSecondaryStructure;
+ }
+
+ /**
+ * Control whether structure manager will try to annotate mapped sequences
+ * with secondary structure from PDB data.
+ *
+ * @param enable
+ */
+ public void setProcessSecondaryStructure(boolean enable)
+ {
+ processSecondaryStructure = enable;
+ }
/**
* debug function - write all mappings to stdout
*/
- public void reportMapping() {
- if (mappings==null)
- {
- System.err.println("reportMapping: No PDB/Sequence mappings.");
- }else{
- System.err.println("reportMapping: There are "+mappings.length+" mappings.");
- for (int m=0;m<mappings.length;m++)
- {
- System.err.println("mapping "+m+" : "+mappings[m].pdbfile);
- }
- }
- }
- Hashtable mappingData = new Hashtable();
-
- public static StructureSelectionManager getStructureSelectionManager(StructureSelectionManagerProvider context)
+ public void reportMapping()
+ {
+ if (mappings.isEmpty())
+ {
+ System.err.println("reportMapping: No PDB/Sequence mappings.");
+ }
+ else
+ {
+ System.err.println("reportMapping: There are " + mappings.size()
+ + " mappings.");
+ int i = 0;
+ for (StructureMapping sm : mappings)
+ {
+ System.err.println("mapping " + i++ + " : " + sm.pdbfile);
+ }
+ }
+ }
+
+ /**
+ * map between the PDB IDs (or structure identifiers) used by Jalview and the
+ * absolute filenames for PDB data that corresponds to it
+ */
+ Map<String, String> pdbIdFileName = new HashMap<String, String>();
+
+ Map<String, String> pdbFileNameId = new HashMap<String, String>();
+
+ public void registerPDBFile(String idForFile, String absoluteFile)
+ {
+ pdbIdFileName.put(idForFile, absoluteFile);
+ pdbFileNameId.put(absoluteFile, idForFile);
+ }
+
+ public String findIdForPDBFile(String idOrFile)
+ {
+ String id = pdbFileNameId.get(idOrFile);
+ return id;
+ }
+
+ public String findFileForPDBId(String idOrFile)
+ {
+ String id = pdbIdFileName.get(idOrFile);
+ return id;
+ }
+
+ public boolean isPDBFileRegistered(String idOrFile)
+ {
+ return pdbFileNameId.containsKey(idOrFile)
+ || pdbIdFileName.containsKey(idOrFile);
+ }
+
+ private static StructureSelectionManager nullProvider = null;
+
+ public static StructureSelectionManager getStructureSelectionManager(
+ StructureSelectionManagerProvider context)
{
+ if (context == null)
+ {
+ if (nullProvider == null)
+ {
+ if (instances != null)
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_structure_selection_manager_null"),
+ new NullPointerException(MessageManager
+ .getString("exception.ssm_context_is_null")));
+ }
+ else
+ {
+ nullProvider = new StructureSelectionManager();
+ }
+ return nullProvider;
+ }
+ }
if (instances == null)
{
- instances = new java.util.IdentityHashMap<StructureSelectionManagerProvider,StructureSelectionManager>();
+ instances = new java.util.IdentityHashMap<StructureSelectionManagerProvider, StructureSelectionManager>();
}
- StructureSelectionManager instance=instances.get(context);
- if (instance==null)
+ StructureSelectionManager instance = instances.get(context);
+ if (instance == null)
{
- instances.put(context, instance=new StructureSelectionManager());
+ if (nullProvider != null)
+ {
+ instance = nullProvider;
+ }
+ else
+ {
+ instance = new StructureSelectionManager();
+ }
+ instances.put(context, instance);
}
return instance;
}
@@ -96,6 +267,7 @@ public class StructureSelectionManager
/**
* register a listener for alignment sequence mouseover events
+ *
* @param svl
*/
public void addStructureViewerListener(Object svl)
@@ -106,25 +278,52 @@ public class StructureSelectionManager
}
}
+ /**
+ * Returns the file name for a mapped PDB id (or null if not mapped).
+ *
+ * @param pdbid
+ * @return
+ */
public String alreadyMappedToFile(String pdbid)
{
- if (mappings != null)
+ for (StructureMapping sm : mappings)
{
- for (int i = 0; i < mappings.length; i++)
+ if (sm.getPdbId().equals(pdbid))
{
- if (mappings[i].getPdbId().equals(pdbid))
- {
- return mappings[i].pdbfile;
- }
+ return sm.pdbfile;
}
}
return null;
}
/**
+ * Import structure data and register a structure mapping for broadcasting
+ * colouring, mouseovers and selection events (convenience wrapper).
+ *
+ * @param sequence
+ * - one or more sequences to be mapped to pdbFile
+ * @param targetChains
+ * - optional chain specification for mapping each sequence to pdb
+ * (may be nill, individual elements may be nill)
+ * @param pdbFile
+ * - structure data resource
+ * @param protocol
+ * - how to resolve data from resource
+ * @return null or the structure data parsed as a pdb file
+ */
+ synchronized public PDBfile setMapping(SequenceI[] sequence,
+ String[] targetChains, String pdbFile, String protocol)
+ {
+ return setMapping(true, sequence, targetChains, pdbFile, protocol);
+ }
+
+ /**
* create sequence structure mappings between each sequence and the given
* pdbFile (retrieved via the given protocol).
*
+ * @param forStructureView
+ * when true, record the mapping for use in mouseOvers
+ *
* @param sequence
* - one or more sequences to be mapped to pdbFile
* @param targetChains
@@ -136,36 +335,70 @@ public class StructureSelectionManager
* - how to resolve data from resource
* @return null or the structure data parsed as a pdb file
*/
- synchronized public MCview.PDBfile setMapping(SequenceI[] sequence,
- String[] targetChains, String pdbFile, String protocol)
+ synchronized public PDBfile setMapping(boolean forStructureView,
+ SequenceI[] sequence, String[] targetChains, String pdbFile,
+ String protocol)
{
/*
* There will be better ways of doing this in the future, for now we'll use
* the tried and tested MCview pdb mapping
*/
- MCview.PDBfile pdb = null;
+ boolean parseSecStr = processSecondaryStructure;
+ if (isPDBFileRegistered(pdbFile))
+ {
+ for (SequenceI sq : sequence)
+ {
+ SequenceI ds = sq;
+ while (ds.getDatasetSequence() != null)
+ {
+ ds = ds.getDatasetSequence();
+ }
+ ;
+ if (ds.getAnnotation() != null)
+ {
+ for (AlignmentAnnotation ala : ds.getAnnotation())
+ {
+ // false if any annotation present from this structure
+ // JBPNote this fails for jmol/chimera view because the *file* is
+ // passed, not the structure data ID -
+ if (PDBfile.isCalcIdForFile(ala, findIdForPDBFile(pdbFile)))
+ {
+ parseSecStr = false;
+ }
+ }
+ }
+ }
+ }
+ PDBfile pdb = null;
try
{
- pdb = new MCview.PDBfile(pdbFile, protocol);
+ pdb = new PDBfile(addTempFacAnnot, parseSecStr, secStructServices,
+ pdbFile, protocol);
+ if (pdb.id != null && pdb.id.trim().length() > 0
+ && AppletFormatAdapter.FILE.equals(protocol))
+ {
+ registerPDBFile(pdb.id.trim(), pdbFile);
+ }
} catch (Exception ex)
{
ex.printStackTrace();
return null;
}
-
+
String targetChain;
for (int s = 0; s < sequence.length; s++)
{
boolean infChain = true;
+ final SequenceI seq = sequence[s];
if (targetChains != null && targetChains[s] != null)
{
infChain = false;
targetChain = targetChains[s];
}
- else if (sequence[s].getName().indexOf("|") > -1)
+ else if (seq.getName().indexOf("|") > -1)
{
- targetChain = sequence[s].getName().substring(
- sequence[s].getName().lastIndexOf("|") + 1);
+ targetChain = seq.getName().substring(
+ seq.getName().lastIndexOf("|") + 1);
if (targetChain.length() > 1)
{
if (targetChain.trim().length() == 0)
@@ -180,28 +413,35 @@ public class StructureSelectionManager
}
}
else
+ {
targetChain = "";
+ }
+ /*
+ * Attempt pairwise alignment of the sequence with each chain in the PDB,
+ * and remember the highest scoring chain
+ */
int max = -10;
AlignSeq maxAlignseq = null;
String maxChainId = " ";
PDBChain maxChain = null;
boolean first = true;
- for (int i = 0; i < pdb.chains.size(); i++)
+ for (PDBChain chain : pdb.chains)
{
- PDBChain chain = ((PDBChain) pdb.chains.elementAt(i));
- if (targetChain.length() > 0 && !targetChain.equals(chain.id) && !infChain)
+ if (targetChain.length() > 0 && !targetChain.equals(chain.id)
+ && !infChain)
{
continue; // don't try to map chains don't match.
}
// TODO: correctly determine sequence type for mixed na/peptide
// structures
- AlignSeq as = new AlignSeq(sequence[s],
- ((PDBChain) pdb.chains.elementAt(i)).sequence,
- ((PDBChain) pdb.chains.elementAt(i)).isNa ? AlignSeq.DNA
- : AlignSeq.PEP);
- as.calcScoreMatrix();
- as.traceAlignment();
+ final String type = chain.isNa ? AlignSeq.DNA : AlignSeq.PEP;
+ AlignSeq as = AlignSeq.doGlobalNWAlignment(seq, chain.sequence,
+ type);
+ // equivalent to:
+ // AlignSeq as = new AlignSeq(sequence[s], chain.sequence, type);
+ // as.calcScoreMatrix();
+ // as.traceAlignment();
if (first || as.maxscore > max
|| (as.maxscore == max && chain.id.equals(targetChain)))
@@ -217,73 +457,84 @@ public class StructureSelectionManager
{
continue;
}
- final StringBuffer mappingDetails = new StringBuffer();
- mappingDetails.append("\n\nPDB Sequence is :\nSequence = "
- + maxChain.sequence.getSequenceAsString());
- mappingDetails.append("\nNo of residues = "
- + maxChain.residues.size() + "\n\n");
+ final StringBuilder mappingDetails = new StringBuilder(128);
+ mappingDetails.append(NEWLINE).append("PDB Sequence is :")
+ .append(NEWLINE).append("Sequence = ")
+ .append(maxChain.sequence.getSequenceAsString());
+ mappingDetails.append(NEWLINE).append("No of residues = ")
+ .append(maxChain.residues.size()).append(NEWLINE)
+ .append(NEWLINE);
PrintStream ps = new PrintStream(System.out)
{
+ @Override
public void print(String x)
{
mappingDetails.append(x);
}
+ @Override
public void println()
{
- mappingDetails.append("\n");
+ mappingDetails.append(NEWLINE);
}
};
maxAlignseq.printAlignment(ps);
- mappingDetails.append("\nPDB start/end " + maxAlignseq.seq2start
- + " " + maxAlignseq.seq2end);
- mappingDetails.append("\nSEQ start/end "
- + (maxAlignseq.seq1start + sequence[s].getStart() - 1) + " "
- + (maxAlignseq.seq1end + sequence[s].getEnd() - 1));
-
- maxChain.makeExactMapping(maxAlignseq, sequence[s]);
-
- maxChain.transferRESNUMFeatures(sequence[s], null);
+ mappingDetails.append(NEWLINE).append("PDB start/end ");
+ mappingDetails.append(String.valueOf(maxAlignseq.seq2start)).append(
+ " ");
+ mappingDetails.append(String.valueOf(maxAlignseq.seq2end));
+
+ mappingDetails.append(NEWLINE).append("SEQ start/end ");
+ mappingDetails.append(
+ String.valueOf(maxAlignseq.seq1start + seq.getStart() - 1))
+ .append(" ");
+ mappingDetails.append(String.valueOf(maxAlignseq.seq1end
+ + seq.getEnd() - 1));
+
+ maxChain.makeExactMapping(maxAlignseq, seq);
+ jalview.datamodel.Mapping sqmpping = maxAlignseq
+ .getMappingFromS1(false);
+ jalview.datamodel.Mapping omap = new jalview.datamodel.Mapping(
+ sqmpping.getMap().getInverse());
+ maxChain.transferRESNUMFeatures(seq, null);
// allocate enough slots to store the mapping from positions in
// sequence[s] to the associated chain
- int[][] mapping = new int[sequence[s].findPosition(sequence[s].getLength()) + 2][2];
+ int[][] mapping = new int[seq.findPosition(seq.getLength()) + 2][2];
int resNum = -10000;
int index = 0;
do
{
- Atom tmp = (Atom) maxChain.atoms.elementAt(index);
+ Atom tmp = maxChain.atoms.elementAt(index);
if (resNum != tmp.resNumber && tmp.alignmentMapping != -1)
{
resNum = tmp.resNumber;
- mapping[tmp.alignmentMapping + 1][0] = tmp.resNumber;
- mapping[tmp.alignmentMapping + 1][1] = tmp.atomIndex;
+ if (tmp.alignmentMapping >= -1)
+ {
+ // TODO (JAL-1836) address root cause: negative residue no in PDB
+ // file
+ mapping[tmp.alignmentMapping + 1][0] = tmp.resNumber;
+ mapping[tmp.alignmentMapping + 1][1] = tmp.atomIndex;
+ }
}
index++;
} while (index < maxChain.atoms.size());
- if (mappings == null)
+ if (protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
{
- mappings = new StructureMapping[1];
+ pdbFile = "INLINE" + pdb.id;
}
- else
+ StructureMapping newMapping = new StructureMapping(seq, pdbFile,
+ pdb.id, maxChainId, mapping, mappingDetails.toString());
+ if (forStructureView)
{
- StructureMapping[] tmp = new StructureMapping[mappings.length + 1];
- System.arraycopy(mappings, 0, tmp, 0, mappings.length);
- mappings = tmp;
+ mappings.add(newMapping);
}
-
- if (protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
- pdbFile = "INLINE" + pdb.id;
-
- mappings[mappings.length - 1] = new StructureMapping(sequence[s],
- pdbFile, pdb.id, maxChainId, mapping,
- mappingDetails.toString());
- maxChain.transferResidueAnnotation(mappings[mappings.length - 1]);
+ maxChain.transferResidueAnnotation(newMapping, sqmpping);
}
// ///////
@@ -295,127 +546,137 @@ public class StructureSelectionManager
listeners.removeElement(svl);
if (svl instanceof SequenceListener)
{
- for (int i=0;i<listeners.size();i++)
+ for (int i = 0; i < listeners.size(); i++)
{
if (listeners.elementAt(i) instanceof StructureListener)
{
- ((StructureListener)listeners.elementAt(i)).releaseReferences(svl);
+ ((StructureListener) listeners.elementAt(i))
+ .releaseReferences(svl);
}
}
}
-
+
if (pdbfiles == null)
{
return;
}
- boolean removeMapping = true;
- String[] handlepdbs;
- Vector pdbs = new Vector();
- for (int i = 0; i < pdbfiles.length; pdbs.addElement(pdbfiles[i++]))
- ;
+
+ /*
+ * Remove mappings to the closed listener's PDB files, but first check if
+ * another listener is still interested
+ */
+ List<String> pdbs = new ArrayList<String>(Arrays.asList(pdbfiles));
+
StructureListener sl;
for (int i = 0; i < listeners.size(); i++)
{
if (listeners.elementAt(i) instanceof StructureListener)
{
sl = (StructureListener) listeners.elementAt(i);
- handlepdbs = sl.getPdbFile();
- for (int j = 0; j < handlepdbs.length; j++)
+ for (String pdbfile : sl.getPdbFile())
{
- if (pdbs.contains(handlepdbs[j]))
- {
- pdbs.removeElement(handlepdbs[j]);
- }
+ pdbs.remove(pdbfile);
}
-
}
}
- if (pdbs.size() > 0 && mappings != null)
+ /*
+ * Rebuild the mappings set, retaining only those which are for 'other' PDB
+ * files
+ */
+ if (pdbs.size() > 0)
{
- Vector tmp = new Vector();
- for (int i = 0; i < mappings.length; i++)
+ List<StructureMapping> tmp = new ArrayList<StructureMapping>();
+ for (StructureMapping sm : mappings)
{
- if (!pdbs.contains(mappings[i].pdbfile))
+ if (!pdbs.contains(sm.pdbfile))
{
- tmp.addElement(mappings[i]);
+ tmp.add(sm);
}
}
- mappings = new StructureMapping[tmp.size()];
- tmp.copyInto(mappings);
+ mappings = tmp;
}
}
+ /**
+ * Propagate mouseover of a single position in a structure
+ *
+ * @param pdbResNum
+ * @param chain
+ * @param pdbfile
+ */
public void mouseOverStructure(int pdbResNum, String chain, String pdbfile)
{
- if (listeners==null)
+ AtomSpec atomSpec = new AtomSpec(pdbfile, chain, pdbResNum, 0);
+ List<AtomSpec> atoms = Collections.singletonList(atomSpec);
+ mouseOverStructure(atoms);
+ }
+
+ /**
+ * Propagate mouseover or selection of multiple positions in a structure
+ *
+ * @param atoms
+ */
+ public void mouseOverStructure(List<AtomSpec> atoms)
+ {
+ if (listeners == null)
{
// old or prematurely sent event
return;
}
- boolean hasSequenceListeners = handlingVamsasMo || seqmappings != null;
- SearchResults results = null;
- SequenceI lastseq = null;
- int lastipos = -1, indexpos;
+ boolean hasSequenceListener = false;
for (int i = 0; i < listeners.size(); i++)
{
if (listeners.elementAt(i) instanceof SequenceListener)
{
- if (results == null)
- {
- results = new SearchResults();
- }
- if (mappings != null)
+ hasSequenceListener = true;
+ }
+ }
+ if (!hasSequenceListener)
+ {
+ return;
+ }
+
+ SearchResults results = new SearchResults();
+ for (AtomSpec atom : atoms)
+ {
+ SequenceI lastseq = null;
+ int lastipos = -1;
+ for (StructureMapping sm : mappings)
+ {
+ if (sm.pdbfile.equals(atom.getPdbFile())
+ && sm.pdbchain.equals(atom.getChain()))
{
- for (int j = 0; j < mappings.length; j++)
+ int indexpos = sm.getSeqPos(atom.getPdbResNum());
+ if (lastipos != indexpos && lastseq != sm.sequence)
{
- if (mappings[j].pdbfile.equals(pdbfile)
- && mappings[j].pdbchain.equals(chain))
+ results.addResult(sm.sequence, indexpos, indexpos);
+ lastipos = indexpos;
+ lastseq = sm.sequence;
+ // construct highlighted sequence list
+ for (AlignedCodonFrame acf : seqmappings)
{
- indexpos = mappings[j].getSeqPos(pdbResNum);
- if (lastipos != indexpos && lastseq != mappings[j].sequence)
- {
- results.addResult(mappings[j].sequence, indexpos, indexpos);
- lastipos = indexpos;
- lastseq = mappings[j].sequence;
- // construct highlighted sequence list
- if (seqmappings != null)
- {
-
- Enumeration e = seqmappings.elements();
- while (e.hasMoreElements())
-
- {
- ((AlignedCodonFrame) e.nextElement()).markMappedRegion(
- mappings[j].sequence, indexpos, results);
- }
- }
- }
-
+ acf.markMappedRegion(sm.sequence, indexpos, results);
}
}
}
}
}
- if (results!=null)
+ for (Object li : listeners)
{
- for (int i = 0; i < listeners.size(); i++)
+ if (li instanceof SequenceListener)
{
- Object li = listeners.elementAt(i);
- if (li instanceof SequenceListener)
- ((SequenceListener) li).highlightSequence(results);
+ ((SequenceListener) li).highlightSequence(results);
}
}
}
- Vector seqmappings = null; // should be a simpler list of mapped seuqence
-
/**
* highlight regions associated with a position (indexpos) in seq
*
* @param seq
- * the sequeence that the mouse over occured on
+ * the sequence that the mouse over occurred on
* @param indexpos
* the absolute position being mouseovered in seq (0 to seq.length())
* @param index
@@ -425,95 +686,101 @@ public class StructureSelectionManager
public void mouseOverSequence(SequenceI seq, int indexpos, int index,
VamsasSource source)
{
- boolean hasSequenceListeners = handlingVamsasMo || seqmappings != null;
+ boolean hasSequenceListeners = handlingVamsasMo
+ || !seqmappings.isEmpty();
SearchResults results = null;
if (index == -1)
+ {
index = seq.findPosition(indexpos);
- StructureListener sl;
- int atomNo = 0;
+ }
for (int i = 0; i < listeners.size(); i++)
{
- if (listeners.elementAt(i) instanceof StructureListener)
+ Object listener = listeners.elementAt(i);
+ if (listener == source)
{
- sl = (StructureListener) listeners.elementAt(i);
- if (mappings == null)
- {
- continue;
- }
- for (int j = 0; j < mappings.length; j++)
- {
- if (mappings[j].sequence == seq
- || mappings[j].sequence == seq.getDatasetSequence())
- {
- atomNo = mappings[j].getAtomNum(index);
-
- if (atomNo > 0)
- {
- sl.highlightAtom(atomNo, mappings[j].getPDBResNum(index),
- mappings[j].pdbchain, mappings[j].pdbfile);
- }
- }
- }
+ // TODO listener (e.g. SeqPanel) is never == source (AlignViewport)
+ // Temporary fudge with SequenceListener.getVamsasSource()
+ continue;
+ }
+ if (listener instanceof StructureListener)
+ {
+ highlightStructure((StructureListener) listener, seq, index);
}
else
{
- if (relaySeqMappings && hasSequenceListeners
- && listeners.elementAt(i) instanceof SequenceListener)
+ if (listener instanceof SequenceListener)
{
- // DEBUG
- // System.err.println("relay Seq " + seq.getDisplayId(false) + " " +
- // index);
-
- if (results == null)
+ final SequenceListener seqListener = (SequenceListener) listener;
+ if (hasSequenceListeners
+ && seqListener.getVamsasSource() != source)
{
- results = new SearchResults();
- if (index >= seq.getStart() && index <= seq.getEnd())
+ if (relaySeqMappings)
{
- // construct highlighted sequence list
-
- if (seqmappings != null)
+ if (results == null)
{
- Enumeration e = seqmappings.elements();
- while (e.hasMoreElements())
-
- {
- ((AlignedCodonFrame) e.nextElement()).markMappedRegion(
- seq, index, results);
- }
+ results = MappingUtils.buildSearchResults(seq, index,
+ seqmappings);
}
- // hasSequenceListeners = results.getSize() > 0;
if (handlingVamsasMo)
{
- // maybe have to resolve seq to a dataset seqeunce...
- // add in additional direct sequence and/or dataset sequence
- // highlighting
results.addResult(seq, index, index);
+
+ }
+ if (!results.isEmpty())
+ {
+ seqListener.highlightSequence(results);
}
}
}
- if (hasSequenceListeners)
- {
- ((SequenceListener) listeners.elementAt(i))
- .highlightSequence(results);
- }
}
- else if (listeners.elementAt(i) instanceof VamsasListener
- && !handlingVamsasMo)
+ else if (listener instanceof VamsasListener && !handlingVamsasMo)
{
- // DEBUG
- // System.err.println("Vamsas from Seq " + seq.getDisplayId(false) + "
- // " +
- // index);
- // pass the mouse over and absolute position onto the
- // VamsasListener(s)
- ((VamsasListener) listeners.elementAt(i)).mouseOver(seq,
- indexpos, source);
+ ((VamsasListener) listener).mouseOverSequence(seq, indexpos,
+ source);
+ }
+ else if (listener instanceof SecondaryStructureListener)
+ {
+ ((SecondaryStructureListener) listener).mouseOverSequence(seq,
+ indexpos, index);
}
}
}
}
/**
+ * Send suitable messages to a StructureListener to highlight atoms
+ * corresponding to the given sequence position.
+ *
+ * @param sl
+ * @param seq
+ * @param index
+ */
+ protected void highlightStructure(StructureListener sl, SequenceI seq,
+ int index)
+ {
+ if (!sl.isListeningFor(seq))
+ {
+ return;
+ }
+ int atomNo;
+ List<AtomSpec> atoms = new ArrayList<AtomSpec>();
+ for (StructureMapping sm : mappings)
+ {
+ if (sm.sequence == seq || sm.sequence == seq.getDatasetSequence())
+ {
+ atomNo = sm.getAtomNum(index);
+
+ if (atomNo > 0)
+ {
+ atoms.add(new AtomSpec(sm.pdbfile, sm.pdbchain, sm
+ .getPDBResNum(index), atomNo));
+ }
+ }
+ }
+ sl.highlightAtoms(atoms);
+ }
+
+ /**
* true if a mouse over event from an external (ie Vamsas) source is being
* handled
*/
@@ -599,113 +866,141 @@ public class StructureSelectionManager
public StructureMapping[] getMapping(String pdbfile)
{
- Vector tmp = new Vector();
- if (mappings != null)
+ List<StructureMapping> tmp = new ArrayList<StructureMapping>();
+ for (StructureMapping sm : mappings)
{
- for (int i = 0; i < mappings.length; i++)
+ if (sm.pdbfile.equals(pdbfile))
{
- if (mappings[i].pdbfile.equals(pdbfile))
- {
- tmp.addElement(mappings[i]);
- }
+ tmp.add(sm);
}
}
- StructureMapping[] ret = new StructureMapping[tmp.size()];
- for (int i = 0; i < tmp.size(); i++)
- {
- ret[i] = (StructureMapping) tmp.elementAt(i);
- }
-
- return ret;
+ return tmp.toArray(new StructureMapping[tmp.size()]);
}
- public String printMapping(String pdbfile)
+ /**
+ * Returns a readable description of all mappings for the given pdbfile to any
+ * of the given sequences
+ *
+ * @param pdbfile
+ * @param seqs
+ * @return
+ */
+ public String printMappings(String pdbfile, List<SequenceI> seqs)
{
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < mappings.length; i++)
+ if (pdbfile == null || seqs == null || seqs.isEmpty())
+ {
+ return "";
+ }
+
+ StringBuilder sb = new StringBuilder(64);
+ for (StructureMapping sm : mappings)
{
- if (mappings[i].pdbfile.equals(pdbfile))
+ if (sm.pdbfile.equals(pdbfile) && seqs.contains(sm.sequence))
{
- sb.append(mappings[i].mappingDetails);
+ sb.append(sm.mappingDetails);
+ sb.append(NEWLINE);
+ // separator makes it easier to read multiple mappings
+ sb.append("=====================");
+ sb.append(NEWLINE);
}
}
+ sb.append(NEWLINE);
return sb.toString();
}
- private int[] seqmappingrefs = null; // refcount for seqmappings elements
+ /**
+ * Remove the given mapping
+ *
+ * @param acf
+ */
+ public void deregisterMapping(AlignedCodonFrame acf)
+ {
+ if (acf != null)
+ {
+ boolean removed = seqmappings.remove(acf);
+ if (removed && seqmappings.isEmpty())
+ { // debug
+ System.out.println("All mappings removed");
+ }
+ }
+ }
- private synchronized void modifySeqMappingList(boolean add,
- AlignedCodonFrame[] codonFrames)
+ /**
+ * Add each of the given codonFrames to the stored set, if not aready present.
+ *
+ * @param set
+ */
+ public void registerMappings(Set<AlignedCodonFrame> set)
{
- if (!add && (seqmappings == null || seqmappings.size() == 0))
- return;
- if (seqmappings == null)
- seqmappings = new Vector();
- if (codonFrames != null && codonFrames.length > 0)
+ if (set != null)
{
- for (int cf = 0; cf < codonFrames.length; cf++)
+ for (AlignedCodonFrame acf : set)
{
- if (seqmappings.contains(codonFrames[cf]))
- {
- if (add)
- {
- seqmappingrefs[seqmappings.indexOf(codonFrames[cf])]++;
- }
- else
- {
- if (--seqmappingrefs[seqmappings.indexOf(codonFrames[cf])] <= 0)
- {
- int pos = seqmappings.indexOf(codonFrames[cf]);
- int[] nr = new int[seqmappingrefs.length - 1];
- if (pos > 0)
- {
- System.arraycopy(seqmappingrefs, 0, nr, 0, pos);
- }
- if (pos < seqmappingrefs.length - 1)
- {
- System.arraycopy(seqmappingrefs, pos + 1, nr, 0,
- seqmappingrefs.length - pos - 2);
- }
- }
- }
- }
- else
- {
- if (add)
- {
- seqmappings.addElement(codonFrames[cf]);
-
- int[] nsr = new int[(seqmappingrefs == null) ? 1
- : seqmappingrefs.length + 1];
- if (seqmappingrefs != null && seqmappingrefs.length > 0)
- System.arraycopy(seqmappingrefs, 0, nsr, 0,
- seqmappingrefs.length);
- nsr[(seqmappingrefs == null) ? 0 : seqmappingrefs.length] = 1;
- seqmappingrefs = nsr;
- }
- }
+ registerMapping(acf);
}
}
}
- public void removeMappings(AlignedCodonFrame[] codonFrames)
+ /**
+ * Add the given mapping to the stored set, unless already stored.
+ */
+ public void registerMapping(AlignedCodonFrame acf)
{
- modifySeqMappingList(false, codonFrames);
+ if (acf != null)
+ {
+ if (!seqmappings.contains(acf))
+ {
+ seqmappings.add(acf);
+ }
+ }
}
- public void addMappings(AlignedCodonFrame[] codonFrames)
+ /**
+ * Resets this object to its initial state by removing all registered
+ * listeners, codon mappings, PDB file mappings
+ */
+ public void resetAll()
{
- modifySeqMappingList(true, codonFrames);
+ if (mappings != null)
+ {
+ mappings.clear();
+ }
+ if (seqmappings != null)
+ {
+ seqmappings.clear();
+ }
+ if (sel_listeners != null)
+ {
+ sel_listeners.clear();
+ }
+ if (listeners != null)
+ {
+ listeners.clear();
+ }
+ if (commandListeners != null)
+ {
+ commandListeners.clear();
+ }
+ if (view_listeners != null)
+ {
+ view_listeners.clear();
+ }
+ if (pdbFileNameId != null)
+ {
+ pdbFileNameId.clear();
+ }
+ if (pdbIdFileName != null)
+ {
+ pdbIdFileName.clear();
+ }
}
- Vector<SelectionListener> sel_listeners = new Vector<SelectionListener>();
-
public void addSelectionListener(SelectionListener selecter)
{
if (!sel_listeners.contains(selecter))
{
- sel_listeners.addElement(selecter);
+ sel_listeners.add(selecter);
}
}
@@ -713,7 +1008,7 @@ public class StructureSelectionManager
{
if (sel_listeners.contains(toremove))
{
- sel_listeners.removeElement(toremove);
+ sel_listeners.remove(toremove);
}
}
@@ -721,34 +1016,29 @@ public class StructureSelectionManager
jalview.datamodel.SequenceGroup selection,
jalview.datamodel.ColumnSelection colsel, SelectionSource source)
{
- if (sel_listeners != null && sel_listeners.size() > 0)
+ for (SelectionListener slis : sel_listeners)
{
- Enumeration listeners = sel_listeners.elements();
- while (listeners.hasMoreElements())
+ if (slis != source)
{
- SelectionListener slis = ((SelectionListener) listeners
- .nextElement());
- if (slis != source)
- {
- slis.selection(selection, colsel, source);
- }
- ;
+ slis.selection(selection, colsel, source);
}
}
}
-
- Vector<AlignmentViewPanelListener> view_listeners=new Vector<AlignmentViewPanelListener>();
- public synchronized void sendViewPosition(jalview.api.AlignmentViewPanel source, int startRes,
- int endRes, int startSeq, int endSeq)
+
+ Vector<AlignmentViewPanelListener> view_listeners = new Vector<AlignmentViewPanelListener>();
+
+ public synchronized void sendViewPosition(
+ jalview.api.AlignmentViewPanel source, int startRes, int endRes,
+ int startSeq, int endSeq)
{
if (view_listeners != null && view_listeners.size() > 0)
{
- Enumeration<AlignmentViewPanelListener> listeners = view_listeners.elements();
+ Enumeration<AlignmentViewPanelListener> listeners = view_listeners
+ .elements();
while (listeners.hasMoreElements())
{
- AlignmentViewPanelListener slis = listeners
- .nextElement();
+ AlignmentViewPanelListener slis = listeners.nextElement();
if (slis != source)
{
slis.viewPosition(startRes, endRes, startSeq, endSeq, source);
@@ -757,39 +1047,15 @@ public class StructureSelectionManager
}
}
}
-
-
- public void finalize() throws Throwable {
- if (listeners!=null) {
- listeners.clear();
- listeners=null;
- }
- if (mappingData!=null)
- {
- mappingData.clear();
- mappingData=null;
- }
- if (sel_listeners!=null)
- {
- sel_listeners.clear();
- sel_listeners=null;
- }
- if (view_listeners!=null)
- {
- view_listeners.clear();
- view_listeners=null;
- }
- mappings=null;
- seqmappingrefs=null;
- }
/**
* release all references associated with this manager provider
+ *
* @param jalviewLite
*/
public static void release(StructureSelectionManagerProvider jalviewLite)
{
-// synchronized (instances)
+ // synchronized (instances)
{
if (instances == null)
{
@@ -805,9 +1071,80 @@ public class StructureSelectionManager
} catch (Throwable x)
{
}
- ;
}
}
}
+ public void registerPDBEntry(PDBEntry pdbentry)
+ {
+ if (pdbentry.getFile() != null
+ && pdbentry.getFile().trim().length() > 0)
+ {
+ registerPDBFile(pdbentry.getId(), pdbentry.getFile());
+ }
+ }
+
+ public void addCommandListener(CommandListener cl)
+ {
+ if (!commandListeners.contains(cl))
+ {
+ commandListeners.add(cl);
+ }
+ }
+
+ public boolean hasCommandListener(CommandListener cl)
+ {
+ return this.commandListeners.contains(cl);
+ }
+
+ public boolean removeCommandListener(CommandListener l)
+ {
+ return commandListeners.remove(l);
+ }
+
+ /**
+ * Forward a command to any command listeners (except for the command's
+ * source).
+ *
+ * @param command
+ * the command to be broadcast (in its form after being performed)
+ * @param undo
+ * if true, the command was being 'undone'
+ * @param source
+ */
+ public void commandPerformed(CommandI command, boolean undo,
+ VamsasSource source)
+ {
+ for (CommandListener listener : commandListeners)
+ {
+ listener.mirrorCommand(command, undo, this, source);
+ }
+ }
+
+ /**
+ * Returns a new CommandI representing the given command as mapped to the
+ * given sequences. If no mapping could be made, or the command is not of a
+ * mappable kind, returns null.
+ *
+ * @param command
+ * @param undo
+ * @param mapTo
+ * @param gapChar
+ * @return
+ */
+ public CommandI mapCommand(CommandI command, boolean undo,
+ final AlignmentI mapTo, char gapChar)
+ {
+ if (command instanceof EditCommand)
+ {
+ return MappingUtils.mapEditCommand((EditCommand) command, undo,
+ mapTo, gapChar, seqmappings);
+ }
+ else if (command instanceof OrderCommand)
+ {
+ return MappingUtils.mapOrderCommand((OrderCommand) command, undo,
+ mapTo, seqmappings);
+ }
+ return null;
+ }
}
diff --git a/src/jalview/structure/VamsasListener.java b/src/jalview/structure/VamsasListener.java
index af5d720..dbcccd9 100644
--- a/src/jalview/structure/VamsasListener.java
+++ b/src/jalview/structure/VamsasListener.java
@@ -1,34 +1,41 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.structure;
-
-import jalview.datamodel.SequenceI;
-
-/**
- * The vamsasListener allows peers to receive mouseOver events from any Jalview alignment window.
- * @author JimP
- *
- * @history Version 1 released for Jalview 2.4.
- * @history Version 2 mouseOver refactored to include an additional parameter allowing the source of the event to be passed to the handler.
- *
- *
- */
-public interface VamsasListener
-{
- public void mouseOver(SequenceI seq, int index, VamsasSource source);
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.structure;
+
+import jalview.datamodel.SequenceI;
+
+/**
+ * The vamsasListener allows peers to receive mouseOver events from any Jalview
+ * alignment window.
+ *
+ * @author JimP
+ *
+ * @history Version 1 released for Jalview 2.4.
+ * @history Version 2 mouseOver refactored to include an additional parameter
+ * allowing the source of the event to be passed to the handler.
+ *
+ *
+ */
+public interface VamsasListener
+{
+ public void mouseOverSequence(SequenceI seq, int index,
+ VamsasSource source);
+}
diff --git a/src/jalview/structure/VamsasSource.java b/src/jalview/structure/VamsasSource.java
index 2e3d78d..b9841f6 100644
--- a/src/jalview/structure/VamsasSource.java
+++ b/src/jalview/structure/VamsasSource.java
@@ -1,31 +1,33 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.structure;
-
/**
- * an object that can generate mouseover events for VamsasListeners. This is purely a tag for the
- * moment, but there may be more interrogative methods in future.
+ * an object that can generate mouseover events for VamsasListeners. This is
+ * purely a tag for the moment, but there may be more interrogative methods in
+ * future.
*
*/
public interface VamsasSource
{
-
}
diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java
new file mode 100644
index 0000000..74fee63
--- /dev/null
+++ b/src/jalview/structures/models/AAStructureBindingModel.java
@@ -0,0 +1,656 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.structures.models;
+
+import jalview.api.StructureSelectionManagerProvider;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.structure.AtomSpec;
+import jalview.structure.StructureListener;
+import jalview.structure.StructureMapping;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.Comparison;
+import jalview.util.MessageManager;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ *
+ * A base class to hold common function for protein structure model binding.
+ * Initial version created by refactoring JMol and Chimera binding models, but
+ * other structure viewers could in principle be accommodated in future.
+ *
+ * @author gmcarstairs
+ *
+ */
+public abstract class AAStructureBindingModel extends
+ SequenceStructureBindingModel implements StructureListener,
+ StructureSelectionManagerProvider
+{
+
+ private StructureSelectionManager ssm;
+
+ private PDBEntry[] pdbEntry;
+
+ /*
+ * sequences mapped to each pdbentry
+ */
+ private SequenceI[][] sequence;
+
+ /*
+ * array of target chains for sequences - tied to pdbentry and sequence[]
+ */
+ private String[][] chains;
+
+ /*
+ * datasource protocol for access to PDBEntrylatest
+ */
+ String protocol = null;
+
+ protected boolean colourBySequence = true;
+
+ private boolean nucleotide;
+
+ private boolean finishedInit = false;
+
+ /**
+ * Data bean class to simplify parameterisation in superposeStructures
+ */
+ protected class SuperposeData
+ {
+ /**
+ * Constructor with alignment width argument
+ *
+ * @param width
+ */
+ public SuperposeData(int width)
+ {
+ pdbResNo = new int[width];
+ }
+
+ public String filename;
+
+ public String pdbId;
+
+ public String chain = "";
+
+ public boolean isRna;
+
+ /*
+ * The pdb residue number (if any) mapped to each column of the alignment
+ */
+ public int[] pdbResNo;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param ssm
+ * @param seqs
+ */
+ public AAStructureBindingModel(StructureSelectionManager ssm,
+ SequenceI[][] seqs)
+ {
+ this.ssm = ssm;
+ this.sequence = seqs;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param ssm
+ * @param pdbentry
+ * @param sequenceIs
+ * @param chains
+ * @param protocol
+ */
+ public AAStructureBindingModel(StructureSelectionManager ssm,
+ PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
+ String protocol)
+ {
+ this.ssm = ssm;
+ this.sequence = sequenceIs;
+ this.nucleotide = Comparison.isNucleotide(sequenceIs);
+ this.chains = chains;
+ this.pdbEntry = pdbentry;
+ this.protocol = protocol;
+ if (chains == null)
+ {
+ this.chains = new String[pdbentry.length][];
+ }
+ }
+
+ public StructureSelectionManager getSsm()
+ {
+ return ssm;
+ }
+
+ /**
+ * Returns the i'th PDBEntry (or null)
+ *
+ * @param i
+ * @return
+ */
+ public PDBEntry getPdbEntry(int i)
+ {
+ return (pdbEntry != null && pdbEntry.length > i) ? pdbEntry[i] : null;
+ }
+
+ /**
+ * Answers true if this binding includes the given PDB id, else false
+ *
+ * @param pdbId
+ * @return
+ */
+ public boolean hasPdbId(String pdbId)
+ {
+ if (pdbEntry != null)
+ {
+ for (PDBEntry pdb : pdbEntry)
+ {
+ if (pdb.getId().equals(pdbId))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the number of modelled PDB file entries.
+ *
+ * @return
+ */
+ public int getPdbCount()
+ {
+ return pdbEntry == null ? 0 : pdbEntry.length;
+ }
+
+ public SequenceI[][] getSequence()
+ {
+ return sequence;
+ }
+
+ public String[][] getChains()
+ {
+ return chains;
+ }
+
+ public String getProtocol()
+ {
+ return protocol;
+ }
+
+ // TODO may remove this if calling methods can be pulled up here
+ protected void setPdbentry(PDBEntry[] pdbentry)
+ {
+ this.pdbEntry = pdbentry;
+ }
+
+ protected void setSequence(SequenceI[][] sequence)
+ {
+ this.sequence = sequence;
+ }
+
+ protected void setChains(String[][] chains)
+ {
+ this.chains = chains;
+ }
+
+ /**
+ * Construct a title string for the viewer window based on the data Jalview
+ * knows about
+ *
+ * @param viewerName
+ * TODO
+ * @param verbose
+ *
+ * @return
+ */
+ public String getViewerTitle(String viewerName, boolean verbose)
+ {
+ if (getSequence() == null || getSequence().length < 1
+ || getPdbCount() < 1 || getSequence()[0].length < 1)
+ {
+ return ("Jalview " + viewerName + " Window");
+ }
+ // TODO: give a more informative title when multiple structures are
+ // displayed.
+ StringBuilder title = new StringBuilder(64);
+ final PDBEntry pdbEntry = getPdbEntry(0);
+ title.append(viewerName + " view for " + getSequence()[0][0].getName()
+ + ":" + pdbEntry.getId());
+
+ if (verbose)
+ {
+ if (pdbEntry.getProperty() != null)
+ {
+ if (pdbEntry.getProperty().get("method") != null)
+ {
+ title.append(" Method: ");
+ title.append(pdbEntry.getProperty().get("method"));
+ }
+ if (pdbEntry.getProperty().get("chains") != null)
+ {
+ title.append(" Chain:");
+ title.append(pdbEntry.getProperty().get("chains"));
+ }
+ }
+ }
+ return title.toString();
+ }
+
+ /**
+ * Called by after closeViewer is called, to release any resources and
+ * references so they can be garbage collected. Override if needed.
+ */
+ protected void releaseUIResources()
+ {
+
+ }
+
+ public boolean isColourBySequence()
+ {
+ return colourBySequence;
+ }
+
+ public void setColourBySequence(boolean colourBySequence)
+ {
+ this.colourBySequence = colourBySequence;
+ }
+
+ protected void addSequenceAndChain(int pe, SequenceI[] seq,
+ String[] tchain)
+ {
+ if (pe < 0 || pe >= getPdbCount())
+ {
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_no_pdbentry_from_index",
+ new Object[] { Integer.valueOf(pe).toString() }));
+ }
+ final String nullChain = "TheNullChain";
+ List<SequenceI> s = new ArrayList<SequenceI>();
+ List<String> c = new ArrayList<String>();
+ if (getChains() == null)
+ {
+ setChains(new String[getPdbCount()][]);
+ }
+ if (getSequence()[pe] != null)
+ {
+ for (int i = 0; i < getSequence()[pe].length; i++)
+ {
+ s.add(getSequence()[pe][i]);
+ if (getChains()[pe] != null)
+ {
+ if (i < getChains()[pe].length)
+ {
+ c.add(getChains()[pe][i]);
+ }
+ else
+ {
+ c.add(nullChain);
+ }
+ }
+ else
+ {
+ if (tchain != null && tchain.length > 0)
+ {
+ c.add(nullChain);
+ }
+ }
+ }
+ }
+ for (int i = 0; i < seq.length; i++)
+ {
+ if (!s.contains(seq[i]))
+ {
+ s.add(seq[i]);
+ if (tchain != null && i < tchain.length)
+ {
+ c.add(tchain[i] == null ? nullChain : tchain[i]);
+ }
+ }
+ }
+ SequenceI[] tmp = s.toArray(new SequenceI[s.size()]);
+ getSequence()[pe] = tmp;
+ if (c.size() > 0)
+ {
+ String[] tch = c.toArray(new String[c.size()]);
+ for (int i = 0; i < tch.length; i++)
+ {
+ if (tch[i] == nullChain)
+ {
+ tch[i] = null;
+ }
+ }
+ getChains()[pe] = tch;
+ }
+ else
+ {
+ getChains()[pe] = null;
+ }
+ }
+
+ /**
+ * add structures and any known sequence associations
+ *
+ * @returns the pdb entries added to the current set.
+ */
+ public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe,
+ SequenceI[][] seq, String[][] chns)
+ {
+ List<PDBEntry> v = new ArrayList<PDBEntry>();
+ List<int[]> rtn = new ArrayList<int[]>();
+ for (int i = 0; i < getPdbCount(); i++)
+ {
+ v.add(getPdbEntry(i));
+ }
+ for (int i = 0; i < pdbe.length; i++)
+ {
+ int r = v.indexOf(pdbe[i]);
+ if (r == -1 || r >= getPdbCount())
+ {
+ rtn.add(new int[] { v.size(), i });
+ v.add(pdbe[i]);
+ }
+ else
+ {
+ // just make sure the sequence/chain entries are all up to date
+ addSequenceAndChain(r, seq[i], chns[i]);
+ }
+ }
+ pdbe = v.toArray(new PDBEntry[v.size()]);
+ setPdbentry(pdbe);
+ if (rtn.size() > 0)
+ {
+ // expand the tied sequence[] and string[] arrays
+ SequenceI[][] sqs = new SequenceI[getPdbCount()][];
+ String[][] sch = new String[getPdbCount()][];
+ System.arraycopy(getSequence(), 0, sqs, 0, getSequence().length);
+ System.arraycopy(getChains(), 0, sch, 0, this.getChains().length);
+ setSequence(sqs);
+ setChains(sch);
+ pdbe = new PDBEntry[rtn.size()];
+ for (int r = 0; r < pdbe.length; r++)
+ {
+ int[] stri = (rtn.get(r));
+ // record the pdb file as a new addition
+ pdbe[r] = getPdbEntry(stri[0]);
+ // and add the new sequence/chain entries
+ addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]);
+ }
+ }
+ else
+ {
+ pdbe = null;
+ }
+ return pdbe;
+ }
+
+ /**
+ * Add sequences to the pe'th pdbentry's sequence set.
+ *
+ * @param pe
+ * @param seq
+ */
+ public void addSequence(int pe, SequenceI[] seq)
+ {
+ addSequenceAndChain(pe, seq, null);
+ }
+
+ /**
+ * add the given sequences to the mapping scope for the given pdb file handle
+ *
+ * @param pdbFile
+ * - pdbFile identifier
+ * @param seq
+ * - set of sequences it can be mapped to
+ */
+ public void addSequenceForStructFile(String pdbFile, SequenceI[] seq)
+ {
+ for (int pe = 0; pe < getPdbCount(); pe++)
+ {
+ if (getPdbEntry(pe).getFile().equals(pdbFile))
+ {
+ addSequence(pe, seq);
+ }
+ }
+ }
+
+ @Override
+ public abstract void highlightAtoms(List<AtomSpec> atoms);
+
+ protected boolean isNucleotide()
+ {
+ return this.nucleotide;
+ }
+
+ /**
+ * Returns a readable description of all mappings for the wrapped pdbfile to
+ * any mapped sequences
+ *
+ * @param pdbfile
+ * @param seqs
+ * @return
+ */
+ public String printMappings()
+ {
+ if (pdbEntry == null)
+ {
+ return "";
+ }
+ StringBuilder sb = new StringBuilder(128);
+ for (int pdbe = 0; pdbe < getPdbCount(); pdbe++)
+ {
+ String pdbfile = getPdbEntry(pdbe).getFile();
+ List<SequenceI> seqs = Arrays.asList(getSequence()[pdbe]);
+ sb.append(getSsm().printMappings(pdbfile, seqs));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Returns the mapped structure position for a given aligned column of a given
+ * sequence, or -1 if the column is gapped, beyond the end of the sequence, or
+ * not mapped to structure.
+ *
+ * @param seq
+ * @param alignedPos
+ * @param mapping
+ * @return
+ */
+ protected int getMappedPosition(SequenceI seq, int alignedPos,
+ StructureMapping mapping)
+ {
+ if (alignedPos >= seq.getLength())
+ {
+ return -1;
+ }
+
+ if (Comparison.isGap(seq.getCharAt(alignedPos)))
+ {
+ return -1;
+ }
+ int seqPos = seq.findPosition(alignedPos);
+ int pos = mapping.getPDBResNum(seqPos);
+ return pos;
+ }
+
+ /**
+ * Helper method to identify residues that can participate in a structure
+ * superposition command. For each structure, identify a sequence in the
+ * alignment which is mapped to the structure. Identify non-gapped columns in
+ * the sequence which have a mapping to a residue in the structure. Returns
+ * the index of the first structure that has a mapping to the alignment.
+ *
+ * @param alignment
+ * the sequence alignment which is the basis of structure
+ * superposition
+ * @param matched
+ * an array of booleans, indexed by alignment column, where true
+ * indicates that every structure has a mapped residue present in the
+ * column (so the column can participate in structure alignment)
+ * @param structures
+ * an array of data beans corresponding to pdb file index
+ * @return
+ */
+ protected int findSuperposableResidues(AlignmentI alignment,
+ boolean[] matched, SuperposeData[] structures)
+ {
+ int refStructure = -1;
+ String[] files = getPdbFile();
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ StructureMapping[] mappings = getSsm().getMapping(files[pdbfnum]);
+ int lastPos = -1;
+
+ /*
+ * Find the first mapped sequence (if any) for this PDB entry which is in
+ * the alignment
+ */
+ final int seqCountForPdbFile = getSequence()[pdbfnum].length;
+ for (int s = 0; s < seqCountForPdbFile; s++)
+ {
+ for (StructureMapping mapping : mappings)
+ {
+ final SequenceI theSequence = getSequence()[pdbfnum][s];
+ if (mapping.getSequence() == theSequence
+ && alignment.findIndex(theSequence) > -1)
+ {
+ if (refStructure < 0)
+ {
+ refStructure = pdbfnum;
+ }
+ for (int r = 0; r < matched.length; r++)
+ {
+ if (!matched[r])
+ {
+ continue;
+ }
+ int pos = getMappedPosition(theSequence, r, mapping);
+ if (pos < 1 || pos == lastPos)
+ {
+ matched[r] = false;
+ continue;
+ }
+ lastPos = pos;
+ structures[pdbfnum].pdbResNo[r] = pos;
+ }
+ String chain = mapping.getChain();
+ if (chain != null && chain.trim().length() > 0)
+ {
+ structures[pdbfnum].chain = chain;
+ }
+ structures[pdbfnum].pdbId = mapping.getPdbId();
+ structures[pdbfnum].isRna = theSequence.getRNA() != null;
+ // move on to next pdb file
+ s = seqCountForPdbFile;
+ break;
+ }
+ }
+ }
+ }
+ return refStructure;
+ }
+
+ /**
+ * Returns true if the structure viewer has loaded all of the files of
+ * interest (identified by the file mapping having been set up), or false if
+ * any are still not loaded after a timeout interval.
+ *
+ * @param files
+ */
+ protected boolean waitForFileLoad(String[] files)
+ {
+ /*
+ * give up after 10 secs plus 1 sec per file
+ */
+ long starttime = System.currentTimeMillis();
+ long endTime = 10000 + 1000 * files.length + starttime;
+ String notLoaded = null;
+
+ boolean waiting = true;
+ while (waiting && System.currentTimeMillis() < endTime)
+ {
+ waiting = false;
+ for (String file : files)
+ {
+ notLoaded = file;
+ try
+ {
+ StructureMapping[] sm = getSsm().getMapping(file);
+ if (sm == null || sm.length == 0)
+ {
+ waiting = true;
+ }
+ } catch (Throwable x)
+ {
+ waiting = true;
+ }
+ }
+ }
+
+ if (waiting)
+ {
+ System.err
+ .println("Timed out waiting for structure viewer to load file "
+ + notLoaded);
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isListeningFor(SequenceI seq)
+ {
+ if (sequence != null)
+ {
+ for (SequenceI[] seqs : sequence)
+ {
+ if (seqs != null)
+ {
+ for (SequenceI s : seqs)
+ {
+ if (s == seq)
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean isFinishedInit()
+ {
+ return finishedInit;
+ }
+
+ public void setFinishedInit(boolean fi)
+ {
+ this.finishedInit = fi;
+ }
+}
diff --git a/src/jalview/structures/models/SequenceStructureBindingModel.java b/src/jalview/structures/models/SequenceStructureBindingModel.java
new file mode 100644
index 0000000..54c1a53
--- /dev/null
+++ b/src/jalview/structures/models/SequenceStructureBindingModel.java
@@ -0,0 +1,72 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.structures.models;
+
+import jalview.api.SequenceStructureBinding;
+
+public class SequenceStructureBindingModel implements
+ SequenceStructureBinding
+{
+
+ /**
+ * set if Structure Viewer state is being restored from some source -
+ * instructs binding not to apply default display style when structure set is
+ * updated for first time.
+ */
+ private boolean loadingFromArchive = false;
+
+ /**
+ * second flag to indicate if the Structure viewer should ignore sequence
+ * colouring events from the structure manager because the GUI is still
+ * setting up
+ */
+ private boolean loadingFinished = true;
+
+ @Override
+ public void setLoadingFromArchive(boolean loadingFromArchive)
+ {
+ this.loadingFromArchive = loadingFromArchive;
+ }
+
+ /**
+ *
+ * @return true if viewer is still restoring state or loading is still going
+ * on (see setFinishedLoadingFromArchive)
+ */
+ @Override
+ public boolean isLoadingFromArchive()
+ {
+ return loadingFromArchive && !loadingFinished;
+ }
+
+ @Override
+ public boolean isLoadingFinished()
+ {
+ return loadingFinished;
+ }
+
+ @Override
+ public void setFinishedLoadingFromArchive(boolean finishedLoading)
+ {
+ loadingFinished = finishedLoading;
+ }
+
+}
diff --git a/src/jalview/util/AWTConsole.java b/src/jalview/util/AWTConsole.java
index c2a73f7..9d4f72a 100644
--- a/src/jalview/util/AWTConsole.java
+++ b/src/jalview/util/AWTConsole.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.util;
@@ -27,9 +30,23 @@ package jalview.util;
//
// RJHM van den Bergh , rvdb at comweb.nl
-import java.io.*;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GraphicsEnvironment;
+import java.awt.Panel;
+import java.awt.TextArea;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.io.IOException;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.PrintStream;
public class AWTConsole extends WindowAdapter implements WindowListener,
ActionListener, Runnable
@@ -221,7 +238,7 @@ public class AWTConsole extends WindowAdapter implements WindowListener,
{
}
throw new NullPointerException(
- "Application test: throwing an NullPointerException It should arrive at the console");
+ MessageManager.getString("exception.application_test_npe"));
}
}
diff --git a/src/jalview/util/BrowserLauncher.java b/src/jalview/util/BrowserLauncher.java
index 23324a0..52a3cdd 100644
--- a/src/jalview/util/BrowserLauncher.java
+++ b/src/jalview/util/BrowserLauncher.java
@@ -1,24 +1,31 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.util;
-import java.io.*;
-import java.lang.reflect.*;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
/**
* BrowserLauncher is a class that provides one static method, openURL, which
@@ -233,7 +240,16 @@ public class BrowserLauncher
if (osName.startsWith("Mac OS"))
{
String mrjVersion = System.getProperty("mrj.version");
- String majorMRJVersion = mrjVersion.substring(0, 3);
+ String majorMRJVersion;
+ if (mrjVersion == null)
+ {
+ // must be on some later build with mrj support
+ majorMRJVersion = "3.1";
+ }
+ else
+ {
+ majorMRJVersion = mrjVersion.substring(0, 3);
+ }
try
{
@@ -322,23 +338,19 @@ public class BrowserLauncher
aeDescClass = Class.forName("com.apple.MacOS.AEDesc");
aeTargetConstructor = aeTargetClass
- .getDeclaredConstructor(new Class[]
- { int.class });
+ .getDeclaredConstructor(new Class[] { int.class });
appleEventConstructor = appleEventClass
- .getDeclaredConstructor(new Class[]
- { int.class, int.class, aeTargetClass, int.class, int.class });
- aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[]
- { String.class });
+ .getDeclaredConstructor(new Class[] { int.class, int.class,
+ aeTargetClass, int.class, int.class });
+ aeDescConstructor = aeDescClass
+ .getDeclaredConstructor(new Class[] { String.class });
makeOSType = osUtilsClass.getDeclaredMethod("makeOSType",
- new Class[]
- { String.class });
+ new Class[] { String.class });
putParameter = appleEventClass.getDeclaredMethod("putParameter",
- new Class[]
- { int.class, aeDescClass });
+ new Class[] { int.class, aeDescClass });
sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply",
- new Class[]
- {});
+ new Class[] {});
Field keyDirectObjectField = aeClass
.getDeclaredField("keyDirectObject");
@@ -387,14 +399,11 @@ public class BrowserLauncher
.getDeclaredField("kSystemFolderType");
kSystemFolderType = systemFolderField.get(null);
findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder",
- new Class[]
- { mrjOSTypeClass });
+ new Class[] { mrjOSTypeClass });
getFileCreator = mrjFileUtilsClass.getDeclaredMethod(
- "getFileCreator", new Class[]
- { File.class });
+ "getFileCreator", new Class[] { File.class });
getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType",
- new Class[]
- { File.class });
+ new Class[] { File.class });
} catch (ClassNotFoundException cnfe)
{
errorMessage = cnfe.getMessage();
@@ -429,10 +438,10 @@ public class BrowserLauncher
try
{
Class linker = Class.forName("com.apple.mrj.jdirect.Linker");
- Constructor constructor = linker.getConstructor(new Class[]
- { Class.class });
- linkage = constructor.newInstance(new Object[]
- { BrowserLauncher.class });
+ Constructor constructor = linker
+ .getConstructor(new Class[] { Class.class });
+ linkage = constructor
+ .newInstance(new Object[] { BrowserLauncher.class });
} catch (ClassNotFoundException cnfe)
{
errorMessage = cnfe.getMessage();
@@ -468,8 +477,7 @@ public class BrowserLauncher
{
mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
openURL = mrjFileUtilsClass.getDeclaredMethod("openURL",
- new Class[]
- { String.class });
+ new Class[] { String.class });
} catch (ClassNotFoundException cnfe)
{
errorMessage = cnfe.getMessage();
@@ -516,14 +524,13 @@ public class BrowserLauncher
try
{
Integer finderCreatorCode = (Integer) makeOSType.invoke(null,
- new Object[]
- { FINDER_CREATOR });
- Object aeTarget = aeTargetConstructor.newInstance(new Object[]
- { finderCreatorCode });
- Integer gurlType = (Integer) makeOSType.invoke(null, new Object[]
- { GURL_EVENT });
- Object appleEvent = appleEventConstructor.newInstance(new Object[]
- { gurlType, gurlType, aeTarget, kAutoGenerateReturnID,
+ new Object[] { FINDER_CREATOR });
+ Object aeTarget = aeTargetConstructor
+ .newInstance(new Object[] { finderCreatorCode });
+ Integer gurlType = (Integer) makeOSType.invoke(null,
+ new Object[] { GURL_EVENT });
+ Object appleEvent = appleEventConstructor.newInstance(new Object[] {
+ gurlType, gurlType, aeTarget, kAutoGenerateReturnID,
kAnyTransactionID });
// Don't set browser = appleEvent because then the next time we call
@@ -561,8 +568,8 @@ public class BrowserLauncher
try
{
- systemFolder = (File) findFolder.invoke(null, new Object[]
- { kSystemFolderType });
+ systemFolder = (File) findFolder.invoke(null,
+ new Object[] { kSystemFolderType });
} catch (IllegalArgumentException iare)
{
browser = null;
@@ -603,13 +610,12 @@ public class BrowserLauncher
// applications being picked up on certain Mac OS 9 systems,
// especially German ones, and sending a GURL event to those
// applications results in a logout under Multiple Users.
- Object fileType = getFileType.invoke(null, new Object[]
- { file });
+ Object fileType = getFileType.invoke(null, new Object[] { file });
if (FINDER_TYPE.equals(fileType.toString()))
{
- Object fileCreator = getFileCreator.invoke(null, new Object[]
- { file });
+ Object fileCreator = getFileCreator.invoke(null,
+ new Object[] { file });
if (FINDER_CREATOR.equals(fileCreator.toString()))
{
@@ -690,14 +696,17 @@ public class BrowserLauncher
{
if (!loadedWithoutErrors)
{
- throw new IOException("Exception in finding browser: " + errorMessage);
+ throw new IOException(MessageManager.formatMessage(
+ "exception.browser_not_found", new String[] { errorMessage }));
}
Object browser = locateBrowser();
if (browser == null)
{
- throw new IOException("Unable to locate browser: " + errorMessage);
+ throw new IOException(MessageManager.formatMessage(
+ "exception.browser_unable_to_locate",
+ new String[] { errorMessage }));
}
switch (jvm)
@@ -708,27 +717,25 @@ public class BrowserLauncher
try
{
- aeDesc = aeDescConstructor.newInstance(new Object[]
- { url });
- putParameter.invoke(browser, new Object[]
- { keyDirectObject, aeDesc });
- sendNoReply.invoke(browser, new Object[]
- {});
+ aeDesc = aeDescConstructor.newInstance(new Object[] { url });
+ putParameter.invoke(browser,
+ new Object[] { keyDirectObject, aeDesc });
+ sendNoReply.invoke(browser, new Object[] {});
} catch (InvocationTargetException ite)
{
- throw new IOException(
- "InvocationTargetException while creating AEDesc: "
- + ite.getMessage());
+ throw new IOException(MessageManager.formatMessage(
+ "exception.invocation_target_exception_creating_aedesc",
+ new String[] { ite.getMessage() }));
} catch (IllegalAccessException iae)
{
- throw new IOException(
- "IllegalAccessException while building AppleEvent: "
- + iae.getMessage());
+ throw new IOException(MessageManager.formatMessage(
+ "exception.illegal_access_building_apple_evt", new String[]
+ { iae.getMessage() }));
} catch (InstantiationException ie)
{
- throw new IOException(
- "InstantiationException while creating AEDesc: "
- + ie.getMessage());
+ throw new IOException(MessageManager.formatMessage(
+ "exception.illegal_access_building_apple_evt", new String[]
+ { ie.getMessage() }));
} finally
{
aeDesc = null; // Encourage it to get disposed if it was created
@@ -738,8 +745,7 @@ public class BrowserLauncher
break;
case MRJ_2_1:
- Runtime.getRuntime().exec(new String[]
- { (String) browser, url });
+ Runtime.getRuntime().exec(new String[] { (String) browser, url });
break;
@@ -750,13 +756,11 @@ public class BrowserLauncher
if (result == 0)
{
- int[] selectionStart = new int[]
- { 0 };
+ int[] selectionStart = new int[] { 0 };
byte[] urlBytes = url.getBytes();
- int[] selectionEnd = new int[]
- { urlBytes.length };
- result = ICLaunchURL(instance[0], new byte[]
- { 0 }, urlBytes, urlBytes.length, selectionStart, selectionEnd);
+ int[] selectionEnd = new int[] { urlBytes.length };
+ result = ICLaunchURL(instance[0], new byte[] { 0 }, urlBytes,
+ urlBytes.length, selectionStart, selectionEnd);
if (result == 0)
{
@@ -766,13 +770,16 @@ public class BrowserLauncher
}
else
{
- throw new IOException("Unable to launch URL: " + result);
+ throw new IOException(MessageManager.formatMessage(
+ "exception.unable_to_launch_url", new String[] { Integer
+ .valueOf(result).toString() }));
}
}
else
{
- throw new IOException(
- "Unable to create an Internet Config instance: " + result);
+ throw new IOException(MessageManager.formatMessage(
+ "exception.unable_to_create_internet_config",
+ new String[] { Integer.valueOf(result).toString() }));
}
break;
@@ -781,18 +788,17 @@ public class BrowserLauncher
try
{
- openURL.invoke(null, new Object[]
- { url });
+ openURL.invoke(null, new Object[] { url });
} catch (InvocationTargetException ite)
{
- throw new IOException(
- "InvocationTargetException while calling openURL: "
- + ite.getMessage());
+ throw new IOException(MessageManager.formatMessage(
+ "exception.invocation_target_calling_url",
+ new String[] { ite.getMessage() }));
} catch (IllegalAccessException iae)
{
- throw new IOException(
- "IllegalAccessException while calling openURL: "
- + iae.getMessage());
+ throw new IOException(MessageManager.formatMessage(
+ "exception.illegal_access_calling_url",
+ new String[] { iae.getMessage() }));
}
break;
@@ -803,8 +809,7 @@ public class BrowserLauncher
// Add quotes around the URL to allow ampersands and other special
// characters to work.
Process process = Runtime.getRuntime().exec(
- new String[]
- { (String) browser, FIRST_WINDOWS_PARAMETER,
+ new String[] { (String) browser, FIRST_WINDOWS_PARAMETER,
SECOND_WINDOWS_PARAMETER, THIRD_WINDOWS_PARAMETER,
'"' + url + '"' });
@@ -817,9 +822,9 @@ public class BrowserLauncher
process.exitValue();
} catch (InterruptedException ie)
{
- throw new IOException(
- "InterruptedException while launching browser: "
- + ie.getMessage());
+ throw new IOException(MessageManager.formatMessage(
+ "exception.interrupted_launching_browser",
+ new String[] { ie.getMessage() }));
}
break;
@@ -838,8 +843,7 @@ public class BrowserLauncher
* NETSCAPE_OPEN_NEW_WINDOW + NETSCAPE_OPEN_PARAMETER_END);
*/
process = Runtime.getRuntime().exec(
- new String[]
- {
+ new String[] {
(String) browser,
NETSCAPE_REMOTE_PARAMETER,
@@ -853,14 +857,13 @@ public class BrowserLauncher
if (exitCode != 0)
{ // if Netscape was not open
- Runtime.getRuntime().exec(new String[]
- { (String) browser, url });
+ Runtime.getRuntime().exec(new String[] { (String) browser, url });
}
} catch (InterruptedException ie)
{
- throw new IOException(
- "InterruptedException while launching browser: "
- + ie.getMessage());
+ throw new IOException(MessageManager.formatMessage(
+ "exception.interrupted_launching_browser",
+ new String[] { ie.getMessage() }));
}
break;
@@ -869,8 +872,7 @@ public class BrowserLauncher
// This should never occur, but if it does, we'll try the simplest thing
// possible
- Runtime.getRuntime().exec(new String[]
- { (String) browser, url });
+ Runtime.getRuntime().exec(new String[] { (String) browser, url });
break;
}
diff --git a/src/jalview/util/ColorUtils.java b/src/jalview/util/ColorUtils.java
new file mode 100644
index 0000000..c2f54f7
--- /dev/null
+++ b/src/jalview/util/ColorUtils.java
@@ -0,0 +1,106 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+/**
+ * author: Lauren Michelle Lui
+ */
+
+package jalview.util;
+
+import java.awt.Color;
+import java.util.Random;
+
+public class ColorUtils
+{
+
+ /**
+ * Generates a random color, will mix with input color. Code taken from
+ * http://stackoverflow
+ * .com/questions/43044/algorithm-to-randomly-generate-an-aesthetically
+ * -pleasing-color-palette
+ *
+ * @param mix
+ * @return Random color in RGB
+ */
+ public static final Color generateRandomColor(Color mix)
+ {
+ Random random = new Random();
+ int red = random.nextInt(256);
+ int green = random.nextInt(256);
+ int blue = random.nextInt(256);
+
+ // mix the color
+ if (mix != null)
+ {
+ red = (red + mix.getRed()) / 2;
+ green = (green + mix.getGreen()) / 2;
+ blue = (blue + mix.getBlue()) / 2;
+ }
+
+ Color color = new Color(red, green, blue);
+ return color;
+
+ }
+
+ /**
+ * Convert to Tk colour code format
+ *
+ * @param colour
+ * @return
+ * @see http
+ * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/colortool.html#
+ * tkcode
+ */
+ public static final String toTkCode(Color colour)
+ {
+ String colstring = "#" + ((colour.getRed() < 16) ? "0" : "")
+ + Integer.toHexString(colour.getRed())
+ + ((colour.getGreen() < 16) ? "0" : "")
+ + Integer.toHexString(colour.getGreen())
+ + ((colour.getBlue() < 16) ? "0" : "")
+ + Integer.toHexString(colour.getBlue());
+ return colstring;
+ }
+
+ /**
+ * Returns a colour three shades darker. Note you can't guarantee that
+ * brighterThan reverses this, as darkerThan may result in black.
+ *
+ * @param col
+ * @return
+ */
+ public static Color darkerThan(Color col)
+ {
+ return col == null ? null : col.darker().darker().darker();
+ }
+
+ /**
+ * Returns a colour three shades brighter. Note you can't guarantee that
+ * darkerThan reverses this, as brighterThan may result in white.
+ *
+ * @param col
+ * @return
+ */
+ public static Color brighterThan(Color col)
+ {
+ return col == null ? null : col.brighter().brighter().brighter();
+ }
+
+}
diff --git a/src/jalview/util/Comparison.java b/src/jalview/util/Comparison.java
index ff4e1a9..c491be4 100644
--- a/src/jalview/util/Comparison.java
+++ b/src/jalview/util/Comparison.java
@@ -1,34 +1,47 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.util;
-import jalview.datamodel.*;
+import jalview.datamodel.SequenceI;
+
+import java.util.ArrayList;
+import java.util.List;
/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
+ * Assorted methods for analysing or comparing sequences.
*/
public class Comparison
{
- /** DOCUMENT ME!! */
- public static final String GapChars = " .-";
+ private static final int EIGHTY_FIVE = 85;
+
+ private static final int TO_UPPER_CASE = 'a' - 'A';
+
+ private static final char GAP_SPACE = ' ';
+
+ private static final char GAP_DOT = '.';
+
+ private static final char GAP_DASH = '-';
+
+ public static final String GapChars = new String(new char[] { GAP_SPACE,
+ GAP_DOT, GAP_DASH });
/**
* DOCUMENT ME!
@@ -66,12 +79,12 @@ public class Comparison
int ilen = si.length() - 1;
int jlen = sj.length() - 1;
- while (jalview.util.Comparison.isGap(si.charAt(start + ilen)))
+ while (Comparison.isGap(si.charAt(start + ilen)))
{
ilen--;
}
- while (jalview.util.Comparison.isGap(sj.charAt(start + jlen)))
+ while (Comparison.isGap(sj.charAt(start + jlen)))
{
jlen--;
}
@@ -133,19 +146,28 @@ public class Comparison
// Another pid with region specification
public final static float PID(String seq1, String seq2, int start, int end)
{
- return PID(seq1, seq2, start, end, true,false);
+ return PID(seq1, seq2, start, end, true, false);
}
+
/**
- * Calculate percent identity for a pair of sequences over a particular range, with different options for ignoring gaps.
+ * Calculate percent identity for a pair of sequences over a particular range,
+ * with different options for ignoring gaps.
+ *
* @param seq1
* @param seq2
- * @param start - position in seqs
- * @param end - position in seqs
- * @param wcGaps - if true - gaps match any character, if false, do not match anything
- * @param ungappedOnly - if true - only count PID over ungapped columns
+ * @param start
+ * - position in seqs
+ * @param end
+ * - position in seqs
+ * @param wcGaps
+ * - if true - gaps match any character, if false, do not match
+ * anything
+ * @param ungappedOnly
+ * - if true - only count PID over ungapped columns
* @return
*/
- public final static float PID(String seq1, String seq2, int start, int end, boolean wcGaps, boolean ungappedOnly)
+ public final static float PID(String seq1, String seq2, int start,
+ int end, boolean wcGaps, boolean ungappedOnly)
{
int s1len = seq1.length();
int s2len = seq2.length();
@@ -162,7 +184,7 @@ public class Comparison
start = len - 1; // we just use a single residue for the difference
}
- int elen=len-start,bad = 0;
+ int elen = len - start, bad = 0;
char chr1;
char chr2;
boolean agap;
@@ -184,69 +206,95 @@ public class Comparison
// Faster than toUpperCase
chr2 -= caseShift;
}
-
+
if (chr1 != chr2)
{
- if (agap)
- {
- if (ungappedOnly)
- {
- elen--;
- } else if (!wcGaps) {
- bad++;
- }
- } else {
- bad++;
- }
+ if (agap)
+ {
+ if (ungappedOnly)
+ {
+ elen--;
+ }
+ else if (!wcGaps)
+ {
+ bad++;
+ }
+ }
+ else
+ {
+ bad++;
+ }
}
-
+
+ }
+ if (elen < 1)
+ {
+ return 0f;
}
- if (elen<1) { return 0f; }
return ((float) 100 * (elen - bad)) / elen;
}
/**
- * DOCUMENT ME!
+ * Answers true if the supplied character is a recognised gap character, else
+ * false. Currently hard-coded to recognise '-', '-' or ' ' (hyphen / dot /
+ * space).
*
* @param c
- * DOCUMENT ME!
*
- * @return DOCUMENT ME!
+ * @return
*/
public static final boolean isGap(char c)
{
- return (c == '-' || c == '.' || c == ' ') ? true : false;
+ return (c == GAP_DASH || c == GAP_DOT || c == GAP_SPACE) ? true : false;
}
+ /**
+ * Answers true if more than 85% of the sequence residues (ignoring gaps) are
+ * A, G, C, T or U, else false. This is just a heuristic guess and may give a
+ * wrong answer (as AGCT are also amino acid codes).
+ *
+ * @param seqs
+ * @return
+ */
public static final boolean isNucleotide(SequenceI[] seqs)
{
- int i = 0, iSize = seqs.length, j, jSize;
- float nt = 0, aa = 0;
- char c;
- while (i < iSize)
+ if (seqs == null)
+ {
+ return false;
+ }
+ int ntCount = 0;
+ int aaCount = 0;
+ for (SequenceI seq : seqs)
{
- jSize = seqs[i].getLength();
- for (j = 0; j < jSize; j++)
+ if (seq == null)
+ {
+ continue;
+ }
+ // TODO could possibly make an informed guess just from the first sequence
+ // to save a lengthy calculation
+ for (char c : seq.getSequence())
{
- c = seqs[i].getCharAt(j);
if ('a' <= c && c <= 'z')
{
- c -= ('a' - 'A');
+ c -= TO_UPPER_CASE;
}
if (c == 'A' || c == 'G' || c == 'C' || c == 'T' || c == 'U')
{
- nt++;
+ ntCount++;
}
- else if (!jalview.util.Comparison.isGap(seqs[i].getCharAt(j)))
+ else if (!Comparison.isGap(c))
{
- aa++;
+ aaCount++;
}
}
- i++;
}
- if ((nt / (nt + aa)) > 0.85f)
+ /*
+ * Check for nucleotide count > 85% of total count (in a form that evades
+ * int / float conversion or divide by zero).
+ */
+ if (ntCount * 100 > EIGHTY_FIVE * (ntCount + aaCount))
{
return true;
}
@@ -256,4 +304,29 @@ public class Comparison
}
}
+
+ /**
+ * Convenience overload of isNucleotide
+ *
+ * @param seqs
+ * @return
+ */
+ public static boolean isNucleotide(SequenceI[][] seqs)
+ {
+ if (seqs == null)
+ {
+ return false;
+ }
+ List<SequenceI> flattened = new ArrayList<SequenceI>();
+ for (SequenceI[] ss : seqs)
+ {
+ for (SequenceI s : ss)
+ {
+ flattened.add(s);
+ }
+ }
+ final SequenceI[] oneDArray = flattened.toArray(new SequenceI[flattened
+ .size()]);
+ return isNucleotide(oneDArray);
+ }
}
diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java
index 42fbef6..32589f7 100644
--- a/src/jalview/util/DBRefUtils.java
+++ b/src/jalview/util/DBRefUtils.java
@@ -1,28 +1,58 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.util;
-import java.util.*;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
-import jalview.datamodel.*;
+import com.stevesoft.pat.Regex;
public class DBRefUtils
{
+ private static Map<String, String> canonicalSourceNameLookup = new HashMap<String, String>();
+
+ private static Map<String, String> dasCoordinateSystemsLookup = new HashMap<String, String>();
+
+ static
+ {
+ // TODO load these from a resource file?
+ canonicalSourceNameLookup.put("uniprotkb/swiss-prot",
+ DBRefSource.UNIPROT);
+ canonicalSourceNameLookup.put("uniprotkb/trembl", DBRefSource.UNIPROT);
+ canonicalSourceNameLookup.put("pdb", DBRefSource.PDB);
+
+ dasCoordinateSystemsLookup.put("pdbresnum", DBRefSource.PDB);
+ dasCoordinateSystemsLookup.put("uniprot", DBRefSource.UNIPROT);
+ dasCoordinateSystemsLookup.put("embl", DBRefSource.EMBL);
+ // dasCoordinateSystemsLookup.put("embl", DBRefSource.EMBLCDS);
+ }
+
/**
* Utilities for handling DBRef objects and their collections.
*/
@@ -45,8 +75,8 @@ public class DBRefUtils
{
return dbrefs;
}
- Hashtable srcs = new Hashtable();
- Vector res = new Vector();
+ Map<String, Integer> srcs = new HashMap<String, Integer>();
+ ArrayList<DBRefEntry> res = new ArrayList<DBRefEntry>();
for (int i = 0; i < sources.length; i++)
{
@@ -56,18 +86,14 @@ public class DBRefUtils
{
if (srcs.containsKey(dbrefs[i].getSource()))
{
- res.addElement(dbrefs[i]);
+ res.add(dbrefs[i]);
}
}
if (res.size() > 0)
{
DBRefEntry[] reply = new DBRefEntry[res.size()];
- for (int i = 0; i < res.size(); i++)
- {
- reply[i] = (DBRefEntry) res.elementAt(i);
- }
- return reply;
+ return res.toArray(reply);
}
res = null;
// there are probable memory leaks in the hashtable!
@@ -84,37 +110,19 @@ public class DBRefUtils
* @return boolean true if Source DBRefEntry is compatible with DAS
* CoordinateSystem name
*/
- public static Hashtable DasCoordinateSystemsLookup = null;
public static boolean isDasCoordinateSystem(String string,
DBRefEntry dBRefEntry)
{
- if (DasCoordinateSystemsLookup == null)
- {
- // TODO: Make a DasCoordinateSystemsLookup properties resource
- // Initialise
- DasCoordinateSystemsLookup = new Hashtable();
- DasCoordinateSystemsLookup.put("pdbresnum",
- jalview.datamodel.DBRefSource.PDB);
- DasCoordinateSystemsLookup.put("uniprot",
- jalview.datamodel.DBRefSource.UNIPROT);
- DasCoordinateSystemsLookup.put("EMBL",
- jalview.datamodel.DBRefSource.EMBL);
- // DasCoordinateSystemsLookup.put("EMBL",
- // jalview.datamodel.DBRefSource.EMBLCDS);
- }
-
- String coordsys = (String) DasCoordinateSystemsLookup.get(string
- .toLowerCase());
- if (coordsys != null)
+ if (string == null || dBRefEntry == null)
{
- return coordsys.equals(dBRefEntry.getSource());
+ return false;
}
- return false;
+ String coordsys = dasCoordinateSystemsLookup.get(string.toLowerCase());
+ return coordsys == null ? false : coordsys.equals(dBRefEntry
+ .getSource());
}
- public static Hashtable CanonicalSourceNameLookup = null;
-
/**
* look up source in an internal list of database reference sources and return
* the canonical jalview name for the source, or the original string if it has
@@ -126,34 +134,27 @@ public class DBRefUtils
*/
public static String getCanonicalName(String source)
{
- if (CanonicalSourceNameLookup == null)
- {
- CanonicalSourceNameLookup = new Hashtable();
- CanonicalSourceNameLookup.put("uniprotkb/swiss-prot",
- jalview.datamodel.DBRefSource.UNIPROT);
- CanonicalSourceNameLookup.put("uniprotkb/trembl",
- jalview.datamodel.DBRefSource.UNIPROT);
- CanonicalSourceNameLookup.put("pdb",
- jalview.datamodel.DBRefSource.PDB);
- }
- String canonical = (String) CanonicalSourceNameLookup.get(source
- .toLowerCase());
- if (canonical == null)
+ if (source == null)
{
- return source;
+ return null;
}
- return canonical;
+ String canonical = canonicalSourceNameLookup.get(source.toLowerCase());
+ return canonical == null ? source : canonical;
}
/**
- * find RefEntry corresponding to a particular pattern the equals method of
- * each entry is used, from String attributes right down to Mapping
- * attributes.
+ * Returns an array of those references that match the given entry, or null if
+ * no matches. Currently uses a comparator which matches if
+ * <ul>
+ * <li>database sources are the same</li>
+ * <li>accession ids are the same</li>
+ * <li>both have no mapping, or the mappings are the same</li>
+ * </ul>
*
* @param ref
* Set of references to search
* @param entry
- * pattern to collect - null any entry for wildcard match
+ * pattern to match
* @return
*/
public static DBRefEntry[] searchRefs(DBRefEntry[] ref, DBRefEntry entry)
@@ -162,30 +163,36 @@ public class DBRefUtils
matchDbAndIdAndEitherMapOrEquivalentMapList);
}
- public static DBRefEntry[] searchRefs(DBRefEntry[] ref, DBRefEntry entry,
+ /**
+ * Returns an array of those references that match the given entry, according
+ * to the given comparator. Returns null if no matches.
+ *
+ * @param refs
+ * an array of database references to search
+ * @param entry
+ * an entry to compare against
+ * @param comparator
+ * @return
+ */
+ static DBRefEntry[] searchRefs(DBRefEntry[] refs, DBRefEntry entry,
DbRefComp comparator)
{
- if (ref == null || entry == null)
+ if (refs == null || entry == null)
+ {
return null;
- Vector rfs = new Vector();
- for (int i = 0; i < ref.length; i++)
+ }
+ List<DBRefEntry> rfs = new ArrayList<DBRefEntry>();
+ for (int i = 0; i < refs.length; i++)
{
- if (comparator.matches(entry, ref[i]))
+ if (comparator.matches(entry, refs[i]))
{
- rfs.addElement(ref[i]);
+ rfs.add(refs[i]);
}
}
- // TODO Auto-generated method stub
- if (rfs.size() > 0)
- {
- DBRefEntry[] rf = new DBRefEntry[rfs.size()];
- rfs.copyInto(rf);
- return rf;
- }
- return null;
+ return rfs.size() == 0 ? null : rfs.toArray(new DBRefEntry[rfs.size()]);
}
- public interface DbRefComp
+ interface DbRefComp
{
public boolean matches(DBRefEntry refa, DBRefEntry refb);
}
@@ -300,6 +307,7 @@ public class DBRefUtils
{
if ((refa.getMap() == null && refb.getMap() == null)
|| (refa.getMap() != null && refb.getMap() != null))
+ {
if ((refb.getMap().getMap() == null && refa.getMap().getMap() == null)
|| (refb.getMap().getMap() != null
&& refa.getMap().getMap() != null && refb
@@ -308,6 +316,7 @@ public class DBRefUtils
{
return true;
}
+ }
}
}
return false;
@@ -393,14 +402,17 @@ public class DBRefUtils
};
/**
- * used by file parsers to generate DBRefs from annotation within file (eg
- * stockholm)
+ * Parses a DBRefEntry and adds it to the sequence, also a PDBEntry if the
+ * database is PDB.
+ * <p>
+ * Used by file parsers to generate DBRefs from annotation within file (eg
+ * Stockholm)
*
* @param dbname
* @param version
* @param acn
* @param seq
- * where to anotate with reference
+ * where to annotate with reference
* @return parsed version of entry that was added to seq (if any)
*/
public static DBRefEntry parseToDbRef(SequenceI seq, String dbname,
@@ -409,19 +421,25 @@ public class DBRefUtils
DBRefEntry ref = null;
if (dbname != null)
{
- String locsrc = jalview.util.DBRefUtils.getCanonicalName(dbname);
- if (locsrc.equals(jalview.datamodel.DBRefSource.PDB))
+ String locsrc = DBRefUtils.getCanonicalName(dbname);
+ if (locsrc.equals(DBRefSource.PDB))
{
- // check for chaincode and mapping
- // PFAM style stockhom PDB citation
- com.stevesoft.pat.Regex r = new com.stevesoft.pat.Regex(
- "([0-9][0-9A-Za-z]{3})\\s*(.?)\\s*;([0-9]+)-([0-9]+)");
+ /*
+ * Check for PFAM style stockhom PDB accession id citation e.g.
+ * "1WRI A; 7-80;"
+ */
+ Regex r = new com.stevesoft.pat.Regex(
+ "([0-9][0-9A-Za-z]{3})\\s*(.?)\\s*;\\s*([0-9]+)-([0-9]+)");
if (r.search(acn.trim()))
{
String pdbid = r.stringMatched(1);
String chaincode = r.stringMatched(2);
- String mapstart = r.stringMatched(3);
- String mapend = r.stringMatched(4);
+ if (chaincode == null)
+ {
+ chaincode = " ";
+ }
+ // String mapstart = r.stringMatched(3);
+ // String mapend = r.stringMatched(4);
if (chaincode.equals(" "))
{
chaincode = "_";
@@ -430,8 +448,16 @@ public class DBRefUtils
ref = new DBRefEntry(locsrc, version, pdbid + chaincode);
PDBEntry pdbr = new PDBEntry();
pdbr.setId(pdbid);
+ pdbr.setType(PDBEntry.Type.PDB);
+ pdbr.setProperty(new Hashtable());
+ pdbr.setChainCode(chaincode);
+ // pdbr.getProperty().put("CHAIN", chaincode);
seq.addPDBId(pdbr);
}
+ else
+ {
+ System.err.println("Malformed PDB DR line:" + acn);
+ }
}
else
{
diff --git a/src/jalview/util/Format.java b/src/jalview/util/Format.java
index 89d5a5c..ffc80d3 100644
--- a/src/jalview/util/Format.java
+++ b/src/jalview/util/Format.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
/**
* A class for formatting numbers that follows printf conventions.
@@ -51,6 +54,8 @@ public class Format
private char fmt; // one of cdeEfgGiosxXos
+ private final String formatString;
+
/**
* Creates a new Format object.
*
@@ -59,6 +64,7 @@ public class Format
*/
public Format(String s)
{
+ formatString = s;
width = 0;
precision = -1;
pre = "";
@@ -619,7 +625,7 @@ public class Format
/**
* Formats a character into a string (like sprintf in C)
*
- * @param x
+ * @param debounceTrap
* the value to format
* @return the formatted string
*/
@@ -638,7 +644,7 @@ public class Format
/**
* Formats a string into a larger string (like sprintf in C)
*
- * @param x
+ * @param debounceTrap
* the value to format
* @return the formatted string
*/
@@ -935,4 +941,10 @@ public class Format
return f + p.substring(p.length() - 3, p.length());
}
+
+ @Override
+ public String toString()
+ {
+ return formatString;
+ }
}
diff --git a/src/jalview/util/GroupUrlLink.java b/src/jalview/util/GroupUrlLink.java
index 581ca4b..1acf94b 100644
--- a/src/jalview/util/GroupUrlLink.java
+++ b/src/jalview/util/GroupUrlLink.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.util;
@@ -21,7 +24,6 @@ import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
import java.util.Hashtable;
-import java.util.Vector;
public class GroupUrlLink
{
@@ -80,8 +82,7 @@ public class GroupUrlLink
{
if (tokens == null)
{
- tokens = new String[]
- { "SEQUENCEIDS", "SEQUENCES", "DATASETID" };
+ tokens = new String[] { "SEQUENCEIDS", "SEQUENCES", "DATASETID" };
}
}
@@ -389,12 +390,12 @@ public class GroupUrlLink
Hashtable rstrings = new Hashtable();
rstrings.put(tokens[0], idstrings);
rstrings.put(tokens[1], seqstrings);
- rstrings.put(tokens[2], new String[]
- { dsstring });
+ rstrings.put(tokens[2], new String[] { dsstring });
if (idstrings.length != seqstrings.length)
{
throw new Error(
- "idstrings and seqstrings contain one string each per sequence.");
+ MessageManager
+ .getString("error.idstring_seqstrings_only_one_per_sequence"));
}
return rstrings;
}
@@ -421,9 +422,8 @@ public class GroupUrlLink
Object[] stubs = makeUrlsIf(false, rstrings, b);
if (stubs != null)
{
- return new Object[]
- { stubs[0], stubs[1], rstrings, new boolean[]
- { b } };
+ return new Object[] { stubs[0], stubs[1], rstrings,
+ new boolean[] { b } };
}
// TODO Auto-generated method stub
return null;
@@ -484,18 +484,19 @@ public class GroupUrlLink
{
if (maxs != idseq[i].length)
{
- throw new Error(
- "Cannot have mixed length replacement vectors. Replacement vector for "
- + (mtch[i]) + " is " + idseq[i].length
- + " strings long, and have already seen a "
- + maxs + " length vector.");
+ throw new Error(MessageManager.formatMessage(
+ "error.cannot_have_mixed_length_replacement_vectors",
+ new String[] { (mtch[i]),
+ Integer.valueOf(idseq[i].length).toString(),
+ Integer.valueOf(maxs).toString() }));
}
}
}
else
{
throw new Error(
- "Cannot have zero length vector of replacement strings - either 1 value or n values.");
+ MessageManager
+ .getString("error.cannot_have_zero_length_vector_replacement_strings"));
}
}
// iterate through input, collating segments to be inserted into url
@@ -691,9 +692,7 @@ public class GroupUrlLink
{
// just return the essential info about what the URL would be generated
// from
- return new Object[]
- { new int[]
- { seqsmatched }, thismatched };
+ return new Object[] { new int[] { seqsmatched }, thismatched };
}
// otherwise, create the URL completely.
@@ -708,10 +707,8 @@ public class GroupUrlLink
}
}
- return new Object[]
- { new int[]
- { seqsmatched }, thismatched, matched, new String[]
- { submiturl.toString() } };
+ return new Object[] { new int[] { seqsmatched }, thismatched, matched,
+ new String[] { submiturl.toString() } };
}
/**
@@ -818,8 +815,8 @@ public class GroupUrlLink
public static void main(String argv[])
{
- String[] links = new String[]
- {
+ // note - JAL-1383 - these services are all dead
+ String[] links = new String[] {
"EnVision2|IDS|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?workflow=Enfin%20Default%20Workflow&datasetName=linkInDatasetFromJalview&input=$SEQUENCEIDS$&inputType=0|,",
"EnVision2|Seqs|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?workflow=Enfin%20Default%20Workflow&datasetName=linkInDatasetFromJalview&input=$SEQUENCES$&inputType=1|,",
"EnVision2|IDS|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?workflow=Enfin%20Default%20Workflow&datasetName=$DATASETID$&input=$SEQUENCEIDS$&inputType=0|,",
@@ -835,8 +832,8 @@ public class GroupUrlLink
*/
};
- SequenceI[] seqs = new SequenceI[]
- { new Sequence("StupidLabel:gi|9234|pdb|102L|A",
+ SequenceI[] seqs = new SequenceI[] { new Sequence(
+ "StupidLabel:gi|9234|pdb|102L|A",
"asdiasdpasdpadpwpadasdpaspdw"), };
String[][] seqsandids = formStrings(seqs);
for (int i = 0; i < links.length; i++)
diff --git a/src/jalview/util/ImageMaker.java b/src/jalview/util/ImageMaker.java
index b4547be..3c7ac8c 100644
--- a/src/jalview/util/ImageMaker.java
+++ b/src/jalview/util/ImageMaker.java
@@ -1,69 +1,112 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.util;
-import java.io.*;
-import javax.imageio.*;
+import jalview.bin.Jalview;
+import jalview.gui.EPSOptions;
+import jalview.gui.SVGOptions;
+import jalview.io.JalviewFileChooser;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileOutputStream;
-import java.awt.*;
-import java.awt.image.*;
+import javax.imageio.ImageIO;
-import org.jibble.epsgraphics.*;
-import jalview.gui.*;
-import jalview.io.*;
+import org.jfree.graphics2d.svg.SVGGraphics2D;
+import org.jfree.graphics2d.svg.SVGHints;
+import org.jibble.epsgraphics.EpsGraphics2D;
public class ImageMaker
{
- public static final int EPS = 0;
-
- public static final int PNG = 1;
-
- int type = -1;
-
EpsGraphics2D pg;
+ SVGGraphics2D g2;
+
Graphics graphics;
FileOutputStream out;
BufferedImage bi;
- public ImageMaker(Component parent, int type, String title, int width,
- int height, File file, String EPStitle)
+ TYPE type;
+
+ public enum TYPE
+ {
+ EPS("EPS", MessageManager.getString("label.eps_file"), getEPSChooser()), PNG(
+ "PNG", MessageManager.getString("label.png_image"),
+ getPNGChooser()), SVG("SVG", "SVG", getSVGChooser());
+
+ private JalviewFileChooser chooser;
+
+ private String name;
+
+ private String label;
+
+ TYPE(String name, String label, JalviewFileChooser chooser)
+ {
+ this.name = name;
+ this.label = label;
+ this.chooser = chooser;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public JalviewFileChooser getChooser()
+ {
+ return chooser;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ }
+
+ public ImageMaker(Component parent, TYPE type, String title, int width,
+ int height, File file, String fileTitle)
{
this.type = type;
if (file == null)
{
JalviewFileChooser chooser;
- chooser = type == EPS ? getEPSChooser() : getPNGChooser();
-
+ chooser = type.getChooser();
chooser.setFileView(new jalview.io.JalviewFileView());
chooser.setDialogTitle(title);
- chooser.setToolTipText("Save");
-
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(parent);
if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
{
jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
.getSelectedFile().getParent());
-
file = chooser.getSelectedFile();
}
}
@@ -73,19 +116,22 @@ public class ImageMaker
try
{
out = new FileOutputStream(file);
-
- if (type == EPS)
+ if (type == TYPE.SVG)
{
- setupEPS(width, height, EPStitle);
+ setupSVG(width, height, fileTitle);
}
- else
+ else if (type == TYPE.EPS)
+ {
+ setupEPS(width, height, fileTitle);
+ }
+ else if (type == TYPE.PNG)
{
setupPNG(width, height);
}
+
} catch (Exception ex)
{
- System.out.println("Error creating "
- + (type == EPS ? "EPS" : "PNG") + " file.");
+ System.out.println("Error creating " + type.getName() + " file.");
}
}
}
@@ -95,15 +141,6 @@ public class ImageMaker
return graphics;
}
- void setupPNG(int width, int height)
- {
- bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
- graphics = bi.getGraphics();
- Graphics2D ig2 = (Graphics2D) graphics;
- ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
- }
-
public void writeImage()
{
try
@@ -114,8 +151,15 @@ public class ImageMaker
pg.flush();
pg.close();
break;
+ case SVG:
+ String svgData = ((SVGGraphics2D) getGraphics()).getSVGDocument();
+ out.write(svgData.getBytes());
+ out.flush();
+ out.close();
+ break;
case PNG:
ImageIO.write(bi, "png", out);
+ out.flush();
out.close();
break;
}
@@ -155,7 +199,7 @@ public class ImageMaker
try
{
pg = new EpsGraphics2D(title, out, 0, 0, width, height);
- Graphics2D ig2 = (Graphics2D) pg;
+ Graphics2D ig2 = pg;
ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
@@ -167,19 +211,85 @@ public class ImageMaker
}
}
- JalviewFileChooser getPNGChooser()
+ void setupPNG(int width, int height)
+ {
+ bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+ graphics = bi.getGraphics();
+ Graphics2D ig2 = (Graphics2D) graphics;
+ ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
+ }
+
+ void setupSVG(int width, int height, String title)
{
+
+ g2 = new SVGGraphics2D(width, height);
+ Graphics2D ig2 = g2;
+
+ String renderStyle = jalview.bin.Cache.getDefault("SVG_RENDERING",
+ "Prompt each time");
+
+ // If we need to prompt, and if the GUI is visible then
+ // Prompt for EPS rendering style
+ if (renderStyle.equalsIgnoreCase("Prompt each time")
+ && !(System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true")))
+ {
+ SVGOptions svgOption = new SVGOptions();
+ renderStyle = svgOption.getValue();
+
+ if (renderStyle == null || svgOption.cancelled)
+ {
+ return;
+ }
+ }
+
+ if (renderStyle.equalsIgnoreCase("lineart"))
+ {
+ ig2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
+ SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
+ }
+
+ graphics = g2;
+ }
+
+ static JalviewFileChooser getPNGChooser()
+ {
+ if (Jalview.isHeadlessMode())
+ {
+ return null;
+ }
+ return new jalview.io.JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "png" },
+ new String[] { "Portable network graphics" },
+ "Portable network graphics");
+ }
+
+ static JalviewFileChooser getEPSChooser()
+ {
+ if (Jalview.isHeadlessMode())
+ {
+ return null;
+ }
return new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "png" }, new String[]
- { "Portable network graphics" }, "Portable network graphics");
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "eps" },
+ new String[] { "Encapsulated Postscript" },
+ "Encapsulated Postscript");
}
- JalviewFileChooser getEPSChooser()
+ static JalviewFileChooser getSVGChooser()
{
+ if (Jalview.isHeadlessMode())
+ {
+ return null;
+ }
return new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "eps" }, new String[]
- { "Encapsulated Postscript" }, "Encapsulated Postscript");
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ new String[] { "svg" },
+ new String[] { "Scalable Vector Graphics" },
+ "Scalable Vector Graphics");
}
}
diff --git a/src/jalview/util/MapList.java b/src/jalview/util/MapList.java
index e5a0254..a20a340 100644
--- a/src/jalview/util/MapList.java
+++ b/src/jalview/util/MapList.java
@@ -1,102 +1,140 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.util;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
/**
- * MapList Simple way of bijectively mapping a non-contiguous linear range to
- * another non-contiguous linear range Use at your own risk! TODO: efficient
- * implementation of private posMap method TODO: test/ensure that sense of from
- * and to ratio start position is conserved (codon start position recovery)
- * TODO: optimize to use int[][] arrays rather than vectors.
+ * A simple way of bijectively mapping a non-contiguous linear range to another
+ * non-contiguous linear range.
+ *
+ * Use at your own risk!
+ *
+ * TODO: efficient implementation of private posMap method
+ *
+ * TODO: test/ensure that sense of from and to ratio start position is conserved
+ * (codon start position recovery)
*/
public class MapList
{
+
/*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
+ * Subregions (base 1) described as { [start1, end1], [start2, end2], ...}
+ */
+ private List<int[]> fromShifts = new ArrayList<int[]>();
+
+ /*
+ * Same format as fromShifts, for the 'mapped to' sequence
+ */
+ private List<int[]> toShifts = new ArrayList<int[]>();
+
+ /*
+ * number of steps in fromShifts to one toRatio unit
+ */
+ private int fromRatio;
+
+ /*
+ * number of steps in toShifts to one fromRatio
+ */
+ private int toRatio;
+
+ /*
+ * lowest and highest value in the from Map
+ */
+ private int fromLowest;
+
+ private int fromHighest;
+
+ /*
+ * lowest and highest value in the to Map
+ */
+ private int toLowest;
+
+ private int toHighest;
+
+ /**
+ * Two MapList objects are equal if they are the same object, or they both
+ * have populated shift ranges and all values are the same.
*/
- public boolean equals(MapList obj)
+ @Override
+ public boolean equals(Object o)
{
+ // TODO should also override hashCode to ensure equal objects have equal
+ // hashcodes
+ if (o == null || !(o instanceof MapList))
+ {
+ return false;
+ }
+
+ MapList obj = (MapList) o;
if (obj == this)
+ {
return true;
- if (obj != null && obj.fromRatio == fromRatio && obj.toRatio == toRatio
- && obj.fromShifts != null && obj.toShifts != null)
- {
- int i, iSize = fromShifts.size(), j, jSize = obj.fromShifts.size();
- if (iSize != jSize)
- return false;
- for (i = 0, iSize = fromShifts.size(), j = 0, jSize = obj.fromShifts
- .size(); i < iSize;)
- {
- int[] mi = (int[]) fromShifts.elementAt(i++);
- int[] mj = (int[]) obj.fromShifts.elementAt(j++);
- if (mi[0] != mj[0] || mi[1] != mj[1])
- return false;
- }
- iSize = toShifts.size();
- jSize = obj.toShifts.size();
- if (iSize != jSize)
- return false;
- for (i = 0, j = 0; i < iSize;)
- {
- int[] mi = (int[]) toShifts.elementAt(i++);
- int[] mj = (int[]) obj.toShifts.elementAt(j++);
- if (mi[0] != mj[0] || mi[1] != mj[1])
- return false;
- }
- return true;
}
- return false;
+ if (obj.fromRatio != fromRatio || obj.toRatio != toRatio
+ || obj.fromShifts == null || obj.toShifts == null)
+ {
+ return false;
+ }
+ return Arrays
+ .deepEquals(fromShifts.toArray(), obj.fromShifts.toArray())
+ && Arrays
+ .deepEquals(toShifts.toArray(), obj.toShifts.toArray());
}
- public Vector fromShifts;
-
- public Vector toShifts;
-
- int fromRatio; // number of steps in fromShifts to one toRatio unit
-
- int toRatio; // number of steps in toShifts to one fromRatio
-
/**
+ * Returns the 'from' ranges as {[start1, end1], [start2, end2], ...}
*
- * @return series of intervals mapped in from
+ * @return
*/
- public int[] getFromRanges()
+ public List<int[]> getFromRanges()
{
- return getRanges(fromShifts);
+ return fromShifts;
}
- public int[] getToRanges()
+ /**
+ * Returns the 'to' ranges as {[start1, end1], [start2, end2], ...}
+ *
+ * @return
+ */
+ public List<int[]> getToRanges()
{
- return getRanges(toShifts);
+ return toShifts;
}
- private int[] getRanges(Vector shifts)
+ /**
+ * Flattens a list of [start, end] into a single [start1, end1, start2,
+ * end2,...] array.
+ *
+ * @param shifts
+ * @return
+ */
+ protected static int[] getRanges(List<int[]> shifts)
{
int[] rnges = new int[2 * shifts.size()];
- Enumeration e = shifts.elements();
int i = 0;
- while (e.hasMoreElements())
+ for (int[] r : shifts)
{
- int r[] = (int[]) e.nextElement();
rnges[i++] = r[0];
rnges[i++] = r[1];
}
@@ -104,16 +142,6 @@ public class MapList
}
/**
- * lowest and highest value in the from Map
- */
- int[] fromRange = null;
-
- /**
- * lowest and highest value in the to Map
- */
- int[] toRange = null;
-
- /**
*
* @return length of mapped phrase in from
*/
@@ -133,100 +161,133 @@ public class MapList
public int getFromLowest()
{
- return fromRange[0];
+ return fromLowest;
}
public int getFromHighest()
{
- return fromRange[1];
+ return fromHighest;
}
public int getToLowest()
{
- return toRange[0];
+ return toLowest;
}
public int getToHighest()
{
- return toRange[1];
- }
-
- private void ensureRange(int[] limits, int pos)
- {
- if (limits[0] > pos)
- limits[0] = pos;
- if (limits[1] < pos)
- limits[1] = pos;
+ return toHighest;
}
+ /**
+ * Constructor.
+ *
+ * @param from
+ * contiguous regions as [start1, end1, start2, end2, ...]
+ * @param to
+ * same format as 'from'
+ * @param fromRatio
+ * phrase length in 'from' (e.g. 3 for dna)
+ * @param toRatio
+ * phrase length in 'to' (e.g. 1 for protein)
+ */
public MapList(int from[], int to[], int fromRatio, int toRatio)
{
- fromRange = new int[]
- { from[0], from[1] };
- toRange = new int[]
- { to[0], to[1] };
-
- fromShifts = new Vector();
+ this.fromRatio = fromRatio;
+ this.toRatio = toRatio;
+ fromLowest = from[0];
+ fromHighest = from[1];
for (int i = 0; i < from.length; i += 2)
{
- ensureRange(fromRange, from[i]);
- ensureRange(fromRange, from[i + 1]);
+ fromLowest = Math.min(fromLowest, from[i]);
+ fromHighest = Math.max(fromHighest, from[i + 1]);
- fromShifts.addElement(new int[]
- { from[i], from[i + 1] });
+ fromShifts.add(new int[] { from[i], from[i + 1] });
}
- toShifts = new Vector();
+
+ toLowest = to[0];
+ toHighest = to[1];
for (int i = 0; i < to.length; i += 2)
{
- ensureRange(toRange, to[i]);
- ensureRange(toRange, to[i + 1]);
- toShifts.addElement(new int[]
- { to[i], to[i + 1] });
+ toLowest = Math.min(toLowest, to[i]);
+ toHighest = Math.max(toHighest, to[i + 1]);
+ toShifts.add(new int[] { to[i], to[i + 1] });
}
- this.fromRatio = fromRatio;
- this.toRatio = toRatio;
}
+ /**
+ * Copy constructor. Creates an identical mapping.
+ *
+ * @param map
+ */
public MapList(MapList map)
{
- this.fromRange = new int[]
- { map.fromRange[0], map.fromRange[1] };
- this.toRange = new int[]
- { map.toRange[0], map.toRange[1] };
+ // TODO not used - remove?
+ this.fromLowest = map.fromLowest;
+ this.fromHighest = map.fromHighest;
+ this.toLowest = map.toLowest;
+ this.toHighest = map.toHighest;
+
this.fromRatio = map.fromRatio;
this.toRatio = map.toRatio;
if (map.fromShifts != null)
{
- this.fromShifts = new Vector();
- Enumeration e = map.fromShifts.elements();
- while (e.hasMoreElements())
+ for (int[] r : map.fromShifts)
{
- int[] el = (int[]) e.nextElement();
- fromShifts.addElement(new int[]
- { el[0], el[1] });
+ fromShifts.add(new int[] { r[0], r[1] });
}
}
if (map.toShifts != null)
{
- this.toShifts = new Vector();
- Enumeration e = map.toShifts.elements();
- while (e.hasMoreElements())
+ for (int[] r : map.toShifts)
{
- int[] el = (int[]) e.nextElement();
- toShifts.addElement(new int[]
- { el[0], el[1] });
+ toShifts.add(new int[] { r[0], r[1] });
}
}
}
/**
+ * Constructor given ranges as lists of [start, end] positions
+ *
+ * @param fromRange
+ * @param toRange
+ * @param fromRatio
+ * @param toRatio
+ */
+ public MapList(List<int[]> fromRange, List<int[]> toRange, int fromRatio,
+ int toRatio)
+ {
+ this.fromShifts = fromRange;
+ this.toShifts = toRange;
+ this.fromRatio = fromRatio;
+ this.toRatio = toRatio;
+
+ fromLowest = Integer.MAX_VALUE;
+ fromHighest = 0;
+ for (int[] range : fromRange)
+ {
+ fromLowest = Math.min(fromLowest, range[0]);
+ fromHighest = Math.max(fromHighest, range[1]);
+ }
+
+ toLowest = Integer.MAX_VALUE;
+ toHighest = 0;
+ for (int[] range : toRange)
+ {
+ toLowest = Math.min(toLowest, range[0]);
+ toHighest = Math.max(toHighest, range[1]);
+ }
+ }
+
+ /**
* get all mapped positions from 'from' to 'to'
*
* @return int[][] { int[] { fromStart, fromFinish, toStart, toFinish }, int
* [fromFinish-fromStart+2] { toStart..toFinish mappings}}
*/
- public int[][] makeFromMap()
+ protected int[][] makeFromMap()
{
+ // TODO not used - remove??
return posMap(fromShifts, fromRatio, toShifts, toRatio);
}
@@ -235,27 +296,29 @@ public class MapList
*
* @return int[to position]=position mapped in from
*/
- public int[][] makeToMap()
+ protected int[][] makeToMap()
{
+ // TODO not used - remove??
return posMap(toShifts, toRatio, fromShifts, fromRatio);
}
/**
* construct an int map for intervals in intVals
*
- * @param intVals
+ * @param shiftTo
* @return int[] { from, to pos in range }, int[range.to-range.from+1]
* returning mapped position
*/
- private int[][] posMap(Vector intVals, int ratio, Vector toIntVals,
- int toRatio)
+ private int[][] posMap(List<int[]> shiftTo, int ratio,
+ List<int[]> shiftFrom, int toRatio)
{
- int iv = 0, ivSize = intVals.size();
+ // TODO not used - remove??
+ int iv = 0, ivSize = shiftTo.size();
if (iv >= ivSize)
{
return null;
}
- int[] intv = (int[]) intVals.elementAt(iv++);
+ int[] intv = shiftTo.get(iv++);
int from = intv[0], to = intv[1];
if (from > to)
{
@@ -264,7 +327,7 @@ public class MapList
}
while (iv < ivSize)
{
- intv = (int[]) intVals.elementAt(iv++);
+ intv = shiftTo.get(iv++);
if (intv[0] < from)
{
from = intv[0];
@@ -286,7 +349,7 @@ public class MapList
int mp[][] = new int[to - from + 2][];
for (int i = 0; i < mp.length; i++)
{
- int[] m = shift(i + from, intVals, ratio, toIntVals, toRatio);
+ int[] m = shift(i + from, shiftTo, ratio, shiftFrom, toRatio);
if (m != null)
{
if (i == 0)
@@ -307,9 +370,8 @@ public class MapList
}
mp[i] = m;
}
- int[][] map = new int[][]
- { new int[]
- { from, to, tF, tT }, new int[to - from + 2] };
+ int[][] map = new int[][] { new int[] { from, to, tF, tT },
+ new int[to - from + 2] };
map[0][2] = tF;
map[0][3] = tT;
@@ -342,6 +404,7 @@ public class MapList
* shifts.insertElementAt(new int[] { pos, shift}, sidx); else
* rshift[1]+=shift; }
*/
+
/**
* shift from pos to To(pos)
*
@@ -370,51 +433,50 @@ public class MapList
/**
*
- * @param fromShifts
+ * @param shiftTo
* @param fromRatio
- * @param toShifts
+ * @param shiftFrom
* @param toRatio
* @return
*/
- private int[] shift(int pos, Vector fromShifts, int fromRatio,
- Vector toShifts, int toRatio)
+ protected static int[] shift(int pos, List<int[]> shiftTo, int fromRatio,
+ List<int[]> shiftFrom, int toRatio)
{
- int[] fromCount = countPos(fromShifts, pos);
+ // TODO: javadoc; tests
+ int[] fromCount = countPos(shiftTo, pos);
if (fromCount == null)
{
return null;
}
int fromRemainder = (fromCount[0] - 1) % fromRatio;
int toCount = 1 + (((fromCount[0] - 1) / fromRatio) * toRatio);
- int[] toPos = countToPos(toShifts, toCount);
+ int[] toPos = countToPos(shiftFrom, toCount);
if (toPos == null)
{
return null; // throw new Error("Bad Mapping!");
}
// System.out.println(fromCount[0]+" "+fromCount[1]+" "+toCount);
- return new int[]
- { toPos[0], fromRemainder, toPos[1] };
+ return new int[] { toPos[0], fromRemainder, toPos[1] };
}
/**
* count how many positions pos is along the series of intervals.
*
- * @param intVals
+ * @param shiftTo
* @param pos
* @return number of positions or null if pos is not within intervals
*/
- private int[] countPos(Vector intVals, int pos)
+ protected static int[] countPos(List<int[]> shiftTo, int pos)
{
- int count = 0, intv[], iv = 0, ivSize = intVals.size();
+ int count = 0, intv[], iv = 0, ivSize = shiftTo.size();
while (iv < ivSize)
{
- intv = (int[]) intVals.elementAt(iv++);
+ intv = shiftTo.get(iv++);
if (intv[0] <= intv[1])
{
if (pos >= intv[0] && pos <= intv[1])
{
- return new int[]
- { count + pos - intv[0] + 1, +1 };
+ return new int[] { count + pos - intv[0] + 1, +1 };
}
else
{
@@ -425,8 +487,7 @@ public class MapList
{
if (pos >= intv[1] && pos <= intv[0])
{
- return new int[]
- { count + intv[0] - pos + 1, -1 };
+ return new int[] { count + intv[0] - pos + 1, -1 };
}
else
{
@@ -440,24 +501,23 @@ public class MapList
/**
* count out pos positions into a series of intervals and return the position
*
- * @param intVals
+ * @param shiftFrom
* @param pos
* @return position pos in interval set
*/
- private int[] countToPos(Vector intVals, int pos)
+ protected static int[] countToPos(List<int[]> shiftFrom, int pos)
{
- int count = 0, diff = 0, iv = 0, ivSize = intVals.size(), intv[] =
- { 0, 0 };
+ int count = 0, diff = 0, iv = 0, ivSize = shiftFrom.size();
+ int[] intv = { 0, 0 };
while (iv < ivSize)
{
- intv = (int[]) intVals.elementAt(iv++);
+ intv = shiftFrom.get(iv++);
diff = intv[1] - intv[0];
if (diff >= 0)
{
if (pos <= count + 1 + diff)
{
- return new int[]
- { pos - count - 1 + intv[0], +1 };
+ return new int[] { pos - count - 1 + intv[0], +1 };
}
else
{
@@ -468,8 +528,7 @@ public class MapList
{
if (pos <= count + 1 - diff)
{
- return new int[]
- { intv[0] - (pos - count - 1), -1 };
+ return new int[] { intv[0] - (pos - count - 1), -1 };
}
else
{
@@ -484,69 +543,67 @@ public class MapList
* find series of intervals mapping from start-end in the From map.
*
* @param start
- * position in to map
+ * position mapped 'to'
* @param end
- * position in to map
- * @return series of ranges in from map
+ * position mapped 'to'
+ * @return series of [start, end] ranges in sequence mapped 'from'
*/
public int[] locateInFrom(int start, int end)
{
// inefficient implementation
int fromStart[] = shiftTo(start);
- int fromEnd[] = shiftTo(end); // needs to be inclusive of end of symbol
- // position
- if (fromStart == null || fromEnd == null)
- return null;
- int iv[] = getIntervals(fromShifts, fromStart, fromEnd, fromRatio);
- return iv;
+ // needs to be inclusive of end of symbol position
+ int fromEnd[] = shiftTo(end);
+
+ return getIntervals(fromShifts, fromStart, fromEnd, fromRatio);
}
/**
* find series of intervals mapping from start-end in the to map.
*
* @param start
- * position in from map
+ * position mapped 'from'
* @param end
- * position in from map
- * @return series of ranges in to map
+ * position mapped 'from'
+ * @return series of [start, end] ranges in sequence mapped 'to'
*/
public int[] locateInTo(int start, int end)
{
- // inefficient implementation
int toStart[] = shiftFrom(start);
int toEnd[] = shiftFrom(end);
- if (toStart == null || toEnd == null)
- return null;
- int iv[] = getIntervals(toShifts, toStart, toEnd, toRatio);
- return iv;
+ return getIntervals(toShifts, toStart, toEnd, toRatio);
}
/**
* like shift - except returns the intervals in the given vector of shifts
* which were spanned in traversing fromStart to fromEnd
*
- * @param fromShifts2
+ * @param shiftFrom
* @param fromStart
* @param fromEnd
* @param fromRatio2
* @return series of from,to intervals from from first position of starting
* region to final position of ending region inclusive
*/
- private int[] getIntervals(Vector fromShifts2, int[] fromStart,
- int[] fromEnd, int fromRatio2)
+ protected static int[] getIntervals(List<int[]> shiftFrom,
+ int[] fromStart, int[] fromEnd, int fromRatio2)
{
+ if (fromStart == null || fromEnd == null)
+ {
+ return null;
+ }
int startpos, endpos;
startpos = fromStart[0]; // first position in fromStart
endpos = fromEnd[0]; // last position in fromEnd
int endindx = (fromRatio2 - 1); // additional positions to get to last
// position from endpos
- int intv = 0, intvSize = fromShifts2.size();
+ int intv = 0, intvSize = shiftFrom.size();
int iv[], i = 0, fs = -1, fe_s = -1, fe = -1; // containing intervals
// search intervals to locate ones containing startpos and count endindx
// positions on from endpos
while (intv < intvSize && (fs == -1 || fe == -1))
{
- iv = (int[]) fromShifts2.elementAt(intv++);
+ iv = shiftFrom.get(intv++);
if (fe_s > -1)
{
endpos = iv[0]; // start counting from beginning of interval
@@ -609,41 +666,44 @@ public class MapList
i++;
}
if (fs == fe && fe == -1)
+ {
return null;
- Vector ranges = new Vector();
+ }
+ List<int[]> ranges = new ArrayList<int[]>();
if (fs <= fe)
{
intv = fs;
i = fs;
// truncate initial interval
- iv = (int[]) fromShifts2.elementAt(intv++);
- iv = new int[]
- { iv[0], iv[1] };// clone
+ iv = shiftFrom.get(intv++);
+ iv = new int[] { iv[0], iv[1] };// clone
if (i == fs)
+ {
iv[0] = startpos;
+ }
while (i != fe)
{
- ranges.addElement(iv); // add initial range
- iv = (int[]) fromShifts2.elementAt(intv++); // get next interval
- iv = new int[]
- { iv[0], iv[1] };// clone
+ ranges.add(iv); // add initial range
+ iv = shiftFrom.get(intv++); // get next interval
+ iv = new int[] { iv[0], iv[1] };// clone
i++;
}
if (i == fe)
+ {
iv[1] = endpos;
- ranges.addElement(iv); // add only - or final range
+ }
+ ranges.add(iv); // add only - or final range
}
else
{
// walk from end of interval.
- i = fromShifts2.size() - 1;
+ i = shiftFrom.size() - 1;
while (i > fs)
{
i--;
}
- iv = (int[]) fromShifts2.elementAt(i);
- iv = new int[]
- { iv[1], iv[0] };// reverse and clone
+ iv = shiftFrom.get(i);
+ iv = new int[] { iv[1], iv[0] };// reverse and clone
// truncate initial interval
if (i == fs)
{
@@ -651,17 +711,16 @@ public class MapList
}
while (--i != fe)
{ // fix apparent logic bug when fe==-1
- ranges.addElement(iv); // add (truncated) reversed interval
- iv = (int[]) fromShifts2.elementAt(i);
- iv = new int[]
- { iv[1], iv[0] }; // reverse and clone
+ ranges.add(iv); // add (truncated) reversed interval
+ iv = shiftFrom.get(i);
+ iv = new int[] { iv[1], iv[0] }; // reverse and clone
}
if (i == fe)
{
// interval is already reversed
iv[1] = endpos;
}
- ranges.addElement(iv); // add only - or final range
+ ranges.add(iv); // add only - or final range
}
// create array of start end intervals.
int[] range = null;
@@ -673,10 +732,10 @@ public class MapList
i = 0;
while (intv < intvSize)
{
- iv = (int[]) ranges.elementAt(intv);
+ iv = ranges.get(intv);
range[i++] = iv[0];
range[i++] = iv[1];
- ranges.setElementAt(null, intv++); // remove
+ ranges.set(intv++, null); // remove
}
}
return range;
@@ -691,6 +750,7 @@ public class MapList
*/
public int getToPosition(int mpos)
{
+ // TODO not used - remove??
int[] mp = shiftTo(mpos);
if (mp != null)
{
@@ -712,8 +772,7 @@ public class MapList
int[] mp = shiftTo(mpos);
if (mp != null)
{
- return new int[]
- { mp[0], mp[0] + mp[2] * (getFromRatio() - 1) };
+ return new int[] { mp[0], mp[0] + mp[2] * (getFromRatio() - 1) };
}
return null;
}
@@ -727,6 +786,7 @@ public class MapList
*/
public int getMappedPosition(int pos)
{
+ // TODO not used - remove??
int[] mp = shiftFrom(pos);
if (mp != null)
{
@@ -737,233 +797,16 @@ public class MapList
public int[] getMappedWord(int pos)
{
+ // TODO not used - remove??
int[] mp = shiftFrom(pos);
if (mp != null)
{
- return new int[]
- { mp[0], mp[0] + mp[2] * (getToRatio() - 1) };
+ return new int[] { mp[0], mp[0] + mp[2] * (getToRatio() - 1) };
}
return null;
}
/**
- * test routine. not incremental.
- *
- * @param ml
- * @param fromS
- * @param fromE
- */
- public static void testMap(MapList ml, int fromS, int fromE)
- {
- for (int from = 1; from <= 25; from++)
- {
- int[] too = ml.shiftFrom(from);
- System.out.print("ShiftFrom(" + from + ")==");
- if (too == null)
- {
- System.out.print("NaN\n");
- }
- else
- {
- System.out.print(too[0] + " % " + too[1] + " (" + too[2] + ")");
- System.out.print("\t+--+\t");
- int[] toofrom = ml.shiftTo(too[0]);
- if (toofrom != null)
- {
- if (toofrom[0] != from)
- {
- System.err.println("Mapping not reflexive:" + from + " "
- + too[0] + "->" + toofrom[0]);
- }
- System.out.println("ShiftTo(" + too[0] + ")==" + toofrom[0]
- + " % " + toofrom[1] + " (" + toofrom[2] + ")");
- }
- else
- {
- System.out.println("ShiftTo(" + too[0] + ")=="
- + "NaN! - not Bijective Mapping!");
- }
- }
- }
- int mmap[][] = ml.makeFromMap();
- System.out.println("FromMap : (" + mmap[0][0] + " " + mmap[0][1] + " "
- + mmap[0][2] + " " + mmap[0][3] + " ");
- for (int i = 1; i <= mmap[1].length; i++)
- {
- if (mmap[1][i - 1] == -1)
- {
- System.out.print(i + "=XXX");
-
- }
- else
- {
- System.out.print(i + "=" + (mmap[0][2] + mmap[1][i - 1]));
- }
- if (i % 20 == 0)
- {
- System.out.print("\n");
- }
- else
- {
- System.out.print(",");
- }
- }
- // test range function
- System.out.print("\nTest locateInFrom\n");
- {
- int f = mmap[0][2], t = mmap[0][3];
- while (f <= t)
- {
- System.out.println("Range " + f + " to " + t);
- int rng[] = ml.locateInFrom(f, t);
- if (rng != null)
- {
- for (int i = 0; i < rng.length; i++)
- {
- System.out.print(rng[i] + ((i % 2 == 0) ? "," : ";"));
- }
- }
- else
- {
- System.out.println("No range!");
- }
- System.out.print("\nReversed\n");
- rng = ml.locateInFrom(t, f);
- if (rng != null)
- {
- for (int i = 0; i < rng.length; i++)
- {
- System.out.print(rng[i] + ((i % 2 == 0) ? "," : ";"));
- }
- }
- else
- {
- System.out.println("No range!");
- }
- System.out.print("\n");
- f++;
- t--;
- }
- }
- System.out.print("\n");
- mmap = ml.makeToMap();
- System.out.println("ToMap : (" + mmap[0][0] + " " + mmap[0][1] + " "
- + mmap[0][2] + " " + mmap[0][3] + " ");
- for (int i = 1; i <= mmap[1].length; i++)
- {
- if (mmap[1][i - 1] == -1)
- {
- System.out.print(i + "=XXX");
-
- }
- else
- {
- System.out.print(i + "=" + (mmap[0][2] + mmap[1][i - 1]));
- }
- if (i % 20 == 0)
- {
- System.out.print("\n");
- }
- else
- {
- System.out.print(",");
- }
- }
- System.out.print("\n");
- // test range function
- System.out.print("\nTest locateInTo\n");
- {
- int f = mmap[0][2], t = mmap[0][3];
- while (f <= t)
- {
- System.out.println("Range " + f + " to " + t);
- int rng[] = ml.locateInTo(f, t);
- if (rng != null)
- {
- for (int i = 0; i < rng.length; i++)
- {
- System.out.print(rng[i] + ((i % 2 == 0) ? "," : ";"));
- }
- }
- else
- {
- System.out.println("No range!");
- }
- System.out.print("\nReversed\n");
- rng = ml.locateInTo(t, f);
- if (rng != null)
- {
- for (int i = 0; i < rng.length; i++)
- {
- System.out.print(rng[i] + ((i % 2 == 0) ? "," : ";"));
- }
- }
- else
- {
- System.out.println("No range!");
- }
- f++;
- t--;
- System.out.print("\n");
- }
- }
-
- }
-
- public static void main(String argv[])
- {
- MapList ml = new MapList(new int[]
- { 1, 5, 10, 15, 25, 20 }, new int[]
- { 51, 1 }, 1, 3);
- MapList ml1 = new MapList(new int[]
- { 1, 3, 17, 4 }, new int[]
- { 51, 1 }, 1, 3);
- MapList ml2 = new MapList(new int[]
- { 1, 60 }, new int[]
- { 1, 20 }, 3, 1);
- // test internal consistency
- int to[] = new int[51];
- MapList.testMap(ml, 1, 60);
- MapList mldna = new MapList(new int[]
- { 2, 2, 6, 8, 12, 16 }, new int[]
- { 1, 3 }, 3, 1);
- int[] frm = mldna.locateInFrom(1, 1);
- testLocateFrom(mldna, 1, 1, new int[]
- { 2, 2, 6, 7 });
- MapList.testMap(mldna, 1, 3);
- /*
- * for (int from=1; from<=51; from++) { int[] too=ml.shiftTo(from); int[]
- * toofrom=ml.shiftFrom(too[0]);
- * System.out.println("ShiftFrom("+from+")=="+too[0]+" %
- * "+too[1]+"\t+-+\tShiftTo("+too[0]+")=="+toofrom[0]+" % "+toofrom[1]); }
- */
- System.out.print("Success?\n"); // if we get here - something must be
- // working!
- }
-
- private static void testLocateFrom(MapList mldna, int i, int j, int[] ks)
- {
- int[] frm = mldna.locateInFrom(i, j);
- if (frm == ks || java.util.Arrays.equals(frm, ks))
- {
- System.out.println("Success test locate from " + i + " to " + j);
- }
- else
- {
- System.err.println("Failed test locate from " + i + " to " + j);
- for (int c = 0; c < frm.length; c++)
- {
- System.err.print(frm[c] + ((c % 2 == 0) ? "," : ";"));
- }
- System.err.println("Expected");
- for (int c = 0; c < ks.length; c++)
- {
- System.err.print(ks[c] + ((c % 2 == 0) ? "," : ";"));
- }
- }
- }
-
- /**
*
* @return a MapList whose From range is this maplist's To Range, and vice
* versa
@@ -984,6 +827,7 @@ public class MapList
*/
public boolean containsEither(boolean local, MapList map)
{
+ // TODO not used - remove?
if (local)
{
return ((getFromLowest() >= map.getFromLowest() && getFromHighest() <= map
@@ -997,4 +841,26 @@ public class MapList
.getToHighest()));
}
}
+
+ /**
+ * String representation - for debugging, not guaranteed not to change
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder(64);
+ sb.append("From (").append(fromRatio).append(":").append(toRatio)
+ .append(") [");
+ for (int[] shift : fromShifts)
+ {
+ sb.append(" ").append(Arrays.toString(shift));
+ }
+ sb.append(" ] To [");
+ for (int[] shift : toShifts)
+ {
+ sb.append(" ").append(Arrays.toString(shift));
+ }
+ sb.append(" ]");
+ return sb.toString();
+ }
}
diff --git a/src/jalview/util/MappingUtils.java b/src/jalview/util/MappingUtils.java
new file mode 100644
index 0000000..0933b97
--- /dev/null
+++ b/src/jalview/util/MappingUtils.java
@@ -0,0 +1,678 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.util;
+
+import jalview.analysis.AlignmentSorter;
+import jalview.api.AlignViewportI;
+import jalview.commands.CommandI;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.commands.EditCommand.Edit;
+import jalview.commands.OrderCommand;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentOrder;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResults.Match;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Helper methods for manipulations involving sequence mappings.
+ *
+ * @author gmcarstairs
+ *
+ */
+public final class MappingUtils
+{
+
+ /**
+ * Helper method to map a CUT or PASTE command.
+ *
+ * @param edit
+ * the original command
+ * @param undo
+ * if true, the command is to be undone
+ * @param targetSeqs
+ * the mapped sequences to apply the mapped command to
+ * @param result
+ * the mapped EditCommand to add to
+ * @param mappings
+ */
+ protected static void mapCutOrPaste(Edit edit, boolean undo,
+ List<SequenceI> targetSeqs, EditCommand result,
+ Set<AlignedCodonFrame> mappings)
+ {
+ Action action = edit.getAction();
+ if (undo)
+ {
+ action = action.getUndoAction();
+ }
+ // TODO write this
+ System.err.println("MappingUtils.mapCutOrPaste not yet implemented");
+ }
+
+ /**
+ * Returns a new EditCommand representing the given command as mapped to the
+ * given sequences. If there is no mapping, returns null.
+ *
+ * @param command
+ * @param undo
+ * @param mapTo
+ * @param gapChar
+ * @param mappings
+ * @return
+ */
+ public static EditCommand mapEditCommand(EditCommand command,
+ boolean undo, final AlignmentI mapTo, char gapChar,
+ Set<AlignedCodonFrame> mappings)
+ {
+ /*
+ * For now, only support mapping from protein edits to cDna
+ */
+ if (!mapTo.isNucleotide())
+ {
+ return null;
+ }
+
+ /*
+ * Cache a copy of the target sequences so we can mimic successive edits on
+ * them. This lets us compute mappings for all edits in the set.
+ */
+ Map<SequenceI, SequenceI> targetCopies = new HashMap<SequenceI, SequenceI>();
+ for (SequenceI seq : mapTo.getSequences())
+ {
+ SequenceI ds = seq.getDatasetSequence();
+ if (ds != null)
+ {
+ final SequenceI copy = new Sequence(seq);
+ copy.setDatasetSequence(ds);
+ targetCopies.put(ds, copy);
+ }
+ }
+
+ /*
+ * Compute 'source' sequences as they were before applying edits:
+ */
+ Map<SequenceI, SequenceI> originalSequences = command.priorState(undo);
+
+ EditCommand result = new EditCommand();
+ Iterator<Edit> edits = command.getEditIterator(!undo);
+ while (edits.hasNext())
+ {
+ Edit edit = edits.next();
+ if (edit.getAction() == Action.CUT
+ || edit.getAction() == Action.PASTE)
+ {
+ mapCutOrPaste(edit, undo, mapTo.getSequences(), result, mappings);
+ }
+ else if (edit.getAction() == Action.INSERT_GAP
+ || edit.getAction() == Action.DELETE_GAP)
+ {
+ mapInsertOrDelete(edit, undo, originalSequences,
+ mapTo.getSequences(), targetCopies, gapChar, result,
+ mappings);
+ }
+ }
+ return result.getSize() > 0 ? result : null;
+ }
+
+ /**
+ * Helper method to map an edit command to insert or delete gaps.
+ *
+ * @param edit
+ * the original command
+ * @param undo
+ * if true, the action is to undo the command
+ * @param originalSequences
+ * the sequences the command acted on
+ * @param targetSeqs
+ * @param targetCopies
+ * @param gapChar
+ * @param result
+ * the new EditCommand to add mapped commands to
+ * @param mappings
+ */
+ protected static void mapInsertOrDelete(Edit edit, boolean undo,
+ Map<SequenceI, SequenceI> originalSequences,
+ final List<SequenceI> targetSeqs,
+ Map<SequenceI, SequenceI> targetCopies, char gapChar,
+ EditCommand result, Set<AlignedCodonFrame> mappings)
+ {
+ Action action = edit.getAction();
+
+ /*
+ * Invert sense of action if an Undo.
+ */
+ if (undo)
+ {
+ action = action.getUndoAction();
+ }
+ final int count = edit.getNumber();
+ final int editPos = edit.getPosition();
+ for (SequenceI seq : edit.getSequences())
+ {
+ /*
+ * Get residue position at (or to right of) edit location. Note we use our
+ * 'copy' of the sequence before editing for this.
+ */
+ SequenceI ds = seq.getDatasetSequence();
+ if (ds == null)
+ {
+ continue;
+ }
+ final SequenceI actedOn = originalSequences.get(ds);
+ final int seqpos = actedOn.findPosition(editPos);
+
+ /*
+ * Determine all mappings from this position to mapped sequences.
+ */
+ SearchResults sr = buildSearchResults(seq, seqpos, mappings);
+
+ if (!sr.isEmpty())
+ {
+ for (SequenceI targetSeq : targetSeqs)
+ {
+ ds = targetSeq.getDatasetSequence();
+ if (ds == null)
+ {
+ continue;
+ }
+ SequenceI copyTarget = targetCopies.get(ds);
+ final int[] match = sr.getResults(copyTarget, 0,
+ copyTarget.getLength());
+ if (match != null)
+ {
+ final int ratio = 3; // TODO: compute this - how?
+ final int mappedCount = count * ratio;
+
+ /*
+ * Shift Delete start position left, as it acts on positions to its
+ * right.
+ */
+ int mappedEditPos = action == Action.DELETE_GAP ? match[0]
+ - mappedCount : match[0];
+ Edit e = result.new Edit(action, new SequenceI[] { targetSeq },
+ mappedEditPos, mappedCount, gapChar);
+ result.addEdit(e);
+
+ /*
+ * and 'apply' the edit to our copy of its target sequence
+ */
+ if (action == Action.INSERT_GAP)
+ {
+ copyTarget.setSequence(new String(StringUtils.insertCharAt(
+ copyTarget.getSequence(), mappedEditPos, mappedCount,
+ gapChar)));
+ }
+ else if (action == Action.DELETE_GAP)
+ {
+ copyTarget.setSequence(new String(StringUtils.deleteChars(
+ copyTarget.getSequence(), mappedEditPos,
+ mappedEditPos + mappedCount)));
+ }
+ }
+ }
+ }
+ /*
+ * and 'apply' the edit to our copy of its source sequence
+ */
+ if (action == Action.INSERT_GAP)
+ {
+ actedOn.setSequence(new String(StringUtils.insertCharAt(
+ actedOn.getSequence(), editPos, count, gapChar)));
+ }
+ else if (action == Action.DELETE_GAP)
+ {
+ actedOn.setSequence(new String(StringUtils.deleteChars(
+ actedOn.getSequence(), editPos, editPos + count)));
+ }
+ }
+ }
+
+ /**
+ * Returns a SearchResults object describing the mapped region corresponding
+ * to the specified sequence position.
+ *
+ * @param seq
+ * @param index
+ * @param seqmappings
+ * @return
+ */
+ public static SearchResults buildSearchResults(SequenceI seq, int index,
+ Set<AlignedCodonFrame> seqmappings)
+ {
+ SearchResults results = new SearchResults();
+ addSearchResults(results, seq, index, seqmappings);
+ return results;
+ }
+
+ /**
+ * Adds entries to a SearchResults object describing the mapped region
+ * corresponding to the specified sequence position.
+ *
+ * @param results
+ * @param seq
+ * @param index
+ * @param seqmappings
+ */
+ public static void addSearchResults(SearchResults results, SequenceI seq,
+ int index, Set<AlignedCodonFrame> seqmappings)
+ {
+ if (index >= seq.getStart() && index <= seq.getEnd())
+ {
+ for (AlignedCodonFrame acf : seqmappings)
+ {
+ acf.markMappedRegion(seq, index, results);
+ }
+ }
+ }
+
+ /**
+ * Returns a (possibly empty) SequenceGroup containing any sequences in the
+ * mapped viewport corresponding to the given group in the source viewport.
+ *
+ * @param sg
+ * @param mapFrom
+ * @param mapTo
+ * @return
+ */
+ public static SequenceGroup mapSequenceGroup(final SequenceGroup sg,
+ final AlignViewportI mapFrom, final AlignViewportI mapTo)
+ {
+ /*
+ * Note the SequenceGroup holds aligned sequences, the mappings hold dataset
+ * sequences.
+ */
+ boolean targetIsNucleotide = mapTo.isNucleotide();
+ AlignViewportI protein = targetIsNucleotide ? mapFrom : mapTo;
+ Set<AlignedCodonFrame> codonFrames = protein.getAlignment()
+ .getCodonFrames();
+ /*
+ * Copy group name, colours etc, but not sequences or sequence colour scheme
+ */
+ SequenceGroup mappedGroup = new SequenceGroup(sg);
+ mappedGroup.cs = mapTo.getGlobalColourScheme();
+ mappedGroup.clear();
+
+ int minStartCol = -1;
+ int maxEndCol = -1;
+ final int selectionStartRes = sg.getStartRes();
+ final int selectionEndRes = sg.getEndRes();
+ for (SequenceI selected : sg.getSequences())
+ {
+ /*
+ * Find the widest range of non-gapped positions in the selection range
+ */
+ int firstUngappedPos = selectionStartRes;
+ while (firstUngappedPos <= selectionEndRes
+ && Comparison.isGap(selected.getCharAt(firstUngappedPos)))
+ {
+ firstUngappedPos++;
+ }
+
+ /*
+ * If this sequence is only gaps in the selected range, skip it
+ */
+ if (firstUngappedPos > selectionEndRes)
+ {
+ continue;
+ }
+
+ int lastUngappedPos = selectionEndRes;
+ while (lastUngappedPos >= selectionStartRes
+ && Comparison.isGap(selected.getCharAt(lastUngappedPos)))
+ {
+ lastUngappedPos--;
+ }
+
+ /*
+ * Find the selected start/end residue positions in sequence
+ */
+ int startResiduePos = selected.findPosition(firstUngappedPos);
+ int endResiduePos = selected.findPosition(lastUngappedPos);
+
+ for (AlignedCodonFrame acf : codonFrames)
+ {
+ SequenceI mappedSequence = targetIsNucleotide ? acf
+ .getDnaForAaSeq(selected) : acf.getAaForDnaSeq(selected);
+ if (mappedSequence != null)
+ {
+ for (SequenceI seq : mapTo.getAlignment().getSequences())
+ {
+ int mappedStartResidue = 0;
+ int mappedEndResidue = 0;
+ if (seq.getDatasetSequence() == mappedSequence)
+ {
+ /*
+ * Found a sequence mapping. Locate the start/end mapped residues.
+ */
+ SearchResults sr = buildSearchResults(selected,
+ startResiduePos, Collections.singleton(acf));
+ for (Match m : sr.getResults())
+ {
+ mappedStartResidue = m.getStart();
+ mappedEndResidue = m.getEnd();
+ }
+ sr = buildSearchResults(selected, endResiduePos,
+ Collections.singleton(acf));
+ for (Match m : sr.getResults())
+ {
+ mappedStartResidue = Math.min(mappedStartResidue,
+ m.getStart());
+ mappedEndResidue = Math.max(mappedEndResidue, m.getEnd());
+ }
+
+ /*
+ * Find the mapped aligned columns, save the range. Note findIndex
+ * returns a base 1 position, SequenceGroup uses base 0
+ */
+ int mappedStartCol = seq.findIndex(mappedStartResidue) - 1;
+ minStartCol = minStartCol == -1 ? mappedStartCol : Math.min(
+ minStartCol, mappedStartCol);
+ int mappedEndCol = seq.findIndex(mappedEndResidue) - 1;
+ maxEndCol = maxEndCol == -1 ? mappedEndCol : Math.max(
+ maxEndCol, mappedEndCol);
+ mappedGroup.addSequence(seq, false);
+ break;
+ }
+ }
+ }
+ }
+ }
+ mappedGroup.setStartRes(minStartCol < 0 ? 0 : minStartCol);
+ mappedGroup.setEndRes(maxEndCol < 0 ? 0 : maxEndCol);
+ return mappedGroup;
+ }
+
+ /**
+ * Returns an OrderCommand equivalent to the given one, but acting on mapped
+ * sequences as described by the mappings, or null if no mapping can be made.
+ *
+ * @param command
+ * the original order command
+ * @param undo
+ * if true, the action is to undo the sort
+ * @param mapTo
+ * the alignment we are mapping to
+ * @param mappings
+ * the mappings available
+ * @return
+ */
+ public static CommandI mapOrderCommand(OrderCommand command,
+ boolean undo, AlignmentI mapTo, Set<AlignedCodonFrame> mappings)
+ {
+ SequenceI[] sortOrder = command.getSequenceOrder(undo);
+ List<SequenceI> mappedOrder = new ArrayList<SequenceI>();
+ int j = 0;
+
+ /*
+ * Assumption: we are only interested in a cDNA/protein mapping; refactor in
+ * future if we want to support sorting (c)dna as (c)dna or protein as
+ * protein
+ */
+ boolean mappingToNucleotide = mapTo.isNucleotide();
+ for (SequenceI seq : sortOrder)
+ {
+ for (AlignedCodonFrame acf : mappings)
+ {
+ SequenceI mappedSeq = mappingToNucleotide ? acf.getDnaForAaSeq(seq)
+ : acf.getAaForDnaSeq(seq);
+ if (mappedSeq != null)
+ {
+ for (SequenceI seq2 : mapTo.getSequences())
+ {
+ if (seq2.getDatasetSequence() == mappedSeq)
+ {
+ mappedOrder.add(seq2);
+ j++;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Return null if no mappings made.
+ */
+ if (j == 0)
+ {
+ return null;
+ }
+
+ /*
+ * Add any unmapped sequences on the end of the sort in their original
+ * ordering.
+ */
+ if (j < mapTo.getHeight())
+ {
+ for (SequenceI seq : mapTo.getSequences())
+ {
+ if (!mappedOrder.contains(seq))
+ {
+ mappedOrder.add(seq);
+ }
+ }
+ }
+
+ /*
+ * Have to sort the sequences before constructing the OrderCommand - which
+ * then resorts them?!?
+ */
+ final SequenceI[] mappedOrderArray = mappedOrder
+ .toArray(new SequenceI[mappedOrder.size()]);
+ SequenceI[] oldOrder = mapTo.getSequencesArray();
+ AlignmentSorter.sortBy(mapTo, new AlignmentOrder(mappedOrderArray));
+ final OrderCommand result = new OrderCommand(command.getDescription(),
+ oldOrder, mapTo);
+ return result;
+ }
+
+ /**
+ * Returns a ColumnSelection in the 'mapTo' view which corresponds to the
+ * given selection in the 'mapFrom' view. We assume one is nucleotide, the
+ * other is protein (and holds the mappings from codons to protein residues).
+ *
+ * @param colsel
+ * @param mapFrom
+ * @param mapTo
+ * @return
+ */
+ public static ColumnSelection mapColumnSelection(ColumnSelection colsel,
+ AlignViewportI mapFrom, AlignViewportI mapTo)
+ {
+ boolean targetIsNucleotide = mapTo.isNucleotide();
+ AlignViewportI protein = targetIsNucleotide ? mapFrom : mapTo;
+ Set<AlignedCodonFrame> codonFrames = protein.getAlignment()
+ .getCodonFrames();
+ ColumnSelection mappedColumns = new ColumnSelection();
+
+ if (colsel == null)
+ {
+ return mappedColumns;
+ }
+
+ char fromGapChar = mapFrom.getAlignment().getGapCharacter();
+
+ // FIXME allow for hidden columns
+
+ /*
+ * For each mapped column, find the range of columns that residues in that
+ * column map to.
+ */
+ for (Object obj : colsel.getSelected())
+ {
+ int col = ((Integer) obj).intValue();
+ int mappedToMin = Integer.MAX_VALUE;
+ int mappedToMax = Integer.MIN_VALUE;
+
+ /*
+ * For each sequence in the 'from' alignment
+ */
+ for (SequenceI fromSeq : mapFrom.getAlignment().getSequences())
+ {
+ /*
+ * Ignore gaps (unmapped anyway)
+ */
+ if (fromSeq.getCharAt(col) == fromGapChar)
+ {
+ continue;
+ }
+
+ /*
+ * Get the residue position and find the mapped position.
+ */
+ int residuePos = fromSeq.findPosition(col);
+ SearchResults sr = buildSearchResults(fromSeq, residuePos,
+ codonFrames);
+ for (Match m : sr.getResults())
+ {
+ int mappedStartResidue = m.getStart();
+ int mappedEndResidue = m.getEnd();
+ SequenceI mappedSeq = m.getSequence();
+
+ /*
+ * Locate the aligned sequence whose dataset is mappedSeq. TODO a
+ * datamodel that can do this efficiently.
+ */
+ for (SequenceI toSeq : mapTo.getAlignment().getSequences())
+ {
+ if (toSeq.getDatasetSequence() == mappedSeq)
+ {
+ int mappedStartCol = toSeq.findIndex(mappedStartResidue);
+ int mappedEndCol = toSeq.findIndex(mappedEndResidue);
+ mappedToMin = Math.min(mappedToMin, mappedStartCol);
+ mappedToMax = Math.max(mappedToMax, mappedEndCol);
+ // System.out.println(fromSeq.getName() + " mapped to cols "
+ // + mappedStartCol + ":" + mappedEndCol);
+ break;
+ // note: remove break if we ever want to map one to many sequences
+ }
+ }
+ }
+ }
+ /*
+ * Add the range of mapped columns to the mapped selection (converting
+ * base 1 to base 0). Note that this may include intron-only regions which
+ * lie between the start and end ranges of the selection.
+ */
+ for (int i = mappedToMin; i <= mappedToMax; i++)
+ {
+ mappedColumns.addElement(i - 1);
+ }
+ }
+ return mappedColumns;
+ }
+
+ /**
+ * Returns the mapped codon for a given aligned sequence column position (base
+ * 0).
+ *
+ * @param seq
+ * an aligned peptide sequence
+ * @param col
+ * an aligned column position (base 0)
+ * @param mappings
+ * a set of codon mappings
+ * @return the bases of the mapped codon in the cDNA dataset sequence, or null
+ * if not found
+ */
+ public static char[] findCodonFor(SequenceI seq, int col,
+ Set<AlignedCodonFrame> mappings)
+ {
+ int dsPos = seq.findPosition(col);
+ for (AlignedCodonFrame mapping : mappings)
+ {
+ if (mapping.involvesSequence(seq))
+ {
+ return mapping.getMappedCodon(seq.getDatasetSequence(), dsPos);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Converts a series of [start, end] ranges into an array of individual
+ * positions.
+ *
+ * @param ranges
+ * @return
+ */
+ public static int[] flattenRanges(int[] ranges)
+ {
+ /*
+ * Count how many positions altogether
+ */
+ int count = 0;
+ for (int i = 0; i < ranges.length - 1; i += 2)
+ {
+ count += ranges[i + 1] - ranges[i] + 1;
+ }
+
+ int[] result = new int[count];
+ int k = 0;
+ for (int i = 0; i < ranges.length - 1; i += 2)
+ {
+ for (int j = ranges[i]; j <= ranges[i + 1]; j++)
+ {
+ result[k++] = j;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns a list of any mappings that are from or to the given (aligned or
+ * dataset) sequence.
+ *
+ * @param sequence
+ * @param mappings
+ * @return
+ */
+ public static List<AlignedCodonFrame> findMappingsForSequence(
+ SequenceI sequence, Set<AlignedCodonFrame> mappings)
+ {
+ List<AlignedCodonFrame> result = new ArrayList<AlignedCodonFrame>();
+ if (sequence == null || mappings == null)
+ {
+ return result;
+ }
+ for (AlignedCodonFrame mapping : mappings)
+ {
+ if (mapping.involvesSequence(sequence))
+ {
+ result.add(mapping);
+ }
+ }
+ return result;
+ }
+}
diff --git a/src/jalview/util/MessageManager.java b/src/jalview/util/MessageManager.java
new file mode 100644
index 0000000..51f23bb
--- /dev/null
+++ b/src/jalview/util/MessageManager.java
@@ -0,0 +1,127 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.util;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author David Roldan Martinez
+ * @author Thomas Abeel
+ *
+ *
+ */
+public class MessageManager
+{
+
+ private static ResourceBundle rb;
+
+ private static Logger log = Logger.getLogger(MessageManager.class
+ .getCanonicalName());
+
+ private static Locale loc;
+
+ static
+ {
+ try
+ {
+ /* Localize Java dialogs */
+ loc = Locale.getDefault();
+ // Locale.setDefault(loc);
+ /* Getting messages for GV */
+ log.info("Getting messages for lang: " + loc);
+ rb = ResourceBundle.getBundle("lang.Messages", loc);
+ if (log.isLoggable(Level.FINEST))
+ {
+ // this might take a while, so we only do it if it will be shown
+ log.finest("Language keys: " + rb.keySet());
+ }
+ } catch (Exception q)
+ {
+ log.warning("Exception when initting Locale for i18n messages\n"
+ + q.getMessage());
+ q.printStackTrace();
+ } catch (Error v)
+ {
+ log.warning("Error when initting Locale for i18n messages\n"
+ + v.getMessage());
+ v.printStackTrace();
+ }
+
+ }
+
+ public static String getString(String key)
+ {
+ String value = "[missing key] " + key;
+ try
+ {
+ value = rb.getString(key);
+ } catch (Exception e)
+ {
+ log.warning("I18N missing: " + loc + "\t" + key);
+ }
+ return value;
+ }
+
+ public static Locale getLocale()
+ {
+ return loc;
+ }
+
+ public static String formatMessage(String key, Object... params)
+ {
+ return MessageFormat.format(rb.getString(key), params);
+ }
+
+ public static String formatMessage(String key, String[] params)
+ {
+ return MessageFormat.format(rb.getString(key), (Object[]) params);
+ }
+
+ /**
+ * lookup and return a key given a root and a human-readable(ish) name that
+ * when combined might resolve to an i18n string. If the key doesn't resolve,
+ * then name is returned.if the key doesn't exist. Use this for
+ * programatically constructed keys that have have a human readable
+ * alternative used in the program (e.g. BLOSUM62 and label.score_blosum62)
+ *
+ * @param keyroot
+ * @param name
+ * @return
+ */
+ public static String getStringOrReturn(String keyroot, String name)
+ {
+ String smkey = keyroot + name.toLowerCase().replaceAll(" ", "");
+ try
+ {
+ name = rb.getString(smkey);
+ } catch (Exception x)
+ {
+ log.finest("I18N missing key with root " + keyroot + ": " + loc
+ + "\t" + smkey);
+ }
+ return name;
+ }
+}
diff --git a/src/jalview/util/ParseHtmlBodyAndLinks.java b/src/jalview/util/ParseHtmlBodyAndLinks.java
index 8bd19a0..fef31b2 100644
--- a/src/jalview/util/ParseHtmlBodyAndLinks.java
+++ b/src/jalview/util/ParseHtmlBodyAndLinks.java
@@ -1,82 +1,99 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.util;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
-
/**
* utility class for dealing with HTML link extraction
+ *
* @author jprocter
- *
+ *
*/
public class ParseHtmlBodyAndLinks
+{
+ private static final Pattern LEFT_ANGLE_BRACKET_PATTERN = Pattern
+ .compile("<");
+
+ String orig = null;
+
+ public String getOrig()
{
- String orig=null;
- public String getOrig()
- {
- return orig;
- }
- boolean htmlContent=true;
- /**
- * @return true if the content looked like HTML
+ return orig;
+ }
- */
- public boolean isHtmlContent()
- {
- return htmlContent;
- }
+ boolean htmlContent = true;
- ArrayList<String> links=new ArrayList<String>();
- StringBuffer sb = new StringBuffer();
- /**
- * result of parsing description - with or without HTML tags
- * @return
- */
- public String getContent()
- {
-
- return sb.toString();
- }
- /**
- * list of Label|Link encoded URL links extracted from HTML
- * @return
- */
- public ArrayList<String> getLinks() {
- return links;
- }
+ /**
+ * @return true if the content looked like HTML
+ */
+ public boolean isHtmlContent()
+ {
+ return htmlContent;
+ }
+
+ ArrayList<String> links = new ArrayList<String>();
+
+ StringBuffer sb = new StringBuffer();
+
+ /**
+ * result of parsing description - with or without HTML tags
+ *
+ * @return
+ */
+ public String getContent()
+ {
- /**
- *
- * @param description - html or text content to be parsed
- * @param removeHTML flag to indicate if HTML tags should be removed if they are present.
- * @param newline
- */
- public ParseHtmlBodyAndLinks(String description,
- boolean removeHTML, String newline)
+ return sb.toString();
+ }
+
+ /**
+ * list of Label|Link encoded URL links extracted from HTML
+ *
+ * @return
+ */
+ public ArrayList<String> getLinks()
+ {
+ return links;
+ }
+
+ /**
+ *
+ * @param description
+ * - html or text content to be parsed
+ * @param removeHTML
+ * flag to indicate if HTML tags should be removed if they are
+ * present.
+ * @param newline
+ */
+ public ParseHtmlBodyAndLinks(String description, boolean removeHTML,
+ String newline)
+ {
+ if (description == null || description.length() == 0)
{
- if (description==null || description.length()==0)
- {
- htmlContent=false;
- return;
- }
+ htmlContent = false;
+ return;
+ }
if (description.toUpperCase().indexOf("<HTML>") == -1)
{
htmlContent = false;
@@ -139,18 +156,22 @@ public class ParseHtmlBodyAndLinks
{
// instead of parsing the html into plaintext
// clean the description ready for embedding in html
- sb = new StringBuffer(Pattern.compile("<").matcher(description).replaceAll("<"));
-
+ sb = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(description)
+ .replaceAll("<"));
+
}
-
+
+ }
+
+ /**
+ * get either the parsed content or the original, depending on whether the
+ * original looked like html content or not.
+ *
+ * @return
+ */
+ public String getNonHtmlContent()
+ {
+ return isHtmlContent() ? sb.toString() : orig;
}
- /**
- * get either the parsed content or the original, depending on whether the original looked like html content or not.
- * @return
- */
- public String getNonHtmlContent()
- {
- return isHtmlContent() ? sb.toString() : orig;
- }
}
diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java
index 392f1f9..ef860d4 100644
--- a/src/jalview/util/Platform.java
+++ b/src/jalview/util/Platform.java
@@ -1,54 +1,77 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.util;
-
-/**
- * System platform information used by Applet and Application
- *
- * @author Jim Procter
- */
-public class Platform
-{
- /**
- * sorry folks - Macs really are different
- *
- * @return true if we do things in a special way.
- */
- public boolean isAMac()
- {
- return java.lang.System.getProperty("os.name").indexOf("Mac") > -1;
-
- }
-
- public boolean isHeadless()
- {
- String hdls = java.lang.System.getProperty("java.awt.headless");
-
- return hdls != null && hdls.equals("true");
- }
-
- /**
- *
- * @return nominal maximum command line length for this platform
- */
- public static int getMaxCommandLineLength()
- {
- // TODO: determine nominal limits for most platforms.
- return 2046; // this is the max length for a windows NT system.
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.util;
+
+/**
+ * System platform information used by Applet and Application
+ *
+ * @author Jim Procter
+ */
+public class Platform
+{
+ /**
+ * sorry folks - Macs really are different
+ *
+ * @return true if we do things in a special way.
+ */
+ public static boolean isAMac()
+ {
+ return java.lang.System.getProperty("os.name").indexOf("Mac") > -1;
+
+ }
+
+ public static boolean isHeadless()
+ {
+ String hdls = java.lang.System.getProperty("java.awt.headless");
+
+ return hdls != null && hdls.equals("true");
+ }
+
+ /**
+ *
+ * @return nominal maximum command line length for this platform
+ */
+ public static int getMaxCommandLineLength()
+ {
+ // TODO: determine nominal limits for most platforms.
+ return 2046; // this is the max length for a windows NT system.
+ }
+
+ /**
+ * escape a string according to the local platform's escape character
+ *
+ * @param file
+ * @return escaped file
+ */
+ public static String escapeString(String file)
+ {
+ StringBuffer f = new StringBuffer();
+ int p = 0, lastp = 0;
+ while ((p = file.indexOf('\\', lastp)) > -1)
+ {
+ f.append(file.subSequence(lastp, p));
+ f.append("\\\\");
+ lastp = p + 1;
+ }
+ f.append(file.substring(lastp));
+ return f.toString();
+ }
+}
diff --git a/src/jalview/util/QuickSort.java b/src/jalview/util/QuickSort.java
index 94ec1aa..19ef730 100644
--- a/src/jalview/util/QuickSort.java
+++ b/src/jalview/util/QuickSort.java
@@ -1,45 +1,122 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.util;
+import java.util.Arrays;
+import java.util.Comparator;
+
+/**
+ * A class to perform efficient sorting of arrays of objects based on arrays of
+ * scores or other attributes. For example, residues by percentage frequency.
+ *
+ * @author gmcarstairs
+ *
+ */
public class QuickSort
{
+ static class FloatComparator implements Comparator<Integer>
+ {
+
+ private final float[] values;
+
+ FloatComparator(float[] v)
+ {
+ values = v;
+ }
+
+ @Override
+ public int compare(Integer o1, Integer o2)
+ {
+ return Float.compare(values[o1], values[o2]);
+ }
+
+ }
+
+ static class IntComparator implements Comparator<Integer>
+ {
+
+ private final int[] values;
+
+ IntComparator(int[] v)
+ {
+ values = v;
+ }
+
+ @Override
+ public int compare(Integer o1, Integer o2)
+ {
+ return Integer.compare(values[o1], values[o2]);
+ }
+
+ }
+
+ /**
+ * Sorts both arrays with respect to ascending order of the items in the first
+ * array.
+ *
+ * @param arr
+ * @param s
+ */
public static void sort(int[] arr, Object[] s)
{
sort(arr, 0, arr.length - 1, s);
}
+ /**
+ * Sorts both arrays with respect to ascending order of the items in the first
+ * array.
+ *
+ * @param arr
+ * @param s
+ */
public static void sort(float[] arr, Object[] s)
{
sort(arr, 0, arr.length - 1, s);
}
+ /**
+ * Sorts both arrays with respect to ascending order of the items in the first
+ * array.
+ *
+ * @param arr
+ * @param s
+ */
public static void sort(double[] arr, Object[] s)
{
sort(arr, 0, arr.length - 1, s);
}
+ /**
+ * Sorts both arrays with respect to descending order of the items in the
+ * first array.
+ *
+ * @param arr
+ * @param s
+ */
public static void sort(String[] arr, Object[] s)
{
stringSort(arr, 0, arr.length - 1, s);
}
- public static void stringSort(String[] arr, int p, int r, Object[] s)
+ static void stringSort(String[] arr, int p, int r, Object[] s)
{
int q;
@@ -51,7 +128,7 @@ public class QuickSort
}
}
- public static void sort(float[] arr, int p, int r, Object[] s)
+ static void sort(float[] arr, int p, int r, Object[] s)
{
int q;
@@ -63,7 +140,7 @@ public class QuickSort
}
}
- public static void sort(double[] arr, int p, int r, Object[] s)
+ static void sort(double[] arr, int p, int r, Object[] s)
{
int q;
@@ -75,7 +152,7 @@ public class QuickSort
}
}
- public static void sort(int[] arr, int p, int r, Object[] s)
+ static void sort(int[] arr, int p, int r, Object[] s)
{
int q;
@@ -87,7 +164,7 @@ public class QuickSort
}
}
- private static int partition(float[] arr, int p, int r, Object[] s)
+ static int partition(float[] arr, int p, int r, Object[] s)
{
float x = arr[p];
int i = p - 1;
@@ -122,7 +199,42 @@ public class QuickSort
}
}
- private static int partition(int[] arr, int p, int r, Object[] s)
+ static int partition(float[] arr, int p, int r, char[] s)
+ {
+ float x = arr[p];
+ int i = p - 1;
+ int j = r + 1;
+
+ while (true)
+ {
+ do
+ {
+ j = j - 1;
+ } while (arr[j] > x);
+
+ do
+ {
+ i = i + 1;
+ } while (arr[i] < x);
+
+ if (i < j)
+ {
+ float tmp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = tmp;
+
+ char tmp2 = s[i];
+ s[i] = s[j];
+ s[j] = tmp2;
+ }
+ else
+ {
+ return j;
+ }
+ }
+ }
+
+ static int partition(int[] arr, int p, int r, Object[] s)
{
int x = arr[p];
int i = p - 1;
@@ -157,7 +269,7 @@ public class QuickSort
}
}
- private static int partition(double[] arr, int p, int r, Object[] s)
+ static int partition(double[] arr, int p, int r, Object[] s)
{
double x = arr[p];
int i = p - 1;
@@ -192,7 +304,7 @@ public class QuickSort
}
}
- private static int stringPartition(String[] arr, int p, int r, Object[] s)
+ static int stringPartition(String[] arr, int p, int r, Object[] s)
{
String x = arr[p];
int i = p - 1;
@@ -226,4 +338,217 @@ public class QuickSort
}
}
}
+
+ /**
+ * Sorts both arrays to give ascending order in the first array, by first
+ * partitioning into zero and non-zero values before sorting the latter.
+ *
+ * @param arr
+ * @param s
+ */
+ public static void sort(float[] arr, char[] s)
+ {
+ /*
+ * Sort all zero values to the front
+ */
+ float[] f1 = new float[arr.length];
+ char[] s1 = new char[s.length];
+ int nextZeroValue = 0;
+ int nextNonZeroValue = arr.length - 1;
+ for (int i = 0; i < arr.length; i++)
+ {
+ float val = arr[i];
+ if (val > 0f)
+ {
+ f1[nextNonZeroValue] = val;
+ s1[nextNonZeroValue] = s[i];
+ nextNonZeroValue--;
+ }
+ else
+ {
+ f1[nextZeroValue] = val;
+ s1[nextZeroValue] = s[i];
+ nextZeroValue++;
+ }
+ }
+
+ /*
+ * Copy zero values back to original arrays
+ */
+ System.arraycopy(f1, 0, arr, 0, nextZeroValue);
+ System.arraycopy(s1, 0, s, 0, nextZeroValue);
+
+ if (nextZeroValue == arr.length)
+ {
+ return; // all zero
+ }
+ /*
+ * Sort the non-zero values
+ */
+ float[] nonZeroFloats = Arrays
+ .copyOfRange(f1, nextZeroValue, f1.length);
+ char[] nonZeroChars = Arrays.copyOfRange(s1, nextZeroValue, s1.length);
+ externalSort(nonZeroFloats, nonZeroChars);
+ // sort(nonZeroFloats, 0, nonZeroFloats.length - 1, nonZeroChars);
+
+ /*
+ * Assemble sorted non-zero results
+ */
+ System.arraycopy(nonZeroFloats, 0, arr, nextZeroValue,
+ nonZeroFloats.length);
+ System.arraycopy(nonZeroChars, 0, s, nextZeroValue, nonZeroChars.length);
+ }
+
+ /**
+ * Sort by making an array of indices, and sorting it using a comparator that
+ * refers to the float values.
+ *
+ * @see http
+ * ://stackoverflow.com/questions/4859261/get-the-indices-of-an-array-
+ * after-sorting
+ * @param arr
+ * @param s
+ */
+ protected static void externalSort(float[] arr, char[] s)
+ {
+ final int length = arr.length;
+ Integer[] indices = makeIndexArray(length);
+ Arrays.sort(indices, new FloatComparator(arr));
+
+ /*
+ * Copy the array values as per the sorted indices
+ */
+ float[] sortedFloats = new float[length];
+ char[] sortedChars = new char[s.length];
+ for (int i = 0; i < length; i++)
+ {
+ sortedFloats[i] = arr[indices[i]];
+ sortedChars[i] = s[indices[i]];
+ }
+
+ /*
+ * And copy the sorted values back into the arrays
+ */
+ System.arraycopy(sortedFloats, 0, arr, 0, length);
+ System.arraycopy(sortedChars, 0, s, 0, s.length);
+ }
+
+ /**
+ * Make an array whose values are 0...length.
+ *
+ * @param length
+ * @return
+ */
+ protected static Integer[] makeIndexArray(final int length)
+ {
+ Integer[] indices = new Integer[length];
+ for (int i = 0; i < length; i++)
+ {
+ indices[i] = i;
+ }
+ return indices;
+ }
+
+ static void sort(float[] arr, int p, int r, char[] s)
+ {
+ int q;
+ if (p < r)
+ {
+ q = partition(arr, p, r, s);
+ sort(arr, p, q, s);
+ sort(arr, q + 1, r, s);
+ }
+ }
+
+ /**
+ * Sorts both arrays to give ascending order in the first array, by first
+ * partitioning into zero and non-zero values before sorting the latter.
+ *
+ * @param arr
+ * @param s
+ */
+ public static void sort(int[] arr, char[] s)
+ {
+ /*
+ * Sort all zero values to the front
+ */
+ int[] f1 = new int[arr.length];
+ char[] s1 = new char[s.length];
+ int nextZeroValue = 0;
+ int nextNonZeroValue = arr.length - 1;
+ for (int i = 0; i < arr.length; i++)
+ {
+ int val = arr[i];
+ if (val > 0f)
+ {
+ f1[nextNonZeroValue] = val;
+ s1[nextNonZeroValue] = s[i];
+ nextNonZeroValue--;
+ }
+ else
+ {
+ f1[nextZeroValue] = val;
+ s1[nextZeroValue] = s[i];
+ nextZeroValue++;
+ }
+ }
+
+ /*
+ * Copy zero values back to original arrays
+ */
+ System.arraycopy(f1, 0, arr, 0, nextZeroValue);
+ System.arraycopy(s1, 0, s, 0, nextZeroValue);
+
+ if (nextZeroValue == arr.length)
+ {
+ return; // all zero
+ }
+ /*
+ * Sort the non-zero values
+ */
+ int[] nonZeroInts = Arrays.copyOfRange(f1, nextZeroValue, f1.length);
+ char[] nonZeroChars = Arrays.copyOfRange(s1, nextZeroValue, s1.length);
+ externalSort(nonZeroInts, nonZeroChars);
+ // sort(nonZeroFloats, 0, nonZeroFloats.length - 1, nonZeroChars);
+
+ /*
+ * Assemble sorted non-zero results
+ */
+ System.arraycopy(nonZeroInts, 0, arr, nextZeroValue, nonZeroInts.length);
+ System.arraycopy(nonZeroChars, 0, s, nextZeroValue, nonZeroChars.length);
+ }
+
+ /**
+ * Sort by making an array of indices, and sorting it using a comparator that
+ * refers to the float values.
+ *
+ * @see http
+ * ://stackoverflow.com/questions/4859261/get-the-indices-of-an-array-
+ * after-sorting
+ * @param arr
+ * @param s
+ */
+ protected static void externalSort(int[] arr, char[] s)
+ {
+ final int length = arr.length;
+ Integer[] indices = makeIndexArray(length);
+ Arrays.sort(indices, new IntComparator(arr));
+
+ /*
+ * Copy the array values as per the sorted indices
+ */
+ int[] sortedInts = new int[length];
+ char[] sortedChars = new char[s.length];
+ for (int i = 0; i < length; i++)
+ {
+ sortedInts[i] = arr[indices[i]];
+ sortedChars[i] = s[indices[i]];
+ }
+
+ /*
+ * And copy the sorted values back into the arrays
+ */
+ System.arraycopy(sortedInts, 0, arr, 0, length);
+ System.arraycopy(sortedChars, 0, s, 0, s.length);
+ }
}
diff --git a/src/jalview/util/ReverseListIterator.java b/src/jalview/util/ReverseListIterator.java
new file mode 100644
index 0000000..1145b66
--- /dev/null
+++ b/src/jalview/util/ReverseListIterator.java
@@ -0,0 +1,63 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.util;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * An iterator that traverses a list backwards.
+ *
+ * @author gmcarstairs (and checked against
+ * org.codehaus.groovey.runtime.ReverseListIterator)
+ *
+ * @param <E>
+ */
+public class ReverseListIterator<E> implements Iterator<E>
+{
+
+ private ListIterator<E> iterator;
+
+ public ReverseListIterator(List<E> stuff)
+ {
+ this.iterator = stuff.listIterator(stuff.size());
+ }
+
+ @Override
+ public boolean hasNext()
+ {
+ return iterator.hasPrevious();
+ }
+
+ @Override
+ public E next()
+ {
+ return iterator.previous();
+ }
+
+ @Override
+ public void remove()
+ {
+ iterator.remove();
+ }
+
+}
diff --git a/src/jalview/util/ShiftList.java b/src/jalview/util/ShiftList.java
index 9fb5eca..860a700 100644
--- a/src/jalview/util/ShiftList.java
+++ b/src/jalview/util/ShiftList.java
@@ -1,143 +1,154 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.util;
-
-import java.util.*;
-
-/**
- * ShiftList Simple way of mapping a linear series to a new linear range with
- * new points introduced. Use at your own risk! Now growing to be used for
- * interval ranges (position, offset) storing deletions/insertions
- */
-public class ShiftList
-{
- public Vector shifts;
-
- public ShiftList()
- {
- shifts = new Vector();
- }
-
- /**
- * addShift
- *
- * @param pos
- * start position for shift (in original reference frame)
- * @param shift
- * length of shift
- */
- public void addShift(int pos, int shift)
- {
- int sidx = 0;
- int[] rshift = null;
- while (sidx < shifts.size()
- && (rshift = (int[]) shifts.elementAt(sidx))[0] < pos)
- {
- sidx++;
- }
- if (sidx == shifts.size())
- {
- shifts.insertElementAt(new int[]
- { pos, shift }, sidx);
- }
- else
- {
- rshift[1] += shift;
- }
- }
-
- /**
- * shift
- *
- * @param pos
- * int
- * @return int shifted position
- */
- public int shift(int pos)
- {
- if (shifts.size() == 0)
- {
- return pos;
- }
- int shifted = pos;
- int sidx = 0;
- int rshift[];
- while (sidx < shifts.size()
- && (rshift = ((int[]) shifts.elementAt(sidx++)))[0] <= pos)
- {
- shifted += rshift[1];
- }
- return shifted;
- }
-
- /**
- * clear all shifts
- */
- public void clear()
- {
- shifts.removeAllElements();
- }
-
- /**
- * invert the shifts
- *
- * @return ShiftList with inverse shift operations
- */
- public ShiftList getInverse()
- {
- ShiftList inverse = new ShiftList();
- if (shifts != null)
- {
- for (int i = 0, j = shifts.size(); i < j; i++)
- {
- int[] sh = (int[]) shifts.elementAt(i);
- if (sh != null)
- {
- inverse.shifts.addElement(new int[]
- { sh[0], -sh[1] });
- }
- }
- }
- return inverse;
- }
-
- /**
- * parse a 1d map of position 1<i<n to L<pos[i]<N such as that returned from
- * SequenceI.gapMap()
- *
- * @param gapMap
- * @return shifts from map index to mapped position
- */
- public static ShiftList parseMap(int[] gapMap)
- {
- ShiftList shiftList = null;
- if (gapMap != null && gapMap.length > 0)
- {
- shiftList = new ShiftList();
- for (int i = 0, p = 0; i < gapMap.length; p++, i++)
- {
- if (p != gapMap[i])
- {
- shiftList.addShift(p, gapMap[i] - p);
- p = gapMap[i];
- }
- }
- }
- return shiftList;
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ShiftList Simple way of mapping a linear series to a new linear range with
+ * new points introduced. Use at your own risk! Now growing to be used for
+ * interval ranges (position, offset) storing deletions/insertions
+ */
+public class ShiftList
+{
+ private List<int[]> shifts;
+
+ public ShiftList()
+ {
+ shifts = new ArrayList<int[]>();
+ }
+
+ /**
+ * addShift
+ *
+ * @param pos
+ * start position for shift (in original reference frame)
+ * @param shift
+ * length of shift
+ */
+ public void addShift(int pos, int shift)
+ {
+ synchronized (shifts)
+ {
+ int sidx = 0;
+ int[] rshift = null;
+ while (sidx < shifts.size() && (rshift = shifts.get(sidx))[0] < pos)
+ {
+ sidx++;
+ }
+ if (sidx == shifts.size())
+ {
+ shifts.add(sidx, new int[] { pos, shift });
+ }
+ else
+ {
+ rshift[1] += shift;
+ }
+ }
+ }
+
+ /**
+ * shift
+ *
+ * @param pos
+ * int
+ * @return int shifted position
+ */
+ public int shift(int pos)
+ {
+ if (shifts.size() == 0)
+ {
+ return pos;
+ }
+ int shifted = pos;
+ int sidx = 0;
+ int rshift[];
+ while (sidx < shifts.size()
+ && (rshift = (shifts.get(sidx++)))[0] <= pos)
+ {
+ shifted += rshift[1];
+ }
+ return shifted;
+ }
+
+ /**
+ * clear all shifts
+ */
+ public synchronized void clear()
+ {
+ shifts.clear();
+ }
+
+ /**
+ * invert the shifts
+ *
+ * @return ShiftList with inverse shift operations
+ */
+ public ShiftList getInverse()
+ {
+ ShiftList inverse = new ShiftList();
+ synchronized (shifts)
+ {
+ if (shifts != null)
+ {
+ for (int[] sh : shifts)
+ {
+ if (sh != null)
+ {
+ inverse.shifts.add(new int[] { sh[0], -sh[1] });
+ }
+ }
+ }
+ }
+ return inverse;
+ }
+
+ /**
+ * parse a 1d map of position 1<i<n to L<pos[i]<N such as that
+ * returned from SequenceI.gapMap()
+ *
+ * @param gapMap
+ * @return shifts from map index to mapped position
+ */
+ public static ShiftList parseMap(int[] gapMap)
+ {
+ ShiftList shiftList = null;
+ if (gapMap != null && gapMap.length > 0)
+ {
+ shiftList = new ShiftList();
+ for (int i = 0, p = 0; i < gapMap.length; p++, i++)
+ {
+ if (p != gapMap[i])
+ {
+ shiftList.addShift(p, gapMap[i] - p);
+ p = gapMap[i];
+ }
+ }
+ }
+ return shiftList;
+ }
+
+ public List<int[]> getShifts()
+ {
+ return shifts;
+ }
+}
diff --git a/src/jalview/util/StringUtils.java b/src/jalview/util/StringUtils.java
new file mode 100644
index 0000000..b499e6e
--- /dev/null
+++ b/src/jalview/util/StringUtils.java
@@ -0,0 +1,251 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+public class StringUtils
+{
+ private static final Pattern DELIMITERS_PATTERN = Pattern
+ .compile(".*='[^']*(?!')");
+
+ private static final boolean DEBUG = false;
+
+ /**
+ * Returns a new character array, after inserting characters into the given
+ * character array.
+ *
+ * @param in
+ * the character array to insert into
+ * @param position
+ * the 0-based position for insertion
+ * @param count
+ * the number of characters to insert
+ * @param ch
+ * the character to insert
+ */
+ public static final char[] insertCharAt(char[] in, int position,
+ int count, char ch)
+ {
+ char[] tmp = new char[in.length + count];
+
+ if (position >= in.length)
+ {
+ System.arraycopy(in, 0, tmp, 0, in.length);
+ position = in.length;
+ }
+ else
+ {
+ System.arraycopy(in, 0, tmp, 0, position);
+ }
+
+ int index = position;
+ while (count > 0)
+ {
+ tmp[index++] = ch;
+ count--;
+ }
+
+ if (position < in.length)
+ {
+ System.arraycopy(in, position, tmp, index, in.length - position);
+ }
+
+ return tmp;
+ }
+
+ /**
+ * Delete
+ *
+ * @param in
+ * @param from
+ * @param to
+ * @return
+ */
+ public static final char[] deleteChars(char[] in, int from, int to)
+ {
+ if (from >= in.length || from < 0)
+ {
+ return in;
+ }
+
+ char[] tmp;
+
+ if (to >= in.length)
+ {
+ tmp = new char[from];
+ System.arraycopy(in, 0, tmp, 0, from);
+ to = in.length;
+ }
+ else
+ {
+ tmp = new char[in.length - to + from];
+ System.arraycopy(in, 0, tmp, 0, from);
+ System.arraycopy(in, to, tmp, from, in.length - to);
+ }
+ return tmp;
+ }
+
+ /**
+ * Returns the last part of 'input' after the last occurrence of 'token'. For
+ * example to extract only the filename from a full path or URL.
+ *
+ * @param input
+ * @param token
+ * a delimiter which must be in regular expression format
+ * @return
+ */
+ public static String getLastToken(String input, String token)
+ {
+ if (input == null)
+ {
+ return null;
+ }
+ if (token == null)
+ {
+ return input;
+ }
+ String[] st = input.split(token);
+ return st[st.length - 1];
+ }
+
+ /**
+ * Parses the input string into components separated by the delimiter. Unlike
+ * String.split(), this method will ignore occurrences of the delimiter which
+ * are nested within single quotes in name-value pair values, e.g. a='b,c'.
+ *
+ * @param input
+ * @param delimiter
+ * @return elements separated by separator
+ */
+ public static String[] separatorListToArray(String input, String delimiter)
+ {
+ int seplen = delimiter.length();
+ if (input == null || input.equals("") || input.equals(delimiter))
+ {
+ return null;
+ }
+ List<String> jv = new ArrayList<String>();
+ int cp = 0, pos, escape;
+ boolean wasescaped = false, wasquoted = false;
+ String lstitem = null;
+ while ((pos = input.indexOf(delimiter, cp)) >= cp)
+ {
+ escape = (pos > 0 && input.charAt(pos - 1) == '\\') ? -1 : 0;
+ if (wasescaped || wasquoted)
+ {
+ // append to previous pos
+ jv.set(jv.size() - 1,
+ lstitem = lstitem + delimiter
+ + input.substring(cp, pos + escape));
+ }
+ else
+ {
+ jv.add(lstitem = input.substring(cp, pos + escape));
+ }
+ cp = pos + seplen;
+ wasescaped = escape == -1;
+ // last separator may be in an unmatched quote
+ wasquoted = DELIMITERS_PATTERN.matcher(lstitem).matches();
+ }
+ if (cp < input.length())
+ {
+ String c = input.substring(cp);
+ if (wasescaped || wasquoted)
+ {
+ // append final separator
+ jv.set(jv.size() - 1, lstitem + delimiter + c);
+ }
+ else
+ {
+ if (!c.equals(delimiter))
+ {
+ jv.add(c);
+ }
+ }
+ }
+ if (jv.size() > 0)
+ {
+ String[] v = jv.toArray(new String[jv.size()]);
+ jv.clear();
+ if (DEBUG)
+ {
+ System.err.println("Array from '" + delimiter
+ + "' separated List:\n" + v.length);
+ for (int i = 0; i < v.length; i++)
+ {
+ System.err.println("item " + i + " '" + v[i] + "'");
+ }
+ }
+ return v;
+ }
+ if (DEBUG)
+ {
+ System.err.println("Empty Array from '" + delimiter
+ + "' separated List");
+ }
+ return null;
+ }
+
+ /**
+ * Returns a string which contains the list elements delimited by the
+ * separator. Null items are ignored. If the input is null or has length zero,
+ * a single delimiter is returned.
+ *
+ * @param list
+ * @param separator
+ * @return concatenated string
+ */
+ public static String arrayToSeparatorList(String[] list, String separator)
+ {
+ StringBuffer v = new StringBuffer();
+ if (list != null && list.length > 0)
+ {
+ for (int i = 0, iSize = list.length; i < iSize; i++)
+ {
+ if (list[i] != null)
+ {
+ if (v.length() > 0)
+ {
+ v.append(separator);
+ }
+ // TODO - escape any separator values in list[i]
+ v.append(list[i]);
+ }
+ }
+ if (DEBUG)
+ {
+ System.err.println("Returning '" + separator
+ + "' separated List:\n");
+ System.err.println(v);
+ }
+ return v.toString();
+ }
+ if (DEBUG)
+ {
+ System.err.println("Returning empty '" + separator
+ + "' separated List\n");
+ }
+ return "" + separator;
+ }
+}
diff --git a/src/jalview/util/TableSorter.java b/src/jalview/util/TableSorter.java
index f1a8794..77e0577 100644
--- a/src/jalview/util/TableSorter.java
+++ b/src/jalview/util/TableSorter.java
@@ -1,597 +1,616 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.util;
-
-import java.util.*;
-import java.util.List;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.table.*;
-
-/**
- * TableSorter is a decorator for TableModels; adding sorting functionality to a
- * supplied TableModel. TableSorter does not store or copy the data in its
- * TableModel; instead it maintains a map from the row indexes of the view to
- * the row indexes of the model. As requests are made of the sorter (like
- * getValueAt(row, col)) they are passed to the underlying model after the row
- * numbers have been translated via the internal mapping array. This way, the
- * TableSorter appears to hold another copy of the table with the rows in a
- * different order.
- * <p/>
- * TableSorter registers itself as a listener to the underlying model, just as
- * the JTable itself would. Events recieved from the model are examined,
- * sometimes manipulated (typically widened), and then passed on to the
- * TableSorter's listeners (typically the JTable). If a change to the model has
- * invalidated the order of TableSorter's rows, a note of this is made and the
- * sorter will resort the rows the next time a value is requested.
- * <p/>
- * When the tableHeader property is set, either by using the setTableHeader()
- * method or the two argument constructor, the table header may be used as a
- * complete UI for TableSorter. The default renderer of the tableHeader is
- * decorated with a renderer that indicates the sorting status of each column.
- * In addition, a mouse listener is installed with the following behavior:
- * <ul>
- * <li>Mouse-click: Clears the sorting status of all other columns and advances
- * the sorting status of that column through three values: {NOT_SORTED,
- * ASCENDING, DESCENDING} (then back to NOT_SORTED again).
- * <li>SHIFT-mouse-click: Clears the sorting status of all other columns and
- * cycles the sorting status of the column through the same three values, in the
- * opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.
- * <li>CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that
- * the changes to the column do not cancel the statuses of columns that are
- * already sorting - giving a way to initiate a compound sort.
- * </ul>
- * <p/>
- * This is a long overdue rewrite of a class of the same name that first
- * appeared in the swing table demos in 1997.
- *
- * @author Philip Milne
- * @author Brendon McLean
- * @author Dan van Enckevort
- * @author Parwinder Sekhon
- * @version 2.0 02/27/04
- */
-
-public class TableSorter extends AbstractTableModel
-{
- protected TableModel tableModel;
-
- public static final int DESCENDING = -1;
-
- public static final int NOT_SORTED = 0;
-
- public static final int ASCENDING = 1;
-
- private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
-
- public static final Comparator COMPARABLE_COMAPRATOR = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- return ((Comparable) o1).compareTo(o2);
- }
- };
-
- public static final Comparator LEXICAL_COMPARATOR = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- return o1.toString().compareTo(o2.toString());
- }
- };
-
- private Row[] viewToModel;
-
- private int[] modelToView;
-
- private JTableHeader tableHeader;
-
- private MouseListener mouseListener;
-
- private TableModelListener tableModelListener;
-
- private Map columnComparators = new HashMap();
-
- private List sortingColumns = new ArrayList();
-
- public TableSorter()
- {
- this.mouseListener = new MouseHandler();
- this.tableModelListener = new TableModelHandler();
- }
-
- public TableSorter(TableModel tableModel)
- {
- this();
- setTableModel(tableModel);
- }
-
- public TableSorter(TableModel tableModel, JTableHeader tableHeader)
- {
- this();
- setTableHeader(tableHeader);
- setTableModel(tableModel);
- }
-
- private void clearSortingState()
- {
- viewToModel = null;
- modelToView = null;
- }
-
- public TableModel getTableModel()
- {
- return tableModel;
- }
-
- public void setTableModel(TableModel tableModel)
- {
- if (this.tableModel != null)
- {
- this.tableModel.removeTableModelListener(tableModelListener);
- }
-
- this.tableModel = tableModel;
- if (this.tableModel != null)
- {
- this.tableModel.addTableModelListener(tableModelListener);
- }
-
- clearSortingState();
- fireTableStructureChanged();
- }
-
- public JTableHeader getTableHeader()
- {
- return tableHeader;
- }
-
- public void setTableHeader(JTableHeader tableHeader)
- {
- if (this.tableHeader != null)
- {
- this.tableHeader.removeMouseListener(mouseListener);
- TableCellRenderer defaultRenderer = this.tableHeader
- .getDefaultRenderer();
- if (defaultRenderer instanceof SortableHeaderRenderer)
- {
- this.tableHeader
- .setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
- }
- }
- this.tableHeader = tableHeader;
- if (this.tableHeader != null)
- {
- this.tableHeader.addMouseListener(mouseListener);
- this.tableHeader.setDefaultRenderer(new SortableHeaderRenderer(
- this.tableHeader.getDefaultRenderer()));
- }
- }
-
- public boolean isSorting()
- {
- return sortingColumns.size() != 0;
- }
-
- private Directive getDirective(int column)
- {
- for (int i = 0; i < sortingColumns.size(); i++)
- {
- Directive directive = (Directive) sortingColumns.get(i);
- if (directive.column == column)
- {
- return directive;
- }
- }
- return EMPTY_DIRECTIVE;
- }
-
- public int getSortingStatus(int column)
- {
- return getDirective(column).direction;
- }
-
- private void sortingStatusChanged()
- {
- clearSortingState();
- fireTableDataChanged();
- if (tableHeader != null)
- {
- tableHeader.repaint();
- }
- }
-
- public void setSortingStatus(int column, int status)
- {
- Directive directive = getDirective(column);
- if (directive != EMPTY_DIRECTIVE)
- {
- sortingColumns.remove(directive);
- }
- if (status != NOT_SORTED)
- {
- sortingColumns.add(new Directive(column, status));
- }
- sortingStatusChanged();
- }
-
- protected Icon getHeaderRendererIcon(int column, int size)
- {
- Directive directive = getDirective(column);
- if (directive == EMPTY_DIRECTIVE)
- {
- return null;
- }
- return new Arrow(directive.direction == DESCENDING, size,
- sortingColumns.indexOf(directive));
- }
-
- private void cancelSorting()
- {
- sortingColumns.clear();
- sortingStatusChanged();
- }
-
- public void setColumnComparator(Class type, Comparator comparator)
- {
- if (comparator == null)
- {
- columnComparators.remove(type);
- }
- else
- {
- columnComparators.put(type, comparator);
- }
- }
-
- protected Comparator getComparator(int column)
- {
- Class columnType = tableModel.getColumnClass(column);
- Comparator comparator = (Comparator) columnComparators.get(columnType);
- if (comparator != null)
- {
- return comparator;
- }
- if (Comparable.class.isAssignableFrom(columnType))
- {
- return COMPARABLE_COMAPRATOR;
- }
- return LEXICAL_COMPARATOR;
- }
-
- private Row[] getViewToModel()
- {
- if (viewToModel == null)
- {
- int tableModelRowCount = tableModel.getRowCount();
- viewToModel = new Row[tableModelRowCount];
- for (int row = 0; row < tableModelRowCount; row++)
- {
- viewToModel[row] = new Row(row);
- }
-
- if (isSorting())
- {
- Arrays.sort(viewToModel);
- }
- }
- return viewToModel;
- }
-
- public int modelIndex(int viewIndex)
- {
- return getViewToModel()[viewIndex].modelIndex;
- }
-
- private int[] getModelToView()
- {
- if (modelToView == null)
- {
- int n = getViewToModel().length;
- modelToView = new int[n];
- for (int i = 0; i < n; i++)
- {
- modelToView[modelIndex(i)] = i;
- }
- }
- return modelToView;
- }
-
- // TableModel interface methods
-
- public int getRowCount()
- {
- return (tableModel == null) ? 0 : tableModel.getRowCount();
- }
-
- public int getColumnCount()
- {
- return (tableModel == null) ? 0 : tableModel.getColumnCount();
- }
-
- public String getColumnName(int column)
- {
- return tableModel.getColumnName(column);
- }
-
- public Class getColumnClass(int column)
- {
- return tableModel.getColumnClass(column);
- }
-
- public boolean isCellEditable(int row, int column)
- {
- return tableModel.isCellEditable(modelIndex(row), column);
- }
-
- public Object getValueAt(int row, int column)
- {
- return tableModel.getValueAt(modelIndex(row), column);
- }
-
- public void setValueAt(Object aValue, int row, int column)
- {
- tableModel.setValueAt(aValue, modelIndex(row), column);
- }
-
- // Helper classes
-
- private class Row implements Comparable
- {
- private int modelIndex;
-
- public Row(int index)
- {
- this.modelIndex = index;
- }
-
- public int compareTo(Object o)
- {
- int row1 = modelIndex;
- int row2 = ((Row) o).modelIndex;
-
- for (Iterator it = sortingColumns.iterator(); it.hasNext();)
- {
- Directive directive = (Directive) it.next();
- int column = directive.column;
- Object o1 = tableModel.getValueAt(row1, column);
- Object o2 = tableModel.getValueAt(row2, column);
-
- int comparison = 0;
- // Define null less than everything, except null.
- if (o1 == null && o2 == null)
- {
- comparison = 0;
- }
- else if (o1 == null)
- {
- comparison = -1;
- }
- else if (o2 == null)
- {
- comparison = 1;
- }
- else
- {
- comparison = getComparator(column).compare(o1, o2);
- }
- if (comparison != 0)
- {
- return directive.direction == DESCENDING ? -comparison
- : comparison;
- }
- }
- return 0;
- }
- }
-
- private class TableModelHandler implements TableModelListener
- {
- public void tableChanged(TableModelEvent e)
- {
- // If we're not sorting by anything, just pass the event along.
- if (!isSorting())
- {
- clearSortingState();
- fireTableChanged(e);
- return;
- }
-
- // If the table structure has changed, cancel the sorting; the
- // sorting columns may have been either moved or deleted from
- // the model.
- if (e.getFirstRow() == TableModelEvent.HEADER_ROW)
- {
- cancelSorting();
- fireTableChanged(e);
- return;
- }
-
- // We can map a cell event through to the view without widening
- // when the following conditions apply:
- //
- // a) all the changes are on one row (e.getFirstRow() == e.getLastRow())
- // and,
- // b) all the changes are in one column (column !=
- // TableModelEvent.ALL_COLUMNS) and,
- // c) we are not sorting on that column (getSortingStatus(column) ==
- // NOT_SORTED) and,
- // d) a reverse lookup will not trigger a sort (modelToView != null)
- //
- // Note: INSERT and DELETE events fail this test as they have column ==
- // ALL_COLUMNS.
- //
- // The last check, for (modelToView != null) is to see if modelToView
- // is already allocated. If we don't do this check; sorting can become
- // a performance bottleneck for applications where cells
- // change rapidly in different parts of the table. If cells
- // change alternately in the sorting column and then outside of
- // it this class can end up re-sorting on alternate cell updates -
- // which can be a performance problem for large tables. The last
- // clause avoids this problem.
- int column = e.getColumn();
- if (e.getFirstRow() == e.getLastRow()
- && column != TableModelEvent.ALL_COLUMNS
- && getSortingStatus(column) == NOT_SORTED
- && modelToView != null)
- {
- int viewIndex = getModelToView()[e.getFirstRow()];
- fireTableChanged(new TableModelEvent(TableSorter.this, viewIndex,
- viewIndex, column, e.getType()));
- return;
- }
-
- // Something has happened to the data that may have invalidated the row
- // order.
- clearSortingState();
- fireTableDataChanged();
- return;
- }
- }
-
- private class MouseHandler extends MouseAdapter
- {
- public void mouseClicked(MouseEvent e)
- {
- JTableHeader h = (JTableHeader) e.getSource();
- TableColumnModel columnModel = h.getColumnModel();
- int viewColumn = columnModel.getColumnIndexAtX(e.getX());
- int column = columnModel.getColumn(viewColumn).getModelIndex();
- if (column != -1)
- {
- int status = getSortingStatus(column);
- if (!e.isControlDown())
- {
- cancelSorting();
- }
- // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING}
- // or
- // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is
- // pressed.
- status = status + (e.isShiftDown() ? -1 : 1);
- status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
- setSortingStatus(column, status);
- }
- }
- }
-
- private static class Arrow implements Icon
- {
- private boolean descending;
-
- private int size;
-
- private int priority;
-
- public Arrow(boolean descending, int size, int priority)
- {
- this.descending = descending;
- this.size = size;
- this.priority = priority;
- }
-
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- Color color = c == null ? Color.GRAY : c.getBackground();
- // In a compound sort, make each succesive triangle 20%
- // smaller than the previous one.
- int dx = (int) (size / 2 * Math.pow(0.8, priority));
- int dy = descending ? dx : -dx;
- // Align icon (roughly) with font baseline.
- y = y + 5 * size / 6 + (descending ? -dy : 0);
- int shift = descending ? 1 : -1;
- g.translate(x, y);
-
- // Right diagonal.
- g.setColor(color.darker());
- g.drawLine(dx / 2, dy, 0, 0);
- g.drawLine(dx / 2, dy + shift, 0, shift);
-
- // Left diagonal.
- g.setColor(color.brighter());
- g.drawLine(dx / 2, dy, dx, 0);
- g.drawLine(dx / 2, dy + shift, dx, shift);
-
- // Horizontal line.
- if (descending)
- {
- g.setColor(color.darker().darker());
- }
- else
- {
- g.setColor(color.brighter().brighter());
- }
- g.drawLine(dx, 0, 0, 0);
-
- g.setColor(color);
- g.translate(-x, -y);
- }
-
- public int getIconWidth()
- {
- return size;
- }
-
- public int getIconHeight()
- {
- return size;
- }
- }
-
- private class SortableHeaderRenderer implements TableCellRenderer
- {
- private TableCellRenderer tableCellRenderer;
-
- public SortableHeaderRenderer(TableCellRenderer tableCellRenderer)
- {
- this.tableCellRenderer = tableCellRenderer;
- }
-
- public Component getTableCellRendererComponent(JTable table,
- Object value, boolean isSelected, boolean hasFocus, int row,
- int column)
- {
- Component c = tableCellRenderer.getTableCellRendererComponent(table,
- value, isSelected, hasFocus, row, column);
- if (c instanceof JLabel)
- {
- JLabel l = (JLabel) c;
- l.setHorizontalTextPosition(JLabel.LEFT);
- int modelColumn = table.convertColumnIndexToModel(column);
- l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
- }
- return c;
- }
- }
-
- private static class Directive
- {
- private int column;
-
- private int direction;
-
- public Directive(int column, int direction)
- {
- this.column = column;
- this.direction = direction;
- }
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.util;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.Icon;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.JTableHeader;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
+
+/**
+ * TableSorter is a decorator for TableModels; adding sorting functionality to a
+ * supplied TableModel. TableSorter does not store or copy the data in its
+ * TableModel; instead it maintains a map from the row indexes of the view to
+ * the row indexes of the model. As requests are made of the sorter (like
+ * getValueAt(row, col)) they are passed to the underlying model after the row
+ * numbers have been translated via the internal mapping array. This way, the
+ * TableSorter appears to hold another copy of the table with the rows in a
+ * different order.
+ * <p/>
+ * TableSorter registers itself as a listener to the underlying model, just as
+ * the JTable itself would. Events recieved from the model are examined,
+ * sometimes manipulated (typically widened), and then passed on to the
+ * TableSorter's listeners (typically the JTable). If a change to the model has
+ * invalidated the order of TableSorter's rows, a note of this is made and the
+ * sorter will resort the rows the next time a value is requested.
+ * <p/>
+ * When the tableHeader property is set, either by using the setTableHeader()
+ * method or the two argument constructor, the table header may be used as a
+ * complete UI for TableSorter. The default renderer of the tableHeader is
+ * decorated with a renderer that indicates the sorting status of each column.
+ * In addition, a mouse listener is installed with the following behavior:
+ * <ul>
+ * <li>Mouse-click: Clears the sorting status of all other columns and advances
+ * the sorting status of that column through three values: {NOT_SORTED,
+ * ASCENDING, DESCENDING} (then back to NOT_SORTED again).
+ * <li>SHIFT-mouse-click: Clears the sorting status of all other columns and
+ * cycles the sorting status of the column through the same three values, in the
+ * opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.
+ * <li>CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that
+ * the changes to the column do not cancel the statuses of columns that are
+ * already sorting - giving a way to initiate a compound sort.
+ * </ul>
+ * <p/>
+ * This is a long overdue rewrite of a class of the same name that first
+ * appeared in the swing table demos in 1997.
+ *
+ * @author Philip Milne
+ * @author Brendon McLean
+ * @author Dan van Enckevort
+ * @author Parwinder Sekhon
+ * @version 2.0 02/27/04
+ */
+
+public class TableSorter extends AbstractTableModel
+{
+ protected TableModel tableModel;
+
+ public static final int DESCENDING = -1;
+
+ public static final int NOT_SORTED = 0;
+
+ public static final int ASCENDING = 1;
+
+ private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
+
+ public static final Comparator COMPARABLE_COMAPRATOR = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ return ((Comparable) o1).compareTo(o2);
+ }
+ };
+
+ public static final Comparator LEXICAL_COMPARATOR = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ return o1.toString().compareTo(o2.toString());
+ }
+ };
+
+ private Row[] viewToModel;
+
+ private int[] modelToView;
+
+ private JTableHeader tableHeader;
+
+ private MouseListener mouseListener;
+
+ private TableModelListener tableModelListener;
+
+ private Map columnComparators = new HashMap();
+
+ private List sortingColumns = new ArrayList();
+
+ public TableSorter()
+ {
+ this.mouseListener = new MouseHandler();
+ this.tableModelListener = new TableModelHandler();
+ }
+
+ public TableSorter(TableModel tableModel)
+ {
+ this();
+ setTableModel(tableModel);
+ }
+
+ public TableSorter(TableModel tableModel, JTableHeader tableHeader)
+ {
+ this();
+ setTableHeader(tableHeader);
+ setTableModel(tableModel);
+ }
+
+ private void clearSortingState()
+ {
+ viewToModel = null;
+ modelToView = null;
+ }
+
+ public TableModel getTableModel()
+ {
+ return tableModel;
+ }
+
+ public void setTableModel(TableModel tableModel)
+ {
+ if (this.tableModel != null)
+ {
+ this.tableModel.removeTableModelListener(tableModelListener);
+ }
+
+ this.tableModel = tableModel;
+ if (this.tableModel != null)
+ {
+ this.tableModel.addTableModelListener(tableModelListener);
+ }
+
+ clearSortingState();
+ fireTableStructureChanged();
+ }
+
+ public JTableHeader getTableHeader()
+ {
+ return tableHeader;
+ }
+
+ public void setTableHeader(JTableHeader tableHeader)
+ {
+ if (this.tableHeader != null)
+ {
+ this.tableHeader.removeMouseListener(mouseListener);
+ TableCellRenderer defaultRenderer = this.tableHeader
+ .getDefaultRenderer();
+ if (defaultRenderer instanceof SortableHeaderRenderer)
+ {
+ this.tableHeader
+ .setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
+ }
+ }
+ this.tableHeader = tableHeader;
+ if (this.tableHeader != null)
+ {
+ this.tableHeader.addMouseListener(mouseListener);
+ this.tableHeader.setDefaultRenderer(new SortableHeaderRenderer(
+ this.tableHeader.getDefaultRenderer()));
+ }
+ }
+
+ public boolean isSorting()
+ {
+ return sortingColumns.size() != 0;
+ }
+
+ private Directive getDirective(int column)
+ {
+ for (int i = 0; i < sortingColumns.size(); i++)
+ {
+ Directive directive = (Directive) sortingColumns.get(i);
+ if (directive.column == column)
+ {
+ return directive;
+ }
+ }
+ return EMPTY_DIRECTIVE;
+ }
+
+ public int getSortingStatus(int column)
+ {
+ return getDirective(column).direction;
+ }
+
+ private void sortingStatusChanged()
+ {
+ clearSortingState();
+ fireTableDataChanged();
+ if (tableHeader != null)
+ {
+ tableHeader.repaint();
+ }
+ }
+
+ public void setSortingStatus(int column, int status)
+ {
+ Directive directive = getDirective(column);
+ if (directive != EMPTY_DIRECTIVE)
+ {
+ sortingColumns.remove(directive);
+ }
+ if (status != NOT_SORTED)
+ {
+ sortingColumns.add(new Directive(column, status));
+ }
+ sortingStatusChanged();
+ }
+
+ protected Icon getHeaderRendererIcon(int column, int size)
+ {
+ Directive directive = getDirective(column);
+ if (directive == EMPTY_DIRECTIVE)
+ {
+ return null;
+ }
+ return new Arrow(directive.direction == DESCENDING, size,
+ sortingColumns.indexOf(directive));
+ }
+
+ private void cancelSorting()
+ {
+ sortingColumns.clear();
+ sortingStatusChanged();
+ }
+
+ public void setColumnComparator(Class type, Comparator comparator)
+ {
+ if (comparator == null)
+ {
+ columnComparators.remove(type);
+ }
+ else
+ {
+ columnComparators.put(type, comparator);
+ }
+ }
+
+ protected Comparator getComparator(int column)
+ {
+ Class columnType = tableModel.getColumnClass(column);
+ Comparator comparator = (Comparator) columnComparators.get(columnType);
+ if (comparator != null)
+ {
+ return comparator;
+ }
+ if (Comparable.class.isAssignableFrom(columnType))
+ {
+ return COMPARABLE_COMAPRATOR;
+ }
+ return LEXICAL_COMPARATOR;
+ }
+
+ private Row[] getViewToModel()
+ {
+ if (viewToModel == null)
+ {
+ int tableModelRowCount = tableModel.getRowCount();
+ viewToModel = new Row[tableModelRowCount];
+ for (int row = 0; row < tableModelRowCount; row++)
+ {
+ viewToModel[row] = new Row(row);
+ }
+
+ if (isSorting())
+ {
+ Arrays.sort(viewToModel);
+ }
+ }
+ return viewToModel;
+ }
+
+ public int modelIndex(int viewIndex)
+ {
+ return getViewToModel()[viewIndex].modelIndex;
+ }
+
+ private int[] getModelToView()
+ {
+ if (modelToView == null)
+ {
+ int n = getViewToModel().length;
+ modelToView = new int[n];
+ for (int i = 0; i < n; i++)
+ {
+ modelToView[modelIndex(i)] = i;
+ }
+ }
+ return modelToView;
+ }
+
+ // TableModel interface methods
+
+ public int getRowCount()
+ {
+ return (tableModel == null) ? 0 : tableModel.getRowCount();
+ }
+
+ public int getColumnCount()
+ {
+ return (tableModel == null) ? 0 : tableModel.getColumnCount();
+ }
+
+ public String getColumnName(int column)
+ {
+ return tableModel.getColumnName(column);
+ }
+
+ public Class getColumnClass(int column)
+ {
+ return tableModel.getColumnClass(column);
+ }
+
+ public boolean isCellEditable(int row, int column)
+ {
+ return tableModel.isCellEditable(modelIndex(row), column);
+ }
+
+ public Object getValueAt(int row, int column)
+ {
+ return tableModel.getValueAt(modelIndex(row), column);
+ }
+
+ public void setValueAt(Object aValue, int row, int column)
+ {
+ tableModel.setValueAt(aValue, modelIndex(row), column);
+ }
+
+ // Helper classes
+
+ private class Row implements Comparable
+ {
+ private int modelIndex;
+
+ public Row(int index)
+ {
+ this.modelIndex = index;
+ }
+
+ public int compareTo(Object o)
+ {
+ int row1 = modelIndex;
+ int row2 = ((Row) o).modelIndex;
+
+ for (Iterator it = sortingColumns.iterator(); it.hasNext();)
+ {
+ Directive directive = (Directive) it.next();
+ int column = directive.column;
+ Object o1 = tableModel.getValueAt(row1, column);
+ Object o2 = tableModel.getValueAt(row2, column);
+
+ int comparison = 0;
+ // Define null less than everything, except null.
+ if (o1 == null && o2 == null)
+ {
+ comparison = 0;
+ }
+ else if (o1 == null)
+ {
+ comparison = -1;
+ }
+ else if (o2 == null)
+ {
+ comparison = 1;
+ }
+ else
+ {
+ comparison = getComparator(column).compare(o1, o2);
+ }
+ if (comparison != 0)
+ {
+ return directive.direction == DESCENDING ? -comparison
+ : comparison;
+ }
+ }
+ return 0;
+ }
+ }
+
+ private class TableModelHandler implements TableModelListener
+ {
+ public void tableChanged(TableModelEvent e)
+ {
+ // If we're not sorting by anything, just pass the event along.
+ if (!isSorting())
+ {
+ clearSortingState();
+ fireTableChanged(e);
+ return;
+ }
+
+ // If the table structure has changed, cancel the sorting; the
+ // sorting columns may have been either moved or deleted from
+ // the model.
+ if (e.getFirstRow() == TableModelEvent.HEADER_ROW)
+ {
+ cancelSorting();
+ fireTableChanged(e);
+ return;
+ }
+
+ // We can map a cell event through to the view without widening
+ // when the following conditions apply:
+ //
+ // a) all the changes are on one row (e.getFirstRow() == e.getLastRow())
+ // and,
+ // b) all the changes are in one column (column !=
+ // TableModelEvent.ALL_COLUMNS) and,
+ // c) we are not sorting on that column (getSortingStatus(column) ==
+ // NOT_SORTED) and,
+ // d) a reverse lookup will not trigger a sort (modelToView != null)
+ //
+ // Note: INSERT and DELETE events fail this test as they have column ==
+ // ALL_COLUMNS.
+ //
+ // The last check, for (modelToView != null) is to see if modelToView
+ // is already allocated. If we don't do this check; sorting can become
+ // a performance bottleneck for applications where cells
+ // change rapidly in different parts of the table. If cells
+ // change alternately in the sorting column and then outside of
+ // it this class can end up re-sorting on alternate cell updates -
+ // which can be a performance problem for large tables. The last
+ // clause avoids this problem.
+ int column = e.getColumn();
+ if (e.getFirstRow() == e.getLastRow()
+ && column != TableModelEvent.ALL_COLUMNS
+ && getSortingStatus(column) == NOT_SORTED
+ && modelToView != null)
+ {
+ int viewIndex = getModelToView()[e.getFirstRow()];
+ fireTableChanged(new TableModelEvent(TableSorter.this, viewIndex,
+ viewIndex, column, e.getType()));
+ return;
+ }
+
+ // Something has happened to the data that may have invalidated the row
+ // order.
+ clearSortingState();
+ fireTableDataChanged();
+ return;
+ }
+ }
+
+ private class MouseHandler extends MouseAdapter
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ JTableHeader h = (JTableHeader) e.getSource();
+ TableColumnModel columnModel = h.getColumnModel();
+ int viewColumn = columnModel.getColumnIndexAtX(e.getX());
+ int column = columnModel.getColumn(viewColumn).getModelIndex();
+ if (column != -1)
+ {
+ int status = getSortingStatus(column);
+ if (!e.isControlDown())
+ {
+ cancelSorting();
+ }
+ // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING}
+ // or
+ // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is
+ // pressed.
+ status = status + (e.isShiftDown() ? -1 : 1);
+ status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
+ setSortingStatus(column, status);
+ }
+ }
+ }
+
+ private static class Arrow implements Icon
+ {
+ private boolean descending;
+
+ private int size;
+
+ private int priority;
+
+ public Arrow(boolean descending, int size, int priority)
+ {
+ this.descending = descending;
+ this.size = size;
+ this.priority = priority;
+ }
+
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color color = c == null ? Color.GRAY : c.getBackground();
+ // In a compound sort, make each succesive triangle 20%
+ // smaller than the previous one.
+ int dx = (int) (size / 2 * Math.pow(0.8, priority));
+ int dy = descending ? dx : -dx;
+ // Align icon (roughly) with font baseline.
+ y = y + 5 * size / 6 + (descending ? -dy : 0);
+ int shift = descending ? 1 : -1;
+ g.translate(x, y);
+
+ // Right diagonal.
+ g.setColor(color.darker());
+ g.drawLine(dx / 2, dy, 0, 0);
+ g.drawLine(dx / 2, dy + shift, 0, shift);
+
+ // Left diagonal.
+ g.setColor(color.brighter());
+ g.drawLine(dx / 2, dy, dx, 0);
+ g.drawLine(dx / 2, dy + shift, dx, shift);
+
+ // Horizontal line.
+ if (descending)
+ {
+ g.setColor(color.darker().darker());
+ }
+ else
+ {
+ g.setColor(color.brighter().brighter());
+ }
+ g.drawLine(dx, 0, 0, 0);
+
+ g.setColor(color);
+ g.translate(-x, -y);
+ }
+
+ public int getIconWidth()
+ {
+ return size;
+ }
+
+ public int getIconHeight()
+ {
+ return size;
+ }
+ }
+
+ private class SortableHeaderRenderer implements TableCellRenderer
+ {
+ private TableCellRenderer tableCellRenderer;
+
+ public SortableHeaderRenderer(TableCellRenderer tableCellRenderer)
+ {
+ this.tableCellRenderer = tableCellRenderer;
+ }
+
+ public Component getTableCellRendererComponent(JTable table,
+ Object value, boolean isSelected, boolean hasFocus, int row,
+ int column)
+ {
+ Component c = tableCellRenderer.getTableCellRendererComponent(table,
+ value, isSelected, hasFocus, row, column);
+ if (c instanceof JLabel)
+ {
+ JLabel l = (JLabel) c;
+ l.setHorizontalTextPosition(JLabel.LEFT);
+ int modelColumn = table.convertColumnIndexToModel(column);
+ l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
+ }
+ return c;
+ }
+ }
+
+ private static class Directive
+ {
+ private int column;
+
+ private int direction;
+
+ public Directive(int column, int direction)
+ {
+ this.column = column;
+ this.direction = direction;
+ }
+ }
+}
diff --git a/src/jalview/util/UrlLink.java b/src/jalview/util/UrlLink.java
index 84a327a..85a4bc8 100644
--- a/src/jalview/util/UrlLink.java
+++ b/src/jalview/util/UrlLink.java
@@ -1,398 +1,396 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.util;
-
-import java.util.Vector;
-
-public class UrlLink
-{
- /**
- * helper class to parse URL Link strings taken from applet parameters or
- * jalview properties file using the com.stevesoft.pat.Regex implementation.
- * Jalview 2.4 extension allows regular expressions to be used to parse ID
- * strings and replace the result in the URL. Regex's operate on the whole ID
- * string given to the matchURL method, if no regex is supplied, then only
- * text following the first pipe symbol will be susbstituted. Usage
- * documentation todo.
- */
- private String url_suffix, url_prefix, target, label, regexReplace;
-
- private boolean dynamic = false;
-
- private String invalidMessage = null;
-
- /**
- * parse the given linkString of the form '<label>|<url>' into parts url may
- * contain a string $SEQUENCE_ID<=optional regex=>$ where <=optional regex=>
- * must be of the form =/<perl style regex>/=$
- *
- * @param link
- */
- public UrlLink(String link)
- {
- int sep = link.indexOf("|"), psqid = link.indexOf("$SEQUENCE_ID");
- if (psqid > -1)
- {
- dynamic = true;
- int p = sep;
- do
- {
- sep = p;
- p = link.indexOf("|", sep + 1);
- } while (p > sep && p < psqid);
- // Assuming that the URL itself does not contain any '|' symbols
- // sep now contains last pipe symbol position prior to any regex symbols
- label = link.substring(0, sep);
- if (label.indexOf("|") > -1)
- {
- // | terminated database name / www target at start of Label
- target = label.substring(0, label.indexOf("|"));
- }
- else if (label.indexOf(" ") > 2)
- {
- // space separated Label - matches database name
- target = label.substring(0, label.indexOf(" "));
- }
- else
- {
- target = label;
- }
- // Parse URL : Whole URL string first
- url_prefix = link.substring(sep + 1, psqid);
- if (link.indexOf("$SEQUENCE_ID=/") == psqid
- && (p = link.indexOf("/=$", psqid + 14)) > psqid + 14)
- {
- // Extract Regex and suffix
- url_suffix = link.substring(p + 3);
- regexReplace = link.substring(psqid + 14, p);
- try
- {
- com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"
- + regexReplace + "/");
- if (rg == null)
- {
- invalidMessage = "Invalid Regular Expression : '"
- + regexReplace + "'\n";
- }
- } catch (Exception e)
- {
- invalidMessage = "Invalid Regular Expression : '" + regexReplace
- + "'\n";
- }
- }
- else
- {
- regexReplace = null;
- // verify format is really correct.
- if (link.indexOf("$SEQUENCE_ID$") == psqid)
- {
- url_suffix = link.substring(psqid + 13);
- regexReplace = null;
- }
- else
- {
- invalidMessage = "Warning: invalid regex structure for URL link : "
- + link;
- }
- }
- }
- else
- {
- target = link.substring(0, sep);
- label = link.substring(0, sep = link.lastIndexOf("|"));
- url_prefix = link.substring(sep + 1);
- regexReplace = null; // implies we trim any prefix if necessary //
- // regexReplace=".*\\|?(.*)";
- url_suffix = null;
- }
- }
-
- /**
- * @return the url_suffix
- */
- public String getUrl_suffix()
- {
- return url_suffix;
- }
-
- /**
- * @return the url_prefix
- */
- public String getUrl_prefix()
- {
- return url_prefix;
- }
-
- /**
- * @return the target
- */
- public String getTarget()
- {
- return target;
- }
-
- /**
- * @return the label
- */
- public String getLabel()
- {
- return label;
- }
-
- /**
- * @return the regexReplace
- */
- public String getRegexReplace()
- {
- return regexReplace;
- }
-
- /**
- * @return the invalidMessage
- */
- public String getInvalidMessage()
- {
- return invalidMessage;
- }
-
- /**
- * Check if URL string was parsed properly.
- *
- * @return boolean - if false then <code>getInvalidMessage</code> returns an
- * error message
- */
- public boolean isValid()
- {
- return invalidMessage == null;
- }
-
- /**
- * return one or more URL strings by applying regex to the given idstring
- *
- * @param idstring
- * @param onlyIfMatches
- * - when true url strings are only made if regex is defined and
- * matches
- * @return String[] { part of idstring substituted, full substituted url , ..
- * next part, next url..}
- */
- public String[] makeUrls(String idstring, boolean onlyIfMatches)
- {
- if (dynamic)
- {
- if (regexReplace != null)
- {
- com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"
- + regexReplace + "/");
- if (rg.search(idstring))
- {
- int ns = rg.numSubs();
- if (ns == 0)
- {
- // take whole regex
- return new String[]
- { rg.stringMatched(),
- url_prefix + rg.stringMatched() + url_suffix };
- } /*
- * else if (ns==1) { // take only subgroup match return new String[]
- * { rg.stringMatched(1), url_prefix+rg.stringMatched(1)+url_suffix
- * }; }
- */
- else
- {
- // debug
- for (int s = 0; s <= rg.numSubs(); s++)
- {
- System.err.println("Sub " + s + " : " + rg.matchedFrom(s)
- + " : " + rg.matchedTo(s) + " : '"
- + rg.stringMatched(s) + "'");
- }
- // try to collate subgroup matches
- Vector subs = new Vector();
- // have to loop through submatches, collating them at top level
- // match
- int s = 0; // 1;
- while (s <= ns)
- {
- if (s + 1 <= ns && rg.matchedTo(s) > -1
- && rg.matchedTo(s + 1) > -1
- && rg.matchedTo(s + 1) < rg.matchedTo(s))
- {
- // s is top level submatch. search for submatches enclosed by
- // this one
- int r = s + 1;
- String mtch = "";
- while (r <= ns && rg.matchedTo(r) <= rg.matchedTo(s))
- {
- if (rg.matchedFrom(r) > -1)
- {
- mtch += rg.stringMatched(r);
- }
- r++;
- }
- if (mtch.length() > 0)
- {
- subs.addElement(mtch);
- subs.addElement(url_prefix + mtch + url_suffix);
- }
- s = r;
- }
- else
- {
- if (rg.matchedFrom(s) > -1)
- {
- subs.addElement(rg.stringMatched(s));
- subs.addElement(url_prefix + rg.stringMatched(s)
- + url_suffix);
- }
- s++;
- }
- }
-
- String[] res = new String[subs.size()];
- for (int r = 0, rs = subs.size(); r < rs; r++)
- {
- res[r] = (String) subs.elementAt(r);
- }
- subs.removeAllElements();
- return res;
- }
- }
- if (onlyIfMatches)
- {
- return null;
- }
- }
- /* Otherwise - trim off any 'prefix' - pre 2.4 Jalview behaviour */
- if (idstring.indexOf("|") > -1)
- {
- idstring = idstring.substring(idstring.lastIndexOf("|") + 1);
- }
-
- // just return simple url substitution.
- return new String[]
- { idstring, url_prefix + idstring + url_suffix };
- }
- else
- {
- return new String[]
- { "", url_prefix };
- }
- }
-
- public String toString()
- {
- return label
- + "|"
- + url_prefix
- + (dynamic ? ("$SEQUENCE_ID" + ((regexReplace != null) ? "="
- + regexReplace + "=$" : "$")) : "")
- + ((url_suffix == null) ? "" : url_suffix);
-
- }
-
- private static void testUrls(UrlLink ul, String idstring, String[] urls)
- {
-
- if (urls == null)
- {
- System.out.println("Created NO urls.");
- }
- else
- {
- System.out.println("Created " + (urls.length / 2) + " Urls.");
- for (int uls = 0; uls < urls.length; uls += 2)
- {
- System.out.println("URL Replacement text : " + urls[uls]
- + " : URL : " + urls[uls + 1]);
- }
- }
- }
-
- public static void main(String argv[])
- {
- String[] links = new String[]
- {
- /*
- * "AlinkT|Target|http://foo.foo.soo/",
- * "myUrl1|http://$SEQUENCE_ID=/[0-9]+/=$.someserver.org/foo",
- * "myUrl2|http://$SEQUENCE_ID=/(([0-9]+).+([A-Za-z]+))/=$.someserver.org/foo"
- * ,
- * "myUrl3|http://$SEQUENCE_ID=/([0-9]+).+([A-Za-z]+)/=$.someserver.org/foo"
- * , "myUrl4|target|http://$SEQUENCE_ID$.someserver.org/foo|too",
- * "PF1|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/(?:PFAM:)?(.+)/=$"
- * ,
- * "PF2|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/(PFAM:)?(.+)/=$"
- * ,
- * "PF3|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/PFAM:(.+)/=$"
- * , "NOTFER|http://notfer.org/$SEQUENCE_ID=/(?<!\\s)(.+)/=$",
- */
- "NESTED|http://nested/$SEQUENCE_ID=/^(?:Label:)?(?:(?:gi\\|(\\d+))|([^:]+))/=$/nested" };
- String[] idstrings = new String[]
- {
- /*
- * //"LGUL_human", //"QWIQW_123123", "uniprot|why_do+_12313_foo",
- * //"123123312", "123123 ABCDE foo", "PFAM:PF23943",
- */
- "Label:gi|9234|pdb|102L|A" };
- // TODO: test the setLabel method.
- for (int i = 0; i < links.length; i++)
- {
- UrlLink ul = new UrlLink(links[i]);
- if (ul.isValid())
- {
- System.out.println("\n\n\n");
- System.out.println("Link " + i + " " + links[i] + " : "
- + ul.toString());
- System.out.println(" pref : "
- + ul.getUrl_prefix()
- + "\n suf : "
- + ul.getUrl_suffix()
- + "\n : "
- + ((ul.getRegexReplace() != null) ? ul.getRegexReplace()
- : ""));
- for (int ids = 0; ids < idstrings.length; ids++)
- {
- System.out.println("ID String : " + idstrings[ids]
- + "\nWithout onlyIfMatches:");
- String[] urls = ul.makeUrls(idstrings[ids], false);
- testUrls(ul, idstrings[ids], urls);
- System.out.println("With onlyIfMatches set.");
- urls = ul.makeUrls(idstrings[ids], true);
- testUrls(ul, idstrings[ids], urls);
- }
- }
- else
- {
- System.err.println("Invalid URLLink : " + links[i] + " : "
- + ul.getInvalidMessage());
- }
- }
- }
-
- public boolean isDynamic()
- {
- // TODO Auto-generated method stub
- return dynamic;
- }
-
- public void setLabel(String newlabel)
- {
- this.label = newlabel;
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.util;
+
+import java.util.Vector;
+
+public class UrlLink
+{
+ /**
+ * helper class to parse URL Link strings taken from applet parameters or
+ * jalview properties file using the com.stevesoft.pat.Regex implementation.
+ * Jalview 2.4 extension allows regular expressions to be used to parse ID
+ * strings and replace the result in the URL. Regex's operate on the whole ID
+ * string given to the matchURL method, if no regex is supplied, then only
+ * text following the first pipe symbol will be susbstituted. Usage
+ * documentation todo.
+ */
+ private String url_suffix, url_prefix, target, label, regexReplace;
+
+ private boolean dynamic = false;
+
+ private String invalidMessage = null;
+
+ /**
+ * parse the given linkString of the form '<label>|<url>' into parts url may
+ * contain a string $SEQUENCE_ID<=optional regex=>$ where <=optional regex=>
+ * must be of the form =/<perl style regex>/=$
+ *
+ * @param link
+ */
+ public UrlLink(String link)
+ {
+ int sep = link.indexOf("|"), psqid = link.indexOf("$SEQUENCE_ID");
+ if (psqid > -1)
+ {
+ dynamic = true;
+ int p = sep;
+ do
+ {
+ sep = p;
+ p = link.indexOf("|", sep + 1);
+ } while (p > sep && p < psqid);
+ // Assuming that the URL itself does not contain any '|' symbols
+ // sep now contains last pipe symbol position prior to any regex symbols
+ label = link.substring(0, sep);
+ if (label.indexOf("|") > -1)
+ {
+ // | terminated database name / www target at start of Label
+ target = label.substring(0, label.indexOf("|"));
+ }
+ else if (label.indexOf(" ") > 2)
+ {
+ // space separated Label - matches database name
+ target = label.substring(0, label.indexOf(" "));
+ }
+ else
+ {
+ target = label;
+ }
+ // Parse URL : Whole URL string first
+ url_prefix = link.substring(sep + 1, psqid);
+ if (link.indexOf("$SEQUENCE_ID=/") == psqid
+ && (p = link.indexOf("/=$", psqid + 14)) > psqid + 14)
+ {
+ // Extract Regex and suffix
+ url_suffix = link.substring(p + 3);
+ regexReplace = link.substring(psqid + 14, p);
+ try
+ {
+ com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"
+ + regexReplace + "/");
+ if (rg == null)
+ {
+ invalidMessage = "Invalid Regular Expression : '"
+ + regexReplace + "'\n";
+ }
+ } catch (Exception e)
+ {
+ invalidMessage = "Invalid Regular Expression : '" + regexReplace
+ + "'\n";
+ }
+ }
+ else
+ {
+ regexReplace = null;
+ // verify format is really correct.
+ if (link.indexOf("$SEQUENCE_ID$") == psqid)
+ {
+ url_suffix = link.substring(psqid + 13);
+ regexReplace = null;
+ }
+ else
+ {
+ invalidMessage = "Warning: invalid regex structure for URL link : "
+ + link;
+ }
+ }
+ }
+ else
+ {
+ target = link.substring(0, sep);
+ label = link.substring(0, sep = link.lastIndexOf("|"));
+ url_prefix = link.substring(sep + 1);
+ regexReplace = null; // implies we trim any prefix if necessary //
+ // regexReplace=".*\\|?(.*)";
+ url_suffix = null;
+ }
+ }
+
+ /**
+ * @return the url_suffix
+ */
+ public String getUrl_suffix()
+ {
+ return url_suffix;
+ }
+
+ /**
+ * @return the url_prefix
+ */
+ public String getUrl_prefix()
+ {
+ return url_prefix;
+ }
+
+ /**
+ * @return the target
+ */
+ public String getTarget()
+ {
+ return target;
+ }
+
+ /**
+ * @return the label
+ */
+ public String getLabel()
+ {
+ return label;
+ }
+
+ /**
+ * @return the regexReplace
+ */
+ public String getRegexReplace()
+ {
+ return regexReplace;
+ }
+
+ /**
+ * @return the invalidMessage
+ */
+ public String getInvalidMessage()
+ {
+ return invalidMessage;
+ }
+
+ /**
+ * Check if URL string was parsed properly.
+ *
+ * @return boolean - if false then <code>getInvalidMessage</code> returns an
+ * error message
+ */
+ public boolean isValid()
+ {
+ return invalidMessage == null;
+ }
+
+ /**
+ * return one or more URL strings by applying regex to the given idstring
+ *
+ * @param idstring
+ * @param onlyIfMatches
+ * - when true url strings are only made if regex is defined and
+ * matches
+ * @return String[] { part of idstring substituted, full substituted url , ..
+ * next part, next url..}
+ */
+ public String[] makeUrls(String idstring, boolean onlyIfMatches)
+ {
+ if (dynamic)
+ {
+ if (regexReplace != null)
+ {
+ com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"
+ + regexReplace + "/");
+ if (rg.search(idstring))
+ {
+ int ns = rg.numSubs();
+ if (ns == 0)
+ {
+ // take whole regex
+ return new String[] { rg.stringMatched(),
+ url_prefix + rg.stringMatched() + url_suffix };
+ } /*
+ * else if (ns==1) { // take only subgroup match return new String[]
+ * { rg.stringMatched(1), url_prefix+rg.stringMatched(1)+url_suffix
+ * }; }
+ */
+ else
+ {
+ // debug
+ for (int s = 0; s <= rg.numSubs(); s++)
+ {
+ System.err.println("Sub " + s + " : " + rg.matchedFrom(s)
+ + " : " + rg.matchedTo(s) + " : '"
+ + rg.stringMatched(s) + "'");
+ }
+ // try to collate subgroup matches
+ Vector subs = new Vector();
+ // have to loop through submatches, collating them at top level
+ // match
+ int s = 0; // 1;
+ while (s <= ns)
+ {
+ if (s + 1 <= ns && rg.matchedTo(s) > -1
+ && rg.matchedTo(s + 1) > -1
+ && rg.matchedTo(s + 1) < rg.matchedTo(s))
+ {
+ // s is top level submatch. search for submatches enclosed by
+ // this one
+ int r = s + 1;
+ String mtch = "";
+ while (r <= ns && rg.matchedTo(r) <= rg.matchedTo(s))
+ {
+ if (rg.matchedFrom(r) > -1)
+ {
+ mtch += rg.stringMatched(r);
+ }
+ r++;
+ }
+ if (mtch.length() > 0)
+ {
+ subs.addElement(mtch);
+ subs.addElement(url_prefix + mtch + url_suffix);
+ }
+ s = r;
+ }
+ else
+ {
+ if (rg.matchedFrom(s) > -1)
+ {
+ subs.addElement(rg.stringMatched(s));
+ subs.addElement(url_prefix + rg.stringMatched(s)
+ + url_suffix);
+ }
+ s++;
+ }
+ }
+
+ String[] res = new String[subs.size()];
+ for (int r = 0, rs = subs.size(); r < rs; r++)
+ {
+ res[r] = (String) subs.elementAt(r);
+ }
+ subs.removeAllElements();
+ return res;
+ }
+ }
+ if (onlyIfMatches)
+ {
+ return null;
+ }
+ }
+ /* Otherwise - trim off any 'prefix' - pre 2.4 Jalview behaviour */
+ if (idstring.indexOf("|") > -1)
+ {
+ idstring = idstring.substring(idstring.lastIndexOf("|") + 1);
+ }
+
+ // just return simple url substitution.
+ return new String[] { idstring, url_prefix + idstring + url_suffix };
+ }
+ else
+ {
+ return new String[] { "", url_prefix };
+ }
+ }
+
+ public String toString()
+ {
+ return label
+ + "|"
+ + url_prefix
+ + (dynamic ? ("$SEQUENCE_ID" + ((regexReplace != null) ? "="
+ + regexReplace + "=$" : "$")) : "")
+ + ((url_suffix == null) ? "" : url_suffix);
+
+ }
+
+ private static void testUrls(UrlLink ul, String idstring, String[] urls)
+ {
+
+ if (urls == null)
+ {
+ System.out.println("Created NO urls.");
+ }
+ else
+ {
+ System.out.println("Created " + (urls.length / 2) + " Urls.");
+ for (int uls = 0; uls < urls.length; uls += 2)
+ {
+ System.out.println("URL Replacement text : " + urls[uls]
+ + " : URL : " + urls[uls + 1]);
+ }
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ String[] links = new String[] {
+ /*
+ * "AlinkT|Target|http://foo.foo.soo/",
+ * "myUrl1|http://$SEQUENCE_ID=/[0-9]+/=$.someserver.org/foo",
+ * "myUrl2|http://$SEQUENCE_ID=/(([0-9]+).+([A-Za-z]+))/=$.someserver.org/foo"
+ * ,
+ * "myUrl3|http://$SEQUENCE_ID=/([0-9]+).+([A-Za-z]+)/=$.someserver.org/foo"
+ * , "myUrl4|target|http://$SEQUENCE_ID$.someserver.org/foo|too",
+ * "PF1|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/(?:PFAM:)?(.+)/=$"
+ * ,
+ * "PF2|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/(PFAM:)?(.+)/=$"
+ * ,
+ * "PF3|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/PFAM:(.+)/=$"
+ * , "NOTFER|http://notfer.org/$SEQUENCE_ID=/(?<!\\s)(.+)/=$",
+ */
+ "NESTED|http://nested/$SEQUENCE_ID=/^(?:Label:)?(?:(?:gi\\|(\\d+))|([^:]+))/=$/nested" };
+ String[] idstrings = new String[] {
+ /*
+ * //"LGUL_human", //"QWIQW_123123", "uniprot|why_do+_12313_foo",
+ * //"123123312", "123123 ABCDE foo", "PFAM:PF23943",
+ */
+ "Label:gi|9234|pdb|102L|A" };
+ // TODO: test the setLabel method.
+ for (int i = 0; i < links.length; i++)
+ {
+ UrlLink ul = new UrlLink(links[i]);
+ if (ul.isValid())
+ {
+ System.out.println("\n\n\n");
+ System.out.println("Link " + i + " " + links[i] + " : "
+ + ul.toString());
+ System.out.println(" pref : "
+ + ul.getUrl_prefix()
+ + "\n suf : "
+ + ul.getUrl_suffix()
+ + "\n : "
+ + ((ul.getRegexReplace() != null) ? ul.getRegexReplace()
+ : ""));
+ for (int ids = 0; ids < idstrings.length; ids++)
+ {
+ System.out.println("ID String : " + idstrings[ids]
+ + "\nWithout onlyIfMatches:");
+ String[] urls = ul.makeUrls(idstrings[ids], false);
+ testUrls(ul, idstrings[ids], urls);
+ System.out.println("With onlyIfMatches set.");
+ urls = ul.makeUrls(idstrings[ids], true);
+ testUrls(ul, idstrings[ids], urls);
+ }
+ }
+ else
+ {
+ System.err.println("Invalid URLLink : " + links[i] + " : "
+ + ul.getInvalidMessage());
+ }
+ }
+ }
+
+ public boolean isDynamic()
+ {
+ // TODO Auto-generated method stub
+ return dynamic;
+ }
+
+ public void setLabel(String newlabel)
+ {
+ this.label = newlabel;
+ }
+}
diff --git a/src/jalview/util/jarInputStreamProvider.java b/src/jalview/util/jarInputStreamProvider.java
index 1f02d31..17bb015 100644
--- a/src/jalview/util/jarInputStreamProvider.java
+++ b/src/jalview/util/jarInputStreamProvider.java
@@ -1,45 +1,48 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.util;
-
-import java.io.IOException;
-import java.util.jar.JarInputStream;
-
-/**
- * input stream provider interface to be implemented by any non-file or URL
- * datasources so that all Jar entries can be read from the datasource by
- * repeatedly re-opening the JarInputStream.
- *
- * This is a workaround necessary because castor's unmarshaller will close the
- * input stream after an unmarshalling session, which normally closes the whole
- * Jar input stream, not just the current JarEntry's stream.
- */
-public interface jarInputStreamProvider
-{
- /**
- * @return properly initialized jar input stream
- */
- JarInputStream getJarInputStream() throws IOException;
-
- /**
- *
- * @return human readable name for datasource used when reporting any problems
- * with it
- */
- String getFilename();
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.util;
+
+import java.io.IOException;
+import java.util.jar.JarInputStream;
+
+/**
+ * input stream provider interface to be implemented by any non-file or URL
+ * datasources so that all Jar entries can be read from the datasource by
+ * repeatedly re-opening the JarInputStream.
+ *
+ * This is a workaround necessary because castor's unmarshaller will close the
+ * input stream after an unmarshalling session, which normally closes the whole
+ * Jar input stream, not just the current JarEntry's stream.
+ */
+public interface jarInputStreamProvider
+{
+ /**
+ * @return properly initialized jar input stream
+ */
+ JarInputStream getJarInputStream() throws IOException;
+
+ /**
+ *
+ * @return human readable name for datasource used when reporting any problems
+ * with it
+ */
+ String getFilename();
+}
diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java
new file mode 100644
index 0000000..a15e9a6
--- /dev/null
+++ b/src/jalview/viewmodel/AlignmentViewport.java
@@ -0,0 +1,2560 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.viewmodel;
+
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.analysis.Conservation;
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeaturesDisplayedI;
+import jalview.api.ViewStyleI;
+import jalview.commands.CommandI;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.CigarArray;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.HiddenSequences;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.CommandListener;
+import jalview.structure.StructureSelectionManager;
+import jalview.structure.VamsasSource;
+import jalview.util.Comparison;
+import jalview.util.MappingUtils;
+import jalview.viewmodel.styles.ViewStyle;
+import jalview.workers.AlignCalcManager;
+import jalview.workers.ComplementConsensusThread;
+import jalview.workers.ConsensusThread;
+import jalview.workers.StrucConsensusThread;
+
+import java.awt.Color;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * base class holding visualization and analysis attributes and common logic for
+ * an active alignment view displayed in the GUI
+ *
+ * @author jimp
+ *
+ */
+public abstract class AlignmentViewport implements AlignViewportI,
+ CommandListener, VamsasSource
+{
+ protected ViewStyleI viewStyle = new ViewStyle();
+
+ /**
+ * A viewport that hosts the cDna view of this (protein), or vice versa (if
+ * set).
+ */
+ AlignViewportI codingComplement = null;
+
+ FeaturesDisplayedI featuresDisplayed = null;
+
+ protected Deque<CommandI> historyList = new ArrayDeque<CommandI>();
+
+ protected Deque<CommandI> redoList = new ArrayDeque<CommandI>();
+
+ /**
+ * @param name
+ * @see jalview.api.ViewStyleI#setFontName(java.lang.String)
+ */
+ public void setFontName(String name)
+ {
+ viewStyle.setFontName(name);
+ }
+
+ /**
+ * @param style
+ * @see jalview.api.ViewStyleI#setFontStyle(int)
+ */
+ public void setFontStyle(int style)
+ {
+ viewStyle.setFontStyle(style);
+ }
+
+ /**
+ * @param size
+ * @see jalview.api.ViewStyleI#setFontSize(int)
+ */
+ public void setFontSize(int size)
+ {
+ viewStyle.setFontSize(size);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getFontStyle()
+ */
+ public int getFontStyle()
+ {
+ return viewStyle.getFontStyle();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getFontName()
+ */
+ public String getFontName()
+ {
+ return viewStyle.getFontName();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getFontSize()
+ */
+ public int getFontSize()
+ {
+ return viewStyle.getFontSize();
+ }
+
+ /**
+ * @param upperCasebold
+ * @see jalview.api.ViewStyleI#setUpperCasebold(boolean)
+ */
+ public void setUpperCasebold(boolean upperCasebold)
+ {
+ viewStyle.setUpperCasebold(upperCasebold);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#isUpperCasebold()
+ */
+ public boolean isUpperCasebold()
+ {
+ return viewStyle.isUpperCasebold();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#isSeqNameItalics()
+ */
+ public boolean isSeqNameItalics()
+ {
+ return viewStyle.isSeqNameItalics();
+ }
+
+ /**
+ * @param colourByReferenceSeq
+ * @see jalview.api.ViewStyleI#setColourByReferenceSeq(boolean)
+ */
+ public void setColourByReferenceSeq(boolean colourByReferenceSeq)
+ {
+ viewStyle.setColourByReferenceSeq(colourByReferenceSeq);
+ }
+
+ /**
+ * @param b
+ * @see jalview.api.ViewStyleI#setColourAppliesToAllGroups(boolean)
+ */
+ public void setColourAppliesToAllGroups(boolean b)
+ {
+ viewStyle.setColourAppliesToAllGroups(b);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getColourAppliesToAllGroups()
+ */
+ public boolean getColourAppliesToAllGroups()
+ {
+ return viewStyle.getColourAppliesToAllGroups();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getAbovePIDThreshold()
+ */
+ public boolean getAbovePIDThreshold()
+ {
+ return viewStyle.getAbovePIDThreshold();
+ }
+
+ /**
+ * @param inc
+ * @see jalview.api.ViewStyleI#setIncrement(int)
+ */
+ public void setIncrement(int inc)
+ {
+ viewStyle.setIncrement(inc);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getIncrement()
+ */
+ public int getIncrement()
+ {
+ return viewStyle.getIncrement();
+ }
+
+ /**
+ * @param b
+ * @see jalview.api.ViewStyleI#setConservationSelected(boolean)
+ */
+ public void setConservationSelected(boolean b)
+ {
+ viewStyle.setConservationSelected(b);
+ }
+
+ /**
+ * @param show
+ * @see jalview.api.ViewStyleI#setShowHiddenMarkers(boolean)
+ */
+ public void setShowHiddenMarkers(boolean show)
+ {
+ viewStyle.setShowHiddenMarkers(show);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getShowHiddenMarkers()
+ */
+ public boolean getShowHiddenMarkers()
+ {
+ return viewStyle.getShowHiddenMarkers();
+ }
+
+ /**
+ * @param b
+ * @see jalview.api.ViewStyleI#setScaleRightWrapped(boolean)
+ */
+ public void setScaleRightWrapped(boolean b)
+ {
+ viewStyle.setScaleRightWrapped(b);
+ }
+
+ /**
+ * @param b
+ * @see jalview.api.ViewStyleI#setScaleLeftWrapped(boolean)
+ */
+ public void setScaleLeftWrapped(boolean b)
+ {
+ viewStyle.setScaleLeftWrapped(b);
+ }
+
+ /**
+ * @param b
+ * @see jalview.api.ViewStyleI#setScaleAboveWrapped(boolean)
+ */
+ public void setScaleAboveWrapped(boolean b)
+ {
+ viewStyle.setScaleAboveWrapped(b);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getScaleLeftWrapped()
+ */
+ public boolean getScaleLeftWrapped()
+ {
+ return viewStyle.getScaleLeftWrapped();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getScaleAboveWrapped()
+ */
+ public boolean getScaleAboveWrapped()
+ {
+ return viewStyle.getScaleAboveWrapped();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getScaleRightWrapped()
+ */
+ public boolean getScaleRightWrapped()
+ {
+ return viewStyle.getScaleRightWrapped();
+ }
+
+ /**
+ * @param b
+ * @see jalview.api.ViewStyleI#setAbovePIDThreshold(boolean)
+ */
+ public void setAbovePIDThreshold(boolean b)
+ {
+ viewStyle.setAbovePIDThreshold(b);
+ }
+
+ /**
+ * @param thresh
+ * @see jalview.api.ViewStyleI#setThreshold(int)
+ */
+ public void setThreshold(int thresh)
+ {
+ viewStyle.setThreshold(thresh);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getThreshold()
+ */
+ public int getThreshold()
+ {
+ return viewStyle.getThreshold();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getShowJVSuffix()
+ */
+ public boolean getShowJVSuffix()
+ {
+ return viewStyle.getShowJVSuffix();
+ }
+
+ /**
+ * @param b
+ * @see jalview.api.ViewStyleI#setShowJVSuffix(boolean)
+ */
+ public void setShowJVSuffix(boolean b)
+ {
+ viewStyle.setShowJVSuffix(b);
+ }
+
+ /**
+ * @param state
+ * @see jalview.api.ViewStyleI#setWrapAlignment(boolean)
+ */
+ public void setWrapAlignment(boolean state)
+ {
+ viewStyle.setWrapAlignment(state);
+ }
+
+ /**
+ * @param state
+ * @see jalview.api.ViewStyleI#setShowText(boolean)
+ */
+ public void setShowText(boolean state)
+ {
+ viewStyle.setShowText(state);
+ }
+
+ /**
+ * @param state
+ * @see jalview.api.ViewStyleI#setRenderGaps(boolean)
+ */
+ public void setRenderGaps(boolean state)
+ {
+ viewStyle.setRenderGaps(state);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getColourText()
+ */
+ public boolean getColourText()
+ {
+ return viewStyle.getColourText();
+ }
+
+ /**
+ * @param state
+ * @see jalview.api.ViewStyleI#setColourText(boolean)
+ */
+ public void setColourText(boolean state)
+ {
+ viewStyle.setColourText(state);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getWrapAlignment()
+ */
+ public boolean getWrapAlignment()
+ {
+ return viewStyle.getWrapAlignment();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getShowText()
+ */
+ public boolean getShowText()
+ {
+ return viewStyle.getShowText();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getWrappedWidth()
+ */
+ public int getWrappedWidth()
+ {
+ return viewStyle.getWrappedWidth();
+ }
+
+ /**
+ * @param w
+ * @see jalview.api.ViewStyleI#setWrappedWidth(int)
+ */
+ public void setWrappedWidth(int w)
+ {
+ viewStyle.setWrappedWidth(w);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getCharHeight()
+ */
+ public int getCharHeight()
+ {
+ return viewStyle.getCharHeight();
+ }
+
+ /**
+ * @param h
+ * @see jalview.api.ViewStyleI#setCharHeight(int)
+ */
+ public void setCharHeight(int h)
+ {
+ viewStyle.setCharHeight(h);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getCharWidth()
+ */
+ public int getCharWidth()
+ {
+ return viewStyle.getCharWidth();
+ }
+
+ /**
+ * @param w
+ * @see jalview.api.ViewStyleI#setCharWidth(int)
+ */
+ public void setCharWidth(int w)
+ {
+ viewStyle.setCharWidth(w);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getShowBoxes()
+ */
+ public boolean getShowBoxes()
+ {
+ return viewStyle.getShowBoxes();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getShowUnconserved()
+ */
+ public boolean getShowUnconserved()
+ {
+ return viewStyle.getShowUnconserved();
+ }
+
+ /**
+ * @param showunconserved
+ * @see jalview.api.ViewStyleI#setShowUnconserved(boolean)
+ */
+ public void setShowUnconserved(boolean showunconserved)
+ {
+ viewStyle.setShowUnconserved(showunconserved);
+ }
+
+ /**
+ * @param default1
+ * @see jalview.api.ViewStyleI#setSeqNameItalics(boolean)
+ */
+ public void setSeqNameItalics(boolean default1)
+ {
+ viewStyle.setSeqNameItalics(default1);
+ }
+
+ /**
+ * alignment displayed in the viewport. Please use get/setter
+ */
+ protected AlignmentI alignment;
+
+ @Override
+ public AlignmentI getAlignment()
+ {
+ return alignment;
+ }
+
+ @Override
+ public char getGapCharacter()
+ {
+ return alignment.getGapCharacter();
+ }
+
+ protected String sequenceSetID;
+
+ /**
+ * probably unused indicator that view is of a dataset rather than an
+ * alignment
+ */
+ protected boolean isDataset = false;
+
+ public void setDataset(boolean b)
+ {
+ isDataset = b;
+ }
+
+ public boolean isDataset()
+ {
+ return isDataset;
+ }
+
+ private Map<SequenceI, SequenceCollectionI> hiddenRepSequences;
+
+ protected ColumnSelection colSel = new ColumnSelection();
+
+ public boolean autoCalculateConsensus = true;
+
+ protected boolean autoCalculateStrucConsensus = true;
+
+ protected boolean ignoreGapsInConsensusCalculation = false;
+
+ protected ColourSchemeI globalColourScheme = null;
+
+ @Override
+ public void setGlobalColourScheme(ColourSchemeI cs)
+ {
+ // TODO: logic refactored from AlignFrame changeColour -
+ // TODO: autorecalc stuff should be changed to rely on the worker system
+ // check to see if we should implement a changeColour(cs) method rather than
+ // put th logic in here
+ // - means that caller decides if they want to just modify state and defer
+ // calculation till later or to do all calculations in thread.
+ // via changecolour
+ globalColourScheme = cs;
+ boolean recalc = false;
+ if (cs != null)
+ {
+ cs.setConservationApplied(recalc = getConservationSelected());
+ if (getAbovePIDThreshold() || cs instanceof PIDColourScheme
+ || cs instanceof Blosum62ColourScheme)
+ {
+ recalc = true;
+ cs.setThreshold(viewStyle.getThreshold(),
+ ignoreGapsInConsensusCalculation);
+ }
+ else
+ {
+ cs.setThreshold(0, ignoreGapsInConsensusCalculation);
+ }
+ if (recalc)
+ {
+ cs.setConsensus(hconsensus);
+ cs.setConservation(hconservation);
+ }
+ cs.alignmentChanged(alignment, hiddenRepSequences);
+ }
+ if (getColourAppliesToAllGroups())
+ {
+ for (SequenceGroup sg : getAlignment().getGroups())
+ {
+ if (cs == null)
+ {
+ sg.cs = null;
+ continue;
+ }
+ sg.cs = cs.applyTo(sg, getHiddenRepSequences());
+ sg.setConsPercGaps(ConsPercGaps);
+ if (getAbovePIDThreshold() || cs instanceof PIDColourScheme
+ || cs instanceof Blosum62ColourScheme)
+ {
+ sg.cs.setThreshold(viewStyle.getThreshold(),
+ isIgnoreGapsConsensus());
+ recalc = true;
+ }
+ else
+ {
+ sg.cs.setThreshold(0, isIgnoreGapsConsensus());
+ }
+
+ if (getConservationSelected())
+ {
+ sg.cs.setConservationApplied(true);
+ recalc = true;
+ }
+ else
+ {
+ sg.cs.setConservation(null);
+ // sg.cs.setThreshold(0, getIgnoreGapsConsensus());
+ }
+ if (recalc)
+ {
+ sg.recalcConservation();
+ }
+ else
+ {
+ sg.cs.alignmentChanged(sg, hiddenRepSequences);
+ }
+ }
+ }
+ }
+
+ @Override
+ public ColourSchemeI getGlobalColourScheme()
+ {
+ return globalColourScheme;
+ }
+
+ protected AlignmentAnnotation consensus;
+
+ protected AlignmentAnnotation complementConsensus;
+
+ protected AlignmentAnnotation strucConsensus;
+
+ protected AlignmentAnnotation conservation;
+
+ protected AlignmentAnnotation quality;
+
+ protected AlignmentAnnotation[] groupConsensus;
+
+ protected AlignmentAnnotation[] groupConservation;
+
+ /**
+ * results of alignment consensus analysis for visible portion of view
+ */
+ protected Hashtable[] hconsensus = null;
+
+ /**
+ * results of cDNA complement consensus visible portion of view
+ */
+ protected Hashtable[] hcomplementConsensus = null;
+
+ /**
+ * results of secondary structure base pair consensus for visible portion of
+ * view
+ */
+ protected Hashtable[] hStrucConsensus = null;
+
+ protected Conservation hconservation = null;
+
+ @Override
+ public void setConservation(Conservation cons)
+ {
+ hconservation = cons;
+ }
+
+ /**
+ * percentage gaps allowed in a column before all amino acid properties should
+ * be considered unconserved
+ */
+ int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
+
+ @Override
+ public int getConsPercGaps()
+ {
+ return ConsPercGaps;
+ }
+
+ @Override
+ public void setSequenceConsensusHash(Hashtable[] hconsensus)
+ {
+ this.hconsensus = hconsensus;
+ }
+
+ @Override
+ public void setComplementConsensusHash(Hashtable[] hconsensus)
+ {
+ this.hcomplementConsensus = hconsensus;
+ }
+
+ @Override
+ public Hashtable[] getSequenceConsensusHash()
+ {
+ return hconsensus;
+ }
+
+ @Override
+ public Hashtable[] getComplementConsensusHash()
+ {
+ return hcomplementConsensus;
+ }
+
+ @Override
+ public Hashtable[] getRnaStructureConsensusHash()
+ {
+ return hStrucConsensus;
+ }
+
+ @Override
+ public void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus)
+ {
+ this.hStrucConsensus = hStrucConsensus;
+
+ }
+
+ @Override
+ public AlignmentAnnotation getAlignmentQualityAnnot()
+ {
+ return quality;
+ }
+
+ @Override
+ public AlignmentAnnotation getAlignmentConservationAnnotation()
+ {
+ return conservation;
+ }
+
+ @Override
+ public AlignmentAnnotation getAlignmentConsensusAnnotation()
+ {
+ return consensus;
+ }
+
+ @Override
+ public AlignmentAnnotation getComplementConsensusAnnotation()
+ {
+ return complementConsensus;
+ }
+
+ @Override
+ public AlignmentAnnotation getAlignmentStrucConsensusAnnotation()
+ {
+ return strucConsensus;
+ }
+
+ protected AlignCalcManagerI calculator = new AlignCalcManager();
+
+ /**
+ * trigger update of conservation annotation
+ */
+ public void updateConservation(final AlignmentViewPanel ap)
+ {
+ // see note in mantis : issue number 8585
+ if (alignment.isNucleotide() || conservation == null
+ || !autoCalculateConsensus)
+ {
+ return;
+ }
+ if (calculator
+ .getRegisteredWorkersOfClass(jalview.workers.ConservationThread.class) == null)
+ {
+ calculator.registerWorker(new jalview.workers.ConservationThread(
+ this, ap));
+ }
+ }
+
+ /**
+ * trigger update of consensus annotation
+ */
+ public void updateConsensus(final AlignmentViewPanel ap)
+ {
+ // see note in mantis : issue number 8585
+ if (consensus == null || !autoCalculateConsensus)
+ {
+ return;
+ }
+ if (calculator.getRegisteredWorkersOfClass(ConsensusThread.class) == null)
+ {
+ calculator.registerWorker(new ConsensusThread(this, ap));
+ }
+
+ /*
+ * A separate thread to compute cDNA consensus for a protein alignment
+ */
+ final AlignmentI al = this.getAlignment();
+ if (!al.isNucleotide() && al.getCodonFrames() != null
+ && !al.getCodonFrames().isEmpty())
+ {
+ if (calculator
+ .getRegisteredWorkersOfClass(ComplementConsensusThread.class) == null)
+ {
+ calculator.registerWorker(new ComplementConsensusThread(this, ap));
+ }
+ }
+ }
+
+ // --------START Structure Conservation
+ public void updateStrucConsensus(final AlignmentViewPanel ap)
+ {
+ if (autoCalculateStrucConsensus && strucConsensus == null
+ && alignment.isNucleotide() && alignment.hasRNAStructure())
+ {
+ // secondary structure has been added - so init the consensus line
+ initRNAStructure();
+ }
+
+ // see note in mantis : issue number 8585
+ if (strucConsensus == null || !autoCalculateStrucConsensus)
+ {
+ return;
+ }
+ if (calculator.getRegisteredWorkersOfClass(StrucConsensusThread.class) == null)
+ {
+ calculator.registerWorker(new StrucConsensusThread(this, ap));
+ }
+ }
+
+ public boolean isCalcInProgress()
+ {
+ return calculator.isWorking();
+ }
+
+ @Override
+ public boolean isCalculationInProgress(
+ AlignmentAnnotation alignmentAnnotation)
+ {
+ if (!alignmentAnnotation.autoCalculated)
+ {
+ return false;
+ }
+ if (calculator.workingInvolvedWith(alignmentAnnotation))
+ {
+ // System.err.println("grey out ("+alignmentAnnotation.label+")");
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isClosed()
+ {
+ // TODO: check that this isClosed is only true after panel is closed, not
+ // before it is fully constructed.
+ return alignment == null;
+ }
+
+ @Override
+ public AlignCalcManagerI getCalcManager()
+ {
+ return calculator;
+ }
+
+ /**
+ * should conservation rows be shown for groups
+ */
+ protected boolean showGroupConservation = false;
+
+ /**
+ * should consensus rows be shown for groups
+ */
+ protected boolean showGroupConsensus = false;
+
+ /**
+ * should consensus profile be rendered by default
+ */
+ protected boolean showSequenceLogo = false;
+
+ /**
+ * should consensus profile be rendered normalised to row height
+ */
+ protected boolean normaliseSequenceLogo = false;
+
+ /**
+ * should consensus histograms be rendered by default
+ */
+ protected boolean showConsensusHistogram = true;
+
+ /**
+ * @return the showConsensusProfile
+ */
+ @Override
+ public boolean isShowSequenceLogo()
+ {
+ return showSequenceLogo;
+ }
+
+ /**
+ * @param showSequenceLogo
+ * the new value
+ */
+ public void setShowSequenceLogo(boolean showSequenceLogo)
+ {
+ if (showSequenceLogo != this.showSequenceLogo)
+ {
+ // TODO: decouple settings setting from calculation when refactoring
+ // annotation update method from alignframe to viewport
+ this.showSequenceLogo = showSequenceLogo;
+ calculator.updateAnnotationFor(ConsensusThread.class);
+ calculator.updateAnnotationFor(ComplementConsensusThread.class);
+ calculator.updateAnnotationFor(StrucConsensusThread.class);
+ }
+ this.showSequenceLogo = showSequenceLogo;
+ }
+
+ /**
+ * @param showConsensusHistogram
+ * the showConsensusHistogram to set
+ */
+ public void setShowConsensusHistogram(boolean showConsensusHistogram)
+ {
+ this.showConsensusHistogram = showConsensusHistogram;
+ }
+
+ /**
+ * @return the showGroupConservation
+ */
+ public boolean isShowGroupConservation()
+ {
+ return showGroupConservation;
+ }
+
+ /**
+ * @param showGroupConservation
+ * the showGroupConservation to set
+ */
+ public void setShowGroupConservation(boolean showGroupConservation)
+ {
+ this.showGroupConservation = showGroupConservation;
+ }
+
+ /**
+ * @return the showGroupConsensus
+ */
+ public boolean isShowGroupConsensus()
+ {
+ return showGroupConsensus;
+ }
+
+ /**
+ * @param showGroupConsensus
+ * the showGroupConsensus to set
+ */
+ public void setShowGroupConsensus(boolean showGroupConsensus)
+ {
+ this.showGroupConsensus = showGroupConsensus;
+ }
+
+ /**
+ *
+ * @return flag to indicate if the consensus histogram should be rendered by
+ * default
+ */
+ @Override
+ public boolean isShowConsensusHistogram()
+ {
+ return this.showConsensusHistogram;
+ }
+
+ /**
+ * when set, updateAlignment will always ensure sequences are of equal length
+ */
+ private boolean padGaps = false;
+
+ /**
+ * when set, alignment should be reordered according to a newly opened tree
+ */
+ public boolean sortByTree = false;
+
+ /**
+ *
+ *
+ * @return null or the currently selected sequence region
+ */
+ @Override
+ public SequenceGroup getSelectionGroup()
+ {
+ return selectionGroup;
+ }
+
+ /**
+ * Set the selection group for this window.
+ *
+ * @param sg
+ * - group holding references to sequences in this alignment view
+ *
+ */
+ @Override
+ public void setSelectionGroup(SequenceGroup sg)
+ {
+ selectionGroup = sg;
+ }
+
+ public void setHiddenColumns(ColumnSelection colsel)
+ {
+ this.colSel = colsel;
+ }
+
+ @Override
+ public ColumnSelection getColumnSelection()
+ {
+ return colSel;
+ }
+
+ @Override
+ public void setColumnSelection(ColumnSelection colSel)
+ {
+ this.colSel = colSel;
+ if (colSel != null)
+ {
+ updateHiddenColumns();
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public Map<SequenceI, SequenceCollectionI> getHiddenRepSequences()
+ {
+ return hiddenRepSequences;
+ }
+
+ @Override
+ public void setHiddenRepSequences(
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ {
+ this.hiddenRepSequences = hiddenRepSequences;
+ }
+
+ @Override
+ public boolean hasHiddenColumns()
+ {
+ return colSel != null && colSel.hasHiddenColumns();
+ }
+
+ public void updateHiddenColumns()
+ {
+ // this method doesn't really do anything now. But - it could, since a
+ // column Selection could be in the process of modification
+ // hasHiddenColumns = colSel.hasHiddenColumns();
+ }
+
+ @Override
+ public boolean hasHiddenRows()
+ {
+ return alignment.getHiddenSequences().getSize() > 0;
+ }
+
+ protected SequenceGroup selectionGroup;
+
+ public void setSequenceSetId(String newid)
+ {
+ if (sequenceSetID != null)
+ {
+ System.err
+ .println("Warning - overwriting a sequenceSetId for a viewport!");
+ }
+ sequenceSetID = new String(newid);
+ }
+
+ @Override
+ public String getSequenceSetId()
+ {
+ if (sequenceSetID == null)
+ {
+ sequenceSetID = alignment.hashCode() + "";
+ }
+
+ return sequenceSetID;
+ }
+
+ /**
+ * unique viewId for synchronizing state (e.g. with stored Jalview Project)
+ *
+ */
+ protected String viewId = null;
+
+ @Override
+ public String getViewId()
+ {
+ if (viewId == null)
+ {
+ viewId = this.getSequenceSetId() + "." + this.hashCode() + "";
+ }
+ return viewId;
+ }
+
+ public void setIgnoreGapsConsensus(boolean b, AlignmentViewPanel ap)
+ {
+ ignoreGapsInConsensusCalculation = b;
+ if (ap != null)
+ {
+ updateConsensus(ap);
+ if (globalColourScheme != null)
+ {
+ globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
+ ignoreGapsInConsensusCalculation);
+ }
+ }
+
+ }
+
+ private long sgrouphash = -1, colselhash = -1;
+
+ /**
+ * checks current SelectionGroup against record of last hash value, and
+ * updates record.
+ *
+ * @param b
+ * update the record of last hash value
+ *
+ * @return true if SelectionGroup changed since last call (when b is true)
+ */
+ public boolean isSelectionGroupChanged(boolean b)
+ {
+ int hc = (selectionGroup == null || selectionGroup.getSize() == 0) ? -1
+ : selectionGroup.hashCode();
+ if (hc != -1 && hc != sgrouphash)
+ {
+ if (b)
+ {
+ sgrouphash = hc;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * checks current colsel against record of last hash value, and optionally
+ * updates record.
+ *
+ * @param b
+ * update the record of last hash value
+ * @return true if colsel changed since last call (when b is true)
+ */
+ public boolean isColSelChanged(boolean b)
+ {
+ int hc = (colSel == null || colSel.size() == 0) ? -1 : colSel
+ .hashCode();
+ if (hc != -1 && hc != colselhash)
+ {
+ if (b)
+ {
+ colselhash = hc;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isIgnoreGapsConsensus()
+ {
+ return ignoreGapsInConsensusCalculation;
+ }
+
+ // / property change stuff
+
+ // JBPNote Prolly only need this in the applet version.
+ private final java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
+ this);
+
+ protected boolean showConservation = true;
+
+ protected boolean showQuality = true;
+
+ protected boolean showConsensus = true;
+
+ private Map<SequenceI, Color> sequenceColours = new HashMap<SequenceI, Color>();
+
+ protected SequenceAnnotationOrder sortAnnotationsBy = null;
+
+ protected boolean showAutocalculatedAbove;
+
+ /**
+ * when set, view will scroll to show the highlighted position
+ */
+ private boolean followHighlight = true;
+
+ // TODO private with getters and setters?
+ public int startRes;
+
+ public int endRes;
+
+ public int startSeq;
+
+ public int endSeq;
+
+ /**
+ * Property change listener for changes in alignment
+ *
+ * @param listener
+ * DOCUMENT ME!
+ */
+ public void addPropertyChangeListener(
+ java.beans.PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param listener
+ * DOCUMENT ME!
+ */
+ public void removePropertyChangeListener(
+ java.beans.PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Property change listener for changes in alignment
+ *
+ * @param prop
+ * DOCUMENT ME!
+ * @param oldvalue
+ * DOCUMENT ME!
+ * @param newvalue
+ * DOCUMENT ME!
+ */
+ public void firePropertyChange(String prop, Object oldvalue,
+ Object newvalue)
+ {
+ changeSupport.firePropertyChange(prop, oldvalue, newvalue);
+ }
+
+ // common hide/show column stuff
+
+ public void hideSelectedColumns()
+ {
+ if (colSel.size() < 1)
+ {
+ return;
+ }
+
+ colSel.hideSelectedColumns();
+ setSelectionGroup(null);
+
+ }
+
+ public void hideColumns(int start, int end)
+ {
+ if (start == end)
+ {
+ colSel.hideColumns(start);
+ }
+ else
+ {
+ colSel.hideColumns(start, end);
+ }
+ }
+
+ public void showColumn(int col)
+ {
+ colSel.revealHiddenColumns(col);
+
+ }
+
+ public void showAllHiddenColumns()
+ {
+ colSel.revealAllHiddenColumns();
+ }
+
+ // common hide/show seq stuff
+ public void showAllHiddenSeqs()
+ {
+ if (alignment.getHiddenSequences().getSize() > 0)
+ {
+ if (selectionGroup == null)
+ {
+ selectionGroup = new SequenceGroup();
+ selectionGroup.setEndRes(alignment.getWidth() - 1);
+ }
+ List<SequenceI> tmp = alignment.getHiddenSequences().showAll(
+ hiddenRepSequences);
+ for (SequenceI seq : tmp)
+ {
+ selectionGroup.addSequence(seq, false);
+ setSequenceAnnotationsVisible(seq, true);
+ }
+
+ hiddenRepSequences = null;
+
+ firePropertyChange("alignment", null, alignment.getSequences());
+ // used to set hasHiddenRows/hiddenRepSequences here, after the property
+ // changed event
+ sendSelection();
+ }
+ }
+
+ public void showSequence(int index)
+ {
+ List<SequenceI> tmp = alignment.getHiddenSequences().showSequence(
+ index, hiddenRepSequences);
+ if (tmp.size() > 0)
+ {
+ if (selectionGroup == null)
+ {
+ selectionGroup = new SequenceGroup();
+ selectionGroup.setEndRes(alignment.getWidth() - 1);
+ }
+
+ for (SequenceI seq : tmp)
+ {
+ selectionGroup.addSequence(seq, false);
+ setSequenceAnnotationsVisible(seq, true);
+ }
+ firePropertyChange("alignment", null, alignment.getSequences());
+ sendSelection();
+ }
+ }
+
+ public void hideAllSelectedSeqs()
+ {
+ if (selectionGroup == null || selectionGroup.getSize() < 1)
+ {
+ return;
+ }
+
+ SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
+
+ hideSequence(seqs);
+
+ setSelectionGroup(null);
+ }
+
+ public void hideSequence(SequenceI[] seq)
+ {
+ if (seq != null)
+ {
+ for (int i = 0; i < seq.length; i++)
+ {
+ alignment.getHiddenSequences().hideSequence(seq[i]);
+ setSequenceAnnotationsVisible(seq[i], false);
+ }
+ firePropertyChange("alignment", null, alignment.getSequences());
+ }
+ }
+
+ /**
+ * Set visibility for any annotations for the given sequence.
+ *
+ * @param sequenceI
+ */
+ protected void setSequenceAnnotationsVisible(SequenceI sequenceI,
+ boolean visible)
+ {
+ for (AlignmentAnnotation ann : alignment.getAlignmentAnnotation())
+ {
+ if (ann.sequenceRef == sequenceI)
+ {
+ ann.visible = visible;
+ }
+ }
+ }
+
+ public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
+ {
+ int sSize = sg.getSize();
+ if (sSize < 2)
+ {
+ return;
+ }
+
+ if (hiddenRepSequences == null)
+ {
+ hiddenRepSequences = new Hashtable();
+ }
+
+ hiddenRepSequences.put(repSequence, sg);
+
+ // Hide all sequences except the repSequence
+ SequenceI[] seqs = new SequenceI[sSize - 1];
+ int index = 0;
+ for (int i = 0; i < sSize; i++)
+ {
+ if (sg.getSequenceAt(i) != repSequence)
+ {
+ if (index == sSize - 1)
+ {
+ return;
+ }
+
+ seqs[index++] = sg.getSequenceAt(i);
+ }
+ }
+ sg.setSeqrep(repSequence); // note: not done in 2.7applet
+ sg.setHidereps(true); // note: not done in 2.7applet
+ hideSequence(seqs);
+
+ }
+
+ public boolean isHiddenRepSequence(SequenceI seq)
+ {
+ return alignment.getSeqrep() == seq
+ || (hiddenRepSequences != null && hiddenRepSequences
+ .containsKey(seq));
+ }
+
+ public SequenceGroup getRepresentedSequences(SequenceI seq)
+ {
+ return (SequenceGroup) (hiddenRepSequences == null ? null
+ : hiddenRepSequences.get(seq));
+ }
+
+ @Override
+ public int adjustForHiddenSeqs(int alignmentIndex)
+ {
+ return alignment.getHiddenSequences().adjustForHiddenSeqs(
+ alignmentIndex);
+ }
+
+ @Override
+ public void invertColumnSelection()
+ {
+ colSel.invertColumnSelection(0, alignment.getWidth());
+ }
+
+ @Override
+ public SequenceI[] getSelectionAsNewSequence()
+ {
+ SequenceI[] sequences;
+ // JBPNote: Need to test jalviewLite.getSelectedSequencesAsAlignmentFrom -
+ // this was the only caller in the applet for this method
+ // JBPNote: in applet, this method returned references to the alignment
+ // sequences, and it did not honour the presence/absence of annotation
+ // attached to the alignment (probably!)
+ if (selectionGroup == null || selectionGroup.getSize() == 0)
+ {
+ sequences = alignment.getSequencesArray();
+ AlignmentAnnotation[] annots = alignment.getAlignmentAnnotation();
+ for (int i = 0; i < sequences.length; i++)
+ {
+ // construct new sequence with subset of visible annotation
+ sequences[i] = new Sequence(sequences[i], annots);
+ }
+ }
+ else
+ {
+ sequences = selectionGroup.getSelectionAsNewSequences(alignment);
+ }
+
+ return sequences;
+ }
+
+ @Override
+ public SequenceI[] getSequenceSelection()
+ {
+ SequenceI[] sequences = null;
+ if (selectionGroup != null)
+ {
+ sequences = selectionGroup.getSequencesInOrder(alignment);
+ }
+ if (sequences == null)
+ {
+ sequences = alignment.getSequencesArray();
+ }
+ return sequences;
+ }
+
+ @Override
+ public CigarArray getViewAsCigars(boolean selectedRegionOnly)
+ {
+ return new CigarArray(alignment, colSel,
+ (selectedRegionOnly ? selectionGroup : null));
+ }
+
+ @Override
+ public jalview.datamodel.AlignmentView getAlignmentView(
+ boolean selectedOnly)
+ {
+ return getAlignmentView(selectedOnly, false);
+ }
+
+ @Override
+ public jalview.datamodel.AlignmentView getAlignmentView(
+ boolean selectedOnly, boolean markGroups)
+ {
+ return new AlignmentView(alignment, colSel, selectionGroup,
+ colSel != null && colSel.hasHiddenColumns(), selectedOnly,
+ markGroups);
+ }
+
+ @Override
+ public String[] getViewAsString(boolean selectedRegionOnly)
+ {
+ String[] selection = null;
+ SequenceI[] seqs = null;
+ int i, iSize;
+ int start = 0, end = 0;
+ if (selectedRegionOnly && selectionGroup != null)
+ {
+ iSize = selectionGroup.getSize();
+ seqs = selectionGroup.getSequencesInOrder(alignment);
+ start = selectionGroup.getStartRes();
+ end = selectionGroup.getEndRes() + 1;
+ }
+ else
+ {
+ iSize = alignment.getHeight();
+ seqs = alignment.getSequencesArray();
+ end = alignment.getWidth();
+ }
+
+ selection = new String[iSize];
+ if (colSel != null && colSel.hasHiddenColumns())
+ {
+ selection = colSel.getVisibleSequenceStrings(start, end, seqs);
+ }
+ else
+ {
+ for (i = 0; i < iSize; i++)
+ {
+ selection[i] = seqs[i].getSequenceAsString(start, end);
+ }
+
+ }
+ return selection;
+ }
+
+ @Override
+ public List<int[]> getVisibleRegionBoundaries(int min, int max)
+ {
+ ArrayList<int[]> regions = new ArrayList<int[]>();
+ int start = min;
+ int end = max;
+
+ do
+ {
+ if (colSel != null && colSel.hasHiddenColumns())
+ {
+ if (start == 0)
+ {
+ start = colSel.adjustForHiddenColumns(start);
+ }
+
+ end = colSel.getHiddenBoundaryRight(start);
+ if (start == end)
+ {
+ end = max;
+ }
+ if (end > max)
+ {
+ end = max;
+ }
+ }
+
+ regions.add(new int[] { start, end });
+
+ if (colSel != null && colSel.hasHiddenColumns())
+ {
+ start = colSel.adjustForHiddenColumns(end);
+ start = colSel.getHiddenBoundaryLeft(start) + 1;
+ }
+ } while (end < max);
+
+ int[][] startEnd = new int[regions.size()][2];
+
+ return regions;
+ }
+
+ @Override
+ public List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
+ boolean selectedOnly)
+ {
+ ArrayList<AlignmentAnnotation> ala = new ArrayList<AlignmentAnnotation>();
+ AlignmentAnnotation[] aa;
+ if ((aa = alignment.getAlignmentAnnotation()) != null)
+ {
+ for (AlignmentAnnotation annot : aa)
+ {
+ AlignmentAnnotation clone = new AlignmentAnnotation(annot);
+ if (selectedOnly && selectionGroup != null)
+ {
+ colSel.makeVisibleAnnotation(selectionGroup.getStartRes(),
+ selectionGroup.getEndRes(), clone);
+ }
+ else
+ {
+ colSel.makeVisibleAnnotation(clone);
+ }
+ ala.add(clone);
+ }
+ }
+ return ala;
+ }
+
+ @Override
+ public boolean isPadGaps()
+ {
+ return padGaps;
+ }
+
+ @Override
+ public void setPadGaps(boolean padGaps)
+ {
+ this.padGaps = padGaps;
+ }
+
+ /**
+ * apply any post-edit constraints and trigger any calculations needed after
+ * an edit has been performed on the alignment
+ *
+ * @param ap
+ */
+ @Override
+ public void alignmentChanged(AlignmentViewPanel ap)
+ {
+ if (isPadGaps())
+ {
+ alignment.padGaps();
+ }
+ if (autoCalculateConsensus)
+ {
+ updateConsensus(ap);
+ }
+ if (hconsensus != null && autoCalculateConsensus)
+ {
+ updateConservation(ap);
+ }
+ if (autoCalculateStrucConsensus)
+ {
+ updateStrucConsensus(ap);
+ }
+
+ // Reset endRes of groups if beyond alignment width
+ int alWidth = alignment.getWidth();
+ List<SequenceGroup> groups = alignment.getGroups();
+ if (groups != null)
+ {
+ for (SequenceGroup sg : groups)
+ {
+ if (sg.getEndRes() > alWidth)
+ {
+ sg.setEndRes(alWidth - 1);
+ }
+ }
+ }
+
+ if (selectionGroup != null && selectionGroup.getEndRes() > alWidth)
+ {
+ selectionGroup.setEndRes(alWidth - 1);
+ }
+
+ resetAllColourSchemes();
+ calculator.restartWorkers();
+ // alignment.adjustSequenceAnnotations();
+ }
+
+ /**
+ * reset scope and do calculations for all applied colourschemes on alignment
+ */
+ void resetAllColourSchemes()
+ {
+ ColourSchemeI cs = globalColourScheme;
+ if (cs != null)
+ {
+ cs.alignmentChanged(alignment, hiddenRepSequences);
+
+ cs.setConsensus(hconsensus);
+ if (cs.conservationApplied())
+ {
+ cs.setConservation(Conservation.calculateConservation("All",
+ ResidueProperties.propHash, 3, alignment.getSequences(), 0,
+ alignment.getWidth(), false, getConsPercGaps(), false));
+ }
+ }
+
+ for (SequenceGroup sg : alignment.getGroups())
+ {
+ if (sg.cs != null)
+ {
+ sg.cs.alignmentChanged(sg, hiddenRepSequences);
+ }
+ sg.recalcConservation();
+ }
+ }
+
+ protected void initAutoAnnotation()
+ {
+ // TODO: add menu option action that nulls or creates consensus object
+ // depending on if the user wants to see the annotation or not in a
+ // specific alignment
+
+ if (hconsensus == null && !isDataset)
+ {
+ if (!alignment.isNucleotide())
+ {
+ initConservation();
+ initQuality();
+ }
+ else
+ {
+ initRNAStructure();
+ }
+ consensus = new AlignmentAnnotation("Consensus", "PID",
+ new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
+ initConsensus(consensus);
+
+ initComplementConsensus();
+ }
+ }
+
+ /**
+ * If this is a protein alignment and there are mappings to cDNA, add the cDNA
+ * consensus annotation.
+ */
+ public void initComplementConsensus()
+ {
+ if (!alignment.isNucleotide())
+ {
+ final Set<AlignedCodonFrame> codonMappings = alignment
+ .getCodonFrames();
+ if (codonMappings != null && !codonMappings.isEmpty())
+ {
+ complementConsensus = new AlignmentAnnotation("cDNA Consensus",
+ "PID for cDNA", new Annotation[1], 0f, 100f,
+ AlignmentAnnotation.BAR_GRAPH);
+ initConsensus(complementConsensus);
+ }
+ }
+ }
+
+ private void initConsensus(AlignmentAnnotation aa)
+ {
+ aa.hasText = true;
+ aa.autoCalculated = true;
+
+ if (showConsensus)
+ {
+ alignment.addAnnotation(aa);
+ }
+ }
+
+ private void initConservation()
+ {
+ if (showConservation)
+ {
+ if (conservation == null)
+ {
+ conservation = new AlignmentAnnotation("Conservation",
+ "Conservation of total alignment less than "
+ + getConsPercGaps() + "% gaps", new Annotation[1],
+ 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
+ conservation.hasText = true;
+ conservation.autoCalculated = true;
+ alignment.addAnnotation(conservation);
+ }
+ }
+ }
+
+ private void initQuality()
+ {
+ if (showQuality)
+ {
+ if (quality == null)
+ {
+ quality = new AlignmentAnnotation("Quality",
+ "Alignment Quality based on Blosum62 scores",
+ new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
+ quality.hasText = true;
+ quality.autoCalculated = true;
+ alignment.addAnnotation(quality);
+ }
+ }
+ }
+
+ private void initRNAStructure()
+ {
+ if (alignment.hasRNAStructure() && strucConsensus == null)
+ {
+ strucConsensus = new AlignmentAnnotation("StrucConsensus", "PID",
+ new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
+ strucConsensus.hasText = true;
+ strucConsensus.autoCalculated = true;
+
+ if (showConsensus)
+ {
+ alignment.addAnnotation(strucConsensus);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.api.AlignViewportI#calcPanelHeight()
+ */
+ @Override
+ public int calcPanelHeight()
+ {
+ // setHeight of panels
+ AlignmentAnnotation[] anns = getAlignment().getAlignmentAnnotation();
+ int height = 0;
+ int charHeight = getCharHeight();
+ if (anns != null)
+ {
+ BitSet graphgrp = new BitSet();
+ for (AlignmentAnnotation aa : anns)
+ {
+ if (aa == null)
+ {
+ System.err.println("Null annotation row: ignoring.");
+ continue;
+ }
+ if (!aa.visible)
+ {
+ continue;
+ }
+ if (aa.graphGroup > -1)
+ {
+ if (graphgrp.get(aa.graphGroup))
+ {
+ continue;
+ }
+ else
+ {
+ graphgrp.set(aa.graphGroup);
+ }
+ }
+ aa.height = 0;
+
+ if (aa.hasText)
+ {
+ aa.height += charHeight;
+ }
+
+ if (aa.hasIcons)
+ {
+ aa.height += 16;
+ }
+
+ if (aa.graph > 0)
+ {
+ aa.height += aa.graphHeight;
+ }
+
+ if (aa.height == 0)
+ {
+ aa.height = 20;
+ }
+
+ height += aa.height;
+ }
+ }
+ if (height == 0)
+ {
+ // set minimum
+ height = 20;
+ }
+ return height;
+ }
+
+ @Override
+ public void updateGroupAnnotationSettings(boolean applyGlobalSettings,
+ boolean preserveNewGroupSettings)
+ {
+ boolean updateCalcs = false;
+ boolean conv = isShowGroupConservation();
+ boolean cons = isShowGroupConsensus();
+ boolean showprf = isShowSequenceLogo();
+ boolean showConsHist = isShowConsensusHistogram();
+ boolean normLogo = isNormaliseSequenceLogo();
+
+ /**
+ * TODO reorder the annotation rows according to group/sequence ordering on
+ * alignment
+ */
+ boolean sortg = true;
+
+ // remove old automatic annotation
+ // add any new annotation
+
+ // intersect alignment annotation with alignment groups
+
+ AlignmentAnnotation[] aan = alignment.getAlignmentAnnotation();
+ List<SequenceGroup> oldrfs = new ArrayList<SequenceGroup>();
+ if (aan != null)
+ {
+ for (int an = 0; an < aan.length; an++)
+ {
+ if (aan[an].autoCalculated && aan[an].groupRef != null)
+ {
+ oldrfs.add(aan[an].groupRef);
+ alignment.deleteAnnotation(aan[an], false);
+ }
+ }
+ }
+ if (alignment.getGroups() != null)
+ {
+ for (SequenceGroup sg : alignment.getGroups())
+ {
+ updateCalcs = false;
+ if (applyGlobalSettings
+ || (!preserveNewGroupSettings && !oldrfs.contains(sg)))
+ {
+ // set defaults for this group's conservation/consensus
+ sg.setshowSequenceLogo(showprf);
+ sg.setShowConsensusHistogram(showConsHist);
+ sg.setNormaliseSequenceLogo(normLogo);
+ }
+ if (conv)
+ {
+ updateCalcs = true;
+ alignment.addAnnotation(sg.getConservationRow(), 0);
+ }
+ if (cons)
+ {
+ updateCalcs = true;
+ alignment.addAnnotation(sg.getConsensus(), 0);
+ }
+ // refresh the annotation rows
+ if (updateCalcs)
+ {
+ sg.recalcConservation();
+ }
+ }
+ }
+ oldrfs.clear();
+ }
+
+ @Override
+ public boolean isDisplayReferenceSeq()
+ {
+ return alignment.hasSeqrep() && viewStyle.isDisplayReferenceSeq();
+ }
+
+ @Override
+ public void setDisplayReferenceSeq(boolean displayReferenceSeq)
+ {
+ viewStyle.setDisplayReferenceSeq(displayReferenceSeq);
+ }
+
+ @Override
+ public boolean isColourByReferenceSeq()
+ {
+ return alignment.hasSeqrep() && viewStyle.isColourByReferenceSeq();
+ }
+
+ @Override
+ public Color getSequenceColour(SequenceI seq)
+ {
+ Color sqc = sequenceColours.get(seq);
+ return (sqc == null ? Color.white : sqc);
+ }
+
+ @Override
+ public void setSequenceColour(SequenceI seq, Color col)
+ {
+ if (col == null)
+ {
+ sequenceColours.remove(seq);
+ }
+ else
+ {
+ sequenceColours.put(seq, col);
+ }
+ }
+
+ @Override
+ public void updateSequenceIdColours()
+ {
+ for (SequenceGroup sg : alignment.getGroups())
+ {
+ if (sg.idColour != null)
+ {
+ for (SequenceI s : sg.getSequences(getHiddenRepSequences()))
+ {
+ sequenceColours.put(s, sg.idColour);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void clearSequenceColours()
+ {
+ sequenceColours.clear();
+ };
+
+ @Override
+ public AlignViewportI getCodingComplement()
+ {
+ return this.codingComplement;
+ }
+
+ /**
+ * Set this as the (cDna/protein) complement of the given viewport. Also
+ * ensures the reverse relationship is set on the given viewport.
+ */
+ @Override
+ public void setCodingComplement(AlignViewportI av)
+ {
+ if (this == av)
+ {
+ System.err.println("Ignoring recursive setCodingComplement request");
+ }
+ else
+ {
+ this.codingComplement = av;
+ // avoid infinite recursion!
+ if (av.getCodingComplement() != this)
+ {
+ av.setCodingComplement(this);
+ }
+ }
+ }
+
+ @Override
+ public boolean isNucleotide()
+ {
+ return getAlignment() == null ? false : getAlignment().isNucleotide();
+ }
+
+ @Override
+ public FeaturesDisplayedI getFeaturesDisplayed()
+ {
+ return featuresDisplayed;
+ }
+
+ @Override
+ public void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI)
+ {
+ featuresDisplayed = featuresDisplayedI;
+ }
+
+ @Override
+ public boolean areFeaturesDisplayed()
+ {
+ return featuresDisplayed != null
+ && featuresDisplayed.getRegisterdFeaturesCount() > 0;
+ }
+
+ /**
+ * set the flag
+ *
+ * @param b
+ * features are displayed if true
+ */
+ @Override
+ public void setShowSequenceFeatures(boolean b)
+ {
+ viewStyle.setShowSequenceFeatures(b);
+ }
+
+ @Override
+ public boolean isShowSequenceFeatures()
+ {
+ return viewStyle.isShowSequenceFeatures();
+ }
+
+ @Override
+ public void setShowSequenceFeaturesHeight(boolean selected)
+ {
+ viewStyle.setShowSequenceFeaturesHeight(selected);
+ }
+
+ @Override
+ public boolean isShowSequenceFeaturesHeight()
+ {
+ return viewStyle.isShowSequenceFeaturesHeight();
+ }
+
+ @Override
+ public void setShowAnnotation(boolean b)
+ {
+ viewStyle.setShowAnnotation(b);
+ }
+
+ @Override
+ public boolean isShowAnnotation()
+ {
+ return viewStyle.isShowAnnotation();
+ }
+
+ @Override
+ public boolean isRightAlignIds()
+ {
+ return viewStyle.isRightAlignIds();
+ }
+
+ @Override
+ public void setRightAlignIds(boolean rightAlignIds)
+ {
+ viewStyle.setRightAlignIds(rightAlignIds);
+ }
+
+ @Override
+ public boolean getConservationSelected()
+ {
+ return viewStyle.getConservationSelected();
+ }
+
+ @Override
+ public void setShowBoxes(boolean state)
+ {
+ viewStyle.setShowBoxes(state);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getTextColour()
+ */
+ public Color getTextColour()
+ {
+ return viewStyle.getTextColour();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getTextColour2()
+ */
+ public Color getTextColour2()
+ {
+ return viewStyle.getTextColour2();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getThresholdTextColour()
+ */
+ public int getThresholdTextColour()
+ {
+ return viewStyle.getThresholdTextColour();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#isConservationColourSelected()
+ */
+ public boolean isConservationColourSelected()
+ {
+ return viewStyle.isConservationColourSelected();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#isRenderGaps()
+ */
+ public boolean isRenderGaps()
+ {
+ return viewStyle.isRenderGaps();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#isShowColourText()
+ */
+ public boolean isShowColourText()
+ {
+ return viewStyle.isShowColourText();
+ }
+
+ /**
+ * @param conservationColourSelected
+ * @see jalview.api.ViewStyleI#setConservationColourSelected(boolean)
+ */
+ public void setConservationColourSelected(
+ boolean conservationColourSelected)
+ {
+ viewStyle.setConservationColourSelected(conservationColourSelected);
+ }
+
+ /**
+ * @param showColourText
+ * @see jalview.api.ViewStyleI#setShowColourText(boolean)
+ */
+ public void setShowColourText(boolean showColourText)
+ {
+ viewStyle.setShowColourText(showColourText);
+ }
+
+ /**
+ * @param textColour
+ * @see jalview.api.ViewStyleI#setTextColour(java.awt.Color)
+ */
+ public void setTextColour(Color textColour)
+ {
+ viewStyle.setTextColour(textColour);
+ }
+
+ /**
+ * @param thresholdTextColour
+ * @see jalview.api.ViewStyleI#setThresholdTextColour(int)
+ */
+ public void setThresholdTextColour(int thresholdTextColour)
+ {
+ viewStyle.setThresholdTextColour(thresholdTextColour);
+ }
+
+ /**
+ * @param textColour2
+ * @see jalview.api.ViewStyleI#setTextColour2(java.awt.Color)
+ */
+ public void setTextColour2(Color textColour2)
+ {
+ viewStyle.setTextColour2(textColour2);
+ }
+
+ @Override
+ public ViewStyleI getViewStyle()
+ {
+ return new ViewStyle(viewStyle);
+ }
+
+ @Override
+ public void setViewStyle(ViewStyleI settingsForView)
+ {
+ viewStyle = new ViewStyle(settingsForView);
+ }
+
+ @Override
+ public boolean sameStyle(ViewStyleI them)
+ {
+ return viewStyle.sameStyle(them);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#getIdWidth()
+ */
+ public int getIdWidth()
+ {
+ return viewStyle.getIdWidth();
+ }
+
+ /**
+ * @param i
+ * @see jalview.api.ViewStyleI#setIdWidth(int)
+ */
+ public void setIdWidth(int i)
+ {
+ viewStyle.setIdWidth(i);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#isCentreColumnLabels()
+ */
+ public boolean isCentreColumnLabels()
+ {
+ return viewStyle.isCentreColumnLabels();
+ }
+
+ /**
+ * @param centreColumnLabels
+ * @see jalview.api.ViewStyleI#setCentreColumnLabels(boolean)
+ */
+ public void setCentreColumnLabels(boolean centreColumnLabels)
+ {
+ viewStyle.setCentreColumnLabels(centreColumnLabels);
+ }
+
+ /**
+ * @param showdbrefs
+ * @see jalview.api.ViewStyleI#setShowDBRefs(boolean)
+ */
+ public void setShowDBRefs(boolean showdbrefs)
+ {
+ viewStyle.setShowDBRefs(showdbrefs);
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#isShowDBRefs()
+ */
+ public boolean isShowDBRefs()
+ {
+ return viewStyle.isShowDBRefs();
+ }
+
+ /**
+ * @return
+ * @see jalview.api.ViewStyleI#isShowNPFeats()
+ */
+ public boolean isShowNPFeats()
+ {
+ return viewStyle.isShowNPFeats();
+ }
+
+ /**
+ * @param shownpfeats
+ * @see jalview.api.ViewStyleI#setShowNPFeats(boolean)
+ */
+ public void setShowNPFeats(boolean shownpfeats)
+ {
+ viewStyle.setShowNPFeats(shownpfeats);
+ }
+
+ public abstract StructureSelectionManager getStructureSelectionManager();
+
+ /**
+ * Add one command to the command history list.
+ *
+ * @param command
+ */
+ public void addToHistoryList(CommandI command)
+ {
+ if (this.historyList != null)
+ {
+ this.historyList.push(command);
+ broadcastCommand(command, false);
+ }
+ }
+
+ protected void broadcastCommand(CommandI command, boolean undo)
+ {
+ getStructureSelectionManager().commandPerformed(command, undo,
+ getVamsasSource());
+ }
+
+ /**
+ * Add one command to the command redo list.
+ *
+ * @param command
+ */
+ public void addToRedoList(CommandI command)
+ {
+ if (this.redoList != null)
+ {
+ this.redoList.push(command);
+ }
+ broadcastCommand(command, true);
+ }
+
+ /**
+ * Clear the command redo list.
+ */
+ public void clearRedoList()
+ {
+ if (this.redoList != null)
+ {
+ this.redoList.clear();
+ }
+ }
+
+ public void setHistoryList(Deque<CommandI> list)
+ {
+ this.historyList = list;
+ }
+
+ public Deque<CommandI> getHistoryList()
+ {
+ return this.historyList;
+ }
+
+ public void setRedoList(Deque<CommandI> list)
+ {
+ this.redoList = list;
+ }
+
+ public Deque<CommandI> getRedoList()
+ {
+ return this.redoList;
+ }
+
+ @Override
+ public VamsasSource getVamsasSource()
+ {
+ return this;
+ }
+
+ public SequenceAnnotationOrder getSortAnnotationsBy()
+ {
+ return sortAnnotationsBy;
+ }
+
+ public void setSortAnnotationsBy(SequenceAnnotationOrder sortAnnotationsBy)
+ {
+ this.sortAnnotationsBy = sortAnnotationsBy;
+ }
+
+ public boolean isShowAutocalculatedAbove()
+ {
+ return showAutocalculatedAbove;
+ }
+
+ public void setShowAutocalculatedAbove(boolean showAutocalculatedAbove)
+ {
+ this.showAutocalculatedAbove = showAutocalculatedAbove;
+ }
+
+ @Override
+ public boolean isScaleProteinAsCdna()
+ {
+ return viewStyle.isScaleProteinAsCdna();
+ }
+
+ @Override
+ public void setScaleProteinAsCdna(boolean b)
+ {
+ viewStyle.setScaleProteinAsCdna(b);
+ }
+
+ /**
+ * @return true if view should scroll to show the highlighted region of a
+ * sequence
+ * @return
+ */
+ @Override
+ public final boolean isFollowHighlight()
+ {
+ return followHighlight;
+ }
+
+ @Override
+ public final void setFollowHighlight(boolean b)
+ {
+ this.followHighlight = b;
+ }
+
+ public int getStartRes()
+ {
+ return startRes;
+ }
+
+ public int getEndRes()
+ {
+ return endRes;
+ }
+
+ public int getStartSeq()
+ {
+ return startSeq;
+ }
+
+ public void setStartRes(int res)
+ {
+ this.startRes = res;
+ }
+
+ public void setStartSeq(int seq)
+ {
+ this.startSeq = seq;
+ }
+
+ public void setEndRes(int res)
+ {
+ if (res > alignment.getWidth() - 1)
+ {
+ // log.System.out.println(" Corrected res from " + res + " to maximum " +
+ // (alignment.getWidth()-1));
+ res = alignment.getWidth() - 1;
+ }
+ if (res < 0)
+ {
+ res = 0;
+ }
+ this.endRes = res;
+ }
+
+ public void setEndSeq(int seq)
+ {
+ if (seq > alignment.getHeight())
+ {
+ seq = alignment.getHeight();
+ }
+ if (seq < 0)
+ {
+ seq = 0;
+ }
+ this.endSeq = seq;
+ }
+
+ public int getEndSeq()
+ {
+ return endSeq;
+ }
+
+ /**
+ * Helper method to populate the SearchResults with the location in the
+ * complementary alignment to scroll to, in order to match this one.
+ *
+ * @param sr
+ * the SearchResults to add to
+ * @return the offset (below top of visible region) of the matched sequence
+ */
+ protected int findComplementScrollTarget(SearchResults sr)
+ {
+ final AlignViewportI complement = getCodingComplement();
+ if (complement == null || !complement.isFollowHighlight())
+ {
+ return 0;
+ }
+ boolean iAmProtein = !getAlignment().isNucleotide();
+ AlignmentI proteinAlignment = iAmProtein ? getAlignment() : complement
+ .getAlignment();
+ if (proteinAlignment == null)
+ {
+ return 0;
+ }
+ final Set<AlignedCodonFrame> mappings = proteinAlignment
+ .getCodonFrames();
+
+ /*
+ * Heuristic: find the first mapped sequence (if any) with a non-gapped
+ * residue in the middle column of the visible region. Scroll the
+ * complementary alignment to line up the corresponding residue.
+ */
+ int seqOffset = 0;
+ SequenceI sequence = null;
+
+ /*
+ * locate 'middle' column (true middle if an odd number visible, left of
+ * middle if an even number visible)
+ */
+ int middleColumn = getStartRes() + (getEndRes() - getStartRes()) / 2;
+ final HiddenSequences hiddenSequences = getAlignment()
+ .getHiddenSequences();
+
+ /*
+ * searching to the bottom of the alignment gives smoother scrolling across
+ * all gapped visible regions
+ */
+ int lastSeq = alignment.getHeight() - 1;
+ for (int seqNo = getStartSeq(); seqNo < lastSeq; seqNo++, seqOffset++)
+ {
+ sequence = getAlignment().getSequenceAt(seqNo);
+ if (hiddenSequences != null && hiddenSequences.isHidden(sequence))
+ {
+ continue;
+ }
+ if (Comparison.isGap(sequence.getCharAt(middleColumn)))
+ {
+ continue;
+ }
+ List<AlignedCodonFrame> seqMappings = MappingUtils
+ .findMappingsForSequence(sequence, mappings);
+ if (!seqMappings.isEmpty())
+ {
+ break;
+ }
+ }
+
+ if (sequence == null)
+ {
+ /*
+ * No ungapped mapped sequence in middle column - do nothing
+ */
+ return 0;
+ }
+ MappingUtils.addSearchResults(sr, sequence,
+ sequence.findPosition(middleColumn), mappings);
+ return seqOffset;
+ }
+}
diff --git a/src/jalview/viewmodel/PCAModel.java b/src/jalview/viewmodel/PCAModel.java
new file mode 100644
index 0000000..54a4925
--- /dev/null
+++ b/src/jalview/viewmodel/PCAModel.java
@@ -0,0 +1,246 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.viewmodel;
+
+import jalview.analysis.PCA;
+import jalview.api.RotatableCanvasI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequencePoint;
+
+import java.util.Vector;
+
+public class PCAModel
+{
+
+ public PCAModel(AlignmentView seqstrings2, SequenceI[] seqs2,
+ boolean nucleotide2)
+ {
+ seqstrings = seqstrings2;
+ seqs = seqs2;
+ nucleotide = nucleotide2;
+ score_matrix = nucleotide2 ? "PID" : "BLOSUM62";
+ }
+
+ private volatile PCA pca;
+
+ int top;
+
+ AlignmentView seqstrings;
+
+ SequenceI[] seqs;
+
+ /**
+ * Score matrix used to calculate PC
+ */
+ String score_matrix;
+
+ /**
+ * use the identity matrix for calculating similarity between sequences.
+ */
+ private boolean nucleotide = false;
+
+ private Vector<SequencePoint> points;
+
+ private boolean jvCalcMode = true;
+
+ public boolean isJvCalcMode()
+ {
+ return jvCalcMode;
+ }
+
+ public void run()
+ {
+
+ pca = new PCA(seqstrings.getSequenceStrings(' '), nucleotide,
+ score_matrix);
+ pca.setJvCalcMode(jvCalcMode);
+ pca.run();
+
+ // Now find the component coordinates
+ int ii = 0;
+
+ while ((ii < seqs.length) && (seqs[ii] != null))
+ {
+ ii++;
+ }
+
+ double[][] comps = new double[ii][ii];
+
+ for (int i = 0; i < ii; i++)
+ {
+ if (pca.getEigenvalue(i) > 1e-4)
+ {
+ comps[i] = pca.component(i);
+ }
+ }
+
+ top = pca.getM().rows - 1;
+
+ points = new Vector<SequencePoint>();
+ float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100);
+
+ for (int i = 0; i < pca.getM().rows; i++)
+ {
+ SequencePoint sp = new SequencePoint(seqs[i], scores[i]);
+ points.addElement(sp);
+ }
+
+ }
+
+ public void updateRc(RotatableCanvasI rc)
+ {
+ rc.setPoints(points, pca.getM().rows);
+ }
+
+ public boolean isNucleotide()
+ {
+ return nucleotide;
+ }
+
+ public void setNucleotide(boolean nucleotide)
+ {
+ this.nucleotide = nucleotide;
+ }
+
+ /**
+ *
+ *
+ * @return index of principle dimension of PCA
+ */
+ public int getTop()
+ {
+ return top;
+ }
+
+ /**
+ * update the 2d coordinates for the list of points to the given dimensions
+ * Principal dimension is getTop(). Next greatest eigenvector is getTop()-1.
+ * Note - pca.getComponents starts counting the spectrum from rank-2 to zero,
+ * rather than rank-1, so getComponents(dimN ...) == updateRcView(dimN+1 ..)
+ *
+ * @param dim1
+ * @param dim2
+ * @param dim3
+ */
+ public void updateRcView(int dim1, int dim2, int dim3)
+ {
+ // note: actual indices for components are dim1-1, etc (patch for JAL-1123)
+ float[][] scores = pca.getComponents(dim1 - 1, dim2 - 1, dim3 - 1, 100);
+
+ for (int i = 0; i < pca.getM().rows; i++)
+ {
+ ((SequencePoint) points.elementAt(i)).coord = scores[i];
+ }
+ }
+
+ public String getDetails()
+ {
+ return pca.getDetails();
+ }
+
+ public AlignmentView getSeqtrings()
+ {
+ return seqstrings;
+ }
+
+ public String getPointsasCsv(boolean transformed, int xdim, int ydim,
+ int zdim)
+ {
+ StringBuffer csv = new StringBuffer();
+ csv.append("\"Sequence\"");
+ if (transformed)
+ {
+ csv.append(",");
+ csv.append(xdim);
+ csv.append(",");
+ csv.append(ydim);
+ csv.append(",");
+ csv.append(zdim);
+ }
+ else
+ {
+ for (int d = 1, dmax = pca.component(1).length; d <= dmax; d++)
+ {
+ csv.append("," + d);
+ }
+ }
+ csv.append("\n");
+ for (int s = 0; s < seqs.length; s++)
+ {
+ csv.append("\"" + seqs[s].getName() + "\"");
+ double fl[];
+ if (!transformed)
+ {
+ // output pca in correct order
+ fl = pca.component(s);
+ for (int d = fl.length - 1; d >= 0; d--)
+ {
+ csv.append(",");
+ csv.append(fl[d]);
+ }
+ }
+ else
+ {
+ // output current x,y,z coords for points
+ fl = getPointPosition(s);
+ for (int d = 0; d < fl.length; d++)
+ {
+ csv.append(",");
+ csv.append(fl[d]);
+ }
+ }
+ csv.append("\n");
+ }
+ return csv.toString();
+ }
+
+ /**
+ *
+ * @return x,y,z positions of point s (index into points) under current
+ * transform.
+ */
+ public double[] getPointPosition(int s)
+ {
+ double pts[] = new double[3];
+ float[] p = points.elementAt(s).coord;
+ pts[0] = p[0];
+ pts[1] = p[1];
+ pts[2] = p[2];
+ return pts;
+ }
+
+ public void setJvCalcMode(boolean state)
+ {
+ jvCalcMode = state;
+ }
+
+ public String getScore_matrix()
+ {
+ return score_matrix;
+ }
+
+ public void setScore_matrix(String score_matrix)
+ {
+ this.score_matrix = score_matrix;
+ }
+
+}
diff --git a/src/jalview/viewmodel/annotationfilter/AnnotationFilterParameter.java b/src/jalview/viewmodel/annotationfilter/AnnotationFilterParameter.java
new file mode 100644
index 0000000..68c5ba8
--- /dev/null
+++ b/src/jalview/viewmodel/annotationfilter/AnnotationFilterParameter.java
@@ -0,0 +1,122 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.viewmodel.annotationfilter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AnnotationFilterParameter
+{
+ public enum ThresholdType
+ {
+ NO_THRESHOLD, BELOW_THRESHOLD, ABOVE_THRESHOLD;
+ }
+
+ public enum SearchableAnnotationField
+ {
+ DISPLAY_STRING, DESCRIPTION;
+ }
+
+ private ThresholdType thresholdType;
+
+ private float thresholdValue;
+
+ private boolean filterAlphaHelix = false;
+
+ private boolean filterBetaSheet = false;
+
+ private boolean filterTurn = false;
+
+ private String regexString;
+
+ private List<SearchableAnnotationField> regexSearchFields = new ArrayList<SearchableAnnotationField>();
+
+ public ThresholdType getThresholdType()
+ {
+ return thresholdType;
+ }
+
+ public void setThresholdType(ThresholdType thresholdType)
+ {
+ this.thresholdType = thresholdType;
+ }
+
+ public float getThresholdValue()
+ {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(float thresholdValue)
+ {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public String getRegexString()
+ {
+ return regexString;
+ }
+
+ public void setRegexString(String regexString)
+ {
+ this.regexString = regexString;
+ }
+
+ public List<SearchableAnnotationField> getRegexSearchFields()
+ {
+ return regexSearchFields;
+ }
+
+ public void addRegexSearchField(SearchableAnnotationField regexSearchField)
+ {
+ this.regexSearchFields.add(regexSearchField);
+ }
+
+ public boolean isFilterAlphaHelix()
+ {
+ return filterAlphaHelix;
+ }
+
+ public void setFilterAlphaHelix(boolean alphaHelix)
+ {
+ this.filterAlphaHelix = alphaHelix;
+ }
+
+ public boolean isFilterBetaSheet()
+ {
+ return filterBetaSheet;
+ }
+
+ public void setFilterBetaSheet(boolean betaSheet)
+ {
+ this.filterBetaSheet = betaSheet;
+ }
+
+ public boolean isFilterTurn()
+ {
+ return filterTurn;
+ }
+
+ public void setFilterTurn(boolean turn)
+ {
+ this.filterTurn = turn;
+ }
+
+}
diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
new file mode 100644
index 0000000..fdd40e4
--- /dev/null
+++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
@@ -0,0 +1,956 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.viewmodel.seqfeatures;
+
+import jalview.api.AlignViewportI;
+import jalview.api.FeaturesDisplayedI;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.renderer.seqfeatures.FeatureRenderer;
+import jalview.schemes.GraduatedColor;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Color;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+public abstract class FeatureRendererModel implements
+ jalview.api.FeatureRenderer
+{
+
+ /**
+ * global transparency for feature
+ */
+ protected float transparency = 1.0f;
+
+ protected Map<String, Object> featureColours = new ConcurrentHashMap<String, Object>();
+
+ protected Map<String, Boolean> featureGroups = new ConcurrentHashMap<String, Boolean>();
+
+ protected Object currentColour;
+
+ protected String[] renderOrder;
+
+ protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
+
+ protected AlignmentViewport av;
+
+ public AlignViewportI getViewport()
+ {
+ return av;
+ }
+
+ public FeatureRendererSettings getSettings()
+ {
+ return new FeatureRendererSettings(this);
+ }
+
+ public void transferSettings(FeatureRendererSettings fr)
+ {
+ this.renderOrder = fr.renderOrder;
+ this.featureGroups = fr.featureGroups;
+ this.featureColours = fr.featureColours;
+ this.transparency = fr.transparency;
+ this.featureOrder = fr.featureOrder;
+ }
+
+ /**
+ * update from another feature renderer
+ *
+ * @param fr
+ * settings to copy
+ */
+ public void transferSettings(jalview.api.FeatureRenderer _fr)
+ {
+ FeatureRenderer fr = (FeatureRenderer) _fr;
+ FeatureRendererSettings frs = new FeatureRendererSettings(fr);
+ this.renderOrder = frs.renderOrder;
+ this.featureGroups = frs.featureGroups;
+ this.featureColours = frs.featureColours;
+ this.transparency = frs.transparency;
+ this.featureOrder = frs.featureOrder;
+ if (av != null && av != fr.getViewport())
+ {
+ // copy over the displayed feature settings
+ if (_fr.getFeaturesDisplayed() != null)
+ {
+ FeaturesDisplayedI fd = getFeaturesDisplayed();
+ if (fd == null)
+ {
+ setFeaturesDisplayedFrom(_fr.getFeaturesDisplayed());
+ }
+ else
+ {
+ synchronized (fd)
+ {
+ fd.clear();
+ java.util.Iterator<String> fdisp = _fr.getFeaturesDisplayed()
+ .getVisibleFeatures();
+ while (fdisp.hasNext())
+ {
+ fd.setVisible(fdisp.next());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void setFeaturesDisplayedFrom(FeaturesDisplayedI featuresDisplayed)
+ {
+ av.setFeaturesDisplayed(new FeaturesDisplayed(featuresDisplayed));
+ }
+
+ @Override
+ public void setVisible(String featureType)
+ {
+ FeaturesDisplayedI fdi = av.getFeaturesDisplayed();
+ if (fdi == null)
+ {
+ av.setFeaturesDisplayed(fdi = new FeaturesDisplayed());
+ }
+ if (!fdi.isRegistered(featureType))
+ {
+ pushFeatureType(Arrays.asList(new String[] { featureType }));
+ }
+ fdi.setVisible(featureType);
+ }
+
+ @Override
+ public void setAllVisible(List<String> featureTypes)
+ {
+ FeaturesDisplayedI fdi = av.getFeaturesDisplayed();
+ if (fdi == null)
+ {
+ av.setFeaturesDisplayed(fdi = new FeaturesDisplayed());
+ }
+ List<String> nft = new ArrayList<String>();
+ for (String featureType : featureTypes)
+ {
+ if (!fdi.isRegistered(featureType))
+ {
+ nft.add(featureType);
+ }
+ }
+ if (nft.size() > 0)
+ {
+ pushFeatureType(nft);
+ }
+ fdi.setAllVisible(featureTypes);
+ }
+
+ /**
+ * push a set of new types onto the render order stack. Note - this is a
+ * direct mechanism rather than the one employed in updateRenderOrder
+ *
+ * @param types
+ */
+ private void pushFeatureType(List<String> types)
+ {
+
+ int ts = types.size();
+ String neworder[] = new String[(renderOrder == null ? 0
+ : renderOrder.length) + ts];
+ types.toArray(neworder);
+ if (renderOrder != null)
+ {
+ System.arraycopy(neworder, 0, neworder, renderOrder.length, ts);
+ System.arraycopy(renderOrder, 0, neworder, 0, renderOrder.length);
+ }
+ renderOrder = neworder;
+ }
+
+ protected Hashtable minmax = new Hashtable();
+
+ public Hashtable getMinMax()
+ {
+ return minmax;
+ }
+
+ /**
+ * normalise a score against the max/min bounds for the feature type.
+ *
+ * @param sequenceFeature
+ * @return byte[] { signed, normalised signed (-127 to 127) or unsigned
+ * (0-255) value.
+ */
+ protected final byte[] normaliseScore(SequenceFeature sequenceFeature)
+ {
+ float[] mm = ((float[][]) minmax.get(sequenceFeature.type))[0];
+ final byte[] r = new byte[] { 0, (byte) 255 };
+ if (mm != null)
+ {
+ if (r[0] != 0 || mm[0] < 0.0)
+ {
+ r[0] = 1;
+ r[1] = (byte) ((int) 128.0 + 127.0 * (sequenceFeature.score / mm[1]));
+ }
+ else
+ {
+ r[1] = (byte) ((int) 255.0 * (sequenceFeature.score / mm[1]));
+ }
+ }
+ return r;
+ }
+
+ boolean newFeatureAdded = false;
+
+ boolean findingFeatures = false;
+
+ protected boolean updateFeatures()
+ {
+ if (av.getFeaturesDisplayed() == null || renderOrder == null
+ || newFeatureAdded)
+ {
+ findAllFeatures();
+ if (av.getFeaturesDisplayed().getVisibleFeatureCount() < 1)
+ {
+ return false;
+ }
+ }
+ // TODO: decide if we should check for the visible feature count first
+ return true;
+ }
+
+ /**
+ * search the alignment for all new features, give them a colour and display
+ * them. Then fires a PropertyChangeEvent on the changeSupport object.
+ *
+ */
+ protected void findAllFeatures()
+ {
+ synchronized (firing)
+ {
+ if (firing.equals(Boolean.FALSE))
+ {
+ firing = Boolean.TRUE;
+ findAllFeatures(true); // add all new features as visible
+ changeSupport.firePropertyChange("changeSupport", null, null);
+ firing = Boolean.FALSE;
+ }
+ }
+ }
+
+ @Override
+ public List<SequenceFeature> findFeaturesAtRes(SequenceI sequence, int res)
+ {
+ ArrayList<SequenceFeature> tmp = new ArrayList<SequenceFeature>();
+ SequenceFeature[] features = sequence.getSequenceFeatures();
+
+ if (features != null)
+ {
+ for (int i = 0; i < features.length; i++)
+ {
+ if (!av.areFeaturesDisplayed()
+ || !av.getFeaturesDisplayed().isVisible(
+ features[i].getType()))
+ {
+ continue;
+ }
+
+ if (features[i].featureGroup != null
+ && featureGroups != null
+ && featureGroups.containsKey(features[i].featureGroup)
+ && !featureGroups.get(features[i].featureGroup)
+ .booleanValue())
+ {
+ continue;
+ }
+
+ if ((features[i].getBegin() <= res)
+ && (features[i].getEnd() >= res))
+ {
+ tmp.add(features[i]);
+ }
+ }
+ }
+ return tmp;
+ }
+
+ /**
+ * Searches alignment for all features and updates colours
+ *
+ * @param newMadeVisible
+ * if true newly added feature types will be rendered immediatly
+ * TODO: check to see if this method should actually be proxied so
+ * repaint events can be propagated by the renderer code
+ */
+ @Override
+ public synchronized void findAllFeatures(boolean newMadeVisible)
+ {
+ newFeatureAdded = false;
+
+ if (findingFeatures)
+ {
+ newFeatureAdded = true;
+ return;
+ }
+
+ findingFeatures = true;
+ if (av.getFeaturesDisplayed() == null)
+ {
+ av.setFeaturesDisplayed(new FeaturesDisplayed());
+ }
+ FeaturesDisplayedI featuresDisplayed = av.getFeaturesDisplayed();
+
+ ArrayList<String> allfeatures = new ArrayList<String>();
+ ArrayList<String> oldfeatures = new ArrayList<String>();
+ if (renderOrder != null)
+ {
+ for (int i = 0; i < renderOrder.length; i++)
+ {
+ if (renderOrder[i] != null)
+ {
+ oldfeatures.add(renderOrder[i]);
+ }
+ }
+ }
+ if (minmax == null)
+ {
+ minmax = new Hashtable();
+ }
+ AlignmentI alignment = av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
+ {
+ SequenceI asq = alignment.getSequenceAt(i);
+ SequenceFeature[] features = asq.getSequenceFeatures();
+
+ if (features == null)
+ {
+ continue;
+ }
+
+ int index = 0;
+ while (index < features.length)
+ {
+ if (!featuresDisplayed.isRegistered(features[index].getType()))
+ {
+ String fgrp = features[index].getFeatureGroup();
+ if (fgrp != null)
+ {
+ Boolean groupDisplayed = featureGroups.get(fgrp);
+ if (groupDisplayed == null)
+ {
+ groupDisplayed = Boolean.valueOf(newMadeVisible);
+ featureGroups.put(fgrp, groupDisplayed);
+ }
+ if (!groupDisplayed.booleanValue())
+ {
+ index++;
+ continue;
+ }
+ }
+ if (!(features[index].begin == 0 && features[index].end == 0))
+ {
+ // If beginning and end are 0, the feature is for the whole sequence
+ // and we don't want to render the feature in the normal way
+
+ if (newMadeVisible
+ && !oldfeatures.contains(features[index].getType()))
+ {
+ // this is a new feature type on the alignment. Mark it for
+ // display.
+ featuresDisplayed.setVisible(features[index].getType());
+ setOrder(features[index].getType(), 0);
+ }
+ }
+ }
+ if (!allfeatures.contains(features[index].getType()))
+ {
+ allfeatures.add(features[index].getType());
+ }
+ if (!Float.isNaN(features[index].score))
+ {
+ int nonpos = features[index].getBegin() >= 1 ? 0 : 1;
+ float[][] mm = (float[][]) minmax.get(features[index].getType());
+ if (mm == null)
+ {
+ mm = new float[][] { null, null };
+ minmax.put(features[index].getType(), mm);
+ }
+ if (mm[nonpos] == null)
+ {
+ mm[nonpos] = new float[] { features[index].score,
+ features[index].score };
+
+ }
+ else
+ {
+ if (mm[nonpos][0] > features[index].score)
+ {
+ mm[nonpos][0] = features[index].score;
+ }
+ if (mm[nonpos][1] < features[index].score)
+ {
+ mm[nonpos][1] = features[index].score;
+ }
+ }
+ }
+ index++;
+ }
+ }
+ updateRenderOrder(allfeatures);
+ findingFeatures = false;
+ }
+
+ protected Boolean firing = Boolean.FALSE;
+
+ /**
+ * replaces the current renderOrder with the unordered features in
+ * allfeatures. The ordering of any types in both renderOrder and allfeatures
+ * is preserved, and all new feature types are rendered on top of the existing
+ * types, in the order given by getOrder or the order given in allFeatures.
+ * Note. this operates directly on the featureOrder hash for efficiency. TODO:
+ * eliminate the float storage for computing/recalling the persistent ordering
+ * New Cability: updates min/max for colourscheme range if its dynamic
+ *
+ * @param allFeatures
+ */
+ private void updateRenderOrder(List<String> allFeatures)
+ {
+ List<String> allfeatures = new ArrayList<String>(allFeatures);
+ String[] oldRender = renderOrder;
+ renderOrder = new String[allfeatures.size()];
+ Object mmrange, fc = null;
+ boolean initOrders = (featureOrder == null);
+ int opos = 0;
+ if (oldRender != null && oldRender.length > 0)
+ {
+ for (int j = 0; j < oldRender.length; j++)
+ {
+ if (oldRender[j] != null)
+ {
+ if (initOrders)
+ {
+ setOrder(oldRender[j], (1 - (1 + (float) j) / oldRender.length));
+ }
+ if (allfeatures.contains(oldRender[j]))
+ {
+ renderOrder[opos++] = oldRender[j]; // existing features always
+ // appear below new features
+ allfeatures.remove(oldRender[j]);
+ if (minmax != null)
+ {
+ mmrange = minmax.get(oldRender[j]);
+ if (mmrange != null)
+ {
+ fc = featureColours.get(oldRender[j]);
+ if (fc != null && fc instanceof GraduatedColor
+ && ((GraduatedColor) fc).isAutoScale())
+ {
+ ((GraduatedColor) fc).updateBounds(
+ ((float[][]) mmrange)[0][0],
+ ((float[][]) mmrange)[0][1]);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (allfeatures.size() == 0)
+ {
+ // no new features - leave order unchanged.
+ return;
+ }
+ int i = allfeatures.size() - 1;
+ int iSize = i;
+ boolean sort = false;
+ String[] newf = new String[allfeatures.size()];
+ float[] sortOrder = new float[allfeatures.size()];
+ for (String newfeat : allfeatures)
+ {
+ newf[i] = newfeat;
+ if (minmax != null)
+ {
+ // update from new features minmax if necessary
+ mmrange = minmax.get(newf[i]);
+ if (mmrange != null)
+ {
+ fc = featureColours.get(newf[i]);
+ if (fc != null && fc instanceof GraduatedColor
+ && ((GraduatedColor) fc).isAutoScale())
+ {
+ ((GraduatedColor) fc).updateBounds(((float[][]) mmrange)[0][0],
+ ((float[][]) mmrange)[0][1]);
+ }
+ }
+ }
+ if (initOrders || !featureOrder.containsKey(newf[i]))
+ {
+ int denom = initOrders ? allfeatures.size() : featureOrder.size();
+ // new unordered feature - compute persistent ordering at head of
+ // existing features.
+ setOrder(newf[i], i / (float) denom);
+ }
+ // set order from newly found feature from persisted ordering.
+ sortOrder[i] = 2 - ((Float) featureOrder.get(newf[i])).floatValue();
+ if (i < iSize)
+ {
+ // only sort if we need to
+ sort = sort || sortOrder[i] > sortOrder[i + 1];
+ }
+ i--;
+ }
+ if (iSize > 1 && sort)
+ {
+ jalview.util.QuickSort.sort(sortOrder, newf);
+ }
+ sortOrder = null;
+ System.arraycopy(newf, 0, renderOrder, opos, newf.length);
+ }
+
+ /**
+ * get a feature style object for the given type string. Creates a
+ * java.awt.Color for a featureType with no existing colourscheme. TODO:
+ * replace return type with object implementing standard abstract colour/style
+ * interface
+ *
+ * @param featureType
+ * @return java.awt.Color or GraduatedColor
+ */
+ public Object getFeatureStyle(String featureType)
+ {
+ Object fc = featureColours.get(featureType);
+ if (fc == null)
+ {
+ jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme();
+ Color col = ucs.createColourFromName(featureType);
+ featureColours.put(featureType, fc = col);
+ }
+ return fc;
+ }
+
+ /**
+ * return a nominal colour for this feature
+ *
+ * @param featureType
+ * @return standard color, or maximum colour for graduated colourscheme
+ */
+ public Color getColour(String featureType)
+ {
+ Object fc = getFeatureStyle(featureType);
+
+ if (fc instanceof Color)
+ {
+ return (Color) fc;
+ }
+ else
+ {
+ if (fc instanceof GraduatedColor)
+ {
+ return ((GraduatedColor) fc).getMaxColor();
+ }
+ }
+ throw new Error("Implementation Error: Unrecognised render object "
+ + fc.getClass() + " for features of type " + featureType);
+ }
+
+ /**
+ * calculate the render colour for a specific feature using current feature
+ * settings.
+ *
+ * @param feature
+ * @return render colour for the given feature
+ */
+ public Color getColour(SequenceFeature feature)
+ {
+ Object fc = getFeatureStyle(feature.getType());
+ if (fc instanceof Color)
+ {
+ return (Color) fc;
+ }
+ else
+ {
+ if (fc instanceof GraduatedColor)
+ {
+ return ((GraduatedColor) fc).findColor(feature);
+ }
+ }
+ throw new Error("Implementation Error: Unrecognised render object "
+ + fc.getClass() + " for features of type " + feature.getType());
+ }
+
+ protected boolean showFeature(SequenceFeature sequenceFeature)
+ {
+ Object fc = getFeatureStyle(sequenceFeature.type);
+ if (fc instanceof GraduatedColor)
+ {
+ return ((GraduatedColor) fc).isColored(sequenceFeature);
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ protected boolean showFeatureOfType(String type)
+ {
+ return av.getFeaturesDisplayed().isVisible(type);
+ }
+
+ public void setColour(String featureType, Object col)
+ {
+ // overwrite
+ // Color _col = (col instanceof Color) ? ((Color) col) : (col instanceof
+ // GraduatedColor) ? ((GraduatedColor) col).getMaxColor() : null;
+ // Object c = featureColours.get(featureType);
+ // if (c == null || c instanceof Color || (c instanceof GraduatedColor &&
+ // !((GraduatedColor)c).getMaxColor().equals(_col)))
+ {
+ featureColours.put(featureType, col);
+ }
+ }
+
+ public void setTransparency(float value)
+ {
+ transparency = value;
+ }
+
+ public float getTransparency()
+ {
+ return transparency;
+ }
+
+ Map featureOrder = null;
+
+ /**
+ * analogous to colour - store a normalized ordering for all feature types in
+ * this rendering context.
+ *
+ * @param type
+ * Feature type string
+ * @param position
+ * normalized priority - 0 means always appears on top, 1 means
+ * always last.
+ */
+ public float setOrder(String type, float position)
+ {
+ if (featureOrder == null)
+ {
+ featureOrder = new Hashtable();
+ }
+ featureOrder.put(type, new Float(position));
+ return position;
+ }
+
+ /**
+ * get the global priority (0 (top) to 1 (bottom))
+ *
+ * @param type
+ * @return [0,1] or -1 for a type without a priority
+ */
+ public float getOrder(String type)
+ {
+ if (featureOrder != null)
+ {
+ if (featureOrder.containsKey(type))
+ {
+ return ((Float) featureOrder.get(type)).floatValue();
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public Map<String, Object> getFeatureColours()
+ {
+ return new ConcurrentHashMap<String, Object>(featureColours);
+ }
+
+ /**
+ * Replace current ordering with new ordering
+ *
+ * @param data
+ * { String(Type), Colour(Type), Boolean(Displayed) }
+ */
+ public void setFeaturePriority(Object[][] data)
+ {
+ setFeaturePriority(data, true);
+ }
+
+ /**
+ *
+ * @param data
+ * { String(Type), Colour(Type), Boolean(Displayed) }
+ * @param visibleNew
+ * when true current featureDisplay list will be cleared
+ */
+ public void setFeaturePriority(Object[][] data, boolean visibleNew)
+ {
+ FeaturesDisplayedI av_featuresdisplayed = null;
+ if (visibleNew)
+ {
+ if ((av_featuresdisplayed = av.getFeaturesDisplayed()) != null)
+ {
+ av.getFeaturesDisplayed().clear();
+ }
+ else
+ {
+ av.setFeaturesDisplayed(av_featuresdisplayed = new FeaturesDisplayed());
+ }
+ }
+ else
+ {
+ av_featuresdisplayed = av.getFeaturesDisplayed();
+ }
+ if (data == null)
+ {
+ return;
+ }
+ // The feature table will display high priority
+ // features at the top, but theses are the ones
+ // we need to render last, so invert the data
+ renderOrder = new String[data.length];
+
+ if (data.length > 0)
+ {
+ for (int i = 0; i < data.length; i++)
+ {
+ String type = data[i][0].toString();
+ setColour(type, data[i][1]); // todo : typesafety - feature color
+ // interface object
+ if (((Boolean) data[i][2]).booleanValue())
+ {
+ av_featuresdisplayed.setVisible(type);
+ }
+
+ renderOrder[data.length - i - 1] = type;
+ }
+ }
+
+ }
+
+ /**
+ * @param listener
+ * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * @param listener
+ * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ public Set getAllFeatureColours()
+ {
+ return featureColours.keySet();
+ }
+
+ public void clearRenderOrder()
+ {
+ renderOrder = null;
+ }
+
+ public boolean hasRenderOrder()
+ {
+ return renderOrder != null;
+ }
+
+ public List<String> getRenderOrder()
+ {
+ if (renderOrder == null)
+ {
+ return Arrays.asList(new String[] {});
+ }
+ return Arrays.asList(renderOrder);
+ }
+
+ public int getFeatureGroupsSize()
+ {
+ return featureGroups != null ? 0 : featureGroups.size();
+ }
+
+ @Override
+ public List<String> getFeatureGroups()
+ {
+ // conflict between applet and desktop - featureGroups returns the map in
+ // the desktop featureRenderer
+ return (featureGroups == null) ? Arrays.asList(new String[0]) : Arrays
+ .asList(featureGroups.keySet().toArray(new String[0]));
+ }
+
+ public boolean checkGroupVisibility(String group, boolean newGroupsVisible)
+ {
+ if (featureGroups == null)
+ {
+ // then an exception happens next..
+ }
+ if (featureGroups.containsKey(group))
+ {
+ return featureGroups.get(group).booleanValue();
+ }
+ if (newGroupsVisible)
+ {
+ featureGroups.put(group, new Boolean(true));
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * get visible or invisible groups
+ *
+ * @param visible
+ * true to return visible groups, false to return hidden ones.
+ * @return list of groups
+ */
+ @Override
+ public List getGroups(boolean visible)
+ {
+ if (featureGroups != null)
+ {
+ ArrayList gp = new ArrayList();
+
+ for (Object grp : featureGroups.keySet())
+ {
+ Boolean state = featureGroups.get(grp);
+ if (state.booleanValue() == visible)
+ {
+ gp.add(grp);
+ }
+ }
+ return gp;
+ }
+ return null;
+ }
+
+ @Override
+ public void setGroupVisibility(String group, boolean visible)
+ {
+ featureGroups.put(group, new Boolean(visible));
+ }
+
+ @Override
+ public void setGroupVisibility(List<String> toset, boolean visible)
+ {
+ if (toset != null && toset.size() > 0 && featureGroups != null)
+ {
+ boolean rdrw = false;
+ for (String gst : toset)
+ {
+ Boolean st = featureGroups.get(gst);
+ featureGroups.put(gst, new Boolean(visible));
+ if (st != null)
+ {
+ rdrw = rdrw || (visible != st.booleanValue());
+ }
+ }
+ if (rdrw)
+ {
+ // set local flag indicating redraw needed ?
+ }
+ }
+ }
+
+ @Override
+ public Hashtable getDisplayedFeatureCols()
+ {
+ Hashtable fcols = new Hashtable();
+ if (getViewport().getFeaturesDisplayed() == null)
+ {
+ return fcols;
+ }
+ Iterator<String> en = getViewport().getFeaturesDisplayed()
+ .getVisibleFeatures();
+ while (en.hasNext())
+ {
+ String col = en.next();
+ fcols.put(col, getColour(col));
+ }
+ return fcols;
+ }
+
+ @Override
+ public FeaturesDisplayedI getFeaturesDisplayed()
+ {
+ return av.getFeaturesDisplayed();
+ }
+
+ @Override
+ public String[] getDisplayedFeatureTypes()
+ {
+ String[] typ = null;
+ typ = getRenderOrder().toArray(new String[0]);
+ FeaturesDisplayedI feature_disp = av.getFeaturesDisplayed();
+ if (feature_disp != null)
+ {
+ synchronized (feature_disp)
+ {
+ for (int i = 0; i < typ.length; i++)
+ {
+ if (!feature_disp.isVisible(typ[i]))
+ {
+ typ[i] = null;
+ }
+ }
+ }
+ }
+ return typ;
+ }
+
+ @Override
+ public String[] getDisplayedFeatureGroups()
+ {
+ String[] gps = null;
+ ArrayList<String> _gps = new ArrayList<String>();
+ Iterator en = getFeatureGroups().iterator();
+ int g = 0;
+ boolean valid = false;
+ while (en.hasNext())
+ {
+ String gp = (String) en.next();
+ if (checkGroupVisibility(gp, false))
+ {
+ valid = true;
+ _gps.add(gp);
+ }
+ if (!valid)
+ {
+ return null;
+ }
+ else
+ {
+ gps = new String[_gps.size()];
+ _gps.toArray(gps);
+ }
+ }
+ return gps;
+ }
+
+}
diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java
new file mode 100644
index 0000000..93884f5
--- /dev/null
+++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java
@@ -0,0 +1,97 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.viewmodel.seqfeatures;
+
+import jalview.schemes.GraduatedColor;
+
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class FeatureRendererSettings implements Cloneable
+{
+ String[] renderOrder;
+
+ Map featureGroups;
+
+ Map featureColours;
+
+ float transparency;
+
+ Map featureOrder;
+
+ public FeatureRendererSettings(String[] renderOrder,
+ Hashtable featureGroups, Hashtable featureColours,
+ float transparency, Hashtable featureOrder)
+ {
+ super();
+ this.renderOrder = Arrays.copyOf(renderOrder, renderOrder.length);
+ this.featureGroups = new ConcurrentHashMap(featureGroups);
+ this.featureColours = new ConcurrentHashMap(featureColours);
+ this.transparency = transparency;
+ this.featureOrder = new ConcurrentHashMap(featureOrder);
+ }
+
+ /**
+ * create an independent instance of the feature renderer settings
+ *
+ * @param fr
+ */
+ public FeatureRendererSettings(
+ jalview.viewmodel.seqfeatures.FeatureRendererModel fr)
+ {
+ renderOrder = null;
+ featureGroups = new ConcurrentHashMap();
+ featureColours = new ConcurrentHashMap();
+ featureOrder = new ConcurrentHashMap();
+ if (fr.renderOrder != null)
+ {
+ this.renderOrder = new String[fr.renderOrder.length];
+ System.arraycopy(fr.renderOrder, 0, renderOrder, 0,
+ fr.renderOrder.length);
+ }
+ if (fr.featureGroups != null)
+ {
+ this.featureGroups = new ConcurrentHashMap(fr.featureGroups);
+ }
+ if (fr.featureColours != null)
+ {
+ this.featureColours = new ConcurrentHashMap(fr.featureColours);
+ }
+ Iterator en = fr.featureColours.keySet().iterator();
+ while (en.hasNext())
+ {
+ Object next = en.next();
+ Object val = featureColours.get(next);
+ if (val instanceof GraduatedColor)
+ {
+ featureColours.put(next, new GraduatedColor((GraduatedColor) val));
+ }
+ }
+ this.transparency = fr.transparency;
+ if (fr.featureOrder != null)
+ {
+ this.featureOrder = new ConcurrentHashMap(fr.featureOrder);
+ }
+ }
+}
diff --git a/src/jalview/viewmodel/seqfeatures/FeatureSettingsModel.java b/src/jalview/viewmodel/seqfeatures/FeatureSettingsModel.java
new file mode 100644
index 0000000..a311bc5
--- /dev/null
+++ b/src/jalview/viewmodel/seqfeatures/FeatureSettingsModel.java
@@ -0,0 +1,28 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.viewmodel.seqfeatures;
+
+import jalview.api.FeatureSettingsModelI;
+
+public abstract class FeatureSettingsModel implements FeatureSettingsModelI
+{
+
+}
diff --git a/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java b/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java
new file mode 100644
index 0000000..81a06a3
--- /dev/null
+++ b/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java
@@ -0,0 +1,114 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.viewmodel.seqfeatures;
+
+import jalview.api.FeaturesDisplayedI;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+public class FeaturesDisplayed implements FeaturesDisplayedI
+{
+ private HashSet<String> featuresDisplayed = new HashSet<String>();
+
+ private HashSet<String> featuresRegistered = new HashSet<String>();
+
+ public FeaturesDisplayed(FeaturesDisplayedI featuresDisplayed2)
+ {
+ Iterator<String> fdisp = featuresDisplayed2.getVisibleFeatures();
+ String ftype;
+ while (fdisp.hasNext())
+ {
+ ftype = fdisp.next();
+ featuresDisplayed.add(ftype);
+ featuresRegistered.add(ftype);
+ }
+ }
+
+ public FeaturesDisplayed()
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public Iterator<String> getVisibleFeatures()
+ {
+ return featuresDisplayed.iterator();
+ }
+
+ @Override
+ public boolean isVisible(String featureType)
+ {
+ return featuresDisplayed.contains(featureType);
+ }
+
+ @Override
+ public boolean areVisible(Collection featureTypes)
+ {
+ return featuresDisplayed.containsAll(featureTypes);
+ }
+
+ @Override
+ public void clear()
+ {
+ featuresDisplayed.clear();
+ featuresRegistered.clear();
+ }
+
+ @Override
+ public void setAllVisible(Collection makeVisible)
+ {
+ featuresDisplayed.addAll(makeVisible);
+ featuresRegistered.addAll(makeVisible);
+ }
+
+ @Override
+ public void setAllRegisteredVisible()
+ {
+ featuresDisplayed.addAll(featuresRegistered);
+ }
+
+ @Override
+ public void setVisible(String featureType)
+ {
+ featuresDisplayed.add(featureType);
+ featuresRegistered.add(featureType);
+ }
+
+ @Override
+ public boolean isRegistered(String type)
+ {
+ return featuresRegistered.contains(type);
+ }
+
+ @Override
+ public int getVisibleFeatureCount()
+ {
+ return featuresDisplayed.size();
+ }
+
+ @Override
+ public int getRegisterdFeaturesCount()
+ {
+ return featuresRegistered.size();
+ }
+}
diff --git a/src/jalview/viewmodel/styles/ViewStyle.java b/src/jalview/viewmodel/styles/ViewStyle.java
new file mode 100644
index 0000000..a0ba633
--- /dev/null
+++ b/src/jalview/viewmodel/styles/ViewStyle.java
@@ -0,0 +1,1097 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.viewmodel.styles;
+
+import jalview.api.ViewStyleI;
+
+import java.awt.Color;
+
+/**
+ * A container for holding alignment view properties. View properties are
+ * data-independent, which means they can be safely copied between views
+ * involving different alignment data without causing exceptions in the
+ * rendering system.
+ *
+ * @author jprocter
+ *
+ */
+public class ViewStyle implements ViewStyleI
+{
+ private boolean abovePIDThreshold = false;
+
+ int charHeight;
+
+ int charWidth;
+
+ int idWidth = -1;
+
+ /**
+ * gui state - changes to colour scheme propagated to all groups
+ */
+ private boolean colourAppliesToAllGroups;
+
+ /**
+ * centre columnar annotation labels in displayed alignment annotation
+ */
+ boolean centreColumnLabels = false;
+
+ private boolean showdbrefs;
+
+ private boolean shownpfeats;
+
+ // --------END Structure Conservation
+
+ /**
+ * colour according to the reference sequence defined on the alignment
+ */
+ private boolean colourByReferenceSeq = false;
+
+ boolean conservationColourSelected = false;
+
+ /**
+ * show the reference sequence in the alignment view
+ */
+ private boolean displayReferenceSeq = false;
+
+ private int increment;
+
+ /**
+ * display gap characters
+ */
+ boolean renderGaps = true;
+
+ private boolean rightAlignIds = false;
+
+ boolean scaleAboveWrapped = false;
+
+ boolean scaleLeftWrapped = true;
+
+ boolean scaleRightWrapped = true;
+
+ boolean seqNameItalics;
+
+ /**
+ * show annotation tracks on the alignment
+ */
+ private boolean showAnnotation = true;
+
+ /**
+ * render each residue in a coloured box
+ */
+ boolean showBoxes = true;
+
+ /**
+ * Colour sequence text
+ */
+ boolean showColourText = false;
+
+ /**
+ * show blue triangles
+ */
+ boolean showHiddenMarkers = true;
+
+ /**
+ * show /start-end in ID panel
+ */
+ boolean showJVSuffix = true;
+
+ /**
+ * scale features height according to score
+ */
+ boolean showSeqFeaturesHeight;
+
+ /**
+ * display setting for showing/hiding sequence features on alignment view
+ */
+ boolean showSequenceFeatures = false;
+
+ /**
+ * display sequence symbols
+ */
+ boolean showText = true;
+
+ /**
+ * show non-conserved residues only
+ */
+ protected boolean showUnconserved = false;
+
+ Color textColour = Color.black;
+
+ Color textColour2 = Color.white;
+
+ /**
+ * PID or consensus threshold
+ */
+ int threshold;
+
+ /**
+ * threshold for switching between textColour & textColour2
+ */
+ int thresholdTextColour = 0;
+
+ /**
+ * upper case characters in sequence are shown in bold
+ */
+ boolean upperCasebold = false;
+
+ /**
+ * name of base font for view
+ */
+ private String fontName;
+
+ /**
+ * size for base font
+ */
+ private int fontSize;
+
+ /*
+ * If true, scale protein residues to 3 times width of cDNA bases (in
+ * SplitFrame views only)
+ */
+ private boolean scaleProteinAsCdna = true;
+
+ /**
+ * Copy constructor
+ *
+ * @param vs
+ */
+ public ViewStyle(ViewStyleI vs)
+ {
+ setAbovePIDThreshold(vs.getAbovePIDThreshold());
+ setCentreColumnLabels(vs.isCentreColumnLabels());
+ setCharHeight(vs.getCharHeight());
+ setCharWidth(vs.getCharWidth());
+ setColourAppliesToAllGroups(vs.getColourAppliesToAllGroups());
+ setColourByReferenceSeq(vs.isColourByReferenceSeq());
+ setColourText(vs.getColourText());
+ setConservationColourSelected(vs.isConservationColourSelected());
+ setConservationSelected(vs.getConservationSelected());
+ setDisplayReferenceSeq(vs.isDisplayReferenceSeq());
+ setFontName(vs.getFontName());
+ setFontSize(vs.getFontSize());
+ setFontStyle(vs.getFontStyle());
+ setIdWidth(vs.getIdWidth());
+ setIncrement(vs.getIncrement());
+ setRenderGaps(vs.isRenderGaps());
+ setRightAlignIds(vs.isRightAlignIds());
+ setScaleAboveWrapped(vs.getScaleAboveWrapped());
+ setScaleLeftWrapped(vs.getScaleLeftWrapped());
+ setScaleProteinAsCdna(vs.isScaleProteinAsCdna());
+ setScaleRightWrapped(vs.getScaleRightWrapped());
+ setSeqNameItalics(vs.isSeqNameItalics());
+ setShowAnnotation(vs.isShowAnnotation());
+ setShowBoxes(vs.getShowBoxes());
+ setShowColourText(vs.isShowColourText());
+ setShowDBRefs(vs.isShowDBRefs());
+ setShowHiddenMarkers(vs.getShowHiddenMarkers());
+ setShowJVSuffix(vs.getShowJVSuffix());
+ setShowNPFeats(vs.isShowNPFeats());
+ setShowSequenceFeaturesHeight(vs.isShowSequenceFeaturesHeight());
+ setShowSequenceFeatures(vs.isShowSequenceFeatures());
+ setShowText(vs.getShowText());
+ setShowUnconserved(vs.getShowUnconserved());
+ setTextColour(vs.getTextColour());
+ setTextColour2(vs.getTextColour2());
+ setThreshold(vs.getThreshold());
+ setThresholdTextColour(vs.getThresholdTextColour());
+ setUpperCasebold(vs.isUpperCasebold());
+ setWrapAlignment(vs.getWrapAlignment());
+ setWrappedWidth(vs.getWrappedWidth());
+ // ViewStyle.configureFrom(this, viewStyle);
+ }
+
+ public ViewStyle()
+ {
+ }
+
+ /**
+ * Returns true if all attributes of the ViewStyles have the same value
+ */
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other == null || !(other instanceof ViewStyle))
+ {
+ return false;
+ }
+ ViewStyle vs = (ViewStyle) other;
+
+ boolean match = (getAbovePIDThreshold() == vs.getAbovePIDThreshold()
+ && isCentreColumnLabels() == vs.isCentreColumnLabels()
+ && getCharHeight() == vs.getCharHeight()
+ && getCharWidth() == vs.getCharWidth()
+ && getColourAppliesToAllGroups() == vs
+ .getColourAppliesToAllGroups()
+ && isColourByReferenceSeq() == vs.isColourByReferenceSeq()
+ && getColourText() == vs.getColourText()
+ && isConservationColourSelected() == vs
+ .isConservationColourSelected()
+ && getConservationSelected() == vs.getConservationSelected()
+ && isDisplayReferenceSeq() == vs.isDisplayReferenceSeq()
+ && getFontSize() == vs.getFontSize()
+ && getFontStyle() == vs.getFontStyle()
+ && getIdWidth() == vs.getIdWidth()
+ && getIncrement() == vs.getIncrement()
+ && isRenderGaps() == vs.isRenderGaps()
+ && isRightAlignIds() == vs.isRightAlignIds()
+ && getScaleAboveWrapped() == vs.getScaleAboveWrapped()
+ && getScaleLeftWrapped() == vs.getScaleLeftWrapped()
+ && isScaleProteinAsCdna() == vs.isScaleProteinAsCdna()
+ && getScaleRightWrapped() == vs.getScaleRightWrapped()
+ && isSeqNameItalics() == vs.isSeqNameItalics()
+ && isShowAnnotation() == vs.isShowAnnotation()
+ && getShowBoxes() == vs.getShowBoxes()
+ && isShowColourText() == vs.isShowColourText()
+ && isShowDBRefs() == vs.isShowDBRefs()
+ && getShowHiddenMarkers() == vs.getShowHiddenMarkers()
+ && getShowJVSuffix() == vs.getShowJVSuffix()
+ && isShowNPFeats() == vs.isShowNPFeats()
+ && isShowSequenceFeaturesHeight() == vs
+ .isShowSequenceFeaturesHeight()
+ && isShowSequenceFeatures() == vs.isShowSequenceFeatures()
+ && getShowText() == vs.getShowText()
+ && getShowUnconserved() == vs.getShowUnconserved()
+ && getThreshold() == vs.getThreshold()
+ && getThresholdTextColour() == vs.getThresholdTextColour()
+ && isUpperCasebold() == vs.isUpperCasebold()
+ && getWrapAlignment() == vs.getWrapAlignment() && getWrappedWidth() == vs
+ .getWrappedWidth());
+ /*
+ * and compare non-primitive types; syntax below will match null with null
+ * values
+ */
+ match = match
+ && String.valueOf(getFontName()).equals(
+ String.valueOf(vs.getFontName()));
+ match = match
+ && String.valueOf(getTextColour()).equals(
+ String.valueOf(vs.getTextColour()));
+ match = match
+ && String.valueOf(getTextColour2()).equals(
+ String.valueOf(vs.getTextColour2()));
+ return match;
+ // return equivalent(this, (ViewStyle) other);
+ }
+
+ /**
+ * Overridden to ensure that whenever vs1.equals(vs2) then vs1.hashCode() ==
+ * vs2.hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ /*
+ * No need to include all properties, just a selection...
+ */
+ int hash = 0;
+ int m = 1;
+ // Boolean.hashCode returns 1231 or 1237
+ hash += m++ * Boolean.valueOf(this.abovePIDThreshold).hashCode();
+ hash += m++ * Boolean.valueOf(this.centreColumnLabels).hashCode();
+ hash += m++ * Boolean.valueOf(this.colourAppliesToAllGroups).hashCode();
+ hash += m++ * Boolean.valueOf(this.displayReferenceSeq).hashCode();
+ hash += m++ * Boolean.valueOf(this.renderGaps).hashCode();
+ hash += m++ * Boolean.valueOf(this.rightAlignIds).hashCode();
+ hash += m++ * Boolean.valueOf(this.scaleProteinAsCdna).hashCode();
+ hash += m++ * Boolean.valueOf(this.scaleRightWrapped).hashCode();
+ hash += m++ * Boolean.valueOf(this.seqNameItalics).hashCode();
+ hash += m++ * Boolean.valueOf(this.showAnnotation).hashCode();
+ hash += m++ * Boolean.valueOf(this.showBoxes).hashCode();
+ hash += m++ * Boolean.valueOf(this.showdbrefs).hashCode();
+ hash += m++ * Boolean.valueOf(this.showJVSuffix).hashCode();
+ hash += m++ * Boolean.valueOf(this.showSequenceFeatures).hashCode();
+ hash += m++ * Boolean.valueOf(this.showUnconserved).hashCode();
+ hash += m++ * Boolean.valueOf(this.wrapAlignment).hashCode();
+ hash += m++ * this.charHeight;
+ hash += m++ * this.charWidth;
+ hash += m++ * fontSize;
+ hash += m++ * fontStyle;
+ hash += m++ * idWidth;
+ hash += String.valueOf(this.fontName).hashCode();
+ return hash;
+ }
+
+ /**
+ * @return the upperCasebold
+ */
+ @Override
+ public boolean isUpperCasebold()
+ {
+ return upperCasebold;
+ }
+
+ /**
+ * @param upperCasebold
+ * the upperCasebold to set
+ */
+ @Override
+ public void setUpperCasebold(boolean upperCasebold)
+ {
+ this.upperCasebold = upperCasebold;
+ }
+
+ /**
+ * flag for wrapping
+ */
+ boolean wrapAlignment = false;
+
+ /**
+ * number columns in wrapped alignment
+ */
+ int wrappedWidth;
+
+ private int fontStyle;
+
+ /**
+ * GUI state
+ *
+ * @return true if percent identity threshold is applied to shading
+ */
+ @Override
+ public boolean getAbovePIDThreshold()
+ {
+ return abovePIDThreshold;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public int getCharHeight()
+ {
+ return charHeight;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public int getCharWidth()
+ {
+ return charWidth;
+ }
+
+ /**
+ *
+ *
+ * @return flag indicating if colourchanges propagated to all groups
+ */
+ @Override
+ public boolean getColourAppliesToAllGroups()
+ {
+ return colourAppliesToAllGroups;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public boolean getColourText()
+ {
+ return showColourText;
+ }
+
+ /**
+ * GUI state
+ *
+ * @return true if conservation based shading is enabled
+ */
+ @Override
+ public boolean getConservationSelected()
+ {
+ return conservationColourSelected;
+ }
+
+ /**
+ * GUI State
+ *
+ * @return get scalar for bleaching colourschemes by conservation
+ */
+ @Override
+ public int getIncrement()
+ {
+ return increment;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public boolean getScaleAboveWrapped()
+ {
+ return scaleAboveWrapped;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public boolean getScaleLeftWrapped()
+ {
+ return scaleLeftWrapped;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public boolean getScaleRightWrapped()
+ {
+ return scaleRightWrapped;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public boolean getShowBoxes()
+ {
+ return showBoxes;
+ }
+
+ @Override
+ public boolean getShowHiddenMarkers()
+ {
+ return showHiddenMarkers;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public boolean getShowJVSuffix()
+ {
+ return showJVSuffix;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public boolean getShowText()
+ {
+ return showText;
+ }
+
+ @Override
+ public boolean getShowUnconserved()
+ {
+ return showUnconserved;
+ }
+
+ /**
+ * @return the textColour
+ */
+ @Override
+ public Color getTextColour()
+ {
+ return textColour;
+ }
+
+ /**
+ * @return the textColour2
+ */
+ @Override
+ public Color getTextColour2()
+ {
+ return textColour2;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public int getThreshold()
+ {
+ return threshold;
+ }
+
+ /**
+ * @return the thresholdTextColour
+ */
+ @Override
+ public int getThresholdTextColour()
+ {
+ return thresholdTextColour;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public boolean getWrapAlignment()
+ {
+ return wrapAlignment;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ @Override
+ public int getWrappedWidth()
+ {
+ return wrappedWidth;
+ }
+
+ @Override
+ public boolean isColourByReferenceSeq()
+ {
+ return colourByReferenceSeq;
+ }
+
+ /**
+ * @return the conservationColourSelected
+ */
+ @Override
+ public boolean isConservationColourSelected()
+ {
+ return conservationColourSelected;
+ }
+
+ @Override
+ public boolean isDisplayReferenceSeq()
+ {
+ return displayReferenceSeq;
+ }
+
+ /**
+ * @return the renderGaps
+ */
+ @Override
+ public boolean isRenderGaps()
+ {
+ return renderGaps;
+ }
+
+ @Override
+ public boolean isRightAlignIds()
+ {
+ return rightAlignIds;
+ }
+
+ /**
+ * @return the seqNameItalics
+ */
+ @Override
+ public boolean isSeqNameItalics()
+ {
+ return seqNameItalics;
+ }
+
+ @Override
+ public boolean isShowAnnotation()
+ {
+ return showAnnotation;
+ }
+
+ /**
+ * @return the showColourText
+ */
+ @Override
+ public boolean isShowColourText()
+ {
+ return showColourText;
+ }
+
+ /**
+ * @return the showSeqFeaturesHeight
+ */
+ @Override
+ public boolean isShowSequenceFeaturesHeight()
+ {
+ return showSeqFeaturesHeight;
+ }
+
+ @Override
+ public boolean isShowSequenceFeatures()
+ {
+ return showSequenceFeatures;
+ }
+
+ /**
+ * GUI state
+ *
+ *
+ * @param b
+ * indicate if percent identity threshold is applied to shading
+ */
+ @Override
+ public void setAbovePIDThreshold(boolean b)
+ {
+ abovePIDThreshold = b;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param h
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setCharHeight(int h)
+ {
+ this.charHeight = h;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param w
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setCharWidth(int w)
+ {
+ this.charWidth = w;
+ }
+
+ /**
+ * @param value
+ * indicating if subsequent colourscheme changes will be propagated
+ * to all groups
+ */
+ @Override
+ public void setColourAppliesToAllGroups(boolean b)
+ {
+ colourAppliesToAllGroups = b;
+ }
+
+ @Override
+ public void setColourByReferenceSeq(boolean colourByReferenceSeq)
+ {
+ this.colourByReferenceSeq = colourByReferenceSeq;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param state
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setColourText(boolean state)
+ {
+ showColourText = state;
+ }
+
+ /**
+ * @param conservationColourSelected
+ * the conservationColourSelected to set
+ */
+ @Override
+ public void setConservationColourSelected(
+ boolean conservationColourSelected)
+ {
+ this.conservationColourSelected = conservationColourSelected;
+ }
+
+ /**
+ * GUI state
+ *
+ * @param b
+ * enable conservation based shading
+ */
+ @Override
+ public void setConservationSelected(boolean b)
+ {
+ conservationColourSelected = b;
+ }
+
+ @Override
+ public void setDisplayReferenceSeq(boolean displayReferenceSeq)
+ {
+ this.displayReferenceSeq = displayReferenceSeq;
+ }
+
+ /**
+ *
+ * @param inc
+ * set the scalar for bleaching colourschemes according to degree of
+ * conservation
+ */
+ @Override
+ public void setIncrement(int inc)
+ {
+ increment = inc;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param state
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setRenderGaps(boolean state)
+ {
+ renderGaps = state;
+ }
+
+ @Override
+ public void setRightAlignIds(boolean rightAlignIds)
+ {
+ this.rightAlignIds = rightAlignIds;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param b
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setScaleAboveWrapped(boolean b)
+ {
+ scaleAboveWrapped = b;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param b
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setScaleLeftWrapped(boolean b)
+ {
+ scaleLeftWrapped = b;
+ }
+
+ /**
+ *
+ *
+ * @param scaleRightWrapped
+ * - true or false
+ */
+
+ @Override
+ public void setScaleRightWrapped(boolean b)
+ {
+ scaleRightWrapped = b;
+ }
+
+ @Override
+ public void setSeqNameItalics(boolean italics)
+ {
+ seqNameItalics = italics;
+ }
+
+ @Override
+ public void setShowAnnotation(boolean b)
+ {
+ showAnnotation = b;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param state
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setShowBoxes(boolean state)
+ {
+ showBoxes = state;
+ }
+
+ /**
+ * @param showColourText
+ * the showColourText to set
+ */
+ @Override
+ public void setShowColourText(boolean showColourText)
+ {
+ this.showColourText = showColourText;
+ }
+
+ @Override
+ public void setShowHiddenMarkers(boolean show)
+ {
+ showHiddenMarkers = show;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param b
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setShowJVSuffix(boolean b)
+ {
+ showJVSuffix = b;
+ }
+
+ @Override
+ public void setShowSequenceFeaturesHeight(boolean selected)
+ {
+ showSeqFeaturesHeight = selected;
+
+ }
+
+ /**
+ * set the flag
+ *
+ * @param b
+ * features are displayed if true
+ */
+ @Override
+ public void setShowSequenceFeatures(boolean b)
+ {
+ showSequenceFeatures = b;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param state
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setShowText(boolean state)
+ {
+ showText = state;
+ }
+
+ @Override
+ public void setShowUnconserved(boolean showunconserved)
+ {
+ showUnconserved = showunconserved;
+ }
+
+ /**
+ * @param textColour
+ * the textColour to set
+ */
+ @Override
+ public void setTextColour(Color textColour)
+ {
+ this.textColour = textColour;
+ }
+
+ /**
+ * @param textColour2
+ * the textColour2 to set
+ */
+ @Override
+ public void setTextColour2(Color textColour2)
+ {
+ this.textColour2 = textColour2;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param thresh
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setThreshold(int thresh)
+ {
+ threshold = thresh;
+ }
+
+ /**
+ * @param thresholdTextColour
+ * the thresholdTextColour to set
+ */
+ @Override
+ public void setThresholdTextColour(int thresholdTextColour)
+ {
+ this.thresholdTextColour = thresholdTextColour;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param state
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setWrapAlignment(boolean state)
+ {
+ wrapAlignment = state;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param w
+ * DOCUMENT ME!
+ */
+ @Override
+ public void setWrappedWidth(int w)
+ {
+ this.wrappedWidth = w;
+ }
+
+ @Override
+ public boolean sameStyle(ViewStyleI that)
+ {
+ return this.equals(that);
+ }
+
+ @Override
+ public String getFontName()
+ {
+ return fontName;
+ }
+
+ @Override
+ public int getFontSize()
+ {
+ return fontSize;
+ }
+
+ @Override
+ public int getFontStyle()
+ {
+ return fontStyle;
+ }
+
+ @Override
+ public void setFontName(String name)
+ {
+ fontName = name;
+ }
+
+ @Override
+ public void setFontSize(int size)
+ {
+ fontSize = size;
+
+ }
+
+ @Override
+ public void setFontStyle(int style)
+ {
+ fontStyle = style;
+ }
+
+ @Override
+ public int getIdWidth()
+ {
+ return idWidth;
+ }
+
+ /**
+ * @param idWidth
+ * the idWidth to set
+ */
+ @Override
+ public void setIdWidth(int idWidth)
+ {
+ this.idWidth = idWidth;
+ }
+
+ /**
+ * @return the centreColumnLabels
+ */
+ @Override
+ public boolean isCentreColumnLabels()
+ {
+ return centreColumnLabels;
+ }
+
+ /**
+ * @param centreColumnLabels
+ * the centreColumnLabels to set
+ */
+ @Override
+ public void setCentreColumnLabels(boolean centreColumnLabels)
+ {
+ this.centreColumnLabels = centreColumnLabels;
+ }
+
+ /**
+ * @return the showdbrefs
+ */
+ @Override
+ public boolean isShowDBRefs()
+ {
+ return showdbrefs;
+ }
+
+ /**
+ * @param showdbrefs
+ * the showdbrefs to set
+ */
+ @Override
+ public void setShowDBRefs(boolean showdbrefs)
+ {
+ this.showdbrefs = showdbrefs;
+ }
+
+ /**
+ * @return the shownpfeats
+ */
+ @Override
+ public boolean isShowNPFeats()
+ {
+ return shownpfeats;
+ }
+
+ /**
+ * @param shownpfeats
+ * the shownpfeats to set
+ */
+ @Override
+ public void setShowNPFeats(boolean shownpfeats)
+ {
+ this.shownpfeats = shownpfeats;
+ }
+
+ @Override
+ public boolean isScaleProteinAsCdna()
+ {
+ return this.scaleProteinAsCdna;
+ }
+
+ @Override
+ public void setScaleProteinAsCdna(boolean b)
+ {
+ this.scaleProteinAsCdna = b;
+ }
+}
diff --git a/src/jalview/workers/AlignCalcManager.java b/src/jalview/workers/AlignCalcManager.java
new file mode 100644
index 0000000..2fa0553
--- /dev/null
+++ b/src/jalview/workers/AlignCalcManager.java
@@ -0,0 +1,385 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.workers;
+
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignCalcWorkerI;
+import jalview.datamodel.AlignmentAnnotation;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class AlignCalcManager implements AlignCalcManagerI
+{
+ private volatile List<AlignCalcWorkerI> restartable = Collections
+ .synchronizedList(new ArrayList<AlignCalcWorkerI>());
+
+ private volatile List<Class> blackList = Collections
+ .synchronizedList(new ArrayList<Class>());
+
+ /**
+ * global record of calculations in progress
+ */
+ private volatile Map<Class, AlignCalcWorkerI> inProgress = Collections
+ .synchronizedMap(new Hashtable<Class, AlignCalcWorkerI>());
+
+ /**
+ * record of calculations pending or in progress in the current context
+ */
+ private volatile Map<Class, List<AlignCalcWorkerI>> updating = Collections
+ .synchronizedMap(new Hashtable<Class, List<AlignCalcWorkerI>>());
+
+ @Override
+ public void notifyStart(AlignCalcWorkerI worker)
+ {
+ synchronized (updating)
+ {
+ List<AlignCalcWorkerI> upd = updating.get(worker.getClass());
+ if (upd == null)
+ {
+ updating.put(
+ worker.getClass(),
+ upd = Collections
+ .synchronizedList(new ArrayList<AlignCalcWorkerI>()));
+ }
+ synchronized (upd)
+ {
+ upd.add(worker);
+ }
+ }
+ }
+
+ @Override
+ public boolean alreadyDoing(AlignCalcWorkerI worker)
+ {
+ synchronized (inProgress)
+ {
+ return inProgress.containsKey(worker.getClass());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.api.AlignCalcManagerI#isPending(jalview.api.AlignCalcWorkerI)
+ */
+ @Override
+ public boolean isPending(AlignCalcWorkerI workingClass)
+ {
+ List<AlignCalcWorkerI> upd;
+ synchronized (updating)
+ {
+ upd = updating.get(workingClass.getClass());
+ if (upd == null)
+ {
+ return false;
+ }
+ synchronized (upd)
+ {
+ if (upd.size() > 1)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ // TODO make into api method if needed ?
+ public int numberLive(AlignCalcWorkerI worker)
+ {
+ synchronized (updating)
+ {
+ List<AlignCalcWorkerI> upd = updating.get(worker.getClass());
+ if (upd == null)
+ {
+ return 0;
+ }
+ ;
+ return upd.size();
+ }
+ }
+
+ @Override
+ public boolean notifyWorking(AlignCalcWorkerI worker)
+ {
+ synchronized (inProgress)
+ {
+ // TODO: decide if we should throw exceptions here if multiple workers
+ // start to work
+ if (inProgress.get(worker.getClass()) != null)
+ {
+ if (false)
+ {
+ System.err
+ .println("Warning: Multiple workers are running of type "
+ + worker.getClass());
+ }
+ return false;
+ }
+ inProgress.put(worker.getClass(), worker);
+ }
+ return true;
+ }
+
+ private final HashSet<AlignCalcWorkerI> canUpdate = new HashSet<AlignCalcWorkerI>();
+
+ @Override
+ public void workerComplete(AlignCalcWorkerI worker)
+ {
+ synchronized (inProgress)
+ {
+ // System.err.println("Worker "+worker.getClass()+" marked as complete.");
+ inProgress.remove(worker.getClass());
+ List<AlignCalcWorkerI> upd = updating.get(worker.getClass());
+ if (upd != null)
+ {
+ synchronized (upd)
+ {
+ upd.remove(worker);
+ }
+ canUpdate.add(worker);
+ }
+ }
+ }
+
+ @Override
+ public void workerCannotRun(AlignCalcWorkerI worker)
+ {
+ synchronized (blackList)
+ {
+ blackList.add(worker.getClass());
+ }
+ }
+
+ public boolean isBlackListed(Class workerType)
+ {
+ synchronized (blackList)
+ {
+ return blackList.contains(workerType);
+ }
+ }
+
+ @Override
+ public void startWorker(AlignCalcWorkerI worker)
+ {
+ // System.err.println("Starting "+worker.getClass());
+ // new Exception("").printStackTrace();
+ Thread tw = new Thread(worker);
+ tw.setName(worker.getClass().toString());
+ tw.start();
+ }
+
+ @Override
+ public boolean isWorking(AlignCalcWorkerI worker)
+ {
+ synchronized (inProgress)
+ {// System.err.println("isWorking : worker "+(worker!=null ?
+ // worker.getClass():"null")+ " "+hashCode());
+ return worker != null && inProgress.get(worker.getClass()) == worker;
+ }
+ }
+
+ @Override
+ public boolean isWorking()
+ {
+ synchronized (inProgress)
+ {
+ // System.err.println("isWorking "+hashCode());
+ return inProgress.size() > 0;
+ }
+ }
+
+ @Override
+ public void registerWorker(AlignCalcWorkerI worker)
+ {
+ synchronized (restartable)
+ {
+ if (!restartable.contains(worker))
+ {
+ restartable.add(worker);
+ }
+ startWorker(worker);
+ }
+ }
+
+ @Override
+ public void restartWorkers()
+ {
+ synchronized (restartable)
+ {
+ for (AlignCalcWorkerI worker : restartable)
+ {
+ startWorker(worker);
+ }
+ }
+ }
+
+ @Override
+ public boolean workingInvolvedWith(AlignmentAnnotation alignmentAnnotation)
+ {
+ synchronized (inProgress)
+ {
+ for (AlignCalcWorkerI worker : inProgress.values())
+ {
+ if (worker.involves(alignmentAnnotation))
+ {
+ return true;
+ }
+ }
+ }
+ synchronized (updating)
+ {
+ for (List<AlignCalcWorkerI> workers : updating.values())
+ {
+ for (AlignCalcWorkerI worker : workers)
+ {
+ if (worker.involves(alignmentAnnotation))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void updateAnnotationFor(Class workerClass)
+ {
+
+ AlignCalcWorkerI[] workers;
+ synchronized (canUpdate)
+ {
+ workers = canUpdate.toArray(new AlignCalcWorkerI[0]);
+ }
+ for (AlignCalcWorkerI worker : workers)
+ {
+ if (workerClass.equals(worker.getClass()))
+ {
+ worker.updateAnnotation();
+ }
+ }
+ }
+
+ @Override
+ public List<AlignCalcWorkerI> getRegisteredWorkersOfClass(
+ Class workerClass)
+ {
+ List<AlignCalcWorkerI> workingClass = new ArrayList<AlignCalcWorkerI>();
+ AlignCalcWorkerI[] workers;
+ synchronized (canUpdate)
+ {
+ workers = canUpdate.toArray(new AlignCalcWorkerI[canUpdate.size()]);
+ }
+ for (AlignCalcWorkerI worker : workers)
+ {
+ if (workerClass.equals(worker.getClass()))
+ {
+ workingClass.add(worker);
+ }
+ }
+ return (workingClass.size() == 0) ? null : workingClass;
+ }
+
+ @Override
+ public boolean startRegisteredWorkersOfClass(Class workerClass)
+ {
+ List<AlignCalcWorkerI> workers = getRegisteredWorkersOfClass(workerClass);
+ if (workers == null)
+ {
+ return false;
+ }
+ for (AlignCalcWorkerI worker : workers)
+ {
+ if (!isPending(worker))
+ {
+ startWorker(worker);
+ }
+ else
+ {
+ System.err.println("Pending exists for " + workerClass);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void workerMayRun(AlignCalcWorkerI worker)
+ {
+ synchronized (blackList)
+ {
+ if (blackList.contains(worker.getClass()))
+ {
+ blackList.remove(worker.getClass());
+ }
+ }
+ }
+
+ @Override
+ public void removeRegisteredWorkersOfClass(Class typeToRemove)
+ {
+ List<AlignCalcWorkerI> workers = getRegisteredWorkersOfClass(typeToRemove);
+ List<AlignCalcWorkerI> removable = new ArrayList<AlignCalcWorkerI>();
+ Set<AlignCalcWorkerI> toremovannot = new HashSet<AlignCalcWorkerI>();
+ synchronized (restartable)
+ {
+ for (AlignCalcWorkerI worker : restartable)
+ {
+ if (typeToRemove.equals(worker.getClass()))
+ {
+ removable.add(worker);
+ toremovannot.add(worker);
+ }
+ }
+ restartable.removeAll(removable);
+ }
+ synchronized (canUpdate)
+ {
+ for (AlignCalcWorkerI worker : canUpdate)
+ {
+ if (typeToRemove.equals(worker.getClass()))
+ {
+ removable.add(worker);
+ toremovannot.add(worker);
+ }
+ }
+ canUpdate.removeAll(removable);
+ }
+ // TODO: finish testing this extension
+
+ /*
+ * synchronized (inProgress) { // need to kill or mark as dead any running
+ * threads... (inProgress.get(typeToRemove)); }
+ *
+ * if (workers == null) { return; } for (AlignCalcWorkerI worker : workers)
+ * {
+ *
+ * if (isPending(worker)) { worker.abortAndDestroy(); startWorker(worker); }
+ * else { System.err.println("Pending exists for " + workerClass); } }
+ */
+ }
+}
diff --git a/src/jalview/workers/AlignCalcWorker.java b/src/jalview/workers/AlignCalcWorker.java
new file mode 100644
index 0000000..6bdf1c2
--- /dev/null
+++ b/src/jalview/workers/AlignCalcWorker.java
@@ -0,0 +1,98 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.workers;
+
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+
+import java.util.List;
+
+/**
+ * Base class for alignment calculation workers
+ *
+ * @author jimp
+ *
+ */
+public abstract class AlignCalcWorker implements AlignCalcWorkerI
+{
+ /**
+ * manager and data source for calculations
+ */
+ protected AlignViewportI alignViewport;
+
+ protected AlignCalcManagerI calcMan;
+
+ protected AlignmentViewPanel ap;
+
+ protected List<AlignmentAnnotation> ourAnnots = null;
+
+ public AlignCalcWorker(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ this.alignViewport = alignViewport;
+ calcMan = alignViewport.getCalcManager();
+ ap = alignPanel;
+ }
+
+ protected void abortAndDestroy()
+ {
+ if (calcMan != null)
+ {
+ calcMan.workerComplete(this);
+ }
+ alignViewport = null;
+ calcMan = null;
+ ap = null;
+
+ }
+
+ public boolean involves(AlignmentAnnotation i)
+ {
+ return ourAnnots != null && ourAnnots.contains(i);
+ }
+
+ /**
+ * permanently remove from the alignment all annotation rows managed by this
+ * worker
+ */
+ @Override
+ public void removeOurAnnotation()
+ {
+ if (ourAnnots != null && alignViewport != null)
+ {
+ AlignmentI alignment = alignViewport.getAlignment();
+ synchronized (ourAnnots)
+ {
+ for (AlignmentAnnotation aa : ourAnnots)
+ {
+ alignment.deleteAnnotation(aa, true);
+ }
+ }
+ }
+ }
+ // TODO: allow GUI to query workers associated with annotation to add items to
+ // annotation label panel popup menu
+
+}
diff --git a/src/jalview/workers/ComplementConsensusThread.java b/src/jalview/workers/ComplementConsensusThread.java
new file mode 100644
index 0000000..13e9790
--- /dev/null
+++ b/src/jalview/workers/ComplementConsensusThread.java
@@ -0,0 +1,107 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.workers;
+
+import jalview.analysis.AAFrequency;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+
+import java.util.ConcurrentModificationException;
+import java.util.Hashtable;
+
+/**
+ * A thread to recompute the consensus of the cDNA complement for a linked
+ * protein alignment.
+ *
+ * @author gmcarstairs
+ *
+ */
+public class ComplementConsensusThread extends ConsensusThread
+{
+
+ public ComplementConsensusThread(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ }
+
+ @Override
+ protected AlignmentAnnotation getConsensusAnnotation()
+ {
+ return alignViewport.getComplementConsensusAnnotation();
+ }
+
+ @Override
+ protected Hashtable[] getViewportConsensus()
+ {
+ return alignViewport.getComplementConsensusHash();
+ }
+
+ /**
+ * Calculate the cDNA consensus and store it on the Viewport
+ */
+ @Override
+ protected void computeConsensus(AlignmentI alignment)
+ {
+ Hashtable[] hconsensus = new Hashtable[alignment.getWidth()];
+
+ SequenceI[] aseqs = getSequences();
+
+ /*
+ * Allow 3 tries at this, since this thread can start up while we are still
+ * modifying protein-codon mappings on the alignment
+ */
+ for (int i = 0; i < 3; i++)
+ {
+ try
+ {
+ AAFrequency.calculateCdna(alignment, hconsensus);
+ break;
+ } catch (ConcurrentModificationException e)
+ {
+ // try again
+ }
+ }
+
+ alignViewport.setComplementConsensusHash(hconsensus);
+ }
+
+ /**
+ * Convert the computed consensus data into the desired annotation for
+ * display.
+ *
+ * @param consensusAnnotation
+ * the annotation to be populated
+ * @param consensusData
+ * the computed consensus data
+ */
+ @Override
+ protected void deriveConsensus(AlignmentAnnotation consensusAnnotation,
+ Hashtable[] consensusData)
+ {
+ AAFrequency.completeCdnaConsensus(consensusAnnotation, consensusData,
+ alignViewport.isShowSequenceLogo(), getSequences().length);
+ }
+
+}
diff --git a/src/jalview/workers/ConsensusThread.java b/src/jalview/workers/ConsensusThread.java
new file mode 100644
index 0000000..ff7e7ce
--- /dev/null
+++ b/src/jalview/workers/ConsensusThread.java
@@ -0,0 +1,218 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.workers;
+
+import jalview.analysis.AAFrequency;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
+
+import java.util.Hashtable;
+
+public class ConsensusThread extends AlignCalcWorker implements
+ AlignCalcWorkerI
+{
+ public ConsensusThread(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ }
+
+ @Override
+ public void run()
+ {
+ if (calcMan.isPending(this))
+ {
+ return;
+ }
+ calcMan.notifyStart(this);
+ long started = System.currentTimeMillis();
+ try
+ {
+ AlignmentAnnotation consensus = getConsensusAnnotation();
+ if (consensus == null || calcMan.isPending(this))
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+ while (!calcMan.notifyWorking(this))
+ {
+ // System.err.println("Thread (Consensus"+Thread.currentThread().getName()+") Waiting around.");
+ try
+ {
+ if (ap != null)
+ {
+ ap.paintAlignment(false);
+ }
+ Thread.sleep(200);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ if (alignViewport.isClosed())
+ {
+ abortAndDestroy();
+ return;
+ }
+ AlignmentI alignment = alignViewport.getAlignment();
+
+ int aWidth = -1;
+
+ if (alignment == null || (aWidth = alignment.getWidth()) < 0)
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+
+ eraseConsensus(aWidth);
+ computeConsensus(alignment);
+ updateResultAnnotation(true);
+
+ if (ap != null)
+ {
+ ap.paintAlignment(true);
+ }
+ } catch (OutOfMemoryError error)
+ {
+ calcMan.workerCannotRun(this);
+ ap.raiseOOMWarning("calculating consensus", error);
+ } finally
+ {
+ /*
+ * e.g. ArrayIndexOutOfBoundsException can happen due to a race condition
+ * - alignment was edited at same time as calculation was running
+ */
+ calcMan.workerComplete(this);
+ }
+ }
+
+ /**
+ * Clear out any existing consensus annotations
+ *
+ * @param aWidth
+ * the width (number of columns) of the annotated alignment
+ */
+ protected void eraseConsensus(int aWidth)
+ {
+ AlignmentAnnotation consensus = getConsensusAnnotation();
+ consensus.annotations = new Annotation[aWidth];
+ }
+
+ /**
+ * @param alignment
+ */
+ protected void computeConsensus(AlignmentI alignment)
+ {
+ Hashtable[] hconsensus = new Hashtable[alignment.getWidth()];
+
+ SequenceI[] aseqs = getSequences();
+ AAFrequency.calculate(aseqs, 0, alignment.getWidth(), hconsensus, true);
+
+ alignViewport.setSequenceConsensusHash(hconsensus);
+ setColourSchemeConsensus(hconsensus);
+ }
+
+ /**
+ * @return
+ */
+ protected SequenceI[] getSequences()
+ {
+ return alignViewport.getAlignment().getSequencesArray();
+ }
+
+ /**
+ * @param hconsensus
+ */
+ protected void setColourSchemeConsensus(Hashtable[] hconsensus)
+ {
+ ColourSchemeI globalColourScheme = alignViewport
+ .getGlobalColourScheme();
+ if (globalColourScheme != null)
+ {
+ globalColourScheme.setConsensus(hconsensus);
+ }
+ }
+
+ /**
+ * Get the Consensus annotation for the alignment
+ *
+ * @return
+ */
+ protected AlignmentAnnotation getConsensusAnnotation()
+ {
+ return alignViewport.getAlignmentConsensusAnnotation();
+ }
+
+ /**
+ * update the consensus annotation from the sequence profile data using
+ * current visualization settings.
+ */
+ @Override
+ public void updateAnnotation()
+ {
+ updateResultAnnotation(false);
+ }
+
+ public void updateResultAnnotation(boolean immediate)
+ {
+ AlignmentAnnotation consensus = getConsensusAnnotation();
+ Hashtable[] hconsensus = getViewportConsensus();
+ if (immediate || !calcMan.isWorking(this) && consensus != null
+ && hconsensus != null)
+ {
+ deriveConsensus(consensus, hconsensus);
+ }
+ }
+
+ /**
+ * Convert the computed consensus data into the desired annotation for
+ * display.
+ *
+ * @param consensusAnnotation
+ * the annotation to be populated
+ * @param consensusData
+ * the computed consensus data
+ */
+ protected void deriveConsensus(AlignmentAnnotation consensusAnnotation,
+ Hashtable[] consensusData)
+ {
+ long nseq = getSequences().length;
+ AAFrequency.completeConsensus(consensusAnnotation, consensusData, 0,
+ consensusData.length, alignViewport.isIgnoreGapsConsensus(),
+ alignViewport.isShowSequenceLogo(), nseq);
+ }
+
+ /**
+ * Get the consensus data stored on the viewport.
+ *
+ * @return
+ */
+ protected Hashtable[] getViewportConsensus()
+ {
+ return alignViewport.getSequenceConsensusHash();
+ }
+}
diff --git a/src/jalview/workers/ConservationThread.java b/src/jalview/workers/ConservationThread.java
new file mode 100644
index 0000000..990f724
--- /dev/null
+++ b/src/jalview/workers/ConservationThread.java
@@ -0,0 +1,143 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.workers;
+
+import jalview.analysis.Conservation;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ConservationThread extends AlignCalcWorker implements
+ AlignCalcWorkerI
+{
+
+ private int ConsPercGaps = 25; // JBPNote : This should be a configurable
+ // property!
+
+ public ConservationThread(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ ConsPercGaps = alignViewport.getConsPercGaps();
+ }
+
+ private Conservation cons;
+
+ AlignmentAnnotation conservation, quality;
+
+ int alWidth;
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ calcMan.notifyStart(this); // updatingConservation = true;
+
+ while (!calcMan.notifyWorking(this))
+ {
+ try
+ {
+ if (ap != null)
+ {
+ // ap.paintAlignment(false);
+ }
+ Thread.sleep(200);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ if (alignViewport.isClosed())
+ {
+ abortAndDestroy();
+ return;
+ }
+ List<AlignmentAnnotation> ourAnnot = new ArrayList<AlignmentAnnotation>();
+ AlignmentI alignment = alignViewport.getAlignment();
+ conservation = alignViewport.getAlignmentConservationAnnotation();
+ quality = alignViewport.getAlignmentQualityAnnot();
+ ourAnnot.add(conservation);
+ ourAnnot.add(quality);
+ ourAnnots = ourAnnot;
+ ConsPercGaps = alignViewport.getConsPercGaps();
+ // AlignViewport.UPDATING_CONSERVATION = true;
+
+ if (alignment == null || (alWidth = alignment.getWidth()) < 0)
+ {
+ calcMan.workerComplete(this);
+ // .updatingConservation = false;
+ // AlignViewport.UPDATING_CONSERVATION = false;
+
+ return;
+ }
+ try
+ {
+ cons = Conservation.calculateConservation("All",
+ jalview.schemes.ResidueProperties.propHash, 3,
+ alignment.getSequences(), 0, alWidth - 1, false,
+ ConsPercGaps, quality != null);
+ } catch (IndexOutOfBoundsException x)
+ {
+ // probable race condition. just finish and return without any fuss.
+ calcMan.workerComplete(this);
+ return;
+ }
+ updateResultAnnotation(true);
+ } catch (OutOfMemoryError error)
+ {
+ ap.raiseOOMWarning("calculating conservation", error);
+ calcMan.workerCannotRun(this);
+ // alignViewport.conservation = null;
+ // this.alignViewport.quality = null;
+
+ }
+ calcMan.workerComplete(this);
+
+ if (ap != null)
+ {
+ ap.paintAlignment(true);
+ }
+
+ }
+
+ private void updateResultAnnotation(boolean b)
+ {
+ if (b || !calcMan.isWorking(this) && cons != null
+ && conservation != null && quality != null)
+ {
+ alignViewport.setConservation(cons);
+ cons.completeAnnotations(conservation, quality, 0, alWidth);
+ }
+ }
+
+ @Override
+ public void updateAnnotation()
+ {
+ updateResultAnnotation(false);
+
+ }
+}
diff --git a/src/jalview/workers/StrucConsensusThread.java b/src/jalview/workers/StrucConsensusThread.java
new file mode 100644
index 0000000..a7f64e7
--- /dev/null
+++ b/src/jalview/workers/StrucConsensusThread.java
@@ -0,0 +1,169 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.workers;
+
+import jalview.analysis.StructureFrequency;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceI;
+
+import java.util.Hashtable;
+
+public class StrucConsensusThread extends AlignCalcWorker implements
+ AlignCalcWorkerI
+{
+ public StrucConsensusThread(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ }
+
+ AlignmentAnnotation strucConsensus;
+
+ Hashtable[] hStrucConsensus;
+
+ private long nseq = -1;
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ if (calcMan.isPending(this))
+ {
+ return;
+ }
+ calcMan.notifyStart(this);
+ while (!calcMan.notifyWorking(this))
+ {
+ try
+ {
+ if (ap != null)
+ {
+ // ap.paintAlignment(false);
+ }
+
+ Thread.sleep(200);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ if (alignViewport.isClosed())
+ {
+ abortAndDestroy();
+ return;
+ }
+ AlignmentI alignment = alignViewport.getAlignment();
+
+ int aWidth = -1;
+
+ if (alignment == null || (aWidth = alignment.getWidth()) < 0)
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+ strucConsensus = alignViewport.getAlignmentStrucConsensusAnnotation();
+ hStrucConsensus = alignViewport.getRnaStructureConsensusHash();
+ strucConsensus.annotations = null;
+ strucConsensus.annotations = new Annotation[aWidth];
+
+ hStrucConsensus = new Hashtable[aWidth];
+
+ AlignmentAnnotation[] aa = alignViewport.getAlignment()
+ .getAlignmentAnnotation();
+ AlignmentAnnotation rnaStruc = null;
+ // select rna struct to use for calculation
+ for (int i = 0; i < aa.length; i++)
+ {
+ if (aa[i].visible && aa[i].isRNA() && aa[i].isValidStruc())
+ {
+ rnaStruc = aa[i];
+ break;
+ }
+ }
+ // check to see if its valid
+
+ if (rnaStruc == null || !rnaStruc.isValidStruc())
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+
+ try
+ {
+ final SequenceI[] arr = alignment.getSequencesArray();
+ nseq = arr.length;
+ jalview.analysis.StructureFrequency.calculate(arr, 0,
+ alignment.getWidth(), hStrucConsensus, true, rnaStruc);
+ } catch (ArrayIndexOutOfBoundsException x)
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+ alignViewport.setRnaStructureConsensusHash(hStrucConsensus);
+ // TODO AlignmentAnnotation rnaStruc!!!
+ updateResultAnnotation(true);
+ } catch (OutOfMemoryError error)
+ {
+ calcMan.workerCannotRun(this);
+
+ // consensus = null;
+ // hconsensus = null;
+ ap.raiseOOMWarning("calculating RNA structure consensus", error);
+ } finally
+ {
+ calcMan.workerComplete(this);
+ if (ap != null)
+ {
+ ap.paintAlignment(true);
+ }
+ }
+
+ }
+
+ /**
+ * update the consensus annotation from the sequence profile data using
+ * current visualization settings.
+ */
+ @Override
+ public void updateAnnotation()
+ {
+ updateResultAnnotation(false);
+ }
+
+ public void updateResultAnnotation(boolean immediate)
+ {
+ if (immediate || !calcMan.isWorking(this) && strucConsensus != null
+ && hStrucConsensus != null)
+ {
+ StructureFrequency.completeConsensus(strucConsensus, hStrucConsensus,
+ 0, hStrucConsensus.length,
+ alignViewport.isIgnoreGapsConsensus(),
+ alignViewport.isShowSequenceLogo(), nseq);
+ }
+ }
+
+}
diff --git a/src/jalview/ws/AWSThread.java b/src/jalview/ws/AWSThread.java
index 108ca03..156bd84 100644
--- a/src/jalview/ws/AWSThread.java
+++ b/src/jalview/ws/AWSThread.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws;
@@ -25,7 +28,11 @@ import jalview.datamodel.AlignmentView;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.WebserviceInfo;
-import jalview.gui.FeatureRenderer.FeatureRendererSettings;
+import jalview.util.MessageManager;
+import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
public abstract class AWSThread extends Thread
{
@@ -53,7 +60,7 @@ public abstract class AWSThread extends Thread
/**
* dataset sequence relationships to be propagated onto new results
*/
- protected AlignedCodonFrame[] codonframe = null;
+ protected Set<AlignedCodonFrame> codonframe = null;
/**
* are there jobs still running in this thread.
@@ -83,6 +90,11 @@ public abstract class AWSThread extends Thread
*/
protected String WsUrl = null;
+ /*
+ * The AlignFrame from which the service was requested.
+ */
+ private AlignFrame alignFrame;
+
/**
* generic web service job/subjob poll loop
*/
@@ -120,8 +132,9 @@ public abstract class AWSThread extends Thread
} catch (Exception ex)
{
// Deal with Transaction exceptions
- wsInfo.appendProgressText(jobs[j].jobnum, "\n" + WebServiceName
- + " Server exception!\n" + ex.getMessage());
+ wsInfo.appendProgressText(jobs[j].jobnum, MessageManager
+ .formatMessage("info.server_exception", new Object[] {
+ WebServiceName, ex.getMessage() }));
// always output the exception's stack trace to the log
Cache.log.warn(WebServiceName + " job(" + jobs[j].jobnum
+ ") Server exception.");
@@ -163,30 +176,7 @@ public abstract class AWSThread extends Thread
jstate.updateJobPanelState(wsInfo, OutputHeader, jobs[j]);
}
// Decide on overall state based on collected jobs[] states
- if (jstate.running > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);
- }
- else if (jstate.queuing > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);
- }
- else
- {
- jobComplete = true;
- if (jstate.finished > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);
- }
- else if (jstate.error > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
- }
- else if (jstate.serror > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
- }
- }
+ updateGlobalStatus(jstate);
if (!jobComplete)
{
try
@@ -208,10 +198,41 @@ public abstract class AWSThread extends Thread
{
Cache.log
.debug("WebServiceJob poll loop finished with no jobs created.");
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
+ wsInfo.appendProgressText(MessageManager
+ .getString("info.no_jobs_ran"));
wsInfo.setFinishedNoResults();
}
}
+ protected void updateGlobalStatus(JobStateSummary jstate)
+ {
+ if (jstate.running > 0)
+ {
+ wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);
+ }
+ else if (jstate.queuing > 0)
+ {
+ wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);
+ }
+ else
+ {
+ jobComplete = true;
+ if (jstate.finished > 0)
+ {
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);
+ }
+ else if (jstate.error > 0)
+ {
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
+ }
+ else if (jstate.serror > 0)
+ {
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
+ }
+ }
+ }
+
public AWSThread()
{
super();
@@ -284,13 +305,12 @@ public abstract class AWSThread extends Thread
SequenceI[] alignment = al.getSequencesArray();
for (int sq = 0; sq < alignment.length; sq++)
{
- for (int i = 0; i < codonframe.length; i++)
+ for (AlignedCodonFrame acf : codonframe)
{
- if (codonframe[i] != null
- && codonframe[i].involvesSequence(alignment[sq]))
+ final SequenceI seq = alignment[sq];
+ if (acf != null && acf.involvesSequence(seq))
{
- al.addCodonFrame(codonframe[i]);
- codonframe[i] = null;
+ al.addCodonFrame(acf);
break;
}
}
@@ -335,6 +355,7 @@ public abstract class AWSThread extends Thread
/**
* Extracts additional info from alignment view's context.
+ *
* @param alframe
* - reference for copying mappings and display styles across
* @param wsinfo2
@@ -348,7 +369,7 @@ public abstract class AWSThread extends Thread
AlignmentView alview, String wsurl2)
{
super();
- // this.alignFrame = alframe;
+ this.alignFrame = alframe;
currentView = alframe.getCurrentView().getAlignment();
featureSettings = alframe.getFeatureRenderer().getSettings();
defGapChar = alframe.getViewport().getGapCharacter();
@@ -357,13 +378,18 @@ public abstract class AWSThread extends Thread
WsUrl = wsurl2;
if (alframe != null)
{
- AlignedCodonFrame[] cf = alframe.getViewport().getAlignment()
+ Set<AlignedCodonFrame> cf = alframe.getViewport().getAlignment()
.getCodonFrames();
if (cf != null)
{
- codonframe = new AlignedCodonFrame[cf.length];
- System.arraycopy(cf, 0, codonframe, 0, cf.length);
+ codonframe = new LinkedHashSet<AlignedCodonFrame>();
+ codonframe.addAll(cf);
}
}
}
+
+ protected AlignFrame getRequestingAlignFrame()
+ {
+ return this.alignFrame;
+ }
}
diff --git a/src/jalview/ws/AWsJob.java b/src/jalview/ws/AWsJob.java
index 1b89758..3bd7e65 100644
--- a/src/jalview/ws/AWsJob.java
+++ b/src/jalview/ws/AWsJob.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws;
diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java
index d235410..7693142 100644
--- a/src/jalview/ws/DBRefFetcher.java
+++ b/src/jalview/ws/DBRefFetcher.java
@@ -1,721 +1,757 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws;
-
-import jalview.analysis.AlignSeq;
-import jalview.bin.Cache;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.DBRefSource;
-import jalview.datamodel.Mapping;
-import jalview.datamodel.SequenceFeature;
-import jalview.datamodel.SequenceI;
-import jalview.gui.AlignFrame;
-import jalview.gui.CutAndPasteTransfer;
-import jalview.gui.Desktop;
-import jalview.gui.IProgressIndicator;
-import jalview.gui.OOMWarning;
-
-import java.lang.reflect.Array;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.biojava.dasobert.dasregistry.DasSource;
-
-import uk.ac.ebi.picr.model.UPEntry;
-
-/**
- * Implements a runnable for validating a sequence against external databases
- * and then propagating references and features onto the sequence(s)
- *
- * @author $author$
- * @version $Revision$
- */
-public class DBRefFetcher implements Runnable
-{
- SequenceI[] dataset;
-
- IProgressIndicator af;
-
- CutAndPasteTransfer output = new CutAndPasteTransfer();
-
- StringBuffer sbuffer = new StringBuffer();
-
- boolean running = false;
-
- /**
- * picr client instance
- */
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface picrClient = null;
-
- // /This will be a collection of Vectors of sequenceI refs.
- // The key will be the seq name or accession id of the seq
- Hashtable seqRefs;
-
- String[] dbSources;
-
- SequenceFetcher sfetcher;
-
- private SequenceI[] alseqs;
-
- public DBRefFetcher()
- {
- }
-
- /**
- * Creates a new SequenceFeatureFetcher object and fetches from the currently
- * selected set of databases.
- *
- * @param seqs
- * fetch references for these sequences
- * @param af
- * the parent alignframe for progress bar monitoring.
- */
- public DBRefFetcher(SequenceI[] seqs, AlignFrame af)
- {
- this(seqs, af, null);
- }
-
- /**
- * Creates a new SequenceFeatureFetcher object and fetches from the currently
- * selected set of databases.
- *
- * @param seqs
- * fetch references for these sequences
- * @param af
- * the parent alignframe for progress bar monitoring.
- * @param sources
- * array of database source strings to query references from
- */
- public DBRefFetcher(SequenceI[] seqs, AlignFrame af, String[] sources)
- {
- this.af = af;
- alseqs = new SequenceI[seqs.length];
- SequenceI[] ds = new SequenceI[seqs.length];
- for (int i = 0; i < seqs.length; i++)
- {
- alseqs[i] = seqs[i];
- if (seqs[i].getDatasetSequence() != null)
- ds[i] = seqs[i].getDatasetSequence();
- else
- ds[i] = seqs[i];
- }
- this.dataset = ds;
- // TODO Jalview 2.5 lots of this code should be in the gui package!
- sfetcher = jalview.gui.SequenceFetcher.getSequenceFetcherSingleton(af);
- if (sources == null)
- {
- // af.featureSettings_actionPerformed(null);
- String[] defdb = null, otherdb = sfetcher
- .getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
- Vector selsources = new Vector(), dasselsrc = (af.featureSettings != null) ? af.featureSettings
- .getSelectedSources() : new jalview.gui.DasSourceBrowser()
- .getSelectedSources();
- Enumeration en = dasselsrc.elements();
- while (en.hasMoreElements())
- {
- DasSource src = (DasSource) en.nextElement();
- selsources.addElement(src.getNickname());
- }
- int osel = 0;
- for (int o = 0; otherdb != null && o < otherdb.length; o++)
- {
- if (!selsources.contains(otherdb[o]))
- {
- otherdb[o] = null;
- }
- else
- {
- osel++;
- }
- }
- // select appropriate databases based on alignFrame context.
- if (af.getViewport().getAlignment().isNucleotide())
- {
- defdb = DBRefSource.DNACODINGDBS;
- }
- else
- {
- defdb = DBRefSource.PROTEINDBS;
- }
- // append the selected sequence sources to the default dbs
- dbSources = new String[defdb.length + osel];
- System.arraycopy(defdb, 0, dbSources, 0, defdb.length);
- for (int o = 0, op = defdb.length; otherdb != null
- && o < otherdb.length; o++)
- {
- if (otherdb[o] != null)
- {
- dbSources[op++] = otherdb[o];
- }
- }
- }
- else
- {
- // we assume the caller knows what they're doing and ensured that all the
- // db source names are valid
- dbSources = sources;
- }
- }
-
- /**
- * retrieve all the das sequence sources and add them to the list of db
- * sources to retrieve from
- */
- public void appendAllDasSources()
- {
- if (dbSources == null)
- {
- dbSources = new String[]
- {};
- }
- // append additional sources
- String[] otherdb = sfetcher
- .getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
- if (otherdb != null && otherdb.length > 0)
- {
- String[] newsrc = new String[dbSources.length + otherdb.length];
- System.arraycopy(dbSources, 0, newsrc, 0, dbSources.length);
- System.arraycopy(otherdb, 0, newsrc, dbSources.length, otherdb.length);
- dbSources = newsrc;
- }
- }
-
- /**
- * start the fetcher thread
- *
- * @param waitTillFinished
- * true to block until the fetcher has finished
- */
- public void fetchDBRefs(boolean waitTillFinished)
- {
- Thread thread = new Thread(this);
- thread.start();
- running = true;
-
- if (waitTillFinished)
- {
- while (running)
- {
- try
- {
- Thread.sleep(500);
- } catch (Exception ex)
- {
- }
- }
- }
- }
-
- /**
- * The sequence will be added to a vector of sequences belonging to key which
- * could be either seq name or dbref id
- *
- * @param seq
- * SequenceI
- * @param key
- * String
- */
- void addSeqId(SequenceI seq, String key)
- {
- key = key.toUpperCase();
-
- Vector seqs;
- if (seqRefs.containsKey(key))
- {
- seqs = (Vector) seqRefs.get(key);
-
- if (seqs != null && !seqs.contains(seq))
- {
- seqs.addElement(seq);
- }
- else if (seqs == null)
- {
- seqs = new Vector();
- seqs.addElement(seq);
- }
-
- }
- else
- {
- seqs = new Vector();
- seqs.addElement(seq);
- }
-
- seqRefs.put(key, seqs);
- }
-
- /**
- * DOCUMENT ME!
- */
- public void run()
- {
- if (dbSources == null)
- {
- throw new Error("Implementation error. Must initialise dbSources");
- }
- running = true;
- long startTime = System.currentTimeMillis();
- af.setProgressBar("Fetching db refs", startTime);
- try
- {
- if (Cache.getDefault("DBREFFETCH_USEPICR", false))
- {
- picrClient = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator()
- .getAccessionMapperPort();
- }
- } catch (Exception e)
- {
- System.err.println("Couldn't locate PICR service instance.\n");
- e.printStackTrace();
- }
- int db = 0;
- Vector sdataset = new Vector();
- for (int s = 0; s < dataset.length; s++)
- {
- sdataset.addElement(dataset[s]);
- }
- while (sdataset.size() > 0 && db < dbSources.length)
- {
- int maxqlen = 1; // default number of queries made to at one time
- System.err.println("Verifying against " + dbSources[db]);
- jalview.ws.seqfetcher.DbSourceProxy dbsource = sfetcher
- .getSourceProxy(dbSources[db]);
- if (dbsource == null)
- {
- System.err.println("No proxy for " + dbSources[db]);
- db++;
- continue;
- }
- if (dbsource.getDbSourceProperties()
- .containsKey(DBRefSource.MULTIACC))
- {
- maxqlen = ((Integer) dbsource.getDbSourceProperties().get(
- DBRefSource.MULTIACC)).intValue();
- }
- else
- {
- maxqlen = 1;
- }
- // iterate through db for each remaining un-verified sequence
- SequenceI[] currSeqs = new SequenceI[sdataset.size()];
- sdataset.copyInto(currSeqs);// seqs that are to be validated against
- // dbSources[db]
- Vector queries = new Vector(); // generated queries curSeq
- seqRefs = new Hashtable();
-
- int seqIndex = 0;
-
- while (queries.size() > 0 || seqIndex < currSeqs.length)
- {
- if (queries.size() > 0)
- {
- // Still queries to make for current seqIndex
- StringBuffer queryString = new StringBuffer("");
- int numq = 0, nqSize = (maxqlen > queries.size()) ? queries
- .size() : maxqlen;
-
- while (queries.size() > 0 && numq < nqSize)
- {
- String query = (String) queries.elementAt(0);
- if (dbsource.isValidReference(query))
- {
- queryString.append((numq == 0) ? "" : dbsource
- .getAccessionSeparator());
- queryString.append(query);
- numq++;
- }
- // remove the extracted query string
- queries.removeElementAt(0);
- }
- // make the queries and process the response
- AlignmentI retrieved = null;
- try
- {
- if (jalview.bin.Cache.log.isDebugEnabled())
- {
- jalview.bin.Cache.log.debug("Querying "
- + dbsource.getDbName() + " with : '"
- + queryString.toString() + "'");
- }
- retrieved = dbsource.getSequenceRecords(queryString.toString());
- } catch (Exception ex)
- {
- ex.printStackTrace();
- } catch (OutOfMemoryError err)
- {
- new OOMWarning("retrieving database references ("
- + queryString.toString() + ")", err);
- }
- if (retrieved != null)
- {
- transferReferences(sdataset, dbSources[db], retrieved);
- }
- }
- else
- {
- // make some more strings for use as queries
- for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)
- {
- SequenceI sequence = dataset[seqIndex];
- DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
- sequence.getDBRef(), new String[]
- { dbSources[db] }); // jalview.datamodel.DBRefSource.UNIPROT
- // });
- // check for existing dbrefs to use
- if (uprefs != null && uprefs.length > 0)
- {
- for (int j = 0; j < uprefs.length; j++)
- {
- addSeqId(sequence, uprefs[j].getAccessionId());
- queries.addElement(uprefs[j].getAccessionId().toUpperCase());
- }
- }
- else
- {
- // generate queries from sequence ID string
- StringTokenizer st = new StringTokenizer(sequence.getName(),
- "|");
- while (st.hasMoreTokens())
- {
- String token = st.nextToken();
- UPEntry[] presp = null;
- if (picrClient != null)
- {
- // resolve the string against PICR to recover valid IDs
- try
- {
- presp = picrClient
- .getUPIForAccession(token, null,
- picrClient.getMappedDatabaseNames(),
- null, true);
- } catch (Exception e)
- {
- System.err.println("Exception with Picr for '" + token
- + "'\n");
- e.printStackTrace();
- }
- }
- if (presp != null && presp.length > 0)
- {
- for (int id = 0; id < presp.length; id++)
- {
- // construct sequences from response if sequences are
- // present, and do a transferReferences
- // otherwise transfer non sequence x-references directly.
- }
- System.out
- .println("Validated ID against PICR... (for what its worth):"
- + token);
- addSeqId(sequence, token);
- queries.addElement(token.toUpperCase());
- }
- else
- {
- // if ()
- // System.out.println("Not querying source with token="+token+"\n");
- addSeqId(sequence, token);
- queries.addElement(token.toUpperCase());
- }
- }
- }
- }
- }
- }
- // advance to next database
- db++;
- } // all databases have been queries.
- if (sbuffer.length() > 0)
- {
- output.setText("Your sequences have been verified against known sequence databases. Some of the ids have been\n"
- + "altered, most likely the start/end residue will have been updated.\n"
- + "Save your alignment to maintain the updated id.\n\n"
- + sbuffer.toString());
- Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);
- // The above is the dataset, we must now find out the index
- // of the viewed sequence
-
- }
-
- af.setProgressBar("DBRef search completed", startTime);
- // promptBeforeBlast();
-
- running = false;
-
- }
-
- /**
- * Verify local sequences in seqRefs against the retrieved sequence database
- * records.
- *
- */
- void transferReferences(Vector sdataset, String dbSource,
- AlignmentI retrievedAl) // File
- // file)
- {
- if (retrievedAl == null || retrievedAl.getHeight() == 0)
- {
- return;
- }
- SequenceI[] retrieved = recoverDbSequences(retrievedAl
- .getSequencesArray());
- SequenceI sequence = null;
- boolean transferred = false;
- StringBuffer messages = new StringBuffer();
-
- // Vector entries = new Uniprot().getUniprotEntries(file);
-
- int i, iSize = retrieved.length; // entries == null ? 0 : entries.size();
- // UniprotEntry entry;
- for (i = 0; i < iSize; i++)
- {
- SequenceI entry = retrieved[i]; // (UniprotEntry) entries.elementAt(i);
-
- // Work out which sequences this sequence matches,
- // taking into account all accessionIds and names in the file
- Vector sequenceMatches = new Vector();
- // look for corresponding accession ids
- DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(
- entry.getDBRef(), new String[]
- { dbSource });
- if (entryRefs == null)
- {
- System.err
- .println("Dud dbSource string ? no entryrefs selected for "
- + dbSource + " on " + entry.getName());
- continue;
- }
- for (int j = 0; j < entryRefs.length; j++)
- {
- String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString();
- // match up on accessionId
- if (seqRefs.containsKey(accessionId.toUpperCase()))
- {
- Vector seqs = (Vector) seqRefs.get(accessionId);
- for (int jj = 0; jj < seqs.size(); jj++)
- {
- sequence = (SequenceI) seqs.elementAt(jj);
- if (!sequenceMatches.contains(sequence))
- {
- sequenceMatches.addElement(sequence);
- }
- }
- }
- }
- if (sequenceMatches.size() == 0)
- {
- // failed to match directly on accessionId==query so just compare all
- // sequences to entry
- Enumeration e = seqRefs.keys();
- while (e.hasMoreElements())
- {
- Vector sqs = (Vector) seqRefs.get(e.nextElement());
- if (sqs != null && sqs.size() > 0)
- {
- Enumeration sqe = sqs.elements();
- while (sqe.hasMoreElements())
- {
- sequenceMatches.addElement(sqe.nextElement());
- }
- }
- }
- }
- // look for corresponding names
- // this is uniprot specific ?
- // could be useful to extend this so we try to find any 'significant'
- // information in common between two sequence objects.
- /*
- * DBRefEntry[] entryRefs =
- * jalview.util.DBRefUtils.selectRefs(entry.getDBRef(), new String[] {
- * dbSource }); for (int j = 0; j < entry.getName().size(); j++) { String
- * name = entry.getName().elementAt(j).toString(); if
- * (seqRefs.containsKey(name)) { Vector seqs = (Vector) seqRefs.get(name);
- * for (int jj = 0; jj < seqs.size(); jj++) { sequence = (SequenceI)
- * seqs.elementAt(jj); if (!sequenceMatches.contains(sequence)) {
- * sequenceMatches.addElement(sequence); } } } }
- */
- // sequenceMatches now contains the set of all sequences associated with
- // the returned db record
- String entrySeq = entry.getSequenceAsString().toUpperCase();
- for (int m = 0; m < sequenceMatches.size(); m++)
- {
- sequence = (SequenceI) sequenceMatches.elementAt(m);
- // only update start and end positions and shift features if there are
- // no existing references
- // TODO: test for legacy where uniprot or EMBL refs exist but no
- // mappings are made (but content matches retrieved set)
- boolean updateRefFrame = sequence.getDBRef() == null
- || sequence.getDBRef().length == 0;
- // verify sequence against the entry sequence
-
- String nonGapped = AlignSeq.extractGaps("-. ",
- sequence.getSequenceAsString()).toUpperCase();
-
- int absStart = entrySeq.indexOf(nonGapped);
- int mapStart = entry.getStart();
- jalview.datamodel.Mapping mp;
-
- if (absStart == -1)
- {
- // Is local sequence contained in dataset sequence?
- absStart = nonGapped.indexOf(entrySeq);
- if (absStart == -1)
- { // verification failed.
- messages.append(sequence.getName()
- + " SEQUENCE NOT %100 MATCH \n");
- continue;
- }
- transferred = true;
- sbuffer.append(sequence.getName() + " HAS " + absStart
- + " PREFIXED RESIDUES COMPARED TO " + dbSource + "\n");
- //
- // + " - ANY SEQUENCE FEATURES"
- // + " HAVE BEEN ADJUSTED ACCORDINGLY \n");
- // absStart = 0;
- // create valid mapping between matching region of local sequence and
- // the mapped sequence
- mp = new Mapping(null, new int[]
- { sequence.getStart() + absStart,
- sequence.getStart() + absStart + entrySeq.length() - 1 },
- new int[]
- { entry.getStart(),
- entry.getStart() + entrySeq.length() - 1 }, 1, 1);
- updateRefFrame = false; // mapping is based on current start/end so
- // don't modify start and end
- }
- else
- {
- transferred = true;
- // update start and end of local sequence to place it in entry's
- // reference frame.
- // apply identity map map from whole of local sequence to matching
- // region of database
- // sequence
- mp = null; // Mapping.getIdentityMap();
- // new Mapping(null,
- // new int[] { absStart+sequence.getStart(),
- // absStart+sequence.getStart()+entrySeq.length()-1},
- // new int[] { entry.getStart(), entry.getEnd() }, 1, 1);
- // relocate local features for updated start
- if (updateRefFrame)
- {
- if (sequence.getSequenceFeatures() != null)
- {
- SequenceFeature[] sf = sequence.getSequenceFeatures();
- int start = sequence.getStart();
- int end = sequence.getEnd();
- int startShift = 1 - absStart - start; // how much the features
- // are
- // to be shifted by
- for (int sfi = 0; sfi < sf.length; sfi++)
- {
- if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)
- {
- // shift feature along by absstart
- sf[sfi].setBegin(sf[sfi].getBegin() + startShift);
- sf[sfi].setEnd(sf[sfi].getEnd() + startShift);
- }
- }
- }
- }
- }
-
- System.out.println("Adding dbrefs to " + sequence.getName()
- + " from " + dbSource + " sequence : " + entry.getName());
- sequence.transferAnnotation(entry, mp);
- // unknownSequences.remove(sequence);
- int absEnd = absStart + nonGapped.length();
- absStart += 1;
- if (updateRefFrame)
- {
- // finally, update local sequence reference frame if we're allowed
- sequence.setStart(absStart);
- sequence.setEnd(absEnd);
- // search for alignment sequences to update coordinate frame for
- for (int alsq = 0; alsq < alseqs.length; alsq++)
- {
- if (alseqs[alsq].getDatasetSequence() == sequence)
- {
- String ngAlsq = AlignSeq.extractGaps("-. ",
- alseqs[alsq].getSequenceAsString()).toUpperCase();
- int oldstrt = alseqs[alsq].getStart();
- alseqs[alsq].setStart(sequence.getSequenceAsString()
- .toUpperCase().indexOf(ngAlsq)
- + sequence.getStart());
- if (oldstrt != alseqs[alsq].getStart())
- {
- alseqs[alsq].setEnd(ngAlsq.length()
- + alseqs[alsq].getStart() - 1);
- }
- }
- }
- // TODO: search for all other references to this dataset sequence, and
- // update start/end
- // TODO: update all AlCodonMappings which involve this alignment
- // sequence (e.g. Q30167 cdna translation from exon2 product (vamsas
- // demo)
- }
- // and remove it from the rest
- // TODO: decide if we should remove annotated sequence from set
- sdataset.remove(sequence);
- // TODO: should we make a note of sequences that have received new DB
- // ids, so we can query all enabled DAS servers for them ?
- }
- }
- if (!transferred)
- {
- // report the ID/sequence mismatches
- sbuffer.append(messages);
- }
- }
-
- /**
- * loop thru and collect additional sequences in Map.
- *
- * @param sequencesArray
- * @return
- */
- private SequenceI[] recoverDbSequences(SequenceI[] sequencesArray)
- {
- Vector nseq = new Vector();
- for (int i = 0; sequencesArray != null && i < sequencesArray.length; i++)
- {
- nseq.addElement(sequencesArray[i]);
- DBRefEntry dbr[] = sequencesArray[i].getDBRef();
- jalview.datamodel.Mapping map = null;
- for (int r = 0; (dbr != null) && r < dbr.length; r++)
- {
- if ((map = dbr[r].getMap()) != null)
- {
- if (map.getTo() != null && !nseq.contains(map.getTo()))
- {
- nseq.addElement(map.getTo());
- }
- }
- }
- }
- if (nseq.size() > 0)
- {
- sequencesArray = new SequenceI[nseq.size()];
- nseq.toArray(sequencesArray);
- }
- return sequencesArray;
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws;
+
+import jalview.analysis.AlignSeq;
+import jalview.bin.Cache;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.Mapping;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.CutAndPasteTransfer;
+import jalview.gui.Desktop;
+import jalview.gui.IProgressIndicator;
+import jalview.gui.OOMWarning;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import uk.ac.ebi.picr.model.UPEntry;
+
+/**
+ * Implements a runnable for validating a sequence against external databases
+ * and then propagating references and features onto the sequence(s)
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class DBRefFetcher implements Runnable
+{
+ SequenceI[] dataset;
+
+ IProgressIndicator af;
+
+ CutAndPasteTransfer output = new CutAndPasteTransfer();
+
+ StringBuffer sbuffer = new StringBuffer();
+
+ boolean running = false;
+
+ /**
+ * picr client instance
+ */
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface picrClient = null;
+
+ // /This will be a collection of Vectors of sequenceI refs.
+ // The key will be the seq name or accession id of the seq
+ Hashtable seqRefs;
+
+ DbSourceProxy[] dbSources;
+
+ SequenceFetcher sfetcher;
+
+ private SequenceI[] alseqs;
+
+ /**
+ * when true - retrieved sequences will be trimmed to cover longest derived
+ * alignment sequence
+ */
+ private boolean trimDsSeqs = true;
+
+ public DBRefFetcher()
+ {
+ }
+
+ /**
+ * Creates a new SequenceFeatureFetcher object and fetches from the currently
+ * selected set of databases.
+ *
+ * @param seqs
+ * fetch references for these sequences
+ * @param af
+ * the parent alignframe for progress bar monitoring.
+ */
+ public DBRefFetcher(SequenceI[] seqs, AlignFrame af)
+ {
+ this(seqs, af, null);
+ }
+
+ /**
+ * Creates a new SequenceFeatureFetcher object and fetches from the currently
+ * selected set of databases.
+ *
+ * @param seqs
+ * fetch references for these sequences
+ * @param af
+ * the parent alignframe for progress bar monitoring.
+ * @param sources
+ * array of database source strings to query references from
+ */
+ public DBRefFetcher(SequenceI[] seqs, AlignFrame af,
+ DbSourceProxy[] sources)
+ {
+ this.af = af;
+ alseqs = new SequenceI[seqs.length];
+ SequenceI[] ds = new SequenceI[seqs.length];
+ for (int i = 0; i < seqs.length; i++)
+ {
+ alseqs[i] = seqs[i];
+ if (seqs[i].getDatasetSequence() != null)
+ ds[i] = seqs[i].getDatasetSequence();
+ else
+ ds[i] = seqs[i];
+ }
+ this.dataset = ds;
+ // TODO Jalview 2.5 lots of this code should be in the gui package!
+ sfetcher = jalview.gui.SequenceFetcher.getSequenceFetcherSingleton(af);
+ // set default behaviour for transferring excess sequence data to the
+ // dataset
+ trimDsSeqs = Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true);
+ if (sources == null)
+ {
+ // af.featureSettings_actionPerformed(null);
+ String[] defdb = null, otherdb = sfetcher
+ .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
+ List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
+ Vector dasselsrc = (af.featureSettings != null) ? af.featureSettings
+ .getSelectedSources() : new jalview.gui.DasSourceBrowser()
+ .getSelectedSources();
+ Enumeration<jalviewSourceI> en = dasselsrc.elements();
+ while (en.hasMoreElements())
+ {
+ jalviewSourceI src = en.nextElement();
+ List<DbSourceProxy> sp = src.getSequenceSourceProxies();
+ if (sp != null)
+ {
+ selsources.addAll(sp);
+ if (sp.size() > 1)
+ {
+ Cache.log.debug("Added many Db Sources for :" + src.getTitle());
+ }
+ }
+ }
+ // select appropriate databases based on alignFrame context.
+ if (af.getViewport().getAlignment().isNucleotide())
+ {
+ defdb = DBRefSource.DNACODINGDBS;
+ }
+ else
+ {
+ defdb = DBRefSource.PROTEINDBS;
+ }
+ List<DbSourceProxy> srces = new ArrayList<DbSourceProxy>();
+ for (String ddb : defdb)
+ {
+ List<DbSourceProxy> srcesfordb = sfetcher.getSourceProxy(ddb);
+ if (srcesfordb != null)
+ {
+ srces.addAll(srcesfordb);
+ }
+ }
+
+ // append the selected sequence sources to the default dbs
+ srces.addAll(selsources);
+ dbSources = srces.toArray(new DbSourceProxy[0]);
+ }
+ else
+ {
+ // we assume the caller knows what they're doing and ensured that all the
+ // db source names are valid
+ dbSources = sources;
+ }
+ }
+
+ /**
+ * retrieve all the das sequence sources and add them to the list of db
+ * sources to retrieve from
+ */
+ public void appendAllDasSources()
+ {
+ if (dbSources == null)
+ {
+ dbSources = new DbSourceProxy[0];
+ }
+ // append additional sources
+ DbSourceProxy[] otherdb = sfetcher
+ .getDbSourceProxyInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
+ if (otherdb != null && otherdb.length > 0)
+ {
+ DbSourceProxy[] newsrc = new DbSourceProxy[dbSources.length
+ + otherdb.length];
+ System.arraycopy(dbSources, 0, newsrc, 0, dbSources.length);
+ System.arraycopy(otherdb, 0, newsrc, dbSources.length, otherdb.length);
+ dbSources = newsrc;
+ }
+ }
+
+ /**
+ * start the fetcher thread
+ *
+ * @param waitTillFinished
+ * true to block until the fetcher has finished
+ */
+ public void fetchDBRefs(boolean waitTillFinished)
+ {
+ Thread thread = new Thread(this);
+ thread.start();
+ running = true;
+
+ if (waitTillFinished)
+ {
+ while (running)
+ {
+ try
+ {
+ Thread.sleep(500);
+ } catch (Exception ex)
+ {
+ }
+ }
+ }
+ }
+
+ /**
+ * The sequence will be added to a vector of sequences belonging to key which
+ * could be either seq name or dbref id
+ *
+ * @param seq
+ * SequenceI
+ * @param key
+ * String
+ */
+ void addSeqId(SequenceI seq, String key)
+ {
+ key = key.toUpperCase();
+
+ Vector seqs;
+ if (seqRefs.containsKey(key))
+ {
+ seqs = (Vector) seqRefs.get(key);
+
+ if (seqs != null && !seqs.contains(seq))
+ {
+ seqs.addElement(seq);
+ }
+ else if (seqs == null)
+ {
+ seqs = new Vector();
+ seqs.addElement(seq);
+ }
+
+ }
+ else
+ {
+ seqs = new Vector();
+ seqs.addElement(seq);
+ }
+
+ seqRefs.put(key, seqs);
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void run()
+ {
+ if (dbSources == null)
+ {
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_must_init_dbsources"));
+ }
+ running = true;
+ long startTime = System.currentTimeMillis();
+ af.setProgressBar(MessageManager.getString("status.fetching_db_refs"),
+ startTime);
+ try
+ {
+ if (Cache.getDefault("DBREFFETCH_USEPICR", false))
+ {
+ picrClient = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator()
+ .getAccessionMapperPort();
+ }
+ } catch (Exception e)
+ {
+ System.err.println("Couldn't locate PICR service instance.\n");
+ e.printStackTrace();
+ }
+ int db = 0;
+ Vector sdataset = new Vector();
+ for (int s = 0; s < dataset.length; s++)
+ {
+ sdataset.addElement(dataset[s]);
+ }
+ while (sdataset.size() > 0 && db < dbSources.length)
+ {
+ int maxqlen = 1; // default number of queries made to at one time
+ System.err.println("Verifying against " + dbSources[db].getDbName());
+ boolean dn = false;
+
+ // iterate through db for each remaining un-verified sequence
+ SequenceI[] currSeqs = new SequenceI[sdataset.size()];
+ sdataset.copyInto(currSeqs);// seqs that are to be validated against
+ // dbSources[db]
+ Vector queries = new Vector(); // generated queries curSeq
+ seqRefs = new Hashtable();
+
+ int seqIndex = 0;
+
+ jalview.ws.seqfetcher.DbSourceProxy dbsource = dbSources[db];
+ {
+ // for moment, we dumbly iterate over all retrieval sources for a
+ // particular database
+ // TODO: introduce multithread multisource queries and logic to remove a
+ // query from other sources if any source for a database returns a
+ // record
+ if (dbsource.getDbSourceProperties().containsKey(
+ DBRefSource.MULTIACC))
+ {
+ maxqlen = ((Integer) dbsource.getDbSourceProperties().get(
+ DBRefSource.MULTIACC)).intValue();
+ }
+ else
+ {
+ maxqlen = 1;
+ }
+ while (queries.size() > 0 || seqIndex < currSeqs.length)
+ {
+ if (queries.size() > 0)
+ {
+ // Still queries to make for current seqIndex
+ StringBuffer queryString = new StringBuffer("");
+ int numq = 0, nqSize = (maxqlen > queries.size()) ? queries
+ .size() : maxqlen;
+
+ while (queries.size() > 0 && numq < nqSize)
+ {
+ String query = (String) queries.elementAt(0);
+ if (dbsource.isValidReference(query))
+ {
+ queryString.append((numq == 0) ? "" : dbsource
+ .getAccessionSeparator());
+ queryString.append(query);
+ numq++;
+ }
+ // remove the extracted query string
+ queries.removeElementAt(0);
+ }
+ // make the queries and process the response
+ AlignmentI retrieved = null;
+ try
+ {
+ if (jalview.bin.Cache.log.isDebugEnabled())
+ {
+ jalview.bin.Cache.log.debug("Querying "
+ + dbsource.getDbName() + " with : '"
+ + queryString.toString() + "'");
+ }
+ retrieved = dbsource.getSequenceRecords(queryString
+ .toString());
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } catch (OutOfMemoryError err)
+ {
+ new OOMWarning("retrieving database references ("
+ + queryString.toString() + ")", err);
+ }
+ if (retrieved != null)
+ {
+ transferReferences(sdataset, dbsource.getDbSource(),
+ retrieved, trimDsSeqs);
+ }
+ }
+ else
+ {
+ // make some more strings for use as queries
+ for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)
+ {
+ SequenceI sequence = dataset[seqIndex];
+ DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
+ sequence.getDBRef(),
+ new String[] { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT
+ // });
+ // check for existing dbrefs to use
+ if (uprefs != null && uprefs.length > 0)
+ {
+ for (int j = 0; j < uprefs.length; j++)
+ {
+ addSeqId(sequence, uprefs[j].getAccessionId());
+ queries.addElement(uprefs[j].getAccessionId()
+ .toUpperCase());
+ }
+ }
+ else
+ {
+ // generate queries from sequence ID string
+ StringTokenizer st = new StringTokenizer(
+ sequence.getName(), "|");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ UPEntry[] presp = null;
+ if (picrClient != null)
+ {
+ // resolve the string against PICR to recover valid IDs
+ try
+ {
+ presp = picrClient.getUPIForAccession(token, null,
+ picrClient.getMappedDatabaseNames(), null,
+ true);
+ } catch (Exception e)
+ {
+ System.err.println("Exception with Picr for '"
+ + token + "'\n");
+ e.printStackTrace();
+ }
+ }
+ if (presp != null && presp.length > 0)
+ {
+ for (int id = 0; id < presp.length; id++)
+ {
+ // construct sequences from response if sequences are
+ // present, and do a transferReferences
+ // otherwise transfer non sequence x-references directly.
+ }
+ System.out
+ .println("Validated ID against PICR... (for what its worth):"
+ + token);
+ addSeqId(sequence, token);
+ queries.addElement(token.toUpperCase());
+ }
+ else
+ {
+ // if ()
+ // System.out.println("Not querying source with token="+token+"\n");
+ addSeqId(sequence, token);
+ queries.addElement(token.toUpperCase());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // advance to next database
+ db++;
+ } // all databases have been queries.
+ if (sbuffer.length() > 0)
+ {
+ output.setText(MessageManager
+ .getString("label.your_sequences_have_been_verified")
+ + sbuffer.toString());
+ Desktop.addInternalFrame(output,
+ MessageManager.getString("label.sequence_names_updated"),
+ 600, 300);
+ // The above is the dataset, we must now find out the index
+ // of the viewed sequence
+
+ }
+
+ af.setProgressBar(
+ MessageManager.getString("label.dbref_search_completed"),
+ startTime);
+ // promptBeforeBlast();
+
+ running = false;
+
+ }
+
+ /**
+ * Verify local sequences in seqRefs against the retrieved sequence database
+ * records.
+ *
+ * @param trimDatasetSeqs
+ *
+ */
+ void transferReferences(Vector sdataset, String dbSource,
+ AlignmentI retrievedAl, boolean trimDatasetSeqs) // File
+ // file)
+ {
+ System.out.println("trimming ? " + trimDatasetSeqs);
+ if (retrievedAl == null || retrievedAl.getHeight() == 0)
+ {
+ return;
+ }
+ SequenceI[] retrieved = recoverDbSequences(retrievedAl
+ .getSequencesArray());
+ SequenceI sequence = null;
+ boolean transferred = false;
+ StringBuffer messages = new StringBuffer();
+
+ // Vector entries = new Uniprot().getUniprotEntries(file);
+
+ int i, iSize = retrieved.length; // entries == null ? 0 : entries.size();
+ // UniprotEntry entry;
+ for (i = 0; i < iSize; i++)
+ {
+ SequenceI entry = retrieved[i]; // (UniprotEntry) entries.elementAt(i);
+
+ // Work out which sequences this sequence matches,
+ // taking into account all accessionIds and names in the file
+ Vector sequenceMatches = new Vector();
+ // look for corresponding accession ids
+ DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(
+ entry.getDBRef(), new String[] { dbSource });
+ if (entryRefs == null)
+ {
+ System.err
+ .println("Dud dbSource string ? no entryrefs selected for "
+ + dbSource + " on " + entry.getName());
+ continue;
+ }
+ for (int j = 0; j < entryRefs.length; j++)
+ {
+ String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString();
+ // match up on accessionId
+ if (seqRefs.containsKey(accessionId.toUpperCase()))
+ {
+ Vector seqs = (Vector) seqRefs.get(accessionId);
+ for (int jj = 0; jj < seqs.size(); jj++)
+ {
+ sequence = (SequenceI) seqs.elementAt(jj);
+ if (!sequenceMatches.contains(sequence))
+ {
+ sequenceMatches.addElement(sequence);
+ }
+ }
+ }
+ }
+ if (sequenceMatches.size() == 0)
+ {
+ // failed to match directly on accessionId==query so just compare all
+ // sequences to entry
+ Enumeration e = seqRefs.keys();
+ while (e.hasMoreElements())
+ {
+ Vector sqs = (Vector) seqRefs.get(e.nextElement());
+ if (sqs != null && sqs.size() > 0)
+ {
+ Enumeration sqe = sqs.elements();
+ while (sqe.hasMoreElements())
+ {
+ sequenceMatches.addElement(sqe.nextElement());
+ }
+ }
+ }
+ }
+ // look for corresponding names
+ // this is uniprot specific ?
+ // could be useful to extend this so we try to find any 'significant'
+ // information in common between two sequence objects.
+ /*
+ * DBRefEntry[] entryRefs =
+ * jalview.util.DBRefUtils.selectRefs(entry.getDBRef(), new String[] {
+ * dbSource }); for (int j = 0; j < entry.getName().size(); j++) { String
+ * name = entry.getName().elementAt(j).toString(); if
+ * (seqRefs.containsKey(name)) { Vector seqs = (Vector) seqRefs.get(name);
+ * for (int jj = 0; jj < seqs.size(); jj++) { sequence = (SequenceI)
+ * seqs.elementAt(jj); if (!sequenceMatches.contains(sequence)) {
+ * sequenceMatches.addElement(sequence); } } } }
+ */
+ // sequenceMatches now contains the set of all sequences associated with
+ // the returned db record
+ String entrySeq = entry.getSequenceAsString().toUpperCase();
+ for (int m = 0; m < sequenceMatches.size(); m++)
+ {
+ sequence = (SequenceI) sequenceMatches.elementAt(m);
+ // only update start and end positions and shift features if there are
+ // no existing references
+ // TODO: test for legacy where uniprot or EMBL refs exist but no
+ // mappings are made (but content matches retrieved set)
+ boolean updateRefFrame = sequence.getDBRef() == null
+ || sequence.getDBRef().length == 0;
+ // TODO:
+ // verify sequence against the entry sequence
+
+ String nonGapped = AlignSeq.extractGaps("-. ",
+ sequence.getSequenceAsString()).toUpperCase();
+
+ int absStart = entrySeq.indexOf(nonGapped);
+ int mapStart = entry.getStart();
+ jalview.datamodel.Mapping mp;
+
+ if (absStart == -1)
+ {
+ // Is local sequence contained in dataset sequence?
+ absStart = nonGapped.indexOf(entrySeq);
+ if (absStart == -1)
+ { // verification failed.
+ messages.append(sequence.getName()
+ + " SEQUENCE NOT %100 MATCH \n");
+ continue;
+ }
+ transferred = true;
+ sbuffer.append(sequence.getName() + " HAS " + absStart
+ + " PREFIXED RESIDUES COMPARED TO " + dbSource + "\n");
+ //
+ // + " - ANY SEQUENCE FEATURES"
+ // + " HAVE BEEN ADJUSTED ACCORDINGLY \n");
+ // absStart = 0;
+ // create valid mapping between matching region of local sequence and
+ // the mapped sequence
+ mp = new Mapping(null, new int[] {
+ sequence.getStart() + absStart,
+ sequence.getStart() + absStart + entrySeq.length() - 1 },
+ new int[] { entry.getStart(),
+ entry.getStart() + entrySeq.length() - 1 }, 1, 1);
+ updateRefFrame = false; // mapping is based on current start/end so
+ // don't modify start and end
+ }
+ else
+ {
+ transferred = true;
+ // update start and end of local sequence to place it in entry's
+ // reference frame.
+ // apply identity map map from whole of local sequence to matching
+ // region of database
+ // sequence
+ mp = null; // Mapping.getIdentityMap();
+ // new Mapping(null,
+ // new int[] { absStart+sequence.getStart(),
+ // absStart+sequence.getStart()+entrySeq.length()-1},
+ // new int[] { entry.getStart(), entry.getEnd() }, 1, 1);
+ // relocate local features for updated start
+ if (updateRefFrame)
+ {
+ if (sequence.getSequenceFeatures() != null)
+ {
+ SequenceFeature[] sf = sequence.getSequenceFeatures();
+ int start = sequence.getStart();
+ int end = sequence.getEnd();
+ int startShift = 1 - absStart - start; // how much the features
+ // are
+ // to be shifted by
+ for (int sfi = 0; sfi < sf.length; sfi++)
+ {
+ if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)
+ {
+ // shift feature along by absstart
+ sf[sfi].setBegin(sf[sfi].getBegin() + startShift);
+ sf[sfi].setEnd(sf[sfi].getEnd() + startShift);
+ }
+ }
+ }
+ }
+ }
+
+ System.out.println("Adding dbrefs to " + sequence.getName()
+ + " from " + dbSource + " sequence : " + entry.getName());
+ sequence.transferAnnotation(entry, mp);
+ // unknownSequences.remove(sequence);
+ int absEnd = absStart + nonGapped.length();
+ absStart += 1;
+ if (!trimDatasetSeqs)
+ {
+ // insert full length sequence from record
+ sequence.setSequence(entry.getSequenceAsString());
+ sequence.setStart(entry.getStart());
+ }
+ if (updateRefFrame)
+ {
+ // finally, update local sequence reference frame if we're allowed
+ if (trimDatasetSeqs)
+ {
+ // just fix start/end
+ sequence.setStart(absStart);
+ sequence.setEnd(absEnd);
+ }
+ // search for alignment sequences to update coordinate frame for
+ for (int alsq = 0; alsq < alseqs.length; alsq++)
+ {
+ if (alseqs[alsq].getDatasetSequence() == sequence)
+ {
+ String ngAlsq = AlignSeq.extractGaps("-. ",
+ alseqs[alsq].getSequenceAsString()).toUpperCase();
+ int oldstrt = alseqs[alsq].getStart();
+ alseqs[alsq].setStart(sequence.getSequenceAsString()
+ .toUpperCase().indexOf(ngAlsq)
+ + sequence.getStart());
+ if (oldstrt != alseqs[alsq].getStart())
+ {
+ alseqs[alsq].setEnd(ngAlsq.length()
+ + alseqs[alsq].getStart() - 1);
+ }
+ }
+ }
+ // TODO: search for all other references to this dataset sequence, and
+ // update start/end
+ // TODO: update all AlCodonMappings which involve this alignment
+ // sequence (e.g. Q30167 cdna translation from exon2 product (vamsas
+ // demo)
+ }
+ // and remove it from the rest
+ // TODO: decide if we should remove annotated sequence from set
+ sdataset.remove(sequence);
+ // TODO: should we make a note of sequences that have received new DB
+ // ids, so we can query all enabled DAS servers for them ?
+ }
+ }
+ if (!transferred)
+ {
+ // report the ID/sequence mismatches
+ sbuffer.append(messages);
+ }
+ }
+
+ /**
+ * loop thru and collect additional sequences in Map.
+ *
+ * @param sequencesArray
+ * @return
+ */
+ private SequenceI[] recoverDbSequences(SequenceI[] sequencesArray)
+ {
+ Vector nseq = new Vector();
+ for (int i = 0; sequencesArray != null && i < sequencesArray.length; i++)
+ {
+ nseq.addElement(sequencesArray[i]);
+ DBRefEntry dbr[] = sequencesArray[i].getDBRef();
+ jalview.datamodel.Mapping map = null;
+ for (int r = 0; (dbr != null) && r < dbr.length; r++)
+ {
+ if ((map = dbr[r].getMap()) != null)
+ {
+ if (map.getTo() != null && !nseq.contains(map.getTo()))
+ {
+ nseq.addElement(map.getTo());
+ }
+ }
+ }
+ }
+ if (nseq.size() > 0)
+ {
+ sequencesArray = new SequenceI[nseq.size()];
+ nseq.toArray(sequencesArray);
+ }
+ return sequencesArray;
+ }
+}
diff --git a/src/jalview/ws/DasSequenceFeatureFetcher.java b/src/jalview/ws/DasSequenceFeatureFetcher.java
index bf200ce..345bdd7 100644
--- a/src/jalview/ws/DasSequenceFeatureFetcher.java
+++ b/src/jalview/ws/DasSequenceFeatureFetcher.java
@@ -1,898 +1,926 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws;
-
-import java.net.*;
-import java.util.*;
-
-import javax.swing.*;
-
-import org.biojava.dasobert.das.*;
-import org.biojava.dasobert.das2.*;
-import org.biojava.dasobert.das2.io.*;
-import org.biojava.dasobert.dasregistry.*;
-import org.biojava.dasobert.eventmodel.*;
-import jalview.bin.Cache;
-import jalview.datamodel.*;
-import jalview.gui.*;
-import jalview.util.UrlLink;
-
-/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
- */
-public class DasSequenceFeatureFetcher
-{
- SequenceI[] sequences;
-
- AlignFrame af;
-
- FeatureSettings fsettings;
-
- StringBuffer sbuffer = new StringBuffer();
-
- Vector selectedSources;
-
- boolean cancelled = false;
-
- private void debug(String mesg)
- {
- debug(mesg, null);
- }
-
- private void debug(String mesg, Exception e)
- {
- if (Cache.log != null)
- {
- Cache.log.debug(mesg, e);
- }
- else
- {
- System.err.println(mesg);
- if (e != null)
- {
- e.printStackTrace();
- }
- }
- }
-
- long startTime;
-
- /**
- * Creates a new SequenceFeatureFetcher object. Uses default
- *
- * @param align
- * DOCUMENT ME!
- * @param ap
- * DOCUMENT ME!
- */
- public DasSequenceFeatureFetcher(SequenceI[] sequences,
- FeatureSettings fsettings, Vector selectedSources)
- {
- this(sequences, fsettings, selectedSources, true, true);
- }
-
- public DasSequenceFeatureFetcher(SequenceI[] oursequences,
- FeatureSettings fsettings, Vector ourselectedSources,
- boolean checkDbrefs, boolean promptFetchDbrefs)
- {
- this.selectedSources = new Vector();
- Enumeration sources = ourselectedSources.elements();
- // filter both sequences and sources to eliminate duplicates
- while (sources.hasMoreElements())
- {
- Object src = sources.nextElement();
- if (!selectedSources.contains(src))
- {
- selectedSources.addElement(src);
- }
- ;
- }
- Vector sqs = new Vector();
- for (int i = 0; i < oursequences.length; i++)
- {
- if (!sqs.contains(oursequences[i]))
- {
- sqs.addElement(oursequences[i]);
- }
- }
- sequences = new SequenceI[sqs.size()];
- for (int i = 0; i < sequences.length; i++)
- {
- sequences[i] = (SequenceI) sqs.elementAt(i);
- }
- if (fsettings != null)
- {
- this.fsettings = fsettings;
- this.af = fsettings.af;
- af.setShowSeqFeatures(true);
- }
- int uniprotCount = 0;
- for (int i = 0; i < selectedSources.size(); i++)
- {
- DasSource source = (DasSource) selectedSources.elementAt(i);
- DasCoordinateSystem[] coords = source.getCoordinateSystem();
- for (int c = 0; c < coords.length; c++)
- {
- // TODO: match UniProt coord system canonically (?) - does
- // UniProt==uniprot==UNIPROT ?
- if (coords[c].getName().indexOf("UniProt") > -1)
- {
- uniprotCount++;
- break;
- }
- }
- }
-
- int refCount = 0;
- for (int i = 0; i < sequences.length; i++)
- {
- DBRefEntry[] dbref = sequences[i].getDBRef();
- if (dbref != null)
- {
- for (int j = 0; j < dbref.length; j++)
- {
- if (dbref[j].getSource().equals(
- jalview.datamodel.DBRefSource.UNIPROT))
- {
- refCount++;
- break;
- }
- }
- }
- }
-
- if (checkDbrefs && refCount < sequences.length && uniprotCount > 0)
- {
-
- int reply = JOptionPane.YES_OPTION;
- if (promptFetchDbrefs)
- {
- reply = JOptionPane
- .showInternalConfirmDialog(
- Desktop.desktop,
- "Do you want Jalview to find\n"
- + "Uniprot Accession ids for given sequence names?",
- "Find Uniprot Accession Ids",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- }
-
- if (reply == JOptionPane.YES_OPTION)
- {
- Thread thread = new Thread(new FetchDBRefs());
- thread.start();
- }
- else
- {
- startFetching();
- }
- }
- else
- {
- startFetching();
- }
-
- }
-
- class FetchDBRefs implements Runnable
- {
- public void run()
- {
- new DBRefFetcher(sequences, af).fetchDBRefs(true);
- startFetching();
- }
- }
-
- /**
- * Spawns a number of dasobert Fetcher threads to add features to sequences in
- * the dataset
- */
- void startFetching()
- {
- cancelled = false;
- startTime = System.currentTimeMillis();
- if (af != null)
- {
- af.setProgressBar("Fetching DAS Sequence Features", startTime);
- }
-
- if (selectedSources == null || selectedSources.size() == 0)
- {
- try
- {
- DasSource[] sources = new jalview.gui.DasSourceBrowser()
- .getDASSource();
-
- String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
- "uniprot");
- StringTokenizer st = new StringTokenizer(active, "\t");
- selectedSources = new Vector();
- String token;
- while (st.hasMoreTokens())
- {
- token = st.nextToken();
- for (int i = 0; i < sources.length; i++)
- {
- if (sources[i].getNickname().equals(token))
- {
- selectedSources.addElement(sources[i]);
- break;
- }
- }
- }
- } catch (Exception ex)
- {
- debug("Exception whilst setting default feature sources from registry and local preferences.",
- ex);
- }
- }
-
- if (selectedSources == null || selectedSources.size() == 0)
- {
- System.out.println("No DAS Sources active");
- cancelled = true;
- setGuiNoDassourceActive();
- return;
- }
-
- sourcesRemaining = selectedSources.size();
- // Now sending requests one at a time to each server
- for (int sourceIndex = 0; sourceIndex < selectedSources.size()
- && !cancelled; sourceIndex++)
- {
- DasSource dasSource = (DasSource) selectedSources
- .elementAt(sourceIndex);
-
- nextSequence(dasSource, sequences[0]);
- }
- }
-
- private void setGuiNoDassourceActive()
- {
-
- if (af != null)
- {
- af.setProgressBar("No DAS Sources Active", startTime);
- }
- if (getFeatSettings() != null)
- {
- fsettings.noDasSourceActive();
- }
- }
-
- /**
- * Update our fsettings dialog reference if we didn't have one when we were
- * first initialised.
- *
- * @return fsettings
- */
- private FeatureSettings getFeatSettings()
- {
- if (fsettings == null)
- {
- if (af != null)
- {
- fsettings = af.featureSettings;
- }
- }
- return fsettings;
- }
-
- public void cancel()
- {
- if (af != null)
- {
- af.setProgressBar("DAS Feature Fetching Cancelled", startTime);
- }
- cancelled = true;
- }
-
- int sourcesRemaining = 0;
-
- void responseComplete(DasSource dasSource, SequenceI seq)
- {
- if (seq != null)
- {
- for (int seqIndex = 0; seqIndex < sequences.length - 1 && !cancelled; seqIndex++)
- {
- if (sequences[seqIndex] == seq)
- {
- nextSequence(dasSource, sequences[++seqIndex]);
- return;
- }
- }
- }
-
- sourcesRemaining--;
-
- if (sourcesRemaining == 0)
- {
- System.err.println("Fetching Complete.");
- setGuiFetchComplete();
- }
-
- }
-
- private void setGuiFetchComplete()
- {
-
- if (!cancelled && af != null)
- {
- // only update the progress bar if we've completed the fetch normally
- af.setProgressBar("DAS Feature Fetching Complete", startTime);
- }
-
- if (af != null && af.featureSettings != null)
- {
- af.featureSettings.setTableData();
- }
-
- if (getFeatSettings() != null)
- {
- fsettings.complete();
- }
- }
-
- void featuresAdded(SequenceI seq)
- {
- if (af == null)
- {
- // no gui to update with features.
- return;
- }
- af.getFeatureRenderer().featuresAdded();
-
- int start = af.getViewport().getStartSeq();
- int end = af.getViewport().getEndSeq();
- int index;
- for (index = start; index < end; index++)
- {
- if (seq == af.getViewport().getAlignment().getSequenceAt(index)
- .getDatasetSequence())
- {
- af.alignPanel.paintAlignment(true);
- break;
- }
- }
- }
-
- void nextSequence(DasSource dasSource, SequenceI seq)
- {
- if (cancelled)
- return;
- DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
- seq.getDBRef(), new String[]
- {
- // jalview.datamodel.DBRefSource.PDB,
- jalview.datamodel.DBRefSource.UNIPROT,
- // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord
- // sys sources
- });
- // TODO: minimal list of DAS queries to make by querying with untyped ID if
- // distinct from any typed IDs
-
- boolean dasCoordSysFound = false;
-
- if (uprefs != null)
- {
- // do any of these ids match the source's coordinate system ?
- for (int j = 0; !dasCoordSysFound && j < uprefs.length; j++)
- {
- DasCoordinateSystem cs[] = dasSource.getCoordinateSystem();
-
- for (int csIndex = 0; csIndex < cs.length && !dasCoordSysFound; csIndex++)
- {
- if (cs.length > 0
- && jalview.util.DBRefUtils.isDasCoordinateSystem(
- cs[csIndex].getName(), uprefs[j]))
- {
- debug("Launched fetcher for coordinate system "
- + cs[0].getName());
- // Will have to pass any mapping information to the fetcher
- // - the start/end for the DBRefEntry may not be the same as the
- // sequence's start/end
-
- System.out.println(seq.getName() + " "
- + (seq.getDatasetSequence() == null) + " "
- + dasSource.getUrl());
-
- dasCoordSysFound = true; // break's out of the loop
- createFeatureFetcher(seq, dasSource, uprefs[j]);
- }
- else
- System.out.println("IGNORE " + cs[csIndex].getName());
- }
- }
- }
-
- if (!dasCoordSysFound)
- {
- String id = null;
- // try and use the name as the sequence id
- if (seq.getName().indexOf("|") > -1)
- {
- id = seq.getName().substring(seq.getName().lastIndexOf("|") + 1);
- if (id.trim().length() < 4)
- {
- // hack - we regard a significant ID as being at least 4
- // non-whitespace characters
- id = seq.getName().substring(0, seq.getName().lastIndexOf("|"));
- if (id.indexOf("|") > -1)
- {
- id = id.substring(id.lastIndexOf("|") + 1);
- }
- }
- }
- else
- {
- id = seq.getName();
- }
- if (id != null)
- {
- // Should try to call a general feature fetcher that
- // queries many sources with name to discover applicable ID references
- createFeatureFetcher(seq, dasSource, id);
- }
- }
-
- }
-
- /**
- * fetch and add das features to a sequence using the given source URL and
- * compatible DbRef id. new features are mapped using the DbRef mapping to the
- * local coordinate system.
- *
- * @param seq
- * @param SourceUrl
- * @param dbref
- */
- protected void createFeatureFetcher(final SequenceI seq,
- final DasSource dasSource, final DBRefEntry dbref)
- {
-
- // ////////////
- // / fetch DAS features
- final Das1Source source = new Das1Source();
- source.setUrl(dasSource.getUrl());
- source.setNickname(dasSource.getNickname());
- if (dbref == null || dbref.getAccessionId() == null
- || dbref.getAccessionId().length() < 1)
- {
- responseComplete(dasSource, seq); // reduce thread count anyhow
- return;
- }
- debug("new Das Feature Fetcher for " + dbref.getSource() + ":"
- + dbref.getAccessionId() + " querying " + dasSource.getUrl());
- FeatureThread fetcher = new FeatureThread(dbref.getAccessionId()
- // + ":" + start + "," + end,
- , source);
-
- fetcher.addFeatureListener(new FeatureListener()
- {
- public void comeBackLater(FeatureEvent e)
- {
- responseComplete(dasSource, seq);
- debug("das source " + e.getSource().getNickname()
- + " asked us to come back in " + e.getComeBackLater()
- + " secs.");
- }
-
- public void newFeatures(FeatureEvent e)
- {
-
- Das1Source ds = e.getSource();
-
- Map[] features = e.getFeatures();
- // add features to sequence
- debug("das source " + ds.getUrl() + " returned " + features.length
- + " features");
-
- if (features.length > 0)
- {
- for (int i = 0; i < features.length; i++)
- {
- // standard DAS feature-> jalview sequence feature transformation
- SequenceFeature f = newSequenceFeature(features[i],
- source.getNickname());
- if (!parseSeqFeature(seq, f, features[i], source))
- {
- if (dbref.getMap() != null && f.getBegin() > 0
- && f.getEnd() > 0)
- {
- debug("mapping from " + f.getBegin() + " - " + f.getEnd());
- SequenceFeature vf[] = null;
-
- try
- {
- vf = dbref.getMap().locateFeature(f);
- } catch (Exception ex)
- {
- Cache.log
- .info("Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss at jalview.org.");
- Cache.log.info("Mapping feature from " + f.getBegin()
- + " to " + f.getEnd() + " in dbref "
- + dbref.getAccessionId() + " in "
- + dbref.getSource());
- Cache.log.info("using das Source " + ds.getUrl());
- Cache.log.info("Exception", ex);
- }
-
- if (vf != null)
- {
- for (int v = 0; v < vf.length; v++)
- {
- debug("mapping to " + v + ": " + vf[v].getBegin()
- + " - " + vf[v].getEnd());
- seq.addSequenceFeature(vf[v]);
- }
- }
- }
- else
- {
- seq.addSequenceFeature(f);
- }
- }
- }
- featuresAdded(seq);
- }
- else
- {
- // System.out.println("No features found for " + seq.getName()
- // + " from: " + e.getDasSource().getNickname());
- }
- responseComplete(dasSource, seq);
-
- }
- }
-
- );
-
- fetcher.start();
- }
-
- protected void createFeatureFetcher(final SequenceI seq,
- final DasSource dasSource, String id)
- {
- // ////////////
- // / fetch DAS features
- final Das1Source source = new Das1Source();
- source.setUrl(dasSource.getUrl());
- source.setNickname(dasSource.getNickname());
-
- if (id != null)
- {
- id = id.trim();
- }
- if (id != null && id.length() > 0)
- {
- debug("new Das Feature Fetcher for " + id + " querying "
- + dasSource.getUrl());
- FeatureThread fetcher = new FeatureThread(id
- // + ":" + start + "," + end,
- , source);
-
- fetcher.addFeatureListener(new FeatureListener()
- {
- public void comeBackLater(FeatureEvent e)
- {
- responseComplete(dasSource, seq);
- debug("das source " + e.getSource().getNickname()
- + " asked us to come back in " + e.getComeBackLater()
- + " secs.");
- }
-
- public void newFeatures(FeatureEvent e)
- {
-
- Das1Source ds = e.getSource();
-
- Map[] features = e.getFeatures();
- // add features to sequence
- debug("das source " + ds.getUrl() + " returned "
- + features.length + " features");
-
- if (features.length > 0)
- {
- for (int i = 0; i < features.length; i++)
- {
- // standard DAS feature-> jalview sequence feature transformation
- SequenceFeature f = newSequenceFeature(features[i],
- source.getNickname());
- if (!parseSeqFeature(seq, f, features[i], source))
- {
- // just add as a simple sequence feature
- seq.addSequenceFeature(f);
- }
- }
-
- featuresAdded(seq);
- }
- else
- {
- // System.out.println("No features found for " + seq.getName()
- // + " from: " + e.getDasSource().getNickname());
- }
- responseComplete(dasSource, seq);
-
- }
- }
-
- );
-
- fetcher.start();
- }
- else
- {
- // invalid fetch - indicate it is finished.
- debug("Skipping empty ID for querying " + dasSource.getUrl());
- responseComplete(dasSource, seq);
- }
- }
-
- /**
- * examine the given sequence feature to determine if it should actually be
- * turned into sequence annotation or database cross references rather than a
- * simple sequence feature.
- *
- * @param seq
- * the sequence to annotate
- * @param f
- * the jalview sequence feature generated from the DAS feature
- * @param map
- * the sequence feature attributes
- * @param source
- * the source that emitted the feature
- * @return true if feature was consumed as another kind of annotation.
- */
- protected boolean parseSeqFeature(SequenceI seq, SequenceFeature f,
- Map map, Das1Source source)
- {
- SequenceI mseq = seq;
- while (seq.getDatasetSequence() != null)
- {
- seq = seq.getDatasetSequence();
- }
- if (f.getType() != null)
- {
- String type = f.getType();
- if (type.equalsIgnoreCase("protein_name"))
- {
- // parse name onto the alignment sequence or the dataset sequence.
- if (seq.getDescription() == null
- || seq.getDescription().trim().length() == 0)
- {
- // could look at the note series to pick out the first long name, for
- // the moment just use the whole description string
- seq.setDescription(f.getDescription());
- }
- if (mseq.getDescription() == null
- || mseq.getDescription().trim().length() == 0)
- {
- // could look at the note series to pick out the first long name, for
- // the moment just use the whole description string
- mseq.setDescription(f.getDescription());
- }
- return true;
- }
- // check if source has biosapiens or other sequence ontology label
- if (type.equalsIgnoreCase("DBXREF") || type.equalsIgnoreCase("DBREF"))
- {
- // try to parse the accession out
-
- DBRefEntry dbr = new DBRefEntry();
- dbr.setVersion(source.getNickname());
- StringTokenizer st = new StringTokenizer(f.getDescription(), ":");
- if (st.hasMoreTokens())
- {
- dbr.setSource(st.nextToken());
- }
- if (st.hasMoreTokens())
- {
- dbr.setAccessionId(st.nextToken());
- }
- seq.addDBRef(dbr);
-
- if (f.links != null && f.links.size() > 0)
- {
- // feature is also appended to enable links to be seen.
- // TODO: consider extending dbrefs to have their own links ?
- // TODO: new feature: extract dbref links from DAS servers and add the
- // URL pattern to the list of DB name associated links in the user's
- // preferences ?
- // for the moment - just fix up the existing feature so it displays
- // correctly.
- // f.setType(dbr.getSource());
- // f.setDescription();
- f.setValue("linkonly", Boolean.TRUE);
- // f.setDescription("");
- Vector newlinks = new Vector();
- Enumeration it = f.links.elements();
- while (it.hasMoreElements())
- {
- String elm;
- UrlLink urllink = new UrlLink(elm = (String) it.nextElement());
- if (urllink.isValid())
- {
- urllink.setLabel(f.getDescription());
- newlinks.addElement(urllink.toString());
- }
- else
- {
- // couldn't parse the link properly. Keep it anyway - just in
- // case.
- debug("couldn't parse link string - " + elm);
- newlinks.addElement(elm);
- }
- }
- f.links = newlinks;
- seq.addSequenceFeature(f);
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * creates a jalview sequence feature from a das feature document
- *
- * @param dasfeature
- * @return sequence feature object created using dasfeature information
- */
- SequenceFeature newSequenceFeature(Map dasfeature, String nickname)
- {
- if (dasfeature == null)
- {
- return null;
- }
- try
- {
- /**
- * Different qNames for a DAS Feature - are string keys to the HashMaps in
- * features "METHOD") || qName.equals("TYPE") || qName.equals("START") ||
- * qName.equals("END") || qName.equals("NOTE") || qName.equals("LINK") ||
- * qName.equals("SCORE")
- */
- String desc = new String();
- if (dasfeature.containsKey("NOTE"))
- {
- desc += (String) dasfeature.get("NOTE");
- }
-
- int start = 0, end = 0;
- float score = 0f;
-
- try
- {
- start = Integer.parseInt(dasfeature.get("START").toString());
- } catch (Exception ex)
- {
- }
- try
- {
- end = Integer.parseInt(dasfeature.get("END").toString());
- } catch (Exception ex)
- {
- }
- try
- {
- Object scr = dasfeature.get("SCORE");
- if (scr != null)
- {
- score = (float) Double.parseDouble(scr.toString());
-
- }
- } catch (Exception ex)
- {
- }
-
- SequenceFeature f = new SequenceFeature(
- (String) dasfeature.get("TYPE"), desc, start, end, score,
- nickname);
-
- if (dasfeature.containsKey("LINK"))
- {
- // Do not put feature extent in link text for non-positional features
- if (f.begin == 0 && f.end == 0)
- {
- f.addLink(f.getType() + "|" + dasfeature.get("LINK"));
- }
- else
- {
- f.addLink(f.getType() + " " + f.begin + "_" + f.end + "|"
- + dasfeature.get("LINK"));
- }
- }
-
- return f;
- } catch (Exception e)
- {
- System.out.println("ERRR " + e);
- e.printStackTrace();
- System.out.println("############");
- debug("Failed to parse " + dasfeature.toString(), e);
- return null;
- }
- }
-
- /**
- * query the default DAS Source Registry for sources. Uses value of jalview
- * property DAS_REGISTRY_URL and the DasSourceBrowser.DEFAULT_REGISTRY if that
- * doesn't exist.
- *
- * @return list of sources
- */
- public static DasSource[] getDASSources()
- {
-
- String registryURL = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
- DasSourceBrowser.DEFAULT_REGISTRY);
- return getDASSources(registryURL);
- }
-
- /**
- * query the given URL for DasSources.
- *
- * @param registryURL
- * return sources from registryURL
- */
- public static DasSource[] getDASSources(String registryURL)
- {
- DasSourceReaderImpl reader = new DasSourceReaderImpl();
-
- try
- {
- URL url = new URL(registryURL);
-
- DasSource[] sources = reader.readDasSource(url);
-
- List das1sources = new ArrayList();
- for (int i = 0; i < sources.length; i++)
- {
- DasSource ds = sources[i];
- if (ds instanceof Das2Source)
- {
- Das2Source d2s = (Das2Source) ds;
- if (d2s.hasDas1Capabilities())
- {
- Das1Source d1s = DasSourceConverter.toDas1Source(d2s);
- das1sources.add(d1s);
- }
-
- }
- else if (ds instanceof Das1Source)
- {
- das1sources.add((Das1Source) ds);
- }
- }
-
- return (Das1Source[]) das1sources.toArray(new Das1Source[das1sources
- .size()]);
- } catch (Exception ex)
- {
- System.err.println("Failed to contact DAS1 registry at "
- + registryURL);
- ex.printStackTrace();
- return null;
- }
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws;
+
+import jalview.bin.Cache;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.FeatureSettings;
+import jalview.util.MessageManager;
+import jalview.util.UrlLink;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JOptionPane;
+
+import org.biodas.jdas.client.FeaturesClient;
+import org.biodas.jdas.client.adapters.features.DasGFFAdapter;
+import org.biodas.jdas.client.adapters.features.DasGFFAdapter.GFFAdapter;
+import org.biodas.jdas.client.threads.FeaturesClientMultipleSources;
+import org.biodas.jdas.schema.features.ERRORSEGMENT;
+import org.biodas.jdas.schema.features.FEATURE;
+import org.biodas.jdas.schema.features.LINK;
+import org.biodas.jdas.schema.features.SEGMENT;
+import org.biodas.jdas.schema.features.TYPE;
+import org.biodas.jdas.schema.features.UNKNOWNFEATURE;
+import org.biodas.jdas.schema.features.UNKNOWNSEGMENT;
+import org.biodas.jdas.schema.sources.COORDINATES;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class DasSequenceFeatureFetcher
+{
+ SequenceI[] sequences;
+
+ AlignFrame af;
+
+ FeatureSettings fsettings;
+
+ StringBuffer sbuffer = new StringBuffer();
+
+ List<jalviewSourceI> selectedSources;
+
+ boolean cancelled = false;
+
+ private void debug(String mesg)
+ {
+ debug(mesg, null);
+ }
+
+ private void debug(String mesg, Exception e)
+ {
+ if (Cache.log != null)
+ {
+ Cache.log.debug(mesg, e);
+ }
+ else
+ {
+ System.err.println(mesg);
+ if (e != null)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ long startTime;
+
+ private DasSourceRegistryI sourceRegistry;
+
+ private boolean useJDASMultiThread = true;
+
+ /**
+ * Creates a new SequenceFeatureFetcher object. Uses default
+ *
+ * @param align
+ * DOCUMENT ME!
+ * @param ap
+ * DOCUMENT ME!
+ */
+ public DasSequenceFeatureFetcher(SequenceI[] sequences,
+ FeatureSettings fsettings, Vector selectedSources)
+ {
+ this(sequences, fsettings, selectedSources, true, true, true);
+ }
+
+ public DasSequenceFeatureFetcher(SequenceI[] oursequences,
+ FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,
+ boolean checkDbrefs, boolean promptFetchDbrefs)
+ {
+ this(oursequences, fsettings, selectedSources2, checkDbrefs,
+ promptFetchDbrefs, true);
+ }
+
+ public DasSequenceFeatureFetcher(SequenceI[] oursequences,
+ FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,
+ boolean checkDbrefs, boolean promptFetchDbrefs,
+ boolean useJDasMultiThread)
+ {
+ this.useJDASMultiThread = useJDasMultiThread;
+ this.selectedSources = new ArrayList<jalviewSourceI>();
+ // filter both sequences and sources to eliminate duplicates
+ for (jalviewSourceI src : selectedSources2)
+ {
+ if (!selectedSources.contains(src))
+ {
+ selectedSources.add(src);
+ }
+ ;
+ }
+ Vector sqs = new Vector();
+ for (int i = 0; i < oursequences.length; i++)
+ {
+ if (!sqs.contains(oursequences[i]))
+ {
+ sqs.addElement(oursequences[i]);
+ }
+ }
+ sequences = new SequenceI[sqs.size()];
+ for (int i = 0; i < sequences.length; i++)
+ {
+ sequences[i] = (SequenceI) sqs.elementAt(i);
+ }
+ if (fsettings != null)
+ {
+ this.fsettings = fsettings;
+ this.af = fsettings.af;
+ af.setShowSeqFeatures(true);
+ }
+ int uniprotCount = 0;
+ for (jalviewSourceI source : selectedSources)
+ {
+ for (COORDINATES coords : source.getVersion().getCOORDINATES())
+ {
+ // TODO: match UniProt coord system canonically (?) - does
+ // UniProt==uniprot==UNIPROT ?
+ if (coords.getAuthority().toLowerCase().equals("uniprot"))
+ {
+ uniprotCount++;
+ break;
+ }
+ }
+ }
+
+ int refCount = 0;
+ for (int i = 0; i < sequences.length; i++)
+ {
+ DBRefEntry[] dbref = sequences[i].getDBRef();
+ if (dbref != null)
+ {
+ for (int j = 0; j < dbref.length; j++)
+ {
+ if (dbref[j].getSource().equals(
+ jalview.datamodel.DBRefSource.UNIPROT))
+ {
+ refCount++;
+ break;
+ }
+ }
+ }
+ }
+
+ if (checkDbrefs && refCount < sequences.length && uniprotCount > 0)
+ {
+
+ int reply = JOptionPane.YES_OPTION;
+ if (promptFetchDbrefs)
+ {
+ reply = JOptionPane
+ .showInternalConfirmDialog(
+ Desktop.desktop,
+ MessageManager
+ .getString("info.you_want_jalview_to_find_uniprot_accessions"),
+ MessageManager
+ .getString("label.find_uniprot_accession_ids"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+ }
+
+ if (reply == JOptionPane.YES_OPTION)
+ {
+ Thread thread = new Thread(new FetchDBRefs());
+ thread.start();
+ }
+ else
+ {
+ _startFetching();
+ }
+ }
+ else
+ {
+ _startFetching();
+ }
+
+ }
+
+ private void _startFetching()
+ {
+ running = true;
+ new Thread(new FetchSeqFeatures()).start();
+ }
+
+ class FetchSeqFeatures implements Runnable
+ {
+ public void run()
+ {
+ startFetching();
+ setGuiFetchComplete();
+ }
+ }
+
+ class FetchDBRefs implements Runnable
+ {
+ public void run()
+ {
+ running = true;
+ new DBRefFetcher(sequences, af).fetchDBRefs(true);
+ startFetching();
+ setGuiFetchComplete();
+ }
+ }
+
+ /**
+ * Spawns Fetcher threads to add features to sequences in the dataset
+ */
+ void startFetching()
+ {
+ running = true;
+ cancelled = false;
+ startTime = System.currentTimeMillis();
+ if (af != null)
+ {
+ af.setProgressBar(MessageManager
+ .getString("status.fetching_das_sequence_features"),
+ startTime);
+ }
+ if (sourceRegistry == null)
+ {
+ sourceRegistry = Cache.getDasSourceRegistry();
+ }
+ if (selectedSources == null || selectedSources.size() == 0)
+ {
+ try
+ {
+ jalviewSourceI[] sources = sourceRegistry.getSources().toArray(
+ new jalviewSourceI[0]);
+ String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
+ "uniprot");
+ StringTokenizer st = new StringTokenizer(active, "\t");
+ selectedSources = new Vector();
+ String token;
+ while (st.hasMoreTokens())
+ {
+ token = st.nextToken();
+ for (int i = 0; i < sources.length; i++)
+ {
+ if (sources[i].getTitle().equals(token))
+ {
+ selectedSources.add(sources[i]);
+ break;
+ }
+ }
+ }
+ } catch (Exception ex)
+ {
+ debug("Exception whilst setting default feature sources from registry and local preferences.",
+ ex);
+ }
+ }
+
+ if (selectedSources == null || selectedSources.size() == 0)
+ {
+ System.out.println("No DAS Sources active");
+ cancelled = true;
+ setGuiNoDassourceActive();
+ return;
+ }
+
+ sourcesRemaining = selectedSources.size();
+ FeaturesClientMultipleSources fc = new FeaturesClientMultipleSources();
+ fc.setConnProps(sourceRegistry.getSessionHandler());
+ // Now sending requests one at a time to each server
+ ArrayList<jalviewSourceI> srcobj = new ArrayList<jalviewSourceI>();
+ ArrayList<String> src = new ArrayList<String>();
+ List<List<String>> ids = new ArrayList<List<String>>();
+ List<List<DBRefEntry>> idobj = new ArrayList<List<DBRefEntry>>();
+ List<Map<String, SequenceI>> sqset = new ArrayList<Map<String, SequenceI>>();
+ for (jalviewSourceI _sr : selectedSources)
+ {
+
+ Map<String, SequenceI> slist = new HashMap<String, SequenceI>();
+ List<DBRefEntry> idob = new ArrayList<DBRefEntry>();
+ List<String> qset = new ArrayList<String>();
+
+ for (SequenceI seq : sequences)
+ {
+ Object[] idset = nextSequence(_sr, seq);
+ if (idset != null)
+ {
+ List<DBRefEntry> _idob = (List<DBRefEntry>) idset[0];
+ List<String> _qset = (List<String>) idset[1];
+ if (_idob.size() > 0)
+ {
+ // add sequence's ref for each id derived from it
+ // (space inefficient, but most unambiguous)
+ // could replace with hash with _qset values as keys.
+ Iterator<DBRefEntry> dbobj = _idob.iterator();
+ for (String q : _qset)
+ {
+ SequenceI osq = slist.get(q);
+ DBRefEntry dr = dbobj.next();
+ if (osq != null && osq != seq)
+ {
+ // skip - non-canonical query
+ }
+ else
+ {
+ idob.add(dr);
+ qset.add(q);
+ slist.put(q, seq);
+ }
+ }
+ }
+ }
+ }
+ if (idob.size() > 0)
+ {
+ srcobj.add(_sr);
+ src.add(_sr.getSourceURL());
+ ids.add(qset);
+ idobj.add(idob);
+ sqset.add(slist);
+ }
+ }
+ Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();
+ Map<String, Map<List<String>, DasGFFAdapter>> results = new HashMap<String, Map<List<String>, DasGFFAdapter>>();
+ if (!useJDASMultiThread)
+ {
+ Iterator<String> sources = src.iterator();
+ // iterate over each query for each source and do each one individually
+ for (List<String> idl : ids)
+ {
+ String source = sources.next();
+ FeaturesClient featuresc = new FeaturesClient(sourceRegistry
+ .getSessionHandler().getConnectionPropertyProviderFor(
+ source));
+ for (String id : idl)
+ {
+ List<String> qid = Arrays.asList(new String[] { id });
+ try
+ {
+ DasGFFAdapter dga = featuresc.fetchData(source, qid);
+ Map<List<String>, DasGFFAdapter> ers = results.get(source);
+ if (ers == null)
+ {
+ results.put(source,
+ ers = new HashMap<List<String>, DasGFFAdapter>());
+ }
+ ers.put(qid, dga);
+ } catch (Exception ex)
+ {
+ Map<List<String>, Exception> ers = errors.get(source);
+ if (ers == null)
+ {
+ errors.put(source,
+ ers = new HashMap<List<String>, Exception>());
+ }
+ ers.put(qid, ex);
+ }
+ }
+ }
+ }
+ else
+ {
+ // pass them all at once
+ fc.fetchData(src, ids, false, results, errors);
+ fc.shutDown();
+ while (!fc.isTerminated())
+ {
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException x)
+ {
+
+ }
+ }
+ }
+ Iterator<List<String>> idset = ids.iterator();
+ Iterator<List<DBRefEntry>> idobjset = idobj.iterator();
+ Iterator<Map<String, SequenceI>> seqset = sqset.iterator();
+ for (jalviewSourceI source : srcobj)
+ {
+ processResponse(seqset.next(), source, idset.next(), idobjset.next(),
+ results.get(source.getSourceURL()),
+ errors.get(source.getSourceURL()));
+ }
+ }
+
+ private void processResponse(Map<String, SequenceI> sequencemap,
+ jalviewSourceI jvsource, List<String> ids,
+ List<DBRefEntry> idobj, Map<List<String>, DasGFFAdapter> results,
+ Map<List<String>, Exception> errors)
+ {
+ Set<SequenceI> sequences = new HashSet<SequenceI>();
+ String source = jvsource.getSourceURL();
+ // process features
+ DasGFFAdapter result = (results == null) ? null : results.get(ids);
+ Exception error = (errors == null) ? null : errors.get(ids);
+ if (result == null)
+ {
+ debug("das source " + source + " could not be contacted. "
+ + (error == null ? "" : error.toString()));
+ }
+ else
+ {
+
+ GFFAdapter gff = result.getGFF();
+ List<SEGMENT> segments = gff.getSegments();
+ List<ERRORSEGMENT> errorsegs = gff.getErrorSegments();
+ List<UNKNOWNFEATURE> unkfeats = gff.getUnknownFeatures();
+ List<UNKNOWNSEGMENT> unksegs = gff.getUnknownSegments();
+ debug("das source " + source + " returned " + gff.getTotal()
+ + " responses. " + (errorsegs != null ? errorsegs.size() : 0)
+ + " were incorrect segment queries, "
+ + (unkfeats != null ? unkfeats.size() : 0)
+ + " were unknown features "
+ + (unksegs != null ? unksegs.size() : 0)
+ + " were unknown segments and "
+ + (segments != null ? segments.size() : 0)
+ + " were segment responses.");
+ Iterator<DBRefEntry> dbr = idobj.iterator();
+ if (segments != null)
+ {
+ for (SEGMENT seg : segments)
+ {
+ String id = seg.getId();
+ if (ids.indexOf(id) == -1)
+ {
+ id = id.toUpperCase();
+ }
+ DBRefEntry dbref = idobj.get(ids.indexOf(id));
+ SequenceI sequence = sequencemap.get(id);
+ boolean added = false;
+ sequences.add(sequence);
+
+ for (FEATURE feat : seg.getFEATURE())
+ {
+ // standard DAS feature-> jalview sequence feature transformation
+ SequenceFeature f = newSequenceFeature(feat,
+ jvsource.getTitle());
+ if (!parseSeqFeature(sequence, f, feat, jvsource))
+ {
+ if (dbref.getMap() != null && f.getBegin() > 0
+ && f.getEnd() > 0)
+ {
+ debug("mapping from " + f.getBegin() + " - " + f.getEnd());
+ SequenceFeature vf[] = null;
+
+ try
+ {
+ vf = dbref.getMap().locateFeature(f);
+ } catch (Exception ex)
+ {
+ Cache.log
+ .warn("Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss at jalview.org.");
+ Cache.log.warn("Mapping feature from " + f.getBegin()
+ + " to " + f.getEnd() + " in dbref "
+ + dbref.getAccessionId() + " in "
+ + dbref.getSource());
+ Cache.log.warn("using das Source " + source);
+ Cache.log.warn("Exception", ex);
+ }
+
+ if (vf != null)
+ {
+ for (int v = 0; v < vf.length; v++)
+ {
+ debug("mapping to " + v + ": " + vf[v].getBegin()
+ + " - " + vf[v].getEnd());
+ sequence.addSequenceFeature(vf[v]);
+ }
+ }
+ }
+ else
+ {
+ sequence.addSequenceFeature(f);
+ }
+ }
+ }
+ }
+ featuresAdded(sequences);
+ }
+ else
+ {
+ // System.out.println("No features found for " + seq.getName()
+ // + " from: " + e.getDasSource().getNickname());
+ }
+ }
+ }
+
+ private void setGuiNoDassourceActive()
+ {
+
+ if (af != null)
+ {
+ af.setProgressBar(
+ MessageManager.getString("status.no_das_sources_active"),
+ startTime);
+ }
+ if (getFeatSettings() != null)
+ {
+ fsettings.noDasSourceActive();
+ }
+ }
+
+ /**
+ * Update our fsettings dialog reference if we didn't have one when we were
+ * first initialised.
+ *
+ * @return fsettings
+ */
+ private FeatureSettings getFeatSettings()
+ {
+ if (fsettings == null)
+ {
+ if (af != null)
+ {
+ fsettings = af.featureSettings;
+ }
+ }
+ return fsettings;
+ }
+
+ public void cancel()
+ {
+ if (af != null)
+ {
+ af.setProgressBar(MessageManager
+ .getString("status.das_feature_fetching_cancelled"),
+ startTime);
+ }
+ cancelled = true;
+ }
+
+ int sourcesRemaining = 0;
+
+ private boolean running = false;
+
+ private void setGuiFetchComplete()
+ {
+ running = false;
+ if (!cancelled && af != null)
+ {
+ // only update the progress bar if we've completed the fetch normally
+ af.setProgressBar(MessageManager
+ .getString("status.das_feature_fetching_complete"), startTime);
+ }
+
+ if (af != null && af.featureSettings != null)
+ {
+ af.featureSettings.discoverAllFeatureData();
+ }
+
+ if (getFeatSettings() != null)
+ {
+ fsettings.complete();
+ }
+ }
+
+ void featuresAdded(Set<SequenceI> seqs)
+ {
+ if (af == null)
+ {
+ // no gui to update with features.
+ return;
+ }
+ af.getFeatureRenderer().featuresAdded();
+
+ int start = af.getViewport().getStartSeq();
+ int end = af.getViewport().getEndSeq();
+ int index;
+ for (index = start; index < end; index++)
+ {
+ for (SequenceI seq : seqs)
+ {
+ if (seq == af.getViewport().getAlignment().getSequenceAt(index)
+ .getDatasetSequence())
+ {
+ af.alignPanel.paintAlignment(true);
+ index = end;
+ break;
+ }
+ }
+ }
+ }
+
+ Object[] nextSequence(jalviewSourceI dasSource, SequenceI seq)
+ {
+ if (cancelled)
+ {
+ return null;
+ }
+ DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
+ seq.getDBRef(), new String[] {
+ // jalview.datamodel.DBRefSource.PDB,
+ jalview.datamodel.DBRefSource.UNIPROT,
+ // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord
+ // sys sources
+ });
+ // TODO: minimal list of DAS queries to make by querying with untyped ID if
+ // distinct from any typed IDs
+
+ List<DBRefEntry> ids = new ArrayList<DBRefEntry>();
+ List<String> qstring = new ArrayList<String>();
+ boolean dasCoordSysFound = false;
+
+ if (uprefs != null)
+ {
+ // do any of these ids match the source's coordinate system ?
+ for (int j = 0; !dasCoordSysFound && j < uprefs.length; j++)
+ {
+
+ for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())
+ {
+ if (jalview.util.DBRefUtils.isDasCoordinateSystem(
+ csys.getAuthority(), uprefs[j]))
+ {
+ debug("Launched fetcher for coordinate system "
+ + csys.getAuthority());
+ // Will have to pass any mapping information to the fetcher
+ // - the start/end for the DBRefEntry may not be the same as the
+ // sequence's start/end
+
+ System.out.println(seq.getName() + " "
+ + (seq.getDatasetSequence() == null) + " "
+ + csys.getUri());
+
+ dasCoordSysFound = true; // break's out of the loop
+ ids.add(uprefs[j]);
+ qstring.add(uprefs[j].getAccessionId());
+ }
+ else
+ {
+ System.out.println("IGNORE " + csys.getAuthority());
+ }
+ }
+ }
+ }
+
+ if (!dasCoordSysFound)
+ {
+ String id = null;
+ // try and use the name as the sequence id
+ if (seq.getName().indexOf("|") > -1)
+ {
+ id = seq.getName().substring(seq.getName().lastIndexOf("|") + 1);
+ if (id.trim().length() < 4)
+ {
+ // hack - we regard a significant ID as being at least 4
+ // non-whitespace characters
+ id = seq.getName().substring(0, seq.getName().lastIndexOf("|"));
+ if (id.indexOf("|") > -1)
+ {
+ id = id.substring(id.lastIndexOf("|") + 1);
+ }
+ }
+ }
+ else
+ {
+ id = seq.getName();
+ }
+ if (id != null)
+ {
+ DBRefEntry dbre = new DBRefEntry();
+ dbre.setAccessionId(id);
+ // Should try to call a general feature fetcher that
+ // queries many sources with name to discover applicable ID references
+ ids.add(dbre);
+ qstring.add(dbre.getAccessionId());
+ }
+ }
+
+ return new Object[] { ids, qstring };
+ }
+
+ /**
+ * examine the given sequence feature to determine if it should actually be
+ * turned into sequence annotation or database cross references rather than a
+ * simple sequence feature.
+ *
+ * @param seq
+ * the sequence to annotate
+ * @param f
+ * the jalview sequence feature generated from the DAS feature
+ * @param map
+ * the sequence feature attributes
+ * @param source
+ * the source that emitted the feature
+ * @return true if feature was consumed as another kind of annotation.
+ */
+ protected boolean parseSeqFeature(SequenceI seq, SequenceFeature f,
+ FEATURE feature, jalviewSourceI source)
+ {
+ SequenceI mseq = seq;
+ while (seq.getDatasetSequence() != null)
+ {
+ seq = seq.getDatasetSequence();
+ }
+ if (f.getType() != null)
+ {
+ String type = f.getType();
+ if (type.equalsIgnoreCase("protein_name"))
+ {
+ // parse name onto the alignment sequence or the dataset sequence.
+ if (seq.getDescription() == null
+ || seq.getDescription().trim().length() == 0)
+ {
+ // could look at the note series to pick out the first long name, for
+ // the moment just use the whole description string
+ seq.setDescription(f.getDescription());
+ }
+ if (mseq.getDescription() == null
+ || mseq.getDescription().trim().length() == 0)
+ {
+ // could look at the note series to pick out the first long name, for
+ // the moment just use the whole description string
+ mseq.setDescription(f.getDescription());
+ }
+ return true;
+ }
+ // check if source has biosapiens or other sequence ontology label
+ if (type.equalsIgnoreCase("DBXREF") || type.equalsIgnoreCase("DBREF"))
+ {
+ // try to parse the accession out
+
+ DBRefEntry dbr = new DBRefEntry();
+ dbr.setVersion(source.getTitle());
+ StringTokenizer st = new StringTokenizer(f.getDescription(), ":");
+ if (st.hasMoreTokens())
+ {
+ dbr.setSource(st.nextToken());
+ }
+ if (st.hasMoreTokens())
+ {
+ dbr.setAccessionId(st.nextToken());
+ }
+ seq.addDBRef(dbr);
+
+ if (f.links != null && f.links.size() > 0)
+ {
+ // feature is also appended to enable links to be seen.
+ // TODO: consider extending dbrefs to have their own links ?
+ // TODO: new feature: extract dbref links from DAS servers and add the
+ // URL pattern to the list of DB name associated links in the user's
+ // preferences ?
+ // for the moment - just fix up the existing feature so it displays
+ // correctly.
+ // f.setType(dbr.getSource());
+ // f.setDescription();
+ f.setValue("linkonly", Boolean.TRUE);
+ // f.setDescription("");
+ Vector newlinks = new Vector();
+ Enumeration it = f.links.elements();
+ while (it.hasMoreElements())
+ {
+ String elm;
+ UrlLink urllink = new UrlLink(elm = (String) it.nextElement());
+ if (urllink.isValid())
+ {
+ urllink.setLabel(f.getDescription());
+ newlinks.addElement(urllink.toString());
+ }
+ else
+ {
+ // couldn't parse the link properly. Keep it anyway - just in
+ // case.
+ debug("couldn't parse link string - " + elm);
+ newlinks.addElement(elm);
+ }
+ }
+ f.links = newlinks;
+ seq.addSequenceFeature(f);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * creates a jalview sequence feature from a das feature document
+ *
+ * @param feat
+ * @return sequence feature object created using dasfeature information
+ */
+ SequenceFeature newSequenceFeature(FEATURE feat, String nickname)
+ {
+ if (feat == null)
+ {
+ return null;
+ }
+ try
+ {
+ /**
+ * Different qNames for a DAS Feature - are string keys to the HashMaps in
+ * features "METHOD") || qName.equals("TYPE") || qName.equals("START") ||
+ * qName.equals("END") || qName.equals("NOTE") || qName.equals("LINK") ||
+ * qName.equals("SCORE")
+ */
+ String desc = new String();
+ if (feat.getNOTE() != null)
+ {
+ for (String note : feat.getNOTE())
+ {
+ desc += note;
+ }
+ }
+
+ int start = 0, end = 0;
+ float score = 0f;
+
+ try
+ {
+ start = Integer.parseInt(feat.getSTART().toString());
+ } catch (Exception ex)
+ {
+ }
+ try
+ {
+ end = Integer.parseInt(feat.getEND().toString());
+ } catch (Exception ex)
+ {
+ }
+ try
+ {
+ Object scr = feat.getSCORE();
+ if (scr != null)
+ {
+ score = (float) Double.parseDouble(scr.toString());
+
+ }
+ } catch (Exception ex)
+ {
+ }
+
+ SequenceFeature f = new SequenceFeature(
+ getTypeString(feat.getTYPE()), desc, start, end, score,
+ nickname);
+
+ if (feat.getLINK() != null)
+ {
+ for (LINK link : feat.getLINK())
+ {
+ // Do not put feature extent in link text for non-positional features
+ if (f.begin == 0 && f.end == 0)
+ {
+ f.addLink(f.getType() + " " + link.getContent() + "|"
+ + link.getHref());
+ }
+ else
+ {
+ f.addLink(f.getType() + " " + f.begin + "_" + f.end + " "
+ + link.getContent() + "|" + link.getHref());
+ }
+ }
+ }
+
+ return f;
+ } catch (Exception e)
+ {
+ System.out.println("ERRR " + e);
+ e.printStackTrace();
+ System.out.println("############");
+ debug("Failed to parse " + feat.toString(), e);
+ return null;
+ }
+ }
+
+ private String getTypeString(TYPE type)
+ {
+ return type.getContent();
+ }
+
+ public boolean isRunning()
+ {
+ return running;
+ }
+
+}
diff --git a/src/jalview/ws/EnfinEnvision2OneWay.java b/src/jalview/ws/EnfinEnvision2OneWay.java
deleted file mode 100644
index 7c9f575..0000000
--- a/src/jalview/ws/EnfinEnvision2OneWay.java
+++ /dev/null
@@ -1,709 +0,0 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws;
-
-import jalview.bin.Cache;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.SequenceGroup;
-import jalview.datamodel.SequenceI;
-import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
-import jalview.gui.JvSwingUtils;
-import jalview.util.GroupUrlLink;
-import jalview.util.GroupUrlLink.UrlStringTooLongException;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetEncoder;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Vector;
-import java.util.regex.Pattern;
-
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.event.MenuEvent;
-import javax.swing.event.MenuListener;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.apache.axis.utils.StringUtils;
-import org.apache.http.client.utils.URLEncodedUtils;
-import org.apache.http.entity.StringEntity;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import com.lowagie.text.html.HtmlEncoder;
-
-/**
- * Lightweight runnable to discover dynamic 'one way' group URL services
- *
- * @author JimP
- *
- */
-public class EnfinEnvision2OneWay extends DefaultHandler implements
- Runnable, WSMenuEntryProviderI
-{
- private static EnfinEnvision2OneWay groupURLLinksGatherer = null;
-
- public static EnfinEnvision2OneWay getInstance()
- {
- if (groupURLLinksGatherer == null)
- {
- groupURLLinksGatherer = new EnfinEnvision2OneWay();
- }
- return groupURLLinksGatherer;
- }
-
- private void waitForCompletion()
- {
- if (groupURLLinksGatherer.isRunning())
- {
- // wait around and show a visual delay indicator
- Cursor oldCursor = Desktop.instance.getCursor();
- Desktop.instance.setCursor(new Cursor(Cursor.WAIT_CURSOR));
- while (groupURLLinksGatherer.isRunning())
- {
- try
- {
- Thread.sleep(100);
- } catch (InterruptedException e)
- {
- }
- ;
- }
- Desktop.instance.setCursor(oldCursor);
- }
- }
-
- public Vector getEnvisionServiceGroupURLS()
- {
- waitForCompletion();
- return groupURLLinks;
- }
-
- /**
- * indicate if
- */
- private static String BACKGROUND = "BACKGROUNDPARAM";
-
- /**
- * contains null strings or one of the above constants - indicate if this URL
- * is a special case.
- */
- private Vector additionalPar = new Vector();
-
- /**
- * the enfin service URL
- */
- private String enfinService = null;
-
- private String description = null;
-
- private String wfname;
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public void endElement(String uri, String localName, String qName)
- throws SAXException
- {
-
- // System.err.println("End element: : '"+uri+" "+localName+" "+qName);
- if (qName.equalsIgnoreCase("workflow") && description != null
- && description.length() > 0)
- {
- // groupURLLinks.addElement("UNIPROT|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=Default&datasetName=JalviewIDs$DATASETID$&input=$SEQUENCEIDS$&inputType=0|,");
- // groupURLLinks.addElement("Seqs|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=Default&datasetName=JalviewSeqs$DATASETID$&input=$SEQUENCES=/([A-Za-z]+)+/=$&inputType=1|,");
- System.err.println("Adding entry for " + wfname + " " + description);
- if (wfname.toLowerCase().indexOf("funcnet") == -1)
- {
- description = Pattern.compile("\\s+",Pattern.MULTILINE).matcher(description).replaceAll(" ");
- groupURLdescr.addElement(description);
- groupURLdescr.addElement(description);
- String urlstub=wfname;
- if (wfname.indexOf(" ")>-1)
- {
- // make the name safe!
- try {
- urlstub = URLEncoder.encode(wfname,"utf-8");
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- groupURLLinks
- .addElement(wfname
- + "|"
- + "http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow="
- + urlstub
- + "&datasetName=JalviewSeqs$DATASETID$&input=$SEQUENCEIDS$&inputType=0|,"); // #"+description+"#");
- groupURLLinks
- .addElement(wfname
- + "|"
- + "http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow="
- + urlstub
- + "&datasetName=JalviewSeqs$DATASETID$&input=$SEQUENCES=/([A-Za-z]+)+/=$&inputType=1|,"); // #"+description+"#");
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int)
- */
- public void characters(char[] ch, int start, int length)
- throws SAXException
- {
- if (description != null)
- {
- for (int i = start; i < start + length; i++)
- {
- description += ch[i];
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String,
- * java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException
- {
- if (qName.equalsIgnoreCase("workflow"))
- {
- description = null;
- wfname = attributes.getValue("name");
- }
- if (qName.equalsIgnoreCase("description"))
- {
- description = "";
- }
-
- // System.err.println("Start element: : '"+uri+" "+localName+" "+qName+" attributes"+attributes);
- // super.startElement(uri,localName,qname,attributes);
- }
-
- private boolean started = false;
-
- private boolean running = false;
-
- private Vector groupURLLinks = null;
-
- private Vector groupURLdescr = null;
-
- private static String[] allowedDb = new String[]
- { "UNIPROT", "EMBL", "PDB" };
-
- public EnfinEnvision2OneWay()
- {
- groupURLLinks = new Vector();
- groupURLdescr = new Vector();
-
- enfinService = Cache.getDefault("ENVISION2_WORKFLOWSERVICE",
- "http://www.ebi.ac.uk/enfin-srv/envision2/pages/workflows.xml");
- new Thread(this).start();
- }
-
- public void run()
- {
- started = true;
- running = true;
- try
- {
- SAXParserFactory spf = SAXParserFactory.newInstance();
- SAXParser sp = spf.newSAXParser();
- sp.parse(new URL(enfinService).openStream(), this);
- } catch (Exception e)
- {
- Cache.log.warn("Exception when discovering One Way services: ", e);
- } catch (Error e)
- {
- Cache.log.warn("Error when discovering One Way services: ", e);
- }
- running = false;
- Cache.log.debug("Finished running.");
- }
-
- /**
- * have we finished running yet ?
- *
- * @return false if we have been run.
- */
- public boolean isRunning()
- {
-
- // TODO Auto-generated method stub
- return !started || running;
- }
-
- public static void main(String[] args)
- {
- Cache.initLogger();
- EnfinEnvision2OneWay ow = new EnfinEnvision2OneWay();
- while (ow.isRunning())
- {
- try
- {
- Thread.sleep(50);
- } catch (Exception e)
- {
- }
- ;
-
- }
- for (int i = 0; i < ow.groupURLLinks.size(); i++)
- {
- System.err.println("Description" + ow.groupURLdescr.elementAt(i)
- + "Service URL: " + ow.groupURLLinks.elementAt(i));
- }
- }
-
- // / Copied from jalview.gui.PopupMenu
- /**
- * add a late bound URL service item to the given menu
- *
- * @param linkMenu
- * @param label
- * - menu label string
- * @param urlgenerator
- * GroupURLLink used to generate URL
- * @param urlstub
- * Object array returned from the makeUrlStubs function.
- */
- private void addshowLink(JMenu linkMenu, String label, String descr,
- String dbname, final GroupUrlLink urlgenerator,
- final Object[] urlstub)
- {
- Component[] jmi = linkMenu.getMenuComponents();
- for (int i = 0; i < jmi.length; i++)
- {
- if (jmi[i] instanceof JMenuItem
- && ((JMenuItem) jmi[i]).getText().equalsIgnoreCase(label))
- {
- // don't add this - its a repeat of an existing URL.
- return;
- }
- }
- try {
- descr = HtmlEncoder.encode(descr);
- } catch (Exception e){};
-
- boolean seqsorids = (urlgenerator.getGroupURLType() & urlgenerator.SEQUENCEIDS) == 0;
- int i = urlgenerator.getNumberInvolved(urlstub);
- JMenuItem item = new JMenuItem(label);
- //
- if (dbname == null || dbname.trim().length() == 0)
- {
- dbname = "";
- }
- item.setToolTipText("<html>"
- + JvSwingUtils.wrapTooltip("Submit " + i + " " + dbname + " "
- + (seqsorids ? "sequence" : "sequence id")
- + (i > 1 ? "s" : "")
-
- + " to<br/>" + descr) + "</html>");
- item.addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- new Thread(new Runnable()
- {
-
- public void run()
- {
- try
- {
- showLink(urlgenerator.constructFrom(urlstub));
- } catch (UrlStringTooLongException ex)
- {
- Cache.log.warn("Not showing link: URL is too long!", ex);
- }
- }
-
- }).start();
- }
- });
-
- linkMenu.add(item);
- }
-
- /**
- * open the given link in a new browser window
- *
- * @param url
- */
- public void showLink(String url)
- {
- try
- {
- jalview.util.BrowserLauncher.openURL(url);
- } catch (Exception ex)
- {
- JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
- "Unixers: Couldn't find default web browser."
- + "\nAdd the full path to your browser in Preferences.",
- "Web browser not found", JOptionPane.WARNING_MESSAGE);
-
- ex.printStackTrace();
- }
- }
-
- /**
- * called by a web service menu instance when it is opened.
- *
- * @param enfinServiceMenu
- * @param alignFrame
- */
- private void buildGroupLinkMenu(JMenu enfinServiceMenu,
- AlignFrame alignFrame)
- {
- if (running || !started)
- {
- return;
- }
- SequenceI[] seqs = alignFrame.getViewport().getSelectionAsNewSequence();
- SequenceGroup sg = alignFrame.getViewport().getSelectionGroup();
- if (sg == null)
- {
- // consider visible regions here/
- }
- enfinServiceMenu.removeAll();
- JMenu entries = buildGroupURLMenu(seqs, sg);
- if (entries != null)
- {
- for (int i = 0, iSize = entries.getMenuComponentCount(); i < iSize; i++)
- {
- // transfer - menu component is removed from entries automatically
- enfinServiceMenu.add(entries.getMenuComponent(0));
- }
- // entries.removeAll();
- enfinServiceMenu.setEnabled(true);
- }
- else
- {
- enfinServiceMenu.setEnabled(false);
- }
- }
-
- /**
- * construct a dynamic enfin services menu given a sequence selection
- *
- * @param seqs
- * @param sg
- * @param groupLinks
- * @return
- */
- private JMenu buildGroupURLMenu(SequenceI[] seqs, SequenceGroup sg)
- {
- if (groupURLdescr == null || groupURLLinks == null)
- return null;
- // TODO: usability: thread off the generation of group url content so root
- // menu appears asap
- // sequence only URLs
- // ID/regex match URLs
- JMenu groupLinksMenu = new JMenu("Group Link");
- String[][] idandseqs = GroupUrlLink.formStrings(seqs);
- Hashtable commonDbrefs = new Hashtable();
- for (int sq = 0; sq < seqs.length; sq++)
- {
-
- int start, end;
- if (sg != null)
- {
- start = seqs[sq].findPosition(sg.getStartRes());
- end = seqs[sq].findPosition(sg.getEndRes());
- }
- else
- {
- // get total width of alignment.
- start = seqs[sq].getStart();
- end = seqs[sq].findPosition(seqs[sq].getLength());
- }
- // we skip sequences which do not have any non-gaps in the region of
- // interest
- if (start > end)
- {
- continue;
- }
- // just collect ids from dataset sequence
- // TODO: check if IDs collected from selecton group intersects with the
- // current selection, too
- SequenceI sqi = seqs[sq];
- while (sqi.getDatasetSequence() != null)
- {
- sqi = sqi.getDatasetSequence();
- }
- DBRefEntry[] dbr = sqi.getDBRef();
- if (dbr != null && dbr.length > 0)
- {
- for (int d = 0; d < dbr.length; d++)
- {
- String src = dbr[d].getSource(); // jalview.util.DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase();
- Object[] sarray = (Object[]) commonDbrefs.get(src);
- if (sarray == null)
- {
- sarray = new Object[2];
- sarray[0] = new int[]
- { 0 };
- sarray[1] = new String[seqs.length];
-
- commonDbrefs.put(src, sarray);
- }
-
- if (((String[]) sarray[1])[sq] == null)
- {
- if (!dbr[d].hasMap()
- || (dbr[d].getMap().locateMappedRange(start, end) != null))
- {
- ((String[]) sarray[1])[sq] = dbr[d].getAccessionId();
- ((int[]) sarray[0])[0]++;
- }
- }
- }
- }
- }
- // now create group links for all distinct ID/sequence sets.
- Hashtable<String, JMenu[]> gurlMenus = new Hashtable<String, JMenu[]>();
- /**
- * last number of sequences where URL generation failed
- */
- int[] nsqtype = new int[]
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- for (int i = 0; i < groupURLLinks.size(); i++)
- {
- String link = (String) groupURLLinks.elementAt(i);
- String descr = (String) groupURLdescr.elementAt(i);
-
- // boolean specialCase =
- // additionalPar.elementAt(i).toString().equals(BACKGROUND);
- GroupUrlLink urlLink = null;
- try
- {
- urlLink = new GroupUrlLink(link);
- } catch (Exception foo)
- {
- jalview.bin.Cache.log.error("Exception for GroupURLLink '" + link
- + "'", foo);
- continue;
- }
- ;
- if (!urlLink.isValid())
- {
- jalview.bin.Cache.log.error(urlLink.getInvalidMessage());
- continue;
- }
- final String label = urlLink.getLabel();
- // create/recover the sub menus that might be populated for this link.
- JMenu[] wflinkMenus = gurlMenus.get(label);
- if (wflinkMenus == null)
- {
- // three types of url that might be
- // created.
- wflinkMenus = new JMenu[]
- { null, new JMenu("IDS"), new JMenu("Sequences"),
- new JMenu("IDS and Sequences") };
- gurlMenus.put(label, wflinkMenus);
- }
-
- boolean usingNames = false;
- // Now see which parts of the group apply for this URL
- String ltarget;
- String[] seqstr, ids; // input to makeUrl
- for (int t = 0; t < allowedDb.length; t++)
- {
- ltarget = allowedDb[t]; // jalview.util.DBRefUtils.getCanonicalName(urlLink.getTarget());
- Object[] idset = (Object[]) commonDbrefs.get(ltarget.toUpperCase());
- if (idset != null)
- {
- int numinput = ((int[]) idset[0])[0];
- String[] allids = ((String[]) idset[1]);
- seqstr = new String[numinput];
- ids = new String[numinput];
- if (nsqtype[urlLink.getGroupURLType()] > 0
- && numinput >= nsqtype[urlLink.getGroupURLType()])
- {
- continue;
- }
- for (int sq = 0, idcount = 0; sq < seqs.length; sq++)
- {
- if (allids[sq] != null)
- {
- ids[idcount] = allids[sq];
- seqstr[idcount++] = idandseqs[1][sq];
- }
- }
- try
- {
- createAndAddLinks(wflinkMenus, false, urlLink, ltarget, null,
- descr, ids, seqstr);
- } catch (UrlStringTooLongException ex)
- {
- nsqtype[urlLink.getGroupURLType()] = numinput;
- }
- }
- }
- // also do names only.
- seqstr = idandseqs[1];
- ids = idandseqs[0];
- if (nsqtype[urlLink.getGroupURLType()] > 0
- && idandseqs[0].length >= nsqtype[urlLink.getGroupURLType()])
- {
- continue;
- }
-
- try
- {
- createAndAddLinks(wflinkMenus, true, urlLink, "Any", null, descr,
- ids, seqstr);
- } catch (UrlStringTooLongException ex)
- {
- nsqtype[urlLink.getGroupURLType()] = idandseqs[0].length;
- }
- }
- boolean anyadded = false; // indicates if there are any group links to give
- // to user
- for (Map.Entry<String, JMenu[]> menues : gurlMenus.entrySet())
- {
- JMenu grouplinkset = new JMenu(menues.getKey());
- JMenu[] wflinkMenus = menues.getValue();
- for (int m = 0; m < wflinkMenus.length; m++)
- {
- if (wflinkMenus[m] != null
- && wflinkMenus[m].getMenuComponentCount() > 0)
- {
- anyadded = true;
- grouplinkset.add(wflinkMenus[m]);
- }
- }
- groupLinksMenu.add(grouplinkset);
- }
- if (anyadded)
- {
- return groupLinksMenu;
- }
- return null;
- }
-
- private boolean createAndAddLinks(JMenu[] linkMenus, boolean usingNames,
- GroupUrlLink urlLink, String label, String ltarget, String descr,
- String[] ids, String[] seqstr) throws UrlStringTooLongException
- {
- Object[] urlset = urlLink.makeUrlStubs(ids, seqstr, "FromJalview"
- + System.currentTimeMillis(), false);
-
- if (urlset != null)
- {
- int type = urlLink.getGroupURLType() & 3;
- // System.out.println(urlLink.getGroupURLType()
- // +" "+((String[])urlset[3])[0]);
- // first two bits ofurlLink type bitfield are sequenceids and sequences
- // TODO: FUTURE: ensure the groupURL menu structure can be generalised
- addshowLink(
- linkMenus[type],
- label
- + " "
- + (ltarget == null ? (((type & 1) == 1 ? "ID"
- : "Sequence") + (urlLink
- .getNumberInvolved(urlset) > 1 ? "s" : ""))
- : (usingNames ? (((type & 1) == 1) ? "(Names)"
- : "")
- : ("(" + ltarget + ")"))), descr,
- usingNames ? null : label, urlLink, urlset);
- return true;
- }
- return false;
- }
-
- // / end of stuff copied from popupmenu
- public void attachWSMenuEntry(final JMenu wsmenu,
- final AlignFrame alignFrame)
- {
- final JMenu enfinServiceMenu = new JMenu("Envision 2");
- wsmenu.add(enfinServiceMenu);
- enfinServiceMenu.setEnabled(false);
- wsmenu.addMenuListener(new MenuListener()
- {
- // this listener remembers when the menu was first selected, and
- // doesn't rebuild the session list until it has been cleared and
- // reselected again.
- boolean refresh = true;
-
- public void menuCanceled(MenuEvent e)
- {
- refresh = true;
- }
-
- public void menuDeselected(MenuEvent e)
- {
- refresh = true;
- }
-
- public void menuSelected(MenuEvent e)
- {
- if (refresh && !isRunning())
- {
- new Thread(new Runnable()
- {
- public void run()
- {
- try
- {
- buildGroupLinkMenu(enfinServiceMenu, alignFrame);
- } catch (OutOfMemoryError ex)
- {
- Cache.log
- .error("Out of memory when calculating the Envision2 links.",
- ex);
- enfinServiceMenu.setEnabled(false);
- }
- }
- }).start();
- refresh = false;
- }
- }
- });
-
- }
-
-}
diff --git a/src/jalview/ws/HttpClientUtils.java b/src/jalview/ws/HttpClientUtils.java
new file mode 100644
index 0000000..a782917
--- /dev/null
+++ b/src/jalview/ws/HttpClientUtils.java
@@ -0,0 +1,169 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpVersion;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.mime.HttpMultipartMode;
+import org.apache.http.entity.mime.MultipartEntity;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.entity.mime.content.InputStreamBody;
+import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+
+/**
+ * Helpful procedures for working with services via HTTPClient
+ *
+ * @author jimp
+ *
+ */
+public class HttpClientUtils
+{
+ /**
+ * do a minimal HTTP post with URL-Encoded parameters passed in the Query
+ * string
+ *
+ * @param postUrl
+ * @param vals
+ * @return Reader containing content, if any, or null if no entity returned.
+ * @throws IOException
+ * @throws ClientProtocolException
+ * @throws Exception
+ */
+ public static BufferedReader doHttpUrlPost(String postUrl,
+ List<NameValuePair> vals, int connectionTimeoutMs,
+ int readTimeoutMs) throws ClientProtocolException, IOException
+ {
+ // todo use HttpClient 4.3 or later and class RequestConfig
+ HttpParams params = new BasicHttpParams();
+ params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION,
+ HttpVersion.HTTP_1_1);
+ if (connectionTimeoutMs > 0)
+ {
+ HttpConnectionParams
+ .setConnectionTimeout(params, connectionTimeoutMs);
+ }
+ if (readTimeoutMs > 0)
+ {
+ HttpConnectionParams.setSoTimeout(params, readTimeoutMs);
+ }
+ HttpClient httpclient = new DefaultHttpClient(params);
+ HttpPost httppost = new HttpPost(postUrl);
+ UrlEncodedFormEntity ue = new UrlEncodedFormEntity(vals, "UTF-8");
+ httppost.setEntity(ue);
+ HttpResponse response = httpclient.execute(httppost);
+ HttpEntity resEntity = response.getEntity();
+
+ if (resEntity != null)
+ {
+ BufferedReader r = new BufferedReader(new InputStreamReader(
+ resEntity.getContent()));
+ return r;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static BufferedReader doHttpMpartFilePost(String postUrl,
+ List<NameValuePair> vals, String fparm, File file, String mtype)
+ throws ClientProtocolException, IOException
+ {
+ HttpClient httpclient = new DefaultHttpClient();
+ HttpPost httppost = new HttpPost(postUrl);
+ MultipartEntity mpe = new MultipartEntity(
+ HttpMultipartMode.BROWSER_COMPATIBLE);
+ for (NameValuePair nvp : vals)
+ {
+ mpe.addPart(nvp.getName(), new StringBody(nvp.getValue()));
+ }
+
+ FileBody fb = new FileBody(file, mtype != null ? mtype
+ : "application/octet-stream");
+ mpe.addPart(fparm, fb);
+ UrlEncodedFormEntity ue = new UrlEncodedFormEntity(vals, "UTF-8");
+ httppost.setEntity(ue);
+ HttpResponse response = httpclient.execute(httppost);
+ HttpEntity resEntity = response.getEntity();
+
+ if (resEntity != null)
+ {
+ BufferedReader r = new BufferedReader(new InputStreamReader(
+ resEntity.getContent()));
+ return r;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static BufferedReader doHttpMpartInputstreamPost(String postUrl,
+ List<NameValuePair> vals, String fparm, String fname,
+ InputStream is, String mtype) throws ClientProtocolException,
+ IOException
+ {
+ HttpClient httpclient = new DefaultHttpClient();
+ HttpPost httppost = new HttpPost(postUrl);
+ MultipartEntity mpe = new MultipartEntity(HttpMultipartMode.STRICT);
+ for (NameValuePair nvp : vals)
+ {
+ mpe.addPart(nvp.getName(), new StringBody(nvp.getValue()));
+ }
+
+ InputStreamBody fb = (mtype != null) ? new InputStreamBody(is, fname,
+ mtype) : new InputStreamBody(is, fname);
+ mpe.addPart(fparm, fb);
+ UrlEncodedFormEntity ue = new UrlEncodedFormEntity(vals, "UTF-8");
+ httppost.setEntity(ue);
+ HttpResponse response = httpclient.execute(httppost);
+ HttpEntity resEntity = response.getEntity();
+
+ if (resEntity != null)
+ {
+ BufferedReader r = new BufferedReader(new InputStreamReader(
+ resEntity.getContent()));
+ return r;
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
diff --git a/src/jalview/ws/JobStateSummary.java b/src/jalview/ws/JobStateSummary.java
index c117e4b..f5b678c 100644
--- a/src/jalview/ws/JobStateSummary.java
+++ b/src/jalview/ws/JobStateSummary.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws;
@@ -74,6 +77,13 @@ public class JobStateSummary
public void updateJobPanelState(WebserviceInfo wsInfo,
String OutputHeader, AWsJob j)
{
+ if (j.cancelled)
+ {
+ cancelled++;
+ j.subjobComplete = true;
+ wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_CANCELLED_OK);
+ return;
+ }
if (j.submitted)
{
String progheader = "";
@@ -119,12 +129,13 @@ public class JobStateSummary
wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR);
}
// and pass on any sub-job messages to the user
- StringBuffer output=new StringBuffer();
- if (OutputHeader!=null) {
-
+ StringBuffer output = new StringBuffer();
+ if (OutputHeader != null)
+ {
+
output.append(OutputHeader);
}
- if (progheader!=null)
+ if (progheader != null)
{
output.append(progheader);
}
@@ -134,8 +145,9 @@ public class JobStateSummary
// probably won't be
// enough memory to handle the results later on anyway.
// try {
- String stat = j.getStatus();
- if (stat!=null) {
+ String stat = j.getStatus();
+ if (stat != null)
+ {
output.append(stat);
}
// } catch (OutOfMemoryError e)
@@ -145,7 +157,7 @@ public class JobStateSummary
// "..\n(Out of memory when displaying status)\n");
// }
}
- wsInfo.setProgressText(j.jobnum,output.toString());
+ wsInfo.setProgressText(j.jobnum, output.toString());
}
else
{
diff --git a/src/jalview/ws/SequenceFetcher.java b/src/jalview/ws/SequenceFetcher.java
index 4f9e0ab..aba3c6f 100644
--- a/src/jalview/ws/SequenceFetcher.java
+++ b/src/jalview/ws/SequenceFetcher.java
@@ -1,407 +1,452 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.biojava.dasobert.das2.Das2Source;
-import org.biojava.dasobert.dasregistry.Das1Source;
-import org.biojava.dasobert.dasregistry.DasCoordinateSystem;
-import org.biojava.dasobert.dasregistry.DasSource;
-
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefSource;
-import jalview.datamodel.SequenceI;
-import jalview.ws.dbsources.DasSequenceSource;
-import jalview.ws.seqfetcher.ASequenceFetcher;
-import jalview.ws.seqfetcher.DbSourceProxy;
-
-/**
- * This is the the concrete implementation of the sequence retrieval interface
- * and abstract class in jalview.ws.seqfetcher. This implements the run-time
- * discovery of sequence database clients, and provides a hardwired main for
- * testing all registered handlers.
- *
- */
-public class SequenceFetcher extends ASequenceFetcher
-{
- /**
- * Thread safe construction of database proxies TODO: extend to a configurable
- * database plugin mechanism where classes are instantiated by reflection and
- * queried for their DbRefSource and version association.
- *
- */
- public SequenceFetcher()
- {
- addDBRefSourceImpl(jalview.ws.dbsources.EmblSource.class);
- addDBRefSourceImpl(jalview.ws.dbsources.EmblCdsSouce.class);
- addDBRefSourceImpl(jalview.ws.dbsources.Uniprot.class);
- addDBRefSourceImpl(jalview.ws.dbsources.UnprotName.class);
- addDBRefSourceImpl(jalview.ws.dbsources.Pdb.class);
- addDBRefSourceImpl(jalview.ws.dbsources.PfamFull.class);
- addDBRefSourceImpl(jalview.ws.dbsources.PfamSeed.class); // ensures Seed
- // alignment is
- // 'default' for
- // PFAM
- registerDasSequenceSources();
- }
-
- /**
- * return an ordered list of database sources suitable for using in a GUI
- * element
- */
- public String[] getOrderedSupportedSources()
- {
- String[] srcs = this.getSupportedDb();
- ArrayList dassrc = new ArrayList(), nondas = new ArrayList();
- for (int i = 0; i < srcs.length; i++)
- {
- String nm = getSourceProxy(srcs[i]).getDbName();
- if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.DasSequenceSource)
- {
- if (nm.startsWith("das:"))
- {
- nm = nm.substring(4);
- }
- dassrc.add(new String[]
- { srcs[i], nm.toUpperCase() });
- }
- else
- {
- nondas.add(new String[]
- { srcs[i], nm.toUpperCase() });
- }
- }
- Object[] sorted = nondas.toArray();
- String[] tosort = new String[sorted.length];
- nondas.clear();
- for (int j = 0; j < sorted.length; j++)
- {
- tosort[j] = ((String[]) sorted[j])[1];
- }
- jalview.util.QuickSort.sort(tosort, sorted);
- int i = 0;
- for (int j = sorted.length - 1; j >= 0; j--, i++)
- {
- srcs[i] = ((String[]) sorted[j])[0];
- sorted[j] = null;
- }
-
- sorted = dassrc.toArray();
- tosort = new String[sorted.length];
- dassrc.clear();
- for (int j = 0; j < sorted.length; j++)
- {
- tosort[j] = ((String[]) sorted[j])[1];
- }
- jalview.util.QuickSort.sort(tosort, sorted);
- for (int j = sorted.length - 1; j >= 0; j--, i++)
- {
- srcs[i] = ((String[]) sorted[j])[0];
- sorted[j] = null;
- }
- return srcs;
- }
-
- /**
- * simple run method to test dbsources.
- *
- * @param argv
- */
- public static void main(String[] argv)
- {
- AlignmentI ds = null;
- Vector noProds = new Vector();
- String usage = "SequenceFetcher.main [<DBNAME> <ACCNO>]\n"
- + "With no arguments, all DbSources will be queried with their test Accession number.\n"
- + "If given two arguments, SequenceFetcher will try to find the DbFetcher corresponding to <DBNAME> and retrieve <ACCNO> from it.";
- if (argv != null && argv.length > 0)
- {
- DbSourceProxy sp = new SequenceFetcher().getSourceProxy(argv[0]);
- if (sp != null)
- {
- AlignmentI al = null;
- try
- {
- al = sp.getSequenceRecords(argv[1]);
- } catch (Exception e)
- {
- e.printStackTrace();
- System.err.println("Error when retrieving " + argv[1] + " from "
- + argv[0] + "\nUsage: " + usage);
- }
- SequenceI[] prod = al.getSequencesArray();
- if (al != null)
- {
- for (int p = 0; p < prod.length; p++)
- {
- System.out.println("Prod " + p + ": "
- + prod[p].getDisplayId(true) + " : "
- + prod[p].getDescription());
- }
- }
- return;
- }
- else
- {
- System.err.println("Can't resolve " + argv[0]
- + " as a database name. Allowed values are :\n"
- + new SequenceFetcher().getSupportedDb());
- }
- System.out.println(usage);
- }
- ASequenceFetcher sfetcher = new SequenceFetcher();
- String[] dbSources = sfetcher.getSupportedDb();
- for (int dbsource = 0; dbsource < dbSources.length; dbsource++)
- {
- String db = dbSources[dbsource];
- // skip me
- if (db.equals(DBRefSource.PDB))
- continue;
- DbSourceProxy sp = sfetcher.getSourceProxy(db);
- System.out.println("Source: " + sp.getDbName() + " (" + db
- + "): retrieving test:" + sp.getTestQuery());
- AlignmentI al = null;
- try
- {
- al = sp.getSequenceRecords(sp.getTestQuery());
- if (al != null && al.getHeight() > 0
- && sp.getDbSourceProperties() != null)
- {
- boolean dna = sp.getDbSourceProperties().containsKey(
- DBRefSource.DNACODINGSEQDB)
- || sp.getDbSourceProperties().containsKey(
- DBRefSource.DNASEQDB)
- || sp.getDbSourceProperties().containsKey(
- DBRefSource.CODINGSEQDB);
- // try and find products
- String types[] = jalview.analysis.CrossRef.findSequenceXrefTypes(
- dna, al.getSequencesArray());
- if (types != null)
- {
- System.out.println("Xref Types for: " + (dna ? "dna" : "prot"));
- for (int t = 0; t < types.length; t++)
- {
- System.out.println("Type: " + types[t]);
- SequenceI[] prod = jalview.analysis.CrossRef
- .findXrefSequences(al.getSequencesArray(), dna,
- types[t]).getSequencesArray();
- System.out.println("Found "
- + ((prod == null) ? "no" : "" + prod.length)
- + " products");
- if (prod != null)
- {
- for (int p = 0; p < prod.length; p++)
- {
- System.out.println("Prod " + p + ": "
- + prod[p].getDisplayId(true));
- }
- }
- }
- }
- else
- {
- noProds.addElement((dna ? new Object[]
- { al, al } : new Object[]
- { al }));
- }
-
- }
- } catch (Exception ex)
- {
- System.out.println("ERROR:Failed to retrieve test query.");
- ex.printStackTrace(System.out);
- }
- if (al == null)
- {
- System.out.println("ERROR:No alignment retrieved.");
- StringBuffer raw = sp.getRawRecords();
- if (raw != null)
- System.out.println(raw.toString());
- else
- System.out.println("ERROR:No Raw results.");
- }
- else
- {
- System.out.println("Retrieved " + al.getHeight() + " sequences.");
- for (int s = 0; s < al.getHeight(); s++)
- {
- SequenceI sq = al.getSequenceAt(s);
- while (sq.getDatasetSequence() != null)
- {
- sq = sq.getDatasetSequence();
-
- }
- if (ds == null)
- {
- ds = new Alignment(new SequenceI[]
- { sq });
-
- }
- else
- {
- ds.addSequence(sq);
- }
- }
- }
- System.out.flush();
- System.err.flush();
-
- }
- if (noProds.size() > 0)
- {
- Enumeration ts = noProds.elements();
- while (ts.hasMoreElements())
-
- {
- Object[] typeSq = (Object[]) ts.nextElement();
- boolean dna = (typeSq.length > 1);
- AlignmentI al = (AlignmentI) typeSq[0];
- System.out.println("Trying getProducts for "
- + al.getSequenceAt(0).getDisplayId(true));
- System.out.println("Search DS Xref for: " + (dna ? "dna" : "prot"));
- // have a bash at finding the products amongst all the retrieved
- // sequences.
- SequenceI[] seqs = al.getSequencesArray();
- Alignment prodal = jalview.analysis.CrossRef.findXrefSequences(
- seqs, dna, null, ds);
- System.out.println("Found "
- + ((prodal == null) ? "no" : "" + prodal.getHeight())
- + " products");
- if (prodal != null)
- {
- SequenceI[] prod = prodal.getSequencesArray(); // note
- // should
- // test
- // rather
- // than
- // throw
- // away
- // codon
- // mapping
- // (if
- // present)
- for (int p = 0; p < prod.length; p++)
- {
- System.out.println("Prod " + p + ": "
- + prod[p].getDisplayId(true));
- }
- }
- }
-
- }
- }
-
- /**
- * query the currently defined DAS source registry for sequence sources and
- * add a DasSequenceSource instance for each source to the SequenceFetcher
- * source list.
- */
- public void registerDasSequenceSources()
- {
- DasSource[] sources = jalview.ws.DasSequenceFeatureFetcher
- .getDASSources();
- if (sources != null)
- {
- for (int s = 0; sources != null && s < sources.length; s++)
- {
- addDasSequenceSource(sources[s]);
- }
- }
-
- Vector localsources = jalview.bin.Cache.getLocalDasSources();
- if (localsources != null)
- {
- for (Enumeration ls = localsources.elements(); ls.hasMoreElements();)
- {
- addDasSequenceSource((DasSource) ls.nextElement());
- }
- }
- }
-
- /**
- * Try to create and add a DasSequenceSource to the list of sources.
- *
- * @param source
- * @return null if no source was added, or the new DasSequenceSource created
- */
- DasSequenceSource addDasSequenceSource(DasSource source)
- {
- DasSequenceSource ds = null;
- Das1Source d1s = null;
- if (source.hasCapability("sequence"))
- {
- if (source instanceof Das2Source)
- {
- if (((Das2Source) source).hasDas1Capabilities())
- {
- try
- {
- d1s = org.biojava.dasobert.das2.DasSourceConverter
- .toDas1Source((Das2Source) source);
- } catch (Exception e)
- {
- System.err.println("Ignoring DAS2 sequence source "
- + source.getNickname()
- + " - couldn't map to Das1Source.\n");
- e.printStackTrace();
- }
- }
- }
- else
- {
- if (source instanceof Das1Source)
- {
- d1s = (Das1Source) source;
- }
- }
- }
- if (d1s != null)
- {
- DasCoordinateSystem[] css = d1s.getCoordinateSystem();
- if (css == null || css.length == 0)
- {
- // TODO: query das source directly to identify coordinate system... or
- // have to make up a coordinate system
- css = new DasCoordinateSystem[]
- { new DasCoordinateSystem() };
- css[0].setName(d1s.getNickname());
- css[0].setUniqueId(d1s.getNickname());
- }
- for (int c = 0; c < css.length; c++)
- {
- try
- {
- addDbRefSourceImpl(ds = new DasSequenceSource("das:"
- + d1s.getNickname() + " (" + css[c].getName() + ")",
- css[c].getName(), d1s, css[c]));
- } catch (Exception e)
- {
- System.err.println("Ignoring sequence coord system " + c + " ("
- + css[c].getName() + ") for source " + d1s.getNickname()
- + "- threw exception when constructing fetcher.\n");
- e.printStackTrace();
- }
- }
- }
- return ds;
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws;
+
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.SequenceI;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.seqfetcher.ASequenceFetcher;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * This is the the concrete implementation of the sequence retrieval interface
+ * and abstract class in jalview.ws.seqfetcher. This implements the run-time
+ * discovery of sequence database clients, and provides a hardwired main for
+ * testing all registered handlers.
+ *
+ */
+public class SequenceFetcher extends ASequenceFetcher
+{
+ /**
+ * Thread safe construction of database proxies TODO: extend to a configurable
+ * database plugin mechanism where classes are instantiated by reflection and
+ * queried for their DbRefSource and version association.
+ *
+ */
+ public SequenceFetcher()
+ {
+ this(true);
+ }
+
+ public SequenceFetcher(boolean addDas)
+ {
+ addDBRefSourceImpl(jalview.ws.dbsources.EmblSource.class);
+ addDBRefSourceImpl(jalview.ws.dbsources.EmblCdsSouce.class);
+ addDBRefSourceImpl(jalview.ws.dbsources.Uniprot.class);
+ addDBRefSourceImpl(jalview.ws.dbsources.UnprotName.class);
+ addDBRefSourceImpl(jalview.ws.dbsources.Pdb.class);
+ addDBRefSourceImpl(jalview.ws.dbsources.PfamFull.class);
+ addDBRefSourceImpl(jalview.ws.dbsources.PfamSeed.class);
+ // ensures Seed alignment is 'default' for PFAM
+ addDBRefSourceImpl(jalview.ws.dbsources.RfamFull.class);
+ addDBRefSourceImpl(jalview.ws.dbsources.RfamSeed.class);
+ if (addDas)
+ {
+ registerDasSequenceSources();
+ }
+ }
+
+ /**
+ * return an ordered list of database sources where non-das database classes
+ * appear before das database classes
+ */
+ public String[] getOrderedSupportedSources()
+ {
+ String[] srcs = this.getSupportedDb();
+ ArrayList<String> dassrc = new ArrayList<String>(), nondas = new ArrayList<String>();
+ for (int i = 0; i < srcs.length; i++)
+ {
+ boolean das = false, skip = false;
+ String nm;
+ for (DbSourceProxy dbs : getSourceProxy(srcs[i]))
+ {
+ // Skip the alignment databases for the moment - they're not useful for
+ // verifying a single sequence against its reference source
+ if (dbs.isA(DBRefSource.ALIGNMENTDB))
+ {
+ skip = true;
+ }
+ else
+ {
+ nm = dbs.getDbName();
+ if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
+ {
+ if (nm.startsWith("das:"))
+ {
+ nm = nm.substring(4);
+ das = true;
+ }
+ break;
+ }
+ }
+ }
+ if (skip)
+ {
+ continue;
+ }
+ if (das)
+ {
+ dassrc.add(srcs[i]);
+ }
+ else
+ {
+ nondas.add(srcs[i]);
+ }
+ }
+ String[] tosort = nondas.toArray(new String[0]), sorted = nondas
+ .toArray(new String[0]);
+ for (int j = 0, jSize = sorted.length; j < jSize; j++)
+ {
+ tosort[j] = tosort[j].toLowerCase();
+ }
+ jalview.util.QuickSort.sort(tosort, sorted);
+ // construct array with all sources listed
+
+ srcs = new String[sorted.length + dassrc.size()];
+ int i = 0;
+ for (int j = sorted.length - 1; j >= 0; j--, i++)
+ {
+ srcs[i] = sorted[j];
+ sorted[j] = null;
+ }
+
+ sorted = dassrc.toArray(new String[0]);
+ tosort = dassrc.toArray(new String[0]);
+ for (int j = 0, jSize = sorted.length; j < jSize; j++)
+ {
+ tosort[j] = tosort[j].toLowerCase();
+ }
+ jalview.util.QuickSort.sort(tosort, sorted);
+ for (int j = sorted.length - 1; j >= 0; j--, i++)
+ {
+ srcs[i] = sorted[j];
+ }
+ return srcs;
+ }
+
+ /**
+ * return plaintext databse list suitable for using in a GUI element
+ */
+ public String[] _getOrderedSupportedSources()
+ {
+ String[] srcs = this.getSupportedDb();
+ ArrayList dassrc = new ArrayList(), nondas = new ArrayList();
+ for (int i = 0; i < srcs.length; i++)
+ {
+ for (DbSourceProxy dbs : getSourceProxy(srcs[i]))
+ {
+ String nm = dbs.getDbName();
+ if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
+ {
+ if (nm.startsWith("das:"))
+ {
+ nm = nm.substring(4);
+ }
+ dassrc.add(new String[] { srcs[i], nm.toUpperCase() });
+ }
+ else
+ {
+ nondas.add(new String[] { srcs[i], nm.toUpperCase() });
+ }
+ }
+ }
+ Object[] sorted = nondas.toArray();
+ String[] tosort = new String[sorted.length];
+ nondas.clear();
+ for (int j = 0; j < sorted.length; j++)
+ {
+ tosort[j] = ((String[]) sorted[j])[1];
+ }
+ jalview.util.QuickSort.sort(tosort, sorted);
+ int i = 0;
+ // construct array with all sources listed
+ srcs = new String[sorted.length + dassrc.size()];
+ for (int j = sorted.length - 1; j >= 0; j--, i++)
+ {
+ srcs[i] = ((String[]) sorted[j])[0];
+ sorted[j] = null;
+ }
+
+ sorted = dassrc.toArray();
+ tosort = new String[sorted.length];
+ dassrc.clear();
+ for (int j = 0; j < sorted.length; j++)
+ {
+ tosort[j] = ((String[]) sorted[j])[1];
+ }
+ jalview.util.QuickSort.sort(tosort, sorted);
+ for (int j = sorted.length - 1; j >= 0; j--, i++)
+ {
+ srcs[i] = ((String[]) sorted[j])[0];
+ sorted[j] = null;
+ }
+ return srcs;
+ }
+
+ /**
+ * simple run method to test dbsources.
+ *
+ * @param argv
+ */
+ public static void main(String[] argv)
+ {
+ AlignmentI ds = null;
+ Vector noProds = new Vector();
+ String usage = "SequenceFetcher.main [-nodas] [<DBNAME> [<ACCNO>]]\n"
+ + "With no arguments, all DbSources will be queried with their test Accession number.\n"
+ + "With one argument, the argument will be resolved to one or more db sources and each will be queried with their test accession only.\n"
+ + "If given two arguments, SequenceFetcher will try to find the DbFetcher corresponding to <DBNAME> and retrieve <ACCNO> from it.\n"
+ + "The -nodas option will exclude DAS sources from the database fetchers Jalview will try to use.";
+ boolean withDas = true;
+ if (argv != null && argv.length > 0
+ && argv[0].toLowerCase().startsWith("-nodas"))
+ {
+ withDas = false;
+ String targs[] = new String[argv.length - 1];
+ System.arraycopy(argv, 1, targs, 0, targs.length);
+ argv = targs;
+ }
+ if (argv != null && argv.length > 0)
+ {
+ List<DbSourceProxy> sps = new SequenceFetcher(withDas)
+ .getSourceProxy(argv[0]);
+
+ if (sps != null)
+ {
+ for (DbSourceProxy sp : sps)
+ {
+ AlignmentI al = null;
+ try
+ {
+ al = sp.getSequenceRecords(argv.length > 1 ? argv[1] : sp
+ .getTestQuery());
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err.println("Error when retrieving "
+ + (argv.length > 1 ? argv[1] : sp.getTestQuery())
+ + " from " + argv[0] + "\nUsage: " + usage);
+ }
+ SequenceI[] prod = al.getSequencesArray();
+ if (al != null)
+ {
+ for (int p = 0; p < prod.length; p++)
+ {
+ System.out.println("Prod " + p + ": "
+ + prod[p].getDisplayId(true) + " : "
+ + prod[p].getDescription());
+ }
+ }
+ }
+ return;
+ }
+ else
+ {
+ System.err.println("Can't resolve " + argv[0]
+ + " as a database name. Allowed values are :\n"
+ + new SequenceFetcher().getSupportedDb());
+ }
+ System.out.println(usage);
+ return;
+ }
+ ASequenceFetcher sfetcher = new SequenceFetcher(withDas);
+ String[] dbSources = sfetcher.getSupportedDb();
+ for (int dbsource = 0; dbsource < dbSources.length; dbsource++)
+ {
+ String db = dbSources[dbsource];
+ // skip me
+ if (db.equals(DBRefSource.PDB))
+ {
+ continue;
+ }
+ for (DbSourceProxy sp : sfetcher.getSourceProxy(db))
+ {
+ System.out.println("Source: " + sp.getDbName() + " (" + db
+ + "): retrieving test:" + sp.getTestQuery());
+ AlignmentI al = null;
+ try
+ {
+ al = sp.getSequenceRecords(sp.getTestQuery());
+ if (al != null && al.getHeight() > 0
+ && sp.getDbSourceProperties() != null)
+ {
+ boolean dna = sp.getDbSourceProperties().containsKey(
+ DBRefSource.DNACODINGSEQDB)
+ || sp.getDbSourceProperties().containsKey(
+ DBRefSource.DNASEQDB)
+ || sp.getDbSourceProperties().containsKey(
+ DBRefSource.CODINGSEQDB);
+ // try and find products
+ String types[] = jalview.analysis.CrossRef
+ .findSequenceXrefTypes(dna, al.getSequencesArray());
+ if (types != null)
+ {
+ System.out.println("Xref Types for: "
+ + (dna ? "dna" : "prot"));
+ for (int t = 0; t < types.length; t++)
+ {
+ System.out.println("Type: " + types[t]);
+ SequenceI[] prod = jalview.analysis.CrossRef
+ .findXrefSequences(al.getSequencesArray(), dna,
+ types[t]).getSequencesArray();
+ System.out.println("Found "
+ + ((prod == null) ? "no" : "" + prod.length)
+ + " products");
+ if (prod != null)
+ {
+ for (int p = 0; p < prod.length; p++)
+ {
+ System.out.println("Prod " + p + ": "
+ + prod[p].getDisplayId(true));
+ }
+ }
+ }
+ }
+ else
+ {
+ noProds.addElement((dna ? new Object[] { al, al }
+ : new Object[] { al }));
+ }
+
+ }
+ } catch (Exception ex)
+ {
+ System.out.println("ERROR:Failed to retrieve test query.");
+ ex.printStackTrace(System.out);
+ }
+
+ if (al == null)
+ {
+ System.out.println("ERROR:No alignment retrieved.");
+ StringBuffer raw = sp.getRawRecords();
+ if (raw != null)
+ {
+ System.out.println(raw.toString());
+ }
+ else
+ {
+ System.out.println("ERROR:No Raw results.");
+ }
+ }
+ else
+ {
+ System.out.println("Retrieved " + al.getHeight() + " sequences.");
+ for (int s = 0; s < al.getHeight(); s++)
+ {
+ SequenceI sq = al.getSequenceAt(s);
+ while (sq.getDatasetSequence() != null)
+ {
+ sq = sq.getDatasetSequence();
+
+ }
+ if (ds == null)
+ {
+ ds = new Alignment(new SequenceI[] { sq });
+
+ }
+ else
+ {
+ ds.addSequence(sq);
+ }
+ }
+ }
+ System.out.flush();
+ System.err.flush();
+
+ }
+ if (noProds.size() > 0)
+ {
+ Enumeration ts = noProds.elements();
+ while (ts.hasMoreElements())
+
+ {
+ Object[] typeSq = (Object[]) ts.nextElement();
+ boolean dna = (typeSq.length > 1);
+ AlignmentI al = (AlignmentI) typeSq[0];
+ System.out.println("Trying getProducts for "
+ + al.getSequenceAt(0).getDisplayId(true));
+ System.out.println("Search DS Xref for: "
+ + (dna ? "dna" : "prot"));
+ // have a bash at finding the products amongst all the retrieved
+ // sequences.
+ SequenceI[] seqs = al.getSequencesArray();
+ Alignment prodal = jalview.analysis.CrossRef.findXrefSequences(
+ seqs, dna, null, ds);
+ System.out.println("Found "
+ + ((prodal == null) ? "no" : "" + prodal.getHeight())
+ + " products");
+ if (prodal != null)
+ {
+ SequenceI[] prod = prodal.getSequencesArray(); // note
+ // should
+ // test
+ // rather
+ // than
+ // throw
+ // away
+ // codon
+ // mapping
+ // (if
+ // present)
+ for (int p = 0; p < prod.length; p++)
+ {
+ System.out.println("Prod " + p + ": "
+ + prod[p].getDisplayId(true));
+ }
+ }
+ }
+
+ }
+
+ }
+ }
+
+ /**
+ * query the currently defined DAS source registry for sequence sources and
+ * add a DasSequenceSource instance for each source to the SequenceFetcher
+ * source list.
+ */
+ public void registerDasSequenceSources()
+ {
+ // TODO: define a context as a registry provider (either desktop,
+ // jalview.bin.cache, or something else).
+ for (jalviewSourceI source : jalview.bin.Cache.getDasSourceRegistry()
+ .getSources())
+ {
+ if (source.isSequenceSource())
+ {
+ List<DbSourceProxy> dassources = source.getSequenceSourceProxies();
+ for (DbSourceProxy seqsrc : dassources)
+ {
+ addDbRefSourceImpl(seqsrc);
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/jalview/ws/WSClient.java b/src/jalview/ws/WSClient.java
index 3f10686..4ca0b76 100644
--- a/src/jalview/ws/WSClient.java
+++ b/src/jalview/ws/WSClient.java
@@ -1,23 +1,26 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws;
-import jalview.gui.*;
+import jalview.gui.WebserviceInfo;
public abstract class WSClient // implements WSMenuEntryProviderI
{
diff --git a/src/jalview/ws/WSClientI.java b/src/jalview/ws/WSClientI.java
index 993865c..2b3539e 100644
--- a/src/jalview/ws/WSClientI.java
+++ b/src/jalview/ws/WSClientI.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws;
diff --git a/src/jalview/ws/WSMenuEntryProviderI.java b/src/jalview/ws/WSMenuEntryProviderI.java
index 608a282..76f5519 100644
--- a/src/jalview/ws/WSMenuEntryProviderI.java
+++ b/src/jalview/ws/WSMenuEntryProviderI.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws;
@@ -25,7 +28,9 @@ public interface WSMenuEntryProviderI
{
/**
* Called by the AlignFrame web service menu constructor to enable a service
- * instance to add menu entries. Usually, any actionperformed methods associated with menu items will create new instances of GUI classes to handle the action in a thread-safe manner.
+ * instance to add menu entries. Usually, any actionperformed methods
+ * associated with menu items will create new instances of GUI classes to
+ * handle the action in a thread-safe manner.
*
* @param wsmenu
* the menu to which any menu entries/sub menus are to be attached
diff --git a/src/jalview/ws/dbsources/DasSequenceSource.java b/src/jalview/ws/dbsources/DasSequenceSource.java
deleted file mode 100644
index f03665d..0000000
--- a/src/jalview/ws/dbsources/DasSequenceSource.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import java.util.Hashtable;
-
-import org.biojava.dasobert.das.SequenceThread;
-import org.biojava.dasobert.das2.Das2Source;
-import org.biojava.dasobert.dasregistry.Das1Source;
-import org.biojava.dasobert.dasregistry.DasCoordinateSystem;
-import org.biojava.dasobert.dasregistry.DasSource;
-import org.biojava.dasobert.eventmodel.SequenceEvent;
-import org.biojava.dasobert.eventmodel.SequenceListener;
-
-import com.stevesoft.pat.Regex;
-
-import jalview.ws.dbsources.das.DasSequenceSourceListener;
-import jalview.ws.seqfetcher.*;
-import jalview.datamodel.AlignmentI;
-
-/**
- * an instance of this class is created for each unique DAS Sequence source (ie
- * one capable of handling the 'sequence' for a particular MapMaster)
- *
- * @author JimP
- *
- */
-public class DasSequenceSource extends DbSourceProxyImpl implements
- DbSourceProxy
-{
- protected Das1Source source = null;
-
- protected String dbname = "DASCS";
-
- protected String dbrefname = "das:source";
-
- protected DasCoordinateSystem coordsys = null;
-
- /**
- * create a new DbSource proxy for a DAS 1 source
- *
- * @param dbnbame
- * Human Readable Name to use when fetching from this source
- * @param dbrefname
- * DbRefName for DbRefs attached to sequences retrieved from this
- * source
- * @param source
- * Das1Source
- * @param coordsys
- * specific coordinate system to use for this source
- * @throws Exception
- * if source is not capable of the 'sequence' command
- */
- public DasSequenceSource(String dbname, String dbrefname,
- Das1Source source, DasCoordinateSystem coordsys) throws Exception
- {
- if (!source.hasCapability("sequence"))
- {
- throw new Exception("Source " + source.getNickname()
- + " does not support the sequence command.");
- }
- this.source = source;
- this.dbname = dbname;
- this.dbrefname = dbrefname;
- this.coordsys = coordsys;
- }
-
- public String getAccessionSeparator()
- {
- // cope with single sequences only
- return null;
- }
-
- public Regex getAccessionValidator()
- {
- /** ? * */
- return Regex.perlCode("\\S+");
- }
-
- public String getDbName()
- {
- // TODO: map to
- return dbname + " (DAS)";
- }
-
- public String getDbSource()
- {
- return dbrefname;
- }
-
- public String getDbVersion()
- {
- return coordsys.getVersion();
- }
-
- public AlignmentI getSequenceRecords(String queries) throws Exception
- {
- SequenceThread seqfetcher = new org.biojava.dasobert.das.SequenceThread(
- queries, source);
- DasSequenceSourceListener ourlistener = new DasSequenceSourceListener(
- this, queries);
- seqfetcher.addSequenceListener(ourlistener);
- seqfetcher.start();
- try
- {
- Thread.sleep(5);
- } catch (Exception e)
- {
- }
- ;
- while (ourlistener.isNotCalled() && seqfetcher.isAlive())
- {
- try
- {
- Thread.sleep(5);
- } catch (Exception e)
- {
- }
- ;
- }
- if (ourlistener.isNotCalled() || ourlistener.hasNoSequences())
- {
- System.err.println("Sequence Query to " + source.getNickname()
- + " with '" + queries + "' returned no sequences.");
- return null;
- }
- else
- {
- return ourlistener.getSequences();
- }
- }
-
- public String getTestQuery()
- {
- return coordsys.getTestCode();
- }
-
- public boolean isValidReference(String accession)
- {
- // TODO try to validate an accession against source
- // We don't really know how to do this without querying source
-
- return true;
- }
-
- /**
- * @return the source
- */
- public Das1Source getSource()
- {
- return source;
- }
-
- /**
- * @return the coordsys
- */
- public DasCoordinateSystem getCoordsys()
- {
- return coordsys;
- }
-}
diff --git a/src/jalview/ws/dbsources/EbiFileRetrievedProxy.java b/src/jalview/ws/dbsources/EbiFileRetrievedProxy.java
index d803bea..09ce4bc 100644
--- a/src/jalview/ws/dbsources/EbiFileRetrievedProxy.java
+++ b/src/jalview/ws/dbsources/EbiFileRetrievedProxy.java
@@ -1,64 +1,66 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-
-import com.stevesoft.pat.Regex;
-
-import jalview.datamodel.AlignmentI;
-import jalview.ws.seqfetcher.DbSourceProxyImpl;
-
-public abstract class EbiFileRetrievedProxy extends DbSourceProxyImpl
-{
-
- /**
- * temp path to retrieved file
- */
- protected String file = null;
-
- public StringBuffer getRawRecords()
- {
- if (file == null)
- return null;
- StringBuffer bf = null;
- try
- {
- File f = new File(file);
- if (f.exists())
- {
- bf = new StringBuffer();
- BufferedReader breader = new BufferedReader(new FileReader(f));
- String line = null;
- while (breader.ready() && (line = breader.readLine()) != null)
- {
- bf.append(line);
- }
- breader.close();
- }
- } catch (Exception e)
- {
- System.err.println("Warning: problems reading temp file " + file);
- return null;
- }
- return bf;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+public abstract class EbiFileRetrievedProxy extends DbSourceProxyImpl
+{
+
+ /**
+ * temp path to retrieved file
+ */
+ protected String file = null;
+
+ public StringBuffer getRawRecords()
+ {
+ if (file == null)
+ {
+ return null;
+ }
+ StringBuffer bf = null;
+ try
+ {
+ File f = new File(file);
+ if (f.exists())
+ {
+ bf = new StringBuffer();
+ BufferedReader breader = new BufferedReader(new FileReader(f));
+ String line = null;
+ while (breader.ready() && (line = breader.readLine()) != null)
+ {
+ bf.append(line);
+ }
+ breader.close();
+ }
+ } catch (Exception e)
+ {
+ System.err.println("Warning: problems reading temp file " + file);
+ return null;
+ }
+ return bf;
+ }
+
+}
diff --git a/src/jalview/ws/dbsources/EmblCdsSouce.java b/src/jalview/ws/dbsources/EmblCdsSouce.java
index 1345f48..40a4098 100644
--- a/src/jalview/ws/dbsources/EmblCdsSouce.java
+++ b/src/jalview/ws/dbsources/EmblCdsSouce.java
@@ -1,88 +1,95 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import java.util.Hashtable;
-
-import com.stevesoft.pat.Regex;
-
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefSource;
-import jalview.ws.seqfetcher.DbSourceProxy;
-
-public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy
-{
-
- public EmblCdsSouce()
- {
- super();
- addDbSourceProperty(DBRefSource.CODINGSEQDB);
- }
-
- public String getAccessionSeparator()
- {
- return null;
- }
-
- public Regex getAccessionValidator()
- {
- return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");
- }
-
- public String getDbSource()
- {
- return DBRefSource.EMBLCDS;
- }
-
- public String getDbVersion()
- {
- return "0"; // TODO : this is dynamically set for a returned record - not
- // tied to proxy
- }
-
- public AlignmentI getSequenceRecords(String queries) throws Exception
- {
- if (queries.indexOf(".") > -1)
- {
- queries = queries.substring(0, queries.indexOf("."));
- }
- return getEmblSequenceRecords(DBRefSource.EMBLCDS, queries);
- }
-
- public boolean isValidReference(String accession)
- {
- // most embl CDS refs look like ..
- // TODO: improve EMBLCDS regex
- return (accession == null || accession.length() < 2) ? false
- : getAccessionValidator().search(accession);
- }
-
- /**
- * cDNA for LDHA_CHICK swissprot sequence
- */
- public String getTestQuery()
- {
- return "CAA37824";
- }
-
- public String getDbName()
- {
- return "EMBL (CDS)";
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefSource;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import com.stevesoft.pat.Regex;
+
+public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy
+{
+
+ public EmblCdsSouce()
+ {
+ super();
+ addDbSourceProperty(DBRefSource.CODINGSEQDB);
+ }
+
+ public String getAccessionSeparator()
+ {
+ return null;
+ }
+
+ public Regex getAccessionValidator()
+ {
+ return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");
+ }
+
+ public String getDbSource()
+ {
+ return DBRefSource.EMBLCDS;
+ }
+
+ public String getDbVersion()
+ {
+ return "0"; // TODO : this is dynamically set for a returned record - not
+ // tied to proxy
+ }
+
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ if (queries.indexOf(".") > -1)
+ {
+ queries = queries.substring(0, queries.indexOf("."));
+ }
+ return getEmblSequenceRecords(DBRefSource.EMBLCDS, queries);
+ }
+
+ public boolean isValidReference(String accession)
+ {
+ // most embl CDS refs look like ..
+ // TODO: improve EMBLCDS regex
+ return (accession == null || accession.length() < 2) ? false
+ : getAccessionValidator().search(accession);
+ }
+
+ /**
+ * cDNA for LDHA_CHICK swissprot sequence
+ */
+ public String getTestQuery()
+ {
+ return "CAA37824";
+ }
+
+ public String getDbName()
+ {
+ return "EMBL (CDS)";
+ }
+
+ @Override
+ public int getTier()
+ {
+ return 0;
+ }
+
+}
diff --git a/src/jalview/ws/dbsources/EmblSource.java b/src/jalview/ws/dbsources/EmblSource.java
index 9573f72..3d57000 100644
--- a/src/jalview/ws/dbsources/EmblSource.java
+++ b/src/jalview/ws/dbsources/EmblSource.java
@@ -1,127 +1,126 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import java.io.File;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-
-import com.stevesoft.pat.Regex;
-
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefSource;
-import jalview.datamodel.SequenceI;
-import jalview.datamodel.xdb.embl.EmblEntry;
-import jalview.ws.ebi.EBIFetchClient;
-import jalview.ws.seqfetcher.DbSourceProxy;
-import jalview.ws.seqfetcher.DbSourceProxyImpl;
-
-/**
- * @author JimP
- *
- */
-public class EmblSource extends EmblXmlSource implements DbSourceProxy
-{
-
- public EmblSource()
- {
- addDbSourceProperty(DBRefSource.DNASEQDB);
- addDbSourceProperty(DBRefSource.CODINGSEQDB);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
- */
- public String getAccessionSeparator()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getAccessionValidator()
- */
- public Regex getAccessionValidator()
- {
- return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbSource()
- */
- public String getDbSource()
- {
- return DBRefSource.EMBL;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbVersion()
- */
- public String getDbVersion()
- {
- // TODO Auto-generated method stub
- return "0";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
- */
- public AlignmentI getSequenceRecords(String queries) throws Exception
- {
- return getEmblSequenceRecords(DBRefSource.EMBL, queries);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
- */
- public boolean isValidReference(String accession)
- {
- // most embl refs look like ..
-
- return (accession == null || accession.length() < 2) ? false
- : getAccessionValidator().search(accession);
-
- }
-
- /**
- * return LHD_CHICK coding gene
- */
- public String getTestQuery()
- {
- return "X53828";
- }
-
- public String getDbName()
- {
- return "EMBL"; // getDbSource();
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefSource;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import com.stevesoft.pat.Regex;
+
+/**
+ * @author JimP
+ *
+ */
+public class EmblSource extends EmblXmlSource implements DbSourceProxy
+{
+
+ public EmblSource()
+ {
+ addDbSourceProperty(DBRefSource.DNASEQDB);
+ addDbSourceProperty(DBRefSource.CODINGSEQDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator()
+ */
+ public Regex getAccessionValidator()
+ {
+ return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource()
+ */
+ public String getDbSource()
+ {
+ return DBRefSource.EMBL;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ public String getDbVersion()
+ {
+ // TODO Auto-generated method stub
+ return "0";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ return getEmblSequenceRecords(DBRefSource.EMBL, queries);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ // most embl refs look like ..
+
+ return (accession == null || accession.length() < 2) ? false
+ : getAccessionValidator().search(accession);
+
+ }
+
+ /**
+ * return LHD_CHICK coding gene
+ */
+ public String getTestQuery()
+ {
+ return "X53828";
+ }
+
+ public String getDbName()
+ {
+ return "EMBL"; // getDbSource();
+ }
+
+ @Override
+ public int getTier()
+ {
+ return 0;
+ }
+}
diff --git a/src/jalview/ws/dbsources/EmblXmlSource.java b/src/jalview/ws/dbsources/EmblXmlSource.java
index 80206c0..697e4ee 100644
--- a/src/jalview/ws/dbsources/EmblXmlSource.java
+++ b/src/jalview/ws/dbsources/EmblXmlSource.java
@@ -1,162 +1,158 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SequenceI;
-import jalview.datamodel.xdb.embl.EmblEntry;
-import jalview.ws.ebi.EBIFetchClient;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.Vector;
-
-public abstract class EmblXmlSource extends EbiFileRetrievedProxy
-{
-
- /**
- * Last properly parsed embl file.
- */
- public jalview.datamodel.xdb.embl.EmblFile efile = null;
-
- public EmblXmlSource()
- {
- super();
- }
-
- /**
- * retrieve and parse an emblxml file
- *
- * @param emprefx
- * either EMBL or EMBLCDS strings are allowed - anything else will
- * not retrieve emblxml
- * @param query
- * @return
- * @throws Exception
- */
- public AlignmentI getEmblSequenceRecords(String emprefx, String query)
- throws Exception
- {
- startQuery();
- EBIFetchClient dbFetch = new EBIFetchClient();
- File reply;
- try
- {
- reply = dbFetch.fetchDataAsFile(
- emprefx.toLowerCase() + ":" + query.trim(), "emblxml", null);
- } catch (Exception e)
- {
- stopQuery();
- throw new Exception("EBI EMBL XML retrieval failed on "
- + emprefx.toLowerCase() + ":" + query.trim(), e);
- }
- return getEmblSequenceRecords(emprefx, query, reply);
- }
-
- /**
- * parse an emblxml file stored locally
- *
- * @param emprefx
- * either EMBL or EMBLCDS strings are allowed - anything else will
- * not retrieve emblxml
- * @param query
- * @param file
- * the EMBL XML file containing the results of a query
- * @return
- * @throws Exception
- */
- public AlignmentI getEmblSequenceRecords(String emprefx, String query,
- File reply) throws Exception
- {
- SequenceI seqs[] = null;
- StringBuffer result = new StringBuffer();
- if (reply != null && reply.exists())
- {
- efile = null;
- file = reply.getAbsolutePath();
- if (reply.length() > 25)
- {
- efile = jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply);
- }
- else
- {
- result.append("# No EMBL record retrieved for "
- + emprefx.toLowerCase() + ":" + query.trim());
- }
- }
- if (efile != null)
- {
- for (Iterator i = efile.getEntries().iterator(); i.hasNext();)
- {
- EmblEntry entry = (EmblEntry) i.next();
- SequenceI[] seqparts = entry.getSequences(false, true, emprefx); // TODO:
- // use
- // !fetchNa,!fetchPeptide
- // here
- // instead
- // -
- // see
- // todo
- // in
- // emblEntry
- if (seqparts != null)
- {
- SequenceI[] newseqs = null;
- int si = 0;
- if (seqs == null)
- {
- newseqs = new SequenceI[seqparts.length];
- }
- else
- {
- newseqs = new SequenceI[seqs.length + seqparts.length];
-
- for (; si < seqs.length; si++)
- {
- newseqs[si] = seqs[si];
- seqs[si] = null;
- }
- }
- for (int j = 0; j < seqparts.length; si++, j++)
- {
- newseqs[si] = seqparts[j].deriveSequence(); // place DBReferences on
- // dataset and refer
- }
- seqs = newseqs;
-
- }
- }
- }
- else
- {
- result = null;
- }
- AlignmentI al = null;
- if (seqs != null && seqs.length > 0)
- {
- al = new Alignment(seqs);
- result.append("# Successfully parsed the " + emprefx
- + " queries into an Alignment");
- results = result;
- }
- stopQuery();
- return al;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.xdb.embl.EmblEntry;
+import jalview.datamodel.xdb.embl.EmblFile;
+import jalview.util.MessageManager;
+import jalview.ws.ebi.EBIFetchClient;
+
+import java.io.File;
+
+public abstract class EmblXmlSource extends EbiFileRetrievedProxy
+{
+
+ /**
+ * Last properly parsed embl file.
+ */
+ public EmblFile efile = null;
+
+ public EmblXmlSource()
+ {
+ super();
+ }
+
+ /**
+ * retrieve and parse an emblxml file
+ *
+ * @param emprefx
+ * either EMBL or EMBLCDS strings are allowed - anything else will
+ * not retrieve emblxml
+ * @param query
+ * @return
+ * @throws Exception
+ */
+ public AlignmentI getEmblSequenceRecords(String emprefx, String query)
+ throws Exception
+ {
+ startQuery();
+ EBIFetchClient dbFetch = new EBIFetchClient();
+ File reply;
+ try
+ {
+ reply = dbFetch.fetchDataAsFile(
+ emprefx.toLowerCase() + ":" + query.trim(), "emblxml", null);
+ } catch (Exception e)
+ {
+ stopQuery();
+ throw new Exception(MessageManager.formatMessage(
+ "exception.ebiembl_retrieval_failed_on", new String[] {
+ emprefx.toLowerCase(), query.trim() }), e);
+ }
+ return getEmblSequenceRecords(emprefx, query, reply);
+ }
+
+ /**
+ * parse an emblxml file stored locally
+ *
+ * @param emprefx
+ * either EMBL or EMBLCDS strings are allowed - anything else will
+ * not retrieve emblxml
+ * @param query
+ * @param file
+ * the EMBL XML file containing the results of a query
+ * @return
+ * @throws Exception
+ */
+ public AlignmentI getEmblSequenceRecords(String emprefx, String query,
+ File reply) throws Exception
+ {
+ SequenceI seqs[] = null;
+ StringBuffer result = new StringBuffer();
+ if (reply != null && reply.exists())
+ {
+ efile = null;
+ file = reply.getAbsolutePath();
+ if (reply.length() > 25)
+ {
+ efile = EmblFile.getEmblFile(reply);
+ }
+ else
+ {
+ result.append(MessageManager.formatMessage(
+ "label.no_embl_record_found",
+ new String[] { emprefx.toLowerCase(), query.trim() }));
+ }
+ }
+ if (efile != null)
+ {
+ for (EmblEntry entry : efile.getEntries())
+ {
+ SequenceI[] seqparts = entry.getSequences(false, true, emprefx);
+ // TODO: use !fetchNa,!fetchPeptide here instead - see todo in EmblEntry
+ if (seqparts != null)
+ {
+ SequenceI[] newseqs = null;
+ int si = 0;
+ if (seqs == null)
+ {
+ newseqs = new SequenceI[seqparts.length];
+ }
+ else
+ {
+ newseqs = new SequenceI[seqs.length + seqparts.length];
+
+ for (; si < seqs.length; si++)
+ {
+ newseqs[si] = seqs[si];
+ seqs[si] = null;
+ }
+ }
+ for (int j = 0; j < seqparts.length; si++, j++)
+ {
+ newseqs[si] = seqparts[j].deriveSequence();
+ // place DBReferences on dataset and refer
+ }
+ seqs = newseqs;
+
+ }
+ }
+ }
+ else
+ {
+ result = null;
+ }
+ AlignmentI al = null;
+ if (seqs != null && seqs.length > 0)
+ {
+ al = new Alignment(seqs);
+ result.append(MessageManager.formatMessage(
+ "label.embl_successfully_parsed", new String[] { emprefx }));
+ results = result;
+ }
+ stopQuery();
+ return al;
+ }
+
+}
diff --git a/src/jalview/ws/dbsources/GeneDbSource.java b/src/jalview/ws/dbsources/GeneDbSource.java
index 1cbfef8..3b251ed 100644
--- a/src/jalview/ws/dbsources/GeneDbSource.java
+++ b/src/jalview/ws/dbsources/GeneDbSource.java
@@ -1,130 +1,129 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import java.io.File;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-
-import com.stevesoft.pat.Regex;
-
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefSource;
-import jalview.datamodel.SequenceI;
-import jalview.datamodel.xdb.embl.EmblEntry;
-import jalview.ws.ebi.EBIFetchClient;
-import jalview.ws.seqfetcher.DbSourceProxy;
-import jalview.ws.seqfetcher.DbSourceProxyImpl;
-
-/**
- * Test class for accessing GeneDB - not yet finished.
- *
- * @author JimP
- *
- */
-public class GeneDbSource extends EmblXmlSource implements DbSourceProxy
-{
-
- public GeneDbSource()
- {
- addDbSourceProperty(DBRefSource.DNASEQDB);
- addDbSourceProperty(DBRefSource.CODINGSEQDB);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
- */
- public String getAccessionSeparator()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getAccessionValidator()
- */
- public Regex getAccessionValidator()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbSource()
- */
- public String getDbSource()
- {
- return DBRefSource.GENEDB;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbVersion()
- */
- public String getDbVersion()
- {
- // TODO Auto-generated method stub
- return "0";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
- */
- public AlignmentI getSequenceRecords(String queries) throws Exception
- {
- // query of form
- // http://www.genedb.org/genedb/ArtemisFormHandler?id=&dest=EMBL
- //
- return getEmblSequenceRecords(DBRefSource.GENEDB, queries);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
- */
- public boolean isValidReference(String accession)
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- /**
- * return T.Brucei Mannosyl-Transferase TbPIG-M
- */
- public String getTestQuery()
- {
- return "Tb927.6.3300";
- }
-
- public String getDbName()
- {
- return "GeneDB"; // getDbSource();
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefSource;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import com.stevesoft.pat.Regex;
+
+/**
+ * Test class for accessing GeneDB - not yet finished.
+ *
+ * @author JimP
+ *
+ */
+public class GeneDbSource extends EmblXmlSource implements DbSourceProxy
+{
+
+ public GeneDbSource()
+ {
+ addDbSourceProperty(DBRefSource.DNASEQDB);
+ addDbSourceProperty(DBRefSource.CODINGSEQDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator()
+ */
+ public Regex getAccessionValidator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource()
+ */
+ public String getDbSource()
+ {
+ return DBRefSource.GENEDB;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ public String getDbVersion()
+ {
+ // TODO Auto-generated method stub
+ return "0";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ // query of form
+ // http://www.genedb.org/genedb/ArtemisFormHandler?id=&dest=EMBL
+ //
+ return getEmblSequenceRecords(DBRefSource.GENEDB, queries);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /**
+ * return T.Brucei Mannosyl-Transferase TbPIG-M
+ */
+ public String getTestQuery()
+ {
+ return "Tb927.6.3300";
+ }
+
+ public String getDbName()
+ {
+ return "GeneDB"; // getDbSource();
+ }
+
+ @Override
+ public int getTier()
+ {
+ return 0;
+ }
+}
diff --git a/src/jalview/ws/dbsources/PDBRestClient.java b/src/jalview/ws/dbsources/PDBRestClient.java
new file mode 100644
index 0000000..44ef3fc
--- /dev/null
+++ b/src/jalview/ws/dbsources/PDBRestClient.java
@@ -0,0 +1,422 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.util.MessageManager;
+import jalview.ws.uimodel.PDBRestRequest;
+import jalview.ws.uimodel.PDBRestResponse;
+import jalview.ws.uimodel.PDBRestResponse.PDBResponseSummary;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.ws.rs.core.MediaType;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+
+/**
+ * A rest client for querying the Search endpoing of the PDB REST API
+ *
+ * @author tcnofoegbu
+ *
+ */
+public class PDBRestClient
+{
+ public static final String PDB_SEARCH_ENDPOINT = "http://www.ebi.ac.uk/pdbe/search/pdb/select?";
+
+ private static int DEFAULT_RESPONSE_SIZE = 200;
+
+ /**
+ * Takes a PDBRestRequest object and returns a response upon execution
+ *
+ * @param pdbRestRequest
+ * the PDBRestRequest instance to be processed
+ * @return the pdbResponse object for the given request
+ * @throws Exception
+ */
+ public PDBRestResponse executeRequest(PDBRestRequest pdbRestRequest)
+ throws Exception
+ {
+ try
+ {
+ ClientConfig clientConfig = new DefaultClientConfig();
+ Client client = Client.create(clientConfig);
+
+ String wantedFields = getPDBDocFieldsAsCommaDelimitedString(pdbRestRequest
+ .getWantedFields());
+ int responseSize = (pdbRestRequest.getResponseSize() == 0) ? DEFAULT_RESPONSE_SIZE
+ : pdbRestRequest.getResponseSize();
+ String sortParam = (pdbRestRequest.getFieldToSortBy() == null || pdbRestRequest
+ .getFieldToSortBy().trim().isEmpty()) ? "" : (pdbRestRequest
+ .getFieldToSortBy() + (pdbRestRequest.isAscending() ? " asc"
+ : " desc"));
+ // Build request parameters for the REST Request
+ WebResource webResource = client.resource(PDB_SEARCH_ENDPOINT)
+ .queryParam("wt", "json").queryParam("fl", wantedFields)
+ .queryParam("rows", String.valueOf(responseSize))
+ .queryParam("q", pdbRestRequest.getQuery())
+ .queryParam("sort", sortParam);
+
+ // Execute the REST request
+ ClientResponse clientResponse = webResource.accept(
+ MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+ // Get the JSON string from the response object
+ String responseString = clientResponse.getEntity(String.class);
+
+ // Check the response status and report exception if one occurs
+ if (clientResponse.getStatus() != 200)
+ {
+ String errorMessage = "";
+ if (clientResponse.getStatus() == 400)
+ {
+ errorMessage = parseJsonExceptionString(responseString);
+ throw new Exception(errorMessage);
+ }
+ else
+ {
+ errorMessage = getMessageByHTTPStatusCode(clientResponse
+ .getStatus());
+ throw new Exception(errorMessage);
+ }
+ }
+
+ // Make redundant objects eligible for garbage collection to conserve
+ // memory
+ clientResponse = null;
+ client = null;
+
+ // Process the response and return the result to the caller.
+ return parsePDBJsonResponse(responseString, pdbRestRequest);
+ } catch (Exception e)
+ {
+ String exceptionMsg = e.getMessage();
+ if (exceptionMsg.contains("SocketException"))
+ {
+ // No internet connection
+ throw new Exception(
+ MessageManager
+ .getString("exception.unable_to_detect_internet_connection"));
+ }
+ else if (exceptionMsg.contains("UnknownHostException"))
+ {
+ // The server 'www.ebi.ac.uk' is unreachable
+ throw new Exception(
+ MessageManager
+ .getString("exception.pdb_server_unreachable"));
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+
+ public String getMessageByHTTPStatusCode(int code)
+ {
+ String message = "";
+ switch (code)
+ {
+ case 410:
+ message = MessageManager
+ .getString("exception.pdb_rest_service_no_longer_available");
+ break;
+ case 403:
+ case 404:
+ message = MessageManager.getString("exception.resource_not_be_found");
+ break;
+ case 408:
+ case 409:
+ case 500:
+ case 501:
+ case 502:
+ case 503:
+ case 504:
+ case 505:
+ message = MessageManager.getString("exception.pdb_server_error");
+ break;
+
+ default:
+ break;
+ }
+ return message;
+ }
+
+ /**
+ * Process error response from PDB server if/when one occurs.
+ *
+ * @param jsonResponse
+ * the JSON string containing error message from the server
+ * @return the processed error message from the JSON string
+ */
+ public static String parseJsonExceptionString(String jsonErrorResponse)
+ {
+ StringBuilder errorMessage = new StringBuilder(
+ "\n============= PDB Rest Client RunTime error =============\n");
+
+ try
+ {
+ JSONParser jsonParser = new JSONParser();
+ JSONObject jsonObj = (JSONObject) jsonParser.parse(jsonErrorResponse);
+ JSONObject errorResponse = (JSONObject) jsonObj.get("error");
+
+ JSONObject responseHeader = (JSONObject) jsonObj
+ .get("responseHeader");
+ JSONObject paramsObj = (JSONObject) responseHeader.get("params");
+ String status = responseHeader.get("status").toString();
+ String message = errorResponse.get("msg").toString();
+ String query = paramsObj.get("q").toString();
+ String fl = paramsObj.get("fl").toString();
+
+ errorMessage.append("Status: ").append(status).append("\n");
+ errorMessage.append("Message: ").append(message).append("\n");
+ errorMessage.append("query: ").append(query).append("\n");
+ errorMessage.append("fl: ").append(fl).append("\n");
+
+ } catch (ParseException e)
+ {
+ e.printStackTrace();
+ }
+ return errorMessage.toString();
+ }
+
+ /**
+ * Parses the JSON response string from PDB REST API. The response is dynamic
+ * hence, only fields specifically requested for in the 'wantedFields'
+ * parameter is fetched/processed
+ *
+ * @param pdbJsonResponseString
+ * the JSON string to be parsed
+ * @param pdbRestRequest
+ * the request object which contains parameters used to process the
+ * JSON string
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public static PDBRestResponse parsePDBJsonResponse(
+ String pdbJsonResponseString, PDBRestRequest pdbRestRequest)
+ {
+ PDBRestResponse searchResult = new PDBRestResponse();
+ List<PDBResponseSummary> result = null;
+ try
+ {
+ JSONParser jsonParser = new JSONParser();
+ JSONObject jsonObj = (JSONObject) jsonParser
+ .parse(pdbJsonResponseString);
+
+ JSONObject pdbResponse = (JSONObject) jsonObj.get("response");
+ String queryTime = ((JSONObject) jsonObj.get("responseHeader")).get(
+ "QTime").toString();
+ int numFound = Integer
+ .valueOf(pdbResponse.get("numFound").toString());
+ if (numFound > 0)
+ {
+ result = new ArrayList<PDBResponseSummary>();
+ JSONArray docs = (JSONArray) pdbResponse.get("docs");
+ for (Iterator<JSONObject> docIter = docs.iterator(); docIter
+ .hasNext();)
+ {
+ JSONObject doc = docIter.next();
+ result.add(searchResult.new PDBResponseSummary(doc,
+ pdbRestRequest));
+ }
+ searchResult.setNumberOfItemsFound(numFound);
+ searchResult.setResponseTime(queryTime);
+ searchResult.setSearchSummary(result);
+ }
+ } catch (ParseException e)
+ {
+ e.printStackTrace();
+ }
+ return searchResult;
+ }
+
+ /**
+ * Takes a collection of PDBDocField and converts its 'code' Field values into
+ * a comma delimited string.
+ *
+ * @param pdbDocfields
+ * the collection of PDBDocField to process
+ * @return the comma delimited string from the pdbDocFields collection
+ */
+ public static String getPDBDocFieldsAsCommaDelimitedString(
+ Collection<PDBDocField> pdbDocfields)
+ {
+ String result = "";
+ if (pdbDocfields != null && !pdbDocfields.isEmpty())
+ {
+ StringBuilder returnedFields = new StringBuilder();
+ for (PDBDocField field : pdbDocfields)
+ {
+ returnedFields.append(",").append(field.getCode());
+ }
+ returnedFields.deleteCharAt(0);
+ result = returnedFields.toString();
+ }
+ return result;
+ }
+
+ /**
+ * Determines the column index for 'PDB Id' Fields in the dynamic summary
+ * table. The PDB Id serves as a unique identifier for a given row in the
+ * summary table
+ *
+ * @param wantedFields
+ * the available table columns in no particular order
+ * @return the pdb id field column index
+ */
+ public static int getPDBIdColumIndex(
+ Collection<PDBDocField> wantedFields, boolean hasRefSeq)
+ {
+
+ // If a reference sequence is attached then start counting from 1 else
+ // start from zero
+ int pdbFieldIndexCounter = hasRefSeq ? 1 : 0;
+
+ for (PDBDocField field : wantedFields)
+ {
+ if (field.equals(PDBDocField.PDB_ID))
+ {
+ break; // Once PDB Id index is determined exit iteration
+ }
+ ++pdbFieldIndexCounter;
+ }
+ return pdbFieldIndexCounter;
+ }
+
+ /**
+ * This enum represents the fields available in the PDB JSON response
+ *
+ */
+ public enum PDBDocField
+ {
+ PDB_ID("PDB Id", "pdb_id"), TITLE("Title", "title"), MOLECULE_NAME(
+ "Molecule", "molecule_name"), MOLECULE_TYPE("Molecule Type",
+ "molecule_type"), MOLECULE_SEQUENCE("Sequence",
+ "molecule_sequence"), PFAM_ACCESSION("PFAM Accession",
+ "pfam_accession"), PFAM_NAME("PFAM Name", "pfam_name"), INTERPRO_NAME(
+ "InterPro Name", "interpro_name"), INTERPRO_ACCESSION(
+ "InterPro Accession", "interpro_accession"), UNIPROT_ID(
+ "UniProt Id", "uniprot_id"), UNIPROT_ACCESSION(
+ "UniProt Accession", "uniprot_accession"), UNIPROT_COVERAGE(
+ "UniProt Coverage", "uniprot_coverage"), UNIPROT_FEATURES(
+ "Uniprot Features", "uniprot_features"), R_FACTOR("R Factor",
+ "r_factor"), RESOLUTION("Resolution", "resolution"), DATA_QUALITY(
+ "Data Quality", "data_quality"), OVERALL_QUALITY(
+ "Overall Quality", "overall_quality"), POLYMER_COUNT(
+ "Number of Polymers", "number_of_polymers"), PROTEIN_CHAIN_COUNT(
+ "Number of Protein Chains", "number_of_protein_chains"), BOUND_MOLECULE_COUNT(
+ "Number of Bound Molecule", "number_of_bound_molecules"), POLYMER_RESIDUE_COUNT(
+ "Number of Polymer Residue", "number_of_polymer_residues"), GENUS(
+ "GENUS", "genus"), GENE_NAME("Gene Name", "gene_name"), EXPERIMENTAL_METHOD(
+ "Experimental Method", "experimental_method"), GO_ID("GO Id",
+ "go_id"), ASSEMBLY_ID("Assembly Id", "assembly_form"), ASSEMBLY_FORM(
+ "Assembly Form", "assembly_id"), ASSEMBLY_TYPE("Assembly Type",
+ "assembly_type"), SPACE_GROUP("Space Group", "spacegroup"), CATH_CODE(
+ "Cath Code", "cath_code"), TAX_ID("Tax Id", "tax_id"), TAX_QUERY(
+ "Tax Query", "tax_query"), INTERACTING_ENTRY_ID(
+ "Interacting Entry Id", "interacting_entry_id"), INTERACTING_ENTITY_ID(
+ "Interacting Entity Id", "interacting_entity_id"), INTERACTING_MOLECULES(
+ "Interacting Molecules", "interacting_molecules"), PUBMED_ID(
+ "Pubmed Id", "pubmed_id"), STATUS("Status", "status"), MODEL_QUALITY(
+ "Model Quality", "model_quality"), PIVOT_RESOLUTION(
+ "Pivot Resolution", "pivot_resolution"), DATA_REDUCTION_SOFTWARE(
+ "Data reduction software", "data_reduction_software"), MAX_OBSERVED_RES(
+ "Max observed residues", "max_observed_residues"), ORG_SCI_NAME(
+ "Organism scientific name", "organism_scientific_name"), SUPER_KINGDOM(
+ "Super kingdom", "superkingdom"), RANK("Rank", "rank"), CRYSTALLISATION_PH(
+ "Crystallisation Ph", "crystallisation_ph"), BIOLOGICAL_FUNCTION(
+ "Biological Function", "biological_function"), BIOLOGICAL_PROCESS(
+ "Biological Process", "biological_process"), BIOLOGICAL_CELL_COMPONENT(
+ "Biological Cell Component", "biological_cell_component"), COMPOUND_NAME(
+ "Compound Name", "compound_name"), COMPOUND_ID("Compound Id",
+ "compound_id"), COMPOUND_WEIGHT("Compound Weight",
+ "compound_weight"), COMPOUND_SYSTEMATIC_NAME(
+ "Compound Systematic Name", "compound_systematic_name"), INTERACTING_LIG(
+ "Interacting Ligands", "interacting_ligands"), JOURNAL(
+ "Journal", "journal"), ALL_AUTHORS("All Authors", "all_authors"), EXPERIMENTAL_DATA_AVAILABLE(
+ "Experiment Data Available", "experiment_data_available"), DIFFRACTION_PROTOCOL(
+ "Diffraction Protocol", "diffraction_protocol"), REFINEMENT_SOFTWARE(
+ "Refinement Software", "refinement_software"), STRUCTURE_DETERMINATION_METHOD(
+ "Structure Determination Method",
+ "structure_determination_method"), SYNCHROTON_SITE(
+ "Synchrotron Site", "synchrotron_site"), SAMPLE_PREP_METHOD(
+ "Sample Preparation Method", "sample_preparation_method"), ENTRY_AUTHORS(
+ "Entry Authors", "entry_authors"), CITATION_TITLE(
+ "Citation Title", "citation_title"), STRUCTURE_SOLUTION_SOFTWARE(
+ "Structure Solution Software", "structure_solution_software"), ENTRY_ENTITY(
+ "Entry Entity", "entry_entity"), R_FREE("R Free", "r_free"), NO_OF_POLYMER_ENTITIES(
+ "Number of Polymer Entities", "number_of_polymer_entities"), NO_OF_BOUND_ENTITIES(
+ "Number of Bound Entities", "number_of_bound_entities"), CRYSTALLISATION_RESERVOIR(
+ "Crystallisation Reservoir", "crystallisation_reservoir"), DATA_SCALING_SW(
+ "Data Scalling Software", "data_scaling_software"), DETECTOR(
+ "Detector", "detector"), DETECTOR_TYPE("Detector Type",
+ "detector_type"), MODIFIED_RESIDUE_FLAG(
+ "Modified Residue Flag", "modified_residue_flag"), NUMBER_OF_COPIES(
+ "Number of Copies", "number_of_copies"), STRUCT_ASYM_ID(
+ "Struc Asym Id", "struct_asym_id"), HOMOLOGUS_PDB_ENTITY_ID(
+ "Homologus PDB Entity Id", "homologus_pdb_entity_id"), MOLECULE_SYNONYM(
+ "Molecule Synonym", "molecule_synonym"), DEPOSITION_SITE(
+ "Deposition Site", "deposition_site"), SYNCHROTRON_BEAMLINE(
+ "Synchrotron Beamline", "synchrotron_beamline"), ENTITY_ID(
+ "Entity Id", "entity_id"), BEAM_SOURCE_NAME("Beam Source Name",
+ "beam_source_name"), PROCESSING_SITE("Processing Site",
+ "processing_site"), ENTITY_WEIGHT("Entity Weight",
+ "entity_weight"), VERSION("Version", "_version_"), ALL("ALL",
+ "text");
+
+ private String name;
+
+ private String code;
+
+ PDBDocField(String name, String code)
+ {
+ this.name = name;
+ this.code = code;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getCode()
+ {
+ return code;
+ }
+
+ public String toString()
+ {
+ return name;
+ }
+ }
+}
diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java
index 7586856..a125ce4 100644
--- a/src/jalview/ws/dbsources/Pdb.java
+++ b/src/jalview/ws/dbsources/Pdb.java
@@ -1,218 +1,246 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import jalview.datamodel.Alignment;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.DBRefSource;
-import jalview.datamodel.SequenceI;
-
-import java.io.BufferedInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import MCview.PDBChain;
-import MCview.PDBfile;
-
-import com.stevesoft.pat.Regex;
-
-import jalview.datamodel.AlignmentI;
-import jalview.io.FileParse;
-import jalview.ws.ebi.EBIFetchClient;
-import jalview.ws.seqfetcher.DbSourceProxy;
-import jalview.ws.seqfetcher.DbSourceProxyImpl;
-
-/**
- * @author JimP
- *
- */
-public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy
-{
- public Pdb()
- {
- super();
- addDbSourceProperty(DBRefSource.PROTSEQDB);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
- */
- public String getAccessionSeparator()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getAccessionValidator()
- */
- public Regex getAccessionValidator()
- {
- return new Regex("([1-9][0-9A-Za-z]{3}):?([ _A-Za-z0-9]?)");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbSource()
- */
- public String getDbSource()
- {
- return DBRefSource.PDB;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbVersion()
- */
- public String getDbVersion()
- {
- return "0";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
- */
- public AlignmentI getSequenceRecords(String queries) throws Exception
- {
-
- Vector result = new Vector();
- String chain = null;
- String id = null;
- if (queries.indexOf(":") > -1)
- {
- chain = queries.substring(queries.indexOf(":") + 1);
- id = queries.substring(0, queries.indexOf(":"));
- }
- else
- {
- id = queries;
- }
- if (queries.length() > 4 && chain == null)
- {
- chain = queries.substring(4, 5);
- id = queries.substring(0, 4);
- }
- if (!isValidReference(id))
- {
- System.err.println("Ignoring invalid pdb query: '" + id + "'");
- stopQuery();
- return null;
- }
- EBIFetchClient ebi = new EBIFetchClient();
- file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw").getAbsolutePath();
- stopQuery();
- if (file == null)
- {
- return null;
- }
- try
- {
-
- PDBfile pdbfile = new PDBfile(file,
- jalview.io.AppletFormatAdapter.FILE);
- for (int i = 0; i < pdbfile.chains.size(); i++)
- {
- if (chain == null
- || ((PDBChain) pdbfile.chains.elementAt(i)).id
- .toUpperCase().equals(chain))
- {
- PDBChain pdbchain = (PDBChain) pdbfile.chains.elementAt(i);
- // Get the Chain's Sequence - who's dataset includes any special
- // features added from the PDB file
- SequenceI sq = pdbchain.sequence;
- // Specially formatted name for the PDB chain sequences retrieved from
- // the PDB
- sq.setName(jalview.datamodel.DBRefSource.PDB + "|" + id + "|"
- + sq.getName());
- // Might need to add more metadata to the PDBEntry object
- // like below
- /*
- * PDBEntry entry = new PDBEntry(); // Construct the PDBEntry
- * entry.setId(id); if (entry.getProperty() == null)
- * entry.setProperty(new Hashtable());
- * entry.getProperty().put("chains", pdbchain.id + "=" + sq.getStart()
- * + "-" + sq.getEnd()); sq.getDatasetSequence().addPDBId(entry);
- */
- // Add PDB DB Refs
- // We make a DBRefEtntry because we have obtained the PDB file from a
- // verifiable source
- // JBPNote - PDB DBRefEntry should also carry the chain and mapping
- // information
- DBRefEntry dbentry = new DBRefEntry(getDbSource(),
- getDbVersion(), id + pdbchain.id);
- sq.addDBRef(dbentry);
- // and add seuqence to the retrieved set
- result.addElement(sq.deriveSequence());
- }
- }
-
- if (result.size() < 1)
- {
- throw new Exception("No PDB Records for " + id + " chain "
- + ((chain == null) ? "' '" : chain));
- }
- } catch (Exception ex) // Problem parsing PDB file
- {
- stopQuery();
- throw (ex);
- }
-
- SequenceI[] results = new SequenceI[result.size()];
- for (int i = 0, j = result.size(); i < j; i++)
- {
- results[i] = (SequenceI) result.elementAt(i);
- result.setElementAt(null, i);
- }
- return new Alignment(results);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
- */
- public boolean isValidReference(String accession)
- {
- Regex r = getAccessionValidator();
- return r.search(accession.trim());
- }
-
- /**
- * obtain human glyoxalase chain A sequence
- */
- public String getTestQuery()
- {
- return "1QIPA";
- }
-
- public String getDbName()
- {
- return "PDB"; // getDbSource();
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.io.FormatAdapter;
+import jalview.util.MessageManager;
+import jalview.ws.ebi.EBIFetchClient;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import com.stevesoft.pat.Regex;
+
+/**
+ * @author JimP
+ *
+ */
+public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy
+{
+ public Pdb()
+ {
+ super();
+ addDbSourceProperty(DBRefSource.PROTSEQDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator()
+ */
+ public Regex getAccessionValidator()
+ {
+ return new Regex("([1-9][0-9A-Za-z]{3}):?([ _A-Za-z0-9]?)");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource()
+ */
+ public String getDbSource()
+ {
+ return DBRefSource.PDB;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ public String getDbVersion()
+ {
+ return "0";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ AlignmentI pdbfile = null;
+ Vector result = new Vector();
+ String chain = null;
+ String id = null;
+ if (queries.indexOf(":") > -1)
+ {
+ chain = queries.substring(queries.indexOf(":") + 1);
+ id = queries.substring(0, queries.indexOf(":"));
+ }
+ else
+ {
+ id = queries;
+ }
+ if (queries.length() > 4 && chain == null)
+ {
+ chain = queries.substring(4, 5);
+ id = queries.substring(0, 4);
+ }
+ if (!isValidReference(id))
+ {
+ System.err.println("Ignoring invalid pdb query: '" + id + "'");
+ stopQuery();
+ return null;
+ }
+ EBIFetchClient ebi = new EBIFetchClient();
+ file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw").getAbsolutePath();
+ stopQuery();
+ if (file == null)
+ {
+ return null;
+ }
+ try
+ {
+
+ pdbfile = new FormatAdapter().readFile(file,
+ jalview.io.AppletFormatAdapter.FILE, "PDB");
+ if (pdbfile != null)
+ {
+ List<SequenceI> toremove = new ArrayList<SequenceI>();
+ for (SequenceI pdbcs : pdbfile.getSequences())
+ {
+ String chid = null;
+ // Mapping map=null;
+ for (PDBEntry pid : pdbcs.getAllPDBEntries())
+ {
+ if (pid.getFile() == file)
+ {
+ chid = pid.getChainCode();
+
+ }
+ ;
+
+ }
+ if (chain == null
+ || (chid != null && (chid.equals(chain)
+ || chid.trim().equals(chain.trim()) || (chain
+ .trim().length() == 0 && chid.equals("_")))))
+ {
+ pdbcs.setName(jalview.datamodel.DBRefSource.PDB + "|" + id
+ + "|" + pdbcs.getName());
+ // Might need to add more metadata to the PDBEntry object
+ // like below
+ /*
+ * PDBEntry entry = new PDBEntry(); // Construct the PDBEntry
+ * entry.setId(id); if (entry.getProperty() == null)
+ * entry.setProperty(new Hashtable());
+ * entry.getProperty().put("chains", pdbchain.id + "=" +
+ * sq.getStart() + "-" + sq.getEnd());
+ * sq.getDatasetSequence().addPDBId(entry);
+ */
+ // Add PDB DB Refs
+ // We make a DBRefEtntry because we have obtained the PDB file from
+ // a
+ // verifiable source
+ // JBPNote - PDB DBRefEntry should also carry the chain and mapping
+ // information
+ DBRefEntry dbentry = new DBRefEntry(getDbSource(),
+ getDbVersion(), (chid == null ? id : id + chid));
+ // dbentry.setMap()
+ pdbcs.addDBRef(dbentry);
+ }
+ else
+ {
+ // mark this sequence to be removed from the alignment
+ // - since it's not from the right chain
+ toremove.add(pdbcs);
+ }
+ }
+ // now remove marked sequences
+ for (SequenceI pdbcs : toremove)
+ {
+ pdbfile.deleteSequence(pdbcs);
+ if (pdbcs.getAnnotation() != null)
+ {
+ for (AlignmentAnnotation aa : pdbcs.getAnnotation())
+ {
+ pdbfile.deleteAnnotation(aa);
+ }
+ }
+ }
+ }
+
+ if (pdbfile == null || pdbfile.getHeight() < 1)
+ {
+ throw new Exception(MessageManager.formatMessage(
+ "exception.no_pdb_records_for_chain", new String[] { id,
+ ((chain == null) ? "' '" : chain) }));
+ }
+
+ } catch (Exception ex) // Problem parsing PDB file
+ {
+ stopQuery();
+ throw (ex);
+ }
+ return pdbfile;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ Regex r = getAccessionValidator();
+ return r.search(accession.trim());
+ }
+
+ /**
+ * obtain human glyoxalase chain A sequence
+ */
+ public String getTestQuery()
+ {
+ return "1QIPA";
+ }
+
+ public String getDbName()
+ {
+ return "PDB"; // getDbSource();
+ }
+
+ @Override
+ public int getTier()
+ {
+ return 0;
+ }
+}
diff --git a/src/jalview/ws/dbsources/Pfam.java b/src/jalview/ws/dbsources/Pfam.java
index 8ce586a..356eac3 100644
--- a/src/jalview/ws/dbsources/Pfam.java
+++ b/src/jalview/ws/dbsources/Pfam.java
@@ -1,154 +1,159 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import java.util.Hashtable;
-
-import com.stevesoft.pat.Regex;
-
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefEntry;
-import jalview.io.AppletFormatAdapter;
-import jalview.io.FastaFile;
-import jalview.io.StockholmFile;
-import jalview.ws.seqfetcher.DbSourceProxy;
-import jalview.ws.seqfetcher.DbSourceProxyImpl;
-
-/**
- * TODO: later PFAM is a complex datasource - it could return a tree in addition
- * to an alignment TODO: create interface to pass alignment properties and tree
- * back to sequence fetcher
- *
- * @author JimP
- *
- */
-abstract public class Pfam extends DbSourceProxyImpl implements
- DbSourceProxy
-{
-
- public Pfam()
- {
- super();
- // all extensions of this PFAM source base class are DOMAINDB sources
- addDbSourceProperty(jalview.datamodel.DBRefSource.DOMAINDB);
- addDbSourceProperty(jalview.datamodel.DBRefSource.ALIGNMENTDB);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
- */
- public String getAccessionSeparator()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getAccessionValidator()
- */
- public Regex getAccessionValidator()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbSource() public String getDbSource() { *
- * this doesn't work - DbSource is key for the hash of DbSourceProxy instances
- * - 1:many mapping for DbSource to proxy will be lost. * suggest : PFAM is an
- * 'alignment' source - means proxy is higher level than a sequence source.
- * return jalview.datamodel.DBRefSource.PFAM; }
- */
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbSourceProperties() public Hashtable
- * getDbSourceProperties() {
- *
- * return null; }
- */
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbVersion()
- */
- public String getDbVersion()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- *
- * @return PFAM URL stub for this DbSource
- */
- protected abstract String getPFAMURL();
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
- */
- public AlignmentI getSequenceRecords(String queries) throws Exception
- {
- // TODO: this is not a perfect implementation. We need to be able to add
- // individual references to each sequence in each family alignment that's
- // retrieved.
- startQuery();
- AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getPFAMURL()
- + queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL,
- "STH");
- for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)
- {
- rcds.getSequenceAt(s).addDBRef(
- new DBRefEntry(jalview.datamodel.DBRefSource.PFAM,
- // getDbSource(),
- getDbVersion(), queries.trim().toUpperCase()));
- if (!getDbSource().equals(jalview.datamodel.DBRefSource.PFAM))
- { // add the specific ref too
- rcds.getSequenceAt(s).addDBRef(
- new DBRefEntry(getDbSource(), getDbVersion(), queries
- .trim().toUpperCase()));
- }
- }
- stopQuery();
- return rcds;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
- */
- public boolean isValidReference(String accession)
- {
- return accession.indexOf("PF") == 0;
- }
-
- /*
- * public String getDbName() { return "PFAM"; // getDbSource(); }
- */
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import com.stevesoft.pat.Regex;
+
+/**
+ * TODO: later PFAM is a complex datasource - it could return a tree in addition
+ * to an alignment TODO: create interface to pass alignment properties and tree
+ * back to sequence fetcher
+ *
+ * @author JimP
+ *
+ */
+abstract public class Pfam extends Xfam implements DbSourceProxy
+{
+
+ public Pfam()
+ {
+ super();
+ // all extensions of this PFAM source base class are DOMAINDB sources
+ addDbSourceProperty(jalview.datamodel.DBRefSource.DOMAINDB);
+ addDbSourceProperty(jalview.datamodel.DBRefSource.ALIGNMENTDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator()
+ */
+ public Regex getAccessionValidator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource() public String getDbSource() { *
+ * this doesn't work - DbSource is key for the hash of DbSourceProxy instances
+ * - 1:many mapping for DbSource to proxy will be lost. * suggest : PFAM is an
+ * 'alignment' source - means proxy is higher level than a sequence source.
+ * return jalview.datamodel.DBRefSource.PFAM; }
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSourceProperties() public Hashtable
+ * getDbSourceProperties() {
+ *
+ * return null; }
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ @Override
+ public String getDbVersion()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * Returns base URL for selected Pfam alignment type
+ *
+ * @return PFAM URL stub for this DbSource
+ */
+ @Override
+ protected abstract String getXFAMURL();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ // TODO: this is not a perfect implementation. We need to be able to add
+ // individual references to each sequence in each family alignment that's
+ // retrieved.
+ startQuery();
+ AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getXFAMURL()
+ + queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL,
+ "STH");
+ for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)
+ {
+ rcds.getSequenceAt(s).addDBRef(
+ new DBRefEntry(jalview.datamodel.DBRefSource.PFAM,
+ // getDbSource(),
+ getDbVersion(), queries.trim().toUpperCase()));
+ if (!getDbSource().equals(jalview.datamodel.DBRefSource.PFAM))
+ { // add the specific ref too
+ rcds.getSequenceAt(s).addDBRef(
+ new DBRefEntry(getDbSource(), getDbVersion(), queries
+ .trim().toUpperCase()));
+ }
+ }
+ stopQuery();
+ return rcds;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ return accession.indexOf("PF") == 0;
+ }
+
+ /*
+ * public String getDbName() { return "PFAM"; // getDbSource(); }
+ */
+
+ public String getXfamSource()
+ {
+ return jalview.datamodel.DBRefSource.PFAM;
+ }
+
+}
diff --git a/src/jalview/ws/dbsources/PfamFull.java b/src/jalview/ws/dbsources/PfamFull.java
index 5f579f6..a979098 100644
--- a/src/jalview/ws/dbsources/PfamFull.java
+++ b/src/jalview/ws/dbsources/PfamFull.java
@@ -1,63 +1,76 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import jalview.ws.seqfetcher.DbSourceProxy;
-
-/**
- * flyweight class specifying retrieval of Full family alignments from PFAM
- *
- */
-public class PfamFull extends Pfam implements DbSourceProxy
-{
- public PfamFull()
- {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.dbsources.Pfam#getPFAMURL()
- */
- protected String getPFAMURL()
- {
- return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=full&format=stockholm&order=t&case=l&gaps=default&entry=";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
- */
- public String getDbName()
- {
- return "PFAM (Full)";
- }
-
- public String getDbSource()
- {
- return getDbName(); // so we have unique DbSource string.
- }
-
- public String getTestQuery()
- {
- return "PF03760";
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * flyweight class specifying retrieval of Full family alignments from PFAM
+ *
+ */
+public class PfamFull extends Pfam implements DbSourceProxy
+{
+ public PfamFull()
+ {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Pfam#getPFAMURL()
+ */
+ protected String getXFAMURL()
+ {
+ return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=full&format=stockholm&order=t&case=l&gaps=default&entry=";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
+ */
+ public String getDbName()
+ {
+ return "PFAM (Full)";
+ }
+
+ public String getDbSource()
+ {
+ return getDbName(); // so we have unique DbSource string.
+ }
+
+ public String getTestQuery()
+ {
+ return "PF03760";
+ }
+
+ public String getDbVersion()
+ {
+ return null;
+ }
+
+ @Override
+ public int getTier()
+ {
+ return 0;
+ }
+}
diff --git a/src/jalview/ws/dbsources/PfamSeed.java b/src/jalview/ws/dbsources/PfamSeed.java
index 0e85f65..027db80 100644
--- a/src/jalview/ws/dbsources/PfamSeed.java
+++ b/src/jalview/ws/dbsources/PfamSeed.java
@@ -1,65 +1,73 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-import jalview.ws.seqfetcher.DbSourceProxy;
-
-/**
- * flyweight class specifying retrieval of Seed alignments from PFAM
- *
- * @author JimP
- *
- */
-public class PfamSeed extends Pfam implements DbSourceProxy
-{
- public PfamSeed()
- {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.dbsources.Pfam#getPFAMURL()
- */
- protected String getPFAMURL()
- {
- return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=seed&format=stockholm&order=t&case=l&gaps=default&entry=";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
- */
- public String getDbName()
- {
- return "PFAM (Seed)";
- }
-
- public String getDbSource()
- {
- return jalview.datamodel.DBRefSource.PFAM; // archetype source
- }
-
- public String getTestQuery()
- {
- return "PF03760";
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * flyweight class specifying retrieval of Seed alignments from PFAM
+ *
+ * @author JimP
+ *
+ */
+public class PfamSeed extends Pfam implements DbSourceProxy
+{
+ public PfamSeed()
+ {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Pfam#getPFAMURL()
+ */
+ protected String getXFAMURL()
+ {
+ return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=seed&format=stockholm&order=t&case=l&gaps=default&entry=";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
+ */
+ public String getDbName()
+ {
+ return "PFAM (Seed)";
+ }
+
+ public String getDbSource()
+ {
+ return jalview.datamodel.DBRefSource.PFAM; // archetype source
+ }
+
+ public String getTestQuery()
+ {
+ return "PF03760";
+ }
+
+ @Override
+ public int getTier()
+ {
+ return 0;
+ }
+}
diff --git a/src/jalview/ws/dbsources/Rfam.java b/src/jalview/ws/dbsources/Rfam.java
new file mode 100644
index 0000000..842090d
--- /dev/null
+++ b/src/jalview/ws/dbsources/Rfam.java
@@ -0,0 +1,118 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import com.stevesoft.pat.Regex;
+
+/**
+ * Contains methods for fetching sequences from Rfam database
+ *
+ * @author Lauren Michelle Lui
+ */
+abstract public class Rfam extends Xfam implements DbSourceProxy
+{
+
+ public Rfam()
+ {
+ super();
+ // all extensions of this RFAM source base class are DOMAINDB sources
+ addDbSourceProperty(jalview.datamodel.DBRefSource.DOMAINDB);
+ addDbSourceProperty(jalview.datamodel.DBRefSource.ALIGNMENTDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator() Left here for
+ * consistency with Pfam class
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator() * Left here for
+ */
+ public Regex getAccessionValidator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * Left here for consistency with Pfam class
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource() public String getDbSource() { *
+ * this doesn't work - DbSource is key for the hash of DbSourceProxy instances
+ * - 1:many mapping for DbSource to proxy will be lost. * suggest : RFAM is an
+ * 'alignment' source - means proxy is higher level than a sequence source.
+ * return jalview.datamodel.DBRefSource.RFAM; }
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ @Override
+ public String getDbVersion()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * Returns base URL for selected Rfam alignment type
+ *
+ * @return RFAM URL stub for this DbSource
+ */
+ @Override
+ protected abstract String getXFAMURL();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ return accession.indexOf("RF") == 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Xfam#getXfamSource()
+ */
+ public String getXfamSource()
+ {
+ return jalview.datamodel.DBRefSource.RFAM;
+ }
+
+}
diff --git a/src/jalview/ws/dbsources/RfamFull.java b/src/jalview/ws/dbsources/RfamFull.java
new file mode 100644
index 0000000..09d5a93
--- /dev/null
+++ b/src/jalview/ws/dbsources/RfamFull.java
@@ -0,0 +1,81 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * Flyweight class specifying retrieval of Full family alignments from RFAM
+ *
+ * @author Lauren Michelle Lui
+ *
+ */
+public class RfamFull extends Rfam implements DbSourceProxy
+{
+ public RfamFull()
+ {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Rfam#getXFAMURL()
+ */
+ protected String getXFAMURL()
+ {
+ return "http://rfam.sanger.ac.uk/family/alignment/download/format?alnType=full&nseLabels=0&format=stockholm&acc=";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
+ */
+ public String getDbName()
+ {
+ return "RFAM (Full)";
+ }
+
+ public String getDbSource()
+ {
+ return getDbName(); // so we have unique DbSource string.
+ }
+
+ public String getTestQuery()
+ {
+ // Can be retrieved from http://rfam.janelia.org/cgi-bin/getdesc?acc=RF00014
+ // or
+ // http://rfam.sanger.ac.uk/family/alignment/download/format?alnType=full&nseLabels=0&format=stockholm&acc=RF00014
+ return "RF00014";
+ }
+
+ public String getDbVersion()
+ {
+ return null;
+ }
+
+ @Override
+ public int getTier()
+ {
+ return 0;
+ }
+}
diff --git a/src/jalview/ws/dbsources/RfamSeed.java b/src/jalview/ws/dbsources/RfamSeed.java
new file mode 100644
index 0000000..22d8c71
--- /dev/null
+++ b/src/jalview/ws/dbsources/RfamSeed.java
@@ -0,0 +1,80 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * Flyweight class specifying retrieval of Seed family alignments from RFAM
+ *
+ * @author Lauren Michelle Lui
+ *
+ */
+public class RfamSeed extends Rfam implements DbSourceProxy
+{
+ public RfamSeed()
+ {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Rfam#getRFAMURL()
+ */
+ protected String getXFAMURL()
+ {
+ return "http://rfam.sanger.ac.uk/family/alignment/download/format?alnType=seed&nseLabels=0&format=stockholm&acc=";
+ // Janelia Farms url
+ // "http://rfam.janelia.org/cgi-bin/getalignment?type=seed&fmt=stockholm&acc=";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
+ */
+ public String getDbName()
+ {
+ return "RFAM (Seed)";
+ }
+
+ public String getDbSource()
+ {
+ return getDbName(); // so we have unique DbSource string.
+ }
+
+ public String getTestQuery()
+ {
+ return "RF00014";
+ } // http://rfam.janelia.org/cgi-bin/getdesc?acc=RF00014
+
+ public String getDbVersion()
+ {
+ return null;
+ }
+
+ @Override
+ public int getTier()
+ {
+ return 0;
+ }
+}
diff --git a/src/jalview/ws/dbsources/Uniprot.java b/src/jalview/ws/dbsources/Uniprot.java
index 17d0ca8..0d38ca6 100644
--- a/src/jalview/ws/dbsources/Uniprot.java
+++ b/src/jalview/ws/dbsources/Uniprot.java
@@ -1,34 +1,25 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.dbsources;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.exolab.castor.xml.Unmarshaller;
-
-import com.stevesoft.pat.Regex;
-
-import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
@@ -37,19 +28,35 @@ import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.datamodel.UniprotEntry;
import jalview.datamodel.UniprotFile;
-import jalview.io.FormatAdapter;
-import jalview.io.IdentifyFile;
-import jalview.ws.DBRefFetcher;
import jalview.ws.ebi.EBIFetchClient;
import jalview.ws.seqfetcher.DbSourceProxy;
import jalview.ws.seqfetcher.DbSourceProxyImpl;
+import java.io.File;
+import java.io.FileReader;
+import java.io.Reader;
+import java.util.Vector;
+
+import org.exolab.castor.xml.Unmarshaller;
+
+import com.stevesoft.pat.Regex;
+
/**
* @author JimP
*
*/
public class Uniprot extends DbSourceProxyImpl implements DbSourceProxy
{
+
+ private static final String BAR_DELIMITER = "|";
+
+ private static final String NEWLINE = "\n";
+
+ private static org.exolab.castor.mapping.Mapping map;
+
+ /**
+ * Constructor
+ */
public Uniprot()
{
super();
@@ -98,26 +105,35 @@ public class Uniprot extends DbSourceProxyImpl implements DbSourceProxy
return "0"; // we really don't know what version we're on.
}
- private EBIFetchClient ebi = null;
-
- public Vector getUniprotEntries(File file)
+ /**
+ * Reads a file containing the reply to the EBI Fetch Uniprot data query,
+ * unmarshals it to a UniprotFile object, and returns the list of UniprotEntry
+ * data models (mapped from <entry> elements)
+ *
+ * @param fileReader
+ * @return
+ */
+ public Vector<UniprotEntry> getUniprotEntries(Reader fileReader)
{
UniprotFile uni = new UniprotFile();
try
{
- // 1. Load the mapping information from the file
- org.exolab.castor.mapping.Mapping map = new org.exolab.castor.mapping.Mapping(
- uni.getClass().getClassLoader());
- java.net.URL url = getClass().getResource("/uniprot_mapping.xml");
- map.loadMapping(url);
+ if (map == null)
+ {
+ // 1. Load the mapping information from the file
+ map = new org.exolab.castor.mapping.Mapping(uni.getClass()
+ .getClassLoader());
+ java.net.URL url = getClass().getResource("/uniprot_mapping.xml");
+ map.loadMapping(url);
+ }
// 2. Unmarshal the data
Unmarshaller unmar = new Unmarshaller(uni);
unmar.setIgnoreExtraElements(true);
unmar.setMapping(map);
- if (file != null)
+ if (fileReader != null)
{
- uni = (UniprotFile) unmar.unmarshal(new FileReader(file));
+ uni = (UniprotFile) unmar.unmarshal(fileReader);
}
} catch (Exception e)
{
@@ -139,49 +155,29 @@ public class Uniprot extends DbSourceProxyImpl implements DbSourceProxy
{
queries = queries.toUpperCase().replaceAll(
"(UNIPROT\\|?|UNIPROT_|UNIREF\\d+_|UNIREF\\d+\\|?)", "");
- Alignment al = null;
- ebi = new EBIFetchClient();
- StringBuffer result = new StringBuffer();
+ AlignmentI al = null;
+ EBIFetchClient ebi = new EBIFetchClient();
// uniprotxml parameter required since december 2007
// uniprotkb dbname changed introduced december 2008
File file = ebi.fetchDataAsFile("uniprotkb:" + queries, "uniprotxml",
null);
- Vector entries = getUniprotEntries(file);
+ Vector<UniprotEntry> entries = getUniprotEntries(new FileReader(file));
if (entries != null)
{
+ /*
+ * If Castor binding included sequence at length, we could guesstimate the
+ * size of buffer to hold the alignment
+ */
+ StringBuffer result = new StringBuffer(128);
// First, make the new sequences
- Enumeration en = entries.elements();
- while (en.hasMoreElements())
+ for (UniprotEntry entry : entries)
{
- UniprotEntry entry = (UniprotEntry) en.nextElement();
-
- StringBuffer name = new StringBuffer(">UniProt/Swiss-Prot");
- Enumeration en2 = entry.getAccession().elements();
- while (en2.hasMoreElements())
- {
- name.append("|");
- name.append(en2.nextElement());
- }
- en2 = entry.getName().elements();
- while (en2.hasMoreElements())
- {
- name.append("|");
- name.append(en2.nextElement());
- }
-
- if (entry.getProtein() != null
- && entry.getProtein().getName() != null)
- {
- for (int nm = 0, nmSize = entry.getProtein().getName().size(); nm < nmSize; nm++)
- {
- name.append(" " + entry.getProtein().getName().elementAt(nm));
- }
- }
-
- result.append(name + "\n"
- + entry.getUniprotSequence().getContent() + "\n");
+ StringBuilder name = constructSequenceFastaHeader(entry);
+ result.append(name).append(NEWLINE)
+ .append(entry.getUniprotSequence().getContent())
+ .append(NEWLINE);
}
// Then read in the features and apply them to the dataset
@@ -206,63 +202,94 @@ public class Uniprot extends DbSourceProxyImpl implements DbSourceProxy
}
/**
+ * Construct a Fasta-format sequence header by concatenating the source,
+ * accession id(s) and name(s), delimited by '|', plus any protein names, now
+ * with space rather than bar delimiter
+ *
+ * @param entry
+ * @return
+ */
+ public static StringBuilder constructSequenceFastaHeader(
+ UniprotEntry entry)
+ {
+ StringBuilder name = new StringBuilder(32);
+ name.append(">UniProt/Swiss-Prot");
+ for (String accessionId : entry.getAccession())
+ {
+ name.append(BAR_DELIMITER);
+ name.append(accessionId);
+ }
+ for (String n : entry.getName())
+ {
+ name.append(BAR_DELIMITER);
+ name.append(n);
+ }
+
+ if (entry.getProtein() != null && entry.getProtein().getName() != null)
+ {
+ for (String nm : entry.getProtein().getName())
+ {
+ name.append(" ").append(nm);
+ }
+ }
+ return name;
+ }
+
+ /**
* add an ordered set of UniprotEntry objects to an ordered set of seuqences.
*
* @param al
* - a sequence of n sequences
* @param entries
- * a seuqence of n uniprot entries to be analysed.
+ * a list of n uniprot entries to be analysed.
*/
- public void addUniprotXrefs(Alignment al, Vector entries)
+ public void addUniprotXrefs(AlignmentI al, Vector<UniprotEntry> entries)
{
+ final String dbVersion = getDbVersion();
+
for (int i = 0; i < entries.size(); i++)
{
- UniprotEntry entry = (UniprotEntry) entries.elementAt(i);
- Enumeration e = entry.getDbReference().elements();
- Vector onlyPdbEntries = new Vector();
- Vector dbxrefs = new Vector();
- while (e.hasMoreElements())
+ UniprotEntry entry = entries.elementAt(i);
+ Vector<PDBEntry> onlyPdbEntries = new Vector<PDBEntry>();
+ Vector<DBRefEntry> dbxrefs = new Vector<DBRefEntry>();
+
+ for (PDBEntry pdb : entry.getDbReference())
{
- PDBEntry pdb = (PDBEntry) e.nextElement();
DBRefEntry dbr = new DBRefEntry();
dbr.setSource(pdb.getType());
dbr.setAccessionId(pdb.getId());
- dbr.setVersion(DBRefSource.UNIPROT + ":" + getDbVersion());
+ dbr.setVersion(DBRefSource.UNIPROT + ":" + dbVersion);
dbxrefs.addElement(dbr);
- if (!pdb.getType().equals("PDB"))
+ if ("PDB".equals(pdb.getType()))
{
- continue;
+ onlyPdbEntries.addElement(pdb);
}
-
- onlyPdbEntries.addElement(pdb);
}
+
SequenceI sq = al.getSequenceAt(i);
while (sq.getDatasetSequence() != null)
{
sq = sq.getDatasetSequence();
}
- Enumeration en2 = entry.getAccession().elements();
- while (en2.hasMoreElements())
+ for (String accessionId : entry.getAccession())
{
- // we always add as uniprot if we retrieved from uniprot or uniprot name
- sq.addDBRef(new DBRefEntry(DBRefSource.UNIPROT, getDbVersion(), en2
- .nextElement().toString()));
+ /*
+ * add as uniprot whether retrieved from uniprot or uniprot_name
+ */
+ sq.addDBRef(new DBRefEntry(DBRefSource.UNIPROT, dbVersion,
+ accessionId));
}
- en2 = dbxrefs.elements();
- while (en2.hasMoreElements())
- {
- // we always add as uniprot if we retrieved from uniprot or uniprot name
- sq.addDBRef((DBRefEntry) en2.nextElement());
+ for (DBRefEntry dbRef : dbxrefs)
+ {
+ sq.addDBRef(dbRef);
}
sq.setPDBId(onlyPdbEntries);
if (entry.getFeature() != null)
{
- e = entry.getFeature().elements();
- while (e.hasMoreElements())
+ for (SequenceFeature sf : entry.getFeature())
{
- SequenceFeature sf = (SequenceFeature) e.nextElement();
sf.setFeatureGroup("Uniprot");
sq.addSequenceFeature(sf);
}
@@ -294,4 +321,10 @@ public class Uniprot extends DbSourceProxyImpl implements DbSourceProxy
{
return "Uniprot"; // getDbSource();
}
+
+ @Override
+ public int getTier()
+ {
+ return 0;
+ }
}
diff --git a/src/jalview/ws/dbsources/UnprotName.java b/src/jalview/ws/dbsources/UnprotName.java
index 1d1b9f0..8e4958e 100644
--- a/src/jalview/ws/dbsources/UnprotName.java
+++ b/src/jalview/ws/dbsources/UnprotName.java
@@ -1,41 +1,44 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources;
-
-/**
- * Canonical Uniprot fetcher instance specifically retrieving UP_NAME
- * references.
- *
- * @author JimP
- *
- */
-public class UnprotName extends Uniprot implements
- jalview.ws.seqfetcher.DbSourceProxy
-{
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.dbsources.Uniprot#getDbSource()
- */
- public String getDbSource()
- {
- return jalview.datamodel.DBRefSource.UP_NAME;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+/**
+ * Canonical Uniprot fetcher instance specifically retrieving UP_NAME
+ * references.
+ *
+ * @author JimP
+ *
+ */
+public class UnprotName extends Uniprot implements
+ jalview.ws.seqfetcher.DbSourceProxy
+{
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Uniprot#getDbSource()
+ */
+ public String getDbSource()
+ {
+ return jalview.datamodel.DBRefSource.UP_NAME;
+ }
+
+}
diff --git a/src/jalview/ws/dbsources/Xfam.java b/src/jalview/ws/dbsources/Xfam.java
new file mode 100644
index 0000000..40ea0fb
--- /dev/null
+++ b/src/jalview/ws/dbsources/Xfam.java
@@ -0,0 +1,73 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+/**
+ * Acts as a superclass for the Rfam and Pfam classes
+ *
+ * @author Lauren Michelle Lui
+ *
+ */
+public abstract class Xfam extends DbSourceProxyImpl
+{
+
+ public Xfam()
+ {
+ super();
+ }
+
+ protected abstract String getXFAMURL();
+
+ public abstract String getDbVersion();
+
+ abstract String getXfamSource();
+
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ // TODO: this is not a perfect implementation. We need to be able to add
+ // individual references to each sequence in each family alignment that's
+ // retrieved.
+ startQuery();
+ // TODO: trap HTTP 404 exceptions and return null
+ AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getXFAMURL()
+ + queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL,
+ "STH");
+ for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)
+ {
+ rcds.getSequenceAt(s).addDBRef(new DBRefEntry(getXfamSource(),
+ // getDbSource(),
+ getDbVersion(), queries.trim().toUpperCase()));
+ if (!getDbSource().equals(getXfamSource()))
+ { // add the specific ref too
+ rcds.getSequenceAt(s).addDBRef(
+ new DBRefEntry(getDbSource(), getDbVersion(), queries
+ .trim().toUpperCase()));
+ }
+ }
+ stopQuery();
+ return rcds;
+ }
+
+}
diff --git a/src/jalview/ws/dbsources/das/DasSequenceSourceListener.java b/src/jalview/ws/dbsources/das/DasSequenceSourceListener.java
deleted file mode 100644
index 0b0a065..0000000
--- a/src/jalview/ws/dbsources/das/DasSequenceSourceListener.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.dbsources.das;
-
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.Alignment;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceI;
-import jalview.ws.dbsources.DasSequenceSource;
-
-import org.biojava.dasobert.eventmodel.SequenceEvent;
-import org.biojava.dasobert.eventmodel.SequenceListener;
-
-/**
- * Listen for sequence fetch events from a dasobert SequenceThread started with
- * a query string and collect sequences returned from the DAS sequence source.
- *
- * @author JimP
- *
- */
-public class DasSequenceSourceListener implements SequenceListener
-{
-
- String ourAccession = null;
-
- DasSequenceSource oursource = null;
-
- /**
- *
- * @param source
- * the DAS Sequence DbProxy object containing database details for
- * this source
- * @param query
- * the query string sent to the das source that we should be
- * listening for.
- */
- public DasSequenceSourceListener(DasSequenceSource source, String query)
- {
- oursource = source;
- ourAccession = query;
- }
-
- public void clearSelection()
- {
- // TODO Auto-generated method stub
-
- }
-
- java.util.Vector seqs = null;
-
- public void newSequence(SequenceEvent e)
- {
- if (!e.getAccessionCode().equals(ourAccession))
- {
- System.err
- .println("Warning - received sequence event for strange accession code ("
- + e.getAccessionCode()
- + ") - we expected "
- + ourAccession);
-
- return;
- }
- if (seqs == null)
- {
- if (e.getSequence().length() == 0)
- {
- System.err.println("Empty sequence returned for accession code ("
- + e.getAccessionCode() + ") from " + oursource.getDbName());
- called = true;
- noSequences = true;
- return;
- }
- seqs = new java.util.Vector();
- }
- Sequence sq = new Sequence(e.getAccessionCode(), e.getSequence());
- sq.addDBRef(new DBRefEntry(oursource.getDbSource(), oursource
- .getDbVersion() + ":" + e.getVersion(), e.getAccessionCode()));
- seqs.addElement(sq);
- called = true;
- }
-
- public void selectedSeqPosition(int position)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void selectedSeqRange(int start, int end)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void selectionLocked(boolean flag)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void newObjectRequested(String accessionCode)
- {
- // TODO Auto-generated method stub
-
- }
-
- boolean noSequences = false;
-
- public void noObjectFound(String accessionCode)
- {
- if (accessionCode.equals(ourAccession))
- {
- noSequences = true;
- called = true;
- }
- }
-
- public boolean hasNoSequences()
- {
- return noSequences;
- }
-
- boolean called = false;
-
- public boolean isNotCalled()
- {
- return !called;
- }
-
- public AlignmentI getSequences()
- {
- if (noSequences || seqs != null && seqs.size() == 0)
- return null;
- SequenceI[] sqs = new SequenceI[seqs.size()];
- for (int i = 0, iSize = seqs.size(); i < iSize; i++)
- {
- sqs[i] = (SequenceI) seqs.elementAt(i);
- }
- Alignment al = new Alignment(sqs);
- if (oursource.getSource().hasCapability("features"))
- {
- java.util.Vector src = new java.util.Vector();
- src.addElement(oursource.getSource());
- new jalview.ws.DasSequenceFeatureFetcher(sqs, null, src, false, false);
- }
-
- return al;
- }
-
-}
diff --git a/src/jalview/ws/dbsources/das/api/DasSourceRegistryI.java b/src/jalview/ws/dbsources/das/api/DasSourceRegistryI.java
new file mode 100644
index 0000000..3550b42
--- /dev/null
+++ b/src/jalview/ws/dbsources/das/api/DasSourceRegistryI.java
@@ -0,0 +1,57 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources.das.api;
+
+import java.util.List;
+
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
+
+/**
+ * API for a registry that provides datasources that jalview can access
+ *
+ * @author jprocter
+ *
+ */
+public interface DasSourceRegistryI
+{
+
+ List<jalviewSourceI> getSources();
+
+ String getDasRegistryURL();
+
+ jalviewSourceI getSource(String nickname);
+
+ // TODO: re JAL-424 - introduce form where local source is queried for
+ // metadata, rather than have it all provided by caller.
+ jalviewSourceI createLocalSource(String uri, String name,
+ boolean sequence, boolean features);
+
+ boolean removeLocalSource(jalviewSourceI source);
+
+ void refreshSources();
+
+ String getLocalSourceString();
+
+ List<jalviewSourceI> resolveSourceNicknames(List<String> sources);
+
+ // TODO: refactor to jDAS specific interface
+ MultipleConnectionPropertyProviderI getSessionHandler();
+}
diff --git a/src/jalview/ws/dbsources/das/api/jalviewSourceI.java b/src/jalview/ws/dbsources/das/api/jalviewSourceI.java
new file mode 100644
index 0000000..79d003f
--- /dev/null
+++ b/src/jalview/ws/dbsources/das/api/jalviewSourceI.java
@@ -0,0 +1,87 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources.das.api;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import java.util.List;
+
+import org.biodas.jdas.schema.sources.MAINTAINER;
+import org.biodas.jdas.schema.sources.VERSION;
+
+public interface jalviewSourceI
+{
+
+ String getTitle();
+
+ VERSION getVersion();
+
+ String getDocHref();
+
+ String getDescription();
+
+ String getUri();
+
+ MAINTAINER getMAINTAINER();
+
+ String getEmail();
+
+ boolean isLocal();
+
+ boolean isSequenceSource();
+
+ String[] getCapabilityList(VERSION v);
+
+ String[] getLabelsFor(VERSION v);
+
+ /**
+ *
+ * @return null if not a sequence source, otherwise a series of database
+ * sources that can be used to retrieve sequence data for particular
+ * database coordinate systems
+ */
+ List<DbSourceProxy> getSequenceSourceProxies();
+
+ boolean isFeatureSource();
+
+ /**
+ * returns the base URL for the latest version of a source's DAS endpoint set
+ *
+ * @return
+ */
+ String getSourceURL();
+
+ /**
+ * test to see if this source's latest version is older than the given source
+ *
+ * @param jalviewSourceI
+ * @return true if newer than given source
+ */
+ boolean isNewerThan(jalviewSourceI jalviewSourceI);
+
+ /**
+ * test if the source is a reference source for the authority
+ *
+ * @return
+ */
+ boolean isReferenceSource();
+
+}
diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java
new file mode 100644
index 0000000..8f00f75
--- /dev/null
+++ b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java
@@ -0,0 +1,355 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources.das.datamodel;
+
+import jalview.bin.Cache;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.seqfetcher.DbSourceProxy;
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.biodas.jdas.client.SequenceClient;
+import org.biodas.jdas.client.adapters.sequence.DasSequenceAdapter;
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
+import org.biodas.jdas.client.threads.SequenceClientMultipleSources;
+import org.biodas.jdas.schema.sequence.SEQUENCE;
+import org.biodas.jdas.schema.sources.COORDINATES;
+import org.biodas.jdas.schema.sources.SOURCE;
+import org.biodas.jdas.schema.sources.VERSION;
+
+import com.stevesoft.pat.Regex;
+
+/**
+ * an instance of this class is created for each unique DAS Sequence source (ie
+ * one capable of handling the 'sequence' for a particular MapMaster)
+ *
+ * @author JimP
+ *
+ */
+public class DasSequenceSource extends DbSourceProxyImpl implements
+ DbSourceProxy
+{
+ private jalviewSourceI jsrc;
+
+ protected SOURCE source = null;
+
+ protected VERSION version = null;
+
+ protected COORDINATES coordsys = null;
+
+ protected String dbname = "DASCS";
+
+ protected String dbrefname = "das:source";
+
+ protected MultipleConnectionPropertyProviderI connprops = null;
+
+ /**
+ * DAS sources are tier 1 - if we have a direct DB connection then we should
+ * prefer it
+ */
+ private int tier = 1;
+
+ /**
+ * create a new DbSource proxy for a DAS 1 source
+ *
+ * @param dbnbame
+ * Human Readable Name to use when fetching from this source
+ * @param dbrefname
+ * DbRefName for DbRefs attached to sequences retrieved from this
+ * source
+ * @param source
+ * Das1Source
+ * @param coordsys
+ * specific coordinate system to use for this source
+ * @throws Exception
+ * if source is not capable of the 'sequence' command
+ */
+ public DasSequenceSource(String dbname, String dbrefname, SOURCE source,
+ VERSION version, COORDINATES coordsys,
+ MultipleConnectionPropertyProviderI connprops) throws Exception
+ {
+ if (!(jsrc = new JalviewSource(source, connprops, false))
+ .isSequenceSource())
+ {
+ throw new Exception(MessageManager.formatMessage(
+ "exception.das_source_doesnt_support_sequence_command",
+ new String[] { source.getTitle() }));
+ }
+ this.tier = 1 + ((jsrc.isLocal() || jsrc.isReferenceSource()) ? 0 : 1);
+ this.source = source;
+ this.dbname = dbname;
+ this.dbrefname = dbrefname.toUpperCase();
+ if (coordsys != null)
+ {
+ this.coordsys = coordsys;
+ }
+ this.connprops = connprops;
+ }
+
+ public String getAccessionSeparator()
+ {
+ return "\t";
+ }
+
+ public Regex getAccessionValidator()
+ {
+ /** ? * */
+ return Regex.perlCode("m/([^:]+)(:\\d+,\\d+)?/");
+ }
+
+ public String getDbName()
+ {
+ // TODO: map to
+ return dbname + " (DAS)";
+ }
+
+ public String getDbSource()
+ {
+ return dbrefname;
+ }
+
+ public String getDbVersion()
+ {
+ return coordsys != null ? coordsys.getVersion() : "";
+ }
+
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ StringTokenizer st = new StringTokenizer(queries, "\t");
+ List<String> toks = new ArrayList<String>(), src = new ArrayList<String>(), acIds = new ArrayList<String>();
+ while (st.hasMoreTokens())
+ {
+ String t;
+ toks.add(t = st.nextToken());
+ acIds.add(t.replaceAll(":[0-9,]+", ""));
+ }
+ src.add(jsrc.getSourceURL());
+ Map<String, Map<List<String>, DasSequenceAdapter>> resultset = new HashMap<String, Map<List<String>, DasSequenceAdapter>>();
+ Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();
+
+ // First try multiple sources
+ boolean multiple = true, retry = false;
+ do
+ {
+ if (!multiple)
+ {
+ retry = false;
+ // slow, fetch one at a time.
+ for (String sr : src)
+ {
+ System.err
+ .println("Retrieving IDs individually from das source: "
+ + sr);
+ org.biodas.jdas.client.SequenceClient sq = new SequenceClient(
+ connprops.getConnectionPropertyProviderFor(sr));
+ for (String q : toks)
+ {
+ List<String> qset = Arrays.asList(new String[] { q });
+ try
+ {
+ DasSequenceAdapter s = sq.fetchData(sr, qset);
+ Map<List<String>, DasSequenceAdapter> dss = resultset.get(sr);
+ if (dss == null)
+ {
+ resultset
+ .put(sr,
+ dss = new HashMap<List<String>, DasSequenceAdapter>());
+ }
+ dss.put(qset, s);
+ } catch (Exception x)
+ {
+ Map<List<String>, Exception> ers = errors.get(sr);
+ if (ers == null)
+ {
+ errors.put(sr, ers = new HashMap<List<String>, Exception>());
+ }
+ ers.put(qset, x);
+ }
+ }
+ }
+ }
+ else
+ {
+ SequenceClientMultipleSources sclient;
+ sclient = new SequenceClientMultipleSources();
+ sclient.fetchData(src, toks, resultset, errors);
+ sclient.shutDown();
+ while (!sclient.isTerminated())
+ {
+ try
+ {
+ Thread.sleep(200);
+
+ } catch (InterruptedException x)
+ {
+ }
+ }
+ if (resultset.isEmpty() && !errors.isEmpty())
+ {
+ retry = true;
+ multiple = false;
+ }
+ }
+ } while (retry);
+
+ if (resultset.isEmpty())
+ {
+ System.err.println("Sequence Query to " + jsrc.getTitle() + " with '"
+ + queries + "' returned no sequences.");
+ return null;
+ }
+ else
+ {
+ Vector<SequenceI> seqs = null;
+ for (Map.Entry<String, Map<List<String>, DasSequenceAdapter>> resset : resultset
+ .entrySet())
+ {
+ for (Map.Entry<List<String>, DasSequenceAdapter> result : resset
+ .getValue().entrySet())
+ {
+ DasSequenceAdapter dasseqresp = result.getValue();
+ List<String> accessions = result.getKey();
+ for (SEQUENCE e : dasseqresp.getSequence())
+ {
+ String lbl = e.getId();
+
+ if (acIds.indexOf(lbl) == -1)
+ {
+ System.err
+ .println("Warning - received sequence event for strange accession code ("
+ + lbl + ")");
+ }
+ else
+ {
+ if (seqs == null)
+ {
+ if (e.getContent().length() == 0)
+ {
+ System.err
+ .println("Empty sequence returned for accession code ("
+ + lbl
+ + ") from "
+ + resset.getKey()
+ + " (source is " + getDbName());
+ continue;
+ }
+ }
+ seqs = new java.util.Vector<SequenceI>();
+ // JDAS returns a sequence complete with any newlines and spaces
+ // in the XML
+ Sequence sq = new Sequence(lbl, e.getContent().replaceAll(
+ "\\s+", ""));
+ sq.setStart(e.getStart().intValue());
+ sq.addDBRef(new DBRefEntry(getDbSource(), getDbVersion()
+ + ":" + e.getVersion(), lbl));
+ seqs.addElement(sq);
+ }
+ }
+ }
+ }
+
+ if (seqs == null || seqs.size() == 0)
+ return null;
+ SequenceI[] sqs = new SequenceI[seqs.size()];
+ for (int i = 0, iSize = seqs.size(); i < iSize; i++)
+ {
+ sqs[i] = (SequenceI) seqs.elementAt(i);
+ }
+ Alignment al = new Alignment(sqs);
+ if (jsrc.isFeatureSource())
+ {
+ java.util.Vector<jalviewSourceI> srcs = new java.util.Vector<jalviewSourceI>();
+ srcs.addElement(jsrc);
+ try
+ {
+ jalview.ws.DasSequenceFeatureFetcher dssf = new jalview.ws.DasSequenceFeatureFetcher(
+ sqs, null, srcs, false, false, multiple);
+ while (dssf.isRunning())
+ {
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException x)
+ {
+
+ }
+ }
+
+ } catch (Exception x)
+ {
+ Cache.log
+ .error("Couldn't retrieve features for sequence from its source.",
+ x);
+ }
+ }
+
+ return al;
+ }
+ }
+
+ public String getTestQuery()
+ {
+ return coordsys == null ? "" : coordsys.getTestRange();
+ }
+
+ public boolean isValidReference(String accession)
+ {
+ // TODO try to validate an accession against source
+ // We don't really know how to do this without querying source
+
+ return true;
+ }
+
+ /**
+ * @return the source
+ */
+ public SOURCE getSource()
+ {
+ return source;
+ }
+
+ /**
+ * @return the coordsys
+ */
+ public COORDINATES getCoordsys()
+ {
+ return coordsys;
+ }
+
+ @Override
+ public int getTier()
+ {
+ return tier;
+ }
+}
diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java b/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java
new file mode 100644
index 0000000..7eb74b3
--- /dev/null
+++ b/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java
@@ -0,0 +1,486 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources.das.datamodel;
+
+import jalview.bin.Cache;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.biodas.jdas.client.ConnectionPropertyProviderI;
+import org.biodas.jdas.client.SourcesClient;
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
+import org.biodas.jdas.dassources.Capabilities;
+import org.biodas.jdas.schema.sources.CAPABILITY;
+import org.biodas.jdas.schema.sources.SOURCE;
+import org.biodas.jdas.schema.sources.SOURCES;
+import org.biodas.jdas.schema.sources.VERSION;
+
+/**
+ *
+ */
+public class DasSourceRegistry implements DasSourceRegistryI,
+ MultipleConnectionPropertyProviderI
+{
+ // private org.biodas.jdas.schema.sources.SOURCE[] dasSources = null;
+ private List<jalviewSourceI> dasSources = null;
+
+ private Hashtable<String, jalviewSourceI> sourceNames = null;
+
+ private Hashtable<String, jalviewSourceI> localSources = null;
+
+ // public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das/";
+ public static String DEFAULT_REGISTRY = "http://www.ebi.ac.uk/das-srv/registry/das/";
+
+ /**
+ * true if thread is running and we are talking to DAS registry service
+ */
+ private boolean loadingDasSources = false;
+
+ public boolean isLoadingDasSources()
+ {
+ return loadingDasSources;
+ }
+
+ public String getDasRegistryURL()
+ {
+ String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
+ DEFAULT_REGISTRY);
+
+ if (registry.indexOf("/registry/das1/sources/") > -1)
+ {
+ jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
+ DEFAULT_REGISTRY);
+ registry = DEFAULT_REGISTRY;
+ }
+ if (registry.lastIndexOf("sources.xml") == registry.length() - 11)
+ {
+ // no trailing sources.xml document for registry in JDAS
+ jalview.bin.Cache.setProperty(
+ jalview.bin.Cache.DAS_REGISTRY_URL,
+ registry = registry.substring(0,
+ registry.lastIndexOf("sources.xml")));
+ }
+ return registry;
+ }
+
+ /**
+ * query the default DAS Source Registry for sources. Uses value of jalview
+ * property DAS_REGISTRY_URL and the DasSourceBrowser.DEFAULT_REGISTRY if that
+ * doesn't exist.
+ *
+ * @return list of sources
+ */
+ private List<jalviewSourceI> getDASSources()
+ {
+
+ return getDASSources(getDasRegistryURL(), this);
+ }
+
+ /**
+ * query the given URL for DasSources.
+ *
+ * @param registryURL
+ * return sources from registryURL
+ */
+ private static List<jalviewSourceI> getDASSources(String registryURL,
+ MultipleConnectionPropertyProviderI registry)
+ {
+ try
+ {
+ URL url = new URL(registryURL);
+ org.biodas.jdas.client.SourcesClientInterface client = new SourcesClient();
+
+ SOURCES sources = client.fetchDataRegistry(registryURL, null, null,
+ null, null, null, null);
+
+ List<SOURCE> dassources = sources.getSOURCE();
+ ArrayList<jalviewSourceI> dsrc = new ArrayList<jalviewSourceI>();
+ HashMap<String, Integer> latests = new HashMap<String, Integer>();
+ Integer latest;
+ for (SOURCE src : dassources)
+ {
+ JalviewSource jsrc = new JalviewSource(src, registry, false);
+ latest = latests.get(jsrc.getSourceURL());
+ if (latest != null)
+ {
+ if (jsrc.isNewerThan(dsrc.get(latest.intValue())))
+ {
+ dsrc.set(latest.intValue(), jsrc);
+ }
+ else
+ {
+ System.out.println("Debug: Ignored older source "
+ + jsrc.getTitle());
+ }
+ }
+ else
+ {
+ latests.put(jsrc.getSourceURL(), Integer.valueOf(dsrc.size()));
+ dsrc.add(jsrc);
+ }
+ }
+ return dsrc;
+ } catch (Exception ex)
+ {
+ System.err.println("Failed to contact DAS1 registry at "
+ + registryURL);
+ ex.printStackTrace();
+ return new ArrayList<jalviewSourceI>();
+ }
+ }
+
+ public void run()
+ {
+ getSources();
+ }
+
+ @Override
+ public List<jalviewSourceI> getSources()
+ {
+ if (dasSources == null)
+ {
+ dasSources = getDASSources();
+ }
+ return appendLocalSources();
+ }
+
+ /**
+ * generate Sources from the local das source list
+ *
+ */
+ private void addLocalDasSources()
+ {
+ if (localSources == null)
+ {
+ // get local sources from properties and initialise the local source list
+ String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE");
+
+ if (local != null)
+ {
+ int n = 1;
+ StringTokenizer st = new StringTokenizer(local, "\t");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ int bar = token.indexOf("|");
+ if (bar == -1)
+ {
+ System.err
+ .println("Warning: DAS user local source appears to have no nickname (expected a '|' followed by nickname)\nOffending definition: '"
+ + token + "'");
+ }
+ String url = token.substring(bar + 1);
+ boolean features = true, sequence = false;
+ if (url.startsWith("sequence:"))
+ {
+ url = url.substring(9);
+ // this source also serves sequences as well as features
+ sequence = true;
+ }
+ try
+ {
+ if (bar > -1)
+ {
+ createLocalSource(url, token.substring(0, bar), sequence,
+ features);
+ }
+ else
+ {
+ createLocalSource(url, "User Source" + n, sequence, features);
+ }
+ } catch (Exception q)
+ {
+ System.err
+ .println("Unexpected exception when creating local source from '"
+ + token + "'");
+ q.printStackTrace();
+ }
+ n++;
+ }
+ }
+ }
+ }
+
+ private List<jalviewSourceI> appendLocalSources()
+ {
+ List<jalviewSourceI> srclist = new ArrayList<jalviewSourceI>();
+ addLocalDasSources();
+ sourceNames = new Hashtable<String, jalviewSourceI>();
+ if (dasSources != null)
+ {
+ for (jalviewSourceI src : dasSources)
+ {
+ sourceNames.put(src.getTitle(), src);
+ srclist.add(src);
+ }
+ }
+
+ if (localSources == null)
+ {
+ return srclist;
+ }
+ Enumeration en = localSources.keys();
+ while (en.hasMoreElements())
+ {
+ String key = en.nextElement().toString();
+ jalviewSourceI jvsrc = localSources.get(key);
+ sourceNames.put(key, jvsrc);
+ srclist.add(jvsrc);
+ }
+ return srclist;
+ }
+
+ /*
+ *
+ */
+
+ @Override
+ public jalviewSourceI createLocalSource(String url, String name,
+ boolean sequence, boolean features)
+ {
+ SOURCE local = _createLocalSource(url, name, sequence, features);
+
+ if (localSources == null)
+ {
+ localSources = new Hashtable<String, jalviewSourceI>();
+ }
+ jalviewSourceI src = new JalviewSource(local, this, true);
+ localSources.put(local.getTitle(), src);
+ return src;
+ }
+
+ private SOURCE _createLocalSource(String url, String name,
+ boolean sequence, boolean features)
+ {
+ SOURCE local = new SOURCE();
+
+ local.setUri(url);
+ local.setTitle(name);
+ local.setVERSION(new ArrayList<VERSION>());
+ VERSION v = new VERSION();
+ List<CAPABILITY> cp = new ArrayList<CAPABILITY>();
+ if (sequence)
+ {
+ /*
+ * Could try and synthesize a coordinate system for the source if needbe
+ * COORDINATES coord = new COORDINATES(); coord.setAuthority("NCBI");
+ * coord.setSource("Chromosome"); coord.setTaxid("9606");
+ * coord.setVersion("35"); version.getCOORDINATES().add(coord);
+ */
+ CAPABILITY cap = new CAPABILITY();
+ cap.setType("das1:" + Capabilities.SEQUENCE.getName());
+ cap.setQueryUri(url + "/sequence");
+ cp.add(cap);
+ }
+ if (features)
+ {
+ CAPABILITY cap = new CAPABILITY();
+ cap.setType("das1:" + Capabilities.FEATURES.getName());
+ cap.setQueryUri(url + "/features");
+ cp.add(cap);
+ }
+
+ v.getCAPABILITY().addAll(cp);
+ local.getVERSION().add(v);
+
+ return local;
+ }
+
+ @Override
+ public jalviewSourceI getSource(String nickname)
+ {
+ return sourceNames.get(nickname);
+ }
+
+ @Override
+ public boolean removeLocalSource(jalviewSourceI source)
+ {
+ if (localSources.containsValue(source))
+ {
+ localSources.remove(source.getTitle());
+ sourceNames.remove(source.getTitle());
+ dasSources.remove(source);
+ jalview.bin.Cache.setProperty("DAS_LOCAL_SOURCE",
+ getLocalSourceString());
+
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void refreshSources()
+ {
+ dasSources = null;
+ sourceNames = null;
+ run();
+ }
+
+ @Override
+ public List<jalviewSourceI> resolveSourceNicknames(List<String> sources)
+ {
+ ArrayList<jalviewSourceI> resolved = new ArrayList<jalviewSourceI>();
+ if (sourceNames != null)
+ {
+ for (String src : sources)
+ {
+ jalviewSourceI dsrc = sourceNames.get(src);
+ if (dsrc != null)
+ {
+ resolved.add(dsrc);
+ }
+ }
+ }
+ return resolved;
+ }
+
+ @Override
+ public String getLocalSourceString()
+ {
+ if (localSources != null)
+ {
+ StringBuffer sb = new StringBuffer();
+ Enumeration en = localSources.keys();
+ while (en.hasMoreElements())
+ {
+ String token = en.nextElement().toString();
+ jalviewSourceI srco = localSources.get(token);
+ sb.append(token + "|"
+ + (srco.isSequenceSource() ? "sequence:" : "")
+ + srco.getUri() + "\t");
+ }
+ return sb.toString();
+ }
+ return "";
+ }
+
+ private static final Hashtable<URL, String> authStash;
+ static
+ {
+ authStash = new Hashtable<URL, String>();
+
+ try
+ {
+ // TODO: allow same credentials for https and http
+ authStash.put(new URL(
+ "http://www.compbio.dundee.ac.uk/geneweb/das/myseq/"),
+ "Basic SmltOm1pSg==");
+ } catch (MalformedURLException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public MultipleConnectionPropertyProviderI getSessionHandler()
+ {
+ return this;
+ }
+
+ @Override
+ public ConnectionPropertyProviderI getConnectionPropertyProviderFor(
+ String arg0)
+ {
+
+ final ConnectionPropertyProviderI conprov = new ConnectionPropertyProviderI()
+ {
+ boolean authed = false;
+
+ @Override
+ public void setConnectionProperties(HttpURLConnection connection)
+ {
+ String auth = authStash.get(connection.getURL());
+ if (auth != null && auth.length() > 0)
+ {
+ connection.setRequestProperty("Authorisation", auth);
+ authed = true;
+ }
+ else
+ {
+ authed = false;
+ }
+ }
+
+ @Override
+ public boolean getResponseProperties(HttpURLConnection connection)
+ {
+ String auth = authStash.get(connection.getURL());
+ if (auth != null && auth.length() == 0)
+ {
+ // don't attempt to check if we authed or not - user entered empty
+ // password
+ return false;
+ }
+ if (!authed)
+ {
+ if (auth != null)
+ {
+ // try and pass credentials.
+ return true;
+ }
+ // see if we should try and create a new auth record.
+ String ameth = connection.getHeaderField("X-DAS-AuthMethods");
+ Cache.log.debug("Could authenticate to " + connection.getURL()
+ + " with : " + ameth);
+ // TODO: search auth string and raise login box - return if auth was
+ // provided
+ return false;
+ }
+ else
+ {
+ // check to see if auth was successful
+ String asuc = connection
+ .getHeaderField("X-DAS_AuthenticatedUser");
+ if (asuc != null && asuc.trim().length() > 0)
+ {
+ // authentication was successful
+ Cache.log.debug("Authenticated successfully to "
+ + connection.getURL().toString());
+ return false;
+ }
+ // it wasn't - so we should tell the user it failed and ask if they
+ // want to attempt authentication again.
+ authStash.remove(connection.getURL());
+ // open a new login/password dialog with cancel button
+ // set new authStash content with password and return true
+ return true; //
+ // User cancelled auth - so put empty string in stash to indicate we
+ // don't want to auth with this server.
+ // authStash.put(connection.getURL(), "");
+ // return false;
+ }
+ }
+ };
+ return conprov;
+ }
+
+}
diff --git a/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java b/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java
new file mode 100644
index 0000000..8cb3fba
--- /dev/null
+++ b/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java
@@ -0,0 +1,383 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.dbsources.das.datamodel;
+
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
+import org.biodas.jdas.dassources.Capabilities;
+import org.biodas.jdas.dassources.utils.DasTimeFormat;
+import org.biodas.jdas.schema.sources.CAPABILITY;
+import org.biodas.jdas.schema.sources.COORDINATES;
+import org.biodas.jdas.schema.sources.MAINTAINER;
+import org.biodas.jdas.schema.sources.PROP;
+import org.biodas.jdas.schema.sources.SOURCE;
+import org.biodas.jdas.schema.sources.VERSION;
+
+public class JalviewSource implements jalviewSourceI
+{
+ SOURCE source;
+
+ MultipleConnectionPropertyProviderI connprov;
+
+ public JalviewSource(SOURCE local2,
+ MultipleConnectionPropertyProviderI connprov, boolean local)
+ {
+ this.connprov = connprov;
+ this.local = local;
+ source = local2;
+ }
+
+ @Override
+ public String getTitle()
+ {
+ return source.getTitle();
+ }
+
+ @Override
+ public VERSION getVersion()
+ {
+
+ return getVersionFor(source);
+ }
+
+ @Override
+ public String getDocHref()
+ {
+ return source.getDocHref();
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return source.getDescription();
+ }
+
+ @Override
+ public String getUri()
+ {
+ return source.getUri();
+ }
+
+ @Override
+ public MAINTAINER getMAINTAINER()
+ {
+ return source.getMAINTAINER();
+ }
+
+ @Override
+ public String getEmail()
+ {
+ return (local) ? null : source.getMAINTAINER().getEmail();
+ }
+
+ boolean local = false;
+
+ @Override
+ public boolean isLocal()
+ {
+ return local;
+ }
+
+ @Override
+ public boolean isSequenceSource()
+ {
+ String seqcap = "das1:" + Capabilities.SEQUENCE.getName();
+ for (String cp : getCapabilityList(getVersionFor(source)))
+ {
+ if (cp.equals(seqcap))
+ {
+ return true;
+
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isFeatureSource()
+ {
+ String seqcap = "das1:" + Capabilities.FEATURES.getName();
+ for (String cp : getCapabilityList(getVersionFor(source)))
+ {
+ if (cp.equals(seqcap))
+ {
+ return true;
+
+ }
+ }
+ return false;
+ }
+
+ private VERSION getVersionFor(SOURCE ds)
+ {
+ VERSION latest = null;
+ for (VERSION v : ds.getVERSION())
+ {
+ if (latest == null
+ || isLaterThan(latest.getCreated(), v.getCreated()))
+ {
+ // TODO: das 1.6 - should just get the first version - ignore other
+ // versions since not specified how to construct URL from version's URI
+ // + source URI
+ latest = v;
+ }
+ }
+ return latest;
+ }
+
+ /**
+ * compare date strings. null or unparseable dates are assumed to be oldest
+ *
+ * @param ref
+ * @param newer
+ * @return true iff ref comes before newer
+ */
+ private boolean isLaterThan(String ref, String newer)
+ {
+ Date refdate = null, newdate = null;
+ if (ref != null && ref.trim().length() > 0)
+ {
+ try
+ {
+ refdate = DasTimeFormat.fromDASString(ref.trim());
+
+ } catch (ParseException x)
+ {
+ }
+ }
+ if (newer != null && newer.trim().length() > 0)
+ {
+ try
+ {
+ newdate = DasTimeFormat.fromDASString(newer);
+ } catch (ParseException e)
+ {
+ }
+ }
+ if (refdate != null)
+ {
+ if (newdate != null)
+ {
+ return refdate.before(newdate);
+ }
+ return false;
+ }
+ if (newdate != null)
+ {
+ return true;
+ }
+ // assume first instance of source is newest in list. - TODO: check if
+ // natural ordering of source versions is newest first or oldest first
+ return false;
+ }
+
+ public String[] getLabelsFor(VERSION v)
+ {
+ ArrayList<String> labels = new ArrayList<String>();
+ for (PROP p : v.getPROP())
+ {
+ if (p.getName().equalsIgnoreCase("LABEL"))
+ {
+ labels.add(p.getValue());
+ }
+ }
+ return labels.toArray(new String[0]);
+ }
+
+ private CAPABILITY getCapability(Capabilities capability)
+ {
+ for (CAPABILITY p : getVersion().getCAPABILITY())
+ {
+ if (p.getType().equalsIgnoreCase(capability.getName())
+ || p.getType().equalsIgnoreCase(
+ "das1:" + capability.getName()))
+ {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ public String[] getCapabilityList(VERSION v)
+ {
+
+ ArrayList<String> labels = new ArrayList<String>();
+ for (CAPABILITY p : v.getCAPABILITY())
+ {
+ // TODO: work out what to do with namespace prefix
+ // does SEQUENCE == das1:SEQUENCE and das2:SEQUENCE ?
+ // for moment, just show all capabilities...
+ if (p.getType().startsWith("das1:"))
+ {
+ labels.add(p.getType());
+ }
+ }
+ return labels.toArray(new String[0]);
+ }
+
+ @Override
+ public List<DbSourceProxy> getSequenceSourceProxies()
+ {
+ if (!isSequenceSource())
+ {
+ return null;
+ }
+ ArrayList<DbSourceProxy> seqsources = new ArrayList<DbSourceProxy>();
+ if (!local)
+ {
+ VERSION v = getVersion();
+ Map<String, COORDINATES> latestc = new Hashtable<String, COORDINATES>();
+ for (COORDINATES cs : v.getCOORDINATES())
+ {
+ COORDINATES ltst = latestc.get(cs.getUri());
+ if (ltst == null
+ || ltst.getVersion() == null
+ || (ltst.getVersion() != null && cs.getVersion() != null && isLaterThan(
+ ltst.getVersion(), cs.getVersion())))
+ {
+ latestc.put(cs.getUri(), cs);
+ }
+ }
+ for (COORDINATES cs : latestc.values())
+ {
+ DasSequenceSource ds;
+ /*
+ * if (css == null || css.length == 0) { // TODO: query das source
+ * directly to identify coordinate system... or // have to make up a
+ * coordinate system css = new DasCoordinateSystem[] { new
+ * DasCoordinateSystem() }; css[0].setName(d1s.getNickname());
+ * css[0].setUniqueId(d1s.getNickname()); } for (int c = 0; c <
+ * css.length; c++) {
+ */
+ try
+ {
+ seqsources.add(ds = new DasSequenceSource(getTitle() + " ("
+ + cs.getAuthority() + " " + cs.getSource()
+ + (cs.getVersion() != null ? " " + cs.getVersion() : "")
+ + ")", cs.getAuthority(), source, v, cs, connprov));
+ if (seqsources.size() > 1)
+ {
+ System.err.println("Added another sequence DB source for "
+ + getTitle() + " (" + ds.getDbName() + ")");
+ }
+ } catch (Exception e)
+ {
+ System.err.println("Ignoring sequence coord system " + cs + " ("
+ + cs.getContent() + ") for source " + getTitle()
+ + "- threw exception when constructing fetcher.\n");
+ e.printStackTrace();
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ seqsources.add(new DasSequenceSource(getTitle(), getTitle(),
+ source, getVersion(), null, connprov));
+ } catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+ if (seqsources.size() > 1)
+ {
+ // sort by name
+ DbSourceProxy[] tsort = seqsources.toArray(new DasSequenceSource[0]);
+ String[] nm = new String[tsort.length];
+ for (int i = 0; i < nm.length; i++)
+ {
+ nm[i] = tsort[i].getDbName().toLowerCase();
+ }
+ jalview.util.QuickSort.sort(nm, tsort);
+ seqsources.clear();
+ for (DbSourceProxy ssrc : tsort)
+ {
+ seqsources.add(ssrc);
+ }
+ }
+ return seqsources;
+ }
+
+ @Override
+ public String getSourceURL()
+ {
+ try
+ {
+ // kind of dumb, since
+ // org.biodas.jdas.dassources.utils.VersionAdapter.getSourceUriFromQueryUri()
+ // does this,
+ // but this way, we can access non DAS 1.6 compliant sources (which have
+ // to have a URL like <sourcename>/das/ and cause a validation exception)
+
+ for (CAPABILITY cap : getVersion().getCAPABILITY())
+ {
+ String capname = cap.getType().substring(
+ cap.getType().indexOf(":") + 1);
+ int p = cap.getQueryUri().lastIndexOf(capname);
+ if (p < -1)
+ {
+ throw new Exception(MessageManager.formatMessage(
+ "exception.invalid_das_source",
+ new String[] { source.getUri() }));
+ }
+ if (cap.getQueryUri().charAt(p) == '/')
+ {
+ p--;
+ }
+ return cap.getQueryUri().substring(0, p);
+ }
+ } catch (Exception x)
+ {
+ System.err.println("Serious: Couldn't get the URL for source "
+ + source.getTitle());
+ x.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isNewerThan(jalviewSourceI other)
+ {
+ return isLaterThan(getVersion().getCreated(), other.getVersion()
+ .getCreated());
+ }
+
+ @Override
+ public boolean isReferenceSource()
+ {
+ // TODO check source object for indication that we are the primary for a DAS
+ // coordinate system
+ return false;
+ }
+}
diff --git a/src/jalview/ws/ebi/EBIFetchClient.java b/src/jalview/ws/ebi/EBIFetchClient.java
index 7135d0c..5c1dd91 100644
--- a/src/jalview/ws/ebi/EBIFetchClient.java
+++ b/src/jalview/ws/ebi/EBIFetchClient.java
@@ -1,242 +1,245 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.ebi;
-
-import java.io.*;
-import java.util.*;
-import javax.xml.namespace.*;
-import javax.xml.rpc.*;
-
-import org.apache.axis.client.Call;
-import org.apache.axis.client.Service;
-import org.apache.axis.encoding.*;
-
-/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
- */
-public class EBIFetchClient
-{
- Call call;
-
- String format = "default";
-
- String style = "raw";
-
- /**
- * Creates a new EBIFetchClient object.
- */
- public EBIFetchClient()
- {
- try
- {
- call = (Call) new Service().createCall();
- call.setTargetEndpointAddress(new java.net.URL(
- "http://www.ebi.ac.uk/ws/services/Dbfetch"));
- } catch (Exception ex)
- {
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public String[] getSupportedDBs()
- {
- try
- {
- call.setOperationName(new QName("urn:Dbfetch", "getSupportedDBs"));
- call.setReturnType(XMLType.SOAP_ARRAY);
-
- return (String[]) call.invoke(new Object[]
- {});
- } catch (Exception ex)
- {
- return null;
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public String[] getSupportedFormats()
- {
- try
- {
- call.setOperationName(new QName("urn:Dbfetch", "getSupportedFormats"));
- call.setReturnType(XMLType.SOAP_ARRAY);
-
- return (String[]) call.invoke(new Object[]
- {});
- } catch (Exception ex)
- {
- return null;
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public String[] getSupportedStyles()
- {
- try
- {
- call.setOperationName(new QName("urn:Dbfetch", "getSupportedStyles"));
- call.setReturnType(XMLType.SOAP_ARRAY);
-
- return (String[]) call.invoke(new Object[]
- {});
- } catch (Exception ex)
- {
- return null;
- }
- }
-
- public File fetchDataAsFile(String ids, String f, String s)
- throws OutOfMemoryError
- {
- String[] data = fetchData(ids, f, s);
- // TODO: after JV 2.4 - test data==null and pass error(s) back up if
- // possible (OutOfMemoryErrors are usual problem)
- if (data == null)
- {
- return null;
- }
- File outFile = null;
- try
- {
- outFile = File.createTempFile("jalview", ".xml");
- outFile.deleteOnExit();
- PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
- int index = 0;
- while (index < data.length)
- {
- out.println(data[index]);
- index++;
- }
- out.close();
- } catch (Exception ex)
- {
- }
- return outFile;
- }
-
- /**
- * Single DB multiple record retrieval
- *
- * @param ids
- * db:query1;query2;query3
- * @param f
- * raw/xml
- * @param s
- * ?
- *
- * @return Raw string array result of query set
- */
- public String[] fetchData(String ids, String f, String s)
- throws OutOfMemoryError
- {
- // Need to split
- // ids of the form uniprot:25KD_SARPE;ADHR_DROPS;
- StringTokenizer queries = new StringTokenizer(ids, ";");
- String db = null;
- StringBuffer querystring = null;
- while (queries.hasMoreTokens())
- {
- String query = queries.nextToken();
- int p;
- if ((p = query.indexOf(':')) > -1)
- {
- db = query.substring(0, p);
- query = query.substring(p + 1);
- }
- if (querystring == null)
- {
- querystring = new StringBuffer(query);
- }
- else
- {
- querystring.append("," + query);
- }
- }
- if (db == null)
- {
- System.err.println("Invalid Query string : '" + ids
- + "'\nShould be of form 'dbname:q1;q2;q3;q4'");
- }
- return fetchBatch(querystring.toString(), db, f, s);
- }
-
- public String[] fetchBatch(String ids, String db, String f, String s)
- throws OutOfMemoryError
- {
- // max 50 ids can be added at one time
- try
- {
- // call.setOperationName(new QName("urn:Dbfetch", "fetchData"));
- call.setOperationName(new QName("urn:Dbfetch", "fetchBatch"));
- call.addParameter("ids", XMLType.XSD_STRING, ParameterMode.IN);
- call.addParameter("db", XMLType.XSD_STRING, ParameterMode.IN);
- call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN);
- call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN);
- call.setReturnType(XMLType.SOAP_ARRAY);
-
- if (f != null)
- {
- format = f;
- }
-
- if (s != null)
- {
- style = s;
- }
-
- try
- {
- return (String[]) call.invoke(new Object[]
- { ids.toLowerCase(), db.toLowerCase(), format, style });
- } catch (OutOfMemoryError er)
- {
-
- System.out.println("OUT OF MEMORY DOWNLOADING QUERY FROM " + db
- + ":\n" + ids);
- throw er;
- }
- // return null;
- } catch (Exception ex)
- {
- if (ex.getMessage().startsWith(
- "uk.ac.ebi.jdbfetch.exceptions.DbfNoEntryFoundException"))
- {
- return null;
- }
- System.err.println("Unexpected exception when retrieving from " + db
- + "\nQuery was : '" + ids + "'");
- ex.printStackTrace(System.err);
- return null;
- }
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.ebi;
+
+import jalview.util.MessageManager;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class EBIFetchClient
+{
+ String format = "default";
+
+ String style = "raw";
+
+ /**
+ * Creates a new EBIFetchClient object.
+ */
+ public EBIFetchClient()
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String[] getSupportedDBs()
+ {
+ // TODO - implement rest call for dbfetch getSupportedDBs
+ throw new Error(MessageManager.getString("error.not_yet_implemented"));
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String[] getSupportedFormats()
+ {
+ // TODO - implement rest call for dbfetch getSupportedFormats
+ throw new Error(MessageManager.getString("error.not_yet_implemented"));
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String[] getSupportedStyles()
+ {
+ // TODO - implement rest call for dbfetch getSupportedStyles
+ throw new Error(MessageManager.getString("error.not_yet_implemented"));
+ }
+
+ /**
+ * Send an HTTP fetch request to EBI and save the reply in a temporary file.
+ *
+ * @param ids
+ * the query formatted as db:query1;query2;query3
+ * @param f
+ * the format wanted
+ * @param s
+ * - unused parameter
+ * @return the file holding the response
+ * @throws OutOfMemoryError
+ */
+ public File fetchDataAsFile(String ids, String f, String s)
+ throws OutOfMemoryError
+ {
+ File outFile = null;
+ try
+ {
+ outFile = File.createTempFile("jalview", ".xml");
+ outFile.deleteOnExit();
+ fetchData(ids, f, s, outFile);
+ if (outFile.length() == 0)
+ {
+ outFile.delete();
+ return null;
+ }
+ } catch (Exception ex)
+ {
+ }
+ return outFile;
+ }
+
+ /**
+ * Single DB multiple record retrieval
+ *
+ * @param ids
+ * db:query1;query2;query3
+ * @param f
+ * raw/xml
+ * @param s
+ * not used - remove?
+ *
+ * @return Raw string array result of query set
+ */
+ public String[] fetchData(String ids, String f, String s)
+ throws OutOfMemoryError
+ {
+ return fetchData(ids, f, s, null);
+ }
+
+ public String[] fetchData(String ids, String f, String s, File outFile)
+ throws OutOfMemoryError
+ {
+ // Need to split
+ // ids of the form uniprot:25KD_SARPE;ADHR_DROPS;
+ String[] rslts = new String[0];
+ StringTokenizer queries = new StringTokenizer(ids, ";");
+ String db = null;
+ StringBuffer querystring = null;
+ int nq = 0;
+ while (queries.hasMoreTokens())
+ {
+ String query = queries.nextToken();
+ int p;
+ if ((p = query.indexOf(':')) > -1)
+ {
+ db = query.substring(0, p);
+ query = query.substring(p + 1);
+ }
+ if (querystring == null)
+ {
+ querystring = new StringBuffer(query);
+ nq++;
+ }
+ else
+ {
+ querystring.append("," + query);
+ nq++;
+ }
+ }
+ if (db == null)
+ {
+ System.err.println("Invalid Query string : '" + ids
+ + "'\nShould be of form 'dbname:q1;q2;q3;q4'");
+ return null;
+ }
+ String[] rslt = fetchBatch(querystring.toString(), db, f, s, outFile);
+ if (rslt != null)
+ {
+ String[] nrslts = new String[rslt.length + rslts.length];
+ System.arraycopy(rslts, 0, nrslts, 0, rslts.length);
+ System.arraycopy(rslt, 0, nrslts, rslts.length, rslt.length);
+ rslts = nrslts;
+ }
+
+ return (rslts.length == 0 ? null : rslts);
+ }
+
+ public String[] fetchBatch(String ids, String db, String f, String s,
+ File outFile) throws OutOfMemoryError
+ {
+ long time = System.currentTimeMillis();
+ // max 200 ids can be added at one time
+ try
+ {
+ URL rcall = new URL("http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/"
+ + db.toLowerCase() + "/" + ids.toLowerCase()
+ + (f != null ? "/" + f : ""));
+
+ InputStream is = new BufferedInputStream(rcall.openStream());
+ if (outFile != null)
+ {
+ FileOutputStream fio = new FileOutputStream(outFile);
+ byte[] bb = new byte[32 * 1024];
+ int l;
+ while ((l = is.read(bb)) > 0)
+ {
+ fio.write(bb, 0, l);
+ }
+ fio.close();
+ is.close();
+ }
+ else
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ String rtn;
+ List<String> arl = new ArrayList<String>();
+ while ((rtn = br.readLine()) != null)
+ {
+ arl.add(rtn);
+ }
+ return arl.toArray(new String[arl.size()]);
+ }
+ } catch (OutOfMemoryError er)
+ {
+
+ System.out.println("OUT OF MEMORY DOWNLOADING QUERY FROM " + db
+ + ":\n" + ids);
+ throw er;
+ } catch (Exception ex)
+ {
+ if (ex.getMessage().startsWith(
+ "uk.ac.ebi.jdbfetch.exceptions.DbfNoEntryFoundException"))
+ {
+ return null;
+ }
+ System.err.println("Unexpected exception when retrieving from " + db
+ + "\nQuery was : '" + ids + "'");
+ ex.printStackTrace(System.err);
+ return null;
+ } finally
+ {
+ // System.err.println("Took " + (System.currentTimeMillis() - time)
+ // / 1000 + " secs for one call.");
+ }
+ return null;
+ }
+}
diff --git a/src/jalview/ws/io/mime/HttpContentHandler.java b/src/jalview/ws/io/mime/HttpContentHandler.java
index 03cc637..6d70404 100644
--- a/src/jalview/ws/io/mime/HttpContentHandler.java
+++ b/src/jalview/ws/io/mime/HttpContentHandler.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.io.mime;
import java.net.ContentHandler;
@@ -26,7 +29,7 @@ public class HttpContentHandler implements ContentHandlerFactory
@Override
public ContentHandler createContentHandler(String mimetype)
{
-
+
// TODO Auto-generated method stub
return null;
}
diff --git a/src/jalview/ws/io/mime/JalviewMimeContentHandler.java b/src/jalview/ws/io/mime/JalviewMimeContentHandler.java
index 53f6436..1a4ded5 100644
--- a/src/jalview/ws/io/mime/JalviewMimeContentHandler.java
+++ b/src/jalview/ws/io/mime/JalviewMimeContentHandler.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.io.mime;
import jalview.io.packed.DataProvider;
@@ -31,12 +34,12 @@ import org.apache.james.mime4j.parser.ContentHandler;
import org.apache.james.mime4j.parser.Field;
/**
- * ContentHandler for parsing mime encoded messages into Jalview objects.
- * TODO: complete implementation
- * TODO: test implementation
- * TODO: hook in to Jalview IO and service response parser.
+ * ContentHandler for parsing mime encoded messages into Jalview objects. TODO:
+ * complete implementation TODO: test implementation TODO: hook in to Jalview IO
+ * and service response parser.
+ *
* @author JimP
- *
+ *
*/
public class JalviewMimeContentHandler implements ContentHandler
{
@@ -47,122 +50,126 @@ public class JalviewMimeContentHandler implements ContentHandler
/**
* create a new handler to process a Jalview mime message.
+ *
* @param ds
*/
public JalviewMimeContentHandler(JalviewDataset ds)
{
- context=ds;
+ context = ds;
}
+
/**
* type of data pack being parsed currently
*/
String currentType;
+
/**
* name of data pack being parsed currently
*/
String currentName;
-
+
/**
- * sources for data to be parsed
+ * sources for data to be parsed
*/
- List<DataProvider> dataItems = new ArrayList<DataProvider>();
-
+ List<DataProvider> dataItems = new ArrayList<DataProvider>();
+
@Override
public void body(BodyDescriptor arg0, InputStream arg1)
throws MimeException, IOException
{
-
+
// TODO Auto-generated method stub
-
+
}
@Override
public void endBodyPart() throws MimeException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void endHeader() throws MimeException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void endMessage() throws MimeException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void endMultipart() throws MimeException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void epilogue(InputStream arg0) throws MimeException, IOException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void field(Field arg0) throws MimeException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void preamble(InputStream arg0) throws MimeException, IOException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void raw(InputStream arg0) throws MimeException, IOException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void startBodyPart() throws MimeException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void startHeader() throws MimeException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void startMessage() throws MimeException
{
// TODO Auto-generated method stub
-
+
}
@Override
public void startMultipart(BodyDescriptor arg0) throws MimeException
{
// TODO Auto-generated method stub
-
+
}
/**
*
- * @return data providers to parse each data file extracted from the mime stream.
+ * @return data providers to parse each data file extracted from the mime
+ * stream.
*/
public Iterable<DataProvider> getJalviewDataProviders()
{
diff --git a/src/jalview/ws/io/mime/MimeTypes.java b/src/jalview/ws/io/mime/MimeTypes.java
index 5dd1e42..366c945 100644
--- a/src/jalview/ws/io/mime/MimeTypes.java
+++ b/src/jalview/ws/io/mime/MimeTypes.java
@@ -1,46 +1,51 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.io.mime;
import jalview.io.packed.DataProvider.JvDataType;
/**
- * static functions for resolving Jalview datatypes from mime types
- * @author JimP
- * TODO: consider making get(Mime)TypeOf functions throw exceptions rather than returning null
+ * static functions for resolving Jalview datatypes from mime types
+ *
+ * @author JimP TODO: consider making get(Mime)TypeOf functions throw exceptions
+ * rather than returning null
*/
public class MimeTypes
{
/**
- * pair list {String,JvDataType} giving a mime-type followed by its associated JvDataType enumeration.
+ * pair list {String,JvDataType} giving a mime-type followed by its associated
+ * JvDataType enumeration.
*/
final public static Object[] typemap = new Object[] {
- "application/x-align",JvDataType.ALIGNMENT,
- "application/x-jalview-annotation",JvDataType.ANNOTATION,
- "application/x-newick",JvDataType.TREE,
- "application/x-new-hampshire",JvDataType.TREE,
- "application/x-new-hampshire-extended",JvDataType.TREE,
- "application/x-nh",JvDataType.TREE,
- "application/x-nhx",JvDataType.TREE,
- "application/x-gff",JvDataType.FEATURES,
- "application/x-gff3",JvDataType.FEATURES,
- "application/x-jalview-feature-file",JvDataType.FEATURES,
- "application/x-pdb",JvDataType.SEQASSOCATED};
+ "application/x-align", JvDataType.ALIGNMENT,
+ "application/x-jalview-annotation", JvDataType.ANNOTATION,
+ "application/x-newick", JvDataType.TREE,
+ "application/x-new-hampshire", JvDataType.TREE,
+ "application/x-new-hampshire-extended", JvDataType.TREE,
+ "application/x-nh", JvDataType.TREE, "application/x-nhx",
+ JvDataType.TREE, "application/x-gff", JvDataType.FEATURES,
+ "application/x-gff3", JvDataType.FEATURES,
+ "application/x-jalview-feature-file", JvDataType.FEATURES,
+ "application/x-pdb", JvDataType.SEQASSOCATED };
+
/**
*
* @param mimeType
@@ -49,16 +54,16 @@ public class MimeTypes
public static JvDataType getTypeOf(String mimeType)
{
String mt = mimeType.toLowerCase();
- for (int i=0;i<typemap.length;i+=2)
+ for (int i = 0; i < typemap.length; i += 2)
{
if (typemap[i].equals(mt))
{
- return (JvDataType) typemap[i+1];
+ return (JvDataType) typemap[i + 1];
}
}
return null;
}
-
+
/**
*
* @param type
@@ -66,13 +71,13 @@ public class MimeTypes
*/
public static String getMimeTypeOf(JvDataType type)
{
- for (int i=1;i<typemap.length;i+=2)
+ for (int i = 1; i < typemap.length; i += 2)
{
if (typemap[i].equals(type))
{
- return (String) typemap[i-1];
+ return (String) typemap[i - 1];
}
}
return null;
}
-}
\ No newline at end of file
+}
diff --git a/src/jalview/ws/jws1/Annotate3D.java b/src/jalview/ws/jws1/Annotate3D.java
new file mode 100644
index 0000000..f3516b7
--- /dev/null
+++ b/src/jalview/ws/jws1/Annotate3D.java
@@ -0,0 +1,282 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws1;
+
+import jalview.datamodel.AlignmentI;
+import jalview.io.FileParse;
+import jalview.io.FormatAdapter;
+import jalview.io.InputStreamParser;
+import jalview.util.MessageManager;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Iterator;
+
+public class Annotate3D
+{
+ // protected BufferedReader in;
+ // protected BufferedWriter out;
+
+ public Annotate3D()
+ {
+ System.out.println("Annotate3D");
+ // try {
+ // Create a URL for the desired page
+ // String id = "1HR2";
+ // URL url = new
+ // URL("http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?pdbid="+id);
+ // in = new BufferedReader(new InputStreamReader(url.openStream()));
+ // String str;
+ // OutputStream out1 = null;
+ // out = new BufferedWriter(new OutputStreamWriter(out1, "temp.rnaml"));
+ // while ((str = in.readLine()) != null) {
+ // System.out.println(str);
+ // out.write(str);
+ // }
+ // in.close();
+ // out.close();
+ // } catch (MalformedURLException e) {
+ // } catch (IOException e) {
+ // }
+ }
+
+ public AlignmentI getRNAMLFor(final FileParse source) throws IOException
+ {
+ try
+ {
+ StringBuffer sb = new StringBuffer();
+
+ Reader fpr = source.getReader();
+ int p = 0;
+ char[] cbuff = new char[2048];
+ while ((p = fpr.read(cbuff)) > 0)
+ {
+ for (int i = 0; i < p; i++)
+ {
+ sb.append(cbuff[i]);
+ }
+ }
+ Iterator<Reader> r = jalview.ext.paradise.Annotate3D
+ .getRNAMLForPDBFileAsString(sb.toString());
+ AlignmentI al = null;
+ while (r.hasNext())
+ {
+ FileParse fp = new InputStreamParser(r.next(), source.getDataName());
+ AlignmentI nal = new FormatAdapter().readFromFile(fp, "RNAML");
+ if (al == null)
+ {
+ al = nal;
+ }
+ else
+ {
+ al.append(nal);
+ }
+ }
+ return al;
+ } catch (Throwable x)
+ {
+ if (x instanceof IOException)
+ {
+ throw ((IOException) x);
+ }
+ else
+ {
+ throw new IOException(
+ MessageManager
+ .getString("exception.unexpected_handling_rnaml_translation_for_pdb"),
+ x);
+ }
+ }
+ }
+
+ public Annotate3D(String path) throws InterruptedException
+ {
+ System.out.println("Annotate3D");
+ try
+ {
+ // //URL url = new
+ // URL("http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?data="+inFile);
+ // System.out.println("Step1");
+ // FileReader r = new FileReader(inFile);
+ // BufferedReader in = new BufferedReader(r);
+ // StringBuffer content = new StringBuffer();
+ // System.out.println("Step2");
+ // while(in.readLine()!=null){
+ // content.append(in.readLine());
+ // //System.out.println("Step3"+in.readLine());
+ // }
+ //
+ // String data = URLEncoder.encode("data", "UTF-8") + "=" +
+ // URLEncoder.encode(content.toString(), "UTF-8");
+ // for (int i=0;i<data.length();i++)
+ // {
+ // System.out.print(data.charAt(i));
+ // }
+
+ // String data = "width=50&height=100";
+
+ // // Send the request
+ // FileReader r = new FileReader(path);
+ // BufferedReader in = new BufferedReader(r);
+ // StringBuffer content = new StringBuffer();
+ // System.out.println("Step1");
+ // while(in.readLine()!=null){
+ // content.append(in.readLine());
+ //
+ // }
+ // System.out.println("Step2");
+ // String data = URLEncoder.encode("data", "UTF-8") + "=" +
+ // URLEncoder.encode(content.toString(), "UTF-8");
+ // System.out.println("Step2");
+ // URL url = new
+ // URL("http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?data="+data);
+ // DataInputStream is = new DataInputStream(url.openStream());
+ // String str;
+ // while ((str = is.readLine()) != null) {
+ // System.out.println(str);
+ // //out.write(str);
+ // }
+ FileReader r = new FileReader(path);
+ BufferedReader in = new BufferedReader(r);
+ String content = "";
+ String str;
+
+ while ((str = in.readLine()) != null)
+ {
+ // System.out.println(str);
+
+ content = content + str;
+ }
+ System.out.println("pdbfile=" + content.toString());
+ System.out.println("capacité=" + content.length());
+ String paramfile = URLEncoder.encode(content.toString(), "UTF-8");
+ System.out.println("param=" + paramfile);
+ URL url = new URL(
+ "http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?data="
+ + content);
+ BufferedReader is = new BufferedReader(new InputStreamReader(
+ url.openStream()));
+ String str4;
+ while ((str4 = is.readLine()) != null)
+ {
+ System.out.println(str4);
+ // out.write(str);
+ }
+ in.close();
+ is.close();
+
+ // HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ // connection.setRequestMethod("POST" );
+ // connection.setRequestProperty("data", path );
+ // //connection.setRequestProperty("nomDuChamp2", "valeurDuChamp2" );
+ // BufferedReader input = new BufferedReader(new
+ // InputStreamReader(connection.getInputStream()));
+ // //DataInputStream input = new
+ // DataInputStream(connection.getInputStream());
+ // String c;
+ // while((c=input.readLine())!=null){
+ // System.out.print(c);
+ // }
+ // input.close();
+ // BufferedReader in1 = new BufferedReader(is);
+
+ // OutputStream out1 = null;
+ // System.out.println("Step3");
+ // BufferedWriter out = new BufferedWriter(new OutputStreamWriter(out1,
+ // "temp.rnaml"));
+ //
+ // in.close();
+ // out.close();
+
+ // return;
+
+ // System.out.println(data.length());
+ // System.out.println("step2");
+ // URL url = new
+ // URL("http://paradise-ibmc.u-strasbg.fr/webservices/annotate3d?data="+data);
+ // System.out.println("step3");
+ // URLConnection conn = url.openConnection();
+ // conn.setDoOutput(true);
+ // OutputStreamWriter writer = new
+ // OutputStreamWriter(conn.getOutputStream());
+
+ // write parameters
+ // writer.write(data);
+ // writer.flush();
+
+ // Get the response
+ // StringBuffer answer = new StringBuffer();
+ // //BufferedReader reader = new BufferedReader(new
+ // InputStreamReader(conn.getInputStream()));
+ // //String line;
+ // while ((line = reader.readLine()) != null) {
+ // answer.append(line);
+ // System.out.println(line);
+ // }
+ // writer.close();
+ // reader.close();
+
+ // Output the response
+
+ } catch (MalformedURLException ex)
+ {
+ ex.printStackTrace();
+ } catch (IOException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ // in = new BufferedReader(new InputStreamReader(url.openStream()));
+
+ // String str;
+
+ // out = new FileOutputStream("temp.rnaml");
+ // out = new BufferedWriter(new FileWriter("temp.rnaml"));
+
+ // while ((str = in.readLine()) != null) {
+ // System.out.println(str);
+ // out.write(str);
+ // System.out.println(str);
+ // in.close();
+
+ // out.close();
+ // } catch (MalformedURLException e) {
+ // } catch (IOException e) {
+ // }
+ //
+ // }
+
+ // public BufferedWriter getReader()
+ // {
+ // System.out.println("The buffer");
+
+ // return out;
+
+ // }
+
+}
diff --git a/src/jalview/ws/jws1/Discoverer.java b/src/jalview/ws/jws1/Discoverer.java
index c401452..b4c29d1 100644
--- a/src/jalview/ws/jws1/Discoverer.java
+++ b/src/jalview/ws/jws1/Discoverer.java
@@ -1,27 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
-import java.util.*;
+import jalview.util.MessageManager;
+
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
-import javax.swing.*;
+import javax.swing.JOptionPane;
-import ext.vamsas.*;
+import ext.vamsas.IRegistry;
+import ext.vamsas.IRegistryServiceLocator;
+import ext.vamsas.RegistryServiceSoapBindingStub;
+import ext.vamsas.ServiceHandle;
+import ext.vamsas.ServiceHandles;
public class Discoverer implements Runnable
{
@@ -182,33 +193,35 @@ public class Discoverer implements Runnable
jalview.bin.Cache.log.debug("Setting default services");
services = new Hashtable();
// Muscle, Clustal and JPred.
- ServiceHandle[] defServices =
- {
+ ServiceHandle[] defServices = {
new ServiceHandle(
"MsaWS",
"Edgar, Robert C. (2004), MUSCLE: multiple sequence alignment "
+ "with high accuracy and high throughput, Nucleic Acids Research 32(5), 1792-97.",
"http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS",
- "Muscle Multiple Protein Sequence Alignment"),
+ MessageManager
+ .getString("label.muscle_multiple_protein_sequence_alignment")),
new ServiceHandle(
"MsaWS",
"Katoh, K., K. Kuma, K., Toh, H., and Miyata, T. (2005) "
+ "\"MAFFT version 5: improvement in accuracy of multiple sequence alignment.\""
+ " Nucleic Acids Research, 33 511-518",
"http://www.compbio.dundee.ac.uk/JalviewWS/services/MafftWS",
- "MAFFT Multiple Sequence Alignment"),
+ MessageManager
+ .getString("label.mafft_multiple_sequence_alignment")),
new ServiceHandle(
"MsaWS",
"Thompson, J.D., Higgins, D.G. and Gibson, T.J. (1994) CLUSTAL W: improving the sensitivity of progressive multiple"
+ " sequence alignment through sequence weighting, position specific gap penalties and weight matrix choice."
+ " Nucleic Acids Research, 22 4673-4680",
"http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS",
- "ClustalW Multiple Sequence Alignment"),
+ MessageManager
+ .getString("label.clustalw_multiple_sequence_alignment")),
new ServiceHandle(
"SecStrPred",
- "Cole C., Barber J. D., Barton G.J (2008) "
- + "The Jpred 3 secondary structure prediction server "
- + "Nucleic Acids Research, 36 W197-W201",
+ "Drozdetskiy A, Cole C, Procter J & Barton GJ. (2015)\nJPred4: a protein secondary structure prediction server"
+ + "\nNucleic Acids Research, Web Server issue (first published 15th April 2015)"
+ + "\ndoi://10.1093/nar/gkv332",
"http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred",
"JNet Secondary Structure Prediction") };
services = new Hashtable();
@@ -242,12 +255,11 @@ public class Discoverer implements Runnable
{
if (jalview.gui.Desktop.desktop != null)
{
- JOptionPane
- .showMessageDialog(
- jalview.gui.Desktop.desktop,
- "Please set up your proxy settings in the 'Connections' tab of the Preferences window",
- "Proxy Authorization Failed",
- JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(jalview.gui.Desktop.desktop,
+ MessageManager.getString("label.set_proxy_settings"),
+ MessageManager
+ .getString("label.proxy_authorization_failed"),
+ JOptionPane.WARNING_MESSAGE);
}
}
else
@@ -351,7 +363,7 @@ public class Discoverer implements Runnable
{
jalview.bin.Cache.log
.warn("No services at "
- + ((java.net.URL) ServiceURLList.get(s_url))
+ + (ServiceURLList.get(s_url))
+ " - check DISCOVERY_URLS property in .jalview_properties");
}
s_url++;
diff --git a/src/jalview/ws/jws1/JPredClient.java b/src/jalview/ws/jws1/JPredClient.java
index b429c97..55d0813 100644
--- a/src/jalview/ws/jws1/JPredClient.java
+++ b/src/jalview/ws/jws1/JPredClient.java
@@ -1,33 +1,47 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
+import jalview.analysis.AlignSeq;
+import jalview.bin.Cache;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SeqCigar;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.WebserviceInfo;
+import jalview.util.MessageManager;
+
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.util.*;
+import java.util.Hashtable;
-import javax.swing.*;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
-import ext.vamsas.*;
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
+import ext.vamsas.Jpred;
+import ext.vamsas.JpredServiceLocator;
+import ext.vamsas.JpredSoapBindingStub;
+import ext.vamsas.ServiceHandle;
public class JPredClient extends WS1Client
{
@@ -141,7 +155,8 @@ public class JPredClient extends WS1Client
if (!msa && msf.length > 1)
{
throw new Error(
- "Implementation Error! Multiple single sequence prediction jobs are not yet supported.");
+ MessageManager
+ .getString("error.implementation_error_multiple_single_sequence_prediction_jobs_not_supported"));
}
String altitle = getPredictionName(WebServiceName) + " for "
@@ -281,14 +296,15 @@ public class JPredClient extends WS1Client
private WebserviceInfo setWebService()
{
WebServiceName = "JNetWS";
- WebServiceJobTitle = "JNet secondary structure prediction";
+ WebServiceJobTitle = MessageManager
+ .getString("label.jnet_secondary_structure_prediction");
WebServiceReference = "\"Cuff J. A and Barton G.J (2000) Application of "
+ "multiple sequence alignment profiles to improve protein secondary structure prediction, "
+ "Proteins 40:502-511\".";
WsURL = "http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred";
WebserviceInfo wsInfo = new WebserviceInfo(WebServiceJobTitle,
- WebServiceReference);
+ WebServiceReference, true);
return wsInfo;
}
@@ -307,14 +323,21 @@ public class JPredClient extends WS1Client
} catch (Exception ex)
{
- JOptionPane.showMessageDialog(Desktop.desktop,
- "The Secondary Structure Prediction Service named "
- + WebServiceName + " at " + WsURL
- + " couldn't be located.", "Internal Jalview Error",
- JOptionPane.WARNING_MESSAGE);
- wsInfo.setProgressText("Serious! " + WebServiceName
- + " Service location failed\nfor URL :" + WsURL + "\n"
- + ex.getMessage());
+ JOptionPane
+ .showMessageDialog(
+ Desktop.desktop,
+ MessageManager
+ .formatMessage(
+ "label.secondary_structure_prediction_service_couldnt_be_located",
+ new String[] { WebServiceName, WsURL }),
+ MessageManager
+ .getString("label.internal_jalview_error"),
+ JOptionPane.WARNING_MESSAGE);
+ wsInfo.setProgressText(MessageManager
+ .formatMessage(
+ "label.secondary_structure_prediction_service_couldnt_be_located",
+ new String[] { WebServiceName, WsURL })
+ + "\n" + ex.getMessage());
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
}
diff --git a/src/jalview/ws/jws1/JPredThread.java b/src/jalview/ws/jws1/JPredThread.java
index 796c2af..79c39b4 100644
--- a/src/jalview/ws/jws1/JPredThread.java
+++ b/src/jalview/ws/jws1/JPredThread.java
@@ -1,33 +1,46 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
-import java.util.*;
-
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
-import jalview.io.*;
-import jalview.util.*;
+import jalview.analysis.AlignSeq;
+import jalview.bin.Cache;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.WebserviceInfo;
+import jalview.io.FormatAdapter;
+import jalview.util.Comparison;
+import jalview.util.MessageManager;
import jalview.ws.AWsJob;
import jalview.ws.JobStateSummary;
import jalview.ws.WSClientI;
+
+import java.util.Hashtable;
+import java.util.List;
+
import vamsas.objects.simple.JpredResult;
class JPredThread extends JWS1Thread implements WSClientI
@@ -91,7 +104,7 @@ class JPredThread extends JWS1Thread implements WSClientI
{
return null;
}
- Alignment al = null;
+ AlignmentI al = null;
ColumnSelection alcsel = null;
int FirstSeq = -1; // the position of the query sequence in Alignment al
@@ -134,24 +147,32 @@ class JPredThread extends JWS1Thread implements WSClientI
{
sqs[i] = al.getSequenceAt(i);
}
- if (!jalview.analysis.SeqsetUtils.deuniquify(
- (Hashtable) SequenceInfo, sqs))
+ if (!jalview.analysis.SeqsetUtils.deuniquify(SequenceInfo, sqs))
{
throw (new Exception(
- "Couldn't recover sequence properties for alignment."));
+ MessageManager
+ .getString("exception.couldnt_recover_sequence_properties_for_alignment")));
}
}
FirstSeq = 0;
- al.setDataset(null);
+ if (currentView.getDataset() != null)
+ {
+ al.setDataset(currentView.getDataset());
+ }
+ else
+ {
+ al.setDataset(null);
+ }
jalview.io.JnetAnnotationMaker.add_annotation(prediction, al,
FirstSeq, false, predMap);
}
else
{
- throw (new Exception("Unknown format " + format
- + " for file : \n" + result.getAligfile()));
+ throw (new Exception(MessageManager.formatMessage(
+ "exception.unknown_format_for_file", new String[] {
+ format, result.getAligfile() })));
}
}
else
@@ -161,20 +182,21 @@ class JPredThread extends JWS1Thread implements WSClientI
if (predMap != null)
{
char gc = getGapChar();
- SequenceI[] sqs = (SequenceI[]) ((java.lang.Object[]) input
- .getAlignmentAndColumnSelection(gc))[0];
+ SequenceI[] sqs = (SequenceI[]) input
+ .getAlignmentAndColumnSelection(gc)[0];
if (this.msaIndex >= sqs.length)
{
throw new Error(
- "Implementation Error! Invalid msaIndex for JPredJob on parent MSA input object!");
+ MessageManager
+ .getString("error.implementation_error_invalid_msa_index_for_job"));
}
// ///
// Uses RemoveGapsCommand
// ///
- new jalview.commands.RemoveGapsCommand("Remove Gaps",
- new SequenceI[]
- { sqs[msaIndex] }, currentView);
+ new jalview.commands.RemoveGapsCommand(
+ MessageManager.getString("label.remove_gaps"),
+ new SequenceI[] { sqs[msaIndex] }, currentView);
SequenceI profileseq = al.getSequenceAt(FirstSeq);
profileseq.setSequence(sqs[msaIndex].getSequenceAsString());
@@ -184,11 +206,20 @@ class JPredThread extends JWS1Thread implements WSClientI
al.getSequenceAt(FirstSeq), SequenceInfo))
{
throw (new Exception(
- "Couldn't recover sequence properties for JNet Query sequence!"));
+ MessageManager
+ .getString("exception.couldnt_recover_sequence_props_for_jnet_query")));
}
else
{
- al.setDataset(null);
+ if (currentView.getDataset() != null)
+ {
+ al.setDataset(currentView.getDataset());
+
+ }
+ else
+ {
+ al.setDataset(null);
+ }
jalview.io.JnetAnnotationMaker.add_annotation(prediction, al,
FirstSeq, true, predMap);
SequenceI profileseq = al.getSequenceAt(0); // this includes any gaps.
@@ -197,12 +228,54 @@ class JPredThread extends JWS1Thread implements WSClientI
{
// Adjust input view for gaps
// propagate insertions into profile
- alcsel = ColumnSelection.propagateInsertions(profileseq, al, input);
+ alcsel = ColumnSelection.propagateInsertions(profileseq, al,
+ input);
}
}
}
- return new Object[]
- { al, alcsel }; // , FirstSeq, noMsa};
+ // transfer to dataset
+ for (AlignmentAnnotation alant : al.getAlignmentAnnotation())
+ {
+ if (alant.sequenceRef != null)
+ {
+ replaceAnnotationOnAlignmentWith(alant, alant.label,
+ "jalview.jws1.Jpred" + (this.msa == null ? "" : "MSA"),
+ alant.sequenceRef);
+ }
+ }
+ return new Object[] { al, alcsel }; // , FirstSeq, noMsa};
+ }
+
+ /**
+ * copied from JabawsCalcWorker
+ *
+ * @param newAnnot
+ * @param typeName
+ * @param calcId
+ * @param aSeq
+ */
+ protected void replaceAnnotationOnAlignmentWith(
+ AlignmentAnnotation newAnnot, String typeName, String calcId,
+ SequenceI aSeq)
+ {
+ SequenceI dsseq = aSeq.getDatasetSequence();
+ while (dsseq.getDatasetSequence() != null)
+ {
+ dsseq = dsseq.getDatasetSequence();
+ }
+ // look for same annotation on dataset and lift this one over
+ List<AlignmentAnnotation> dsan = dsseq.getAlignmentAnnotations(
+ calcId, typeName);
+ if (dsan != null && dsan.size() > 0)
+ {
+ for (AlignmentAnnotation dssan : dsan)
+ {
+ dsseq.removeAlignmentAnnotation(dssan);
+ }
+ }
+ AlignmentAnnotation dssan = new AlignmentAnnotation(newAnnot);
+ dsseq.addAlignmentAnnotation(dssan);
+ dssan.adjustForAlignment();
}
/**
@@ -213,7 +286,7 @@ class JPredThread extends JWS1Thread implements WSClientI
* @param al
* @param profileseq
*/
- private void alignToProfileSeq(Alignment al, SequenceI profileseq)
+ private void alignToProfileSeq(AlignmentI al, SequenceI profileseq)
{
char gc = al.getGapCharacter();
int[] gapMap = profileseq.gapMap();
@@ -255,7 +328,6 @@ class JPredThread extends JWS1Thread implements WSClientI
}
}
-
public JPredJob(Hashtable SequenceInfo, SequenceI seq, int[] delMap)
{
super();
@@ -269,6 +341,10 @@ class JPredThread extends JWS1Thread implements WSClientI
sequence.setId(seq.getName());
sequence.setSeq(sq);
}
+ else
+ {
+ errorMessage = "Sequence is too short to predict with JPred - need at least 20 amino acids.";
+ }
}
public JPredJob(Hashtable SequenceInfo, SequenceI[] msf, int[] delMap)
@@ -284,6 +360,13 @@ class JPredThread extends JWS1Thread implements WSClientI
}
}
}
+
+ String errorMessage = "";
+
+ public String getValidationMessages()
+ {
+ return errorMessage + "\n";
+ }
}
ext.vamsas.Jpred server;
@@ -309,10 +392,13 @@ class JPredThread extends JWS1Thread implements WSClientI
if (job.hasValidInput())
{
OutputHeader = wsInfo.getProgressText();
- jobs = new WSJob[]
- { job };
+ jobs = new WSJob[] { job };
job.setJobnum(0);
}
+ else
+ {
+ wsInfo.appendProgressText(job.getValidationMessages());
+ }
}
JPredThread(WebserviceInfo wsinfo, String altitle,
@@ -324,20 +410,23 @@ class JPredThread extends JWS1Thread implements WSClientI
JPredJob job = new JPredJob(SequenceInfo, msf, delMap);
if (job.hasValidInput())
{
- jobs = new WSJob[]
- { job };
+ jobs = new WSJob[] { job };
OutputHeader = wsInfo.getProgressText();
job.setJobnum(0);
}
+ else
+ {
+ wsInfo.appendProgressText(job.getValidationMessages());
+ }
}
public void StartJob(AWsJob j)
{
if (!(j instanceof JPredJob))
{
- throw new Error(
- "Implementation error - StartJob(JpredJob) called on "
- + j.getClass());
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_startjob_called",
+ new String[] { j.getClass().toString() }));
}
try
{
@@ -356,9 +445,11 @@ class JPredThread extends JWS1Thread implements WSClientI
{
if (job.getJobId().startsWith("Broken"))
{
- job.result = (vamsas.objects.simple.Result) new JpredResult();
+ job.result = new JpredResult();
job.result.setInvalid(true);
- job.result.setStatus("Submission " + job.getJobId());
+ job.result.setStatus(MessageManager.formatMessage(
+ "label.submission_params", new String[] { job.getJobId()
+ .toString() }));
throw new Exception(job.getJobId());
}
else
@@ -370,7 +461,9 @@ class JPredThread extends JWS1Thread implements WSClientI
}
else
{
- throw new Exception("Server timed out - try again later\n");
+ throw new Exception(
+ MessageManager
+ .getString("exception.server_timeout_try_later"));
}
} catch (Exception e)
{
@@ -394,9 +487,11 @@ class JPredThread extends JWS1Thread implements WSClientI
{
wsInfo.setStatus(j.getJobnum(), WebserviceInfo.STATE_STOPPED_ERROR);
// JBPNote - this could be a popup informing the user of the problem.
- wsInfo.appendProgressText(j.getJobnum(),
- "Failed to submit the prediction:\n" + e.getMessage()
- + wsInfo.getProgressText());
+ wsInfo.appendProgressText(j.getJobnum(), MessageManager
+ .formatMessage(
+ "info.failed_to_submit_prediction",
+ new String[] { e.getMessage(),
+ wsInfo.getProgressText() }));
jalview.bin.Cache.log.debug(
"Failed Submission of job " + j.getJobnum(), e);
@@ -451,6 +546,8 @@ class JPredThread extends JWS1Thread implements WSClientI
}
else
{
+ wsInfo.setStatus(wsInfo.STATE_STOPPED_ERROR);
+ wsInfo.appendInfoText("No jobs ran.");
wsInfo.setFinishedNoResults();
}
}
@@ -485,7 +582,8 @@ class JPredThread extends JWS1Thread implements WSClientI
{
// do merge with other job results
throw new Error(
- "Multiple JNet subjob merging not yet implemented.");
+ MessageManager
+ .getString("error.multiple_jnet_subjob_merge_not_implemented"));
}
} catch (Exception e)
{
@@ -493,9 +591,10 @@ class JPredThread extends JWS1Thread implements WSClientI
"JNet Client: JPred Annotation Parse Error", e);
wsInfo.setStatus(j.getJobnum(),
WebserviceInfo.STATE_STOPPED_ERROR);
- wsInfo.appendProgressText(j.getJobnum(), OutputHeader + "\n"
- + j.result.getStatus()
- + "\nInvalid JNet job result data!\n" + e.getMessage());
+ wsInfo.appendProgressText(j.getJobnum(), MessageManager
+ .formatMessage("info.invalid_jnet_job_result_data",
+ new String[] { OutputHeader.toString(),
+ j.result.getStatus(), e.getMessage() }));
j.result.setBroken(true);
}
}
@@ -506,6 +605,8 @@ class JPredThread extends JWS1Thread implements WSClientI
if (newWindow)
{
AlignFrame af;
+ ((AlignmentI) res[0]).setSeqrep(((AlignmentI) res[0])
+ .getSequenceAt(0));
if (input == null)
{
if (res[1] != null)
@@ -563,7 +664,7 @@ class JPredThread extends JWS1Thread implements WSClientI
public void cancelJob()
{
- throw new Error("Implementation error!");
+ throw new Error(MessageManager.getString("error.implementation_error"));
}
public boolean canMergeResults()
diff --git a/src/jalview/ws/jws1/JWS1Thread.java b/src/jalview/ws/jws1/JWS1Thread.java
index 18fed82..97d041e 100644
--- a/src/jalview/ws/jws1/JWS1Thread.java
+++ b/src/jalview/ws/jws1/JWS1Thread.java
@@ -1,27 +1,28 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
-import javax.swing.*;
-
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
+import jalview.datamodel.AlignmentView;
+import jalview.gui.AlignFrame;
+import jalview.gui.WebserviceInfo;
import jalview.ws.AWSThread;
/**
diff --git a/src/jalview/ws/jws1/MsaWSClient.java b/src/jalview/ws/jws1/MsaWSClient.java
index 1a9552b..03b9b8f 100644
--- a/src/jalview/ws/jws1/MsaWSClient.java
+++ b/src/jalview/ws/jws1/MsaWSClient.java
@@ -1,30 +1,43 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentView;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.WebserviceInfo;
+import jalview.util.MessageManager;
+
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import javax.swing.*;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
-import ext.vamsas.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
+import ext.vamsas.MuscleWS;
+import ext.vamsas.MuscleWSServiceLocator;
+import ext.vamsas.MuscleWSSoapBindingStub;
+import ext.vamsas.ServiceHandle;
/**
* DOCUMENT ME!
@@ -66,24 +79,22 @@ public class MsaWSClient extends WS1Client
alignFrame = _alignFrame;
if (!sh.getAbstractName().equals("MsaWS"))
{
- JOptionPane
- .showMessageDialog(
- Desktop.desktop,
- "The Service called \n"
- + sh.getName()
- + "\nis not a \nMultiple Sequence Alignment Service !",
- "Internal Jalview Error", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage("label.service_called_is_not_msa_service",
+ new String[] { sh.getName() }), MessageManager
+ .getString("label.internal_jalview_error"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
if ((wsInfo = setWebService(sh)) == null)
{
- JOptionPane.showMessageDialog(
- Desktop.desktop,
- "The Multiple Sequence Alignment Service named "
- + sh.getName() + " is unknown",
- "Internal Jalview Error", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage("label.msa_service_is_unknown",
+ new String[] { sh.getName() }), MessageManager
+ .getString("label.internal_jalview_error"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
diff --git a/src/jalview/ws/jws1/MsaWSThread.java b/src/jalview/ws/jws1/MsaWSThread.java
index 602eb50..e6afb04 100644
--- a/src/jalview/ws/jws1/MsaWSThread.java
+++ b/src/jalview/ws/jws1/MsaWSThread.java
@@ -1,31 +1,43 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
-import java.util.*;
-
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
+import jalview.analysis.AlignSeq;
+import jalview.bin.Cache;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentOrder;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.WebserviceInfo;
+import jalview.util.MessageManager;
import jalview.ws.AWsJob;
import jalview.ws.JobStateSummary;
import jalview.ws.WSClientI;
+
+import java.util.Hashtable;
+import java.util.Vector;
+
import vamsas.objects.simple.MsaResult;
class MsaWSThread extends JWS1Thread implements WSClientI
@@ -60,7 +72,7 @@ class MsaWSThread extends JWS1Thread implements WSClientI
subjobComplete = true;
result = new MsaResult();
result.setFinished(true);
- result.setStatus("Job never ran - input returned to user.");
+ result.setStatus(MessageManager.getString("label.job_never_ran"));
}
}
@@ -84,7 +96,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI
if (minlen < 0)
{
throw new Error(
- "Implementation error: minlen must be zero or more.");
+ MessageManager
+ .getString("error.implementation_error_minlen_must_be_greater_zero"));
}
for (int i = 0; i < seqs.length; i++)
{
@@ -122,8 +135,7 @@ class MsaWSThread extends JWS1Thread implements WSClientI
.extractGaps(jalview.util.Comparison.GapChars,
seqs[i].getSequenceAsString());
}
- emptySeqs.add(new String[]
- { newname, empty });
+ emptySeqs.add(new String[] { newname, empty });
}
}
this.seqs = new vamsas.objects.simple.SequenceSet();
@@ -242,8 +254,7 @@ class MsaWSThread extends JWS1Thread implements WSClientI
jalview.analysis.AlignmentSorter.recoverOrder(alseqs);
// account for any missing sequences
jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs);
- return new Object[]
- { alseqs, msaorder };
+ return new Object[] { alseqs, msaorder };
}
return null;
}
@@ -428,8 +439,9 @@ class MsaWSThread extends JWS1Thread implements WSClientI
{
if (!(job instanceof MsaWSJob))
{
- throw new Error("StartJob(MsaWSJob) called on a WSJobInstance "
- + job.getClass());
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_msawbjob_called",
+ new String[] { job.getClass().toString() }));
}
MsaWSJob j = (MsaWSJob) job;
if (j.isSubmitted())
@@ -447,7 +459,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI
j.setSubmitted(true);
j.result = new MsaResult();
j.result.setFinished(true);
- j.result.setStatus("Empty Alignment Job");
+ j.result.setStatus(MessageManager
+ .getString("label.empty_alignment_job"));
((MsaResult) j.result).setMsa(null);
}
try
@@ -465,10 +478,9 @@ class MsaWSThread extends JWS1Thread implements WSClientI
{
if (jobsubmit == null)
{
- throw new Exception(
- "Server at "
- + WsUrl
- + " returned null object, it probably cannot be contacted. Try again later ?");
+ throw new Exception(MessageManager.formatMessage(
+ "exception.web_service_returned_null_try_later",
+ new String[] { WsUrl }));
}
throw new Exception(jobsubmit.getJobId());
@@ -486,11 +498,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
wsInfo.setStatus(j.getJobnum(),
WebserviceInfo.STATE_STOPPED_SERVERERROR);
- wsInfo.appendProgressText(
- j.getJobnum(),
- "Failed to submit sequences for alignment.\n"
- + "It is most likely that there is a problem with the server.\n"
- + "Just close the window\n");
+ wsInfo.appendProgressText(j.getJobnum(), MessageManager
+ .getString("info.failed_to_submit_sequences_for_alignment"));
// e.printStackTrace(); // TODO: JBPNote DEBUG
}
@@ -535,8 +544,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI
.getMsa();
if (valign != null)
{
- wsInfo.appendProgressText(jobs[j].getJobnum(),
- "\nAlignment Object Method Notes\n");
+ wsInfo.appendProgressText(jobs[j].getJobnum(), MessageManager
+ .getString("info.alignment_object_method_notes"));
String[] lines = valign.getMethod();
for (int line = 0; line < lines.length; line++)
{
diff --git a/src/jalview/ws/jws1/SeqSearchWSClient.java b/src/jalview/ws/jws1/SeqSearchWSClient.java
index 2628f04..3783f23 100644
--- a/src/jalview/ws/jws1/SeqSearchWSClient.java
+++ b/src/jalview/ws/jws1/SeqSearchWSClient.java
@@ -1,22 +1,32 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentView;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.WebserviceInfo;
+import jalview.util.MessageManager;
+
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -25,11 +35,14 @@ import java.util.Hashtable;
import java.util.StringTokenizer;
import java.util.Vector;
-import javax.swing.*;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
-import ext.vamsas.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
+import ext.vamsas.SeqSearchI;
+import ext.vamsas.SeqSearchServiceLocator;
+import ext.vamsas.SeqSearchServiceSoapBindingStub;
+import ext.vamsas.ServiceHandle;
/**
* DOCUMENT ME!
@@ -72,19 +85,22 @@ public class SeqSearchWSClient extends WS1Client
// name to service client name
if (!sh.getAbstractName().equals(this.getServiceActionKey()))
{
- JOptionPane.showMessageDialog(Desktop.desktop,
- "The Service called \n" + sh.getName()
- + "\nis not a \nSequence Search Service !",
- "Internal Jalview Error", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage(
+ "label.service_called_is_not_seq_search_service",
+ new String[] { sh.getName() }), MessageManager
+ .getString("label.internal_jalview_error"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
if ((wsInfo = setWebService(sh)) == null)
{
- JOptionPane.showMessageDialog(Desktop.desktop,
- "The Sequence Search Service named " + sh.getName()
- + " is unknown", "Internal Jalview Error",
+ JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage("label.seq_search_service_is_unknown",
+ new String[] { sh.getName() }), MessageManager
+ .getString("label.internal_jalview_error"),
JOptionPane.WARNING_MESSAGE);
return;
@@ -205,13 +221,14 @@ public class SeqSearchWSClient extends WS1Client
}
if (!locateWebService())
{
- throw new Exception("Cannot contact service endpoint at " + WsURL);
+ throw new Exception(MessageManager.formatMessage(
+ "exception.cannot_contact_service_endpoint_at",
+ new String[] { WsURL }));
}
String database = server.getDatabase();
if (database == null)
{
- dbParamsForEndpoint.put(WsURL, new String[]
- {});
+ dbParamsForEndpoint.put(WsURL, new String[] {});
return null;
}
StringTokenizer en = new StringTokenizer(database.trim(), ",| ");
diff --git a/src/jalview/ws/jws1/SeqSearchWSThread.java b/src/jalview/ws/jws1/SeqSearchWSThread.java
index aeefcd1..bf791e2 100644
--- a/src/jalview/ws/jws1/SeqSearchWSThread.java
+++ b/src/jalview/ws/jws1/SeqSearchWSThread.java
@@ -1,32 +1,42 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
-import java.util.*;
-
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
+import jalview.analysis.AlignSeq;
+import jalview.bin.Cache;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.WebserviceInfo;
import jalview.io.NewickFile;
+import jalview.util.MessageManager;
import jalview.ws.AWsJob;
import jalview.ws.JobStateSummary;
import jalview.ws.WSClientI;
+
+import java.util.Hashtable;
+import java.util.Vector;
+
import vamsas.objects.simple.MsaResult;
import vamsas.objects.simple.SeqSearchResult;
@@ -58,7 +68,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
subjobComplete = true;
result = new MsaResult();
result.setFinished(true);
- result.setStatus("Job never ran - input returned to user.");
+ result.setStatus(MessageManager.getString("label.job_never_ran"));
}
}
@@ -82,7 +92,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
if (minlen < 0)
{
throw new Error(
- "Implementation error: minlen must be zero or more.");
+ MessageManager
+ .getString("error.implementation_error_minlen_must_be_greater_zero"));
}
for (int i = 0; i < seqs.length; i++)
{
@@ -123,8 +134,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
.extractGaps(jalview.util.Comparison.GapChars,
seqs[i].getSequenceAsString());
}
- emptySeqs.add(new String[]
- { newname, empty });
+ emptySeqs.add(new String[] { newname, empty });
}
}
if (submitGaps)
@@ -256,8 +266,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
* trigger a 'fetchDBids' to annotate sequences with database ids...
*/
- return new Object[]
- { al, nf };
+ return new Object[] { al, nf };
}
return null;
}
@@ -443,8 +452,9 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
{
if (!(job instanceof SeqSearchWSJob))
{
- throw new Error("StartJob(MsaWSJob) called on a WSJobInstance "
- + job.getClass());
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_msawbjob_called",
+ new String[] { job.getClass().toString() }));
}
SeqSearchWSJob j = (SeqSearchWSJob) job;
if (j.isSubmitted())
@@ -462,7 +472,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
j.setSubmitted(true);
j.result = new MsaResult();
j.result.setFinished(true);
- j.result.setStatus("Empty Alignment Job");
+ j.result.setStatus(MessageManager
+ .getString("label.empty_alignment_job"));
((MsaResult) j.result).setMsa(null);
}
try
@@ -481,10 +492,9 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
{
if (jobsubmit == null)
{
- throw new Exception(
- "Server at "
- + WsUrl
- + " returned null object, it probably cannot be contacted. Try again later ?");
+ throw new Exception(MessageManager.formatMessage(
+ "exception.web_service_returned_null_try_later",
+ new String[] { WsUrl }));
}
throw new Exception(jobsubmit.getJobId());
@@ -502,11 +512,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
wsInfo.setStatus(j.getJobnum(),
WebserviceInfo.STATE_STOPPED_SERVERERROR);
- wsInfo.appendProgressText(
- j.getJobnum(),
- "Failed to submit sequences for alignment.\n"
- + "It is most likely that there is a problem with the server.\n"
- + "Just close the window\n");
+ wsInfo.appendProgressText(j.getJobnum(), MessageManager
+ .getString("info.failed_to_submit_sequences_for_alignment"));
// e.printStackTrace(); // TODO: JBPNote DEBUG
}
@@ -544,8 +551,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
.getAlignment();
if (valign != null)
{
- wsInfo.appendProgressText(jobs[j].getJobnum(),
- "\nAlignment Object Method Notes\n");
+ wsInfo.appendProgressText(jobs[j].getJobnum(), MessageManager
+ .getString("info.alignment_object_method_notes"));
String[] lines = valign.getMethod();
for (int line = 0; line < lines.length; line++)
{
@@ -645,7 +652,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
if (nf != null)
{
- af.ShowNewickTree(nf, "Tree from " + this.alTitle);
+ af.ShowNewickTree(nf, MessageManager.formatMessage(
+ "label.tree_from", new String[] { this.alTitle }));
}
// initialise with same renderer settings as in parent alignframe.
af.getFeatureRenderer().transferSettings(this.featureSettings);
diff --git a/src/jalview/ws/jws1/WS1Client.java b/src/jalview/ws/jws1/WS1Client.java
index 79ef6d1..0589ffb 100644
--- a/src/jalview/ws/jws1/WS1Client.java
+++ b/src/jalview/ws/jws1/WS1Client.java
@@ -1,24 +1,28 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
import jalview.gui.AlignFrame;
import jalview.gui.WebserviceInfo;
+import jalview.util.MessageManager;
import jalview.ws.WSClient;
import jalview.ws.WSMenuEntryProviderI;
@@ -88,7 +92,8 @@ public abstract class WS1Client extends WSClient implements
WebserviceInfo wsInfo = null;
if (!headless)
{
- wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference);
+ wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference,
+ true);
}
return wsInfo;
}
@@ -107,7 +112,8 @@ public abstract class WS1Client extends WSClient implements
if (serviceHandle == null)
{
throw new Error(
- "IMPLEMENTATION ERROR: cannot attach WS Menu Entry without service handle reference!");
+ MessageManager
+ .getString("error.implementation_error_cannot_attach_ws_menu_entry"));
}
attachWSMenuEntry(wsmenu, serviceHandle, alignFrame);
}
diff --git a/src/jalview/ws/jws1/WSJob.java b/src/jalview/ws/jws1/WSJob.java
index 481ff27..8654cb2 100644
--- a/src/jalview/ws/jws1/WSJob.java
+++ b/src/jalview/ws/jws1/WSJob.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws1;
diff --git a/src/jalview/ws/jws2/AAConClient.java b/src/jalview/ws/jws2/AAConClient.java
new file mode 100644
index 0000000..0c6c271
--- /dev/null
+++ b/src/jalview/ws/jws2/AAConClient.java
@@ -0,0 +1,128 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.gui.AlignFrame;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+import jalview.ws.uimodel.AlignAnalysisUIText;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import compbio.data.sequence.FastaSequence;
+import compbio.data.sequence.Score;
+import compbio.metadata.Argument;
+
+public class AAConClient extends JabawsCalcWorker
+{
+
+ public AAConClient(Jws2Instance service, AlignFrame alignFrame,
+ WsParamSetI preset, List<Argument> paramset)
+ {
+ super(service, alignFrame, preset, paramset);
+ submitGaps = true;
+ alignedSeqs = true;
+ nucleotidesAllowed = false;
+ proteinAllowed = true;
+ gapMap = new boolean[0];
+ initViewportParams();
+ }
+
+ public String getServiceActionText()
+ {
+ return "calculating Amino acid consensus using AACon service";
+ }
+
+ /**
+ * update the consensus annotation from the sequence profile data using
+ * current visualization settings.
+ */
+
+ public void updateResultAnnotation(boolean immediate)
+ {
+ if (immediate || !calcMan.isWorking(this) && scoremanager != null)
+ {
+ Map<String, TreeSet<Score>> scoremap = scoremanager.asMap();
+ int alWidth = alignViewport.getAlignment().getWidth();
+ ArrayList<AlignmentAnnotation> ourAnnot = new ArrayList<AlignmentAnnotation>();
+ for (String score : scoremap.keySet())
+ {
+ Set<Score> scores = scoremap.get(score);
+ for (Score scr : scores)
+ {
+ if (scr.getRanges() != null && scr.getRanges().size() > 0)
+ {
+ /**
+ * annotation in range annotation = findOrCreate(scr.getMethod(),
+ * true, null, null); Annotation[] elm = new Annotation[alWidth];
+ * Iterator<Float> vals = scr.getScores().iterator(); for (Range rng
+ * : scr.getRanges()) { float val = vals.next().floatValue(); for
+ * (int i = rng.from; i <= rng.to; i++) { elm[i] = new
+ * Annotation("", "", ' ', val); } } annotation.annotations = elm;
+ * annotation.validateRangeAndDisplay();
+ */
+ }
+ else
+ {
+ createAnnotationRowsForScores(ourAnnot, getCalcId(), alWidth,
+ scr);
+ }
+ }
+ }
+
+ if (ourAnnot.size() > 0)
+ {
+ updateOurAnnots(ourAnnot);
+ }
+ }
+ }
+
+ @Override
+ boolean checkValidInputSeqs(boolean dynamic, List<FastaSequence> seqs)
+ {
+ return (seqs.size() > 1);
+ }
+
+ @Override
+ public String getCalcId()
+ {
+ return CALC_ID;
+ }
+
+ private static String CALC_ID = "jabaws2.AACon";
+
+ public static AlignAnalysisUIText getAlignAnalysisUITest()
+ {
+ return new AlignAnalysisUIText(
+ compbio.ws.client.Services.AAConWS.toString(),
+ jalview.ws.jws2.AAConClient.class, CALC_ID, false, true, true,
+ MessageManager.getString("label.aacon_calculations"),
+ MessageManager.getString("tooltip.aacon_calculations"),
+ MessageManager.getString("label.aacon_settings"),
+ MessageManager.getString("tooltip.aacon_settings"));
+ }
+}
diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java
new file mode 100644
index 0000000..d955db5
--- /dev/null
+++ b/src/jalview/ws/jws2/AADisorderClient.java
@@ -0,0 +1,379 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2;
+
+import jalview.api.AlignCalcWorkerI;
+import jalview.bin.Cache;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.GraphLine;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.schemes.GraduatedColor;
+import jalview.schemes.UserColourScheme;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import compbio.data.sequence.FastaSequence;
+import compbio.data.sequence.Range;
+import compbio.data.sequence.Score;
+import compbio.data.sequence.ScoreManager.ScoreHolder;
+import compbio.metadata.Argument;
+
+public class AADisorderClient extends JabawsCalcWorker implements
+ AlignCalcWorkerI
+{
+
+ private static final String THRESHOLD = "THRESHOLD";
+
+ private static final String RANGE = "RANGE";
+
+ String typeName;
+
+ String methodName;
+
+ String groupName;
+
+ AlignFrame af;
+
+ public AADisorderClient(Jws2Instance sh, AlignFrame alignFrame,
+ WsParamSetI preset, List<Argument> paramset)
+ {
+ super(sh, alignFrame, preset, paramset);
+ af = alignFrame;
+ typeName = sh.action;
+ methodName = sh.serviceType;
+
+ submitGaps = false;
+ alignedSeqs = false;
+ nucleotidesAllowed = false;
+ proteinAllowed = true;
+ bySequence = true;
+ }
+
+ @Override
+ public String getServiceActionText()
+ {
+ return "Submitting amino acid sequences for disorder prediction.";
+ }
+
+ @Override
+ boolean checkValidInputSeqs(boolean dynamic, List<FastaSequence> seqs)
+ {
+ return (seqs.size() > 0);
+ }
+
+ private static Map<String, Map<String, String[]>> featureMap;
+
+ private static Map<String, Map<String, Map<String, Object>>> annotMap;
+
+ private static String DONTCOMBINE = "DONTCOMBINE";
+
+ private static String INVISIBLE = "INVISIBLE";
+ static
+ {
+ // TODO: turn this into some kind of configuration file that's a bit easier
+ // to edit
+ featureMap = new HashMap<String, Map<String, String[]>>();
+ Map<String, String[]> fmap;
+ featureMap.put(compbio.ws.client.Services.IUPredWS.toString(),
+ fmap = new HashMap<String, String[]>());
+ fmap.put("Glob", new String[] { "Globular Domain",
+ "Predicted globular domain" });
+ featureMap.put(compbio.ws.client.Services.JronnWS.toString(),
+ fmap = new HashMap<String, String[]>());
+ featureMap.put(compbio.ws.client.Services.DisemblWS.toString(),
+ fmap = new HashMap<String, String[]>());
+ fmap.put("REM465", new String[] { "REM465", "Missing density" });
+ fmap.put("HOTLOOPS", new String[] { "HOTLOOPS", "Flexible loops" });
+ fmap.put("COILS", new String[] { "COILS", "Random coil" });
+ featureMap.put(compbio.ws.client.Services.GlobPlotWS.toString(),
+ fmap = new HashMap<String, String[]>());
+ fmap.put("GlobDoms", new String[] { "Globular Domain",
+ "Predicted globular domain" });
+ fmap.put("Disorder", new String[] { "Protein Disorder",
+ "Probable unstructured peptide region" });
+ Map<String, Map<String, Object>> amap;
+ annotMap = new HashMap<String, Map<String, Map<String, Object>>>();
+ annotMap.put(compbio.ws.client.Services.GlobPlotWS.toString(),
+ amap = new HashMap<String, Map<String, Object>>());
+ amap.put("Dydx", new HashMap<String, Object>());
+ amap.get("Dydx").put(DONTCOMBINE, DONTCOMBINE);
+ amap.get("Dydx").put(THRESHOLD, new double[] { 1, 0 });
+ amap.get("Dydx").put(RANGE, new float[] { -1, +1 });
+
+ amap.put("SmoothedScore", new HashMap<String, Object>());
+ amap.get("SmoothedScore").put(INVISIBLE, INVISIBLE);
+ amap.put("RawScore", new HashMap<String, Object>());
+ amap.get("RawScore").put(INVISIBLE, INVISIBLE);
+ annotMap.put(compbio.ws.client.Services.DisemblWS.toString(),
+ amap = new HashMap<String, Map<String, Object>>());
+ amap.put("COILS", new HashMap<String, Object>());
+ amap.put("HOTLOOPS", new HashMap<String, Object>());
+ amap.put("REM465", new HashMap<String, Object>());
+ amap.get("COILS").put(THRESHOLD, new double[] { 1, 0.516 });
+ amap.get("COILS").put(RANGE, new float[] { 0, 1 });
+
+ amap.get("HOTLOOPS").put(THRESHOLD, new double[] { 1, 0.6 });
+ amap.get("HOTLOOPS").put(RANGE, new float[] { 0, 1 });
+ amap.get("REM465").put(THRESHOLD, new double[] { 1, 0.1204 });
+ amap.get("REM465").put(RANGE, new float[] { 0, 1 });
+
+ annotMap.put(compbio.ws.client.Services.IUPredWS.toString(),
+ amap = new HashMap<String, Map<String, Object>>());
+ amap.put("Long", new HashMap<String, Object>());
+ amap.put("Short", new HashMap<String, Object>());
+ amap.get("Long").put(THRESHOLD, new double[] { 1, 0.5 });
+ amap.get("Long").put(RANGE, new float[] { 0, 1 });
+ amap.get("Short").put(THRESHOLD, new double[] { 1, 0.5 });
+ amap.get("Short").put(RANGE, new float[] { 0, 1 });
+ annotMap.put(compbio.ws.client.Services.JronnWS.toString(),
+ amap = new HashMap<String, Map<String, Object>>());
+ amap.put("JRonn", new HashMap<String, Object>());
+ amap.get("JRonn").put(THRESHOLD, new double[] { 1, 0.5 });
+ amap.get("JRonn").put(RANGE, new float[] { 0, 1 });
+ }
+
+ @Override
+ public void updateResultAnnotation(boolean immediate)
+ {
+
+ if (immediate || !calcMan.isWorking(this) && scoremanager != null)
+ {
+ Map<String, String[]> featureTypeMap = featureMap
+ .get(service.serviceType);
+ Map<String, Map<String, Object>> annotTypeMap = annotMap
+ .get(service.serviceType);
+ boolean dispFeatures = false;
+ Map<String, Object> fc = new Hashtable<String, Object>();
+ List<AlignmentAnnotation> ourAnnot = new ArrayList<AlignmentAnnotation>();
+ /**
+ * grouping for any annotation rows created
+ */
+ int graphGroup = 1;
+ if (alignViewport.getAlignment().getAlignmentAnnotation() != null)
+ {
+ for (AlignmentAnnotation ala : alignViewport.getAlignment()
+ .getAlignmentAnnotation())
+ {
+ if (ala.graphGroup > graphGroup)
+ {
+ graphGroup = ala.graphGroup;
+ }
+ }
+ }
+
+ for (String seqId : seqNames.keySet())
+ {
+ boolean sameGroup = false;
+ SequenceI dseq, aseq, seq = seqNames.get(seqId);
+ int base = seq.findPosition(start) - 1;
+ aseq = seq;
+ while ((dseq = seq).getDatasetSequence() != null)
+ {
+ seq = seq.getDatasetSequence();
+ }
+ ScoreHolder scores = null;
+ try
+ {
+ scores = scoremanager.getAnnotationForSequence(seqId);
+ } catch (Exception q)
+ {
+ Cache.log
+ .info("Couldn't recover disorder prediction for sequence "
+ + seq.getName()
+ + "(Prediction name was "
+ + seqId
+ + ")"
+ + "\nSee http://issues.jalview.org/browse/JAL-1319 for one possible reason why disorder predictions might fail.");
+ }
+ float last = Float.NaN, val = Float.NaN;
+ int lastAnnot = ourAnnot.size();
+ if (scores != null && scores.scores != null)
+ {
+ for (Score scr : scores.scores)
+ {
+
+ if (scr.getRanges() != null && scr.getRanges().size() > 0)
+ {
+ Iterator<Float> vals = scr.getScores().iterator();
+ // make features on sequence
+ for (Range rn : scr.getRanges())
+ {
+
+ SequenceFeature sf;
+ String[] type = featureTypeMap.get(scr.getMethod());
+ if (type == null)
+ {
+ // create a default type for this feature
+ type = new String[] {
+ typeName + " (" + scr.getMethod() + ")",
+ service.getActionText() };
+ }
+ if (vals.hasNext())
+ {
+ sf = new SequenceFeature(type[0], type[1],
+ base + rn.from, base + rn.to, val = vals.next()
+ .floatValue(), methodName);
+ }
+ else
+ {
+ sf = new SequenceFeature(type[0], type[1], null, base
+ + rn.from, base + rn.to, methodName);
+ }
+ dseq.addSequenceFeature(sf);
+ if (last != val && !Float.isNaN(last))
+ {
+ fc.put(sf.getType(), sf);
+ }
+ last = val;
+ dispFeatures = true;
+ }
+ }
+ else
+ {
+ if (scr.getScores().size() == 0)
+ {
+ continue;
+ }
+ String typename, calcName;
+ AlignmentAnnotation annot = createAnnotationRowsForScores(
+ ourAnnot,
+ typename = service.serviceType + " ("
+ + scr.getMethod() + ")",
+ calcName = service.getServiceTypeURI() + "/"
+ + scr.getMethod(), aseq, base + 1, scr);
+ annot.graph = AlignmentAnnotation.LINE_GRAPH;
+
+ Map<String, Object> styleMap = (annotTypeMap == null) ? null
+ : annotTypeMap.get(scr.getMethod());
+
+ annot.visible = (styleMap == null || styleMap.get(INVISIBLE) == null);
+ double[] thrsh = (styleMap == null) ? null
+ : (double[]) styleMap.get(THRESHOLD);
+ float[] range = (styleMap == null) ? null
+ : (float[]) styleMap.get(RANGE);
+ if (range != null)
+ {
+ annot.graphMin = range[0];
+ annot.graphMax = range[1];
+ }
+ if (styleMap == null || styleMap.get(DONTCOMBINE) == null)
+ {
+ {
+ if (!sameGroup)
+ {
+ graphGroup++;
+ sameGroup = true;
+ }
+
+ annot.graphGroup = graphGroup;
+ }
+ }
+
+ annot.description = "<html>" + service.getActionText()
+ + " - raw scores";
+ if (thrsh != null)
+ {
+ String threshNote = (thrsh[0] > 0 ? "Above " : "Below ")
+ + thrsh[1] + " indicates disorder";
+ annot.threshold = new GraphLine((float) thrsh[1],
+ threshNote, Color.red);
+ annot.description += "<br/>" + threshNote;
+ }
+ annot.description += "</html>";
+ Color col = new UserColourScheme(typeName)
+ .createColourFromName(typeName + scr.getMethod());
+ for (int p = 0, ps = annot.annotations.length; p < ps; p++)
+ {
+ if (annot.annotations[p] != null)
+ {
+ annot.annotations[p].colour = col;
+ }
+ }
+ annot._linecolour = col;
+ // finally, update any dataset annotation
+ replaceAnnotationOnAlignmentWith(annot, typename, calcName,
+ aseq);
+ }
+ }
+ }
+ if (lastAnnot + 1 == ourAnnot.size())
+ {
+ // remove singleton alignment annotation row
+ ourAnnot.get(lastAnnot).graphGroup = -1;
+ }
+ }
+ {
+ if (dispFeatures)
+ {
+ jalview.api.FeatureRenderer fr = ((jalview.gui.AlignmentPanel) ap)
+ .cloneFeatureRenderer();
+ for (String ft : fc.keySet())
+ {
+ Object gc = fr.getFeatureStyle(ft);
+ if (gc instanceof Color)
+ {
+ // set graduated color as fading to white for minimum, and
+ // autoscaling to values on alignment
+ GraduatedColor ggc = new GraduatedColor(Color.white,
+ (Color) gc, Float.MIN_VALUE, Float.MAX_VALUE);
+ ggc.setAutoScaled(true);
+ fr.setColour(ft, ggc);
+ }
+ }
+ // TODO: JAL-1150 - create sequence feature settings API for defining
+ // styles and enabling/disabling feature overlay on alignment panel
+ ((jalview.gui.AlignmentPanel) ap).updateFeatureRendererFrom(fr);
+ if (af.alignPanel == ap)
+ {
+ // only do this if the alignFrame is currently showing this view.
+ af.setShowSeqFeatures(true);
+ }
+ ap.paintAlignment(true);
+ }
+ if (ourAnnot.size() > 0)
+ {
+ // Modify the visible annotation on the alignment viewport with the
+ // new alignment annotation rows created.
+ updateOurAnnots(ourAnnot);
+ ap.adjustAnnotationHeight();
+ }
+ }
+ }
+ }
+
+ @Override
+ public String getCalcId()
+ {
+ // Disorder predictions are not dynamically updated so we return null
+ return null;
+ }
+
+}
diff --git a/src/jalview/ws/jws2/AWS2Thread.java b/src/jalview/ws/jws2/AWS2Thread.java
index 28ed672..3eaeb3f 100644
--- a/src/jalview/ws/jws2/AWS2Thread.java
+++ b/src/jalview/ws/jws2/AWS2Thread.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
diff --git a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java
new file mode 100644
index 0000000..fa1e3d1
--- /dev/null
+++ b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java
@@ -0,0 +1,621 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2;
+
+import jalview.analysis.AlignSeq;
+import jalview.analysis.SeqsetUtils;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.IProgressIndicator;
+import jalview.workers.AlignCalcWorker;
+import jalview.ws.jws2.dm.AAConSettings;
+import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import compbio.data.sequence.FastaSequence;
+import compbio.metadata.Argument;
+import compbio.metadata.ChunkHolder;
+import compbio.metadata.JobStatus;
+import compbio.metadata.JobSubmissionException;
+import compbio.metadata.Option;
+import compbio.metadata.ResultNotAvailableException;
+
+public abstract class AbstractJabaCalcWorker extends AlignCalcWorker
+{
+
+ protected Jws2Instance service;
+
+ protected WsParamSetI preset;
+
+ protected List<Argument> arguments;
+
+ protected IProgressIndicator guiProgress;
+
+ protected boolean submitGaps = true;
+
+ /**
+ * Recover any existing parameters for this service
+ */
+ protected void initViewportParams()
+ {
+ if (getCalcId() != null)
+ {
+ ((jalview.gui.AlignViewport) alignViewport).setCalcIdSettingsFor(
+ getCalcId(),
+ new AAConSettings(true, service, this.preset,
+ (arguments != null) ? JabaParamStore
+ .getJwsArgsfromJaba(arguments) : null), true);
+ }
+ }
+
+ /**
+ *
+ * @return null or a string used to recover all annotation generated by this
+ * worker
+ */
+ public abstract String getCalcId();
+
+ public WsParamSetI getPreset()
+ {
+ return preset;
+ }
+
+ public List<Argument> getArguments()
+ {
+ return arguments;
+ }
+
+ /**
+ * reconfigure and restart the AAConClient. This method will spawn a new
+ * thread that will wait until any current jobs are finished, modify the
+ * parameters and restart the conservation calculation with the new values.
+ *
+ * @param newpreset
+ * @param newarguments
+ */
+ public void updateParameters(final WsParamSetI newpreset,
+ final List<Argument> newarguments)
+ {
+ preset = newpreset;
+ arguments = newarguments;
+ calcMan.startWorker(this);
+ initViewportParams();
+ }
+
+ public List<Option> getJabaArguments()
+ {
+ List<Option> newargs = new ArrayList<Option>();
+ if (preset != null && preset instanceof JabaWsParamSet)
+ {
+ newargs.addAll(((JabaWsParamSet) preset).getjabaArguments());
+ }
+ if (arguments != null && arguments.size() > 0)
+ {
+ for (Argument rg : arguments)
+ {
+ if (Option.class.isAssignableFrom(rg.getClass()))
+ {
+ newargs.add((Option) rg);
+ }
+ }
+ }
+ return newargs;
+ }
+
+ protected boolean alignedSeqs = true;
+
+ protected boolean nucleotidesAllowed = false;
+
+ protected boolean proteinAllowed = false;
+
+ /**
+ * record sequences for mapping result back to afterwards
+ */
+ protected boolean bySequence = false;
+
+ protected Map<String, SequenceI> seqNames;
+
+ protected boolean[] gapMap;
+
+ int realw;
+
+ protected int start;
+
+ int end;
+
+ public AbstractJabaCalcWorker(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ }
+
+ public AbstractJabaCalcWorker(Jws2Instance service,
+ AlignFrame alignFrame, WsParamSetI preset, List<Argument> paramset)
+ {
+ this(alignFrame.getCurrentView(), alignFrame.alignPanel);
+ this.guiProgress = alignFrame;
+ this.preset = preset;
+ this.arguments = paramset;
+ this.service = service;
+ }
+
+ /**
+ *
+ * @return true if the submission thread should attempt to submit data
+ */
+ abstract boolean hasService();
+
+ volatile String rslt = "JOB NOT DEFINED";
+
+ @Override
+ public void run()
+ {
+ if (!hasService())
+ {
+ return;
+ }
+ long progressId = -1;
+
+ int serverErrorsLeft = 3;
+
+ StringBuffer msg = new StringBuffer();
+ try
+ {
+ if (checkDone())
+ {
+ return;
+ }
+ List<compbio.data.sequence.FastaSequence> seqs = getInputSequences(
+ alignViewport.getAlignment(),
+ bySequence ? alignViewport.getSelectionGroup() : null);
+
+ if (seqs == null || !checkValidInputSeqs(true, seqs))
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+
+ AlignmentAnnotation[] aa = alignViewport.getAlignment()
+ .getAlignmentAnnotation();
+ if (guiProgress != null)
+ {
+ guiProgress.setProgressBar("JABA " + getServiceActionText(),
+ progressId = System.currentTimeMillis());
+ }
+ rslt = submitToService(seqs);
+
+ boolean finished = false;
+ long rpos = 0;
+ do
+ {
+ JobStatus status = getJobStatus(rslt);
+ if (status.equals(JobStatus.FINISHED))
+ {
+ finished = true;
+ }
+ if (calcMan.isPending(this) && isInteractiveUpdate())
+ {
+ finished = true;
+ // cancel this job and yield to the new job
+ try
+ {
+ if (cancelJob(rslt))
+ {
+ System.err.println("Cancelled AACon job: " + rslt);
+ }
+ else
+ {
+ System.err.println("FAILED TO CANCEL AACon job: " + rslt);
+ }
+
+ } catch (Exception x)
+ {
+
+ }
+ rslt = "CANCELLED JOB";
+ return;
+ }
+ long cpos;
+ ChunkHolder stats = null;
+ do
+ {
+ cpos = rpos;
+ boolean retry = false;
+ do
+ {
+ try
+ {
+ stats = pullExecStatistics(rslt, rpos);
+ } catch (Exception x)
+ {
+
+ if (x.getMessage().contains(
+ "Position in a file could not be negative!"))
+ {
+ // squash index out of bounds exception- seems to happen for
+ // disorder predictors which don't (apparently) produce any
+ // progress information and JABA server throws an exception
+ // because progress length is -1.
+ stats = null;
+ }
+ else
+ {
+ if (--serverErrorsLeft > 0)
+ {
+ retry = true;
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException q)
+ {
+ }
+ ;
+ }
+ else
+ {
+ throw x;
+ }
+ }
+ }
+ } while (retry);
+ if (stats != null)
+ {
+ System.out.print(stats.getChunk());
+ msg.append(stats);
+ rpos = stats.getNextPosition();
+ }
+ } while (stats != null && rpos > cpos);
+
+ if (!finished && status.equals(JobStatus.FAILED))
+ {
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException x)
+ {
+ }
+ ;
+ }
+ } while (!finished);
+ if (serverErrorsLeft > 0)
+ {
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException x)
+ {
+ }
+ if (collectAnnotationResultsFor(rslt))
+ {
+ jalview.bin.Cache.log
+ .debug("Updating result annotation from Job " + rslt
+ + " at " + service.getUri());
+ updateResultAnnotation(true);
+ ap.adjustAnnotationHeight();
+ }
+ }
+ }
+
+ catch (JobSubmissionException x)
+ {
+
+ System.err.println("submission error with " + getServiceActionText()
+ + " :");
+ x.printStackTrace();
+ calcMan.workerCannotRun(this);
+ } catch (ResultNotAvailableException x)
+ {
+ System.err.println("collection error:\nJob ID: " + rslt);
+ x.printStackTrace();
+ calcMan.workerCannotRun(this);
+
+ } catch (OutOfMemoryError error)
+ {
+ calcMan.workerCannotRun(this);
+
+ // consensus = null;
+ // hconsensus = null;
+ ap.raiseOOMWarning(getServiceActionText(), error);
+ } catch (Exception x)
+ {
+ calcMan.workerCannotRun(this);
+
+ // consensus = null;
+ // hconsensus = null;
+ System.err
+ .println("Blacklisting worker due to unexpected exception:");
+ x.printStackTrace();
+ } finally
+ {
+
+ calcMan.workerComplete(this);
+ if (ap != null)
+ {
+ calcMan.workerComplete(this);
+ if (guiProgress != null && progressId != -1)
+ {
+ guiProgress.setProgressBar("", progressId);
+ }
+ ap.paintAlignment(true);
+ }
+ if (msg.length() > 0)
+ {
+ // TODO: stash message somewhere in annotation or alignment view.
+ // code below shows result in a text box popup
+ /*
+ * jalview.gui.CutAndPasteTransfer cap = new
+ * jalview.gui.CutAndPasteTransfer(); cap.setText(msg.toString());
+ * jalview.gui.Desktop.addInternalFrame(cap,
+ * "Job Status for "+getServiceActionText(), 600, 400);
+ */
+ }
+ }
+
+ }
+
+ /**
+ * validate input for dynamic/non-dynamic update context
+ *
+ * @param dynamic
+ * @param seqs
+ * @return true if input is valid
+ */
+ abstract boolean checkValidInputSeqs(boolean dynamic,
+ List<FastaSequence> seqs);
+
+ abstract String submitToService(
+ List<compbio.data.sequence.FastaSequence> seqs)
+ throws JobSubmissionException;
+
+ abstract boolean cancelJob(String rslt) throws Exception;
+
+ abstract JobStatus getJobStatus(String rslt) throws Exception;
+
+ abstract ChunkHolder pullExecStatistics(String rslt, long rpos);
+
+ abstract boolean collectAnnotationResultsFor(String rslt)
+ throws ResultNotAvailableException;
+
+ public void cancelCurrentJob()
+ {
+ try
+ {
+ String id = rslt;
+ if (cancelJob(rslt))
+ {
+ System.err.println("Cancelled job " + id);
+ }
+ else
+ {
+ System.err.println("Job " + id + " couldn't be cancelled.");
+ }
+ } catch (Exception q)
+ {
+ q.printStackTrace();
+ }
+ }
+
+ /**
+ * Interactive updating. Analysis calculations that work on the currently
+ * displayed alignment data should cancel existing jobs when the input data
+ * has changed.
+ *
+ * @return true if a running job should be cancelled because new input data is
+ * available for analysis
+ */
+ abstract boolean isInteractiveUpdate();
+
+ public List<FastaSequence> getInputSequences(AlignmentI alignment,
+ AnnotatedCollectionI inputSeqs)
+ {
+ if (alignment == null || alignment.getWidth() <= 0
+ || alignment.getSequences() == null || alignment.isNucleotide() ? !nucleotidesAllowed
+ : !proteinAllowed)
+ {
+ return null;
+ }
+ if (inputSeqs == null || inputSeqs.getWidth() <= 0
+ || inputSeqs.getSequences() == null
+ || inputSeqs.getSequences().size() < 1)
+ {
+ inputSeqs = alignment;
+ }
+
+ List<compbio.data.sequence.FastaSequence> seqs = new ArrayList<compbio.data.sequence.FastaSequence>();
+
+ int minlen = 10;
+ int ln = -1;
+ if (bySequence)
+ {
+ seqNames = new HashMap<String, SequenceI>();
+ }
+ gapMap = new boolean[0];
+ start = inputSeqs.getStartRes();
+ end = inputSeqs.getEndRes();
+
+ for (SequenceI sq : ((List<SequenceI>) inputSeqs.getSequences()))
+ {
+ if (bySequence ? sq.findPosition(end + 1)
+ - sq.findPosition(start + 1) > minlen - 1 : sq.getEnd()
+ - sq.getStart() > minlen - 1)
+ {
+ String newname = SeqsetUtils.unique_name(seqs.size() + 1);
+ // make new input sequence with or without gaps
+ if (seqNames != null)
+ {
+ seqNames.put(newname, sq);
+ }
+ FastaSequence seq;
+ if (submitGaps)
+ {
+ seqs.add(seq = new compbio.data.sequence.FastaSequence(newname,
+ sq.getSequenceAsString()));
+ if (gapMap == null || gapMap.length < seq.getSequence().length())
+ {
+ boolean[] tg = gapMap;
+ gapMap = new boolean[seq.getLength()];
+ System.arraycopy(tg, 0, gapMap, 0, tg.length);
+ for (int p = tg.length; p < gapMap.length; p++)
+ {
+ gapMap[p] = false; // init as a gap
+ }
+ }
+ for (int apos : sq.gapMap())
+ {
+ gapMap[apos] = true; // aligned.
+ }
+ }
+ else
+ {
+ seqs.add(seq = new compbio.data.sequence.FastaSequence(newname,
+ AlignSeq.extractGaps(jalview.util.Comparison.GapChars,
+ sq.getSequenceAsString(start, end + 1))));
+ }
+ if (seq.getSequence().length() > ln)
+ {
+ ln = seq.getSequence().length();
+ }
+ }
+ }
+ if (alignedSeqs && submitGaps)
+ {
+ realw = 0;
+ for (int i = 0; i < gapMap.length; i++)
+ {
+ if (gapMap[i])
+ {
+ realw++;
+ }
+ }
+ // try real hard to return something submittable
+ // TODO: some of AAcon measures need a minimum of two or three amino
+ // acids at each position, and AAcon doesn't gracefully degrade.
+ for (int p = 0; p < seqs.size(); p++)
+ {
+ FastaSequence sq = seqs.get(p);
+ int l = sq.getSequence().length();
+ // strip gapped columns
+ char[] padded = new char[realw], orig = sq.getSequence()
+ .toCharArray();
+ for (int i = 0, pp = 0; i < realw; pp++)
+ {
+ if (gapMap[pp])
+ {
+ if (orig.length > pp)
+ {
+ padded[i++] = orig[pp];
+ }
+ else
+ {
+ padded[i++] = '-';
+ }
+ }
+ }
+ seqs.set(p, new compbio.data.sequence.FastaSequence(sq.getId(),
+ new String(padded)));
+ }
+ }
+ return seqs;
+ }
+
+ @Override
+ public void updateAnnotation()
+ {
+ updateResultAnnotation(false);
+ }
+
+ public abstract void updateResultAnnotation(boolean immediate);
+
+ public abstract String getServiceActionText();
+
+ /**
+ * notify manager that we have started, and wait for a free calculation slot
+ *
+ * @return true if slot is obtained and work still valid, false if another
+ * thread has done our work for us.
+ */
+ protected boolean checkDone()
+ {
+ calcMan.notifyStart(this);
+ ap.paintAlignment(false);
+ while (!calcMan.notifyWorking(this))
+ {
+ if (calcMan.isWorking(this))
+ {
+ return true;
+ }
+ try
+ {
+ if (ap != null)
+ {
+ ap.paintAlignment(false);
+ }
+
+ Thread.sleep(200);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ if (alignViewport.isClosed())
+ {
+ abortAndDestroy();
+ return true;
+ }
+ return false;
+ }
+
+ protected void updateOurAnnots(List<AlignmentAnnotation> ourAnnot)
+ {
+ List<AlignmentAnnotation> our = ourAnnots;
+ ourAnnots = ourAnnot;
+ AlignmentI alignment = alignViewport.getAlignment();
+ if (our != null)
+ {
+ if (our.size() > 0)
+ {
+ for (AlignmentAnnotation an : our)
+ {
+ if (!ourAnnots.contains(an))
+ {
+ // remove the old annotation
+ alignment.deleteAnnotation(an);
+ }
+ }
+ }
+ our.clear();
+
+ ap.adjustAnnotationHeight();
+ }
+ }
+
+}
diff --git a/src/jalview/ws/jws2/JPred301Client.java b/src/jalview/ws/jws2/JPred301Client.java
new file mode 100644
index 0000000..b98eae4
--- /dev/null
+++ b/src/jalview/ws/jws2/JPred301Client.java
@@ -0,0 +1,300 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2;
+
+import jalview.api.AlignCalcWorkerI;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.gui.AlignFrame;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.OptionI;
+import jalview.ws.params.WsParamSetI;
+import jalview.ws.uimodel.AlignAnalysisUIText;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import compbio.data.sequence.FastaSequence;
+import compbio.data.sequence.JpredAlignment;
+import compbio.metadata.Argument;
+
+public class JPred301Client extends JabawsMsaInterfaceAlignCalcWorker
+ implements AlignCalcWorkerI
+{
+
+ /**
+ *
+ * @return default args for this service when run as dynamic web service
+ */
+ public List<Argument> selectDefaultArgs()
+ {
+ List<ArgumentI> rgs = new ArrayList<ArgumentI>();
+ for (ArgumentI argi : service.getParamStore().getServiceParameters())
+ {
+ if (argi instanceof OptionI)
+ {
+ List<String> o = ((OptionI) argi).getPossibleValues();
+ if (o.contains("-pred-nohits"))
+ {
+ OptionI cpy = ((OptionI) argi).copy();
+ cpy.setValue("-pred-nohits");
+ rgs.add(cpy);
+ }
+ }
+ }
+ return JabaParamStore.getJabafromJwsArgs(rgs);
+ }
+
+ public JPred301Client(Jws2Instance service, AlignFrame alignFrame,
+ WsParamSetI preset, List<Argument> paramset)
+ {
+ super(service, alignFrame, preset, paramset);
+ submitGaps = true;
+ alignedSeqs = true;
+ nucleotidesAllowed = false;
+ proteinAllowed = true;
+ gapMap = new boolean[0];
+ updateParameters(null, selectDefaultArgs());
+ }
+
+ @Override
+ boolean checkValidInputSeqs(boolean dynamic, List<FastaSequence> seqs)
+ {
+ return (seqs.size() > 1);
+ }
+
+ public String getServiceActionText()
+ {
+ return "calculating consensus secondary structure prediction using JPred service";
+ }
+
+ private static Map<String, String[]> jpredRowLabels = new HashMap<String, String[]>();
+
+ private static final Set<String> jpredRes_graph;
+
+ private static final Set<String> jpredRes_ssonly;
+ static
+ {
+ jpredRes_ssonly = new HashSet<String>();
+ jpredRes_ssonly.add("jnetpred".toLowerCase());
+ jpredRes_ssonly.add("jnetpssm".toLowerCase());
+ jpredRes_ssonly.add("jnethmm".toLowerCase());
+ jpredRes_graph = new HashSet<String>();
+ jpredRes_graph.add("jnetconf".toLowerCase());
+ jpredRes_graph.add("jnet burial".toLowerCase());
+ }
+
+ /**
+ * update the consensus annotation from the sequence profile data using
+ * current visualization settings.
+ */
+ public void updateResultAnnotation(boolean immediate)
+ {
+ if (immediate || !calcMan.isWorking(this) && msascoreset != null)
+ {
+ if (msascoreset instanceof compbio.data.sequence.JpredAlignment)
+ {
+ JpredAlignment jpres = (JpredAlignment) msascoreset;
+ int alWidth = alignViewport.getAlignment().getWidth();
+ ArrayList<AlignmentAnnotation> ourAnnot = new ArrayList<AlignmentAnnotation>();
+ char[] sol = new char[jpres.getJpredSequences().get(0).getLength()];
+ boolean firstsol = true;
+ for (FastaSequence fsq : jpres.getJpredSequences())
+ {
+ String[] k = jpredRowLabels.get(fsq.getId());
+ if (k == null)
+ {
+ k = new String[] { fsq.getId(), "JNet Output" };
+ }
+ if (fsq.getId().startsWith("JNETSOL"))
+ {
+ char amnt = (fsq.getId().endsWith("25") ? "3" : fsq.getId()
+ .endsWith("5") ? "6" : "9").charAt(0);
+ char[] vseq = fsq.getSequence().toCharArray();
+ for (int spos = 0, sposL = fsq.getLength(); spos < sposL; spos++)
+ {
+ if (firstsol)
+ {
+ sol[spos] = '0';
+ }
+ if (vseq[spos] == 'B'
+ && (sol[spos] == '0' || sol[spos] < amnt))
+ {
+ sol[spos] = amnt;
+ }
+ }
+ firstsol = false;
+ }
+ else
+ {
+ createAnnotationRowFromString(
+ ourAnnot,
+ getCalcId(),
+ alWidth,
+ k[0],
+ k[1],
+ jpredRes_graph.contains(fsq.getId()) ? AlignmentAnnotation.BAR_GRAPH
+ : AlignmentAnnotation.NO_GRAPH, 0f, 9f,
+ fsq.getSequence());
+ }
+
+ }
+ createAnnotationRowFromString(
+ ourAnnot,
+ getCalcId(),
+ alWidth,
+ "Jnet Burial",
+ "<html>Prediction of Solvent Accessibility<br/>levels are<ul><li>0 - Exposed</li><li>3 - 25% or more S.A. accessible</li><li>6 - 5% or more S.A. accessible</li><li>9 - Buried (<5% exposed)</li></ul>",
+ AlignmentAnnotation.BAR_GRAPH, 0f, 9f, new String(sol));
+ for (FastaSequence fsq : jpres.getSequences())
+ {
+ if (fsq.getId().equalsIgnoreCase("QUERY"))
+ {
+ createAnnotationRowFromString(ourAnnot, getCalcId(), alWidth,
+ "Query", "JPred Reference Sequence",
+ AlignmentAnnotation.NO_GRAPH, 0f, 0f, fsq.getSequence());
+ }
+ }
+ if (ourAnnot.size() > 0)
+ {
+ updateOurAnnots(ourAnnot);
+ }
+ }
+ }
+ }
+
+ private void createAnnotationRowFromString(
+ ArrayList<AlignmentAnnotation> ourAnnot, String calcId,
+ int alWidth, String label, String descr, int rowType, float min,
+ float max, String jpredPrediction)
+ {
+ // simple annotation row
+ AlignmentAnnotation annotation = alignViewport.getAlignment()
+ .findOrCreateAnnotation(label, calcId, true, null, null);
+ if (alWidth == gapMap.length) // scr.getScores().size())
+ {
+ annotation.label = new String(label);
+ annotation.description = new String(descr);
+ annotation.graph = rowType;
+ annotation.graphMin = min;
+ annotation.graphMax = max;
+ if (constructAnnotationFromString(annotation, jpredPrediction,
+ alWidth, rowType))
+ {
+ // created a valid annotation from the data
+ ourAnnot.add(annotation);
+ // annotation.validateRangeAndDisplay();
+ }
+ }
+ }
+
+ private boolean constructAnnotationFromString(
+ AlignmentAnnotation annotation, String sourceData, int alWidth,
+ int rowType)
+ {
+ if (sourceData.length() == 0 && alWidth > 0)
+ {
+ return false;
+ }
+ Annotation[] elm = new Annotation[alWidth];
+ boolean ssOnly = jpredRes_ssonly.contains(annotation.label
+ .toLowerCase());
+ boolean graphOnly = rowType != AlignmentAnnotation.NO_GRAPH;
+ if (!ssOnly && !graphOnly)
+ {
+ // for burial 'B'
+ annotation.showAllColLabels = true;
+ }
+
+ for (int i = 0, iSize = sourceData.length(); i < iSize; i++)
+ {
+ char annot = sourceData.charAt(i);
+ // if we're at a gapped column then skip to next ungapped position
+ if (gapMap != null && gapMap.length > 0)
+ {
+ while (!gapMap[i])
+ {
+ elm[i++] = new Annotation("", "", ' ', Float.NaN);
+ }
+ }
+ switch (rowType)
+ {
+ case AlignmentAnnotation.NO_GRAPH:
+ elm[i] = ssOnly ? new Annotation("", "", annot, Float.NaN,
+ colourSS(annot)) : new Annotation("" + annot, "" + annot,
+ '\0', Float.NaN);
+ break;
+ default:
+ try
+ {
+ elm[i] = new Annotation("" + annot, "" + annot, annot,
+ Integer.valueOf("" + annot));
+ } catch (Exception x)
+ {
+ System.err.println("Expected numeric value in character '"
+ + annot + "'");
+ }
+ }
+ }
+
+ annotation.annotations = elm;
+ annotation.belowAlignment = true;
+ annotation.validateRangeAndDisplay();
+ return true;
+ }
+
+ private Color colourSS(char annot)
+ {
+ switch (annot)
+ {
+ case 'H':
+ return jalview.renderer.AnnotationRenderer.HELIX_COLOUR;
+ case 'E':
+ return jalview.renderer.AnnotationRenderer.SHEET_COLOUR;
+ }
+ return jalview.renderer.AnnotationRenderer.GLYPHLINE_COLOR;
+ }
+
+ @Override
+ public String getCalcId()
+ {
+ return CALC_ID;
+ }
+
+ private static String CALC_ID = "jabaws21.JPred3Cons";
+
+ public static AlignAnalysisUIText getAlignAnalysisUITest()
+ {
+ return new AlignAnalysisUIText(
+ compbio.ws.client.Services.JpredWS.toString(),
+ jalview.ws.jws2.JPred301Client.class, CALC_ID, false, true,
+ true, "JPred Consensus",
+ "When checked, JPred consensus is updated automatically.",
+ "Change JPred Settings...",
+ "Modify settings for JPred calculations.");
+ }
+}
diff --git a/src/jalview/ws/jws2/JWs2Job.java b/src/jalview/ws/jws2/JWs2Job.java
index 7382b9f..602b882 100644
--- a/src/jalview/ws/jws2/JWs2Job.java
+++ b/src/jalview/ws/jws2/JWs2Job.java
@@ -1,26 +1,29 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
-import compbio.metadata.JobStatus;
-
import jalview.ws.AWsJob;
+import compbio.metadata.JobStatus;
+
/**
* job status processing for JWS2 jobs.
*
diff --git a/src/jalview/ws/jws2/JabaParamStore.java b/src/jalview/ws/jws2/JabaParamStore.java
index 856646c..757ee23 100644
--- a/src/jalview/ws/jws2/JabaParamStore.java
+++ b/src/jalview/ws/jws2/JabaParamStore.java
@@ -1,27 +1,38 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
-import java.io.BufferedReader;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.dm.JabaOption;
+import jalview.ws.jws2.dm.JabaParameter;
+import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.ParamDatastoreI;
+import jalview.ws.params.ParamManager;
+import jalview.ws.params.WsParamSetI;
+
import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Hashtable;
import java.util.List;
import java.util.StringTokenizer;
@@ -33,15 +44,6 @@ import compbio.metadata.Preset;
import compbio.metadata.PresetManager;
import compbio.metadata.RunnerConfig;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
-import jalview.ws.jws2.dm.JabaOption;
-import jalview.ws.jws2.dm.JabaParameter;
-import jalview.ws.jws2.dm.JabaWsParamSet;
-import jalview.ws.params.ArgumentI;
-import jalview.ws.params.ParamDatastoreI;
-import jalview.ws.params.ParamManager;
-import jalview.ws.params.WsParamSetI;
-
public class JabaParamStore implements ParamDatastoreI
{
@@ -140,24 +142,56 @@ public class JabaParamStore implements ParamDatastoreI
public static List<ArgumentI> getJwsArgsfromJaba(List jabargs)
{
+ return getJwsArgsfromJaba(jabargs, true);
+ }
+
+ public static List<ArgumentI> getJwsArgsfromJaba(List jabargs,
+ boolean sortByOpt)
+ {
List<ArgumentI> rgs = new ArrayList<ArgumentI>();
+ List<String> rgnames = new ArrayList<String>();
for (Object rg : jabargs)
{
- ArgumentI narg = (rg instanceof Parameter) ? new JabaParameter(
- (Parameter) rg) : (rg instanceof Option) ? new JabaOption(
- (Option) rg) : null;
+ ArgumentI narg = null;
+ String nargstring = null;
+ if (rg instanceof Parameter)
+ {
+ narg = new JabaParameter((Parameter) rg);
+ nargstring = narg.getName(); // just sort by name for this
+ }
+ else if (rg instanceof Option)
+ {
+ narg = new JabaOption((Option) rg);
+ nargstring = (String) ((Option) rg).getOptionNames().get(0);
+ }
if (narg == null)
{
- throw new Error(
- "Implementation Error: Cannot handle Jaba parameter object "
- + rg.getClass());
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_cannot_handle_jaba_param",
+ new String[] { rg.getClass().toString() }));
}
else
{
rgs.add(narg);
+ rgnames.add(nargstring);
}
}
- return rgs;
+ if (!sortByOpt)
+ {
+ return rgs;
+ }
+ ArgumentI[] rgssort = rgs.toArray(new ArgumentI[rgs.size()]);
+ String[] rgssorton = rgnames.toArray(new String[rgs.size()]);
+ jalview.util.QuickSort.sort(rgssorton, rgssort);
+ ArgumentI tmp1;
+ int i = 0;
+ while (rgssort.length - i > i)
+ {
+ tmp1 = rgssort[rgssort.length - i - 1];
+ rgssort[rgssort.length - i - 1] = rgssort[i];
+ rgssort[i++] = tmp1;
+ }
+ return Arrays.asList(rgssort);
}
public static List getJabafromJwsArgs(List<ArgumentI> jwsargs)
@@ -169,9 +203,9 @@ public class JabaParamStore implements ParamDatastoreI
.getOption() : null;
if (narg == null)
{
- throw new Error(
- "Implementation Error: Cannot handle Jaba parameter object "
- + rg.getClass());
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_cannot_handle_jaba_param",
+ new String[] { rg.getClass().toString() }));
}
else
{
@@ -210,7 +244,8 @@ public class JabaParamStore implements ParamDatastoreI
if (servicePresets.containsKey(name))
{
throw new Error(
- "Implementation error: Attempt to delete a service preset!");
+ MessageManager
+ .getString("error.implementation_error_attempt_to_delete_service_preset"));
}
}
@@ -219,8 +254,7 @@ public class JabaParamStore implements ParamDatastoreI
List<ArgumentI> jobParams)
{
JabaWsParamSet jps = new JabaWsParamSet(presetName, text, jobParams);
- jps.setApplicableUrls(new String[]
- { service.getUri() });
+ jps.setApplicableUrls(new String[] { service.getUri() });
editedParams.put(jps.getName(), jps);
if (manager != null)
{
@@ -236,15 +270,16 @@ public class JabaParamStore implements ParamDatastoreI
: getPreset(presetName));
if (jps == null)
{
- throw new Error("Implementation error: Can't locate either oldname ("
- + oldName + ") or presetName (" + presetName
- + "in the datastore!");
+ throw new Error(
+ MessageManager
+ .formatMessage(
+ "error.implementation_error_cannot_locate_oldname_presetname",
+ new String[] { oldName, presetName }));
}
jps.setName(presetName);
jps.setDescription(text);
jps.setArguments(jobParams);
- jps.setApplicableUrls(new String[]
- { service.getUri() });
+ jps.setApplicableUrls(new String[] { service.getUri() });
if (oldName != null && !oldName.equals(jps.getName()))
{
editedParams.remove(oldName);
@@ -272,7 +307,8 @@ public class JabaParamStore implements ParamDatastoreI
boolean found = false;
for (String url : urls)
{
- if (service.getUri().equalsIgnoreCase(url))
+ if (service.getServiceTypeURI().equals(url)
+ || service.getUri().equalsIgnoreCase(url))
{
found = true;
break;
@@ -288,7 +324,8 @@ public class JabaParamStore implements ParamDatastoreI
if (!involves(urls))
{
throw new IOException(
- "Implementation error: Cannot find service url in the given url set!");
+ MessageManager
+ .getString("error.implementation_error_cannot_find_service_url_in_given_set"));
}
JabaWsParamSet wsp = new JabaWsParamSet();
@@ -314,14 +351,16 @@ public class JabaParamStore implements ParamDatastoreI
if (!involves(pset.getApplicableUrls()))
{
throw new IOException(
- "Implementation error: Cannot find service url in the given url set for this service parameter store ("
- + service.getUri() + ") !");
-
+ MessageManager
+ .formatMessage(
+ "error.implementation_error_cannot_find_service_url_in_given_set_param_store",
+ new String[] { service.getUri() }));
}
if (!(pset instanceof JabaWsParamSet))
{
throw new Error(
- "Implementation error: JabaWsParamSets can only be handled by JabaParamStore");
+ MessageManager
+ .getString("error.implementation_error_jabaws_param_set_only_handled_by"));
}
StringBuffer rslt = new StringBuffer();
diff --git a/src/jalview/ws/jws2/JabaPreset.java b/src/jalview/ws/jws2/JabaPreset.java
index 8586d24..561e4e8 100644
--- a/src/jalview/ws/jws2/JabaPreset.java
+++ b/src/jalview/ws/jws2/JabaPreset.java
@@ -1,23 +1,27 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.WsParamSetI;
@@ -52,8 +56,7 @@ public class JabaPreset implements WsParamSetI
@Override
public String[] getApplicableUrls()
{
- return new String[]
- { service.getUri() };
+ return new String[] { service.getUri() };
}
@Override
@@ -71,7 +74,9 @@ public class JabaPreset implements WsParamSetI
@Override
public void setSourceFile(String newfile)
{
- throw new Error("Cannot set source file for " + getClass());
+ throw new Error(MessageManager.formatMessage(
+ "error.cannot_set_source_file_for", new String[] { getClass()
+ .toString() }));
}
@Override
@@ -85,13 +90,16 @@ public class JabaPreset implements WsParamSetI
{
e.printStackTrace();
throw new Error(
- "Probable mismatch between service instance and preset!");
+ MessageManager
+ .getString("error.mismatch_service_instance_preset"));
}
}
@Override
public void setArguments(List<ArgumentI> args)
{
- throw new Error("Cannot set Parameters for a Jaba Web service's preset");
+ throw new Error(
+ MessageManager
+ .getString("error.cannot_set_params_for_ws_preset"));
}
}
diff --git a/src/jalview/ws/jws2/JabaWsServerQuery.java b/src/jalview/ws/jws2/JabaWsServerQuery.java
index 74a5df1..e376a73 100644
--- a/src/jalview/ws/jws2/JabaWsServerQuery.java
+++ b/src/jalview/ws/jws2/JabaWsServerQuery.java
@@ -1,128 +1,260 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
/**
*
*/
package jalview.ws.jws2;
import jalview.bin.Cache;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.jws2.jabaws2.Jws2InstanceFactory;
-import compbio.data.msa.MsaWS;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import compbio.data.msa.Category;
+import compbio.data.msa.JABAService;
import compbio.ws.client.Jws2Client;
import compbio.ws.client.Services;
/**
* @author JimP
- *
+ *
*/
public class JabaWsServerQuery implements Runnable
{
- Jws2Discoverer jws2Discoverer=null;
- String jwsservers=null;
- boolean quit=false,
- running=false;
+ Jws2Discoverer jws2Discoverer = null;
+
+ String jwsserver = null;
+
+ boolean quit = false, running = false;
+
/**
* @return the running
*/
- public boolean isRunning()
+ public boolean isRunning()
{
return running;
}
/**
- * @param quit the quit to set
+ * @param quit
+ * the quit to set
*/
public void setQuit(boolean quit)
{
this.quit = quit;
}
- public JabaWsServerQuery(Jws2Discoverer jws2Discoverer, String jwsservers)
+ public JabaWsServerQuery(Jws2Discoverer jws2Discoverer, String server)
{
this.jws2Discoverer = jws2Discoverer;
- this.jwsservers=jwsservers;
+ this.jwsserver = server;
}
- /* (non-Javadoc)
+ Services[] JABAWS1SERVERS = new Services[] { Services.ClustalWS,
+ Services.MuscleWS, Services.MafftWS, Services.ProbconsWS,
+ Services.TcoffeeWS };
+
+ Services[] JABAWS2SERVERS = new Services[] { Services.ClustalWS,
+ Services.MuscleWS, Services.MafftWS, Services.ProbconsWS,
+ Services.TcoffeeWS, Services.AAConWS, Services.DisemblWS,
+ Services.GlobPlotWS, Services.IUPredWS, Services.JronnWS,
+ Services.RNAalifoldWS };
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Runnable#run()
*/
@Override
public void run()
{
- running=true;
- try
+ running = true;
+ try
{
- if (Jws2Client.validURL(jwsservers))
+ // TODO this test doesn't seem to attempt a connection - should it?
+ // would save a lot of failed tries with UnknownHostException
+ if (isValidUrl(jwsserver))
{
- boolean noservices=true;
+ compbio.data.msa.RegistryWS registry = null;
+ Set svccategories = null;
+ boolean noservices = true;
// look for services
- for (Services srv : Services.values())
+ boolean jabasws2 = false;
+ // If we are dealing with a JABAWS2 service, then just go and ask the
+ // JABAWS 2 service registry
+ Set<Services> srv_set = new HashSet<Services>();
+
+ Set<Category> categories = Category.getCategories();
+ String svc_cat;
+
+ try
{
- if (quit)
+ // JBPNote: why is RegistryWS in compbio.data.msa ?
+ registry = Jws2Client.connectToRegistry(jwsserver);
+ if (registry != null)
{
- running=false;
- return;
+ // System.err.println("Test Services Output\n"
+ // + registry.testAllServices());
+ // TODO: enumerate services and test those that haven't been tested
+ // in the last n-days/hours/etc.
+
+ jabasws2 = true;
+ srv_set = registry.getSupportedServices();
+
+ // dan test
+ System.out.println("registry.getSupportedServices: "
+ + srv_set.toString());
+
+ svccategories = registry.getServiceCategories();
+
+ // dan test
+ // System.out.println("registry.getServiceCategories: " +
+ // svccategories.toString());
+
}
- MsaWS service = null;
- try
+ } catch (Exception ex)
+ {
+ System.err.println("Exception whilst trying to get at registry:");
+ ex.printStackTrace();
+ // if that failed, then we are probably working with a JABAWS1 server.
+ // in that case, look for each service endpoint
+ System.err.println("JWS2 Discoverer: " + jwsserver
+ + " is a JABAWS1 server. Using hardwired list.");
+ for (Services srv : JABAWS1SERVERS)
{
- service = Jws2Client.connect(jwsservers, srv);
- } catch (Exception e)
+ srv_set.add(srv);
+ }
+ }
+
+ for (Category cat : categories)
+ {
+ for (Services srv : cat.getServices())
{
- System.err.println("Jws2 Discoverer: Problem on "
- + jwsservers + " with service " + srv + ":\n"
- + e.getMessage());
- if (!(e instanceof javax.xml.ws.WebServiceException))
+ if (quit)
{
- e.printStackTrace();
+ running = false;
+ return;
}
- // For moment, report service as a problem.
- jws2Discoverer.addInvalidServiceUrl(jwsservers);
- }
- ;
- if (service != null)
- {
- noservices=false;
- jws2Discoverer.addService(jwsservers, srv, service);
+ if (!srv_set.contains(srv))
+ {
+ continue;
+ }
+ JABAService service = null;
+ try
+ {
+ service = Jws2Client.connect(jwsserver, srv);
+ } catch (Exception e)
+ {
+ System.err.println("Jws2 Discoverer: Problem on " + jwsserver
+ + " with service " + srv + ":\n" + e.getMessage());
+ if (!(e instanceof javax.xml.ws.WebServiceException))
+ {
+ e.printStackTrace();
+ }
+ // For moment, report service as a problem.
+ jws2Discoverer.addInvalidServiceUrl(jwsserver);
+ }
+ ;
+ if (service != null
+ && !Jws2InstanceFactory.ignoreService(srv.toString()))
+ {
+ noservices = false;
+ Jws2Instance svc = null;
+ if (registry != null)
+ {
+
+ String description = registry.getServiceDescription(srv);
+
+ svc = Jws2InstanceFactory.newJws2Instance(jwsserver,
+ srv.toString(), cat.name, description, service);
+ }
+ if (svc == null)
+ {
+ svc = Jws2InstanceFactory.newJws2Instance(jwsserver,
+ srv.toString(), cat.name,
+ "JABAWS 1 Alignment Service", service);
+ }
+ jws2Discoverer.addService(jwsserver, svc);
+ }
+
}
}
+
if (noservices)
{
- jws2Discoverer.addUrlwithnoservices(jwsservers);
+ jws2Discoverer.addUrlwithnoservices(jwsserver);
}
}
else
{
- jws2Discoverer.addInvalidServiceUrl(jwsservers);
- Cache.log.info("Ignoring invalid Jws2 service url " + jwsservers);
+ jws2Discoverer.addInvalidServiceUrl(jwsserver);
+ Cache.log.warn("Ignoring invalid Jws2 service url " + jwsserver);
}
} catch (Exception e)
{
e.printStackTrace();
Cache.log.warn("Exception when discovering Jws2 services.", e);
- jws2Discoverer.addInvalidServiceUrl(jwsservers);
+ jws2Discoverer.addInvalidServiceUrl(jwsserver);
} catch (Error e)
{
Cache.log.error("Exception when discovering Jws2 services.", e);
- jws2Discoverer.addInvalidServiceUrl(jwsservers);
+ jws2Discoverer.addInvalidServiceUrl(jwsserver);
+ }
+ running = false;
+ }
+
+ /**
+ * Check if the URL is valid and responding.
+ *
+ * @return
+ */
+ private boolean isValidUrl(String server)
+ {
+ // return Jws2Client.validURL(jwsserver); // checks syntax only
+ boolean result = false;
+ if (server != null)
+ {
+ try
+ {
+ URL url = new URL(server);
+ url.openStream().close();
+ result = true;
+ } catch (MalformedURLException e)
+ {
+ System.err.println("Invalid server URL: " + server);
+ result = false;
+ } catch (IOException e)
+ {
+ System.err.println("Error connecting to server: " + server + ": "
+ + e.toString());
+ result = false;
+ }
}
- running=false;
+ return result;
}
}
diff --git a/src/jalview/ws/jws2/JabawsCalcWorker.java b/src/jalview/ws/jws2/JabawsCalcWorker.java
new file mode 100644
index 0000000..d2e5bcd
--- /dev/null
+++ b/src/jalview/ws/jws2/JabawsCalcWorker.java
@@ -0,0 +1,237 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.Iterator;
+import java.util.List;
+
+import compbio.data.msa.SequenceAnnotation;
+import compbio.data.sequence.Score;
+import compbio.data.sequence.ScoreManager;
+import compbio.metadata.Argument;
+import compbio.metadata.ChunkHolder;
+import compbio.metadata.JobStatus;
+import compbio.metadata.JobSubmissionException;
+import compbio.metadata.ResultNotAvailableException;
+import compbio.metadata.WrongParameterException;
+
+public abstract class JabawsCalcWorker extends AbstractJabaCalcWorker
+{
+
+ @SuppressWarnings("unchecked")
+ protected SequenceAnnotation aaservice;
+
+ protected ScoreManager scoremanager;
+
+ public JabawsCalcWorker(Jws2Instance service, AlignFrame alignFrame,
+ WsParamSetI preset, List<Argument> paramset)
+ {
+ super(service, alignFrame, preset, paramset);
+ aaservice = (SequenceAnnotation) service.service;
+ }
+
+ @Override
+ ChunkHolder pullExecStatistics(String rslt, long rpos)
+ {
+ return aaservice.pullExecStatistics(rslt, rpos);
+ }
+
+ @Override
+ boolean collectAnnotationResultsFor(String rslt)
+ throws ResultNotAvailableException
+ {
+ scoremanager = aaservice.getAnnotation(rslt);
+ if (scoremanager != null)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ boolean cancelJob(String rslt) throws Exception
+ {
+ return aaservice.cancelJob(rslt);
+ }
+
+ @Override
+ protected JobStatus getJobStatus(String rslt) throws Exception
+ {
+ return aaservice.getJobStatus(rslt);
+ }
+
+ @Override
+ boolean hasService()
+ {
+ return aaservice != null;
+ }
+
+ @Override
+ protected boolean isInteractiveUpdate()
+ {
+ return this instanceof AAConClient;
+ }
+
+ @Override
+ protected String submitToService(
+ List<compbio.data.sequence.FastaSequence> seqs)
+ throws JobSubmissionException
+ {
+ String rslt;
+ if (preset == null && arguments == null)
+ {
+ rslt = aaservice.analize(seqs);
+ }
+ else
+ {
+ try
+ {
+ rslt = aaservice.customAnalize(seqs, getJabaArguments());
+ } catch (WrongParameterException x)
+ {
+ throw new JobSubmissionException(
+ MessageManager
+ .getString("exception.jobsubmission_invalid_params_set"),
+ x);
+
+ }
+ }
+ return rslt;
+ }
+
+ protected void createAnnotationRowsForScores(
+ List<AlignmentAnnotation> ourAnnot, String calcId, int alWidth,
+ Score scr)
+ {
+ // simple annotation row
+ AlignmentAnnotation annotation = alignViewport.getAlignment()
+ .findOrCreateAnnotation(scr.getMethod(), calcId, true, null,
+ null);
+ if (alWidth == gapMap.length) // scr.getScores().size())
+ {
+ constructAnnotationFromScore(annotation, 0, alWidth, scr);
+ ourAnnot.add(annotation);
+ }
+ }
+
+ protected AlignmentAnnotation createAnnotationRowsForScores(
+ List<AlignmentAnnotation> ourAnnot, String typeName,
+ String calcId, SequenceI dseq, int base, Score scr)
+ {
+ System.out.println("Creating annotation on dseq:" + dseq.getStart()
+ + " base is " + base + " and length=" + dseq.getLength()
+ + " == " + scr.getScores().size());
+ // AlignmentAnnotation annotation = new AlignmentAnnotation(
+ // scr.getMethod(), typeName, new Annotation[]
+ // {}, 0, -1, AlignmentAnnotation.LINE_GRAPH);
+ // annotation.setCalcId(calcId);
+ AlignmentAnnotation annotation = alignViewport.getAlignment()
+ .findOrCreateAnnotation(typeName, calcId, false, dseq, null);
+ constructAnnotationFromScore(annotation, 0, dseq.getLength(), scr);
+ annotation.createSequenceMapping(dseq, base, false);
+ annotation.adjustForAlignment();
+ dseq.addAlignmentAnnotation(annotation);
+ ourAnnot.add(annotation);
+ return annotation;
+ }
+
+ protected void replaceAnnotationOnAlignmentWith(
+ AlignmentAnnotation newAnnot, String typeName, String calcId,
+ SequenceI aSeq)
+ {
+ SequenceI dsseq = aSeq.getDatasetSequence();
+ while (dsseq.getDatasetSequence() != null)
+ {
+ dsseq = dsseq.getDatasetSequence();
+ }
+ // look for same annotation on dataset and lift this one over
+ List<AlignmentAnnotation> dsan = dsseq.getAlignmentAnnotations(calcId,
+ typeName);
+ if (dsan != null && dsan.size() > 0)
+ {
+ for (AlignmentAnnotation dssan : dsan)
+ {
+ dsseq.removeAlignmentAnnotation(dssan);
+ }
+ }
+ AlignmentAnnotation dssan = new AlignmentAnnotation(newAnnot);
+ dsseq.addAlignmentAnnotation(dssan);
+ dssan.adjustForAlignment();
+ }
+
+ private void constructAnnotationFromScore(AlignmentAnnotation annotation,
+ int base, int alWidth, Score scr)
+ {
+ Annotation[] elm = new Annotation[alWidth];
+ Iterator<Float> vals = scr.getScores().iterator();
+ float m = 0f, x = 0f;
+ for (int i = 0; vals.hasNext(); i++)
+ {
+ float val = vals.next().floatValue();
+ if (i == 0)
+ {
+ m = val;
+ x = val;
+ }
+ else
+ {
+ if (m > val)
+ {
+ m = val;
+ }
+ ;
+ if (x < val)
+ {
+ x = val;
+ }
+ }
+ // if we're at a gapped column then skip to next ungapped position
+ if (gapMap != null && gapMap.length > 0)
+ {
+ while (!gapMap[i])
+ {
+ elm[i++] = new Annotation("", "", ' ', Float.NaN);
+ }
+ }
+ elm[i] = new Annotation("", "" + val, ' ', val);
+ }
+
+ annotation.annotations = elm;
+ annotation.belowAlignment = true;
+ if (x < 0)
+ {
+ x = 0;
+ }
+ x += (x - m) * 0.1;
+ annotation.graphMax = x;
+ annotation.graphMin = m;
+ annotation.validateRangeAndDisplay();
+ }
+
+}
diff --git a/src/jalview/ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java b/src/jalview/ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java
new file mode 100644
index 0000000..d45a0e1
--- /dev/null
+++ b/src/jalview/ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java
@@ -0,0 +1,226 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2;
+
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.Iterator;
+import java.util.List;
+
+import compbio.data.msa.MsaWS;
+import compbio.data.sequence.Alignment;
+import compbio.data.sequence.Score;
+import compbio.metadata.Argument;
+import compbio.metadata.ChunkHolder;
+import compbio.metadata.JobStatus;
+import compbio.metadata.JobSubmissionException;
+import compbio.metadata.ResultNotAvailableException;
+import compbio.metadata.WrongParameterException;
+
+public abstract class JabawsMsaInterfaceAlignCalcWorker extends
+ AbstractJabaCalcWorker
+{
+
+ @SuppressWarnings("unchecked")
+ protected MsaWS msaservice;
+
+ protected Alignment msascoreset;
+
+ public JabawsMsaInterfaceAlignCalcWorker(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ }
+
+ public JabawsMsaInterfaceAlignCalcWorker(Jws2Instance service,
+ AlignFrame alignFrame, WsParamSetI preset, List<Argument> paramset)
+ {
+ this(alignFrame.getCurrentView(), alignFrame.alignPanel);
+ this.guiProgress = alignFrame;
+ this.preset = preset;
+ this.arguments = paramset;
+ this.service = service;
+ msaservice = (MsaWS) service.service;
+
+ }
+
+ @Override
+ ChunkHolder pullExecStatistics(String rslt, long rpos)
+ {
+ return msaservice.pullExecStatistics(rslt, rpos);
+ }
+
+ @Override
+ boolean collectAnnotationResultsFor(String rslt)
+ throws ResultNotAvailableException
+ {
+ msascoreset = msaservice.getResult(rslt);
+ if (msascoreset != null)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ boolean cancelJob(String rslt) throws Exception
+ {
+ return msaservice.cancelJob(rslt);
+ }
+
+ @Override
+ protected JobStatus getJobStatus(String rslt) throws Exception
+ {
+ return msaservice.getJobStatus(rslt);
+ }
+
+ @Override
+ boolean hasService()
+ {
+ return msaservice != null;
+ }
+
+ @Override
+ protected boolean isInteractiveUpdate()
+ {
+ return false; // this instanceof AAConClient;
+ }
+
+ @Override
+ protected String submitToService(
+ List<compbio.data.sequence.FastaSequence> seqs)
+ throws JobSubmissionException
+ {
+ String rslt;
+ if (preset == null && arguments == null)
+ {
+ rslt = msaservice.align(seqs);
+ }
+ else
+ {
+ try
+ {
+ rslt = msaservice.customAlign(seqs, getJabaArguments());
+ } catch (WrongParameterException x)
+ {
+ throw new JobSubmissionException(
+ MessageManager
+ .getString("exception.jobsubmission_invalid_params_set"),
+ x);
+ }
+ }
+ return rslt;
+ }
+
+ protected void createAnnotationRowsForScores(
+ List<AlignmentAnnotation> ourAnnot, String calcId, int alWidth,
+ Score scr)
+ {
+ // simple annotation row
+ AlignmentAnnotation annotation = alignViewport.getAlignment()
+ .findOrCreateAnnotation(scr.getMethod(), calcId, true, null,
+ null);
+ if (alWidth == gapMap.length) // scr.getScores().size())
+ {
+ constructAnnotationFromScore(annotation, 0, alWidth, scr);
+ ourAnnot.add(annotation);
+ }
+ }
+
+ protected AlignmentAnnotation createAnnotationRowsForScores(
+ List<AlignmentAnnotation> ourAnnot, String typeName,
+ String calcId, SequenceI dseq, int base, Score scr)
+ {
+ System.out.println("Creating annotation on dseq:" + dseq.getStart()
+ + " base is " + base + " and length=" + dseq.getLength()
+ + " == " + scr.getScores().size());
+ // AlignmentAnnotation annotation = new AlignmentAnnotation(
+ // scr.getMethod(), typeName, new Annotation[]
+ // {}, 0, -1, AlignmentAnnotation.LINE_GRAPH);
+ // annotation.setCalcId(calcId);
+ AlignmentAnnotation annotation = alignViewport.getAlignment()
+ .findOrCreateAnnotation(typeName, calcId, false, dseq, null);
+ constructAnnotationFromScore(annotation, 0, dseq.getLength(), scr);
+ annotation.createSequenceMapping(dseq, base, false);
+ annotation.adjustForAlignment();
+ dseq.addAlignmentAnnotation(annotation);
+ ourAnnot.add(annotation);
+ return annotation;
+ }
+
+ private void constructAnnotationFromScore(AlignmentAnnotation annotation,
+ int base, int alWidth, Score scr)
+ {
+ Annotation[] elm = new Annotation[alWidth];
+ Iterator<Float> vals = scr.getScores().iterator();
+ float m = 0f, x = 0f;
+ for (int i = 0; vals.hasNext(); i++)
+ {
+ float val = vals.next().floatValue();
+ if (i == 0)
+ {
+ m = val;
+ x = val;
+ }
+ else
+ {
+ if (m > val)
+ {
+ m = val;
+ }
+ ;
+ if (x < val)
+ {
+ x = val;
+ }
+ }
+ // if we're at a gapped column then skip to next ungapped position
+ if (gapMap != null && gapMap.length > 0)
+ {
+ while (!gapMap[i])
+ {
+ elm[i++] = new Annotation("", "", ' ', Float.NaN);
+ }
+ }
+ elm[i] = new Annotation("", "" + val, ' ', val);
+ }
+
+ annotation.annotations = elm;
+ annotation.belowAlignment = true;
+ if (x < 0)
+ {
+ x = 0;
+ }
+ x += (x - m) * 0.1;
+ annotation.graphMax = x;
+ annotation.graphMin = m;
+ annotation.validateRangeAndDisplay();
+ }
+
+}
diff --git a/src/jalview/ws/jws2/Jws2Client.java b/src/jalview/ws/jws2/Jws2Client.java
index 6e60c07..d8fb846 100644
--- a/src/jalview/ws/jws2/Jws2Client.java
+++ b/src/jalview/ws/jws2/Jws2Client.java
@@ -1,47 +1,157 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
-import javax.swing.JMenu;
-
+import jalview.api.AlignCalcWorkerI;
+import jalview.bin.Cache;
import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
import jalview.gui.WebserviceInfo;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
+import jalview.gui.WsJobParameters;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.dm.AAConSettings;
+import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+import jalview.ws.uimodel.AlignAnalysisUIText;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+
+import compbio.metadata.Argument;
/**
- * provides metadata for a jws2 service instance - resolves names, etc.
+ * provides metadata for a jabaws2 service instance - resolves names, etc.
*
* @author JimP
*
*/
public abstract class Jws2Client extends jalview.ws.WSClient
{
+ protected AlignFrame alignFrame;
+
+ protected WsParamSetI preset;
+
+ protected List<Argument> paramset;
+
+ public Jws2Client(AlignFrame _alignFrame, WsParamSetI preset,
+ List<Argument> arguments)
+ {
+ alignFrame = _alignFrame;
+ this.preset = preset;
+ if (preset != null)
+ {
+ if (!((preset instanceof JabaPreset) || preset instanceof JabaWsParamSet))
+ {
+ /*
+ * { this.preset = ((JabaPreset) preset).p; } else if (preset instanceof
+ * JabaWsParamSet) { List<Argument> newargs = new ArrayList<Argument>();
+ * JabaWsParamSet pset = ((JabaWsParamSet) preset); for (Option opt :
+ * pset.getjabaArguments()) { newargs.add(opt); } if (arguments != null
+ * && arguments.size() > 0) { // merge arguments with preset's own
+ * arguments. for (Argument opt : arguments) { newargs.add(opt); } }
+ * paramset = newargs; } else {
+ */
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_can_only_instantiate_jaba_param_sets"));
+ }
+ }
+ else
+ {
+ // just provided with a bunch of arguments
+ this.paramset = arguments;
+ }
+ }
+
+ boolean processParams(Jws2Instance sh, boolean editParams)
+ {
+ return processParams(sh, editParams, false);
+ }
+
+ protected boolean processParams(Jws2Instance sh, boolean editParams,
+ boolean adjustingExisting)
+ {
+
+ if (editParams)
+ {
+ if (sh.paramStore == null)
+ {
+ sh.paramStore = new JabaParamStore(sh,
+ Desktop.getUserParameterStore());
+ }
+ WsJobParameters jobParams = (preset == null && paramset != null && paramset
+ .size() > 0) ? new WsJobParameters(null, sh, null, paramset)
+ : new WsJobParameters(sh, preset);
+ if (adjustingExisting)
+ {
+ jobParams.setName(MessageManager
+ .getString("label.adjusting_parameters_for_calculation"));
+ }
+ if (!jobParams.showRunDialog())
+ {
+ return false;
+ }
+ WsParamSetI prset = jobParams.getPreset();
+ if (prset == null)
+ {
+ paramset = jobParams.isServiceDefaults() ? null : JabaParamStore
+ .getJabafromJwsArgs(jobParams.getJobParams());
+ this.preset = null;
+ }
+ else
+ {
+ this.preset = prset; // ((JabaPreset) prset).p;
+ paramset = null; // no user supplied parameters.
+ }
+ }
+ return true;
+
+ }
+
+ public Jws2Client()
+ {
+ // anonymous constructor - used for headless method calls only
+ }
+
protected WebserviceInfo setWebService(Jws2Instance serv, boolean b)
{
// serviceHandle = serv;
- String serviceInstance = serv.service.getClass().getName();
+ String serviceInstance = serv.action; // serv.service.getClass().getName();
WebServiceName = serv.serviceType;
WebServiceJobTitle = serv.getActionText();
WsURL = serv.hosturl;
if (!b)
{
return new WebserviceInfo(WebServiceJobTitle, WebServiceJobTitle
- + " using service hosted at " + serv.hosturl);
+ + " using service hosted at " + serv.hosturl + "\n"
+ + (serv.description != null ? serv.description : ""), false);
}
return null;
}
@@ -67,4 +177,252 @@ public abstract class Jws2Client extends jalview.ws.WSClient
abstract void attachWSMenuEntry(JMenu wsmenu, final Jws2Instance service,
final AlignFrame alignFrame);
+ protected boolean registerAAConWSInstance(final JMenu wsmenu,
+ final Jws2Instance service, final AlignFrame alignFrame)
+ {
+ final AlignAnalysisUIText aaui = service.getAlignAnalysisUI(); // null ; //
+ // AlignAnalysisUIText.aaConGUI.get(service.serviceType.toString());
+ if (aaui == null)
+ {
+ // not an instantaneous calculation GUI type service
+ return false;
+ }
+ // create the instaneous calculation GUI bits and update state if existing
+ // GUI elements already present
+
+ JCheckBoxMenuItem _aaConEnabled = null;
+ for (int i = 0; i < wsmenu.getItemCount(); i++)
+ {
+ JMenuItem item = wsmenu.getItem(i);
+ if (item instanceof JCheckBoxMenuItem
+ && item.getText().equals(aaui.getAAconToggle()))
+ {
+ _aaConEnabled = (JCheckBoxMenuItem) item;
+ }
+ }
+ // is there an aaCon worker already present - if so, set it to use the
+ // given service handle
+ {
+ List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
+ .getCalcManager()
+ .getRegisteredWorkersOfClass(aaui.getClient());
+ if (aaconClient != null && aaconClient.size() > 0)
+ {
+ AbstractJabaCalcWorker worker = (AbstractJabaCalcWorker) aaconClient
+ .get(0);
+ if (!worker.service.hosturl.equals(service.hosturl))
+ {
+ // javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ // @Override
+ // public void run()
+ {
+ removeCurrentAAConWorkerFor(aaui, alignFrame);
+ buildCurrentAAConWorkerFor(aaui, alignFrame, service);
+ }
+ }// );
+ }
+ }
+ }
+
+ // is there a service already registered ? there shouldn't be if we are
+ // being called correctly
+ if (_aaConEnabled == null)
+ {
+ final JCheckBoxMenuItem aaConEnabled = new JCheckBoxMenuItem(
+ aaui.getAAconToggle());
+
+ aaConEnabled.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ aaui.getAAconToggleTooltip()));
+ aaConEnabled.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
+ .getCalcManager()
+ .getRegisteredWorkersOfClass(aaui.getClient());
+ if (aaconClient != null && aaconClient.size() > 0)
+ {
+ removeCurrentAAConWorkerFor(aaui, alignFrame);
+ }
+ else
+ {
+ buildCurrentAAConWorkerFor(aaui, alignFrame);
+
+ }
+ }
+
+ });
+ wsmenu.add(aaConEnabled);
+ final JMenuItem modifyParams = new JMenuItem(aaui.getAAeditSettings());
+ modifyParams
+ .setToolTipText("<html><p>"
+ + JvSwingUtils.wrapTooltip(false,
+ aaui.getAAeditSettingsTooltip() + "</p>")
+ + "</html>");
+ modifyParams.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ showAAConAnnotationSettingsFor(aaui, alignFrame);
+ }
+ });
+ wsmenu.add(modifyParams);
+ wsmenu.addMenuListener(new MenuListener()
+ {
+
+ @Override
+ public void menuSelected(MenuEvent arg0)
+ {
+ // TODO: refactor to the implementing class.
+ if (alignFrame.getViewport().getAlignment().isNucleotide() ? aaui
+ .isNa() : aaui.isPr())
+ {
+ aaConEnabled.setEnabled(true);
+ modifyParams.setEnabled(true);
+ }
+ else
+ {
+ aaConEnabled.setEnabled(false);
+ modifyParams.setEnabled(false);
+ }
+ List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
+ .getCalcManager()
+ .getRegisteredWorkersOfClass(aaui.getClient());
+ if (aaconClient != null && aaconClient.size() > 0)
+ {
+ aaConEnabled.setSelected(true);
+ }
+ else
+ {
+ aaConEnabled.setSelected(false);
+ }
+ }
+
+ @Override
+ public void menuDeselected(MenuEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void menuCanceled(MenuEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ }
+ return true;
+ }
+
+ private static void showAAConAnnotationSettingsFor(
+ final AlignAnalysisUIText aaui, AlignFrame alignFrame)
+ {
+ /*
+ * preferred settings Whether AACon is automatically recalculated Which
+ * AACon server to use What parameters to use
+ */
+ // could actually do a class search for this too
+ AAConSettings fave = (AAConSettings) alignFrame.getViewport()
+ .getCalcIdSettingsFor(aaui.getCalcId());
+ if (fave == null)
+ {
+ fave = createDefaultAAConSettings(aaui);
+ }
+ new SequenceAnnotationWSClient(fave, alignFrame, true);
+
+ }
+
+ private static void buildCurrentAAConWorkerFor(
+ final AlignAnalysisUIText aaui, AlignFrame alignFrame)
+ {
+ buildCurrentAAConWorkerFor(aaui, alignFrame, null);
+ }
+
+ private static void buildCurrentAAConWorkerFor(
+ final AlignAnalysisUIText aaui, AlignFrame alignFrame,
+ Jws2Instance service)
+ {
+ /*
+ * preferred settings Whether AACon is automatically recalculated Which
+ * AACon server to use What parameters to use
+ */
+ AAConSettings fave = (AAConSettings) alignFrame.getViewport()
+ .getCalcIdSettingsFor(aaui.getCalcId());
+ if (fave == null)
+ {
+ fave = createDefaultAAConSettings(aaui, service);
+ }
+ else
+ {
+ if (service != null
+ && !fave.getService().hosturl.equals(service.hosturl))
+ {
+ Cache.log.debug("Changing AACon service to " + service.hosturl
+ + " from " + fave.getService().hosturl);
+ fave.setService(service);
+ }
+ }
+ new SequenceAnnotationWSClient(fave, alignFrame, false);
+ }
+
+ private static AAConSettings createDefaultAAConSettings(
+ AlignAnalysisUIText aaui)
+ {
+ return createDefaultAAConSettings(aaui, null);
+ }
+
+ private static AAConSettings createDefaultAAConSettings(
+ AlignAnalysisUIText aaui, Jws2Instance service)
+ {
+ if (service != null)
+ {
+ if (!service.serviceType.toString().equals(
+ compbio.ws.client.Services.AAConWS.toString()))
+ {
+ Cache.log
+ .warn("Ignoring invalid preferred service for AACon calculations (service type was "
+ + service.serviceType + ")");
+ service = null;
+ }
+ else
+ {
+ // check service is actually in the list of currently avaialable
+ // services
+ if (!Jws2Discoverer.getDiscoverer().getServices().contains(service))
+ {
+ // it isn't ..
+ service = null;
+ }
+ }
+ }
+ if (service == null)
+ {
+ // get the default service for AACon
+ service = Jws2Discoverer.getDiscoverer().getPreferredServiceFor(null,
+ aaui.getServiceType());
+ }
+ if (service == null)
+ {
+ // TODO raise dialog box explaining error, and/or open the JABA
+ // preferences menu.
+ throw new Error(
+ MessageManager.getString("error.no_aacon_service_found"));
+ }
+ return new AAConSettings(true, service, null, null);
+ }
+
+ private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui,
+ AlignFrame alignFrame)
+ {
+ alignFrame.getViewport().getCalcManager()
+ .removeRegisteredWorkersOfClass(aaui.getClient());
+ }
+
}
diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java
index ed808f6..60fa85b 100644
--- a/src/jalview/ws/jws2/Jws2Discoverer.java
+++ b/src/jalview/ws/jws2/Jws2Discoverer.java
@@ -1,59 +1,56 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
+import jalview.bin.Cache;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
+import jalview.util.MessageManager;
+import jalview.ws.WSMenuEntryProviderI;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.ParamDatastoreI;
+
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.Closeable;
-import java.net.ConnectException;
+import java.beans.PropertyChangeSupport;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
-import javax.swing.event.MenuEvent;
-import javax.swing.event.MenuListener;
-
-import org.apache.log4j.Level;
-import jalview.bin.Cache;
-import jalview.datamodel.AlignmentView;
-import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
-import jalview.gui.JalviewChangeSupport;
-import jalview.gui.JvSwingUtils;
-import jalview.ws.WSMenuEntryProviderI;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
-import jalview.ws.params.ParamDatastoreI;
-import compbio.data.msa.MsaWS;
-import compbio.metadata.Option;
-import compbio.metadata.Preset;
-import compbio.metadata.PresetManager;
-import compbio.metadata.RunnerConfig;
-import compbio.ws.client.Jws2Client;
import compbio.ws.client.Services;
/**
@@ -65,9 +62,48 @@ import compbio.ws.client.Services;
*/
public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
{
- private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
+ public static final String COMPBIO_JABAWS = "http://www.compbio.dundee.ac.uk/jabaws";
+
+ /*
+ * the .jalview_properties entry for JWS2 URLS
+ */
+ final static String JWS2HOSTURLS = "JWS2HOSTURLS";
+
+ /*
+ * Singleton instance
+ */
+ private static Jws2Discoverer discoverer;
+
+ /*
+ * Override for testing only
+ */
+ private static List<String> testUrls = null;
+
+ // preferred url has precedence over others
+ private String preferredUrl;
+
+ private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
this);
+ Vector<String> invalidServiceUrls = null, urlsWithoutServices = null,
+ validServiceUrls = null;
+
+ boolean running = false, aborted = false;
+
+ Thread oldthread = null;
+
+ /**
+ * holds list of services.
+ */
+ protected Vector<Jws2Instance> services;
+
+ /**
+ * Private constructor enforces use of singleton via getDiscoverer()
+ */
+ private Jws2Discoverer()
+ {
+ }
+
/**
* change listeners are notified of "services" property changes
*
@@ -92,8 +128,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
changeSupport.removePropertyChangeListener(listener);
}
- boolean running = false, aborted = false;
-
/**
* @return the aborted
*/
@@ -109,12 +143,12 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
public void setAborted(boolean aborted)
{
this.aborted = aborted;
- }
- Thread oldthread = null;
+ }
public void run()
{
+
if (running && oldthread != null && oldthread.isAlive())
{
if (!aborted)
@@ -136,6 +170,16 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
Cache.log.debug("Old discovery thread has finished.");
}
running = true;
+
+ // first set up exclusion list if needed
+ final Set<String> ignoredServices = new HashSet<String>();
+ for (String ignored : Cache.getDefault("IGNORED_JABAWS_SERVICETYPES",
+ "").split("\\|"))
+ {
+ ignoredServices.add(ignored);
+ }
+
+ changeSupport.firePropertyChange("services", services, new Vector());
oldthread = Thread.currentThread();
try
{
@@ -162,17 +206,36 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
{
invalidServiceUrls.removeAllElements();
}
+ if (validServiceUrls != null)
+ {
+ validServiceUrls.removeAllElements();
+ }
+ ArrayList<String> svctypes = new ArrayList<String>();
List<JabaWsServerQuery> qrys = new ArrayList<JabaWsServerQuery>();
- for (final String jwsservers : getServiceUrls())
+ for (final String jwsserver : getServiceUrls())
{
- JabaWsServerQuery squery = new JabaWsServerQuery(this, jwsservers);
+ JabaWsServerQuery squery = new JabaWsServerQuery(this, jwsserver);
+ if (svctypes.size() == 0)
+ {
+ // TODO: remove this ugly hack to get Canonical JABA service ordering
+ // for all possible services
+ for (Services sv : squery.JABAWS2SERVERS)
+ {
+ if (!ignoredServices.contains(sv.toString()))
+ {
+ svctypes.add(sv.toString());
+ }
+ }
+
+ }
qrys.add(squery);
new Thread(squery).start();
}
- boolean finished = false;
+ boolean finished = true;
do
{
+ finished = true;
try
{
Thread.sleep(100);
@@ -182,7 +245,10 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
;
for (JabaWsServerQuery squery : qrys)
{
- finished |= !squery.isRunning();
+ if (squery.isRunning())
+ {
+ finished = false;
+ }
}
if (aborted)
{
@@ -194,12 +260,37 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
}
}
} while (!aborted && !finished);
- oldthread = null;
- running = false;
if (!aborted)
{
- changeSupport.firePropertyChange("services", new Vector(), services);
+ // resort services according to order found in jabaws service list
+ // also ensure servics for each host are ordered in same way.
+
+ if (services != null && services.size() > 0)
+ {
+ Jws2Instance[] svcs = new Jws2Instance[services.size()];
+ int[] spos = new int[services.size()];
+ int ipos = 0;
+ List<String> svcUrls = getServiceUrls();
+ for (Jws2Instance svc : services)
+ {
+ svcs[ipos] = svc;
+ spos[ipos++] = 1000 * svcUrls.indexOf(svc.getHost()) + 1
+ + svctypes.indexOf(svc.serviceType);
+ }
+ jalview.util.QuickSort.sort(spos, svcs);
+ services = new Vector<Jws2Instance>();
+ for (Jws2Instance svc : svcs)
+ {
+ if (!ignoredServices.contains(svc.serviceType))
+ {
+ services.add(svc);
+ }
+ }
+ }
}
+ oldthread = null;
+ running = false;
+ changeSupport.firePropertyChange("services", new Vector(), services);
}
/**
@@ -209,204 +300,180 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
* @param srv
* @param service2
*/
- synchronized void addService(String jwsservers, Services srv,
- MsaWS service2)
+ synchronized void addService(String jwsservers, Jws2Instance service)
{
if (services == null)
{
services = new Vector<Jws2Instance>();
}
System.out.println("Discovered service: " + jwsservers + " "
- + srv.toString());
- Jws2Instance service = new Jws2Instance(jwsservers, srv.toString(),
- service2);
+ + service.toString());
+ // Jws2Instance service = new Jws2Instance(jwsservers, srv.toString(),
+ // service2);
services.add(service);
// retrieve the presets and parameter set and cache now
- service.getParamStore().getPresets();
+ ParamDatastoreI pds = service.getParamStore();
+ if (pds != null)
+ {
+ pds.getPresets();
+ }
service.hasParameters();
+ if (validServiceUrls == null)
+ {
+ validServiceUrls = new Vector();
+ }
+ validServiceUrls.add(jwsservers);
}
- public class Jws2Instance
+ /**
+ * attach all available web services to the appropriate submenu in the given
+ * JMenu
+ */
+ public void attachWSMenuEntry(JMenu wsmenu, final AlignFrame alignFrame)
{
- public String hosturl;
-
- public String serviceType;
+ // dynamically regenerate service list.
+ populateWSMenuEntry(wsmenu, alignFrame, null);
+ }
- public MsaWS service;
+ private boolean isRecalculable(String action)
+ {
+ return (action != null && action.equalsIgnoreCase("conservation"));
+ }
- public Jws2Instance(String hosturl, String serviceType, MsaWS service)
+ private void populateWSMenuEntry(JMenu jws2al,
+ final AlignFrame alignFrame, String typeFilter)
+ {
+ if (running || services == null || services.size() == 0)
{
- super();
- this.hosturl = hosturl;
- this.serviceType = serviceType;
- this.service = service;
+ return;
}
-
- PresetManager presets = null;
-
- public JabaParamStore paramStore = null;
-
+ boolean byhost = Cache.getDefault("WSMENU_BYHOST", false), bytype = Cache
+ .getDefault("WSMENU_BYTYPE", false);
/**
- * non thread safe - gets the presets for this service (blocks whilst it
- * calls the service to get the preset set)
- *
- * @return service presets or null if exceptions were raised.
+ * eventually, JWS2 services will appear under the same align/etc submenus.
+ * for moment we keep them separate.
*/
- public PresetManager getPresets()
+ JMenu atpoint;
+ List<Jws2Instance> enumerableServices = new ArrayList<Jws2Instance>();
+ // jws2al.removeAll();
+ Map<String, Jws2Instance> preferredHosts = new HashMap<String, Jws2Instance>();
+ Map<String, List<Jws2Instance>> alternates = new HashMap<String, List<Jws2Instance>>();
+ for (Jws2Instance service : services.toArray(new Jws2Instance[0]))
{
- if (presets == null)
+ if (!isRecalculable(service.action))
{
- try
+ // add 'one shot' services to be displayed using the classic menu
+ // structure
+ enumerableServices.add(service);
+ }
+ else
+ {
+ if (!preferredHosts.containsKey(service.serviceType))
{
- presets = service.getPresets();
- } catch (Exception ex)
+ Jws2Instance preferredInstance = getPreferredServiceFor(
+ alignFrame, service.serviceType);
+ if (preferredInstance != null)
+ {
+ preferredHosts.put(service.serviceType, preferredInstance);
+ }
+ else
+ {
+ preferredHosts.put(service.serviceType, service);
+ }
+ }
+ List<Jws2Instance> ph = alternates.get(service.serviceType);
+ if (preferredHosts.get(service.serviceType) != service)
{
- System.err
- .println("Exception when retrieving presets for service "
- + serviceType + " at " + hosturl);
+ if (ph == null)
+ {
+ ph = new ArrayList<Jws2Instance>();
+ }
+ ph.add(service);
+ alternates.put(service.serviceType, ph);
}
}
- return presets;
- }
-
- public String getHost()
- {
- return hosturl;
- /*
- * try { URL serviceurl = new URL(hosturl); if (serviceurl.getPort()!=80)
- * { return serviceurl.getHost()+":"+serviceurl.getPort(); } return
- * serviceurl.getHost(); } catch (Exception e) {
- * System.err.println("Failed to parse service URL '" + hosturl +
- * "' as a valid URL!"); } return null;
- */
- }
-
- /**
- * @return short description of what the service will do
- */
- public String getActionText()
- {
- return "Align with " + serviceType;
- }
- /**
- * non-thread safe - blocks whilst accessing service to get complete set of
- * available options and parameters
- *
- * @return
- */
- public RunnerConfig getRunnerConfig()
- {
- return service.getRunnerOptions();
}
- @Override
- protected void finalize() throws Throwable
+ // create GUI element for classic services
+ addEnumeratedServices(jws2al, alignFrame, enumerableServices);
+ // and the instantaneous services
+ for (final Jws2Instance service : preferredHosts.values())
{
- if (service != null)
+ atpoint = JvSwingUtils.findOrCreateMenu(jws2al, service.action);
+ JMenuItem hitm;
+ if (atpoint.getItemCount() > 1)
{
- try
- {
- Closeable svc = (Closeable) service;
- service = null;
- svc.close();
- } catch (Exception e)
- {
- }
- ;
+ // previous service of this type already present
+ atpoint.addSeparator();
}
- super.finalize();
- }
-
- public ParamDatastoreI getParamStore()
- {
- if (paramStore == null)
+ atpoint.add(hitm = new JMenuItem(service.getHost()));
+ hitm.setForeground(Color.blue);
+ hitm.addActionListener(new ActionListener()
{
- try
- {
- paramStore = new JabaParamStore(this,
- (Desktop.instance != null ? Desktop
- .getUserParameterStore() : null));
- } catch (Exception ex)
+
+ @Override
+ public void actionPerformed(ActionEvent e)
{
+ Desktop.showUrl(service.getHost());
}
+ });
+ hitm.setToolTipText(JvSwingUtils.wrapTooltip(false,
+ MessageManager.getString("label.open_jabaws_web_page")));
- }
- return paramStore;
- }
-
- public String getUri()
- {
- // this is only valid for Jaba 1.0 - this formula might have to change!
- return hosturl
- + (hosturl.lastIndexOf("/") == (hosturl.length() - 1) ? ""
- : "/") + serviceType;
- }
-
- private boolean hasParams = false, lookedForParams = false;
-
- public boolean hasParameters()
- {
- if (!lookedForParams)
+ service.attachWSMenuEntry(atpoint, alignFrame);
+ if (alternates.containsKey(service.serviceType))
{
- lookedForParams = true;
- try
- {
- hasParams = (getRunnerConfig().getArguments().size() > 0);
- } catch (Exception e)
+ atpoint.add(hitm = new JMenu(MessageManager
+ .getString("label.switch_server")));
+ hitm.setToolTipText(JvSwingUtils.wrapTooltip(false,
+ MessageManager.getString("label.choose_jabaws_server")));
+ for (final Jws2Instance sv : alternates.get(service.serviceType))
{
+ JMenuItem itm;
+ hitm.add(itm = new JMenuItem(sv.getHost()));
+ itm.setForeground(Color.blue);
+ itm.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ setPreferredServiceFor(alignFrame, sv.serviceType,
+ sv.action, sv);
+ changeSupport.firePropertyChange("services",
+ new Vector(), services);
+ };
+ }).start();
+
+ }
+ });
}
+ /*
+ * hitm.addActionListener(new ActionListener() {
+ *
+ * @Override public void actionPerformed(ActionEvent arg0) { new
+ * Thread(new Runnable() {
+ *
+ * @Override public void run() { new SetPreferredServer(alignFrame,
+ * service.serviceType, service.action); } }).start(); } });
+ */
}
- return hasParams;
}
- };
+ }
/**
- * holds list of services.
+ * add services using the Java 2.5/2.6/2.7 system which optionally creates
+ * submenus to index by host and service program type
*/
- protected Vector<Jws2Instance> services;
-
- public void attachWSMenuEntry(JMenu wsmenu, final AlignFrame alignFrame)
- {
- // dynamically regenerate service list.
- final JMenu jws2al = wsmenu; // new JMenu("JABAWS Alignment");
- jws2al.addMenuListener(new MenuListener()
- {
- // TODO: future: add menu listener to parent menu - so submenus are
- // populated *before* they are selected.
- @Override
- public void menuSelected(MenuEvent e)
- {
- populateWSMenuEntry(jws2al, alignFrame);
- }
-
- @Override
- public void menuDeselected(MenuEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void menuCanceled(MenuEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- });
- wsmenu.add(jws2al);
-
- }
-
- private void populateWSMenuEntry(JMenu jws2al, final AlignFrame alignFrame)
+ private void addEnumeratedServices(final JMenu jws2al,
+ final AlignFrame alignFrame, List<Jws2Instance> enumerableServices)
{
- if (running || services == null || services.size() == 0)
- {
- return;
- }
boolean byhost = Cache.getDefault("WSMENU_BYHOST", false), bytype = Cache
.getDefault("WSMENU_BYTYPE", false);
/**
@@ -415,24 +482,22 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
*/
JMenu atpoint;
MsaWSClient msacl = new MsaWSClient();
- Vector hostLabels = new Vector();
- jws2al.removeAll();
- String lasthost = null;
+ List<String> hostLabels = new ArrayList<String>();
+ Hashtable<String, String> lasthostFor = new Hashtable<String, String>();
Hashtable<String, ArrayList<Jws2Instance>> hosts = new Hashtable<String, ArrayList<Jws2Instance>>();
- String[] sorton;
- for (Jws2Instance service : services)
+ ArrayList<String> hostlist = new ArrayList<String>();
+ for (Jws2Instance service : enumerableServices)
{
ArrayList<Jws2Instance> hostservices = hosts.get(service.getHost());
if (hostservices == null)
{
hosts.put(service.getHost(),
hostservices = new ArrayList<Jws2Instance>());
+ hostlist.add(service.getHost());
}
hostservices.add(service);
}
- sorton = hosts.keySet().toArray(new String[1]);
- String hostlist[] = sorton.clone();
- jalview.util.QuickSort.sort(sorton, hostlist);
+ // now add hosts in order of the given array
for (String host : hostlist)
{
Jws2Instance orderedsvcs[] = hosts.get(host).toArray(
@@ -445,14 +510,15 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
jalview.util.QuickSort.sort(sortbytype, orderedsvcs);
for (final Jws2Instance service : orderedsvcs)
{
- atpoint = jws2al;
+ atpoint = JvSwingUtils.findOrCreateMenu(jws2al, service.action);
String type = service.serviceType;
if (byhost)
{
atpoint = JvSwingUtils.findOrCreateMenu(atpoint, host);
if (atpoint.getToolTipText() == null)
{
- atpoint.setToolTipText("Services at " + host);
+ atpoint.setToolTipText(MessageManager.formatMessage(
+ "label.services_at", new String[] { host }));
}
}
if (bytype)
@@ -474,8 +540,16 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
// contiguous
// group
JMenuItem hitm;
- atpoint.addSeparator();
- if (lasthost == null || !lasthost.equals(host))
+ if (hostLabels.contains(host))
+ {
+ atpoint.addSeparator();
+ }
+ else
+ {
+ hostLabels.add(host);
+ }
+ if (lasthostFor.get(service.action) == null
+ || !lasthostFor.get(service.action).equals(host))
{
atpoint.add(hitm = new JMenuItem(host));
hitm.setForeground(Color.blue);
@@ -488,35 +562,30 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
Desktop.showUrl(service.getHost());
}
});
- hitm.setToolTipText(JvSwingUtils
- .wrapTooltip("Opens the JABAWS server's homepage in web browser"));
- lasthost = host;
+ hitm.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.open_jabaws_web_page")));
+ lasthostFor.put(service.action, host);
}
- hostLabels.addElement(host + service.serviceType
+ hostLabels.add(host + service.serviceType
+ service.getActionText());
- // hostLabels.addElement(host + (bytype ?
- // service.serviceType+service.getActionText() : ""));
}
- msacl.attachWSMenuEntry(atpoint, service, alignFrame);
- /*
- * JMenuItem sitem = new JMenuItem(service.serviceType);
- * sitem.setToolTipText("Hosted at " + service.hosturl);
- * sitem.addActionListener(new ActionListener() {
- *
- * @Override public void actionPerformed(ActionEvent e) { AlignmentView
- * msa = alignFrame.gatherSequencesForAlignment(); MsaWSClient client =
- * new MsaWSClient(service, "JWS2 Alignment of " +
- * alignFrame.getTitle(), msa, false, true,
- * alignFrame.getViewport().getAlignment().getDataset(), alignFrame); }
- * });
- */
+
+ service.attachWSMenuEntry(atpoint, alignFrame);
}
}
-
}
public static void main(String[] args)
{
+ if (args.length > 0)
+ {
+ testUrls = new ArrayList<String>();
+ for (String url : args)
+ {
+ testUrls.add(url);
+ }
+ ;
+ }
Thread runner = getDiscoverer().startDiscoverer(
new PropertyChangeListener()
{
@@ -527,6 +596,14 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
{
System.out.println("Changesupport: There are now "
+ getDiscoverer().services.size() + " services");
+ int i = 1;
+ for (Jws2Instance instance : getDiscoverer().services)
+ {
+ System.out.println("Service " + i++ + " "
+ + instance.getClass() + "@"
+ + instance.getHost() + ": "
+ + instance.getActionText());
+ }
}
}
@@ -541,10 +618,19 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
}
;
}
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
+ {
+ }
}
- private static Jws2Discoverer discoverer;
-
+ /**
+ * Returns the singleton instance of this class.
+ *
+ * @return
+ */
public static Jws2Discoverer getDiscoverer()
{
if (discoverer == null)
@@ -556,7 +642,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
public boolean hasServices()
{
- // TODO Auto-generated method stub
return !running && services != null && services.size() > 0;
}
@@ -565,24 +650,19 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
return running;
}
- /**
- * the jalview .properties entry for JWS2 URLS
- */
- final static String JWS2HOSTURLS = "JWS2HOSTURLS";
-
- public static void setServiceUrls(Vector<String> urls)
+ public void setServiceUrls(List<String> wsUrls)
{
- if (urls != null)
+ if (wsUrls != null && !wsUrls.isEmpty())
{
- StringBuffer urlbuffer = new StringBuffer();
+ StringBuilder urls = new StringBuilder(128);
String sep = "";
- for (String url : urls)
+ for (String url : wsUrls)
{
- urlbuffer.append(sep);
- urlbuffer.append(url);
+ urls.append(sep);
+ urls.append(url);
sep = ",";
}
- Cache.setProperty(JWS2HOSTURLS, urlbuffer.toString());
+ Cache.setProperty(JWS2HOSTURLS, urls.toString());
}
else
{
@@ -590,11 +670,27 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
}
}
- public static Vector<String> getServiceUrls()
+ /**
+ * Returns web service URLs, in the order in which they should be tried (or an
+ * empty list).
+ *
+ * @return
+ */
+ public List<String> getServiceUrls()
{
- String surls = Cache.getDefault(JWS2HOSTURLS,
- "http://www.compbio.dundee.ac.uk/jabaws");
- Vector<String> urls = new Vector<String>();
+ if (testUrls != null)
+ {
+ // return test urls, if there are any, instead of touching cache
+ return testUrls;
+ }
+ List<String> urls = new ArrayList<String>();
+
+ if (this.preferredUrl != null)
+ {
+ urls.add(preferredUrl);
+ }
+
+ String surls = Cache.getDefault(JWS2HOSTURLS, COMPBIO_JABAWS);
try
{
StringTokenizer st = new StringTokenizer(surls, ",");
@@ -603,40 +699,35 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
String url = null;
try
{
- java.net.URL u = new java.net.URL(url = st.nextToken());
+ url = st.nextToken();
+ new URL(url);
if (!urls.contains(url))
{
urls.add(url);
}
else
{
- jalview.bin.Cache.log.info("Ignoring duplicate url in "
+ Cache.log.warn("Ignoring duplicate url " + url + " in "
+ JWS2HOSTURLS + " list");
}
- } catch (Exception ex)
+ } catch (MalformedURLException ex)
{
- jalview.bin.Cache.log
- .warn("Problem whilst trying to make a URL from '"
- + ((url != null) ? url : "<null>") + "'");
- jalview.bin.Cache.log
+ Cache.log.warn("Problem whilst trying to make a URL from '"
+ + ((url != null) ? url : "<null>") + "'");
+ Cache.log
.warn("This was probably due to a malformed comma separated list"
+ " in the "
+ JWS2HOSTURLS
+ " entry of $(HOME)/.jalview_properties)");
- jalview.bin.Cache.log.debug("Exception was ", ex);
+ Cache.log.debug("Exception was ", ex);
}
}
} catch (Exception ex)
{
- jalview.bin.Cache.log.warn(
- "Error parsing comma separated list of urls in "
- + JWS2HOSTURLS + " preference.", ex);
- }
- if (urls.size() >= 0)
- {
- return urls;
+ Cache.log.warn("Error parsing comma separated list of urls in "
+ + JWS2HOSTURLS + " preference.", ex);
}
- return null;
+ return urls;
}
public Vector<Jws2Instance> getServices()
@@ -655,8 +746,8 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
{
try
{
- compbio.ws.client.WSTester.main(new String[]
- { "-h=" + foo.toString() });
+ compbio.ws.client.WSTester
+ .main(new String[] { "-h=" + foo.toString() });
} catch (Exception e)
{
e.printStackTrace();
@@ -694,8 +785,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
return thr;
}
- Vector<String> invalidServiceUrls = null, urlsWithoutServices = null;
-
/**
* @return the invalidServiceUrls
*/
@@ -764,7 +853,8 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
if (getInvalidServiceUrls() != null
&& getInvalidServiceUrls().size() > 0)
{
- ermsg.append("URLs that could not be contacted: \n");
+ ermsg.append(MessageManager.getString("warn.urls_not_contacted")
+ + ": \n");
for (String svcurl : getInvalidServiceUrls())
{
if (list)
@@ -780,7 +870,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
if (getUrlsWithoutServices() != null
&& getUrlsWithoutServices().size() > 0)
{
- ermsg.append("URLs without any JABA Services : \n");
+ ermsg.append(MessageManager.getString("warn.urls_no_jaba") + ": \n");
for (String svcurl : getUrlsWithoutServices())
{
if (list)
@@ -801,4 +891,144 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
return null;
}
+ public int getServerStatusFor(String url)
+ {
+ if (validServiceUrls != null && validServiceUrls.contains(url))
+ {
+ return 1;
+ }
+ if (urlsWithoutServices != null && urlsWithoutServices.contains(url))
+ {
+ return 0;
+ }
+ if (invalidServiceUrls != null && invalidServiceUrls.contains(url))
+ {
+ return -1;
+ }
+ return -2;
+ }
+
+ /**
+ * pick the user's preferred service based on a set of URLs (jaba server
+ * locations) and service URIs (specifying version and service interface
+ * class)
+ *
+ * @param serviceURL
+ * @return null or best match for given uri/ls.
+ */
+ public Jws2Instance getPreferredServiceFor(String[] serviceURLs)
+ {
+ HashSet<String> urls = new HashSet<String>();
+ urls.addAll(Arrays.asList(serviceURLs));
+ Jws2Instance match = null;
+ if (services != null)
+ {
+ for (Jws2Instance svc : services)
+ {
+ if (urls.contains(svc.getServiceTypeURI()))
+ {
+ if (match == null)
+ {
+ // for moment we always pick service from server ordered first in
+ // user's preferences
+ match = svc;
+ }
+ if (urls.contains(svc.getUri()))
+ {
+ // stop and return - we've matched type URI and URI for service
+ // endpoint
+ return svc;
+ }
+ }
+ }
+ }
+ return match;
+ }
+
+ Map<String, Map<String, String>> preferredServiceMap = new HashMap<String, Map<String, String>>();;
+
+ /**
+ * get current preferred service of the given type, or global default
+ *
+ * @param af
+ * null or a specific alignFrame
+ * @param serviceType
+ * Jws2Instance.serviceType for service
+ * @return null if no service of this type is available, the preferred service
+ * for the serviceType and af if specified and if defined.
+ */
+ public Jws2Instance getPreferredServiceFor(AlignFrame af,
+ String serviceType)
+ {
+ String serviceurl = null;
+ synchronized (preferredServiceMap)
+ {
+ String afid = (af == null) ? "" : af.getViewport().getSequenceSetId();
+ Map<String, String> prefmap = preferredServiceMap.get(afid);
+ if (afid.length() > 0 && prefmap == null)
+ {
+ // recover global setting, if any
+ prefmap = preferredServiceMap.get("");
+ }
+ if (prefmap != null)
+ {
+ serviceurl = prefmap.get(serviceType);
+ }
+
+ }
+ Jws2Instance response = null;
+ for (Jws2Instance svc : services)
+ {
+ if (svc.serviceType.equals(serviceType))
+ {
+ if (serviceurl == null || serviceurl.equals(svc.getHost()))
+ {
+ response = svc;
+ break;
+ }
+ }
+ }
+ return response;
+ }
+
+ public void setPreferredServiceFor(AlignFrame af, String serviceType,
+ String serviceAction, Jws2Instance selectedServer)
+ {
+ String afid = (af == null) ? "" : af.getViewport().getSequenceSetId();
+ if (preferredServiceMap == null)
+ {
+ preferredServiceMap = new HashMap<String, Map<String, String>>();
+ }
+ Map<String, String> prefmap = preferredServiceMap.get(afid);
+ if (prefmap == null)
+ {
+ prefmap = new HashMap<String, String>();
+ preferredServiceMap.put(afid, prefmap);
+ }
+ prefmap.put(serviceType, selectedServer.getHost());
+ prefmap.put(serviceAction, selectedServer.getHost());
+ }
+
+ public void setPreferredServiceFor(String serviceType,
+ String serviceAction, Jws2Instance selectedServer)
+ {
+ setPreferredServiceFor(null, serviceType, serviceAction, selectedServer);
+ }
+
+ /**
+ * Set a URL to try before any others. For use with command-line parameter to
+ * configure a local Jabaws installation without the need to add to property
+ * files.
+ *
+ * @param value
+ * @throws MalformedURLException
+ */
+ public void setPreferredUrl(String value) throws MalformedURLException
+ {
+ if (value != null && value.trim().length() > 0)
+ {
+ new URL(value);
+ preferredUrl = value;
+ }
+ }
}
diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java
index 4f6ce09..b961cfd 100644
--- a/src/jalview/ws/jws2/MsaWSClient.java
+++ b/src/jalview/ws/jws2/MsaWSClient.java
@@ -1,39 +1,47 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentView;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.util.ArrayList;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
import java.util.List;
-import javax.swing.*;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.ToolTipManager;
-import jalview.datamodel.*;
-import jalview.gui.*;
import compbio.data.msa.MsaWS;
import compbio.metadata.Argument;
-import compbio.metadata.Option;
-import compbio.metadata.Preset;
-import compbio.metadata.PresetManager;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
-import jalview.ws.jws2.dm.JabaWsParamSet;
-import jalview.ws.params.WsParamSetI;
/**
* DOCUMENT ME!
@@ -48,13 +56,7 @@ public class MsaWSClient extends Jws2Client
*/
MsaWS server;
- AlignFrame alignFrame;
-
- private WsParamSetI preset;
-
- private List<Argument> paramset;
-
- public MsaWSClient(Jws2Discoverer.Jws2Instance sh, String altitle,
+ public MsaWSClient(Jws2Instance sh, String altitle,
jalview.datamodel.AlignmentView msa, boolean submitGaps,
boolean preserveOrder, Alignment seqdataset,
AlignFrame _alignFrame)
@@ -64,9 +66,9 @@ public class MsaWSClient extends Jws2Client
// TODO Auto-generated constructor stub
}
- public MsaWSClient(Jws2Discoverer.Jws2Instance sh, WsParamSetI preset,
- String altitle, jalview.datamodel.AlignmentView msa,
- boolean submitGaps, boolean preserveOrder, Alignment seqdataset,
+ public MsaWSClient(Jws2Instance sh, WsParamSetI preset, String altitle,
+ jalview.datamodel.AlignmentView msa, boolean submitGaps,
+ boolean preserveOrder, Alignment seqdataset,
AlignFrame _alignFrame)
{
this(sh, preset, null, false, altitle, msa, submitGaps, preserveOrder,
@@ -90,98 +92,41 @@ public class MsaWSClient extends Jws2Client
* DOCUMENT ME!
*/
- public MsaWSClient(Jws2Discoverer.Jws2Instance sh, WsParamSetI preset,
+ public MsaWSClient(Jws2Instance sh, WsParamSetI preset,
List<Argument> arguments, boolean editParams, String altitle,
jalview.datamodel.AlignmentView msa, boolean submitGaps,
boolean preserveOrder, Alignment seqdataset,
AlignFrame _alignFrame)
{
- super();
- alignFrame = _alignFrame;
+ super(_alignFrame, preset, arguments);
+ if (!processParams(sh, editParams))
+ {
+ return;
+ }
+
if (!(sh.service instanceof MsaWS))
{
// redundant at mo - but may change
- JOptionPane
- .showMessageDialog(
- Desktop.desktop,
- "The Service called \n"
- + sh.serviceType
- + "\nis not a \nMultiple Sequence Alignment Service !",
- "Internal Jalview Error", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage("label.service_called_is_not_msa_service",
+ new String[] { sh.serviceType }), MessageManager
+ .getString("label.internal_jalview_error"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
- server = sh.service;
- this.preset=preset;
- if (preset != null)
- {
- if (!((preset instanceof JabaPreset) || preset instanceof JabaWsParamSet)) {
- /*{
- this.preset = ((JabaPreset) preset).p;
- }
- else if (preset instanceof JabaWsParamSet)
- {
- List<Argument> newargs = new ArrayList<Argument>();
- JabaWsParamSet pset = ((JabaWsParamSet) preset);
- for (Option opt : pset.getjabaArguments())
- {
- newargs.add(opt);
- }
- if (arguments != null && arguments.size() > 0)
- {
- // merge arguments with preset's own arguments.
- for (Argument opt : arguments)
- {
- newargs.add(opt);
- }
- }
- paramset = newargs;
- }
- else
- {*/
- throw new Error(
- "Implementation error: Can only instantiate Jaba parameter sets.");
- }
- }
- else
- {
- // just provided with a bunch of arguments
- this.paramset = arguments;
- }
- if (editParams)
- {
- if (sh.paramStore == null)
- {
- sh.paramStore = new JabaParamStore(sh,
- Desktop.getUserParameterStore());
- }
- WsJobParameters jobParams = new WsJobParameters(sh, preset);
- if (!jobParams.showRunDialog())
- {
- return;
- }
- WsParamSetI prset = jobParams.getPreset();
- if (prset == null)
- {
- paramset = JabaParamStore.getJabafromJwsArgs(jobParams
- .getJobParams());
- }
- else
- {
- this.preset = prset; // ((JabaPreset) prset).p;
- paramset = null; // no user supplied parameters.
- }
- }
-
+ server = (MsaWS) sh.service;
if ((wsInfo = setWebService(sh, false)) == null)
{
- JOptionPane.showMessageDialog(Desktop.desktop,
- "The Multiple Sequence Alignment Service named "
- + sh.serviceType + " is unknown",
- "Internal Jalview Error", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ .formatMessage("label.msa_service_is_unknown",
+ new String[] { sh.serviceType }), MessageManager
+ .getString("label.internal_jalview_error"),
+ JOptionPane.WARNING_MESSAGE);
return;
}
+
startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset);
}
@@ -227,8 +172,25 @@ public class MsaWSClient extends Jws2Client
MsaWSThread msathread = new MsaWSThread(server, preset, paramset,
WsURL, wsInfo, alignFrame, WebServiceName, jobtitle, msa,
submitGaps, preserveOrder, seqdataset);
- wsInfo.setthisService(msathread);
- msathread.start();
+ if (msathread.hasValidInput())
+ {
+ wsInfo.setthisService(msathread);
+ wsInfo.setVisible(true);
+ msathread.start();
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(alignFrame,
+ MessageManager.getString("info.invalid_msa_input_mininfo"),
+ MessageManager.getString("info.invalid_msa_notenough"),
+ JOptionPane.INFORMATION_MESSAGE);
+ wsInfo.setVisible(false);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ System.out.println("A".matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*"));
}
protected String getServiceActionKey()
@@ -257,6 +219,11 @@ public class MsaWSClient extends Jws2Client
public void attachWSMenuEntry(JMenu rmsawsmenu,
final Jws2Instance service, final AlignFrame alignFrame)
{
+ if (registerAAConWSInstance(rmsawsmenu, service, alignFrame))
+ {
+ // Alignment dependent analysis calculation WS gui
+ return;
+ }
setWebService(service, true); // headless
boolean finished = true, submitGaps = false;
JMenu msawsmenu = rmsawsmenu;
@@ -279,24 +246,33 @@ public class MsaWSClient extends Jws2Client
if (submitGaps == true)
{
action = "Realign ";
- msawsmenu = new JMenu("Realign with " + svcname);
- msawsmenu
- .setToolTipText("Align sequences to an existing alignment");
+ msawsmenu = new JMenu(MessageManager.formatMessage(
+ "label.realign_with_params", new String[] { svcname }));
+ msawsmenu.setToolTipText(MessageManager
+ .getString("label.align_sequences_to_existing_alignment"));
rmsawsmenu.add(msawsmenu);
}
final boolean withGaps = submitGaps;
- JMenuItem method = new JMenuItem(calcName + "with Defaults");
- method.setToolTipText(action + "with default settings");
+ JMenuItem method = new JMenuItem(MessageManager.formatMessage(
+ "label.calcname_with_default_settings",
+ new String[] { calcName }));
+ method.setToolTipText(MessageManager
+ .formatMessage("label.action_with_default_settings",
+ new String[] { action }));
method.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
- new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps,
- true, alignFrame.getViewport().getAlignment()
- .getDataset(), alignFrame);
+
+ if (msa != null)
+ {
+ new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps,
+ true, alignFrame.getViewport().getAlignment()
+ .getDataset(), alignFrame);
+ }
}
});
@@ -305,17 +281,23 @@ public class MsaWSClient extends Jws2Client
{
// only add these menu options if the service has user-modifiable
// arguments
- method = new JMenuItem("Edit settings and run ...");
- method.setToolTipText("View and change the parameters before alignment.");
+ method = new JMenuItem(
+ MessageManager.getString("label.edit_settings_and_run"));
+ method.setToolTipText(MessageManager
+ .getString("label.view_and_change_parameters_before_alignment"));
method.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
- new MsaWSClient(service, null, null, true, alignFrame
- .getTitle(), msa, withGaps, true, alignFrame
- .getViewport().getAlignment().getDataset(), alignFrame);
+ if (msa != null)
+ {
+ new MsaWSClient(service, null, null, true, alignFrame
+ .getTitle(), msa, withGaps, true, alignFrame
+ .getViewport().getAlignment().getDataset(),
+ alignFrame);
+ }
}
});
@@ -323,25 +305,59 @@ public class MsaWSClient extends Jws2Client
List<WsParamSetI> presets = service.getParamStore().getPresets();
if (presets != null && presets.size() > 0)
{
- JMenu presetlist = new JMenu("Run "+calcName + "with preset");
+ JMenu presetlist = new JMenu(
+ MessageManager.formatMessage(
+ "label.run_with_preset_params",
+ new String[] { calcName }));
+ final int showToolTipFor = ToolTipManager.sharedInstance()
+ .getDismissDelay();
for (final WsParamSetI preset : presets)
{
final JMenuItem methodR = new JMenuItem(preset.getName());
- methodR.setToolTipText("<html><p>"
- + JvSwingUtils.wrapTooltip("<strong>"
- + (preset.isModifiable() ? "User Preset"
- : "Service Preset") + "</strong><br/>"
- + preset.getDescription() + "</p>") + "</html>");
+ final int QUICK_TOOLTIP = 1500;
+ // JAL-1582 shorten tooltip display time in these menu items as
+ // they can obscure other options
+ methodR.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseEntered(MouseEvent e)
+ {
+ ToolTipManager.sharedInstance().setDismissDelay(
+ QUICK_TOOLTIP);
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e)
+ {
+ ToolTipManager.sharedInstance().setDismissDelay(
+ showToolTipFor);
+ }
+
+ });
+ methodR.setToolTipText(JvSwingUtils.wrapTooltip(
+ true,
+ "<p><strong>"
+ + (preset.isModifiable() ? MessageManager
+ .getString("label.user_preset")
+ : MessageManager
+ .getString("label.service_preset"))
+ + "</strong><br/>" + preset.getDescription()
+ + "</p>"));
methodR.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame
.gatherSequencesForAlignment();
- new MsaWSClient(service, preset, alignFrame.getTitle(),
- msa, false, true, alignFrame.getViewport()
- .getAlignment().getDataset(), alignFrame);
+
+ if (msa != null)
+ {
+ MsaWSClient msac = new MsaWSClient(service, preset,
+ alignFrame.getTitle(), msa, false, true,
+ alignFrame.getViewport().getAlignment()
+ .getDataset(), alignFrame);
+ }
}
diff --git a/src/jalview/ws/jws2/MsaWSThread.java b/src/jalview/ws/jws2/MsaWSThread.java
index 3ecba74..40e6de7 100644
--- a/src/jalview/ws/jws2/MsaWSThread.java
+++ b/src/jalview/ws/jws2/MsaWSThread.java
@@ -1,42 +1,59 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
-import java.util.*;
+import jalview.analysis.AlignSeq;
+import jalview.bin.Cache;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentOrder;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.SplitFrame;
+import jalview.gui.WebserviceInfo;
+import jalview.util.MessageManager;
+import jalview.ws.AWsJob;
+import jalview.ws.JobStateSummary;
+import jalview.ws.WSClientI;
+import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.swing.JInternalFrame;
import compbio.data.msa.MsaWS;
-import compbio.data.sequence.AlignmentMetadata;
-import compbio.data.sequence.Program;
import compbio.metadata.Argument;
import compbio.metadata.ChunkHolder;
import compbio.metadata.JobStatus;
import compbio.metadata.Preset;
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
-import jalview.ws.AWsJob;
-import jalview.ws.WSClientI;
-import jalview.ws.JobStateSummary;
-import jalview.ws.jws2.dm.JabaWsParamSet;
-import jalview.ws.params.WsParamSetI;
-
class MsaWSThread extends AWS2Thread implements WSClientI
{
boolean submitGaps = false; // pass sequences including gaps to alignment
@@ -109,7 +126,8 @@ class MsaWSThread extends AWS2Thread implements WSClientI
if (minlen < 0)
{
throw new Error(
- "Implementation error: minlen must be zero or more.");
+ MessageManager
+ .getString("error.implementation_error_minlen_must_be_greater_zero"));
}
for (int i = 0; i < seqs.length; i++)
{
@@ -148,8 +166,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
.extractGaps(jalview.util.Comparison.GapChars,
seqs[i].getSequenceAsString());
}
- emptySeqs.add(new String[]
- { newname, empty });
+ emptySeqs.add(new String[] { newname, empty });
}
}
return valid;
@@ -220,7 +237,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
int ow = w, nw = w;
for (i = 0, w = emptySeqs.size(); i < w; i++)
{
- String[] es = (String[]) emptySeqs.get(i);
+ String[] es = emptySeqs.get(i);
if (es != null && es[1] != null)
{
int sw = es[1].length();
@@ -251,7 +268,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
}
for (i = 0, w = emptySeqs.size(); i < w; i++)
{
- String[] es = (String[]) emptySeqs.get(i);
+ String[] es = emptySeqs.get(i);
if (es[1] == null)
{
t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence(es[0],
@@ -280,8 +297,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
jalview.analysis.AlignmentSorter.recoverOrder(alseqs);
// account for any missing sequences
jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs);
- return new Object[]
- { alseqs, msaorder };
+ return new Object[] { alseqs, msaorder };
}
return null;
}
@@ -435,7 +451,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
* @param presorder
* boolean
*/
- MsaWSThread(MsaWS server, String wsUrl, WebserviceInfo wsinfo,
+ private MsaWSThread(MsaWS server, String wsUrl, WebserviceInfo wsinfo,
jalview.gui.AlignFrame alFrame, AlignmentView alview,
String wsname, boolean subgaps, boolean presorder)
{
@@ -473,7 +489,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
SequenceI[][] conmsa = _msa.getVisibleContigs('-');
if (conmsa != null)
{
- int njobs = conmsa.length;
+ int nvalid = 0, njobs = conmsa.length;
jobs = new MsaWSJob[njobs];
for (int j = 0; j < njobs; j++)
{
@@ -485,6 +501,10 @@ class MsaWSThread extends AWS2Thread implements WSClientI
{
jobs[j] = new MsaWSJob(0, conmsa[j]);
}
+ if (((MsaWSJob) jobs[j]).hasValidInput())
+ {
+ nvalid++;
+ }
((MsaWSJob) jobs[j]).preset = preset;
((MsaWSJob) jobs[j]).arguments = paramset;
((MsaWSJob) jobs[j]).alignmentProgram = wsname;
@@ -495,9 +515,21 @@ class MsaWSThread extends AWS2Thread implements WSClientI
}
wsinfo.setProgressText(jobs[j].getJobnum(), OutputHeader);
}
+ validInput = nvalid > 0;
}
}
+ boolean validInput = false;
+
+ /**
+ *
+ * @return true if the thread will perform a calculation
+ */
+ public boolean hasValidInput()
+ {
+ return validInput;
+ }
+
public boolean isCancellable()
{
return true;
@@ -516,7 +548,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
try
{
boolean cancelledJob = server.cancelJob(jobs[job].getJobId());
- if (cancelledJob || true)
+ if (true) // cancelledJob || true)
{
// CANCELLED_JOB
// if the Jaba server indicates the job can't be cancelled, its
@@ -547,6 +579,14 @@ class MsaWSThread extends AWS2Thread implements WSClientI
wsInfo.setProgressText(jobs[job].getJobnum(), OutputHeader
+ cancelledMessage + "\n");
}
+ else
+ {
+ // if we hadn't submitted then just mark the job as cancelled.
+ jobs[job].setSubjobComplete(true);
+ wsInfo.setStatus(jobs[job].getJobnum(),
+ WebserviceInfo.STATE_CANCELLED_OK);
+
+ }
}
if (cancelled)
{
@@ -586,7 +626,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
{
StringBuffer response = j.jobProgress;
long lastchunk = j.getLastChunk();
- boolean changed=false;
+ boolean changed = false;
do
{
j.setLastChunk(lastchunk);
@@ -594,9 +634,16 @@ class MsaWSThread extends AWS2Thread implements WSClientI
.pullExecStatistics(j.getJobId(), lastchunk);
if (chunk != null)
{
- changed=chunk.getChunk().length()>0;
+ changed |= chunk.getChunk().length() > 0;
response.append(chunk.getChunk());
lastchunk = chunk.getNextPosition();
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
+ {
+ }
+ ;
}
;
} while (lastchunk >= 0 && j.getLastChunk() != lastchunk);
@@ -609,8 +656,9 @@ class MsaWSThread extends AWS2Thread implements WSClientI
// boiler plate template
if (!(job instanceof MsaWSJob))
{
- throw new Error("StartJob(MsaWSJob) called on a WSJobInstance "
- + job.getClass());
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_msawbjob_called",
+ new String[] { job.getClass().toString() }));
}
MsaWSJob j = (MsaWSJob) job;
if (j.isSubmitted())
@@ -628,7 +676,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
{
// special case - selection consisted entirely of empty sequences...
j.setjobStatus(JobStatus.FINISHED);
- j.setStatus("Empty Alignment Job");
+ j.setStatus(MessageManager.getString("label.empty_alignment_job"));
}
try
{
@@ -640,7 +688,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
}
else if (j.hasArguments())
{
- j.setJobId(server.customAlign(j.seqs,j.getJabaArguments()));
+ j.setJobId(server.customAlign(j.seqs, j.getJabaArguments()));
}
else
{
@@ -656,35 +704,39 @@ class MsaWSThread extends AWS2Thread implements WSClientI
}
else
{
- throw new Exception(
- "Server at "
- + WsUrl
- + " returned null string for job id, it probably cannot be contacted. Try again later ?");
+ throw new Exception(MessageManager.formatMessage(
+ "exception.web_service_returned_null_try_later",
+ new String[] { WsUrl }));
}
} catch (compbio.metadata.UnsupportedRuntimeException _lex)
{
lex = _lex;
- wsInfo.appendProgressText("Job could not be run because the server doesn't support this program.\n"
- + _lex.getMessage());
- wsInfo.warnUser(_lex.getMessage(), "Service not supported!");
+ wsInfo.appendProgressText(MessageManager.formatMessage(
+ "info.job_couldnt_be_run_server_doesnt_support_program",
+ new String[] { _lex.getMessage() }));
+ wsInfo.warnUser(_lex.getMessage(),
+ MessageManager.getString("warn.service_not_supported"));
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
wsInfo.setStatus(j.getJobnum(),
WebserviceInfo.STATE_STOPPED_SERVERERROR);
} catch (compbio.metadata.LimitExceededException _lex)
{
lex = _lex;
- wsInfo.appendProgressText("Job could not be run because it exceeded a hard limit on the server.\n"
- + _lex.getMessage());
- wsInfo.warnUser(_lex.getMessage(), "Input is too big!");
+ wsInfo.appendProgressText(MessageManager.formatMessage(
+ "info.job_couldnt_be_run_exceeded_hard_limit",
+ new String[] { _lex.getMessage() }));
+ wsInfo.warnUser(_lex.getMessage(),
+ MessageManager.getString("warn.input_is_too_big"));
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
wsInfo.setStatus(j.getJobnum(), WebserviceInfo.STATE_STOPPED_ERROR);
} catch (compbio.metadata.WrongParameterException _lex)
{
lex = _lex;
- wsInfo.warnUser(_lex.getMessage(), "Invalid job parameter set!");
- wsInfo.appendProgressText("Job could not be run because some of the parameter settings are not supported by the server.\n"
- + _lex.getMessage()
- + "\nPlease check to make sure you have used the correct parameter set for this service!\n");
+ wsInfo.warnUser(_lex.getMessage(),
+ MessageManager.getString("warn.invalid_job_param_set"));
+ wsInfo.appendProgressText(MessageManager.formatMessage(
+ "info.job_couldnt_be_run_incorrect_param_setting",
+ new String[] { _lex.getMessage() }));
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
wsInfo.setStatus(j.getJobnum(), WebserviceInfo.STATE_STOPPED_ERROR);
} catch (Error e)
@@ -717,15 +769,18 @@ class MsaWSThread extends AWS2Thread implements WSClientI
// TODO: JBPNote catch timeout or other fault types explicitly
j.setAllowedServerExceptions(0);
- wsInfo.appendProgressText(j.getJobnum(),
- "Failed to submit sequences for alignment.\n"
- + "Just close the window\n");
+ wsInfo.appendProgressText(j.getJobnum(), MessageManager
+ .getString("info.failed_to_submit_sequences_for_alignment"));
}
}
}
public void parseResult()
{
+ long progbar = System.currentTimeMillis();
+ wsInfo.setProgressBar(
+ MessageManager.getString("status.collecting_job_results"),
+ progbar);
int results = 0; // number of result sets received
JobStateSummary finalState = new JobStateSummary();
try
@@ -735,40 +790,45 @@ class MsaWSThread extends AWS2Thread implements WSClientI
MsaWSJob msjob = ((MsaWSJob) jobs[j]);
if (jobs[j].isFinished() && msjob.alignment == null)
{
- boolean jpchanged=false,jpex=false;
- do {
+ int nunchanged = 3, nexcept = 3;
+ boolean jpchanged = false, jpex = false;
+ do
+ {
try
{
jpchanged = updateJobProgress(msjob);
- jpex=false;
+ jpex = false;
+ if (jpchanged)
+ {
+ nexcept = 3;
+ }
} catch (Exception e)
{
-
+
Cache.log
.warn("Exception when retrieving remaining Job progress data for job "
+ msjob.getJobId() + " on server " + WsUrl);
e.printStackTrace();
- if (jpex) {
- // give up polling after two consecutive exceptions
- jpchanged=false;
- } else {
- jpchanged=true;
- }
+ nexcept--;
+ nunchanged = 3;
// set flag remember that we've had an exception.
- jpex=true;
+ jpex = true;
+ jpchanged = false;
}
- if (jpchanged)
+ if (!jpchanged)
{
try
{
- Thread.sleep(jpex ? 400 : 200); // wait a bit longer if we experienced an exception.
+ Thread.sleep(jpex ? 2400 : 1200); // wait a bit longer if we
+ // experienced an exception.
} catch (Exception ex)
{
}
;
+ nunchanged--;
}
- } while (jpchanged);
-
+ } while (nunchanged > 0 && nexcept > 0);
+
if (Cache.log.isDebugEnabled())
{
System.out.println("Job Execution file for job: "
@@ -787,6 +847,9 @@ class MsaWSThread extends AWS2Thread implements WSClientI
Cache.log
.debug("Results not available for finished job - marking as broken job.",
e);
+ msjob.jobProgress
+ .append("\nResult not available. Probably due to invalid input or parameter settings. Server error message below:\n\n"
+ + e.getLocalizedMessage());
msjob.setjobStatus(JobStatus.FAILED);
} catch (Exception e)
{
@@ -843,15 +906,22 @@ class MsaWSThread extends AWS2Thread implements WSClientI
}
else
{
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
wsInfo.setFinishedNoResults();
}
+ updateGlobalStatus(finalState);
+ wsInfo.setProgressBar(null, progbar);
}
+ /**
+ * Display alignment results in a new frame (or - not currently supported -
+ * added to an existing alignment).
+ *
+ * @param newFrame
+ */
void displayResults(boolean newFrame)
{
// view input or result data for each block
- Vector alorders = new Vector();
+ List<AlignmentOrder> alorders = new ArrayList<AlignmentOrder>();
SequenceI[][] results = new SequenceI[jobs.length][];
AlignmentOrder[] orders = new AlignmentOrder[jobs.length];
String lastProgram = null;
@@ -863,7 +933,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
msjob = (MsaWSJob) jobs[j];
Object[] res = msjob.getAlignment();
lastProgram = msjob.getAlignmentProgram();
- alorders.add(res[1]);
+ alorders.add((AlignmentOrder) res[1]);
results[j] = (SequenceI[]) res[0];
orders[j] = (AlignmentOrder) res[1];
@@ -900,71 +970,134 @@ class MsaWSThread extends AWS2Thread implements WSClientI
if (newFrame)
{
- AlignFrame af = new AlignFrame(al, columnselection,
- AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ displayInNewFrame(al, alorders, columnselection);
- // initialise with same renderer settings as in parent alignframe.
- af.getFeatureRenderer().transferSettings(this.featureSettings);
- // update orders
- if (alorders.size() > 0)
- {
- if (alorders.size() == 1)
- {
- af.addSortByOrderMenuItem(WebServiceName + " Ordering",
- (AlignmentOrder) alorders.get(0));
- }
- else
- {
- // construct a non-redundant ordering set
- Vector names = new Vector();
- for (int i = 0, l = alorders.size(); i < l; i++)
- {
- String orderName = new String(" Region " + i);
- int j = i + 1;
+ }
+ else
+ {
+ // TODO 2.9.x feature
+ System.out.println("MERGE WITH OLD FRAME");
+ // TODO: modify alignment in original frame, replacing old for new
+ // alignment using the commands.EditCommand model to ensure the update can
+ // be undone
+ }
+ }
- while (j < l)
- {
- if (((AlignmentOrder) alorders.get(i))
- .equals(((AlignmentOrder) alorders.get(j))))
- {
- alorders.remove(j);
- l--;
- orderName += "," + j;
- }
- else
- {
- j++;
- }
- }
+ /**
+ * Display the alignment result in a new frame.
+ *
+ * @param al
+ * @param alorders
+ * @param columnselection
+ */
+ protected void displayInNewFrame(AlignmentI al,
+ List<AlignmentOrder> alorders, ColumnSelection columnselection)
+ {
+ AlignFrame af = new AlignFrame(al, columnselection,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
- if (i == 0 && j == 1)
- {
- names.add(new String(""));
- }
- else
- {
- names.add(orderName);
- }
- }
- for (int i = 0, l = alorders.size(); i < l; i++)
- {
- af.addSortByOrderMenuItem(
- WebServiceName + ((String) names.get(i)) + " Ordering",
- (AlignmentOrder) alorders.get(i));
- }
- }
+ // initialise with same renderer settings as in parent alignframe.
+ af.getFeatureRenderer().transferSettings(this.featureSettings);
+
+ if (alorders.size() > 0)
+ {
+ addSortByMenuItems(af, alorders);
+ }
+
+ // TODO: refactor retrieve and show as new splitFrame as Desktop method
+
+ /*
+ * If alignment was requested from one half of a SplitFrame, show in a
+ * SplitFrame with the other pane similarly aligned.
+ */
+ AlignFrame requestedBy = getRequestingAlignFrame();
+ if (requestedBy != null
+ && requestedBy.getSplitViewContainer() != null
+ && requestedBy.getSplitViewContainer().getComplement(
+ requestedBy) != null)
+ {
+ AlignmentI complement = requestedBy.getSplitViewContainer()
+ .getComplement(requestedBy);
+ String complementTitle = requestedBy.getSplitViewContainer()
+ .getComplementTitle(requestedBy);
+ // becomes null if the alignment window was closed before the alignment
+ // job finished.
+ AlignmentI copyComplement = new Alignment(complement);
+ copyComplement.alignAs(al);
+ if (copyComplement.getHeight() > 0)
+ {
+ af.setTitle(alTitle);
+ AlignFrame af2 = new AlignFrame(copyComplement,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ af2.setTitle(complementTitle);
+ String linkedTitle = MessageManager
+ .getString("label.linked_view_title");
+ JInternalFrame splitFrame = new SplitFrame(al.isNucleotide() ? af
+ : af2, al.isNucleotide() ? af2 : af);
+ Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
+ return;
}
+ }
- Desktop.addInternalFrame(af, alTitle, AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
+ /*
+ * Not from SplitFrame, or failed to created a complementary alignment
+ */
+ Desktop.addInternalFrame(af, alTitle, AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+ }
+ /**
+ * Add sort order options to the AlignFrame menus.
+ *
+ * @param af
+ * @param alorders
+ */
+ protected void addSortByMenuItems(AlignFrame af,
+ List<AlignmentOrder> alorders)
+ {
+ // update orders
+ if (alorders.size() == 1)
+ {
+ af.addSortByOrderMenuItem(WebServiceName + " Ordering",
+ alorders.get(0));
}
else
{
- System.out.println("MERGE WITH OLD FRAME");
- // TODO: modify alignment in original frame, replacing old for new
- // alignment using the commands.EditCommand model to ensure the update can
- // be undone
+ // construct a non-redundant ordering set
+ List<String> names = new ArrayList<String>();
+ for (int i = 0, l = alorders.size(); i < l; i++)
+ {
+ String orderName = " Region " + i;
+ int j = i + 1;
+
+ while (j < l)
+ {
+ if (alorders.get(i).equals(alorders.get(j)))
+ {
+ alorders.remove(j);
+ l--;
+ orderName += "," + j;
+ }
+ else
+ {
+ j++;
+ }
+ }
+
+ if (i == 0 && j == 1)
+ {
+ names.add("");
+ }
+ else
+ {
+ names.add(orderName);
+ }
+ }
+ for (int i = 0, l = alorders.size(); i < l; i++)
+ {
+ af.addSortByOrderMenuItem(WebServiceName + (names.get(i))
+ + " Ordering", alorders.get(i));
+ }
}
}
diff --git a/src/jalview/ws/jws2/ParameterUtils.java b/src/jalview/ws/jws2/ParameterUtils.java
index c4e1ca8..99a0d2c 100644
--- a/src/jalview/ws/jws2/ParameterUtils.java
+++ b/src/jalview/ws/jws2/ParameterUtils.java
@@ -1,30 +1,36 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
+import jalview.util.MessageManager;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import compbio.metadata.*;
+import compbio.metadata.Option;
+import compbio.metadata.Parameter;
+import compbio.metadata.RunnerConfig;
+import compbio.metadata.ValueConstrain;
+import compbio.metadata.WrongParameterException;
public class ParameterUtils
{
@@ -129,6 +135,7 @@ public class ParameterUtils
{
copy.setName(option.getName());
copy.setDescription(option.getDescription());
+ copy.setBasicURL(option.getBasicURL());
copy.setFurtherDetails(option.getFurtherDetails());
copy.setRequired(option.isRequired());
List<String> names = option.getOptionNames();
@@ -142,8 +149,7 @@ public class ParameterUtils
}
else
{
- copy.addOptionNames(names.toArray(new String[]
- {}));
+ copy.addOptionNames(names.toArray(new String[] {}));
}
}
try
@@ -180,7 +186,8 @@ public class ParameterUtils
{
e.printStackTrace();
throw new Error(
- "Implementation error: could not copy ValueConstrain!");
+ MessageManager
+ .getString("error.implementation_error_couldnt_copy_value_constraint"));
}
}
@@ -195,8 +202,7 @@ public class ParameterUtils
List<String> pv = parameter.getPossibleValues();
if (pv != null)
{
- copy.addPossibleValues(pv.toArray(new String[]
- {}));
+ copy.addPossibleValues(pv.toArray(new String[] {}));
}
setOptionFrom(copy, parameter);
return copy;
diff --git a/src/jalview/ws/jws2/RNAalifoldClient.java b/src/jalview/ws/jws2/RNAalifoldClient.java
new file mode 100644
index 0000000..769100e
--- /dev/null
+++ b/src/jalview/ws/jws2/RNAalifoldClient.java
@@ -0,0 +1,405 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2;
+
+import jalview.api.AlignCalcWorkerI;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.gui.AlignFrame;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+import jalview.ws.uimodel.AlignAnalysisUIText;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.TreeSet;
+import java.util.regex.Pattern;
+
+import compbio.data.sequence.FastaSequence;
+import compbio.data.sequence.RNAStructReader.AlifoldResult;
+import compbio.data.sequence.RNAStructScoreManager;
+import compbio.data.sequence.Range;
+import compbio.data.sequence.Score;
+import compbio.metadata.Argument;
+
+/**
+ * Client for the JABA RNA Alifold Service
+ *
+ * @author daluke - Daniel Barton
+ *
+ */
+
+public class RNAalifoldClient extends JabawsCalcWorker implements
+ AlignCalcWorkerI
+{
+
+ String methodName;
+
+ AlignFrame af;
+
+ // keeps track of whether the RNAalifold result includes base contact
+ // probabilities
+ boolean bpScores;
+
+ public RNAalifoldClient(Jws2Instance sh, AlignFrame alignFrame,
+ WsParamSetI preset, List<Argument> paramset)
+ {
+ super(sh, alignFrame, preset, paramset);
+ af = alignFrame;
+ methodName = sh.serviceType;
+ alignedSeqs = true;
+ submitGaps = true;
+ nucleotidesAllowed = true;
+ proteinAllowed = false;
+ initViewportParams();
+ }
+
+ public String getCalcId()
+ {
+ return CALC_ID;
+ }
+
+ private static String CALC_ID = "jalview.ws.jws2.RNAalifoldClient";
+
+ public static AlignAnalysisUIText getAlignAnalysisUITest()
+ {
+ return new AlignAnalysisUIText(
+ compbio.ws.client.Services.RNAalifoldWS.toString(),
+ jalview.ws.jws2.RNAalifoldClient.class, CALC_ID, true, false,
+ true, MessageManager.getString("label.rnalifold_calculations"),
+ MessageManager.getString("tooltip.rnalifold_calculations"),
+ MessageManager.getString("label.rnalifold_settings"),
+ MessageManager.getString("tooltip.rnalifold_settings"));
+ }
+
+ @Override
+ public String getServiceActionText()
+ {
+ return "Submitting RNA alignment for Secondary Structure prediction using "
+ + "RNAalifold Service";
+ }
+
+ @Override
+ boolean checkValidInputSeqs(boolean dynamic, List<FastaSequence> seqs)
+ {
+ return (seqs.size() > 1);
+ }
+
+ @Override
+ public void updateResultAnnotation(boolean immediate)
+ {
+
+ if (immediate || !calcMan.isWorking(this) && scoremanager != null)
+ {
+
+ List<AlignmentAnnotation> ourAnnot = new ArrayList<AlignmentAnnotation>();
+
+ // Unpack the ScoreManager
+ List<String> structs = ((RNAStructScoreManager) scoremanager)
+ .getStructs();
+ List<TreeSet<Score>> data = ((RNAStructScoreManager) scoremanager)
+ .getData();
+
+ // test to see if this data object contains base pair contacts
+ Score fscore = data.get(0).first();
+ this.bpScores = (fscore.getMethod()
+ .equals(AlifoldResult.contactProbabilities.toString()));
+
+ // add annotation for the consensus sequence alignment
+ createAnnotationRowforScoreHolder(ourAnnot, getCalcId(),
+ structs.get(0), null, null);
+
+ // Add annotations for the mfe Structure
+ createAnnotationRowforScoreHolder(ourAnnot, getCalcId(),
+ structs.get(1), data.get(1), null);
+
+ // decide whether to add base pair contact probability histogram
+ int count = 2;
+ if (bpScores)
+ {
+ createAnnotationRowforScoreHolder(ourAnnot, getCalcId(),
+ structs.get(2), data.get(0), data.get(2));
+ count++;
+ }
+
+ // Now loop for the rest of the Annotations (if there it isn't stochastic
+ // output
+ // only the centroid and MEA structures remain anyway)
+ for (int i = count; i < structs.size(); i++)
+ {
+ // The ensemble values should be displayed in the description of the
+ // first (or all?) Stochastic Backtrack Structures.
+ if (!data.get(i).first().getMethod()
+ .equals(AlifoldResult.ensembleValues.toString()))
+ {
+
+ createAnnotationRowforScoreHolder(ourAnnot, getCalcId(),
+ structs.get(i), data.get(i), null);
+ }
+ }
+
+ if (ourAnnot.size() > 0)
+ {
+
+ updateOurAnnots(ourAnnot);
+ ap.adjustAnnotationHeight();
+ }
+ }
+ }
+
+ protected void createAnnotationRowforScoreHolder(
+ List<AlignmentAnnotation> ourAnnot, String calcId, String struct,
+ TreeSet<Score> data, TreeSet<Score> descriptionData)
+ {
+ /*
+ * If contactProbability information is returned from RNAalifold it is
+ * stored in the first TreeSet<Score> object corresponding to the String Id
+ * which holds the consensus alignment. The method enumeration is then
+ * updated to AlifoldResult.contactProbabilties. This line recreates the
+ * same data object as was overwritten with the contact probabilites data.
+ */
+ if (data == null)
+ {
+ data = compbio.data.sequence.RNAStructReader
+ .newEmptyScore(AlifoldResult.consensusAlignment);
+ }
+
+ if (descriptionData == null)
+ {
+ descriptionData = data;
+ }
+
+ String[] typenameAndDescription = constructTypenameAndDescription(descriptionData
+ .first());
+ String typename = typenameAndDescription[0];
+ String description = typenameAndDescription[1];
+
+ AlignmentAnnotation annotation = alignViewport.getAlignment()
+ .findOrCreateAnnotation(typename, calcId, false, null, null);
+
+ constructAnnotationFromScoreHolder(annotation, struct, data);
+
+ /*
+ * update annotation description with the free Energy, frequency in ensemble
+ * or other data where appropriate.
+ *
+ * Doesnt deal with AlifoldResult.ensembleValues, the free energy of
+ * ensemble and frequency of mfe structure in ensemble. How to deal with
+ * these?
+ */
+ annotation.description = description;
+
+ annotation.belowAlignment = false;
+ // annotation.showAllColLabels = true;
+
+ alignViewport.getAlignment().validateAnnotation(annotation);
+ af.setMenusForViewport();
+
+ ourAnnot.add(annotation);
+ }
+
+ private AlignmentAnnotation constructAnnotationFromScoreHolder(
+ AlignmentAnnotation annotation, String struct, TreeSet<Score> data)
+ {
+ Annotation[] anns = new Annotation[gapMap != null ? gapMap.length + 1
+ : struct.length()];
+
+ if (data != null
+ && data.size() > 1
+ && data.first().getMethod()
+ .equals(AlifoldResult.contactProbabilities.toString()))
+ {
+
+ // The base pair probabilities are stored in a set in scoreholder. we want
+ // a map
+ LinkedHashMap<Range, Float> basePairs = new LinkedHashMap<Range, Float>();
+ for (Score score : data)
+ {
+ // The Score objects contain a set of size one containing the range and
+ // an ArrayList<float> of size one containing the probabilty
+ basePairs.put(score.getRanges().first(), new Float(score
+ .getScores().get(0)));
+ }
+
+ for (int i = 0, ri = 0, iEnd = struct.length(); i < iEnd; i++, ri++)
+ {
+ if (gapMap != null)
+ {
+ // skip any gapped columns in the input data
+ while (!gapMap[ri])
+ {
+ ri++;
+ }
+ }
+ // Return all the contacts associated with position i
+ LinkedHashMap<Range, Float> contacts = isContact(basePairs, i + 1);
+
+ String description = "";
+ float prob = 0f;
+
+ if (contacts.size() == 0)
+ {
+ description = "No Data";
+ }
+ else
+ {
+ for (Range contact : contacts.keySet())
+ {
+ float t = contacts.get(contact);
+ if (t > prob)
+ {
+ prob = t;
+ }
+ description += Integer.toString(contact.from) + "->"
+ + Integer.toString(contact.to) + ": "
+ + Float.toString(t) + "% | ";
+ }
+ }
+
+ anns[ri] = new Annotation(struct.substring(i, i + 1), description,
+ isSS(struct.charAt(i)), prob);
+ }
+ }
+ else if (data == null || data.size() == 1)
+ {
+ for (int i = 0, ri = 0, iEnd = struct.length(); i < iEnd; i++, ri++)
+ {
+ if (gapMap != null)
+ {
+ // skip any gapped columns in the input data
+ while (!gapMap[ri] && ri < gapMap.length)
+ {
+ ri++;
+ }
+ if (ri == gapMap.length)
+ {
+ break;
+ }
+ }
+ anns[ri] = new Annotation(struct.substring(i, i + 1), "",
+ isSS(struct.charAt(i)), Float.NaN);
+ }
+
+ annotation.graph = 0; // No graph
+ }
+
+ annotation.annotations = anns;
+
+ return annotation;
+ }
+
+ private String[] constructTypenameAndDescription(Score score)
+ {
+ String description = "";
+ String typename = "";
+ String datatype = score.getMethod();
+
+ // Look up java switch syntax and use one here
+ if (datatype.equals(AlifoldResult.mfeStructure.toString()))
+ {
+
+ description = MessageFormat.format(
+ "Minimum Free Energy Structure. Energy: {0} = {1} + {2}",
+ score.getScores().get(0), score.getScores().get(1), score
+ .getScores().get(2));
+ typename = "MFE Structure";
+ }
+ else if (datatype.equals(AlifoldResult.contactProbabilityStructure
+ .toString()))
+ {
+ description = MessageFormat
+ .format("Base Pair Contact Probabilities. "
+ + "Energy of Ensemble: {0} Frequency of Ensemble: {1}",
+ score.getScores().get(0), score.getScores().get(1));
+ typename = "Contact Probabilities";
+ }
+ else if (datatype.equals(AlifoldResult.centroidStructure.toString()))
+ {
+ description = MessageFormat.format(
+ "Centroid Structure. Energy: {0} = {1} + {2}", score
+ .getScores().get(0), score.getScores().get(1), score
+ .getScores().get(2));
+ typename = "Centroid Structure";
+ }
+ else if (datatype.equals(AlifoldResult.stochBTStructure.toString()))
+ {
+ if (score.getScores().size() > 0)
+ {
+ description = MessageFormat.format("Probability: {0} Energy: {1}",
+ score.getScores().get(0), score.getScores().get(1));
+ }
+ else
+ {
+ description = "Stochastic Backtrack Structure";
+ }
+ }
+ else if (datatype.equals(AlifoldResult.MEAStucture.toString()))
+ {
+ description = MessageFormat.format(
+ "Maximum Expected Accuracy Values: '{' {0} MEA={1} '}", score
+ .getScores().get(0), score.getScores().get(1));
+ typename = "MEA Structure";
+ }
+ else if (datatype.equals(AlifoldResult.consensusAlignment.toString()))
+ {
+ typename = "RNAalifold Consensus";
+ description = "Consensus Alignment Produced by RNAalifold";
+ }
+ else
+ {
+ typename = datatype;
+ description = typename;
+ }
+
+ return new String[] { typename, description };
+ }
+
+ // Check whether, at position i there is a base contact and return all the
+ // contacts at this position. Should be in order of descending probability.
+ private LinkedHashMap<Range, Float> isContact(
+ LinkedHashMap<Range, Float> basePairs, int i)
+ {
+ LinkedHashMap<Range, Float> contacts = new LinkedHashMap<Range, Float>();
+
+ for (Range contact : basePairs.keySet())
+ {
+ // finds the contacts associtated with position i ordered by the natural
+ // ordering of the Scores TreeSet in ScoreManager which is, descending
+ // probability
+ if (contact.from == i || contact.to == i)
+ {
+ contacts.put(contact, basePairs.get(contact));
+ }
+ }
+
+ return contacts;
+ }
+
+ private char isSS(char chr)
+ {
+ String regex = "\\(|\\)|\\{|\\}|\\[|\\]";
+ char ss = (Pattern.matches(regex, Character.toString(chr))) ? 'S' : ' ';
+ return ss;
+ }
+}
diff --git a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java
new file mode 100644
index 0000000..75cb678
--- /dev/null
+++ b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java
@@ -0,0 +1,258 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2;
+
+import jalview.api.AlignCalcWorkerI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.dm.AAConSettings;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+import jalview.ws.uimodel.AlignAnalysisUIText;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+
+/**
+ * @author jprocter
+ *
+ */
+public class SequenceAnnotationWSClient extends Jws2Client
+{
+ /**
+ * initialise a client so its attachWSMenuEntry method can be called.
+ */
+ public SequenceAnnotationWSClient()
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+ public SequenceAnnotationWSClient(final Jws2Instance sh,
+ AlignFrame alignFrame, WsParamSetI preset, boolean editParams)
+ {
+ super(alignFrame, preset, null);
+ initSequenceAnnotationWSClient(sh, alignFrame, preset, editParams);
+ }
+
+ // dan think. Do I need to change this method to run RNAalifold through the
+ // GUI
+
+ public void initSequenceAnnotationWSClient(final Jws2Instance sh,
+ AlignFrame alignFrame, WsParamSetI preset, boolean editParams)
+ {
+ // dan changed! dan test. comment out if conditional
+ // if (alignFrame.getViewport().getAlignment().isNucleotide())
+ // {
+ // JOptionPane.showMessageDialog(Desktop.desktop, sh.serviceType
+ // + " can only be used\nfor amino acid alignments.",
+ // "Wrong type of sequences!", JOptionPane.WARNING_MESSAGE);
+ // return;
+ //
+ // }
+ AlignAnalysisUIText aaui = sh.getAlignAnalysisUI();
+ if (aaui != null)
+ {
+ Class clientClass = aaui.getClient();
+
+ // Build an AACon style client - take alignment, return annotation for
+ // columns
+
+ List<AlignCalcWorkerI> clnts = alignFrame.getViewport()
+ .getCalcManager().getRegisteredWorkersOfClass(clientClass);
+ AbstractJabaCalcWorker worker;
+ if (clnts == null || clnts.size() == 0)
+ {
+ if (!processParams(sh, editParams))
+ {
+ return;
+ }
+ try
+ {
+ worker = (AbstractJabaCalcWorker) (clientClass
+ .getConstructor(new Class[] { Jws2Instance.class,
+ AlignFrame.class, WsParamSetI.class, List.class })
+ .newInstance(new Object[] { sh, alignFrame, this.preset,
+ paramset }));
+ } catch (Exception x)
+ {
+ x.printStackTrace();
+ throw new Error(
+ MessageManager.getString("error.implementation_error"), x);
+ }
+ alignFrame.getViewport().getCalcManager().registerWorker(worker);
+ alignFrame.getViewport().getCalcManager().startWorker(worker);
+
+ }
+ else
+ {
+ worker = (AbstractJabaCalcWorker) clnts.get(0);
+ if (editParams)
+ {
+ paramset = worker.getArguments();
+ preset = worker.getPreset();
+ }
+
+ if (!processParams(sh, editParams, true))
+ {
+ return;
+ }
+ // reinstate worker if it was blacklisted (might have happened due to
+ // invalid parameters)
+ alignFrame.getViewport().getCalcManager().workerMayRun(worker);
+ worker.updateParameters(this.preset, paramset);
+ }
+ }
+ if (sh.action.toLowerCase().contains("disorder"))
+ {
+ // build IUPred style client. take sequences, returns annotation per
+ // sequence.
+ if (!processParams(sh, editParams))
+ {
+ return;
+ }
+
+ alignFrame
+ .getViewport()
+ .getCalcManager()
+ .startWorker(
+ new AADisorderClient(sh, alignFrame, preset, paramset));
+ }
+ }
+
+ public SequenceAnnotationWSClient(AAConSettings fave,
+ AlignFrame alignFrame, boolean b)
+ {
+ super(alignFrame, fave.getPreset(), fave.getJobArgset());
+ initSequenceAnnotationWSClient(fave.getService(), alignFrame,
+ fave.getPreset(), b);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.jws2.Jws2Client#attachWSMenuEntry(javax.swing.JMenu,
+ * jalview.ws.jws2.jabaws2.Jws2Instance, jalview.gui.AlignFrame)
+ */
+ public void attachWSMenuEntry(JMenu wsmenu, final Jws2Instance service,
+ final AlignFrame alignFrame)
+ {
+ if (registerAAConWSInstance(wsmenu, service, alignFrame))
+ {
+ // Alignment dependent analysis calculation WS gui
+ return;
+ }
+ boolean hasparams = service.hasParameters();
+ // Assume name ends in WS
+ String calcName = service.serviceType.substring(0,
+ service.serviceType.length() - 2);
+
+ JMenuItem annotservice = new JMenuItem(MessageManager.formatMessage(
+ "label.calcname_with_default_settings",
+ new String[] { calcName }));
+ annotservice.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new SequenceAnnotationWSClient(service, alignFrame, null, false);
+ }
+ });
+ wsmenu.add(annotservice);
+ if (hasparams)
+ {
+ // only add these menu options if the service has user-modifiable
+ // arguments
+ annotservice = new JMenuItem(
+ MessageManager.getString("label.edit_settings_and_run"));
+ annotservice
+ .setToolTipText(MessageManager
+ .getString("label.view_and_change_parameters_before_running_calculation"));
+
+ annotservice.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ new SequenceAnnotationWSClient(service, alignFrame, null, true);
+ }
+ });
+ wsmenu.add(annotservice);
+ List<WsParamSetI> presets = service.getParamStore().getPresets();
+ if (presets != null && presets.size() > 0)
+ {
+ JMenu presetlist = new JMenu(MessageManager.formatMessage(
+ "label.run_with_preset", new String[] { calcName }));
+
+ for (final WsParamSetI preset : presets)
+ {
+ final JMenuItem methodR = new JMenuItem(preset.getName());
+ methodR.setToolTipText(JvSwingUtils.wrapTooltip(
+ true,
+ "<strong>"
+ + (preset.isModifiable() ? MessageManager
+ .getString("label.user_preset")
+ : MessageManager
+ .getString("label.service_preset"))
+ + "</strong><br/>" + preset.getDescription()));
+ methodR.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ new SequenceAnnotationWSClient(service, alignFrame, preset,
+ false);
+ }
+
+ });
+ presetlist.add(methodR);
+ }
+ wsmenu.add(presetlist);
+ }
+
+ }
+ else
+ {
+ annotservice = new JMenuItem(
+ MessageManager.getString("label.view_documentation"));
+ if (service.docUrl != null)
+ {
+ annotservice.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ Desktop.instance.showUrl(service.docUrl);
+ }
+ });
+ annotservice.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.formatMessage("label.view_service_doc_url",
+ new String[] { service.docUrl, service.docUrl })));
+ wsmenu.add(annotservice);
+ }
+ }
+ }
+}
diff --git a/src/jalview/ws/jws2/dm/AAConSettings.java b/src/jalview/ws/jws2/dm/AAConSettings.java
new file mode 100644
index 0000000..285b755
--- /dev/null
+++ b/src/jalview/ws/jws2/dm/AAConSettings.java
@@ -0,0 +1,153 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2.dm;
+
+import jalview.util.MessageManager;
+import jalview.ws.jws2.JabaParamStore;
+import jalview.ws.jws2.JabaPreset;
+import jalview.ws.jws2.ParameterUtils;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import compbio.metadata.Argument;
+import compbio.metadata.Option;
+
+/**
+ * preferences for running AACon service
+ *
+ * @author jprocter TODO: refactor to a generic 'last job and service run'
+ * container ?
+ */
+public class AAConSettings extends jalview.ws.params.AutoCalcSetting
+{
+ Jws2Instance service;
+
+ public AAConSettings(boolean autoUpdate, Jws2Instance service,
+ WsParamSetI preset, List<ArgumentI> jobArgset)
+ {
+ super(preset, jobArgset, autoUpdate);
+ this.service = service;
+ }
+
+ public Jws2Instance getService()
+ {
+ return service;
+ }
+
+ public void setService(Jws2Instance service)
+ {
+ this.service = service;
+ if (preset != null)
+ {
+ // migrate preset to new service
+ for (String url : preset.getApplicableUrls())
+ {
+ if (url.equals(service.getUri()))
+ {
+ return;
+ }
+ }
+ WsParamSetI pr = service.getParamStore().getPreset(preset.getName());
+ if (pr instanceof JabaPreset && preset instanceof JabaPreset)
+ {
+ // easy - Presets are identical (we assume)
+ preset = pr;
+ return;
+ }
+ List<ArgumentI> oldargs = new ArrayList<ArgumentI>(), newargs = new ArrayList<ArgumentI>();
+ oldargs.addAll(preset.getArguments());
+ // need to compare parameters
+ for (ArgumentI newparg : pr.getArguments())
+ {
+ if (!oldargs.remove(newparg))
+ {
+ newargs.add(newparg);
+ }
+ }
+ if (oldargs.size() == 0 && newargs.size() == 0)
+ {
+ // exact match.
+ preset = pr;
+ return;
+ }
+ // Try even harder to migrate arguments.
+ throw new Error(
+ MessageManager
+ .getString("error.parameter_migration_not_implemented_yet"));
+ }
+ }
+
+ public List<Argument> getJobArgset()
+ {
+ return jobArgset == null ? null : JabaParamStore
+ .getJabafromJwsArgs(jobArgset);
+ }
+
+ public void setJobArgset(List<Argument> jobArgset)
+ {
+ // TODO: test if parameters valid for service
+ this.jobArgset = jobArgset == null ? null : JabaParamStore
+ .getJwsArgsfromJaba(jobArgset);
+ }
+
+ public String getWsParamFile()
+ {
+ List<Option> opts = null;
+ if (jobArgset != null)
+ {
+ opts = JabaParamStore.getJabafromJwsArgs(jobArgset);
+ }
+ else
+ {
+ if (preset != null)
+ {
+ opts = JabaParamStore.getJabafromJwsArgs(preset.getArguments());
+ }
+ }
+ if (opts == null || opts.size() == 0)
+ {
+ return "";
+ }
+ StringBuffer pset = new StringBuffer();
+ for (String ps : ParameterUtils.writeParameterSet(opts, " "))
+ {
+ pset.append(ps);
+ pset.append("\n");
+ }
+ return pset.toString();
+ }
+
+ @Override
+ public String getServiceURI()
+ {
+ return service.getServiceTypeURI();
+ }
+
+ @Override
+ public String[] getServiceURLs()
+ {
+ return new String[] { service.getUri() };
+ }
+}
diff --git a/src/jalview/ws/jws2/dm/JabaOption.java b/src/jalview/ws/jws2/dm/JabaOption.java
index c313bd1..66b3112 100644
--- a/src/jalview/ws/jws2/dm/JabaOption.java
+++ b/src/jalview/ws/jws2/dm/JabaOption.java
@@ -1,25 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2.dm;
+import jalview.util.MessageManager;
import jalview.ws.jws2.ParameterUtils;
import jalview.ws.params.OptionI;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
@@ -49,7 +54,17 @@ public class JabaOption implements jalview.ws.params.OptionI
@Override
public URL getFurtherDetails()
{
- return opt.getFurtherDetails();
+ try
+ {
+ return new URL(opt.getBasicURL().toExternalForm() + "/"
+ + opt.getFurtherDetails());
+ } catch (NullPointerException q)
+ {
+ } catch (MalformedURLException q)
+ {
+
+ }
+ return null;
}
@Override
@@ -81,7 +96,8 @@ public class JabaOption implements jalview.ws.params.OptionI
{
e.printStackTrace();
throw new Error(
- "Implementation error: cannot set Jaba Option to a value outside its allowed value range!");
+ MessageManager
+ .getString("error.implementation_error_cannot_set_jaba_option"));
}
}
diff --git a/src/jalview/ws/jws2/dm/JabaParameter.java b/src/jalview/ws/jws2/dm/JabaParameter.java
index d833725..214c15d 100644
--- a/src/jalview/ws/jws2/dm/JabaParameter.java
+++ b/src/jalview/ws/jws2/dm/JabaParameter.java
@@ -1,26 +1,29 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2.dm;
import jalview.ws.jws2.ParameterUtils;
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
-import compbio.metadata.Argument;
+
import compbio.metadata.Parameter;
import compbio.metadata.ValueConstrain;
diff --git a/src/jalview/ws/jws2/dm/JabaValueConstrain.java b/src/jalview/ws/jws2/dm/JabaValueConstrain.java
index 2c63841..7aff089 100644
--- a/src/jalview/ws/jws2/dm/JabaValueConstrain.java
+++ b/src/jalview/ws/jws2/dm/JabaValueConstrain.java
@@ -1,27 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2.dm;
-import compbio.metadata.ValueConstrain;
-import compbio.metadata.ValueConstrain.Type;
-
+import jalview.util.MessageManager;
import jalview.ws.params.ValueConstrainI;
+import compbio.metadata.ValueConstrain;
+
public class JabaValueConstrain implements ValueConstrainI
{
@@ -35,13 +38,19 @@ public class JabaValueConstrain implements ValueConstrainI
@Override
public ValueType getType()
{
- if (vc.getType()==ValueConstrain.Type.Float) {
+ if (vc.getType() == ValueConstrain.Type.Float)
+ {
return ValueType.Float;
}
- if (vc.getType()==ValueConstrain.Type.Integer) {
+ if (vc.getType() == ValueConstrain.Type.Integer)
+ {
return ValueType.Integer;
}
- throw new Error("IMPLEMENTATION ERROR: jalview.ws.params.ValueConstrainI.ValueType does not support the JABAWS type :"+vc.toString());
+ throw new Error(
+ MessageManager
+ .formatMessage(
+ "error.implementation_error_valuetype_doesnt_support_jabaws_type",
+ new String[] { vc.toString() }));
}
@Override
diff --git a/src/jalview/ws/jws2/dm/JabaWsParamSet.java b/src/jalview/ws/jws2/dm/JabaWsParamSet.java
index 6fc8169..07ad45d 100644
--- a/src/jalview/ws/jws2/dm/JabaWsParamSet.java
+++ b/src/jalview/ws/jws2/dm/JabaWsParamSet.java
@@ -1,38 +1,35 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2.dm;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.JabaParamStore;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.WsParamSetI;
+
import java.util.ArrayList;
import java.util.List;
-import compbio.metadata.Argument;
import compbio.metadata.Option;
-import jalview.ws.jws2.JabaParamStore;
-import jalview.ws.jws2.ParameterUtils;
-import jalview.ws.params.ArgumentI;
-import jalview.ws.params.ParamDatastoreI;
-import jalview.ws.params.WsParamSetI;
-
public class JabaWsParamSet implements WsParamSetI
{
/**
@@ -58,7 +55,8 @@ public class JabaWsParamSet implements WsParamSetI
if (!allJaba(jobParams))
{
throw new Error(
- "Cannot create a JabaWSParamSet from non-JabaWS parameters");
+ MessageManager
+ .getString("error.cannot_create_jabaws_param_set"));
}
else
{
@@ -182,7 +180,8 @@ public class JabaWsParamSet implements WsParamSetI
if (!allJaba(args))
{
throw new Error(
- "Cannot set arguments to a JabaWSParamSet that are not JabaWS arguments");
+ MessageManager
+ .getString("error.cannot_set_arguments_to_jabaws_param_set"));
}
jabaArguments = new ArrayList<Option>();
for (ArgumentI rg : args)
diff --git a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java
new file mode 100644
index 0000000..a1307f5
--- /dev/null
+++ b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java
@@ -0,0 +1,252 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2.jabaws2;
+
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.JabaParamStore;
+import jalview.ws.jws2.MsaWSClient;
+import jalview.ws.jws2.SequenceAnnotationWSClient;
+import jalview.ws.params.ParamDatastoreI;
+
+import java.io.Closeable;
+
+import javax.swing.JMenu;
+
+import compbio.data.msa.JABAService;
+import compbio.data.msa.MsaWS;
+import compbio.data.msa.SequenceAnnotation;
+import compbio.metadata.PresetManager;
+import compbio.metadata.RunnerConfig;
+
+public class Jws2Instance
+{
+ public String hosturl;
+
+ public String serviceType;
+
+ public String action;
+
+ public JABAService service;
+
+ public String description;
+
+ public String docUrl;
+
+ /**
+ *
+ * @param hosturl
+ * Service endpoint
+ * @param serviceType
+ * Category for this service's analysis
+ * @param action
+ * text describing their action that service performs (eg 'aligning',
+ * 'analysing')
+ * @param description
+ * Description from JABAWS registry
+ * @param service
+ * JABAWS registry ID for service
+ */
+ public Jws2Instance(String hosturl, String serviceType, String action,
+ String description, JABAService service)
+ {
+ super();
+ this.hosturl = hosturl;
+ this.serviceType = serviceType;
+ this.service = service;
+ this.action = action;
+ this.description = description;
+ int p = description.indexOf("MORE INFORMATION:");
+ if (p > -1)
+ {
+ docUrl = description.substring(description.indexOf("http", p)).trim();
+ if (docUrl.indexOf('\n') > -1)
+ {
+ docUrl = docUrl.substring(0, docUrl.indexOf("\n")).trim();
+ }
+
+ }
+ }
+
+ PresetManager presets = null;
+
+ public JabaParamStore paramStore = null;
+
+ /**
+ * non thread safe - gets the presets for this service (blocks whilst it calls
+ * the service to get the preset set)
+ *
+ * @return service presets or null if exceptions were raised.
+ */
+ public PresetManager getPresets()
+ {
+ if (presets == null)
+ {
+ try
+ {
+ if (service instanceof MsaWS<?>)
+ {
+ presets = ((MsaWS) service).getPresets();
+
+ }
+ if (service instanceof SequenceAnnotation<?>)
+ {
+ presets = ((SequenceAnnotation) service).getPresets();
+ }
+ } catch (Exception ex)
+ {
+ System.err.println("Exception when retrieving presets for service "
+ + serviceType + " at " + hosturl);
+ }
+ }
+ return presets;
+ }
+
+ public String getHost()
+ {
+ return hosturl;
+ /*
+ * try { URL serviceurl = new URL(hosturl); if (serviceurl.getPort()!=80) {
+ * return serviceurl.getHost()+":"+serviceurl.getPort(); } return
+ * serviceurl.getHost(); } catch (Exception e) {
+ * System.err.println("Failed to parse service URL '" + hosturl +
+ * "' as a valid URL!"); } return null;
+ */
+ }
+
+ /**
+ * @return short description of what the service will do
+ */
+ public String getActionText()
+ {
+ return action + " with " + serviceType;
+ }
+
+ /**
+ * non-thread safe - blocks whilst accessing service to get complete set of
+ * available options and parameters
+ *
+ * @return
+ */
+ public RunnerConfig getRunnerConfig()
+ {
+ if (service instanceof MsaWS<?>)
+ {
+ return ((MsaWS) service).getRunnerOptions();
+ }
+ if (service instanceof SequenceAnnotation<?>)
+ {
+ return ((SequenceAnnotation) service).getRunnerOptions();
+ }
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_runner_config_not_available",
+ new String[] { serviceType, service.getClass().toString() }));
+ }
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ if (service != null)
+ {
+ try
+ {
+ Closeable svc = (Closeable) service;
+ service = null;
+ svc.close();
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ super.finalize();
+ }
+
+ public ParamDatastoreI getParamStore()
+ {
+ if (paramStore == null)
+ {
+ try
+ {
+ paramStore = new JabaParamStore(this,
+ (Desktop.instance != null ? Desktop.getUserParameterStore()
+ : null));
+ } catch (Exception ex)
+ {
+ System.err.println("Unexpected exception creating JabaParamStore.");
+ ex.printStackTrace();
+ }
+
+ }
+ return paramStore;
+ }
+
+ public String getUri()
+ {
+ // this is only valid for Jaba 1.0 - this formula might have to change!
+ return hosturl
+ + (hosturl.lastIndexOf("/") == (hosturl.length() - 1) ? ""
+ : "/") + serviceType;
+ }
+
+ private boolean hasParams = false, lookedForParams = false;
+
+ public boolean hasParameters()
+ {
+ if (!lookedForParams)
+ {
+ lookedForParams = true;
+ try
+ {
+ hasParams = (getRunnerConfig().getArguments().size() > 0);
+ } catch (Exception e)
+ {
+
+ }
+ }
+ return hasParams;
+ }
+
+ public void attachWSMenuEntry(JMenu atpoint, AlignFrame alignFrame)
+ {
+ if (service instanceof MsaWS<?>)
+ {
+ new MsaWSClient().attachWSMenuEntry(atpoint, this, alignFrame);
+ }
+ else if (service instanceof SequenceAnnotation<?>)
+ {
+ new SequenceAnnotationWSClient().attachWSMenuEntry(atpoint, this,
+ alignFrame);
+ }
+ }
+
+ public String getServiceTypeURI()
+ {
+ return "java:" + serviceType;
+ }
+
+ jalview.ws.uimodel.AlignAnalysisUIText aaui;
+
+ public jalview.ws.uimodel.AlignAnalysisUIText getAlignAnalysisUI()
+ {
+ return aaui;
+ }
+}
diff --git a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java
new file mode 100644
index 0000000..105a0c3
--- /dev/null
+++ b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java
@@ -0,0 +1,97 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.jws2.jabaws2;
+
+import jalview.ws.jws2.AAConClient;
+import jalview.ws.jws2.JPred301Client;
+import jalview.ws.jws2.RNAalifoldClient;
+import jalview.ws.uimodel.AlignAnalysisUIText;
+
+import java.util.HashMap;
+import java.util.HashSet;
+
+import compbio.data.msa.JABAService;
+
+public class Jws2InstanceFactory
+{
+ private static HashMap<String, AlignAnalysisUIText> aaConGUI;
+
+ private static HashSet<String> ignoreGUI;
+
+ private static String category_rewrite(String cat_name)
+ {
+ return (cat_name != null && cat_name.equals("Prediction")) ? "Secondary Structure Prediction"
+ : cat_name;
+ }
+
+ private static void init()
+ {
+ if (aaConGUI == null)
+ {
+ aaConGUI = new HashMap<String, AlignAnalysisUIText>();
+ aaConGUI.put(compbio.ws.client.Services.AAConWS.toString(),
+ AAConClient.getAlignAnalysisUITest());
+ aaConGUI.put(compbio.ws.client.Services.RNAalifoldWS.toString(),
+ RNAalifoldClient.getAlignAnalysisUITest());
+ // disable the JPred301 client in jalview ...
+ ignoreGUI = new HashSet<String>();
+ ignoreGUI.add(compbio.ws.client.Services.JpredWS.toString());
+ aaConGUI.put(compbio.ws.client.Services.JpredWS.toString(),
+ JPred301Client.getAlignAnalysisUITest());
+ }
+ }
+
+ /**
+ * exclusion list to avoid creating GUI elements for services we don't fully
+ * support
+ *
+ * @param serviceType
+ * @return
+ */
+ public static boolean ignoreService(String serviceType)
+ {
+ init();
+ return (ignoreGUI.contains(serviceType.toString()));
+ }
+
+ /**
+ * construct a service instance and configure it with any additional
+ * properties needed so Jalview can access it correctly
+ *
+ * @param jwsservers
+ * @param serviceType
+ * @param name
+ * @param description
+ * @param service
+ * @return
+ */
+ public static Jws2Instance newJws2Instance(String jwsservers,
+ String serviceType, String name, String description,
+ JABAService service)
+ {
+ init();
+ Jws2Instance svc = new Jws2Instance(jwsservers, serviceType,
+ category_rewrite(name), description, service);
+ svc.aaui = aaConGUI.get(serviceType.toString());
+ return svc;
+ }
+
+}
diff --git a/src/jalview/ws/params/ArgumentI.java b/src/jalview/ws/params/ArgumentI.java
index 7cb6a35..8d57d0a 100644
--- a/src/jalview/ws/params/ArgumentI.java
+++ b/src/jalview/ws/params/ArgumentI.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.params;
@@ -33,6 +36,7 @@ public interface ArgumentI
/**
* set the current value for the argument.
+ *
* @param selectedItem
*/
void setValue(String selectedItem);
diff --git a/src/jalview/ws/params/AutoCalcSetting.java b/src/jalview/ws/params/AutoCalcSetting.java
new file mode 100644
index 0000000..cf892cb
--- /dev/null
+++ b/src/jalview/ws/params/AutoCalcSetting.java
@@ -0,0 +1,90 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.params;
+
+import java.util.List;
+
+public abstract class AutoCalcSetting
+{
+
+ protected boolean autoUpdate;
+
+ protected WsParamSetI preset;
+
+ protected List<ArgumentI> jobArgset;
+
+ public AutoCalcSetting(WsParamSetI preset2, List<ArgumentI> jobArgset2,
+ boolean autoUpdate2)
+ {
+ autoUpdate = autoUpdate2;
+ preset = preset2;
+ jobArgset = jobArgset2;
+ }
+
+ public boolean isAutoUpdate()
+ {
+ return autoUpdate;
+ }
+
+ public void setAutoUpdate(boolean autoUpdate)
+ {
+ this.autoUpdate = autoUpdate;
+ }
+
+ public WsParamSetI getPreset()
+ {
+ return preset;
+ }
+
+ public void setPreset(WsParamSetI preset)
+ {
+ // TODO: test if service URL is in presets
+ this.preset = preset;
+ }
+
+ public List<ArgumentI> getArgumentSet()
+ {
+ return jobArgset;
+ }
+
+ /**
+ *
+ * @return characteristic URI for this service. The URI should reflect the
+ * type and version of this service, enabling the service client code
+ * to recover the correct client for this calculation.
+ */
+ public abstract String getServiceURI();
+
+ /**
+ * return any concrete service endpoints associated with this calculation.
+ * built in services should return a zero length array
+ *
+ * @return
+ */
+ public abstract String[] getServiceURLs();
+
+ /**
+ *
+ * @return stringified representation of the parameters for this setting
+ */
+ public abstract String getWsParamFile();
+
+}
diff --git a/src/jalview/ws/params/InvalidArgumentException.java b/src/jalview/ws/params/InvalidArgumentException.java
index 7aefe16..58a20dc 100644
--- a/src/jalview/ws/params/InvalidArgumentException.java
+++ b/src/jalview/ws/params/InvalidArgumentException.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-/**
*
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.params;
diff --git a/src/jalview/ws/params/OptionI.java b/src/jalview/ws/params/OptionI.java
index 02f4829..1fa7944 100644
--- a/src/jalview/ws/params/OptionI.java
+++ b/src/jalview/ws/params/OptionI.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.params;
diff --git a/src/jalview/ws/params/ParamDatastoreI.java b/src/jalview/ws/params/ParamDatastoreI.java
index b3e8d6e..8ed54b2 100644
--- a/src/jalview/ws/params/ParamDatastoreI.java
+++ b/src/jalview/ws/params/ParamDatastoreI.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.params;
diff --git a/src/jalview/ws/params/ParamManager.java b/src/jalview/ws/params/ParamManager.java
index 5f25e2e..0d01c28 100644
--- a/src/jalview/ws/params/ParamManager.java
+++ b/src/jalview/ws/params/ParamManager.java
@@ -1,24 +1,25 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.params;
-import jalview.ws.jws2.dm.JabaWsParamSet;
-
/**
* Interface implemented by classes for maintaining user's parameters in a
* Jalview session
diff --git a/src/jalview/ws/params/ParameterI.java b/src/jalview/ws/params/ParameterI.java
index fb23dce..cd85c1a 100644
--- a/src/jalview/ws/params/ParameterI.java
+++ b/src/jalview/ws/params/ParameterI.java
@@ -1,26 +1,25 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.params;
-import java.net.URL;
-
-import compbio.metadata.ValueConstrain;
-
public interface ParameterI extends OptionI
{
diff --git a/src/jalview/ws/params/ValueConstrainI.java b/src/jalview/ws/params/ValueConstrainI.java
index 851be86..fa7a706 100644
--- a/src/jalview/ws/params/ValueConstrainI.java
+++ b/src/jalview/ws/params/ValueConstrainI.java
@@ -1,24 +1,25 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.params;
-import compbio.metadata.ValueConstrain.Type;
-
/**
* @author JimP
*
@@ -26,11 +27,11 @@ import compbio.metadata.ValueConstrain.Type;
public interface ValueConstrainI
{
- public enum ValueType {
- Integer,
- Float,
- String
+ public enum ValueType
+ {
+ Integer, Float, String
};
+
ValueType getType();
Number getMax();
diff --git a/src/jalview/ws/params/WsParamSetI.java b/src/jalview/ws/params/WsParamSetI.java
index 8d72b2c..2223d58 100644
--- a/src/jalview/ws/params/WsParamSetI.java
+++ b/src/jalview/ws/params/WsParamSetI.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.params;
diff --git a/src/jalview/ws/params/simple/BooleanOption.java b/src/jalview/ws/params/simple/BooleanOption.java
index 5983d05..484a46d 100644
--- a/src/jalview/ws/params/simple/BooleanOption.java
+++ b/src/jalview/ws/params/simple/BooleanOption.java
@@ -1,35 +1,39 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.params.simple;
+import jalview.ws.params.OptionI;
+
import java.net.URL;
import java.util.Arrays;
-import jalview.ws.params.OptionI;
-
public class BooleanOption extends Option implements OptionI
{
- public BooleanOption(String name, String descr, boolean required, boolean defVal,
- boolean val, URL link)
+ public BooleanOption(String name, String descr, boolean required,
+ boolean defVal, boolean val, URL link)
{
-
- super(name,descr,required,(defVal ? name:""),(val ? name:""),Arrays.asList(new String[] {name}),link);
+
+ super(name, descr, required, (defVal ? name : ""), (val ? name : ""),
+ Arrays.asList(new String[] { name }), link);
}
-
+
}
diff --git a/src/jalview/ws/params/simple/IntegerParameter.java b/src/jalview/ws/params/simple/IntegerParameter.java
index e83af2c..88cb488 100644
--- a/src/jalview/ws/params/simple/IntegerParameter.java
+++ b/src/jalview/ws/params/simple/IntegerParameter.java
@@ -1,71 +1,77 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-/**
*
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.params.simple;
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
-import compbio.metadata.ValueConstrain.Type;
-
/**
* @author jimp
- *
+ *
*/
-public class IntegerParameter extends Option implements ParameterI
+public class IntegerParameter extends Option implements ParameterI
{
int defval;
- int min,max;
- public ValueConstrainI getValidValue() {
+
+ int min, max;
+
+ public ValueConstrainI getValidValue()
+ {
return new ValueConstrainI()
{
-
+
@Override
public ValueType getType()
{
return ValueType.Integer;
}
-
+
@Override
public Number getMin()
{
- if (min<max)
+ if (min < max)
+ {
+ return min;
+ }
+ else
{
- return min;
- } else {
return null;
}
}
-
+
@Override
public Number getMax()
{
- if (min<max)
+ if (min < max)
{
return max;
- } else {
+ }
+ else
+ {
return null;
}
}
};
}
+
public IntegerParameter(IntegerParameter parm)
{
super(parm);
@@ -73,27 +79,30 @@ public class IntegerParameter extends Option implements ParameterI
min = parm.min;
}
- public IntegerParameter(String name, String description, boolean required, int defValue,
- int min, int max)
+ public IntegerParameter(String name, String description,
+ boolean required, int defValue, int min, int max)
{
- super(name, description, required, String.valueOf(defValue), null, null, null);
+ super(name, description, required, String.valueOf(defValue), null,
+ null, null);
defval = defValue;
this.min = min;
this.max = max;
}
- public IntegerParameter(String name, String description, boolean required, int defValue, int value,
- int min, int max)
+ public IntegerParameter(String name, String description,
+ boolean required, int defValue, int value, int min, int max)
{
- super(name, description, required, String.valueOf(defValue), String.valueOf(value), null, null);
+ super(name, description, required, String.valueOf(defValue), String
+ .valueOf(value), null, null);
defval = defValue;
this.min = min;
this.max = max;
}
+
@Override
public IntegerParameter copy()
{
- return new IntegerParameter(this);
+ return new IntegerParameter(this);
}
-
+
}
diff --git a/src/jalview/ws/params/simple/Option.java b/src/jalview/ws/params/simple/Option.java
index 4efeaeb..c3c6db2 100644
--- a/src/jalview/ws/params/simple/Option.java
+++ b/src/jalview/ws/params/simple/Option.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.params.simple;
import jalview.ws.params.OptionI;
@@ -24,13 +27,17 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-public class Option implements OptionI {
+public class Option implements OptionI
+{
+
+ String name, value, defvalue, description;
+
+ ArrayList<String> possibleVals = new ArrayList<String>();
-
- String name, value, defvalue,description;
- ArrayList<String> possibleVals=new ArrayList<String>();
boolean required;
+
URL fdetails;
+
@Override
public String getName()
{
@@ -40,7 +47,7 @@ public class Option implements OptionI {
@Override
public String getValue()
{
- return value==null ? defvalue : value;
+ return value == null ? defvalue : value;
}
@Override
@@ -72,35 +79,39 @@ public class Option implements OptionI {
{
return possibleVals;
}
+
public Option(Option opt)
{
name = new String(opt.name);
- if (opt.value!=null)
+ if (opt.value != null)
value = new String(opt.value);
- if (opt.defvalue!=null)
- defvalue=new String(opt.defvalue);
- if (opt.description!=null)
- description=new String(opt.description);
- if (opt.possibleVals!=null) {
- possibleVals = (ArrayList<String>)opt.possibleVals.clone();
+ if (opt.defvalue != null)
+ defvalue = new String(opt.defvalue);
+ if (opt.description != null)
+ description = new String(opt.description);
+ if (opt.possibleVals != null)
+ {
+ possibleVals = (ArrayList<String>) opt.possibleVals.clone();
}
required = opt.required;
// URLs are singletons - so we copy by reference. nasty but true.
fdetails = opt.fdetails;
}
+
public Option()
{
}
public Option(String name2, String description2, boolean isrequired,
- String defValue, String value, Collection<String> possibleVals, URL fdetails)
+ String defValue, String value, Collection<String> possibleVals,
+ URL fdetails)
{
name = name2;
description = description2;
this.value = value;
this.required = isrequired;
this.defvalue = defValue;
- if (possibleVals!=null)
+ if (possibleVals != null)
{
this.possibleVals = new ArrayList<String>();
this.possibleVals.addAll(possibleVals);
@@ -108,11 +119,10 @@ public class Option implements OptionI {
this.fdetails = fdetails;
}
-
@Override
public OptionI copy()
{
Option opt = new Option(this);
return opt;
}
-}
\ No newline at end of file
+}
diff --git a/src/jalview/ws/params/simple/Parameter.java b/src/jalview/ws/params/simple/Parameter.java
index 54210f4..46767db 100644
--- a/src/jalview/ws/params/simple/Parameter.java
+++ b/src/jalview/ws/params/simple/Parameter.java
@@ -1,42 +1,51 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.params.simple;
import jalview.ws.params.OptionI;
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
-public abstract class Parameter extends Option implements OptionI,ParameterI {
+public abstract class Parameter extends Option implements OptionI,
+ ParameterI
+{
ValueConstrainI validator;
+
@Override
public ValueConstrainI getValidValue()
{
return validator;
}
+
public Parameter(Parameter parm)
{
super(parm);
}
+
public Parameter(ValueConstrainI validator)
{
super();
this.validator = validator;
}
+
@Override
public abstract Parameter copy();
-}
\ No newline at end of file
+}
diff --git a/src/jalview/ws/params/simple/StringChoiceParameter.java b/src/jalview/ws/params/simple/StringChoiceParameter.java
index f1a50a2..74023b7 100644
--- a/src/jalview/ws/params/simple/StringChoiceParameter.java
+++ b/src/jalview/ws/params/simple/StringChoiceParameter.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.params.simple;
public class StringChoiceParameter extends Option
diff --git a/src/jalview/ws/rest/AlignmentProcessor.java b/src/jalview/ws/rest/AlignmentProcessor.java
index 05d9c1a..43193b6 100644
--- a/src/jalview/ws/rest/AlignmentProcessor.java
+++ b/src/jalview/ws/rest/AlignmentProcessor.java
@@ -1,29 +1,35 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest;
import jalview.datamodel.AlignmentI;
-public interface AlignmentProcessor {
+public interface AlignmentProcessor
+{
/**
* prepare the context alignment for this input
- * @param al - alignment to be processed
+ *
+ * @param al
+ * - alignment to be processed
* @return al or a new alignment with appropriate attributes/order for input
*/
public AlignmentI prepareAlignment(AlignmentI al);
-}
\ No newline at end of file
+}
diff --git a/src/jalview/ws/rest/HttpResultSet.java b/src/jalview/ws/rest/HttpResultSet.java
index 53d15de..836ca09 100644
--- a/src/jalview/ws/rest/HttpResultSet.java
+++ b/src/jalview/ws/rest/HttpResultSet.java
@@ -1,28 +1,32 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest;
import jalview.bin.Cache;
import jalview.io.FileParse;
import jalview.io.packed.DataProvider;
+import jalview.io.packed.DataProvider.JvDataType;
import jalview.io.packed.ParsePackedSet;
import jalview.io.packed.SimpleDataProvider;
-import jalview.io.packed.DataProvider.JvDataType;
+import jalview.util.MessageManager;
import jalview.ws.io.mime.JalviewMimeContentHandler;
import java.io.BufferedReader;
@@ -37,7 +41,6 @@ import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.james.mime4j.MimeException;
-import org.apache.james.mime4j.parser.ContentHandler;
import org.apache.james.mime4j.parser.MimeStreamParser;
/**
@@ -96,6 +99,7 @@ public class HttpResultSet extends FileParse
/**
* parses the results of the service output.
+ *
* @return the result of ParsePackedSet.getAlignment()
* @throws Exception
* @throws Error
@@ -108,7 +112,8 @@ public class HttpResultSet extends FileParse
if (en == null)
{
throw new Error(
- "Implementation Error: need to have an HttpResponse to process.");
+ MessageManager
+ .getString("error.implementation_error_need_to_have_httpresponse"));
}
jalview.io.packed.JalviewDataset ds = restJob.newJalviewDataset();
// Decide how we deal with content.
@@ -220,9 +225,10 @@ public class HttpResultSet extends FileParse
*/
public String getUrl()
{
- try {
+ try
+ {
return cachedRequest.getURI().toURL().toString();
- } catch (Exception x)
+ } catch (Exception x)
{
x.printStackTrace();
return null;
diff --git a/src/jalview/ws/rest/InputType.java b/src/jalview/ws/rest/InputType.java
index 26b5ea6..df340b0 100644
--- a/src/jalview/ws/rest/InputType.java
+++ b/src/jalview/ws/rest/InputType.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest;
import jalview.ws.params.ArgumentI;
@@ -23,69 +26,78 @@ import jalview.ws.params.OptionI;
import jalview.ws.params.ParameterI;
import jalview.ws.params.simple.IntegerParameter;
import jalview.ws.params.simple.Option;
-import jalview.ws.rest.params.SeqGroupIndexVector;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.StringBody;
-import sun.io.CharacterEncoding;
-import sun.misc.CharacterEncoder;
-
/***
- * InputType is the abstract model of each input parameter that a rest service might take.
- * It enables the engine to validate input by providing
- * { formatter for type, parser for type }
- *
+ * InputType is the abstract model of each input parameter that a rest service
+ * might take. It enables the engine to validate input by providing { formatter
+ * for type, parser for type }
+ *
*/
-public abstract class InputType {
+public abstract class InputType
+{
+ private static final Pattern URL_PATTERN = Pattern
+ .compile("^([^=]+)=?'?([^']*)?'?");
+
/**
* not used yet
*/
boolean replaceids;
- public enum molType { NUC, PROT, MIX;
- public static Collection<String> toStringValues()
+ public enum molType
{
- Collection<String> c = new ArrayList<String>();
- for (molType type:values())
+ NUC, PROT, MIX;
+
+ public static Collection<String> toStringValues()
{
- c.add(type.toString());
+ Collection<String> c = new ArrayList<String>();
+ for (molType type : values())
+ {
+ c.add(type.toString());
+ }
+ return c;
}
- return c;
- }}
+ }
+
public String token;
- public int min=1;
- public int max=0; // unbounded
- protected ArrayList<Class> inputData=new ArrayList<Class>();
+
+ public int min = 1;
+
+ public int max = 0; // unbounded
+
+ protected ArrayList<Class> inputData = new ArrayList<Class>();
+
/**
- * initialise the InputType with a list of jalview data classes that the RestJob needs to be able to provide to it.
+ * initialise the InputType with a list of jalview data classes that the
+ * RestJob needs to be able to provide to it.
+ *
* @param types
*/
protected InputType(Class[] types)
{
- if(types!=null)
- {for (Class t:types)
+ if (types != null)
{
- inputData.add(t);
- }
+ for (Class t : types)
+ {
+ inputData.add(t);
}
+ }
}
+
/**
- * do basic tests to ensure the job's service takes this parameter, and the job's input data can be used to generate the input data
+ * do basic tests to ensure the job's service takes this parameter, and the
+ * job's input data can be used to generate the input data
+ *
* @param restJob
* @return
*/
@@ -93,7 +105,7 @@ public abstract class InputType {
{
if (!validFor(restJob.rsd))
return false;
- for (Class cl:inputData)
+ for (Class cl : inputData)
{
if (!restJob.hasDataOfType(cl))
{
@@ -102,165 +114,221 @@ public abstract class InputType {
}
return true;
}
-
+
public boolean validFor(RestServiceDescription restServiceDescription)
{
if (!restServiceDescription.inputParams.values().contains(this))
return false;
-
+
return true;
}
+
protected ContentBody utf8StringBody(String content, String type)
{
Charset utf8 = Charset.forName("UTF-8");
- try {
- if (type==null ) {
- return new StringBody(utf8.encode(content).asCharBuffer().toString());
- } else {
- return new StringBody(utf8.encode(content).asCharBuffer().toString(), type, utf8);
- }
+ try
+ {
+ if (type == null)
+ {
+ return new StringBody(utf8.encode(content).asCharBuffer()
+ .toString());
+ }
+ else
+ {
+ return new StringBody(utf8.encode(content).asCharBuffer()
+ .toString(), type, utf8);
+ }
} catch (Exception ex)
{
- System.err.println("Couldn't transform string\n"+content+"\nException was :");
+ System.err.println("Couldn't transform string\n" + content
+ + "\nException was :");
ex.printStackTrace(System.err);
}
return null;
}
+
/**
*
- * @param rj data from which input is to be extracted and formatted
+ * @param rj
+ * data from which input is to be extracted and formatted
* @return StringBody or FileBody ready for posting
*/
- abstract public ContentBody formatForInput(RestJob rj) throws UnsupportedEncodingException,NoValidInputDataException;
+ abstract public ContentBody formatForInput(RestJob rj)
+ throws UnsupportedEncodingException, NoValidInputDataException;
+
/**
*
* @return true if no input data needs to be provided for this parameter
*/
public boolean isConstant()
{
- return (inputData==null || inputData.size()==0);
+ return (inputData == null || inputData.size() == 0);
}
+
/**
- * return a url encoded version of this parameter's value, or an empty string if the parameter has no ='value' content.
+ * return a url encoded version of this parameter's value, or an empty string
+ * if the parameter has no ='value' content.
+ *
* @return
*/
public abstract List<String> getURLEncodedParameter();
-
+
/**
* set the property known as tok, possibly by assigning it with a given val
+ *
* @param tok
- * @param val (may be empty or null)
- * @param warnings place where parse warnings are reported
+ * @param val
+ * (may be empty or null)
+ * @param warnings
+ * place where parse warnings are reported
* @return true if property was set
*/
- public abstract boolean configureProperty(String tok, String val, StringBuffer warnings);
-
+ public abstract boolean configureProperty(String tok, String val,
+ StringBuffer warnings);
+
/**
* Get unique key for this type of parameter in a URL encoding.
- * @return the string that prefixes an input parameter of InputType<T> type in the string returned from getURLEncodedParameter
+ *
+ * @return the string that prefixes an input parameter of InputType<T> type in
+ * the string returned from getURLEncodedParameter
*/
public abstract String getURLtokenPrefix();
+
/**
- * parse the given token String and set InputParameter properties appropriately
- * @param tokenstring - urlencoded parameter string as returned from getURLEncodedParameter
- * @param warnings - place where any warning messages about bad property values are written
+ * parse the given token String and set InputParameter properties
+ * appropriately
+ *
+ * @param tokenstring
+ * - urlencoded parameter string as returned from
+ * getURLEncodedParameter
+ * @param warnings
+ * - place where any warning messages about bad property values are
+ * written
* @return true if configuration succeeded, false otherwise.
*/
- public boolean configureFromURLtokenString(List<String> tokenstring, StringBuffer warnings) {
- boolean valid=true;
- for (String tok:tokenstring)
+ public boolean configureFromURLtokenString(List<String> tokenstring,
+ StringBuffer warnings)
+ {
+ boolean valid = true;
+ for (String tok : tokenstring)
+ {
+ Matcher mtch = URL_PATTERN.matcher(tok);
+ if (mtch.find())
{
- Matcher mtch = Pattern.compile("^([^=]+)=?'?([^']*)?'?").matcher(tok);
- if (mtch.find()) {
- try {
- if (mtch.group(1).equals("min"))
- {
- min = Integer.parseInt(mtch.group(2));
- continue;
-
- } else
- if (mtch.group(1).equals("max"))
- {
- max = Integer.parseInt(mtch.group(2));
- continue;
- }
- }
- catch (NumberFormatException x)
- {
- valid=false;
- warnings.append("Invalid value for parameter "+mtch.group(1).toLowerCase()+" '"+mtch.group(2)+"' (expected an integer)\n");
- }
-
- if (!configureProperty(mtch.group(1), mtch.group(2), warnings)) {
- if (warnings.length()==0)
- {
- warnings.append("Failed to configure InputType :"+getURLtokenPrefix()+" with property string: '"+mtch.group(0)+"'\n (token is '"+mtch.group(1)+"' and value is '"+mtch.group(2)+"')\n");
- }
- valid=false;
+ try
+ {
+ if (mtch.group(1).equals("min"))
+ {
+ min = Integer.parseInt(mtch.group(2));
+ continue;
+
+ }
+ else if (mtch.group(1).equals("max"))
+ {
+ max = Integer.parseInt(mtch.group(2));
+ continue;
}
+ } catch (NumberFormatException x)
+ {
+ valid = false;
+ warnings.append("Invalid value for parameter "
+ + mtch.group(1).toLowerCase() + " '" + mtch.group(2)
+ + "' (expected an integer)\n");
}
+
+ if (!configureProperty(mtch.group(1), mtch.group(2), warnings))
+ {
+ if (warnings.length() == 0)
+ {
+ warnings.append("Failed to configure InputType :"
+ + getURLtokenPrefix() + " with property string: '"
+ + mtch.group(0) + "'\n (token is '" + mtch.group(1)
+ + "' and value is '" + mtch.group(2) + "')\n");
+ }
+ valid = false;
}
- return valid;
+ }
+ }
+ return valid;
}
+
public void addBaseParams(ArrayList<String> prms)
{
- // todo : check if replaceids should be a global for the service, rather than for a specific parameter.
- if (min!=1) {
- prms.add("min='"+min+"'");
+ // todo : check if replaceids should be a global for the service, rather
+ // than for a specific parameter.
+ if (min != 1)
+ {
+ prms.add("min='" + min + "'");
}
- if (max!=0) {
- prms.add("max='"+max+"'");
+ if (max != 0)
+ {
+ prms.add("max='" + max + "'");
}
}
-
+
public abstract List<OptionI> getOptions();
+
public List<OptionI> getBaseOptions()
{
ArrayList<OptionI> opts = new ArrayList<OptionI>();
- opts.add(new IntegerParameter("min","Minimum number of data of this type",true,1,min,0,-1));
- opts.add(new IntegerParameter("max","Maximum number of data of this type",false,0,max,0,-1));
+ opts.add(new IntegerParameter("min",
+ "Minimum number of data of this type", true, 1, min, 0, -1));
+ opts.add(new IntegerParameter("max",
+ "Maximum number of data of this type", false, 0, max, 0, -1));
return opts;
}
+
/**
* make a copy of this InputType
- * @return
- * may not be needed
- public abstract InputType copy();
+ *
+ * @return may not be needed public abstract InputType copy();
*/
-
+
/**
* parse a set of configuration options
- * @param currentSettings - modified settings originally from getOptions
- * @throws InvalidArgumentException thrown if currentSettings contains invalid options for this type.
+ *
+ * @param currentSettings
+ * - modified settings originally from getOptions
+ * @throws InvalidArgumentException
+ * thrown if currentSettings contains invalid options for this type.
*/
- public void configureFromArgumentI(List<ArgumentI> currentSettings) throws InvalidArgumentException
+ public void configureFromArgumentI(List<ArgumentI> currentSettings)
+ throws InvalidArgumentException
{
ArrayList<String> urltoks = new ArrayList<String>();
String rg;
- for (ArgumentI arg: currentSettings)
+ for (ArgumentI arg : currentSettings)
{
if (arg instanceof ParameterI)
{
- rg=arg.getName()+"='"+arg.getValue()+"'";
- } else {
- // TODO: revise architecture - this is counter intuitive - options with different values to their names are actually parameters
- rg=(arg.getValue().length()>0) ? (arg.getValue().equals(arg.getName()) ? arg.getName():arg.getName()+"='"+arg.getValue()+"'")
- : arg.getName();
- }
- if (rg.length()>0) {
+ rg = arg.getName() + "='" + arg.getValue() + "'";
+ }
+ else
+ {
+ // TODO: revise architecture - this is counter intuitive - options with
+ // different values to their names are actually parameters
+ rg = (arg.getValue().length() > 0) ? (arg.getValue().equals(
+ arg.getName()) ? arg.getName() : arg.getName() + "='"
+ + arg.getValue() + "'") : arg.getName();
+ }
+ if (rg.length() > 0)
+ {
urltoks.add(rg);
}
}
StringBuffer warnings;
- if (!configureFromURLtokenString(urltoks, warnings=new StringBuffer()))
+ if (!configureFromURLtokenString(urltoks, warnings = new StringBuffer()))
{
throw new InvalidArgumentException(warnings.toString());
}
}
+
protected OptionI createMolTypeOption(String name, String descr,
boolean req, molType curType, molType defType)
{
- return new Option(name,descr, req, defType==null ? "" : defType.toString(), curType==null ? "" : curType.toString(),molType.toStringValues(),
- null);
+ return new Option(name, descr, req, defType == null ? ""
+ : defType.toString(),
+ curType == null ? "" : curType.toString(),
+ molType.toStringValues(), null);
}
-}
\ No newline at end of file
+}
diff --git a/src/jalview/ws/rest/NoValidInputDataException.java b/src/jalview/ws/rest/NoValidInputDataException.java
index 00ae610..2038973 100644
--- a/src/jalview/ws/rest/NoValidInputDataException.java
+++ b/src/jalview/ws/rest/NoValidInputDataException.java
@@ -1,26 +1,31 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest;
/**
- * exception thrown if there is no data available to construct a valid input for a particular validInput.InputType and RestJob
+ * exception thrown if there is no data available to construct a valid input for
+ * a particular validInput.InputType and RestJob
+ *
* @author JimP
- *
+ *
*/
public class NoValidInputDataException extends Exception
{
@@ -32,7 +37,7 @@ public class NoValidInputDataException extends Exception
public NoValidInputDataException(String string, Exception ex)
{
- super(string,ex);
+ super(string, ex);
}
}
diff --git a/src/jalview/ws/rest/RestClient.java b/src/jalview/ws/rest/RestClient.java
index f42c0c4..202ea12 100644
--- a/src/jalview/ws/rest/RestClient.java
+++ b/src/jalview/ws/rest/RestClient.java
@@ -1,37 +1,25 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-/**
*
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.rest;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.event.MenuEvent;
-import javax.swing.event.MenuListener;
-
import jalview.bin.Cache;
import jalview.datamodel.AlignmentView;
import jalview.gui.AlignFrame;
@@ -40,10 +28,22 @@ import jalview.gui.AlignmentPanel;
import jalview.gui.Desktop;
import jalview.gui.WebserviceInfo;
import jalview.io.packed.DataProvider.JvDataType;
+import jalview.util.MessageManager;
import jalview.ws.WSClient;
import jalview.ws.WSClientI;
import jalview.ws.WSMenuEntryProviderI;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+
/**
* @author JimP
*
@@ -80,16 +80,26 @@ public class RestClient extends WSClient implements WSClientI,
public RestClient(RestServiceDescription service2, AlignFrame alignFrame)
{
+ this(service2, alignFrame, false);
+ }
+
+ boolean headless = false;
+
+ public RestClient(RestServiceDescription service2, AlignFrame alignFrame,
+ boolean nogui)
+ {
service = service2;
af = alignFrame;
av = alignFrame.getViewport();
+ headless = nogui;
constructJob();
}
public void setWebserviceInfo(boolean headless)
{
- WebServiceJobTitle = service.details.Action + " using "
- + service.details.Name;
+ WebServiceJobTitle = MessageManager.formatMessage(
+ "label.webservice_job_title", new String[] {
+ service.details.Action, service.details.Name });
WebServiceName = service.details.Name;
WebServiceReference = "No reference - go to url for more info";
if (service.details.description != null)
@@ -99,7 +109,7 @@ public class RestClient extends WSClient implements WSClientI,
if (!headless)
{
wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceName + "\n"
- + WebServiceReference);
+ + WebServiceReference, true);
wsInfo.setRenderAsHtml(true);
}
@@ -132,7 +142,9 @@ public class RestClient extends WSClient implements WSClientI,
final AlignFrame alignFrame)
{
JMenuItem submit = new JMenuItem(service.details.Name);
- submit.setToolTipText(service.details.Action+" using "+service.details.Name);
+ submit.setToolTipText(MessageManager.formatMessage(
+ "label.rest_client_submit", new String[] {
+ service.details.Action, service.details.Name }));
submit.addActionListener(new ActionListener()
{
@@ -191,17 +203,19 @@ public class RestClient extends WSClient implements WSClientI,
*/
protected boolean isAlignmentModified()
{
- if (undoredo == null || av==null || av.getAlignment()==null)
+ if (undoredo == null || av == null || av.getAlignment() == null)
{
- // always return modified if we don't have access to live GUI elements anymore.
+ // always return modified if we don't have access to live GUI elements
+ // anymore.
return true;
}
if (av.isUndoRedoHashModified(undoredo))
{
- // alignment has been modified in some way.
+ // alignment has been modified in some way.
return true;
}
- // TODO: look deeper into modification of selection state, etc that may affect RestJobThread.realiseResults(boolean merge);
+ // TODO: look deeper into modification of selection state, etc that may
+ // affect RestJobThread.realiseResults(boolean merge);
return false;
}
@@ -234,99 +248,121 @@ public class RestClient extends WSClient implements WSClientI,
*/
boolean selExists = (av.getSelectionGroup() != null)
&& (av.getSelectionGroup().getSize() > 1);
- // TODO: JAL-715: refactor to alignViewport methods and revise to full focus+context+dataset input data staging model
+ // TODO: JAL-715: refactor to alignViewport methods and revise to full
+ // focus+context+dataset input data staging model
if (selExists)
{
if (service.partitiondata)
{
- if (av.getAlignment().getGroups()!=null && av.getAlignment().getGroups().size() > 0)
+ if (av.getAlignment().getGroups() != null
+ && av.getAlignment().getGroups().size() > 0)
{
// intersect groups with selected region
- _input = new AlignmentView(av.getAlignment(),
- av.getColumnSelection(),
- av.getSelectionGroup(),
- av.hasHiddenColumns(),
- true,
- true);
- viewTitle = "selected "+(av.hasHiddenColumns() ? "visible" : "") + " region of "+af.getTitle();
+ _input = new AlignmentView(av.getAlignment(),
+ av.getColumnSelection(), av.getSelectionGroup(),
+ av.hasHiddenColumns(), true, true);
+ viewTitle = MessageManager.formatMessage(
+ "label.select_visible_region_of",
+ new String[] {
+ (av.hasHiddenColumns() ? MessageManager
+ .getString("label.visible") : ""),
+ af.getTitle() });
}
else
{
// use selected region to partition alignment
- _input = new AlignmentView(av.getAlignment(),
- av.getColumnSelection(),
- av.getSelectionGroup(),
- av.hasHiddenColumns(),
- false,
- true);
+ _input = new AlignmentView(av.getAlignment(),
+ av.getColumnSelection(), av.getSelectionGroup(),
+ av.hasHiddenColumns(), false, true);
}
- viewTitle = "select and unselected "+(av.hasHiddenColumns() ? "visible" : "") + " regions from "+af.getTitle();
+ viewTitle = MessageManager.formatMessage(
+ "label.select_unselect_visible_regions_from",
+ new String[] {
+ (av.hasHiddenColumns() ? MessageManager
+ .getString("label.visible") : ""),
+ af.getTitle() });
}
else
{
// just take selected region intersection
- _input = new AlignmentView(av.getAlignment(),
- av.getColumnSelection(),
- av.getSelectionGroup(),
- av.hasHiddenColumns(),
- true,
- true);
- viewTitle = "selected "+(av.hasHiddenColumns() ? "visible" : "") + " region of "+af.getTitle();
+ _input = new AlignmentView(av.getAlignment(),
+ av.getColumnSelection(), av.getSelectionGroup(),
+ av.hasHiddenColumns(), true, true);
+ viewTitle = MessageManager.formatMessage(
+ "label.select_visible_region_of",
+ new String[] {
+ (av.hasHiddenColumns() ? MessageManager
+ .getString("label.visible") : ""),
+ af.getTitle() });
}
- } else {
+ }
+ else
+ {
// standard alignment view without selection present
- _input = new AlignmentView(av.getAlignment(),
- av.getColumnSelection(),
- null,
- av.hasHiddenColumns(),
- false,
+ _input = new AlignmentView(av.getAlignment(),
+ av.getColumnSelection(), null, av.hasHiddenColumns(), false,
true);
- viewTitle = ""+(av.hasHiddenColumns() ? "visible region of " : "") + af.getTitle();
+ viewTitle = ""
+ + (av.hasHiddenColumns() ? (new StringBuffer(" ")
+ .append(MessageManager
+ .getString("label.visible_region_of"))
+ .toString()) : "") + af.getTitle();
}
-
+
RestJobThread jobsthread = new RestJobThread(this);
-
+
if (jobsthread.isValid())
{
- setWebserviceInfo(false);
- wsInfo.setthisService(this);
- jobsthread.setWebServiceInfo(wsInfo);
+ setWebserviceInfo(headless);
+ if (!headless)
+ {
+ wsInfo.setthisService(this);
+ jobsthread.setWebServiceInfo(wsInfo);
+ }
jobsthread.start();
}
else
{
// TODO: try to tell the user why the job couldn't be started.
- JOptionPane.showMessageDialog(Desktop.desktop,
- (jobsthread.hasWarnings() ? jobsthread.getWarnings() : "The Job couldn't be started. Please check your input, and the Jalview console for any warning messages."),
- "Unable to start web service analysis", JOptionPane.WARNING_MESSAGE);
+ JOptionPane
+ .showMessageDialog(
+ Desktop.desktop,
+ (jobsthread.hasWarnings() ? jobsthread.getWarnings()
+ : MessageManager
+ .getString("label.job_couldnt_be_started_check_input")),
+ MessageManager
+ .getString("label.unable_start_web_service_analysis"),
+ JOptionPane.WARNING_MESSAGE);
}
}
public static RestClient makeShmmrRestClient()
{
- String action = "Analysis", description = "Sequence Harmony and Multi-Relief (Brandt et al. 2010)", name = "Multi-Harmony";
+ String action = "Analysis", description = "Sequence Harmony and Multi-Relief (Brandt et al. 2010)", name = MessageManager
+ .getString("label.multiharmony");
Hashtable<String, InputType> iparams = new Hashtable<String, InputType>();
jalview.ws.rest.params.JobConstant toolp;
- //toolp = new jalview.ws.rest.JobConstant("tool","jalview");
- //iparams.put(toolp.token, toolp);
- toolp = new jalview.ws.rest.params.JobConstant("mbjob[method]","shmr");
- iparams.put(toolp.token, toolp);
- toolp = new jalview.ws.rest.params.JobConstant("mbjob[description]","step 1");
- iparams.put(toolp.token, toolp);
- toolp = new jalview.ws.rest.params.JobConstant("start_search","1");
- iparams.put(toolp.token, toolp);
- toolp = new jalview.ws.rest.params.JobConstant("blast","0");
- iparams.put(toolp.token, toolp);
-
+ // toolp = new jalview.ws.rest.JobConstant("tool","jalview");
+ // iparams.put(toolp.token, toolp);
+ // toolp = new jalview.ws.rest.params.JobConstant("mbjob[method]","shmr");
+ // iparams.put(toolp.token, toolp);
+ // toolp = new
+ // jalview.ws.rest.params.JobConstant("mbjob[description]","step 1");
+ // iparams.put(toolp.token, toolp);
+ // toolp = new jalview.ws.rest.params.JobConstant("start_search","1");
+ // iparams.put(toolp.token, toolp);
+ // toolp = new jalview.ws.rest.params.JobConstant("blast","0");
+ // iparams.put(toolp.token, toolp);
+
jalview.ws.rest.params.Alignment aliinput = new jalview.ws.rest.params.Alignment();
- aliinput.token = "ali";//_file";
- aliinput.writeAsFile=false;//true;
- //aliinput.token = "ali_file";
- //aliinput.writeAsFile=true;
+ // SHMR server has a 65K limit for content pasted into the 'ali' parameter,
+ // so we always upload our files.
+ aliinput.token = "ali_file";
+ aliinput.writeAsFile = true;
iparams.put(aliinput.token, aliinput);
jalview.ws.rest.params.SeqGroupIndexVector sgroups = new jalview.ws.rest.params.SeqGroupIndexVector();
sgroups.setMinsize(2);
- sgroups.min=2;// need at least two group defined to make a partition
+ sgroups.min = 2;// need at least two group defined to make a partition
iparams.put("groups", sgroups);
sgroups.token = "groups";
sgroups.sep = " ";
@@ -343,8 +379,9 @@ public class RestClient extends WSClient implements WSClientI,
public AlignmentPanel recoverAlignPanelForView()
{
- AlignmentPanel[] aps = Desktop.getAlignmentPanels(av.getSequenceSetId());
- for (AlignmentPanel alp:aps)
+ AlignmentPanel[] aps = Desktop
+ .getAlignmentPanels(av.getSequenceSetId());
+ for (AlignmentPanel alp : aps)
{
if (alp.av == av)
{
@@ -360,55 +397,41 @@ public class RestClient extends WSClient implements WSClientI,
return true;
}
- protected static Vector<String> services=null;
- public static final String RSBS_SERVICES="RSBS_SERVICES";
+ protected static Vector<String> services = null;
+
+ public static final String RSBS_SERVICES = "RSBS_SERVICES";
+
public static RestClient[] getRestClients()
{
- if (services==null)
+ if (services == null)
{
services = new Vector<String>();
- try {
- for (RestServiceDescription descr: RestServiceDescription.parseDescriptions(jalview.bin.Cache.getDefault(RSBS_SERVICES,makeShmmrRestClient().service.toString())))
+ try
{
- services.add(descr.toString());
- }
- }
- catch (Exception ex) {
- System.err.println("Serious - RSBS descriptions in user preferences are corrupt!");
+ for (RestServiceDescription descr : RestServiceDescription
+ .parseDescriptions(jalview.bin.Cache.getDefault(
+ RSBS_SERVICES,
+ makeShmmrRestClient().service.toString())))
+ {
+ services.add(descr.toString());
+ }
+ } catch (Exception ex)
+ {
+ System.err
+ .println("Serious - RSBS descriptions in user preferences are corrupt!");
ex.printStackTrace();
}
-
+
}
RestClient[] lst = new RestClient[services.size()];
- int i=0;
- for (String svc:services) {
+ int i = 0;
+ for (String svc : services)
+ {
lst[i++] = new RestClient(new RestServiceDescription(svc));
}
return lst;
}
- public static void main(String args[])
- {
- try {
- RestClient[] clients = getRestClients();
- System.out.println("Got "+clients.length+" clients.");
- int i=0;
- Vector<String> urls=new Vector<String>();
- for (RestClient cl:clients) {
- System.out.println(""+(++i)+": "+cl.service.toString());
- urls.add(cl.service.toString());
- }
- setRsbsServices(urls);
- if (clients.length!=getRestClients().length)
- {
- System.err.println("Failed. Differing numbers of clients when stringified and parsed again.");
- }
-
- } catch (Throwable x)
- {
- System.err.println("Failed. Unexpected exception.");
- x.printStackTrace();
- }
- }
+
public String getAction()
{
return service.details.Action;
@@ -422,7 +445,7 @@ public class RestClient extends WSClient implements WSClientI,
public static Vector<String> getRsbsDescriptions()
{
Vector<String> rsbsDescrs = new Vector<String>();
- for (RestClient rsbs:getRestClients())
+ for (RestClient rsbs : getRestClients())
{
rsbsDescrs.add(rsbs.getRestDescription().toString());
}
@@ -431,17 +454,17 @@ public class RestClient extends WSClient implements WSClientI,
public static void setRsbsServices(Vector<String> rsbsUrls)
{
- if (rsbsUrls!=null)
+ if (rsbsUrls != null)
{
// TODO: consider validating services ?
services = new Vector<String>(rsbsUrls);
StringBuffer sprop = new StringBuffer();
- for (String s:services)
+ for (String s : services)
{
sprop.append(s);
}
Cache.setProperty(RSBS_SERVICES, sprop.toString());
- }
+ }
else
{
Cache.removeProperty(RSBS_SERVICES);
diff --git a/src/jalview/ws/rest/RestJob.java b/src/jalview/ws/rest/RestJob.java
index 200c573..0378d62 100644
--- a/src/jalview/ws/rest/RestJob.java
+++ b/src/jalview/ws/rest/RestJob.java
@@ -1,48 +1,42 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest;
-import java.io.IOException;
-import java.sql.ResultSet;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.Vector;
-
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentOrder;
-import jalview.datamodel.AlignmentView;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
-import jalview.io.packed.DataProvider;
import jalview.io.packed.JalviewDataset;
-import jalview.io.packed.ParsePackedSet;
-import jalview.io.packed.SimpleDataProvider;
-import jalview.io.packed.DataProvider.JvDataType;
import jalview.ws.AWsJob;
import jalview.ws.rest.params.Alignment;
import jalview.ws.rest.params.SeqGroupIndexVector;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
public class RestJob extends AWsJob
{
@@ -72,7 +66,7 @@ public class RestJob extends AWsJob
*/
int[] origviscontig;
- private AlignmentI contextAl=null;
+ private AlignmentI contextAl = null;
/**
* create a rest job using data bounded by the given start/end column.
@@ -96,12 +90,15 @@ public class RestJob extends AWsJob
// get sequences for the alignmentI
// get groups trimmed to alignment columns
// get any annotation trimmed to start/end columns, too.
-
+ squniq = jalview.analysis.SeqsetUtils.uniquify(
+ _input.getSequencesArray(), true);
// prepare input
// form alignment+groups+annotation,preprocess and then record references
// for formatters
ArrayList<InputType> alinp = new ArrayList<InputType>();
int paramsWithData = 0;
+ // TODO: JAL-715 - generalise the following validation logic for all
+ // parameter types
// we cheat for moment - since we know a-priori what data is available and
// what inputs we have implemented so far
for (Map.Entry<String, InputType> prm : rsd.inputParams.entrySet())
@@ -114,14 +111,19 @@ public class RestJob extends AWsJob
}
else
{
- // TODO: move validation of input data to SeqGroupIndexVector
- if ((prm.getValue() instanceof SeqGroupIndexVector)
- && (_input.getGroups() != null && _input.getGroups()
- .size() >= prm.getValue().min))
+ if (prm.getValue() instanceof SeqGroupIndexVector
+ && _input.getGroups() != null
+ && _input.getGroups().size() >= -1 + prm.getValue().min)
{
+ // the test above is not rigorous but fixes JAL-1298, since
+ // submission will fail if the partition set doesn't contain at
+ // least one partition
alinp.add(prm.getValue());
- } else {
- statMessage=("Not enough groups defined on the alignment - need at least "+prm.getValue().min);
+ }
+ else
+ {
+ statMessage = ("Not enough groups defined on the alignment - need at least " + prm
+ .getValue().min);
}
}
}
@@ -138,7 +140,7 @@ public class RestJob extends AWsJob
_input.setDataset(null);
}
dsForIO = _input.getDataset();
- if (contextAl==null)
+ if (contextAl == null)
{
contextAl = _input;
}
@@ -151,7 +153,7 @@ public class RestJob extends AWsJob
validInput = false;
}
}
-
+
boolean validInput = false;
@Override
@@ -275,24 +277,29 @@ public class RestJob extends AWsJob
if (context == null)
{
context = new JalviewDataset(dsForIO, null, squniq, null);
- if (contextAl!=null)
+ if (contextAl != null)
{
- // TODO devise way of merging new annotation onto (identical) existing annotation that was used as input
- // delete all input annotation
- if (contextAl.getAlignmentAnnotation()!=null) {
- for (AlignmentAnnotation alan: contextAl.getAlignmentAnnotation()) {
+ // TODO devise way of merging new annotation onto (identical) existing
+ // annotation that was used as input
+ // delete all input annotation
+ if (contextAl.getAlignmentAnnotation() != null)
+ {
+ for (AlignmentAnnotation alan : contextAl
+ .getAlignmentAnnotation())
+ {
contextAl.deleteAnnotation(alan);
}
}
- // TODO devise way of merging new groups onto (identical) existing groups when they were used as input to service
- // delete all existing groups
- if (contextAl.getGroups()!=null)
+ // TODO devise way of merging new groups onto (identical) existing
+ // groups when they were used as input to service
+ // delete all existing groups
+ if (contextAl.getGroups() != null)
{
contextAl.deleteAllGroups();
}
context.addAlignment(contextAl);
}
-
+
}
return context;
}
@@ -419,17 +426,23 @@ public class RestJob extends AWsJob
* context used to parse results from service
*/
JalviewDataset context = null;
+
protected boolean parsedResults = false;
- protected boolean validJvresults=false;
+
+ protected boolean validJvresults = false;
+
Object[] jvresultobj = null;
+
/**
* process the results obtained from the server into jalview datamodel objects
- * ready to be merged/added to the users' view. Use hasResults to test if results were added to context.
+ * ready to be merged/added to the users' view. Use hasResults to test if
+ * results were added to context.
*/
public void parseResultSet() throws Exception, Error
{
- if (!parsedResults) {
- parsedResults=true;
+ if (!parsedResults)
+ {
+ parsedResults = true;
jvresultobj = resSet.parseResultSet();
validJvresults = true;
}
@@ -437,16 +450,19 @@ public class RestJob extends AWsJob
/**
*
- * @return true if job has an input alignment and it was annotated when results were parsed
+ * @return true if job has an input alignment and it was annotated when
+ * results were parsed
*/
public boolean isInputContextModified()
{
- return contextAl!=null && validJvresults && context.getAl().get(0).isModified();
+ return contextAl != null && validJvresults
+ && context.getAl().get(0).isModified();
}
/**
*
- * @return true if the ID/metadata for the input sequences were saved and sequence IDs renamed.
+ * @return true if the ID/metadata for the input sequences were saved and
+ * sequence IDs renamed.
*/
public boolean isInputUniquified()
{
@@ -455,16 +471,19 @@ public class RestJob extends AWsJob
}
/**
- * Return map between ordering of alignment submitted as input, and ordering of alignment as provided by user
+ * Return map between ordering of alignment submitted as input, and ordering
+ * of alignment as provided by user
+ *
* @return int[sequence index in submitted data]==sequence index in input.
*/
public int[] getOrderMap()
{
SequenceI[] contseq = contextAl.getSequencesArray();
int map[] = new int[contseq.length];
- for (int i=0;i<contseq.length;i++)
+ for (int i = 0; i < contseq.length; i++)
{
- // TODO: optimise for large N - build a lookup hash for IDs returning order, and then lookup each sequ's original order
+ // TODO: optimise for large N - build a lookup hash for IDs returning
+ // order, and then lookup each sequ's original order
map[i] = inputOrder.getOrder().indexOf(contseq[i]);
}
return map;
diff --git a/src/jalview/ws/rest/RestJobThread.java b/src/jalview/ws/rest/RestJobThread.java
index bdd20c9..2d5a83a 100644
--- a/src/jalview/ws/rest/RestJobThread.java
+++ b/src/jalview/ws/rest/RestJobThread.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest;
import jalview.bin.Cache;
@@ -33,6 +36,7 @@ import jalview.gui.WebserviceInfo;
import jalview.io.NewickFile;
import jalview.io.packed.JalviewDataset;
import jalview.io.packed.JalviewDataset.AlignmentSet;
+import jalview.util.MessageManager;
import jalview.ws.AWSThread;
import jalview.ws.AWsJob;
@@ -40,11 +44,9 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
import java.util.Map.Entry;
-import java.util.Vector;
import org.apache.axis.transport.http.HTTPConstants;
import org.apache.http.Header;
@@ -106,8 +108,7 @@ public class RestJobThread extends AWSThread
jobs = new RestJob[viscontigals.length];
for (int j = 0; j < jobs.length; j++)
{
- int[] visc = new int[]
- { viscontig[j * 2], viscontig[j * 2 + 1] };
+ int[] visc = new int[] { viscontig[j * 2], viscontig[j * 2 + 1] };
if (j != 0)
{
jobs[j] = new RestJob(j, this, viscontigals[j], visc);
@@ -804,7 +805,10 @@ public class RestJobThread extends AWSThread
destAls.add(destAl);
destColsel.add(destCs);
resultDest.add(AddDataTo.newAlignment);
- throw new Error("Impl. Error! TODO: ");
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error")
+ + "TODO: ");
}
}
/**
@@ -860,10 +864,8 @@ public class RestJobThread extends AWSThread
// TODO: cope with recovering hidden sequences from
// resultContext
{
- Vector sqs = sg.getSequences(null);
- for (int sqsi = 0, iSize = sqs.size(); sqsi < iSize; sqsi++)
+ for (SequenceI oseq : sg.getSequences(null))
{
- SequenceI oseq = (SequenceI) sqs.get(sqsi);
SequenceI nseq = getNewSeq(oseq, rseqs[nrj],
ordermap[nrj], destAl);
if (nseq != null)
@@ -1042,9 +1044,10 @@ public class RestJobThread extends AWSThread
{
AlignmentI destal;
ColumnSelection destcs;
- String alTitle = restClient.service.details.Action + " using "
- + restClient.service.details.Name + " on "
- + restClient.viewTitle;
+ String alTitle = MessageManager.formatMessage(
+ "label.webservice_job_title_on", new String[] {
+ restClient.service.details.Action,
+ restClient.service.details.Name, restClient.viewTitle });
switch (action)
{
case newAlignment:
diff --git a/src/jalview/ws/rest/RestServiceDescription.java b/src/jalview/ws/rest/RestServiceDescription.java
index 0ea68b1..d97ad07 100644
--- a/src/jalview/ws/rest/RestServiceDescription.java
+++ b/src/jalview/ws/rest/RestServiceDescription.java
@@ -1,31 +1,30 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.rest;
import jalview.datamodel.SequenceI;
-import jalview.io.packed.DataProvider;
-import jalview.io.packed.SimpleDataProvider;
import jalview.io.packed.DataProvider.JvDataType;
-import jalview.util.GroupUrlLink.UrlStringTooLongException;
-import jalview.util.Platform;
+import jalview.util.StringUtils;
import jalview.ws.rest.params.Alignment;
import jalview.ws.rest.params.AnnotationFile;
-import jalview.ws.rest.params.JobConstant;
import jalview.ws.rest.params.SeqGroupIndexVector;
import java.net.URL;
@@ -36,25 +35,22 @@ import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
-import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.swing.JViewport;
-
-import com.stevesoft.pat.Regex;
-import com.sun.org.apache.xml.internal.serialize.OutputFormat.DTD;
-import com.sun.tools.doclets.internal.toolkit.util.DocFinder.Output;
-
public class RestServiceDescription
{
+ private static final Pattern PARAM_ENCODED_URL_PATTERN = Pattern
+ .compile("([?&])([A-Za-z0-9_]+)=\\$([^$]+)\\$");
+
/**
* create a new rest service description ready to be configured
*/
public RestServiceDescription()
{
-
+
}
+
/**
* @param details
* @param postUrl
@@ -85,6 +81,7 @@ public class RestServiceDescription
this.gapCharacter = gapCharacter;
}
+ @Override
public boolean equals(Object o)
{
if (o == null || !(o instanceof RestServiceDescription))
@@ -95,7 +92,8 @@ public class RestServiceDescription
boolean diff = (gapCharacter != other.gapCharacter);
diff |= vseparable != other.vseparable;
diff |= hseparable != other.hseparable;
- diff |= !(urlSuffix.equals(other.urlSuffix));
+ diff |= !(urlSuffix == null && other.urlSuffix == null || (urlSuffix != null
+ && other.urlSuffix != null && urlSuffix.equals(other.urlSuffix)));
// TODO - robust diff that includes constants and reordering of URL
// diff |= !(postUrl.equals(other.postUrl));
// diff |= !inputParams.equals(other.inputParams);
@@ -364,131 +362,6 @@ public class RestServiceDescription
return invalidMessage == null;
}
- private static boolean debug = false;
-
- /**
- * parse the string into a list
- *
- * @param list
- * @param separator
- * @return elements separated by separator
- */
- public static String[] separatorListToArray(String list, String separator)
- {
- int seplen = separator.length();
- if (list == null || list.equals("") || list.equals(separator))
- return null;
- java.util.ArrayList<String> jv = new ArrayList<String>();
- int cp = 0, pos, escape;
- boolean wasescaped = false,wasquoted=false;
- String lstitem = null;
- while ((pos = list.indexOf(separator, cp)) >= cp)
- {
-
- escape = (pos > 0 && list.charAt(pos - 1) == '\\') ? -1 : 0;
- if (wasescaped || wasquoted)
- {
- // append to previous pos
- jv.set(jv.size() - 1,
- lstitem = lstitem + separator
- + list.substring(cp, pos + escape));
-
- }
- else
- {
- jv.add(lstitem = list.substring(cp, pos + escape));
- }
- cp = pos + seplen;
- wasescaped = escape == -1;
- if (!wasescaped)
- {
- // last separator may be in an unmatched quote
- if (java.util.regex.Pattern.matches("('[^']*')*[^']*'",lstitem))
- {
- wasquoted=true;
- }
- }
-
- }
- if (cp < list.length())
- {
- String c = list.substring(cp);
- if (wasescaped || wasquoted)
- {
- // append final separator
- jv.set(jv.size() - 1, lstitem + separator + c);
- }
- else
- {
- if (!c.equals(separator))
- {
- jv.add(c);
- }
- }
- }
- if (jv.size() > 0)
- {
- String[] v = jv.toArray(new String[jv.size()]);
- jv.clear();
- if (debug)
- {
- System.err.println("Array from '" + separator
- + "' separated List:\n" + v.length);
- for (int i = 0; i < v.length; i++)
- {
- System.err.println("item " + i + " '" + v[i] + "'");
- }
- }
- return v;
- }
- if (debug)
- {
- System.err.println("Empty Array from '" + separator
- + "' separated List");
- }
- return null;
- }
-
- /**
- * concatenate the list with separator
- *
- * @param list
- * @param separator
- * @return concatenated string
- */
- public static String arrayToSeparatorList(String[] list, String separator)
- {
- StringBuffer v = new StringBuffer();
- if (list != null && list.length > 0)
- {
- for (int i = 0, iSize = list.length; i < iSize; i++)
- {
- if (list[i] != null)
- {
- if (v.length() > 0)
- {
- v.append(separator);
- }
- // TODO - escape any separator values in list[i]
- v.append(list[i]);
- }
- }
- if (debug)
- {
- System.err.println("Returning '" + separator
- + "' separated List:\n");
- System.err.println(v);
- }
- return v.toString();
- }
- if (debug)
- {
- System.err.println("Returning empty '" + separator
- + "' separated List\n");
- }
- return "" + separator;
- }
-
/**
* parse a string containing a list of service properties and configure the
* service description
@@ -500,7 +373,7 @@ public class RestServiceDescription
private boolean configureFromServiceInputProperties(String propList,
StringBuffer warnings)
{
- String[] props = separatorListToArray(propList, ",");
+ String[] props = StringUtils.separatorListToArray(propList, ",");
if (props == null)
{
return true;
@@ -606,11 +479,20 @@ public class RestServiceDescription
private String getServiceIOProperties()
{
ArrayList<String> vls = new ArrayList<String>();
- if (isHseparable()) { vls.add("hseparable");};
- if (isVseparable()) { vls.add("vseparable");};
+ if (isHseparable())
+ {
+ vls.add("hseparable");
+ }
+ ;
+ if (isVseparable())
+ {
+ vls.add("vseparable");
+ }
+ ;
vls.add(new String("gapCharacter='" + gapCharacter + "'"));
vls.add(new String("returns='" + _genOutputFormatString() + "'"));
- return arrayToSeparatorList(vls.toArray(new String[0]), ",");
+ return StringUtils
+ .arrayToSeparatorList(vls.toArray(new String[0]), ",");
}
public String toString()
@@ -641,27 +523,35 @@ public class RestServiceDescription
}
/**
- * processes a service encoded as a string (as generated by RestServiceDescription.toString())
- * Note - this will only use the first service definition encountered in the string to configure the service.
+ * processes a service encoded as a string (as generated by
+ * RestServiceDescription.toString()) Note - this will only use the first
+ * service definition encountered in the string to configure the service.
+ *
* @param encoding
- * @param warnings - where warning messages are reported.
- * @return true if configuration was parsed successfully.
+ * @param warnings
+ * - where warning messages are reported.
+ * @return true if configuration was parsed successfully.
*/
public boolean configureFromEncodedString(String encoding,
StringBuffer warnings)
{
- String[] list = separatorListToArray(encoding, "|");
-
- int nextpos=parseServiceList(list,warnings, 0);
- if (nextpos>0)
+ String[] list = StringUtils.separatorListToArray(encoding, "|");
+
+ int nextpos = parseServiceList(list, warnings, 0);
+ if (nextpos > 0)
{
return true;
}
return false;
}
+
/**
- * processes the given list from position p, attempting to configure the service from it.
- * Service lists are formed by concatenating individual stringified services. The first character of a stringified service is '|', enabling this, and the parser will ignore empty fields in a '|' separated list when they fall outside a service definition.
+ * processes the given list from position p, attempting to configure the
+ * service from it. Service lists are formed by concatenating individual
+ * stringified services. The first character of a stringified service is '|',
+ * enabling this, and the parser will ignore empty fields in a '|' separated
+ * list when they fall outside a service definition.
+ *
* @param list
* @param warnings
* @param p
@@ -671,32 +561,34 @@ public class RestServiceDescription
{
boolean invalid = false;
// look for the first non-empty position - expect it to be service name
- while (list[p]!=null && list[p].trim().length()==0)
+ while (list[p] != null && list[p].trim().length() == 0)
{
p++;
}
details.Name = list[p];
- details.Action = list[p+1];
- details.description = list[p+2];
- invalid |= !configureFromServiceInputProperties(list[p+3], warnings);
- if (list.length-p > 5 && list[p+5]!=null && list[p+5].trim().length()>5)
+ details.Action = list[p + 1];
+ details.description = list[p + 2];
+ invalid |= !configureFromServiceInputProperties(list[p + 3], warnings);
+ if (list.length - p > 5 && list[p + 5] != null
+ && list[p + 5].trim().length() > 5)
{
- urlSuffix = list[p+4];
- invalid |= !configureFromInputParamEncodedUrl(list[p+5], warnings);
- p+=6;
+ urlSuffix = list[p + 4];
+ invalid |= !configureFromInputParamEncodedUrl(list[p + 5], warnings);
+ p += 6;
}
else
{
- if (list.length-p > 4 && list[p+4]!=null && list[p+4].trim().length()>5)
+ if (list.length - p > 4 && list[p + 4] != null
+ && list[p + 4].trim().length() > 5)
{
urlSuffix = null;
- invalid |= !configureFromInputParamEncodedUrl(list[p+4], warnings);
- p+=5;
+ invalid |= !configureFromInputParamEncodedUrl(list[p + 4], warnings);
+ p += 5;
}
}
return invalid ? -1 : p;
}
-
+
/**
* @return string representation of the input parameters, their type and
* constraints, appended to the service's base submission URL
@@ -744,8 +636,8 @@ public class RestServiceDescription
url.append("$");
url.append(param.getValue().getURLtokenPrefix());
url.append(":");
- url.append(arrayToSeparatorList(vals.toArray(new String[0]),
- ","));
+ url.append(StringUtils.arrayToSeparatorList(
+ vals.toArray(new String[0]), ","));
url.append("$");
}
}
@@ -771,8 +663,7 @@ public class RestServiceDescription
boolean valid = true;
int lastp = 0;
String url = new String();
- Matcher prms = Pattern.compile("([?&])([A-Za-z0-9_]+)=\\$([^$]+)\\$")
- .matcher(ipurl);
+ Matcher prms = PARAM_ENCODED_URL_PATTERN.matcher(ipurl);
Map<String, InputType> iparams = new Hashtable<String, InputType>();
InputType jinput;
while (prms.find())
@@ -814,8 +705,7 @@ public class RestServiceDescription
public static Class[] getInputTypes()
{
// TODO - find a better way of maintaining this classlist
- return new Class[]
- { jalview.ws.rest.params.Alignment.class,
+ return new Class[] { jalview.ws.rest.params.Alignment.class,
jalview.ws.rest.params.AnnotationFile.class,
SeqGroupIndexVector.class,
jalview.ws.rest.params.SeqIdVector.class,
@@ -833,13 +723,15 @@ public class RestServiceDescription
{
try
{
- jinput = (InputType) (type.getConstructor().newInstance(null));
+ jinput = (InputType) (type.getConstructor().newInstance());
if (iprm.equalsIgnoreCase(jinput.getURLtokenPrefix()))
{
ArrayList<String> al = new ArrayList<String>();
- for (String prprm : separatorListToArray(iprmparams, ","))
+ for (String prprm : StringUtils.separatorListToArray(iprmparams,
+ ","))
{
- // hack to ensure that strings like "sep=','" containing unescaped commas as values are concatenated
+ // hack to ensure that strings like "sep=','" containing unescaped
+ // commas as values are concatenated
al.add(prprm.trim());
}
if (!jinput.configureFromURLtokenString(al, warnings))
@@ -865,98 +757,6 @@ public class RestServiceDescription
return valid;
}
- public static void main(String argv[])
- {
- // test separator list
- try {
- assert(separatorListToArray("foo=',',min='foo',max='1,2,3',fa=','", ",").length==4);
- if (separatorListToArray("minsize='2', sep=','", ",").length==2)
- {
- assert(false);
- }
-
- } catch (AssertionError x)
- {
- System.err.println("separatorListToArray is faulty.");
- }
- if (argv.length == 0)
- {
- if (!testRsdExchange("Test using default Shmmr service",
- RestClient.makeShmmrRestClient().service))
- {
- System.err.println("default test failed.");
- }
- else
- {
- System.err.println("default test passed.");
- }
- }
- else
- {
- int i = 0, p = 0;
- for (String svc : argv)
- {
- p += testRsdExchange("Test " + (++i), svc) ? 1 : 0;
- }
- System.err.println("" + p + " out of " + i + " tests passed.");
-
- }
- }
-
- private static boolean testRsdExchange(String desc, String servicestring)
- {
- try
- {
- RestServiceDescription newService = new RestServiceDescription(
- servicestring);
- if (!newService.isValid())
- {
- throw new Error("Failed to create service from '" + servicestring
- + "'.\n" + newService.getInvalidMessage());
- }
- return testRsdExchange(desc, newService);
- } catch (Throwable x)
- {
- System.err.println("Failed for service (" + desc + "): "
- + servicestring);
- x.printStackTrace();
- return false;
- }
- }
-
- private static boolean testRsdExchange(String desc,
- RestServiceDescription service)
- {
- try
- {
- String fromservicetostring = service.toString();
- RestServiceDescription newService = new RestServiceDescription(
- fromservicetostring);
- if (!newService.isValid())
- {
- throw new Error("Failed to create service from '"
- + fromservicetostring + "'.\n"
- + newService.getInvalidMessage());
- }
-
- if (!service.equals(newService))
- {
- System.err.println("Failed for service (" + desc + ").");
- System.err.println("Original service and parsed service differ.");
- System.err.println("Original: " + fromservicetostring);
- System.err.println("Parsed : " + newService.toString());
- return false;
- }
- } catch (Throwable x)
- {
- System.err.println("Failed for service (" + desc + "): "
- + service.toString());
- x.printStackTrace();
- return false;
- }
- return true;
- }
-
/**
* covenience method to generate the id and sequence string vector from a set
* of seuqences using each sequence's getName() and getSequenceAsString()
@@ -1070,26 +870,37 @@ public class RestServiceDescription
/**
* parse a concatenated list of rest service descriptions into an array
+ *
* @param services
* @return zero or more services.
- * @throws exceptions if the services are improperly encoded.
+ * @throws exceptions
+ * if the services are improperly encoded.
*/
- public static List<RestServiceDescription> parseDescriptions(String services) throws Exception
+ public static List<RestServiceDescription> parseDescriptions(
+ String services) throws Exception
{
- String[] list = separatorListToArray(services, "|");
+ String[] list = StringUtils.separatorListToArray(services, "|");
List<RestServiceDescription> svcparsed = new ArrayList<RestServiceDescription>();
- int p=0,lastp=0;
- StringBuffer warnings=new StringBuffer();
- do {
+ int p = 0, lastp = 0;
+ StringBuffer warnings = new StringBuffer();
+ do
+ {
RestServiceDescription rsd = new RestServiceDescription();
- p=rsd.parseServiceList(list, warnings, lastp=p);
- if (p>lastp && rsd.isValid())
+ p = rsd.parseServiceList(list, warnings, lastp = p);
+ if (p > lastp && rsd.isValid())
{
svcparsed.add(rsd);
- } else {
- throw new Exception("Failed to parse user defined RSBS services from :"+services+"\nFirst error was encountered at token "+lastp+" starting "+list[lastp]+":\n"+rsd.getInvalidMessage());
}
- } while (p<lastp && p<list.length-1);
+ else
+ {
+ throw new Exception(
+ "Failed to parse user defined RSBS services from :"
+ + services
+ + "\nFirst error was encountered at token " + lastp
+ + " starting " + list[lastp] + ":\n"
+ + rsd.getInvalidMessage());
+ }
+ } while (p < lastp && p < list.length - 1);
return svcparsed;
}
diff --git a/src/jalview/ws/rest/params/Alignment.java b/src/jalview/ws/rest/params/Alignment.java
index 0cd1578..d7b1fc7 100644
--- a/src/jalview/ws/rest/params/Alignment.java
+++ b/src/jalview/ws/rest/params/Alignment.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
@@ -24,19 +27,13 @@ import jalview.ws.params.simple.Option;
import jalview.ws.rest.InputType;
import jalview.ws.rest.NoValidInputDataException;
import jalview.ws.rest.RestJob;
-import jalview.ws.rest.InputType.molType;
-import jalview.ws.rest.RestServiceDescription;
import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
-import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -55,8 +52,7 @@ public class Alignment extends InputType
{
public Alignment()
{
- super(new Class[]
- { AlignmentI.class });
+ super(new Class[] { AlignmentI.class });
}
String format = "FASTA";
@@ -68,7 +64,7 @@ public class Alignment extends InputType
/**
* input data as a file upload rather than inline content
*/
- public boolean writeAsFile=false;
+ public boolean writeAsFile = false;
@Override
public ContentBody formatForInput(RestJob rj)
@@ -186,20 +182,25 @@ public class Alignment extends InputType
}
return false;
}
+
@Override
public List<OptionI> getOptions()
{
List<OptionI> lst = getBaseOptions();
- lst.add(new BooleanOption("jvsuffix","Append jalview style /start-end suffix to ID", false, false, jvsuffix, null));
- lst.add(new BooleanOption("writeasfile","Append jalview style /start-end suffix to ID", false, false, writeAsFile, null));
-
- lst.add(new Option("format",
- "Alignment upload format", true, "FASTA",
- format, Arrays.asList(jalview.io.FormatAdapter.WRITEABLE_FORMATS), null));
- lst.add(createMolTypeOption("type", "Sequence type", false, type,
+ lst.add(new BooleanOption("jvsuffix",
+ "Append jalview style /start-end suffix to ID", false, false,
+ jvsuffix, null));
+ lst.add(new BooleanOption("writeasfile",
+ "Append jalview style /start-end suffix to ID", false, false,
+ writeAsFile, null));
+
+ lst.add(new Option("format", "Alignment upload format", true, "FASTA",
+ format, Arrays
+ .asList(jalview.io.FormatAdapter.WRITEABLE_FORMATS),
null));
-
+ lst.add(createMolTypeOption("type", "Sequence type", false, type, null));
+
return lst;
}
-}
\ No newline at end of file
+}
diff --git a/src/jalview/ws/rest/params/AnnotationFile.java b/src/jalview/ws/rest/params/AnnotationFile.java
index b05b4ed..dd1f39e 100644
--- a/src/jalview/ws/rest/params/AnnotationFile.java
+++ b/src/jalview/ws/rest/params/AnnotationFile.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
@@ -23,8 +26,6 @@ import jalview.ws.params.simple.Option;
import jalview.ws.rest.InputType;
import jalview.ws.rest.NoValidInputDataException;
import jalview.ws.rest.RestJob;
-import jalview.ws.rest.RestServiceDescription;
-import jalview.ws.rest.InputType.molType;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
@@ -36,55 +37,73 @@ import org.apache.http.entity.mime.content.StringBody;
/**
* format a jalview annotation file for input to a rest service.
+ *
* @author JimP
- *
+ *
*/
-public class AnnotationFile extends InputType {
+public class AnnotationFile extends InputType
+{
public AnnotationFile()
{
- super(new Class[] { AlignmentI.class} );
+ super(new Class[] { AlignmentI.class });
}
+
/**
* standard jalview annotation file
*/
- final String JVANNOT="JalviewAnnotation";
+ final String JVANNOT = "JalviewAnnotation";
+
/**
* export annotation row as simple csv
*/
- final String CSVANNOT="CsvAnnotationRow";
+ final String CSVANNOT = "CsvAnnotationRow";
+
/**
* format of annotation file
*/
- String format=JVANNOT;
+ String format = JVANNOT;
+
// TODO verify annotation file format enumeration
@Override
- public ContentBody formatForInput(RestJob rj) throws UnsupportedEncodingException, NoValidInputDataException
+ public ContentBody formatForInput(RestJob rj)
+ throws UnsupportedEncodingException, NoValidInputDataException
{
- AlignmentI al = rj.getAlignmentForInput(token,molType.MIX);
+ AlignmentI al = rj.getAlignmentForInput(token, molType.MIX);
if (format.equals(JVANNOT))
- {return new StringBody(new jalview.io.AnnotationFile().printAnnotations(al.getAlignmentAnnotation(),
- al.getGroups(),al.getProperties()));
- } else {
- if (!format.equals(CSVANNOT))
- {
- throw new UnsupportedEncodingException("Unrecognised format for exporting Annotation ("+format+")");
- }
- return new StringBody(new jalview.io.AnnotationFile().printCSVAnnotations(al.getAlignmentAnnotation()));
+ {
+ return new StringBody(
+ new jalview.io.AnnotationFile()
+ .printAnnotationsForAlignment(al));
+ }
+ else
+ {
+ if (!format.equals(CSVANNOT))
+ {
+ throw new UnsupportedEncodingException(
+ "Unrecognised format for exporting Annotation (" + format
+ + ")");
}
+ return new StringBody(
+ new jalview.io.AnnotationFile().printCSVAnnotations(al
+ .getAlignmentAnnotation()));
+ }
}
+
@Override
public List<String> getURLEncodedParameter()
{
ArrayList<String> prms = new ArrayList<String>();
super.addBaseParams(prms);
- prms.add("format='"+format+"'");
- return prms;
+ prms.add("format='" + format + "'");
+ return prms;
}
+
@Override
public String getURLtokenPrefix()
{
return "ALANNOTATION";
}
+
@Override
public boolean configureProperty(String tok, String val,
StringBuffer warnings)
@@ -92,7 +111,7 @@ public class AnnotationFile extends InputType {
if (tok.startsWith("format"))
{
- for (String fmt : new String[] { CSVANNOT, JVANNOT})
+ for (String fmt : new String[] { CSVANNOT, JVANNOT })
{
if (val.equalsIgnoreCase(fmt))
{
@@ -102,7 +121,7 @@ public class AnnotationFile extends InputType {
}
warnings.append("Invalid annotation file format '" + val
+ "'. Must be one of (");
- for (String fmt : new String[] { CSVANNOT, JVANNOT})
+ for (String fmt : new String[] { CSVANNOT, JVANNOT })
{
warnings.append(" " + fmt);
}
@@ -110,15 +129,15 @@ public class AnnotationFile extends InputType {
}
return false;
}
+
@Override
public List<OptionI> getOptions()
{
// TODO - consider disregarding base options here.
List<OptionI> lst = getBaseOptions();
- lst.add(new Option("format",
- "Alignment annotation upload format", true, JVANNOT,
- format, Arrays.asList(new String[]
- { JVANNOT, CSVANNOT}), null));
+ lst.add(new Option("format", "Alignment annotation upload format",
+ true, JVANNOT, format, Arrays.asList(new String[] { JVANNOT,
+ CSVANNOT }), null));
return lst;
}
}
diff --git a/src/jalview/ws/rest/params/JobConstant.java b/src/jalview/ws/rest/params/JobConstant.java
index 6534e93..da12bb9 100644
--- a/src/jalview/ws/rest/params/JobConstant.java
+++ b/src/jalview/ws/rest/params/JobConstant.java
@@ -1,22 +1,26 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest.params;
+import jalview.util.MessageManager;
import jalview.ws.params.OptionI;
import jalview.ws.rest.InputType;
import jalview.ws.rest.NoValidInputDataException;
@@ -32,17 +36,21 @@ import org.apache.http.entity.mime.content.StringBody;
/**
* defines a constant value always provided as a parameter.
+ *
* @author JimP
- *
+ *
*/
public class JobConstant extends InputType
{
String value;
+
/**
*
- * @param param name of parameter
- * @param val value of parameter
+ * @param param
+ * name of parameter
+ * @param val
+ * value of parameter
*/
public JobConstant(String param, String val)
{
@@ -56,7 +64,7 @@ public class JobConstant extends InputType
public ContentBody formatForInput(RestJob rj)
throws UnsupportedEncodingException, NoValidInputDataException
{
-
+
return new StringBody(value);
}
@@ -64,15 +72,17 @@ public class JobConstant extends InputType
public List<String> getURLEncodedParameter()
{
ArrayList<String> prm = new ArrayList<String>();
-
- if (value!=null && value.length()>0)
+
+ if (value != null && value.length() > 0)
{
- try {
- prm.add(URLEncoder.encode(value,"UTF-8"));
+ try
+ {
+ prm.add(URLEncoder.encode(value, "UTF-8"));
} catch (UnsupportedEncodingException ex)
{
- throw new Error("Couldn't encode '"+value+"' as UTF-8.",ex);
-
+ throw new Error(MessageManager.formatMessage(
+ "error.couldnt_encode_as_utf8", new String[] { value }), ex);
+
}
}
return prm;
@@ -88,11 +98,13 @@ public class JobConstant extends InputType
public boolean configureFromURLtokenString(List<String> tokenstring,
StringBuffer warnings)
{
- if (tokenstring.size()>1) {
+ if (tokenstring.size() > 1)
+ {
warnings.append("IMPLEMENTATION ERROR: Constant POST parameters cannot have more than one value.");
return false;
}
- if (tokenstring.size()==1) {
+ if (tokenstring.size() == 1)
+ {
value = tokenstring.get(0);
}
return true;
diff --git a/src/jalview/ws/rest/params/SeqGroupIndexVector.java b/src/jalview/ws/rest/params/SeqGroupIndexVector.java
index f02c262..6bc208b 100644
--- a/src/jalview/ws/rest/params/SeqGroupIndexVector.java
+++ b/src/jalview/ws/rest/params/SeqGroupIndexVector.java
@@ -1,25 +1,29 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.util.MessageManager;
import jalview.ws.params.OptionI;
import jalview.ws.params.simple.IntegerParameter;
import jalview.ws.params.simple.Option;
@@ -27,14 +31,11 @@ import jalview.ws.rest.AlignmentProcessor;
import jalview.ws.rest.InputType;
import jalview.ws.rest.NoValidInputDataException;
import jalview.ws.rest.RestJob;
-import jalview.ws.rest.RestServiceDescription;
-import jalview.ws.rest.InputType.molType;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.Vector;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.StringBody;
@@ -52,8 +53,7 @@ public class SeqGroupIndexVector extends InputType implements
{
public SeqGroupIndexVector()
{
- super(new Class[]
- { AlignmentI.class });
+ super(new Class[] { AlignmentI.class });
}
/**
@@ -91,82 +91,69 @@ public class SeqGroupIndexVector extends InputType implements
// assume that alignment is properly ordered so groups form consecutive
// blocks
ArrayList<int[]> gl = new ArrayList<int[]>();
- int p = 0;
- for (SequenceGroup sg : (Vector<SequenceGroup>) al.getGroups())
+ int p = 0, lowest = al.getHeight(), highest = 0;
+ List<SequenceGroup> sgs;
+ synchronized (sgs = al.getGroups())
{
- if (sg.getSize() < minsize)
+ for (SequenceGroup sg : sgs)
{
- throw new NoValidInputDataException("Group contains less than "
- + minsize + " sequences.");
- }
- // TODO: refactor to sequenceGroup for efficiency -
- // getAlignmentRowInterval(AlignmentI al)
- int[] se = null;
- for (SequenceI sq : sg.getSequencesInOrder(al))
- {
- p = al.findIndex(sq);
- if (se == null)
+ if (sg.getSize() < minsize)
+ {
+ throw new NoValidInputDataException(
+ MessageManager
+ .formatMessage(
+ "exception.notvaliddata_group_contains_less_than_min_seqs",
+ new String[] { Integer.valueOf(minsize)
+ .toString() }));
+ }
+ // TODO: refactor to sequenceGroup for efficiency -
+ // getAlignmentRowInterval(AlignmentI al)
+ int[] se = null;
+ for (SequenceI sq : sg.getSequencesInOrder(al))
{
- se = new int[]
- { p, p };
+ p = al.findIndex(sq);
+ if (lowest > p)
+ {
+ lowest = p;
+ }
+ if (highest < p)
+ {
+ highest = p;
+ }
+ if (se == null)
+ {
+ se = new int[] { p, p };
+ }
+ else
+ {
+ if (p < se[0])
+ se[0] = p;
+ if (p > se[1])
+ se[1] = p;
+ }
}
- else
+ if (se != null)
{
- if (p < se[0])
- se[0] = p;
- if (p > se[1])
- se[1] = p;
+ gl.add(se);
}
}
- if (se != null)
- {
- gl.add(se);
- }
}
// are there any more sequences ungrouped that should be added as a single
// remaining group ? - these might be at the start or the end
if (gl.size() > 0)
{
- int[] tail = gl.get(0);
- if (tail[0] > 0)
+ if (lowest - 1 > minsize)
{
- if (1 + tail[0] > minsize)
- {
- gl.add(0, new int[]
- { 0, tail[0] - 1 });
- }
- else
- {
- // lets be intelligent here - if the remaining sequences aren't enough
- // to make a final group, then don't make one.
- // throw new
- // NoValidInputDataException("Group from remaining ungrouped sequences in input contains less than "+minsize+" sequences.");
- }
+ gl.add(0, new int[] { 0, lowest - 2 });
}
- else
+ if ((al.getHeight() - 1 - highest) > minsize)
{
- tail = gl.get(gl.size() - 1);
- if (1 + tail[1] < al.getHeight())
- {
- if (al.getHeight() - (1 + tail[1]) > minsize)
- {
- gl.add(new int[]
- { tail[1] + 1, al.getHeight() - 1 });
- }
- else
- {
- // lets be intelligent here - if the remaining sequences aren't
- // enough to make a final group, then don't make one.
- // throw new
- // NoValidInputDataException("Group from remaining ungrouped sequences in input contains less than "+minsize+" sequences.");
- }
- }
+ gl.add(new int[] { highest + 1, al.getHeight() - 1 });
}
}
else
{
- gl.add(new int[]
- { 0, al.getHeight() - 1 });
+ gl.add(new int[] { 0, al.getHeight() - 1 });
}
if (min >= 0 && gl.size() < min)
{
@@ -292,10 +279,13 @@ public class SeqGroupIndexVector extends InputType implements
List<OptionI> lst = getBaseOptions();
lst.add(new Option("sep",
"Separator character between elements of vector", true, ",",
- sep, Arrays.asList(new String[]
- { " ", ",", ";", "\t", "|" }), null));
- lst.add(new IntegerParameter("minsize", "Minimum size of partition allowed by service", true, 1, minsize, 1,0));
- lst.add(createMolTypeOption("type", "Sequence type", false, type, molType.MIX));
+ sep, Arrays.asList(new String[] { " ", ",", ";", "\t", "|" }),
+ null));
+ lst.add(new IntegerParameter("minsize",
+ "Minimum size of partition allowed by service", true, 1,
+ minsize, 1, 0));
+ lst.add(createMolTypeOption("type", "Sequence type", false, type,
+ molType.MIX));
return lst;
}
diff --git a/src/jalview/ws/rest/params/SeqIdVector.java b/src/jalview/ws/rest/params/SeqIdVector.java
index 559cadf..66703a0 100644
--- a/src/jalview/ws/rest/params/SeqIdVector.java
+++ b/src/jalview/ws/rest/params/SeqIdVector.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
@@ -24,15 +27,11 @@ import jalview.ws.params.simple.Option;
import jalview.ws.rest.InputType;
import jalview.ws.rest.NoValidInputDataException;
import jalview.ws.rest.RestJob;
-import jalview.ws.rest.RestServiceDescription;
-import jalview.ws.rest.InputType.molType;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.StringBody;
@@ -47,8 +46,7 @@ public class SeqIdVector extends InputType
{
public SeqIdVector()
{
- super(new Class[]
- { AlignmentI.class });
+ super(new Class[] { AlignmentI.class });
}
/**
@@ -81,9 +79,9 @@ public class SeqIdVector extends InputType
ArrayList<String> prms = new ArrayList<String>();
super.addBaseParams(prms);
prms.add("sep='" + sep + "'");
- if (type!=null)
+ if (type != null)
{
- prms.add("type='"+type+"'");
+ prms.add("type='" + type + "'");
}
return prms;
}
@@ -129,10 +127,9 @@ public class SeqIdVector extends InputType
List<OptionI> lst = getBaseOptions();
lst.add(new Option("sep",
"Separator character between elements of vector", true, ",",
- sep, Arrays.asList(new String[]
- { " ", ",", ";", "\t", "|" }), null));
- lst.add(createMolTypeOption("type", "Sequence type", false, type,
+ sep, Arrays.asList(new String[] { " ", ",", ";", "\t", "|" }),
null));
+ lst.add(createMolTypeOption("type", "Sequence type", false, type, null));
return lst;
}
}
diff --git a/src/jalview/ws/rest/params/SeqVector.java b/src/jalview/ws/rest/params/SeqVector.java
index 4930e0f..0be6b98 100644
--- a/src/jalview/ws/rest/params/SeqVector.java
+++ b/src/jalview/ws/rest/params/SeqVector.java
@@ -1,20 +1,23 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
@@ -24,8 +27,6 @@ import jalview.ws.params.simple.Option;
import jalview.ws.rest.InputType;
import jalview.ws.rest.NoValidInputDataException;
import jalview.ws.rest.RestJob;
-import jalview.ws.rest.RestServiceDescription;
-import jalview.ws.rest.InputType.molType;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
@@ -34,27 +35,31 @@ import java.util.List;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.StringBody;
-import org.jmol.util.ArrayUtil;
/**
- * input a list of sequences separated by some separator
+ * input a list of sequences separated by some separator
+ *
* @author JimP
- *
+ *
*/
-public class SeqVector extends InputType {
+public class SeqVector extends InputType
+{
String sep;
+
molType type;
+
public SeqVector()
{
- super(new Class[] { AlignmentI.class} );
+ super(new Class[] { AlignmentI.class });
}
@Override
- public ContentBody formatForInput(RestJob rj) throws UnsupportedEncodingException, NoValidInputDataException
+ public ContentBody formatForInput(RestJob rj)
+ throws UnsupportedEncodingException, NoValidInputDataException
{
StringBuffer idvector = new StringBuffer();
- boolean list=false;
- for (SequenceI seq:rj.getSequencesForInput(token, type))
+ boolean list = false;
+ for (SequenceI seq : rj.getSequencesForInput(token, type))
{
if (list)
{
@@ -64,15 +69,16 @@ public class SeqVector extends InputType {
}
return new StringBody(idvector.toString());
}
+
@Override
public List<String> getURLEncodedParameter()
{
ArrayList<String> prms = new ArrayList<String>();
super.addBaseParams(prms);
- prms.add("sep='"+ sep+"'");
- if (type!=null)
+ prms.add("sep='" + sep + "'");
+ if (type != null)
{
- prms.add("type='"+type+"'");
+ prms.add("type='" + type + "'");
}
return prms;
}
@@ -90,20 +96,22 @@ public class SeqVector extends InputType {
if (tok.startsWith("sep"))
{
- sep=val;
+ sep = val;
return true;
}
if (tok.startsWith("type"))
{
- try {
- type=molType.valueOf(val);
+ try
+ {
+ type = molType.valueOf(val);
return true;
} catch (Exception x)
{
- warnings.append("Invalid molecule type '"+val+"'. Must be one of (");
- for (molType v:molType.values())
+ warnings.append("Invalid molecule type '" + val
+ + "'. Must be one of (");
+ for (molType v : molType.values())
{
- warnings.append(" "+v);
+ warnings.append(" " + v);
}
warnings.append(")\n");
}
@@ -117,12 +125,12 @@ public class SeqVector extends InputType {
List<OptionI> lst = getBaseOptions();
lst.add(new Option("sep",
"Separator character between elements of vector", true, ",",
- sep, Arrays.asList(new String[]
- { " ", ",", ";", "\t", "|" }), null));
+ sep, Arrays.asList(new String[] { " ", ",", ";", "\t", "|" }),
+ null));
lst.add(createMolTypeOption("type", "Sequence type", false, type,
molType.MIX));
-
+
return lst;
}
-}
\ No newline at end of file
+}
diff --git a/src/jalview/ws/rest/params/Tree.java b/src/jalview/ws/rest/params/Tree.java
index 50fe7e8..736e155 100644
--- a/src/jalview/ws/rest/params/Tree.java
+++ b/src/jalview/ws/rest/params/Tree.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.rest.params;
-import jalview.datamodel.AlignmentI;
-import jalview.ws.params.ArgumentI;
+import jalview.util.MessageManager;
import jalview.ws.params.OptionI;
import jalview.ws.rest.InputType;
import jalview.ws.rest.RestJob;
-import jalview.ws.rest.RestServiceDescription;
-import jalview.ws.rest.InputType.molType;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
@@ -33,30 +33,37 @@ import org.apache.http.entity.mime.content.ContentBody;
/**
* format a tree for input to a rest service
+ *
* @author JimP
- *
+ *
*/
-public class Tree extends InputType {
+public class Tree extends InputType
+{
public Tree()
{
- super(new Class[] { jalview.analysis.NJTree.class} );
+ super(new Class[] { jalview.analysis.NJTree.class });
}
// TODO specify modifiers for tree output format
@Override
- public ContentBody formatForInput(RestJob rj) throws UnsupportedEncodingException
+ public ContentBody formatForInput(RestJob rj)
+ throws UnsupportedEncodingException
{
// TODO: implement tree inputType
- /*rj.getTreeForInput(token);
- return new StringBody(new ) */
- throw new Error("Tree InputType not yet implemented");
- //return null;
+ /*
+ * rj.getTreeForInput(token); return new StringBody(new )
+ */
+ throw new Error(
+ MessageManager
+ .getString("error.tree_inputtype_not_yet_implemented"));
+ // return null;
}
+
public String getURLtokenPrefix()
{
- return "NEWICK";
+ return "NEWICK";
}
-
+
@Override
public List<String> getURLEncodedParameter()
{
@@ -78,4 +85,4 @@ public class Tree extends InputType {
return getBaseOptions();
}
-}
\ No newline at end of file
+}
diff --git a/src/jalview/ws/seqfetcher/ASequenceFetcher.java b/src/jalview/ws/seqfetcher/ASequenceFetcher.java
index d3385f3..4dcc657 100644
--- a/src/jalview/ws/seqfetcher/ASequenceFetcher.java
+++ b/src/jalview/ws/seqfetcher/ASequenceFetcher.java
@@ -1,334 +1,450 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.seqfetcher;
-
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SequenceI;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-public class ASequenceFetcher
-{
-
- /**
- * set of databases we can retrieve entries from
- */
- protected Hashtable FETCHABLEDBS;
-
- public ASequenceFetcher()
- {
- super();
- }
-
- /**
- * get list of supported Databases
- *
- * @return database source string for each database - only the latest version
- * of a source db is bound to each source.
- */
- public String[] getSupportedDb()
- {
- if (FETCHABLEDBS == null)
- return null;
- String[] sf = new String[FETCHABLEDBS.size()];
- Enumeration e = FETCHABLEDBS.keys();
- int i = 0;
- while (e.hasMoreElements())
- {
- sf[i++] = (String) e.nextElement();
- }
- ;
- return sf;
- }
-
- public boolean isFetchable(String source)
- {
- Enumeration e = FETCHABLEDBS.keys();
- while (e.hasMoreElements())
- {
- String db = (String) e.nextElement();
- if (source.compareToIgnoreCase(db) == 0)
- return true;
- }
- jalview.bin.Cache.log.warn("isFetchable doesn't know about '" + source
- + "'");
- return false;
- }
-
- public SequenceI[] getSequences(jalview.datamodel.DBRefEntry[] refs)
- {
- SequenceI[] ret = null;
- Vector rseqs = new Vector();
- Hashtable queries = new Hashtable();
- for (int r = 0; r < refs.length; r++)
- {
- if (!queries.containsKey(refs[r].getSource()))
- {
- queries.put(refs[r].getSource(), new Vector());
- }
- Vector qset = (Vector) queries.get(refs[r].getSource());
- if (!qset.contains(refs[r].getAccessionId()))
- {
- qset.addElement(refs[r].getAccessionId());
- }
- }
- Enumeration e = queries.keys();
- while (e.hasMoreElements())
- {
- Vector query = null;
- String db = null;
- try
- {
- db = (String) e.nextElement();
- query = (Vector) queries.get(db);
- if (!isFetchable(db))
- throw new Exception(
- "Don't know how to fetch from this database :" + db);
- DbSourceProxy fetcher = getSourceProxy(db);
- boolean doMultiple = fetcher.getAccessionSeparator() != null; // No
- // separator
- // - no
- // Multiple
- // Queries
- Enumeration qs = query.elements();
- while (qs.hasMoreElements())
- {
- StringBuffer qsb = new StringBuffer();
- do
- {
- qsb.append((String) qs.nextElement());
- if (qs.hasMoreElements() && doMultiple) // and not reached limit for
- // multiple queries at one
- // time for this source
- {
- qsb.append(fetcher.getAccessionSeparator());
- }
- } while (doMultiple && qs.hasMoreElements());
-
- AlignmentI seqset = null;
- try
- {
- // create a fetcher and go to it
- seqset = fetcher.getSequenceRecords(qsb.toString());
- } catch (Exception ex)
- {
- System.err.println("Failed to retrieve the following from "
- + db);
- System.err.println(qsb);
- ex.printStackTrace(System.err);
- }
- // TODO: Merge alignment together - perhaps
- if (seqset != null)
- {
- SequenceI seqs[] = seqset.getSequencesArray();
- if (seqs != null)
- {
- for (int is = 0; is < seqs.length; is++)
- {
- rseqs.addElement(seqs[is]);
- seqs[is] = null;
- }
- }
- else
- {
- if (fetcher.getRawRecords() != null)
- {
- System.out.println("# Retrieved from " + db + ":"
- + qs.toString());
- StringBuffer rrb = fetcher.getRawRecords();
- /*
- * for (int rr = 0; rr<rrb.length; rr++) {
- */
- String hdr;
- // if (rr<qs.length)
- // {
- hdr = "# " + db + ":" + qsb.toString();
- /*
- * } else { hdr = "# part "+rr; }
- */
- System.out.println(hdr);
- if (rrb != null)
- System.out.println(rrb);
- System.out.println("# end of " + hdr);
- }
- }
- }
- }
- } catch (Exception ex)
- {
- System.err
- .println("Failed to retrieve the following references from "
- + db);
- Enumeration qv = query.elements();
- int n = 0;
- while (qv.hasMoreElements())
- {
- System.err.print(" " + qv.nextElement() + ";");
- if (n++ > 10)
- {
- System.err.println();
- n = 0;
- }
- }
- System.err.println();
- ex.printStackTrace();
- }
- }
- if (rseqs.size() > 0)
- {
- ret = new SequenceI[rseqs.size()];
- Enumeration sqs = rseqs.elements();
- int si = 0;
- while (sqs.hasMoreElements())
- {
- SequenceI s = (SequenceI) sqs.nextElement();
- ret[si++] = s;
- s.updatePDBIds();
- }
- }
- return ret;
- }
-
- /**
- * Retrieve an instance of the proxy for the given source
- *
- * @param db
- * database source string TODO: add version string/wildcard for
- * retrieval of specific DB source/version combinations.
- * @return an instance of DbSourceProxy for that db.
- */
- public DbSourceProxy getSourceProxy(String db)
- {
- DbSourceProxy dbs = (DbSourceProxy) FETCHABLEDBS.get(db);
- return dbs;
- }
-
- /**
- * constructs and instance of the proxy and registers it as a valid
- * dbrefsource
- *
- * @param dbSourceProxy
- * reference for class implementing
- * jalview.ws.seqfetcher.DbSourceProxy
- * @throws java.lang.IllegalArgumentException
- * if class does not implement jalview.ws.seqfetcher.DbSourceProxy
- */
- protected void addDBRefSourceImpl(Class dbSourceProxy)
- throws java.lang.IllegalArgumentException
- {
- DbSourceProxy proxy = null;
- try
- {
- Object proxyObj = dbSourceProxy.getConstructor(null)
- .newInstance(null);
- if (!DbSourceProxy.class.isInstance(proxyObj))
- {
- throw new IllegalArgumentException(
- dbSourceProxy.toString()
- + " does not implement the jalview.ws.seqfetcher.DbSourceProxy");
- }
- proxy = (DbSourceProxy) proxyObj;
- } catch (IllegalArgumentException e)
- {
- throw e;
- } catch (Exception e)
- {
- // Serious problems if this happens.
- throw new Error("DBRefSource Implementation Exception", e);
- }
- addDbRefSourceImpl(proxy);
- }
-
- /**
- * add the properly initialised DbSourceProxy object 'proxy' to the list of
- * sequence fetchers
- *
- * @param proxy
- */
- protected void addDbRefSourceImpl(DbSourceProxy proxy)
- {
- if (proxy != null)
- {
- if (FETCHABLEDBS == null)
- {
- FETCHABLEDBS = new Hashtable();
- }
- FETCHABLEDBS.put(proxy.getDbSource(), proxy);
- }
- }
-
- /**
- * test if the database handler for dbName contains the given dbProperty
- *
- * @param dbName
- * @param dbProperty
- * @return true if proxy has the given property
- */
- public boolean hasDbSourceProperty(String dbName, String dbProperty)
- {
- // TODO: decide if invalidDbName exception is thrown here.
- DbSourceProxy proxy = getSourceProxy(dbName);
- if (proxy != null)
- {
- if (proxy.getDbSourceProperties() != null)
- {
- return proxy.getDbSourceProperties().containsKey(dbProperty);
- }
- }
- return false;
- }
-
- /**
- * select sources which are implemented by instances of the given class
- *
- * @param class that implements DbSourceProxy
- * @return null or vector of source names for fetchers
- */
- public String[] getDbInstances(Class class1)
- {
- if (!jalview.ws.seqfetcher.DbSourceProxy.class.isAssignableFrom(class1))
- {
- throw new Error(
- "Implmentation Error - getDbInstances must be given a class that implements jalview.ws.seqfetcher.DbSourceProxy (was given '"
- + class1 + "')");
- }
- if (FETCHABLEDBS == null)
- {
- return null;
- }
- String[] sources = null;
- Vector src = new Vector();
- Enumeration dbs = FETCHABLEDBS.keys();
- while (dbs.hasMoreElements())
- {
- String dbn = (String) dbs.nextElement();
- DbSourceProxy dbp = (DbSourceProxy) FETCHABLEDBS.get(dbn);
- if (class1.isAssignableFrom(dbp.getClass()))
- {
- src.addElement(dbn);
- }
- }
- if (src.size() > 0)
- {
- src.copyInto(sources = new String[src.size()]);
- }
- return sources;
- }
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.seqfetcher;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceI;
+import jalview.util.DBRefUtils;
+import jalview.util.MessageManager;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+import java.util.Vector;
+
+public class ASequenceFetcher
+{
+
+ /**
+ * set of databases we can retrieve entries from
+ */
+ protected Hashtable<String, Map<String, DbSourceProxy>> FETCHABLEDBS;
+
+ public ASequenceFetcher()
+ {
+ super();
+ }
+
+ /**
+ * get list of supported Databases
+ *
+ * @return database source string for each database - only the latest version
+ * of a source db is bound to each source.
+ */
+ public String[] getSupportedDb()
+ {
+ if (FETCHABLEDBS == null)
+ {
+ return null;
+ }
+ String[] sf = new String[FETCHABLEDBS.size()];
+ Enumeration e = FETCHABLEDBS.keys();
+ int i = 0;
+ while (e.hasMoreElements())
+ {
+ sf[i++] = (String) e.nextElement();
+ }
+ ;
+ return sf;
+ }
+
+ public boolean isFetchable(String source)
+ {
+ Enumeration e = FETCHABLEDBS.keys();
+ while (e.hasMoreElements())
+ {
+ String db = (String) e.nextElement();
+ if (source.compareToIgnoreCase(db) == 0)
+ {
+ return true;
+ }
+ }
+ jalview.bin.Cache.log.warn("isFetchable doesn't know about '" + source
+ + "'");
+ return false;
+ }
+
+ public SequenceI[] getSequences(jalview.datamodel.DBRefEntry[] refs)
+ {
+ SequenceI[] ret = null;
+ Vector<SequenceI> rseqs = new Vector();
+ Hashtable<String, List<String>> queries = new Hashtable();
+ for (int r = 0; r < refs.length; r++)
+ {
+ if (!queries.containsKey(refs[r].getSource()))
+ {
+ queries.put(refs[r].getSource(), new ArrayList<String>());
+ }
+ List<String> qset = queries.get(refs[r].getSource());
+ if (!qset.contains(refs[r].getAccessionId()))
+ {
+ qset.add(refs[r].getAccessionId());
+ }
+ }
+ Enumeration<String> e = queries.keys();
+ while (e.hasMoreElements())
+ {
+ List<String> query = null;
+ String db = null;
+ db = e.nextElement();
+ query = queries.get(db);
+ if (!isFetchable(db))
+ {
+ reportStdError(db, query, new Exception(
+ "Don't know how to fetch from this database :" + db));
+ continue;
+ }
+ Iterator<DbSourceProxy> fetchers = getSourceProxy(db).iterator();
+ Stack<String> queriesLeft = new Stack<String>();
+ // List<String> queriesFailed = new ArrayList<String>();
+ queriesLeft.addAll(query);
+ while (fetchers.hasNext())
+ {
+ List<String> queriesMade = new ArrayList<String>();
+ HashSet queriesFound = new HashSet<String>();
+ try
+ {
+ DbSourceProxy fetcher = fetchers.next();
+ boolean doMultiple = fetcher.getAccessionSeparator() != null; // No
+ // separator
+ // - no
+ // Multiple
+ // Queries
+ while (!queriesLeft.isEmpty())
+ {
+ StringBuffer qsb = new StringBuffer();
+ do
+ {
+ if (qsb.length() > 0)
+ {
+ qsb.append(fetcher.getAccessionSeparator());
+ }
+ String q = queriesLeft.pop();
+ queriesMade.add(q);
+ qsb.append(q);
+ } while (doMultiple && !queriesLeft.isEmpty());
+
+ AlignmentI seqset = null;
+ try
+ {
+ // create a fetcher and go to it
+ seqset = fetcher.getSequenceRecords(qsb.toString()); // ,
+ // queriesFailed);
+ } catch (Exception ex)
+ {
+ System.err.println("Failed to retrieve the following from "
+ + db);
+ System.err.println(qsb);
+ ex.printStackTrace(System.err);
+ }
+ // TODO: Merge alignment together - perhaps
+ if (seqset != null)
+ {
+ SequenceI seqs[] = seqset.getSequencesArray();
+ if (seqs != null)
+ {
+ for (int is = 0; is < seqs.length; is++)
+ {
+ rseqs.addElement(seqs[is]);
+ DBRefEntry[] frefs = DBRefUtils.searchRefs(seqs[is]
+ .getDBRef(), new DBRefEntry(db, null, null));
+ if (frefs != null)
+ {
+ for (DBRefEntry dbr : frefs)
+ {
+ queriesFound.add(dbr.getAccessionId());
+ queriesMade.remove(dbr.getAccessionId());
+ }
+ }
+ seqs[is] = null;
+ }
+ }
+ else
+ {
+ if (fetcher.getRawRecords() != null)
+ {
+ System.out.println("# Retrieved from " + db + ":"
+ + qsb.toString());
+ StringBuffer rrb = fetcher.getRawRecords();
+ /*
+ * for (int rr = 0; rr<rrb.length; rr++) {
+ */
+ String hdr;
+ // if (rr<qs.length)
+ // {
+ hdr = "# " + db + ":" + qsb.toString();
+ /*
+ * } else { hdr = "# part "+rr; }
+ */
+ System.out.println(hdr);
+ if (rrb != null)
+ {
+ System.out.println(rrb);
+ }
+ System.out.println("# end of " + hdr);
+ }
+
+ }
+ }
+
+ }
+ } catch (Exception ex)
+ {
+ reportStdError(db, queriesMade, ex);
+ }
+ if (queriesMade.size() > 0)
+ {
+ System.out.println("# Adding " + queriesMade.size()
+ + " ids back to queries list for searching again (" + db
+ + ".");
+ queriesLeft.addAll(queriesMade);
+ }
+ }
+ }
+ if (rseqs.size() > 0)
+ {
+ ret = new SequenceI[rseqs.size()];
+ Enumeration sqs = rseqs.elements();
+ int si = 0;
+ while (sqs.hasMoreElements())
+ {
+ SequenceI s = (SequenceI) sqs.nextElement();
+ ret[si++] = s;
+ s.updatePDBIds();
+ }
+ }
+ return ret;
+ }
+
+ public void reportStdError(String db, List<String> queriesMade,
+ Exception ex)
+ {
+
+ System.err.println("Failed to retrieve the following references from "
+ + db);
+ int n = 0;
+ for (String qv : queriesMade)
+ {
+ System.err.print(" " + qv + ";");
+ if (n++ > 10)
+ {
+ System.err.println();
+ n = 0;
+ }
+ }
+ System.err.println();
+ ex.printStackTrace();
+ }
+
+ /**
+ * Retrieve an instance of the proxy for the given source
+ *
+ * @param db
+ * database source string TODO: add version string/wildcard for
+ * retrieval of specific DB source/version combinations.
+ * @return an instance of DbSourceProxy for that db.
+ */
+ public List<DbSourceProxy> getSourceProxy(String db)
+ {
+ List<DbSourceProxy> dbs;
+ Map<String, DbSourceProxy> dblist = FETCHABLEDBS.get(db);
+ if (dblist == null)
+ {
+ return new ArrayList<DbSourceProxy>();
+ }
+ ;
+ if (dblist.size() > 1)
+ {
+ DbSourceProxy[] l = dblist.values().toArray(new DbSourceProxy[0]);
+ int i = 0;
+ String[] nm = new String[l.length];
+ // make sure standard dbs appear first, followed by reference das sources,
+ // followed by anything else.
+ for (DbSourceProxy s : l)
+ {
+ nm[i++] = "" + s.getTier() + s.getDbName().toLowerCase();
+ }
+ jalview.util.QuickSort.sort(nm, l);
+ dbs = new ArrayList<DbSourceProxy>();
+ for (i = l.length - 1; i >= 0; i--)
+ {
+ dbs.add(l[i]);
+ }
+ }
+ else
+ {
+ dbs = new ArrayList<DbSourceProxy>(dblist.values());
+ }
+ return dbs;
+ }
+
+ /**
+ * constructs and instance of the proxy and registers it as a valid
+ * dbrefsource
+ *
+ * @param dbSourceProxy
+ * reference for class implementing
+ * jalview.ws.seqfetcher.DbSourceProxy
+ */
+ protected void addDBRefSourceImpl(
+ Class<? extends DbSourceProxy> dbSourceProxy)
+ throws java.lang.IllegalArgumentException
+ {
+ DbSourceProxy proxy = null;
+ try
+ {
+ DbSourceProxy proxyObj = dbSourceProxy.getConstructor().newInstance();
+ proxy = proxyObj;
+ } catch (IllegalArgumentException e)
+ {
+ throw e;
+ } catch (Exception e)
+ {
+ // Serious problems if this happens.
+ throw new Error(
+ MessageManager
+ .getString("error.dbrefsource_implementation_exception"),
+ e);
+ }
+ addDbRefSourceImpl(proxy);
+ }
+
+ /**
+ * add the properly initialised DbSourceProxy object 'proxy' to the list of
+ * sequence fetchers
+ *
+ * @param proxy
+ */
+ protected void addDbRefSourceImpl(DbSourceProxy proxy)
+ {
+ if (proxy != null)
+ {
+ if (FETCHABLEDBS == null)
+ {
+ FETCHABLEDBS = new Hashtable<String, Map<String, DbSourceProxy>>();
+ }
+ Map<String, DbSourceProxy> slist = FETCHABLEDBS.get(proxy
+ .getDbSource());
+ if (slist == null)
+ {
+ FETCHABLEDBS.put(proxy.getDbSource(),
+ slist = new Hashtable<String, DbSourceProxy>());
+ }
+ slist.put(proxy.getDbName(), proxy);
+ }
+ }
+
+ /**
+ * test if the database handler for dbName contains the given dbProperty when
+ * a dbName resolves to a set of proxies - this method will return the result
+ * of the test for the first instance. TODO implement additional method to
+ * query all sources for a db to find one with a particular property
+ *
+ * @param dbName
+ * @param dbProperty
+ * @return true if proxy has the given property
+ */
+ public boolean hasDbSourceProperty(String dbName, String dbProperty)
+ {
+ // TODO: decide if invalidDbName exception is thrown here.
+
+ List<DbSourceProxy> proxies = getSourceProxy(dbName);
+ if (proxies != null)
+ {
+ for (DbSourceProxy proxy : proxies)
+ {
+ if (proxy.getDbSourceProperties() != null)
+ {
+ return proxy.getDbSourceProperties().containsKey(dbProperty);
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * select sources which are implemented by instances of the given class
+ *
+ * @param class that implements DbSourceProxy
+ * @return null or vector of source names for fetchers
+ */
+ public String[] getDbInstances(Class class1)
+ {
+ if (!jalview.ws.seqfetcher.DbSourceProxy.class.isAssignableFrom(class1))
+ {
+ throw new Error(
+ MessageManager
+ .formatMessage(
+ "error.implementation_error_dbinstance_must_implement_interface",
+ new String[] { class1.toString() }));
+ }
+ if (FETCHABLEDBS == null)
+ {
+ return null;
+ }
+ String[] sources = null;
+ Vector src = new Vector();
+ Enumeration dbs = FETCHABLEDBS.keys();
+ while (dbs.hasMoreElements())
+ {
+ String dbn = (String) dbs.nextElement();
+ for (DbSourceProxy dbp : FETCHABLEDBS.get(dbn).values())
+ {
+ if (class1.isAssignableFrom(dbp.getClass()))
+ {
+ src.addElement(dbn);
+ }
+ }
+ }
+ if (src.size() > 0)
+ {
+ src.copyInto(sources = new String[src.size()]);
+ }
+ return sources;
+ }
+
+ public DbSourceProxy[] getDbSourceProxyInstances(Class class1)
+ {
+ ArrayList<DbSourceProxy> prlist = new ArrayList<DbSourceProxy>();
+ for (String fetchable : getSupportedDb())
+ {
+ for (DbSourceProxy pr : getSourceProxy(fetchable))
+ {
+ if (class1.isInstance(pr))
+ {
+ prlist.add(pr);
+ }
+ }
+ }
+ if (prlist.size() == 0)
+ {
+ return null;
+ }
+ return prlist.toArray(new DbSourceProxy[0]);
+ }
+
+}
diff --git a/src/jalview/ws/seqfetcher/DbSourceProxy.java b/src/jalview/ws/seqfetcher/DbSourceProxy.java
index ea3fc0f..57beea2 100644
--- a/src/jalview/ws/seqfetcher/DbSourceProxy.java
+++ b/src/jalview/ws/seqfetcher/DbSourceProxy.java
@@ -1,131 +1,147 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.seqfetcher;
-
-import jalview.datamodel.AlignmentI;
-
-import java.util.Hashtable;
-
-import com.stevesoft.pat.Regex;
-
-/**
- * generic Reference Retrieval interface for a particular database
- * source/version as cited in DBRefEntry. TODO: add/define property to describe
- * max number of queries that this source can cope with at once. TODO:
- * add/define mechanism for retrieval of Trees and distance matrices from a
- * database (unify with io)
- *
- * @author JimP
- *
- */
-public interface DbSourceProxy
-{
- /**
- *
- * @return source string constant used for this DB source
- */
- public String getDbSource();
-
- /**
- * Short meaningful name for this data source for display in menus or
- * selection boxes.
- *
- * @return String
- */
- public String getDbName();
-
- /**
- *
- * @return version string for this database.
- */
- public String getDbVersion();
-
- /**
- * Separator between individual accession queries for a database that allows
- * multiple IDs to be fetched in a single query. Null implies that only a
- * single ID can be fetched at a time.
- *
- * @return string for separating concatenated queries (as individually
- * validated by the accession validator)
- */
- public String getAccessionSeparator();
-
- /**
- * Regular expression for checking form of query string understood by this
- * source.
- *
- * @return null or a validation regex
- */
- public Regex getAccessionValidator();
-
- /**
- * DbSource properties hash - define the capabilities of this source Property
- * hash methods defined in DbSourceProxyImpl. See constants in
- * jalview.datamodel.DBRefSource for definition of properties.
- *
- * @return
- */
- public Hashtable getDbSourceProperties();
-
- /**
- *
- * @return a test/example query that can be used to validate retrieval and
- * parsing mechanisms
- */
- public String getTestQuery();
-
- /**
- * optionally implemented
- *
- * @param accession
- * @return
- */
- public boolean isValidReference(String accession);
-
- /**
- * make one or more queries to the database and attempt to parse the response
- * into an alignment
- *
- * @param queries
- * @return null if queries were successful but result was not parsable
- * @throws Exception
- * TODO
- */
- public AlignmentI getSequenceRecords(String queries) throws Exception;
-
- /**
- *
- * @return true if a query is currently being made
- */
- public boolean queryInProgress();
-
- /**
- * get the raw reponse from the last set of queries
- *
- * @return one or more string buffers for each individual query
- */
- public StringBuffer getRawRecords();
-
-
- /**
- * Find out more info about the source.
- * @param dbsourceproperty - one of the database reference source properties in jalview.datamodel.DBRefSource
- * @return true if the source has this property
- */
- public boolean isA(Object dbsourceproperty);
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.seqfetcher;
+
+import jalview.datamodel.AlignmentI;
+
+import java.util.Hashtable;
+
+import com.stevesoft.pat.Regex;
+
+/**
+ * generic Reference Retrieval interface for a particular database
+ * source/version as cited in DBRefEntry. TODO: add/define property to describe
+ * max number of queries that this source can cope with at once. TODO:
+ * add/define mechanism for retrieval of Trees and distance matrices from a
+ * database (unify with io)
+ *
+ * @author JimP TODO: promote to API
+ */
+public interface DbSourceProxy
+{
+ /**
+ *
+ * @return source string constant used for this DB source
+ */
+ public String getDbSource();
+
+ /**
+ * Short meaningful name for this data source for display in menus or
+ * selection boxes.
+ *
+ * @return String
+ */
+ public String getDbName();
+
+ /**
+ *
+ * @return version string for this database.
+ */
+ public String getDbVersion();
+
+ /**
+ * Separator between individual accession queries for a database that allows
+ * multiple IDs to be fetched in a single query. Null implies that only a
+ * single ID can be fetched at a time.
+ *
+ * @return string for separating concatenated queries (as individually
+ * validated by the accession validator)
+ */
+ public String getAccessionSeparator();
+
+ /**
+ * Regular expression for checking form of query string understood by this
+ * source. If the Regex includes parenthesis, then the first parenthesis
+ * should yield the same accession string as the one used to annotate the
+ * sequence. This is used to match query strings to returned sequences.
+ *
+ * @return null or a validation regex
+ */
+ public Regex getAccessionValidator();
+
+ /**
+ * DbSource properties hash - define the capabilities of this source Property
+ * hash methods defined in DbSourceProxyImpl. See constants in
+ * jalview.datamodel.DBRefSource for definition of properties.
+ *
+ * @return
+ */
+ public Hashtable getDbSourceProperties();
+
+ /**
+ *
+ * @return a test/example query that can be used to validate retrieval and
+ * parsing mechanisms
+ */
+ public String getTestQuery();
+
+ /**
+ * optionally implemented
+ *
+ * @param accession
+ * @return
+ */
+ public boolean isValidReference(String accession);
+
+ /**
+ * make one or more queries to the database and attempt to parse the response
+ * into an alignment
+ *
+ * @param queries
+ * - one or more queries for database in expected form
+ * @return null if queries were successful but result was not parsable
+ * @throws Exception
+ * - propagated from underlying transport to database (note -
+ * exceptions are not raised if query not found in database)
+ *
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception;
+
+ /**
+ *
+ * @return true if a query is currently being made
+ */
+ public boolean queryInProgress();
+
+ /**
+ * get the raw reponse from the last set of queries
+ *
+ * @return one or more string buffers for each individual query
+ */
+ public StringBuffer getRawRecords();
+
+ /**
+ * Find out more info about the source.
+ *
+ * @param dbsourceproperty
+ * - one of the database reference source properties in
+ * jalview.datamodel.DBRefSource
+ * @return true if the source has this property
+ */
+ public boolean isA(Object dbsourceproperty);
+
+ /**
+ * Tier for this data source
+ *
+ * @return 0 - primary datasource, 1 - das primary source, 2 - secondary
+ */
+ public int getTier();
+}
diff --git a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java
index 1467aaf..f0407ad 100644
--- a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java
+++ b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java
@@ -1,139 +1,140 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.ws.seqfetcher;
-
-import jalview.datamodel.Alignment;
-import jalview.datamodel.DBRefSource;
-import jalview.io.FormatAdapter;
-import jalview.io.IdentifyFile;
-
-import java.util.Hashtable;
-
-/**
- * common methods for implementations of the DbSourceProxy interface.
- *
- * @author JimP
- *
- */
-public abstract class DbSourceProxyImpl implements DbSourceProxy
-{
- public DbSourceProxyImpl()
- {
- // default constructor - do nothing probably.
- }
-
- private Hashtable props = null;
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getDbSourceProperties()
- */
- public Hashtable getDbSourceProperties()
- {
- if (props == null)
- {
- props = new Hashtable();
- }
- return props;
- }
-
- protected void addDbSourceProperty(Object propname)
- {
- addDbSourceProperty(propname, propname);
- }
-
- protected void addDbSourceProperty(Object propname, Object propvalue)
- {
- if (props == null)
- {
- props = new Hashtable();
- }
- props.put(propname, propvalue);
- }
-
- boolean queryInProgress = false;
-
- protected StringBuffer results = null;
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#getRawRecords()
- */
- public StringBuffer getRawRecords()
- {
- return results;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.ws.DbSourceProxy#queryInProgress()
- */
- public boolean queryInProgress()
- {
- return queryInProgress;
- }
-
- /**
- * call to set the queryInProgress flag
- *
- */
- protected void startQuery()
- {
- queryInProgress = true;
- }
-
- /**
- * call to clear the queryInProgress flag
- *
- */
- protected void stopQuery()
- {
- queryInProgress = false;
- }
-
- /**
- * create an alignment from raw text file...
- *
- * @param result
- * @return null or a valid alignment
- * @throws Exception
- */
- protected Alignment parseResult(String result) throws Exception
- {
- Alignment sequences = null;
- String format = new IdentifyFile().Identify(result, "Paste");
- if (FormatAdapter.isValidFormat(format))
- {
- sequences = new FormatAdapter().readFile(result.toString(), "Paste",
- format);
- }
- return sequences;
- }
-
- @Override
- public boolean isA(Object dbsourceproperty)
- {
- assert(dbsourceproperty!=null);
- return (props==null) ? false : props.containsKey(dbsourceproperty);
- }
-
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.seqfetcher;
+
+import jalview.datamodel.AlignmentI;
+import jalview.io.FormatAdapter;
+import jalview.io.IdentifyFile;
+
+import java.util.Hashtable;
+
+/**
+ * common methods for implementations of the DbSourceProxy interface.
+ *
+ * @author JimP
+ *
+ */
+public abstract class DbSourceProxyImpl implements DbSourceProxy
+{
+ public DbSourceProxyImpl()
+ {
+ // default constructor - do nothing probably.
+ }
+
+ private Hashtable props = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSourceProperties()
+ */
+ public Hashtable getDbSourceProperties()
+ {
+ if (props == null)
+ {
+ props = new Hashtable();
+ }
+ return props;
+ }
+
+ protected void addDbSourceProperty(Object propname)
+ {
+ addDbSourceProperty(propname, propname);
+ }
+
+ protected void addDbSourceProperty(Object propname, Object propvalue)
+ {
+ if (props == null)
+ {
+ props = new Hashtable();
+ }
+ props.put(propname, propvalue);
+ }
+
+ boolean queryInProgress = false;
+
+ protected StringBuffer results = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getRawRecords()
+ */
+ public StringBuffer getRawRecords()
+ {
+ return results;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#queryInProgress()
+ */
+ public boolean queryInProgress()
+ {
+ return queryInProgress;
+ }
+
+ /**
+ * call to set the queryInProgress flag
+ *
+ */
+ protected void startQuery()
+ {
+ queryInProgress = true;
+ }
+
+ /**
+ * call to clear the queryInProgress flag
+ *
+ */
+ protected void stopQuery()
+ {
+ queryInProgress = false;
+ }
+
+ /**
+ * create an alignment from raw text file...
+ *
+ * @param result
+ * @return null or a valid alignment
+ * @throws Exception
+ */
+ protected AlignmentI parseResult(String result) throws Exception
+ {
+ AlignmentI sequences = null;
+ String format = new IdentifyFile().Identify(result, "Paste");
+ if (FormatAdapter.isValidFormat(format))
+ {
+ sequences = new FormatAdapter().readFile(result.toString(), "Paste",
+ format);
+ }
+ return sequences;
+ }
+
+ @Override
+ public boolean isA(Object dbsourceproperty)
+ {
+ assert (dbsourceproperty != null);
+ return (props == null) ? false : props.containsKey(dbsourceproperty);
+ }
+
+}
diff --git a/src/jalview/ws/uimodel/AlignAnalysisUIText.java b/src/jalview/ws/uimodel/AlignAnalysisUIText.java
new file mode 100644
index 0000000..09224c9
--- /dev/null
+++ b/src/jalview/ws/uimodel/AlignAnalysisUIText.java
@@ -0,0 +1,134 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.uimodel;
+
+
+public class AlignAnalysisUIText
+{
+
+ private String serviceType;
+
+ public String getServiceType()
+ {
+ return serviceType;
+ }
+
+ private Class client;
+
+ private String calcId;
+
+ public String getCalcId()
+ {
+ return calcId;
+ }
+
+ private String AAconToggle, AAconToggleTooltip, AAeditSettings,
+ AAeditSettingsTooltip;
+
+ private boolean isNa;
+
+ public boolean isNa()
+ {
+ return isNa;
+ }
+
+ public boolean isPr()
+ {
+ return isPr;
+ }
+
+ public boolean isAA()
+ {
+ return isAA;
+ }
+
+ private boolean isPr;
+
+ private boolean isAA;
+
+ public AlignAnalysisUIText(String serviceType, Class<?> client,
+ String calcId, boolean acceptNucl, boolean acceptProt,
+ boolean acceptGaps, String toggle, String toggleTooltip,
+ String settings, String settingsTooltip)
+ {
+ this.serviceType = serviceType;
+ this.calcId = calcId;
+ isNa = acceptNucl;
+ isPr = acceptProt;
+ isAA = acceptGaps;
+ this.client = client;
+ this.AAconToggle = toggle;
+ this.AAconToggleTooltip = toggleTooltip;
+ this.AAeditSettings = settings;
+ this.AAeditSettingsTooltip = settingsTooltip;
+ }
+
+ public Class getClient()
+ {
+ return client;
+ }
+
+ public void setClient(Class client)
+ {
+ this.client = client;
+ }
+
+ public String getAAconToggle()
+ {
+ return AAconToggle;
+ }
+
+ public void setAAconToggle(String aAconToggle)
+ {
+ AAconToggle = aAconToggle;
+ }
+
+ public String getAAconToggleTooltip()
+ {
+ return AAconToggleTooltip;
+ }
+
+ public void setAAconToggleTooltip(String aAconToggleTooltip)
+ {
+ AAconToggleTooltip = aAconToggleTooltip;
+ }
+
+ public String getAAeditSettings()
+ {
+ return AAeditSettings;
+ }
+
+ public void setAAeditSettings(String aAeditSettings)
+ {
+ AAeditSettings = aAeditSettings;
+ }
+
+ public String getAAeditSettingsTooltip()
+ {
+ return AAeditSettingsTooltip;
+ }
+
+ public void setAAeditSettingsTooltip(String aAeditSettingsTooltip)
+ {
+ AAeditSettingsTooltip = aAeditSettingsTooltip;
+ }
+
+}
diff --git a/src/jalview/ws/uimodel/PDBRestRequest.java b/src/jalview/ws/uimodel/PDBRestRequest.java
new file mode 100644
index 0000000..7826fbd
--- /dev/null
+++ b/src/jalview/ws/uimodel/PDBRestRequest.java
@@ -0,0 +1,142 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.ws.uimodel;
+
+import jalview.datamodel.SequenceI;
+import jalview.ws.dbsources.PDBRestClient.PDBDocField;
+
+import java.util.Collection;
+
+/**
+ * Represents the PDB request to be consumed by the PDBRestClient
+ *
+ * @author tcnofoegbu
+ *
+ */
+public class PDBRestRequest
+{
+ private String fieldToSearchBy;
+
+ private String searchTerm;
+
+ private String fieldToSortBy;
+
+ private SequenceI associatedSequence;
+
+ private boolean allowEmptySequence;
+
+ private int responseSize;
+
+ private boolean isSortAscending;
+
+ private Collection<PDBDocField> wantedFields;// = new
+ // Collection<PDBDocField>();
+
+ public String getFieldToSearchBy()
+ {
+ return fieldToSearchBy;
+ }
+
+ public void setFieldToSearchBy(String fieldToSearchBy)
+ {
+ this.fieldToSearchBy = fieldToSearchBy;
+ }
+
+ public String getSearchTerm()
+ {
+ return searchTerm;
+ }
+
+ public void setSearchTerm(String searchTerm)
+ {
+ this.searchTerm = searchTerm;
+ }
+
+ public boolean isAllowEmptySeq()
+ {
+ return allowEmptySequence;
+ }
+
+ public void setAllowEmptySeq(boolean allowEmptySeq)
+ {
+ this.allowEmptySequence = allowEmptySeq;
+ }
+
+ public int getResponseSize()
+ {
+ return responseSize;
+ }
+
+ public void setResponseSize(int responseSize)
+ {
+ this.responseSize = responseSize;
+ }
+
+ public Collection<PDBDocField> getWantedFields()
+ {
+ return wantedFields;
+ }
+
+ public void setWantedFields(Collection<PDBDocField> wantedFields)
+ {
+ this.wantedFields = wantedFields;
+ }
+
+ public String getFieldToSortBy()
+ {
+ return fieldToSortBy;
+ }
+
+ public void setFieldToSortBy(String fieldToSortBy, boolean isSortAscending)
+ {
+ this.fieldToSortBy = fieldToSortBy;
+ this.isSortAscending = isSortAscending;
+ }
+
+ public boolean isAscending()
+ {
+ return isSortAscending;
+ }
+
+ public SequenceI getAssociatedSequence()
+ {
+ return associatedSequence;
+ }
+
+ public void setAssociatedSequence(SequenceI associatedSequence)
+ {
+ this.associatedSequence = associatedSequence;
+ }
+
+ public String getQuery()
+ {
+ return fieldToSearchBy + searchTerm
+ + (isAllowEmptySeq() ? "" : " AND molecule_sequence:['' TO *]");
+ }
+
+ public String toString()
+ {
+ return "Query : " + getQuery() + " sort field: " + fieldToSortBy
+ + " isAsc: " + isAscending() + " Associated Seq : "
+ + associatedSequence;
+ }
+}
diff --git a/src/jalview/ws/uimodel/PDBRestResponse.java b/src/jalview/ws/uimodel/PDBRestResponse.java
new file mode 100644
index 0000000..bbd5e84
--- /dev/null
+++ b/src/jalview/ws/uimodel/PDBRestResponse.java
@@ -0,0 +1,223 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+package jalview.ws.uimodel;
+
+import jalview.datamodel.SequenceI;
+import jalview.ws.dbsources.PDBRestClient.PDBDocField;
+
+import java.util.Collection;
+import java.util.Objects;
+
+import javax.swing.table.DefaultTableModel;
+
+import org.json.simple.JSONObject;
+
+/**
+ * Represents the response model produced by the PDBRestClient upon successful
+ * execution of a given request
+ *
+ * @author tcnofoegbu
+ *
+ */
+public class PDBRestResponse
+{
+ private int numberOfItemsFound;
+
+ private String responseTime;
+
+ private Collection<PDBResponseSummary> searchSummary;
+
+ public int getNumberOfItemsFound()
+ {
+ return numberOfItemsFound;
+ }
+
+ public void setNumberOfItemsFound(int itemFound)
+ {
+ this.numberOfItemsFound = itemFound;
+ }
+
+ public String getResponseTime()
+ {
+ return responseTime;
+ }
+
+ public void setResponseTime(String responseTime)
+ {
+ this.responseTime = responseTime;
+ }
+
+ public Collection<PDBResponseSummary> getSearchSummary()
+ {
+ return searchSummary;
+ }
+
+ public void setSearchSummary(Collection<PDBResponseSummary> searchSummary)
+ {
+ this.searchSummary = searchSummary;
+ }
+
+ /**
+ * Convenience method to obtain a Table model for a given summary List based
+ * on the request parameters
+ *
+ * @param request
+ * the PDBRestRequest object which holds useful information for
+ * creating a table model
+ * @param summariesList
+ * the summary list which contains the data for populating the
+ * table's rows
+ * @return the table model which was dynamically generated
+ */
+ public static DefaultTableModel getTableModel(PDBRestRequest request,
+ Collection<PDBResponseSummary> summariesList)
+ {
+ DefaultTableModel tableModel = new DefaultTableModel()
+ {
+ @Override
+ public boolean isCellEditable(int row, int column)
+ {
+ return false;
+ }
+ };
+ if (request.getAssociatedSequence() != null)
+ {
+ tableModel.addColumn("Ref Sequence"); // Create sequence column header if
+ // exists in the request
+ }
+ for (PDBDocField field : request.getWantedFields())
+ {
+ tableModel.addColumn(field.getName()); // Create sequence column header if
+ // exists in the request
+ }
+
+ for (PDBResponseSummary res : summariesList)
+ {
+ tableModel.addRow(res.getSummaryData()); // Populate table rows with
+ // summary list
+ }
+
+ return tableModel;
+ }
+
+ /**
+ * Model for a unique response summary
+ *
+ */
+ public class PDBResponseSummary
+ {
+ private String pdbId;
+
+ private Object[] summaryRowData;
+
+ private SequenceI associatedSequence;
+
+ public PDBResponseSummary(JSONObject pdbJsonDoc, PDBRestRequest request)
+ {
+ Collection<PDBDocField> diplayFields = request.getWantedFields();
+ SequenceI associatedSeq = request.getAssociatedSequence();
+ int colCounter = 0;
+ summaryRowData = new Object[(associatedSeq != null) ? diplayFields
+ .size() + 1 : diplayFields.size()];
+ if (associatedSeq != null)
+ {
+ this.associatedSequence = associatedSeq;
+ summaryRowData[0] = associatedSequence;
+ colCounter = 1;
+ }
+
+ for (PDBDocField field : diplayFields)
+ {
+ String fieldData = (pdbJsonDoc.get(field.getCode()) == null) ? ""
+ : pdbJsonDoc.get(field.getCode()).toString();
+ if (field.equals(PDBDocField.PDB_ID))
+ {
+ this.pdbId = fieldData;
+ summaryRowData[colCounter++] = this.pdbId;
+ }
+ else
+ {
+ summaryRowData[colCounter++] = fieldData;
+ }
+ }
+ }
+
+ public String getPdbId()
+ {
+ return pdbId;
+ }
+
+ public void setPdbId(String pdbId)
+ {
+ this.pdbId = pdbId;
+ }
+
+ public Object[] getSummaryData()
+ {
+ return summaryRowData;
+ }
+
+ public void setSummaryData(String[] summaryData)
+ {
+ this.summaryRowData = summaryData;
+ }
+
+ /**
+ * Returns a string representation of this object;
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder summaryFieldValues = new StringBuilder();
+ for (Object summaryField : summaryRowData)
+ {
+ summaryFieldValues.append(summaryField.toString()).append("\t");
+ }
+ return summaryFieldValues.toString();
+ }
+
+ /**
+ * Returns hash code value for this object
+ */
+ @Override
+ public int hashCode()
+ {
+ return Objects.hash(this.pdbId, this.toString());
+ }
+
+ /**
+ * Indicates whether some object is equal to this one
+ */
+ @Override
+ public boolean equals(Object that)
+ {
+ if (!(that instanceof PDBResponseSummary))
+ {
+ return false;
+ }
+ PDBResponseSummary another = (PDBResponseSummary) that;
+ return this.toString().equals(another.toString());
+ }
+
+ }
+
+}
diff --git a/src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java b/src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java
deleted file mode 100644
index 7d35dea..0000000
--- a/src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/**
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 19.03.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.das;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
-import java.util.logging.*;
-import javax.xml.parsers.*;
-
-import org.xml.sax.*;
-
-/**
- * A class to perform a DAS features request
- *
- * @author Andreas Prlic Adapted for jalview use.
- * @author Andrew Waterhouse Updated to Das 1.53e feature spec.
- * @author Jim Procter
- */
-public class DAS_FeatureRetrieve
-{
- String version;
-
- List features;
-
- Logger logger;
-
- int comeBackLater;
-
- URL url;
-
- /**
- * @param url
- * the URL the features should be downloaded from
- *
- */
- public DAS_FeatureRetrieve(URL url)
- {
- super();
-
- logger = Logger.getLogger("org.biojava.spice");
- features = new ArrayList();
- comeBackLater = -1;
- this.url = url;
- reload();
- }
-
- /**
- * contact the DAS-feature server again. Usually it is not necessary to call
- * this again, because the constructor already does, but if comeBackLater > -1
- * this should be called again.
- *
- */
- public void reload()
- {
-
- try
- {
-
- InputStream dasInStream = null;
- try
- {
- dasInStream = open(url);
- } catch (Exception e)
- {
- comeBackLater = -1;
- System.out.println("NO RESPONSE FROM " + url);
- logger.log(Level.FINE, "could not open connection to " + url, e);
- return;
- }
-
- SAXParserFactory spfactory = SAXParserFactory.newInstance();
-
- spfactory.setValidating(false);
-
- SAXParser saxParser = null;
-
- try
- {
- saxParser = spfactory.newSAXParser();
- } catch (ParserConfigurationException e)
- {
- e.printStackTrace();
- }
-
- String vali = System.getProperty("XMLVALIDATION");
-
- boolean validation = false;
- if (vali != null)
- {
- if (vali.equals("true"))
- {
- validation = true;
- }
- }
-
- XMLReader xmlreader = saxParser.getXMLReader();
-
- // XMLReader xmlreader = XMLReaderFactory.createXMLReader();
- try
- {
- xmlreader.setFeature("http://xml.org/sax/features/validation",
- validation);
- } catch (SAXException e)
- {
- logger.log(Level.FINE, "Cannot set validation " + validation);
- }
-
- try
- {
- xmlreader
- .setFeature(
- "http://apache.org/xml/features/nonvalidating/load-external-dtd",
- validation);
- } catch (SAXNotRecognizedException e)
- {
- e.printStackTrace();
- logger
- .log(Level.FINE, "Cannot set load-external-dtd "
- + validation);
-
- }
-
- DAS_Feature_Handler cont_handle = new DAS_Feature_Handler();
- cont_handle.setDASCommand(url.toString());
- xmlreader.setContentHandler(cont_handle);
- xmlreader.setErrorHandler(new org.xml.sax.helpers.DefaultHandler());
- InputSource insource = new InputSource();
- insource.setByteStream(dasInStream);
-
- try
- {
- xmlreader.parse(insource);
- features = cont_handle.get_features();
- version = cont_handle.getVersion();
-
- comeBackLater = cont_handle.getComBackLater();
- } catch (Exception e)
- {
- System.out
- .println("Error parsing response from: " + url + "\n" + e);
- logger.log(Level.FINE, "error while parsing response from " + url);
- comeBackLater = -1;
- features = new ArrayList();
- }
- } catch (Exception ex)
- {
- ex.printStackTrace();
- comeBackLater = -1;
- }
- }
-
- /**
- * open HttpURLConnection. Recommended way to open HttpURLConnections, since
- * this take care of setting timeouts properly for java 1.4 and 1.5
- */
- public static HttpURLConnection openHttpURLConnection(URL url)
- throws IOException, ConnectException
- {
- HttpURLConnection huc = null;
- huc = (HttpURLConnection) url.openConnection();
-
- String os_name = java.lang.System.getProperty("os.name");
- String os_version = java.lang.System.getProperty("os.version");
- String os_arch = java.lang.System.getProperty("os.arch");
- String VERSION = "1.0";
-
- String userAgent = "Jalview " + VERSION + "(" + os_name + "; "
- + os_arch + " ; " + os_version + ")";
- // e.g. "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.2) Gecko/20040803"
- huc.addRequestProperty("User-Agent", userAgent);
- // logger.finest("opening "+url);
-
- int timeout = 10000;
- System
- .setProperty("sun.net.client.defaultConnectTimeout", timeout
- + "");
- System.setProperty("sun.net.client.defaultReadTimeout", timeout + "");
-
- // use reflection to determine if get and set timeout methods for
- // urlconnection are available
- // seems java 1.5 does not watch the System properties any longer...
- // and java 1.4 did not provide these...
- // for 1.4 see setSystemProperties
-
- try
- {
- // try to use reflection to set timeout property
- Class urlconnectionClass = Class
- .forName("java.net.HttpURLConnection");
-
- Method setconnecttimeout = urlconnectionClass.getMethod(
- "setConnectTimeout", new Class[]
- { int.class });
- setconnecttimeout.invoke(huc, new Object[]
- { new Integer(timeout) });
-
- Method setreadtimeout = urlconnectionClass.getMethod(
- "setReadTimeout", new Class[]
- { int.class });
- setreadtimeout.invoke(huc, new Object[]
- { new Integer(timeout) });
- // System.out.println("successfully set java 1.5 timeout");
- } catch (Exception e)
- {
- // e.printStackTrace();
- // most likely it was a NoSuchMEthodException and we are running java 1.4.
- }
- return huc;
- }
-
- private InputStream open(URL url) throws java.io.IOException,
- java.net.ConnectException
- {
- InputStream inStream = null;
-
- HttpURLConnection huc = openHttpURLConnection(url);
-
- inStream = huc.getInputStream();
-
- return inStream;
-
- }
-
- /**
- * returns a List of Features
- *
- * @return a List of Maps containing the features
- */
- public List get_features()
- {
-
- return features;
- }
-
- /**
- * Get the version string of the reference object. If it does not match the
- * version string that is obtained from the reference server there is a
- * version problem!
- *
- * @return version string. (e.g. a MD5 digest of the reference sequence)
- */
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- this.version = version;
- }
-
- /**
- * returns the comeBackLater value - if a server returned suchh -
- *
- * @return comeBackLater in seconds, or -1 if not provided by server
- */
- public int getComeBackLater()
- {
-
- return comeBackLater;
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/das/DAS_Feature_Handler.java b/src/org/biojava/dasobert/das/DAS_Feature_Handler.java
deleted file mode 100644
index b6badc7..0000000
--- a/src/org/biojava/dasobert/das/DAS_Feature_Handler.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 19.03.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.das;
-
-import java.util.*;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-/**
- * a class to parse the response of a DAS - Feature request
- *
- * @author Andreas Prlic Adapted for jalview use.
- * @author Andrew Waterhouse Updated to Das 1.53e feature spec.
- * @author Jim Procter
- *
- */
-public class DAS_Feature_Handler extends DefaultHandler
-{
-
- /**
- *
- */
- List features;
-
- boolean first_flag;
-
- HashMap feature;
-
- String featurefield;
-
- StringBuffer characterdata;
-
- String dasCommand;
-
- int comeBackLater;
-
- int maxFeatures;
-
- String segmentId;
-
- String version;
-
- String type_id;
-
- String type_category;
-
- public DAS_Feature_Handler()
- {
- super();
-
- features = new ArrayList();
- first_flag = true;
- featurefield = "";
- characterdata = new StringBuffer();
- dasCommand = "";
- comeBackLater = -1;
- maxFeatures = -1;
- segmentId = "";
- version = "";
- type_id = "";
- type_category = "";
- }
-
- /**
- * get the id information specified int the SEGMENT field of the DAS response
- *
- * @return the segmentId or an emtpy string if not available
- */
- public String getSegmentId()
- {
- return segmentId;
- }
-
- /**
- * get the version informationspecified in the SEGMENT field of the DAS
- * response
- *
- * @return the version information of an empty string if not available
- */
- public String getVersion()
- {
- return version;
- }
-
- public boolean isMD5Checksum()
- {
-
- if ((version != null) && (version.length() == 32))
- return true;
- return false;
- }
-
- /**
- * specifies a maximum number of features to be downloaded. if a server
- * returns more, they will be ignored. default is to load all features
- *
- * @param max
- * the maximium number of features to be downloaded
- */
-
- public void setMaxFeatures(int max)
- {
- maxFeatures = max;
- }
-
- public int getMaxFeatures()
- {
- return maxFeatures;
- }
-
- public void setDASCommand(String cmd)
- {
- dasCommand = cmd;
- }
-
- public String getDASCommand()
- {
- return dasCommand;
- }
-
- public List get_features()
- {
- return features;
- }
-
- public int getComBackLater()
- {
- return comeBackLater;
- }
-
- void start_feature(String uri, String name, String qName, Attributes atts)
- {
-
- if ((maxFeatures > 0) && (features.size() > maxFeatures))
- {
- characterdata = new StringBuffer();
- return;
- }
- feature = new HashMap();
- String id = atts.getValue("id");
- feature.put("id", id);
- feature.put("dassource", dasCommand);
- characterdata = new StringBuffer();
- }
-
- void add_featuredata(String uri, String name, String qName)
- {
- // System.out.println("featurefield "+featurefield+ " data "+characterdata);
- // NOTE can have multiple lines ..
-
- if ((maxFeatures > 0) && (features.size() > maxFeatures))
- {
- return;
- }
-
- String data = (String) feature.get(featurefield);
- String featureText = characterdata.toString();
- if (data != null)
- {
- featureText = data + " " + featureText;
- }
-
- if (qName.equals("TYPE"))
- {
- if (featureText.length() < 1)
- featureText = type_id;
-
- feature.put("TYPE_ID", type_id);
- feature.put("TYPE_CATEGORY", type_category);
- type_id = "";
- type_category = "";
- }
-
- feature.put(featurefield, featureText);
- featurefield = "";
- characterdata = new StringBuffer();
- }
-
- private void addLink(String uri, String name, String qName,
- Attributes atts)
- {
- String href = atts.getValue("href");
- feature.put("LINK", href);
- characterdata = new StringBuffer();
- featurefield = "LINK-TEXT";
-
- }
-
- private void addGroup(String uri, String name, String qName,
- Attributes atts)
- {
- String id = atts.getValue("id");
- feature.put("GROUP", id);
- characterdata = new StringBuffer();
- featurefield = "GROUP";
- }
-
- public void startElement(String uri, String name, String qName,
- Attributes atts)
- {
- // System.out.println("new element "+qName);
-
- if (qName.equals("FEATURE"))
- {
- start_feature(uri, name, qName, atts);
- }
- else if (qName.equals("LINK"))
- {
- addLink(uri, name, qName, atts);
- }
- else if (qName.equals("GROUP"))
- {
- addGroup(uri, name, qName, atts);
- }
- else if (qName.equals("METHOD") || qName.equals("TYPE")
- || qName.equals("START") || qName.equals("END")
- || qName.equals("NOTE") || qName.equals("SCORE")
- || qName.equals("ORIENTATION"))
- {
- characterdata = new StringBuffer();
- featurefield = qName;
- }
- else if (qName.equals("SEGMENT"))
- {
- String id = atts.getValue("id");
- if (id != null)
- segmentId = id;
- String v = atts.getValue("version");
- if (v != null)
- version = v;
-
- }
- if (qName.equals("TYPE"))
- {
- type_id = atts.getValue("id");
- type_category = atts.getValue("category");
- }
-
- }
-
- public void startDocument()
- {
- }
-
- public void endDocument()
- {
- }
-
- public void endElement(String uri, String name, String qName)
- {
-
- if (qName.equals("METHOD") || qName.equals("TYPE")
- || qName.equals("START") || qName.equals("END")
- || qName.equals("NOTE") || qName.equals("LINK")
- || qName.equals("SCORE") || qName.equals("ORIENTATION")
- || qName.equals("GROUP"))
- {
- add_featuredata(uri, name, qName);
- }
- else if (qName.equals("FEATURE"))
- {
-
- if (maxFeatures > 0)
- {
- if (features.size() < maxFeatures)
- {
- features.add(feature);
- }
- }
- else
- {
- // no restriction
- features.add(feature);
- }
- }
- }
-
- public void characters(char ch[], int start, int length)
- {
- if (maxFeatures > 0)
- if (features.size() > maxFeatures)
- return;
-
- for (int i = start; i < start + length; i++)
- {
-
- characterdata.append(ch[i]);
- }
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/das/DAS_Sequence_Handler.java b/src/org/biojava/dasobert/das/DAS_Sequence_Handler.java
deleted file mode 100644
index fe5be8b..0000000
--- a/src/org/biojava/dasobert/das/DAS_Sequence_Handler.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 19.03.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.das;
-
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.Attributes;
-import java.util.logging.*;
-
-/**
- * a class that parses the XML response of a DAS - sequence command.
- *
- * @author Andreas Prlic
- *
- */
-public class DAS_Sequence_Handler extends DefaultHandler
-{
-
- StringBuffer sequence;
-
- int length;
-
- int maxLength;
-
- String version;
-
- boolean dna_flag;
-
- /**
- *
- */
- public DAS_Sequence_Handler()
- {
- super();
-
- sequence = new StringBuffer();
- length = 0;
- dna_flag = false;
- maxLength = -1;
- version = "";
- }
-
- /**
- * set a maximum length of sequence that should be loaded default: -1. if -1
- * no length restriction is being supplied
- *
- * @return the maximum length or -1 if no restriction
- */
- public int getMaxLength()
- {
- return maxLength;
- }
-
- /**
- * set a maximum length of sequence that should be loaded default: -1. if -1
- * no length restriction is being supplied
- *
- * @param maxLength
- * the maximum length or -1 if unrestricted
- */
- public void setMaxLength(int maxLength)
- {
- this.maxLength = maxLength;
- }
-
- public void startElement(String uri, String name, String qName,
- Attributes atts)
- {
-
- if (qName.equals("SEQUENCE"))
- {
- version = atts.getValue("version");
- String lenstr = atts.getValue("stop");
- length = Integer.parseInt(lenstr);
- dna_flag = true;
- }
-
- }
-
- public void characters(char ch[], int start, int length)
- {
-
- if (maxLength > 0)
- if (sequence.length() > maxLength)
- return;
-
- if (dna_flag)
- for (int i = start; i < start + length; i++)
- {
-
- // all sorts of characters can be found in "seqeunces" ... ignore
- // them...
- switch (ch[i])
- {
- case '\\':
- // System.out.print("\\\\");
- break;
- case '"':
- // System.out.print("\\\"");
- break;
- case '\n':
- // System.out.print("\\n");
- break;
- case '\r':
- // System.out.print("\\r");
- break;
- case '\t':
- // System.out.print("\\t");
- break;
- case ' ':
- break;
- default:
- sequence = sequence.append(ch[i]);
-
- break;
- }
- }
-
- }
-
- public String get_sequence()
- {
-
- if (maxLength < 0)
- {
- if (length != sequence.length())
- {
- Logger logger = Logger.getLogger("org.biojava.spice");
- logger.warning("Sequence does not match specified length!");
- }
- }
-
- return sequence.toString();
- }
-
- public String getVersion()
- {
- return version;
- }
-
-}
diff --git a/src/org/biojava/dasobert/das/FeatureThread.java b/src/org/biojava/dasobert/das/FeatureThread.java
deleted file mode 100644
index 172078b..0000000
--- a/src/org/biojava/dasobert/das/FeatureThread.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 21.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.das;
-
-import java.net.*;
-import java.util.*;
-import java.util.logging.*;
-
-import org.biojava.dasobert.dasregistry.*;
-import org.biojava.dasobert.eventmodel.*;
-
-/**
- * a thread that connects to a DAS - Feature service and gets the features
- *
- * @author Andreas Prlic
- */
-
-public class FeatureThread implements Runnable
-{
-
- /**
- * number of times the client tries to reconnect to the server if a "come back
- * later" is returned. the server should provide a reasonable estimation how
- * long it will take him to create results. if this number of requests is
- * still not successfull, give up.
- */
- public static int MAX_COME_BACK_ITERATIONS = 5;
-
- public static int MAX_NR_FEATURES = 300;
-
- static Logger logger = Logger.getLogger("org.biojava.spice");
-
- Das1Source dasSource;
-
- String ac;
-
- List featureListeners;
-
- Thread thread;
-
- public FeatureThread(String accessionCode, Das1Source dasSource)
- {
- this.dasSource = dasSource;
- this.ac = accessionCode;
- featureListeners = new ArrayList();
- }
-
- public void addFeatureListener(FeatureListener li)
- {
- featureListeners.add(li);
- }
-
- public void clearFeatureListeners()
- {
- featureListeners.clear();
- }
-
- public synchronized void stop()
- {
- thread = null;
- notify();
- }
-
- public void run()
- {
- Thread me = Thread.currentThread();
- while (thread == me)
- {
- String url = dasSource.getUrl();
- String queryString = url + "features?segment=" + ac;
- URL cmd = null;
- try
- {
- cmd = new URL(queryString);
- } catch (MalformedURLException e)
- {
- logger.warning("got MalformedURL from das source " + dasSource);
- e.printStackTrace();
-
- }
-
- logger.info("requesting features from " + cmd);
- DAS_FeatureRetrieve ftmp = new DAS_FeatureRetrieve(cmd);
-
- int comeBackLater = ftmp.getComeBackLater();
- int securityCounter = 0;
- while ((thread == me) && (comeBackLater > 0))
- {
- securityCounter++;
- if (securityCounter >= MAX_COME_BACK_ITERATIONS)
- {
- comeBackLater = -1;
- break;
-
- }
- notifyComeBackLater(comeBackLater);
- // server is still calculating - asks us to come back later
- try
- {
- wait(comeBackLater);
- } catch (InterruptedException e)
- {
- comeBackLater = -1;
- break;
- }
-
- ftmp.reload();
- comeBackLater = ftmp.getComeBackLater();
- }
-
- if (!(thread == me))
- {
- break;
- }
-
- List features = ftmp.get_features();
- String version = ftmp.getVersion();
-
- // a fallback mechanism to prevent DAS sources from bringing down spice
- if (features.size() > MAX_NR_FEATURES)
- {
- logger
- .warning("DAS source returned more than " + MAX_NR_FEATURES
- + "features. "
- + " throwing away excess features at " + cmd);
- features = features.subList(0, MAX_NR_FEATURES);
- }
-
- // notify FeatureListeners
- Map[] feats = (Map[]) features.toArray(new Map[features.size()]);
- notifyFeatureListeners(feats, version);
-
- break;
-
- }
- thread = null;
-
- }
-
- public void start()
- {
- thread = new Thread(this);
- thread.start();
- }
-
- private void notifyFeatureListeners(Map[] feats, String version)
- {
- logger.finest("FeatureThread found " + feats.length + " features");
- FeatureEvent fevent = new FeatureEvent(feats, dasSource, version);
- Iterator fiter = featureListeners.iterator();
- while (fiter.hasNext())
- {
- FeatureListener fi = (FeatureListener) fiter.next();
- fi.newFeatures(fevent);
- }
- }
-
- /**
- * the Annotation server requested to be queried again in a while
- *
- * @param comeBackLater
- */
- private void notifyComeBackLater(int comeBackLater)
- {
- FeatureEvent event = new FeatureEvent(new HashMap[0], dasSource, "");
- event.setComeBackLater(comeBackLater);
- Iterator fiter = featureListeners.iterator();
- while (fiter.hasNext())
- {
- FeatureListener fi = (FeatureListener) fiter.next();
- fi.comeBackLater(event);
- }
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/das/SequenceThread.java b/src/org/biojava/dasobert/das/SequenceThread.java
deleted file mode 100644
index 720c60b..0000000
--- a/src/org/biojava/dasobert/das/SequenceThread.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Nov 20, 2005
- *
- */
-package org.biojava.dasobert.das;
-
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.biojava.dasobert.dasregistry.Das1Source;
-import org.biojava.dasobert.eventmodel.SequenceEvent;
-import org.biojava.dasobert.eventmodel.SequenceListener;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.XMLReader;
-import java.util.*;
-
-/**
- * a thread that gets the sequence from a DAS server
- *
- * @author Andreas Prlic
- *
- */
-public class SequenceThread extends Thread
-{
-
- Das1Source[] sequenceServers;
-
- String sp_accession;
-
- List seqListeners;
-
- String version;
-
- static Logger logger = Logger.getLogger("org.biojava.spice");
-
- public SequenceThread(String sp_accession, Das1Source ds)
- {
- super();
- Das1Source[] dss = new Das1Source[1];
- dss[0] = ds;
- this.sp_accession = sp_accession;
- this.sequenceServers = dss;
- clearSequenceListeners();
- version = "";
- }
-
- public SequenceThread(String sp_accession, Das1Source[] ds)
- {
- super();
-
- this.sp_accession = sp_accession;
- this.sequenceServers = ds;
- clearSequenceListeners();
- }
-
- public void clearSequenceListeners()
- {
- seqListeners = new ArrayList();
- }
-
- public void addSequenceListener(SequenceListener lis)
- {
- seqListeners.add(lis);
- }
-
- public void run()
- {
- getSequence();
- }
-
- public void getSequence()
- {
-
- boolean gotSequence = false;
-
- for (int i = 0; i < sequenceServers.length; i++)
- {
-
- if (gotSequence)
- break;
-
- Das1Source ds = sequenceServers[i];
- String url = ds.getUrl();
- char lastChar = url.charAt(url.length() - 1);
- if (!(lastChar == '/'))
- url += "/";
- String dascmd = url + "sequence?segment=";
- String connstr = dascmd + sp_accession;
-
- try
- {
- version = "";
-
- String sequence = retrieveSequence(connstr);
- // TODO: discriminate exceptions caused by connection/server errors and ones caused by the sequence not being found in the reference source.
- if (sequence!=null)
- {
- // bug in aristotle das source?
- sequence.replaceAll(" ", "");
- gotSequence = true;
- // set the sequence ...
-
- triggerNewSequence(sp_accession, sequence, ds, version);
- }
- return;
- } catch (Exception ex)
- {
- ex.printStackTrace();
- logger.warning(ex.getMessage());
-
- // triggerException(ex);
-
- }
- }
-
- logger
- .log(
- Level.WARNING,
- "could not retreive UniProt sequence from any available DAS sequence server");
-
- triggerNoSequence(sp_accession);
-
- }
-
- // private void triggerException(Exception e){
- // Iterator iter = seqListeners.iterator();
- // while (iter.hasNext()){
- // SequenceListener li = (SequenceListener)iter.next();
- // li.exceptionOccured(e);
- // }
- // }
-
- private void triggerNewSequence(String sp_accession, String sequence,
- Das1Source source, String version)
- {
-
- Iterator iter = seqListeners.iterator();
- while (iter.hasNext())
- {
- SequenceListener li = (SequenceListener) iter.next();
- // SequenceEvent event = new SequenceEvent(sequence);
- SequenceEvent event = new SequenceEvent(sp_accession, sequence,
- version);
- event.setSource(source);
- li.newSequence(event);
- }
- }
-
- private void triggerNoSequence(String ac)
- {
-
- Iterator iter = seqListeners.iterator();
- while (iter.hasNext())
- {
- SequenceListener li = (SequenceListener) iter.next();
- li.noObjectFound(ac);
- }
-
- }
-
- /**
- * retrieve the Sequence from a DAS server.
- *
- * @param connstr -
- * the DAS - request string. e.g.
- * http://www.ebi.ac.uk/das-srv/uniprot/das/aristotle/sequence?segment=P00280
- * @return the requested Sequence
- * @throws Exception
- */
- public String retrieveSequence(String connstr) throws Exception
- {
-
- // logger.finest("trying: " + connstr) ;
- URL dasUrl = new URL(connstr);
- // DAS_httpConnector dhtp = new DAS_httpConnector() ;
- logger.info("requesting sequence from " + connstr);
- InputStream dasInStream = open(dasUrl);
-
- SAXParserFactory spfactory = SAXParserFactory.newInstance();
-
- // never do this
- // String vali = System.getProperty("XMLVALIDATION");
- String vali = "false";
- boolean validate = false;
- if ((vali != null) && (vali.equals("true")))
- validate = true;
- spfactory.setValidating(validate);
-
- SAXParser saxParser = null;
-
- try
- {
- saxParser = spfactory.newSAXParser();
- } catch (ParserConfigurationException e)
- {
- // e.printStackTrace();
- logger.log(Level.FINER, "Uncaught exception", e);
- }
-
- XMLReader xmlreader = saxParser.getXMLReader();
-
- try
- {
- xmlreader.setFeature("http://xml.org/sax/features/validation",
- validate);
- } catch (SAXException e)
- {
- logger.finer("Cannot set validation to " + validate);
- logger.log(Level.FINER, "Uncaught exception", e);
- }
-
- try
- {
- xmlreader
- .setFeature(
- "http://apache.org/xml/features/nonvalidating/load-external-dtd",
- validate);
- } catch (SAXNotRecognizedException e)
- {
- // e.printStackTrace();
- logger.finer("Cannot set load-external-dtd to" + validate);
- logger.log(Level.FINER, "Uncaught exception", e);
- // System.err.println("Cannot set load-external-dtd to" + validate);
- }
- if (dasInStream==null)
- {
- return null;
- }
- // DAS_DNA_Handler cont_handle = new DAS_DNA_Handler() ;
- DAS_Sequence_Handler cont_handle = new DAS_Sequence_Handler();
- xmlreader.setContentHandler(cont_handle);
- xmlreader.setErrorHandler(new org.xml.sax.helpers.DefaultHandler());
- InputSource insource = new InputSource();
- insource.setByteStream(dasInStream);
-
- xmlreader.parse(insource);
- String sequence = cont_handle.get_sequence();
- version = cont_handle.getVersion();
- // logger.finest("Got sequence from DAS: " +sequence);
-
- logger.exiting(this.getClass().getName(), "retreiveSequence", sequence);
- return sequence;
- }
-
- private InputStream open(URL url)
- {
- {
-
- InputStream inStream = null;
- try
- {
-
- HttpURLConnection huc = null;
-
- huc = DAS_FeatureRetrieve.openHttpURLConnection(url);
-
- logger.finest(huc.getResponseMessage());
-
- inStream = huc.getInputStream();
-
- } catch (Exception ex)
- {
- ex.printStackTrace();
- logger.log(Level.WARNING, "exception occured", ex);
- }
-
- return inStream;
- }
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/das2/Das2Capability.java b/src/org/biojava/dasobert/das2/Das2Capability.java
deleted file mode 100644
index e91bc77..0000000
--- a/src/org/biojava/dasobert/das2/Das2Capability.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-public interface Das2Capability
-{
-
- public boolean equals(Das2Capability other);
-
- public int hashCode();
-
- public void setCapability(String type);
-
- public String getCapability();
-
- public void setQueryUri(String id);
-
- public String getQueryUri();
-
- public void setFormats(String[] formats);
-
- public String[] getFormats();
-
- /**
- * checks if this capability is actually of das1 style
- *
- * @return boolean true if the capability is in DAS1 style
- */
- public boolean isDas1Style();
-
-}
diff --git a/src/org/biojava/dasobert/das2/Das2CapabilityImpl.java b/src/org/biojava/dasobert/das2/Das2CapabilityImpl.java
deleted file mode 100644
index 196b681..0000000
--- a/src/org/biojava/dasobert/das2/Das2CapabilityImpl.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-public class Das2CapabilityImpl implements Das2Capability
-{
-
- String capability;
-
- String[] formats;
-
- String queryId;
-
- public static String DAS1_CAPABILITY_PREFIX = "das1:";
-
- public Das2CapabilityImpl()
- {
- super();
- capability = "undef";
- queryId = "";
- formats = new String[0];
-
- }
-
- public boolean isDas1Style()
- {
-
- if (capability == null)
- {
- return false;
- }
- if (capability.length() < DAS1_CAPABILITY_PREFIX.length())
- {
- return false;
- }
- if (capability.substring(0, DAS1_CAPABILITY_PREFIX.length()).equals(
- DAS1_CAPABILITY_PREFIX))
- {
- return true;
- }
- return false;
-
- }
-
- public boolean equals(Das2Capability other)
- {
-
- boolean status = true;
-
- if (!capability.equals(other.getCapability()))
- {
- status = false;
- }
- if (!queryId.equals(other.getQueryUri()))
- {
- status = false;
- }
-
- return status;
- }
-
- public int hashCode()
- {
- int h = 7;
- h = 31 * h + (null == capability ? 0 : capability.hashCode());
- h = 31 * h + (null == queryId ? 0 : queryId.hashCode());
-
- return h;
- }
-
- public String toString()
- {
- String txt = "capability " + capability + " queryId " + queryId;
- return txt;
- }
-
- public String getCapability()
- {
-
- return capability;
- }
-
- public String[] getFormats()
- {
- return formats;
- }
-
- public String getQueryUri()
- {
- return queryId;
- }
-
- public void setCapability(String type)
- {
- capability = type;
-
- }
-
- public void setFormats(String[] formats)
- {
-
- this.formats = formats;
- }
-
- public void setQueryUri(String id)
- {
- queryId = id;
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/das2/Das2Source.java b/src/org/biojava/dasobert/das2/Das2Source.java
deleted file mode 100644
index 71d59e0..0000000
--- a/src/org/biojava/dasobert/das2/Das2Source.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-import org.biojava.dasobert.dasregistry.*;
-
-public interface Das2Source extends DasSource
-{
-
- public Das2Capability[] getDas2Capabilities();
-
- public void setDas2Capabilities(Das2Capability[] capabilities);
-
- /**
- * test if this is a DAS1 source represented as a DAS2 source if true - this
- * source can be converted into a DAS1 source by using
- * DasSourceConverter.toDas1(Das2Source);
- *
- * @return true if the DasSource has DAS1 capabilties
- */
- public boolean hasDas1Capabilities();
-}
diff --git a/src/org/biojava/dasobert/das2/Das2SourceImpl.java b/src/org/biojava/dasobert/das2/Das2SourceImpl.java
deleted file mode 100644
index 2f5a7ed..0000000
--- a/src/org/biojava/dasobert/das2/Das2SourceImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-import org.biojava.dasobert.dasregistry.*;
-
-public class Das2SourceImpl extends Das1Source implements Das2Source
-
-{
-
- Das2Capability[] capabilities;
-
- public Das2SourceImpl()
- {
- super();
-
- capabilities = new Das2Capability[0];
- }
-
- /**
- * compare if two DasSources are identical
- *
- */
- public boolean equals(DasSource other)
- {
-
- if (this == other)
- {
- return true;
- }
-
- if ((other == null) || (other.getClass() != this.getClass()))
- {
- return false;
- }
-
- // to compare if two Das2Sources are identical we do the following:
- // we check the capabilities
-
- Das2SourceImpl d2o = (Das2SourceImpl) other;
-
- if (nickname.equals(d2o.getNickname()))
- {
- return true;
- }
-
- Das2Capability[] othercaps = d2o.getDas2Capabilities();
-
- if (!(capabilities.length == othercaps.length))
- {
- return false;
- }
-
- for (int x = 0; x < capabilities.length; x++)
- {
- Das2Capability tmpcap = capabilities[x];
- boolean foundCap = false;
- for (int y = 0; y < othercaps.length; y++)
- {
- Das2Capability tmpcapo = othercaps[y];
- if (tmpcap.equals(tmpcapo))
- {
- foundCap = true;
- }
- }
- if (!foundCap)
- {
- return false;
- }
- }
-
- // TODO?
- // should we add a check for coordinate systems?
- // but we already check for the endpoints, that should be enough...
-
- return true;
-
- }
-
- public int hashCode()
- {
- int h = 7;
-
- h = 31 * h + (null == nickname ? 0 : nickname.hashCode());
-
- for (int x = 0; x < capabilities.length; x++)
- {
- Das2Capability cap = capabilities[x];
- h = 31 * h + cap.hashCode();
- }
-
- return h;
- }
-
- public boolean hasDas1Capabilities()
- {
-
- // test if any of the capabilities is a das1 capabilitiy
-
- for (int i = 0; i < capabilities.length; i++)
- {
- Das2Capability cap = capabilities[i];
- if (cap.isDas1Style())
- {
- return true;
- }
- }
- return false;
-
- }
-
- public String[] getCapabilities()
- {
- // todo mark as not needed / not appropriate ...
- return super.getCapabilities();
- }
-
- public void setCapabilities(String[] u)
- {
- // TODO Auto-generated method stub
- super.setCapabilities(u);
- }
-
- public Das2Capability[] getDas2Capabilities()
- {
- // TODO Auto-generated method stub
- return capabilities;
- }
-
- public void setDas2Capabilities(Das2Capability[] capabilities)
- {
- // TODO Auto-generated method stub
- this.capabilities = capabilities;
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/das2/DasSourceConverter.java b/src/org/biojava/dasobert/das2/DasSourceConverter.java
deleted file mode 100644
index 3e4d8e8..0000000
--- a/src/org/biojava/dasobert/das2/DasSourceConverter.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Mar 23, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-// import org.biojava.bio.program.das.dasalignment.DASException;
-import org.biojava.dasobert.dasregistry.*;
-
-public class DasSourceConverter
-{
-
- public DasSourceConverter()
- {
- super();
-
- }
-
- /**
- * convert a das2 source to a das 1 source. This only will work if is passes
- * the Das2Source.isDas1Source() test i.e. this is really a das1 server there
- *
- * @param das2source
- * a DAS2Source to be converted
- * @return a Das1Source
- * @throws DASException
- */
- public static Das1Source toDas1Source(Das2Source das2source)
- throws Exception
- {
- if (!das2source.hasDas1Capabilities())
- {
- throw new Exception(
- "this das source does not have das1 capabilitites");
- }
-
- Das1Source ds = new Das1Source();
- ds.setAdminemail(das2source.getAdminemail());
- ds.setDescription(das2source.getDescription());
- ds.setHelperurl(das2source.getHelperurl());
- ds.setRegisterDate(das2source.getRegisterDate());
- ds.setLeaseDate(das2source.getLeaseDate());
- ds.setLabels(das2source.getLabels());
- ds.setCoordinateSystem(das2source.getCoordinateSystem());
- ds.setNickname(das2source.getNickname());
- ds.setId(das2source.getId());
- ds.setLabels(das2source.getLabels());
-
- // convert the capabilitites to das1 capabiltities and get the url
- Das2Capability[] caps = das2source.getDas2Capabilities();
- String[] das1capabilitites = new String[caps.length];
- int DASPREFIXLENGTH = Das2CapabilityImpl.DAS1_CAPABILITY_PREFIX
- .length();
-
- for (int i = 0; i < caps.length; i++)
- {
- Das2Capability cap = caps[i];
-
- String c = cap.getCapability();
-
- das1capabilitites[i] = c.substring(DASPREFIXLENGTH, c.length());
-
- String query_uri = cap.getQueryUri();
-
- String url = query_uri.substring(0,
- (query_uri.length() - c.length() + DASPREFIXLENGTH));
- ds.setUrl(url);
- }
- ds.setCapabilities(das1capabilitites);
-
- return ds;
- }
-
-}
diff --git a/src/org/biojava/dasobert/das2/io/DAS2SourceHandler.java b/src/org/biojava/dasobert/das2/io/DAS2SourceHandler.java
deleted file mode 100644
index 0ee0b5e..0000000
--- a/src/org/biojava/dasobert/das2/io/DAS2SourceHandler.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Mar 15, 2006
- *
- */
-package org.biojava.dasobert.das2.io;
-
-import java.util.*;
-
-import org.biojava.dasobert.das2.*;
-import org.biojava.dasobert.dasregistry.*;
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-/**
- * a parser for the DAS2 sources response
- *
- * @author Andreas Prlic
- * @since 6:53:45 PM
- * @version %I% %G%
- */
-public class DAS2SourceHandler extends DefaultHandler
-{
-
- List sources;
-
- Das2Source currentSource;
-
- List coordinates;
-
- List capabilities;
-
- List labels;
-
- public static final String LABELPROPERTY = "label";
-
- public DAS2SourceHandler()
- {
- super();
-
- sources = new ArrayList();
- currentSource = new Das2SourceImpl();
- coordinates = new ArrayList();
- capabilities = new ArrayList();
- labels = new ArrayList();
- }
-
- private void startSource(String uri, String name, String qName,
- Attributes atts)
- {
-
- String id = atts.getValue("uri");
- String title = atts.getValue("title");
- String doc_ref = atts.getValue("doc_href");
- String description = atts.getValue("description");
-
- currentSource.setId(id);
- currentSource.setNickname(title);
- currentSource.setHelperurl(doc_ref);
- currentSource.setDescription(description);
-
- }
-
- private DasCoordinateSystem getCoordinateSystem(String uri, String name,
- String qname, Attributes atts)
- {
- // e.g. uri="http://das.sanger.ac.uk/dasregistry/coordsys/CS_LOCAL6"
- // source="Protein Sequence" authority="UniProt" test_range="P06213" />
- DasCoordinateSystem dcs = new DasCoordinateSystem();
- String id = atts.getValue("uri");
- dcs.setUniqueId(id);
-
- String source = atts.getValue("source");
- dcs.setCategory(source);
-
- String authority = atts.getValue("authority");
- dcs.setName(authority);
-
- String test_range = atts.getValue("test_range");
- dcs.setTestCode(test_range);
-
- try
- {
- String taxidstr = atts.getValue("taxid");
- int taxid = Integer.parseInt(taxidstr);
- dcs.setNCBITaxId(taxid);
- } catch (Exception e)
- {
- }
-
- String version = atts.getValue("version");
- if (version != null)
- {
- dcs.setVersion(version);
- }
-
- return dcs;
- }
-
- public void startElement(String uri, String name, String qName,
- Attributes atts)
- {
- // System.out.println("new element "+qName);
-
- if (qName.equals("SOURCE"))
- {
- // System.out.println("new Source " + atts.getValue(uri));
- currentSource = new Das2SourceImpl();
- coordinates = new ArrayList();
- capabilities = new ArrayList();
-
- startSource(uri, name, qName, atts);
-
- }
- else if (qName.equals("MAINTAINER"))
- {
- String email = atts.getValue("email");
- currentSource.setAdminemail(email);
- }
- else if (qName.equals("COORDINATES"))
- {
- DasCoordinateSystem dcs = getCoordinateSystem(uri, name, qName, atts);
- coordinates.add(dcs);
-
- }
- else if (qName.equals("CAPABILITY"))
- {
- Das2Capability cap = getCapability(uri, name, qName, atts);
- capabilities.add(cap);
- }
- else if (qName.equals("PROPERTY"))
- {
- addProperty(uri, name, qName, atts);
- }
- }
-
- private Das2Capability getCapability(String uri, String name,
- String qName, Attributes atts)
- {
- // e.g <CAPABILITY type="features"
- // query_id="http://das.biopackages.net/das/genome/yeast/S228C/feature" />
- Das2Capability cap = new Das2CapabilityImpl();
-
- String type = atts.getValue("type");
- cap.setCapability(type);
- String query_uri = atts.getValue("query_uri");
- cap.setQueryUri(query_uri);
- return cap;
-
- }
-
- private void addProperty(String uri, String name, String qName,
- Attributes atts)
- {
- String pname = atts.getValue("name");
- String label = atts.getValue("value");
- if (pname.equals(LABELPROPERTY))
- {
- labels.add(label);
- }
- }
-
- public void startDocument()
- {
- sources = new ArrayList();
- coordinates = new ArrayList();
- capabilities = new ArrayList();
- }
-
- public void endElement(String uri, String name, String qName)
- {
- if (qName.equals("SOURCE"))
- {
- currentSource.setDas2Capabilities((Das2Capability[]) capabilities
- .toArray(new Das2Capability[capabilities.size()]));
- // System.out.println("got coordinates " + coordinates.size());
- currentSource.setCoordinateSystem((DasCoordinateSystem[]) coordinates
- .toArray(new DasCoordinateSystem[coordinates.size()]));
-
- currentSource.setLabels((String[]) labels.toArray(new String[labels
- .size()]));
- labels.clear();
-
- // System.out.println("Das2SourceHandler endElement name " + name + " uri
- // " + uri + " qName " + qName);
- // System.out.println("Das2SourceHandler adding to source: " +
- // currentSource.getId());
- sources.add(currentSource);
- currentSource = new Das2SourceImpl();
- }
- }
-
- public DasSource[] getSources()
- {
- // System.out.println("Das2SourceHandler: source size: " + sources.size());
- return (DasSource[]) sources.toArray(new DasSource[sources.size()]);
- }
-
-}
diff --git a/src/org/biojava/dasobert/das2/io/DasSourceReader.java b/src/org/biojava/dasobert/das2/io/DasSourceReader.java
deleted file mode 100644
index 62a28f6..0000000
--- a/src/org/biojava/dasobert/das2/io/DasSourceReader.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 24, 2006
- *
- */
-package org.biojava.dasobert.das2.io;
-
-import java.io.*;
-
-import org.biojava.dasobert.dasregistry.*;
-
-public interface DasSourceReader
-{
-
- public DasSource[] readDasSource(InputStream stream);
-}
diff --git a/src/org/biojava/dasobert/das2/io/DasSourceReaderImpl.java b/src/org/biojava/dasobert/das2/io/DasSourceReaderImpl.java
deleted file mode 100644
index 54afa25..0000000
--- a/src/org/biojava/dasobert/das2/io/DasSourceReaderImpl.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 24, 2006
- *
- */
-package org.biojava.dasobert.das2.io;
-
-import java.io.*;
-import java.net.*;
-import javax.xml.parsers.*;
-
-import org.biojava.dasobert.das.*;
-import org.biojava.dasobert.dasregistry.*;
-import org.xml.sax.*;
-
-public class DasSourceReaderImpl implements DasSourceReader
-{
-
- Exception loggedException;
-
- public DasSourceReaderImpl()
- {
- super();
- loggedException = null;
-
- // open the stream to a server and then parse the result ...
- }
-
- private InputStream open(URL url) throws java.io.IOException,
- java.net.ConnectException
- {
- InputStream inStream = null;
-
- HttpURLConnection huc = DAS_FeatureRetrieve.openHttpURLConnection(url);
-
- inStream = huc.getInputStream();
-
- return inStream;
-
- }
-
- public DasSource[] readDasSource(URL url)
- {
- DasSource[] sources = new DasSource[0];
-
- try
- {
- InputStream stream = open(url);
-
- sources = readDasSource(stream);
- } catch (Exception e)
- {
- System.err.println("Exception for url:"+url);
- e.printStackTrace();
- loggedException = e;
- }
- return sources;
- }
-
- /**
- * read a DAS2 sources response and return a list of DAS sources.
- *
- */
- public DasSource[] readDasSource(InputStream stream)
- {
-
- DasSource[] sources = new DasSource[0];
-
- try
- {
- SAXParserFactory spfactory = SAXParserFactory.newInstance();
-
- spfactory.setValidating(false);
-
- SAXParser saxParser = null;
-
- try
- {
- saxParser = spfactory.newSAXParser();
- } catch (ParserConfigurationException e)
- {
- e.printStackTrace();
- loggedException = e;
- }
-
- String vali = System.getProperty("XMLVALIDATION");
-
- boolean validation = false;
- if (vali != null)
- {
- if (vali.equals("true"))
- {
- validation = true;
- }
- }
-
- XMLReader xmlreader = saxParser.getXMLReader();
-
- // XMLReader xmlreader = XMLReaderFactory.createXMLReader();
- try
- {
- xmlreader.setFeature("http://xml.org/sax/features/validation",
- validation);
- } catch (SAXException e)
- {
- // logger.log(Level.FINE,"Cannot set validation " + validation);
- }
-
- try
- {
- xmlreader
- .setFeature(
- "http://apache.org/xml/features/nonvalidating/load-external-dtd",
- validation);
- } catch (SAXNotRecognizedException e)
- {
- e.printStackTrace();
- // logger.log(Level.FINE,"Cannot set load-external-dtd "+validation);
-
- }
-
- DAS2SourceHandler cont_handle = new DAS2SourceHandler();
-
- xmlreader.setContentHandler(cont_handle);
- xmlreader.setErrorHandler(new org.xml.sax.helpers.DefaultHandler());
- InputSource insource = new InputSource();
- insource.setByteStream(stream);
-
- xmlreader.parse(insource);
- sources = cont_handle.getSources();
-
- } catch (Exception e)
- {
- e.printStackTrace();
- loggedException = e;
- }
- return sources;
- }
-
- public Exception getLoggedException()
- {
- return loggedException;
- }
-
- public static void main(String[] args)
- {
- String url = "http://www.spice-3d.org/dasregistry/das2/sources/";
- DasSourceReaderImpl reader = new DasSourceReaderImpl();
- try
- {
- URL u = new URL(url);
- DasSource[] sources = reader.readDasSource(u);
- for (int i = 0; i < sources.length; i++)
- {
- DasSource ds = sources[i];
- System.out.println(ds.toString());
- }
-
- } catch (Exception e)
- {
- e.printStackTrace();
- }
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/dasregistry/Das1Source.java b/src/org/biojava/dasobert/dasregistry/Das1Source.java
deleted file mode 100644
index c46d709..0000000
--- a/src/org/biojava/dasobert/dasregistry/Das1Source.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 15.04.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.dasregistry;
-
-import java.util.*;
-
-// import org.biojava.dasobert.das2.io.DasSourceWriter;
-// import org.biojava.dasobert.das2.io.DasSourceWriterImpl;
-// import org.biojava.utils.xml.PrettyXMLWriter;
-
-/**
- * a simple Bean class to be returned via SOAP
- *
- * @author Andreas Prlic
- */
-
-public class Das1Source implements DasSource
-{
- String url;
-
- protected String nickname;
-
- String adminemail;
-
- String description;
-
- DasCoordinateSystem[] coordinateSystem;
-
- String[] capabilities;
-
- String[] labels;
-
- String helperurl;
-
- Date registerDate;
-
- Date leaseDate;
-
- String id;
-
- boolean local;
-
- Map properties;
-
- boolean alertAdmin;
-
- public static String EMPTY_ID = "UNK:-1";
-
- public Das1Source()
- {
- id = EMPTY_ID;
- url = "";
- adminemail = "";
- description = "";
- // String empty = "" ;
- nickname = "";
- coordinateSystem = new DasCoordinateSystem[0];
- // coordinateSystem[0] = new DasCoordinateSystem();
- capabilities = new String[0];
- labels = new String[0];
- // capabilities[0] = empty ;
- registerDate = new Date();
- leaseDate = new Date();
- helperurl = "";
- local = true;
- }
-
- public boolean equals(DasSource other)
- {
- System.out.println("Das1Source equals, comparing with other DasSource");
- if (!(other instanceof Das1Source))
- {
- return false;
- }
-
- Das1Source ods = (Das1Source) other;
-
- if (ods.getUrl().equals(url))
- {
- return true;
- }
- if (ods.getNickname().equals(nickname))
- {
- return true;
- }
- return false;
- }
-
- public int hashCode()
- {
- int h = 7;
-
- h = 31 * h + (null == nickname ? 0 : nickname.hashCode());
- h = 31 * h + (null == url ? 0 : url.hashCode());
-
- return h;
- }
-
- /**
- * the DAS2 string representation of this DAS source
- *
- * public String toString() {
- *
- * StringWriter writer = new StringWriter();
- *
- * PrintWriter pw = new PrintWriter(writer); PrettyXMLWriter xw = new
- * PrettyXMLWriter(pw);
- *
- * DasSourceWriter dswriter = new DasSourceWriterImpl(); try {
- * dswriter.writeDasSource(xw,this); } catch (IOException e){
- * e.printStackTrace(); }
- *
- * return writer.toString();
- * }
- */
- public void setLocal(boolean flag)
- {
- local = flag;
- }
-
- public boolean isLocal()
- {
- return local;
- }
-
- public void setId(String i)
- {
- id = i;
- }
-
- /**
- * get a the Id of the DasSource. The Id is a unique db identifier. The public
- * DAS-Registry has Auto_Ids that look like DASSOURCE:12345; public look like
- * XYZ:12345, where the XYZ prefix can be configured in the config file.
- */
- public String getId()
- {
- return id;
- }
-
- public void setNickname(String name)
- {
- nickname = name;
- }
-
- public String getNickname()
- {
- return nickname;
- }
-
- public void setUrl(String u)
- {
- char lastChar = u.charAt(u.length() - 1);
- if (lastChar != '/')
- {
- u += "/";
- }
-
- url = u;
- }
-
- public void setAdminemail(String u)
- {
- adminemail = u;
- }
-
- public void setDescription(String u)
- {
- description = u;
- }
-
- public void setCoordinateSystem(DasCoordinateSystem[] u)
- {
- coordinateSystem = u;
- }
-
- public void setCapabilities(String[] u)
- {
- capabilities = u;
- }
-
- public String getUrl()
- {
- return url;
- }
-
- public String getAdminemail()
- {
- return adminemail;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String[] getCapabilities()
- {
- return capabilities;
- }
-
- /**
- * test if a this source has a particular capability
- *
- * @param testCapability
- * @return <code>true</code> if the server has this capability.
- */
- public boolean hasCapability(String testCapability)
- {
- for (int i = 0; i < capabilities.length; i++)
- {
- String cap = capabilities[i];
- if (cap.equals(testCapability))
- return true;
- }
- return false;
- }
-
- public DasCoordinateSystem[] getCoordinateSystem()
- {
- return coordinateSystem;
- }
-
- public void setRegisterDate(Date d)
- {
- registerDate = d;
- }
-
- public Date getRegisterDate()
- {
- return registerDate;
- }
-
- public void setLeaseDate(Date d)
- {
- leaseDate = d;
- }
-
- public Date getLeaseDate()
- {
- return leaseDate;
- }
-
- public void setLabels(String[] ls)
- {
- labels = ls;
- }
-
- public String[] getLabels()
- {
- return labels;
- }
-
- public void setHelperurl(String url)
- {
- helperurl = url;
- }
-
- public String getHelperurl()
- {
- return helperurl;
- }
-
- public void setAlertAdmin(boolean flag)
- {
- alertAdmin = flag;
- }
-
- public boolean getAlertAdmin()
- {
- return alertAdmin;
- }
-
- public Map getProperties()
- {
- return properties;
- }
-
- public void setProperties(Map properties)
- {
- this.properties = properties;
- }
-
-}
diff --git a/src/org/biojava/dasobert/dasregistry/Das2Validator.java b/src/org/biojava/dasobert/dasregistry/Das2Validator.java
deleted file mode 100644
index fea8a0f..0000000
--- a/src/org/biojava/dasobert/dasregistry/Das2Validator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Mar 20, 2006
- *
- */
-package org.biojava.dasobert.dasregistry;
-
-import org.biojava.dasobert.das2.*;
-
-public class Das2Validator
-{
-
- public Das2Validator()
- {
- super();
-
- }
-
- public boolean validate(Das2Source ds)
- {
-
- // TODO this bit still needs to be implemented!
-
- return true;
- }
-
-}
diff --git a/src/org/biojava/dasobert/dasregistry/DasCoordSysComparator.java b/src/org/biojava/dasobert/dasregistry/DasCoordSysComparator.java
deleted file mode 100644
index dbae74d..0000000
--- a/src/org/biojava/dasobert/dasregistry/DasCoordSysComparator.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 15.04.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.dasregistry;
-
-import java.util.*;
-
-/**
- * a comparator to sort DasSources
- *
- * @author Andreas Prlic
- */
-
-public abstract class DasCoordSysComparator implements Comparator
-{
-
- private final String name;
-
- private static final Map COMPS_BY_NAME;
-
- public DasCoordSysComparator(String str)
- {
- // System.out.println("new dasSourceComparator " + str);
- name = str;
- }
-
- public static final Comparator BY_NAME = new DasCoordSysComparator("name")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getName();
- }
- };
-
- public static final Comparator BY_ID = new DasCoordSysComparator("id")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getUniqueId();
- }
- };
-
- public static final Comparator BY_CATEGORY = new DasCoordSysComparator(
- "category")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getCategory();
- }
- };
-
- public static final Comparator BY_ORGANISM = new DasCoordSysComparator(
- "organism")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getOrganismName();
- }
- };
-
- public static final Comparator BY_TAXID = new DasCoordSysComparator(
- "taxid")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getNCBITaxId() + "";
- }
- };
-
- static
- {
- COMPS_BY_NAME = new HashMap();
- COMPS_BY_NAME.put(BY_ID.toString(), BY_ID);
- COMPS_BY_NAME.put(BY_NAME.toString(), BY_NAME);
- COMPS_BY_NAME.put(BY_CATEGORY.toString(), BY_CATEGORY);
- COMPS_BY_NAME.put(BY_ORGANISM.toString(), BY_ORGANISM);
- COMPS_BY_NAME.put(BY_TAXID.toString(), BY_TAXID);
- }
-
- public static Comparator fromString(String name)
- {
- if (COMPS_BY_NAME.containsKey(name))
- {
- return (Comparator) COMPS_BY_NAME.get(name);
- }
- else
- {
- throw new IllegalArgumentException("Can't compare by key " + name);
- }
- }
-
- protected abstract Comparable getField(DasCoordinateSystem ds);
-
- /** compare two DasCoordSys objects */
- public int compare(Object a, Object b)
- {
- DasCoordinateSystem x = (DasCoordinateSystem) a;
- DasCoordinateSystem y = (DasCoordinateSystem) b;
- return getField(x).compareTo(getField(y));
- }
-
- public String toString()
- {
- return name;
- }
-
-}
diff --git a/src/org/biojava/dasobert/dasregistry/DasCoordinateSystem.java b/src/org/biojava/dasobert/dasregistry/DasCoordinateSystem.java
deleted file mode 100644
index 8936a16..0000000
--- a/src/org/biojava/dasobert/dasregistry/DasCoordinateSystem.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 15.04.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.dasregistry;
-
-/**
- * a Bean to be returned via SOAP. It takes care of the DAS - coordinate Systems
- *
- * @author Andreas Prlic
- */
-public class DasCoordinateSystem
-{
-
- String name;
-
- String category;
-
- String organism_name;
-
- int ncbi_tax_id;
-
- String uniqueId;
-
- String version;
-
- String testCode;
-
- public DasCoordinateSystem()
- {
- uniqueId = "";
- name = "";
- category = "";
- organism_name = "";
- ncbi_tax_id = 0;
- version = "";
- testCode = "";
- }
-
- public boolean equals(DasCoordinateSystem other)
- {
- boolean match = true;
- System.out.println("comparing " + this.toString() + " to "
- + other.toString());
- // URI has piority
- if ((!uniqueId.equals("")) && (uniqueId.equals(other.getUniqueId())))
- {
- return true;
- }
-
- if (ncbi_tax_id != other.getNCBITaxId())
- {
- System.out.println("mismatch in ncbi tax id " + ncbi_tax_id + " != "
- + other.getNCBITaxId());
- match = false;
- }
- if (!version.equals(other.getVersion()))
- {
- System.out.println("mismatch in version");
- match = false;
- }
- if (!category.equals(other.getCategory()))
- {
- System.out.println("mismatch in category");
- match = false;
- }
- if (!name.equals(other.getName()))
- {
- System.out.println("mismatch in name");
- match = false;
- }
- System.out.println(" match: " + match);
-
- return match;
- }
-
- public int hashCode()
- {
- int h = 7;
-
- h = 31 * h + (null == name ? 0 : name.hashCode());
- h = 31 * h + (null == category ? 0 : category.hashCode());
-
- return h;
- }
-
- public Object clone()
- {
- DasCoordinateSystem d = new DasCoordinateSystem();
- d.setTestCode(testCode);
- d.setCategory(category);
- d.setName(name);
- d.setNCBITaxId(ncbi_tax_id);
- d.setUniqueId(getUniqueId());
- d.setOrganismName(getOrganismName());
- d.setVersion(getVersion());
- return d;
- }
-
- public String getTestCode()
- {
- return testCode;
- }
-
- public void setTestCode(String testCode)
- {
- if (testCode == null)
- {
- testCode = "";
- }
- this.testCode = testCode;
- }
-
- public void setUniqueId(String id)
- {
- uniqueId = id;
- }
-
- public String getUniqueId()
- {
- return uniqueId;
- }
-
- public void setName(String n)
- {
- name = n;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setCategory(String c)
- {
- category = c;
- }
-
- public String getCategory()
- {
- return category;
- }
-
- public void setOrganismName(String t)
- {
- organism_name = t;
- }
-
- public String getOrganismName()
- {
- return organism_name;
- }
-
- public void setNCBITaxId(int id)
- {
- ncbi_tax_id = id;
- }
-
- public int getNCBITaxId()
- {
- return ncbi_tax_id;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- if (version == null)
- {
- version = "";
- }
- this.version = version;
- }
-
- public String toString()
- {
- String nam = name;
- if (!version.equals(""))
- {
- nam += "_" + version;
- }
-
- if (organism_name.equals(""))
- {
- return nam + "," + category;
- }
- else
- {
- return nam + "," + category + "," + organism_name;
- }
- }
-
- public static DasCoordinateSystem fromString(String rawString)
- {
- String[] spl = rawString.split(",");
- DasCoordinateSystem dcs = new DasCoordinateSystem();
- if (spl.length == 2)
- {
- dcs.setName(spl[0]);
- dcs.setCategory(spl[1]);
- }
- if (spl.length == 3)
- {
- dcs.setName(spl[0]);
- dcs.setCategory(spl[1]);
- dcs.setOrganismName(spl[2]);
- }
- return dcs;
- }
-
-}
diff --git a/src/org/biojava/dasobert/dasregistry/DasSource.java b/src/org/biojava/dasobert/dasregistry/DasSource.java
deleted file mode 100644
index 892963b..0000000
--- a/src/org/biojava/dasobert/dasregistry/DasSource.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 8, 2006
- *
- */
-package org.biojava.dasobert.dasregistry;
-
-import java.util.*;
-
-public interface DasSource
-{
-
- public void setLocal(boolean flag);
-
- public boolean isLocal();
-
- /**
- * compare if two das sources are equal
- *
- * @param ds
- * @return returns true if two DAS sources are equivalent
- */
- public boolean equals(DasSource ds);
-
- /**
- * classes that implement equals, should also implement hashKey
- *
- * @return the hash code of a das source
- */
- public int hashCode();
-
- public void setId(String i);
-
- /**
- * get a the Id of the DasSource. The Id is a unique db identifier. The public
- * DAS-Registry has Auto_Ids that look like DASSOURCE:12345; public look like
- * XYZ:12345, where the XYZ prefix can be configured in the config file.
- *
- * @return String the ID of a Das Source
- */
- public String getId();
-
- public void setNickname(String name);
-
- public String getNickname();
-
- public void setUrl(String u);
-
- public void setAdminemail(String u);
-
- public void setDescription(String u);
-
- public void setCoordinateSystem(DasCoordinateSystem[] u);
-
- public void setCapabilities(String[] u);
-
- /**
- * test if a this source has a particular capability
- *
- * @param testCapability
- * @return <code>true</code> if the server has this capability.
- */
- public boolean hasCapability(String testCapability);
-
- public String getUrl();
-
- public String getAdminemail();
-
- public String getDescription();
-
- public String[] getCapabilities();
-
- public DasCoordinateSystem[] getCoordinateSystem();
-
- public void setRegisterDate(Date d);
-
- public Date getRegisterDate();
-
- public void setLeaseDate(Date d);
-
- public Date getLeaseDate();
-
- public void setLabels(String[] ls);
-
- public String[] getLabels();
-
- public void setHelperurl(String url);
-
- public String getHelperurl();
-
- // TestCode is now part of the coordinate system!
- // public void setTestCode(String code);
- // public String getTestCode();
-
- public void setAlertAdmin(boolean flag);
-
- public boolean getAlertAdmin();
-
- /**
- * set Properties for this DAS source, e.g. project name
- *
- * @param properties
- */
- public void setProperties(Map properties);
-
- /**
- * get Properties for this DAS source
- *
- * @return Properties
- */
- public Map getProperties();
-
-}
\ No newline at end of file
diff --git a/src/org/biojava/dasobert/dasregistry/DasSourceComparator.java b/src/org/biojava/dasobert/dasregistry/DasSourceComparator.java
deleted file mode 100644
index 0d52fd9..0000000
--- a/src/org/biojava/dasobert/dasregistry/DasSourceComparator.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 15.04.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.dasregistry;
-
-import java.util.*;
-
-/**
- * a comparator to sort DasSources
- *
- * @author Andreas Prlic, Thomas Down
- */
-
-public abstract class DasSourceComparator implements Comparator
-{
-
- private final String name;
-
- private static final Map COMPS_BY_NAME;
-
- private static final int TWODAYS = 1000 * 60 * 60 * 24 * 2;
-
- public DasSourceComparator(String str)
- {
- // System.out.println("new dasSourceComparator " + str);
- name = str;
- }
-
- public static final Comparator BY_ID = new DasSourceComparator("id")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getId();
- }
- };
-
- public static final Comparator BY_NICKNAME = new DasSourceComparator(
- "nickname")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getNickname();
- }
- };
-
- public static final Comparator BY_STATUS = new DasSourceComparator(
- "status")
- {
- protected Comparable getField(DasSource ds)
- {
-
- Date now = new Date();
-
- if (ds.getLeaseDate().getTime() < (now.getTime() - TWODAYS))
- return new Integer(0);
- return new Integer(1);
- }
- };
-
- public static final Comparator BY_REGISTER_DATE = new DasSourceComparator(
- "registerdate")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getRegisterDate();
- }
- };
-
- public static final Comparator BY_LEASE_DATE = new DasSourceComparator(
- "leasedate")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getLeaseDate();
- }
- };
-
- public static final Comparator BY_URL = new DasSourceComparator("url")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getUrl();
- }
- };
-
- public static final Comparator BY_ADMIN_EMAIL = new DasSourceComparator(
- "adminemail")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getAdminemail();
- }
- };
-
- public static final Comparator BY_DESCRIPTION = new DasSourceComparator(
- "description")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getDescription();
- }
- };
-
- public static final Comparator BY_CAPABILITIES = new DasSourceComparator(
- "capabilities")
- {
- protected Comparable getField(DasSource ds)
- {
- String[] caps = ds.getCapabilities();
- return caps.length == 0 ? "" : caps[0];
- }
- };
-
- public static final Comparator BY_COORDINATE_SYSTEM = new DasSourceComparator(
- "coordinateSystem")
- {
- protected Comparable getField(DasSource ds)
- {
- DasCoordinateSystem[] dcss = ds.getCoordinateSystem();
- return dcss.length == 0 ? "" : dcss[0].toString();
- }
- };
-
- static
- {
- COMPS_BY_NAME = new HashMap();
- COMPS_BY_NAME.put(BY_ID.toString(), BY_ID);
- COMPS_BY_NAME.put(BY_NICKNAME.toString(), BY_NICKNAME);
- COMPS_BY_NAME.put(BY_REGISTER_DATE.toString(), BY_REGISTER_DATE);
- COMPS_BY_NAME.put(BY_LEASE_DATE.toString(), BY_LEASE_DATE);
- COMPS_BY_NAME.put(BY_URL.toString(), BY_URL);
- COMPS_BY_NAME.put(BY_ADMIN_EMAIL.toString(), BY_ADMIN_EMAIL);
- COMPS_BY_NAME.put(BY_DESCRIPTION.toString(), BY_DESCRIPTION);
- COMPS_BY_NAME.put(BY_CAPABILITIES.toString(), BY_CAPABILITIES);
- COMPS_BY_NAME
- .put(BY_COORDINATE_SYSTEM.toString(), BY_COORDINATE_SYSTEM);
- COMPS_BY_NAME.put(BY_STATUS.toString(), BY_STATUS);
-
- }
-
- public static Comparator fromString(String name)
- {
- if (COMPS_BY_NAME.containsKey(name))
- {
- return (Comparator) COMPS_BY_NAME.get(name);
- }
- else
- {
- throw new IllegalArgumentException("Can't compare by key " + name);
- }
- }
-
- protected abstract Comparable getField(DasSource ds);
-
- /** compare two DasSource objects */
- public int compare(Object a, Object b)
- {
-
- DasSource x = (DasSource) a;
- DasSource y = (DasSource) b;
- return getField(x).compareTo(getField(y));
- }
-
- public String toString()
- {
- return name;
- }
-
-}
diff --git a/src/org/biojava/dasobert/eventmodel/AbstractDasEvent.java b/src/org/biojava/dasobert/eventmodel/AbstractDasEvent.java
deleted file mode 100644
index d8cbebe..0000000
--- a/src/org/biojava/dasobert/eventmodel/AbstractDasEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Nov 17, 2006
- *
- */
-
-package org.biojava.dasobert.eventmodel;
-
-import org.biojava.dasobert.dasregistry.Das1Source;
-
-public class AbstractDasEvent
-{
-
- Das1Source dasSource;
-
- public Das1Source getSource()
- {
- return dasSource;
- }
-
- public void setSource(Das1Source source)
- {
- this.dasSource = source;
- }
-
-}
diff --git a/src/org/biojava/dasobert/eventmodel/FeatureEvent.java b/src/org/biojava/dasobert/eventmodel/FeatureEvent.java
deleted file mode 100644
index dd89ef3..0000000
--- a/src/org/biojava/dasobert/eventmodel/FeatureEvent.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Oct 28, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-import java.util.*;
-
-import org.biojava.dasobert.dasregistry.*;
-
-public class FeatureEvent extends AbstractDasEvent
-{
-
- Map[] features;
-
- int comeBackLater;
-
- String version;
-
- public FeatureEvent(Map[] features, Das1Source dasSource, String version)
- {
- super();
- this.features = features;
- this.dasSource = dasSource;
- comeBackLater = -1;
- this.version = version;
- }
-
- public int getComeBackLater()
- {
- return comeBackLater;
- }
-
- public void setComeBackLater(int comeBackLater)
- {
- this.comeBackLater = comeBackLater;
- }
-
- /**
- * get the features that have been found.
- *
- * do something like Map[] features = event.getFeatures();
- *
- * <pre>
- * for (int i = 0; i < features; i++)
- * {
- * Map f = features[i];
- * String type = (String) f.get("TYPE");
- * System.out.println(type);
- * }
- * </pre>
- *
- * @return a Map containng the features
- */
- public Map[] getFeatures()
- {
- return features;
- }
-
- /**
- * Get the version of the reference object that has been annotated. Compare
- * the version string with the version string obtained from the reference
- * server. If they don;t match there is a version problem between the
- * annotation and the reference!
- *
- * @return the version string (e.g. an MD5 digest of the reference sequence)
- */
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- this.version = version;
- }
-
-}
diff --git a/src/org/biojava/dasobert/eventmodel/FeatureListener.java b/src/org/biojava/dasobert/eventmodel/FeatureListener.java
deleted file mode 100644
index 235c486..0000000
--- a/src/org/biojava/dasobert/eventmodel/FeatureListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Oct 28, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-// import org.biojava.spice.multipanel.eventmodel.FeatureEvent;
-
-/**
- * a feature listener that returns the raw features as returned by a DAS source.
- *
- */
-public interface FeatureListener
-{
-
- /**
- * new features have been returned from the Annotation server
- *
- * @param e
- */
- public void newFeatures(FeatureEvent e);
-
- /**
- * the server says that he is busy and we should try again in x seconds
- *
- * @param e
- */
- public void comeBackLater(FeatureEvent e);
-
-}
diff --git a/src/org/biojava/dasobert/eventmodel/ObjectListener.java b/src/org/biojava/dasobert/eventmodel/ObjectListener.java
deleted file mode 100644
index a19ae4d..0000000
--- a/src/org/biojava/dasobert/eventmodel/ObjectListener.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Nov 1, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-/**
- * an interface for the listeners of new PDB code requested / new Uniprot code
- * requested
- *
- * @author Andreas Prlic
- *
- */
-public interface ObjectListener
-{
-
- /**
- * a new object has been requested
- *
- * @param accessionCode
- */
- public void newObjectRequested(String accessionCode);
-
- /**
- * no object with that accessionCode has been found
- *
- * @param accessionCode
- */
- public void noObjectFound(String accessionCode);
-
- // public void exceptionOccured(Exception e);
-
-}
diff --git a/src/org/biojava/dasobert/eventmodel/SequenceEvent.java b/src/org/biojava/dasobert/eventmodel/SequenceEvent.java
deleted file mode 100644
index 484cf49..0000000
--- a/src/org/biojava/dasobert/eventmodel/SequenceEvent.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Nov 20, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-public class SequenceEvent extends AbstractDasEvent
-{
-
- String sequence;
-
- String accessionCode;
-
- String version;
-
- public SequenceEvent(String accessionCode, String seq, String version)
- {
- super();
- sequence = seq;
- this.accessionCode = accessionCode;
- this.version = version; // bugfix here ?
- }
-
- public String getAccessionCode()
- {
- return accessionCode;
- }
-
- public String getSequence()
- {
- return sequence;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- this.version = version;
- }
-
-}
diff --git a/src/org/biojava/dasobert/eventmodel/SequenceListener.java b/src/org/biojava/dasobert/eventmodel/SequenceListener.java
deleted file mode 100644
index df3a687..0000000
--- a/src/org/biojava/dasobert/eventmodel/SequenceListener.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Jun 10, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-/**
- * An interface fore events related to selections of sequence position, sequence
- * range and locking of the selection.
- *
- * @author Andreas Prlic
- *
- */
-public interface SequenceListener extends ObjectListener
-{
-
- /* select a certain sequence position */
- public void selectedSeqPosition(int position);
-
- /**
- * select a certain range of a sequence
- *
- * @param start
- * the start
- * @param end
- * the end of the range
- */
- public void selectedSeqRange(int start, int end);
-
- /**
- * the current selecetion is locked and can not be changed
- *
- * @param flag
- * true if selection should be locked
- */
- public void selectionLocked(boolean flag);
-
- public void newSequence(SequenceEvent e);
-
- /**
- * clear what has been selected
- *
- *
- */
- public void clearSelection();
-}
diff --git a/src/org/biojava/dasobert/feature/AbstractFeatureTrack.java b/src/org/biojava/dasobert/feature/AbstractFeatureTrack.java
deleted file mode 100644
index 0ad2df7..0000000
--- a/src/org/biojava/dasobert/feature/AbstractFeatureTrack.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2005
- *
- */
-package org.biojava.dasobert.feature;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * An Abstract class representing a Feature as being diplayed in the
- * SeqFeaturePanel A feature corresponds to everything that is visible in a
- * "line" and can contain one or multiple Segments.
- *
- *
- * @author Andreas Prlic
- *
- */
-public abstract class AbstractFeatureTrack implements FeatureTrack,
- Cloneable
-{
-
- String name;
-
- String method;
-
- String type;
-
- List segments;
-
- String note;
-
- String link;
-
- String source;
-
- String score;
-
- String orientation;
-
- String typeID;
-
- String typeCategory;
-
- public AbstractFeatureTrack()
- {
- source = "Unknown";
- method = "Unknown";
- type = "Unknown";
- note = "";
- link = "";
- score = "";
- orientation = null;
- segments = new ArrayList();
-
- }
-
- public abstract Object clone();
-
- public String toString()
- {
- String str = "Feature: method: " + method + " type: " + type;
- if (name != null)
- str += " name: " + name;
-
- if ((note != null) && (!note.equals("null")))
- {
- if (note.length() > 40)
- str += "note: " + note.substring(0, 39) + "...";
- else
- str += " note: " + note;
- }
- str += " # segments: " + segments.size();
- return str;
- }
-
- /**
- * returns true if the specified sequence position is within the range of this
- * Feature
- *
- * @param seqPosition
- * the position to check
- * @return true if the position is within the ranges of the segments of this
- * feature
- */
- public boolean overlaps(int seqPosition)
- {
- List segments = getSegments();
- Iterator iter = segments.iterator();
-
- while (iter.hasNext())
- {
-
- Segment seg = (Segment) iter.next();
- if (seg.overlaps(seqPosition))
- return true;
- }
-
- return false;
- }
-
- public void setSource(String s)
- {
- source = s;
- }
-
- public String getSource()
- {
- return source;
- };
-
- public void setName(String nam)
- {
- name = nam;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setMethod(String methd)
- {
- method = methd;
- }
-
- public String getMethod()
- {
- return method;
- }
-
- public void setType(String typ)
- {
- type = typ;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setNote(String nte)
- {
- if (nte != null)
- note = nte;
- }
-
- public String getNote()
- {
- return note;
- }
-
- public void setLink(String lnk)
- {
- link = lnk;
- }
-
- public String getLink()
- {
- return link;
- }
-
- public void setScore(String s)
- {
- score = s;
- }
-
- public String getScore()
- {
- return score;
- }
-
- /** add a segment to this feature */
- public void addSegment(int start, int end, String name)
- {
- Segment s = new SegmentImpl();
- s.setStart(start);
- s.setEnd(end);
- s.setName(name);
- s.setParent(this);
- segments.add(s);
- }
-
- public void addSegment(Segment s)
- {
- s.setParent(this);
- segments.add(s);
- }
-
- public List getSegments()
- {
- return segments;
- }
-
- public String getOrientation()
- {
- return orientation;
- }
-
- public void setOrientation(String orientation)
- {
- this.orientation = orientation;
- }
-
- /**
- * test if two features are equivalent important: only comares type,method and
- * source. The individual segments are not compared!
- *
- */
- public boolean equals(FeatureTrack feat)
- {
- // if ( note == null) {
- // if (( feat.getNote() == null ) ||
- // ( feat.getNote().equals(""))) {
- // } else if ( this.note.equals(feat.getNote())){
- // return true;
- // }
- if (this.type.equals(feat.getType()))
- {
- if (this.method.equals(feat.getMethod()))
- {
- if (this.source.equals(feat.getSource()))
- {
- if (this.note.equals(feat.getNote()))
- {
- return true;
- }
- }
- }
- }
- return false;
-
- }
-
- public String getTypeCategory()
- {
- // TODO Auto-generated method stub
- return typeCategory;
- }
-
- public String getTypeID()
- {
- // TODO Auto-generated method stub
- return typeID;
- }
-
- public void setTypeCategory(String typeCategory)
- {
- this.typeCategory = typeCategory;
-
- }
-
- public void setTypeID(String typeID)
- {
- this.typeID = typeID;
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/feature/AbstractSegment.java b/src/org/biojava/dasobert/feature/AbstractSegment.java
deleted file mode 100644
index 12c5e1d..0000000
--- a/src/org/biojava/dasobert/feature/AbstractSegment.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.awt.Color;
-
-public abstract class AbstractSegment implements Segment, Cloneable
-{
- int start;
-
- int end;
-
- String name;
-
- Color color;
-
- FeatureTrack parent;
-
- String txtColor;
-
- String note;
-
- public abstract Object clone();
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#toString()
- */
- public String toString()
- {
- String str = "Segment: " + name + " " + start + " " + end;
- if ((note != null) && (!note.equals("null")))
- if (note.length() > 40)
- str += note.substring(0, 39) + "...";
- else
- str += note;
- return str;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getNote()
- */
- public String getNote()
- {
- return note;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setNote(java.lang.String)
- */
- public void setNote(String note)
- {
- this.note = note;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setStart(int)
- */
- public void setStart(int strt)
- {
- start = strt;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getStart()
- */
- public int getStart()
- {
- return start;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setEnd(int)
- */
- public void setEnd(int ed)
- {
- end = ed;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getEnd()
- */
- public int getEnd()
- {
- return end;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setName(java.lang.String)
- */
- public void setName(String nam)
- {
- name = nam;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getName()
- */
- public String getName()
- {
- return name;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setColor(java.awt.Color)
- */
- public void setColor(Color col)
- {
- color = col;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getColor()
- */
- public Color getColor()
- {
- return color;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setParent(org.biojava.spice.feature.Feature)
- */
- public void setParent(FeatureTrack f)
- {
- parent = f;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getParent()
- */
- public FeatureTrack getParent()
- {
- return parent;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setTxtColor(java.lang.String)
- */
- public void setTxtColor(String str)
- {
- txtColor = str;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getTxtColor()
- */
- public String getTxtColor()
- {
- return txtColor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#overlaps(int)
- */
- public boolean overlaps(int seqPosition)
- {
- if ((getStart() <= seqPosition) && (getEnd() >= seqPosition))
- {
- return true;
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#overlaps(org.biojava.spice.feature.Segment)
- */
- public boolean overlaps(Segment segment)
- {
- if (!(this.start <= this.end))
- throw new IndexOutOfBoundsException("start > end for segment" + this);
-
- if (!(segment.getStart() <= segment.getEnd()))
- throw new IndexOutOfBoundsException("start > end for segment"
- + segment);
-
- // start must be in region of other
- if (this.start >= segment.getStart())
- {
- if (this.start <= segment.getEnd())
- {
- return true;
- }
- }
- // or end must be in region of other..
- if (this.end >= segment.getStart())
- {
- if (this.end <= segment.getEnd())
- {
- return true;
- }
- }
-
- if (this.start <= segment.getStart())
- {
- if (this.end >= segment.getEnd())
- {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/src/org/biojava/dasobert/feature/FeatureComparator.java b/src/org/biojava/dasobert/feature/FeatureComparator.java
deleted file mode 100644
index 2b75c22..0000000
--- a/src/org/biojava/dasobert/feature/FeatureComparator.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 23.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * a comparator to sort Features byt type
- *
- * @author Andreas Prlic
- */
-
-public class FeatureComparator implements Comparator
-{
-
- public FeatureComparator()
- {
- }
-
- public int compare(Object a, Object b)
- {
- FeatureTrack x = (FeatureTrack) a;
- FeatureTrack y = (FeatureTrack) b;
-
- String typea = x.getType();
- String typeb = y.getType();
-
- if (!typea.equals(typeb))
- return typea.compareTo(typeb);
-
- List s1 = x.getSegments();
- List s2 = y.getSegments();
-
- Iterator iter1 = s1.iterator();
- Iterator iter2 = s2.iterator();
-
- while (iter1.hasNext())
- {
- Segment seg1 = (Segment) iter1.next();
- int start1 = seg1.getStart();
-
- while (iter2.hasNext())
- {
- Segment seg2 = (Segment) iter2.next();
- int start2 = seg2.getStart();
-
- if (start1 < start2)
- {
- return -1;
- }
- if (start1 > start2)
- {
- return 1;
- }
-
- }
- }
-
- return 0;
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/feature/FeatureMapComparator.java b/src/org/biojava/dasobert/feature/FeatureMapComparator.java
deleted file mode 100644
index aa38981..0000000
--- a/src/org/biojava/dasobert/feature/FeatureMapComparator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 23.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Comparator;
-import java.util.Map;
-
-/**
- * a comparator to sort Features if they are still in a Map ( sorts by type )
- *
- * @author Andreas Prlic
- */
-
-public class FeatureMapComparator implements Comparator
-{
-
- public FeatureMapComparator()
- {
- }
-
- public int compare(Object a, Object b)
- {
- Map x = (Map) a;
- Map y = (Map) b;
-
- String typea = (String) x.get("TYPE");
- String typeb = (String) y.get("TYPE");
-
- if (isSecstruc(typea) && isSecstruc(typeb))
- {
- return 0;
- }
- return typea.compareTo(typeb);
- }
-
- public boolean isSecstruc(String type)
- {
- if (type.equals("HELIX") || type.equals("STRAND")
- || type.equals("TURN"))
- {
- return true;
- }
- return false;
- }
-
-}
diff --git a/src/org/biojava/dasobert/feature/FeatureTrack.java b/src/org/biojava/dasobert/feature/FeatureTrack.java
deleted file mode 100644
index e7b6bbd..0000000
--- a/src/org/biojava/dasobert/feature/FeatureTrack.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2005
- *
- */
-package org.biojava.dasobert.feature;
-
-import java.util.List;
-
-/**
- * A feature corresponds to a track in Ensembl
- *
- * @author Andreas Prlic
- *
- */
-public interface FeatureTrack
-{
-
- public Object clone();
-
- /**
- * returns true if the specified sequence position is within the range of this
- * Feature
- *
- * @param seqPosition
- * the position to check
- * @return true if the position is within the ranges of the segments of this
- * feature
- */
- public boolean overlaps(int seqPosition);
-
- public String toString();
-
- public void setSource(String s);
-
- public String getSource();
-
- public void setName(String nam);
-
- public String getName();
-
- public void setMethod(String methd);
-
- public String getMethod();
-
- public void setType(String typ);
-
- public String getType();
-
- public void setNote(String nte);
-
- public String getNote();
-
- public void setLink(String lnk);
-
- public String getLink();
-
- public void setScore(String score);
-
- public String getScore();
-
- public void setOrientation(String orientation);
-
- public String getOrientation();
-
- /**
- * test if two features are equivalent
- *
- * @param feat
- * feature to compare with
- * @return true if equivalend
- */
- public abstract boolean equals(FeatureTrack feat);
-
- /**
- * add a segment to this feature
- *
- * @param start
- * position
- * @param end
- * position
- * @param name
- * of feature
- */
- public abstract void addSegment(int start, int end, String name);
-
- public abstract void addSegment(Segment s);
-
- public abstract List getSegments();
-
- /**
- * set the data from the DAS - type - id field (used for Ontology support)
- *
- * @param typeID
- */
- public void setTypeID(String typeID);
-
- /**
- * set the data from the DAS - type - category field (used for Ontology
- * support)
- *
- * @param typeCategory
- */
- public void setTypeCategory(String typeCategory);
-
- public String getTypeID();
-
- public String getTypeCategory();
-
-}
\ No newline at end of file
diff --git a/src/org/biojava/dasobert/feature/FeatureTrackConverter.java b/src/org/biojava/dasobert/feature/FeatureTrackConverter.java
deleted file mode 100644
index 4818e10..0000000
--- a/src/org/biojava/dasobert/feature/FeatureTrackConverter.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Dec 5, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * converts the features from their "raw" representation as a Map into a Feature
- * class
- *
- * @author Andreas Prlic
- *
- */
-public class FeatureTrackConverter
-{
-
- public static final Color HELIX_COLOR = new Color(255, 51, 51);
-
- public static final Color STRAND_COLOR = new Color(255, 204, 51);
-
- public static final Color TURN_COLOR = new Color(204, 204, 204);
-
- // some annotation types, for which there is a special treatment
- public static final String DISULFID_TYPE = "DISULFID";
-
- public static final String SECSTRUC_TYPE = "SECSTRUC";
-
- public static final String METAL_TYPE = "METAL";
-
- public static final String MSD_SITE_TYPE = "MSD_SITE";
-
- String type;
-
- public static final String TYPE_HISTOGRAM = "histogram";
-
- public static final String TYPE_DEFAULT = "default";
-
- // rotate between these colors
- public static final Color[] entColors = new Color[]
- { new Color(51, 51, 255), // blue
- new Color(102, 255, 255), // cyan
- new Color(153, 255, 153), // green
- new Color(153, 255, 153), // green
- new Color(255, 153, 153), // pink
- new Color(255, 51, 51), // red
- new Color(255, 51, 255) // pink
- };
-
- public static final String[] txtColors = new String[]
- { "blue", "pink", "green", "yellow", "red", "cyan", "pink" };
-
- Map[] stylesheet;
-
- boolean isHistogram = false;
-
- public FeatureTrackConverter()
- {
- type = TYPE_DEFAULT;
- stylesheet = new Map[0];
- }
-
- public FeatureTrackConverter(Map[] stylesheet)
- {
-
- if (stylesheet == null)
- stylesheet = new Map[0];
-
- this.stylesheet = stylesheet;
-
- }
-
- public FeatureTrackConverter(Map[] stylesheet, boolean isHistogram)
- {
- this(stylesheet);
- this.isHistogram = isHistogram;
- if (isHistogram)
- type = TYPE_HISTOGRAM;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType(String type)
- {
- if (type.equals(TYPE_HISTOGRAM))
- isHistogram = true;
- this.type = type;
- }
-
- public boolean isHistogram()
- {
- return isHistogram;
- }
-
- public void setHistogram(boolean isHistogram)
- {
- this.isHistogram = isHistogram;
- }
-
- public FeatureTrack[] convertMap2Features(Map[] mapfeatures)
- {
- List features = new ArrayList();
-
- boolean first = true;
- boolean secstruc = false;
- boolean isGroup = false;
-
- FeatureTrack feat = null;
- Segment segment = null;
-
- int featuresCounter = 0;
- String prevGroup = null;
-
- for (int i = 0; i < mapfeatures.length; i++)
- {
-
- Map currentFeatureMap = mapfeatures[i];
- String type = (String) currentFeatureMap.get("TYPE");
-
- String group = (String) currentFeatureMap.get("GROUP");
- if (group != null)
- {
- if (prevGroup != null)
- {
- if (group.equals(prevGroup))
- {
- feat.setName(group);
- isGroup = true;
- }
- else
- {
- isGroup = false;
- }
- }
- else
- {
- isGroup = false;
- }
- }
- else
- {
- isGroup = false;
- }
-
- // we are skipping literature references for the moment
- // TODO: add a display to spice for non-positional features
- //
- if (type.equals("reference") || type.equals("GOA"))
- {
- continue;
- }
-
- if (!first)
- {
- // if not first feature
-
- if ((!secstruc) && (!isGroup))
- {
-
- // if not secondary structure and not in a group ...
- features = testAddFeatures(features, feat);
-
- }
- else if (!(type.equals("HELIX") || type.equals("STRAND") || type
- .equals("TURN")))
- {
- // end of secondary structure
- secstruc = false;
- if (feat != null && (!isGroup))
- {
- features = testAddFeatures(features, feat);
- }
-
- }
- } // end of not first
-
- first = false;
- if ((!secstruc) && (!isGroup))
- {
- featuresCounter += 1;
- feat = getNewFeat(currentFeatureMap);
- }
-
- if (type.equals("STRAND"))
- {
- secstruc = true;
- currentFeatureMap.put("colorTxt", "yellow");
- feat.setName("SECSTRUC");
- feat.setType("SECSTRUC");
- }
-
- else if (type.equals("HELIX"))
- {
- secstruc = true;
- currentFeatureMap.put("colorTxt", "red");
- feat.setName("SECSTRUC");
- feat.setType("SECSTRUC");
- }
-
- else if (type.equals("TURN"))
- {
- secstruc = true;
- currentFeatureMap.put("colorTxt", "white");
-
- feat.setName("SECSTRUC");
- feat.setType("SECSTRUC");
- }
- else
- {
- secstruc = false;
- currentFeatureMap.put("colorTxt", txtColors[featuresCounter
- % txtColors.length]);
- if (!isGroup)
- {
- try
- {
- feat.setName(type);
-
- } catch (NullPointerException e)
- {
- // e.printStackTrace();
- feat.setName("null");
- }
- }
- }
-
- segment = getNewSegment(currentFeatureMap);
-
- feat.addSegment(segment);
- prevGroup = group;
- }
-
- if (feat != null)
- features = testAddFeatures(features, feat);
-
- return (FeatureTrack[]) features.toArray(new FeatureTrack[features
- .size()]);
- }
-
- /**
- * test if this features is added as a new feature to the features list, or if
- * it is joint with an already existing one...
- *
- * @param features
- * @param newFeature
- * @return a List of FeatureTrack objects
- */
- protected List testAddFeatures(List features, FeatureTrack newFeature)
- {
-
- // System.out.println("testing " + newFeature + " " +
- // newFeature.getScore());
- Iterator iter = features.iterator();
-
- if (isHistogramFeatureType(newFeature))
- {
-
- // return histogram type features
- type = TYPE_HISTOGRAM;
-
- Segment seg = getHistogramSegmentFromFeature(newFeature);
-
- while (iter.hasNext())
- {
- FeatureTrack knownFeature = (FeatureTrack) iter.next();
- String knownType = knownFeature.getType();
-
- // System.out.println("found histogram style " + feat);
- // set type of this DAS source to being HISTOGRAM style
-
- if (knownType.equals(newFeature.getType()))
- {
- // convert the feature into a HistogramSegment and add to the already
- // known feature
-
- knownFeature.addSegment(seg);
- // we can return now
- return features;
- }
-
- }
- // we could not link this to any existing feature
- // convert it to a new HistogramFeature
- HistogramFeature hfeat = new HistogramFeature();
-
- hfeat.setLink(newFeature.getLink());
- hfeat.setMethod(newFeature.getMethod());
- hfeat.setName(newFeature.getName());
- hfeat.setNote(newFeature.getNote());
- hfeat.setScore("0");
- hfeat.setSource(newFeature.getSource());
- hfeat.addSegment(seg);
- hfeat.setType(newFeature.getType());
-
- newFeature = hfeat;
- features.add(newFeature);
- return features;
- }
-
- while (iter.hasNext())
- {
- FeatureTrack knownFeature = (FeatureTrack) iter.next();
- // this only compares method source and type ...
- boolean sameFeat = false;
- if (knownFeature.equals(newFeature))
- sameFeat = true;
-
- if ((knownFeature.getSource().equals(newFeature.getSource()))
- && (knownFeature.getMethod().equals(newFeature.getMethod()))
- && (knownFeature.getNote().equals(newFeature.getNote()))
- && isSecondaryStructureFeat(knownFeature)
- && isSecondaryStructureFeat(newFeature))
- sameFeat = true;
-
- if (sameFeat)
- {
-
- // seems to be of same type, method and source, so check if the segments
- // can be joined
-
- List tmpsegs = knownFeature.getSegments();
- Iterator segiter = tmpsegs.iterator();
- List newsegs = newFeature.getSegments();
- Iterator newsegsiter = newsegs.iterator();
- boolean overlap = false;
- while (newsegsiter.hasNext())
- {
- Segment newseg = (Segment) newsegsiter.next();
-
- while (segiter.hasNext())
- {
- Segment tmpseg = (Segment) segiter.next();
-
- if (tmpseg.overlaps(newseg))
- overlap = true;
- }
- }
-
- if (!overlap)
- {
- // add all new segments to old features...
- newsegsiter = newsegs.iterator();
- while (newsegsiter.hasNext())
- {
- Segment newseg = (Segment) newsegsiter.next();
- knownFeature.addSegment(newseg);
- }
-
- return features;
- }
- }
-
- }
-
- // if we get here, the features could not be joint with any other one, so
- // there is always some overlap
- // add to the list of known features
- features.add(newFeature);
- return features;
- }
-
- private FeatureTrack getNewFeat(Map currentFeatureMap)
- {
- FeatureTrack feat = new FeatureTrackImpl();
- // logger.finest(currentFeatureMap);
- // System.out.println("DrawableDasSource " + currentFeatureMap);
- feat.setSource((String) currentFeatureMap.get("dassource"));
- feat.setName((String) currentFeatureMap.get("NAME"));
- feat.setType((String) currentFeatureMap.get("TYPE"));
- feat.setLink((String) currentFeatureMap.get("LINK"));
- feat.setNote((String) currentFeatureMap.get("NOTE"));
-
- String typeID = (String) currentFeatureMap.get("TYPE_ID");
- String typeCategory = (String) currentFeatureMap.get("TYPE_CATEGORY");
- feat.setTypeID(typeID);
- feat.setTypeCategory(typeCategory);
-
- String method = (String) currentFeatureMap.get("METHOD");
- if (method == null)
- {
- method = "";
- }
- feat.setMethod(method);
- feat.setScore((String) currentFeatureMap.get("SCORE"));
- return feat;
- }
-
- private Segment getNewSegment(Map featureMap)
- {
- Segment s = new SegmentImpl();
- String sstart = (String) featureMap.get("START");
- String send = (String) featureMap.get("END");
- int start = Integer.parseInt(sstart);
- int end = Integer.parseInt(send);
- s.setStart(start);
- s.setEnd(end);
- s.setName((String) featureMap.get("TYPE"));
- s.setTxtColor((String) featureMap.get("colorTxt"));
- s.setColor((Color) featureMap.get("color"));
- s.setNote((String) featureMap.get("NOTE"));
- return s;
-
- }
-
- private boolean isSecondaryStructureFeat(FeatureTrack feat)
- {
- String type = feat.getType();
- if (type.equals("HELIX") || type.equals("STRAND")
- || type.equals("TURN"))
- return true;
- return false;
- }
-
- private boolean isHistogramFeatureType(FeatureTrack feat)
- {
- String ftype = feat.getType();
-
- Map[] style = stylesheet;
-
- // System.out.println("is HistogramFeature type " + ftype + " " + style );
-
- // todo : move this info into a config file...
-
- if (ftype.equals("hydrophobicity"))
- {
- return true;
- }
- if (getType().equals(TYPE_HISTOGRAM))
- return true;
-
- if (style != null)
- {
-
- for (int i = 0; i < style.length; i++)
- {
- Map m = style[i];
-
- // make sure the stylesheet is for this feature type
- String styleType = (String) m.get("type");
- if (styleType != null)
- {
- if (!styleType.equals(ftype))
- {
- continue;
- }
- }
- else
- {
- continue;
- }
-
- String type = (String) m.get("style");
- if (type != null)
- {
- // System.out.println("stylesheet type " + type);
- if (type.equals("gradient") || (type.equals("lineplot"))
- || (type.equals("histogram")))
- {
-
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- private HistogramSegment getHistogramSegmentFromFeature(FeatureTrack feat)
- {
- HistogramSegment s = new HistogramSegment();
-
- double score = 0.0;
-
- try
- {
- score = Double.parseDouble(feat.getScore());
-
- } catch (Exception e)
- {
- // e.printStackTrace();
- }
- s.setScore(score);
- List segments = feat.getSegments();
- if (segments.size() > 0)
- {
- Segment seg = (Segment) segments.get(0);
- s.setName(seg.getName());
- s.setStart(seg.getStart());
- s.setEnd(seg.getEnd());
- s.setNote(seg.getNote());
- s.setColor(seg.getColor());
- s.setTxtColor(seg.getTxtColor());
- }
-
- return s;
- }
-
-}
diff --git a/src/org/biojava/dasobert/feature/FeatureTrackImpl.java b/src/org/biojava/dasobert/feature/FeatureTrackImpl.java
deleted file mode 100644
index a13fbb3..0000000
--- a/src/org/biojava/dasobert/feature/FeatureTrackImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 22.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Iterator;
-
-/**
- * a class to store FeatureData and to visualize them coordinate system of
- * features is always UniProt ! PDBresnum features served by DAS need to be
- * converted into UniProt coord sys first.
- *
- * a feature consists of one or several segments. segmetns cotnains <start> and
- * <end> information.
- *
- * @author Andreas Prlic
- */
-public class FeatureTrackImpl extends AbstractFeatureTrack implements
- FeatureTrack
-
-{
-
- public Object clone()
- {
-
- FeatureTrack f = new FeatureTrackImpl();
- f.setName(name);
- f.setMethod(method);
- f.setType(type);
- f.setNote(note);
- f.setLink(link);
- f.setSource(source);
- f.setScore(score);
-
- Iterator iter = segments.iterator();
-
- while (iter.hasNext())
- {
- Segment s = (Segment) iter.next();
- f.addSegment((Segment) s.clone());
- }
-
- return f;
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/feature/HistogramFeature.java b/src/org/biojava/dasobert/feature/HistogramFeature.java
deleted file mode 100644
index 8663081..0000000
--- a/src/org/biojava/dasobert/feature/HistogramFeature.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Iterator;
-
-/**
- * a class that represents Histogram Style features in addition to normal
- * features they know about Max and Minimum scores for the whole line Histogram
- * feautes have only one (Histogram) Segment, which contains the scores for each
- * position
- *
- * @author Andreas Prlic
- *
- */
-public class HistogramFeature extends AbstractFeatureTrack
-{
-
- double max;
-
- double min;
-
- public HistogramFeature()
- {
- super();
- // TODO Auto-generated constructor stub
- }
-
- public double getMax()
- {
- return max;
- }
-
- public void setMax(double max)
- {
- this.max = max;
- }
-
- public double getMin()
- {
- return min;
- }
-
- public void setMin(double min)
- {
- this.min = min;
- }
-
- public Object clone()
- {
-
- HistogramFeature f = new HistogramFeature();
-
- f.setName(name);
- f.setMethod(method);
- f.setType(type);
- f.setNote(note);
- f.setLink(link);
- f.setSource(source);
- f.setScore(score);
-
- Iterator iter = segments.iterator();
-
- while (iter.hasNext())
- {
- Segment s = (Segment) iter.next();
- f.addSegment((Segment) s.clone());
- }
-
- return f;
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/feature/HistogramSegment.java b/src/org/biojava/dasobert/feature/HistogramSegment.java
deleted file mode 100644
index 7a7ea25..0000000
--- a/src/org/biojava/dasobert/feature/HistogramSegment.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-/**
- * a Histogram segment is an extension of the standard Segment with a score
- *
- * @author Andreas Prlic
- *
- */
-public class HistogramSegment extends AbstractSegment
-{
-
- double score;
-
- public HistogramSegment()
- {
- super();
-
- }
-
- public double getScore()
- {
- return score;
- }
-
- public void setScore(double score)
- {
- this.score = score;
- }
-
- public Object clone()
- {
-
- Segment s = new HistogramSegment();
- s.setStart(start);
- s.setEnd(end);
- s.setName(name);
- s.setColor(color);
- s.setTxtColor(txtColor);
- s.setNote(note);
- return s;
-
- }
-
-}
diff --git a/src/org/biojava/dasobert/feature/Segment.java b/src/org/biojava/dasobert/feature/Segment.java
deleted file mode 100644
index 78e2840..0000000
--- a/src/org/biojava/dasobert/feature/Segment.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 22.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.awt.Color;
-
-/** a class to keep track of location information for a feature */
-public interface Segment
-{
-
- public Object clone();
-
- public String toString();
-
- public String getNote();
-
- public void setNote(String note);
-
- public void setStart(int strt);
-
- public int getStart();
-
- public void setEnd(int ed);
-
- public int getEnd();
-
- public void setName(String nam);
-
- public String getName();
-
- public void setColor(Color col);
-
- public Color getColor();
-
- public void setParent(FeatureTrack f);
-
- public FeatureTrack getParent();
-
- public void setTxtColor(String str);
-
- public String getTxtColor();
-
- /**
- * returns true if the specified sequence position is within the range of this
- * Segment
- *
- * @param seqPosition
- * the position to check
- * @return true if seqPos >= start && seqPos <= end
- */
- public boolean overlaps(int seqPosition);
-
- /**
- * tests if two segments are overlapping
- *
- * @param segment
- * to compare with
- * @return true if segments overlap
- */
- public boolean overlaps(Segment segment);
-
-}
diff --git a/src/org/biojava/dasobert/feature/SegmentComparator.java b/src/org/biojava/dasobert/feature/SegmentComparator.java
deleted file mode 100644
index 68a2c16..0000000
--- a/src/org/biojava/dasobert/feature/SegmentComparator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Comparator;
-
-public class SegmentComparator implements Comparator
-{
-
- public int compare(Object arg0, Object arg1)
- {
-
- Segment s1 = (Segment) arg0;
- Segment s2 = (Segment) arg1;
-
- if (s1.getStart() < s2.getStart())
- return -1;
- if (s1.getStart() > s2.getStart())
- return 1;
-
- return 0;
- }
-
-}
diff --git a/src/org/biojava/dasobert/feature/SegmentImpl.java b/src/org/biojava/dasobert/feature/SegmentImpl.java
deleted file mode 100644
index dba25e9..0000000
--- a/src/org/biojava/dasobert/feature/SegmentImpl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.awt.Color;
-
-public class SegmentImpl extends AbstractSegment
-{
-
- public SegmentImpl()
- {
- super();
- start = 0;
- end = 0;
- name = "Unknown";
- color = Color.white;
- txtColor = "white";
- parent = null;
- note = "";
- }
-
- public boolean equals(Segment s)
- {
- if (s == null)
- return false;
-
- if ((start == s.getStart()) && (end == s.getEnd())
- && (name.equals(s.getName())))
- {
- if (note == null)
- {
- if (s.getNote() == null)
- return true;
- }
- else
- {
- if (s.getNote() != null)
- {
- if (s.getNote().equals(note))
- return true;
- }
- }
-
- }
-
- return false;
- }
-
- public Object clone()
- {
-
- Segment s = new SegmentImpl();
- s.setStart(start);
- s.setEnd(end);
- s.setName(name);
- s.setColor(color);
- s.setTxtColor(txtColor);
- s.setNote(note);
- return s;
-
- }
-}
diff --git a/src/org/jibble/epsgraphics/EpsDocument.java b/src/org/jibble/epsgraphics/EpsDocument.java
index 0674d05..1e71632 100644
--- a/src/org/jibble/epsgraphics/EpsDocument.java
+++ b/src/org/jibble/epsgraphics/EpsDocument.java
@@ -1,23 +1,34 @@
/*
- Copyright Paul James Mutton, 2001-2004, http://www.jibble.org/
-
- This file is part of EpsGraphics2D.
-
- This software is dual-licensed, allowing you to choose between the GNU
- General Public License (GPL) and the www.jibble.org Commercial License.
- Since the GPL may be too restrictive for use in a proprietary application,
- a commercial license is also provided. Full license information can be
- found at http://www.jibble.org/licenses/
-
- $Author$
- $Id$
-
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
-
package org.jibble.epsgraphics;
-import java.io.*;
-import java.util.*;
+import jalview.util.MessageManager;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Date;
/**
* This represents an EPS document. Several EpsGraphics2D objects may point to
@@ -153,7 +164,9 @@ public class EpsDocument
_bufferedWriter.write(line + "\n");
} catch (IOException e)
{
- throw new EpsException("Could not write to the output file: " + e);
+ throw new EpsException(MessageManager.formatMessage(
+ "exception.eps_coudnt_write_output_file",
+ new String[] { e.getMessage() }));
}
}
diff --git a/src/org/jibble/epsgraphics/EpsException.java b/src/org/jibble/epsgraphics/EpsException.java
index c860500..faaaa07 100644
--- a/src/org/jibble/epsgraphics/EpsException.java
+++ b/src/org/jibble/epsgraphics/EpsException.java
@@ -1,19 +1,23 @@
/*
- Copyright Paul James Mutton, 2001-2004, http://www.jibble.org/
-
- This file is part of EpsGraphics2D.
-
- This software is dual-licensed, allowing you to choose between the GNU
- General Public License (GPL) and the www.jibble.org Commercial License.
- Since the GPL may be too restrictive for use in a proprietary application,
- a commercial license is also provided. Full license information can be
- found at http://www.jibble.org/licenses/
-
- $Author$
- $Id$
-
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
-
package org.jibble.epsgraphics;
public class EpsException extends RuntimeException
@@ -24,4 +28,4 @@ public class EpsException extends RuntimeException
super(message);
}
-}
\ No newline at end of file
+}
diff --git a/src/org/jibble/epsgraphics/EpsGraphics2D.java b/src/org/jibble/epsgraphics/EpsGraphics2D.java
index 63b10d9..34a4ae2 100644
--- a/src/org/jibble/epsgraphics/EpsGraphics2D.java
+++ b/src/org/jibble/epsgraphics/EpsGraphics2D.java
@@ -1,30 +1,76 @@
/*
- Copyright Paul James Mutton, 2001-2004, http://www.jibble.org/
-
- This file is part of EpsGraphics2D.
-
- This software is dual-licensed, allowing you to choose between the GNU
- General Public License (GPL) and the www.jibble.org Commercial License.
- Since the GPL may be too restrictive for use in a proprietary application,
- a commercial license is also provided. Full license information can be
- found at http://www.jibble.org/licenses/
-
- $Author$
- $Id$
-
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
-
package org.jibble.epsgraphics;
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.font.*;
-import java.awt.geom.*;
-import java.awt.image.*;
-import java.awt.image.renderable.*;
+import jalview.util.MessageManager;
+
+import java.awt.AlphaComposite;
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.Paint;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.Stroke;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.font.TextAttribute;
+import java.awt.font.TextLayout;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Arc2D;
+import java.awt.geom.Area;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Line2D;
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.BufferedImageOp;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.PixelGrabber;
+import java.awt.image.RenderedImage;
+import java.awt.image.WritableRaster;
+import java.awt.image.renderable.RenderableImage;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
+import java.text.CharacterIterator;
+import java.util.Hashtable;
+import java.util.Map;
/**
* EpsGraphics2D is suitable for creating high quality EPS graphics for use in
@@ -157,9 +203,8 @@ public class EpsGraphics2D extends java.awt.Graphics2D
*/
private void methodNotSupported()
{
- EpsException e = new EpsException(
- "Method not currently supported by EpsGraphics2D version "
- + VERSION);
+ EpsException e = new EpsException(MessageManager.formatMessage(
+ "exception.eps_method_not_supported", new String[] { VERSION }));
e.printStackTrace(System.err);
}
@@ -457,8 +502,8 @@ public class EpsGraphics2D extends java.awt.Graphics2D
ColorModel cm = img.getColorModel();
WritableRaster wr = img.copyData(null);
- BufferedImage img1 = new BufferedImage(cm, wr, cm
- .isAlphaPremultiplied(), properties);
+ BufferedImage img1 = new BufferedImage(cm, wr,
+ cm.isAlphaPremultiplied(), properties);
AffineTransform at = AffineTransform.getTranslateInstance(
img.getMinX(), img.getMinY());
at.preConcatenate(xform);
@@ -991,8 +1036,9 @@ public class EpsGraphics2D extends java.awt.Graphics2D
return t.createTransformedShape(_clip);
} catch (Exception e)
{
- throw new EpsException("Unable to get inverse of matrix: "
- + _transform);
+ throw new EpsException(MessageManager.formatMessage(
+ "exception.eps_unable_to_get_inverse_matrix",
+ new String[] { _transform.toString() }));
}
}
}
@@ -1310,7 +1356,9 @@ public class EpsGraphics2D extends java.awt.Graphics2D
matrix = matrix.createInverse();
} catch (Exception e)
{
- throw new EpsException("Unable to get inverse of matrix: " + matrix);
+ throw new EpsException(MessageManager.formatMessage(
+ "exception.eps_unable_to_get_inverse_matrix",
+ new String[] { matrix.toString() }));
}
matrix.scale(1, -1);
matrix.getMatrix(m);
@@ -1441,4 +1489,4 @@ public class EpsGraphics2D extends java.awt.Graphics2D
private static FontRenderContext _fontRenderContext = new FontRenderContext(
null, false, true);
-}
\ No newline at end of file
+}
diff --git a/src/uk/ac/ebi/picr/model/CrossReference.java b/src/uk/ac/ebi/picr/model/CrossReference.java
index caae608..edadddc 100644
--- a/src/uk/ac/ebi/picr/model/CrossReference.java
+++ b/src/uk/ac/ebi/picr/model/CrossReference.java
@@ -1,330 +1,345 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package uk.ac.ebi.picr.model;
-
-public class CrossReference implements java.io.Serializable
-{
- private java.lang.String accession;
-
- private java.lang.String accessionVersion;
-
- private java.lang.String databaseDescription;
-
- private java.lang.String databaseName;
-
- private java.util.Calendar dateAdded;
-
- private java.util.Calendar dateDeleted;
-
- private boolean deleted;
-
- private java.lang.String gi;
-
- private java.lang.String taxonId;
-
- public CrossReference()
- {
- }
-
- public CrossReference(java.lang.String accession,
- java.lang.String accessionVersion,
- java.lang.String databaseDescription,
- java.lang.String databaseName, java.util.Calendar dateAdded,
- java.util.Calendar dateDeleted, boolean deleted,
- java.lang.String gi, java.lang.String taxonId)
- {
- this.accession = accession;
- this.accessionVersion = accessionVersion;
- this.databaseDescription = databaseDescription;
- this.databaseName = databaseName;
- this.dateAdded = dateAdded;
- this.dateDeleted = dateDeleted;
- this.deleted = deleted;
- this.gi = gi;
- this.taxonId = taxonId;
- }
-
- /**
- * Gets the accession value for this CrossReference.
- *
- * @return accession
- */
- public java.lang.String getAccession()
- {
- return accession;
- }
-
- /**
- * Sets the accession value for this CrossReference.
- *
- * @param accession
- */
- public void setAccession(java.lang.String accession)
- {
- this.accession = accession;
- }
-
- /**
- * Gets the accessionVersion value for this CrossReference.
- *
- * @return accessionVersion
- */
- public java.lang.String getAccessionVersion()
- {
- return accessionVersion;
- }
-
- /**
- * Sets the accessionVersion value for this CrossReference.
- *
- * @param accessionVersion
- */
- public void setAccessionVersion(java.lang.String accessionVersion)
- {
- this.accessionVersion = accessionVersion;
- }
-
- /**
- * Gets the databaseDescription value for this CrossReference.
- *
- * @return databaseDescription
- */
- public java.lang.String getDatabaseDescription()
- {
- return databaseDescription;
- }
-
- /**
- * Sets the databaseDescription value for this CrossReference.
- *
- * @param databaseDescription
- */
- public void setDatabaseDescription(java.lang.String databaseDescription)
- {
- this.databaseDescription = databaseDescription;
- }
-
- /**
- * Gets the databaseName value for this CrossReference.
- *
- * @return databaseName
- */
- public java.lang.String getDatabaseName()
- {
- return databaseName;
- }
-
- /**
- * Sets the databaseName value for this CrossReference.
- *
- * @param databaseName
- */
- public void setDatabaseName(java.lang.String databaseName)
- {
- this.databaseName = databaseName;
- }
-
- /**
- * Gets the dateAdded value for this CrossReference.
- *
- * @return dateAdded
- */
- public java.util.Calendar getDateAdded()
- {
- return dateAdded;
- }
-
- /**
- * Sets the dateAdded value for this CrossReference.
- *
- * @param dateAdded
- */
- public void setDateAdded(java.util.Calendar dateAdded)
- {
- this.dateAdded = dateAdded;
- }
-
- /**
- * Gets the dateDeleted value for this CrossReference.
- *
- * @return dateDeleted
- */
- public java.util.Calendar getDateDeleted()
- {
- return dateDeleted;
- }
-
- /**
- * Sets the dateDeleted value for this CrossReference.
- *
- * @param dateDeleted
- */
- public void setDateDeleted(java.util.Calendar dateDeleted)
- {
- this.dateDeleted = dateDeleted;
- }
-
- /**
- * Gets the deleted value for this CrossReference.
- *
- * @return deleted
- */
- public boolean isDeleted()
- {
- return deleted;
- }
-
- /**
- * Sets the deleted value for this CrossReference.
- *
- * @param deleted
- */
- public void setDeleted(boolean deleted)
- {
- this.deleted = deleted;
- }
-
- /**
- * Gets the gi value for this CrossReference.
- *
- * @return gi
- */
- public java.lang.String getGi()
- {
- return gi;
- }
-
- /**
- * Sets the gi value for this CrossReference.
- *
- * @param gi
- */
- public void setGi(java.lang.String gi)
- {
- this.gi = gi;
- }
-
- /**
- * Gets the taxonId value for this CrossReference.
- *
- * @return taxonId
- */
- public java.lang.String getTaxonId()
- {
- return taxonId;
- }
-
- /**
- * Sets the taxonId value for this CrossReference.
- *
- * @param taxonId
- */
- public void setTaxonId(java.lang.String taxonId)
- {
- this.taxonId = taxonId;
- }
-
- private java.lang.Object __equalsCalc = null;
-
- public synchronized boolean equals(java.lang.Object obj)
- {
- if (!(obj instanceof CrossReference))
- return false;
- CrossReference other = (CrossReference) obj;
- if (obj == null)
- return false;
- if (this == obj)
- return true;
- if (__equalsCalc != null)
- {
- return (__equalsCalc == obj);
- }
- __equalsCalc = obj;
- boolean _equals;
- _equals = true
- && ((this.accession == null && other.getAccession() == null) || (this.accession != null && this.accession
- .equals(other.getAccession())))
- && ((this.accessionVersion == null && other
- .getAccessionVersion() == null) || (this.accessionVersion != null && this.accessionVersion
- .equals(other.getAccessionVersion())))
- && ((this.databaseDescription == null && other
- .getDatabaseDescription() == null) || (this.databaseDescription != null && this.databaseDescription
- .equals(other.getDatabaseDescription())))
- && ((this.databaseName == null && other.getDatabaseName() == null) || (this.databaseName != null && this.databaseName
- .equals(other.getDatabaseName())))
- && ((this.dateAdded == null && other.getDateAdded() == null) || (this.dateAdded != null && this.dateAdded
- .equals(other.getDateAdded())))
- && ((this.dateDeleted == null && other.getDateDeleted() == null) || (this.dateDeleted != null && this.dateDeleted
- .equals(other.getDateDeleted())))
- && this.deleted == other.isDeleted()
- && ((this.gi == null && other.getGi() == null) || (this.gi != null && this.gi
- .equals(other.getGi())))
- && ((this.taxonId == null && other.getTaxonId() == null) || (this.taxonId != null && this.taxonId
- .equals(other.getTaxonId())));
- __equalsCalc = null;
- return _equals;
- }
-
- private boolean __hashCodeCalc = false;
-
- public synchronized int hashCode()
- {
- if (__hashCodeCalc)
- {
- return 0;
- }
- __hashCodeCalc = true;
- int _hashCode = 1;
- if (getAccession() != null)
- {
- _hashCode += getAccession().hashCode();
- }
- if (getAccessionVersion() != null)
- {
- _hashCode += getAccessionVersion().hashCode();
- }
- if (getDatabaseDescription() != null)
- {
- _hashCode += getDatabaseDescription().hashCode();
- }
- if (getDatabaseName() != null)
- {
- _hashCode += getDatabaseName().hashCode();
- }
- if (getDateAdded() != null)
- {
- _hashCode += getDateAdded().hashCode();
- }
- if (getDateDeleted() != null)
- {
- _hashCode += getDateDeleted().hashCode();
- }
- _hashCode += (isDeleted() ? Boolean.TRUE : Boolean.FALSE).hashCode();
- if (getGi() != null)
- {
- _hashCode += getGi().hashCode();
- }
- if (getTaxonId() != null)
- {
- _hashCode += getTaxonId().hashCode();
- }
- __hashCodeCalc = false;
- return _hashCode;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package uk.ac.ebi.picr.model;
+
+public class CrossReference implements java.io.Serializable
+{
+ private java.lang.String accession;
+
+ private java.lang.String accessionVersion;
+
+ private java.lang.String databaseDescription;
+
+ private java.lang.String databaseName;
+
+ private java.util.Calendar dateAdded;
+
+ private java.util.Calendar dateDeleted;
+
+ private boolean deleted;
+
+ private java.lang.String gi;
+
+ private java.lang.String taxonId;
+
+ public CrossReference()
+ {
+ }
+
+ public CrossReference(java.lang.String accession,
+ java.lang.String accessionVersion,
+ java.lang.String databaseDescription,
+ java.lang.String databaseName, java.util.Calendar dateAdded,
+ java.util.Calendar dateDeleted, boolean deleted,
+ java.lang.String gi, java.lang.String taxonId)
+ {
+ this.accession = accession;
+ this.accessionVersion = accessionVersion;
+ this.databaseDescription = databaseDescription;
+ this.databaseName = databaseName;
+ this.dateAdded = dateAdded;
+ this.dateDeleted = dateDeleted;
+ this.deleted = deleted;
+ this.gi = gi;
+ this.taxonId = taxonId;
+ }
+
+ /**
+ * Gets the accession value for this CrossReference.
+ *
+ * @return accession
+ */
+ public java.lang.String getAccession()
+ {
+ return accession;
+ }
+
+ /**
+ * Sets the accession value for this CrossReference.
+ *
+ * @param accession
+ */
+ public void setAccession(java.lang.String accession)
+ {
+ this.accession = accession;
+ }
+
+ /**
+ * Gets the accessionVersion value for this CrossReference.
+ *
+ * @return accessionVersion
+ */
+ public java.lang.String getAccessionVersion()
+ {
+ return accessionVersion;
+ }
+
+ /**
+ * Sets the accessionVersion value for this CrossReference.
+ *
+ * @param accessionVersion
+ */
+ public void setAccessionVersion(java.lang.String accessionVersion)
+ {
+ this.accessionVersion = accessionVersion;
+ }
+
+ /**
+ * Gets the databaseDescription value for this CrossReference.
+ *
+ * @return databaseDescription
+ */
+ public java.lang.String getDatabaseDescription()
+ {
+ return databaseDescription;
+ }
+
+ /**
+ * Sets the databaseDescription value for this CrossReference.
+ *
+ * @param databaseDescription
+ */
+ public void setDatabaseDescription(java.lang.String databaseDescription)
+ {
+ this.databaseDescription = databaseDescription;
+ }
+
+ /**
+ * Gets the databaseName value for this CrossReference.
+ *
+ * @return databaseName
+ */
+ public java.lang.String getDatabaseName()
+ {
+ return databaseName;
+ }
+
+ /**
+ * Sets the databaseName value for this CrossReference.
+ *
+ * @param databaseName
+ */
+ public void setDatabaseName(java.lang.String databaseName)
+ {
+ this.databaseName = databaseName;
+ }
+
+ /**
+ * Gets the dateAdded value for this CrossReference.
+ *
+ * @return dateAdded
+ */
+ public java.util.Calendar getDateAdded()
+ {
+ return dateAdded;
+ }
+
+ /**
+ * Sets the dateAdded value for this CrossReference.
+ *
+ * @param dateAdded
+ */
+ public void setDateAdded(java.util.Calendar dateAdded)
+ {
+ this.dateAdded = dateAdded;
+ }
+
+ /**
+ * Gets the dateDeleted value for this CrossReference.
+ *
+ * @return dateDeleted
+ */
+ public java.util.Calendar getDateDeleted()
+ {
+ return dateDeleted;
+ }
+
+ /**
+ * Sets the dateDeleted value for this CrossReference.
+ *
+ * @param dateDeleted
+ */
+ public void setDateDeleted(java.util.Calendar dateDeleted)
+ {
+ this.dateDeleted = dateDeleted;
+ }
+
+ /**
+ * Gets the deleted value for this CrossReference.
+ *
+ * @return deleted
+ */
+ public boolean isDeleted()
+ {
+ return deleted;
+ }
+
+ /**
+ * Sets the deleted value for this CrossReference.
+ *
+ * @param deleted
+ */
+ public void setDeleted(boolean deleted)
+ {
+ this.deleted = deleted;
+ }
+
+ /**
+ * Gets the gi value for this CrossReference.
+ *
+ * @return gi
+ */
+ public java.lang.String getGi()
+ {
+ return gi;
+ }
+
+ /**
+ * Sets the gi value for this CrossReference.
+ *
+ * @param gi
+ */
+ public void setGi(java.lang.String gi)
+ {
+ this.gi = gi;
+ }
+
+ /**
+ * Gets the taxonId value for this CrossReference.
+ *
+ * @return taxonId
+ */
+ public java.lang.String getTaxonId()
+ {
+ return taxonId;
+ }
+
+ /**
+ * Sets the taxonId value for this CrossReference.
+ *
+ * @param taxonId
+ */
+ public void setTaxonId(java.lang.String taxonId)
+ {
+ this.taxonId = taxonId;
+ }
+
+ private java.lang.Object __equalsCalc = null;
+
+ @Override
+ public synchronized boolean equals(java.lang.Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ if (!(obj instanceof CrossReference))
+ {
+ return false;
+ }
+ CrossReference other = (CrossReference) obj;
+ if (this == obj)
+ {
+ return true;
+ }
+ if (__equalsCalc != null)
+ {
+ return (__equalsCalc == obj);
+ }
+ __equalsCalc = obj;
+ boolean _equals;
+ _equals = true
+ && ((this.accession == null && other.getAccession() == null) || (this.accession != null && this.accession
+ .equals(other.getAccession())))
+ && ((this.accessionVersion == null && other
+ .getAccessionVersion() == null) || (this.accessionVersion != null && this.accessionVersion
+ .equals(other.getAccessionVersion())))
+ && ((this.databaseDescription == null && other
+ .getDatabaseDescription() == null) || (this.databaseDescription != null && this.databaseDescription
+ .equals(other.getDatabaseDescription())))
+ && ((this.databaseName == null && other.getDatabaseName() == null) || (this.databaseName != null && this.databaseName
+ .equals(other.getDatabaseName())))
+ && ((this.dateAdded == null && other.getDateAdded() == null) || (this.dateAdded != null && this.dateAdded
+ .equals(other.getDateAdded())))
+ && ((this.dateDeleted == null && other.getDateDeleted() == null) || (this.dateDeleted != null && this.dateDeleted
+ .equals(other.getDateDeleted())))
+ && this.deleted == other.isDeleted()
+ && ((this.gi == null && other.getGi() == null) || (this.gi != null && this.gi
+ .equals(other.getGi())))
+ && ((this.taxonId == null && other.getTaxonId() == null) || (this.taxonId != null && this.taxonId
+ .equals(other.getTaxonId())));
+ __equalsCalc = null;
+ return _equals;
+ }
+
+ private boolean __hashCodeCalc = false;
+
+ /**
+ * hashCode designed to ensure that if two instances satisfy o1.equals(o2)
+ * then they have the same hashcode.
+ */
+ @Override
+ public synchronized int hashCode()
+ {
+ if (__hashCodeCalc)
+ {
+ return 0;
+ }
+ __hashCodeCalc = true;
+ int _hashCode = 1;
+ if (getAccession() != null)
+ {
+ _hashCode += getAccession().hashCode();
+ }
+ if (getAccessionVersion() != null)
+ {
+ _hashCode += getAccessionVersion().hashCode();
+ }
+ if (getDatabaseDescription() != null)
+ {
+ _hashCode += getDatabaseDescription().hashCode();
+ }
+ if (getDatabaseName() != null)
+ {
+ _hashCode += getDatabaseName().hashCode();
+ }
+ if (getDateAdded() != null)
+ {
+ _hashCode += getDateAdded().hashCode();
+ }
+ if (getDateDeleted() != null)
+ {
+ _hashCode += getDateDeleted().hashCode();
+ }
+ _hashCode += (isDeleted() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+ if (getGi() != null)
+ {
+ _hashCode += getGi().hashCode();
+ }
+ if (getTaxonId() != null)
+ {
+ _hashCode += getTaxonId().hashCode();
+ }
+ __hashCodeCalc = false;
+ return _hashCode;
+ }
+
+}
diff --git a/src/uk/ac/ebi/picr/model/CrossReference_Helper.java b/src/uk/ac/ebi/picr/model/CrossReference_Helper.java
index 21dd4f3..5b5c3f7 100644
--- a/src/uk/ac/ebi/picr/model/CrossReference_Helper.java
+++ b/src/uk/ac/ebi/picr/model/CrossReference_Helper.java
@@ -1,125 +1,128 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package uk.ac.ebi.picr.model;
-
-public class CrossReference_Helper
-{
- // Type metadata
- private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
- CrossReference.class, true);
-
- static
- {
- typeDesc.setXmlType(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "CrossReference"));
- org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("accession");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "accession"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("accessionVersion");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "accessionVersion"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("databaseDescription");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "databaseDescription"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("databaseName");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "databaseName"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("dateAdded");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "dateAdded"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "dateTime"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("dateDeleted");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "dateDeleted"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "dateTime"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("deleted");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "deleted"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "boolean"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("gi");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "gi"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("taxonId");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "taxonId"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- typeDesc.addFieldDesc(elemField);
- }
-
- /**
- * Return type metadata object
- */
- public static org.apache.axis.description.TypeDesc getTypeDesc()
- {
- return typeDesc;
- }
-
- /**
- * Get Custom Serializer
- */
- public static org.apache.axis.encoding.Serializer getSerializer(
- java.lang.String mechType, java.lang.Class _javaType,
- javax.xml.namespace.QName _xmlType)
- {
- return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,
- _xmlType, typeDesc);
- }
-
- /**
- * Get Custom Deserializer
- */
- public static org.apache.axis.encoding.Deserializer getDeserializer(
- java.lang.String mechType, java.lang.Class _javaType,
- javax.xml.namespace.QName _xmlType)
- {
- return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,
- _xmlType, typeDesc);
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package uk.ac.ebi.picr.model;
+
+public class CrossReference_Helper
+{
+ // Type metadata
+ private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
+ CrossReference.class, true);
+
+ static
+ {
+ typeDesc.setXmlType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "CrossReference"));
+ org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("accession");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "accession"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("accessionVersion");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "accessionVersion"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("databaseDescription");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "databaseDescription"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("databaseName");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "databaseName"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("dateAdded");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "dateAdded"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "dateTime"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("dateDeleted");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "dateDeleted"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "dateTime"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("deleted");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "deleted"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "boolean"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("gi");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "gi"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("taxonId");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "taxonId"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ }
+
+ /**
+ * Return type metadata object
+ */
+ public static org.apache.axis.description.TypeDesc getTypeDesc()
+ {
+ return typeDesc;
+ }
+
+ /**
+ * Get Custom Serializer
+ */
+ public static org.apache.axis.encoding.Serializer getSerializer(
+ java.lang.String mechType, java.lang.Class _javaType,
+ javax.xml.namespace.QName _xmlType)
+ {
+ return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,
+ _xmlType, typeDesc);
+ }
+
+ /**
+ * Get Custom Deserializer
+ */
+ public static org.apache.axis.encoding.Deserializer getDeserializer(
+ java.lang.String mechType, java.lang.Class _javaType,
+ javax.xml.namespace.QName _xmlType)
+ {
+ return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,
+ _xmlType, typeDesc);
+ }
+
+}
diff --git a/src/uk/ac/ebi/picr/model/UPEntry.java b/src/uk/ac/ebi/picr/model/UPEntry.java
index 818eab1..ca9b1f4 100644
--- a/src/uk/ac/ebi/picr/model/UPEntry.java
+++ b/src/uk/ac/ebi/picr/model/UPEntry.java
@@ -1,290 +1,301 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package uk.ac.ebi.picr.model;
-
-public class UPEntry implements java.io.Serializable
-{
- private java.lang.String CRC64;
-
- private java.lang.String UPI;
-
- private uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences;
-
- private uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences;
-
- private java.lang.String sequence;
-
- private java.util.Calendar timestamp;
-
- public UPEntry()
- {
- }
-
- public UPEntry(java.lang.String CRC64, java.lang.String UPI,
- uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences,
- uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences,
- java.lang.String sequence, java.util.Calendar timestamp)
- {
- this.CRC64 = CRC64;
- this.UPI = UPI;
- this.identicalCrossReferences = identicalCrossReferences;
- this.logicalCrossReferences = logicalCrossReferences;
- this.sequence = sequence;
- this.timestamp = timestamp;
- }
-
- /**
- * Gets the CRC64 value for this UPEntry.
- *
- * @return CRC64
- */
- public java.lang.String getCRC64()
- {
- return CRC64;
- }
-
- /**
- * Sets the CRC64 value for this UPEntry.
- *
- * @param CRC64
- */
- public void setCRC64(java.lang.String CRC64)
- {
- this.CRC64 = CRC64;
- }
-
- /**
- * Gets the UPI value for this UPEntry.
- *
- * @return UPI
- */
- public java.lang.String getUPI()
- {
- return UPI;
- }
-
- /**
- * Sets the UPI value for this UPEntry.
- *
- * @param UPI
- */
- public void setUPI(java.lang.String UPI)
- {
- this.UPI = UPI;
- }
-
- /**
- * Gets the identicalCrossReferences value for this UPEntry.
- *
- * @return identicalCrossReferences
- */
- public uk.ac.ebi.picr.model.CrossReference[] getIdenticalCrossReferences()
- {
- return identicalCrossReferences;
- }
-
- /**
- * Sets the identicalCrossReferences value for this UPEntry.
- *
- * @param identicalCrossReferences
- */
- public void setIdenticalCrossReferences(
- uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences)
- {
- this.identicalCrossReferences = identicalCrossReferences;
- }
-
- public uk.ac.ebi.picr.model.CrossReference getIdenticalCrossReferences(
- int i)
- {
- return this.identicalCrossReferences[i];
- }
-
- public void setIdenticalCrossReferences(int i,
- uk.ac.ebi.picr.model.CrossReference _value)
- {
- this.identicalCrossReferences[i] = _value;
- }
-
- /**
- * Gets the logicalCrossReferences value for this UPEntry.
- *
- * @return logicalCrossReferences
- */
- public uk.ac.ebi.picr.model.CrossReference[] getLogicalCrossReferences()
- {
- return logicalCrossReferences;
- }
-
- /**
- * Sets the logicalCrossReferences value for this UPEntry.
- *
- * @param logicalCrossReferences
- */
- public void setLogicalCrossReferences(
- uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences)
- {
- this.logicalCrossReferences = logicalCrossReferences;
- }
-
- public uk.ac.ebi.picr.model.CrossReference getLogicalCrossReferences(int i)
- {
- return this.logicalCrossReferences[i];
- }
-
- public void setLogicalCrossReferences(int i,
- uk.ac.ebi.picr.model.CrossReference _value)
- {
- this.logicalCrossReferences[i] = _value;
- }
-
- /**
- * Gets the sequence value for this UPEntry.
- *
- * @return sequence
- */
- public java.lang.String getSequence()
- {
- return sequence;
- }
-
- /**
- * Sets the sequence value for this UPEntry.
- *
- * @param sequence
- */
- public void setSequence(java.lang.String sequence)
- {
- this.sequence = sequence;
- }
-
- /**
- * Gets the timestamp value for this UPEntry.
- *
- * @return timestamp
- */
- public java.util.Calendar getTimestamp()
- {
- return timestamp;
- }
-
- /**
- * Sets the timestamp value for this UPEntry.
- *
- * @param timestamp
- */
- public void setTimestamp(java.util.Calendar timestamp)
- {
- this.timestamp = timestamp;
- }
-
- private java.lang.Object __equalsCalc = null;
-
- public synchronized boolean equals(java.lang.Object obj)
- {
- if (!(obj instanceof UPEntry))
- return false;
- UPEntry other = (UPEntry) obj;
- if (obj == null)
- return false;
- if (this == obj)
- return true;
- if (__equalsCalc != null)
- {
- return (__equalsCalc == obj);
- }
- __equalsCalc = obj;
- boolean _equals;
- _equals = true
- && ((this.CRC64 == null && other.getCRC64() == null) || (this.CRC64 != null && this.CRC64
- .equals(other.getCRC64())))
- && ((this.UPI == null && other.getUPI() == null) || (this.UPI != null && this.UPI
- .equals(other.getUPI())))
- && ((this.identicalCrossReferences == null && other
- .getIdenticalCrossReferences() == null) || (this.identicalCrossReferences != null && java.util.Arrays
- .equals(this.identicalCrossReferences,
- other.getIdenticalCrossReferences())))
- && ((this.logicalCrossReferences == null && other
- .getLogicalCrossReferences() == null) || (this.logicalCrossReferences != null && java.util.Arrays
- .equals(this.logicalCrossReferences,
- other.getLogicalCrossReferences())))
- && ((this.sequence == null && other.getSequence() == null) || (this.sequence != null && this.sequence
- .equals(other.getSequence())))
- && ((this.timestamp == null && other.getTimestamp() == null) || (this.timestamp != null && this.timestamp
- .equals(other.getTimestamp())));
- __equalsCalc = null;
- return _equals;
- }
-
- private boolean __hashCodeCalc = false;
-
- public synchronized int hashCode()
- {
- if (__hashCodeCalc)
- {
- return 0;
- }
- __hashCodeCalc = true;
- int _hashCode = 1;
- if (getCRC64() != null)
- {
- _hashCode += getCRC64().hashCode();
- }
- if (getUPI() != null)
- {
- _hashCode += getUPI().hashCode();
- }
- if (getIdenticalCrossReferences() != null)
- {
- for (int i = 0; i < java.lang.reflect.Array
- .getLength(getIdenticalCrossReferences()); i++)
- {
- java.lang.Object obj = java.lang.reflect.Array.get(
- getIdenticalCrossReferences(), i);
- if (obj != null && !obj.getClass().isArray())
- {
- _hashCode += obj.hashCode();
- }
- }
- }
- if (getLogicalCrossReferences() != null)
- {
- for (int i = 0; i < java.lang.reflect.Array
- .getLength(getLogicalCrossReferences()); i++)
- {
- java.lang.Object obj = java.lang.reflect.Array.get(
- getLogicalCrossReferences(), i);
- if (obj != null && !obj.getClass().isArray())
- {
- _hashCode += obj.hashCode();
- }
- }
- }
- if (getSequence() != null)
- {
- _hashCode += getSequence().hashCode();
- }
- if (getTimestamp() != null)
- {
- _hashCode += getTimestamp().hashCode();
- }
- __hashCodeCalc = false;
- return _hashCode;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package uk.ac.ebi.picr.model;
+
+public class UPEntry implements java.io.Serializable
+{
+ private java.lang.String CRC64;
+
+ private java.lang.String UPI;
+
+ private uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences;
+
+ private uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences;
+
+ private java.lang.String sequence;
+
+ private java.util.Calendar timestamp;
+
+ public UPEntry()
+ {
+ }
+
+ public UPEntry(java.lang.String CRC64, java.lang.String UPI,
+ uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences,
+ uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences,
+ java.lang.String sequence, java.util.Calendar timestamp)
+ {
+ this.CRC64 = CRC64;
+ this.UPI = UPI;
+ this.identicalCrossReferences = identicalCrossReferences;
+ this.logicalCrossReferences = logicalCrossReferences;
+ this.sequence = sequence;
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Gets the CRC64 value for this UPEntry.
+ *
+ * @return CRC64
+ */
+ public java.lang.String getCRC64()
+ {
+ return CRC64;
+ }
+
+ /**
+ * Sets the CRC64 value for this UPEntry.
+ *
+ * @param CRC64
+ */
+ public void setCRC64(java.lang.String CRC64)
+ {
+ this.CRC64 = CRC64;
+ }
+
+ /**
+ * Gets the UPI value for this UPEntry.
+ *
+ * @return UPI
+ */
+ public java.lang.String getUPI()
+ {
+ return UPI;
+ }
+
+ /**
+ * Sets the UPI value for this UPEntry.
+ *
+ * @param UPI
+ */
+ public void setUPI(java.lang.String UPI)
+ {
+ this.UPI = UPI;
+ }
+
+ /**
+ * Gets the identicalCrossReferences value for this UPEntry.
+ *
+ * @return identicalCrossReferences
+ */
+ public uk.ac.ebi.picr.model.CrossReference[] getIdenticalCrossReferences()
+ {
+ return identicalCrossReferences;
+ }
+
+ /**
+ * Sets the identicalCrossReferences value for this UPEntry.
+ *
+ * @param identicalCrossReferences
+ */
+ public void setIdenticalCrossReferences(
+ uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences)
+ {
+ this.identicalCrossReferences = identicalCrossReferences;
+ }
+
+ public uk.ac.ebi.picr.model.CrossReference getIdenticalCrossReferences(
+ int i)
+ {
+ return this.identicalCrossReferences[i];
+ }
+
+ public void setIdenticalCrossReferences(int i,
+ uk.ac.ebi.picr.model.CrossReference _value)
+ {
+ this.identicalCrossReferences[i] = _value;
+ }
+
+ /**
+ * Gets the logicalCrossReferences value for this UPEntry.
+ *
+ * @return logicalCrossReferences
+ */
+ public uk.ac.ebi.picr.model.CrossReference[] getLogicalCrossReferences()
+ {
+ return logicalCrossReferences;
+ }
+
+ /**
+ * Sets the logicalCrossReferences value for this UPEntry.
+ *
+ * @param logicalCrossReferences
+ */
+ public void setLogicalCrossReferences(
+ uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences)
+ {
+ this.logicalCrossReferences = logicalCrossReferences;
+ }
+
+ public uk.ac.ebi.picr.model.CrossReference getLogicalCrossReferences(int i)
+ {
+ return this.logicalCrossReferences[i];
+ }
+
+ public void setLogicalCrossReferences(int i,
+ uk.ac.ebi.picr.model.CrossReference _value)
+ {
+ this.logicalCrossReferences[i] = _value;
+ }
+
+ /**
+ * Gets the sequence value for this UPEntry.
+ *
+ * @return sequence
+ */
+ public java.lang.String getSequence()
+ {
+ return sequence;
+ }
+
+ /**
+ * Sets the sequence value for this UPEntry.
+ *
+ * @param sequence
+ */
+ public void setSequence(java.lang.String sequence)
+ {
+ this.sequence = sequence;
+ }
+
+ /**
+ * Gets the timestamp value for this UPEntry.
+ *
+ * @return timestamp
+ */
+ public java.util.Calendar getTimestamp()
+ {
+ return timestamp;
+ }
+
+ /**
+ * Sets the timestamp value for this UPEntry.
+ *
+ * @param timestamp
+ */
+ public void setTimestamp(java.util.Calendar timestamp)
+ {
+ this.timestamp = timestamp;
+ }
+
+ private java.lang.Object __equalsCalc = null;
+
+ @Override
+ public synchronized boolean equals(java.lang.Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ if (!(obj instanceof UPEntry))
+ {
+ return false;
+ }
+ UPEntry other = (UPEntry) obj;
+ if (this == obj)
+ {
+ return true;
+ }
+ if (__equalsCalc != null)
+ {
+ return (__equalsCalc == obj);
+ }
+ __equalsCalc = obj;
+ boolean _equals;
+ _equals = true
+ && ((this.CRC64 == null && other.getCRC64() == null) || (this.CRC64 != null && this.CRC64
+ .equals(other.getCRC64())))
+ && ((this.UPI == null && other.getUPI() == null) || (this.UPI != null && this.UPI
+ .equals(other.getUPI())))
+ && ((this.identicalCrossReferences == null && other
+ .getIdenticalCrossReferences() == null) || (this.identicalCrossReferences != null && java.util.Arrays
+ .equals(this.identicalCrossReferences,
+ other.getIdenticalCrossReferences())))
+ && ((this.logicalCrossReferences == null && other
+ .getLogicalCrossReferences() == null) || (this.logicalCrossReferences != null && java.util.Arrays
+ .equals(this.logicalCrossReferences,
+ other.getLogicalCrossReferences())))
+ && ((this.sequence == null && other.getSequence() == null) || (this.sequence != null && this.sequence
+ .equals(other.getSequence())))
+ && ((this.timestamp == null && other.getTimestamp() == null) || (this.timestamp != null && this.timestamp
+ .equals(other.getTimestamp())));
+ __equalsCalc = null;
+ return _equals;
+ }
+
+ private boolean __hashCodeCalc = false;
+
+ @Override
+ public synchronized int hashCode()
+ {
+ if (__hashCodeCalc)
+ {
+ return 0;
+ }
+ __hashCodeCalc = true;
+ int _hashCode = 1;
+ if (getCRC64() != null)
+ {
+ _hashCode += getCRC64().hashCode();
+ }
+ if (getUPI() != null)
+ {
+ _hashCode += getUPI().hashCode();
+ }
+ if (getIdenticalCrossReferences() != null)
+ {
+ for (int i = 0; i < java.lang.reflect.Array
+ .getLength(getIdenticalCrossReferences()); i++)
+ {
+ java.lang.Object obj = java.lang.reflect.Array.get(
+ getIdenticalCrossReferences(), i);
+ if (obj != null && !obj.getClass().isArray())
+ {
+ _hashCode += obj.hashCode();
+ }
+ }
+ }
+ if (getLogicalCrossReferences() != null)
+ {
+ for (int i = 0; i < java.lang.reflect.Array
+ .getLength(getLogicalCrossReferences()); i++)
+ {
+ java.lang.Object obj = java.lang.reflect.Array.get(
+ getLogicalCrossReferences(), i);
+ if (obj != null && !obj.getClass().isArray())
+ {
+ _hashCode += obj.hashCode();
+ }
+ }
+ }
+ if (getSequence() != null)
+ {
+ _hashCode += getSequence().hashCode();
+ }
+ if (getTimestamp() != null)
+ {
+ _hashCode += getTimestamp().hashCode();
+ }
+ __hashCodeCalc = false;
+ return _hashCode;
+ }
+
+}
diff --git a/src/uk/ac/ebi/picr/model/UPEntry_Helper.java b/src/uk/ac/ebi/picr/model/UPEntry_Helper.java
index 871832c..fba9b44 100644
--- a/src/uk/ac/ebi/picr/model/UPEntry_Helper.java
+++ b/src/uk/ac/ebi/picr/model/UPEntry_Helper.java
@@ -1,106 +1,109 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package uk.ac.ebi.picr.model;
-
-public class UPEntry_Helper
-{
- // Type metadata
- private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
- UPEntry.class, true);
-
- static
- {
- typeDesc.setXmlType(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "UPEntry"));
- org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("CRC64");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "CRC64"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("UPI");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "UPI"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("identicalCrossReferences");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "identicalCrossReferences"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "CrossReference"));
- elemField.setMinOccurs(0);
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("logicalCrossReferences");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "logicalCrossReferences"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "CrossReference"));
- elemField.setMinOccurs(0);
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("sequence");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "sequence"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("timestamp");
- elemField.setXmlName(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "timestamp"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "dateTime"));
- typeDesc.addFieldDesc(elemField);
- }
-
- /**
- * Return type metadata object
- */
- public static org.apache.axis.description.TypeDesc getTypeDesc()
- {
- return typeDesc;
- }
-
- /**
- * Get Custom Serializer
- */
- public static org.apache.axis.encoding.Serializer getSerializer(
- java.lang.String mechType, java.lang.Class _javaType,
- javax.xml.namespace.QName _xmlType)
- {
- return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,
- _xmlType, typeDesc);
- }
-
- /**
- * Get Custom Deserializer
- */
- public static org.apache.axis.encoding.Deserializer getDeserializer(
- java.lang.String mechType, java.lang.Class _javaType,
- javax.xml.namespace.QName _xmlType)
- {
- return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,
- _xmlType, typeDesc);
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package uk.ac.ebi.picr.model;
+
+public class UPEntry_Helper
+{
+ // Type metadata
+ private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
+ UPEntry.class, true);
+
+ static
+ {
+ typeDesc.setXmlType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "UPEntry"));
+ org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("CRC64");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "CRC64"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("UPI");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "UPI"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("identicalCrossReferences");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "identicalCrossReferences"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "CrossReference"));
+ elemField.setMinOccurs(0);
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("logicalCrossReferences");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "logicalCrossReferences"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "CrossReference"));
+ elemField.setMinOccurs(0);
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("sequence");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "sequence"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("timestamp");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "timestamp"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "dateTime"));
+ typeDesc.addFieldDesc(elemField);
+ }
+
+ /**
+ * Return type metadata object
+ */
+ public static org.apache.axis.description.TypeDesc getTypeDesc()
+ {
+ return typeDesc;
+ }
+
+ /**
+ * Get Custom Serializer
+ */
+ public static org.apache.axis.encoding.Serializer getSerializer(
+ java.lang.String mechType, java.lang.Class _javaType,
+ javax.xml.namespace.QName _xmlType)
+ {
+ return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,
+ _xmlType, typeDesc);
+ }
+
+ /**
+ * Get Custom Deserializer
+ */
+ public static org.apache.axis.encoding.Deserializer getDeserializer(
+ java.lang.String mechType, java.lang.Class _javaType,
+ javax.xml.namespace.QName _xmlType)
+ {
+ return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,
+ _xmlType, typeDesc);
+ }
+
+}
diff --git a/src/uk/ac/ebi/www/Data.java b/src/uk/ac/ebi/www/Data.java
index ca7d651..9a71fdd 100644
--- a/src/uk/ac/ebi/www/Data.java
+++ b/src/uk/ac/ebi/www/Data.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package uk.ac.ebi.www;
@@ -49,17 +52,18 @@ public class Data implements java.io.Serializable
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof Data))
+ if (obj == null)
{
return false;
}
- Data other = (Data) obj;
- if (obj == null)
+ if (!(obj instanceof Data))
{
return false;
}
+ Data other = (Data) obj;
if (this == obj)
{
return true;
@@ -81,6 +85,7 @@ public class Data implements java.io.Serializable
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/uk/ac/ebi/www/InputParams.java b/src/uk/ac/ebi/www/InputParams.java
index 106d3b4..696214a 100644
--- a/src/uk/ac/ebi/www/InputParams.java
+++ b/src/uk/ac/ebi/www/InputParams.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package uk.ac.ebi.www;
@@ -217,17 +220,18 @@ public class InputParams implements java.io.Serializable
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof InputParams))
+ if (obj == null)
{
return false;
}
- InputParams other = (InputParams) obj;
- if (obj == null)
+ if (!(obj instanceof InputParams))
{
return false;
}
+ InputParams other = (InputParams) obj;
if (this == obj)
{
return true;
@@ -271,6 +275,7 @@ public class InputParams implements java.io.Serializable
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/uk/ac/ebi/www/WSFile.java b/src/uk/ac/ebi/www/WSFile.java
index 37cebc0..04dfe41 100644
--- a/src/uk/ac/ebi/www/WSFile.java
+++ b/src/uk/ac/ebi/www/WSFile.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package uk.ac.ebi.www;
@@ -49,17 +52,18 @@ public class WSFile implements java.io.Serializable
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof WSFile))
+ if (obj == null)
{
return false;
}
- WSFile other = (WSFile) obj;
- if (obj == null)
+ if (!(obj instanceof WSFile))
{
return false;
}
+ WSFile other = (WSFile) obj;
if (this == obj)
{
return true;
@@ -81,6 +85,7 @@ public class WSFile implements java.io.Serializable
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/uk/ac/ebi/www/WSWUBlast.java b/src/uk/ac/ebi/www/WSWUBlast.java
index e31f5d0..e540ebc 100644
--- a/src/uk/ac/ebi/www/WSWUBlast.java
+++ b/src/uk/ac/ebi/www/WSWUBlast.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package uk.ac.ebi.www;
diff --git a/src/uk/ac/ebi/www/WSWUBlastService.java b/src/uk/ac/ebi/www/WSWUBlastService.java
index 7e45712..ee9ee35 100644
--- a/src/uk/ac/ebi/www/WSWUBlastService.java
+++ b/src/uk/ac/ebi/www/WSWUBlastService.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package uk.ac.ebi.www;
diff --git a/src/uk/ac/ebi/www/WSWUBlastServiceLocator.java b/src/uk/ac/ebi/www/WSWUBlastServiceLocator.java
index 849a0f8..ae8b2a8 100644
--- a/src/uk/ac/ebi/www/WSWUBlastServiceLocator.java
+++ b/src/uk/ac/ebi/www/WSWUBlastServiceLocator.java
@@ -1,22 +1,27 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package uk.ac.ebi.www;
+import jalview.util.MessageManager;
+
public class WSWUBlastServiceLocator extends org.apache.axis.client.Service
implements uk.ac.ebi.www.WSWUBlastService
{
@@ -92,10 +97,10 @@ public class WSWUBlastServiceLocator extends org.apache.axis.client.Service
{
throw new javax.xml.rpc.ServiceException(t);
}
- throw new javax.xml.rpc.ServiceException(
- "There is no stub implementation for the interface: "
- + (serviceEndpointInterface == null ? "null"
- : serviceEndpointInterface.getName()));
+ throw new javax.xml.rpc.ServiceException(MessageManager.formatMessage(
+ "exception.no_stub_implementation_for_interface",
+ new String[] { (serviceEndpointInterface == null ? "null"
+ : serviceEndpointInterface.getName()) }));
}
/**
diff --git a/src/uk/ac/ebi/www/WSWUBlastSoapBindingStub.java b/src/uk/ac/ebi/www/WSWUBlastSoapBindingStub.java
index ddd94d4..ce192ee 100644
--- a/src/uk/ac/ebi/www/WSWUBlastSoapBindingStub.java
+++ b/src/uk/ac/ebi/www/WSWUBlastSoapBindingStub.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package uk.ac.ebi.www;
@@ -202,8 +205,8 @@ public class WSWUBlastSoapBindingStub extends org.apache.axis.client.Stub
_call.setOperationName(new javax.xml.namespace.QName(
"http://www.ebi.ac.uk/WSWUBlast", "poll"));
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { jobid, type });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { jobid,
+ type });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -247,8 +250,8 @@ public class WSWUBlastSoapBindingStub extends org.apache.axis.client.Stub
_call.setOperationName(new javax.xml.namespace.QName(
"http://www.ebi.ac.uk/WSWUBlast", "runWUBlast"));
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { params, content });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { params,
+ content });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -292,8 +295,8 @@ public class WSWUBlastSoapBindingStub extends org.apache.axis.client.Stub
_call.setOperationName(new javax.xml.namespace.QName(
"http://www.ebi.ac.uk/WSWUBlast", "test"));
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { jobid, type });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { jobid,
+ type });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -333,8 +336,7 @@ public class WSWUBlastSoapBindingStub extends org.apache.axis.client.Stub
_call.setOperationName(new javax.xml.namespace.QName(
"http://www.ebi.ac.uk/WSWUBlast", "checkStatus"));
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { jobid });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { jobid });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -374,8 +376,7 @@ public class WSWUBlastSoapBindingStub extends org.apache.axis.client.Stub
_call.setOperationName(new javax.xml.namespace.QName(
"http://www.ebi.ac.uk/WSWUBlast", "getResults"));
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { jobid });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { jobid });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -419,8 +420,8 @@ public class WSWUBlastSoapBindingStub extends org.apache.axis.client.Stub
_call.setOperationName(new javax.xml.namespace.QName(
"http://www.ebi.ac.uk/WSWUBlast", "polljob"));
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { jobid, outformat });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { jobid,
+ outformat });
if (_resp instanceof java.rmi.RemoteException)
{
@@ -464,8 +465,8 @@ public class WSWUBlastSoapBindingStub extends org.apache.axis.client.Stub
_call.setOperationName(new javax.xml.namespace.QName(
"http://www.ebi.ac.uk/WSWUBlast", "doWUBlast"));
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { params, content });
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] { params,
+ content });
if (_resp instanceof java.rmi.RemoteException)
{
diff --git a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperBindingStub.java b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperBindingStub.java
index cdfd618..0e679dc 100644
--- a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperBindingStub.java
+++ b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperBindingStub.java
@@ -1,397 +1,398 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package uk.ac.ebi.www.picr.AccessionMappingService;
-
-public class AccessionMapperBindingStub extends org.apache.axis.client.Stub
- implements
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface
-{
- private java.util.Vector cachedSerClasses = new java.util.Vector();
-
- private java.util.Vector cachedSerQNames = new java.util.Vector();
-
- private java.util.Vector cachedSerFactories = new java.util.Vector();
-
- private java.util.Vector cachedDeserFactories = new java.util.Vector();
-
- static org.apache.axis.description.OperationDesc[] _operations;
-
- static
- {
- _operations = new org.apache.axis.description.OperationDesc[3];
- _initOperationDesc1();
- }
-
- private static void _initOperationDesc1()
- {
- org.apache.axis.description.OperationDesc oper;
- oper = new org.apache.axis.description.OperationDesc();
- oper.setName("getUPIForSequence");
- oper.addParameter(
- new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "sequence"), new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.addParameter(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "searchDatabases"), new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String[].class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.addParameter(
- new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "taxonId"), new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.addParameter(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "onlyActive"), new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.setReturnType(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "UPEntry"));
- oper.setReturnClass(uk.ac.ebi.picr.model.UPEntry.class);
- oper.setReturnQName(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "getUPIForSequenceReturn"));
- oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
- oper.setUse(org.apache.axis.constants.Use.LITERAL);
- _operations[0] = oper;
-
- oper = new org.apache.axis.description.OperationDesc();
- oper.setName("getUPIForAccession");
- oper.addParameter(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "accession"), new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.addParameter(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "ac_version"), new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.addParameter(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "searchDatabases"), new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String[].class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.addParameter(
- new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "taxonId"), new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"),
- java.lang.String.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.addParameter(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "onlyActive"), new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class,
- org.apache.axis.description.ParameterDesc.IN, false, false);
- oper.setReturnType(new javax.xml.namespace.QName(
- "http://model.picr.ebi.ac.uk", "UPEntry"));
- oper.setReturnClass(uk.ac.ebi.picr.model.UPEntry[].class);
- oper.setReturnQName(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "getUPIForAccessionReturn"));
- oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
- oper.setUse(org.apache.axis.constants.Use.LITERAL);
- _operations[1] = oper;
-
- oper = new org.apache.axis.description.OperationDesc();
- oper.setName("getMappedDatabaseNames");
- oper.setReturnType(new javax.xml.namespace.QName(
- "http://www.w3.org/2001/XMLSchema", "string"));
- oper.setReturnClass(java.lang.String[].class);
- oper.setReturnQName(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "mappedDatabases"));
- oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
- oper.setUse(org.apache.axis.constants.Use.LITERAL);
- _operations[2] = oper;
-
- }
-
- public AccessionMapperBindingStub() throws org.apache.axis.AxisFault
- {
- this(null);
- }
-
- public AccessionMapperBindingStub(java.net.URL endpointURL,
- javax.xml.rpc.Service service) throws org.apache.axis.AxisFault
- {
- this(service);
- super.cachedEndpoint = endpointURL;
- }
-
- public AccessionMapperBindingStub(javax.xml.rpc.Service service)
- throws org.apache.axis.AxisFault
- {
- if (service == null)
- {
- super.service = new org.apache.axis.client.Service();
- }
- else
- {
- super.service = service;
- }
- java.lang.Class cls;
- javax.xml.namespace.QName qName;
- java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
- java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
- java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
- java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
- java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
- java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
- java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
- java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
- java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
- java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
- qName = new javax.xml.namespace.QName("http://model.picr.ebi.ac.uk",
- "UPEntry");
- cachedSerQNames.add(qName);
- cls = uk.ac.ebi.picr.model.UPEntry.class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(beansf);
- cachedDeserFactories.add(beandf);
-
- qName = new javax.xml.namespace.QName("http://model.picr.ebi.ac.uk",
- "CrossReference");
- cachedSerQNames.add(qName);
- cls = uk.ac.ebi.picr.model.CrossReference.class;
- cachedSerClasses.add(cls);
- cachedSerFactories.add(beansf);
- cachedDeserFactories.add(beandf);
-
- }
-
- protected org.apache.axis.client.Call createCall()
- throws java.rmi.RemoteException
- {
- try
- {
- org.apache.axis.client.Call _call = (org.apache.axis.client.Call) super.service
- .createCall();
- if (super.maintainSessionSet)
- {
- _call.setMaintainSession(super.maintainSession);
- }
- if (super.cachedUsername != null)
- {
- _call.setUsername(super.cachedUsername);
- }
- if (super.cachedPassword != null)
- {
- _call.setPassword(super.cachedPassword);
- }
- if (super.cachedEndpoint != null)
- {
- _call.setTargetEndpointAddress(super.cachedEndpoint);
- }
- if (super.cachedTimeout != null)
- {
- _call.setTimeout(super.cachedTimeout);
- }
- if (super.cachedPortName != null)
- {
- _call.setPortName(super.cachedPortName);
- }
- java.util.Enumeration keys = super.cachedProperties.keys();
- while (keys.hasMoreElements())
- {
- java.lang.String key = (java.lang.String) keys.nextElement();
- _call.setProperty(key, super.cachedProperties.get(key));
- }
- // All the type mapping information is registered
- // when the first call is made.
- // The type mapping information is actually registered in
- // the TypeMappingRegistry of the service, which
- // is the reason why registration is only needed for the first call.
- synchronized (this)
- {
- if (firstCall())
- {
- // must set encoding style before registering serializers
- _call.setEncodingStyle(null);
- for (int i = 0; i < cachedSerFactories.size(); ++i)
- {
- java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
- javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames
- .get(i);
- java.lang.Class sf = (java.lang.Class) cachedSerFactories
- .get(i);
- java.lang.Class df = (java.lang.Class) cachedDeserFactories
- .get(i);
- _call.registerTypeMapping(cls, qName, sf, df, false);
- }
- }
- }
- return _call;
- } catch (java.lang.Throwable _t)
- {
- throw new org.apache.axis.AxisFault(
- "Failure trying to get the Call object", _t);
- }
- }
-
- public uk.ac.ebi.picr.model.UPEntry getUPIForSequence(
- java.lang.String sequence, java.lang.String[] searchDatabases,
- java.lang.String taxonId, boolean onlyActive)
- throws java.rmi.RemoteException
- {
- if (super.cachedEndpoint == null)
- {
- throw new org.apache.axis.NoEndPointException();
- }
- org.apache.axis.client.Call _call = createCall();
- _call.setOperation(_operations[0]);
- _call.setUseSOAPAction(true);
- _call.setSOAPActionURI("getUPIForSequence");
- _call.setEncodingStyle(null);
- _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
- Boolean.FALSE);
- _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
- Boolean.FALSE);
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
- _call.setOperationName(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "getUPIForSequence"));
-
- setRequestHeaders(_call);
- setAttachments(_call);
- java.lang.Object _resp = _call
- .invoke(new java.lang.Object[]
- { sequence, searchDatabases, taxonId,
- new java.lang.Boolean(onlyActive) });
-
- if (_resp instanceof java.rmi.RemoteException)
- {
- throw (java.rmi.RemoteException) _resp;
- }
- else
- {
- extractAttachments(_call);
- try
- {
- return (uk.ac.ebi.picr.model.UPEntry) _resp;
- } catch (java.lang.Exception _exception)
- {
- return (uk.ac.ebi.picr.model.UPEntry) org.apache.axis.utils.JavaUtils
- .convert(_resp, uk.ac.ebi.picr.model.UPEntry.class);
- }
- }
- }
-
- public uk.ac.ebi.picr.model.UPEntry[] getUPIForAccession(
- java.lang.String accession, java.lang.String ac_version,
- java.lang.String[] searchDatabases, java.lang.String taxonId,
- boolean onlyActive) throws java.rmi.RemoteException
- {
- if (super.cachedEndpoint == null)
- {
- throw new org.apache.axis.NoEndPointException();
- }
- org.apache.axis.client.Call _call = createCall();
- _call.setOperation(_operations[1]);
- _call.setUseSOAPAction(true);
- _call.setSOAPActionURI("getUPIForAccession");
- _call.setEncodingStyle(null);
- _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
- Boolean.FALSE);
- _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
- Boolean.FALSE);
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
- _call.setOperationName(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "getUPIForAccession"));
-
- setRequestHeaders(_call);
- setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- { accession, ac_version, searchDatabases, taxonId,
- new java.lang.Boolean(onlyActive) });
-
- if (_resp instanceof java.rmi.RemoteException)
- {
- throw (java.rmi.RemoteException) _resp;
- }
- else
- {
- extractAttachments(_call);
- try
- {
- return (uk.ac.ebi.picr.model.UPEntry[]) _resp;
- } catch (java.lang.Exception _exception)
- {
- return (uk.ac.ebi.picr.model.UPEntry[]) org.apache.axis.utils.JavaUtils
- .convert(_resp, uk.ac.ebi.picr.model.UPEntry[].class);
- }
- }
- }
-
- public java.lang.String[] getMappedDatabaseNames()
- throws java.rmi.RemoteException
- {
- if (super.cachedEndpoint == null)
- {
- throw new org.apache.axis.NoEndPointException();
- }
- org.apache.axis.client.Call _call = createCall();
- _call.setOperation(_operations[2]);
- _call.setUseSOAPAction(true);
- _call.setSOAPActionURI("getMappedDatabaseNames");
- _call.setEncodingStyle(null);
- _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
- Boolean.FALSE);
- _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
- Boolean.FALSE);
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
- _call.setOperationName(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "getMappedDatabaseNames"));
-
- setRequestHeaders(_call);
- setAttachments(_call);
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]
- {});
-
- if (_resp instanceof java.rmi.RemoteException)
- {
- throw (java.rmi.RemoteException) _resp;
- }
- else
- {
- extractAttachments(_call);
- try
- {
- return (java.lang.String[]) _resp;
- } catch (java.lang.Exception _exception)
- {
- return (java.lang.String[]) org.apache.axis.utils.JavaUtils
- .convert(_resp, java.lang.String[].class);
- }
- }
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package uk.ac.ebi.www.picr.AccessionMappingService;
+
+public class AccessionMapperBindingStub extends org.apache.axis.client.Stub
+ implements
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface
+{
+ private java.util.Vector cachedSerClasses = new java.util.Vector();
+
+ private java.util.Vector cachedSerQNames = new java.util.Vector();
+
+ private java.util.Vector cachedSerFactories = new java.util.Vector();
+
+ private java.util.Vector cachedDeserFactories = new java.util.Vector();
+
+ static org.apache.axis.description.OperationDesc[] _operations;
+
+ static
+ {
+ _operations = new org.apache.axis.description.OperationDesc[3];
+ _initOperationDesc1();
+ }
+
+ private static void _initOperationDesc1()
+ {
+ org.apache.axis.description.OperationDesc oper;
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getUPIForSequence");
+ oper.addParameter(
+ new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "sequence"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "searchDatabases"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String[].class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(
+ new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "taxonId"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "onlyActive"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "UPEntry"));
+ oper.setReturnClass(uk.ac.ebi.picr.model.UPEntry.class);
+ oper.setReturnQName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getUPIForSequenceReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+ oper.setUse(org.apache.axis.constants.Use.LITERAL);
+ _operations[0] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getUPIForAccession");
+ oper.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "accession"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "ac_version"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "searchDatabases"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String[].class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(
+ new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "taxonId"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"),
+ java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "onlyActive"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "UPEntry"));
+ oper.setReturnClass(uk.ac.ebi.picr.model.UPEntry[].class);
+ oper.setReturnQName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getUPIForAccessionReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+ oper.setUse(org.apache.axis.constants.Use.LITERAL);
+ _operations[1] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getMappedDatabaseNames");
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ oper.setReturnClass(java.lang.String[].class);
+ oper.setReturnQName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "mappedDatabases"));
+ oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+ oper.setUse(org.apache.axis.constants.Use.LITERAL);
+ _operations[2] = oper;
+
+ }
+
+ public AccessionMapperBindingStub() throws org.apache.axis.AxisFault
+ {
+ this(null);
+ }
+
+ public AccessionMapperBindingStub(java.net.URL endpointURL,
+ javax.xml.rpc.Service service) throws org.apache.axis.AxisFault
+ {
+ this(service);
+ super.cachedEndpoint = endpointURL;
+ }
+
+ public AccessionMapperBindingStub(javax.xml.rpc.Service service)
+ throws org.apache.axis.AxisFault
+ {
+ if (service == null)
+ {
+ super.service = new org.apache.axis.client.Service();
+ }
+ else
+ {
+ super.service = service;
+ }
+ java.lang.Class cls;
+ javax.xml.namespace.QName qName;
+ java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
+ java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
+ java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
+ java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
+ java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
+ java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
+ java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
+ java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
+ java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
+ java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
+ qName = new javax.xml.namespace.QName("http://model.picr.ebi.ac.uk",
+ "UPEntry");
+ cachedSerQNames.add(qName);
+ cls = uk.ac.ebi.picr.model.UPEntry.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("http://model.picr.ebi.ac.uk",
+ "CrossReference");
+ cachedSerQNames.add(qName);
+ cls = uk.ac.ebi.picr.model.CrossReference.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ }
+
+ protected org.apache.axis.client.Call createCall()
+ throws java.rmi.RemoteException
+ {
+ try
+ {
+ org.apache.axis.client.Call _call = (org.apache.axis.client.Call) super.service
+ .createCall();
+ if (super.maintainSessionSet)
+ {
+ _call.setMaintainSession(super.maintainSession);
+ }
+ if (super.cachedUsername != null)
+ {
+ _call.setUsername(super.cachedUsername);
+ }
+ if (super.cachedPassword != null)
+ {
+ _call.setPassword(super.cachedPassword);
+ }
+ if (super.cachedEndpoint != null)
+ {
+ _call.setTargetEndpointAddress(super.cachedEndpoint);
+ }
+ if (super.cachedTimeout != null)
+ {
+ _call.setTimeout(super.cachedTimeout);
+ }
+ if (super.cachedPortName != null)
+ {
+ _call.setPortName(super.cachedPortName);
+ }
+ java.util.Enumeration keys = super.cachedProperties.keys();
+ while (keys.hasMoreElements())
+ {
+ java.lang.String key = (java.lang.String) keys.nextElement();
+ _call.setProperty(key, super.cachedProperties.get(key));
+ }
+ // All the type mapping information is registered
+ // when the first call is made.
+ // The type mapping information is actually registered in
+ // the TypeMappingRegistry of the service, which
+ // is the reason why registration is only needed for the first call.
+ synchronized (this)
+ {
+ if (firstCall())
+ {
+ // must set encoding style before registering serializers
+ _call.setEncodingStyle(null);
+ for (int i = 0; i < cachedSerFactories.size(); ++i)
+ {
+ java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
+ javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames
+ .get(i);
+ java.lang.Class sf = (java.lang.Class) cachedSerFactories
+ .get(i);
+ java.lang.Class df = (java.lang.Class) cachedDeserFactories
+ .get(i);
+ _call.registerTypeMapping(cls, qName, sf, df, false);
+ }
+ }
+ }
+ return _call;
+ } catch (java.lang.Throwable _t)
+ {
+ throw new org.apache.axis.AxisFault(
+ "Failure trying to get the Call object", _t);
+ }
+ }
+
+ public uk.ac.ebi.picr.model.UPEntry getUPIForSequence(
+ java.lang.String sequence, java.lang.String[] searchDatabases,
+ java.lang.String taxonId, boolean onlyActive)
+ throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[0]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("getUPIForSequence");
+ _call.setEncodingStyle(null);
+ _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
+ Boolean.FALSE);
+ _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
+ Boolean.FALSE);
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getUPIForSequence"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] {
+ sequence, searchDatabases, taxonId,
+ new java.lang.Boolean(onlyActive) });
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (uk.ac.ebi.picr.model.UPEntry) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (uk.ac.ebi.picr.model.UPEntry) org.apache.axis.utils.JavaUtils
+ .convert(_resp, uk.ac.ebi.picr.model.UPEntry.class);
+ }
+ }
+ }
+
+ public uk.ac.ebi.picr.model.UPEntry[] getUPIForAccession(
+ java.lang.String accession, java.lang.String ac_version,
+ java.lang.String[] searchDatabases, java.lang.String taxonId,
+ boolean onlyActive) throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[1]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("getUPIForAccession");
+ _call.setEncodingStyle(null);
+ _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
+ Boolean.FALSE);
+ _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
+ Boolean.FALSE);
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getUPIForAccession"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] {
+ accession, ac_version, searchDatabases, taxonId,
+ new java.lang.Boolean(onlyActive) });
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (uk.ac.ebi.picr.model.UPEntry[]) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (uk.ac.ebi.picr.model.UPEntry[]) org.apache.axis.utils.JavaUtils
+ .convert(_resp, uk.ac.ebi.picr.model.UPEntry[].class);
+ }
+ }
+ }
+
+ public java.lang.String[] getMappedDatabaseNames()
+ throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[2]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("getMappedDatabaseNames");
+ _call.setEncodingStyle(null);
+ _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
+ Boolean.FALSE);
+ _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
+ Boolean.FALSE);
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getMappedDatabaseNames"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (java.lang.String[]) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (java.lang.String[]) org.apache.axis.utils.JavaUtils
+ .convert(_resp, java.lang.String[].class);
+ }
+ }
+ }
+
+}
diff --git a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperInterface.java b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperInterface.java
index 3a4a2ab..7bff797 100644
--- a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperInterface.java
+++ b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperInterface.java
@@ -1,34 +1,37 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package uk.ac.ebi.www.picr.AccessionMappingService;
-
-public interface AccessionMapperInterface extends java.rmi.Remote
-{
- public uk.ac.ebi.picr.model.UPEntry getUPIForSequence(
- java.lang.String sequence, java.lang.String[] searchDatabases,
- java.lang.String taxonId, boolean onlyActive)
- throws java.rmi.RemoteException;
-
- public uk.ac.ebi.picr.model.UPEntry[] getUPIForAccession(
- java.lang.String accession, java.lang.String ac_version,
- java.lang.String[] searchDatabases, java.lang.String taxonId,
- boolean onlyActive) throws java.rmi.RemoteException;
-
- public java.lang.String[] getMappedDatabaseNames()
- throws java.rmi.RemoteException;
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package uk.ac.ebi.www.picr.AccessionMappingService;
+
+public interface AccessionMapperInterface extends java.rmi.Remote
+{
+ public uk.ac.ebi.picr.model.UPEntry getUPIForSequence(
+ java.lang.String sequence, java.lang.String[] searchDatabases,
+ java.lang.String taxonId, boolean onlyActive)
+ throws java.rmi.RemoteException;
+
+ public uk.ac.ebi.picr.model.UPEntry[] getUPIForAccession(
+ java.lang.String accession, java.lang.String ac_version,
+ java.lang.String[] searchDatabases, java.lang.String taxonId,
+ boolean onlyActive) throws java.rmi.RemoteException;
+
+ public java.lang.String[] getMappedDatabaseNames()
+ throws java.rmi.RemoteException;
+}
diff --git a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperService.java b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperService.java
index 05ded00..a384dbe 100644
--- a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperService.java
+++ b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperService.java
@@ -1,29 +1,32 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package uk.ac.ebi.www.picr.AccessionMappingService;
-
-public interface AccessionMapperService extends javax.xml.rpc.Service
-{
- public java.lang.String getAccessionMapperPortAddress();
-
- public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort()
- throws javax.xml.rpc.ServiceException;
-
- public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort(
- java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package uk.ac.ebi.www.picr.AccessionMappingService;
+
+public interface AccessionMapperService extends javax.xml.rpc.Service
+{
+ public java.lang.String getAccessionMapperPortAddress();
+
+ public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort()
+ throws javax.xml.rpc.ServiceException;
+
+ public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort(
+ java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
+}
diff --git a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperServiceLocator.java b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperServiceLocator.java
index 80a870b..3936f73 100644
--- a/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperServiceLocator.java
+++ b/src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperServiceLocator.java
@@ -1,189 +1,196 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package uk.ac.ebi.www.picr.AccessionMappingService;
-
-public class AccessionMapperServiceLocator extends
- org.apache.axis.client.Service implements
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperService
-{
-
- public AccessionMapperServiceLocator()
- {
- }
-
- public AccessionMapperServiceLocator(
- org.apache.axis.EngineConfiguration config)
- {
- super(config);
- }
-
- // Use to get a proxy class for AccessionMapperPort
- private java.lang.String AccessionMapperPort_address = "http://www.ebi.ac.uk:80/Tools/picr/service";
-
- public java.lang.String getAccessionMapperPortAddress()
- {
- return AccessionMapperPort_address;
- }
-
- // The WSDD service name defaults to the port name.
- private java.lang.String AccessionMapperPortWSDDServiceName = "AccessionMapperPort";
-
- public java.lang.String getAccessionMapperPortWSDDServiceName()
- {
- return AccessionMapperPortWSDDServiceName;
- }
-
- public void setAccessionMapperPortWSDDServiceName(java.lang.String name)
- {
- AccessionMapperPortWSDDServiceName = name;
- }
-
- public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort()
- throws javax.xml.rpc.ServiceException
- {
- java.net.URL endpoint;
- try
- {
- endpoint = new java.net.URL(AccessionMapperPort_address);
- } catch (java.net.MalformedURLException e)
- {
- throw new javax.xml.rpc.ServiceException(e);
- }
- return getAccessionMapperPort(endpoint);
- }
-
- public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort(
- java.net.URL portAddress) throws javax.xml.rpc.ServiceException
- {
- try
- {
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub _stub = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub(
- portAddress, this);
- _stub.setPortName(getAccessionMapperPortWSDDServiceName());
- return _stub;
- } catch (org.apache.axis.AxisFault e)
- {
- return null;
- }
- }
-
- public void setAccessionMapperPortEndpointAddress(java.lang.String address)
- {
- AccessionMapperPort_address = address;
- }
-
- /**
- * For the given interface, get the stub implementation. If this service has
- * no port for the given interface, then ServiceException is thrown.
- */
- public java.rmi.Remote getPort(Class serviceEndpointInterface)
- throws javax.xml.rpc.ServiceException
- {
- try
- {
- if (uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface.class
- .isAssignableFrom(serviceEndpointInterface))
- {
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub _stub = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub(
- new java.net.URL(AccessionMapperPort_address), this);
- _stub.setPortName(getAccessionMapperPortWSDDServiceName());
- return _stub;
- }
- } catch (java.lang.Throwable t)
- {
- throw new javax.xml.rpc.ServiceException(t);
- }
- throw new javax.xml.rpc.ServiceException(
- "There is no stub implementation for the interface: "
- + (serviceEndpointInterface == null ? "null"
- : serviceEndpointInterface.getName()));
- }
-
- /**
- * For the given interface, get the stub implementation. If this service has
- * no port for the given interface, then ServiceException is thrown.
- */
- public java.rmi.Remote getPort(javax.xml.namespace.QName portName,
- Class serviceEndpointInterface)
- throws javax.xml.rpc.ServiceException
- {
- if (portName == null)
- {
- return getPort(serviceEndpointInterface);
- }
- java.lang.String inputPortName = portName.getLocalPart();
- if ("AccessionMapperPort".equals(inputPortName))
- {
- return getAccessionMapperPort();
- }
- else
- {
- java.rmi.Remote _stub = getPort(serviceEndpointInterface);
- ((org.apache.axis.client.Stub) _stub).setPortName(portName);
- return _stub;
- }
- }
-
- public javax.xml.namespace.QName getServiceName()
- {
- return new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "AccessionMapperService");
- }
-
- private java.util.HashSet ports = null;
-
- public java.util.Iterator getPorts()
- {
- if (ports == null)
- {
- ports = new java.util.HashSet();
- ports.add(new javax.xml.namespace.QName(
- "http://www.ebi.ac.uk/picr/AccessionMappingService",
- "AccessionMapperPort"));
- }
- return ports.iterator();
- }
-
- /**
- * Set the endpoint address for the specified port name.
- */
- public void setEndpointAddress(java.lang.String portName,
- java.lang.String address) throws javax.xml.rpc.ServiceException
- {
- if ("AccessionMapperPort".equals(portName))
- {
- setAccessionMapperPortEndpointAddress(address);
- }
- else
- { // Unknown Port Name
- throw new javax.xml.rpc.ServiceException(
- " Cannot set Endpoint Address for Unknown Port" + portName);
- }
- }
-
- /**
- * Set the endpoint address for the specified port name.
- */
- public void setEndpointAddress(javax.xml.namespace.QName portName,
- java.lang.String address) throws javax.xml.rpc.ServiceException
- {
- setEndpointAddress(portName.getLocalPart(), address);
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package uk.ac.ebi.www.picr.AccessionMappingService;
+
+import jalview.util.MessageManager;
+
+public class AccessionMapperServiceLocator extends
+ org.apache.axis.client.Service implements
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperService
+{
+
+ public AccessionMapperServiceLocator()
+ {
+ }
+
+ public AccessionMapperServiceLocator(
+ org.apache.axis.EngineConfiguration config)
+ {
+ super(config);
+ }
+
+ // Use to get a proxy class for AccessionMapperPort
+ private java.lang.String AccessionMapperPort_address = "http://www.ebi.ac.uk:80/Tools/picr/service";
+
+ public java.lang.String getAccessionMapperPortAddress()
+ {
+ return AccessionMapperPort_address;
+ }
+
+ // The WSDD service name defaults to the port name.
+ private java.lang.String AccessionMapperPortWSDDServiceName = "AccessionMapperPort";
+
+ public java.lang.String getAccessionMapperPortWSDDServiceName()
+ {
+ return AccessionMapperPortWSDDServiceName;
+ }
+
+ public void setAccessionMapperPortWSDDServiceName(java.lang.String name)
+ {
+ AccessionMapperPortWSDDServiceName = name;
+ }
+
+ public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort()
+ throws javax.xml.rpc.ServiceException
+ {
+ java.net.URL endpoint;
+ try
+ {
+ endpoint = new java.net.URL(AccessionMapperPort_address);
+ } catch (java.net.MalformedURLException e)
+ {
+ throw new javax.xml.rpc.ServiceException(e);
+ }
+ return getAccessionMapperPort(endpoint);
+ }
+
+ public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort(
+ java.net.URL portAddress) throws javax.xml.rpc.ServiceException
+ {
+ try
+ {
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub _stub = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub(
+ portAddress, this);
+ _stub.setPortName(getAccessionMapperPortWSDDServiceName());
+ return _stub;
+ } catch (org.apache.axis.AxisFault e)
+ {
+ return null;
+ }
+ }
+
+ public void setAccessionMapperPortEndpointAddress(java.lang.String address)
+ {
+ AccessionMapperPort_address = address;
+ }
+
+ /**
+ * For the given interface, get the stub implementation. If this service has
+ * no port for the given interface, then ServiceException is thrown.
+ */
+ public java.rmi.Remote getPort(Class serviceEndpointInterface)
+ throws javax.xml.rpc.ServiceException
+ {
+ try
+ {
+ if (uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface.class
+ .isAssignableFrom(serviceEndpointInterface))
+ {
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub _stub = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub(
+ new java.net.URL(AccessionMapperPort_address), this);
+ _stub.setPortName(getAccessionMapperPortWSDDServiceName());
+ return _stub;
+ }
+ } catch (java.lang.Throwable t)
+ {
+ throw new javax.xml.rpc.ServiceException(t);
+ }
+ throw new javax.xml.rpc.ServiceException(MessageManager.formatMessage(
+ "exception.no_stub_implementation_for_interface",
+ new String[] { (serviceEndpointInterface == null ? "null"
+ : serviceEndpointInterface.getName()) }));
+ }
+
+ /**
+ * For the given interface, get the stub implementation. If this service has
+ * no port for the given interface, then ServiceException is thrown.
+ */
+ public java.rmi.Remote getPort(javax.xml.namespace.QName portName,
+ Class serviceEndpointInterface)
+ throws javax.xml.rpc.ServiceException
+ {
+ if (portName == null)
+ {
+ return getPort(serviceEndpointInterface);
+ }
+ java.lang.String inputPortName = portName.getLocalPart();
+ if ("AccessionMapperPort".equals(inputPortName))
+ {
+ return getAccessionMapperPort();
+ }
+ else
+ {
+ java.rmi.Remote _stub = getPort(serviceEndpointInterface);
+ ((org.apache.axis.client.Stub) _stub).setPortName(portName);
+ return _stub;
+ }
+ }
+
+ public javax.xml.namespace.QName getServiceName()
+ {
+ return new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "AccessionMapperService");
+ }
+
+ private java.util.HashSet ports = null;
+
+ public java.util.Iterator getPorts()
+ {
+ if (ports == null)
+ {
+ ports = new java.util.HashSet();
+ ports.add(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "AccessionMapperPort"));
+ }
+ return ports.iterator();
+ }
+
+ /**
+ * Set the endpoint address for the specified port name.
+ */
+ public void setEndpointAddress(java.lang.String portName,
+ java.lang.String address) throws javax.xml.rpc.ServiceException
+ {
+ if ("AccessionMapperPort".equals(portName))
+ {
+ setAccessionMapperPortEndpointAddress(address);
+ }
+ else
+ { // Unknown Port Name
+ throw new javax.xml.rpc.ServiceException(
+ MessageManager.formatMessage(
+ "exception.cannot_set_endpoint_address_unknown_port",
+ new String[] { portName }));
+ }
+ }
+
+ /**
+ * Set the endpoint address for the specified port name.
+ */
+ public void setEndpointAddress(javax.xml.namespace.QName portName,
+ java.lang.String address) throws javax.xml.rpc.ServiceException
+ {
+ setEndpointAddress(portName.getLocalPart(), address);
+ }
+
+}
diff --git a/src/vamsas/IMsaWS.java b/src/vamsas/IMsaWS.java
index 37eefad..1a5d92d 100644
--- a/src/vamsas/IMsaWS.java
+++ b/src/vamsas/IMsaWS.java
@@ -1,23 +1,29 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas;
-import vamsas.objects.simple.*;
+import vamsas.objects.simple.Alignment;
+import vamsas.objects.simple.MsaResult;
+import vamsas.objects.simple.SequenceSet;
+import vamsas.objects.simple.WsJobId;
public interface IMsaWS
{
diff --git a/src/vamsas/objects/simple/Alignment.java b/src/vamsas/objects/simple/Alignment.java
index 27d233d..7070015 100644
--- a/src/vamsas/objects/simple/Alignment.java
+++ b/src/vamsas/objects/simple/Alignment.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -100,15 +103,22 @@ public class Alignment extends vamsas.objects.simple.Object implements
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
+ if (obj == null)
+ {
+ return false;
+ }
if (!(obj instanceof Alignment))
+ {
return false;
+ }
Alignment other = (Alignment) obj;
- if (obj == null)
- return false;
if (this == obj)
+ {
return true;
+ }
if (__equalsCalc != null)
{
return (__equalsCalc == obj);
@@ -128,6 +138,7 @@ public class Alignment extends vamsas.objects.simple.Object implements
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/vamsas/objects/simple/Alignment_Helper.java b/src/vamsas/objects/simple/Alignment_Helper.java
index d525218..1e31e0b 100644
--- a/src/vamsas/objects/simple/Alignment_Helper.java
+++ b/src/vamsas/objects/simple/Alignment_Helper.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
diff --git a/src/vamsas/objects/simple/JpredResult.java b/src/vamsas/objects/simple/JpredResult.java
index 8c427cb..5e28795 100644
--- a/src/vamsas/objects/simple/JpredResult.java
+++ b/src/vamsas/objects/simple/JpredResult.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -76,17 +79,18 @@ public class JpredResult extends vamsas.objects.simple.Result implements
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof JpredResult))
+ if (obj == null)
{
return false;
}
- JpredResult other = (JpredResult) obj;
- if (obj == null)
+ if (!(obj instanceof JpredResult))
{
return false;
}
+ JpredResult other = (JpredResult) obj;
if (this == obj)
{
return true;
@@ -108,6 +112,7 @@ public class JpredResult extends vamsas.objects.simple.Result implements
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/vamsas/objects/simple/JpredResult_Helper.java b/src/vamsas/objects/simple/JpredResult_Helper.java
index 4270e55..36c65ee 100644
--- a/src/vamsas/objects/simple/JpredResult_Helper.java
+++ b/src/vamsas/objects/simple/JpredResult_Helper.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
diff --git a/src/vamsas/objects/simple/MsaResult.java b/src/vamsas/objects/simple/MsaResult.java
index cf5fdb0..06c9853 100644
--- a/src/vamsas/objects/simple/MsaResult.java
+++ b/src/vamsas/objects/simple/MsaResult.java
@@ -1,37 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -73,20 +58,20 @@ public class MsaResult extends vamsas.objects.simple.Result implements
this.msa = msa;
}
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof MsaResult))
+ if (obj == null)
{
return false;
}
-
- MsaResult other = (MsaResult) obj;
-
- if (obj == null)
+ if (!(obj instanceof MsaResult))
{
return false;
}
+ MsaResult other = (MsaResult) obj;
+
if (this == obj)
{
return true;
@@ -108,6 +93,7 @@ public class MsaResult extends vamsas.objects.simple.Result implements
return _equals;
}
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/vamsas/objects/simple/MsaResult_Helper.java b/src/vamsas/objects/simple/MsaResult_Helper.java
index 3205207..4a140b7 100644
--- a/src/vamsas/objects/simple/MsaResult_Helper.java
+++ b/src/vamsas/objects/simple/MsaResult_Helper.java
@@ -1,38 +1,24 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
+
package vamsas.objects.simple;
public class MsaResult_Helper
diff --git a/src/vamsas/objects/simple/Msfalignment.java b/src/vamsas/objects/simple/Msfalignment.java
index f36c6cc..39814f9 100644
--- a/src/vamsas/objects/simple/Msfalignment.java
+++ b/src/vamsas/objects/simple/Msfalignment.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -75,17 +78,18 @@ public class Msfalignment implements java.io.Serializable
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof Msfalignment))
+ if (obj == null)
{
return false;
}
- Msfalignment other = (Msfalignment) obj;
- if (obj == null)
+ if (!(obj instanceof Msfalignment))
{
return false;
}
+ Msfalignment other = (Msfalignment) obj;
if (this == obj)
{
return true;
@@ -107,6 +111,7 @@ public class Msfalignment implements java.io.Serializable
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/vamsas/objects/simple/Msfalignment_Helper.java b/src/vamsas/objects/simple/Msfalignment_Helper.java
index 7df1599..47dbd9c 100644
--- a/src/vamsas/objects/simple/Msfalignment_Helper.java
+++ b/src/vamsas/objects/simple/Msfalignment_Helper.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
diff --git a/src/vamsas/objects/simple/Object.java b/src/vamsas/objects/simple/Object.java
index 3520905..713db9b 100644
--- a/src/vamsas/objects/simple/Object.java
+++ b/src/vamsas/objects/simple/Object.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -26,15 +29,21 @@ public abstract class Object implements java.io.Serializable
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof Object))
- return false;
- Object other = (Object) obj;
if (obj == null)
+ {
return false;
+ }
+ if (!(obj instanceof Object))
+ {
+ return false;
+ }
if (this == obj)
+ {
return true;
+ }
if (__equalsCalc != null)
{
return (__equalsCalc == obj);
@@ -48,6 +57,7 @@ public abstract class Object implements java.io.Serializable
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/vamsas/objects/simple/Object_Helper.java b/src/vamsas/objects/simple/Object_Helper.java
index fab0138..0b81b50 100644
--- a/src/vamsas/objects/simple/Object_Helper.java
+++ b/src/vamsas/objects/simple/Object_Helper.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
diff --git a/src/vamsas/objects/simple/Result.java b/src/vamsas/objects/simple/Result.java
index 0f0e7e2..2361016 100644
--- a/src/vamsas/objects/simple/Result.java
+++ b/src/vamsas/objects/simple/Result.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -285,15 +288,22 @@ public class Result implements java.io.Serializable
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
+ if (obj == null)
+ {
+ return false;
+ }
if (!(obj instanceof Result))
+ {
return false;
+ }
Result other = (Result) obj;
- if (obj == null)
- return false;
if (this == obj)
+ {
return true;
+ }
if (__equalsCalc != null)
{
return (__equalsCalc == obj);
@@ -319,6 +329,7 @@ public class Result implements java.io.Serializable
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/vamsas/objects/simple/Result_Helper.java b/src/vamsas/objects/simple/Result_Helper.java
index ed2f541..6758287 100644
--- a/src/vamsas/objects/simple/Result_Helper.java
+++ b/src/vamsas/objects/simple/Result_Helper.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
diff --git a/src/vamsas/objects/simple/Secstructpred.java b/src/vamsas/objects/simple/Secstructpred.java
index 82332bd..ad7d67c 100644
--- a/src/vamsas/objects/simple/Secstructpred.java
+++ b/src/vamsas/objects/simple/Secstructpred.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -54,15 +57,15 @@ public class Secstructpred implements java.io.Serializable
public synchronized boolean equals(java.lang.Object obj)
{
- if (!(obj instanceof Secstructpred))
+ if (obj == null)
{
return false;
}
- Secstructpred other = (Secstructpred) obj;
- if (obj == null)
+ if (!(obj instanceof Secstructpred))
{
return false;
}
+ Secstructpred other = (Secstructpred) obj;
if (this == obj)
{
return true;
diff --git a/src/vamsas/objects/simple/Secstructpred_Helper.java b/src/vamsas/objects/simple/Secstructpred_Helper.java
index 63bf731..646eafa 100644
--- a/src/vamsas/objects/simple/Secstructpred_Helper.java
+++ b/src/vamsas/objects/simple/Secstructpred_Helper.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
diff --git a/src/vamsas/objects/simple/SeqSearchResult.java b/src/vamsas/objects/simple/SeqSearchResult.java
index 71084c0..7813607 100644
--- a/src/vamsas/objects/simple/SeqSearchResult.java
+++ b/src/vamsas/objects/simple/SeqSearchResult.java
@@ -1,185 +1,196 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package vamsas.objects.simple;
-
-public class SeqSearchResult extends vamsas.objects.simple.Result implements
- java.io.Serializable
-{
- private vamsas.objects.simple.Alignment alignment;
-
- private java.lang.String annotation;
-
- private java.lang.String features;
-
- private java.lang.String newickTree;
-
- public SeqSearchResult()
- {
- }
-
- public SeqSearchResult(vamsas.objects.simple.Alignment alignment,
- java.lang.String annotation, java.lang.String features,
- java.lang.String newickTree)
- {
- this.alignment = alignment;
- this.annotation = annotation;
- this.features = features;
- this.newickTree = newickTree;
- }
-
- /**
- * Gets the alignment value for this SeqSearchResult.
- *
- * @return alignment
- */
- public vamsas.objects.simple.Alignment getAlignment()
- {
- return alignment;
- }
-
- /**
- * Sets the alignment value for this SeqSearchResult.
- *
- * @param alignment
- */
- public void setAlignment(vamsas.objects.simple.Alignment alignment)
- {
- this.alignment = alignment;
- }
-
- /**
- * Gets the annotation value for this SeqSearchResult.
- *
- * @return annotation
- */
- public java.lang.String getAnnotation()
- {
- return annotation;
- }
-
- /**
- * Sets the annotation value for this SeqSearchResult.
- *
- * @param annotation
- */
- public void setAnnotation(java.lang.String annotation)
- {
- this.annotation = annotation;
- }
-
- /**
- * Gets the features value for this SeqSearchResult.
- *
- * @return features
- */
- public java.lang.String getFeatures()
- {
- return features;
- }
-
- /**
- * Sets the features value for this SeqSearchResult.
- *
- * @param features
- */
- public void setFeatures(java.lang.String features)
- {
- this.features = features;
- }
-
- /**
- * Gets the newickTree value for this SeqSearchResult.
- *
- * @return newickTree
- */
- public java.lang.String getNewickTree()
- {
- return newickTree;
- }
-
- /**
- * Sets the newickTree value for this SeqSearchResult.
- *
- * @param newickTree
- */
- public void setNewickTree(java.lang.String newickTree)
- {
- this.newickTree = newickTree;
- }
-
- private java.lang.Object __equalsCalc = null;
-
- public synchronized boolean equals(java.lang.Object obj)
- {
- if (!(obj instanceof SeqSearchResult))
- return false;
- SeqSearchResult other = (SeqSearchResult) obj;
- if (obj == null)
- return false;
- if (this == obj)
- return true;
- if (__equalsCalc != null)
- {
- return (__equalsCalc == obj);
- }
- __equalsCalc = obj;
- boolean _equals;
- _equals = super.equals(obj)
- && ((this.alignment == null && other.getAlignment() == null) || (this.alignment != null && this.alignment
- .equals(other.getAlignment())))
- && ((this.annotation == null && other.getAnnotation() == null) || (this.annotation != null && this.annotation
- .equals(other.getAnnotation())))
- && ((this.features == null && other.getFeatures() == null) || (this.features != null && this.features
- .equals(other.getFeatures())))
- && ((this.newickTree == null && other.getNewickTree() == null) || (this.newickTree != null && this.newickTree
- .equals(other.getNewickTree())));
- __equalsCalc = null;
- return _equals;
- }
-
- private boolean __hashCodeCalc = false;
-
- public synchronized int hashCode()
- {
- if (__hashCodeCalc)
- {
- return 0;
- }
- __hashCodeCalc = true;
- int _hashCode = super.hashCode();
- if (getAlignment() != null)
- {
- _hashCode += getAlignment().hashCode();
- }
- if (getAnnotation() != null)
- {
- _hashCode += getAnnotation().hashCode();
- }
- if (getFeatures() != null)
- {
- _hashCode += getFeatures().hashCode();
- }
- if (getNewickTree() != null)
- {
- _hashCode += getNewickTree().hashCode();
- }
- __hashCodeCalc = false;
- return _hashCode;
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package vamsas.objects.simple;
+
+public class SeqSearchResult extends vamsas.objects.simple.Result implements
+ java.io.Serializable
+{
+ private vamsas.objects.simple.Alignment alignment;
+
+ private java.lang.String annotation;
+
+ private java.lang.String features;
+
+ private java.lang.String newickTree;
+
+ public SeqSearchResult()
+ {
+ }
+
+ public SeqSearchResult(vamsas.objects.simple.Alignment alignment,
+ java.lang.String annotation, java.lang.String features,
+ java.lang.String newickTree)
+ {
+ this.alignment = alignment;
+ this.annotation = annotation;
+ this.features = features;
+ this.newickTree = newickTree;
+ }
+
+ /**
+ * Gets the alignment value for this SeqSearchResult.
+ *
+ * @return alignment
+ */
+ public vamsas.objects.simple.Alignment getAlignment()
+ {
+ return alignment;
+ }
+
+ /**
+ * Sets the alignment value for this SeqSearchResult.
+ *
+ * @param alignment
+ */
+ public void setAlignment(vamsas.objects.simple.Alignment alignment)
+ {
+ this.alignment = alignment;
+ }
+
+ /**
+ * Gets the annotation value for this SeqSearchResult.
+ *
+ * @return annotation
+ */
+ public java.lang.String getAnnotation()
+ {
+ return annotation;
+ }
+
+ /**
+ * Sets the annotation value for this SeqSearchResult.
+ *
+ * @param annotation
+ */
+ public void setAnnotation(java.lang.String annotation)
+ {
+ this.annotation = annotation;
+ }
+
+ /**
+ * Gets the features value for this SeqSearchResult.
+ *
+ * @return features
+ */
+ public java.lang.String getFeatures()
+ {
+ return features;
+ }
+
+ /**
+ * Sets the features value for this SeqSearchResult.
+ *
+ * @param features
+ */
+ public void setFeatures(java.lang.String features)
+ {
+ this.features = features;
+ }
+
+ /**
+ * Gets the newickTree value for this SeqSearchResult.
+ *
+ * @return newickTree
+ */
+ public java.lang.String getNewickTree()
+ {
+ return newickTree;
+ }
+
+ /**
+ * Sets the newickTree value for this SeqSearchResult.
+ *
+ * @param newickTree
+ */
+ public void setNewickTree(java.lang.String newickTree)
+ {
+ this.newickTree = newickTree;
+ }
+
+ private java.lang.Object __equalsCalc = null;
+
+ @Override
+ public synchronized boolean equals(java.lang.Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ if (!(obj instanceof SeqSearchResult))
+ {
+ return false;
+ }
+ SeqSearchResult other = (SeqSearchResult) obj;
+ if (this == obj)
+ {
+ return true;
+ }
+ if (__equalsCalc != null)
+ {
+ return (__equalsCalc == obj);
+ }
+ __equalsCalc = obj;
+ boolean _equals;
+ _equals = super.equals(obj)
+ && ((this.alignment == null && other.getAlignment() == null) || (this.alignment != null && this.alignment
+ .equals(other.getAlignment())))
+ && ((this.annotation == null && other.getAnnotation() == null) || (this.annotation != null && this.annotation
+ .equals(other.getAnnotation())))
+ && ((this.features == null && other.getFeatures() == null) || (this.features != null && this.features
+ .equals(other.getFeatures())))
+ && ((this.newickTree == null && other.getNewickTree() == null) || (this.newickTree != null && this.newickTree
+ .equals(other.getNewickTree())));
+ __equalsCalc = null;
+ return _equals;
+ }
+
+ private boolean __hashCodeCalc = false;
+
+ @Override
+ public synchronized int hashCode()
+ {
+ if (__hashCodeCalc)
+ {
+ return 0;
+ }
+ __hashCodeCalc = true;
+ int _hashCode = super.hashCode();
+ if (getAlignment() != null)
+ {
+ _hashCode += getAlignment().hashCode();
+ }
+ if (getAnnotation() != null)
+ {
+ _hashCode += getAnnotation().hashCode();
+ }
+ if (getFeatures() != null)
+ {
+ _hashCode += getFeatures().hashCode();
+ }
+ if (getNewickTree() != null)
+ {
+ _hashCode += getNewickTree().hashCode();
+ }
+ __hashCodeCalc = false;
+ return _hashCode;
+ }
+
+}
diff --git a/src/vamsas/objects/simple/SeqSearchResult_Helper.java b/src/vamsas/objects/simple/SeqSearchResult_Helper.java
index fb11db5..b5a112f 100644
--- a/src/vamsas/objects/simple/SeqSearchResult_Helper.java
+++ b/src/vamsas/objects/simple/SeqSearchResult_Helper.java
@@ -1,86 +1,89 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package vamsas.objects.simple;
-
-public class SeqSearchResult_Helper
-{
- // Type metadata
- private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
- SeqSearchResult.class, true);
-
- static
- {
- typeDesc.setXmlType(new javax.xml.namespace.QName(
- "simple.objects.vamsas", "SeqSearchResult"));
- org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("alignment");
- elemField.setXmlName(new javax.xml.namespace.QName("", "alignment"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "simple.objects.vamsas", "Alignment"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("annotation");
- elemField.setXmlName(new javax.xml.namespace.QName("", "annotation"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://schemas.xmlsoap.org/soap/encoding/", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("features");
- elemField.setXmlName(new javax.xml.namespace.QName("", "features"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://schemas.xmlsoap.org/soap/encoding/", "string"));
- typeDesc.addFieldDesc(elemField);
- elemField = new org.apache.axis.description.ElementDesc();
- elemField.setFieldName("newickTree");
- elemField.setXmlName(new javax.xml.namespace.QName("", "newickTree"));
- elemField.setXmlType(new javax.xml.namespace.QName(
- "http://schemas.xmlsoap.org/soap/encoding/", "string"));
- typeDesc.addFieldDesc(elemField);
- }
-
- /**
- * Return type metadata object
- */
- public static org.apache.axis.description.TypeDesc getTypeDesc()
- {
- return typeDesc;
- }
-
- /**
- * Get Custom Serializer
- */
- public static org.apache.axis.encoding.Serializer getSerializer(
- java.lang.String mechType, java.lang.Class _javaType,
- javax.xml.namespace.QName _xmlType)
- {
- return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,
- _xmlType, typeDesc);
- }
-
- /**
- * Get Custom Deserializer
- */
- public static org.apache.axis.encoding.Deserializer getDeserializer(
- java.lang.String mechType, java.lang.Class _javaType,
- javax.xml.namespace.QName _xmlType)
- {
- return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,
- _xmlType, typeDesc);
- }
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package vamsas.objects.simple;
+
+public class SeqSearchResult_Helper
+{
+ // Type metadata
+ private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
+ SeqSearchResult.class, true);
+
+ static
+ {
+ typeDesc.setXmlType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "SeqSearchResult"));
+ org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("alignment");
+ elemField.setXmlName(new javax.xml.namespace.QName("", "alignment"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "Alignment"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("annotation");
+ elemField.setXmlName(new javax.xml.namespace.QName("", "annotation"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("features");
+ elemField.setXmlName(new javax.xml.namespace.QName("", "features"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("newickTree");
+ elemField.setXmlName(new javax.xml.namespace.QName("", "newickTree"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"));
+ typeDesc.addFieldDesc(elemField);
+ }
+
+ /**
+ * Return type metadata object
+ */
+ public static org.apache.axis.description.TypeDesc getTypeDesc()
+ {
+ return typeDesc;
+ }
+
+ /**
+ * Get Custom Serializer
+ */
+ public static org.apache.axis.encoding.Serializer getSerializer(
+ java.lang.String mechType, java.lang.Class _javaType,
+ javax.xml.namespace.QName _xmlType)
+ {
+ return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,
+ _xmlType, typeDesc);
+ }
+
+ /**
+ * Get Custom Deserializer
+ */
+ public static org.apache.axis.encoding.Deserializer getDeserializer(
+ java.lang.String mechType, java.lang.Class _javaType,
+ javax.xml.namespace.QName _xmlType)
+ {
+ return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,
+ _xmlType, typeDesc);
+ }
+
+}
diff --git a/src/vamsas/objects/simple/Sequence.java b/src/vamsas/objects/simple/Sequence.java
index ac44b66..0943dce 100644
--- a/src/vamsas/objects/simple/Sequence.java
+++ b/src/vamsas/objects/simple/Sequence.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -75,15 +78,22 @@ public class Sequence implements java.io.Serializable
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
+ if (obj == null)
+ {
+ return false;
+ }
if (!(obj instanceof Sequence))
+ {
return false;
+ }
Sequence other = (Sequence) obj;
- if (obj == null)
- return false;
if (this == obj)
+ {
return true;
+ }
if (__equalsCalc != null)
{
return (__equalsCalc == obj);
@@ -101,6 +111,7 @@ public class Sequence implements java.io.Serializable
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/vamsas/objects/simple/SequenceSet.java b/src/vamsas/objects/simple/SequenceSet.java
index dc866f4..9f024bc 100644
--- a/src/vamsas/objects/simple/SequenceSet.java
+++ b/src/vamsas/objects/simple/SequenceSet.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -52,15 +55,22 @@ public class SequenceSet implements java.io.Serializable
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
+ if (obj == null)
+ {
+ return false;
+ }
if (!(obj instanceof SequenceSet))
+ {
return false;
+ }
SequenceSet other = (SequenceSet) obj;
- if (obj == null)
- return false;
if (this == obj)
+ {
return true;
+ }
if (__equalsCalc != null)
{
return (__equalsCalc == obj);
@@ -75,6 +85,7 @@ public class SequenceSet implements java.io.Serializable
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/vamsas/objects/simple/SequenceSet_Helper.java b/src/vamsas/objects/simple/SequenceSet_Helper.java
index c8aef7f..59badf3 100644
--- a/src/vamsas/objects/simple/SequenceSet_Helper.java
+++ b/src/vamsas/objects/simple/SequenceSet_Helper.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
diff --git a/src/vamsas/objects/simple/Sequence_Helper.java b/src/vamsas/objects/simple/Sequence_Helper.java
index 82a7e4b..2f24b7b 100644
--- a/src/vamsas/objects/simple/Sequence_Helper.java
+++ b/src/vamsas/objects/simple/Sequence_Helper.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
diff --git a/src/vamsas/objects/simple/WsJobId.java b/src/vamsas/objects/simple/WsJobId.java
index 7e44a42..3efaf36 100644
--- a/src/vamsas/objects/simple/WsJobId.java
+++ b/src/vamsas/objects/simple/WsJobId.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
@@ -75,15 +78,22 @@ public class WsJobId implements java.io.Serializable
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
+ if (obj == null)
+ {
+ return false;
+ }
if (!(obj instanceof WsJobId))
+ {
return false;
+ }
WsJobId other = (WsJobId) obj;
- if (obj == null)
- return false;
if (this == obj)
+ {
return true;
+ }
if (__equalsCalc != null)
{
return (__equalsCalc == obj);
@@ -100,6 +110,7 @@ public class WsJobId implements java.io.Serializable
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
diff --git a/src/vamsas/objects/simple/WsJobId_Helper.java b/src/vamsas/objects/simple/WsJobId_Helper.java
index 3444b8d..4fa1555 100644
--- a/src/vamsas/objects/simple/WsJobId_Helper.java
+++ b/src/vamsas/objects/simple/WsJobId_Helper.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package vamsas.objects.simple;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jalview.git
More information about the pkg-java-commits
mailing list